From c1b0aff26ae066819ed44179b8e4107ab6681b79 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 12 Jul 2018 18:20:37 +0200 Subject: [PATCH 0001/1045] ethereumProvider interface implemented --- .../web3-core-requestmanager/package.json | 3 +- .../web3-core-requestmanager/src/index.js | 12 ++-- packages/web3-providers-ethereum/README.md | 38 ++++++++++++ packages/web3-providers-ethereum/package.json | 11 ++++ packages/web3-providers-ethereum/src/index.js | 61 +++++++++++++++++++ 5 files changed, 119 insertions(+), 6 deletions(-) create mode 100644 packages/web3-providers-ethereum/README.md create mode 100644 packages/web3-providers-ethereum/package.json create mode 100644 packages/web3-providers-ethereum/src/index.js diff --git a/packages/web3-core-requestmanager/package.json b/packages/web3-core-requestmanager/package.json index 8414dc17b0b..067d0b5647f 100644 --- a/packages/web3-core-requestmanager/package.json +++ b/packages/web3-core-requestmanager/package.json @@ -11,6 +11,7 @@ "web3-core-helpers": "1.0.0-beta.34", "web3-providers-http": "1.0.0-beta.34", "web3-providers-ipc": "1.0.0-beta.34", - "web3-providers-ws": "1.0.0-beta.34" + "web3-providers-ws": "1.0.0-beta.34", + "web3-providers-ethereum": "1.0.0-beta.34" } } diff --git a/packages/web3-core-requestmanager/src/index.js b/packages/web3-core-requestmanager/src/index.js index 4fc48d493c7..b97469d3534 100644 --- a/packages/web3-core-requestmanager/src/index.js +++ b/packages/web3-core-requestmanager/src/index.js @@ -52,7 +52,8 @@ RequestManager.givenProvider = givenProvider; RequestManager.providers = { WebsocketProvider: require('web3-providers-ws'), HttpProvider: require('web3-providers-http'), - IpcProvider: require('web3-providers-ipc') + IpcProvider: require('web3-providers-ipc'), + EthereumProvider: require('web3-providers-ethereum') }; @@ -73,11 +74,11 @@ RequestManager.prototype.setProvider = function (p, net) { if(/^http(s)?:\/\//i.test(p)) { p = new this.providers.HttpProvider(p); - // WS + // WS } else if(/^ws(s)?:\/\//i.test(p)) { p = new this.providers.WebsocketProvider(p); - // IPC + // IPC } else if(p && typeof net === 'object' && typeof net.connect === 'function') { p = new this.providers.IpcProvider(p, net); @@ -86,10 +87,11 @@ RequestManager.prototype.setProvider = function (p, net) { } } + // reset the old one before changing, if still connected - if(this.provider && this.provider.connected) + if(this.provider && this.provider.connected) { this.clearSubscriptions(); - + } this.provider = p || null; diff --git a/packages/web3-providers-ethereum/README.md b/packages/web3-providers-ethereum/README.md new file mode 100644 index 00000000000..f7f5fa9326b --- /dev/null +++ b/packages/web3-providers-ethereum/README.md @@ -0,0 +1,38 @@ +# web3-providers-http + +*This is a sub package of [web3.js][repo]* + +This is a Ethereum provider for [web3.js][repo]. +Please read the [documentation][docs] for more. + +## Installation + +### Node.js + +```bash +npm install web3-providers-ethereum +``` + +### In the Browser + +Build running the following in the [web3.js][repo] repository: + +```bash +npm run-script build-all +``` + +Then include `dist/web3-providers-http.js` in your html file. +This will expose the `Web3HttpProvider` object on the window object. + + +## Usage + +```js +// TODO: Create example +``` + + +[docs]: http://web3js.readthedocs.io/en/1.0/ +[repo]: https://github.com/ethereum/web3.js + + diff --git a/packages/web3-providers-ethereum/package.json b/packages/web3-providers-ethereum/package.json new file mode 100644 index 00000000000..4817bbe813c --- /dev/null +++ b/packages/web3-providers-ethereum/package.json @@ -0,0 +1,11 @@ +{ + "name": "web3-providers-ethereum", + "namespace": "ethereum", + "version": "1.0.0-beta.34", + "description": "Module to handle web3 RPC connections over the ethereumProvider.", + "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-providers-ethereum", + "license": "LGPL-3.0", + "main": "src/index.js", + "dependencies": { + } +} diff --git a/packages/web3-providers-ethereum/src/index.js b/packages/web3-providers-ethereum/src/index.js new file mode 100644 index 00000000000..3dc751922aa --- /dev/null +++ b/packages/web3-providers-ethereum/src/index.js @@ -0,0 +1,61 @@ +/* + 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 . +*/ +/** @file ethereumprovider.js + * @authors: Samuel Furter + * @date 2018 + */ + +var EventEmitter = require('eventemitter3'); + +/** + * EthereumProvider should be used to send rpc calls + */ +var EthereumProvider = function EthereumProvider(provider) { + this.provider = provider; +}; + +/** + * @method send + * @param {string} method + * @param {Array} params + * @returns {Promise} + */ +EthereumProvider.prototype.send = function (method, params) { + +}; + +/** + * @param {string} subscriptionType + * @param {Array} params + * @returns {Promise} + */ +EthereumProvider.prototype.subscribe = function (subscriptionType, params) { + +}; + +/** + * @param {string} subscriptionId + * @returns {Promise} + */ +EthereumProvider.prototype.unsubscribe = function (subscriptionId) { + +}; + +// Extends ethereumProvider with EventEmitter +EthereumProvider.prototype = new EventEmitter(); + +module.exports = EthereumProvider; From 0312696484f798ff8455e5e463dd751142f77c5b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 21 Aug 2018 13:46:19 +0200 Subject: [PATCH 0002/1045] first POC for the ethereum provider implementation --- .../web3-core-requestmanager/src/index.js | 2 +- packages/web3-provider/src/Web3Provider.js | 0 .../src/adapters/EthereumProviderAdapter.js | 50 +++++++++++++++++ .../src/adapters/HttpProviderAdapter.js | 54 +++++++++++++++++++ .../src/adapters/IPCProviderAdapter.js | 52 ++++++++++++++++++ .../src/adapters/WebsocketProviderAdapter.js | 52 ++++++++++++++++++ .../src/resolver/ProviderAdapterResolver.js | 33 ++++++++++++ 7 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 packages/web3-provider/src/Web3Provider.js create mode 100644 packages/web3-provider/src/adapters/EthereumProviderAdapter.js create mode 100644 packages/web3-provider/src/adapters/HttpProviderAdapter.js create mode 100644 packages/web3-provider/src/adapters/IPCProviderAdapter.js create mode 100644 packages/web3-provider/src/adapters/WebsocketProviderAdapter.js create mode 100644 packages/web3-provider/src/resolver/ProviderAdapterResolver.js diff --git a/packages/web3-core-requestmanager/src/index.js b/packages/web3-core-requestmanager/src/index.js index b97469d3534..35d56b57bf9 100644 --- a/packages/web3-core-requestmanager/src/index.js +++ b/packages/web3-core-requestmanager/src/index.js @@ -89,7 +89,7 @@ RequestManager.prototype.setProvider = function (p, net) { // reset the old one before changing, if still connected - if(this.provider && this.provider.connected) { + if(this.provider && this.provider.connected) { //TODO: change connected to isConnected this.clearSubscriptions(); } diff --git a/packages/web3-provider/src/Web3Provider.js b/packages/web3-provider/src/Web3Provider.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/web3-provider/src/adapters/EthereumProviderAdapter.js b/packages/web3-provider/src/adapters/EthereumProviderAdapter.js new file mode 100644 index 00000000000..4fc1296cb92 --- /dev/null +++ b/packages/web3-provider/src/adapters/EthereumProviderAdapter.js @@ -0,0 +1,50 @@ + +/** + * @param {EthereumProvider} ethereumProvider + * @constructor + */ +function EthereumProviderAdapter (ethereumProvider) { + this.provider = ethereumProvider; +} + +/** + * @param {string} method + * @param {Array} parameters + * @returns {Promise} + */ +EthereumProviderAdapter.send = function (method, parameters) { + return this.provider.send(method, parameters); +}; + +/** + * @param {string} subscriptionType + * @param {Array} parameters + * @returns {Promise} + */ +EthereumProviderAdapter.subscribe = function (subscriptionType, parameters) { + return this.provider.subscribe(subscriptionType, parameters); +}; + +/** + * @param {string} subscriptionId + * @returns {Promise} + */ +EthereumProviderAdapter.unsubscribe = function (subscriptionId) { + return this.provider.unsubscribe(subscriptionId); +}; + +/** + * @returns {*} //TODO: define return value + */ +EthereumProviderAdapter.isConnected = function () { + return this.provider.isConnected(); +}; + +/** + * @param {Object} payload + * @param {function} callback + * @returns {Promise} + */ +EthereumProviderAdapter.sendAync = function (payload, callback) { + return this.provider.sendAsync(); // TODO: Check if this is necessary +}; diff --git a/packages/web3-provider/src/adapters/HttpProviderAdapter.js b/packages/web3-provider/src/adapters/HttpProviderAdapter.js new file mode 100644 index 00000000000..fe53f1dbcf7 --- /dev/null +++ b/packages/web3-provider/src/adapters/HttpProviderAdapter.js @@ -0,0 +1,54 @@ +var Jsonrpc = require('./jsonrpc.js'); //TODO: Fix import + +// TODO: Methods should have the same behavior like the EthereumProvider. +/** + * @param {HttpProvider} httpProvider + * @constructor + */ +function HttpProviderAdapter (httpProvider) { + this.provider = httpProvider; +} + +/** + * @param {string} method + * @param {Array} parameters + * @returns {Promise} + */ +HttpProviderAdapter.send = function (method, parameters) { + return new Promise(function(resolve, reject) { + this.provider.send(Jsonrpc.toPayload(method, parameters), function(result, error) { + if(!error) { + resolve(result); + return; + } + + reject(error); + }); + + }); +}; + +/** + * @returns {Promise} + */ +HttpProviderAdapter.subscribe = function () { + return new Promise(function(resolve, reject) { + reject(new Error('HTTP does not support subscriptions')); + }); +}; + +/** + * @returns {Promise} + */ +HttpProviderAdapter.unsubscribe = function () { + return new Promise(function(resolve, reject) { + reject(new Error('HTTP does not support subscriptions')); + }); +}; + +/** + * @returns {boolean} + */ +HttpProviderAdapter.isConnected = function () { + return this.provider.connected; +}; diff --git a/packages/web3-provider/src/adapters/IPCProviderAdapter.js b/packages/web3-provider/src/adapters/IPCProviderAdapter.js new file mode 100644 index 00000000000..c0fbcd4e44b --- /dev/null +++ b/packages/web3-provider/src/adapters/IPCProviderAdapter.js @@ -0,0 +1,52 @@ + + +// TODO: Methods should have the same behavior like the EthereumProvider. +/** + * @param {IPCProvider} ipcProvider + * @constructor + */ +function IPCProviderAdapter (ipcProvider) { + this.provider = ipcProvider; +} + +/** + * @param {string} method + * @param {Array} parameters + * @returns {Promise} + */ +IPCProviderAdapter.send = function (method, parameters) { + return this.provider.send(method, parameters); +}; + +/** + * @param {string} subscriptionType + * @param {Array} parameters + * @returns {Promise} + */ +IPCProviderAdapter.subscribe = function (subscriptionType, parameters) { + return this.provider.subscribe(subscriptionType, parameters); +}; + +/** + * @param {string} subscriptionId + * @returns {Promise} + */ +IPCProviderAdapter.unsubscribe = function (subscriptionId) { + return this.provider.unsubscribe(subscriptionId); +}; + +/** + * @returns {*} //TODO: define return value + */ +IPCProviderAdapter.isConnected = function () { + return this.provider.isConnected(); +}; + +/** + * @param {Object} payload + * @param {function} callback + * @returns {Promise} + */ +IPCProviderAdapter.sendAync = function (payload, callback) { + return this.provider.sendAsync(); // TODO: Check if this is necessary +}; diff --git a/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js b/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js new file mode 100644 index 00000000000..b82d0ed2369 --- /dev/null +++ b/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js @@ -0,0 +1,52 @@ + + +// TODO: Methods should have the same behavior like the EthereumProvider. +/** + * @param {WebsocketProvider} websocketProvider + * @constructor + */ +function WebsocketProviderAdapter (websocketProvider) { + this.provider = websocketProvider; +} + +/** + * @param {string} method + * @param {Array} parameters + * @returns {Promise} + */ +WebsocketProviderAdapter.send = function (method, parameters) { + return this.provider.send(method, parameters); +}; + +/** + * @param {string} subscriptionType + * @param {Array} parameters + * @returns {Promise} + */ +WebsocketProviderAdapter.subscribe = function (subscriptionType, parameters) { + return this.provider.subscribe(subscriptionType, parameters); +}; + +/** + * @param {string} subscriptionId + * @returns {Promise} + */ +WebsocketProviderAdapter.unsubscribe = function (subscriptionId) { + return this.provider.unsubscribe(subscriptionId); +}; + +/** + * @returns {*} //TODO: define return value + */ +WebsocketProviderAdapter.isConnected = function () { + return this.provider.isConnected(); +}; + +/** + * @param {Object} payload + * @param {function} callback + * @returns {Promise} + */ +WebsocketProviderAdapter.sendAync = function (payload, callback) { + return this.provider.sendAsync(); // TODO: Check if this is necessary +}; diff --git a/packages/web3-provider/src/resolver/ProviderAdapterResolver.js b/packages/web3-provider/src/resolver/ProviderAdapterResolver.js new file mode 100644 index 00000000000..c33ea1c771e --- /dev/null +++ b/packages/web3-provider/src/resolver/ProviderAdapterResolver.js @@ -0,0 +1,33 @@ + +function ProviderAdapterResolver (provider) { + this.providerAdapter = this.resolveProvider(provider); +} + + +ProviderAdapterResolver.prototype.resolveProvider = function () { + // Check if http ws ipc or ethereum provider + // Instantiate the correct provider and set it to this.provider + // autodetect provider + // if(p && typeof p === 'string' && this.providers) { + // + // // HTTP + // if(/^http(s)?:\/\//i.test(p)) { + // p = new this.providers.HttpProvider(p); + // + // // WS + // } else if(/^ws(s)?:\/\//i.test(p)) { + // p = new this.providers.WebsocketProvider(p); + // + // // IPC + // } else if(p && typeof net === 'object' && typeof net.connect === 'function') { + // p = new this.providers.IpcProvider(p, net); + // + // } else if(p) { + // throw new Error('Can\'t autodetect provider for "'+ p +'"'); + // } + // } +}; + +ProviderAdapterResolver.prototype.getProvider = function () { + return this.provider; +}; From abd010702d5420bcba3a56e583640fd059e4973e Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 21 Aug 2018 13:46:50 +0200 Subject: [PATCH 0003/1045] unsused files removed --- packages/web3-providers-ethereum/README.md | 38 ------------ packages/web3-providers-ethereum/package.json | 11 ---- packages/web3-providers-ethereum/src/index.js | 61 ------------------- 3 files changed, 110 deletions(-) delete mode 100644 packages/web3-providers-ethereum/README.md delete mode 100644 packages/web3-providers-ethereum/package.json delete mode 100644 packages/web3-providers-ethereum/src/index.js diff --git a/packages/web3-providers-ethereum/README.md b/packages/web3-providers-ethereum/README.md deleted file mode 100644 index f7f5fa9326b..00000000000 --- a/packages/web3-providers-ethereum/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# web3-providers-http - -*This is a sub package of [web3.js][repo]* - -This is a Ethereum provider for [web3.js][repo]. -Please read the [documentation][docs] for more. - -## Installation - -### Node.js - -```bash -npm install web3-providers-ethereum -``` - -### In the Browser - -Build running the following in the [web3.js][repo] repository: - -```bash -npm run-script build-all -``` - -Then include `dist/web3-providers-http.js` in your html file. -This will expose the `Web3HttpProvider` object on the window object. - - -## Usage - -```js -// TODO: Create example -``` - - -[docs]: http://web3js.readthedocs.io/en/1.0/ -[repo]: https://github.com/ethereum/web3.js - - diff --git a/packages/web3-providers-ethereum/package.json b/packages/web3-providers-ethereum/package.json deleted file mode 100644 index 4817bbe813c..00000000000 --- a/packages/web3-providers-ethereum/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "web3-providers-ethereum", - "namespace": "ethereum", - "version": "1.0.0-beta.34", - "description": "Module to handle web3 RPC connections over the ethereumProvider.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-providers-ethereum", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - } -} diff --git a/packages/web3-providers-ethereum/src/index.js b/packages/web3-providers-ethereum/src/index.js deleted file mode 100644 index 3dc751922aa..00000000000 --- a/packages/web3-providers-ethereum/src/index.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - 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 . -*/ -/** @file ethereumprovider.js - * @authors: Samuel Furter - * @date 2018 - */ - -var EventEmitter = require('eventemitter3'); - -/** - * EthereumProvider should be used to send rpc calls - */ -var EthereumProvider = function EthereumProvider(provider) { - this.provider = provider; -}; - -/** - * @method send - * @param {string} method - * @param {Array} params - * @returns {Promise} - */ -EthereumProvider.prototype.send = function (method, params) { - -}; - -/** - * @param {string} subscriptionType - * @param {Array} params - * @returns {Promise} - */ -EthereumProvider.prototype.subscribe = function (subscriptionType, params) { - -}; - -/** - * @param {string} subscriptionId - * @returns {Promise} - */ -EthereumProvider.prototype.unsubscribe = function (subscriptionId) { - -}; - -// Extends ethereumProvider with EventEmitter -EthereumProvider.prototype = new EventEmitter(); - -module.exports = EthereumProvider; From e8cbfa7326086eab0d4049da48ad63b22bed8350 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 21 Aug 2018 13:49:00 +0200 Subject: [PATCH 0004/1045] sendAsync removed from provider adapters --- .../src/adapters/EthereumProviderAdapter.js | 9 --------- .../web3-provider/src/adapters/IPCProviderAdapter.js | 9 --------- .../src/adapters/WebsocketProviderAdapter.js | 9 --------- 3 files changed, 27 deletions(-) diff --git a/packages/web3-provider/src/adapters/EthereumProviderAdapter.js b/packages/web3-provider/src/adapters/EthereumProviderAdapter.js index 4fc1296cb92..594de196c9c 100644 --- a/packages/web3-provider/src/adapters/EthereumProviderAdapter.js +++ b/packages/web3-provider/src/adapters/EthereumProviderAdapter.js @@ -39,12 +39,3 @@ EthereumProviderAdapter.unsubscribe = function (subscriptionId) { EthereumProviderAdapter.isConnected = function () { return this.provider.isConnected(); }; - -/** - * @param {Object} payload - * @param {function} callback - * @returns {Promise} - */ -EthereumProviderAdapter.sendAync = function (payload, callback) { - return this.provider.sendAsync(); // TODO: Check if this is necessary -}; diff --git a/packages/web3-provider/src/adapters/IPCProviderAdapter.js b/packages/web3-provider/src/adapters/IPCProviderAdapter.js index c0fbcd4e44b..01c43d6b9c5 100644 --- a/packages/web3-provider/src/adapters/IPCProviderAdapter.js +++ b/packages/web3-provider/src/adapters/IPCProviderAdapter.js @@ -41,12 +41,3 @@ IPCProviderAdapter.unsubscribe = function (subscriptionId) { IPCProviderAdapter.isConnected = function () { return this.provider.isConnected(); }; - -/** - * @param {Object} payload - * @param {function} callback - * @returns {Promise} - */ -IPCProviderAdapter.sendAync = function (payload, callback) { - return this.provider.sendAsync(); // TODO: Check if this is necessary -}; diff --git a/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js b/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js index b82d0ed2369..9a5f05a0009 100644 --- a/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js @@ -41,12 +41,3 @@ WebsocketProviderAdapter.unsubscribe = function (subscriptionId) { WebsocketProviderAdapter.isConnected = function () { return this.provider.isConnected(); }; - -/** - * @param {Object} payload - * @param {function} callback - * @returns {Promise} - */ -WebsocketProviderAdapter.sendAync = function (payload, callback) { - return this.provider.sendAsync(); // TODO: Check if this is necessary -}; From fd84a49b2c5add0abe0833100f08b148402c6a51 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 12:58:55 +0200 Subject: [PATCH 0005/1045] SocketProviderAdapter created and code style improved --- .../web3-core-requestmanager/src/index.js | 2 +- .../src/adapters/EthereumProviderAdapter.js | 31 ++- .../src/adapters/HttpProviderAdapter.js | 36 +++- .../src/adapters/IPCProviderAdapter.js | 43 ---- .../src/adapters/SocketProviderAdapter.js | 78 +++++++ .../src/adapters/WebsocketProviderAdapter.js | 43 ---- .../src/resolver/ProviderAdapterResolver.js | 4 +- packages/web3-providers-ipc/src/index.js | 200 +++++++++--------- 8 files changed, 243 insertions(+), 194 deletions(-) delete mode 100644 packages/web3-provider/src/adapters/IPCProviderAdapter.js create mode 100644 packages/web3-provider/src/adapters/SocketProviderAdapter.js delete mode 100644 packages/web3-provider/src/adapters/WebsocketProviderAdapter.js diff --git a/packages/web3-core-requestmanager/src/index.js b/packages/web3-core-requestmanager/src/index.js index 35d56b57bf9..0aeec34e16c 100644 --- a/packages/web3-core-requestmanager/src/index.js +++ b/packages/web3-core-requestmanager/src/index.js @@ -89,7 +89,7 @@ RequestManager.prototype.setProvider = function (p, net) { // reset the old one before changing, if still connected - if(this.provider && this.provider.connected) { //TODO: change connected to isConnected + if(this.provider && this.provider.isConnected()) { this.clearSubscriptions(); } diff --git a/packages/web3-provider/src/adapters/EthereumProviderAdapter.js b/packages/web3-provider/src/adapters/EthereumProviderAdapter.js index 594de196c9c..05c16d07b28 100644 --- a/packages/web3-provider/src/adapters/EthereumProviderAdapter.js +++ b/packages/web3-provider/src/adapters/EthereumProviderAdapter.js @@ -1,3 +1,26 @@ +/* + 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 . +*/ +/** + * @file EthereumProviderAdapter.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; /** * @param {EthereumProvider} ethereumProvider @@ -12,7 +35,7 @@ function EthereumProviderAdapter (ethereumProvider) { * @param {Array} parameters * @returns {Promise} */ -EthereumProviderAdapter.send = function (method, parameters) { +EthereumProviderAdapter.prototype.send = function (method, parameters) { return this.provider.send(method, parameters); }; @@ -21,7 +44,7 @@ EthereumProviderAdapter.send = function (method, parameters) { * @param {Array} parameters * @returns {Promise} */ -EthereumProviderAdapter.subscribe = function (subscriptionType, parameters) { +EthereumProviderAdapter.prototype.subscribe = function (subscriptionType, parameters) { return this.provider.subscribe(subscriptionType, parameters); }; @@ -29,13 +52,13 @@ EthereumProviderAdapter.subscribe = function (subscriptionType, parameters) { * @param {string} subscriptionId * @returns {Promise} */ -EthereumProviderAdapter.unsubscribe = function (subscriptionId) { +EthereumProviderAdapter.prototype.unsubscribe = function (subscriptionId) { return this.provider.unsubscribe(subscriptionId); }; /** * @returns {*} //TODO: define return value */ -EthereumProviderAdapter.isConnected = function () { +EthereumProviderAdapter.prototype.isConnected = function () { return this.provider.isConnected(); }; diff --git a/packages/web3-provider/src/adapters/HttpProviderAdapter.js b/packages/web3-provider/src/adapters/HttpProviderAdapter.js index fe53f1dbcf7..4edeb613cfd 100644 --- a/packages/web3-provider/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-provider/src/adapters/HttpProviderAdapter.js @@ -1,3 +1,27 @@ +/* + 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 . +*/ +/** + * @file HttpProviderAdapter.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + var Jsonrpc = require('./jsonrpc.js'); //TODO: Fix import // TODO: Methods should have the same behavior like the EthereumProvider. @@ -14,15 +38,17 @@ function HttpProviderAdapter (httpProvider) { * @param {Array} parameters * @returns {Promise} */ -HttpProviderAdapter.send = function (method, parameters) { +HttpProviderAdapter.prototype.send = function (method, parameters) { return new Promise(function(resolve, reject) { this.provider.send(Jsonrpc.toPayload(method, parameters), function(result, error) { if(!error) { resolve(result); + this.emit('data', result); return; } reject(error); + this.emit('error', error); }); }); @@ -31,7 +57,7 @@ HttpProviderAdapter.send = function (method, parameters) { /** * @returns {Promise} */ -HttpProviderAdapter.subscribe = function () { +HttpProviderAdapter.prototype.subscribe = function () { return new Promise(function(resolve, reject) { reject(new Error('HTTP does not support subscriptions')); }); @@ -40,7 +66,7 @@ HttpProviderAdapter.subscribe = function () { /** * @returns {Promise} */ -HttpProviderAdapter.unsubscribe = function () { +HttpProviderAdapter.prototype.unsubscribe = function () { return new Promise(function(resolve, reject) { reject(new Error('HTTP does not support subscriptions')); }); @@ -49,6 +75,8 @@ HttpProviderAdapter.unsubscribe = function () { /** * @returns {boolean} */ -HttpProviderAdapter.isConnected = function () { +HttpProviderAdapter.prototype.isConnected = function () { return this.provider.connected; }; + +HttpProviderAdapter.prototype = new EventEmitter(); diff --git a/packages/web3-provider/src/adapters/IPCProviderAdapter.js b/packages/web3-provider/src/adapters/IPCProviderAdapter.js deleted file mode 100644 index 01c43d6b9c5..00000000000 --- a/packages/web3-provider/src/adapters/IPCProviderAdapter.js +++ /dev/null @@ -1,43 +0,0 @@ - - -// TODO: Methods should have the same behavior like the EthereumProvider. -/** - * @param {IPCProvider} ipcProvider - * @constructor - */ -function IPCProviderAdapter (ipcProvider) { - this.provider = ipcProvider; -} - -/** - * @param {string} method - * @param {Array} parameters - * @returns {Promise} - */ -IPCProviderAdapter.send = function (method, parameters) { - return this.provider.send(method, parameters); -}; - -/** - * @param {string} subscriptionType - * @param {Array} parameters - * @returns {Promise} - */ -IPCProviderAdapter.subscribe = function (subscriptionType, parameters) { - return this.provider.subscribe(subscriptionType, parameters); -}; - -/** - * @param {string} subscriptionId - * @returns {Promise} - */ -IPCProviderAdapter.unsubscribe = function (subscriptionId) { - return this.provider.unsubscribe(subscriptionId); -}; - -/** - * @returns {*} //TODO: define return value - */ -IPCProviderAdapter.isConnected = function () { - return this.provider.isConnected(); -}; diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js new file mode 100644 index 00000000000..944c85b7b1f --- /dev/null +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -0,0 +1,78 @@ + + +var EventEmitter = require('eventemitter3'); + +function SocketProviderAdapter (provider) { + this.provider = provider; + this.subscriptions = []; + this.registerSubscriptionListener(); +} + +/** + * @param {string} method + * @param {Array} parameters + * @returns {Promise} + */ +SocketProviderAdapter.prototype.send = function (method, parameters) { + return this.provider.send(method, parameters); +}; + +/** + * @param {string} subscriptionType + * @param {Array} parameters + * @returns {Promise} + */ +SocketProviderAdapter.prototype.subscribe = function (subscriptionType, parameters) { + return this.send('eth_subscribe', parameters.shift(subscriptionType)).then(function (error, subscriptionId) { + if (!error) { + this.subscriptions[subscriptionId]({subscriptionType: subscriptionType, type: 'eth'}); + + return subscriptionId; + } + + throw new Error('SUB ERROR'); + }); +}; + +/** + * Emits an event with the subscription id + */ +SocketProviderAdapter.prototype.registerSubscriptionListener = function () { + var self = this; + this.provider.on('data', function (result, deprecatedResult) { + result = result || deprecatedResult; // this is for possible old providers, which may had the error first handler + + // check for result.method, to prevent old providers errors to pass as result + if (result.method && self.subscriptions[result.params.subscription]) { + self.emit(result.params.subscription, result.params.result); + } + }); +}; + +/** + * @param {string} subscriptionId + * @returns {Promise} + */ +SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId) { + return this.send('eth_unsubscribe', [subscriptionId]).then(function (result) { + if (result) { + this.subscriptions = this.subscriptions.filter(function (subscription) { + return subscription !== subscriptionId; + }); + + return true; + } + + return false; + }); +}; + +/** + * @returns {boolean} + */ +SocketProviderAdapter.prototype.isConnected = function () { + return this.provider.connected; +}; + +SocketProviderAdapter.prototype = Object.create(EventEmitter.prototype); +SocketProviderAdapter.prototype.constructor = SocketProviderAdapter; diff --git a/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js b/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js deleted file mode 100644 index 9a5f05a0009..00000000000 --- a/packages/web3-provider/src/adapters/WebsocketProviderAdapter.js +++ /dev/null @@ -1,43 +0,0 @@ - - -// TODO: Methods should have the same behavior like the EthereumProvider. -/** - * @param {WebsocketProvider} websocketProvider - * @constructor - */ -function WebsocketProviderAdapter (websocketProvider) { - this.provider = websocketProvider; -} - -/** - * @param {string} method - * @param {Array} parameters - * @returns {Promise} - */ -WebsocketProviderAdapter.send = function (method, parameters) { - return this.provider.send(method, parameters); -}; - -/** - * @param {string} subscriptionType - * @param {Array} parameters - * @returns {Promise} - */ -WebsocketProviderAdapter.subscribe = function (subscriptionType, parameters) { - return this.provider.subscribe(subscriptionType, parameters); -}; - -/** - * @param {string} subscriptionId - * @returns {Promise} - */ -WebsocketProviderAdapter.unsubscribe = function (subscriptionId) { - return this.provider.unsubscribe(subscriptionId); -}; - -/** - * @returns {*} //TODO: define return value - */ -WebsocketProviderAdapter.isConnected = function () { - return this.provider.isConnected(); -}; diff --git a/packages/web3-provider/src/resolver/ProviderAdapterResolver.js b/packages/web3-provider/src/resolver/ProviderAdapterResolver.js index c33ea1c771e..1571b895ad2 100644 --- a/packages/web3-provider/src/resolver/ProviderAdapterResolver.js +++ b/packages/web3-provider/src/resolver/ProviderAdapterResolver.js @@ -14,11 +14,11 @@ ProviderAdapterResolver.prototype.resolveProvider = function () { // if(/^http(s)?:\/\//i.test(p)) { // p = new this.providers.HttpProvider(p); // - // // WS + // // WS // } else if(/^ws(s)?:\/\//i.test(p)) { // p = new this.providers.WebsocketProvider(p); // - // // IPC + // // IPC // } else if(p && typeof net === 'object' && typeof net.connect === 'function') { // p = new this.providers.IpcProvider(p, net); // diff --git a/packages/web3-providers-ipc/src/index.js b/packages/web3-providers-ipc/src/index.js index 8e8002bbfad..c14b4dcb98c 100644 --- a/packages/web3-providers-ipc/src/index.js +++ b/packages/web3-providers-ipc/src/index.js @@ -14,9 +14,9 @@ You should have received a copy of the GNU Lesser General Public License along with web3.js. If not, see . */ -/** @file index.js - * @authors: - * Fabian Vogelsteller +/** + * @file index.js + * @authors: Fabian Vogelsteller * @date 2017 */ @@ -27,6 +27,11 @@ var errors = require('web3-core-helpers').errors; var oboe = require('oboe'); +/** + * @param {string} path + * @param {Net} net + * @constructor + */ var IpcProvider = function IpcProvider(path, net) { var _this = this; this.responseCallbacks = {}; @@ -39,15 +44,15 @@ var IpcProvider = function IpcProvider(path, net) { this.addDefaultEvents(); // LISTEN FOR CONNECTION RESPONSES - var callback = function(result) { + var callback = function (result) { /*jshint maxcomplexity: 6 */ var id = null; // get the id which matches the returned id - if(_.isArray(result)) { - result.forEach(function(load){ - if(_this.responseCallbacks[load.id]) + if (_.isArray(result)) { + result.forEach(function (load) { + if (_this.responseCallbacks[load.id]) id = load.id; }); } else { @@ -55,14 +60,14 @@ var IpcProvider = function IpcProvider(path, net) { } // notification - if(!id && result.method.indexOf('_subscription') !== -1) { - _this.notificationCallbacks.forEach(function(callback){ - if(_.isFunction(callback)) + if (!id && result.method.indexOf('_subscription') !== -1) { + _this.notificationCallbacks.forEach(function (callback) { + if (_.isFunction(callback)) callback(result); }); // fire the callback - } else if(_this.responseCallbacks[id]) { + } else if (_this.responseCallbacks[id]) { _this.responseCallbacks[id](null, result); delete _this.responseCallbacks[id]; } @@ -71,82 +76,83 @@ var IpcProvider = function IpcProvider(path, net) { // use oboe.js for Sockets if (net.constructor.name === 'Socket') { oboe(this.connection) - .done(callback); + .done(callback); } else { - this.connection.on('data', function(data){ + this.connection.on('data', function (data) { _this._parseResponse(data.toString()).forEach(callback); }); } }; /** -Will add the error and end event to timeout existing calls - -@method addDefaultEvents -*/ -IpcProvider.prototype.addDefaultEvents = function(){ + * Will add the error and end event to timeout existing calls + * + * @method addDefaultEvents + */ +IpcProvider.prototype.addDefaultEvents = function () { var _this = this; - this.connection.on('connect', function(){ + this.connection.on('connect', function () { _this.connected = true; }); - this.connection.on('close', function(){ + this.connection.on('close', function () { _this.connected = false; }); - this.connection.on('error', function(){ + this.connection.on('error', function () { _this._timeout(); }); - this.connection.on('end', function(){ + this.connection.on('end', function () { _this._timeout(); }); - this.connection.on('timeout', function(){ + this.connection.on('timeout', function () { _this._timeout(); }); }; /** - Will parse the response and make an array out of it. - - NOTE, this exists for backwards compatibility reasons. - - @method _parseResponse - @param {String} data + * Will parse the response and make an array out of it. + * + * NOTE, this exists for backwards compatibility reasons. + * + * @method _parseResponse + * @param {String} data + * @returns {Array} */ -IpcProvider.prototype._parseResponse = function(data) { +IpcProvider.prototype._parseResponse = function (data) { var _this = this, returnValues = []; // DE-CHUNKER var dechunkedData = data - .replace(/\}[\n\r]?\{/g,'}|--|{') // }{ - .replace(/\}\][\n\r]?\[\{/g,'}]|--|[{') // }][{ - .replace(/\}[\n\r]?\[\{/g,'}|--|[{') // }[{ - .replace(/\}\][\n\r]?\{/g,'}]|--|{') // }]{ + .replace(/\}[\n\r]?\{/g, '}|--|{') // }{ + .replace(/\}\][\n\r]?\[\{/g, '}]|--|[{') // }][{ + .replace(/\}[\n\r]?\[\{/g, '}|--|[{') // }[{ + .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ .split('|--|'); - dechunkedData.forEach(function(data){ + dechunkedData.forEach(function (data) { + var result = null; // prepend the last chunk - if(_this.lastChunk) + if (_this.lastChunk) { data = _this.lastChunk + data; + } - var result = null; try { result = JSON.parse(data); - - } catch(e) { - + } catch (e) { _this.lastChunk = data; // start timeout to cancel all requests clearTimeout(_this.lastChunkTimeout); - _this.lastChunkTimeout = setTimeout(function(){ + + _this.lastChunkTimeout = setTimeout(function () { _this._timeout(); throw errors.InvalidResponse(data); }, 1000 * 15); @@ -158,8 +164,9 @@ IpcProvider.prototype._parseResponse = function(data) { clearTimeout(_this.lastChunkTimeout); _this.lastChunk = null; - if(result) + if (result) { returnValues.push(result); + } }); return returnValues; @@ -167,12 +174,12 @@ IpcProvider.prototype._parseResponse = function(data) { /** -Get the adds a callback to the responseCallbacks object, -which will be called if a response matching the response Id will arrive. - -@method _addResponseCallback -*/ -IpcProvider.prototype._addResponseCallback = function(payload, callback) { + * Get the adds a callback to the responseCallbacks object, + * which will be called if a response matching the response Id will arrive. + * + * @method _addResponseCallback + */ +IpcProvider.prototype._addResponseCallback = function (payload, callback) { var id = payload.id || payload[0].id; var method = payload.method || payload[0].method; @@ -181,13 +188,13 @@ IpcProvider.prototype._addResponseCallback = function(payload, callback) { }; /** -Timeout all requests when the end/error event is fired - -@method _timeout -*/ -IpcProvider.prototype._timeout = function() { - for(var key in this.responseCallbacks) { - if(this.responseCallbacks.hasOwnProperty(key)){ + * Timeout all requests when the end/error event is fired + * + * @method _timeout + */ +IpcProvider.prototype._timeout = function () { + for (var key in this.responseCallbacks) { + if (this.responseCallbacks.hasOwnProperty(key)) { this.responseCallbacks[key](errors.InvalidConnection('on IPC')); delete this.responseCallbacks[key]; } @@ -195,38 +202,38 @@ IpcProvider.prototype._timeout = function() { }; /** - Try to reconnect - - @method reconnect + * Try to reconnect + * + * @method reconnect */ -IpcProvider.prototype.reconnect = function() { +IpcProvider.prototype.reconnect = function () { this.connection.connect({path: this.path}); }; IpcProvider.prototype.send = function (payload, callback) { // try reconnect, when connection is gone - if(!this.connection.writable) + if (!this.connection.writable) { this.connection.connect({path: this.path}); - + } this.connection.write(JSON.stringify(payload)); this._addResponseCallback(payload, callback); }; /** -Subscribes to provider events.provider - -@method on -@param {String} type 'notification', 'connect', 'error', 'end' or 'data' -@param {Function} callback the callback to call -*/ + * Subscribes to provider events.provider + * + * @method on + * @param {String} type 'notification', 'connect', 'error', 'end' or 'data' + * @param {Function} callback the callback to call + */ IpcProvider.prototype.on = function (type, callback) { - - if(typeof callback !== 'function') + if (typeof callback !== 'function') { throw new Error('The second parameter callback must be a function.'); + } - switch(type){ + switch (type) { case 'data': this.notificationCallbacks.push(callback); break; @@ -239,34 +246,34 @@ IpcProvider.prototype.on = function (type, callback) { }; /** - Subscribes to provider events.provider - - @method on - @param {String} type 'connect', 'error', 'end' or 'data' - @param {Function} callback the callback to call + * Subscribes to provider events.provider + * + * @method on + * @param {String} type 'connect', 'error', 'end' or 'data' + * @param {Function} callback the callback to call */ IpcProvider.prototype.once = function (type, callback) { - - if(typeof callback !== 'function') + if (typeof callback !== 'function') { throw new Error('The second parameter callback must be a function.'); + } this.connection.once(type, callback); }; /** -Removes event listener - -@method removeListener -@param {String} type 'data', 'connect', 'error', 'end' or 'data' -@param {Function} callback the callback to call -*/ + * Removes event listener + * + * @method removeListener + * @param {String} type 'data', 'connect', 'error', 'end' or 'data' + * @param {Function} callback the callback to call + */ IpcProvider.prototype.removeListener = function (type, callback) { var _this = this; - switch(type){ + switch (type) { case 'data': - this.notificationCallbacks.forEach(function(cb, index){ - if(cb === callback) + this.notificationCallbacks.forEach(function (cb, index) { + if (cb === callback) _this.notificationCallbacks.splice(index, 1); }); break; @@ -278,13 +285,13 @@ IpcProvider.prototype.removeListener = function (type, callback) { }; /** -Removes all event listeners - -@method removeAllListeners -@param {String} type 'data', 'connect', 'error', 'end' or 'data' -*/ + * Removes all event listeners + * + * @method removeAllListeners + * @param {String} type 'data', 'connect', 'error', 'end' or 'data' + */ IpcProvider.prototype.removeAllListeners = function (type) { - switch(type){ + switch (type) { case 'data': this.notificationCallbacks = []; break; @@ -296,10 +303,10 @@ IpcProvider.prototype.removeAllListeners = function (type) { }; /** -Resets the providers, clears all callbacks - -@method reset -*/ + * Resets the providers, clears all callbacks + * + * @method reset + */ IpcProvider.prototype.reset = function () { this._timeout(); this.notificationCallbacks = []; @@ -312,4 +319,3 @@ IpcProvider.prototype.reset = function () { }; module.exports = IpcProvider; - From c7ef6c81ff2c4e38946781095d135465a09fcc87 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 12:59:57 +0200 Subject: [PATCH 0006/1045] copyright added to SocketProviderAdapter --- .../src/adapters/SocketProviderAdapter.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index 944c85b7b1f..afa2a6e9b24 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -1,4 +1,26 @@ +/* + 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 . +*/ +/** + * @file EthereumProviderAdapter.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; var EventEmitter = require('eventemitter3'); From 230d0b9ee6d3e32f1825cf69b6b975cb50ecb339 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 13:02:43 +0200 Subject: [PATCH 0007/1045] promise added to send --- .../src/adapters/SocketProviderAdapter.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index afa2a6e9b24..5541b7f3a08 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -36,7 +36,17 @@ function SocketProviderAdapter (provider) { * @returns {Promise} */ SocketProviderAdapter.prototype.send = function (method, parameters) { - return this.provider.send(method, parameters); + return new Promise(function(resolve, reject) { + this.provider.send(Jsonrpc.toPayload(method, parameters), function(result, error) { + if(!error) { + resolve(result); + return; + } + + reject(error); + }); + + }); }; /** From 1c8c7ffb0bcdfc0bf152d126351887eea3dcfdc3 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 13:05:27 +0200 Subject: [PATCH 0008/1045] shift => unshift --- packages/web3-provider/src/adapters/SocketProviderAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index 5541b7f3a08..c025a1fdc39 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -55,7 +55,7 @@ SocketProviderAdapter.prototype.send = function (method, parameters) { * @returns {Promise} */ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, parameters) { - return this.send('eth_subscribe', parameters.shift(subscriptionType)).then(function (error, subscriptionId) { + return this.send('eth_subscribe', parameters.unshift(subscriptionType)).then(function (error, subscriptionId) { if (!error) { this.subscriptions[subscriptionId]({subscriptionType: subscriptionType, type: 'eth'}); From afd10cc1bce0fa3d4630851845c04cb714fa35b9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 13:35:55 +0200 Subject: [PATCH 0009/1045] Clear subscriptions added to SocketProviderAdapter --- .../src/adapters/SocketProviderAdapter.js | 46 +++++++++++++------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index c025a1fdc39..8e7f7632d33 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -24,7 +24,7 @@ var EventEmitter = require('eventemitter3'); -function SocketProviderAdapter (provider) { +function SocketProviderAdapter(provider) { this.provider = provider; this.subscriptions = []; this.registerSubscriptionListener(); @@ -36,9 +36,9 @@ function SocketProviderAdapter (provider) { * @returns {Promise} */ SocketProviderAdapter.prototype.send = function (method, parameters) { - return new Promise(function(resolve, reject) { - this.provider.send(Jsonrpc.toPayload(method, parameters), function(result, error) { - if(!error) { + return new Promise(function (resolve, reject) { + this.provider.send(Jsonrpc.toPayload(method, parameters), function (result, error) { + if (!error) { resolve(result); return; } @@ -66,6 +66,24 @@ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, paramete }); }; +/** + * @param {string} subscriptionId + * @returns {Promise} + */ +SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId) { + return this.send('eth_unsubscribe', [subscriptionId]).then(function (result) { + if (result) { + this.subscriptions = this.subscriptions.filter(function (subscription) { + return subscription !== subscriptionId; + }); + + return true; + } + + return false; + }); +}; + /** * Emits an event with the subscription id */ @@ -82,20 +100,20 @@ SocketProviderAdapter.prototype.registerSubscriptionListener = function () { }; /** - * @param {string} subscriptionId - * @returns {Promise} + * @param {boolean} keepIsSyncing */ -SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId) { - return this.send('eth_unsubscribe', [subscriptionId]).then(function (result) { - if (result) { - this.subscriptions = this.subscriptions.filter(function (subscription) { - return subscription !== subscriptionId; - }); +SocketProviderAdapter.prototype.clearSubscriptions = function (keepIsSyncing) { + var self = this; + var unsubscribePromises = []; - return true; + Object.keys(this.subscriptions).forEach(function (subscriptionId) { + if (!keepIsSyncing || self.subscriptions[subscriptionId].name !== 'syncing') { + unsubscribePromises.push(self.unsubscribe(subscriptionId)); } + }); - return false; + Promise.all(unsubscribePromises).then(function () { + this.provider.reset(); }); }; From 0aee2e7e76695752e615771b0507b18274cd2a3d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 14:17:59 +0200 Subject: [PATCH 0010/1045] LegacyProviderAdapter added --- .../src/adapters/HttpProviderAdapter.js | 9 +-- .../src/adapters/LegacyProviderAdapter.js | 75 +++++++++++++++++++ 2 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 packages/web3-provider/src/adapters/LegacyProviderAdapter.js diff --git a/packages/web3-provider/src/adapters/HttpProviderAdapter.js b/packages/web3-provider/src/adapters/HttpProviderAdapter.js index 4edeb613cfd..b1e63669d26 100644 --- a/packages/web3-provider/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-provider/src/adapters/HttpProviderAdapter.js @@ -24,7 +24,6 @@ var Jsonrpc = require('./jsonrpc.js'); //TODO: Fix import -// TODO: Methods should have the same behavior like the EthereumProvider. /** * @param {HttpProvider} httpProvider * @constructor @@ -43,12 +42,10 @@ HttpProviderAdapter.prototype.send = function (method, parameters) { this.provider.send(Jsonrpc.toPayload(method, parameters), function(result, error) { if(!error) { resolve(result); - this.emit('data', result); return; } reject(error); - this.emit('error', error); }); }); @@ -59,7 +56,7 @@ HttpProviderAdapter.prototype.send = function (method, parameters) { */ HttpProviderAdapter.prototype.subscribe = function () { return new Promise(function(resolve, reject) { - reject(new Error('HTTP does not support subscriptions')); + reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); }); }; @@ -68,7 +65,7 @@ HttpProviderAdapter.prototype.subscribe = function () { */ HttpProviderAdapter.prototype.unsubscribe = function () { return new Promise(function(resolve, reject) { - reject(new Error('HTTP does not support subscriptions')); + reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); }); }; @@ -78,5 +75,3 @@ HttpProviderAdapter.prototype.unsubscribe = function () { HttpProviderAdapter.prototype.isConnected = function () { return this.provider.connected; }; - -HttpProviderAdapter.prototype = new EventEmitter(); diff --git a/packages/web3-provider/src/adapters/LegacyProviderAdapter.js b/packages/web3-provider/src/adapters/LegacyProviderAdapter.js new file mode 100644 index 00000000000..265259d6056 --- /dev/null +++ b/packages/web3-provider/src/adapters/LegacyProviderAdapter.js @@ -0,0 +1,75 @@ +/* + 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 . +*/ +/** + * @file LegacyProviderAdapter.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var Jsonrpc = require('./jsonrpc.js'); //TODO: Fix import + +/** + * @param {LegacyProvider} legacyProvider + * @constructor + */ +function LegacyProviderAdapter(legacyProvider) { + this.provider = legacyProvider; +} + +/** + * @param {string} method + * @param {Array} parameters + * @returns {Promise} + */ +LegacyProviderAdapter.prototype.send = function (method, parameters) { + return new Promise(function (resolve, reject) { + this.provider.sendAsync(Jsonrpc.toPayload(method, parameters), function (result, error) { + if (!error) { + resolve(result); + return; + } + + reject(error); + }); + + }); +}; + +/** + * @returns {Promise} + */ +LegacyProviderAdapter.prototype.subscribe = function () { + return new Promise(function (resolve, reject) { + reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); + }); +}; + +/** + * @returns {Promise} + */ +LegacyProviderAdapter.prototype.unsubscribe = function () { + return new Promise(function (resolve, reject) { + reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); + }); +}; + +/** + * @returns {boolean} + */ +LegacyProviderAdapter.prototype.isConnected = this.provider.isConnected; From 89e526f152ae7ddf31d93566ef4f731cc7648687 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 14:19:40 +0200 Subject: [PATCH 0011/1045] removing of sendAsync for legacy provider removed because of the provider adapter --- packages/web3-core-requestmanager/src/givenProvider.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/web3-core-requestmanager/src/givenProvider.js b/packages/web3-core-requestmanager/src/givenProvider.js index cc215fcb464..bf1ddbcf2d2 100644 --- a/packages/web3-core-requestmanager/src/givenProvider.js +++ b/packages/web3-core-requestmanager/src/givenProvider.js @@ -34,12 +34,6 @@ if(typeof global.ethereumProvider !== 'undefined') { // Legacy web3.currentProvider } else if(typeof global.web3 !== 'undefined' && global.web3.currentProvider) { - - if(global.web3.currentProvider.sendAsync) { - global.web3.currentProvider.send = global.web3.currentProvider.sendAsync; - delete global.web3.currentProvider.sendAsync; - } - // if connection is 'ipcProviderWrapper', add subscription support if(!global.web3.currentProvider.on && global.web3.currentProvider.connection && From a89c1de25d28244cfed61a9dd5348cbb98b3aecb Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 14:28:03 +0200 Subject: [PATCH 0012/1045] sendBatch added to legacy provider adapter --- .../src/givenProvider.js | 1 + .../src/adapters/LegacyProviderAdapter.js | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/web3-core-requestmanager/src/givenProvider.js b/packages/web3-core-requestmanager/src/givenProvider.js index bf1ddbcf2d2..287f0bbebc5 100644 --- a/packages/web3-core-requestmanager/src/givenProvider.js +++ b/packages/web3-core-requestmanager/src/givenProvider.js @@ -34,6 +34,7 @@ if(typeof global.ethereumProvider !== 'undefined') { // Legacy web3.currentProvider } else if(typeof global.web3 !== 'undefined' && global.web3.currentProvider) { + // if connection is 'ipcProviderWrapper', add subscription support if(!global.web3.currentProvider.on && global.web3.currentProvider.connection && diff --git a/packages/web3-provider/src/adapters/LegacyProviderAdapter.js b/packages/web3-provider/src/adapters/LegacyProviderAdapter.js index 265259d6056..f6fd1924f97 100644 --- a/packages/web3-provider/src/adapters/LegacyProviderAdapter.js +++ b/packages/web3-provider/src/adapters/LegacyProviderAdapter.js @@ -39,7 +39,7 @@ function LegacyProviderAdapter(legacyProvider) { */ LegacyProviderAdapter.prototype.send = function (method, parameters) { return new Promise(function (resolve, reject) { - this.provider.sendAsync(Jsonrpc.toPayload(method, parameters), function (result, error) { + this.provider.sendAsync(Jsonrpc.toPayload(method, parameters), function (error, result) { if (!error) { resolve(result); return; @@ -51,6 +51,23 @@ LegacyProviderAdapter.prototype.send = function (method, parameters) { }); }; +/** + * @param {Array} payloadBatch + * @returns {Promise} + */ +LegacyProviderAdapter.prototype.sendBatch = function (payloadBatch) { + return new Promise(function (resolve, reject) { + this.provider.sendAsync(Jsonrpc.toBatchPayload(payloadBatch), function (error, result) { + if (!error) { + resolve(result); + return; + } + + reject(error); + }); + }); +}; + /** * @returns {Promise} */ From 7bee5d66a04b4c2c34402248f4c7ab8afe12c758 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 14:33:59 +0200 Subject: [PATCH 0013/1045] Better naming for the legacy inpage provider --- ...ProviderAdapter.js => InpageProviderAdapter.js} | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) rename packages/web3-provider/src/adapters/{LegacyProviderAdapter.js => InpageProviderAdapter.js} (84%) diff --git a/packages/web3-provider/src/adapters/LegacyProviderAdapter.js b/packages/web3-provider/src/adapters/InpageProviderAdapter.js similarity index 84% rename from packages/web3-provider/src/adapters/LegacyProviderAdapter.js rename to packages/web3-provider/src/adapters/InpageProviderAdapter.js index f6fd1924f97..f7d2764f3a6 100644 --- a/packages/web3-provider/src/adapters/LegacyProviderAdapter.js +++ b/packages/web3-provider/src/adapters/InpageProviderAdapter.js @@ -25,10 +25,10 @@ var Jsonrpc = require('./jsonrpc.js'); //TODO: Fix import /** - * @param {LegacyProvider} legacyProvider + * @param {InpageProvider} legacyProvider * @constructor */ -function LegacyProviderAdapter(legacyProvider) { +function InpageProviderAdapter(legacyProvider) { this.provider = legacyProvider; } @@ -37,7 +37,7 @@ function LegacyProviderAdapter(legacyProvider) { * @param {Array} parameters * @returns {Promise} */ -LegacyProviderAdapter.prototype.send = function (method, parameters) { +InpageProviderAdapter.prototype.send = function (method, parameters) { return new Promise(function (resolve, reject) { this.provider.sendAsync(Jsonrpc.toPayload(method, parameters), function (error, result) { if (!error) { @@ -55,7 +55,7 @@ LegacyProviderAdapter.prototype.send = function (method, parameters) { * @param {Array} payloadBatch * @returns {Promise} */ -LegacyProviderAdapter.prototype.sendBatch = function (payloadBatch) { +InpageProviderAdapter.prototype.sendBatch = function (payloadBatch) { return new Promise(function (resolve, reject) { this.provider.sendAsync(Jsonrpc.toBatchPayload(payloadBatch), function (error, result) { if (!error) { @@ -71,7 +71,7 @@ LegacyProviderAdapter.prototype.sendBatch = function (payloadBatch) { /** * @returns {Promise} */ -LegacyProviderAdapter.prototype.subscribe = function () { +InpageProviderAdapter.prototype.subscribe = function () { return new Promise(function (resolve, reject) { reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); }); @@ -80,7 +80,7 @@ LegacyProviderAdapter.prototype.subscribe = function () { /** * @returns {Promise} */ -LegacyProviderAdapter.prototype.unsubscribe = function () { +InpageProviderAdapter.prototype.unsubscribe = function () { return new Promise(function (resolve, reject) { reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); }); @@ -89,4 +89,4 @@ LegacyProviderAdapter.prototype.unsubscribe = function () { /** * @returns {boolean} */ -LegacyProviderAdapter.prototype.isConnected = this.provider.isConnected; +InpageProviderAdapter.prototype.isConnected = this.provider.isConnected; From cb8ba14e3d1528f2484ace51d2754aee32f86334 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 14:35:16 +0200 Subject: [PATCH 0014/1045] file header updated --- packages/web3-provider/src/adapters/InpageProviderAdapter.js | 2 +- packages/web3-provider/src/adapters/SocketProviderAdapter.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/web3-provider/src/adapters/InpageProviderAdapter.js b/packages/web3-provider/src/adapters/InpageProviderAdapter.js index f7d2764f3a6..793f275a2d0 100644 --- a/packages/web3-provider/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-provider/src/adapters/InpageProviderAdapter.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file LegacyProviderAdapter.js + * @file InpageProviderAdapter.js * @authors: Samuel Furter * @date 2018 */ diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index 8e7f7632d33..53e1c86b2a9 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file EthereumProviderAdapter.js + * @file SocketProviderAdapter.js * @authors: Samuel Furter * @date 2018 */ From 0038473fa9da926e2182e34cf2c557305ac502bf Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 14:36:35 +0200 Subject: [PATCH 0015/1045] useless ethereum provider adapter removed --- .../src/adapters/EthereumProviderAdapter.js | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 packages/web3-provider/src/adapters/EthereumProviderAdapter.js diff --git a/packages/web3-provider/src/adapters/EthereumProviderAdapter.js b/packages/web3-provider/src/adapters/EthereumProviderAdapter.js deleted file mode 100644 index 05c16d07b28..00000000000 --- a/packages/web3-provider/src/adapters/EthereumProviderAdapter.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - 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 . -*/ -/** - * @file EthereumProviderAdapter.js - * @authors: Samuel Furter - * @date 2018 - */ - -"use strict"; - -/** - * @param {EthereumProvider} ethereumProvider - * @constructor - */ -function EthereumProviderAdapter (ethereumProvider) { - this.provider = ethereumProvider; -} - -/** - * @param {string} method - * @param {Array} parameters - * @returns {Promise} - */ -EthereumProviderAdapter.prototype.send = function (method, parameters) { - return this.provider.send(method, parameters); -}; - -/** - * @param {string} subscriptionType - * @param {Array} parameters - * @returns {Promise} - */ -EthereumProviderAdapter.prototype.subscribe = function (subscriptionType, parameters) { - return this.provider.subscribe(subscriptionType, parameters); -}; - -/** - * @param {string} subscriptionId - * @returns {Promise} - */ -EthereumProviderAdapter.prototype.unsubscribe = function (subscriptionId) { - return this.provider.unsubscribe(subscriptionId); -}; - -/** - * @returns {*} //TODO: define return value - */ -EthereumProviderAdapter.prototype.isConnected = function () { - return this.provider.isConnected(); -}; From 4bf4dbcc3262b6e1666cd6491a3cbb3fd9c348e2 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 14:50:10 +0200 Subject: [PATCH 0016/1045] jsonrpc renamed to JSONRpcMapper and moved to providers --- .../lib/JSONRpcMapper.js} | 22 ++++++++++--------- .../src/adapters/HttpProviderAdapter.js | 4 ++-- .../src/adapters/InpageProviderAdapter.js | 2 +- .../src/adapters/SocketProviderAdapter.js | 3 ++- 4 files changed, 17 insertions(+), 14 deletions(-) rename packages/{web3-core-requestmanager/src/jsonrpc.js => web3-provider/lib/JSONRpcMapper.js} (86%) diff --git a/packages/web3-core-requestmanager/src/jsonrpc.js b/packages/web3-provider/lib/JSONRpcMapper.js similarity index 86% rename from packages/web3-core-requestmanager/src/jsonrpc.js rename to packages/web3-provider/lib/JSONRpcMapper.js index dfb90184203..fd6628decc4 100644 --- a/packages/web3-core-requestmanager/src/jsonrpc.js +++ b/packages/web3-provider/lib/JSONRpcMapper.js @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with web3.js. If not, see . */ -/** @file jsonrpc.js +/** @file JSONRpcMapper.js * @authors: * Fabian Vogelsteller * Marek Kotewicz @@ -24,8 +24,10 @@ "use strict"; -// Initialize Jsonrpc as a simple object with utility functions. -var Jsonrpc = { +/** + * @constructor + */ +var JSONRpcMapper = { messageId: 0 }; @@ -37,17 +39,17 @@ var Jsonrpc = { * @param {Array} params, an array of method params, optional * @returns {Object} valid jsonrpc payload object */ -Jsonrpc.toPayload = function (method, params) { +JSONRpcMapper.toPayload = function (method, params) { if (!method) { throw new Error('JSONRPC method should be specified for params: "'+ JSON.stringify(params) +'"!'); } // advance message ID - Jsonrpc.messageId++; + JSONRpcMapper.messageId++; return { jsonrpc: '2.0', - id: Jsonrpc.messageId, + id: JSONRpcMapper.messageId, method: method, params: params || [] }; @@ -57,10 +59,10 @@ Jsonrpc.toPayload = function (method, params) { * Should be called to check if jsonrpc response is valid * * @method isValidResponse - * @param {Object} + * @param {Object} response * @returns {Boolean} true if response is valid, otherwise false */ -Jsonrpc.isValidResponse = function (response) { +JSONRpcMapper.isValidResponse = function (response) { return Array.isArray(response) ? response.every(validateSingleMessage) : validateSingleMessage(response); function validateSingleMessage(message){ @@ -79,11 +81,11 @@ Jsonrpc.isValidResponse = function (response) { * @param {Array} messages, an array of objects with method (required) and params (optional) fields * @returns {Array} batch payload */ -Jsonrpc.toBatchPayload = function (messages) { +JSONRpcMapper.toBatchPayload = function (messages) { return messages.map(function (message) { return Jsonrpc.toPayload(message.method, message.params); }); }; -module.exports = Jsonrpc; +module.exports = JSONRpcMapper; diff --git a/packages/web3-provider/src/adapters/HttpProviderAdapter.js b/packages/web3-provider/src/adapters/HttpProviderAdapter.js index b1e63669d26..e18acca51c5 100644 --- a/packages/web3-provider/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-provider/src/adapters/HttpProviderAdapter.js @@ -22,7 +22,7 @@ "use strict"; -var Jsonrpc = require('./jsonrpc.js'); //TODO: Fix import +var JSONRpcMapper = require('./JSONRpcMapperMapper.js'); /** * @param {HttpProvider} httpProvider @@ -39,7 +39,7 @@ function HttpProviderAdapter (httpProvider) { */ HttpProviderAdapter.prototype.send = function (method, parameters) { return new Promise(function(resolve, reject) { - this.provider.send(Jsonrpc.toPayload(method, parameters), function(result, error) { + this.provider.send(JSONRpcMapper.toPayload(method, parameters), function(result, error) { if(!error) { resolve(result); return; diff --git a/packages/web3-provider/src/adapters/InpageProviderAdapter.js b/packages/web3-provider/src/adapters/InpageProviderAdapter.js index 793f275a2d0..b560ea7606c 100644 --- a/packages/web3-provider/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-provider/src/adapters/InpageProviderAdapter.js @@ -22,7 +22,7 @@ "use strict"; -var Jsonrpc = require('./jsonrpc.js'); //TODO: Fix import +var JSONRpcMapper = require('./JSONRpcMapperMapper.js'); /** * @param {InpageProvider} legacyProvider diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index 53e1c86b2a9..3221061de7c 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -22,6 +22,7 @@ "use strict"; +var JSONRpcMapper = require('./JSONRpcMapperMapper.js'); var EventEmitter = require('eventemitter3'); function SocketProviderAdapter(provider) { @@ -37,7 +38,7 @@ function SocketProviderAdapter(provider) { */ SocketProviderAdapter.prototype.send = function (method, parameters) { return new Promise(function (resolve, reject) { - this.provider.send(Jsonrpc.toPayload(method, parameters), function (result, error) { + this.provider.send(JSONRpcMapper.toPayload(method, parameters), function (result, error) { if (!error) { resolve(result); return; From f94433e939fe60f49e4caea810695ef614c20948 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 14:51:24 +0200 Subject: [PATCH 0017/1045] Web3Provider from POC removed --- packages/web3-provider/src/Web3Provider.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 packages/web3-provider/src/Web3Provider.js diff --git a/packages/web3-provider/src/Web3Provider.js b/packages/web3-provider/src/Web3Provider.js deleted file mode 100644 index e69de29bb2d..00000000000 From bb9d01fae935d83056c80c89f4d8d63a6334be7d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 15:17:02 +0200 Subject: [PATCH 0018/1045] ProviderAdapterResolver implemented --- .../web3-core-requestmanager/src/index.js | 3 +- .../src/resolver/ProviderAdapterResolver.js | 65 ++++++++++--------- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/packages/web3-core-requestmanager/src/index.js b/packages/web3-core-requestmanager/src/index.js index 0aeec34e16c..1abf53c393c 100644 --- a/packages/web3-core-requestmanager/src/index.js +++ b/packages/web3-core-requestmanager/src/index.js @@ -52,8 +52,7 @@ RequestManager.givenProvider = givenProvider; RequestManager.providers = { WebsocketProvider: require('web3-providers-ws'), HttpProvider: require('web3-providers-http'), - IpcProvider: require('web3-providers-ipc'), - EthereumProvider: require('web3-providers-ethereum') + IpcProvider: require('web3-providers-ipc') }; diff --git a/packages/web3-provider/src/resolver/ProviderAdapterResolver.js b/packages/web3-provider/src/resolver/ProviderAdapterResolver.js index 1571b895ad2..8ebd80cc6d6 100644 --- a/packages/web3-provider/src/resolver/ProviderAdapterResolver.js +++ b/packages/web3-provider/src/resolver/ProviderAdapterResolver.js @@ -1,33 +1,38 @@ -function ProviderAdapterResolver (provider) { - this.providerAdapter = this.resolveProvider(provider); -} - - -ProviderAdapterResolver.prototype.resolveProvider = function () { - // Check if http ws ipc or ethereum provider - // Instantiate the correct provider and set it to this.provider - // autodetect provider - // if(p && typeof p === 'string' && this.providers) { - // - // // HTTP - // if(/^http(s)?:\/\//i.test(p)) { - // p = new this.providers.HttpProvider(p); - // - // // WS - // } else if(/^ws(s)?:\/\//i.test(p)) { - // p = new this.providers.WebsocketProvider(p); - // - // // IPC - // } else if(p && typeof net === 'object' && typeof net.connect === 'function') { - // p = new this.providers.IpcProvider(p, net); - // - // } else if(p) { - // throw new Error('Can\'t autodetect provider for "'+ p +'"'); - // } - // } -}; +var _ = require('underscore'); +var HttpProviderAdapter = require('../adapters/HttpProviderAdapter'); +var SocketProviderAdapter = require('../adapters/SocketProviderAdapter'); +var InpageProviderAdapter = require('../adapters/InpageProviderAdapter'); +var WebsocketProvider = require('web3-providers-ws'); +var HttpProvider = require('web3-providers-http'); +var IpcProvider = require('web3-providers-ipc'); + +function ProviderAdapterResolver() {} + +ProviderAdapterResolver.prototype.resolve = function (provider, net) { + + if (typeof provider === 'string') { + // HTTP + if (/^http(s)?:\/\//i.test(provider)) { + return new HttpProviderAdapter(new HttpProvider(provider)); + } + // WS + if (/^ws(s)?:\/\//i.test(provider)) { + return new SocketProviderAdapter(new WebsocketProvider(provider)); + } -ProviderAdapterResolver.prototype.getProvider = function () { - return this.provider; + // IPC + if (provider && _.isObject(net) && _.isFunction(net.connect)) { + return new SocketProviderAdapter(new IpcProvider(provider, net)); + } + } + + if (provider.constructor.name === 'EthereumProvider') { + return provider; + } + + if (_.isFunction(provider.sendAsync)) { + return new InpageProviderAdapter(provider); + } }; + From 1175e25926f48c579bced5bdda9eea27cd652d01 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 16:18:56 +0200 Subject: [PATCH 0019/1045] AbstractProviderAdapter added --- .../lib/AbstractProviderAdapter.js | 50 +++++++++++++++++++ .../src/adapters/HttpProviderAdapter.js | 32 ++++-------- .../src/adapters/InpageProviderAdapter.js | 29 +++-------- .../src/adapters/SocketProviderAdapter.js | 27 +--------- 4 files changed, 68 insertions(+), 70 deletions(-) create mode 100644 packages/web3-provider/lib/AbstractProviderAdapter.js diff --git a/packages/web3-provider/lib/AbstractProviderAdapter.js b/packages/web3-provider/lib/AbstractProviderAdapter.js new file mode 100644 index 00000000000..71ba6baf63c --- /dev/null +++ b/packages/web3-provider/lib/AbstractProviderAdapter.js @@ -0,0 +1,50 @@ + +var JSONRpcMapper = require('./JSONRpcMapper.js'); +var errors = require('web3-core-helpers').errors; + +function AbstractProviderAdapter(provider) { + this.provider = provider; +} + +AbstractProviderAdapter.prototype.send = function (method, parameters) { + var self = this; + var payload = JSONRpcMapper.toPayload(method, parameters); + + return new Promise(function(resolve, reject) { + self.provider.send(payload, function(error, response) { + self.handleResponse(reject, resolve, error, response) + }); + + }); +}; + +AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, error, response) { + if (response && response.id && payload.id !== response.id) { + reject( + new Error('Wrong response id "'+ response.id +'" (expected: "'+ payload.id +'") in '+ JSON.stringify(payload)) + ); + + return; + } + + if (response && response.error) { + reject(errors.ErrorResponse(response)); + return; + } + + + if(!JSONRpcMapper.isValidResponse(response.result)) { + reject(errors.InvalidResponse(response)); + return; + } + + if(!error) { + resolve(response.result); + return; + } + + reject(error); +}; + +AbstractProviderAdapter.prototype = Object.create(EventEmitter.prototype); +AbstractProviderAdapter.prototype.constructor = AbstractProviderAdapter; diff --git a/packages/web3-provider/src/adapters/HttpProviderAdapter.js b/packages/web3-provider/src/adapters/HttpProviderAdapter.js index e18acca51c5..85d6e8dc7c5 100644 --- a/packages/web3-provider/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-provider/src/adapters/HttpProviderAdapter.js @@ -22,41 +22,22 @@ "use strict"; -var JSONRpcMapper = require('./JSONRpcMapperMapper.js'); - /** * @param {HttpProvider} httpProvider * @constructor */ function HttpProviderAdapter (httpProvider) { - this.provider = httpProvider; + AbstractProviderAdapter.call(httpProvider); } -/** - * @param {string} method - * @param {Array} parameters - * @returns {Promise} - */ -HttpProviderAdapter.prototype.send = function (method, parameters) { - return new Promise(function(resolve, reject) { - this.provider.send(JSONRpcMapper.toPayload(method, parameters), function(result, error) { - if(!error) { - resolve(result); - return; - } - - reject(error); - }); - - }); -}; /** * @returns {Promise} */ HttpProviderAdapter.prototype.subscribe = function () { + var self = this; return new Promise(function(resolve, reject) { - reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); + reject(new Error('The current provider does not support subscriptions: ' + self.provider.constructor.name)); }); }; @@ -64,8 +45,9 @@ HttpProviderAdapter.prototype.subscribe = function () { * @returns {Promise} */ HttpProviderAdapter.prototype.unsubscribe = function () { + var self = this; return new Promise(function(resolve, reject) { - reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); + reject(new Error('The current provider does not support subscriptions: ' + self.provider.constructor.name)); }); }; @@ -75,3 +57,7 @@ HttpProviderAdapter.prototype.unsubscribe = function () { HttpProviderAdapter.prototype.isConnected = function () { return this.provider.connected; }; + + + +HttpProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); diff --git a/packages/web3-provider/src/adapters/InpageProviderAdapter.js b/packages/web3-provider/src/adapters/InpageProviderAdapter.js index b560ea7606c..71827de6289 100644 --- a/packages/web3-provider/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-provider/src/adapters/InpageProviderAdapter.js @@ -22,42 +22,25 @@ "use strict"; -var JSONRpcMapper = require('./JSONRpcMapperMapper.js'); +var JSONRpcMapper = require('./JSONRpcMapper.js'); /** * @param {InpageProvider} legacyProvider * @constructor */ function InpageProviderAdapter(legacyProvider) { - this.provider = legacyProvider; + AbstractProviderAdapter.call(legacyProvider); + this.provider.send = this.provider.sendAsync; + delete this.provider.sendAsync; } -/** - * @param {string} method - * @param {Array} parameters - * @returns {Promise} - */ -InpageProviderAdapter.prototype.send = function (method, parameters) { - return new Promise(function (resolve, reject) { - this.provider.sendAsync(Jsonrpc.toPayload(method, parameters), function (error, result) { - if (!error) { - resolve(result); - return; - } - - reject(error); - }); - - }); -}; - /** * @param {Array} payloadBatch * @returns {Promise} */ InpageProviderAdapter.prototype.sendBatch = function (payloadBatch) { return new Promise(function (resolve, reject) { - this.provider.sendAsync(Jsonrpc.toBatchPayload(payloadBatch), function (error, result) { + this.provider.send(JSONRpcMapper.toBatchPayload(payloadBatch), function (error, result) { if (!error) { resolve(result); return; @@ -90,3 +73,5 @@ InpageProviderAdapter.prototype.unsubscribe = function () { * @returns {boolean} */ InpageProviderAdapter.prototype.isConnected = this.provider.isConnected; + +InpageProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index 3221061de7c..7e62d0b3da3 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -22,34 +22,12 @@ "use strict"; -var JSONRpcMapper = require('./JSONRpcMapperMapper.js'); -var EventEmitter = require('eventemitter3'); - function SocketProviderAdapter(provider) { - this.provider = provider; + AbstractProviderAdapter.call(provider); this.subscriptions = []; this.registerSubscriptionListener(); } -/** - * @param {string} method - * @param {Array} parameters - * @returns {Promise} - */ -SocketProviderAdapter.prototype.send = function (method, parameters) { - return new Promise(function (resolve, reject) { - this.provider.send(JSONRpcMapper.toPayload(method, parameters), function (result, error) { - if (!error) { - resolve(result); - return; - } - - reject(error); - }); - - }); -}; - /** * @param {string} subscriptionType * @param {Array} parameters @@ -125,5 +103,4 @@ SocketProviderAdapter.prototype.isConnected = function () { return this.provider.connected; }; -SocketProviderAdapter.prototype = Object.create(EventEmitter.prototype); -SocketProviderAdapter.prototype.constructor = SocketProviderAdapter; +SocketProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); From 134460916141fb056c856ad392f682897254a851 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 16:19:49 +0200 Subject: [PATCH 0020/1045] file structure improved --- .../web3-provider/lib/{ => adapters}/AbstractProviderAdapter.js | 2 +- packages/web3-provider/lib/{ => mappers}/JSONRpcMapper.js | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/web3-provider/lib/{ => adapters}/AbstractProviderAdapter.js (95%) rename packages/web3-provider/lib/{ => mappers}/JSONRpcMapper.js (100%) diff --git a/packages/web3-provider/lib/AbstractProviderAdapter.js b/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js similarity index 95% rename from packages/web3-provider/lib/AbstractProviderAdapter.js rename to packages/web3-provider/lib/adapters/AbstractProviderAdapter.js index 71ba6baf63c..6e327ce25ac 100644 --- a/packages/web3-provider/lib/AbstractProviderAdapter.js +++ b/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js @@ -1,5 +1,5 @@ -var JSONRpcMapper = require('./JSONRpcMapper.js'); +var JSONRpcMapper = require('../mappers/JSONRpcMapper.js'); var errors = require('web3-core-helpers').errors; function AbstractProviderAdapter(provider) { diff --git a/packages/web3-provider/lib/JSONRpcMapper.js b/packages/web3-provider/lib/mappers/JSONRpcMapper.js similarity index 100% rename from packages/web3-provider/lib/JSONRpcMapper.js rename to packages/web3-provider/lib/mappers/JSONRpcMapper.js From d0352ed216f00baeaa4414fee9dacefa7e8513d7 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 16:20:58 +0200 Subject: [PATCH 0021/1045] contructor parameter name improved --- .../web3-provider/src/adapters/InpageProviderAdapter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web3-provider/src/adapters/InpageProviderAdapter.js b/packages/web3-provider/src/adapters/InpageProviderAdapter.js index 71827de6289..957cb6b4298 100644 --- a/packages/web3-provider/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-provider/src/adapters/InpageProviderAdapter.js @@ -25,11 +25,11 @@ var JSONRpcMapper = require('./JSONRpcMapper.js'); /** - * @param {InpageProvider} legacyProvider + * @param {InpageProvider} inpageProvider * @constructor */ -function InpageProviderAdapter(legacyProvider) { - AbstractProviderAdapter.call(legacyProvider); +function InpageProviderAdapter(inpageProvider) { + AbstractProviderAdapter.call(inpageProvider); this.provider.send = this.provider.sendAsync; delete this.provider.sendAsync; } From bec35cabeefdfd0f82b91fd7f63f912de7b66f8f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 16:37:05 +0200 Subject: [PATCH 0022/1045] JSONRPCMapper splitted in to mapper and validator because of single responsibility principle --- .../lib/adapters/AbstractProviderAdapter.js | 28 ++++++++- .../lib/mappers/JSONRpcMapper.js | 29 ++-------- .../validators/JSONRpcResponseValidator.js | 57 +++++++++++++++++++ .../src/adapters/HttpProviderAdapter.js | 4 +- .../src/adapters/InpageProviderAdapter.js | 3 +- .../src/adapters/SocketProviderAdapter.js | 2 + .../src/resolver/ProviderAdapterResolver.js | 1 + 7 files changed, 95 insertions(+), 29 deletions(-) create mode 100644 packages/web3-provider/lib/validators/JSONRpcResponseValidator.js diff --git a/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js b/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js index 6e327ce25ac..a54d860e695 100644 --- a/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js @@ -1,5 +1,29 @@ +/* + 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 . +*/ +/** + * @file AbstractProviderAdapter.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; var JSONRpcMapper = require('../mappers/JSONRpcMapper.js'); +var JSONRpcResponseValidator = require('../validators/JSONRpcResponseValidator.js'); var errors = require('web3-core-helpers').errors; function AbstractProviderAdapter(provider) { @@ -33,7 +57,7 @@ AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, er } - if(!JSONRpcMapper.isValidResponse(response.result)) { + if(!JSONRpcResponseValidator.isValid(response.result)) { reject(errors.InvalidResponse(response)); return; } @@ -48,3 +72,5 @@ AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, er AbstractProviderAdapter.prototype = Object.create(EventEmitter.prototype); AbstractProviderAdapter.prototype.constructor = AbstractProviderAdapter; + +module.exports = AbstractProviderAdapter; diff --git a/packages/web3-provider/lib/mappers/JSONRpcMapper.js b/packages/web3-provider/lib/mappers/JSONRpcMapper.js index fd6628decc4..dd6c4754f17 100644 --- a/packages/web3-provider/lib/mappers/JSONRpcMapper.js +++ b/packages/web3-provider/lib/mappers/JSONRpcMapper.js @@ -14,12 +14,10 @@ You should have received a copy of the GNU Lesser General Public License along with web3.js. If not, see . */ -/** @file JSONRpcMapper.js - * @authors: - * Fabian Vogelsteller - * Marek Kotewicz - * Aaron Kumavis - * @date 2015 +/** + * @file JSONRpcMapper.js + * @authors: Samuel Furter + * @date 2018 */ "use strict"; @@ -55,25 +53,6 @@ JSONRpcMapper.toPayload = function (method, params) { }; }; -/** - * Should be called to check if jsonrpc response is valid - * - * @method isValidResponse - * @param {Object} response - * @returns {Boolean} true if response is valid, otherwise false - */ -JSONRpcMapper.isValidResponse = function (response) { - return Array.isArray(response) ? response.every(validateSingleMessage) : validateSingleMessage(response); - - function validateSingleMessage(message){ - return !!message && - !message.error && - message.jsonrpc === '2.0' && - (typeof message.id === 'number' || typeof message.id === 'string') && - message.result !== undefined; // only undefined is not valid json object - } -}; - /** * Should be called to create batch payload object * diff --git a/packages/web3-provider/lib/validators/JSONRpcResponseValidator.js b/packages/web3-provider/lib/validators/JSONRpcResponseValidator.js new file mode 100644 index 00000000000..cdf6df1229a --- /dev/null +++ b/packages/web3-provider/lib/validators/JSONRpcResponseValidator.js @@ -0,0 +1,57 @@ +/* + 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 . +*/ +/** + * @file JSONRpcResponseValidator.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var JSONRpcResponseValidator = {}; + +/** + * Executes JSON-RPC response validation + * + * @method isValid + * @param {Object} response + * @returns {Boolean} true if response is valid, otherwise false + */ +JSONRpcResponseValidator.isValid = function (response) { + if (Array.isArray(response)) { + return response.every(this.validateSingleMessage) + } + + return this.validateSingleMessage(response); +}; + +/** + * Checks if jsonrpc response is valid + * + * @method validateSingleMessage + * @param {Object} response + * @returns {Boolean} true if response is valid, otherwise false + */ +JSONRpcResponseValidator.validateSingleMessage = function (response) { + return !!response && + !response.error && + response.jsonrpc === '2.0' && + (typeof response.id === 'number' || typeof response.id === 'string') && + response.result !== undefined; +}; + +module.exports = JSONRpcResponseValidator; diff --git a/packages/web3-provider/src/adapters/HttpProviderAdapter.js b/packages/web3-provider/src/adapters/HttpProviderAdapter.js index 85d6e8dc7c5..7873ea19d0c 100644 --- a/packages/web3-provider/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-provider/src/adapters/HttpProviderAdapter.js @@ -58,6 +58,6 @@ HttpProviderAdapter.prototype.isConnected = function () { return this.provider.connected; }; - - HttpProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); + +module.exports = HttpProviderAdapter; diff --git a/packages/web3-provider/src/adapters/InpageProviderAdapter.js b/packages/web3-provider/src/adapters/InpageProviderAdapter.js index 957cb6b4298..0340d0680b3 100644 --- a/packages/web3-provider/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-provider/src/adapters/InpageProviderAdapter.js @@ -73,5 +73,6 @@ InpageProviderAdapter.prototype.unsubscribe = function () { * @returns {boolean} */ InpageProviderAdapter.prototype.isConnected = this.provider.isConnected; - InpageProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); + +module.exports = InpageProviderAdapter; diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index 7e62d0b3da3..20316c3b59c 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -104,3 +104,5 @@ SocketProviderAdapter.prototype.isConnected = function () { }; SocketProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); + +module.exports = SocketProviderAdapter; diff --git a/packages/web3-provider/src/resolver/ProviderAdapterResolver.js b/packages/web3-provider/src/resolver/ProviderAdapterResolver.js index 8ebd80cc6d6..2040f3b418d 100644 --- a/packages/web3-provider/src/resolver/ProviderAdapterResolver.js +++ b/packages/web3-provider/src/resolver/ProviderAdapterResolver.js @@ -36,3 +36,4 @@ ProviderAdapterResolver.prototype.resolve = function (provider, net) { } }; +module.exports = ProviderAdapterResolver; From e6861481029c69438ebec1abf1c3e87b8cd55cb9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 16:45:31 +0200 Subject: [PATCH 0023/1045] response validation for sendBatch, naming improved in SockerProviderAdapter --- .../src/adapters/InpageProviderAdapter.js | 10 ++++++++-- .../src/adapters/SocketProviderAdapter.js | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/web3-provider/src/adapters/InpageProviderAdapter.js b/packages/web3-provider/src/adapters/InpageProviderAdapter.js index 0340d0680b3..c1d59b413fe 100644 --- a/packages/web3-provider/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-provider/src/adapters/InpageProviderAdapter.js @@ -23,6 +23,7 @@ "use strict"; var JSONRpcMapper = require('./JSONRpcMapper.js'); +var errors = require('web3-core-helpers').errors; /** * @param {InpageProvider} inpageProvider @@ -40,12 +41,16 @@ function InpageProviderAdapter(inpageProvider) { */ InpageProviderAdapter.prototype.sendBatch = function (payloadBatch) { return new Promise(function (resolve, reject) { - this.provider.send(JSONRpcMapper.toBatchPayload(payloadBatch), function (error, result) { + this.provider.send(JSONRpcMapper.toBatchPayload(payloadBatch), function (error, response) { if (!error) { - resolve(result); + resolve(response); return; } + if (!_.isArray(response)) { + reject(errors.InvalidResponse(response)); + } + reject(error); }); }); @@ -73,6 +78,7 @@ InpageProviderAdapter.prototype.unsubscribe = function () { * @returns {boolean} */ InpageProviderAdapter.prototype.isConnected = this.provider.isConnected; + InpageProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); module.exports = InpageProviderAdapter; diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index 20316c3b59c..ff7911d101e 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -68,12 +68,12 @@ SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId) { */ SocketProviderAdapter.prototype.registerSubscriptionListener = function () { var self = this; - this.provider.on('data', function (result, deprecatedResult) { - result = result || deprecatedResult; // this is for possible old providers, which may had the error first handler + this.provider.on('data', function (response, deprecatedResponse) { + response = response || deprecatedResponse; // this is for possible old providers, which may had the error first handler // check for result.method, to prevent old providers errors to pass as result - if (result.method && self.subscriptions[result.params.subscription]) { - self.emit(result.params.subscription, result.params.result); + if (response.method && self.subscriptions[response.params.subscription]) { + self.emit(response.params.subscription, response.params.result); } }); }; From 9f57a355210b0e4a36da9bc25e65b8b5df3d3b96 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 16:56:31 +0200 Subject: [PATCH 0024/1045] request manager removed --- .../src/givenProvider.js | 81 ------ .../web3-core-requestmanager/src/index.js | 247 ------------------ .../src/detectors/ProviderDetector.js | 78 ++++++ .../ProviderAdapterResolver.js | 27 +- 4 files changed, 103 insertions(+), 330 deletions(-) delete mode 100644 packages/web3-core-requestmanager/src/givenProvider.js delete mode 100644 packages/web3-core-requestmanager/src/index.js create mode 100644 packages/web3-provider/src/detectors/ProviderDetector.js rename packages/web3-provider/src/{resolver => resolvers}/ProviderAdapterResolver.js (55%) diff --git a/packages/web3-core-requestmanager/src/givenProvider.js b/packages/web3-core-requestmanager/src/givenProvider.js deleted file mode 100644 index 287f0bbebc5..00000000000 --- a/packages/web3-core-requestmanager/src/givenProvider.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - 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 . - */ -/** - * @file givenProvider.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -"use strict"; - -var givenProvider = null; - -// ADD GIVEN PROVIDER -/* jshint ignore:start */ -var global = Function('return this')(); - -// EthereumProvider -if(typeof global.ethereumProvider !== 'undefined') { - givenProvider = global.ethereumProvider; - -// Legacy web3.currentProvider -} else if(typeof global.web3 !== 'undefined' && global.web3.currentProvider) { - - // if connection is 'ipcProviderWrapper', add subscription support - if(!global.web3.currentProvider.on && - global.web3.currentProvider.connection && - global.web3.currentProvider.connection.constructor.name === 'ipcProviderWrapper') { - - global.web3.currentProvider.on = function (type, callback) { - - if(typeof callback !== 'function') - throw new Error('The second parameter callback must be a function.'); - - switch(type){ - case 'data': - this.connection.on('data', function(data) { - var result = ''; - - data = data.toString(); - - try { - result = JSON.parse(data); - } catch(e) { - return callback(new Error('Couldn\'t parse response data'+ data)); - } - - // notification - if(!result.id && result.method.indexOf('_subscription') !== -1) { - callback(null, result); - } - - }); - break; - - default: - this.connection.on(type, callback); - break; - } - }; - } - - givenProvider = global.web3.currentProvider; -} -/* jshint ignore:end */ - - -module.exports = givenProvider; diff --git a/packages/web3-core-requestmanager/src/index.js b/packages/web3-core-requestmanager/src/index.js deleted file mode 100644 index 1abf53c393c..00000000000 --- a/packages/web3-core-requestmanager/src/index.js +++ /dev/null @@ -1,247 +0,0 @@ -/* - 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 . -*/ -/** - * @file index.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -"use strict"; - - -var _ = require('underscore'); -var errors = require('web3-core-helpers').errors; -var Jsonrpc = require('./jsonrpc.js'); -var BatchManager = require('./batch.js'); -var givenProvider = require('./givenProvider.js'); - - - - /** - * It's responsible for passing messages to providers - * It's also responsible for polling the ethereum node for incoming messages - * Default poll timeout is 1 second - * Singleton - */ -var RequestManager = function RequestManager(provider) { - this.provider = null; - this.providers = RequestManager.providers; - - this.setProvider(provider); - this.subscriptions = {}; -}; - - - -RequestManager.givenProvider = givenProvider; - -RequestManager.providers = { - WebsocketProvider: require('web3-providers-ws'), - HttpProvider: require('web3-providers-http'), - IpcProvider: require('web3-providers-ipc') -}; - - - -/** - * Should be used to set provider of request manager - * - * @method setProvider - * @param {Object} p - */ -RequestManager.prototype.setProvider = function (p, net) { - var _this = this; - - // autodetect provider - if(p && typeof p === 'string' && this.providers) { - - // HTTP - if(/^http(s)?:\/\//i.test(p)) { - p = new this.providers.HttpProvider(p); - - // WS - } else if(/^ws(s)?:\/\//i.test(p)) { - p = new this.providers.WebsocketProvider(p); - - // IPC - } else if(p && typeof net === 'object' && typeof net.connect === 'function') { - p = new this.providers.IpcProvider(p, net); - - } else if(p) { - throw new Error('Can\'t autodetect provider for "'+ p +'"'); - } - } - - - // reset the old one before changing, if still connected - if(this.provider && this.provider.isConnected()) { - this.clearSubscriptions(); - } - - this.provider = p || null; - - // listen to incoming notifications - if(this.provider && this.provider.on) { - this.provider.on('data', function requestManagerNotification(result, deprecatedResult){ - result = result || deprecatedResult; // this is for possible old providers, which may had the error first handler - - // check for result.method, to prevent old providers errors to pass as result - if(result.method && _this.subscriptions[result.params.subscription] && _this.subscriptions[result.params.subscription].callback) { - _this.subscriptions[result.params.subscription].callback(null, result.params.result); - } - }); - // TODO add error, end, timeout, connect?? - // this.provider.on('error', function requestManagerNotification(result){ - // Object.keys(_this.subscriptions).forEach(function(id){ - // if(_this.subscriptions[id].callback) - // _this.subscriptions[id].callback(err); - // }); - // } - } -}; - - -/** - * Should be used to asynchronously send request - * - * @method sendAsync - * @param {Object} data - * @param {Function} callback - */ -RequestManager.prototype.send = function (data, callback) { - callback = callback || function(){}; - - if (!this.provider) { - return callback(errors.InvalidProvider()); - } - - var payload = Jsonrpc.toPayload(data.method, data.params); - this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](payload, function (err, result) { - if(result && result.id && payload.id !== result.id) return callback(new Error('Wrong response id "'+ result.id +'" (expected: "'+ payload.id +'") in '+ JSON.stringify(payload))); - - if (err) { - return callback(err); - } - - if (result && result.error) { - return callback(errors.ErrorResponse(result)); - } - - if (!Jsonrpc.isValidResponse(result)) { - return callback(errors.InvalidResponse(result)); - } - - callback(null, result.result); - }); -}; - -/** - * Should be called to asynchronously send batch request - * - * @method sendBatch - * @param {Array} batch data - * @param {Function} callback - */ -RequestManager.prototype.sendBatch = function (data, callback) { - if (!this.provider) { - return callback(errors.InvalidProvider()); - } - - var payload = Jsonrpc.toBatchPayload(data); - this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](payload, function (err, results) { - if (err) { - return callback(err); - } - - if (!_.isArray(results)) { - return callback(errors.InvalidResponse(results)); - } - - callback(null, results); - }); -}; - - -/** - * Waits for notifications - * - * @method addSubscription - * @param {String} id the subscription id - * @param {String} name the subscription name - * @param {String} type the subscription namespace (eth, personal, etc) - * @param {Function} callback the callback to call for incoming notifications - */ -RequestManager.prototype.addSubscription = function (id, name, type, callback) { - if(this.provider.on) { - this.subscriptions[id] = { - callback: callback, - type: type, - name: name - }; - - } else { - throw new Error('The provider doesn\'t support subscriptions: '+ this.provider.constructor.name); - } -}; - -/** - * Waits for notifications - * - * @method removeSubscription - * @param {String} id the subscription id - * @param {Function} callback fired once the subscription is removed - */ -RequestManager.prototype.removeSubscription = function (id, callback) { - var _this = this; - - if(this.subscriptions[id]) { - - this.send({ - method: this.subscriptions[id].type + '_unsubscribe', - params: [id] - }, callback); - - // remove subscription - delete _this.subscriptions[id]; - } -}; - -/** - * Should be called to reset the subscriptions - * - * @method reset - */ -RequestManager.prototype.clearSubscriptions = function (keepIsSyncing) { - var _this = this; - - - // uninstall all subscriptions - Object.keys(this.subscriptions).forEach(function(id){ - if(!keepIsSyncing || _this.subscriptions[id].name !== 'syncing') - _this.removeSubscription(id); - }); - - - // reset notification callbacks etc. - if(this.provider.reset) - this.provider.reset(); -}; - -module.exports = { - Manager: RequestManager, - BatchManager: BatchManager -}; diff --git a/packages/web3-provider/src/detectors/ProviderDetector.js b/packages/web3-provider/src/detectors/ProviderDetector.js new file mode 100644 index 00000000000..4b3b3504086 --- /dev/null +++ b/packages/web3-provider/src/detectors/ProviderDetector.js @@ -0,0 +1,78 @@ +/* + 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 . +*/ +/** + * @file ProviderDetector.js + * @authors: Samuel Furter + * @date 2018 + */ + + +function ProviderDetector() { + +} + +ProviderDetector.prototype.detect = function () { + // // EthereumProvider + // if (typeof global.ethereumProvider !== 'undefined') { + // return global.ethereumProvider; + // + // } + // + // // Legacy web3.currentProvider + // if (typeof global.web3 !== 'undefined' && global.web3.currentProvider) { + // + // // if connection is 'ipcProviderWrapper', add subscription support + // if (!global.web3.currentProvider.on && + // global.web3.currentProvider.connection && + // global.web3.currentProvider.connection.constructor.name === 'ipcProviderWrapper') { + // + // global.web3.currentProvider.on = function (type, callback) { + // + // if (typeof callback !== 'function') + // throw new Error('The second parameter callback must be a function.'); + // + // switch (type) { + // case 'data': + // this.connection.on('data', function (data) { + // var result = ''; + // + // data = data.toString(); + // + // try { + // result = JSON.parse(data); + // } catch (e) { + // return callback(new Error('Couldn\'t parse response data' + data)); + // } + // + // // notification + // if (!result.id && result.method.indexOf('_subscription') !== -1) { + // callback(null, result); + // } + // + // }); + // break; + // + // default: + // this.connection.on(type, callback); + // break; + // } + // }; + // } + // + // return global.web3.currentProvider; + // } +}; diff --git a/packages/web3-provider/src/resolver/ProviderAdapterResolver.js b/packages/web3-provider/src/resolvers/ProviderAdapterResolver.js similarity index 55% rename from packages/web3-provider/src/resolver/ProviderAdapterResolver.js rename to packages/web3-provider/src/resolvers/ProviderAdapterResolver.js index 2040f3b418d..4631cd0f332 100644 --- a/packages/web3-provider/src/resolver/ProviderAdapterResolver.js +++ b/packages/web3-provider/src/resolvers/ProviderAdapterResolver.js @@ -1,3 +1,26 @@ +/* + 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 . +*/ +/** + * @file ProviderAdapterResolver.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; var _ = require('underscore'); var HttpProviderAdapter = require('../adapters/HttpProviderAdapter'); @@ -7,9 +30,9 @@ var WebsocketProvider = require('web3-providers-ws'); var HttpProvider = require('web3-providers-http'); var IpcProvider = require('web3-providers-ipc'); -function ProviderAdapterResolver() {} +var ProviderAdapterResolver = {}; -ProviderAdapterResolver.prototype.resolve = function (provider, net) { +ProviderAdapterResolver.resolve = function (provider, net) { if (typeof provider === 'string') { // HTTP From 65f74f868e8cac5e669f341a42228451d7d39d2b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 22 Aug 2018 17:19:42 +0200 Subject: [PATCH 0025/1045] request manager package removed, batch package created and index.js in web3-provider created --- packages/web3-core-batch/package.json | 9 ++++ .../batch.js => web3-core-batch/src/Batch.js} | 14 +++---- packages/web3-core-batch/src/index.js | 25 +++++++++++ packages/web3-core-requestmanager/README.md | 42 ------------------- .../package-lock.json | 11 ----- .../web3-core-requestmanager/package.json | 17 -------- packages/web3-provider/package.json | 9 ++++ packages/web3-provider/src/index.js | 25 +++++++++++ 8 files changed, 75 insertions(+), 77 deletions(-) create mode 100644 packages/web3-core-batch/package.json rename packages/{web3-core-requestmanager/src/batch.js => web3-core-batch/src/Batch.js} (85%) create mode 100644 packages/web3-core-batch/src/index.js delete mode 100644 packages/web3-core-requestmanager/README.md delete mode 100644 packages/web3-core-requestmanager/package-lock.json delete mode 100644 packages/web3-core-requestmanager/package.json create mode 100644 packages/web3-provider/package.json create mode 100644 packages/web3-provider/src/index.js diff --git a/packages/web3-core-batch/package.json b/packages/web3-core-batch/package.json new file mode 100644 index 00000000000..dbf92c10571 --- /dev/null +++ b/packages/web3-core-batch/package.json @@ -0,0 +1,9 @@ +{ + "name": "web3-core-batch", + "namespace": "ethereum", + "version": "1.0.0-beta.35", + "description": "Web3 module to handle requests to external providers.", + "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-requestmanager", + "license": "LGPL-3.0", + "main": "src/index.js" +} diff --git a/packages/web3-core-requestmanager/src/batch.js b/packages/web3-core-batch/src/Batch.js similarity index 85% rename from packages/web3-core-requestmanager/src/batch.js rename to packages/web3-core-batch/src/Batch.js index c47aaf7b9dd..9981bbfdae1 100644 --- a/packages/web3-core-requestmanager/src/batch.js +++ b/packages/web3-core-batch/src/Batch.js @@ -15,18 +15,18 @@ along with web3.js. If not, see . */ /** - * @file batch.js + * @file Batch.js * @author Marek Kotewicz * @date 2015 */ "use strict"; -var Jsonrpc = require('./jsonrpc'); +var JSONRpcResponseValidator = require('web3-provider').JSONRpcResponseValidator; var errors = require('web3-core-helpers').errors; -var Batch = function (requestManager) { - this.requestManager = requestManager; +var Batch = function (provider) { + this.provider = provider; this.requests = []; }; @@ -34,7 +34,7 @@ var Batch = function (requestManager) { * Should be called to add create new request to batch request * * @method add - * @param {Object} jsonrpc requet object + * @param {Object} request */ Batch.prototype.add = function (request) { this.requests.push(request); @@ -47,7 +47,7 @@ Batch.prototype.add = function (request) { */ Batch.prototype.execute = function () { var requests = this.requests; - this.requestManager.sendBatch(requests, function (err, results) { + this.provider.sendBatch(requests, function (err, results) { results = results || []; requests.map(function (request, index) { return results[index] || {}; @@ -57,7 +57,7 @@ Batch.prototype.execute = function () { return requests[index].callback(errors.ErrorResponse(result)); } - if (!Jsonrpc.isValidResponse(result)) { + if (!JSONRpcResponseValidator.isValid(result)) { return requests[index].callback(errors.InvalidResponse(result)); } diff --git a/packages/web3-core-batch/src/index.js b/packages/web3-core-batch/src/index.js new file mode 100644 index 00000000000..6e60e89022d --- /dev/null +++ b/packages/web3-core-batch/src/index.js @@ -0,0 +1,25 @@ +/* + 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 . +*/ +/** + * @file index.js + * + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var Batch = require('./Batch'); + +module.exports = Batch; diff --git a/packages/web3-core-requestmanager/README.md b/packages/web3-core-requestmanager/README.md deleted file mode 100644 index 7e160bec5b3..00000000000 --- a/packages/web3-core-requestmanager/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# web3-core-requestmanager - -This is a sub package of [web3.js][repo] - -The requestmanager package is used by most [web3.js][repo] packages. -Please read the [documentation][docs] for more. - -## Installation - -### Node.js - -```bash -npm install web3-core-requestmanager -``` - -### In the Browser - -Build running the following in the [web3.js][repo] repository: - -```bash -npm run-script build-all -``` - -Then include `dist/web3-core-requestmanager.js` in your html file. -This will expose the `Web3RequestManager` object on the window object. - - -## Usage - -```js -// in node.js -var Web3WsProvider = require('web3-providers-ws'); -var Web3RequestManager = require('web3-core-requestmanager'); - -var requestManager = new Web3RequestManager(new Web3WsProvider('ws://localhost:8546')); -``` - - -[docs]: http://web3js.readthedocs.io/en/1.0/ -[repo]: https://github.com/ethereum/web3.js - - diff --git a/packages/web3-core-requestmanager/package-lock.json b/packages/web3-core-requestmanager/package-lock.json deleted file mode 100644 index 07f47fab5fe..00000000000 --- a/packages/web3-core-requestmanager/package-lock.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } -} diff --git a/packages/web3-core-requestmanager/package.json b/packages/web3-core-requestmanager/package.json deleted file mode 100644 index 067d0b5647f..00000000000 --- a/packages/web3-core-requestmanager/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "web3-core-requestmanager", - "namespace": "ethereum", - "version": "1.0.0-beta.34", - "description": "Web3 module to handle requests to external providers.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-requestmanager", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.34", - "web3-providers-http": "1.0.0-beta.34", - "web3-providers-ipc": "1.0.0-beta.34", - "web3-providers-ws": "1.0.0-beta.34", - "web3-providers-ethereum": "1.0.0-beta.34" - } -} diff --git a/packages/web3-provider/package.json b/packages/web3-provider/package.json new file mode 100644 index 00000000000..9b19bd4d526 --- /dev/null +++ b/packages/web3-provider/package.json @@ -0,0 +1,9 @@ +{ + "name": "web3-provider", + "namespace": "ethereum", + "version": "1.0.0-beta.35", + "description": "Web3 module to handle requests to external providers.", + "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-requestmanager", + "license": "LGPL-3.0", + "main": "src/index.js" +} diff --git a/packages/web3-provider/src/index.js b/packages/web3-provider/src/index.js new file mode 100644 index 00000000000..04373751fef --- /dev/null +++ b/packages/web3-provider/src/index.js @@ -0,0 +1,25 @@ +/* + 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 . +*/ +/** + * @file index.js + * + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var ProviderAdapterResolver = require('./resolvers/ProviderAdapterResolver'); + +module.exports = ProviderAdapterResolver; From 031044a2f9ac84363a679b3bff7c9a8fedace181 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 23 Aug 2018 11:25:01 +0200 Subject: [PATCH 0026/1045] givenProvider.js refactored to ProviderDetector.js --- .../src/detectors/ProviderDetector.js | 123 ++++++++++-------- 1 file changed, 71 insertions(+), 52 deletions(-) diff --git a/packages/web3-provider/src/detectors/ProviderDetector.js b/packages/web3-provider/src/detectors/ProviderDetector.js index 4b3b3504086..fad96d4d926 100644 --- a/packages/web3-provider/src/detectors/ProviderDetector.js +++ b/packages/web3-provider/src/detectors/ProviderDetector.js @@ -20,59 +20,78 @@ * @date 2018 */ +var global = Function('return this')(); -function ProviderDetector() { - -} +function ProviderDetector() { } +/** + * Detects which provider is given with web3.currentProvider + * + * @returns {Object} provider + */ ProviderDetector.prototype.detect = function () { - // // EthereumProvider - // if (typeof global.ethereumProvider !== 'undefined') { - // return global.ethereumProvider; - // - // } - // - // // Legacy web3.currentProvider - // if (typeof global.web3 !== 'undefined' && global.web3.currentProvider) { - // - // // if connection is 'ipcProviderWrapper', add subscription support - // if (!global.web3.currentProvider.on && - // global.web3.currentProvider.connection && - // global.web3.currentProvider.connection.constructor.name === 'ipcProviderWrapper') { - // - // global.web3.currentProvider.on = function (type, callback) { - // - // if (typeof callback !== 'function') - // throw new Error('The second parameter callback must be a function.'); - // - // switch (type) { - // case 'data': - // this.connection.on('data', function (data) { - // var result = ''; - // - // data = data.toString(); - // - // try { - // result = JSON.parse(data); - // } catch (e) { - // return callback(new Error('Couldn\'t parse response data' + data)); - // } - // - // // notification - // if (!result.id && result.method.indexOf('_subscription') !== -1) { - // callback(null, result); - // } - // - // }); - // break; - // - // default: - // this.connection.on(type, callback); - // break; - // } - // }; - // } - // - // return global.web3.currentProvider; - // } + if (typeof global.ethereumProvider !== 'undefined') { + return global.ethereumProvider; + } + + if (typeof global.web3 !== 'undefined' && global.web3.currentProvider) { + + if (this.isIpcProviderWrapper(global.web3.currentProvider)) { + global.web3.currentProvider = this.addSubscriptionToIpcProviderWrapper(global.web3.currentProvider); + } + + return global.web3.currentProvider; + } +}; + +/** + * Checks if the given provider it is of type ipcProviderWrapper + * + * @param currentProvider + * @returns {boolean|*|{encrypted: boolean}|connection|{encrypted}|null} + */ +ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { + return !currentProvider.on && currentProvider.connection && currentProvider.connection.constructor.name === 'ipcProviderWrapper'; +}; + +/** + * Adds the on method for the subscriptions to the ipcProviderWrapper + * + * @param {ipcProviderWrapper} provider + * @returns {ipcProviderWrapper} + */ +ProviderDetector.prototype.addSubscriptionToIpcProviderWrapper = function (provider) { + provider.on = function (type, callback) { + + if (typeof callback !== 'function') + throw new Error('The second parameter callback must be a function.'); + + switch (type) { + case 'data': + this.connection.on('data', function (data) { + var result = ''; + + data = data.toString(); + + try { + result = JSON.parse(data); + } catch (e) { + return callback(new Error('Couldn\'t parse response data' + data)); + } + + // notification + if (!result.id && result.method.indexOf('_subscription') !== -1) { + callback(null, result); + } + + }); + break; + + default: + this.connection.on(type, callback); + break; + } + }; + + return provider; }; From 60c68fc030f30a80f95dac962f7e05b86642957e Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 23 Aug 2018 11:27:11 +0200 Subject: [PATCH 0027/1045] method docs improved --- packages/web3-provider/src/detectors/ProviderDetector.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/web3-provider/src/detectors/ProviderDetector.js b/packages/web3-provider/src/detectors/ProviderDetector.js index fad96d4d926..4082a810283 100644 --- a/packages/web3-provider/src/detectors/ProviderDetector.js +++ b/packages/web3-provider/src/detectors/ProviderDetector.js @@ -47,8 +47,8 @@ ProviderDetector.prototype.detect = function () { /** * Checks if the given provider it is of type ipcProviderWrapper * - * @param currentProvider - * @returns {boolean|*|{encrypted: boolean}|connection|{encrypted}|null} + * @param {Object} currentProvider + * @returns {boolean} */ ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { return !currentProvider.on && currentProvider.connection && currentProvider.connection.constructor.name === 'ipcProviderWrapper'; @@ -57,8 +57,8 @@ ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { /** * Adds the on method for the subscriptions to the ipcProviderWrapper * - * @param {ipcProviderWrapper} provider - * @returns {ipcProviderWrapper} + * @param {Object} provider ipcProviderWrapper + * @returns {Object} ipcProviderWrapper */ ProviderDetector.prototype.addSubscriptionToIpcProviderWrapper = function (provider) { provider.on = function (type, callback) { From dff4db1f6e312ae2eb4affe2466c50b10a5dbe8d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 23 Aug 2018 11:28:56 +0200 Subject: [PATCH 0028/1045] method naming improved in ProviderDetector --- packages/web3-provider/src/detectors/ProviderDetector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/web3-provider/src/detectors/ProviderDetector.js b/packages/web3-provider/src/detectors/ProviderDetector.js index 4082a810283..17934edb306 100644 --- a/packages/web3-provider/src/detectors/ProviderDetector.js +++ b/packages/web3-provider/src/detectors/ProviderDetector.js @@ -37,7 +37,7 @@ ProviderDetector.prototype.detect = function () { if (typeof global.web3 !== 'undefined' && global.web3.currentProvider) { if (this.isIpcProviderWrapper(global.web3.currentProvider)) { - global.web3.currentProvider = this.addSubscriptionToIpcProviderWrapper(global.web3.currentProvider); + global.web3.currentProvider = this.addSubscriptionsToIpcProviderWrapper(global.web3.currentProvider); } return global.web3.currentProvider; @@ -60,7 +60,7 @@ ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { * @param {Object} provider ipcProviderWrapper * @returns {Object} ipcProviderWrapper */ -ProviderDetector.prototype.addSubscriptionToIpcProviderWrapper = function (provider) { +ProviderDetector.prototype.addSubscriptionsToIpcProviderWrapper = function (provider) { provider.on = function (type, callback) { if (typeof callback !== 'function') From 21d885865e34a90f20ba124e71eb3a30b9872008 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 23 Aug 2018 14:56:13 +0200 Subject: [PATCH 0029/1045] web3-core-subscriptions renamed, Subscription object created, Adapters fixed --- .../README.md | 0 .../package-lock.json | 0 .../package.json | 0 .../src/Subscription.js | 169 +++++++++ packages/web3-core-subscriptions/src/index.js | 75 ---- .../src/subscription.js | 307 --------------- packages/web3-eth/src/getNetworkType.js | 2 + packages/web3-eth/src/index.js | 357 ++++++++++-------- .../lib/adapters/AbstractProviderAdapter.js | 17 + .../src/adapters/SocketProviderAdapter.js | 32 +- 10 files changed, 405 insertions(+), 554 deletions(-) rename packages/{web3-core-subscriptions => web3-core-subscription}/README.md (100%) rename packages/{web3-core-subscriptions => web3-core-subscription}/package-lock.json (100%) rename packages/{web3-core-subscriptions => web3-core-subscription}/package.json (100%) create mode 100644 packages/web3-core-subscription/src/Subscription.js delete mode 100644 packages/web3-core-subscriptions/src/index.js delete mode 100644 packages/web3-core-subscriptions/src/subscription.js diff --git a/packages/web3-core-subscriptions/README.md b/packages/web3-core-subscription/README.md similarity index 100% rename from packages/web3-core-subscriptions/README.md rename to packages/web3-core-subscription/README.md diff --git a/packages/web3-core-subscriptions/package-lock.json b/packages/web3-core-subscription/package-lock.json similarity index 100% rename from packages/web3-core-subscriptions/package-lock.json rename to packages/web3-core-subscription/package-lock.json diff --git a/packages/web3-core-subscriptions/package.json b/packages/web3-core-subscription/package.json similarity index 100% rename from packages/web3-core-subscriptions/package.json rename to packages/web3-core-subscription/package.json diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js new file mode 100644 index 00000000000..48143672f47 --- /dev/null +++ b/packages/web3-core-subscription/src/Subscription.js @@ -0,0 +1,169 @@ +/* + 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 . +*/ +/** + * @file Subscription.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var _ = require('underscore'); +var EventEmitter = require('eventemitter3'); + +/** + * @param {Object} provider + * @param {Function} inputFormatter + * @param {Function} outputFormatter + * @constructor + */ +function Subscription(provider, inputFormatter, outputFormatter) { + this.provider = provider; + this.inputFormatter = inputFormatter; + this.outputFormatter = outputFormatter; + this.subscriptionId = null; +} + +/** + * Sends the JSON-RPC request, emits the required events and executes the callback method. + * + * @param {string} type + * @param {*} parameters + * @param {Function} callback + */ +Subscription.prototype.subscribe = function (type, parameters, callback) { + var self = this; + this.provider.subscribe(type, this.formatInput(parameters)).then(function (subscriptionId) { + self.subscriptionId = subscriptionId; + self.provider.on(self.subscriptionId, function (error, response) { + if (!error) { + self.handleSubscriptionResponse(response, callback); + + return; + } + + if(self.provider.once) { + self.reconnect(type, parameters, subscriptionId, callback); + } + + callback(error, null); + self.emit('error', error); + }); + }); + + return this; +}; + +/** + * Iterates over each item in the response, formats the output, emits required events and executes the callback method. + * @param {any} response + * @param {Function} callback + */ +Subscription.prototype.handleSubscriptionResponse = function (response, callback) { + if (!_.isArray(response)) { + response = [response]; + } + + response.forEach(function (item) { + var formattedOutput = this.formatOutput(item); + this.emit('data', formattedOutput); + callback(false, formattedOutput); + }); +}; + +/** + * Reconnects provider and restarts subscription + * + * @param {string} type + * @param {*} parameters + * @param {string} subscriptionId + * @param {Function} callback + */ +Subscription.prototype.reconnect = function (type, parameters, subscriptionId, callback) { + var self = this; + + var interval = setInterval(function () { + if (self.provider.reconnect) { + self.provider.reconnect(); + } + }, 500); + + self.provider.once('connect', function () { + clearInterval(interval); + self.unsubscribe(function(error, result) { + if (result) { + self.subscribe(type, parameters, callback); + } + + callback(error, null); + }); + }); +}; + +/** + * Executes outputFormatter if defined + * + * @param output + * @returns {*} + */ +Subscription.prototype.formatOutput = function (output) { + if (_.isFunction(this.outputFormmater) && output) { + return this.outputFormatter(output); + } + + return output; +}; + +/** + * Executes inputFormatter if defined + * + * @param input + * @returns {*} + */ +Subscription.prototype.formatInput = function (input) { + if (_.isFunction(this.inputFormatter) && input) { + return this.inputFormatter(input); + } + + return input; +}; + +/** + * Unsubscribes subscription + * + * @param {Function} callback + * @returns {Promise} + */ +Subscription.prototype.unsubscribe = function (callback) { + var self = this; + return this.provider.unsubscribe(this.subscriptionId).then(function (response) { + if (!response) { + self.subscriptionId = null; + callback(true, false); + + return true; + } + + callback(false, true); + + return false; + }); +}; + +// Inherit from EventEmitter +Subscription.prototype = Object.create(EventEmitter.prototype); +Subscription.prototype.constructor = Subscription; diff --git a/packages/web3-core-subscriptions/src/index.js b/packages/web3-core-subscriptions/src/index.js deleted file mode 100644 index e12811af8e5..00000000000 --- a/packages/web3-core-subscriptions/src/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - 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 . -*/ -/** - * @file index.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -"use strict"; - -var Subscription = require('./subscription.js'); - - -var Subscriptions = function Subscriptions(options) { - this.name = options.name; - this.type = options.type; - this.subscriptions = options.subscriptions || {}; - this.requestManager = null; -}; - - -Subscriptions.prototype.setRequestManager = function (rm) { - this.requestManager = rm; -}; - - -Subscriptions.prototype.attachToObject = function (obj) { - var func = this.buildCall(); - var name = this.name.split('.'); - if (name.length > 1) { - obj[name[0]] = obj[name[0]] || {}; - obj[name[0]][name[1]] = func; - } else { - obj[name[0]] = func; - } -}; - - -Subscriptions.prototype.buildCall = function() { - var _this = this; - - return function(){ - if(!_this.subscriptions[arguments[0]]) { - console.warn('Subscription '+ JSON.stringify(arguments[0]) +' doesn\'t exist. Subscribing anyway.'); - } - - var subscription = new Subscription({ - subscription: _this.subscriptions[arguments[0]], - requestManager: _this.requestManager, - type: _this.type - }); - - return subscription.subscribe.apply(subscription, arguments); - }; -}; - - -module.exports = { - subscriptions: Subscriptions, - subscription: Subscription -}; diff --git a/packages/web3-core-subscriptions/src/subscription.js b/packages/web3-core-subscriptions/src/subscription.js deleted file mode 100644 index 330ee446904..00000000000 --- a/packages/web3-core-subscriptions/src/subscription.js +++ /dev/null @@ -1,307 +0,0 @@ -/* - 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 . -*/ -/** - * @file subscription.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -"use strict"; - -var _ = require('underscore'); -var errors = require('web3-core-helpers').errors; -var EventEmitter = require('eventemitter3'); - -function Subscription(options) { - EventEmitter.call(this); - - this.id = null; - this.callback = _.identity; - this.arguments = null; - this._reconnectIntervalId = null; - - this.options = { - subscription: options.subscription, - type: options.type, - requestManager: options.requestManager - }; -} - -// INHERIT -Subscription.prototype = Object.create(EventEmitter.prototype); -Subscription.prototype.constructor = Subscription; - - -/** - * Should be used to extract callback from array of arguments. Modifies input param - * - * @method extractCallback - * @param {Array} arguments - * @return {Function|Null} callback, if exists - */ - -Subscription.prototype._extractCallback = function (args) { - if (_.isFunction(args[args.length - 1])) { - return args.pop(); // modify the args array! - } -}; - -/** - * Should be called to check if the number of arguments is correct - * - * @method validateArgs - * @param {Array} arguments - * @throws {Error} if it is not - */ - -Subscription.prototype._validateArgs = function (args) { - var subscription = this.options.subscription; - - if(!subscription) - subscription = {}; - - if(!subscription.params) - subscription.params = 0; - - if (args.length !== subscription.params) { - throw errors.InvalidNumberOfParams(args.length, subscription.params + 1, args[0]); - } -}; - -/** - * Should be called to format input args of method - * - * @method formatInput - * @param {Array} - * @return {Array} - */ - -Subscription.prototype._formatInput = function (args) { - var subscription = this.options.subscription; - - if (!subscription) { - return args; - } - - if (!subscription.inputFormatter) { - return args; - } - - var formattedArgs = subscription.inputFormatter.map(function (formatter, index) { - return formatter ? formatter(args[index]) : args[index]; - }); - - return formattedArgs; -}; - -/** - * Should be called to format output(result) of method - * - * @method formatOutput - * @param {Object} - * @return {Object} - */ - -Subscription.prototype._formatOutput = function (result) { - var subscription = this.options.subscription; - - return (subscription && subscription.outputFormatter && result) ? subscription.outputFormatter(result) : result; -}; - -/** - * Should create payload from given input args - * - * @method toPayload - * @param {Array} args - * @return {Object} - */ -Subscription.prototype._toPayload = function (args) { - var params = []; - this.callback = this._extractCallback(args) || _.identity; - - if (!this.subscriptionMethod) { - this.subscriptionMethod = args.shift(); - - // replace subscription with given name - if (this.options.subscription.subscriptionName) { - this.subscriptionMethod = this.options.subscription.subscriptionName; - } - } - - if (!this.arguments) { - this.arguments = this._formatInput(args); - this._validateArgs(this.arguments); - args = []; // make empty after validation - - } - - // re-add subscriptionName - params.push(this.subscriptionMethod); - params = params.concat(this.arguments); - - - if (args.length) { - throw new Error('Only a callback is allowed as parameter on an already instantiated subscription.'); - } - - return { - method: this.options.type + '_subscribe', - params: params - }; -}; - -/** - * Unsubscribes and clears callbacks - * - * @method unsubscribe - * @return {Object} - */ -Subscription.prototype.unsubscribe = function(callback) { - this.options.requestManager.removeSubscription(this.id, callback); - this.id = null; - this.removeAllListeners(); - clearInterval(this._reconnectIntervalId); -}; - -/** - * Subscribes and watches for changes - * - * @method subscribe - * @param {String} subscription the subscription - * @param {Object} options the options object with address topics and fromBlock - * @return {Object} - */ -Subscription.prototype.subscribe = function() { - var _this = this; - var args = Array.prototype.slice.call(arguments); - var payload = this._toPayload(args); - - if(!payload) { - return this; - } - - if(!this.options.requestManager.provider) { - var err1 = new Error('No provider set.'); - this.callback(err1, null, this); - this.emit('error', err1); - return this; - } - - // throw error, if provider doesnt support subscriptions - if(!this.options.requestManager.provider.on) { - var err2 = new Error('The current provider doesn\'t support subscriptions: '+ this.options.requestManager.provider.constructor.name); - this.callback(err2, null, this); - this.emit('error', err2); - return this; - } - - // if id is there unsubscribe first - if (this.id) { - this.unsubscribe(); - } - - // store the params in the options object - this.options.params = payload.params[1]; - - // get past logs, if fromBlock is available - if(payload.params[0] === 'logs' && _.isObject(payload.params[1]) && payload.params[1].hasOwnProperty('fromBlock') && isFinite(payload.params[1].fromBlock)) { - // send the subscription request - this.options.requestManager.send({ - method: 'eth_getLogs', - params: [payload.params[1]] - }, function (err, logs) { - if(!err) { - logs.forEach(function(log){ - var output = _this._formatOutput(log); - _this.callback(null, output, _this); - _this.emit('data', output); - }); - - // TODO subscribe here? after the past logs? - - } else { - _this.callback(err, null, _this); - _this.emit('error', err); - } - }); - } - - // create subscription - // TODO move to separate function? so that past logs can go first? - - if(typeof payload.params[1] === 'object') - delete payload.params[1].fromBlock; - - this.options.requestManager.send(payload, function (err, result) { - if(!err && result) { - _this.id = result; - - // call callback on notifications - _this.options.requestManager.addSubscription(_this.id, payload.params[0] , _this.options.type, function(err, result) { - - if (!err) { - if (!_.isArray(result)) { - result = [result]; - } - - result.forEach(function(resultItem) { - var output = _this._formatOutput(resultItem); - - if (_.isFunction(_this.options.subscription.subscriptionHandler)) { - return _this.options.subscription.subscriptionHandler.call(_this, output); - } else { - _this.emit('data', output); - } - - // call the callback, last so that unsubscribe there won't affect the emit above - _this.callback(null, output, _this); - }); - } else { - // unsubscribe, but keep listeners - _this.options.requestManager.removeSubscription(_this.id); - - // re-subscribe, if connection fails - if(_this.options.requestManager.provider.once) { - _this._reconnectIntervalId = setInterval(function () { - // TODO check if that makes sense! - if (_this.options.requestManager.provider.reconnect) { - _this.options.requestManager.provider.reconnect(); - } - }, 500); - - _this.options.requestManager.provider.once('connect', function () { - clearInterval(_this._reconnectIntervalId); - _this.subscribe(_this.callback); - }); - } - _this.emit('error', err); - - // call the callback, last so that unsubscribe there won't affect the emit above - _this.callback(err, null, _this); - } - }); - } else { - _this.callback(err, null, _this); - _this.emit('error', err); - } - }); - - // return an object to cancel the subscription - return this; -}; - -module.exports = Subscription; diff --git a/packages/web3-eth/src/getNetworkType.js b/packages/web3-eth/src/getNetworkType.js index dea30b7679f..83aa76b2c4c 100644 --- a/packages/web3-eth/src/getNetworkType.js +++ b/packages/web3-eth/src/getNetworkType.js @@ -24,6 +24,8 @@ var _ = require('underscore'); +// TODO: move this in the correct package (Net) + var getNetworkType = function (callback) { var _this = this, id; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index f3c2b733fe8..59e98eaa11b 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -25,7 +25,6 @@ var _ = require('underscore'); var core = require('web3-core'); var helpers = require('web3-core-helpers'); -var Subscriptions = require('web3-core-subscriptions').subscriptions; var Method = require('web3-core-method'); var utils = require('web3-utils'); var Net = require('web3-net'); @@ -35,7 +34,7 @@ var Personal = require('web3-eth-personal'); var BaseContract = require('web3-eth-contract'); var Iban = require('web3-eth-iban'); var Accounts = require('web3-eth-accounts'); -var abi = require('web3-eth-abi'); +var ABI = require('web3-eth-abi'); var getNetworkType = require('./getNetworkType.js'); var formatter = helpers.formatters; @@ -63,82 +62,43 @@ var uncleCountCall = function (args) { var Eth = function Eth() { - var _this = this; + this.setContractPackage(BaseContract); + this.setNetPackage(new Net(this.currentProvider)); + this.setAccountsPackage(new Accounts(this.currentProvider)); + this.setPersonalPackage(new Personal(this.currentProvider)); + this.setIBANPackage(Iban); + this.setABIPackage(ABI); + this.setENSPackage(new ENS(this)); + this.setMethods(); // 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', { - get: function () { - return defaultAccount; - }, - set: function (val) { - if(val) { - defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); - } - - // also set on the Contract object - _this.Contract.defaultAccount = defaultAccount; - _this.personal.defaultAccount = defaultAccount; - - // update defaultBlock - methods.forEach(function(method) { - method.defaultAccount = defaultAccount; - }); - - return val; - }, - enumerable: true - }); - Object.defineProperty(this, 'defaultBlock', { - get: function () { - return defaultBlock; - }, - set: function (val) { - defaultBlock = val; - // also set on the Contract object - _this.Contract.defaultBlock = defaultBlock; - _this.personal.defaultBlock = defaultBlock; - - // update defaultBlock - methods.forEach(function(method) { - method.defaultBlock = defaultBlock; - }); - - return val; - }, - enumerable: true - }); - - - this.clearSubscriptions = _this._requestManager.clearSubscriptions; - - // add net - this.net = new Net(this.currentProvider); - // add chain detection - this.net.getNetworkType = getNetworkType.bind(this); - - // add accounts - this.accounts = new Accounts(this.currentProvider); +core.addProviders(Eth); - // add personal - this.personal = new Personal(this.currentProvider); - this.personal.defaultAccount = this.defaultAccount; +/** + * PACKAGE INIT (core.packageInit) overwrites setProvider! + * + * // overwrite setProvider + var setProvider = this.setProvider; + * + * + */ +Eth.prototype.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); +}; +/** + * Sets the Contract package as property of Eth + * + * @param {Object} contractPackage + */ +Eth.prototype.setContractPackage = function (contractPackage) { // create a proxy Contract type for this instance, as a Contract's provider // is stored as a class member rather than an instance variable. If we do // not create this proxy type, changing the provider in one instance of @@ -146,7 +106,7 @@ var Eth = function Eth() { // instances! var self = this; var Contract = function Contract() { - BaseContract.apply(this, arguments); + contractPackage.apply(this, arguments); // when Eth.setProvider is called, call packageInit // on all contract instances instantiated via this Eth @@ -155,18 +115,18 @@ var Eth = function Eth() { var _this = this; var setProvider = self.setProvider; self.setProvider = function() { - setProvider.apply(self, arguments); - core.packageInit(_this, [self.currentProvider]); + setProvider.apply(self, arguments); + core.packageInit(_this, [self.currentProvider]); }; }; Contract.setProvider = function() { - BaseContract.setProvider.apply(this, arguments); + contractPackage.setProvider.apply(this, arguments); }; // make our proxy Contract inherit from web3-eth-contract so that it has all // the right functionality and so that instanceof and friends work properly - Contract.prototype = Object.create(BaseContract.prototype); + Contract.prototype = Object.create(contractPackage.prototype); Contract.prototype.constructor = Contract; // add contract @@ -175,15 +135,161 @@ var Eth = function Eth() { this.Contract.defaultBlock = this.defaultBlock; this.Contract.setProvider(this.currentProvider, this.accounts); - // add IBAN - this.Iban = Iban; +}; + +/** + * Sets the Net package as property of Eth + * + * @param {Object} net + */ +Eth.prototype.setNetPackage = function (net) { + this.net = net; + this.net.getNetworkType = getNetworkType.bind(this); +}; + +/** + * Sets the Accounts package as property of Eth + * + * @param {Object} accounts + */ +Eth.prototype.setAccountsPackage = function (accounts) { + this.accounts = accounts; +}; + +/** + * Sets the Personal package as property of Eth + * + * @param {Object} personal + */ +Eth.prototype.setPersonalPackage = function (personal) { + this.personal = personal; + this.personal.defaultAccount = this.defaultAccount; +}; - // add ABI +/** + * Sets the Iban package as property of Eth + * + * @param {Object} iban + */ +Eth.prototype.setIBANPackage = function (iban) { + this.Iban = iban; +}; + +/** + * Sets the ABI package as property of Eth + * + * @param {Object} abi + */ +Eth.prototype.setABIPackage = function (abi) { this.abi = abi; +}; + +/** + * Sets the ENS package as property of Eth + * + * @param {Object} ens + */ +Eth.prototype.setENSPackage = function (ens) { + this.ens = ens; +}; + +/** + * Defines accessors for defaultAccount + */ +Object.defineProperty(Eth, 'defaultAccount', { + get: function () { + return this.defaultAccount ? this.defaultAccount : null; + }, + set: function (val) { + if(val) { + this.defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); + } + + // also set on the Contract object + _this.Contract.defaultAccount = defaultAccount; + _this.personal.defaultAccount = defaultAccount; + + // update defaultBlock + methods.forEach(function(method) { + method.defaultAccount = defaultAccount; + }); + + return val; + }, + enumerable: true +}); + +/** + * Defines accessors for defaultBlock + */ +Object.defineProperty(Eth, 'defaultBlock', { + get: function () { + return this.defaultBlock ? this.defaultBlock : 'latest'; + }, + set: function (val) { + var self = this; + this.defaultBlock = val; + + // also set on the Contract object + this.Contract.defaultBlock = this.defaultBlock; + this.personal.defaultBlock = this.defaultBlock; + + // update defaultBlock + methods.forEach(function(method) { + method.defaultBlock = self.defaultBlock; + }); + + return val; + }, + enumerable: true +}); + +/** + * Starts subscription for an given type + * + * @param {string} type + * @param {Object} parameters + * @param {Function} callback + */ +Eth.prototype.subscribe = function (type, parameters, callback) { + switch (type) { + case 'newBlockHeaders': + this.subscribeNewHeads(callback); + break; + case 'pendingTransactions': + this.subscribeNewPendingTransactions(callback); + break; + case 'logs':// Special behaviour see subscriptions package + this.subscribeLogs(parameters, callback); + break; + case 'syncing':// Special behaviour see subscriptionPackage + this.subscribeSyncing(callback); + break; + default: + throw Error('Unknown subscription: ' + type); + } +}; + +Eth.prototype.subscribeNewHeads = function (callback) { + this.createSubscription('newHeads', outputFormatter, inputFormatter, callback); +}; + +Eth.prototype.subscribeNewPendingTransactions = function (callback) { + this.createSubscription('newPendingTransactions', outputFormatter, inputFormatter, callback); +}; + +Eth.prototype.subscribeLogs = function (parameters, callback) { + this.createSubscription('logs', parameters, outputFormatter, inputFormatter, callback); +}; - // add ENS - this.ens = new ENS(this); +Eth.prototype.subscribeSyncing = function (callback) { + +}; +/** + * Appends rpc methods to Eth + */ +Eth.prototype.setMethods = function () { var methods = [ new Method({ name: 'getNodeInfo', @@ -368,86 +474,6 @@ var Eth = function Eth() { inputFormatter: [formatter.inputLogFormatter], outputFormatter: formatter.outputLogFormatter }), - - // subscriptions - new Subscriptions({ - name: 'subscribe', - type: 'eth', - subscriptions: { - 'newBlockHeaders': { - // TODO rename on RPC side? - subscriptionName: 'newHeads', // replace subscription with this name - params: 0, - outputFormatter: formatter.outputBlockFormatter - }, - 'pendingTransactions': { - subscriptionName: 'newPendingTransactions', // replace subscription with this name - params: 0 - }, - 'logs': { - params: 1, - inputFormatter: [formatter.inputLogFormatter], - outputFormatter: formatter.outputLogFormatter, - // DUBLICATE, also in web3-eth-contract - subscriptionHandler: function (output) { - if(output.removed) { - this.emit('changed', output); - } else { - this.emit('data', output); - } - - if (_.isFunction(this.callback)) { - this.callback(null, output, this); - } - } - }, - 'syncing': { - params: 0, - outputFormatter: formatter.outputSyncingFormatter, - subscriptionHandler: function (output) { - var _this = this; - - // fire TRUE at start - if(this._isSyncing !== true) { - this._isSyncing = true; - this.emit('changed', _this._isSyncing); - - if (_.isFunction(this.callback)) { - this.callback(null, _this._isSyncing, this); - } - - setTimeout(function () { - _this.emit('data', output); - - if (_.isFunction(_this.callback)) { - _this.callback(null, output, _this); - } - }, 0); - - // fire sync status - } else { - this.emit('data', output); - if (_.isFunction(_this.callback)) { - this.callback(null, output, this); - } - - // wait for some time before fireing the FALSE - clearTimeout(this._isSyncingTimeout); - this._isSyncingTimeout = setTimeout(function () { - if(output.currentBlock > output.highestBlock - 200) { - _this._isSyncing = false; - _this.emit('changed', _this._isSyncing); - - if (_.isFunction(_this.callback)) { - _this.callback(null, _this._isSyncing, _this); - } - } - }, 500); - } - } - } - } - }) ]; methods.forEach(function(method) { @@ -459,8 +485,9 @@ var Eth = function Eth() { }; -core.addProviders(Eth); - +/** + * Extends Eth with clearSubscriptions from the current provider + */ +Eth.prototype.clearSubscriptions = this.currentProvider.clearSubscriptions; module.exports = Eth; - diff --git a/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js b/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js index a54d860e695..3d8bf9f2412 100644 --- a/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js @@ -26,10 +26,20 @@ var JSONRpcMapper = require('../mappers/JSONRpcMapper.js'); var JSONRpcResponseValidator = require('../validators/JSONRpcResponseValidator.js'); var errors = require('web3-core-helpers').errors; +/** + * @param {Object} provider + * @constructor + */ function AbstractProviderAdapter(provider) { this.provider = provider; } +/** + * Sends the JSON-RPC request + * @param {string} method + * @param {Array} parameters + * @returns {Promise} + */ AbstractProviderAdapter.prototype.send = function (method, parameters) { var self = this; var payload = JSONRpcMapper.toPayload(method, parameters); @@ -42,6 +52,12 @@ AbstractProviderAdapter.prototype.send = function (method, parameters) { }); }; +/** + * @param {Function} reject + * @param {Function} resolve + * @param {Object} error + * @param {Object} response + */ AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, error, response) { if (response && response.id && payload.id !== response.id) { reject( @@ -70,6 +86,7 @@ AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, er reject(error); }; +// Inherit EventEmitter AbstractProviderAdapter.prototype = Object.create(EventEmitter.prototype); AbstractProviderAdapter.prototype.constructor = AbstractProviderAdapter; diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-provider/src/adapters/SocketProviderAdapter.js index ff7911d101e..2d308348066 100644 --- a/packages/web3-provider/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-provider/src/adapters/SocketProviderAdapter.js @@ -34,14 +34,16 @@ function SocketProviderAdapter(provider) { * @returns {Promise} */ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, parameters) { + var self = this; + return this.send('eth_subscribe', parameters.unshift(subscriptionType)).then(function (error, subscriptionId) { if (!error) { - this.subscriptions[subscriptionId]({subscriptionType: subscriptionType, type: 'eth'}); + self.subscriptions[subscriptionId]({subscriptionType: subscriptionType, type: 'eth'}); return subscriptionId; } - throw new Error('SUB ERROR'); + throw new Error('Provider error: ' + error); }); }; @@ -79,20 +81,36 @@ SocketProviderAdapter.prototype.registerSubscriptionListener = function () { }; /** - * @param {boolean} keepIsSyncing + * Clears all subscriptions and listeners */ -SocketProviderAdapter.prototype.clearSubscriptions = function (keepIsSyncing) { +SocketProviderAdapter.prototype.clearSubscriptions = function () { var self = this; var unsubscribePromises = []; Object.keys(this.subscriptions).forEach(function (subscriptionId) { - if (!keepIsSyncing || self.subscriptions[subscriptionId].name !== 'syncing') { - unsubscribePromises.push(self.unsubscribe(subscriptionId)); - } + unsubscribePromises.push(self.unsubscribe(subscriptionId)); }); Promise.all(unsubscribePromises).then(function () { this.provider.reset(); + self.subscriptions = []; + }); +}; + +/** + * @param {string} subscriptionId + * @returns {Promise} + */ +SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId) { + var self = this; + return this.subscriptions[subscriptionId].unsubscribe().then(function(result) { + if (result) { + delete self.subscriptions[subscriptionId]; + + return true; + } + + return false; }); }; From 370fbe28900a4f40bc4e3dc4478ed6fe5fa01ad7 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 23 Aug 2018 15:03:00 +0200 Subject: [PATCH 0030/1045] Subscription handling improved --- .../src/Subscription.js | 20 +++++++++++-------- packages/web3-eth/src/index.js | 9 ++++++++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 48143672f47..f1121ce697b 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -29,35 +29,39 @@ var EventEmitter = require('eventemitter3'); * @param {Object} provider * @param {Function} inputFormatter * @param {Function} outputFormatter + * @param {String} type + * @param {Array} parameters + * @param {Function} callback * @constructor */ -function Subscription(provider, inputFormatter, outputFormatter) { +function Subscription(provider, inputFormatter, outputFormatter, type, parameters, callback) { this.provider = provider; this.inputFormatter = inputFormatter; this.outputFormatter = outputFormatter; this.subscriptionId = null; + this.type = type; + this.parameters = parameters; + this.callback = callback; } /** * Sends the JSON-RPC request, emits the required events and executes the callback method. * - * @param {string} type - * @param {*} parameters - * @param {Function} callback + * @returns {Object} Subscription */ -Subscription.prototype.subscribe = function (type, parameters, callback) { +Subscription.prototype.subscribe = function () { var self = this; - this.provider.subscribe(type, this.formatInput(parameters)).then(function (subscriptionId) { + this.provider.subscribe(this.type, this.formatInput(this.parameters)).then(function (subscriptionId) { self.subscriptionId = subscriptionId; self.provider.on(self.subscriptionId, function (error, response) { if (!error) { - self.handleSubscriptionResponse(response, callback); + self.handleSubscriptionResponse(response, self.callback); return; } if(self.provider.once) { - self.reconnect(type, parameters, subscriptionId, callback); + self.reconnect(type, parameters, subscriptionId, self.callback); } callback(error, null); diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 59e98eaa11b..34ed9956266 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -271,7 +271,14 @@ Eth.prototype.subscribe = function (type, parameters, callback) { }; Eth.prototype.subscribeNewHeads = function (callback) { - this.createSubscription('newHeads', outputFormatter, inputFormatter, callback); + return new Subscription( + this.currentProvider, + inputFormatter, + outputFormatter, + 'newHeads', + null, + callback + ).subscribe(); }; Eth.prototype.subscribeNewPendingTransactions = function (callback) { From ea610338d1a7ed66e355b3abe8fc017e9ed6ec37 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 23 Aug 2018 15:22:04 +0200 Subject: [PATCH 0031/1045] subscriptions added to web3.eth --- .../src/Subscription.js | 12 +++---- packages/web3-eth/src/index.js | 33 ++++++++++--------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index f1121ce697b..fc14cc343cc 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -27,21 +27,21 @@ var EventEmitter = require('eventemitter3'); /** * @param {Object} provider - * @param {Function} inputFormatter - * @param {Function} outputFormatter * @param {String} type * @param {Array} parameters + * @param {Function} inputFormatter + * @param {Function} outputFormatter * @param {Function} callback * @constructor */ -function Subscription(provider, inputFormatter, outputFormatter, type, parameters, callback) { +function Subscription(provider, type, parameters, inputFormatter, outputFormatter, callback) { this.provider = provider; - this.inputFormatter = inputFormatter; - this.outputFormatter = outputFormatter; - this.subscriptionId = null; this.type = type; this.parameters = parameters; + this.inputFormatter = inputFormatter; + this.outputFormatter = outputFormatter; this.callback = callback; + this.subscriptionId = null; } /** diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 34ed9956266..15bff00220b 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -254,43 +254,44 @@ Object.defineProperty(Eth, 'defaultBlock', { Eth.prototype.subscribe = function (type, parameters, callback) { switch (type) { case 'newBlockHeaders': - this.subscribeNewHeads(callback); + return this.getSubscriptionWithoutParameters('newHeads', inputFormatter, outputFormatter, callback); break; case 'pendingTransactions': - this.subscribeNewPendingTransactions(callback); + return this.getSubscriptionWithoutParameters('newHeads', inputFormatter, outputFormatter, callback); break; case 'logs':// Special behaviour see subscriptions package - this.subscribeLogs(parameters, callback); break; case 'syncing':// Special behaviour see subscriptionPackage - this.subscribeSyncing(callback); break; default: throw Error('Unknown subscription: ' + type); } }; -Eth.prototype.subscribeNewHeads = function (callback) { +/** + * @param {string} type + * @param {Function} inputFormatter + * @param {Function} outputFormatter + * @param {Function} callback + * @returns {Object} + */ +Eth.prototype.getSubscriptionWithoutParameters = function (type, inputFormatter, outputFormatter, callback) { return new Subscription( - this.currentProvider, + this.provider, + type, + [], inputFormatter, outputFormatter, - 'newHeads', - null, callback ).subscribe(); }; -Eth.prototype.subscribeNewPendingTransactions = function (callback) { - this.createSubscription('newPendingTransactions', outputFormatter, inputFormatter, callback); +Eth.prototype.getLogs = function () { + // Todo: implement get logs }; -Eth.prototype.subscribeLogs = function (parameters, callback) { - this.createSubscription('logs', parameters, outputFormatter, inputFormatter, callback); -}; - -Eth.prototype.subscribeSyncing = function (callback) { - +Eth.prototype.getSyncing = function () { +// Todo: implement syncing subscription }; /** From 9e9f42717d631cf3ee679da9334a39b8a0002d83 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 23 Aug 2018 17:00:32 +0200 Subject: [PATCH 0032/1045] EthSubscriptionResolver created --- .../src/Subscription.js | 32 ++-- packages/web3-eth/src/index.js | 48 +----- .../src/resolvers/EthSubscriptionResolver.js | 150 ++++++++++++++++++ 3 files changed, 176 insertions(+), 54 deletions(-) create mode 100644 packages/web3-eth/src/resolvers/EthSubscriptionResolver.js diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index fc14cc343cc..6af0adc7581 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -31,40 +31,42 @@ var EventEmitter = require('eventemitter3'); * @param {Array} parameters * @param {Function} inputFormatter * @param {Function} outputFormatter - * @param {Function} callback * @constructor */ -function Subscription(provider, type, parameters, inputFormatter, outputFormatter, callback) { +function Subscription(provider, type, parameters, inputFormatter, outputFormatter) { this.provider = provider; this.type = type; this.parameters = parameters; this.inputFormatter = inputFormatter; this.outputFormatter = outputFormatter; - this.callback = callback; this.subscriptionId = null; } /** * Sends the JSON-RPC request, emits the required events and executes the callback method. * + * @param {Function} callback + * * @returns {Object} Subscription */ -Subscription.prototype.subscribe = function () { +Subscription.prototype.subscribe = function (callback) { var self = this; this.provider.subscribe(this.type, this.formatInput(this.parameters)).then(function (subscriptionId) { self.subscriptionId = subscriptionId; self.provider.on(self.subscriptionId, function (error, response) { if (!error) { - self.handleSubscriptionResponse(response, self.callback); + self.handleSubscriptionResponse(response, callback); return; } - if(self.provider.once) { - self.reconnect(type, parameters, subscriptionId, self.callback); + if (self.provider.once) { + self.reconnect(type, parameters, subscriptionId, callback); } - callback(error, null); + if (_.isFunction(callback)) { + callback(error, null); + } self.emit('error', error); }); }); @@ -85,7 +87,9 @@ Subscription.prototype.handleSubscriptionResponse = function (response, callback response.forEach(function (item) { var formattedOutput = this.formatOutput(item); this.emit('data', formattedOutput); - callback(false, formattedOutput); + if (_.isFunction(callback)) { + callback(false, formattedOutput); + } }); }; @@ -108,12 +112,14 @@ Subscription.prototype.reconnect = function (type, parameters, subscriptionId, c self.provider.once('connect', function () { clearInterval(interval); - self.unsubscribe(function(error, result) { + self.unsubscribe(function (error, result) { if (result) { self.subscribe(type, parameters, callback); } - callback(error, null); + if (_.isFunction(callback)) { + callback(error, null); + } }); }); }; @@ -162,7 +168,9 @@ Subscription.prototype.unsubscribe = function (callback) { return true; } - callback(false, true); + if (_.isFunction(callback)) { + callback(false, true); + } return false; }); diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 15bff00220b..c145918e4f2 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -37,6 +37,7 @@ var Accounts = require('web3-eth-accounts'); var ABI = require('web3-eth-abi'); var getNetworkType = require('./getNetworkType.js'); +var EthSubscriptionResolver = require('./resolvers/EthSubscriptionResolver'); var formatter = helpers.formatters; @@ -71,6 +72,8 @@ var Eth = function Eth() { this.setENSPackage(new ENS(this)); this.setMethods(); + this.subscriptionResolver = new EthSubscriptionResolver(this.currentProvider); + // sets _requestmanager core.packageInit(this, arguments); }; @@ -245,53 +248,14 @@ Object.defineProperty(Eth, 'defaultBlock', { }); /** - * Starts subscription for an given type + * Gets and executes subscription for an given type * * @param {string} type - * @param {Object} parameters + * @param {*} parameters * @param {Function} callback */ Eth.prototype.subscribe = function (type, parameters, callback) { - switch (type) { - case 'newBlockHeaders': - return this.getSubscriptionWithoutParameters('newHeads', inputFormatter, outputFormatter, callback); - break; - case 'pendingTransactions': - return this.getSubscriptionWithoutParameters('newHeads', inputFormatter, outputFormatter, callback); - break; - case 'logs':// Special behaviour see subscriptions package - break; - case 'syncing':// Special behaviour see subscriptionPackage - break; - default: - throw Error('Unknown subscription: ' + type); - } -}; - -/** - * @param {string} type - * @param {Function} inputFormatter - * @param {Function} outputFormatter - * @param {Function} callback - * @returns {Object} - */ -Eth.prototype.getSubscriptionWithoutParameters = function (type, inputFormatter, outputFormatter, callback) { - return new Subscription( - this.provider, - type, - [], - inputFormatter, - outputFormatter, - callback - ).subscribe(); -}; - -Eth.prototype.getLogs = function () { - // Todo: implement get logs -}; - -Eth.prototype.getSyncing = function () { -// Todo: implement syncing subscription + return this.subscriptionResolver.resolve(type, parameters).subscribe(callback); }; /** diff --git a/packages/web3-eth/src/resolvers/EthSubscriptionResolver.js b/packages/web3-eth/src/resolvers/EthSubscriptionResolver.js new file mode 100644 index 00000000000..ff8f6ec12a9 --- /dev/null +++ b/packages/web3-eth/src/resolvers/EthSubscriptionResolver.js @@ -0,0 +1,150 @@ +/* + 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 . +*/ +/** + * @file EthSubscriptionResolver.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var Subscription = require('web3-core-subscription'); +var formatters = require('web3-core-helpers').formatters; + +/** + * @param {Object} provider + * @constructor + */ +function EthSubscriptionResolver(provider) { + this.provider = provider; +} + +/** + * Resolves the requested subscription + * + * @param {string} type + * @param {any} parameters + * @param {Function} callback + * @returns {Object} + */ +EthSubscriptionResolver.prototype.resolve = function (type, parameters, callback) { + switch (type) { + case 'newBlockHeaders': + return this.getSubscription('newHeads', null, null, formatters.outputBlockFormatter, callback); + break; + case 'pendingTransactions': + return this.getSubscription('newPendingTransactions', null, null, null, callback); + break; + case 'logs': + // TODO: need clarifaction if we really + break; + case 'syncing': + return this.getSyncingSubscription(callback); + break; + default: + throw Error('Unknown subscription: ' + type); + } +}; + +/** + * Create Subscription object + * + * @param {string} type + * @param {any} parameters + * @param {Function} inputFormatter + * @param {Function} outputFormatter + * @param {Function} callback + * @returns {Subscription} + */ +EthSubscriptionResolver.prototype.getSubscription = function (type, parameters, inputFormatter, outputFormatter, callback) { + if (!parameters) { + parameters = []; + } + + return new Subscription( + this.provider, + type, + parameters, + inputFormatter, + outputFormatter + ).subscribe(callback); +}; + +/** + * @param parameters + */ +EthSubscriptionResolver.prototype.getLogsSubscription = function (parameters) { + // implementation on hold +}; + +/** + * @param {Function} callback + */ +EthSubscriptionResolver.prototype.getSyncingSubscription = function (callback) { + var subscription = new Subscription( + this.provider, + 'syncing', + null, + formatters.outputSyncingFormatter + ); + + subscription.subscribe().on('data', function (output) { + var self = this; + + // fire TRUE at start + if (this.isSyncing !== true) { + this.isSyncing = true; + subscription.emit('changed', this.isSyncing); + + if (_.isFunction(callback)) { + callback(null, this.isSyncing, this); + } + + setTimeout(function () { + subscription.emit('data', output); + + if (_.isFunction(self.callback)) { + callback(null, output, self); + } + }, 0); + + // fire sync status + } else { + subscription.emit('data', output); + if (_.isFunction(callback)) { + callback(null, output, this); + } + + // wait for some time before fireing the FALSE + clearTimeout(this.isSyncingTimeout); + this.isSyncingTimeout = setTimeout(function () { + if (output.currentBlock > output.highestBlock - 200) { + self.isSyncing = false; + subscription.emit('changed', self.isSyncing); + + if (_.isFunction(callback)) { + callback(null, self.isSyncing, self); + } + } + }, 500); + } + }); + + return subscription; +}; + +module.exports = EthSubscriptionResolver; From 75084033f8c40892b4d51ea0fc0887e2358bf97d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 24 Aug 2018 15:59:56 +0200 Subject: [PATCH 0033/1045] Factories created, ConnectionModel singleton created, refactoring startet eth package with new connection handling. --- packages/web3-core-subscription/src/index.js | 4 + packages/web3-eth/src/Eth.js | 495 ++++++++++++++++++ packages/web3-eth/src/index.js | 466 +---------------- ...onResolver.js => SubscriptionsResolver.js} | 23 +- packages/web3-provider/src/index.js | 6 +- packages/web3/src/factories/CoreFactory.js | 82 +++ packages/web3/src/factories/PackageFactory.js | 87 +++ packages/web3/src/index.js | 100 ++-- packages/web3/src/models/ConnectionModel.js | 30 ++ 9 files changed, 782 insertions(+), 511 deletions(-) create mode 100644 packages/web3-core-subscription/src/index.js create mode 100644 packages/web3-eth/src/Eth.js rename packages/web3-eth/src/resolvers/{EthSubscriptionResolver.js => SubscriptionsResolver.js} (85%) create mode 100644 packages/web3/src/factories/CoreFactory.js create mode 100644 packages/web3/src/factories/PackageFactory.js create mode 100644 packages/web3/src/models/ConnectionModel.js diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js new file mode 100644 index 00000000000..d332966b4ca --- /dev/null +++ b/packages/web3-core-subscription/src/index.js @@ -0,0 +1,4 @@ + +var Subscription = require('./Subscription'); + +module.exports = Subscription; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js new file mode 100644 index 00000000000..31a9a2cfed2 --- /dev/null +++ b/packages/web3-eth/src/Eth.js @@ -0,0 +1,495 @@ +/* + 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 . + */ +/** + * @file index.js + * @author Fabian Vogelsteller + * @date 2017 + */ + +"use strict"; + +var _ = require('underscore'); +var core = require('web3-core'); +var helpers = require('web3-core-helpers'); +var Method = require('web3-core-method'); +var utils = require('web3-utils'); +var Net = require('web3-net'); + +var ENS = require('web3-eth-ens'); +var Personal = require('web3-eth-personal'); +var BaseContract = require('web3-eth-contract'); +var Iban = require('web3-eth-iban'); +var Accounts = require('web3-eth-accounts'); +var ABI = require('web3-eth-abi'); + +var getNetworkType = require('./getNetworkType.js'); +var SubscriptionsResolver = require('./resolvers/SubscriptionsResolver'); +var formatter = helpers.formatters; + + +var blockCall = function (args) { + return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockByHash" : "eth_getBlockByNumber"; +}; + +var transactionFromBlockCall = function (args) { + return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex'; +}; + +var uncleCall = function (args) { + return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex'; +}; + +var getBlockTransactionCountCall = function (args) { + return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber'; +}; + +var uncleCountCall = function (args) { + return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber'; +}; + + +var Eth = function Eth( + batchRequest, + givenProvider, + providers, + extend, + baseContract, + net, + accounts, + personal, + iban, + abi, + ens, + method, + utils, + helpers, + networkType, + underscore, + formatters, + subscriptionResolver +) { + this.setContractPackage(BaseContract); + this.setNetPackage(new Net(this.currentProvider)); + this.setAccountsPackage(new Accounts(this.currentProvider)); + this.setPersonalPackage(new Personal(this.currentProvider)); + this.setIBANPackage(Iban); + this.setABIPackage(ABI); + this.setENSPackage(new ENS(this)); + this.setMethods(); + this.setSubscriptionsResolver(new SubscriptionsResolver(this.currentProvider)); + + // sets _requestmanager + core.packageInit(this, arguments); +}; + +core.addProviders(Eth); + +/** + * PACKAGE INIT (core.packageInit) overwrites setProvider! + * + * // overwrite setProvider + var setProvider = this.setProvider; + * + * + */ +Eth.prototype.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); + this.subscriptionsResolver.setProvider(this.currentProvider); +}; + +/** + * Sets the Contract package as property of Eth + * + * @param {Object} contractPackage + */ +Eth.prototype.setContractPackage = function (contractPackage) { + // create a proxy Contract type for this instance, as a Contract's provider + // is stored as a class member rather than an instance variable. If we do + // not create this proxy type, changing the provider in one instance of + // web3-eth would subsequently change the provider for _all_ contract + // instances! + var self = this; + var Contract = function Contract() { + contractPackage.apply(this, arguments); + + // when Eth.setProvider is called, call packageInit + // on all contract instances instantiated via this Eth + // instances. This will update the currentProvider for + // the contract instances + var _this = this; + var setProvider = self.setProvider; + self.setProvider = function () { + setProvider.apply(self, arguments); + core.packageInit(_this, [self.currentProvider]); + }; + }; + + Contract.setProvider = function () { + contractPackage.setProvider.apply(this, arguments); + }; + + // make our proxy Contract inherit from web3-eth-contract so that it has all + // the right functionality and so that instanceof and friends work properly + Contract.prototype = Object.create(contractPackage.prototype); + Contract.prototype.constructor = Contract; + + // add contract + this.Contract = Contract; + this.Contract.defaultAccount = this.defaultAccount; + this.Contract.defaultBlock = this.defaultBlock; + this.Contract.setProvider(this.currentProvider, this.accounts); + +}; + +/** + * Sets the Net package as property of Eth + * + * @param {Object} net + */ +Eth.prototype.setNetPackage = function (net) { + this.net = net; + this.net.getNetworkType = getNetworkType.bind(this); +}; + +/** + * Sets the Accounts package as property of Eth + * + * @param {Object} accounts + */ +Eth.prototype.setAccountsPackage = function (accounts) { + this.accounts = accounts; +}; + +/** + * Sets the Personal package as property of Eth + * + * @param {Object} personal + */ +Eth.prototype.setPersonalPackage = function (personal) { + this.personal = personal; + this.personal.defaultAccount = this.defaultAccount; +}; + +/** + * Sets the Iban package as property of Eth + * + * @param {Object} iban + */ +Eth.prototype.setIBANPackage = function (iban) { + this.Iban = iban; +}; + +/** + * Sets the ABI package as property of Eth + * + * @param {Object} abi + */ +Eth.prototype.setABIPackage = function (abi) { + this.abi = abi; +}; + +/** + * Sets the ENS package as property of Eth + * + * @param {Object} ens + */ +Eth.prototype.setENSPackage = function (ens) { + this.ens = ens; +}; + +/** + * Sets the SubscriptionsResolver + * + * @param subscriptionsResolver + */ +Eth.prototype.setSubscriptionsResolver = function (subscriptionsResolver) { + this.subscriptionsResolver = subscriptionsResolver; +}; + +/** + * Defines accessors for defaultAccount + */ +Object.defineProperty(Eth, 'defaultAccount', { + get: function () { + return this.defaultAccount ? this.defaultAccount : null; + }, + set: function (val) { + if (val) { + this.defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); + } + + // also set on the Contract object + _this.Contract.defaultAccount = defaultAccount; + _this.personal.defaultAccount = defaultAccount; + + // update defaultBlock + methods.forEach(function (method) { + method.defaultAccount = defaultAccount; + }); + + return val; + }, + enumerable: true +}); + +/** + * Defines accessors for defaultBlock + */ +Object.defineProperty(Eth, 'defaultBlock', { + get: function () { + return this.defaultBlock ? this.defaultBlock : 'latest'; + }, + set: function (val) { + var self = this; + this.defaultBlock = val; + + // also set on the Contract object + this.Contract.defaultBlock = this.defaultBlock; + this.personal.defaultBlock = this.defaultBlock; + + // update defaultBlock + methods.forEach(function (method) { + method.defaultBlock = self.defaultBlock; + }); + + return val; + }, + enumerable: true +}); + +/** + * Gets and executes subscription for an given type + * + * @param {string} type + * @param {*} parameters + * @param {Function} callback + */ +Eth.prototype.subscribe = function (type, parameters, callback) { + return this.subscriptionsResolver.resolve(type, parameters).subscribe(callback); +}; + +/** + * Appends rpc methods to Eth + */ +Eth.prototype.setMethods = function () { + var methods = [ + new Method({ + name: 'getNodeInfo', + call: 'web3_clientVersion' + }), + new Method({ + name: 'getProtocolVersion', + call: 'eth_protocolVersion', + params: 0 + }), + new Method({ + name: 'getCoinbase', + call: 'eth_coinbase', + params: 0 + }), + new Method({ + name: 'isMining', + call: 'eth_mining', + params: 0 + }), + new Method({ + name: 'getHashrate', + call: 'eth_hashrate', + params: 0, + outputFormatter: utils.hexToNumber + }), + new Method({ + name: 'isSyncing', + call: 'eth_syncing', + params: 0, + outputFormatter: formatter.outputSyncingFormatter + }), + new Method({ + name: 'getGasPrice', + call: 'eth_gasPrice', + params: 0, + outputFormatter: formatter.outputBigNumberFormatter + }), + new Method({ + name: 'getAccounts', + call: 'eth_accounts', + params: 0, + outputFormatter: utils.toChecksumAddress + }), + new Method({ + name: 'getBlockNumber', + call: 'eth_blockNumber', + params: 0, + outputFormatter: utils.hexToNumber + }), + new Method({ + name: 'getBalance', + call: 'eth_getBalance', + params: 2, + inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], + outputFormatter: formatter.outputBigNumberFormatter + }), + new Method({ + name: 'getStorageAt', + call: 'eth_getStorageAt', + params: 3, + inputFormatter: [formatter.inputAddressFormatter, utils.numberToHex, formatter.inputDefaultBlockNumberFormatter] + }), + new Method({ + name: 'getCode', + call: 'eth_getCode', + params: 2, + inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter] + }), + new Method({ + name: 'getBlock', + call: blockCall, + params: 2, + inputFormatter: [formatter.inputBlockNumberFormatter, function (val) { + return !!val; + }], + outputFormatter: formatter.outputBlockFormatter + }), + new Method({ + name: 'getUncle', + call: uncleCall, + params: 2, + inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], + outputFormatter: formatter.outputBlockFormatter, + + }), + new Method({ + name: 'getBlockTransactionCount', + call: getBlockTransactionCountCall, + params: 1, + inputFormatter: [formatter.inputBlockNumberFormatter], + outputFormatter: utils.hexToNumber + }), + new Method({ + name: 'getBlockUncleCount', + call: uncleCountCall, + params: 1, + inputFormatter: [formatter.inputBlockNumberFormatter], + outputFormatter: utils.hexToNumber + }), + new Method({ + name: 'getTransaction', + call: 'eth_getTransactionByHash', + params: 1, + inputFormatter: [null], + outputFormatter: formatter.outputTransactionFormatter + }), + new Method({ + name: 'getTransactionFromBlock', + call: transactionFromBlockCall, + params: 2, + inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], + outputFormatter: formatter.outputTransactionFormatter + }), + new Method({ + name: 'getTransactionReceipt', + call: 'eth_getTransactionReceipt', + params: 1, + inputFormatter: [null], + outputFormatter: formatter.outputTransactionReceiptFormatter + }), + new Method({ + name: 'getTransactionCount', + call: 'eth_getTransactionCount', + params: 2, + inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], + outputFormatter: utils.hexToNumber + }), + new Method({ + name: 'sendSignedTransaction', + call: 'eth_sendRawTransaction', + params: 1, + inputFormatter: [null] + }), + new Method({ + name: 'signTransaction', + call: 'eth_signTransaction', + params: 1, + inputFormatter: [formatter.inputTransactionFormatter] + }), + new Method({ + name: 'sendTransaction', + call: 'eth_sendTransaction', + params: 1, + inputFormatter: [formatter.inputTransactionFormatter] + }), + new Method({ + name: 'sign', + call: 'eth_sign', + params: 2, + inputFormatter: [formatter.inputSignFormatter, formatter.inputAddressFormatter], + transformPayload: function (payload) { + payload.params.reverse(); + return payload; + } + }), + new Method({ + name: 'call', + call: 'eth_call', + params: 2, + inputFormatter: [formatter.inputCallFormatter, formatter.inputDefaultBlockNumberFormatter] + }), + new Method({ + name: 'estimateGas', + call: 'eth_estimateGas', + params: 1, + inputFormatter: [formatter.inputCallFormatter], + outputFormatter: utils.hexToNumber + }), + new Method({ + name: 'submitWork', + call: 'eth_submitWork', + params: 3 + }), + new Method({ + name: 'getWork', + call: 'eth_getWork', + params: 0 + }), + new Method({ + name: 'getPastLogs', + call: 'eth_getLogs', + params: 1, + inputFormatter: [formatter.inputLogFormatter], + outputFormatter: formatter.outputLogFormatter + }), + ]; + + 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; + }); + +}; + +/** + * Extends Eth with clearSubscriptions from the current provider + */ +Eth.prototype.clearSubscriptions = this.currentProvider.clearSubscriptions; + +module.exports = Eth; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index c145918e4f2..c32304cc5d3 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -1,465 +1,9 @@ -/* - 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. +var Eth = require('./Eth'); +var SubscriptionsResolver = require('./resolvers/SubscriptionsResolver'); - 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 . - */ -/** - * @file index.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -"use strict"; - -var _ = require('underscore'); -var core = require('web3-core'); -var helpers = require('web3-core-helpers'); -var Method = require('web3-core-method'); -var utils = require('web3-utils'); -var Net = require('web3-net'); - -var ENS = require('web3-eth-ens'); -var Personal = require('web3-eth-personal'); -var BaseContract = require('web3-eth-contract'); -var Iban = require('web3-eth-iban'); -var Accounts = require('web3-eth-accounts'); -var ABI = require('web3-eth-abi'); - -var getNetworkType = require('./getNetworkType.js'); -var EthSubscriptionResolver = require('./resolvers/EthSubscriptionResolver'); -var formatter = helpers.formatters; - - -var blockCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockByHash" : "eth_getBlockByNumber"; -}; - -var transactionFromBlockCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex'; -}; - -var uncleCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex'; -}; - -var getBlockTransactionCountCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber'; -}; - -var uncleCountCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber'; -}; - - -var Eth = function Eth() { - this.setContractPackage(BaseContract); - this.setNetPackage(new Net(this.currentProvider)); - this.setAccountsPackage(new Accounts(this.currentProvider)); - this.setPersonalPackage(new Personal(this.currentProvider)); - this.setIBANPackage(Iban); - this.setABIPackage(ABI); - this.setENSPackage(new ENS(this)); - this.setMethods(); - - this.subscriptionResolver = new EthSubscriptionResolver(this.currentProvider); - - // sets _requestmanager - core.packageInit(this, arguments); -}; - -core.addProviders(Eth); - -/** - * PACKAGE INIT (core.packageInit) overwrites setProvider! - * - * // overwrite setProvider - var setProvider = this.setProvider; - * - * - */ -Eth.prototype.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); -}; - -/** - * Sets the Contract package as property of Eth - * - * @param {Object} contractPackage - */ -Eth.prototype.setContractPackage = function (contractPackage) { - // create a proxy Contract type for this instance, as a Contract's provider - // is stored as a class member rather than an instance variable. If we do - // not create this proxy type, changing the provider in one instance of - // web3-eth would subsequently change the provider for _all_ contract - // instances! - var self = this; - var Contract = function Contract() { - contractPackage.apply(this, arguments); - - // when Eth.setProvider is called, call packageInit - // on all contract instances instantiated via this Eth - // instances. This will update the currentProvider for - // the contract instances - var _this = this; - var setProvider = self.setProvider; - self.setProvider = function() { - setProvider.apply(self, arguments); - core.packageInit(_this, [self.currentProvider]); - }; - }; - - Contract.setProvider = function() { - contractPackage.setProvider.apply(this, arguments); - }; - - // make our proxy Contract inherit from web3-eth-contract so that it has all - // the right functionality and so that instanceof and friends work properly - Contract.prototype = Object.create(contractPackage.prototype); - Contract.prototype.constructor = Contract; - - // add contract - this.Contract = Contract; - this.Contract.defaultAccount = this.defaultAccount; - this.Contract.defaultBlock = this.defaultBlock; - this.Contract.setProvider(this.currentProvider, this.accounts); - -}; - -/** - * Sets the Net package as property of Eth - * - * @param {Object} net - */ -Eth.prototype.setNetPackage = function (net) { - this.net = net; - this.net.getNetworkType = getNetworkType.bind(this); -}; - -/** - * Sets the Accounts package as property of Eth - * - * @param {Object} accounts - */ -Eth.prototype.setAccountsPackage = function (accounts) { - this.accounts = accounts; -}; - -/** - * Sets the Personal package as property of Eth - * - * @param {Object} personal - */ -Eth.prototype.setPersonalPackage = function (personal) { - this.personal = personal; - this.personal.defaultAccount = this.defaultAccount; +module.exports = { + Eth: Eth, + SubscriptionsResolver: SubscriptionsResolver }; -/** - * Sets the Iban package as property of Eth - * - * @param {Object} iban - */ -Eth.prototype.setIBANPackage = function (iban) { - this.Iban = iban; -}; - -/** - * Sets the ABI package as property of Eth - * - * @param {Object} abi - */ -Eth.prototype.setABIPackage = function (abi) { - this.abi = abi; -}; - -/** - * Sets the ENS package as property of Eth - * - * @param {Object} ens - */ -Eth.prototype.setENSPackage = function (ens) { - this.ens = ens; -}; - -/** - * Defines accessors for defaultAccount - */ -Object.defineProperty(Eth, 'defaultAccount', { - get: function () { - return this.defaultAccount ? this.defaultAccount : null; - }, - set: function (val) { - if(val) { - this.defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); - } - - // also set on the Contract object - _this.Contract.defaultAccount = defaultAccount; - _this.personal.defaultAccount = defaultAccount; - - // update defaultBlock - methods.forEach(function(method) { - method.defaultAccount = defaultAccount; - }); - - return val; - }, - enumerable: true -}); - -/** - * Defines accessors for defaultBlock - */ -Object.defineProperty(Eth, 'defaultBlock', { - get: function () { - return this.defaultBlock ? this.defaultBlock : 'latest'; - }, - set: function (val) { - var self = this; - this.defaultBlock = val; - - // also set on the Contract object - this.Contract.defaultBlock = this.defaultBlock; - this.personal.defaultBlock = this.defaultBlock; - - // update defaultBlock - methods.forEach(function(method) { - method.defaultBlock = self.defaultBlock; - }); - - return val; - }, - enumerable: true -}); - -/** - * Gets and executes subscription for an given type - * - * @param {string} type - * @param {*} parameters - * @param {Function} callback - */ -Eth.prototype.subscribe = function (type, parameters, callback) { - return this.subscriptionResolver.resolve(type, parameters).subscribe(callback); -}; - -/** - * Appends rpc methods to Eth - */ -Eth.prototype.setMethods = function () { - var methods = [ - new Method({ - name: 'getNodeInfo', - call: 'web3_clientVersion' - }), - new Method({ - name: 'getProtocolVersion', - call: 'eth_protocolVersion', - params: 0 - }), - new Method({ - name: 'getCoinbase', - call: 'eth_coinbase', - params: 0 - }), - new Method({ - name: 'isMining', - call: 'eth_mining', - params: 0 - }), - new Method({ - name: 'getHashrate', - call: 'eth_hashrate', - params: 0, - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'isSyncing', - call: 'eth_syncing', - params: 0, - outputFormatter: formatter.outputSyncingFormatter - }), - new Method({ - name: 'getGasPrice', - call: 'eth_gasPrice', - params: 0, - outputFormatter: formatter.outputBigNumberFormatter - }), - new Method({ - name: 'getAccounts', - call: 'eth_accounts', - params: 0, - outputFormatter: utils.toChecksumAddress - }), - new Method({ - name: 'getBlockNumber', - call: 'eth_blockNumber', - params: 0, - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'getBalance', - call: 'eth_getBalance', - params: 2, - inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], - outputFormatter: formatter.outputBigNumberFormatter - }), - new Method({ - name: 'getStorageAt', - call: 'eth_getStorageAt', - params: 3, - inputFormatter: [formatter.inputAddressFormatter, utils.numberToHex, formatter.inputDefaultBlockNumberFormatter] - }), - new Method({ - name: 'getCode', - call: 'eth_getCode', - params: 2, - inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter] - }), - new Method({ - name: 'getBlock', - call: blockCall, - params: 2, - inputFormatter: [formatter.inputBlockNumberFormatter, function (val) { return !!val; }], - outputFormatter: formatter.outputBlockFormatter - }), - new Method({ - name: 'getUncle', - call: uncleCall, - params: 2, - inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], - outputFormatter: formatter.outputBlockFormatter, - - }), - new Method({ - name: 'getBlockTransactionCount', - call: getBlockTransactionCountCall, - params: 1, - inputFormatter: [formatter.inputBlockNumberFormatter], - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'getBlockUncleCount', - call: uncleCountCall, - params: 1, - inputFormatter: [formatter.inputBlockNumberFormatter], - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'getTransaction', - call: 'eth_getTransactionByHash', - params: 1, - inputFormatter: [null], - outputFormatter: formatter.outputTransactionFormatter - }), - new Method({ - name: 'getTransactionFromBlock', - call: transactionFromBlockCall, - params: 2, - inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], - outputFormatter: formatter.outputTransactionFormatter - }), - new Method({ - name: 'getTransactionReceipt', - call: 'eth_getTransactionReceipt', - params: 1, - inputFormatter: [null], - outputFormatter: formatter.outputTransactionReceiptFormatter - }), - new Method({ - name: 'getTransactionCount', - call: 'eth_getTransactionCount', - params: 2, - inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'sendSignedTransaction', - call: 'eth_sendRawTransaction', - params: 1, - inputFormatter: [null] - }), - new Method({ - name: 'signTransaction', - call: 'eth_signTransaction', - params: 1, - inputFormatter: [formatter.inputTransactionFormatter] - }), - new Method({ - name: 'sendTransaction', - call: 'eth_sendTransaction', - params: 1, - inputFormatter: [formatter.inputTransactionFormatter] - }), - new Method({ - name: 'sign', - call: 'eth_sign', - params: 2, - inputFormatter: [formatter.inputSignFormatter, formatter.inputAddressFormatter], - transformPayload: function (payload) { - payload.params.reverse(); - return payload; - } - }), - new Method({ - name: 'call', - call: 'eth_call', - params: 2, - inputFormatter: [formatter.inputCallFormatter, formatter.inputDefaultBlockNumberFormatter] - }), - new Method({ - name: 'estimateGas', - call: 'eth_estimateGas', - params: 1, - inputFormatter: [formatter.inputCallFormatter], - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'submitWork', - call: 'eth_submitWork', - params: 3 - }), - new Method({ - name: 'getWork', - call: 'eth_getWork', - params: 0 - }), - new Method({ - name: 'getPastLogs', - call: 'eth_getLogs', - params: 1, - inputFormatter: [formatter.inputLogFormatter], - outputFormatter: formatter.outputLogFormatter - }), - ]; - - 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; - }); - -}; - -/** - * Extends Eth with clearSubscriptions from the current provider - */ -Eth.prototype.clearSubscriptions = this.currentProvider.clearSubscriptions; - -module.exports = Eth; diff --git a/packages/web3-eth/src/resolvers/EthSubscriptionResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js similarity index 85% rename from packages/web3-eth/src/resolvers/EthSubscriptionResolver.js rename to packages/web3-eth/src/resolvers/SubscriptionsResolver.js index ff8f6ec12a9..b17aacfc436 100644 --- a/packages/web3-eth/src/resolvers/EthSubscriptionResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file EthSubscriptionResolver.js + * @file SubscriptionsResolver.js * @authors: Samuel Furter * @date 2018 */ @@ -29,7 +29,7 @@ var formatters = require('web3-core-helpers').formatters; * @param {Object} provider * @constructor */ -function EthSubscriptionResolver(provider) { +function SubscriptionsResolver(provider) { this.provider = provider; } @@ -41,7 +41,7 @@ function EthSubscriptionResolver(provider) { * @param {Function} callback * @returns {Object} */ -EthSubscriptionResolver.prototype.resolve = function (type, parameters, callback) { +SubscriptionsResolver.prototype.resolve = function (type, parameters, callback) { switch (type) { case 'newBlockHeaders': return this.getSubscription('newHeads', null, null, formatters.outputBlockFormatter, callback); @@ -70,7 +70,7 @@ EthSubscriptionResolver.prototype.resolve = function (type, parameters, callback * @param {Function} callback * @returns {Subscription} */ -EthSubscriptionResolver.prototype.getSubscription = function (type, parameters, inputFormatter, outputFormatter, callback) { +SubscriptionsResolver.prototype.getSubscription = function (type, parameters, inputFormatter, outputFormatter, callback) { if (!parameters) { parameters = []; } @@ -87,14 +87,14 @@ EthSubscriptionResolver.prototype.getSubscription = function (type, parameters, /** * @param parameters */ -EthSubscriptionResolver.prototype.getLogsSubscription = function (parameters) { +SubscriptionsResolver.prototype.getLogsSubscription = function (parameters) { // implementation on hold }; /** * @param {Function} callback */ -EthSubscriptionResolver.prototype.getSyncingSubscription = function (callback) { +SubscriptionsResolver.prototype.getSyncingSubscription = function (callback) { var subscription = new Subscription( this.provider, 'syncing', @@ -147,4 +147,13 @@ EthSubscriptionResolver.prototype.getSyncingSubscription = function (callback) { return subscription; }; -module.exports = EthSubscriptionResolver; +/** + * Sets the provider + * + * @param {Object} provider + */ +SubscriptionsResolver.prototype.setProvider = function (provider) { + this.provider = provider; +}; + +module.exports = SubscriptionsResolver; diff --git a/packages/web3-provider/src/index.js b/packages/web3-provider/src/index.js index 04373751fef..f70490d15a3 100644 --- a/packages/web3-provider/src/index.js +++ b/packages/web3-provider/src/index.js @@ -21,5 +21,9 @@ "use strict"; var ProviderAdapterResolver = require('./resolvers/ProviderAdapterResolver'); +var ProviderDetector = require('./detectors/ProviderDetector'); -module.exports = ProviderAdapterResolver; +module.exports = { + ProviderAdapterResolver: ProviderAdapterResolver, + ProviderDetector: ProviderDetector +}; diff --git a/packages/web3/src/factories/CoreFactory.js b/packages/web3/src/factories/CoreFactory.js new file mode 100644 index 00000000000..3721ff80aa0 --- /dev/null +++ b/packages/web3/src/factories/CoreFactory.js @@ -0,0 +1,82 @@ +var Subscription = require('web3-core-subscription'); +var PromiEvent = require('web3-core-promievent'); +var Net = require('web3-net'); +var helpers = require('web3-core-helpers'); +var Utils = require('web3-utils'); + +function CoreFactory() { } + +/** + * Creates Subscription object + * + * @param {Object} connectionModel + * @param {string} type + * @param {*} parameters + * @param {Object} inputFormatter + * @param {Object} outputFormatter + */ +CoreFactory.prototype.createSubscription = function (connectionModel, type, parameters, inputFormatter, outputFormatter) { + return new Subscription(connectionModel, type, parameters, inputFormatter, outputFormatter); +}; + +/** + * Creates PromiEvent object + * + * @param {boolean} justPromise + */ +CoreFactory.prototype.createPromiEvent = function (justPromise) { + return new PromiEvent(justPromise); +}; + +/** + * Creates Method object + * + * @param {ConnectionModel} connectionModel + * @param {Object} options + * @param {boolean} justPromise + * @returns {Method} + */ +CoreFactory.prototype.createMethod = function (connectionModel, options, justPromise) { + return new Method(connectionModel, this.createPromiEvent(justPromise), options); +}; + +/** + * @returns {Object} + */ +CoreFactory.prototype.createUtils = function () { // maybe this can be in a global scope + return Utils; +}; + +/** + * Creates Batch object + * + * @param {Object} connectionModel + * @returns {Batch} + */ +CoreFactory.prototype.createBatch = function (connectionModel) { + return new Batch(connectionModel); +}; + +// This helpers things are strange.. maybe we can add this directly in the Web3 global scope.. something like helpers.X +CoreFactory.prototype.createFormatters = function () {// helpers + return helpers.formatters; +}; + +CoreFactory.prototype.createErrors = function () { // helpers + return helpers.errors; +}; + +//TODO: move this to connection model +// /** +// * Creates Net object +// * +// * @param {Object} provider +// * @returns {Net} +// */ +// CoreFactory.prototype.createNet = function (provider) { +// if (provider) { +// this.connectionModel.setProvider(provider); +// } +// +// return new Net(this.connectionModel); +// }; diff --git a/packages/web3/src/factories/PackageFactory.js b/packages/web3/src/factories/PackageFactory.js new file mode 100644 index 00000000000..05903fe67b9 --- /dev/null +++ b/packages/web3/src/factories/PackageFactory.js @@ -0,0 +1,87 @@ +var Shh = require('web3-shh'); +var Bzz = require('web3-bzz'); +var ENS = require('web3-eth-ens'); +var Accounts = require('web3-eth-accounts'); +var Personal = require('web3-eth-personal'); +var EthPackage = require('web3-eth'); +var Iban = require('web3-eth-iban'); +var Contract = require('web3-eth-contract'); +var ABI = require('web3-eth-abi'); + +/** + * @param {Object} coreFactory + * @param {Object} connectionModel + * @constructor + */ +function PackageFactory(coreFactory, connectionModel) { + this.coreFactory = coreFactory; + this.connectionModel = connectionModel; +} + +/** + * @returns {Shh} + */ +PackageFactory.prototype.createShhPackage = function () { + return new Shh(this.connectionModel, this.coreFactory); +}; + +/** + * @returns {Bzz} + */ +PackageFactory.prototype.createBzzPackage = function () { + return new Bzz(this.connectionModel); +}; + +/** + * @returns {ENS} + */ +PackageFactory.prototype.createEnsPackage = function () { + return new ENS(this.connectionModel, this.createEthPackage()); +}; + +/** + * @returns {Accounts} + */ +PackageFactory.prototype.createAccountsPackage = function () { + return new Accounts(this.connectionModel, this.coreFactory); +}; + +/** + * @returns {Personal} + */ +PackageFactory.prototype.createPersonalPackage = function () { + return new Personal(this.connectionModel, this.coreFactory); +}; + +/** + * @returns {Eth} + */ +PackageFactory.prototype.createEthPackage = function () { + return new EthPackage.Eth( + this.connectionModel, + this, + this.coreFactory, + new EthPackage.SubscriptionsResolver(this.connectionModel) + ); +}; + +/** + * @returns {Contract} + */ +PackageFactory.prototype.createContractPackage = function () { + return Contract;// have a closer look later +}; + +/** + * @returns {Iban} + */ +PackageFactory.prototype.createIbanPackage = function () { + return Iban;// have a closer look later +}; + +/** + * @returns {ABI} + */ +PackageFactory.prototype.createAbiPackage = function () { + return new ABI(this.coreFactory.createUtils()); +}; diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 789c1785ac9..afbd03e6c5e 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -16,64 +16,80 @@ */ /** * @file index.js - * @authors: - * Fabian Vogelsteller - * Gav Wood - * Jeffrey Wilcke - * Marek Kotewicz - * Marian Oancea - * @date 2017 + * @authors: Samuel Furter + * @date 2018 */ "use strict"; - +var PackageFactory = require('./factories/PackageFactory'); +var CoreFactory = require('./factories/CoreFactory'); var version = require('../package.json').version; -var core = require('web3-core'); -var Eth = require('web3-eth'); -var Net = require('web3-net'); -var Personal = require('web3-eth-personal'); -var Shh = require('web3-shh'); -var Bzz = require('web3-bzz'); -var utils = require('web3-utils'); - -var Web3 = function Web3() { - var _this = this; - // sets _requestmanager etc - core.packageInit(this, arguments); +/** + * @param {Object} provider + * @param {Object} net + * @constructor + */ +var Web3 = function Web3(provider, net) { + this.connectionModel = new ConnectionModel(provider); + this.coreFactory = new CoreFactory(); + this.packageFactory = new PackageFactory(this.coreFactory, this.connectionModel); this.version = version; - this.utils = utils; - this.eth = new Eth(this); - this.shh = new Shh(this); - this.bzz = new Bzz(this); + this.utils = this.coreFactory.createUtils(); + this.eth = this.packageFactory.createEthPackage(); + this.shh = this.packageFactory.createShhPackage(); + this.bzz = this.packageFactory.createBzzPackage(); +}; + +/** + * Defines accessors for connectionModel + */ +Object.defineProperty(Web3, 'connectionModel', { + get: function () { + return this.connectionModel; + }, + set: function (connectionModel) { + if (this.connectionModel) { + return; + } + + this.connectionModel = connectionModel; + }, + enumerable: true +}); - // overwrite package setProvider - var setProvider = this.setProvider; - this.setProvider = function (provider, net) { - setProvider.apply(_this, arguments); +Web3.version = version; - this.eth.setProvider(provider, net); - this.shh.setProvider(provider, net); - this.bzz.setProvider(provider); +Web3.utils = new CoreFactory().createUtils(); - return true; - }; +Web3.modules = { + Eth: function (provider) { + return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createEthPackage(); + }, + Net: function (provider) { + return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createEthPackage(); + }, + Personal: function (provider) { + return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createPersonalPackage(); + }, + Shh: function (provider) { + return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createShhPackage(); + }, + Bzz: function (provider) { + return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createBzzPackage(); + } }; -Web3.version = version; -Web3.utils = utils; -Web3.modules = { - Eth: Eth, - Net: Net, - Personal: Personal, - Shh: Shh, - Bzz: Bzz +Web3.providers = { + HttpProvider: require('web3-provider-http'), + WebsocketProvider: require('web3-provider-ws'), + IpcProvider: require('web3-provider-ipc') }; -core.addProviders(Web3); +// Web3.givenProvider = this.providerDetector.detect(); module.exports = Web3; diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js new file mode 100644 index 00000000000..4771d7577f7 --- /dev/null +++ b/packages/web3/src/models/ConnectionModel.js @@ -0,0 +1,30 @@ + +/** + * @param {Object} provider + * @constructor + */ +function ConnectionModel(provider) { + this.setProvider(provider); +} + +/** + * Sets the provider object + * + * @param {Object} provider + */ +ConnectionModel.prototype.setProvider = function (provider) { + this.provider = provider; +}; + +/** + * Gets the provider Object + * + * @returns {Object} provider + */ +ConnectionModel.prototype.getProvider = function () { + return this.provider; +}; + +ConnectionModel.prototype.getNetworkType = function () { + // return network type (main, ropsten, kovan etc.) +}; From 50789a2f09028b7af04d1e6a07d7ff19b6b911cd Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 24 Aug 2018 16:13:05 +0200 Subject: [PATCH 0034/1045] moved providers, provider adapters, provider resolver and provider detector to one package --- packages/web3-core-providers/README.md | 29 + .../lib/adapters/AbstractProviderAdapter.js | 0 .../lib/mappers/JSONRpcMapper.js | 0 .../validators/JSONRpcResponseValidator.js | 0 .../package.json | 9 +- .../src/adapters/HttpProviderAdapter.js | 0 .../src/adapters/InpageProviderAdapter.js | 0 .../src/adapters/SocketProviderAdapter.js | 0 .../src/detectors/ProviderDetector.js | 0 .../src/index.js | 8 +- .../src/providers/HttpProvider.js} | 0 .../src/providers/IpcProvider.js} | 0 .../src/providers/WebsocketProvider.js} | 0 .../src/resolvers/ProviderAdapterResolver.js | 0 packages/web3-provider/package.json | 9 - packages/web3-providers-http/README.md | 45 - .../web3-providers-http/package-lock.json | 1156 ----------------- packages/web3-providers-http/package.json | 13 - packages/web3-providers-ipc/README.md | 42 - packages/web3-providers-ipc/package-lock.json | 1156 ----------------- packages/web3-providers-ipc/package.json | 14 - packages/web3-providers-ws/README.md | 40 - packages/web3-providers-ws/package-lock.json | 57 - 23 files changed, 41 insertions(+), 2537 deletions(-) create mode 100644 packages/web3-core-providers/README.md rename packages/{web3-provider => web3-core-providers}/lib/adapters/AbstractProviderAdapter.js (100%) rename packages/{web3-provider => web3-core-providers}/lib/mappers/JSONRpcMapper.js (100%) rename packages/{web3-provider => web3-core-providers}/lib/validators/JSONRpcResponseValidator.js (100%) rename packages/{web3-providers-ws => web3-core-providers}/package.json (62%) rename packages/{web3-provider => web3-core-providers}/src/adapters/HttpProviderAdapter.js (100%) rename packages/{web3-provider => web3-core-providers}/src/adapters/InpageProviderAdapter.js (100%) rename packages/{web3-provider => web3-core-providers}/src/adapters/SocketProviderAdapter.js (100%) rename packages/{web3-provider => web3-core-providers}/src/detectors/ProviderDetector.js (100%) rename packages/{web3-provider => web3-core-providers}/src/index.js (76%) rename packages/{web3-providers-http/src/index.js => web3-core-providers/src/providers/HttpProvider.js} (100%) rename packages/{web3-providers-ipc/src/index.js => web3-core-providers/src/providers/IpcProvider.js} (100%) rename packages/{web3-providers-ws/src/index.js => web3-core-providers/src/providers/WebsocketProvider.js} (100%) rename packages/{web3-provider => web3-core-providers}/src/resolvers/ProviderAdapterResolver.js (100%) delete mode 100644 packages/web3-provider/package.json delete mode 100644 packages/web3-providers-http/README.md delete mode 100644 packages/web3-providers-http/package-lock.json delete mode 100644 packages/web3-providers-http/package.json delete mode 100644 packages/web3-providers-ipc/README.md delete mode 100644 packages/web3-providers-ipc/package-lock.json delete mode 100644 packages/web3-providers-ipc/package.json delete mode 100644 packages/web3-providers-ws/README.md delete mode 100644 packages/web3-providers-ws/package-lock.json diff --git a/packages/web3-core-providers/README.md b/packages/web3-core-providers/README.md new file mode 100644 index 00000000000..31a87963c23 --- /dev/null +++ b/packages/web3-core-providers/README.md @@ -0,0 +1,29 @@ +# web3-core-providers + +This is a sub package of [web3.js][repo] + +## Installation + +### Node.js + +```bash +npm install web3-core-providers +``` + +### In the Browser + +Build running the following in the [web3.js][repo] repository: + +```bash +npm run-script build-all +``` + +Then include `dist/web3-core-providers.js` in your html file. + + +## Usage + +``` TODO: Create example ``` + +[docs]: http://web3js.readthedocs.io/en/1.0/ +[repo]: https://github.com/ethereum/web3.js diff --git a/packages/web3-provider/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js similarity index 100% rename from packages/web3-provider/lib/adapters/AbstractProviderAdapter.js rename to packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js diff --git a/packages/web3-provider/lib/mappers/JSONRpcMapper.js b/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js similarity index 100% rename from packages/web3-provider/lib/mappers/JSONRpcMapper.js rename to packages/web3-core-providers/lib/mappers/JSONRpcMapper.js diff --git a/packages/web3-provider/lib/validators/JSONRpcResponseValidator.js b/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js similarity index 100% rename from packages/web3-provider/lib/validators/JSONRpcResponseValidator.js rename to packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js diff --git a/packages/web3-providers-ws/package.json b/packages/web3-core-providers/package.json similarity index 62% rename from packages/web3-providers-ws/package.json rename to packages/web3-core-providers/package.json index 35e4a5543ce..3191294d162 100644 --- a/packages/web3-providers-ws/package.json +++ b/packages/web3-core-providers/package.json @@ -1,14 +1,15 @@ { - "name": "web3-providers-ws", + "name": "web3-provider", "namespace": "ethereum", "version": "1.0.0-beta.35", - "description": "Module to handle web3 RPC connections over WebSockets.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-providers-ws", + "description": "Web3 module to handle requests to external providers.", + "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-requestmanager", "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { + "xhr2-cookies": "1.1.0", + "oboe": "2.1.3", "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", "websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible" } } diff --git a/packages/web3-provider/src/adapters/HttpProviderAdapter.js b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js similarity index 100% rename from packages/web3-provider/src/adapters/HttpProviderAdapter.js rename to packages/web3-core-providers/src/adapters/HttpProviderAdapter.js diff --git a/packages/web3-provider/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js similarity index 100% rename from packages/web3-provider/src/adapters/InpageProviderAdapter.js rename to packages/web3-core-providers/src/adapters/InpageProviderAdapter.js diff --git a/packages/web3-provider/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js similarity index 100% rename from packages/web3-provider/src/adapters/SocketProviderAdapter.js rename to packages/web3-core-providers/src/adapters/SocketProviderAdapter.js diff --git a/packages/web3-provider/src/detectors/ProviderDetector.js b/packages/web3-core-providers/src/detectors/ProviderDetector.js similarity index 100% rename from packages/web3-provider/src/detectors/ProviderDetector.js rename to packages/web3-core-providers/src/detectors/ProviderDetector.js diff --git a/packages/web3-provider/src/index.js b/packages/web3-core-providers/src/index.js similarity index 76% rename from packages/web3-provider/src/index.js rename to packages/web3-core-providers/src/index.js index f70490d15a3..f343cb43e3a 100644 --- a/packages/web3-provider/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -22,8 +22,14 @@ var ProviderAdapterResolver = require('./resolvers/ProviderAdapterResolver'); var ProviderDetector = require('./detectors/ProviderDetector'); +var HttpProvider = require('./providers/HttpProvider'); +var IpcProvider = require('./providers/IpcProvider'); +var WebsocketProvider = require('./providers/WebsocketProvider'); module.exports = { ProviderAdapterResolver: ProviderAdapterResolver, - ProviderDetector: ProviderDetector + ProviderDetector: ProviderDetector, + HttpProvider: HttpProvider, + IpcProvider: IpcProvider, + WebsocketProvider: WebsocketProvider }; diff --git a/packages/web3-providers-http/src/index.js b/packages/web3-core-providers/src/providers/HttpProvider.js similarity index 100% rename from packages/web3-providers-http/src/index.js rename to packages/web3-core-providers/src/providers/HttpProvider.js diff --git a/packages/web3-providers-ipc/src/index.js b/packages/web3-core-providers/src/providers/IpcProvider.js similarity index 100% rename from packages/web3-providers-ipc/src/index.js rename to packages/web3-core-providers/src/providers/IpcProvider.js diff --git a/packages/web3-providers-ws/src/index.js b/packages/web3-core-providers/src/providers/WebsocketProvider.js similarity index 100% rename from packages/web3-providers-ws/src/index.js rename to packages/web3-core-providers/src/providers/WebsocketProvider.js diff --git a/packages/web3-provider/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js similarity index 100% rename from packages/web3-provider/src/resolvers/ProviderAdapterResolver.js rename to packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js diff --git a/packages/web3-provider/package.json b/packages/web3-provider/package.json deleted file mode 100644 index 9b19bd4d526..00000000000 --- a/packages/web3-provider/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "web3-provider", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Web3 module to handle requests to external providers.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-requestmanager", - "license": "LGPL-3.0", - "main": "src/index.js" -} diff --git a/packages/web3-providers-http/README.md b/packages/web3-providers-http/README.md deleted file mode 100644 index ac46853390c..00000000000 --- a/packages/web3-providers-http/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# web3-providers-http - -*This is a sub package of [web3.js][repo]* - -This is a HTTP provider for [web3.js][repo]. -Please read the [documentation][docs] for more. - -## Installation - -### Node.js - -```bash -npm install web3-providers-http -``` - -### In the Browser - -Build running the following in the [web3.js][repo] repository: - -```bash -npm run-script build-all -``` - -Then include `dist/web3-providers-http.js` in your html file. -This will expose the `Web3HttpProvider` object on the window object. - - -## Usage - -```js -// in node.js -var Web3HttpProvider = require('web3-providers-http'); - -var options = { - timeout: 20000, // milliseconds, - headers: [{name: 'Access-Control-Allow-Origin', value: '*'},{...}] -}; -var http = new Web3HttpProvider('http://localhost:8545', options); -``` - - -[docs]: http://web3js.readthedocs.io/en/1.0/ -[repo]: https://github.com/ethereum/web3.js - - diff --git a/packages/web3-providers-http/package-lock.json b/packages/web3-providers-http/package-lock.json deleted file mode 100644 index ae6bb965991..00000000000 --- a/packages/web3-providers-http/package-lock.json +++ /dev/null @@ -1,1156 +0,0 @@ -{ - "name": "web3-providers-http", - "version": "1.0.0-beta.34", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" - }, - "body-parser": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "~1.6.3", - "iconv-lite": "0.4.23", - "on-finished": "~2.3.0", - "qs": "6.5.2", - "raw-body": "2.3.3", - "type-is": "~1.6.16" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "browserify-sha3": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", - "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", - "requires": { - "js-sha3": "^0.3.1" - } - }, - "buffer-to-arraybuffer": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", - "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "cookiejar": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", - "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cors": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", - "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "requires": { - "mimic-response": "^1.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "dom-walk": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", - "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "optional": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "elliptic": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "eth-lib": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", - "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "keccakjs": "^0.2.1", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", - "xhr-request-promise": "^0.1.2" - } - }, - "ethjs-unit": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", - "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", - "requires": { - "bn.js": "4.11.6", - "number-to-bn": "1.7.0" - } - }, - "express": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - } - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" - } - } - }, - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "finalhandler": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "requires": { - "is-callable": "^1.1.3" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "global": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", - "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", - "requires": { - "min-document": "^2.19.0", - "process": "~0.5.1" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "requires": { - "ajv": "^5.1.0", - "har-schema": "^2.0.0" - } - }, - "hash.js": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", - "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" - }, - "is-function": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", - "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" - }, - "is-hex-prefixed": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "js-sha3": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", - "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "keccakjs": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", - "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", - "requires": { - "browserify-sha3": "^0.0.1", - "sha3": "^1.1.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - }, - "mime-db": { - "version": "1.35.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" - }, - "mime-types": { - "version": "2.1.19", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", - "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", - "requires": { - "mime-db": "~1.35.0" - } - }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, - "min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", - "requires": { - "dom-walk": "^0.1.0" - } - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "nan": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" - }, - "nano-json-stream-parser": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", - "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, - "number-to-bn": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", - "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", - "requires": { - "bn.js": "4.11.6", - "strip-hex-prefix": "1.0.0" - } - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "parse-headers": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", - "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", - "requires": { - "for-each": "^0.3.2", - "trim": "0.0.1" - } - }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "process": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", - "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" - }, - "proxy-addr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.8.0" - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "query-string": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", - "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", - "requires": { - "decode-uri-component": "^0.2.0", - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - } - }, - "randomhex": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", - "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" - }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.3", - "iconv-lite": "0.4.23", - "unpipe": "1.0.0" - } - }, - "request": { - "version": "2.87.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", - "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", - "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", - "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "tough-cookie": "~2.3.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, - "servify": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", - "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", - "requires": { - "body-parser": "^1.16.0", - "cors": "^2.8.1", - "express": "^4.14.0", - "request": "^2.79.0", - "xhr": "^2.3.3" - } - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, - "sha3": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", - "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", - "requires": { - "nan": "2.10.0" - } - }, - "simple-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", - "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" - }, - "simple-get": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", - "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", - "requires": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, - "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", - "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" - }, - "strip-hex-prefix": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", - "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", - "requires": { - "is-hex-prefixed": "1.0.0" - } - }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" - }, - "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", - "requires": { - "punycode": "^1.4.1" - } - }, - "trim": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", - "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" - }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "url-set-query": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", - "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" - }, - "utf8": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", - "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "web3-core-helpers": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.34.tgz", - "integrity": "sha1-sWjaANPhnhVrwVriAyA91N/uLQM=", - "requires": { - "underscore": "1.8.3", - "web3-eth-iban": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" - } - }, - "web3-eth-iban": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.34.tgz", - "integrity": "sha1-mvRYYFhnzPdOqXmq8yazi6alugw=", - "requires": { - "bn.js": "4.11.6", - "web3-utils": "1.0.0-beta.34" - } - }, - "web3-utils": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.34.tgz", - "integrity": "sha1-lBH8OarvOcpOBhafdiKX2f8CCXA=", - "requires": { - "bn.js": "4.11.6", - "eth-lib": "0.1.27", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randomhex": "0.1.5", - "underscore": "1.8.3", - "utf8": "2.1.1" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - }, - "xhr": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", - "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", - "requires": { - "global": "~4.3.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "xhr-request": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", - "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", - "requires": { - "buffer-to-arraybuffer": "^0.0.5", - "object-assign": "^4.1.1", - "query-string": "^5.0.1", - "simple-get": "^2.7.0", - "timed-out": "^4.0.1", - "url-set-query": "^1.0.0", - "xhr": "^2.0.4" - } - }, - "xhr-request-promise": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", - "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", - "requires": { - "xhr-request": "^1.0.1" - } - }, - "xhr2-cookies": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", - "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", - "requires": { - "cookiejar": "^2.1.1" - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - } - } -} diff --git a/packages/web3-providers-http/package.json b/packages/web3-providers-http/package.json deleted file mode 100644 index 348a1d8ff1a..00000000000 --- a/packages/web3-providers-http/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "web3-providers-http", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Module to handle web3 RPC connections over HTTP.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-providers-http", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "web3-core-helpers": "1.0.0-beta.35", - "xhr2-cookies": "1.1.0" - } -} diff --git a/packages/web3-providers-ipc/README.md b/packages/web3-providers-ipc/README.md deleted file mode 100644 index 03a329ea00c..00000000000 --- a/packages/web3-providers-ipc/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# web3-providers-ipc - -This is a sub package of [web3.js][repo] - -This is a IPC provider for [web3.js][repo]. -Please read the [documentation][docs] for more. - -## Installation - -### Node.js - -```bash -npm install web3-providers-ipc -``` - -### In the Browser - -Build running the following in the [web3.js][repo] repository: - -```bash -npm run-script build-all -``` - -Then include `dist/web3-providers-ipc.js` in your html file. -This will expose the `Web3IpcProvider` object on the window object. - - -## Usage - -```js -// in node.js -var Web3IpcProvider = require('web3-providers-ipc'); -var net = require(net); - -var ipc = new Web3IpcProvider('/Users/me/Library/Ethereum/geth.ipc', net); -``` - - -[docs]: http://web3js.readthedocs.io/en/1.0/ -[repo]: https://github.com/ethereum/web3.js - - diff --git a/packages/web3-providers-ipc/package-lock.json b/packages/web3-providers-ipc/package-lock.json deleted file mode 100644 index 2dad5c303fd..00000000000 --- a/packages/web3-providers-ipc/package-lock.json +++ /dev/null @@ -1,1156 +0,0 @@ -{ - "name": "web3-providers-ipc", - "version": "1.0.0-beta.34", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" - }, - "body-parser": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "~1.6.3", - "iconv-lite": "0.4.23", - "on-finished": "~2.3.0", - "qs": "6.5.2", - "raw-body": "2.3.3", - "type-is": "~1.6.16" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "browserify-sha3": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", - "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", - "requires": { - "js-sha3": "^0.3.1" - } - }, - "buffer-to-arraybuffer": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", - "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cors": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", - "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "requires": { - "mimic-response": "^1.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "dom-walk": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", - "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "optional": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "elliptic": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "eth-lib": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", - "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "keccakjs": "^0.2.1", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", - "xhr-request-promise": "^0.1.2" - } - }, - "ethjs-unit": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", - "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", - "requires": { - "bn.js": "4.11.6", - "number-to-bn": "1.7.0" - } - }, - "express": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - } - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" - } - } - }, - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "finalhandler": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "requires": { - "is-callable": "^1.1.3" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "global": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", - "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", - "requires": { - "min-document": "^2.19.0", - "process": "~0.5.1" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "requires": { - "ajv": "^5.1.0", - "har-schema": "^2.0.0" - } - }, - "hash.js": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", - "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "http-https": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", - "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" - }, - "is-function": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", - "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" - }, - "is-hex-prefixed": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "js-sha3": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", - "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "keccakjs": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", - "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", - "requires": { - "browserify-sha3": "^0.0.1", - "sha3": "^1.1.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - }, - "mime-db": { - "version": "1.35.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" - }, - "mime-types": { - "version": "2.1.19", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", - "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", - "requires": { - "mime-db": "~1.35.0" - } - }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, - "min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", - "requires": { - "dom-walk": "^0.1.0" - } - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "nan": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" - }, - "nano-json-stream-parser": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", - "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, - "number-to-bn": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", - "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", - "requires": { - "bn.js": "4.11.6", - "strip-hex-prefix": "1.0.0" - } - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "oboe": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", - "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", - "requires": { - "http-https": "^1.0.0" - } - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "parse-headers": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", - "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", - "requires": { - "for-each": "^0.3.2", - "trim": "0.0.1" - } - }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "process": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", - "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" - }, - "proxy-addr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.8.0" - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "query-string": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", - "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", - "requires": { - "decode-uri-component": "^0.2.0", - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - } - }, - "randomhex": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", - "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" - }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.3", - "iconv-lite": "0.4.23", - "unpipe": "1.0.0" - } - }, - "request": { - "version": "2.87.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", - "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", - "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", - "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "tough-cookie": "~2.3.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, - "servify": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", - "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", - "requires": { - "body-parser": "^1.16.0", - "cors": "^2.8.1", - "express": "^4.14.0", - "request": "^2.79.0", - "xhr": "^2.3.3" - } - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, - "sha3": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", - "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", - "requires": { - "nan": "2.10.0" - } - }, - "simple-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", - "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" - }, - "simple-get": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", - "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", - "requires": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, - "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", - "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" - }, - "strip-hex-prefix": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", - "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", - "requires": { - "is-hex-prefixed": "1.0.0" - } - }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" - }, - "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", - "requires": { - "punycode": "^1.4.1" - } - }, - "trim": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", - "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" - }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "url-set-query": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", - "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" - }, - "utf8": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", - "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "web3-core-helpers": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.34.tgz", - "integrity": "sha1-sWjaANPhnhVrwVriAyA91N/uLQM=", - "requires": { - "underscore": "1.8.3", - "web3-eth-iban": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" - } - }, - "web3-eth-iban": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.34.tgz", - "integrity": "sha1-mvRYYFhnzPdOqXmq8yazi6alugw=", - "requires": { - "bn.js": "4.11.6", - "web3-utils": "1.0.0-beta.34" - } - }, - "web3-utils": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.34.tgz", - "integrity": "sha1-lBH8OarvOcpOBhafdiKX2f8CCXA=", - "requires": { - "bn.js": "4.11.6", - "eth-lib": "0.1.27", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randomhex": "0.1.5", - "underscore": "1.8.3", - "utf8": "2.1.1" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - }, - "xhr": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", - "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", - "requires": { - "global": "~4.3.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "xhr-request": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", - "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", - "requires": { - "buffer-to-arraybuffer": "^0.0.5", - "object-assign": "^4.1.1", - "query-string": "^5.0.1", - "simple-get": "^2.7.0", - "timed-out": "^4.0.1", - "url-set-query": "^1.0.0", - "xhr": "^2.0.4" - } - }, - "xhr-request-promise": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", - "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", - "requires": { - "xhr-request": "^1.0.1" - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - } - } -} diff --git a/packages/web3-providers-ipc/package.json b/packages/web3-providers-ipc/package.json deleted file mode 100644 index c29dcf15687..00000000000 --- a/packages/web3-providers-ipc/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "web3-providers-ipc", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Module to handle web3 RPC connections over IPC sockets.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-providers-ipc", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "oboe": "2.1.3", - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35" - } -} diff --git a/packages/web3-providers-ws/README.md b/packages/web3-providers-ws/README.md deleted file mode 100644 index 72553c48e17..00000000000 --- a/packages/web3-providers-ws/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# web3-providers-ws - -This is a sub package of [web3.js][repo] - -This is a websocket provider for [web3.js][repo]. -Please read the [documentation][docs] for more. - -## Installation - -### Node.js - -```bash -npm install web3-providers-ws -``` - -### In the Browser - -Build running the following in the [web3.js][repo] repository: - -```bash -npm run-script build-all -``` - -Then include `dist/web3-providers-ws.js` in your html file. -This will expose the `Web3WsProvider` object on the window object. - - -## Usage - -```js -// in node.js -var Web3WsProvider = require('web3-providers-ws'); - -var options = { timeout: 30000, headers: {authorization: 'Basic username:password'} } // set a custom timeout at 30 seconds, and credentials (you can also add the credentials to the URL: ws://username:password@localhost:8546) -var ws = new Web3WsProvider('ws://localhost:8546', options); -``` - - -[docs]: http://web3js.readthedocs.io/en/1.0/ -[repo]: https://github.com/ethereum/web3.js diff --git a/packages/web3-providers-ws/package-lock.json b/packages/web3-providers-ws/package-lock.json deleted file mode 100644 index 806722b8c47..00000000000 --- a/packages/web3-providers-ws/package-lock.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "nan": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" - }, - "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "requires": { - "is-typedarray": "^1.0.0" - } - }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - }, - "websocket": { - "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", - "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", - "requires": { - "debug": "^2.2.0", - "nan": "^2.3.3", - "typedarray-to-buffer": "^3.1.2", - "yaeti": "^0.0.6" - } - }, - "yaeti": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", - "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" - } - } -} From 654bac908704af4532e73919e9c8201ec5f92e3f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 24 Aug 2018 16:27:45 +0200 Subject: [PATCH 0035/1045] AbstractWeb3Package implementation started and web3-core renamed to web3-core-package --- .../README.md | 0 .../package.json | 3 +- .../src/AbstractWeb3Package.js | 77 +++++++++++++++++ packages/web3-core-package/src/index.js | 0 packages/web3-core/src/extend.js | 69 --------------- packages/web3-core/src/index.js | 86 ------------------- packages/web3/src/models/ConnectionModel.js | 18 ++++ 7 files changed, 96 insertions(+), 157 deletions(-) rename packages/{web3-core => web3-core-package}/README.md (100%) rename packages/{web3-core => web3-core-package}/package.json (85%) create mode 100644 packages/web3-core-package/src/AbstractWeb3Package.js create mode 100644 packages/web3-core-package/src/index.js delete mode 100644 packages/web3-core/src/extend.js delete mode 100644 packages/web3-core/src/index.js diff --git a/packages/web3-core/README.md b/packages/web3-core-package/README.md similarity index 100% rename from packages/web3-core/README.md rename to packages/web3-core-package/README.md diff --git a/packages/web3-core/package.json b/packages/web3-core-package/package.json similarity index 85% rename from packages/web3-core/package.json rename to packages/web3-core-package/package.json index b136228c920..05d5f053353 100644 --- a/packages/web3-core/package.json +++ b/packages/web3-core-package/package.json @@ -1,5 +1,5 @@ { - "name": "web3-core", + "name": "web3-core-package", "namespace": "ethereum", "version": "1.0.0-beta.35", "description": "Web3 core tools for sub packages. This is an internal package.", @@ -9,7 +9,6 @@ "dependencies": { "web3-core-helpers": "1.0.0-beta.35", "web3-core-method": "1.0.0-beta.35", - "web3-core-requestmanager": "1.0.0-beta.35", "web3-utils": "1.0.0-beta.35" } } diff --git a/packages/web3-core-package/src/AbstractWeb3Package.js b/packages/web3-core-package/src/AbstractWeb3Package.js new file mode 100644 index 00000000000..6c0883b49ee --- /dev/null +++ b/packages/web3-core-package/src/AbstractWeb3Package.js @@ -0,0 +1,77 @@ +/* + 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 . + */ +/** + * @file AbstractWeb3Package.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {Object} connectionModel + * @constructor + */ +function AbstractWeb3Package(connectionModel) { + this.connectionModel = connectionModel; + this.givenProvider = connectionModel.givenProvider; + this.currentProvider = this.connectionModel.provider; + this.BatchRequest = ''; +} + +AbstractWeb3Package.prototype.setProvider = function (provider) { + this.connectionModel.setProvider(provider); +}; + +AbstractWeb3Package.prototype.extend = function () { + // TODO: Implement extend in a readable way + + // var extend = function (pckg) { + // /* jshint maxcomplexity:5 */ + // var ex = function (extension) { + // + // var extendedObject; + // if (extension.property) { + // if (!pckg[extension.property]) { + // pckg[extension.property] = {}; + // } + // extendedObject = pckg[extension.property]; + // } else { + // extendedObject = pckg; + // } + // + // if (extension.methods) { + // extension.methods.forEach(function (method) { + // if(!(method instanceof Method)) { + // method = new Method(method); + // } + // + // method.attachToObject(extendedObject); + // method.setRequestManager(pckg._requestManager); + // }); + // } + // + // return pckg; + // }; + // + // ex.formatters = formatters; + // ex.utils = utils; + // ex.Method = Method; + // + // return ex; + // }; +}; diff --git a/packages/web3-core-package/src/index.js b/packages/web3-core-package/src/index.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/web3-core/src/extend.js b/packages/web3-core/src/extend.js deleted file mode 100644 index c8b787848fd..00000000000 --- a/packages/web3-core/src/extend.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - 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 . - */ -/** - * @file extend.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -"use strict"; - - -var formatters = require('web3-core-helpers').formatters; -var Method = require('web3-core-method'); -var utils = require('web3-utils'); - - -var extend = function (pckg) { - /* jshint maxcomplexity:5 */ - var ex = function (extension) { - - var extendedObject; - if (extension.property) { - if (!pckg[extension.property]) { - pckg[extension.property] = {}; - } - extendedObject = pckg[extension.property]; - } else { - extendedObject = pckg; - } - - if (extension.methods) { - extension.methods.forEach(function (method) { - if(!(method instanceof Method)) { - method = new Method(method); - } - - method.attachToObject(extendedObject); - method.setRequestManager(pckg._requestManager); - }); - } - - return pckg; - }; - - ex.formatters = formatters; - ex.utils = utils; - ex.Method = Method; - - return ex; -}; - - - -module.exports = extend; - diff --git a/packages/web3-core/src/index.js b/packages/web3-core/src/index.js deleted file mode 100644 index 29ecd36fdea..00000000000 --- a/packages/web3-core/src/index.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - 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 . -*/ -/** - * @file index.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -"use strict"; - - -var requestManager = require('web3-core-requestmanager'); -var extend = require('./extend.js'); - -module.exports = { - packageInit: function (pkg, args) { - args = Array.prototype.slice.call(args); - - if (!pkg) { - throw new Error('You need to instantiate using the "new" keyword.'); - } - - - // make property of pkg._provider, which can properly set providers - Object.defineProperty(pkg, 'currentProvider', { - get: function () { - return pkg._provider; - }, - set: function (value) { - return pkg.setProvider(value); - }, - enumerable: true, - configurable: true - }); - - // inherit from web3 umbrella package - if (args[0] && args[0]._requestManager) { - pkg._requestManager = new requestManager.Manager(args[0].currentProvider); - - // set requestmanager on package - } else { - pkg._requestManager = new requestManager.Manager(); - pkg._requestManager.setProvider(args[0], args[1]); - } - - // add givenProvider - pkg.givenProvider = requestManager.Manager.givenProvider; - pkg.providers = requestManager.Manager.providers; - - pkg._provider = pkg._requestManager.provider; - - // add SETPROVIDER function (don't overwrite if already existing) - if (!pkg.setProvider) { - pkg.setProvider = function (provider, net) { - pkg._requestManager.setProvider(provider, net); - pkg._provider = pkg._requestManager.provider; - return true; - }; - } - - // attach batch request creation - pkg.BatchRequest = requestManager.BatchManager.bind(null, pkg._requestManager); - - // attach extend function - pkg.extend = extend(pkg); - }, - addProviders: function (pkg) { - pkg.givenProvider = requestManager.Manager.givenProvider; - pkg.providers = requestManager.Manager.providers; - } -}; - diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index 4771d7577f7..d5a15e5f823 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -25,6 +25,24 @@ ConnectionModel.prototype.getProvider = function () { return this.provider; }; +/** + * Sets givenProvider + * + * @param {Object} givenProvider + */ +ConnectionModel.prototype.setGivenProvider = function (givenProvider) { + this.givenProvider = givenProvider; +}; + +/** + * Gets the givenProvider (currentProvider, ipcWrapperProvider or ethereumProvider) + * + * @returns {Object|*} + */ +ConnectionModel.prototype.getGivenProvider = function () { + return this.givenProvider; +}; + ConnectionModel.prototype.getNetworkType = function () { // return network type (main, ropsten, kovan etc.) }; From 3aaeb39915931531bc224fbc331abee3e829c63f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 24 Aug 2018 16:43:56 +0200 Subject: [PATCH 0036/1045] little clean up of Eth.js and todo's added --- packages/web3-eth/src/Eth.js | 135 ++++------------------------------- 1 file changed, 15 insertions(+), 120 deletions(-) diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 31a9a2cfed2..a67c4b5e041 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -62,57 +62,14 @@ var uncleCountCall = function (args) { }; -var Eth = function Eth( - batchRequest, - givenProvider, - providers, - extend, - baseContract, - net, - accounts, - personal, - iban, - abi, - ens, - method, - utils, - helpers, - networkType, - underscore, - formatters, - subscriptionResolver -) { - this.setContractPackage(BaseContract); - this.setNetPackage(new Net(this.currentProvider)); - this.setAccountsPackage(new Accounts(this.currentProvider)); - this.setPersonalPackage(new Personal(this.currentProvider)); - this.setIBANPackage(Iban); - this.setABIPackage(ABI); - this.setENSPackage(new ENS(this)); - this.setMethods(); - this.setSubscriptionsResolver(new SubscriptionsResolver(this.currentProvider)); - - // sets _requestmanager - core.packageInit(this, arguments); -}; - -core.addProviders(Eth); - -/** - * PACKAGE INIT (core.packageInit) overwrites setProvider! - * - * // overwrite setProvider - var setProvider = this.setProvider; - * - * - */ -Eth.prototype.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); - this.subscriptionsResolver.setProvider(this.currentProvider); +var Eth = function Eth(connectionModel, packageFactory, coreFactory, subscriptionsResolver) { + this.net = connectionModel.getNetworkMethods(); + this.accounts = this.packageFactory.createAccountsPackage(); + this.personal = this.packageFactory.createPersonalPackage(); + this.iban = this.packageFactory.createIbanPackage(); + this.abi = this.packageFactory.createAbiPackage(); + this.ens = this.packageFactory.createEnsPackage(); + this.subscriptionsResolver = subscriptionsResolver; }; /** @@ -120,7 +77,7 @@ Eth.prototype.setProvider = function () { * * @param {Object} contractPackage */ -Eth.prototype.setContractPackage = function (contractPackage) { +Eth.prototype.setContractPackage = function (contractPackage) {// TODO: check if this could be removed because of the ConnectionModel // create a proxy Contract type for this instance, as a Contract's provider // is stored as a class member rather than an instance variable. If we do // not create this proxy type, changing the provider in one instance of @@ -159,75 +116,10 @@ Eth.prototype.setContractPackage = function (contractPackage) { }; -/** - * Sets the Net package as property of Eth - * - * @param {Object} net - */ -Eth.prototype.setNetPackage = function (net) { - this.net = net; - this.net.getNetworkType = getNetworkType.bind(this); -}; - -/** - * Sets the Accounts package as property of Eth - * - * @param {Object} accounts - */ -Eth.prototype.setAccountsPackage = function (accounts) { - this.accounts = accounts; -}; - -/** - * Sets the Personal package as property of Eth - * - * @param {Object} personal - */ -Eth.prototype.setPersonalPackage = function (personal) { - this.personal = personal; - this.personal.defaultAccount = this.defaultAccount; -}; - -/** - * Sets the Iban package as property of Eth - * - * @param {Object} iban - */ -Eth.prototype.setIBANPackage = function (iban) { - this.Iban = iban; -}; - -/** - * Sets the ABI package as property of Eth - * - * @param {Object} abi - */ -Eth.prototype.setABIPackage = function (abi) { - this.abi = abi; -}; - -/** - * Sets the ENS package as property of Eth - * - * @param {Object} ens - */ -Eth.prototype.setENSPackage = function (ens) { - this.ens = ens; -}; - -/** - * Sets the SubscriptionsResolver - * - * @param subscriptionsResolver - */ -Eth.prototype.setSubscriptionsResolver = function (subscriptionsResolver) { - this.subscriptionsResolver = subscriptionsResolver; -}; - /** * Defines accessors for defaultAccount */ -Object.defineProperty(Eth, 'defaultAccount', { +Object.defineProperty(Eth, 'defaultAccount', { // Todo: Move this getter and setter to ConnectionModel and only set here the defaultAccount get: function () { return this.defaultAccount ? this.defaultAccount : null; }, @@ -236,6 +128,7 @@ Object.defineProperty(Eth, 'defaultAccount', { this.defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); } + //TODO: remove the lines below this will now longer required because of the ConnectionModel singleton // also set on the Contract object _this.Contract.defaultAccount = defaultAccount; _this.personal.defaultAccount = defaultAccount; @@ -253,7 +146,7 @@ Object.defineProperty(Eth, 'defaultAccount', { /** * Defines accessors for defaultBlock */ -Object.defineProperty(Eth, 'defaultBlock', { +Object.defineProperty(Eth, 'defaultBlock', { // Todo: Move this getter and setter to ConnectionModel and only set here the defaultBlock get: function () { return this.defaultBlock ? this.defaultBlock : 'latest'; }, @@ -261,6 +154,7 @@ Object.defineProperty(Eth, 'defaultBlock', { var self = this; this.defaultBlock = val; + //TODO: remove the lines below this will now longer required because of the ConnectionModel singleton // also set on the Contract object this.Contract.defaultBlock = this.defaultBlock; this.personal.defaultBlock = this.defaultBlock; @@ -288,6 +182,7 @@ Eth.prototype.subscribe = function (type, parameters, callback) { /** * Appends rpc methods to Eth + * TODO: Refactor methods package and remove that ugly array and write the methods instead of generating it over the constructor. */ Eth.prototype.setMethods = function () { var methods = [ @@ -490,6 +385,6 @@ Eth.prototype.setMethods = function () { /** * Extends Eth with clearSubscriptions from the current provider */ -Eth.prototype.clearSubscriptions = this.currentProvider.clearSubscriptions; +Eth.prototype.clearSubscriptions = this.connectionModel.provider.clearSubscriptions; module.exports = Eth; From 710c08bd055af50fded5433bf5e562a195ab5cf1 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 24 Aug 2018 17:05:16 +0200 Subject: [PATCH 0037/1045] defaultAccount and defaultBlock moved to ConnectionModel --- packages/web3-eth/src/Eth.js | 53 --------------------- packages/web3/src/models/ConnectionModel.js | 50 ++++++------------- 2 files changed, 15 insertions(+), 88 deletions(-) diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index a67c4b5e041..49da2e09c52 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -116,59 +116,6 @@ Eth.prototype.setContractPackage = function (contractPackage) {// TODO: check if }; -/** - * Defines accessors for defaultAccount - */ -Object.defineProperty(Eth, 'defaultAccount', { // Todo: Move this getter and setter to ConnectionModel and only set here the defaultAccount - get: function () { - return this.defaultAccount ? this.defaultAccount : null; - }, - set: function (val) { - if (val) { - this.defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); - } - - //TODO: remove the lines below this will now longer required because of the ConnectionModel singleton - // also set on the Contract object - _this.Contract.defaultAccount = defaultAccount; - _this.personal.defaultAccount = defaultAccount; - - // update defaultBlock - methods.forEach(function (method) { - method.defaultAccount = defaultAccount; - }); - - return val; - }, - enumerable: true -}); - -/** - * Defines accessors for defaultBlock - */ -Object.defineProperty(Eth, 'defaultBlock', { // Todo: Move this getter and setter to ConnectionModel and only set here the defaultBlock - get: function () { - return this.defaultBlock ? this.defaultBlock : 'latest'; - }, - set: function (val) { - var self = this; - this.defaultBlock = val; - - //TODO: remove the lines below this will now longer required because of the ConnectionModel singleton - // also set on the Contract object - this.Contract.defaultBlock = this.defaultBlock; - this.personal.defaultBlock = this.defaultBlock; - - // update defaultBlock - methods.forEach(function (method) { - method.defaultBlock = self.defaultBlock; - }); - - return val; - }, - enumerable: true -}); - /** * Gets and executes subscription for an given type * diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index d5a15e5f823..14b6ebe24e3 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -1,47 +1,27 @@ - /** * @param {Object} provider * @constructor */ function ConnectionModel(provider) { - this.setProvider(provider); -} - -/** - * Sets the provider object - * - * @param {Object} provider - */ -ConnectionModel.prototype.setProvider = function (provider) { this.provider = provider; -}; - -/** - * Gets the provider Object - * - * @returns {Object} provider - */ -ConnectionModel.prototype.getProvider = function () { - return this.provider; -}; - -/** - * Sets givenProvider - * - * @param {Object} givenProvider - */ -ConnectionModel.prototype.setGivenProvider = function (givenProvider) { - this.givenProvider = givenProvider; -}; + this.givenProvider = null; + this.defaultBlock = null; +} /** - * Gets the givenProvider (currentProvider, ipcWrapperProvider or ethereumProvider) - * - * @returns {Object|*} + * Defines accessors for defaultAccount */ -ConnectionModel.prototype.getGivenProvider = function () { - return this.givenProvider; -}; +Object.defineProperty(Eth, 'defaultAccount', { + get: function () { + return this.defaultAccount; + }, + set: function (val) { + if (val) { + this.defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); + } + }, + enumerable: true +}); ConnectionModel.prototype.getNetworkType = function () { // return network type (main, ropsten, kovan etc.) From b8d79aec4a0dd75b0ae70e075ab606f3ded2643d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 24 Aug 2018 17:13:03 +0200 Subject: [PATCH 0038/1045] unused imports removed --- packages/web3-eth/src/Eth.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 49da2e09c52..c8ff86f550b 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -27,17 +27,6 @@ var core = require('web3-core'); var helpers = require('web3-core-helpers'); var Method = require('web3-core-method'); var utils = require('web3-utils'); -var Net = require('web3-net'); - -var ENS = require('web3-eth-ens'); -var Personal = require('web3-eth-personal'); -var BaseContract = require('web3-eth-contract'); -var Iban = require('web3-eth-iban'); -var Accounts = require('web3-eth-accounts'); -var ABI = require('web3-eth-abi'); - -var getNetworkType = require('./getNetworkType.js'); -var SubscriptionsResolver = require('./resolvers/SubscriptionsResolver'); var formatter = helpers.formatters; From de902dac1fe9dcd69e7087b7075aee64b467d217 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 27 Aug 2018 13:56:24 +0200 Subject: [PATCH 0039/1045] ConnectionModel added to contract package, network methods added to connection model, contract package added to package factory and Eth.Contract refactored --- packages/web3-eth-contract/src/index.js | 65 ++-------- packages/web3-eth/src/Eth.js | 51 +------- packages/web3/src/factories/PackageFactory.js | 6 +- packages/web3/src/models/ConnectionModel.js | 121 +++++++++++++++++- 4 files changed, 139 insertions(+), 104 deletions(-) diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index c0d7e3d8770..cebccafbdd2 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -59,12 +59,7 @@ var Contract = function Contract(jsonInterface, address, options) { 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; - - + this.clearSubscriptions = this.connectionModel.provider.clearSubscriptions; if(!jsonInterface || !(Array.isArray(jsonInterface))) { throw new Error('You must provide the json interface of the contract when instantiating a contract object.'); @@ -177,35 +172,6 @@ var Contract = function Contract(jsonInterface, address, options) { enumerable: true }); - // get default account from the Class - var defaultAccount = this.constructor.defaultAccount; - var defaultBlock = this.constructor.defaultBlock || 'latest'; - - Object.defineProperty(this, 'defaultAccount', { - get: function () { - return defaultAccount; - }, - set: function (val) { - if(val) { - defaultAccount = utils.toChecksumAddress(formatters.inputAddressFormatter(val)); - } - - return val; - }, - enumerable: true - }); - Object.defineProperty(this, 'defaultBlock', { - get: function () { - return defaultBlock; - }, - set: function (val) { - defaultBlock = val; - - return val; - }, - enumerable: true - }); - // properties this.methods = {}; this.events = {}; @@ -220,10 +186,8 @@ var Contract = function Contract(jsonInterface, address, options) { }; Contract.setProvider = function(provider, accounts) { - // Contract.currentProvider = provider; - core.packageInit(this, [provider]); - - this._ethAccounts = accounts; + this.connectionModel.provider = provider; + this.accounts = accounts; }; @@ -483,8 +447,7 @@ Contract.prototype._decodeMethodReturn = function (outputs, returnValues) { * @param {Function} callback * @return {Object} EventEmitter possible events are "error", "transactionHash" and "receipt" */ -Contract.prototype.deploy = function(options, callback){ - +Contract.prototype.deploy = function (options, callback) { options = options || {}; options.arguments = options.arguments || []; @@ -505,7 +468,7 @@ Contract.prototype.deploy = function(options, callback){ method: constructor, parent: this, deployData: options.data, - _ethAccounts: this.constructor._ethAccounts + _ethAccounts: this.accounts }, options.arguments); }; @@ -702,7 +665,7 @@ Contract.prototype._createTxObject = function _createTxObject(){ txObject.arguments = args || []; txObject._method = this.method; txObject._parent = this.parent; - txObject._ethAccounts = this.parent.constructor._ethAccounts || this._ethAccounts; + txObject._ethAccounts = this.parent.accounts || this._ethAccounts; if(this.deployData) { txObject._deployData = this.deployData; @@ -765,7 +728,7 @@ Contract.prototype._executeMethod = function _executeMethod(){ var _this = this, args = this._parent._processExecuteArguments.call(this, Array.prototype.slice.call(arguments), defer), defer = promiEvent((args.type !== 'send')), - ethAccounts = _this.constructor._ethAccounts || _this._ethAccounts; + ethAccounts = _this.accounts || _this._ethAccounts; // simple return request for batch requests if(args.generateRequest) { @@ -798,8 +761,8 @@ Contract.prototype._executeMethod = function _executeMethod(){ outputFormatter: utils.hexToNumber, requestManager: _this._parent._requestManager, accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.defaultAccount, - defaultBlock: _this._parent.defaultBlock + defaultAccount: _this._parent.connectionModel.defaultAccount, + defaultBlock: _this._parent.connectionModel.defaultBlock })).createFunction(); return estimateGas(args.options, args.callback); @@ -819,8 +782,8 @@ Contract.prototype._executeMethod = function _executeMethod(){ }, requestManager: _this._parent._requestManager, accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.defaultAccount, - defaultBlock: _this._parent.defaultBlock + defaultAccount: _this._parent.connectionModel.defaultAccount, + defaultBlock: _this._parent.connectionModel.defaultBlock })).createFunction(); return call(args.options, args.defaultBlock, args.callback); @@ -888,9 +851,9 @@ Contract.prototype._executeMethod = function _executeMethod(){ params: 1, inputFormatter: [formatters.inputTransactionFormatter], requestManager: _this._parent._requestManager, - accounts: _this.constructor._ethAccounts || _this._ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.defaultAccount, - defaultBlock: _this._parent.defaultBlock, + accounts: _this.accounts || _this._ethAccounts, // is eth.accounts (necessary for wallet signing) + defaultAccount: _this._parent.connectionModel.defaultAccount, + defaultBlock: _this._parent.connectionModel.defaultBlock, extraFormatters: extraFormatters })).createFunction(); diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index c8ff86f550b..641b99fcf3e 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -16,8 +16,8 @@ */ /** * @file index.js - * @author Fabian Vogelsteller - * @date 2017 + * @author Samuel Furter + * @date 2018 */ "use strict"; @@ -52,7 +52,8 @@ var uncleCountCall = function (args) { var Eth = function Eth(connectionModel, packageFactory, coreFactory, subscriptionsResolver) { - this.net = connectionModel.getNetworkMethods(); + this.net = connectionModel.getNetworkMethodsAsObject(); + this.Contract = this.packageFactory.createContractPackage(); this.accounts = this.packageFactory.createAccountsPackage(); this.personal = this.packageFactory.createPersonalPackage(); this.iban = this.packageFactory.createIbanPackage(); @@ -61,50 +62,6 @@ var Eth = function Eth(connectionModel, packageFactory, coreFactory, subscriptio this.subscriptionsResolver = subscriptionsResolver; }; -/** - * Sets the Contract package as property of Eth - * - * @param {Object} contractPackage - */ -Eth.prototype.setContractPackage = function (contractPackage) {// TODO: check if this could be removed because of the ConnectionModel - // create a proxy Contract type for this instance, as a Contract's provider - // is stored as a class member rather than an instance variable. If we do - // not create this proxy type, changing the provider in one instance of - // web3-eth would subsequently change the provider for _all_ contract - // instances! - var self = this; - var Contract = function Contract() { - contractPackage.apply(this, arguments); - - // when Eth.setProvider is called, call packageInit - // on all contract instances instantiated via this Eth - // instances. This will update the currentProvider for - // the contract instances - var _this = this; - var setProvider = self.setProvider; - self.setProvider = function () { - setProvider.apply(self, arguments); - core.packageInit(_this, [self.currentProvider]); - }; - }; - - Contract.setProvider = function () { - contractPackage.setProvider.apply(this, arguments); - }; - - // make our proxy Contract inherit from web3-eth-contract so that it has all - // the right functionality and so that instanceof and friends work properly - Contract.prototype = Object.create(contractPackage.prototype); - Contract.prototype.constructor = Contract; - - // add contract - this.Contract = Contract; - this.Contract.defaultAccount = this.defaultAccount; - this.Contract.defaultBlock = this.defaultBlock; - this.Contract.setProvider(this.currentProvider, this.accounts); - -}; - /** * Gets and executes subscription for an given type * diff --git a/packages/web3/src/factories/PackageFactory.js b/packages/web3/src/factories/PackageFactory.js index 05903fe67b9..13ed1aa671b 100644 --- a/packages/web3/src/factories/PackageFactory.js +++ b/packages/web3/src/factories/PackageFactory.js @@ -66,10 +66,12 @@ PackageFactory.prototype.createEthPackage = function () { }; /** - * @returns {Contract} + * Bind ConnectionModel and Accounts package to Contract and return the uninstantiated Contract object. + * + * @returns {Contract} // TODO: Refactor Contract for usage of binded properties */ PackageFactory.prototype.createContractPackage = function () { - return Contract;// have a closer look later + return Contract.bind({connectionModel: this.connectionModel, accounts: this.createAccountsPackage()}); }; /** diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index 14b6ebe24e3..ae949364a91 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -3,9 +3,8 @@ * @constructor */ function ConnectionModel(provider) { - this.provider = provider; + this.provider = provider; //TODO: add provider resolver this.givenProvider = null; - this.defaultBlock = null; } /** @@ -23,6 +22,120 @@ Object.defineProperty(Eth, 'defaultAccount', { enumerable: true }); -ConnectionModel.prototype.getNetworkType = function () { - // return network type (main, ropsten, kovan etc.) +/** + * Defines accessors for defaultBlock + */ +Object.defineProperty(Eth, 'defaultBlock', { + get: function () { + return this.defaultBlock || 'latest'; + }, + set: function (val) { + this.defaultBlock = val; + }, + enumerable: true +}); + +/** + * Determines to which network web3 is currently connected + * + * @method getNetworkType + * + * @param {Function} callback + * + * @callback callback(error, result) + * @returns {Promise} + */ +ConnectionModel.prototype.getNetworkType = function (callback) { + var self = this, id; + + return this.getId().then(function (givenId) { + id = givenId; + + return self.getBlock(0); + }).then(function (genesis) { + var returnValue = 'private'; + switch (genesis) { + case genesis.hash === '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' && id === 1: + returnValue = 'main'; + break; + case genesis.hash === '0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303' && id === 2: + returnValue = 'morden'; + break; + case genesis.hash === '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d' && id === 3: + returnValue = 'ropsten'; + break; + case genesis.hash === '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177' && id === 4: + returnValue = 'rinkeby'; + break; + case genesis.hash === '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9' && id === 42: + returnValue = 'kovan'; + break; + } + + if (_.isFunction(callback)) { + callback(null, returnValue); + } + + return returnValue; + }).catch(function (err) { + if (_.isFunction(callback)) { + callback(err); + + return; + } + + throw err; + }); +}; + +ConnectionModel.prototype.getId = function () { + // new Method({ + // name: 'getId', + // call: 'net_version', + // params: 0, + // outputFormatter: utils.hexToNumber + // }) +}; + +ConnectionModel.prototype.isListening = function () { + // new Method({ + // name: 'isListening', + // call: 'net_listening', + // params: 0 + // }) +}; + +ConnectionModel.prototype.getPeerCount = function () { + // new Method({ + // name: 'getPeerCount', + // call: 'net_peerCount', + // params: 0, + // outputFormatter: utils.hexToNumber + // }) +}; + +ConnectionModel.prototype.getBlock = function (blockNumber) { + // new Method({ + // name: 'getBlock', + // call: blockCall, + // params: 2, + // inputFormatter: [formatter.inputBlockNumberFormatter, function (val) { + // return !!val; + // }], + // outputFormatter: formatter.outputBlockFormatter + // }) +}; + +/** + * Returns the network methods for the public API + * + * @returns {Object} + */ +ConnectionModel.prototype.getNetworkMethodsAsObject = function () { + return { + getId: this.getId.bind(this), + isListening: this.isListening.bind(this), + getPeerCount: this.getPeerCount.bind(this), + getNetworkType: this.getNetworkType.bind(this) + } }; From 9de3979a975325a4fbd2dda5e459c5f0412135f9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 27 Aug 2018 13:57:29 +0200 Subject: [PATCH 0040/1045] Net package removed, getNetworkType moved to ConnectionModel --- packages/web3-eth/src/getNetworkType.js | 80 ------------------------- packages/web3-net/README.md | 41 ------------- packages/web3-net/package.json | 14 ----- packages/web3-net/src/index.js | 67 --------------------- 4 files changed, 202 deletions(-) delete mode 100644 packages/web3-eth/src/getNetworkType.js delete mode 100644 packages/web3-net/README.md delete mode 100644 packages/web3-net/package.json delete mode 100644 packages/web3-net/src/index.js diff --git a/packages/web3-eth/src/getNetworkType.js b/packages/web3-eth/src/getNetworkType.js deleted file mode 100644 index 83aa76b2c4c..00000000000 --- a/packages/web3-eth/src/getNetworkType.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - 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 . - */ -/** - * @file getNetworkType.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -"use strict"; - -var _ = require('underscore'); - -// TODO: move this in the correct package (Net) - -var getNetworkType = function (callback) { - var _this = this, - id; - - - return this.net.getId() - .then(function (givenId) { - - id = givenId; - - return _this.getBlock(0); - }) - .then(function (genesis) { - var returnValue = 'private'; - - if (genesis.hash === '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' && - id === 1) { - returnValue = 'main'; - } - if (genesis.hash === '0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303' && - id === 2) { - returnValue = 'morden'; - } - if (genesis.hash === '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d' && - id === 3) { - returnValue = 'ropsten'; - } - if (genesis.hash === '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177' && - id === 4) { - returnValue = 'rinkeby'; - } - if (genesis.hash === '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9' && - id === 42) { - returnValue = 'kovan'; - } - - if (_.isFunction(callback)) { - callback(null, returnValue); - } - - return returnValue; - }) - .catch(function (err) { - if (_.isFunction(callback)) { - callback(err); - } else { - throw err; - } - }); -}; - -module.exports = getNetworkType; diff --git a/packages/web3-net/README.md b/packages/web3-net/README.md deleted file mode 100644 index a8160c25b2f..00000000000 --- a/packages/web3-net/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# web3-net - -This is a sub package of [web3.js][repo] - -This is the net package to be used in other web3.js packages. -Please read the [documentation][docs] for more. - -## Installation - -### Node.js - -```bash -npm install web3-net -``` - -### In the Browser - -Build running the following in the [web3.js][repo] repository: - -```bash -npm run-script build-all -``` - -Then include `dist/web3-net.js` in your html file. -This will expose the `Web3Net` object on the window object. - - -## Usage - -```js -// in node.js -var Web3Net = require('web3-net'); - -var net = new Web3Net('ws://localhost:8546'); -``` - - -[docs]: http://web3js.readthedocs.io/en/1.0/ -[repo]: https://github.com/ethereum/web3.js - - diff --git a/packages/web3-net/package.json b/packages/web3-net/package.json deleted file mode 100644 index 672ece81723..00000000000 --- a/packages/web3-net/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "web3-net", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Web3 module to interact with the Ethereum nodes networking properties.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-net", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "web3-core": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } -} diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js deleted file mode 100644 index ebf1b456bf5..00000000000 --- a/packages/web3-net/src/index.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - 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 . -*/ -/** - * @file index.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -"use strict"; - -var core = require('web3-core'); -var Method = require('web3-core-method'); -var utils = require('web3-utils'); - - -var Net = function () { - var _this = this; - - // sets _requestmanager - core.packageInit(this, arguments); - - - [ - new Method({ - name: 'getId', - call: 'net_version', - params: 0, - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'isListening', - call: 'net_listening', - params: 0 - }), - new Method({ - name: 'getPeerCount', - call: 'net_peerCount', - params: 0, - outputFormatter: utils.hexToNumber - }) - ].forEach(function(method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - }); - -}; - -core.addProviders(Net); - - -module.exports = Net; - - From b2abe3bde716d8b908284f2e2f98dc8aa2963be4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 28 Aug 2018 13:09:12 +0200 Subject: [PATCH 0041/1045] Smaller provider adapter fixes, refactoring method package started, connectionModel updated --- packages/web3-core-method/src/Method.js | 164 +++++++++++++++++ .../TransactionConfirmationHandler.js | 73 ++++++++ packages/web3-core-method/src/index.js | 169 +++++++++--------- .../lib/adapters/AbstractProviderAdapter.js | 3 + .../src/adapters/HttpProviderAdapter.js | 4 +- .../src/adapters/InpageProviderAdapter.js | 3 +- .../src/adapters/SocketProviderAdapter.js | 6 + packages/web3-eth/package.json | 15 +- packages/web3-eth/src/Eth.js | 18 +- packages/web3/src/models/ConnectionModel.js | 4 +- 10 files changed, 342 insertions(+), 117 deletions(-) create mode 100644 packages/web3-core-method/src/Method.js create mode 100644 packages/web3-core-method/src/handlers/TransactionConfirmationHandler.js diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js new file mode 100644 index 00000000000..ee8bdfaa079 --- /dev/null +++ b/packages/web3-core-method/src/Method.js @@ -0,0 +1,164 @@ +/* + 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 . + */ + +/** + * @file Method.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {Object} provider + * @param {string} rpcMethod + * @param {array} parameters + * @param {array} inputFormatters + * @param {Function} outputFormatter + * @param {Function} extraFormatters + * @param {Object} promiEvent + * @param {Object} transactionConfirmationHandler + * @constructor + */ +function Method( + provider, + rpcMethod, + parameters, + inputFormatters, + outputFormatter, + extraFormatters, + promiEvent, + transactionConfirmationHandler +) { + this.provider = provider; + this.rpcMethod = rpcMethod; + this.parameters = parameters; + this.inputFormatters = inputFormatters; + this.outputFormatter = outputFormatter; + this.extraFormatters = extraFormatters; + this.promiEvent = promiEvent; + this.transactionConfirmationHandler = transactionConfirmationHandler; +} + +/** + * Sends and rpc request + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise | eventifiedPromise} + */ +Method.prototype.send = function (callback) { + if (this.isCall(this.rpcMethod)) { + return this.call(callback); + } + + return this.sendTransaction(callback); +}; + +/** + * Handles a call request + * + * @param callback + * @returns {Promise} + */ +Method.prototype.call = function (callback) { + var self = this; + return this.provider.send(this.rpcMethod, this.formatInput(this.parameters)).then(function (response) { + return self.handleCallResponse(response, callback) + }); +}; + + +/** + * Handle call response + * + * @param {array | string} response + * @param callback + * @returns {*} + */ +Method.prototype.handleCallResponse = function (response, callback) { + var self = this; + + if(_.isArray(response)) { + response = response.map(function(responseItem){ + if (self.outputFormatter && responseItem) { + return self.outputFormatter(responseItem); + } + + return responseItem; + }); + + callback(false, response); + + return response; + } + + if (self.outputFormatter && result) { + response = self.outputFormatter(response); + } + + callback(false, response); + + return response; +}; + +/** + * Handles an sendTransaction request + * + * @param callback + * @returns {eventifiedPromise} + */ +Method.prototype.sendTransaction = function (callback) { + var self = this; + this.provider.send(this.rpcMethod, this.formatInput(this.parameters)).then(function (response) { + self.promiEvent.resolve(this.transactionConfirmationHandler.handle( + response, + self.outputFormatter, + self.extraFormatters, + callback, + self.promiEvent + )); + }).catch(function (error) { + self.promiEvent.reject(error); + self.promiEvent.on('error', error); + }); + + return this.promiEvent; +}; + +/** + * Formatts the input parameters + * + * @param parameters + * @returns {array} + */ +Method.prototype.formatInput = function (parameters) { + return this.inputFormatters.map(function(formatter, key) { + return formatter ? formatter(parameters[key]) : parameters[key]; + }); +}; + +/** + * Determines if the JSON-RPC method is a call method + * + * @param {string} rpcMethod + * @returns {boolean} + */ +Method.prototype.isCall = function (rpcMethod) { + return rpcMethod.indexOf('eth_call') > -1; +}; diff --git a/packages/web3-core-method/src/handlers/TransactionConfirmationHandler.js b/packages/web3-core-method/src/handlers/TransactionConfirmationHandler.js new file mode 100644 index 00000000000..d45e643c1eb --- /dev/null +++ b/packages/web3-core-method/src/handlers/TransactionConfirmationHandler.js @@ -0,0 +1,73 @@ +/* + 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 . + */ +/** + * @file TransactionConfirmationHandler.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var TIMEOUTBLOCK = 50; +var POLLINGTIMEOUT = 15 * TIMEOUTBLOCK; // ~average block time (seconds) * TIMEOUTBLOCK +var CONFIRMATIONBLOCKS = 24; + +function TransactionConfirmationHandler(connectionModel, coreFactory) { + this.connectionModel = connectionModel; + this.coreFactory = coreFactory; // For Subscription creation + this.formatters = this.coreFactory.createFormatters();// for rpc methods + this.confirmationCountForApprovedState = 24; + this.newHeadsSubscription = null; +} + +TransactionConfirmationHandler.prototype.handle = function (transactionPromise, outputFormatter) { + var confirmations = 0; + // determine if it's a contract deployment or not and run the correct method + // return promiEvent on.(confirmation|reciept...) +}; + +TransactionConfirmationHandler.prototype.handleTransaction = function () { + // handle normal transaction and run outputFormatter on it +}; + +TransactionConfirmationHandler.prototype.handleContractDeployment = function () { + // Check for contract address in reciept and check if the code is succesfully deployed on chain + // use contractDeployFormatter on output +}; + +TransactionConfirmationHandler.prototype.startConfirmationListener = function () { + // Check if subscriptions are supported and if they are start an subscription of newHeads and check if this transaction + // is confirmed. If it's confirmed increase the confirmation counter. +}; + +TransactionConfirmationHandler.prototype.isTransactionApproved = function () { + // checks if it has enough confirmations for approving this transaction +}; + +TransactionConfirmationHandler.prototype.clearConfirmationListeners = function () { + // clears all listeners and unsubscribe newHeads subscription +}; + +TransactionConfirmationHandler.prototype.getTransactionReciept = function (transactionHash) { + return this.connectionModel.provider.send('eth_getTransactionReciept', transactionHash).then(function (reciept) { + // output formatter + }); +}; + +TransactionConfirmationHandler.prototype.getContractCode = function (address, blockNumber) { + return this.connectionModel.provider.send('eth_getCode', addressFormatter(address), blockNumberFormatter(blockNumber)); +}; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index e8012bf77c6..0b148285e2b 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -34,7 +34,7 @@ var TIMEOUTBLOCK = 50; var POLLINGTIMEOUT = 15 * TIMEOUTBLOCK; // ~average block time (seconds) * TIMEOUTBLOCK var CONFIRMATIONBLOCKS = 24; -var Method = function Method(options) { +var Method = function Method(connectionModel, coreFactory, options) { if(!options.call || !options.name) { throw new Error('When creating a method you need to provide at least the "name" and "call" property.'); @@ -48,69 +48,68 @@ var Method = function Method(options) { this.transformPayload = options.transformPayload; this.extraFormatters = options.extraFormatters; - this.requestManager = options.requestManager; + this.connectionModel = connectionModel; - // reference to eth.accounts - this.accounts = options.accounts; + this.accounts = this.coreFactory.createAccountsPackage(); - this.defaultBlock = options.defaultBlock || 'latest'; - this.defaultAccount = options.defaultAccount || null; + // this.defaultBlock = this.connectionModel.defaultBlock; + // this.defaultAccount = this.connectionModel.defaultAccount; }; -Method.prototype.setRequestManager = function (requestManager, accounts) { - this.requestManager = requestManager; - - // reference to eth.accounts - if (accounts) { - this.accounts = accounts; - } - -}; - -Method.prototype.createFunction = function (requestManager, accounts) { - var func = this.buildCall(); - func.call = this.call; - - this.setRequestManager(requestManager || this.requestManager, accounts || this.accounts); - - return func; -}; - -Method.prototype.attachToObject = function (obj) { - var func = this.buildCall(); - func.call = this.call; - var name = this.name.split('.'); - if (name.length > 1) { - obj[name[0]] = obj[name[0]] || {}; - obj[name[0]][name[1]] = func; - } else { - obj[name[0]] = func; - } -}; - -/** - * Should be used to determine name of the jsonrpc method based on arguments - * - * @method getCall - * @param {Array} arguments - * @return {String} name of jsonrpc method - */ -Method.prototype.getCall = function (args) { - return _.isFunction(this.call) ? this.call(args) : this.call; -}; - -/** - * Should be used to extract callback from array of arguments. Modifies input param - * - * @method extractCallback - * @param {Array} arguments - * @return {Function|Null} callback, if exists - */ -Method.prototype.extractCallback = function (args) { - if (_.isFunction(args[args.length - 1])) { - return args.pop(); // modify the args array! - } -}; +// Method.prototype.setRequestManager = function (requestManager, accounts) { +// this.requestManager = requestManager; +// +// // reference to eth.accounts +// if (accounts) { +// this.accounts = accounts; +// } +// +// }; + +// Method.prototype.createFunction = function (requestManager, accounts) {// Check where this parameters are used +// var func = this.buildCall(); +// func.call = this.call; +// +// this.setRequestManager(requestManager || this.requestManager, accounts || this.accounts); +// +// return func; +// }; + +// Method.prototype.attachToObject = function (obj) { +// // var func = this.buildCall(); +// // func.call = this.call; +// // var name = this.name.split('.'); +// // if (name.length > 1) { +// // obj[name[0]] = obj[name[0]] || {}; +// // obj[name[0]][name[1]] = func; +// // } else { +// // obj[name[0]] = func; +// // } +// // }; + +// /** +// * Should be used to determine name of the jsonrpc method based on arguments +// * +// * @method getCall +// * @param {Array} arguments +// * @return {String} name of jsonrpc method +// */ +// Method.prototype.getCall = function (args) { +// return _.isFunction(this.call) ? this.call(args) : this.call; +// }; +// +// /** +// * Should be used to extract callback from array of arguments. Modifies input param +// * +// * @method extractCallback +// * @param {Array} arguments +// * @return {Function|Null} callback, if exists +// */ +// Method.prototype.extractCallback = function (args) { +// if (_.isFunction(args[args.length - 1])) { +// return args.pop(); // modify the args array! +// } +// }; /** * Should be called to check if the number of arguments is correct @@ -164,31 +163,31 @@ Method.prototype.formatOutput = function (result) { } }; -/** - * Should create payload from given input args - * - * @method toPayload - * @param {Array} args - * @return {Object} - */ -Method.prototype.toPayload = function (args) { - var call = this.getCall(args); - var callback = this.extractCallback(args); - var params = this.formatInput(args); - this.validateArgs(params); - - var payload = { - method: call, - params: params, - callback: callback - }; - - if (this.transformPayload) { - payload = this.transformPayload(payload); - } - - return payload; -}; +// /** +// * Should create payload from given input args +// * +// * @method toPayload +// * @param {Array} args +// * @return {Object} +// */ +// Method.prototype.toPayload = function (args) { +// var call = this.getCall(args); +// var callback = this.extractCallback(args); +// var params = this.formatInput(args); +// this.validateArgs(params); +// +// var payload = { +// method: call, +// params: params, +// callback: callback +// }; +// +// if (this.transformPayload) { +// payload = this.transformPayload(payload); +// } +// +// return payload; +// }; Method.prototype._confirmTransaction = function (defer, result, payload) { diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js index 3d8bf9f2412..26798886f7b 100644 --- a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js @@ -69,17 +69,20 @@ AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, er if (response && response.error) { reject(errors.ErrorResponse(response)); + return; } if(!JSONRpcResponseValidator.isValid(response.result)) { reject(errors.InvalidResponse(response)); + return; } if(!error) { resolve(response.result); + return; } diff --git a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js index 7873ea19d0c..5d6ba2fe754 100644 --- a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js @@ -22,8 +22,10 @@ "use strict"; +var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapter'); + /** - * @param {HttpProvider} httpProvider + * @param {Object} httpProvider * @constructor */ function HttpProviderAdapter (httpProvider) { diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js index c1d59b413fe..1ee956fe223 100644 --- a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js @@ -22,11 +22,12 @@ "use strict"; +var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapter'); var JSONRpcMapper = require('./JSONRpcMapper.js'); var errors = require('web3-core-helpers').errors; /** - * @param {InpageProvider} inpageProvider + * @param {Object} inpageProvider * @constructor */ function InpageProviderAdapter(inpageProvider) { diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index 2d308348066..5759395a88c 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -22,6 +22,12 @@ "use strict"; +var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapter'); + +/** + * @param {Object} provider + * @constructor + */ function SocketProviderAdapter(provider) { AbstractProviderAdapter.call(provider); this.subscriptions = []; diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index e8a797c2578..9a2cd5bc84d 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -7,19 +7,6 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "underscore": "1.8.3", - "web3-core": "1.0.0-beta.35", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-core-subscriptions": "1.0.0-beta.35", - "web3-eth-abi": "1.0.0-beta.35", - "web3-eth-accounts": "1.0.0-beta.35", - "web3-eth-contract": "1.0.0-beta.35", - "web3-eth-ens": "1.0.0", - "web3-eth-iban": "1.0.0-beta.35", - "web3-eth-personal": "1.0.0-beta.35", - "web3-eth-ens": "1.0.0-beta.35", - "web3-net": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" + "underscore": "1.8.3" } } diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 641b99fcf3e..d7d2d271123 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -23,11 +23,6 @@ "use strict"; var _ = require('underscore'); -var core = require('web3-core'); -var helpers = require('web3-core-helpers'); -var Method = require('web3-core-method'); -var utils = require('web3-utils'); -var formatter = helpers.formatters; var blockCall = function (args) { @@ -59,6 +54,8 @@ var Eth = function Eth(connectionModel, packageFactory, coreFactory, subscriptio this.iban = this.packageFactory.createIbanPackage(); this.abi = this.packageFactory.createAbiPackage(); this.ens = this.packageFactory.createEnsPackage(); + this.utils = this.coreFactory.createUtils(); + this.formatters = this.coreFactory.createFormatters(); this.subscriptionsResolver = subscriptionsResolver; }; @@ -75,9 +72,10 @@ Eth.prototype.subscribe = function (type, parameters, callback) { /** * Appends rpc methods to Eth - * TODO: Refactor methods package and remove that ugly array and write the methods instead of generating it over the constructor. + * */ Eth.prototype.setMethods = function () { + // TODO: change new Method(...) to this.coreFactory.createMethod(...); var methods = [ new Method({ name: 'getNodeInfo', @@ -265,14 +263,6 @@ Eth.prototype.setMethods = function () { outputFormatter: formatter.outputLogFormatter }), ]; - - 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; - }); - }; /** diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index ae949364a91..2879211b0b6 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -4,7 +4,7 @@ */ function ConnectionModel(provider) { this.provider = provider; //TODO: add provider resolver - this.givenProvider = null; + this.givenProvider = null; //TODO: add provider detection maybe this cant be here } /** @@ -12,7 +12,7 @@ function ConnectionModel(provider) { */ Object.defineProperty(Eth, 'defaultAccount', { get: function () { - return this.defaultAccount; + return this.defaultAccount || null; }, set: function (val) { if (val) { From 2693cc7c48725db30662feb7fe18e442b32d6b39 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 28 Aug 2018 15:45:37 +0200 Subject: [PATCH 0042/1045] Transaction confirmation process splitted in smaller objects for better readability of the code --- packages/web3-core-method/src/Method.js | 16 +- .../TransactionConfirmationHandler.js | 73 --- packages/web3-core-method/src/index.js | 610 +----------------- .../models/TransactionConfirmationModel.js | 35 + .../validators/TransactionReceiptValidator.js | 55 ++ .../src/watchers/NewHeadsWatcher.js | 77 +++ .../TransactionConfirmationWorkflow.js | 108 ++++ .../src/Subscription.js | 2 +- 8 files changed, 300 insertions(+), 676 deletions(-) delete mode 100644 packages/web3-core-method/src/handlers/TransactionConfirmationHandler.js create mode 100644 packages/web3-core-method/src/models/TransactionConfirmationModel.js create mode 100644 packages/web3-core-method/src/validators/TransactionReceiptValidator.js create mode 100644 packages/web3-core-method/src/watchers/NewHeadsWatcher.js create mode 100644 packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index ee8bdfaa079..ac8b8593ad5 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -51,7 +51,7 @@ function Method( this.outputFormatter = outputFormatter; this.extraFormatters = extraFormatters; this.promiEvent = promiEvent; - this.transactionConfirmationHandler = transactionConfirmationHandler; + this.transactionConfirmationWorkflow = transactionConfirmationWorkflow; } /** @@ -79,7 +79,7 @@ Method.prototype.send = function (callback) { Method.prototype.call = function (callback) { var self = this; return this.provider.send(this.rpcMethod, this.formatInput(this.parameters)).then(function (response) { - return self.handleCallResponse(response, callback) + return self.formatOutput(response, callback) }); }; @@ -91,7 +91,7 @@ Method.prototype.call = function (callback) { * @param callback * @returns {*} */ -Method.prototype.handleCallResponse = function (response, callback) { +Method.prototype.formatOutput = function (response, callback) { var self = this; if(_.isArray(response)) { @@ -126,13 +126,15 @@ Method.prototype.handleCallResponse = function (response, callback) { Method.prototype.sendTransaction = function (callback) { var self = this; this.provider.send(this.rpcMethod, this.formatInput(this.parameters)).then(function (response) { - self.promiEvent.resolve(this.transactionConfirmationHandler.handle( + self.transactionConfirmationWorkflow.execute( response, self.outputFormatter, self.extraFormatters, - callback, - self.promiEvent - )); + self.promiEvent, + callback + ); + + self.promiEvent.eventEmitter.emit('transactionHash', response) }).catch(function (error) { self.promiEvent.reject(error); self.promiEvent.on('error', error); diff --git a/packages/web3-core-method/src/handlers/TransactionConfirmationHandler.js b/packages/web3-core-method/src/handlers/TransactionConfirmationHandler.js deleted file mode 100644 index d45e643c1eb..00000000000 --- a/packages/web3-core-method/src/handlers/TransactionConfirmationHandler.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - 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 . - */ -/** - * @file TransactionConfirmationHandler.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var TIMEOUTBLOCK = 50; -var POLLINGTIMEOUT = 15 * TIMEOUTBLOCK; // ~average block time (seconds) * TIMEOUTBLOCK -var CONFIRMATIONBLOCKS = 24; - -function TransactionConfirmationHandler(connectionModel, coreFactory) { - this.connectionModel = connectionModel; - this.coreFactory = coreFactory; // For Subscription creation - this.formatters = this.coreFactory.createFormatters();// for rpc methods - this.confirmationCountForApprovedState = 24; - this.newHeadsSubscription = null; -} - -TransactionConfirmationHandler.prototype.handle = function (transactionPromise, outputFormatter) { - var confirmations = 0; - // determine if it's a contract deployment or not and run the correct method - // return promiEvent on.(confirmation|reciept...) -}; - -TransactionConfirmationHandler.prototype.handleTransaction = function () { - // handle normal transaction and run outputFormatter on it -}; - -TransactionConfirmationHandler.prototype.handleContractDeployment = function () { - // Check for contract address in reciept and check if the code is succesfully deployed on chain - // use contractDeployFormatter on output -}; - -TransactionConfirmationHandler.prototype.startConfirmationListener = function () { - // Check if subscriptions are supported and if they are start an subscription of newHeads and check if this transaction - // is confirmed. If it's confirmed increase the confirmation counter. -}; - -TransactionConfirmationHandler.prototype.isTransactionApproved = function () { - // checks if it has enough confirmations for approving this transaction -}; - -TransactionConfirmationHandler.prototype.clearConfirmationListeners = function () { - // clears all listeners and unsubscribe newHeads subscription -}; - -TransactionConfirmationHandler.prototype.getTransactionReciept = function (transactionHash) { - return this.connectionModel.provider.send('eth_getTransactionReciept', transactionHash).then(function (reciept) { - // output formatter - }); -}; - -TransactionConfirmationHandler.prototype.getContractCode = function (address, blockNumber) { - return this.connectionModel.provider.send('eth_getCode', addressFormatter(address), blockNumberFormatter(blockNumber)); -}; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 0b148285e2b..5428b0c96b4 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -1,606 +1,26 @@ /* - This file is part of web3.js. + 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 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. + 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 . -*/ -/** - * @file index.js - * @author Fabian Vogelsteller - * @author Marek Kotewicz - * @date 2017 + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ -"use strict"; - -var _ = require('underscore'); -var errors = require('web3-core-helpers').errors; -var formatters = require('web3-core-helpers').formatters; -var utils = require('web3-utils'); -var promiEvent = require('web3-core-promievent'); -var Subscriptions = require('web3-core-subscriptions').subscriptions; - -var TIMEOUTBLOCK = 50; -var POLLINGTIMEOUT = 15 * TIMEOUTBLOCK; // ~average block time (seconds) * TIMEOUTBLOCK -var CONFIRMATIONBLOCKS = 24; - -var Method = function Method(connectionModel, coreFactory, options) { - - if(!options.call || !options.name) { - throw new Error('When creating a method you need to provide at least the "name" and "call" property.'); - } - - this.name = options.name; - this.call = options.call; - this.params = options.params || 0; - this.inputFormatter = options.inputFormatter; - this.outputFormatter = options.outputFormatter; - this.transformPayload = options.transformPayload; - this.extraFormatters = options.extraFormatters; - - this.connectionModel = connectionModel; - - this.accounts = this.coreFactory.createAccountsPackage(); - - // this.defaultBlock = this.connectionModel.defaultBlock; - // this.defaultAccount = this.connectionModel.defaultAccount; -}; - -// Method.prototype.setRequestManager = function (requestManager, accounts) { -// this.requestManager = requestManager; -// -// // reference to eth.accounts -// if (accounts) { -// this.accounts = accounts; -// } -// -// }; - -// Method.prototype.createFunction = function (requestManager, accounts) {// Check where this parameters are used -// var func = this.buildCall(); -// func.call = this.call; -// -// this.setRequestManager(requestManager || this.requestManager, accounts || this.accounts); -// -// return func; -// }; - -// Method.prototype.attachToObject = function (obj) { -// // var func = this.buildCall(); -// // func.call = this.call; -// // var name = this.name.split('.'); -// // if (name.length > 1) { -// // obj[name[0]] = obj[name[0]] || {}; -// // obj[name[0]][name[1]] = func; -// // } else { -// // obj[name[0]] = func; -// // } -// // }; - -// /** -// * Should be used to determine name of the jsonrpc method based on arguments -// * -// * @method getCall -// * @param {Array} arguments -// * @return {String} name of jsonrpc method -// */ -// Method.prototype.getCall = function (args) { -// return _.isFunction(this.call) ? this.call(args) : this.call; -// }; -// -// /** -// * Should be used to extract callback from array of arguments. Modifies input param -// * -// * @method extractCallback -// * @param {Array} arguments -// * @return {Function|Null} callback, if exists -// */ -// Method.prototype.extractCallback = function (args) { -// if (_.isFunction(args[args.length - 1])) { -// return args.pop(); // modify the args array! -// } -// }; - /** - * Should be called to check if the number of arguments is correct - * - * @method validateArgs - * @param {Array} arguments - * @throws {Error} if it is not + * @file Method.js + * @author Samuel Furter + * @date 2018 */ -Method.prototype.validateArgs = function (args) { - if (args.length !== this.params) { - throw errors.InvalidNumberOfParams(args.length, this.params, this.name); - } -}; - -/** - * Should be called to format input args of method - * - * @method formatInput - * @param {Array} - * @return {Array} - */ -Method.prototype.formatInput = function (args) { - var _this = this; - - if (!this.inputFormatter) { - return args; - } - - return this.inputFormatter.map(function (formatter, index) { - // bind this for defaultBlock, and defaultAccount - return formatter ? formatter.call(_this, args[index]) : args[index]; - }); -}; - -/** - * Should be called to format output(result) of method - * - * @method formatOutput - * @param {Object} - * @return {Object} - */ -Method.prototype.formatOutput = function (result) { - var _this = this; - - if(_.isArray(result)) { - return result.map(function(res){ - return _this.outputFormatter && res ? _this.outputFormatter(res) : res; - }); - } else { - return this.outputFormatter && result ? this.outputFormatter(result) : result; - } -}; - -// /** -// * Should create payload from given input args -// * -// * @method toPayload -// * @param {Array} args -// * @return {Object} -// */ -// Method.prototype.toPayload = function (args) { -// var call = this.getCall(args); -// var callback = this.extractCallback(args); -// var params = this.formatInput(args); -// this.validateArgs(params); -// -// var payload = { -// method: call, -// params: params, -// callback: callback -// }; -// -// if (this.transformPayload) { -// payload = this.transformPayload(payload); -// } -// -// return payload; -// }; - - -Method.prototype._confirmTransaction = function (defer, result, payload) { - var method = this, - promiseResolved = false, - canUnsubscribe = true, - timeoutCount = 0, - confirmationCount = 0, - intervalId = null, - receiptJSON = '', - gasProvided = (_.isObject(payload.params[0]) && payload.params[0].gas) ? payload.params[0].gas : null, - isContractDeployment = _.isObject(payload.params[0]) && - payload.params[0].data && - payload.params[0].from && - !payload.params[0].to; - - // add custom send Methods - var _ethereumCalls = [ - new Method({ - name: 'getTransactionReceipt', - call: 'eth_getTransactionReceipt', - params: 1, - inputFormatter: [null], - outputFormatter: formatters.outputTransactionReceiptFormatter - }), - new Method({ - name: 'getCode', - call: 'eth_getCode', - params: 2, - inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter] - }), - new Subscriptions({ - name: 'subscribe', - type: 'eth', - subscriptions: { - 'newBlockHeaders': { - subscriptionName: 'newHeads', // replace subscription with this name - params: 0, - outputFormatter: formatters.outputBlockFormatter - } - } - }) - ]; - // attach methods to this._ethereumCall - var _ethereumCall = {}; - _.each(_ethereumCalls, function (mthd) { - mthd.attachToObject(_ethereumCall); - mthd.requestManager = method.requestManager; // assign rather than call setRequestManager() - }); - - - // fire "receipt" and confirmation events and resolve after - var checkConfirmation = function (existingReceipt, isPolling, err, blockHeader, sub) { - if (!err) { - // create fake unsubscribe - if (!sub) { - sub = { - unsubscribe: function () { - clearInterval(intervalId); - } - }; - } - // if we have a valid receipt we don't need to send a request - return (existingReceipt ? promiEvent.resolve(existingReceipt) : _ethereumCall.getTransactionReceipt(result)) - // catch error from requesting receipt - .catch(function (err) { - sub.unsubscribe(); - promiseResolved = true; - utils._fireError({message: 'Failed to check for transaction receipt:', data: err}, defer.eventEmitter, defer.reject); - }) - // if CONFIRMATION listener exists check for confirmations, by setting canUnsubscribe = false - .then(function(receipt) { - if (!receipt || !receipt.blockHash) { - throw new Error('Receipt missing or blockHash null'); - } - - // apply extra formatters - if (method.extraFormatters && method.extraFormatters.receiptFormatter) { - receipt = method.extraFormatters.receiptFormatter(receipt); - } - - // check if confirmation listener exists - if (defer.eventEmitter.listeners('confirmation').length > 0) { - - // If there was an immediately retrieved receipt, it's already - // been confirmed by the direct call to checkConfirmation needed - // for parity instant-seal - if (existingReceipt === undefined || confirmationCount !== 0){ - defer.eventEmitter.emit('confirmation', confirmationCount, receipt); - } - - canUnsubscribe = false; - confirmationCount++; - - if (confirmationCount === CONFIRMATIONBLOCKS + 1) { // add 1 so we account for conf 0 - sub.unsubscribe(); - defer.eventEmitter.removeAllListeners(); - } - } - - return receipt; - }) - // CHECK for CONTRACT DEPLOYMENT - .then(function(receipt) { - - if (isContractDeployment && !promiseResolved) { - - if (!receipt.contractAddress) { - - if (canUnsubscribe) { - sub.unsubscribe(); - promiseResolved = true; - } - - utils._fireError(new Error('The transaction receipt didn\'t contain a contract address.'), defer.eventEmitter, defer.reject); - return; - } - - _ethereumCall.getCode(receipt.contractAddress, function (e, code) { - - if (!code) { - return; - } - - - if (code.length > 2) { - defer.eventEmitter.emit('receipt', receipt); - - // if contract, return instance instead of receipt - if (method.extraFormatters && method.extraFormatters.contractDeployFormatter) { - defer.resolve(method.extraFormatters.contractDeployFormatter(receipt)); - } else { - defer.resolve(receipt); - } - - // need to remove listeners, as they aren't removed automatically when succesfull - if (canUnsubscribe) { - defer.eventEmitter.removeAllListeners(); - } - - } else { - utils._fireError(new Error('The contract code couldn\'t be stored, please check your gas limit.'), defer.eventEmitter, defer.reject); - } - - if (canUnsubscribe) { - sub.unsubscribe(); - } - promiseResolved = true; - }); - } - - return receipt; - }) - // CHECK for normal tx check for receipt only - .then(function(receipt) { - - if (!isContractDeployment && !promiseResolved) { - - if(!receipt.outOfGas && - (!gasProvided || gasProvided !== receipt.gasUsed) && - (receipt.status === true || receipt.status === '0x1' || typeof receipt.status === 'undefined')) { - defer.eventEmitter.emit('receipt', receipt); - defer.resolve(receipt); - - // need to remove listeners, as they aren't removed automatically when succesfull - if (canUnsubscribe) { - defer.eventEmitter.removeAllListeners(); - } - - } else { - receiptJSON = JSON.stringify(receipt, null, 2); - if (receipt.status === false || receipt.status === '0x0') { - utils._fireError(new Error("Transaction has been reverted by the EVM:\n" + receiptJSON), - defer.eventEmitter, defer.reject); - } else { - utils._fireError( - new Error("Transaction ran out of gas. Please provide more gas:\n" + receiptJSON), - defer.eventEmitter, defer.reject); - } - } - - if (canUnsubscribe) { - sub.unsubscribe(); - } - promiseResolved = true; - } - - }) - // time out the transaction if not mined after 50 blocks - .catch(function () { - timeoutCount++; - // check to see if we are http polling - if(!!isPolling) { - // polling timeout is different than TIMEOUTBLOCK blocks since we are triggering every second - if (timeoutCount - 1 >= POLLINGTIMEOUT) { - sub.unsubscribe(); - promiseResolved = true; - utils._fireError(new Error('Transaction was not mined within' + POLLINGTIMEOUT + ' seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!'), defer.eventEmitter, defer.reject); - } - } else { - if (timeoutCount - 1 >= TIMEOUTBLOCK) { - sub.unsubscribe(); - promiseResolved = true; - utils._fireError(new Error('Transaction was not mined within 50 blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!'), defer.eventEmitter, defer.reject); - } - } - }); - - - } else { - sub.unsubscribe(); - promiseResolved = true; - utils._fireError({message: 'Failed to subscribe to new newBlockHeaders to confirm the transaction receipts.', data: err}, defer.eventEmitter, defer.reject); - } - }; - - // start watching for confirmation depending on the support features of the provider - var startWatching = function(existingReceipt) { - // if provider allows PUB/SUB - if (_.isFunction(this.requestManager.provider.on)) { - _ethereumCall.subscribe('newBlockHeaders', checkConfirmation.bind(null, existingReceipt, false)); - } else { - intervalId = setInterval(checkConfirmation.bind(null, existingReceipt, true), 1000); - } - }.bind(this); - - - // first check if we already have a confirmed transaction - _ethereumCall.getTransactionReceipt(result) - .then(function(receipt) { - if (receipt && receipt.blockHash) { - if (defer.eventEmitter.listeners('confirmation').length > 0) { - // We must keep on watching for new Blocks, if a confirmation listener is present - startWatching(receipt); - } - checkConfirmation(receipt, false); - - } else if (!promiseResolved) { - startWatching(); - } - }) - .catch(function(){ - if (!promiseResolved) startWatching(); - }); - -}; - - -var getWallet = function(from, accounts) { - var wallet = null; - - // is index given - if (_.isNumber(from)) { - wallet = accounts.wallet[from]; - - // is account given - } else if (_.isObject(from) && from.address && from.privateKey) { - wallet = from; - - // search in wallet for address - } else { - wallet = accounts.wallet[from.toLowerCase()]; - } - - return wallet; -}; - -Method.prototype.buildCall = function() { - var method = this, - isSendTx = (method.call === 'eth_sendTransaction' || method.call === 'eth_sendRawTransaction'); // || method.call === 'personal_sendTransaction' - - // actual send function - var send = function () { - var defer = promiEvent(!isSendTx), - payload = method.toPayload(Array.prototype.slice.call(arguments)); - - - // CALLBACK function - var sendTxCallback = function (err, result) { - try { - result = method.formatOutput(result); - } catch(e) { - err = e; - } - - if (result instanceof Error) { - err = result; - } - - if (!err) { - if (payload.callback) { - payload.callback(null, result); - } - } else { - if(err.error) { - err = err.error; - } - - return utils._fireError(err, defer.eventEmitter, defer.reject, payload.callback); - } - - // return PROMISE - if (!isSendTx) { - - if (!err) { - defer.resolve(result); - - } - - // return PROMIEVENT - } else { - defer.eventEmitter.emit('transactionHash', result); - - method._confirmTransaction(defer, result, payload); - } - - }; - - // SENDS the SIGNED SIGNATURE - var sendSignedTx = function(sign){ - - var signedPayload = _.extend({}, payload, { - method: 'eth_sendRawTransaction', - params: [sign.rawTransaction] - }); - - method.requestManager.send(signedPayload, sendTxCallback); - }; - - - var sendRequest = function(payload, method) { - - if (method && method.accounts && method.accounts.wallet && method.accounts.wallet.length) { - var wallet; - - // ETH_SENDTRANSACTION - if (payload.method === 'eth_sendTransaction') { - var tx = payload.params[0]; - wallet = getWallet((_.isObject(tx)) ? tx.from : null, method.accounts); - - - // If wallet was found, sign tx, and send using sendRawTransaction - if (wallet && wallet.privateKey) { - return method.accounts.signTransaction(_.omit(tx, 'from'), wallet.privateKey).then(sendSignedTx); - } - - // ETH_SIGN - } else if (payload.method === 'eth_sign') { - var data = payload.params[1]; - wallet = getWallet(payload.params[0], method.accounts); - - // If wallet was found, sign tx, and send using sendRawTransaction - if (wallet && wallet.privateKey) { - var sign = method.accounts.sign(data, wallet.privateKey); - - if (payload.callback) { - payload.callback(null, sign.signature); - } - - defer.resolve(sign.signature); - return; - } - - - } - } - - return method.requestManager.send(payload, sendTxCallback); - }; - - // Send the actual transaction - if(isSendTx && _.isObject(payload.params[0]) && typeof payload.params[0].gasPrice === 'undefined') { - - var getGasPrice = (new Method({ - name: 'getGasPrice', - call: 'eth_gasPrice', - params: 0 - })).createFunction(method.requestManager); - - getGasPrice(function (err, gasPrice) { - - if (gasPrice) { - payload.params[0].gasPrice = gasPrice; - } - sendRequest(payload, method); - }); - - } else { - sendRequest(payload, method); - } - - - return defer.eventEmitter; - }; - - // necessary to attach things to the method - send.method = method; - // necessary for batch requests - send.request = this.request.bind(this); - return send; -}; - -/** - * Should be called to create the pure JSONRPC request which can be used in a batch request - * - * @method request - * @return {Object} jsonrpc request - */ -Method.prototype.request = function () { - var payload = this.toPayload(Array.prototype.slice.call(arguments)); - payload.format = this.formatOutput.bind(this); - return payload; -}; +var Method = require('./Method'); module.exports = Method; diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js new file mode 100644 index 00000000000..9a72713b564 --- /dev/null +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -0,0 +1,35 @@ +/* + 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 . + */ +/** + * @file TransactionConfirmationModel.js + * @author Samuel Furter + * @date 2018 + */ + +function TransactionConfirmationModel() { + this.confirmations = []; +} + +TransactionConfirmationModel.prototype.addConfirmation = function (receipt) { + this.confirmations.push(receipt); +}; + +TransactionConfirmationModel.prototype.getConfirmationsCount = function () { + return this.confirmations.length; +}; + + diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js new file mode 100644 index 00000000000..aa9c08825b7 --- /dev/null +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -0,0 +1,55 @@ +/* + 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 . + */ +/** + * @file TransactionReceiptValidator.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +function TransactionReceiptValidator() { } + +TransactionReceiptValidator.prototype.validate = function (receipt) { + if (this.isValidGasUsage(receipt) && this.isValidReceiptStatus(receipt)) { + return true; + } + + var receiptJSON = JSON.stringify(receipt, null, 2); + + if (receipt.status === false || receipt.status === '0x0') { + return new Error("Transaction has been reverted by the EVM:\n" + receiptJSON); + } + + return new Error("Transaction ran out of gas. Please provide more gas:\n" + receiptJSON); +}; + +/** + * @param {Object} receipt + * @returns {boolean} + */ +TransactionReceiptValidator.prototype.isValidReceiptStatus = function (receipt) { + return receipt.status === true || receipt.status === '0x1' || typeof receipt.status === 'undefined' +}; + +/** + * @param {Object} receipt + * @returns {boolean} + */ +TransactionReceiptValidator.prototype.isValidGasUsage = function (receipt) { + return !receipt.outOfGas && (!gasProvided || gasProvided !== receipt.gasUsed); +}; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js new file mode 100644 index 00000000000..ccbabcaa996 --- /dev/null +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -0,0 +1,77 @@ +/* + 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 . + */ +/** + * @file NewHeadsWatcher.js + * @author Samuel Furter + * @date 2018 + */ + +/** + * @param {Object} provider + * @param {Object} coreFactory + * @constructor + */ +function NewHeadsWatcher(provider, coreFactory) { + this.provider = provider; + this.coreFactory = coreFactory; + this.formatters = this.coreFactory.createFormatters(); + this.confirmationInterval = null; + this.confirmationSubscription = null; +} + +/** + * Starts subscription on newHeads if supported or creates an interval to get the newHeads + * + * @param {String} transactionHash + * @returns {NewHeadsWatcher} + */ +NewHeadsWatcher.prototype.watch = function (transactionHash) { + var self = this; + + try { + this.confirmationSubscription = this.coreFactory.createSubscription( + this.provider, + 'newHeads', + transactionHash, + null, + this.formatters.outputBlockFormatter + ).subscribe(function () { + self.emit('newHead');// Check the return values + }); + } catch (error) { + this.confirmationInterval = setInterval(this.emit('newHead'), 1000); + } + + return this; +}; + +/** + * Clears the interval and unsubscribes the subscription + */ +NewHeadsWatcher.prototype.stop = function () { + if(this.confirmationSubscription) { + this.confirmationSubscription.unsubscribe(); + + return; + } + + clearInterval(this.confirmationInterval); +}; + +// Inherit EventEmitter +NewHeadsWatcher.prototype = Object.create(EventEmitter.prototype); +NewHeadsWatcher.prototype.constructor = NewHeadsWatcher; diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js new file mode 100644 index 00000000000..190e34ac0db --- /dev/null +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -0,0 +1,108 @@ +/* + 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 . + */ +/** + * @file TransactionConfirmationWorkflow.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var TIMEOUTBLOCK = 50; +var POLLINGTIMEOUT = 15 * TIMEOUTBLOCK; // ~average block time (seconds) * TIMEOUTBLOCK +var CONFIRMATIONBLOCKS = 24; + +/** + * @param {Object} transactionConfirmationModel + * @param {Object} transactionReceiptValidator + * @param {Object} newHeadsWatcher + * @constructor + */ +function TransactionConfirmationWorkflow( // TODO: Timeout handling + transactionConfirmationModel, + transactionReceiptValidator, + newHeadsWatcher +) { + this.transactionConfirmationModel = transactionConfirmationModel; + this.transactionReceiptValidator = transactionReceiptValidator; + this.newHeadsWatcher = newHeadsWatcher; +} + +/** + * Executes the transaction confirmation workflow + * + * @param {string} transactionHash + * @param {Function} outputFormatter + * @param {Function} extraFormatter //TODO: check for what exactly this extraFormatters are and where they are used. + * @param {Object} promiEvent + * @param {Function} callback + */ +TransactionConfirmationWorkflow.prototype.execute = function (transactionHash, outputFormatter, extraFormatter, promiEvent, callback) { + var self = this; + this.getTransactionReceipt(transactionHash).then(function (receipt) { + if (receipt && receipt.blockHash) { + var validationResult = this.transactionReceiptValidator.validate(receipt); + if (validationResult === true) { + promiEvent.eventEmitter.emit('receipt', receipt); + promiEvent.resolve(receipt); + callback(false, receipt); + + return; + } + + promiEvent.eventEmitter.emit('error', validationResult); + promiEvent.reject(validationResult); + callback(validationResult, null); + + return; + } + + self.newHeadsWatcher.watch().on('newHead', function () { + self.getTransactionReciept(transactionHash).then(function (receipt) { + var validationResult = self.transactionReceiptValidator.validate(receipt); + if (validationResult === true) { + var formattedReceipt = outputFormatter(receipt); + + self.transactionConfirmationModel.addConfirmation(formattedReceipt); + var confirmationsCount = self.transactionConfirmationModel.getConfirmationsCount(); + + self.promiEvent.eventEmitter.emit( + 'confirmation', + confirmationsCount, + outputFormatter(formattedReceipt) + ); + + if (confirmationsCount === CONFIRMATIONBLOCKS) { + promiEvent.eventEmitter.emit('receipt', outputFormatter(formattedReceipt)); + promiEvent.resolve(outputFormatter(formattedReceipt)); + callback(false, formattedReceipt); + + self.newHeadsWatcher.stop(); + } + + return; + } + + promiEvent.eventEmitter.emit('error', validationResult, receipt); + promiEvent.reject(validationResult); + callback(validationResult, null); + + // throw validationResult; have a closer look to utils.fireError and why this method exists + }); + }); + }); +}; diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 6af0adc7581..d23a818f7e4 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -131,7 +131,7 @@ Subscription.prototype.reconnect = function (type, parameters, subscriptionId, c * @returns {*} */ Subscription.prototype.formatOutput = function (output) { - if (_.isFunction(this.outputFormmater) && output) { + if (_.isFunction(this.outputFormatter) && output) { return this.outputFormatter(output); } From 92bc3a5283d62fae3235ea1881ae1514c6a74c62 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 28 Aug 2018 15:50:19 +0200 Subject: [PATCH 0043/1045] getTransactionReceipt added to TransactonConfirmationWorkflow --- .../TransactionConfirmationWorkflow.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 190e34ac0db..2b22d8f8933 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -27,12 +27,14 @@ var POLLINGTIMEOUT = 15 * TIMEOUTBLOCK; // ~average block time (seconds) * TIMEO var CONFIRMATIONBLOCKS = 24; /** + * @param {Object} provider * @param {Object} transactionConfirmationModel * @param {Object} transactionReceiptValidator * @param {Object} newHeadsWatcher * @constructor */ -function TransactionConfirmationWorkflow( // TODO: Timeout handling +function TransactionConfirmationWorkflow(// TODO: Timeout handling, handling of contract deployment + provider, transactionConfirmationModel, transactionReceiptValidator, newHeadsWatcher @@ -40,6 +42,7 @@ function TransactionConfirmationWorkflow( // TODO: Timeout handling this.transactionConfirmationModel = transactionConfirmationModel; this.transactionReceiptValidator = transactionReceiptValidator; this.newHeadsWatcher = newHeadsWatcher; + this.provider = provider; } /** @@ -72,7 +75,7 @@ TransactionConfirmationWorkflow.prototype.execute = function (transactionHash, o } self.newHeadsWatcher.watch().on('newHead', function () { - self.getTransactionReciept(transactionHash).then(function (receipt) { + self.getTransactionReceipt(transactionHash).then(function (receipt) { var validationResult = self.transactionReceiptValidator.validate(receipt); if (validationResult === true) { var formattedReceipt = outputFormatter(receipt); @@ -106,3 +109,14 @@ TransactionConfirmationWorkflow.prototype.execute = function (transactionHash, o }); }); }; + +/** + * Get receipt by transaction hash + * + * @param {string} transactionHash + */ +TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (transactionHash) { + this.provider.send('eth_getTransactionReceipt', transactionHash).then(function(receipt) { + return this.formatters.outputTransactionReceiptFormatter(receipt); + }) +}; From d27a9b17b12598319b14f7a73a28cc1d80f150fc Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 28 Aug 2018 17:30:09 +0200 Subject: [PATCH 0044/1045] Contract deployment handling added to transaction workflow --- packages/web3-core-method/src/Method.js | 34 ++-- .../src/watchers/NewHeadsWatcher.js | 6 +- .../TransactionConfirmationWorkflow.js | 149 +++++++++++++++--- 3 files changed, 151 insertions(+), 38 deletions(-) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index ac8b8593ad5..dc884a7172b 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -31,7 +31,7 @@ * @param {Function} outputFormatter * @param {Function} extraFormatters * @param {Object} promiEvent - * @param {Object} transactionConfirmationHandler + * @param {Object} transactionConfirmationWorkflow * @constructor */ function Method( @@ -42,7 +42,7 @@ function Method( outputFormatter, extraFormatters, promiEvent, - transactionConfirmationHandler + transactionConfirmationWorkflow ) { this.provider = provider; this.rpcMethod = rpcMethod; @@ -63,11 +63,11 @@ function Method( * @returns {Promise | eventifiedPromise} */ Method.prototype.send = function (callback) { - if (this.isCall(this.rpcMethod)) { - return this.call(callback); + if (this.isSendTransaction(this.rpcMethod)) { + return this.sendTransaction(callback); } - return this.sendTransaction(callback); + return this.call(callback); }; /** @@ -94,8 +94,8 @@ Method.prototype.call = function (callback) { Method.prototype.formatOutput = function (response, callback) { var self = this; - if(_.isArray(response)) { - response = response.map(function(responseItem){ + if (_.isArray(response)) { + response = response.map(function (responseItem) { if (self.outputFormatter && responseItem) { return self.outputFormatter(responseItem); } @@ -129,7 +129,7 @@ Method.prototype.sendTransaction = function (callback) { self.transactionConfirmationWorkflow.execute( response, self.outputFormatter, - self.extraFormatters, + self.isContractDeployment(self.parameters), self.promiEvent, callback ); @@ -150,8 +150,8 @@ Method.prototype.sendTransaction = function (callback) { * @returns {array} */ Method.prototype.formatInput = function (parameters) { - return this.inputFormatters.map(function(formatter, key) { - return formatter ? formatter(parameters[key]) : parameters[key]; + return this.inputFormatters.map(function (formatter, key) { + return formatter ? formatter(parameters[key]) : parameters[key]; }); }; @@ -161,6 +161,16 @@ Method.prototype.formatInput = function (parameters) { * @param {string} rpcMethod * @returns {boolean} */ -Method.prototype.isCall = function (rpcMethod) { - return rpcMethod.indexOf('eth_call') > -1; +Method.prototype.isSendTransaction = function (rpcMethod) { + return rpcMethod === 'eth_sendTransaction' || rpcMethod === 'eth_sendRawTransaction'; +}; + +/** + * Check if this method deploys a contract + * + * @param {array} parameters + * @returns {boolean} + */ +Method.prototype.isContractDeployment = function (parameters) { + return _.isObject(parameters[0]) && parameters[0].data && parameters[0].from && !parameters[0].to; }; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index ccbabcaa996..0aa54cea778 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -65,11 +65,11 @@ NewHeadsWatcher.prototype.watch = function (transactionHash) { NewHeadsWatcher.prototype.stop = function () { if(this.confirmationSubscription) { this.confirmationSubscription.unsubscribe(); - - return; } - clearInterval(this.confirmationInterval); + if(this.confirmationInterval) { + clearInterval(this.confirmationInterval); + } }; // Inherit EventEmitter diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 2b22d8f8933..13e8e215930 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -27,14 +27,14 @@ var POLLINGTIMEOUT = 15 * TIMEOUTBLOCK; // ~average block time (seconds) * TIMEO var CONFIRMATIONBLOCKS = 24; /** - * @param {Object} provider + * @param {Object} connectionModel * @param {Object} transactionConfirmationModel * @param {Object} transactionReceiptValidator * @param {Object} newHeadsWatcher * @constructor */ -function TransactionConfirmationWorkflow(// TODO: Timeout handling, handling of contract deployment - provider, +function TransactionConfirmationWorkflow(// TODO: Timeout handling, remove eventEmitter listeners on "done" + connectionModel, transactionConfirmationModel, transactionReceiptValidator, newHeadsWatcher @@ -42,7 +42,8 @@ function TransactionConfirmationWorkflow(// TODO: Timeout handling, handling of this.transactionConfirmationModel = transactionConfirmationModel; this.transactionReceiptValidator = transactionReceiptValidator; this.newHeadsWatcher = newHeadsWatcher; - this.provider = provider; + this.provider = connectionModel.provider; + this.connectionModel = connectionModel; } /** @@ -50,26 +51,35 @@ function TransactionConfirmationWorkflow(// TODO: Timeout handling, handling of * * @param {string} transactionHash * @param {Function} outputFormatter - * @param {Function} extraFormatter //TODO: check for what exactly this extraFormatters are and where they are used. + * @param {boolean} isContractDeployment * @param {Object} promiEvent * @param {Function} callback */ -TransactionConfirmationWorkflow.prototype.execute = function (transactionHash, outputFormatter, extraFormatter, promiEvent, callback) { +TransactionConfirmationWorkflow.prototype.execute = function (// TODO: check extraFormatters + transactionHash, + outputFormatter, + isContractDeployment, + promiEvent, + callback +) { var self = this; this.getTransactionReceipt(transactionHash).then(function (receipt) { if (receipt && receipt.blockHash) { var validationResult = this.transactionReceiptValidator.validate(receipt); if (validationResult === true) { - promiEvent.eventEmitter.emit('receipt', receipt); - promiEvent.resolve(receipt); - callback(false, receipt); + + if (isContractDeployment) { + self.handleContractDeployment(receipt, promiEvent, callback); + + return; + } + + this.handleSuccessState(receipt, promiEvent, callback); return; } - promiEvent.eventEmitter.emit('error', validationResult); - promiEvent.reject(validationResult); - callback(validationResult, null); + self.handleErrorState(validationResult, promiEvent, callback); return; } @@ -78,6 +88,13 @@ TransactionConfirmationWorkflow.prototype.execute = function (transactionHash, o self.getTransactionReceipt(transactionHash).then(function (receipt) { var validationResult = self.transactionReceiptValidator.validate(receipt); if (validationResult === true) { + + if (isContractDeployment) { + self.handleContractDeployment(receipt, promiEvent, callback); + + return; + } + var formattedReceipt = outputFormatter(receipt); self.transactionConfirmationModel.addConfirmation(formattedReceipt); @@ -86,37 +103,123 @@ TransactionConfirmationWorkflow.prototype.execute = function (transactionHash, o self.promiEvent.eventEmitter.emit( 'confirmation', confirmationsCount, - outputFormatter(formattedReceipt) + formattedReceipt ); - if (confirmationsCount === CONFIRMATIONBLOCKS) { - promiEvent.eventEmitter.emit('receipt', outputFormatter(formattedReceipt)); - promiEvent.resolve(outputFormatter(formattedReceipt)); - callback(false, formattedReceipt); - - self.newHeadsWatcher.stop(); + if (confirmationsCount === (CONFIRMATIONBLOCKS + 1)) { + self.handleSuccessState(formattedReceipt, promiEvent, callback); } return; } - promiEvent.eventEmitter.emit('error', validationResult, receipt); promiEvent.reject(validationResult); + promiEvent.eventEmitter.emit('error', validationResult, receipt); + promiEvent.eventEmitter.removeAllListeners(); callback(validationResult, null); - - // throw validationResult; have a closer look to utils.fireError and why this method exists }); }); }); }; +/** + * Handle contract deployment + * + * @param {Object} receipt + * @param {Object} promiEvent + * @param {Function} callback + */ +TransactionConfirmationWorkflow.prototype.handleContractDeployment = function (receipt, promiEvent, callback) { + var self = this; + + if (!receipt.contractAddress) { + self.handleErrorState( + new Error('The transaction receipt didn\'t contain a contract address.'), + promiEvent, + callback + ); + } + + this.getContractCode(receipt.contractAddress).then(function (contractCode) { + if (contractCode.length > 2) { + var result = receipt; + + if (method.extraFormatters && method.extraFormatters.contractDeployFormatter) { + result = method.extraFormatters.contractDeployFormatter(receipt); + } + + self.newHeadsWatcher.stop(); + + promiEvent.resolve(result); + promiEvent.eventEmitter.emit('receipt', receipt); + promiEvent.eventEmitter.removeAllListeners(); + callback(false, result); + + return; + } + + self.handleErrorState( + new Error('The contract code couldn\'t be stored, please check your gas limit.'), + promiEvent, + callback + ); + + }); +}; + /** * Get receipt by transaction hash * * @param {string} transactionHash */ TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (transactionHash) { - this.provider.send('eth_getTransactionReceipt', transactionHash).then(function(receipt) { + this.provider.send('eth_getTransactionReceipt', transactionHash).then(function (receipt) { return this.formatters.outputTransactionReceiptFormatter(receipt); }) }; + +/** + * Get code of contract by his address + * + * @param {string} contractAddress + * @returns {Promise} + */ +TransactionConfirmationWorkflow.prototype.getContractCode = function (contractAddress) { + return this.provider.send( + 'eth_getCode', + [ + this.formatters.inputAddressFormatter(contractAddress), + this.formatters.inputDefaultBlockNumberFormatter() // have a closer look on this formatter it uses this.defaultBlock from a magic scope where ever it is defined. + ] + ); +}; + +/** + * Resolves promise, emits receipt event, calls callback and removes all the listeners. + * + * @param {Object} receipt + * @param {Object} promiEvent + * @param {Function} callback + */ +TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt, promiEvent, callback) { + this.newHeadsWatcher.stop(); + promiEvent.resolve(receipt); + promiEvent.eventEmitter.emit('receipt', receipt); + promiEvent.eventEmitter.removeAllListeners(); + callback(false, receipt); +}; + +/** + * Rejects promise, emits error event, calls callback and removes all the listeners. + * + * @param {Object} error + * @param {Object} promiEvent + * @param {Function} callback + */ +TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, promiEvent, callback) { + this.newHeadsWatcher.stop(); + promiEvent.reject(error).apply(error); + promiEvent.eventEmitter.emit('error', error); + promiEvent.eventEmitter.removeAllListeners(); + callback(error, null); +}; From 7eb49809b67330513f8092911ec2e9768072f0db Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 28 Aug 2018 17:33:22 +0200 Subject: [PATCH 0045/1045] Important todo added --- .../src/workflows/TransactionConfirmationWorkflow.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 13e8e215930..40045544d6c 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -125,6 +125,7 @@ TransactionConfirmationWorkflow.prototype.execute = function (// TODO: check ext /** * Handle contract deployment * + * TODO: Create AbstractWorkflow and determine in the Method object which workflow should be executed. * @param {Object} receipt * @param {Object} promiEvent * @param {Function} callback From 347bf790083801fae9fc6ac912b18a86c7ba3825 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 28 Aug 2018 18:02:39 +0200 Subject: [PATCH 0046/1045] Strange extra formatters added to TransactionConfirmationWorkflow --- packages/web3-core-method/src/Method.js | 10 ++--- .../TransactionConfirmationWorkflow.js | 38 ++++++++++++++----- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index dc884a7172b..e60ddf999c7 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -29,18 +29,18 @@ * @param {array} parameters * @param {array} inputFormatters * @param {Function} outputFormatter - * @param {Function} extraFormatters + * @param {Function} extraFormatter * @param {Object} promiEvent * @param {Object} transactionConfirmationWorkflow * @constructor */ -function Method( +function Method(// TODO: Add transaction signing provider, rpcMethod, parameters, inputFormatters, outputFormatter, - extraFormatters, + extraFormatter, promiEvent, transactionConfirmationWorkflow ) { @@ -49,7 +49,7 @@ function Method( this.parameters = parameters; this.inputFormatters = inputFormatters; this.outputFormatter = outputFormatter; - this.extraFormatters = extraFormatters; + this.extraFormatter = extraFormatter; this.promiEvent = promiEvent; this.transactionConfirmationWorkflow = transactionConfirmationWorkflow; } @@ -128,7 +128,7 @@ Method.prototype.sendTransaction = function (callback) { this.provider.send(this.rpcMethod, this.formatInput(this.parameters)).then(function (response) { self.transactionConfirmationWorkflow.execute( response, - self.outputFormatter, + self.extraFormatter, self.isContractDeployment(self.parameters), self.promiEvent, callback diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 40045544d6c..93620e36504 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -50,14 +50,14 @@ function TransactionConfirmationWorkflow(// TODO: Timeout handling, remove event * Executes the transaction confirmation workflow * * @param {string} transactionHash - * @param {Function} outputFormatter + * @param {Object} extraFormatters * @param {boolean} isContractDeployment * @param {Object} promiEvent * @param {Function} callback */ -TransactionConfirmationWorkflow.prototype.execute = function (// TODO: check extraFormatters +TransactionConfirmationWorkflow.prototype.execute = function ( transactionHash, - outputFormatter, + extraFormatters, isContractDeployment, promiEvent, callback @@ -69,12 +69,12 @@ TransactionConfirmationWorkflow.prototype.execute = function (// TODO: check ext if (validationResult === true) { if (isContractDeployment) { - self.handleContractDeployment(receipt, promiEvent, callback); + self.handleContractDeployment(receipt, extraFormatters, promiEvent, callback); return; } - this.handleSuccessState(receipt, promiEvent, callback); + this.handleSuccessState(this.executeExtraReceiptFormatter(receipt, extraFormatters), promiEvent, callback); return; } @@ -90,12 +90,12 @@ TransactionConfirmationWorkflow.prototype.execute = function (// TODO: check ext if (validationResult === true) { if (isContractDeployment) { - self.handleContractDeployment(receipt, promiEvent, callback); + self.handleContractDeployment(receipt, extraFormatters, promiEvent, callback); return; } - var formattedReceipt = outputFormatter(receipt); + var formattedReceipt = self.executeExtraReceiptFormatter(receipt, extraFormatters); self.transactionConfirmationModel.addConfirmation(formattedReceipt); var confirmationsCount = self.transactionConfirmationModel.getConfirmationsCount(); @@ -128,9 +128,10 @@ TransactionConfirmationWorkflow.prototype.execute = function (// TODO: check ext * TODO: Create AbstractWorkflow and determine in the Method object which workflow should be executed. * @param {Object} receipt * @param {Object} promiEvent + * @param {Object} extraFormatters * @param {Function} callback */ -TransactionConfirmationWorkflow.prototype.handleContractDeployment = function (receipt, promiEvent, callback) { +TransactionConfirmationWorkflow.prototype.handleContractDeployment = function (receipt, extraFormatters, promiEvent, callback) { var self = this; if (!receipt.contractAddress) { @@ -145,8 +146,8 @@ TransactionConfirmationWorkflow.prototype.handleContractDeployment = function (r if (contractCode.length > 2) { var result = receipt; - if (method.extraFormatters && method.extraFormatters.contractDeployFormatter) { - result = method.extraFormatters.contractDeployFormatter(receipt); + if (extraFormatters && extraFormatters.contractDeployFormatter) { + result = extraFormatters.contractDeployFormatter(receipt); } self.newHeadsWatcher.stop(); @@ -224,3 +225,20 @@ TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, pr promiEvent.eventEmitter.removeAllListeners(); callback(error, null); }; + +/** + * Execute receipt extra formatter on receipt if its defined. + * + * TODO: This sounds strange maybe it could be removed with a small refactoring + * + * @param {Object} receipt + * @param {Object} formatters + * @returns {Object} + */ +TransactionConfirmationWorkflow.prototype.executeExtraReceiptFormatter = function (receipt, formatters) { + if (formatters && formatters.receiptFormatter) { + receipt = formatters.receiptFormatter(receipt); + } + + return receipt; +}; From 3f62852805e10a47690adec567963838005ceead Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 28 Aug 2018 18:43:57 +0200 Subject: [PATCH 0047/1045] extraFormatters removed and todo's added for moving the contract specific logic to the contract package --- packages/web3-core-method/src/Method.js | 10 +++---- .../TransactionConfirmationWorkflow.js | 27 +++++-------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index e60ddf999c7..ac50617d2f9 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -23,13 +23,14 @@ "use strict"; +var _ = require('underscore'); + /** * @param {Object} provider * @param {string} rpcMethod * @param {array} parameters * @param {array} inputFormatters * @param {Function} outputFormatter - * @param {Function} extraFormatter * @param {Object} promiEvent * @param {Object} transactionConfirmationWorkflow * @constructor @@ -40,7 +41,6 @@ function Method(// TODO: Add transaction signing parameters, inputFormatters, outputFormatter, - extraFormatter, promiEvent, transactionConfirmationWorkflow ) { @@ -49,7 +49,6 @@ function Method(// TODO: Add transaction signing this.parameters = parameters; this.inputFormatters = inputFormatters; this.outputFormatter = outputFormatter; - this.extraFormatter = extraFormatter; this.promiEvent = promiEvent; this.transactionConfirmationWorkflow = transactionConfirmationWorkflow; } @@ -128,8 +127,6 @@ Method.prototype.sendTransaction = function (callback) { this.provider.send(this.rpcMethod, this.formatInput(this.parameters)).then(function (response) { self.transactionConfirmationWorkflow.execute( response, - self.extraFormatter, - self.isContractDeployment(self.parameters), self.promiEvent, callback ); @@ -138,6 +135,7 @@ Method.prototype.sendTransaction = function (callback) { }).catch(function (error) { self.promiEvent.reject(error); self.promiEvent.on('error', error); + self.promiEvent.eventEmitter.removeAllListeners(); }); return this.promiEvent; @@ -168,6 +166,8 @@ Method.prototype.isSendTransaction = function (rpcMethod) { /** * Check if this method deploys a contract * + * TODO: Move this to contract package + * * @param {array} parameters * @returns {boolean} */ diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 93620e36504..51cd91807e2 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -33,7 +33,7 @@ var CONFIRMATIONBLOCKS = 24; * @param {Object} newHeadsWatcher * @constructor */ -function TransactionConfirmationWorkflow(// TODO: Timeout handling, remove eventEmitter listeners on "done" +function TransactionConfirmationWorkflow(// TODO: Timeout handling connectionModel, transactionConfirmationModel, transactionReceiptValidator, @@ -50,15 +50,11 @@ function TransactionConfirmationWorkflow(// TODO: Timeout handling, remove event * Executes the transaction confirmation workflow * * @param {string} transactionHash - * @param {Object} extraFormatters - * @param {boolean} isContractDeployment * @param {Object} promiEvent * @param {Function} callback */ TransactionConfirmationWorkflow.prototype.execute = function ( transactionHash, - extraFormatters, - isContractDeployment, promiEvent, callback ) { @@ -67,13 +63,6 @@ TransactionConfirmationWorkflow.prototype.execute = function ( if (receipt && receipt.blockHash) { var validationResult = this.transactionReceiptValidator.validate(receipt); if (validationResult === true) { - - if (isContractDeployment) { - self.handleContractDeployment(receipt, extraFormatters, promiEvent, callback); - - return; - } - this.handleSuccessState(this.executeExtraReceiptFormatter(receipt, extraFormatters), promiEvent, callback); return; @@ -88,13 +77,7 @@ TransactionConfirmationWorkflow.prototype.execute = function ( self.getTransactionReceipt(transactionHash).then(function (receipt) { var validationResult = self.transactionReceiptValidator.validate(receipt); if (validationResult === true) { - - if (isContractDeployment) { - self.handleContractDeployment(receipt, extraFormatters, promiEvent, callback); - - return; - } - + // TODO: remove this because it should be handled in the contract package var formattedReceipt = self.executeExtraReceiptFormatter(receipt, extraFormatters); self.transactionConfirmationModel.addConfirmation(formattedReceipt); @@ -125,7 +108,7 @@ TransactionConfirmationWorkflow.prototype.execute = function ( /** * Handle contract deployment * - * TODO: Create AbstractWorkflow and determine in the Method object which workflow should be executed. + * TODO: Move this to the contract package because it is only used there * @param {Object} receipt * @param {Object} promiEvent * @param {Object} extraFormatters @@ -183,6 +166,8 @@ TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (tran /** * Get code of contract by his address * + * TODO: Move this to the contract package + * * @param {string} contractAddress * @returns {Promise} */ @@ -229,7 +214,7 @@ TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, pr /** * Execute receipt extra formatter on receipt if its defined. * - * TODO: This sounds strange maybe it could be removed with a small refactoring + * TODO: Move this to the contract package because its only used there! * * @param {Object} receipt * @param {Object} formatters From c5a1d34509e39c81d2d0896f85f6c04e16c17fbb Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 12:43:42 +0200 Subject: [PATCH 0048/1045] Conceptual comments added and timeout handling in the transaction confirmation workflow added --- .../models/TransactionConfirmationModel.js | 79 +++++++++- .../src/watchers/NewHeadsWatcher.js | 7 +- .../TransactionConfirmationWorkflow.js | 145 +++++------------- packages/web3-core-promievent/src/index.js | 2 +- packages/web3-eth-contract/src/index.js | 4 +- packages/web3-eth/src/Eth.js | 4 + packages/web3/src/factories/CoreFactory.js | 38 +++-- 7 files changed, 150 insertions(+), 129 deletions(-) diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index 9a72713b564..9f37bd38e23 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -20,16 +20,91 @@ * @date 2018 */ +/** + * @constructor + */ function TransactionConfirmationModel() { this.confirmations = []; + this.timeoutCounter = 0; } +/** + * Defines accessors for POLLINGTIMEOUT. This is the average block time (seconds) * TIMEOUTBLOCK + * + * Created empty setter that it acts like a constant. + */ +Object.defineProperty(TransactionConfirmationModel, 'POLLINGTIMEOUT', { + get: function () { + return 15 * this.TIMEOUTBLOCK; + }, + set: function () {}, + enumerable: true +}); + +/** + * Defines accessors for TIMEOUTBLOCK + * + * Created empty setter that it acts like a constant. + */ +Object.defineProperty(TransactionConfirmationModel, 'TIMEOUTBLOCK', { + get: function () { + return 50; + }, + set: function () {}, + enumerable: true +}); + +/** + * Defines accessors for CONFIRMATIONBLOCKS + * + * Created empty setter that it acts like a constant. + */ +Object.defineProperty(TransactionConfirmationModel, 'CONFIRMATIONBLOCKS', { + get: function () { + return 24; + }, + set: function () {}, + enumerable: true +}); + +/** + * Defines accessors for confirmationsCount + */ +Object.defineProperty(TransactionConfirmationModel, 'confirmationsCount', { + get: function () { + return this.confirmations.length; + }, + set: function () {}, + enumerable: true +}); + +/** + * Adds a receipt to the confirmation array + * + * @param {Object} receipt + */ TransactionConfirmationModel.prototype.addConfirmation = function (receipt) { this.confirmations.push(receipt); }; -TransactionConfirmationModel.prototype.getConfirmationsCount = function () { - return this.confirmations.length; +/** + * Checks if enough confirmations are registered to set the transaction approved + * + * @returns {boolean} + */ +TransactionConfirmationModel.prototype.isConfirmed = function () { + return this.confirmationsCount === (this.CONFIRMATIONBLOCKS + 1); }; +/** + * Checks if the the timeout time is exceeded + * + * @returns {boolean} + */ +TransactionConfirmationModel.prototype.isTimeoutTimeExceeded = function (watcherIsPolling) { + if (watcherIsPolling) { + return (this.timeoutCounter - 1) >= this.POLLINGTIMEOUT; + } + return (this.timeoutCounter - 1) >= this.TIMEOUTBLOCK; +}; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 0aa54cea778..39130f1cc87 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -28,9 +28,9 @@ function NewHeadsWatcher(provider, coreFactory) { this.provider = provider; this.coreFactory = coreFactory; - this.formatters = this.coreFactory.createFormatters(); this.confirmationInterval = null; this.confirmationSubscription = null; + this.isPolling = false; } /** @@ -48,11 +48,12 @@ NewHeadsWatcher.prototype.watch = function (transactionHash) { 'newHeads', transactionHash, null, - this.formatters.outputBlockFormatter + null ).subscribe(function () { - self.emit('newHead');// Check the return values + self.emit('newHead'); }); } catch (error) { + this.isPolling = true; this.confirmationInterval = setInterval(this.emit('newHead'), 1000); } diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 51cd91807e2..e875b1abc7a 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -22,10 +22,6 @@ "use strict"; -var TIMEOUTBLOCK = 50; -var POLLINGTIMEOUT = 15 * TIMEOUTBLOCK; // ~average block time (seconds) * TIMEOUTBLOCK -var CONFIRMATIONBLOCKS = 24; - /** * @param {Object} connectionModel * @param {Object} transactionConfirmationModel @@ -33,7 +29,7 @@ var CONFIRMATIONBLOCKS = 24; * @param {Object} newHeadsWatcher * @constructor */ -function TransactionConfirmationWorkflow(// TODO: Timeout handling +function TransactionConfirmationWorkflow( connectionModel, transactionConfirmationModel, transactionReceiptValidator, @@ -59,11 +55,12 @@ TransactionConfirmationWorkflow.prototype.execute = function ( callback ) { var self = this; + this.getTransactionReceipt(transactionHash).then(function (receipt) { if (receipt && receipt.blockHash) { var validationResult = this.transactionReceiptValidator.validate(receipt); if (validationResult === true) { - this.handleSuccessState(this.executeExtraReceiptFormatter(receipt, extraFormatters), promiEvent, callback); + this.handleSuccessState(receipt, promiEvent, callback); return; } @@ -74,81 +71,46 @@ TransactionConfirmationWorkflow.prototype.execute = function ( } self.newHeadsWatcher.watch().on('newHead', function () { - self.getTransactionReceipt(transactionHash).then(function (receipt) { - var validationResult = self.transactionReceiptValidator.validate(receipt); - if (validationResult === true) { - // TODO: remove this because it should be handled in the contract package - var formattedReceipt = self.executeExtraReceiptFormatter(receipt, extraFormatters); - - self.transactionConfirmationModel.addConfirmation(formattedReceipt); - var confirmationsCount = self.transactionConfirmationModel.getConfirmationsCount(); - - self.promiEvent.eventEmitter.emit( - 'confirmation', - confirmationsCount, - formattedReceipt - ); - - if (confirmationsCount === (CONFIRMATIONBLOCKS + 1)) { - self.handleSuccessState(formattedReceipt, promiEvent, callback); + self.transactionConfirmationModel.timeoutCounter++; + if (!self.transactionConfirmationModel.isTimeoutTimeExceeded()) { + self.getTransactionReceipt(transactionHash).then(function (receipt) { + var validationResult = self.transactionReceiptValidator.validate(receipt); + if (validationResult === true) { + self.transactionConfirmationModel.addConfirmation(receipt); + self.promiEvent.eventEmitter.emit( + 'confirmation', + self.transactionConfirmationModel.confirmationsCount, + receipt + ); + + if (self.transactionConfirmationModel.isConfirmed()) { + self.handleSuccessState(receipt, promiEvent, callback); + } + + return; } - return; - } - - promiEvent.reject(validationResult); - promiEvent.eventEmitter.emit('error', validationResult, receipt); - promiEvent.eventEmitter.removeAllListeners(); - callback(validationResult, null); - }); - }); - }); -}; + promiEvent.reject(validationResult); + promiEvent.eventEmitter.emit('error', validationResult, receipt); + promiEvent.eventEmitter.removeAllListeners(); + callback(validationResult, null); + }); -/** - * Handle contract deployment - * - * TODO: Move this to the contract package because it is only used there - * @param {Object} receipt - * @param {Object} promiEvent - * @param {Object} extraFormatters - * @param {Function} callback - */ -TransactionConfirmationWorkflow.prototype.handleContractDeployment = function (receipt, extraFormatters, promiEvent, callback) { - var self = this; - - if (!receipt.contractAddress) { - self.handleErrorState( - new Error('The transaction receipt didn\'t contain a contract address.'), - promiEvent, - callback - ); - } - - this.getContractCode(receipt.contractAddress).then(function (contractCode) { - if (contractCode.length > 2) { - var result = receipt; - - if (extraFormatters && extraFormatters.contractDeployFormatter) { - result = extraFormatters.contractDeployFormatter(receipt); + return; } - self.newHeadsWatcher.stop(); + var error = new Error('Transaction was not mined within '+ self.transactionConfirmationModel.TIMEOUTBLOCK +' blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!'); - promiEvent.resolve(result); - promiEvent.eventEmitter.emit('receipt', receipt); - promiEvent.eventEmitter.removeAllListeners(); - callback(false, result); - - return; - } - - self.handleErrorState( - new Error('The contract code couldn\'t be stored, please check your gas limit.'), - promiEvent, - callback - ); + if (self.newHeadsWatcher.isPolling) { + error = new Error('Transaction was not mined within' + self.transactionConfirmationModel.POLLINGTIMEOUT + ' seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!') + } + self.handleErrorState( + error, + promiEvent, + callback + ); + }); }); }; @@ -163,24 +125,6 @@ TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (tran }) }; -/** - * Get code of contract by his address - * - * TODO: Move this to the contract package - * - * @param {string} contractAddress - * @returns {Promise} - */ -TransactionConfirmationWorkflow.prototype.getContractCode = function (contractAddress) { - return this.provider.send( - 'eth_getCode', - [ - this.formatters.inputAddressFormatter(contractAddress), - this.formatters.inputDefaultBlockNumberFormatter() // have a closer look on this formatter it uses this.defaultBlock from a magic scope where ever it is defined. - ] - ); -}; - /** * Resolves promise, emits receipt event, calls callback and removes all the listeners. * @@ -210,20 +154,3 @@ TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, pr promiEvent.eventEmitter.removeAllListeners(); callback(error, null); }; - -/** - * Execute receipt extra formatter on receipt if its defined. - * - * TODO: Move this to the contract package because its only used there! - * - * @param {Object} receipt - * @param {Object} formatters - * @returns {Object} - */ -TransactionConfirmationWorkflow.prototype.executeExtraReceiptFormatter = function (receipt, formatters) { - if (formatters && formatters.receiptFormatter) { - receipt = formatters.receiptFormatter(receipt); - } - - return receipt; -}; diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index 3799b3dc3dd..3b13ed4f26d 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -30,7 +30,7 @@ var Promise = require("any-promise"); * * @method eventifiedPromise */ -var PromiEvent = function PromiEvent(justPromise) { +var PromiEvent = function PromiEvent(justPromise) {// TODO: Just promise is no longer required var resolve, reject, eventEmitter = new Promise(function() { resolve = arguments[0]; diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index cebccafbdd2..1023e365363 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -801,7 +801,7 @@ Contract.prototype._executeMethod = function _executeMethod(){ // make sure receipt logs are decoded - var extraFormatters = { + var extraFormatters = {// TODO: The new method package does not support the extraFormatters receiptFormatter: function (receipt) { if (_.isArray(receipt.logs)) { @@ -854,7 +854,7 @@ Contract.prototype._executeMethod = function _executeMethod(){ accounts: _this.accounts || _this._ethAccounts, // is eth.accounts (necessary for wallet signing) defaultAccount: _this._parent.connectionModel.defaultAccount, defaultBlock: _this._parent.connectionModel.defaultBlock, - extraFormatters: extraFormatters + extraFormatters: extraFormatters // TODO: the new method package does not support extraFormatters })).createFunction(); return sendTransaction(args.options, args.callback); diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index d7d2d271123..bc3723574d6 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -70,6 +70,10 @@ Eth.prototype.subscribe = function (type, parameters, callback) { return this.subscriptionsResolver.resolve(type, parameters).subscribe(callback); }; +Eth.prototype.getNodeInfo = function () { + return this.coreFactory.createMethod(...).send(); +}; + /** * Appends rpc methods to Eth * diff --git a/packages/web3/src/factories/CoreFactory.js b/packages/web3/src/factories/CoreFactory.js index 3721ff80aa0..21270424676 100644 --- a/packages/web3/src/factories/CoreFactory.js +++ b/packages/web3/src/factories/CoreFactory.js @@ -9,35 +9,49 @@ function CoreFactory() { } /** * Creates Subscription object * - * @param {Object} connectionModel + * @param {Object} provider * @param {string} type * @param {*} parameters * @param {Object} inputFormatter * @param {Object} outputFormatter */ -CoreFactory.prototype.createSubscription = function (connectionModel, type, parameters, inputFormatter, outputFormatter) { - return new Subscription(connectionModel, type, parameters, inputFormatter, outputFormatter); +CoreFactory.prototype.createSubscription = function (provider, type, parameters, inputFormatter, outputFormatter) { + return new Subscription(provider, type, parameters, inputFormatter, outputFormatter); }; /** * Creates PromiEvent object - * - * @param {boolean} justPromise */ -CoreFactory.prototype.createPromiEvent = function (justPromise) { - return new PromiEvent(justPromise); +CoreFactory.prototype.createPromiEvent = function () { + return new PromiEvent(); }; /** * Creates Method object * - * @param {ConnectionModel} connectionModel - * @param {Object} options - * @param {boolean} justPromise + * @param {Object} provider + * @param {string} rpcMethod + * @param {array} parameters + * @param {array} inputFormatters + * @param {Function} outputFormatter * @returns {Method} */ -CoreFactory.prototype.createMethod = function (connectionModel, options, justPromise) { - return new Method(connectionModel, this.createPromiEvent(justPromise), options); +CoreFactory.prototype.createMethod = function (provider, rpcMethod, parameters, inputFormatters, outputFormatter) { + return new Method( + provider, + rpcMethod, + parameters, + inputFormatters, + outputFormatter, + this.createPromiEvent(), + this.createTransactionConfirmationWorkflow() + ); +}; + +CoreFactory.prototype.createTransactionConfirmationWorkflow = function () { + // TODO: overthink the implemented factory pattern. It is strange to create here an internal package object. + // maybe each package will have his own PackageFactory and it will have an web3-core-factories package where I combine all the factories + // to one "masterFactory" this master factory should be a proxy to all factories. }; /** From 1d9d6b2d36e5a9e14b42ebb92590bea3745c8065 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 13:22:29 +0200 Subject: [PATCH 0049/1045] getGasPrice added to method object --- packages/web3-core-method/src/Method.js | 41 +++++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index ac50617d2f9..e911cb717e3 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -62,8 +62,18 @@ function Method(// TODO: Add transaction signing * @returns {Promise | eventifiedPromise} */ Method.prototype.send = function (callback) { + var self = this; + if (this.isSendTransaction(this.rpcMethod)) { - return this.sendTransaction(callback); + if (this.isGasPriceDefined()) { + return this.sendTransaction(null, callback); + } + + this.getGasPrice().then(function (gasPrice) { + self.sendTransaction(gasPrice, callback) + }); + + return this.promiEvent; } return this.call(callback); @@ -119,11 +129,17 @@ Method.prototype.formatOutput = function (response, callback) { /** * Handles an sendTransaction request * - * @param callback + * @param {string} gasPrice + * @param {Function} callback * @returns {eventifiedPromise} */ -Method.prototype.sendTransaction = function (callback) { +Method.prototype.sendTransaction = function (gasPrice, callback) { var self = this; + + if (gasPrice && _.isObject(this.parameters[0])) { + this.parameters.gasPrice = gasPrice; + } + this.provider.send(this.rpcMethod, this.formatInput(this.parameters)).then(function (response) { self.transactionConfirmationWorkflow.execute( response, @@ -154,7 +170,15 @@ Method.prototype.formatInput = function (parameters) { }; /** - * Determines if the JSON-RPC method is a call method + * Gets the gasPrice with the eth_gasPrice RPC call. + * @returns {Promise} + */ +Method.prototype.getGasPrice = function () { + return this.provider.send('eth_gasPrice', []); +}; + +/** + * Determines if the JSON-RPC method is a sendTransaction method * * @param {string} rpcMethod * @returns {boolean} @@ -164,13 +188,10 @@ Method.prototype.isSendTransaction = function (rpcMethod) { }; /** - * Check if this method deploys a contract + * Determines if gasPrice is defined in method options * - * TODO: Move this to contract package - * - * @param {array} parameters * @returns {boolean} */ -Method.prototype.isContractDeployment = function (parameters) { - return _.isObject(parameters[0]) && parameters[0].data && parameters[0].from && !parameters[0].to; +Method.prototype.isGasPriceDefined = function () { + return _.isObject(this.parameters[0]) && typeof this.parameters[0].gasPrice !== 'undefined'; }; From e7fe9b1e3e09bfef233a0d5014eabbce4e0a8ba9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 13:56:15 +0200 Subject: [PATCH 0050/1045] Signers and module.exports added --- .../web3-core-method/lib/AbstractSigner.js | 63 +++++++++++++++++++ packages/web3-core-method/src/Method.js | 2 + .../models/TransactionConfirmationModel.js | 2 + .../src/signers/MessageSigner.js | 42 +++++++++++++ .../src/signers/TransactionSigner.js | 48 ++++++++++++++ .../validators/TransactionReceiptValidator.js | 2 + .../src/watchers/NewHeadsWatcher.js | 2 + .../TransactionConfirmationWorkflow.js | 2 + 8 files changed, 163 insertions(+) create mode 100644 packages/web3-core-method/lib/AbstractSigner.js create mode 100644 packages/web3-core-method/src/signers/MessageSigner.js create mode 100644 packages/web3-core-method/src/signers/TransactionSigner.js diff --git a/packages/web3-core-method/lib/AbstractSigner.js b/packages/web3-core-method/lib/AbstractSigner.js new file mode 100644 index 00000000000..61a5c42042b --- /dev/null +++ b/packages/web3-core-method/lib/AbstractSigner.js @@ -0,0 +1,63 @@ +/* + 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 . + */ +/** + * @file AbstractSigner.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var _ = require('underscore'); + +/** + * + * @param {Object} accounts + * @constructor + */ +function AbstractSigner(accounts) { + this.accounts = accounts; +} + +/** + * Get wallet for address with accounts package + * + * @param {any} from + * + * @returns {any} + */ +AbstractSigner.prototype.getWallet = function (from) { + // is index given + if (_.isNumber(from)) { + return this.accounts.wallet[from]; + + } + + // is account given + if (_.isObject(from) && from.address && from.privateKey) { + return from; + } + + var searchedWalletForAddress = this.accounts.wallet[from.toLowerCase()]; + if (searchedWalletForAddress) { + return searchedWalletForAddress; + } + + return null; +}; + +module.exports = AbstractSigner; diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index e911cb717e3..b7004ea6f76 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -195,3 +195,5 @@ Method.prototype.isSendTransaction = function (rpcMethod) { Method.prototype.isGasPriceDefined = function () { return _.isObject(this.parameters[0]) && typeof this.parameters[0].gasPrice !== 'undefined'; }; + +module.exports = Method; diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index 9f37bd38e23..0245f2879dd 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -108,3 +108,5 @@ TransactionConfirmationModel.prototype.isTimeoutTimeExceeded = function (watcher return (this.timeoutCounter - 1) >= this.TIMEOUTBLOCK; }; + +module.exports = TransactionConfirmationModel; diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js new file mode 100644 index 00000000000..0e81d91de77 --- /dev/null +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -0,0 +1,42 @@ +/* + 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 . + */ +/** + * @file MessageSigner.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractSigner = require('../../AbstractSigner'); + +function MessageSigner() { } + +MessageSigner.prototype.sign = function(data, address) { + var wallet = this.getWallet(address); + if (wallet && wallet.privateKey) { + return this.accounts.sign(data, wallet.privateKey).signature; + } + + return false; +}; + +// Inherit from AbstractSigner +MessageSigner.prototype = Object.create(AbstractSigner.prototype); +MessageSigner.prototype.constructor = AbstractSigner.prototype.constructor; + +module.exports = MessageSigner; diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js new file mode 100644 index 00000000000..1cd9627a908 --- /dev/null +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -0,0 +1,48 @@ +/* + 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 . + */ +/** + * @file TransactionSigner.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractSigner = require('../../lib/AbstractSigner'); + +function TransactionSigner() { } + +/** + * @param {Object} transaction + * @returns {*} + */ +TransactionSigner.prototype.sign = function (transaction) { + var wallet = this.getWallet(transaction.from); + if (wallet && wallet.privateKey) { + delete transaction.from; + + return this.accounts.signTransaction(transaction, wallet.privateKey); + } + + return false; +}; + +// Inherit from AbstractSigner +TransactionSigner.prototype = Object.create(AbstractSigner.prototype); +TransactionSigner.prototype.constructor = AbstractSigner.prototype.constructor; + +module.exports = TransactionSigner; diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index aa9c08825b7..7eb9447b16e 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -53,3 +53,5 @@ TransactionReceiptValidator.prototype.isValidReceiptStatus = function (receipt) TransactionReceiptValidator.prototype.isValidGasUsage = function (receipt) { return !receipt.outOfGas && (!gasProvided || gasProvided !== receipt.gasUsed); }; + +module.exports = TransactionReceiptValidator; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 39130f1cc87..540a64e9df9 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -76,3 +76,5 @@ NewHeadsWatcher.prototype.stop = function () { // Inherit EventEmitter NewHeadsWatcher.prototype = Object.create(EventEmitter.prototype); NewHeadsWatcher.prototype.constructor = NewHeadsWatcher; + +module.exports = NewHeadsWatcher; diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index e875b1abc7a..6a63398296b 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -154,3 +154,5 @@ TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, pr promiEvent.eventEmitter.removeAllListeners(); callback(error, null); }; + +module.exports = TransactionConfirmationWorkflow; From fb62aab4b58ed7ec2ce9d34f29312461291ae906 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 14:34:12 +0200 Subject: [PATCH 0051/1045] sigining and the request method added to method object --- packages/web3-core-batch/src/Batch.js | 2 +- packages/web3-core-method/src/Method.js | 73 +++++++++++++++++++++++-- 2 files changed, 69 insertions(+), 6 deletions(-) diff --git a/packages/web3-core-batch/src/Batch.js b/packages/web3-core-batch/src/Batch.js index 9981bbfdae1..e97433bd185 100644 --- a/packages/web3-core-batch/src/Batch.js +++ b/packages/web3-core-batch/src/Batch.js @@ -45,7 +45,7 @@ Batch.prototype.add = function (request) { * * @method execute */ -Batch.prototype.execute = function () { +Batch.prototype.execute = function () {// TODO: refactore because of new method package var requests = this.requests; this.provider.sendBatch(requests, function (err, results) { results = results || []; diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index b7004ea6f76..2c5e6ce3d1b 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -27,30 +27,39 @@ var _ = require('underscore'); /** * @param {Object} provider + * @param {Object} accounts * @param {string} rpcMethod * @param {array} parameters * @param {array} inputFormatters * @param {Function} outputFormatter * @param {Object} promiEvent * @param {Object} transactionConfirmationWorkflow + * @param {Object} transactionSigner + * @param {Object} messageSigner * @constructor */ -function Method(// TODO: Add transaction signing +function Method( provider, + accounts, rpcMethod, parameters, inputFormatters, outputFormatter, promiEvent, - transactionConfirmationWorkflow + transactionConfirmationWorkflow, + transactionSigner, + messageSigner ) { this.provider = provider; + this.accounts = accounts; this.rpcMethod = rpcMethod; this.parameters = parameters; this.inputFormatters = inputFormatters; this.outputFormatter = outputFormatter; this.promiEvent = promiEvent; this.transactionConfirmationWorkflow = transactionConfirmationWorkflow; + this.transactionSigner = transactionSigner; + this.messageSigner = messageSigner; } /** @@ -64,7 +73,19 @@ function Method(// TODO: Add transaction signing Method.prototype.send = function (callback) { var self = this; - if (this.isSendTransaction(this.rpcMethod)) { + if (this.hasWallets()) { + if (this.isSign(this.rpcMethod)) { + return this.messageSigner.sign(this.parameters[0], this.parameters[1]); + } + + if (this.isSendTransaction(this.rpcMethod)) { + this.rpcMethod = 'eth_sendRawTransaction'; + this.parameters = [this.transactionSigner.sign(this.parameters[0]).rawTransaction]; + return this.sendTransaction(null, callback); + } + } + + if (this.isSendTransaction(this.rpcMethod) || this.isSendRawTransaction(this.rpcMethod)) { if (this.isGasPriceDefined()) { return this.sendTransaction(null, callback); } @@ -76,6 +97,10 @@ Method.prototype.send = function (callback) { return this.promiEvent; } + if (this.isSign(this.rpcMethod)) { + return this.messageSigner.sign(this.parameters[0], this.parameters[1]); + } + return this.call(callback); }; @@ -157,6 +182,15 @@ Method.prototype.sendTransaction = function (gasPrice, callback) { return this.promiEvent; }; +/** + * Should be called to get the request which can be used in a batch request + * + * @returns {Function} + */ +Method.prototype.request = function () { + return this.send.bind(this); +}; + /** * Formatts the input parameters * @@ -178,13 +212,33 @@ Method.prototype.getGasPrice = function () { }; /** - * Determines if the JSON-RPC method is a sendTransaction method + * Determines if the JSON-RPC method is sendTransaction * * @param {string} rpcMethod * @returns {boolean} */ Method.prototype.isSendTransaction = function (rpcMethod) { - return rpcMethod === 'eth_sendTransaction' || rpcMethod === 'eth_sendRawTransaction'; + return rpcMethod === 'eth_sendTransaction'; +}; + +/** + * Determines if the JSON-RPC method is sendRawTransaction + * + * @param {string} rpcMethod + * @returns {boolean} + */ +Method.prototype.isSendRawTransaction = function (rpcMethod) { + return rpcMethod === 'eth_sendRawTransaction'; +}; + +/** + * Determines if the JSON-RPC method is sign. + * + * @param {string} rpcMethod + * @returns {boolean} + */ +Method.prototype.isSign = function (rpcMethod) { + return rpcMethod === 'eth_sign'; }; /** @@ -196,4 +250,13 @@ Method.prototype.isGasPriceDefined = function () { return _.isObject(this.parameters[0]) && typeof this.parameters[0].gasPrice !== 'undefined'; }; +/** + * Check if wallets are defined + * + * @returns {boolean} + */ +Method.prototype.hasWallets = function() { + return this.accounts.wallet.length > 0; +}; + module.exports = Method; From 4755cde984fd711e01bead99936cc69677b6548d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 14:36:57 +0200 Subject: [PATCH 0052/1045] comments updated in method object --- packages/web3-core-method/src/Method.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index 2c5e6ce3d1b..cf05cfbdacc 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -63,7 +63,7 @@ function Method( } /** - * Sends and rpc request + * Sends the JSON-RPC request * * @param {Function} callback * @@ -105,7 +105,7 @@ Method.prototype.send = function (callback) { }; /** - * Handles a call request + * Sends a JSON-RPC call request * * @param callback * @returns {Promise} @@ -119,7 +119,7 @@ Method.prototype.call = function (callback) { /** - * Handle call response + * Formats the output of an JSON-RPC call request * * @param {array | string} response * @param callback @@ -152,7 +152,7 @@ Method.prototype.formatOutput = function (response, callback) { }; /** - * Handles an sendTransaction request + * Sends the JSON-RPC sendTransaction request * * @param {string} gasPrice * @param {Function} callback @@ -192,7 +192,7 @@ Method.prototype.request = function () { }; /** - * Formatts the input parameters + * Formats the input parameters * * @param parameters * @returns {array} @@ -242,7 +242,7 @@ Method.prototype.isSign = function (rpcMethod) { }; /** - * Determines if gasPrice is defined in method options + * Determines if gasPrice is defined in the method options * * @returns {boolean} */ @@ -251,7 +251,7 @@ Method.prototype.isGasPriceDefined = function () { }; /** - * Check if wallets are defined + * Check if wallets are defined in the accounts package * * @returns {boolean} */ From fb583c4dcf2dc91260c2c22102edfbc93697c6fb Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 14:39:09 +0200 Subject: [PATCH 0053/1045] Function params and return values in funcDoc updated --- packages/web3-core-method/src/Method.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index cf05cfbdacc..e709406fe13 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -107,7 +107,9 @@ Method.prototype.send = function (callback) { /** * Sends a JSON-RPC call request * - * @param callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {Promise} */ Method.prototype.call = function (callback) { @@ -156,6 +158,8 @@ Method.prototype.formatOutput = function (response, callback) { * * @param {string} gasPrice * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ Method.prototype.sendTransaction = function (gasPrice, callback) { @@ -195,6 +199,7 @@ Method.prototype.request = function () { * Formats the input parameters * * @param parameters + * * @returns {array} */ Method.prototype.formatInput = function (parameters) { @@ -205,6 +210,7 @@ Method.prototype.formatInput = function (parameters) { /** * Gets the gasPrice with the eth_gasPrice RPC call. + * * @returns {Promise} */ Method.prototype.getGasPrice = function () { @@ -215,6 +221,7 @@ Method.prototype.getGasPrice = function () { * Determines if the JSON-RPC method is sendTransaction * * @param {string} rpcMethod + * * @returns {boolean} */ Method.prototype.isSendTransaction = function (rpcMethod) { @@ -225,6 +232,7 @@ Method.prototype.isSendTransaction = function (rpcMethod) { * Determines if the JSON-RPC method is sendRawTransaction * * @param {string} rpcMethod + * * @returns {boolean} */ Method.prototype.isSendRawTransaction = function (rpcMethod) { @@ -235,6 +243,7 @@ Method.prototype.isSendRawTransaction = function (rpcMethod) { * Determines if the JSON-RPC method is sign. * * @param {string} rpcMethod + * * @returns {boolean} */ Method.prototype.isSign = function (rpcMethod) { From 73a2e7e57af7693294a0e2ca4b50e7b1dc4c1bf4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 14:44:45 +0200 Subject: [PATCH 0054/1045] Function docs improved --- packages/web3-core-method/src/Method.js | 2 +- .../src/models/TransactionConfirmationModel.js | 4 ++-- packages/web3-core-method/src/signers/MessageSigner.js | 8 ++++++++ .../web3-core-method/src/signers/TransactionSigner.js | 5 ++++- .../src/validators/TransactionReceiptValidator.js | 9 +++++++++ .../web3-core-method/src/watchers/NewHeadsWatcher.js | 3 ++- .../src/workflows/TransactionConfirmationWorkflow.js | 6 ++++++ 7 files changed, 32 insertions(+), 5 deletions(-) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index e709406fe13..84bd6ddc0d1 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -243,7 +243,7 @@ Method.prototype.isSendRawTransaction = function (rpcMethod) { * Determines if the JSON-RPC method is sign. * * @param {string} rpcMethod - * + * * @returns {boolean} */ Method.prototype.isSign = function (rpcMethod) { diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index 0245f2879dd..52c2559b797 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -88,7 +88,7 @@ TransactionConfirmationModel.prototype.addConfirmation = function (receipt) { }; /** - * Checks if enough confirmations are registered to set the transaction approved + * Checks if enough confirmations are registered to set the transaction as approved * * @returns {boolean} */ @@ -97,7 +97,7 @@ TransactionConfirmationModel.prototype.isConfirmed = function () { }; /** - * Checks if the the timeout time is exceeded + * Checks if the timeout time is exceeded * * @returns {boolean} */ diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 0e81d91de77..001bc47efcf 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -26,6 +26,14 @@ var AbstractSigner = require('../../AbstractSigner'); function MessageSigner() { } +/** + * Signs a given message + * + * @param {string} data + * @param {any} address + * + * @returns {any} + */ MessageSigner.prototype.sign = function(data, address) { var wallet = this.getWallet(address); if (wallet && wallet.privateKey) { diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index 1cd9627a908..e9a5d390488 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -27,8 +27,11 @@ var AbstractSigner = require('../../lib/AbstractSigner'); function TransactionSigner() { } /** + * Signs the given transaction + * * @param {Object} transaction - * @returns {*} + * + * @returns {any} */ TransactionSigner.prototype.sign = function (transaction) { var wallet = this.getWallet(transaction.from); diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index 7eb9447b16e..fbb9d952402 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -24,6 +24,13 @@ function TransactionReceiptValidator() { } +/** + * Validates the receipt + * + * @param {Obejct} receipt + * + * @returns {Error | boolean} + */ TransactionReceiptValidator.prototype.validate = function (receipt) { if (this.isValidGasUsage(receipt) && this.isValidReceiptStatus(receipt)) { return true; @@ -40,6 +47,7 @@ TransactionReceiptValidator.prototype.validate = function (receipt) { /** * @param {Object} receipt + * * @returns {boolean} */ TransactionReceiptValidator.prototype.isValidReceiptStatus = function (receipt) { @@ -48,6 +56,7 @@ TransactionReceiptValidator.prototype.isValidReceiptStatus = function (receipt) /** * @param {Object} receipt + * * @returns {boolean} */ TransactionReceiptValidator.prototype.isValidGasUsage = function (receipt) { diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 540a64e9df9..7ccc2e3a3fd 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -37,7 +37,8 @@ function NewHeadsWatcher(provider, coreFactory) { * Starts subscription on newHeads if supported or creates an interval to get the newHeads * * @param {String} transactionHash - * @returns {NewHeadsWatcher} + * + * @returns {this} */ NewHeadsWatcher.prototype.watch = function (transactionHash) { var self = this; diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 6a63398296b..1b8dcce0069 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -48,6 +48,8 @@ function TransactionConfirmationWorkflow( * @param {string} transactionHash * @param {Object} promiEvent * @param {Function} callback + * + * @callback callback callback(error, result) */ TransactionConfirmationWorkflow.prototype.execute = function ( transactionHash, @@ -131,6 +133,8 @@ TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (tran * @param {Object} receipt * @param {Object} promiEvent * @param {Function} callback + * + * @callback callback callback(error, result) */ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt, promiEvent, callback) { this.newHeadsWatcher.stop(); @@ -146,6 +150,8 @@ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt * @param {Object} error * @param {Object} promiEvent * @param {Function} callback + * + * @callback callback callback(error, result) */ TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, promiEvent, callback) { this.newHeadsWatcher.stop(); From 06b3bcbe266f6c869bf9c39f91ff46c1c41bf2cd Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 16:31:35 +0200 Subject: [PATCH 0055/1045] TransactionConfirmationWorkflow dependencies updated, MethodPackageFactory created, CoreFactory updated --- .../src/factories/MethodPackageFactory.js | 123 ++++++++++++++++++ packages/web3-core-method/src/index.js | 6 +- .../TransactionConfirmationWorkflow.js | 7 +- packages/web3/src/factories/CoreFactory.js | 60 +++++---- 4 files changed, 161 insertions(+), 35 deletions(-) create mode 100644 packages/web3-core-method/src/factories/MethodPackageFactory.js diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js new file mode 100644 index 00000000000..55e8127ef1b --- /dev/null +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -0,0 +1,123 @@ +/* + 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 . + */ +/** + * @file MethodPackageFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var TransactionConfirmationWorkflow = require('../workflows/TransactionConfirmationWorkflow'); +var TransactionSigner = require('../signers/TransactionSigner'); +var MessageSigner = require('../signers/MessageSigner'); +var TransactionConfirmationModel = require('../models/TransactionConfirmationModel'); +var TransactionReceiptValidator = require('../validators/TransactionReceiptValidator'); +var NewHeadsWatcher = require('../watchers/NewHeadsWatcher'); + + +function MethodPackageFactory() { } + + +/** + * Return Method object + * + * @param {Object} provider + * @param {CoreFactory} coreFactory + * @param {string} rpcMethod + * @param {array} parameters + * @param {array} inputFormatters + * @param {Function} outputFormatter + * @param {PromiEvent} promiEvent + * + * @returns {Method} + */ +MethodPackageFactory.prototype.createMethod = function ( + provider, + coreFactory, + rpcMethod, + parameters, + inputFormatters, + outputFormatter, + promiEvent +) { + return new Method( + provider, + coreFactory.createAccountsPackage(), + rpcMethod, + parameters, + inputFormatters, + outputFormatter, + promiEvent, + this.createTransactionConfirmationWorkflow(provider, coreFactory), + this.createTransactionSigner(), + this.createMessageSigner() + ); +}; + +/** + * Return TransactionConfirmationWorkflow object + * + * @param {Object} provider + * @param {CoreFactory} coreFactory + */ +MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (provider, coreFactory) { + new TransactionConfirmationWorkflow( + provider, + this.createTransactionConfirmationModel(), + this.createTransactionReceiptValidator(), + this.createNewHeadsWatcher(provider, coreFactory) + ); +}; + +MethodPackageFactory.prototype.createTransactionSigner = function () { + new TransactionSigner(); +}; + +MethodPackageFactory.prototype.createMessageSigner = function () { + new MessageSigner(); +}; + +/** + * Returns TransactionConfirmationModel object + * + * @returns {TransactionConfirmationModel} + */ +MethodPackageFactory.prototype.createTransactionConfirmationModel = function() { + return new TransactionConfirmationModel() +}; + +/** + * Returns TransactionReceiptValidator object + * + * @returns {TransactionReceiptValidator} + */ +MethodPackageFactory.prototype.createTransactionReceiptValidator = function() { + return new TransactionReceiptValidator(); +}; + +/** + * Returns NewHeadsWatcher object + * + * @param {Object} provider + * @param {CoreFactory} coreFactory + * + * @returns {NewHeadsWatcher} + */ +MethodPackageFactory.prototype.createNewHeadsWatcher = function (provider, coreFactory) { + return new NewHeadsWatcher(provider, coreFactory); +}; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 5428b0c96b4..ca59ecc9642 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -16,11 +16,11 @@ */ /** - * @file Method.js + * @file index.js * @author Samuel Furter * @date 2018 */ -var Method = require('./Method'); +var MethodPackageFactory = require('./factories/MethodPackageFactory'); -module.exports = Method; +module.exports = MethodPackageFactory; diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 1b8dcce0069..b49649c89a6 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -23,14 +23,14 @@ "use strict"; /** - * @param {Object} connectionModel + * @param {Object} provider * @param {Object} transactionConfirmationModel * @param {Object} transactionReceiptValidator * @param {Object} newHeadsWatcher * @constructor */ function TransactionConfirmationWorkflow( - connectionModel, + provider, transactionConfirmationModel, transactionReceiptValidator, newHeadsWatcher @@ -38,8 +38,7 @@ function TransactionConfirmationWorkflow( this.transactionConfirmationModel = transactionConfirmationModel; this.transactionReceiptValidator = transactionReceiptValidator; this.newHeadsWatcher = newHeadsWatcher; - this.provider = connectionModel.provider; - this.connectionModel = connectionModel; + this.provider = provider; } /** diff --git a/packages/web3/src/factories/CoreFactory.js b/packages/web3/src/factories/CoreFactory.js index 21270424676..b2172299bbc 100644 --- a/packages/web3/src/factories/CoreFactory.js +++ b/packages/web3/src/factories/CoreFactory.js @@ -1,7 +1,31 @@ +/* + 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 . + */ +/** + * @file CoreFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + var Subscription = require('web3-core-subscription'); var PromiEvent = require('web3-core-promievent'); -var Net = require('web3-net'); var helpers = require('web3-core-helpers'); +var MethodPackageFactory = require('web3-core-method'); var Utils = require('web3-utils'); function CoreFactory() { } @@ -34,26 +58,21 @@ CoreFactory.prototype.createPromiEvent = function () { * @param {array} parameters * @param {array} inputFormatters * @param {Function} outputFormatter + * * @returns {Method} */ CoreFactory.prototype.createMethod = function (provider, rpcMethod, parameters, inputFormatters, outputFormatter) { - return new Method( + return new MethodPackageFactory().createMethod( provider, + this, rpcMethod, parameters, inputFormatters, outputFormatter, - this.createPromiEvent(), - this.createTransactionConfirmationWorkflow() + this.createPromiEvent() ); }; -CoreFactory.prototype.createTransactionConfirmationWorkflow = function () { - // TODO: overthink the implemented factory pattern. It is strange to create here an internal package object. - // maybe each package will have his own PackageFactory and it will have an web3-core-factories package where I combine all the factories - // to one "masterFactory" this master factory should be a proxy to all factories. -}; - /** * @returns {Object} */ @@ -65,32 +84,17 @@ CoreFactory.prototype.createUtils = function () { // maybe this can be in a glob * Creates Batch object * * @param {Object} connectionModel + * * @returns {Batch} */ CoreFactory.prototype.createBatch = function (connectionModel) { return new Batch(connectionModel); }; -// This helpers things are strange.. maybe we can add this directly in the Web3 global scope.. something like helpers.X -CoreFactory.prototype.createFormatters = function () {// helpers +CoreFactory.prototype.createFormatters = function () { return helpers.formatters; }; -CoreFactory.prototype.createErrors = function () { // helpers +CoreFactory.prototype.createErrors = function () { return helpers.errors; }; - -//TODO: move this to connection model -// /** -// * Creates Net object -// * -// * @param {Object} provider -// * @returns {Net} -// */ -// CoreFactory.prototype.createNet = function (provider) { -// if (provider) { -// this.connectionModel.setProvider(provider); -// } -// -// return new Net(this.connectionModel); -// }; From 9e0c0d9e043141a1df49bbdc5248b9e7d966bbd3 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 16:33:59 +0200 Subject: [PATCH 0056/1045] funcDocs updated in CoreFactory --- packages/web3/src/factories/CoreFactory.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/web3/src/factories/CoreFactory.js b/packages/web3/src/factories/CoreFactory.js index b2172299bbc..cbb1057f3f2 100644 --- a/packages/web3/src/factories/CoreFactory.js +++ b/packages/web3/src/factories/CoreFactory.js @@ -74,6 +74,8 @@ CoreFactory.prototype.createMethod = function (provider, rpcMethod, parameters, }; /** + * Returns the web3 utilities + * * @returns {Object} */ CoreFactory.prototype.createUtils = function () { // maybe this can be in a global scope @@ -91,10 +93,20 @@ CoreFactory.prototype.createBatch = function (connectionModel) { return new Batch(connectionModel); }; +/** + * Returns the web3 formatters + * + * @returns {Object} + */ CoreFactory.prototype.createFormatters = function () { return helpers.formatters; }; +/** + * Returns the default web3 errors + * + * @returns {Object} + */ CoreFactory.prototype.createErrors = function () { return helpers.errors; }; From c609501fe0ffe2839b4971e74d173c99def5f382 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 16:34:39 +0200 Subject: [PATCH 0057/1045] CodeStyle improved in CoreFactory --- packages/web3/src/factories/CoreFactory.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web3/src/factories/CoreFactory.js b/packages/web3/src/factories/CoreFactory.js index cbb1057f3f2..61174dbff1a 100644 --- a/packages/web3/src/factories/CoreFactory.js +++ b/packages/web3/src/factories/CoreFactory.js @@ -61,7 +61,7 @@ CoreFactory.prototype.createPromiEvent = function () { * * @returns {Method} */ -CoreFactory.prototype.createMethod = function (provider, rpcMethod, parameters, inputFormatters, outputFormatter) { +CoreFactory.prototype.createMethod = function (provider, rpcMethod, parameters, inputFormatters, outputFormatter) { return new MethodPackageFactory().createMethod( provider, this, @@ -78,8 +78,8 @@ CoreFactory.prototype.createMethod = function (provider, rpcMethod, parameters, * * @returns {Object} */ -CoreFactory.prototype.createUtils = function () { // maybe this can be in a global scope - return Utils; +CoreFactory.prototype.createUtils = function () { + return Utils; }; /** From 7a170d4d5111325a47f54e02f840b7cdc0572dbf Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 16:45:53 +0200 Subject: [PATCH 0058/1045] RPC-Methods implemented in ConnectionModel --- packages/web3/src/models/ConnectionModel.js | 109 ++++++++++++++------ 1 file changed, 77 insertions(+), 32 deletions(-) diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index 2879211b0b6..521701a8c00 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -1,10 +1,37 @@ +/* + 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 . + */ + +/** + * @file ConnectionModel.js + * @author Samuel Furter + * @date 2018 + */ + /** * @param {Object} provider + * @param {CoreFactory} coreFactory * @constructor */ -function ConnectionModel(provider) { +function ConnectionModel(provider, coreFactory) { this.provider = provider; //TODO: add provider resolver this.givenProvider = null; //TODO: add provider detection maybe this cant be here + this.coreFactory = coreFactory; + this.utils = this.coreFactory.createUtils(); + this.formatters = this.coreFactory.createFormatters(); } /** @@ -51,7 +78,7 @@ ConnectionModel.prototype.getNetworkType = function (callback) { return this.getId().then(function (givenId) { id = givenId; - return self.getBlock(0); + return self.getBlockByNumber(0, false); }).then(function (genesis) { var returnValue = 'private'; switch (genesis) { @@ -88,42 +115,60 @@ ConnectionModel.prototype.getNetworkType = function (callback) { }); }; -ConnectionModel.prototype.getId = function () { - // new Method({ - // name: 'getId', - // call: 'net_version', - // params: 0, - // outputFormatter: utils.hexToNumber - // }) +/** + * Executes the JSON-RPC method net_version + * + * @param callback + * + * @callback callback callback(error, result) + * @returns {Promise|eventifiedPromise} + */ +ConnectionModel.prototype.getId = function (callback) { + return this.coreFactory.createMethod(this.provider, 'net_version', [], null, this.utils.hexToNumber).send(callback); }; -ConnectionModel.prototype.isListening = function () { - // new Method({ - // name: 'isListening', - // call: 'net_listening', - // params: 0 - // }) +/** + * Executes the JSON-RPC method net_listening + * + * @param callback + * + * @callback callback callback(error, result) + * @returns {Promise|eventifiedPromise} + */ +ConnectionModel.prototype.isListening = function (callback) { + return this.coreFactory.createMethod(this.provider, 'net_listening', [], null, null).send(callback); }; -ConnectionModel.prototype.getPeerCount = function () { - // new Method({ - // name: 'getPeerCount', - // call: 'net_peerCount', - // params: 0, - // outputFormatter: utils.hexToNumber - // }) +/** + * Executes the JSON-RPC method net_peerCount + * + * @param callback + * + * @callback callback callback(error, result) + * @returns {Promise|eventifiedPromise} + */ +ConnectionModel.prototype.getPeerCount = function (callback) { + return this.coreFactory.createMethod(this.provider, 'net_peerCount', [], null, this.utils.hexToNumber).send(callback); }; -ConnectionModel.prototype.getBlock = function (blockNumber) { - // new Method({ - // name: 'getBlock', - // call: blockCall, - // params: 2, - // inputFormatter: [formatter.inputBlockNumberFormatter, function (val) { - // return !!val; - // }], - // outputFormatter: formatter.outputBlockFormatter - // }) +/** + * Gets a block by his number + * + * @param blockNumber + * @param returnTransactionObjects + * @param callback + * + * @callback callback callback(error, result) + * @returns {Promise|eventifiedPromise} + */ +ConnectionModel.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { + return this.coreFactory.createMethod( + this.provider, + 'eth_getBlockByNumber', + [blockNumber, returnTransactionObjects], + [this.formatters.inputBlockNumberFormatter, function (val) { return !!val }], + this.formatters.outputBlockFormatter + ).send(callback); }; /** From 4cfd1a0c5988155e7c3155314cb44ddddbdf3dde Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 17:01:46 +0200 Subject: [PATCH 0059/1045] ProviderPackageFactory created --- .../src/factories/ProviderPackageFactory.js | 116 ++++++++++++++++++ .../src/resolvers/ProviderAdapterResolver.js | 30 +++-- packages/web3/src/models/ConnectionModel.js | 4 +- 3 files changed, 137 insertions(+), 13 deletions(-) create mode 100644 packages/web3-core-providers/src/factories/ProviderPackageFactory.js diff --git a/packages/web3-core-providers/src/factories/ProviderPackageFactory.js b/packages/web3-core-providers/src/factories/ProviderPackageFactory.js new file mode 100644 index 00000000000..688849b14a7 --- /dev/null +++ b/packages/web3-core-providers/src/factories/ProviderPackageFactory.js @@ -0,0 +1,116 @@ +/* + 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 . +*/ +/** + * @file ProviderPackageFactory.js + * @authors: Samuel Furter + * @date 2018 + */ + +var ProviderAdapterResolver = require('../resolvers/ProviderAdapterResolver'); +var SocketProviderAdapter = require('../adapters/SocketProviderAdapter'); +var InpageProviderAdapter = require('../adapters/InpageProviderAdapter'); +var HttpProviderAdapter = require('../adapters/HttpProviderAdapter'); +var WebsocketProvider = require('../providers/WebsocketProvider'); +var IpcProvider = require('../providers/IpcProvider'); +var HttpProvider = require('../providers/HttpProvider'); + +function ProviderPackageFactory() { } + +/** + * Return ProviderAdapterResolver object + * + * @returns {ProviderAdapterResolver} + */ +ProviderPackageFactory.prototype.createProviderAdapterResolver = function () { + return new ProviderAdapterResolver(this); +}; + +/** + * Return ProviderDetector object + * + * @returns {ProviderDetector} + */ +ProviderPackageFactory.prototype.createProviderDetector = function () { + return new ProviderDetector(); +}; + +/** + * Return HttpProvider object + * + * @param {string} url + * + * @returns {HttpProvider} + */ +ProviderPackageFactory.prototype.createHttpProvider = function (url) { + return new HttpProvider(url); +}; + +/** + * Return WebsocketProvider object + * + * @param {string} url + * + * @returns {WebsocketProvider} + */ +ProviderPackageFactory.prototype.createWebsocketProvider = function (url) { + return new WebsocketProvider(url); +}; + +/** + * Return IpcProvider object + * + * @param {string} path + * @param {Net} net + * + * @returns {IpcProvider} + */ +ProviderPackageFactory.prototype.createIpcProvider = function (path, net) { + return new IpcProvider(path, net); +}; + +/** + * Returns HttpProviderAdapter object + * + * @param {HttpProvider} provider + * + * @returns {HttpProviderAdapter} + */ +ProviderPackageFactory.prototype.createHttpProviderAdapter = function (provider) { + return new HttpProviderAdapter(provider); +}; + +/** + * Returns SocketProviderAdapter object + * + * @param {WebsocketProvider | IpcProvider} provider + * + * @returns {SocketProviderAdapter} + */ +ProviderPackageFactory.prototype.createSocketProviderAdapter = function (provider) { + return new SocketProviderAdapter(provider) +}; + +/** + * Returns InpageProviderAdapter object + * + * @param {Object} provider + * + * @returns {InpageProviderAdapter} + */ +ProviderPackageFactory.prototype.createInpageProviderAdapter = function (provider) { + return new InpageProviderAdapter(provider) +}; diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index 4631cd0f332..db2e5737c2a 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -23,30 +23,36 @@ "use strict"; var _ = require('underscore'); -var HttpProviderAdapter = require('../adapters/HttpProviderAdapter'); -var SocketProviderAdapter = require('../adapters/SocketProviderAdapter'); -var InpageProviderAdapter = require('../adapters/InpageProviderAdapter'); -var WebsocketProvider = require('web3-providers-ws'); -var HttpProvider = require('web3-providers-http'); -var IpcProvider = require('web3-providers-ipc'); -var ProviderAdapterResolver = {}; +/** + * @param {ProviderPackageFactory} providerPackageFactory + * @constructor + */ +function ProviderAdapterResolver(providerPackageFactory) { + this.providerPackageFactory = providerPackageFactory; +} -ProviderAdapterResolver.resolve = function (provider, net) { +ProviderAdapterResolver.prototype.resolve = function (provider, net) { if (typeof provider === 'string') { // HTTP if (/^http(s)?:\/\//i.test(provider)) { - return new HttpProviderAdapter(new HttpProvider(provider)); + return this.providerPackageFactory.createHttpProviderAdapter( + this.providerPackageFactory.createHttpProvider(provider) + ); } // WS if (/^ws(s)?:\/\//i.test(provider)) { - return new SocketProviderAdapter(new WebsocketProvider(provider)); + return this.providerPackageFactory.createSocketProviderAdapter( + this.providerPackageFactory.createWebsocketProvider(provider) + ); } // IPC if (provider && _.isObject(net) && _.isFunction(net.connect)) { - return new SocketProviderAdapter(new IpcProvider(provider, net)); + return this.providerPackageFactory.createSocketProviderAdapter( + this.providerPackageFactory.createIpcProvider(provider, net) + ); } } @@ -55,7 +61,7 @@ ProviderAdapterResolver.resolve = function (provider, net) { } if (_.isFunction(provider.sendAsync)) { - return new InpageProviderAdapter(provider); + return this.providerPackageFactory.createInpageProviderAdapter(provider); } }; diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index 521701a8c00..848d521e08c 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -166,7 +166,9 @@ ConnectionModel.prototype.getBlockByNumber = function (blockNumber, returnTransa this.provider, 'eth_getBlockByNumber', [blockNumber, returnTransactionObjects], - [this.formatters.inputBlockNumberFormatter, function (val) { return !!val }], + [this.formatters.inputBlockNumberFormatter, function (val) { + return !!val + }], this.formatters.outputBlockFormatter ).send(callback); }; From 99769f81b71b1f083bd440f4d0dcd373ed38afdc Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 29 Aug 2018 17:04:18 +0200 Subject: [PATCH 0060/1045] module.exports added and index.js updated in web3-core-providers --- .../src/factories/ProviderPackageFactory.js | 2 ++ packages/web3-core-providers/src/index.js | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/web3-core-providers/src/factories/ProviderPackageFactory.js b/packages/web3-core-providers/src/factories/ProviderPackageFactory.js index 688849b14a7..82526dfda30 100644 --- a/packages/web3-core-providers/src/factories/ProviderPackageFactory.js +++ b/packages/web3-core-providers/src/factories/ProviderPackageFactory.js @@ -114,3 +114,5 @@ ProviderPackageFactory.prototype.createSocketProviderAdapter = function (provide ProviderPackageFactory.prototype.createInpageProviderAdapter = function (provider) { return new InpageProviderAdapter(provider) }; + +module.exports = ProviderPackageFactory; diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index f343cb43e3a..aed97f17dd5 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -20,15 +20,13 @@ "use strict"; -var ProviderAdapterResolver = require('./resolvers/ProviderAdapterResolver'); -var ProviderDetector = require('./detectors/ProviderDetector'); +var ProviderPackageFactory = require('./factories/ProviderPackageFactory'); var HttpProvider = require('./providers/HttpProvider'); var IpcProvider = require('./providers/IpcProvider'); var WebsocketProvider = require('./providers/WebsocketProvider'); module.exports = { - ProviderAdapterResolver: ProviderAdapterResolver, - ProviderDetector: ProviderDetector, + ProviderPackageFactory: ProviderPackageFactory, HttpProvider: HttpProvider, IpcProvider: IpcProvider, WebsocketProvider: WebsocketProvider From ed5b04dbcdfba54e9770e53d9324f31105537791 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 30 Aug 2018 13:48:36 +0200 Subject: [PATCH 0061/1045] ProviderPackageFactory renamed to ProvidersPackageFactory, Web3 package updated, ConnectionModel refactored, ConnectionModel removed from PackageFactory constructor dependency --- ...eFactory.js => ProvidersPackageFactory.js} | 20 +++---- packages/web3-core-providers/src/index.js | 4 +- packages/web3/src/factories/PackageFactory.js | 44 +++++++++------ packages/web3/src/index.js | 56 ++++++++++++++----- packages/web3/src/models/ConnectionModel.js | 5 +- 5 files changed, 82 insertions(+), 47 deletions(-) rename packages/web3-core-providers/src/factories/{ProviderPackageFactory.js => ProvidersPackageFactory.js} (77%) diff --git a/packages/web3-core-providers/src/factories/ProviderPackageFactory.js b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js similarity index 77% rename from packages/web3-core-providers/src/factories/ProviderPackageFactory.js rename to packages/web3-core-providers/src/factories/ProvidersPackageFactory.js index 82526dfda30..fed1f407803 100644 --- a/packages/web3-core-providers/src/factories/ProviderPackageFactory.js +++ b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js @@ -28,14 +28,14 @@ var WebsocketProvider = require('../providers/WebsocketProvider'); var IpcProvider = require('../providers/IpcProvider'); var HttpProvider = require('../providers/HttpProvider'); -function ProviderPackageFactory() { } +function ProvidersPackageFactory() { } /** * Return ProviderAdapterResolver object * * @returns {ProviderAdapterResolver} */ -ProviderPackageFactory.prototype.createProviderAdapterResolver = function () { +ProvidersPackageFactory.prototype.createProviderAdapterResolver = function () { return new ProviderAdapterResolver(this); }; @@ -44,7 +44,7 @@ ProviderPackageFactory.prototype.createProviderAdapterResolver = function () { * * @returns {ProviderDetector} */ -ProviderPackageFactory.prototype.createProviderDetector = function () { +ProvidersPackageFactory.prototype.createProviderDetector = function () { return new ProviderDetector(); }; @@ -55,7 +55,7 @@ ProviderPackageFactory.prototype.createProviderDetector = function () { * * @returns {HttpProvider} */ -ProviderPackageFactory.prototype.createHttpProvider = function (url) { +ProvidersPackageFactory.prototype.createHttpProvider = function (url) { return new HttpProvider(url); }; @@ -66,7 +66,7 @@ ProviderPackageFactory.prototype.createHttpProvider = function (url) { * * @returns {WebsocketProvider} */ -ProviderPackageFactory.prototype.createWebsocketProvider = function (url) { +ProvidersPackageFactory.prototype.createWebsocketProvider = function (url) { return new WebsocketProvider(url); }; @@ -78,7 +78,7 @@ ProviderPackageFactory.prototype.createWebsocketProvider = function (url) { * * @returns {IpcProvider} */ -ProviderPackageFactory.prototype.createIpcProvider = function (path, net) { +ProvidersPackageFactory.prototype.createIpcProvider = function (path, net) { return new IpcProvider(path, net); }; @@ -89,7 +89,7 @@ ProviderPackageFactory.prototype.createIpcProvider = function (path, net) { * * @returns {HttpProviderAdapter} */ -ProviderPackageFactory.prototype.createHttpProviderAdapter = function (provider) { +ProvidersPackageFactory.prototype.createHttpProviderAdapter = function (provider) { return new HttpProviderAdapter(provider); }; @@ -100,7 +100,7 @@ ProviderPackageFactory.prototype.createHttpProviderAdapter = function (provider) * * @returns {SocketProviderAdapter} */ -ProviderPackageFactory.prototype.createSocketProviderAdapter = function (provider) { +ProvidersPackageFactory.prototype.createSocketProviderAdapter = function (provider) { return new SocketProviderAdapter(provider) }; @@ -111,8 +111,8 @@ ProviderPackageFactory.prototype.createSocketProviderAdapter = function (provide * * @returns {InpageProviderAdapter} */ -ProviderPackageFactory.prototype.createInpageProviderAdapter = function (provider) { +ProvidersPackageFactory.prototype.createInpageProviderAdapter = function (provider) { return new InpageProviderAdapter(provider) }; -module.exports = ProviderPackageFactory; +module.exports = ProvidersPackageFactory; diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index aed97f17dd5..113f9c12986 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -20,13 +20,13 @@ "use strict"; -var ProviderPackageFactory = require('./factories/ProviderPackageFactory'); +var ProvidersPackageFactory = require('./factories/ProvidersPackageFactory'); var HttpProvider = require('./providers/HttpProvider'); var IpcProvider = require('./providers/IpcProvider'); var WebsocketProvider = require('./providers/WebsocketProvider'); module.exports = { - ProviderPackageFactory: ProviderPackageFactory, + ProvidersPackageFactory: ProvidersPackageFactory, HttpProvider: HttpProvider, IpcProvider: IpcProvider, WebsocketProvider: WebsocketProvider diff --git a/packages/web3/src/factories/PackageFactory.js b/packages/web3/src/factories/PackageFactory.js index 13ed1aa671b..bc54ea8afb9 100644 --- a/packages/web3/src/factories/PackageFactory.js +++ b/packages/web3/src/factories/PackageFactory.js @@ -7,61 +7,60 @@ var EthPackage = require('web3-eth'); var Iban = require('web3-eth-iban'); var Contract = require('web3-eth-contract'); var ABI = require('web3-eth-abi'); +var ProvidersPackageFactory = require('web3-core-providers').ProvidersPackageFactory; /** * @param {Object} coreFactory - * @param {Object} connectionModel * @constructor */ -function PackageFactory(coreFactory, connectionModel) { +function PackageFactory(coreFactory) { this.coreFactory = coreFactory; - this.connectionModel = connectionModel; } /** * @returns {Shh} */ -PackageFactory.prototype.createShhPackage = function () { - return new Shh(this.connectionModel, this.coreFactory); +PackageFactory.prototype.createShhPackage = function (connectionModel) { + return new Shh(connectionModel, this.coreFactory); }; /** * @returns {Bzz} */ -PackageFactory.prototype.createBzzPackage = function () { - return new Bzz(this.connectionModel); +PackageFactory.prototype.createBzzPackage = function (connectionModel) { + return new Bzz(connectionModel); }; /** * @returns {ENS} */ -PackageFactory.prototype.createEnsPackage = function () { - return new ENS(this.connectionModel, this.createEthPackage()); +PackageFactory.prototype.createEnsPackage = function (connectionModel) { + return new ENS(connectionModel, this.createEthPackage()); }; /** * @returns {Accounts} */ -PackageFactory.prototype.createAccountsPackage = function () { - return new Accounts(this.connectionModel, this.coreFactory); +PackageFactory.prototype.createAccountsPackage = function (connectionModel) { + return new Accounts(connectionModel, this.coreFactory); }; /** * @returns {Personal} */ -PackageFactory.prototype.createPersonalPackage = function () { - return new Personal(this.connectionModel, this.coreFactory); +PackageFactory.prototype.createPersonalPackage = function (connectionModel) { + return new Personal(connectionModel, this.coreFactory); }; /** * @returns {Eth} */ -PackageFactory.prototype.createEthPackage = function () { +PackageFactory.prototype.createEthPackage = function (connectionModel) { return new EthPackage.Eth( - this.connectionModel, + connectionModel, this, this.coreFactory, - new EthPackage.SubscriptionsResolver(this.connectionModel) + new EthPackage.SubscriptionsResolver(connectionModel) ); }; @@ -70,8 +69,8 @@ PackageFactory.prototype.createEthPackage = function () { * * @returns {Contract} // TODO: Refactor Contract for usage of binded properties */ -PackageFactory.prototype.createContractPackage = function () { - return Contract.bind({connectionModel: this.connectionModel, accounts: this.createAccountsPackage()}); +PackageFactory.prototype.createContractPackage = function (connectionModel) { + return Contract.bind({connectionModel: connectionModel, accounts: this.createAccountsPackage()}); }; /** @@ -87,3 +86,12 @@ PackageFactory.prototype.createIbanPackage = function () { PackageFactory.prototype.createAbiPackage = function () { return new ABI(this.coreFactory.createUtils()); }; + +/** + * Return the ProvidersPackageFactory from web3-core-providers + * + * @returns ProvidersPackageFactory + */ +PackageFactory.prototype.createProvidersPackageFactory = function () { + return new ProvidersPackageFactory() +}; diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index afbd03e6c5e..d697f028f7a 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -32,16 +32,19 @@ var version = require('../package.json').version; * @constructor */ var Web3 = function Web3(provider, net) { - this.connectionModel = new ConnectionModel(provider); this.coreFactory = new CoreFactory(); - this.packageFactory = new PackageFactory(this.coreFactory, this.connectionModel); + this.packageFactory = new PackageFactory(this.coreFactory); + this.connectionModel = new ConnectionModel( + this.packageFactory.createProvidersPackageFactory().createProviderAdapterResolver().resolve(provider, net), + this.coreFactory + ); this.version = version; this.utils = this.coreFactory.createUtils(); - this.eth = this.packageFactory.createEthPackage(); - this.shh = this.packageFactory.createShhPackage(); - this.bzz = this.packageFactory.createBzzPackage(); + this.eth = this.packageFactory.createEthPackage(this.connectionModel); + this.shh = this.packageFactory.createShhPackage(this.connectionModel); + this.bzz = this.packageFactory.createBzzPackage(this.connectionModel); }; /** @@ -61,35 +64,60 @@ Object.defineProperty(Web3, 'connectionModel', { enumerable: true }); +/** + * Defines accessors for connectionModel + */ +Object.defineProperty(Web3, 'givenProvider', { + get: function () { + return this.connectionModel; + }, + set: function (connectionModel) { + if (this.connectionModel) { + return; + } + + this.connectionModel = connectionModel; + }, + enumerable: true +}); + Web3.version = version; Web3.utils = new CoreFactory().createUtils(); Web3.modules = { Eth: function (provider) { - return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createEthPackage(); + var coreFactory = new CoreFactory(); + return new PackageFactory(coreFactory).createEthPackage(new ConnectionModel(provider, coreFactory)); }, Net: function (provider) { - return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createEthPackage(); + var coreFactory = new CoreFactory(); + return new ConnectionModel(provider, coreFactory).getNetworkMethodsAsObject(); }, Personal: function (provider) { - return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createPersonalPackage(); + var coreFactory = new CoreFactory(); + return new PackageFactory(coreFactory).createPersonalPackage(new ConnectionModel(provider, coreFactory)); }, Shh: function (provider) { - return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createShhPackage(); + var coreFactory = new CoreFactory(); + return new PackageFactory(coreFactory).createShhPackage(new ConnectionModel(provider, coreFactory)); }, Bzz: function (provider) { - return new PackageFactory(new CoreFactory(), new ConnectionModel(provider)).createBzzPackage(); + var coreFactory = new CoreFactory(); + return new PackageFactory(coreFactory).createBzzPackage(new ConnectionModel(provider, coreFactory)); } }; + Web3.providers = { - HttpProvider: require('web3-provider-http'), - WebsocketProvider: require('web3-provider-ws'), - IpcProvider: require('web3-provider-ipc') + HttpProvider: require('web3-core-providers').HttpProvider, + WebsocketProvider: require('web3-core-providers').WebsocketProvider, + IpcProvider: require('web3-core-providers').IpcProvider }; -// Web3.givenProvider = this.providerDetector.detect(); +Web3.givenProvider = function () { + return new PackageFactory(new CoreFactory()).createProvidersPackageFactory().createProviderDetector().detect(); +}; module.exports = Web3; diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index 848d521e08c..af83c0a94d6 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -27,8 +27,7 @@ * @constructor */ function ConnectionModel(provider, coreFactory) { - this.provider = provider; //TODO: add provider resolver - this.givenProvider = null; //TODO: add provider detection maybe this cant be here + this.provider = provider; this.coreFactory = coreFactory; this.utils = this.coreFactory.createUtils(); this.formatters = this.coreFactory.createFormatters(); @@ -43,7 +42,7 @@ Object.defineProperty(Eth, 'defaultAccount', { }, set: function (val) { if (val) { - this.defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); + this.defaultAccount = utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); } }, enumerable: true From ab4c05f44ae18f4dec3c8b55625a5edfc2f6a076 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 30 Aug 2018 17:15:53 +0200 Subject: [PATCH 0062/1045] funcDocs updated in Subscription and SubscriptionsResolver, Eth object refactored with new Mehtod handling --- .../src/Subscription.js | 2 +- packages/web3-eth/src/Eth.js | 1042 +++++++++++++---- .../src/resolvers/SubscriptionsResolver.js | 5 +- 3 files changed, 823 insertions(+), 226 deletions(-) diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index d23a818f7e4..8a92798356c 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -47,7 +47,7 @@ function Subscription(provider, type, parameters, inputFormatter, outputFormatte * * @param {Function} callback * - * @returns {Object} Subscription + * @returns {Subscription} Subscription */ Subscription.prototype.subscribe = function (callback) { var self = this; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index bc3723574d6..b3436601206 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -24,249 +24,845 @@ var _ = require('underscore'); +/** + * @param {ConnectionModel} connectionModel + * @param {PackageFactory} packageFactory + * @param {CoreFactory} coreFactory + * @param {SubscriptionsResolver} subscriptionsResolver + * @constructor + */ +var Eth = function Eth(connectionModel, packageFactory, coreFactory, subscriptionsResolver) { + this.connectionModel = connectionModel; + this.coreFactory = coreFactory; + this.net = this.connectionModel.getNetworkMethodsAsObject(); + this.Contract = packageFactory.createContractPackage(); + this.accounts = packageFactory.createAccountsPackage(); + this.personal = packageFactory.createPersonalPackage(); + this.iban = packageFactory.createIbanPackage(); + this.abi = packageFactory.createAbiPackage(); + this.ens = packageFactory.createEnsPackage(); + this.utils = this.coreFactory.createUtils(); + this.formatters = this.coreFactory.createFormatters(); + this.subscriptionsResolver = subscriptionsResolver; +}; -var blockCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockByHash" : "eth_getBlockByNumber"; +/** + * Gets and executes subscription for an given type + * + * @param {String} type + * @param {array} parameters + * @param {Function} callback + */ +Eth.prototype.subscribe = function (type, parameters, callback) { + return this.subscriptionsResolver.resolve(type, parameters, callback); }; -var transactionFromBlockCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex'; +/** + * Sends the JSON-RPC request web3_clientVersion and gets the node information + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getNodeInfo = function (callback) { + return this.coreFactory.createMethod(this.connectionModel.provider, 'web3_clientVersion', [], null, null).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_protocolVersion and gets the protocol version. + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getProtocolVersion = function (callback) { + return this.coreFactory.createMethod(this.connectionModel.provider, 'eth_protocolVersion', [], null, null).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_coinbase and gets the coinbase + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getCoinbase = function (callback) { + return this.coreFactory.createMethod(this.connectionModel.provider, 'eth_coinbase', [], null, null).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_mining and checks if the node is mining + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.isMining = function (callback) { + return this.coreFactory.createMethod(this.connectionModel.provider, 'eth_mining', [], null, null).send(callback); }; -var uncleCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex'; +/** + * Sends the JSON-RPC request eth_hashrate and returns the current hashrate + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getHashrate = function (callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_hashrate', + [], + null, + this.utils.hexToNumber + ).send(callback); }; -var getBlockTransactionCountCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber'; +/** + * Sends the JSON-RPC request eth_syncing and checks if the node is syncing + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.isSyncing = function (callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_syncing', + [], + null, + this.formatters.outputSyncingFormatter + ).send(callback); }; -var uncleCountCall = function (args) { - return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber'; +/** + * Sends the JSON-RPC request eth_gasPrice and returns the current gasPrice from this node + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getGasPrice = function (callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_gasPrice', + [], + null, + this.formatters.outputBigNumberFormatter + ).send(callback); }; +/** + * Sends the JSON-RPC request eth_accounts and returns a list of addresses owned by client. + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getAccounts = function (callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_accounts', + [], + null, + this.utils.toChecksumAddress + ).send(callback); +}; -var Eth = function Eth(connectionModel, packageFactory, coreFactory, subscriptionsResolver) { - this.net = connectionModel.getNetworkMethodsAsObject(); - this.Contract = this.packageFactory.createContractPackage(); - this.accounts = this.packageFactory.createAccountsPackage(); - this.personal = this.packageFactory.createPersonalPackage(); - this.iban = this.packageFactory.createIbanPackage(); - this.abi = this.packageFactory.createAbiPackage(); - this.ens = this.packageFactory.createEnsPackage(); - this.utils = this.coreFactory.createUtils(); - this.formatters = this.coreFactory.createFormatters(); - this.subscriptionsResolver = subscriptionsResolver; +/** + * Sends the JSON-RPC request eth_blockNumber and returns the current block number. + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlockNumber = function (callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_blockNumber', + [], + null, + this.utils.hexToNumber + ).send(callback); }; /** - * Gets and executes subscription for an given type + * Sends the JSON-RPC request eth_getBalance and returns the balance of an address * - * @param {string} type - * @param {*} parameters + * @param {String} address + * @param {number} block * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} */ -Eth.prototype.subscribe = function (type, parameters, callback) { - return this.subscriptionsResolver.resolve(type, parameters).subscribe(callback); -}; - -Eth.prototype.getNodeInfo = function () { - return this.coreFactory.createMethod(...).send(); -}; - -/** - * Appends rpc methods to Eth - * - */ -Eth.prototype.setMethods = function () { - // TODO: change new Method(...) to this.coreFactory.createMethod(...); - var methods = [ - new Method({ - name: 'getNodeInfo', - call: 'web3_clientVersion' - }), - new Method({ - name: 'getProtocolVersion', - call: 'eth_protocolVersion', - params: 0 - }), - new Method({ - name: 'getCoinbase', - call: 'eth_coinbase', - params: 0 - }), - new Method({ - name: 'isMining', - call: 'eth_mining', - params: 0 - }), - new Method({ - name: 'getHashrate', - call: 'eth_hashrate', - params: 0, - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'isSyncing', - call: 'eth_syncing', - params: 0, - outputFormatter: formatter.outputSyncingFormatter - }), - new Method({ - name: 'getGasPrice', - call: 'eth_gasPrice', - params: 0, - outputFormatter: formatter.outputBigNumberFormatter - }), - new Method({ - name: 'getAccounts', - call: 'eth_accounts', - params: 0, - outputFormatter: utils.toChecksumAddress - }), - new Method({ - name: 'getBlockNumber', - call: 'eth_blockNumber', - params: 0, - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'getBalance', - call: 'eth_getBalance', - params: 2, - inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], - outputFormatter: formatter.outputBigNumberFormatter - }), - new Method({ - name: 'getStorageAt', - call: 'eth_getStorageAt', - params: 3, - inputFormatter: [formatter.inputAddressFormatter, utils.numberToHex, formatter.inputDefaultBlockNumberFormatter] - }), - new Method({ - name: 'getCode', - call: 'eth_getCode', - params: 2, - inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter] - }), - new Method({ - name: 'getBlock', - call: blockCall, - params: 2, - inputFormatter: [formatter.inputBlockNumberFormatter, function (val) { +Eth.prototype.getBalance = function (address, block, callback) { + if (!block) { + block = this.connectionModel.defaultBlock; + } + + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getBalance', + [address, block], + [ + this.formatters.inputAddressFormatter, + this.formatters.inputDefaultBlockNumberFormatter + ], + this.formatters.outputBigNumberFormatter + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getStorageAt and returns the value from a storage position at a given address + * + * @param {String} address + * @param {number} position + * @param {number} block + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getStorageAt = function (address, position, block, callback) { + if (!block) { + block = this.connectionModel.defaultBlock; + } + + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getStorageAt', + [address, position, block], + [ + this.formatters.inputAddressFormatter, + this.utils.numberToHex, + this.formatters.inputDefaultBlockNumberFormatter + ], + null + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getCode and returns the code of a contract at a given address + * + * @param {String} address + * @param {number} block + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getCode = function (address, block, callback) { + if (!block) { + block = this.connectionModel.defaultBlock; + } + + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getCode', + [address, block], + [ + this.formatters.inputAddressFormatter, + this.formatters.inputDefaultBlockNumberFormatter + ], + null + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getBlockByNumber and returns a block by his number. + * + * @param {number} blockNumber + * @param {boolean} returnTransactionObjects + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getBlockByNumber', + [blockNumber, returnTransactionObjects], + [ + this.formatters.inputBlockNumberFormatter, + function (val) { + return !!val; + } + ], + this.formatters.outputBlockFormatter + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getBlockByHash and return a block by his hash. + * + * @param {String} blockHash + * @param {boolean} returnTransactionObjects + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlockByHash = function (blockHash, returnTransactionObjects, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getBlockByHash', + [blockHash, returnTransactionObjects], + [ + this.formatters.inputBlockNumberFormatter, + function (val) { return !!val; - }], - outputFormatter: formatter.outputBlockFormatter - }), - new Method({ - name: 'getUncle', - call: uncleCall, - params: 2, - inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], - outputFormatter: formatter.outputBlockFormatter, - - }), - new Method({ - name: 'getBlockTransactionCount', - call: getBlockTransactionCountCall, - params: 1, - inputFormatter: [formatter.inputBlockNumberFormatter], - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'getBlockUncleCount', - call: uncleCountCall, - params: 1, - inputFormatter: [formatter.inputBlockNumberFormatter], - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'getTransaction', - call: 'eth_getTransactionByHash', - params: 1, - inputFormatter: [null], - outputFormatter: formatter.outputTransactionFormatter - }), - new Method({ - name: 'getTransactionFromBlock', - call: transactionFromBlockCall, - params: 2, - inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], - outputFormatter: formatter.outputTransactionFormatter - }), - new Method({ - name: 'getTransactionReceipt', - call: 'eth_getTransactionReceipt', - params: 1, - inputFormatter: [null], - outputFormatter: formatter.outputTransactionReceiptFormatter - }), - new Method({ - name: 'getTransactionCount', - call: 'eth_getTransactionCount', - params: 2, - inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'sendSignedTransaction', - call: 'eth_sendRawTransaction', - params: 1, - inputFormatter: [null] - }), - new Method({ - name: 'signTransaction', - call: 'eth_signTransaction', - params: 1, - inputFormatter: [formatter.inputTransactionFormatter] - }), - new Method({ - name: 'sendTransaction', - call: 'eth_sendTransaction', - params: 1, - inputFormatter: [formatter.inputTransactionFormatter] - }), - new Method({ - name: 'sign', - call: 'eth_sign', - params: 2, - inputFormatter: [formatter.inputSignFormatter, formatter.inputAddressFormatter], - transformPayload: function (payload) { - payload.params.reverse(); - return payload; } - }), - new Method({ - name: 'call', - call: 'eth_call', - params: 2, - inputFormatter: [formatter.inputCallFormatter, formatter.inputDefaultBlockNumberFormatter] - }), - new Method({ - name: 'estimateGas', - call: 'eth_estimateGas', - params: 1, - inputFormatter: [formatter.inputCallFormatter], - outputFormatter: utils.hexToNumber - }), - new Method({ - name: 'submitWork', - call: 'eth_submitWork', - params: 3 - }), - new Method({ - name: 'getWork', - call: 'eth_getWork', - params: 0 - }), - new Method({ - name: 'getPastLogs', - call: 'eth_getLogs', - params: 1, - inputFormatter: [formatter.inputLogFormatter], - outputFormatter: formatter.outputLogFormatter - }), - ]; + ], + this.formatters.outputBlockFormatter + ).send(callback); +}; + +/** + * Gets block by hash or number. + * + * TODO: Define this method as deprecated + * + * @param {String|number} blockHashOrBlockNumber + * @param {boolean} returnTransactionObjects + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlock = function (blockHashOrBlockNumber, returnTransactionObjects, callback) { + if (this.isBlockHash(blockHashOrBlockNumber)) { + return this.getBlockByHash(returnTransactionObjects, callback); + } + + return this.getBlockByNumber(blockHashOrBlockNumber, returnTransactionObjects, callback); +}; + +/** + * Gets uncle by hash or number. + * + * TODO: Define this method as deprecated + * + * @param {String|number} blockHashOrBlockNumber + * @param {number} uncleIndex + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getUncle = function (blockHashOrBlockNumber, uncleIndex, callback) { + if (this.isBlockHash(blockHashOrBlockNumber)) { + return this.getUnlceByBlockHash(blockHashOrBlockNumber, uncleIndex, callback); + } + + return this.getUncleByBlockNumber(blockHashOrBlockNumber, uncleIndex, callback); +}; + +/** + * Sends the JSON-RPC request eth_getUncleByBlockNumberAndIndex and returns the uncle block by his number and index + * + * @param {number} blockNumber + * @param {number} uncleIndex + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getUncleByBlockNumber = function (blockNumber, uncleIndex, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getUncleByBlockNumberAndIndex', + [blockNumber, uncleIndex], + [ + this.formatters.inputBlockNumberFormatter, + this.utils.numberToHex + ], + this.formatters.outputBlockFormatter + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getUncleByBlockHashAndIndex and returns the uncle block by his hash and index + * + * @param {String} blockHash + * @param {number} uncleIndex + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getUnlceByBlockHash = function (blockHash, uncleIndex, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getUncleByBlockHashAndIndex', + [blockHash, uncleIndex], + [ + this.formatters.inputBlockNumberFormatter, + this.utils.numberToHex + ], + this.formatters.outputBlockFormatter + ).send(callback); +}; + +/** + * Gets block transaction count by hash or number. + * + * TODO: Define this method as deprecated + * + * @param {String|number} blockHashOrBlockNumber + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlockTransactionCount = function (blockHashOrBlockNumber, callback) { + if (this.isBlockHash(blockHashOrBlockNumber)) { + return this.getBlockTransactionCountByBlockHash(blockHashOrBlockNumber, callback); + } + + return this.getBlockTransactionCountByBlockNumber(blockHashOrBlockNumber, callback); +}; + +/** + * Sends the JSON-RPC request eth_getBlockTransactionCountByNumber and returns the block transaction count + * from a block by his number + * + * @param {number} blockNumber + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlockTransactionCountByBlockNumber = function (blockNumber, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getBlockTransactionCountByNumber', + [blockNumber], + [ + this.formatters.inputBlockNumberFormatter + ], + this.utils.hexToNumber + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getBlockTransactionCountByHash and returns the block transaction count + * from a block by his hash + * + * @param {String} blockHash + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlockTransactionCountByBlockHash = function (blockHash, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getBlockTransactionCountByHash', + [blockNumber], + [ + this.formatters.inputBlockNumberFormatter + ], + this.utils.hexToNumber + ).send(callback); +}; + +/** + * Gets block transaction count by hash or number. + * + * TODO: Define this method as deprecated + * + * @param {String|number} blockHashOrBlockNumber + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlockUncleCount = function (blockHashOrBlockNumber, callback) { + if (this.isBlockHash(blockHashOrBlockNumber)) { + return this.getBlockUncleCountByBlockHash(blockHashOrBlockNumber, callback); + } + + return this.getBlockUncleCountByBlockNumber(blockHashOrBlockNumber, callback); +}; + +/** + * Sends the JSON-RPC request eth_getUncleCountByBlockHash and returns the uncle count of a block by his hash + * + * @param {String} blockHash + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlockUncleCountByBlockHash = function (blockHash, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getUncleCountByBlockHash', + [blockHash], + [ + this.formatters.inputBlockNumberFormatter + ], + this.utils.hexToNumber + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getUncleCountByBlockHash and returns the uncle count of a block by his number + * + * @param {number} blockNumber + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getBlockUncleCountByBlockNumber = function (blockNumber, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getUncleCountByBlockNumber', + [blockNumber], + [ + this.formatters.inputBlockNumberFormatter + ], + this.utils.hexToNumber + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getTransactionByHash and returns the transaction by his hash + * + * @param {String} transactionHash + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getTransaction = function (transactionHash, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getTransactionByHash', + [transactionHash], + null, + this.formatters.outputTransactionFormatter + ).send(callback); +}; + +/** + * Gets transaction from block hash or number and index. + * + * TODO: Define this method as deprecated + * + * @param {String|number} hashStringOrNumber + * @param {number} indexNumber + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getTransactionFromBlock = function (hashStringOrNumber, indexNumber, callback) { + if (this.isBlockHash(hashStringOrNumber)) { + return this.getTransactionFromBlockByBlockHash(hashStringOrNumber, indexNumber, callback); + } + return this.getTransactionFromBlockByBlockNumber(hashStringOrNumber, indexNumber, callback); +}; + +/** + * Sends the JSON-RPC request eth_getTransactionByBlockHashAndIndex and returns a transaction + * by his index from a block with the block hash. + * + * @param {String} transactionHash + * @param {number} indexNumber + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getTransactionFromBlockByBlockHash = function (transactionHash, indexNumber, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getTransactionByBlockHashAndIndex', + [transactionHash, indexNumber], + [ + this.formatters.inputBlockNumberFormatter, + this.utils.numberToHex + ], + this.formatters.outputTransactionFormatter + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getTransactionByBlockHashAndIndex and returns a transaction + * by his index from a block with the block number. + * + * @param {number} blockNumber + * @param {number} indexNumber + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getTransactionFromBlockByBlockNumber = function (blockNumber, indexNumber, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getTransactionByBlockNumberAndIndex', + [blockNumber, indexNumber], + [ + this.formatters.inputBlockNumberFormatter, + this.utils.numberToHex + ], + this.formatters.outputTransactionFormatter + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getTransactionReceipt and returns the transaction receipt by his transaction hash + * + * @param {String} transactionHash + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getTransactionReceipt = function (transactionHash, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getTransactionReceipt', + [transactionHash], + null, + this.formatters.outputTransactionReceiptFormatter + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getTransactionCount and returns the transaction count of an address + * + * @param {String} address + * @param {number} block + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getTransactionCount = function (address, block, callback) { + if (!block) { + block = this.connectionModel.defaultBlock; + } + + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getTransactionCount', + [address, block], + [ + this.formatters.inputAddressFormatter, + this.formatters.inputDefaultBlockNumberFormatter + ], + this.utils.hexToNumber + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_sendRawTransaction and returns the transaction hash + * + * @param {String} signedTransactionData + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.sendSignedTransaction = function (signedTransactionData, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_sendRawTransaction', + [signedTransactionData], + null, + null + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_signTransaction and returns the signed transaction + * + * @param {Object} transactionObject + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.signTransaction = function (transactionObject, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_signTransaction', + [transactionObject], + [this.formatters.inputTransactionFormatter], + null + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_sendTransaction and returns the transaction hash + * + * @param {Object} transactionObject + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.sendTransaction = function (transactionObject, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_sendTransaction', + [transactionObject], + [this.formatters.inputTransactionFormatter], + null + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_sign and returns the signed data + * + * @param {String} dataToSign + * @param {String} address + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.sign = function (dataToSign, address, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_sign', + [address, dataToSign], + [ + this.formatters.inputSignFormatter, + this.formatters.inputAddressFormatter + ], + null + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_call and returns the return value of the executed contract + * + * @param {Object} callObject + * @param {Number|String} block + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.call = function (callObject, block, callback) { + if (!block) { + block = this.connectionModel.defaultBlock; + } + + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_call', + [callObject, block], + [ + this.formatters.inputCallFormatter, + this.formatters.inputDefaultBlockNumberFormatter + ], + null + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_estimateGas and returns the estimated gas + * + * @param {Object} callObject + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.estimateGas = function (callObject, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_estimateGas', + [callObject], + [this.formatters.inputCallFormatter], + this.utils.hexToNumber + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_submitWork and returns the validation result + * + * @param {String} nonce + * @param {String} powHash + * @param {String} digest + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.submitWork = function (nonce, powHash, digest, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_submitWork', + [nonce, powHash, digest], + null, + null + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getWork and returns the hash of the current block, the seedHash, and the + * boundary condition to be met ("target"). + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getWork = function (callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getWork', + [], + null, + null + ).send(callback); +}; + +/** + * Sends the JSON-RPC request eth_getLogs and returns an array of all logs matching a given filter object + * + * @param {Object} options + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Eth.prototype.getPastLogs = function (options, callback) { + return this.coreFactory.createMethod( + this.connectionModel.provider, + 'eth_getLogs', + [], + [this.formatters.inputLogFormatter], + this.formatters.outputLogFormatter + ).send(callback); +}; + +/** + * Determines if given block parameter is of type hash or number + * + * @param {String|Number} blockParameter + * @returns {boolean} + */ +Eth.prototype.isBlockHash = function (blockParameter) { + return _.isString(blockParameter) && blockParameter.indexOf('0x') === 0 }; /** diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index b17aacfc436..95d8c20526e 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -37,7 +37,7 @@ function SubscriptionsResolver(provider) { * Resolves the requested subscription * * @param {string} type - * @param {any} parameters + * @param {array} parameters * @param {Function} callback * @returns {Object} */ @@ -64,10 +64,11 @@ SubscriptionsResolver.prototype.resolve = function (type, parameters, callback) * Create Subscription object * * @param {string} type - * @param {any} parameters + * @param {array} parameters * @param {Function} inputFormatter * @param {Function} outputFormatter * @param {Function} callback + * * @returns {Subscription} */ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, inputFormatter, outputFormatter, callback) { From faa837c1814fe971d0066eb5a681585ed9aa22a9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 13:29:26 +0200 Subject: [PATCH 0063/1045] Subscriptions in eth package finished --- .../src/Subscription.js | 30 +-- .../src/factories/EthPackageFactory.js | 59 ++++++ .../src/resolvers/SubscriptionsResolver.js | 189 ++++++++++++++---- 3 files changed, 227 insertions(+), 51 deletions(-) create mode 100644 packages/web3-eth/src/factories/EthPackageFactory.js diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 8a92798356c..29526855d8f 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -28,16 +28,16 @@ var EventEmitter = require('eventemitter3'); /** * @param {Object} provider * @param {String} type - * @param {Array} parameters - * @param {Function} inputFormatter + * @param {array} parameters + * @param {array} inputFormatters * @param {Function} outputFormatter * @constructor */ -function Subscription(provider, type, parameters, inputFormatter, outputFormatter) { +function Subscription(provider, type, parameters, inputFormatters, outputFormatter) { this.provider = provider; this.type = type; this.parameters = parameters; - this.inputFormatter = inputFormatter; + this.inputFormatters = inputFormatters; this.outputFormatter = outputFormatter; this.subscriptionId = null; } @@ -127,8 +127,8 @@ Subscription.prototype.reconnect = function (type, parameters, subscriptionId, c /** * Executes outputFormatter if defined * - * @param output - * @returns {*} + * @param {any} output + * @returns {any} */ Subscription.prototype.formatOutput = function (output) { if (_.isFunction(this.outputFormatter) && output) { @@ -139,17 +139,23 @@ Subscription.prototype.formatOutput = function (output) { }; /** - * Executes inputFormatter if defined + * Executes inputFormatters if defined * - * @param input + * @param {array} parameters * @returns {*} */ -Subscription.prototype.formatInput = function (input) { - if (_.isFunction(this.inputFormatter) && input) { - return this.inputFormatter(input); +Subscription.prototype.formatInput = function (parameters) { + if (_.isArray(this.inputFormatters)) { + return this.inputFormatters.map(function (formatter, index) { + if (_.isFunction(formatter)) { + return formatter(parameters[index]); + } + + return parameters[index]; + }); } - return input; + return parameters; }; /** diff --git a/packages/web3-eth/src/factories/EthPackageFactory.js b/packages/web3-eth/src/factories/EthPackageFactory.js new file mode 100644 index 00000000000..3a04f42e465 --- /dev/null +++ b/packages/web3-eth/src/factories/EthPackageFactory.js @@ -0,0 +1,59 @@ +/* + 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 . +*/ +/** + * @file EthPackageFactory.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var SubscriptionsResolver = require('../resolvers/SubscriptionsResolver'); +var Eth = require('../Eth'); + + +function EthPackageFactory () { } + +/** + * Returns object of type SubscriptionsResolver + * + * @param {Object} provider + * @param {CoreFactory} coreFactory + * + * @returns {SubscriptionsResolver} + */ +EthPackageFactory.prototype.createSubscriptionsResolver = function (provider, coreFactory) { + return new SubscriptionsResolver(provider, coreFactory) +}; + +/** + * Returns object of type Eth + * + * @param {ConnectionModel} connectionModel + * @param {PackageFactory} packageFactory + * @param {CoreFactory} coreFactory + * + * @returns {Eth} + */ +EthPackageFactory.prototype.createEth = function (connectionModel, packageFactory, coreFactory) { + return new Eth( + connectionModel, + packageFactory, + coreFactory, + this.createSubscriptionsResolver(connectionModel.provider, coreFactory) + ); +}; diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index 95d8c20526e..47131920ee5 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -22,35 +22,39 @@ "use strict"; -var Subscription = require('web3-core-subscription'); -var formatters = require('web3-core-helpers').formatters; - /** * @param {Object} provider + * @param {CoreFactory} coreFactory * @constructor */ -function SubscriptionsResolver(provider) { +function SubscriptionsResolver(provider, coreFactory) { this.provider = provider; + this.coreFactory = coreFactory; + this.formatters = this.coreFactory.createFormatters(); } /** * Resolves the requested subscription * + * @method resolve + * * @param {string} type * @param {array} parameters * @param {Function} callback - * @returns {Object} + * + * @callback callback callback(error, result) + * @returns {eventifiedPromise | Subscription} */ SubscriptionsResolver.prototype.resolve = function (type, parameters, callback) { switch (type) { case 'newBlockHeaders': - return this.getSubscription('newHeads', null, null, formatters.outputBlockFormatter, callback); + return this.getSubscription('newHeads', null, null, this.formatters.outputBlockFormatter, callback); break; case 'pendingTransactions': return this.getSubscription('newPendingTransactions', null, null, null, callback); break; case 'logs': - // TODO: need clarifaction if we really + return this.getLogsSubscription(parameters, callback); break; case 'syncing': return this.getSyncingSubscription(callback); @@ -63,12 +67,15 @@ SubscriptionsResolver.prototype.resolve = function (type, parameters, callback) /** * Create Subscription object * + * @method getSubscription + * * @param {string} type * @param {array} parameters * @param {Function} inputFormatter * @param {Function} outputFormatter * @param {Function} callback * + * @callback callback callback(error, result) * @returns {Subscription} */ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, inputFormatter, outputFormatter, callback) { @@ -76,7 +83,7 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in parameters = []; } - return new Subscription( + return this.coreFactory.createSubscription( this.provider, type, parameters, @@ -86,75 +93,179 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in }; /** - * @param parameters + * Determines if fromBlock is set and returns the expected subscription. + * + * @method getLogsSubscription + * + * @param {array} parameters + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {eventifiedPromise} */ -SubscriptionsResolver.prototype.getLogsSubscription = function (parameters) { - // implementation on hold +SubscriptionsResolver.prototype.getLogsSubscription = function (parameters, callback) { + var promiEvent = this.coreFactory.createPromiEvent(); + + if (this.hasFromBlockProperty(parameters[1])) { + this.handleLogsSubscriptionWithFromBlock(parameters, promiEvent, callback); + + return promiEvent; + } + + this.subscribeToLogs(parameters, promiEvent, callback); + + return promiEvent; }; /** + * Subscribes to logs and emits promiEvent events + * + * @method subscribeToLogs + * + * @param {array} parameters + * @param {PromiEvent} promiEvent * @param {Function} callback + * + * @callback callback callback(error, result) */ -SubscriptionsResolver.prototype.getSyncingSubscription = function (callback) { - var subscription = new Subscription( +SubscriptionsResolver.prototype.subscribeToLogs = function (parameters, promiEvent, callback) { + this.coreFactory.createSubscription( this.provider, + 'logs', + parameters, + null, + this.formatters.outputLogFormatter + ).subscribe(function (error, logs) { + if (error) { + callback(error, null); + promiEvent.eventEmitter.emit('error', error); + + return; + } + + logs.forEach(function(log) { + callback(false, log); + promiEvent.eventEmitter.emit('data', log); + }); + }); +}; + +/** + * Sends the JSON-RPC request eth_getLogs to get the past logs and after that it subscribes to the comming logs. + * + * @method handleLogsSubscriptionWithFromBlock + * + * @param {array} parameters + * @param {PromiEvent} promiEvent + * @param {Function} callback + * + * @callback callback callback(error,result) + */ +SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function (parameters, promiEvent, callback) { + var self = this; + this.provider.send('eth_getLogs', parameters).then(function (logs) { + logs.forEach(function (log) { + var output = self.formatters.outputLogFormatter(log); + callback(false, output); + promiEvent.eventEmitter.emit('data', output); + }); + + delete parameters[1].fromBlock; + + self.subscribeToLogs(parameters, outputFormatter, promiEvent, callback); + + }).catch(function (error) { + promiEvent.eventEmitter.emit('error', error); + callback(error, null); + }); +}; + +/** + * Checks if node is syncing and returns PromiEvent + * + * @method getSyncingSubscription + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {eventifiedPromise} + */ +SubscriptionsResolver.prototype.getSyncingSubscription = function (callback) { + var subscription = this.getSubscription( 'syncing', null, - formatters.outputSyncingFormatter + null, + this.formatters.outputSyncingFormatter, + callback ); - subscription.subscribe().on('data', function (output) { + var promiEvent = this.coreFactory.createPromiEvent(); + + subscription.subscribe(function (error, output) { var self = this; + if (error) { + promiEvent.eventEmitter.emit('error', error); + callback(error, null, this); + + return; + } + // fire TRUE at start if (this.isSyncing !== true) { this.isSyncing = true; - subscription.emit('changed', this.isSyncing); + promiEvent.eventEmitter.emit('changed', this.isSyncing); if (_.isFunction(callback)) { callback(null, this.isSyncing, this); } setTimeout(function () { - subscription.emit('data', output); + promiEvent.eventEmitter.emit('data', output); if (_.isFunction(self.callback)) { callback(null, output, self); } }, 0); - // fire sync status - } else { - subscription.emit('data', output); - if (_.isFunction(callback)) { - callback(null, output, this); - } + return; + } + + // fire sync status + promiEvent.eventEmitter.emit('data', output); + if (_.isFunction(callback)) { + callback(null, output, this); + } - // wait for some time before fireing the FALSE - clearTimeout(this.isSyncingTimeout); - this.isSyncingTimeout = setTimeout(function () { - if (output.currentBlock > output.highestBlock - 200) { - self.isSyncing = false; - subscription.emit('changed', self.isSyncing); + // wait for some time before fireing the FALSE + clearTimeout(this.isSyncingTimeout); + this.isSyncingTimeout = setTimeout(function () { + if (output.currentBlock > output.highestBlock - 200) { + self.isSyncing = false; + promiEvent.eventEmitter.emit('changed', self.isSyncing); - if (_.isFunction(callback)) { - callback(null, self.isSyncing, self); - } + if (_.isFunction(callback)) { + callback(null, self.isSyncing, self); } - }, 500); - } + } + }, 500); + }); - return subscription; + return promiEvent; }; /** - * Sets the provider + * Checks if fromBlock property is set in parameter object * - * @param {Object} provider + * @method hasFromBlockProperty + * + * @param {Object} parameter + * + * @returns {boolean} */ -SubscriptionsResolver.prototype.setProvider = function (provider) { - this.provider = provider; +SubscriptionsResolver.prototype.hasFromBlockProperty = function (parameter) { + return _.isObject(parameter) && parameter.hasOwnProperty('fromBlock') && _.isNumber(parameter.fromBlock); }; module.exports = SubscriptionsResolver; From b1c7aaa34e625409ddecea9ff9d727210329c33b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 13:37:13 +0200 Subject: [PATCH 0064/1045] FuncDocs improved --- packages/web3-eth/src/Eth.js | 85 +++++++++++++++++++ .../src/factories/EthPackageFactory.js | 4 + 2 files changed, 89 insertions(+) diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index b3436601206..b60a6ae96c2 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -49,9 +49,14 @@ var Eth = function Eth(connectionModel, packageFactory, coreFactory, subscriptio /** * Gets and executes subscription for an given type * + * @method subscribe + * * @param {String} type * @param {array} parameters * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {eventifiedPromise | Subscription} */ Eth.prototype.subscribe = function (type, parameters, callback) { return this.subscriptionsResolver.resolve(type, parameters, callback); @@ -60,6 +65,8 @@ Eth.prototype.subscribe = function (type, parameters, callback) { /** * Sends the JSON-RPC request web3_clientVersion and gets the node information * + * @method getNodeInfo + * * @param {Function} callback * * @callback callback callback(error, result) @@ -72,6 +79,8 @@ Eth.prototype.getNodeInfo = function (callback) { /** * Sends the JSON-RPC request eth_protocolVersion and gets the protocol version. * + * @method getProtocolVersion + * * @param {Function} callback * * @callback callback callback(error, result) @@ -84,6 +93,8 @@ Eth.prototype.getProtocolVersion = function (callback) { /** * Sends the JSON-RPC request eth_coinbase and gets the coinbase * + * @method getCoinbase + * * @param {Function} callback * * @callback callback callback(error, result) @@ -96,6 +107,8 @@ Eth.prototype.getCoinbase = function (callback) { /** * Sends the JSON-RPC request eth_mining and checks if the node is mining * + * @method isMining + * * @param {Function} callback * * @callback callback callback(error, result) @@ -108,6 +121,8 @@ Eth.prototype.isMining = function (callback) { /** * Sends the JSON-RPC request eth_hashrate and returns the current hashrate * + * @method getHashrate + * * @param {Function} callback * * @callback callback callback(error, result) @@ -126,6 +141,8 @@ Eth.prototype.getHashrate = function (callback) { /** * Sends the JSON-RPC request eth_syncing and checks if the node is syncing * + * @method isSyncing + * * @param {Function} callback * * @callback callback callback(error, result) @@ -144,6 +161,8 @@ Eth.prototype.isSyncing = function (callback) { /** * Sends the JSON-RPC request eth_gasPrice and returns the current gasPrice from this node * + * @method getGasPrice + * * @param {Function} callback * * @callback callback callback(error, result) @@ -162,6 +181,8 @@ Eth.prototype.getGasPrice = function (callback) { /** * Sends the JSON-RPC request eth_accounts and returns a list of addresses owned by client. * + * @method getAccounts + * * @param {Function} callback * * @callback callback callback(error, result) @@ -180,6 +201,8 @@ Eth.prototype.getAccounts = function (callback) { /** * Sends the JSON-RPC request eth_blockNumber and returns the current block number. * + * @method getBlockNumber + * * @param {Function} callback * * @callback callback callback(error, result) @@ -198,6 +221,8 @@ Eth.prototype.getBlockNumber = function (callback) { /** * Sends the JSON-RPC request eth_getBalance and returns the balance of an address * + * @method getBalance + * * @param {String} address * @param {number} block * @param {Function} callback @@ -225,6 +250,8 @@ Eth.prototype.getBalance = function (address, block, callback) { /** * Sends the JSON-RPC request eth_getStorageAt and returns the value from a storage position at a given address * + * @method getStorageAt + * * @param {String} address * @param {number} position * @param {number} block @@ -254,6 +281,8 @@ Eth.prototype.getStorageAt = function (address, position, block, callback) { /** * Sends the JSON-RPC request eth_getCode and returns the code of a contract at a given address * + * @method getCode + * * @param {String} address * @param {number} block * @param {Function} callback @@ -281,6 +310,8 @@ Eth.prototype.getCode = function (address, block, callback) { /** * Sends the JSON-RPC request eth_getBlockByNumber and returns a block by his number. * + * @method getBlockByNumber + * * @param {number} blockNumber * @param {boolean} returnTransactionObjects * @param {Function} callback @@ -306,6 +337,8 @@ Eth.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects /** * Sends the JSON-RPC request eth_getBlockByHash and return a block by his hash. * + * @method getBlockByHash + * * @param {String} blockHash * @param {boolean} returnTransactionObjects * @param {Function} callback @@ -333,6 +366,8 @@ Eth.prototype.getBlockByHash = function (blockHash, returnTransactionObjects, ca * * TODO: Define this method as deprecated * + * @method getBlock + * * @param {String|number} blockHashOrBlockNumber * @param {boolean} returnTransactionObjects * @param {Function} callback @@ -353,6 +388,8 @@ Eth.prototype.getBlock = function (blockHashOrBlockNumber, returnTransactionObje * * TODO: Define this method as deprecated * + * @method getUncle + * * @param {String|number} blockHashOrBlockNumber * @param {number} uncleIndex * @param {Function} callback @@ -371,6 +408,8 @@ Eth.prototype.getUncle = function (blockHashOrBlockNumber, uncleIndex, callback) /** * Sends the JSON-RPC request eth_getUncleByBlockNumberAndIndex and returns the uncle block by his number and index * + * @method getUncleByBlockNumber + * * @param {number} blockNumber * @param {number} uncleIndex * @param {Function} callback @@ -394,6 +433,8 @@ Eth.prototype.getUncleByBlockNumber = function (blockNumber, uncleIndex, callbac /** * Sends the JSON-RPC request eth_getUncleByBlockHashAndIndex and returns the uncle block by his hash and index * + * @method getUnlceByBlockHash + * * @param {String} blockHash * @param {number} uncleIndex * @param {Function} callback @@ -419,6 +460,8 @@ Eth.prototype.getUnlceByBlockHash = function (blockHash, uncleIndex, callback) { * * TODO: Define this method as deprecated * + * @method getBlockTransactionCount + * * @param {String|number} blockHashOrBlockNumber * @param {Function} callback * @@ -437,6 +480,8 @@ Eth.prototype.getBlockTransactionCount = function (blockHashOrBlockNumber, callb * Sends the JSON-RPC request eth_getBlockTransactionCountByNumber and returns the block transaction count * from a block by his number * + * @method getBlockTransactionCountByBlockNumber + * * @param {number} blockNumber * @param {Function} callback * @@ -459,6 +504,8 @@ Eth.prototype.getBlockTransactionCountByBlockNumber = function (blockNumber, cal * Sends the JSON-RPC request eth_getBlockTransactionCountByHash and returns the block transaction count * from a block by his hash * + * @method getBlockTransactionCountByBlockHash + * * @param {String} blockHash * @param {Function} callback * @@ -482,6 +529,8 @@ Eth.prototype.getBlockTransactionCountByBlockHash = function (blockHash, callbac * * TODO: Define this method as deprecated * + * @method getBlockUncleCount + * * @param {String|number} blockHashOrBlockNumber * @param {Function} callback * @@ -499,6 +548,8 @@ Eth.prototype.getBlockUncleCount = function (blockHashOrBlockNumber, callback) { /** * Sends the JSON-RPC request eth_getUncleCountByBlockHash and returns the uncle count of a block by his hash * + * @method getBlockUncleCountByBlockHash + * * @param {String} blockHash * @param {Function} callback * @@ -520,6 +571,8 @@ Eth.prototype.getBlockUncleCountByBlockHash = function (blockHash, callback) { /** * Sends the JSON-RPC request eth_getUncleCountByBlockHash and returns the uncle count of a block by his number * + * @method getBlockUncleCountByBlockNumber + * * @param {number} blockNumber * @param {Function} callback * @@ -541,6 +594,8 @@ Eth.prototype.getBlockUncleCountByBlockNumber = function (blockNumber, callback) /** * Sends the JSON-RPC request eth_getTransactionByHash and returns the transaction by his hash * + * @method getTransaction + * * @param {String} transactionHash * @param {Function} callback * @@ -562,6 +617,8 @@ Eth.prototype.getTransaction = function (transactionHash, callback) { * * TODO: Define this method as deprecated * + * @method getTransactionFromBlock + * * @param {String|number} hashStringOrNumber * @param {number} indexNumber * @param {Function} callback @@ -580,6 +637,8 @@ Eth.prototype.getTransactionFromBlock = function (hashStringOrNumber, indexNumbe * Sends the JSON-RPC request eth_getTransactionByBlockHashAndIndex and returns a transaction * by his index from a block with the block hash. * + * @method getTransactionFromBlockByBlockHash + * * @param {String} transactionHash * @param {number} indexNumber * @param {Function} callback @@ -604,6 +663,8 @@ Eth.prototype.getTransactionFromBlockByBlockHash = function (transactionHash, in * Sends the JSON-RPC request eth_getTransactionByBlockHashAndIndex and returns a transaction * by his index from a block with the block number. * + * @method getTransactionFromBlockByBlockNumber + * * @param {number} blockNumber * @param {number} indexNumber * @param {Function} callback @@ -627,6 +688,8 @@ Eth.prototype.getTransactionFromBlockByBlockNumber = function (blockNumber, inde /** * Sends the JSON-RPC request eth_getTransactionReceipt and returns the transaction receipt by his transaction hash * + * @method getTransactionReceipt + * * @param {String} transactionHash * @param {Function} callback * @@ -646,6 +709,8 @@ Eth.prototype.getTransactionReceipt = function (transactionHash, callback) { /** * Sends the JSON-RPC request eth_getTransactionCount and returns the transaction count of an address * + * @method getTransactionCount + * * @param {String} address * @param {number} block * @param {Function} callback @@ -673,6 +738,8 @@ Eth.prototype.getTransactionCount = function (address, block, callback) { /** * Sends the JSON-RPC request eth_sendRawTransaction and returns the transaction hash * + * @method sendSignedTransaction + * * @param {String} signedTransactionData * @param {Function} callback * @@ -692,6 +759,8 @@ Eth.prototype.sendSignedTransaction = function (signedTransactionData, callback) /** * Sends the JSON-RPC request eth_signTransaction and returns the signed transaction * + * @method signTransaction + * * @param {Object} transactionObject * @param {Function} callback * @@ -711,6 +780,8 @@ Eth.prototype.signTransaction = function (transactionObject, callback) { /** * Sends the JSON-RPC request eth_sendTransaction and returns the transaction hash * + * @method sendTransaction + * * @param {Object} transactionObject * @param {Function} callback * @@ -730,6 +801,8 @@ Eth.prototype.sendTransaction = function (transactionObject, callback) { /** * Sends the JSON-RPC request eth_sign and returns the signed data * + * @method sign + * * @param {String} dataToSign * @param {String} address * @param {Function} callback @@ -753,6 +826,8 @@ Eth.prototype.sign = function (dataToSign, address, callback) { /** * Sends the JSON-RPC request eth_call and returns the return value of the executed contract * + * @method call + * * @param {Object} callObject * @param {Number|String} block * @param {Function} callback @@ -780,6 +855,8 @@ Eth.prototype.call = function (callObject, block, callback) { /** * Sends the JSON-RPC request eth_estimateGas and returns the estimated gas * + * @method estimateGas + * * @param {Object} callObject * @param {Function} callback * @@ -799,6 +876,8 @@ Eth.prototype.estimateGas = function (callObject, callback) { /** * Sends the JSON-RPC request eth_submitWork and returns the validation result * + * @method submitWork + * * @param {String} nonce * @param {String} powHash * @param {String} digest @@ -821,6 +900,8 @@ Eth.prototype.submitWork = function (nonce, powHash, digest, callback) { * Sends the JSON-RPC request eth_getWork and returns the hash of the current block, the seedHash, and the * boundary condition to be met ("target"). * + * @method getWork + * * @param {Function} callback * * @callback callback callback(error, result) @@ -839,6 +920,8 @@ Eth.prototype.getWork = function (callback) { /** * Sends the JSON-RPC request eth_getLogs and returns an array of all logs matching a given filter object * + * @method getPastLogs + * * @param {Object} options * @param {Function} callback * @@ -858,6 +941,8 @@ Eth.prototype.getPastLogs = function (options, callback) { /** * Determines if given block parameter is of type hash or number * + * @method isBlockHash + * * @param {String|Number} blockParameter * @returns {boolean} */ diff --git a/packages/web3-eth/src/factories/EthPackageFactory.js b/packages/web3-eth/src/factories/EthPackageFactory.js index 3a04f42e465..4546f2e5b74 100644 --- a/packages/web3-eth/src/factories/EthPackageFactory.js +++ b/packages/web3-eth/src/factories/EthPackageFactory.js @@ -31,6 +31,8 @@ function EthPackageFactory () { } /** * Returns object of type SubscriptionsResolver * + * @method createSubscriptionsResolver + * * @param {Object} provider * @param {CoreFactory} coreFactory * @@ -43,6 +45,8 @@ EthPackageFactory.prototype.createSubscriptionsResolver = function (provider, co /** * Returns object of type Eth * + * @method createEth + * * @param {ConnectionModel} connectionModel * @param {PackageFactory} packageFactory * @param {CoreFactory} coreFactory From 149e8153d94a399699ae87fd3e5a45c54bcb2796 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 14:44:55 +0200 Subject: [PATCH 0065/1045] CodeStyle improved --- packages/web3-core-batch/src/Batch.js | 1 + .../web3-core-method/lib/AbstractSigner.js | 3 +- packages/web3-core-method/src/Method.js | 45 +++++-- .../src/factories/MethodPackageFactory.js | 29 ++++- .../models/TransactionConfirmationModel.js | 6 + .../src/signers/MessageSigner.js | 5 + .../src/signers/TransactionSigner.js | 4 +- .../validators/TransactionReceiptValidator.js | 15 ++- .../src/watchers/NewHeadsWatcher.js | 6 +- .../TransactionConfirmationWorkflow.js | 25 ++-- .../lib/adapters/AbstractProviderAdapter.js | 13 +- .../lib/mappers/JSONRpcMapper.js | 10 +- .../validators/JSONRpcResponseValidator.js | 4 + .../src/adapters/HttpProviderAdapter.js | 15 ++- .../src/adapters/InpageProviderAdapter.js | 20 +++- .../src/adapters/SocketProviderAdapter.js | 27 ++++- .../src/detectors/ProviderDetector.js | 8 ++ .../src/factories/ProvidersPackageFactory.js | 19 +++ .../src/providers/HttpProvider.js | 31 +++-- .../src/providers/IpcProvider.js | 34 +++++- .../src/providers/WebsocketProvider.js | 113 ++++++++++++------ .../src/resolvers/ProviderAdapterResolver.js | 31 +++-- .../src/Subscription.js | 28 ++++- packages/web3-eth/src/Eth.js | 2 +- packages/web3/src/factories/CoreFactory.js | 20 +++- packages/web3/src/models/ConnectionModel.js | 22 +++- 26 files changed, 431 insertions(+), 105 deletions(-) diff --git a/packages/web3-core-batch/src/Batch.js b/packages/web3-core-batch/src/Batch.js index e97433bd185..7bb3505b60a 100644 --- a/packages/web3-core-batch/src/Batch.js +++ b/packages/web3-core-batch/src/Batch.js @@ -34,6 +34,7 @@ var Batch = function (provider) { * Should be called to add create new request to batch request * * @method add + * * @param {Object} request */ Batch.prototype.add = function (request) { diff --git a/packages/web3-core-method/lib/AbstractSigner.js b/packages/web3-core-method/lib/AbstractSigner.js index 61a5c42042b..2c9ab05464e 100644 --- a/packages/web3-core-method/lib/AbstractSigner.js +++ b/packages/web3-core-method/lib/AbstractSigner.js @@ -25,8 +25,7 @@ var _ = require('underscore'); /** - * - * @param {Object} accounts + * @param {Accounts} accounts * @constructor */ function AbstractSigner(accounts) { diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index 84bd6ddc0d1..23109907dba 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -27,15 +27,16 @@ var _ = require('underscore'); /** * @param {Object} provider - * @param {Object} accounts + * @param {Accounts} accounts * @param {string} rpcMethod * @param {array} parameters * @param {array} inputFormatters * @param {Function} outputFormatter - * @param {Object} promiEvent - * @param {Object} transactionConfirmationWorkflow - * @param {Object} transactionSigner - * @param {Object} messageSigner + * @param {PromiEvent} promiEvent + * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow + * @param {TransactionSigner} transactionSigner + * @param {MessageSigner} messageSigner + * * @constructor */ function Method( @@ -65,6 +66,8 @@ function Method( /** * Sends the JSON-RPC request * + * @method send + * * @param {Function} callback * * @callback callback callback(error, result) @@ -107,6 +110,8 @@ Method.prototype.send = function (callback) { /** * Sends a JSON-RPC call request * + * @method call + * * @param {Function} callback * * @callback callback callback(error, result) @@ -123,9 +128,13 @@ Method.prototype.call = function (callback) { /** * Formats the output of an JSON-RPC call request * + * @method formatOutput + * * @param {array | string} response - * @param callback - * @returns {*} + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {array | string} */ Method.prototype.formatOutput = function (response, callback) { var self = this; @@ -156,6 +165,8 @@ Method.prototype.formatOutput = function (response, callback) { /** * Sends the JSON-RPC sendTransaction request * + * @method sendTransaction + * * @param {string} gasPrice * @param {Function} callback * @@ -187,7 +198,9 @@ Method.prototype.sendTransaction = function (gasPrice, callback) { }; /** - * Should be called to get the request which can be used in a batch request + * Should be called to get the request which can be used in a batch request + * + * @method request * * @returns {Function} */ @@ -198,7 +211,9 @@ Method.prototype.request = function () { /** * Formats the input parameters * - * @param parameters + * @method formatInput + * + * @param {array} parameters * * @returns {array} */ @@ -211,6 +226,8 @@ Method.prototype.formatInput = function (parameters) { /** * Gets the gasPrice with the eth_gasPrice RPC call. * + * @method getGasPrice + * * @returns {Promise} */ Method.prototype.getGasPrice = function () { @@ -220,6 +237,8 @@ Method.prototype.getGasPrice = function () { /** * Determines if the JSON-RPC method is sendTransaction * + * @method isSendTransaction + * * @param {string} rpcMethod * * @returns {boolean} @@ -231,6 +250,8 @@ Method.prototype.isSendTransaction = function (rpcMethod) { /** * Determines if the JSON-RPC method is sendRawTransaction * + * @method isSendRawTransaction + * * @param {string} rpcMethod * * @returns {boolean} @@ -242,6 +263,8 @@ Method.prototype.isSendRawTransaction = function (rpcMethod) { /** * Determines if the JSON-RPC method is sign. * + * @method isSign + * * @param {string} rpcMethod * * @returns {boolean} @@ -253,6 +276,8 @@ Method.prototype.isSign = function (rpcMethod) { /** * Determines if gasPrice is defined in the method options * + * @method isGasPriceDefined + * * @returns {boolean} */ Method.prototype.isGasPriceDefined = function () { @@ -262,6 +287,8 @@ Method.prototype.isGasPriceDefined = function () { /** * Check if wallets are defined in the accounts package * + * @method hasWallets + * * @returns {boolean} */ Method.prototype.hasWallets = function() { diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index 55e8127ef1b..1715a38346a 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -30,12 +30,17 @@ var TransactionReceiptValidator = require('../validators/TransactionReceiptValid var NewHeadsWatcher = require('../watchers/NewHeadsWatcher'); +/** + * @constructor + */ function MethodPackageFactory() { } /** * Return Method object * + * @method createMethod + * * @param {Object} provider * @param {CoreFactory} coreFactory * @param {string} rpcMethod @@ -70,10 +75,14 @@ MethodPackageFactory.prototype.createMethod = function ( }; /** - * Return TransactionConfirmationWorkflow object + * Returns TransactionConfirmationWorkflow object + * + * @method createTransactionConfirmationWorkflow * * @param {Object} provider * @param {CoreFactory} coreFactory + * + * @returns {TransactionConfirmationWorkflow} */ MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (provider, coreFactory) { new TransactionConfirmationWorkflow( @@ -84,10 +93,24 @@ MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function ); }; +/** + * Returns TransactionSigner object + * + * @method createTransactionSigner + * + * @returns {TransactionSigner} + */ MethodPackageFactory.prototype.createTransactionSigner = function () { - new TransactionSigner(); + return new TransactionSigner(); }; +/** + * Returns MessageSigner object + * + * @method createMessageSigner + * + * @returns {MessageSigner} + */ MethodPackageFactory.prototype.createMessageSigner = function () { new MessageSigner(); }; @@ -95,6 +118,8 @@ MethodPackageFactory.prototype.createMessageSigner = function () { /** * Returns TransactionConfirmationModel object * + * @method createTransactionConfirmationModel + * * @returns {TransactionConfirmationModel} */ MethodPackageFactory.prototype.createTransactionConfirmationModel = function() { diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index 52c2559b797..f53578c5e53 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -81,6 +81,8 @@ Object.defineProperty(TransactionConfirmationModel, 'confirmationsCount', { /** * Adds a receipt to the confirmation array * + * @method addConfirmation + * * @param {Object} receipt */ TransactionConfirmationModel.prototype.addConfirmation = function (receipt) { @@ -90,6 +92,8 @@ TransactionConfirmationModel.prototype.addConfirmation = function (receipt) { /** * Checks if enough confirmations are registered to set the transaction as approved * + * @method isConfirmed + * * @returns {boolean} */ TransactionConfirmationModel.prototype.isConfirmed = function () { @@ -99,6 +103,8 @@ TransactionConfirmationModel.prototype.isConfirmed = function () { /** * Checks if the timeout time is exceeded * + * @method isTimeoutTimeExceeded + * * @returns {boolean} */ TransactionConfirmationModel.prototype.isTimeoutTimeExceeded = function (watcherIsPolling) { diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 001bc47efcf..aae7bf784ee 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -24,11 +24,16 @@ var AbstractSigner = require('../../AbstractSigner'); +/** + * @constructor + */ function MessageSigner() { } /** * Signs a given message * + * @method sign + * * @param {string} data * @param {any} address * diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index e9a5d390488..9334acbe866 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -29,9 +29,11 @@ function TransactionSigner() { } /** * Signs the given transaction * + * @method sign + * * @param {Object} transaction * - * @returns {any} + * @returns {boolean | string} */ TransactionSigner.prototype.sign = function (transaction) { var wallet = this.getWallet(transaction.from); diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index fbb9d952402..dc9db022824 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -22,12 +22,17 @@ "use strict"; +/** + * @constructor + */ function TransactionReceiptValidator() { } /** * Validates the receipt * - * @param {Obejct} receipt + * @method validate + * + * @param {Object} receipt * * @returns {Error | boolean} */ @@ -46,6 +51,10 @@ TransactionReceiptValidator.prototype.validate = function (receipt) { }; /** + * Checks if receipt status is valid + * + * @method isValidReceiptStatus + * * @param {Object} receipt * * @returns {boolean} @@ -55,6 +64,10 @@ TransactionReceiptValidator.prototype.isValidReceiptStatus = function (receipt) }; /** + * Checks it is a valid gas usage + * + * @method isValidGasUsage + * * @param {Object} receipt * * @returns {boolean} diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 7ccc2e3a3fd..f21271c9664 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -22,7 +22,7 @@ /** * @param {Object} provider - * @param {Object} coreFactory + * @param {CoreFactory} coreFactory * @constructor */ function NewHeadsWatcher(provider, coreFactory) { @@ -36,6 +36,8 @@ function NewHeadsWatcher(provider, coreFactory) { /** * Starts subscription on newHeads if supported or creates an interval to get the newHeads * + * @method watch + * * @param {String} transactionHash * * @returns {this} @@ -63,6 +65,8 @@ NewHeadsWatcher.prototype.watch = function (transactionHash) { /** * Clears the interval and unsubscribes the subscription + * + * @method stop */ NewHeadsWatcher.prototype.stop = function () { if(this.confirmationSubscription) { diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index b49649c89a6..17de5a4e1fe 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -24,9 +24,10 @@ /** * @param {Object} provider - * @param {Object} transactionConfirmationModel - * @param {Object} transactionReceiptValidator - * @param {Object} newHeadsWatcher + * @param {TransactionConfirmationModel} transactionConfirmationModel + * @param {TransactionReceiptValidator} transactionReceiptValidator + * @param {NewHeadsWatcher} newHeadsWatcher + * * @constructor */ function TransactionConfirmationWorkflow( @@ -44,6 +45,8 @@ function TransactionConfirmationWorkflow( /** * Executes the transaction confirmation workflow * + * @method execute + * * @param {string} transactionHash * @param {Object} promiEvent * @param {Function} callback @@ -118,10 +121,14 @@ TransactionConfirmationWorkflow.prototype.execute = function ( /** * Get receipt by transaction hash * + * @method execute + * * @param {string} transactionHash + * + * @returns {Promise} */ TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (transactionHash) { - this.provider.send('eth_getTransactionReceipt', transactionHash).then(function (receipt) { + return this.provider.send('eth_getTransactionReceipt', transactionHash).then(function (receipt) { return this.formatters.outputTransactionReceiptFormatter(receipt); }) }; @@ -129,8 +136,10 @@ TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (tran /** * Resolves promise, emits receipt event, calls callback and removes all the listeners. * + * @method handleSuccessState + * * @param {Object} receipt - * @param {Object} promiEvent + * @param {PromiEvent} promiEvent * @param {Function} callback * * @callback callback callback(error, result) @@ -146,8 +155,10 @@ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt /** * Rejects promise, emits error event, calls callback and removes all the listeners. * - * @param {Object} error - * @param {Object} promiEvent + * @method handleErrorState + * + * @param {Error} error + * @param {PromiEvent} promiEvent * @param {Function} callback * * @callback callback callback(error, result) diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js index 26798886f7b..9c646857991 100644 --- a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js @@ -28,6 +28,7 @@ var errors = require('web3-core-helpers').errors; /** * @param {Object} provider + * * @constructor */ function AbstractProviderAdapter(provider) { @@ -36,9 +37,13 @@ function AbstractProviderAdapter(provider) { /** * Sends the JSON-RPC request + * + * @method send + * * @param {string} method - * @param {Array} parameters - * @returns {Promise} + * @param {array} parameters + * + * @returns {Promise} */ AbstractProviderAdapter.prototype.send = function (method, parameters) { var self = this; @@ -53,6 +58,10 @@ AbstractProviderAdapter.prototype.send = function (method, parameters) { }; /** + * Handles the JSON-RPC response + * + * @method handleResponse + * * @param {Function} reject * @param {Function} resolve * @param {Object} error diff --git a/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js b/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js index dd6c4754f17..5b14f2a0f74 100644 --- a/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js +++ b/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js @@ -33,8 +33,10 @@ var JSONRpcMapper = { * Should be called to valid json create payload object * * @method toPayload + * * @param {Function} method of jsonrpc call, required - * @param {Array} params, an array of method params, optional + * @param {array} params, an array of method params, optional + * * @returns {Object} valid jsonrpc payload object */ JSONRpcMapper.toPayload = function (method, params) { @@ -57,8 +59,10 @@ JSONRpcMapper.toPayload = function (method, params) { * Should be called to create batch payload object * * @method toBatchPayload - * @param {Array} messages, an array of objects with method (required) and params (optional) fields - * @returns {Array} batch payload + * + * @param {array} messages, an array of objects with method (required) and params (optional) fields + * + * @returns {array} batch payload */ JSONRpcMapper.toBatchPayload = function (messages) { return messages.map(function (message) { diff --git a/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js b/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js index cdf6df1229a..61ce57d0140 100644 --- a/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js +++ b/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js @@ -28,7 +28,9 @@ var JSONRpcResponseValidator = {}; * Executes JSON-RPC response validation * * @method isValid + * * @param {Object} response + * * @returns {Boolean} true if response is valid, otherwise false */ JSONRpcResponseValidator.isValid = function (response) { @@ -43,7 +45,9 @@ JSONRpcResponseValidator.isValid = function (response) { * Checks if jsonrpc response is valid * * @method validateSingleMessage + * * @param {Object} response + * * @returns {Boolean} true if response is valid, otherwise false */ JSONRpcResponseValidator.validateSingleMessage = function (response) { diff --git a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js index 5d6ba2fe754..8de542ea5e5 100644 --- a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js @@ -25,7 +25,8 @@ var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapter'); /** - * @param {Object} httpProvider + * @param {HttpProvider} httpProvider + * * @constructor */ function HttpProviderAdapter (httpProvider) { @@ -34,6 +35,10 @@ function HttpProviderAdapter (httpProvider) { /** + * Returns promise with an error because HTTP does not support subscriptions + * + * @method subscribe + * * @returns {Promise} */ HttpProviderAdapter.prototype.subscribe = function () { @@ -44,6 +49,10 @@ HttpProviderAdapter.prototype.subscribe = function () { }; /** + * Returns promise with an error because HTTP does not support subscriptions + * + * @method unsubscribe + * * @returns {Promise} */ HttpProviderAdapter.prototype.unsubscribe = function () { @@ -54,6 +63,10 @@ HttpProviderAdapter.prototype.unsubscribe = function () { }; /** + * Checks if the provider is connected + * + * @method isConnected + * * @returns {boolean} */ HttpProviderAdapter.prototype.isConnected = function () { diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js index 1ee956fe223..dd8dabc2408 100644 --- a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js @@ -28,6 +28,7 @@ var errors = require('web3-core-helpers').errors; /** * @param {Object} inpageProvider + * * @constructor */ function InpageProviderAdapter(inpageProvider) { @@ -37,8 +38,11 @@ function InpageProviderAdapter(inpageProvider) { } /** - * @param {Array} payloadBatch - * @returns {Promise} + * Sends batch request + * + * @param {array} payloadBatch + * + * @returns {Promise} */ InpageProviderAdapter.prototype.sendBatch = function (payloadBatch) { return new Promise(function (resolve, reject) { @@ -58,6 +62,10 @@ InpageProviderAdapter.prototype.sendBatch = function (payloadBatch) { }; /** + * Returns promise with an error because the inpageProvider does not support subscriptions + * + * @method subscribe + * * @returns {Promise} */ InpageProviderAdapter.prototype.subscribe = function () { @@ -67,6 +75,10 @@ InpageProviderAdapter.prototype.subscribe = function () { }; /** + * Returns promise with an error because the inpageProvider does not support subscriptions + * + * @method unsubscribe + * * @returns {Promise} */ InpageProviderAdapter.prototype.unsubscribe = function () { @@ -76,6 +88,10 @@ InpageProviderAdapter.prototype.unsubscribe = function () { }; /** + * Checks if the provider is connected + * + * @method isConnected + * * @returns {boolean} */ InpageProviderAdapter.prototype.isConnected = this.provider.isConnected; diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index 5759395a88c..5a3ac46a132 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -26,6 +26,7 @@ var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapte /** * @param {Object} provider + * * @constructor */ function SocketProviderAdapter(provider) { @@ -35,8 +36,13 @@ function SocketProviderAdapter(provider) { } /** + * Subscribes to a given subscriptionType + * + * @method subscribe + * * @param {string} subscriptionType * @param {Array} parameters + * * @returns {Promise} */ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, parameters) { @@ -54,7 +60,12 @@ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, paramete }; /** + * Unsubscribes the subscription by his id + * + * @method unsubscribe + * * @param {string} subscriptionId + * * @returns {Promise} */ SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId) { @@ -73,11 +84,14 @@ SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId) { /** * Emits an event with the subscription id + * + * @method registerSubscriptionListener */ SocketProviderAdapter.prototype.registerSubscriptionListener = function () { var self = this; this.provider.on('data', function (response, deprecatedResponse) { - response = response || deprecatedResponse; // this is for possible old providers, which may had the error first handler + // this is for possible old providers, which may had the error first handler + response = response || deprecatedResponse; // check for result.method, to prevent old providers errors to pass as result if (response.method && self.subscriptions[response.params.subscription]) { @@ -88,6 +102,8 @@ SocketProviderAdapter.prototype.registerSubscriptionListener = function () { /** * Clears all subscriptions and listeners + * + * @method clearSubscriptions */ SocketProviderAdapter.prototype.clearSubscriptions = function () { var self = this; @@ -104,7 +120,12 @@ SocketProviderAdapter.prototype.clearSubscriptions = function () { }; /** + * Removes subscription from subscriptions list and unsubscribes it. + * + * @method removeSubscription + * * @param {string} subscriptionId + * * @returns {Promise} */ SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId) { @@ -121,6 +142,10 @@ SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId) { }; /** + * Checks if the provider is connected + * + * @method isConnected + * * @returns {boolean} */ SocketProviderAdapter.prototype.isConnected = function () { diff --git a/packages/web3-core-providers/src/detectors/ProviderDetector.js b/packages/web3-core-providers/src/detectors/ProviderDetector.js index 17934edb306..dee9e0f8c1d 100644 --- a/packages/web3-core-providers/src/detectors/ProviderDetector.js +++ b/packages/web3-core-providers/src/detectors/ProviderDetector.js @@ -27,6 +27,8 @@ function ProviderDetector() { } /** * Detects which provider is given with web3.currentProvider * + * @method detect + * * @returns {Object} provider */ ProviderDetector.prototype.detect = function () { @@ -47,7 +49,10 @@ ProviderDetector.prototype.detect = function () { /** * Checks if the given provider it is of type ipcProviderWrapper * + * @method isIpcProviderWrapper + * * @param {Object} currentProvider + * * @returns {boolean} */ ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { @@ -57,7 +62,10 @@ ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { /** * Adds the on method for the subscriptions to the ipcProviderWrapper * + * @method addSubscriptionsToIpcProviderWrapper + * * @param {Object} provider ipcProviderWrapper + * * @returns {Object} ipcProviderWrapper */ ProviderDetector.prototype.addSubscriptionsToIpcProviderWrapper = function (provider) { diff --git a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js index fed1f407803..afb4dda5a8f 100644 --- a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js +++ b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js @@ -28,11 +28,16 @@ var WebsocketProvider = require('../providers/WebsocketProvider'); var IpcProvider = require('../providers/IpcProvider'); var HttpProvider = require('../providers/HttpProvider'); +/** + * @constructor + */ function ProvidersPackageFactory() { } /** * Return ProviderAdapterResolver object * + * @method createProviderAdapterResolver + * * @returns {ProviderAdapterResolver} */ ProvidersPackageFactory.prototype.createProviderAdapterResolver = function () { @@ -42,6 +47,8 @@ ProvidersPackageFactory.prototype.createProviderAdapterResolver = function () { /** * Return ProviderDetector object * + * @method createProviderDetector + * * @returns {ProviderDetector} */ ProvidersPackageFactory.prototype.createProviderDetector = function () { @@ -51,6 +58,8 @@ ProvidersPackageFactory.prototype.createProviderDetector = function () { /** * Return HttpProvider object * + * @method createHttpProvider + * * @param {string} url * * @returns {HttpProvider} @@ -62,6 +71,8 @@ ProvidersPackageFactory.prototype.createHttpProvider = function (url) { /** * Return WebsocketProvider object * + * @method createWebsocketProvider + * * @param {string} url * * @returns {WebsocketProvider} @@ -73,6 +84,8 @@ ProvidersPackageFactory.prototype.createWebsocketProvider = function (url) { /** * Return IpcProvider object * + * @method createIpcProvider + * * @param {string} path * @param {Net} net * @@ -85,6 +98,8 @@ ProvidersPackageFactory.prototype.createIpcProvider = function (path, net) { /** * Returns HttpProviderAdapter object * + * @method createHttpProviderAdapter + * * @param {HttpProvider} provider * * @returns {HttpProviderAdapter} @@ -96,6 +111,8 @@ ProvidersPackageFactory.prototype.createHttpProviderAdapter = function (provider /** * Returns SocketProviderAdapter object * + * @method createSocketProviderAdapter + * * @param {WebsocketProvider | IpcProvider} provider * * @returns {SocketProviderAdapter} @@ -107,6 +124,8 @@ ProvidersPackageFactory.prototype.createSocketProviderAdapter = function (provid /** * Returns InpageProviderAdapter object * + * @method createInpageProviderAdapter + * * @param {Object} provider * * @returns {InpageProviderAdapter} diff --git a/packages/web3-core-providers/src/providers/HttpProvider.js b/packages/web3-core-providers/src/providers/HttpProvider.js index 8a4ec985a34..a204310052f 100644 --- a/packages/web3-core-providers/src/providers/HttpProvider.js +++ b/packages/web3-core-providers/src/providers/HttpProvider.js @@ -23,13 +23,15 @@ */ var errors = require('web3-core-helpers').errors; -var XHR2 = require('xhr2-cookies').XMLHttpRequest // jshint ignore: line +var XHR2 = require('xhr2-cookies').XMLHttpRequest; // jshint ignore: line var http = require('http'); var https = require('https'); - /** - * HttpProvider should be used to send rpc calls over http + * @param {string} host + * @param {Object} options + * + * @constructor */ var HttpProvider = function HttpProvider(host, options) { options = options || {}; @@ -44,7 +46,15 @@ var HttpProvider = function HttpProvider(host, options) { this.connected = false; }; -HttpProvider.prototype._prepareRequest = function(){ +/** + * Prepares the HTTP request + * + * @private + * @method _prepareRequest + * + * @returns {FakeXHR2} + */ +HttpProvider.prototype._prepareRequest = function () { var request = new XHR2(); request.nodejsSet({ httpsAgent:this.httpsAgent, @@ -69,8 +79,12 @@ HttpProvider.prototype._prepareRequest = function(){ * Should be used to make async request * * @method send + * * @param {Object} payload - * @param {Function} callback triggered on end with (err, result) + * + * @param {Function} callback + * + * @callback callback callback(error, result) */ HttpProvider.prototype.send = function (payload, callback) { var _this = this; @@ -105,9 +119,10 @@ HttpProvider.prototype.send = function (payload, callback) { } }; -HttpProvider.prototype.disconnect = function () { - //NO OP -}; +/** + * If this method does not exist it will throw en error. + */ +HttpProvider.prototype.disconnect = function () { }; module.exports = HttpProvider; diff --git a/packages/web3-core-providers/src/providers/IpcProvider.js b/packages/web3-core-providers/src/providers/IpcProvider.js index c14b4dcb98c..0273a87c039 100644 --- a/packages/web3-core-providers/src/providers/IpcProvider.js +++ b/packages/web3-core-providers/src/providers/IpcProvider.js @@ -30,6 +30,7 @@ var oboe = require('oboe'); /** * @param {string} path * @param {Net} net + * * @constructor */ var IpcProvider = function IpcProvider(path, net) { @@ -116,11 +117,12 @@ IpcProvider.prototype.addDefaultEvents = function () { /** * Will parse the response and make an array out of it. - * * NOTE, this exists for backwards compatibility reasons. * * @method _parseResponse + * * @param {String} data + * * @returns {Array} */ IpcProvider.prototype._parseResponse = function (data) { @@ -178,6 +180,8 @@ IpcProvider.prototype._parseResponse = function (data) { * which will be called if a response matching the response Id will arrive. * * @method _addResponseCallback + * + * @callback callback callback(error, result) */ IpcProvider.prototype._addResponseCallback = function (payload, callback) { var id = payload.id || payload[0].id; @@ -211,6 +215,16 @@ IpcProvider.prototype.reconnect = function () { }; +/** + * Sends the JSON-RPC the request + * + * @method send + * + * @param {Object} payload + * @param {Function} callback + * + * @callback callback callback(error, result) + */ IpcProvider.prototype.send = function (payload, callback) { // try reconnect, when connection is gone if (!this.connection.writable) { @@ -225,8 +239,11 @@ IpcProvider.prototype.send = function (payload, callback) { * Subscribes to provider events.provider * * @method on + * * @param {String} type 'notification', 'connect', 'error', 'end' or 'data' - * @param {Function} callback the callback to call + * @param {Function} callback + * + * @callback callback callback(error, result) */ IpcProvider.prototype.on = function (type, callback) { if (typeof callback !== 'function') { @@ -249,8 +266,11 @@ IpcProvider.prototype.on = function (type, callback) { * Subscribes to provider events.provider * * @method on + * * @param {String} type 'connect', 'error', 'end' or 'data' - * @param {Function} callback the callback to call + * @param {Function} callback + * + * @callback callback callback(error, result) */ IpcProvider.prototype.once = function (type, callback) { if (typeof callback !== 'function') { @@ -264,8 +284,11 @@ IpcProvider.prototype.once = function (type, callback) { * Removes event listener * * @method removeListener + * * @param {String} type 'data', 'connect', 'error', 'end' or 'data' - * @param {Function} callback the callback to call + * @param {Function} callback + * + * @callback callback callback(error, result) */ IpcProvider.prototype.removeListener = function (type, callback) { var _this = this; @@ -288,7 +311,10 @@ IpcProvider.prototype.removeListener = function (type, callback) { * Removes all event listeners * * @method removeAllListeners + * * @param {String} type 'data', 'connect', 'error', 'end' or 'data' + * + * @callback callback callback(error, result) */ IpcProvider.prototype.removeAllListeners = function (type) { switch (type) { diff --git a/packages/web3-core-providers/src/providers/WebsocketProvider.js b/packages/web3-core-providers/src/providers/WebsocketProvider.js index 7d29861584f..19ea4408301 100644 --- a/packages/web3-core-providers/src/providers/WebsocketProvider.js +++ b/packages/web3-core-providers/src/providers/WebsocketProvider.js @@ -54,11 +54,15 @@ if (typeof window !== 'undefined' && typeof window.WebSocket !== 'undefined') { parseURL = require('url').parse; } } -// Default connection ws://localhost:8546 - - - +/** + * Default connection ws://localhost:8546 + * + * @param {String} url + * @param {Object} options + * + * @constructor + */ var WebsocketProvider = function WebsocketProvider(url, options) { var _this = this; this.responseCallbacks = {}; @@ -134,11 +138,11 @@ var WebsocketProvider = function WebsocketProvider(url, options) { }; /** - Will add the error and end event to timeout existing calls - - @method addDefaultEvents + * Will add the error and end event to timeout existing calls + * + * @method addDefaultEvents */ -WebsocketProvider.prototype.addDefaultEvents = function(){ +WebsocketProvider.prototype.addDefaultEvents = function () { var _this = this; this.connection.onerror = function(){ @@ -158,12 +162,13 @@ WebsocketProvider.prototype.addDefaultEvents = function(){ }; /** - Will parse the response and make an array out of it. - - @method _parseResponse - @param {String} data + * Will parse the response and make an array out of it. + * + * @method _parseResponse + * + * @param {String} data */ -WebsocketProvider.prototype._parseResponse = function(data) { +WebsocketProvider.prototype._parseResponse = function (data) { var _this = this, returnValues = []; @@ -213,10 +218,15 @@ WebsocketProvider.prototype._parseResponse = function(data) { /** - Adds a callback to the responseCallbacks object, - which will be called if a response matching the response Id will arrive. - - @method _addResponseCallback + * Adds a callback to the responseCallbacks object, + * which will be called if a response matching the response Id will arrive. + * + * @method _addResponseCallback + * + * @param {Object} payload + * @param {Function} callback + * + * @callback callback callback(error, result) */ WebsocketProvider.prototype._addResponseCallback = function(payload, callback) { var id = payload.id || payload[0].id; @@ -239,9 +249,9 @@ WebsocketProvider.prototype._addResponseCallback = function(payload, callback) { }; /** - Timeout all requests when the end/error event is fired - - @method _timeout + * Timeout all requests when the end/error event is fired + * + * @method _timeout */ WebsocketProvider.prototype._timeout = function() { for(var key in this.responseCallbacks) { @@ -252,7 +262,16 @@ WebsocketProvider.prototype._timeout = function() { } }; - +/** + * Sends the JSON-RPC request + * + * @method send + * + * @param {Object} payload + * @param {Function} callback + * + * @callback callback callback(error, result) + */ WebsocketProvider.prototype.send = function (payload, callback) { var _this = this; @@ -282,11 +301,14 @@ WebsocketProvider.prototype.send = function (payload, callback) { }; /** - Subscribes to provider events.provider - - @method on - @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' - @param {Function} callback the callback to call + * Subscribes to provider events.provider + * + * @method on + * + * @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + * @param {Function} callback + * + * @callback callback callback(error, result) */ WebsocketProvider.prototype.on = function (type, callback) { @@ -316,14 +338,17 @@ WebsocketProvider.prototype.on = function (type, callback) { } }; -// TODO add once +// TODO: add once /** - Removes event listener - - @method removeListener - @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' - @param {Function} callback the callback to call + * Removes event listener + * + * @method removeListener + * + * @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + * @param {Function} callback + * + * @callback callback callback(error, result) */ WebsocketProvider.prototype.removeListener = function (type, callback) { var _this = this; @@ -345,10 +370,13 @@ WebsocketProvider.prototype.removeListener = function (type, callback) { }; /** - Removes all event listeners - - @method removeAllListeners - @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + * Removes all event listeners + * + * @method removeAllListeners + * + * @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + * + * @callback callback callback(error, result) */ WebsocketProvider.prototype.removeAllListeners = function (type) { switch(type){ @@ -377,9 +405,11 @@ WebsocketProvider.prototype.removeAllListeners = function (type) { }; /** - Resets the providers, clears all callbacks - - @method reset + * Resets the providers, clears all callbacks + * + * @method reset + * + * @callback callback callback(error, result) */ WebsocketProvider.prototype.reset = function () { this._timeout(); @@ -392,6 +422,11 @@ WebsocketProvider.prototype.reset = function () { this.addDefaultEvents(); }; +/** + * Will close the socket connection + * + * @method disconnect + */ WebsocketProvider.prototype.disconnect = function () { if (this.connection) { this.connection.close(); diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index db2e5737c2a..d7c5fcdea45 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -25,33 +25,44 @@ var _ = require('underscore'); /** - * @param {ProviderPackageFactory} providerPackageFactory + * @param {ProvidersPackageFactory} providersPackageFactory + * * @constructor */ -function ProviderAdapterResolver(providerPackageFactory) { - this.providerPackageFactory = providerPackageFactory; +function ProviderAdapterResolver(providersPackageFactory) { + this.providersPackageFactory = providersPackageFactory; } +/** + * Resolves the correct provider with his adapter + * + * @method resolve + * + * @param {Object} provider + * @param {Net} net + * + * @returns {Object} + */ ProviderAdapterResolver.prototype.resolve = function (provider, net) { if (typeof provider === 'string') { // HTTP if (/^http(s)?:\/\//i.test(provider)) { - return this.providerPackageFactory.createHttpProviderAdapter( - this.providerPackageFactory.createHttpProvider(provider) + return this.providersPackageFactory.createHttpProviderAdapter( + this.providersPackageFactory.createHttpProvider(provider) ); } // WS if (/^ws(s)?:\/\//i.test(provider)) { - return this.providerPackageFactory.createSocketProviderAdapter( - this.providerPackageFactory.createWebsocketProvider(provider) + return this.providersPackageFactory.createSocketProviderAdapter( + this.providersPackageFactory.createWebsocketProvider(provider) ); } // IPC if (provider && _.isObject(net) && _.isFunction(net.connect)) { - return this.providerPackageFactory.createSocketProviderAdapter( - this.providerPackageFactory.createIpcProvider(provider, net) + return this.providersPackageFactory.createSocketProviderAdapter( + this.providersPackageFactory.createIpcProvider(provider, net) ); } } @@ -61,7 +72,7 @@ ProviderAdapterResolver.prototype.resolve = function (provider, net) { } if (_.isFunction(provider.sendAsync)) { - return this.providerPackageFactory.createInpageProviderAdapter(provider); + return this.providersPackageFactory.createInpageProviderAdapter(provider); } }; diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 29526855d8f..e355df9eebd 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -31,6 +31,7 @@ var EventEmitter = require('eventemitter3'); * @param {array} parameters * @param {array} inputFormatters * @param {Function} outputFormatter + * * @constructor */ function Subscription(provider, type, parameters, inputFormatters, outputFormatter) { @@ -45,8 +46,11 @@ function Subscription(provider, type, parameters, inputFormatters, outputFormatt /** * Sends the JSON-RPC request, emits the required events and executes the callback method. * + * @method subscribe + * * @param {Function} callback * + * @callback callback callback(error, result) * @returns {Subscription} Subscription */ Subscription.prototype.subscribe = function (callback) { @@ -76,8 +80,13 @@ Subscription.prototype.subscribe = function (callback) { /** * Iterates over each item in the response, formats the output, emits required events and executes the callback method. + * + * @method handleSubscriptionResponse + * * @param {any} response * @param {Function} callback + * + * @callback callback callback(error, result) */ Subscription.prototype.handleSubscriptionResponse = function (response, callback) { if (!_.isArray(response)) { @@ -96,10 +105,14 @@ Subscription.prototype.handleSubscriptionResponse = function (response, callback /** * Reconnects provider and restarts subscription * + * @method reconnect + * * @param {string} type - * @param {*} parameters + * @param {array} parameters * @param {string} subscriptionId * @param {Function} callback + * + * @callback callback callback(error, result) */ Subscription.prototype.reconnect = function (type, parameters, subscriptionId, callback) { var self = this; @@ -127,8 +140,12 @@ Subscription.prototype.reconnect = function (type, parameters, subscriptionId, c /** * Executes outputFormatter if defined * + * @method formatOutput + * * @param {any} output + * * @returns {any} + * @callback callback callback(error, result) */ Subscription.prototype.formatOutput = function (output) { if (_.isFunction(this.outputFormatter) && output) { @@ -141,8 +158,11 @@ Subscription.prototype.formatOutput = function (output) { /** * Executes inputFormatters if defined * + * @method formatInput + * * @param {array} parameters - * @returns {*} + * + * @returns {any} */ Subscription.prototype.formatInput = function (parameters) { if (_.isArray(this.inputFormatters)) { @@ -161,7 +181,11 @@ Subscription.prototype.formatInput = function (parameters) { /** * Unsubscribes subscription * + * @method unsubscribe + * * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {Promise} */ Subscription.prototype.unsubscribe = function (callback) { diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index b60a6ae96c2..b31a53b4711 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -942,7 +942,7 @@ Eth.prototype.getPastLogs = function (options, callback) { * Determines if given block parameter is of type hash or number * * @method isBlockHash - * + * * @param {String|Number} blockParameter * @returns {boolean} */ diff --git a/packages/web3/src/factories/CoreFactory.js b/packages/web3/src/factories/CoreFactory.js index 61174dbff1a..f266d66e46c 100644 --- a/packages/web3/src/factories/CoreFactory.js +++ b/packages/web3/src/factories/CoreFactory.js @@ -33,11 +33,15 @@ function CoreFactory() { } /** * Creates Subscription object * + * @method createSubscription + * * @param {Object} provider * @param {string} type - * @param {*} parameters + * @param {array} parameters * @param {Object} inputFormatter * @param {Object} outputFormatter + * + * @returns {Subscription} */ CoreFactory.prototype.createSubscription = function (provider, type, parameters, inputFormatter, outputFormatter) { return new Subscription(provider, type, parameters, inputFormatter, outputFormatter); @@ -53,6 +57,8 @@ CoreFactory.prototype.createPromiEvent = function () { /** * Creates Method object * + * @method createMethod + * * @param {Object} provider * @param {string} rpcMethod * @param {array} parameters @@ -76,7 +82,9 @@ CoreFactory.prototype.createMethod = function (provider, rpcMethod, parameters, /** * Returns the web3 utilities * - * @returns {Object} + * @method createUtils + * + * @returns {Utils} */ CoreFactory.prototype.createUtils = function () { return Utils; @@ -85,7 +93,9 @@ CoreFactory.prototype.createUtils = function () { /** * Creates Batch object * - * @param {Object} connectionModel + * @method createBatch + * + * @param {ConnectionModel} connectionModel * * @returns {Batch} */ @@ -96,6 +106,8 @@ CoreFactory.prototype.createBatch = function (connectionModel) { /** * Returns the web3 formatters * + * @method createFormatters + * * @returns {Object} */ CoreFactory.prototype.createFormatters = function () { @@ -105,6 +117,8 @@ CoreFactory.prototype.createFormatters = function () { /** * Returns the default web3 errors * + * @method createErrors + * * @returns {Object} */ CoreFactory.prototype.createErrors = function () { diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index af83c0a94d6..e257b04ac47 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -117,7 +117,9 @@ ConnectionModel.prototype.getNetworkType = function (callback) { /** * Executes the JSON-RPC method net_version * - * @param callback + * @method getId + * + * @param {Function} callback * * @callback callback callback(error, result) * @returns {Promise|eventifiedPromise} @@ -129,7 +131,9 @@ ConnectionModel.prototype.getId = function (callback) { /** * Executes the JSON-RPC method net_listening * - * @param callback + * @method isListening + * + * @param {Function} callback * * @callback callback callback(error, result) * @returns {Promise|eventifiedPromise} @@ -141,7 +145,9 @@ ConnectionModel.prototype.isListening = function (callback) { /** * Executes the JSON-RPC method net_peerCount * - * @param callback + * @method getPeerCount + * + * @param {Function} callback * * @callback callback callback(error, result) * @returns {Promise|eventifiedPromise} @@ -153,9 +159,11 @@ ConnectionModel.prototype.getPeerCount = function (callback) { /** * Gets a block by his number * - * @param blockNumber - * @param returnTransactionObjects - * @param callback + * @method getBlockByNumber + * + * @param {Number} blockNumber + * @param {Boolean} returnTransactionObjects + * @param {Function} callback * * @callback callback callback(error, result) * @returns {Promise|eventifiedPromise} @@ -175,6 +183,8 @@ ConnectionModel.prototype.getBlockByNumber = function (blockNumber, returnTransa /** * Returns the network methods for the public API * + * @method getNetworkMethodsAsObject + * * @returns {Object} */ ConnectionModel.prototype.getNetworkMethodsAsObject = function () { From 12341d8ae96ff70c3dd8b12841aa8e76429ca6ec Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 15:10:18 +0200 Subject: [PATCH 0066/1045] types are now uppercase in the funcDocs --- packages/web3-core-method/src/Method.js | 24 +++++------ .../src/factories/MethodPackageFactory.js | 6 +-- .../src/signers/MessageSigner.js | 2 +- .../src/signers/TransactionSigner.js | 2 +- .../TransactionConfirmationWorkflow.js | 4 +- .../lib/adapters/AbstractProviderAdapter.js | 4 +- .../lib/mappers/JSONRpcMapper.js | 6 +-- .../src/adapters/InpageProviderAdapter.js | 2 +- .../src/adapters/SocketProviderAdapter.js | 8 ++-- .../src/factories/ProvidersPackageFactory.js | 6 +-- .../src/providers/HttpProvider.js | 2 +- .../src/providers/IpcProvider.js | 2 +- .../src/Subscription.js | 12 +++--- packages/web3-eth-abi/src/index.js | 4 +- packages/web3-eth-ens/src/ENS.js | 28 ++++++------- .../web3-eth-ens/src/contracts/Registry.js | 4 +- .../src/lib/ResolverMethodHandler.js | 16 +++---- packages/web3-eth/src/Eth.js | 42 +++++++++---------- .../src/resolvers/SubscriptionsResolver.js | 14 +++---- packages/web3-utils/src/utils.js | 2 +- packages/web3/src/factories/CoreFactory.js | 10 ++--- packages/web3/src/models/ConnectionModel.js | 2 +- 22 files changed, 101 insertions(+), 101 deletions(-) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index 23109907dba..6a6bbc38e63 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -28,9 +28,9 @@ var _ = require('underscore'); /** * @param {Object} provider * @param {Accounts} accounts - * @param {string} rpcMethod - * @param {array} parameters - * @param {array} inputFormatters + * @param {String} rpcMethod + * @param {Array} parameters + * @param {Array} inputFormatters * @param {Function} outputFormatter * @param {PromiEvent} promiEvent * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow @@ -130,11 +130,11 @@ Method.prototype.call = function (callback) { * * @method formatOutput * - * @param {array | string} response + * @param {Array | String} response * @param {Function} callback * * @callback callback callback(error, result) - * @returns {array | string} + * @returns {Array | String} */ Method.prototype.formatOutput = function (response, callback) { var self = this; @@ -167,7 +167,7 @@ Method.prototype.formatOutput = function (response, callback) { * * @method sendTransaction * - * @param {string} gasPrice + * @param {String} gasPrice * @param {Function} callback * * @callback callback callback(error, result) @@ -213,9 +213,9 @@ Method.prototype.request = function () { * * @method formatInput * - * @param {array} parameters + * @param {Array} parameters * - * @returns {array} + * @returns {Array} */ Method.prototype.formatInput = function (parameters) { return this.inputFormatters.map(function (formatter, key) { @@ -228,7 +228,7 @@ Method.prototype.formatInput = function (parameters) { * * @method getGasPrice * - * @returns {Promise} + * @returns {Promise} */ Method.prototype.getGasPrice = function () { return this.provider.send('eth_gasPrice', []); @@ -239,7 +239,7 @@ Method.prototype.getGasPrice = function () { * * @method isSendTransaction * - * @param {string} rpcMethod + * @param {String} rpcMethod * * @returns {boolean} */ @@ -252,7 +252,7 @@ Method.prototype.isSendTransaction = function (rpcMethod) { * * @method isSendRawTransaction * - * @param {string} rpcMethod + * @param {String} rpcMethod * * @returns {boolean} */ @@ -265,7 +265,7 @@ Method.prototype.isSendRawTransaction = function (rpcMethod) { * * @method isSign * - * @param {string} rpcMethod + * @param {String} rpcMethod * * @returns {boolean} */ diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index 1715a38346a..cfea3748e1c 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -43,9 +43,9 @@ function MethodPackageFactory() { } * * @param {Object} provider * @param {CoreFactory} coreFactory - * @param {string} rpcMethod - * @param {array} parameters - * @param {array} inputFormatters + * @param {String} rpcMethod + * @param {Array} parameters + * @param {Array} inputFormatters * @param {Function} outputFormatter * @param {PromiEvent} promiEvent * diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index aae7bf784ee..565c310e028 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -34,7 +34,7 @@ function MessageSigner() { } * * @method sign * - * @param {string} data + * @param {String} data * @param {any} address * * @returns {any} diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index 9334acbe866..a3e023d5b1c 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -33,7 +33,7 @@ function TransactionSigner() { } * * @param {Object} transaction * - * @returns {boolean | string} + * @returns {boolean | String} */ TransactionSigner.prototype.sign = function (transaction) { var wallet = this.getWallet(transaction.from); diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 17de5a4e1fe..68d873d9c3c 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -47,7 +47,7 @@ function TransactionConfirmationWorkflow( * * @method execute * - * @param {string} transactionHash + * @param {String} transactionHash * @param {Object} promiEvent * @param {Function} callback * @@ -123,7 +123,7 @@ TransactionConfirmationWorkflow.prototype.execute = function ( * * @method execute * - * @param {string} transactionHash + * @param {String} transactionHash * * @returns {Promise} */ diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js index 9c646857991..9bb7795d3f8 100644 --- a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js @@ -40,8 +40,8 @@ function AbstractProviderAdapter(provider) { * * @method send * - * @param {string} method - * @param {array} parameters + * @param {String} method + * @param {Array} parameters * * @returns {Promise} */ diff --git a/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js b/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js index 5b14f2a0f74..181bc01c1d3 100644 --- a/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js +++ b/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js @@ -35,7 +35,7 @@ var JSONRpcMapper = { * @method toPayload * * @param {Function} method of jsonrpc call, required - * @param {array} params, an array of method params, optional + * @param {Array} params, an Array of method params, optional * * @returns {Object} valid jsonrpc payload object */ @@ -60,9 +60,9 @@ JSONRpcMapper.toPayload = function (method, params) { * * @method toBatchPayload * - * @param {array} messages, an array of objects with method (required) and params (optional) fields + * @param {Array} messages, an array of objects with method (required) and params (optional) fields * - * @returns {array} batch payload + * @returns {Array} batch payload */ JSONRpcMapper.toBatchPayload = function (messages) { return messages.map(function (message) { diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js index dd8dabc2408..6de5aec2d47 100644 --- a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js @@ -40,7 +40,7 @@ function InpageProviderAdapter(inpageProvider) { /** * Sends batch request * - * @param {array} payloadBatch + * @param {Array} payloadBatch * * @returns {Promise} */ diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index 5a3ac46a132..f531d05a215 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -40,10 +40,10 @@ function SocketProviderAdapter(provider) { * * @method subscribe * - * @param {string} subscriptionType + * @param {String} subscriptionType * @param {Array} parameters * - * @returns {Promise} + * @returns {Promise} */ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, parameters) { var self = this; @@ -64,7 +64,7 @@ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, paramete * * @method unsubscribe * - * @param {string} subscriptionId + * @param {String} subscriptionId * * @returns {Promise} */ @@ -124,7 +124,7 @@ SocketProviderAdapter.prototype.clearSubscriptions = function () { * * @method removeSubscription * - * @param {string} subscriptionId + * @param {String} subscriptionId * * @returns {Promise} */ diff --git a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js index afb4dda5a8f..e06f1a317a8 100644 --- a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js +++ b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js @@ -60,7 +60,7 @@ ProvidersPackageFactory.prototype.createProviderDetector = function () { * * @method createHttpProvider * - * @param {string} url + * @param {String} url * * @returns {HttpProvider} */ @@ -73,7 +73,7 @@ ProvidersPackageFactory.prototype.createHttpProvider = function (url) { * * @method createWebsocketProvider * - * @param {string} url + * @param {String} url * * @returns {WebsocketProvider} */ @@ -86,7 +86,7 @@ ProvidersPackageFactory.prototype.createWebsocketProvider = function (url) { * * @method createIpcProvider * - * @param {string} path + * @param {String} path * @param {Net} net * * @returns {IpcProvider} diff --git a/packages/web3-core-providers/src/providers/HttpProvider.js b/packages/web3-core-providers/src/providers/HttpProvider.js index a204310052f..f7b0d3e9ad8 100644 --- a/packages/web3-core-providers/src/providers/HttpProvider.js +++ b/packages/web3-core-providers/src/providers/HttpProvider.js @@ -28,7 +28,7 @@ var http = require('http'); var https = require('https'); /** - * @param {string} host + * @param {String} host * @param {Object} options * * @constructor diff --git a/packages/web3-core-providers/src/providers/IpcProvider.js b/packages/web3-core-providers/src/providers/IpcProvider.js index 0273a87c039..38326627be0 100644 --- a/packages/web3-core-providers/src/providers/IpcProvider.js +++ b/packages/web3-core-providers/src/providers/IpcProvider.js @@ -28,7 +28,7 @@ var oboe = require('oboe'); /** - * @param {string} path + * @param {String} path * @param {Net} net * * @constructor diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index e355df9eebd..285a47ae55c 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -28,8 +28,8 @@ var EventEmitter = require('eventemitter3'); /** * @param {Object} provider * @param {String} type - * @param {array} parameters - * @param {array} inputFormatters + * @param {Array} parameters + * @param {Array} inputFormatters * @param {Function} outputFormatter * * @constructor @@ -107,9 +107,9 @@ Subscription.prototype.handleSubscriptionResponse = function (response, callback * * @method reconnect * - * @param {string} type - * @param {array} parameters - * @param {string} subscriptionId + * @param {String} type + * @param {Array} parameters + * @param {String} subscriptionId * @param {Function} callback * * @callback callback callback(error, result) @@ -160,7 +160,7 @@ Subscription.prototype.formatOutput = function (output) { * * @method formatInput * - * @param {array} parameters + * @param {Array} parameters * * @returns {any} */ diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index eca92c38dc9..24b15398a4b 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -131,7 +131,7 @@ ABICoder.prototype.mapTypes = function (types) { * Check if type is simplified struct format * * @method isSimplifiedStructFormat - * @param {string | Object} type + * @param {String | Object} type * @returns {boolean} */ ABICoder.prototype.isSimplifiedStructFormat = function (type) { @@ -142,7 +142,7 @@ ABICoder.prototype.isSimplifiedStructFormat = function (type) { * Maps the correct tuple type and name when the simplified format in encode/decodeParameter is used * * @method mapStructNameAndType - * @param {string} structName + * @param {String} structName * @return {{type: string, name: *}} */ ABICoder.prototype.mapStructNameAndType = function (structName) { diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index 741eb5b2b4e..9ef972abdf7 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -50,7 +50,7 @@ Object.defineProperty(ENS.prototype, 'resolverMethodHandler', { }); /** - * @param {string} name + * @param {String} name * @returns {Promise} */ ENS.prototype.resolver = function (name) { @@ -61,7 +61,7 @@ ENS.prototype.resolver = function (name) { * Returns the address record associated with a name. * * @method getAddress - * @param {string} name + * @param {String} name * @param {function} callback * @return {eventifiedPromise} */ @@ -73,8 +73,8 @@ ENS.prototype.getAddress = function (name, callback) { * Sets a new address * * @method setAddress - * @param {string} name - * @param {string} address + * @param {String} name + * @param {String} address * @param {Object} sendOptions * @param {function} callback * @returns {eventifiedPromise} @@ -87,7 +87,7 @@ ENS.prototype.setAddress = function (name, address, sendOptions, callback) { * Returns the public key * * @method getPubkey - * @param {string} name + * @param {String} name * @param {function} callback * @returns {eventifiedPromise} */ @@ -99,9 +99,9 @@ ENS.prototype.getPubkey = function (name, callback) { * Set the new public key * * @method setPubkey - * @param {string} name - * @param {string} x - * @param {string} y + * @param {String} name + * @param {String} x + * @param {String} y * @param {Object} sendOptions * @param {function} callback * @returns {eventifiedPromise} @@ -114,7 +114,7 @@ ENS.prototype.setPubkey = function (name, x, y, sendOptions, callback) { * Returns the content * * @method getContent - * @param {string} name + * @param {String} name * @param {function} callback * @returns {eventifiedPromise} */ @@ -126,8 +126,8 @@ ENS.prototype.getContent = function (name, callback) { * Set the content * * @method setContent - * @param {string} name - * @param {string} hash + * @param {String} name + * @param {String} hash * @param {function} callback * @param {Object} sendOptions * @returns {eventifiedPromise} @@ -140,7 +140,7 @@ ENS.prototype.setContent = function (name, hash, sendOptions, callback) { * Get the multihash * * @method getMultihash - * @param {string} name + * @param {String} name * @param {function} callback * @returns {eventifiedPromise} */ @@ -152,8 +152,8 @@ ENS.prototype.getMultihash = function (name, callback) { * Set the multihash * * @method setMultihash - * @param {string} name - * @param {string} hash + * @param {String} name + * @param {String} hash * @param {Object} sendOptions * @param {function} callback * @returns {eventifiedPromise} diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index 783761f8019..bb60ce78e84 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -50,7 +50,7 @@ function Registry(ens) { * Returns the address of the owner of an ENS name. * * @method owner - * @param {string} name + * @param {String} name * @param {function} callback * @return {Promise} */ @@ -82,7 +82,7 @@ Registry.prototype.owner = function (name, callback) { * Returns the resolver contract associated with a name. * * @method resolver - * @param {string} name + * @param {String} name * @return {Promise} */ Registry.prototype.resolver = function (name) { diff --git a/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js b/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js index 39ee146d65a..a1bfe7297cc 100644 --- a/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js +++ b/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js @@ -35,9 +35,9 @@ function ResolverMethodHandler(registry) { /** * Executes an resolver method and returns an eventifiedPromise * - * @param {string} ensName - * @param {string} methodName - * @param {array} methodArguments + * @param {String} ensName + * @param {String} methodName + * @param {Array} methodArguments * @param {function} callback * @returns {Object} */ @@ -106,7 +106,7 @@ ResolverMethodHandler.prototype.send = function (sendOptions, callback) { * * @param {eventifiedPromise} promiEvent * @param {function} method - * @param {array} preparedArguments + * @param {Array} preparedArguments * @param {function} callback * @returns {eventifiedPromise} */ @@ -134,7 +134,7 @@ ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, prepa * * @param {eventifiedPromise} promiEvent * @param {function} method - * @param {array} preparedArguments + * @param {Array} preparedArguments * @param {Object} sendOptions * @param {function} callback * @returns {eventifiedPromise} @@ -170,9 +170,9 @@ ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, prepa /** * Adds the ENS node to the arguments * - * @param {string} name - * @param {array} methodArguments - * @returns {array} + * @param {String} name + * @param {Array} methodArguments + * @returns {Array} */ ResolverMethodHandler.prototype.prepareArguments = function (name, methodArguments) { var node = namehash.hash(name); diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index b31a53b4711..5093028e677 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -52,7 +52,7 @@ var Eth = function Eth(connectionModel, packageFactory, coreFactory, subscriptio * @method subscribe * * @param {String} type - * @param {array} parameters + * @param {Array} parameters * @param {Function} callback * * @callback callback callback(error, result) @@ -224,7 +224,7 @@ Eth.prototype.getBlockNumber = function (callback) { * @method getBalance * * @param {String} address - * @param {number} block + * @param {Number} block * @param {Function} callback * * @callback callback callback(error, result) @@ -253,8 +253,8 @@ Eth.prototype.getBalance = function (address, block, callback) { * @method getStorageAt * * @param {String} address - * @param {number} position - * @param {number} block + * @param {Number} position + * @param {Number} block * @param {Function} callback * * @callback callback callback(error, result) @@ -284,7 +284,7 @@ Eth.prototype.getStorageAt = function (address, position, block, callback) { * @method getCode * * @param {String} address - * @param {number} block + * @param {Number} block * @param {Function} callback * * @callback callback callback(error, result) @@ -312,7 +312,7 @@ Eth.prototype.getCode = function (address, block, callback) { * * @method getBlockByNumber * - * @param {number} blockNumber + * @param {Number} blockNumber * @param {boolean} returnTransactionObjects * @param {Function} callback * @@ -368,7 +368,7 @@ Eth.prototype.getBlockByHash = function (blockHash, returnTransactionObjects, ca * * @method getBlock * - * @param {String|number} blockHashOrBlockNumber + * @param {String|Number} blockHashOrBlockNumber * @param {boolean} returnTransactionObjects * @param {Function} callback * @@ -390,8 +390,8 @@ Eth.prototype.getBlock = function (blockHashOrBlockNumber, returnTransactionObje * * @method getUncle * - * @param {String|number} blockHashOrBlockNumber - * @param {number} uncleIndex + * @param {String|Number} blockHashOrBlockNumber + * @param {Number} uncleIndex * @param {Function} callback * * @callback callback callback(error, result) @@ -410,8 +410,8 @@ Eth.prototype.getUncle = function (blockHashOrBlockNumber, uncleIndex, callback) * * @method getUncleByBlockNumber * - * @param {number} blockNumber - * @param {number} uncleIndex + * @param {Number} blockNumber + * @param {Number} uncleIndex * @param {Function} callback * * @callback callback callback(error, result) @@ -436,7 +436,7 @@ Eth.prototype.getUncleByBlockNumber = function (blockNumber, uncleIndex, callbac * @method getUnlceByBlockHash * * @param {String} blockHash - * @param {number} uncleIndex + * @param {Number} uncleIndex * @param {Function} callback * * @callback callback callback(error, result) @@ -462,7 +462,7 @@ Eth.prototype.getUnlceByBlockHash = function (blockHash, uncleIndex, callback) { * * @method getBlockTransactionCount * - * @param {String|number} blockHashOrBlockNumber + * @param {String|Number} blockHashOrBlockNumber * @param {Function} callback * * @callback callback callback(error, result) @@ -482,7 +482,7 @@ Eth.prototype.getBlockTransactionCount = function (blockHashOrBlockNumber, callb * * @method getBlockTransactionCountByBlockNumber * - * @param {number} blockNumber + * @param {Number} blockNumber * @param {Function} callback * * @callback callback callback(error, result) @@ -573,7 +573,7 @@ Eth.prototype.getBlockUncleCountByBlockHash = function (blockHash, callback) { * * @method getBlockUncleCountByBlockNumber * - * @param {number} blockNumber + * @param {Number} blockNumber * @param {Function} callback * * @callback callback callback(error, result) @@ -619,8 +619,8 @@ Eth.prototype.getTransaction = function (transactionHash, callback) { * * @method getTransactionFromBlock * - * @param {String|number} hashStringOrNumber - * @param {number} indexNumber + * @param {String|Number} hashStringOrNumber + * @param {Number} indexNumber * @param {Function} callback * * @callback callback callback(error, result) @@ -640,7 +640,7 @@ Eth.prototype.getTransactionFromBlock = function (hashStringOrNumber, indexNumbe * @method getTransactionFromBlockByBlockHash * * @param {String} transactionHash - * @param {number} indexNumber + * @param {Number} indexNumber * @param {Function} callback * * @callback callback callback(error, result) @@ -665,8 +665,8 @@ Eth.prototype.getTransactionFromBlockByBlockHash = function (transactionHash, in * * @method getTransactionFromBlockByBlockNumber * - * @param {number} blockNumber - * @param {number} indexNumber + * @param {Number} blockNumber + * @param {Number} indexNumber * @param {Function} callback * * @callback callback callback(error, result) @@ -712,7 +712,7 @@ Eth.prototype.getTransactionReceipt = function (transactionHash, callback) { * @method getTransactionCount * * @param {String} address - * @param {number} block + * @param {Number} block * @param {Function} callback * * @callback callback callback(error, result) diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index 47131920ee5..97830d2d519 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -38,8 +38,8 @@ function SubscriptionsResolver(provider, coreFactory) { * * @method resolve * - * @param {string} type - * @param {array} parameters + * @param {String} type + * @param {Array} parameters * @param {Function} callback * * @callback callback callback(error, result) @@ -69,8 +69,8 @@ SubscriptionsResolver.prototype.resolve = function (type, parameters, callback) * * @method getSubscription * - * @param {string} type - * @param {array} parameters + * @param {String} type + * @param {Array} parameters * @param {Function} inputFormatter * @param {Function} outputFormatter * @param {Function} callback @@ -97,7 +97,7 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in * * @method getLogsSubscription * - * @param {array} parameters + * @param {Array} parameters * @param {Function} callback * * @callback callback callback(error, result) @@ -122,7 +122,7 @@ SubscriptionsResolver.prototype.getLogsSubscription = function (parameters, call * * @method subscribeToLogs * - * @param {array} parameters + * @param {Array} parameters * @param {PromiEvent} promiEvent * @param {Function} callback * @@ -155,7 +155,7 @@ SubscriptionsResolver.prototype.subscribeToLogs = function (parameters, promiEve * * @method handleLogsSubscriptionWithFromBlock * - * @param {array} parameters + * @param {Array} parameters * @param {PromiEvent} promiEvent * @param {Function} callback * diff --git a/packages/web3-utils/src/utils.js b/packages/web3-utils/src/utils.js index 616cce2902b..496c6279db7 100644 --- a/packages/web3-utils/src/utils.js +++ b/packages/web3-utils/src/utils.js @@ -296,7 +296,7 @@ var bytesToHex = function(bytes) { * Note: Implementation from crypto-js * * @method hexToBytes - * @param {string} hex + * @param {String} hex * @return {Array} the byte array */ var hexToBytes = function(hex) { diff --git a/packages/web3/src/factories/CoreFactory.js b/packages/web3/src/factories/CoreFactory.js index f266d66e46c..d1881d612de 100644 --- a/packages/web3/src/factories/CoreFactory.js +++ b/packages/web3/src/factories/CoreFactory.js @@ -36,8 +36,8 @@ function CoreFactory() { } * @method createSubscription * * @param {Object} provider - * @param {string} type - * @param {array} parameters + * @param {String} type + * @param {Array} parameters * @param {Object} inputFormatter * @param {Object} outputFormatter * @@ -60,9 +60,9 @@ CoreFactory.prototype.createPromiEvent = function () { * @method createMethod * * @param {Object} provider - * @param {string} rpcMethod - * @param {array} parameters - * @param {array} inputFormatters + * @param {String} rpcMethod + * @param {Array} parameters + * @param {Array} inputFormatters * @param {Function} outputFormatter * * @returns {Method} diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index e257b04ac47..b7287bc2e3e 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -69,7 +69,7 @@ Object.defineProperty(Eth, 'defaultBlock', { * @param {Function} callback * * @callback callback(error, result) - * @returns {Promise} + * @returns {Promise} */ ConnectionModel.prototype.getNetworkType = function (callback) { var self = this, id; From 4a1e072a4d2ff7ea1f5d9e104a8a5b2173cf951a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 15:28:12 +0200 Subject: [PATCH 0067/1045] Gulp file updated, gitingore improved, packageJsons updated --- .gitignore | 1 + gulpfile.js | 30 +-- package.json | 179 +++++++++--------- packages/web3-core-method/package.json | 2 +- .../web3-core-providers/package-lock.json | 83 ++++++++ packages/web3-eth-contract/package.json | 3 +- packages/web3-eth-ens/package.json | 1 - packages/web3-eth-personal/package.json | 2 - packages/web3/package.json | 101 +++++----- packages/web3/src/index.js | 3 +- 10 files changed, 238 insertions(+), 167 deletions(-) create mode 100644 packages/web3-core-providers/package-lock.json diff --git a/.gitignore b/.gitignore index 46f98b48121..899cf946489 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,6 @@ bower_components .idea/ .npm/ .vscode/ +lerna-debug.log dist/ !./dist/web3.min.js diff --git a/gulpfile.js b/gulpfile.js index 6b568a2cf4f..ac07fa0f077 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -58,10 +58,6 @@ var packages = [{ fileName: 'web3-eth-ens', expose: 'EthEns', src: './packages/web3-eth-ens/src/index.js' -},{ - fileName: 'web3-net', - expose: 'Web3Net', - src: './packages/web3-net/src/index.js' }, { fileName: 'web3-shh', expose: 'Web3Shh', @@ -71,27 +67,13 @@ var packages = [{ expose: 'Web3Bzz', src: './packages/web3-bzz/src/index.js' }, { - fileName: 'web3-providers-ipc', - expose: 'Web3IpcProvider', - src: './packages/web3-providers-ipc/src/index.js' -}, { - fileName: 'web3-providers-http', - expose: 'Web3HttpProvider', - src: './packages/web3-providers-http/src/index.js', - ignore: ['xmlhttprequest'] -}, { - fileName: 'web3-providers-ws', - expose: 'Web3WsProvider', - src: './packages/web3-providers-ws/src/index.js', - ignore: ['websocket'] -}, { - fileName: 'web3-core-subscriptions', - expose: 'Web3Subscriptions', - src: './packages/web3-core-subscriptions/src/index.js' + fileName: 'web3-core-providers', + expose: 'Web3Providers', + src: './packages/web3-core-providers/src/index.js' }, { - fileName: 'web3-core-requestmanager', - expose: 'Web3RequestManager', - src: './packages/web3-core-requestmanager/src/index.js' + fileName: 'web3-core-subscription', + expose: 'Web3Subscription', + src: './packages/web3-core-subscription/src/index.js' }, { fileName: 'web3-core-promievent', expose: 'Web3PromiEvent', diff --git a/package.json b/package.json index 1edf786d58d..3e87665c585 100644 --- a/package.json +++ b/package.json @@ -1,94 +1,99 @@ { - "name": "web3", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Ethereum JavaScript API wrapper repository", - "license": "LGPL-3.0", - "main": "./packages/web3/src/index.js", - "directories": { - "doc": "./doc", - "test": "./test" - }, - "scripts": { - "postinstall": "lerna bootstrap", - "build": "gulp", - "build-all": "gulp all", - "release": "lerna bootstrap; lerna publish; gulp version; gulp; gulp publishTag; git push --tags", - "watch": "gulp watch", - "docs": "cd docs; make html;", - "lint": "jshint *.js packages", - "test": "mocha; jshint *.js packages", - "test-coveralls": "istanbul cover _mocha -- -R spec && cat coverage/lcov.info | coveralls --verbose" - }, - "repository": { - "type": "git", - "url": "https://github.com/ethereum/web3.js.git" - }, - "homepage": "https://github.com/ethereum/web3.js", - "bugs": { - "url ": "https://github.com/ethereum/web3.js/issues" - }, - "keywords": [ - "Ethereum", - "JavaScript", - "API" - ], - "author": "ethereum.org", - "authors": [ - { - "name": "Fabian Vogelsteller", - "email": "fabian@ethereum.org", - "homepage": "http://frozeman.de" + "name": "web3", + "namespace": "ethereum", + "version": "1.0.0-beta.35", + "description": "Ethereum JavaScript API wrapper repository", + "license": "LGPL-3.0", + "main": "./packages/web3/src/index.js", + "directories": { + "doc": "./doc", + "test": "./test" }, - { - "name": "Marek Kotewicz", - "email": "marek@parity.io", - "url": "https://github.com/debris" + "scripts": { + "postinstall": "lerna bootstrap", + "build": "gulp", + "build-all": "gulp all", + "release": "lerna bootstrap; lerna publish; gulp version; gulp; gulp publishTag; git push --tags", + "watch": "gulp watch", + "docs": "cd docs; make html;", + "lint": "jshint *.js packages", + "test": "mocha; jshint *.js packages", + "test-coveralls": "istanbul cover _mocha -- -R spec && cat coverage/lcov.info | coveralls --verbose" }, - { - "name": "Marian Oancea", - "url": "https://github.com/cubedro" + "repository": { + "type": "git", + "url": "https://github.com/ethereum/web3.js.git" }, - { - "name": "Gav Wood", - "email": "g@parity.io", - "homepage": "http://gavwood.com" + "homepage": "https://github.com/ethereum/web3.js", + "bugs": { + "url ": "https://github.com/ethereum/web3.js/issues" }, - { - "name": "Jeffery Wilcke", - "email": "jeffrey.wilcke@ethereum.org", - "url": "https://github.com/obscuren" + "keywords": [ + "Ethereum", + "JavaScript", + "API" + ], + "author": "ethereum.org", + "authors": [ + { + "name": "Samuel Furter", + "email": "samuel@ethereum.org", + "homepage": "https://github.com/nivida" + }, + { + "name": "Fabian Vogelsteller", + "email": "fabian@ethereum.org", + "homepage": "http://frozeman.de" + }, + { + "name": "Marek Kotewicz", + "email": "marek@parity.io", + "url": "https://github.com/debris" + }, + { + "name": "Marian Oancea", + "url": "https://github.com/cubedro" + }, + { + "name": "Gav Wood", + "email": "g@parity.io", + "homepage": "http://gavwood.com" + }, + { + "name": "Jeffery Wilcke", + "email": "jeffrey.wilcke@ethereum.org", + "url": "https://github.com/obscuren" + } + ], + "devDependencies": { + "@types/bignumber.js": "^4.0.2", + "@types/underscore": "^1.8.0", + "babel-preset-env": "^1.6.0", + "bignumber.js": "^4.0.0", + "bluebird": "3.3.1", + "bn.js": "^4.11.8", + "bower": ">=1.4.1", + "browserify": "^14.4.0", + "chai": "^4.0.0", + "coveralls": "^3.0.2", + "crypto-js": "^3.1.4", + "del": ">=2.0.2", + "ethereumjs-wallet": "^0.6.2", + "ethjs-signer": "^0.1.1", + "exorcist": "^0.4.0", + "gulp": "^4.0.0", + "gulp-babel": "^6.1.2", + "gulp-jshint": "^2.0.4", + "gulp-rename": "^1.2.2", + "gulp-replace": "^0.6.1", + "gulp-streamify": "^1.0.2", + "gulp-uglify": "^3.0.0", + "istanbul": "^0.4.4", + "jshint": ">=2.5.0", + "lerna": "^2.5.1", + "mocha": ">=2.3.3", + "sandboxed-module": "^2.0.2", + "underscore": "^1.8.3", + "vinyl-source-stream": "^2.0.0" } - ], - "devDependencies": { - "@types/bignumber.js": "^4.0.2", - "@types/underscore": "^1.8.0", - "babel-preset-env": "^1.6.0", - "bignumber.js": "^4.0.0", - "bluebird": "3.3.1", - "bn.js": "^4.11.8", - "bower": ">=1.4.1", - "browserify": "^14.4.0", - "chai": "^4.0.0", - "coveralls": "^3.0.2", - "crypto-js": "^3.1.4", - "del": ">=2.0.2", - "ethereumjs-wallet": "^0.6.2", - "ethjs-signer": "^0.1.1", - "exorcist": "^0.4.0", - "gulp": "^4.0.0", - "gulp-babel": "^6.1.2", - "gulp-jshint": "^2.0.4", - "gulp-rename": "^1.2.2", - "gulp-replace": "^0.6.1", - "gulp-streamify": "^1.0.2", - "gulp-uglify": "^3.0.0", - "istanbul": "^0.4.4", - "jshint": ">=2.5.0", - "lerna": "^2.5.1", - "mocha": ">=2.3.3", - "sandboxed-module": "^2.0.2", - "underscore": "^1.8.3", - "vinyl-source-stream": "^2.0.0" - } } diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index c13f69e3c52..de7f4245280 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -10,7 +10,7 @@ "underscore": "1.8.3", "web3-core-helpers": "1.0.0-beta.35", "web3-core-promievent": "1.0.0-beta.35", - "web3-core-subscriptions": "1.0.0-beta.35", + "web3-core-subscription": "1.0.0-beta.35", "web3-utils": "1.0.0-beta.35" } } diff --git a/packages/web3-core-providers/package-lock.json b/packages/web3-core-providers/package-lock.json new file mode 100644 index 00000000000..0318cf45d71 --- /dev/null +++ b/packages/web3-core-providers/package-lock.json @@ -0,0 +1,83 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", + "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==" + }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + } + } +} diff --git a/packages/web3-eth-contract/package.json b/packages/web3-eth-contract/package.json index e2d51c3facc..50e420bb7ce 100644 --- a/packages/web3-eth-contract/package.json +++ b/packages/web3-eth-contract/package.json @@ -8,11 +8,10 @@ "main": "src/index.js", "dependencies": { "underscore": "1.8.3", - "web3-core": "1.0.0-beta.35", "web3-core-helpers": "1.0.0-beta.35", "web3-core-method": "1.0.0-beta.35", "web3-core-promievent": "1.0.0-beta.35", - "web3-core-subscriptions": "1.0.0-beta.35", + "web3-core-subscription": "1.0.0-beta.35", "web3-eth-abi": "1.0.0-beta.35", "web3-utils": "1.0.0-beta.35" } diff --git a/packages/web3-eth-ens/package.json b/packages/web3-eth-ens/package.json index 6c728c1c2d2..818b6825ef4 100644 --- a/packages/web3-eth-ens/package.json +++ b/packages/web3-eth-ens/package.json @@ -8,7 +8,6 @@ "dependencies": { "eth-ens-namehash": "2.0.8", "underscore": "1.8.3", - "web3-core": "1.0.0-beta.35", "web3-core-helpers": "1.0.0-beta.35", "web3-eth-abi": "1.0.0-beta.35", "web3-eth-contract": "1.0.0-beta.35", diff --git a/packages/web3-eth-personal/package.json b/packages/web3-eth-personal/package.json index d400d06b89a..59065f83cfa 100644 --- a/packages/web3-eth-personal/package.json +++ b/packages/web3-eth-personal/package.json @@ -7,10 +7,8 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "web3-core": "1.0.0-beta.35", "web3-core-helpers": "1.0.0-beta.35", "web3-core-method": "1.0.0-beta.35", - "web3-net": "1.0.0-beta.35", "web3-utils": "1.0.0-beta.35" } } diff --git a/packages/web3/package.json b/packages/web3/package.json index ff8131d859a..20c5682c272 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -1,53 +1,56 @@ { - "name": "web3", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Ethereum JavaScript API", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3", - "license": "LGPL-3.0", - "main": "src/index.js", - "bugs": { - "url": "https://github.com/ethereum/web3.js/issues" - }, - "keywords": [ - "Ethereum", - "JavaScript", - "API" - ], - "author": "ethereum.org", - "authors": [ - { - "name": "Fabian Vogelsteller", - "email": "fabian@ethereum.org", - "homepage": "http://frozeman.de" + "name": "web3", + "namespace": "ethereum", + "version": "1.0.0-beta.35", + "description": "Ethereum JavaScript API", + "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3", + "license": "LGPL-3.0", + "main": "src/index.js", + "bugs": { + "url": "https://github.com/ethereum/web3.js/issues" }, - { - "name": "Marek Kotewicz", - "email": "marek@parity.io", - "url": "https://github.com/debris" - }, - { - "name": "Marian Oancea", - "url": "https://github.com/cubedro" - }, - { - "name": "Gav Wood", - "email": "g@parity.io", - "homepage": "http://gavwood.com" - }, - { - "name": "Jeffery Wilcke", - "email": "jeffrey.wilcke@ethereum.org", - "url": "https://github.com/obscuren" + "keywords": [ + "Ethereum", + "JavaScript", + "API" + ], + "author": "ethereum.org", + "authors": [ + { + "name": "Samuel Furter", + "email": "samuel@ethereum.org", + "homepage": "https://github.com/nivida" + }, + { + "name": "Fabian Vogelsteller", + "email": "fabian@ethereum.org", + "homepage": "http://frozeman.de" + }, + { + "name": "Marek Kotewicz", + "email": "marek@parity.io", + "url": "https://github.com/debris" + }, + { + "name": "Marian Oancea", + "url": "https://github.com/cubedro" + }, + { + "name": "Gav Wood", + "email": "g@parity.io", + "homepage": "http://gavwood.com" + }, + { + "name": "Jeffery Wilcke", + "email": "jeffrey.wilcke@ethereum.org", + "url": "https://github.com/obscuren" + } + ], + "dependencies": { + "web3-bzz": "1.0.0-beta.35", + "web3-eth": "1.0.0-beta.35", + "web3-eth-personal": "1.0.0-beta.35", + "web3-shh": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" } - ], - "dependencies": { - "web3-bzz": "1.0.0-beta.35", - "web3-core": "1.0.0-beta.35", - "web3-eth": "1.0.0-beta.35", - "web3-eth-personal": "1.0.0-beta.35", - "web3-net": "1.0.0-beta.35", - "web3-shh": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } } diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index d697f028f7a..c8844d98b29 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -28,7 +28,8 @@ var version = require('../package.json').version; /** * @param {Object} provider - * @param {Object} net + * @param {Net} net + * * @constructor */ var Web3 = function Web3(provider, net) { From 1017c46ed896916854d16f2cc33f12414a901686 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 15:35:29 +0200 Subject: [PATCH 0068/1045] Dependencies updated in package.json --- packages/web3-core-helpers/package.json | 4 +--- packages/web3-core-method/package.json | 6 +----- packages/web3-core-subscription/package.json | 3 +-- packages/web3-eth-abi/package.json | 3 +-- packages/web3-eth-accounts/package.json | 4 ---- packages/web3-eth-contract/package.json | 6 ------ packages/web3-eth-ens/package.json | 5 ----- packages/web3-eth-iban/package.json | 1 - packages/web3-eth-personal/package.json | 7 +------ packages/web3-shh/package.json | 8 +------- packages/web3/package.json | 12 +++++++++++- packages/web3/src/factories/PackageFactory.js | 3 ++- 12 files changed, 19 insertions(+), 43 deletions(-) diff --git a/packages/web3-core-helpers/package.json b/packages/web3-core-helpers/package.json index 6d990bfeb24..bc284f4cedb 100644 --- a/packages/web3-core-helpers/package.json +++ b/packages/web3-core-helpers/package.json @@ -7,8 +7,6 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "underscore": "1.8.3", - "web3-eth-iban": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" + "underscore": "1.8.3" } } diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index de7f4245280..b3496e33a93 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -7,10 +7,6 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-promievent": "1.0.0-beta.35", - "web3-core-subscription": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" + "underscore": "1.8.3" } } diff --git a/packages/web3-core-subscription/package.json b/packages/web3-core-subscription/package.json index 01bbb41148d..28317787e83 100644 --- a/packages/web3-core-subscription/package.json +++ b/packages/web3-core-subscription/package.json @@ -8,7 +8,6 @@ "main": "src/index.js", "dependencies": { "eventemitter3": "1.1.1", - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35" + "underscore": "1.8.3" } } diff --git a/packages/web3-eth-abi/package.json b/packages/web3-eth-abi/package.json index bd5bbb5ffdf..26771eac081 100644 --- a/packages/web3-eth-abi/package.json +++ b/packages/web3-eth-abi/package.json @@ -8,7 +8,6 @@ "main": "src/index.js", "dependencies": { "ethers": "4.0.0-beta.1", - "underscore": "1.8.3", - "web3-utils": "1.0.0-beta.35" + "underscore": "1.8.3" } } diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json index 944ac5668fa..4374b3ffa47 100644 --- a/packages/web3-eth-accounts/package.json +++ b/packages/web3-eth-accounts/package.json @@ -13,9 +13,5 @@ "scrypt.js": "0.2.0", "underscore": "1.8.3", "uuid": "2.0.1", - "web3-core": "1.0.0-beta.35", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" } } diff --git a/packages/web3-eth-contract/package.json b/packages/web3-eth-contract/package.json index 50e420bb7ce..8bce6f4490f 100644 --- a/packages/web3-eth-contract/package.json +++ b/packages/web3-eth-contract/package.json @@ -8,11 +8,5 @@ "main": "src/index.js", "dependencies": { "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-core-promievent": "1.0.0-beta.35", - "web3-core-subscription": "1.0.0-beta.35", - "web3-eth-abi": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" } } diff --git a/packages/web3-eth-ens/package.json b/packages/web3-eth-ens/package.json index 818b6825ef4..c9fa20adf14 100644 --- a/packages/web3-eth-ens/package.json +++ b/packages/web3-eth-ens/package.json @@ -8,10 +8,5 @@ "dependencies": { "eth-ens-namehash": "2.0.8", "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", - "web3-eth-abi": "1.0.0-beta.35", - "web3-eth-contract": "1.0.0-beta.35", - "web3-core-promievent": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" } } diff --git a/packages/web3-eth-iban/package.json b/packages/web3-eth-iban/package.json index fa204c25970..f39fc7a0773 100644 --- a/packages/web3-eth-iban/package.json +++ b/packages/web3-eth-iban/package.json @@ -8,6 +8,5 @@ "main": "src/index.js", "dependencies": { "bn.js": "4.11.6", - "web3-utils": "1.0.0-beta.35" } } diff --git a/packages/web3-eth-personal/package.json b/packages/web3-eth-personal/package.json index 59065f83cfa..c3d09f83e25 100644 --- a/packages/web3-eth-personal/package.json +++ b/packages/web3-eth-personal/package.json @@ -5,10 +5,5 @@ "description": "Web3 module to interact with the Ethereum blockchain accounts stored in the node.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-personal", "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } + "main": "src/index.js" } diff --git a/packages/web3-shh/package.json b/packages/web3-shh/package.json index 33c30315fef..32e134fcbaa 100644 --- a/packages/web3-shh/package.json +++ b/packages/web3-shh/package.json @@ -5,11 +5,5 @@ "description": "Web3 module to interact with the Whisper messaging protocol.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-shh", "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "web3-core": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-core-subscriptions": "1.0.0-beta.35", - "web3-net": "1.0.0-beta.35" - } + "main": "src/index.js" } diff --git a/packages/web3/package.json b/packages/web3/package.json index 20c5682c272..f02cdc9fc35 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -51,6 +51,16 @@ "web3-eth": "1.0.0-beta.35", "web3-eth-personal": "1.0.0-beta.35", "web3-shh": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" + "web3-utils": "1.0.0-beta.35", + "web3-core-subscription": "1.0.0-beta.35", + "web3-core-promievent": "1.0.0-beta.35", + "web3-core-helpers": "1.0.0-beta.35", + "web3-core-method": "1.0.0-beta.35", + "web3-eth-ens": "1.0.0-beta.35", + "web3-eth-accounts": "1.0.0-beta.35", + "web3-eth-iban": "1.0.0-beta.35", + "web3-eth-contract": "1.0.0-beta.35", + "web3-eth-abi": "1.0.0-beta.35", + "web3-core-providers": "1.0.0-beta.35" } } diff --git a/packages/web3/src/factories/PackageFactory.js b/packages/web3/src/factories/PackageFactory.js index bc54ea8afb9..4d53bb31214 100644 --- a/packages/web3/src/factories/PackageFactory.js +++ b/packages/web3/src/factories/PackageFactory.js @@ -10,7 +10,8 @@ var ABI = require('web3-eth-abi'); var ProvidersPackageFactory = require('web3-core-providers').ProvidersPackageFactory; /** - * @param {Object} coreFactory + * @param {CoreFactory} coreFactory + * * @constructor */ function PackageFactory(coreFactory) { From 310534b9cb524cd0feb0170f6c668102ad53b52c Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 17:04:45 +0200 Subject: [PATCH 0069/1045] POC for other dependency handling --- packages/web3-eth/src/Eth.js | 41 ++++-- .../src/factories/EthPackageFactory.js | 55 ++++++-- packages/web3-eth/src/index.js | 37 ++++- .../src/resolvers/SubscriptionsResolver.js | 133 +++++++++--------- packages/web3/src/factories/CoreFactory.js | 126 ----------------- packages/web3/src/factories/PackageFactory.js | 98 ------------- packages/web3/src/index.js | 6 +- 7 files changed, 175 insertions(+), 321 deletions(-) delete mode 100644 packages/web3/src/factories/CoreFactory.js delete mode 100644 packages/web3/src/factories/PackageFactory.js diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 5093028e677..e754ce8e332 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -26,23 +26,40 @@ var _ = require('underscore'); /** * @param {ConnectionModel} connectionModel - * @param {PackageFactory} packageFactory - * @param {CoreFactory} coreFactory + * @param {Contract} contract + * @param {Accounts} accounts + * @param {Personal} personal + * @param {Iban} iban + * @param {Abi} abi + * @param {ENS} ens + * @param {Utils} utils + * @param {Object} formatters * @param {SubscriptionsResolver} subscriptionsResolver + * * @constructor */ -var Eth = function Eth(connectionModel, packageFactory, coreFactory, subscriptionsResolver) { +var Eth = function Eth( + connectionModel, + contract, + accounts, + personal, + iban, + abi, + ens, + utils, + formatters, + subscriptionsResolver +) { this.connectionModel = connectionModel; - this.coreFactory = coreFactory; this.net = this.connectionModel.getNetworkMethodsAsObject(); - this.Contract = packageFactory.createContractPackage(); - this.accounts = packageFactory.createAccountsPackage(); - this.personal = packageFactory.createPersonalPackage(); - this.iban = packageFactory.createIbanPackage(); - this.abi = packageFactory.createAbiPackage(); - this.ens = packageFactory.createEnsPackage(); - this.utils = this.coreFactory.createUtils(); - this.formatters = this.coreFactory.createFormatters(); + this.Contract = contract; + this.accounts = accounts; + this.personal = personal; + this.iban = iban; + this.abi = abi; + this.ens = ens; + this.utils = utils; + this.formatters = formatters; this.subscriptionsResolver = subscriptionsResolver; }; diff --git a/packages/web3-eth/src/factories/EthPackageFactory.js b/packages/web3-eth/src/factories/EthPackageFactory.js index 4546f2e5b74..d667ae337eb 100644 --- a/packages/web3-eth/src/factories/EthPackageFactory.js +++ b/packages/web3-eth/src/factories/EthPackageFactory.js @@ -34,12 +34,19 @@ function EthPackageFactory () { } * @method createSubscriptionsResolver * * @param {Object} provider - * @param {CoreFactory} coreFactory + * @param {Object} formatters + * @param {SubscriptionPackageFactory} subscriptionPackageFactory + * @param {PromiEventPackageFactory} promiEventPackageFactory * * @returns {SubscriptionsResolver} */ -EthPackageFactory.prototype.createSubscriptionsResolver = function (provider, coreFactory) { - return new SubscriptionsResolver(provider, coreFactory) +EthPackageFactory.prototype.createSubscriptionsResolver = function ( + provider, + formatters, + subscriptionPackageFactory, + promiEventPackageFactory +) { + return new SubscriptionsResolver(provider, formatters, subscriptionPackageFactory, promiEventPackageFactory) }; /** @@ -48,16 +55,46 @@ EthPackageFactory.prototype.createSubscriptionsResolver = function (provider, co * @method createEth * * @param {ConnectionModel} connectionModel - * @param {PackageFactory} packageFactory - * @param {CoreFactory} coreFactory + * @param {Contract} contract + * @param {Accounts} accounts + * @param {Personal} personal + * @param {Iban} iban + * @param {Abi} abi + * @param {ENS} ens + * @param {Utils} utils + * @param {Object} formatters + * @param {SubscriptionPackageFactory} subscriptionPackageFactory + * @param {PromiEventPackageFactory} promiEventPackageFactory * * @returns {Eth} */ -EthPackageFactory.prototype.createEth = function (connectionModel, packageFactory, coreFactory) { +EthPackageFactory.prototype.createEth = function ( + connectionModel, + contract, + accounts, + personal, + iban, + abi, + ens, + utils, + formatters, + subscriptionPackageFactory, + promiEventPackageFactory +) { return new Eth( connectionModel, - packageFactory, - coreFactory, - this.createSubscriptionsResolver(connectionModel.provider, coreFactory) + contract, + accounts, + personal, + iban, + abi, + ens, + utils, + formatters, + this.createSubscriptionsResolver( + connectionModel.provider, + subscriptionPackageFactory, + promiEventPackageFactory + ) ); }; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index c32304cc5d3..7d2068cdcf7 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -1,9 +1,36 @@ -var Eth = require('./Eth'); -var SubscriptionsResolver = require('./resolvers/SubscriptionsResolver'); +var EthPackageFactory = require('./factories/EthPackageFactory'); +var Contract = require('web3-eth-contract'); +var Accounts = require('web3-eth-accounts'); +var Personal = require('web3-eth-personal'); +var Iban = require('web3-eth-iban'); +var Abi = require('web3-eth-abi'); +var ENS = require('web3-eth-ens'); +var Utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; +var Subscription = require('web3-core-subscription'); +var PromiEvent = require('web3-core-promiEvent'); + + +var utils = Utils.createUtils(); +var ethPackageFactory = new EthPackageFactory(); + module.exports = { - Eth: Eth, - SubscriptionsResolver: SubscriptionsResolver + createEth: function (connectionModel) { + return ethPackageFactory.createEth( + connectionModel, + Contract.createContract(connectionModel), + Accounts.createAccounts(connectionModel), + Personal.createPersonal(connectionModel), + Iban.createIban(), + Abi.createAbi(utils), + ENS.createEns(connectionModel), + utils, + formatters, + Subscription.SubscriptionPackageFactory, + PromiEvent.PromiEventPackageFactory + ); + }, + EthPackageFactory: ethPackageFactory }; - diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index 97830d2d519..fc5ee327b9f 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -24,13 +24,17 @@ /** * @param {Object} provider - * @param {CoreFactory} coreFactory + * @param {Object} formatters + * @param {SubscriptionPackageFactory} subscriptionPackageFactory + * @param {PromiEventPackageFactory} promiEventPackageFactory + * * @constructor */ -function SubscriptionsResolver(provider, coreFactory) { +function SubscriptionsResolver(provider, formatters, subscriptionPackageFactory, promiEventPackageFactory) { this.provider = provider; - this.coreFactory = coreFactory; - this.formatters = this.coreFactory.createFormatters(); + this.formatters = formatters; + this.subscriptionPackageFactory = subscriptionPackageFactory; + this.promiEventPackageFactory = promiEventPackageFactory; } /** @@ -83,7 +87,7 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in parameters = []; } - return this.coreFactory.createSubscription( + return this.subscriptionPackageFactory.createSubscription( this.provider, type, parameters, @@ -104,7 +108,7 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in * @returns {eventifiedPromise} */ SubscriptionsResolver.prototype.getLogsSubscription = function (parameters, callback) { - var promiEvent = this.coreFactory.createPromiEvent(); + var promiEvent = this.promiEventPackageFactory.createPromiEvent(); if (this.hasFromBlockProperty(parameters[1])) { this.handleLogsSubscriptionWithFromBlock(parameters, promiEvent, callback); @@ -129,25 +133,25 @@ SubscriptionsResolver.prototype.getLogsSubscription = function (parameters, call * @callback callback callback(error, result) */ SubscriptionsResolver.prototype.subscribeToLogs = function (parameters, promiEvent, callback) { - this.coreFactory.createSubscription( - this.provider, + this.getSubscription( 'logs', parameters, null, - this.formatters.outputLogFormatter - ).subscribe(function (error, logs) { - if (error) { - callback(error, null); - promiEvent.eventEmitter.emit('error', error); + this.formatters.outputLogFormatter, + function (error, logs) { + if (error) { + callback(error, null); + promiEvent.eventEmitter.emit('error', error); - return; - } + return; + } - logs.forEach(function(log) { - callback(false, log); - promiEvent.eventEmitter.emit('data', log); - }); - }); + logs.forEach(function (log) { + callback(false, log); + promiEvent.eventEmitter.emit('data', log); + }); + } + ); }; /** @@ -162,7 +166,7 @@ SubscriptionsResolver.prototype.subscribeToLogs = function (parameters, promiEve * @callback callback callback(error,result) */ SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function (parameters, promiEvent, callback) { - var self = this; + var self = this; this.provider.send('eth_getLogs', parameters).then(function (logs) { logs.forEach(function (log) { var output = self.formatters.outputLogFormatter(log); @@ -191,66 +195,63 @@ SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function ( * @returns {eventifiedPromise} */ SubscriptionsResolver.prototype.getSyncingSubscription = function (callback) { - var subscription = this.getSubscription( + var promiEvent = this.promiEventPackageFactory.createPromiEvent(); + + this.getSubscription( 'syncing', null, null, this.formatters.outputSyncingFormatter, - callback - ); - - var promiEvent = this.coreFactory.createPromiEvent(); - - subscription.subscribe(function (error, output) { - var self = this; - - if (error) { - promiEvent.eventEmitter.emit('error', error); - callback(error, null, this); - - return; - } + function (error, output) { + var self = this; - // fire TRUE at start - if (this.isSyncing !== true) { - this.isSyncing = true; - promiEvent.eventEmitter.emit('changed', this.isSyncing); + if (error) { + promiEvent.eventEmitter.emit('error', error); + callback(error, null, this); - if (_.isFunction(callback)) { - callback(null, this.isSyncing, this); + return; } - setTimeout(function () { - promiEvent.eventEmitter.emit('data', output); + // fire TRUE at start + if (this.isSyncing !== true) { + this.isSyncing = true; + promiEvent.eventEmitter.emit('changed', this.isSyncing); - if (_.isFunction(self.callback)) { - callback(null, output, self); + if (_.isFunction(callback)) { + callback(null, this.isSyncing, this); } - }, 0); - return; - } + setTimeout(function () { + promiEvent.eventEmitter.emit('data', output); - // fire sync status - promiEvent.eventEmitter.emit('data', output); - if (_.isFunction(callback)) { - callback(null, output, this); - } + if (_.isFunction(self.callback)) { + callback(null, output, self); + } + }, 0); - // wait for some time before fireing the FALSE - clearTimeout(this.isSyncingTimeout); - this.isSyncingTimeout = setTimeout(function () { - if (output.currentBlock > output.highestBlock - 200) { - self.isSyncing = false; - promiEvent.eventEmitter.emit('changed', self.isSyncing); + return; + } - if (_.isFunction(callback)) { - callback(null, self.isSyncing, self); - } + // fire sync status + promiEvent.eventEmitter.emit('data', output); + if (_.isFunction(callback)) { + callback(null, output, this); } - }, 500); - }); + // wait for some time before fireing the FALSE + clearTimeout(this.isSyncingTimeout); + this.isSyncingTimeout = setTimeout(function () { + if (output.currentBlock > output.highestBlock - 200) { + self.isSyncing = false; + promiEvent.eventEmitter.emit('changed', self.isSyncing); + + if (_.isFunction(callback)) { + callback(null, self.isSyncing, self); + } + } + }, 500); + } + ); return promiEvent; }; @@ -265,7 +266,7 @@ SubscriptionsResolver.prototype.getSyncingSubscription = function (callback) { * @returns {boolean} */ SubscriptionsResolver.prototype.hasFromBlockProperty = function (parameter) { - return _.isObject(parameter) && parameter.hasOwnProperty('fromBlock') && _.isNumber(parameter.fromBlock); + return _.isObject(parameter) && parameter.hasOwnProperty('fromBlock') && _.isNumber(parameter.fromBlock); }; module.exports = SubscriptionsResolver; diff --git a/packages/web3/src/factories/CoreFactory.js b/packages/web3/src/factories/CoreFactory.js deleted file mode 100644 index d1881d612de..00000000000 --- a/packages/web3/src/factories/CoreFactory.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - 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 . - */ -/** - * @file CoreFactory.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var Subscription = require('web3-core-subscription'); -var PromiEvent = require('web3-core-promievent'); -var helpers = require('web3-core-helpers'); -var MethodPackageFactory = require('web3-core-method'); -var Utils = require('web3-utils'); - -function CoreFactory() { } - -/** - * Creates Subscription object - * - * @method createSubscription - * - * @param {Object} provider - * @param {String} type - * @param {Array} parameters - * @param {Object} inputFormatter - * @param {Object} outputFormatter - * - * @returns {Subscription} - */ -CoreFactory.prototype.createSubscription = function (provider, type, parameters, inputFormatter, outputFormatter) { - return new Subscription(provider, type, parameters, inputFormatter, outputFormatter); -}; - -/** - * Creates PromiEvent object - */ -CoreFactory.prototype.createPromiEvent = function () { - return new PromiEvent(); -}; - -/** - * Creates Method object - * - * @method createMethod - * - * @param {Object} provider - * @param {String} rpcMethod - * @param {Array} parameters - * @param {Array} inputFormatters - * @param {Function} outputFormatter - * - * @returns {Method} - */ -CoreFactory.prototype.createMethod = function (provider, rpcMethod, parameters, inputFormatters, outputFormatter) { - return new MethodPackageFactory().createMethod( - provider, - this, - rpcMethod, - parameters, - inputFormatters, - outputFormatter, - this.createPromiEvent() - ); -}; - -/** - * Returns the web3 utilities - * - * @method createUtils - * - * @returns {Utils} - */ -CoreFactory.prototype.createUtils = function () { - return Utils; -}; - -/** - * Creates Batch object - * - * @method createBatch - * - * @param {ConnectionModel} connectionModel - * - * @returns {Batch} - */ -CoreFactory.prototype.createBatch = function (connectionModel) { - return new Batch(connectionModel); -}; - -/** - * Returns the web3 formatters - * - * @method createFormatters - * - * @returns {Object} - */ -CoreFactory.prototype.createFormatters = function () { - return helpers.formatters; -}; - -/** - * Returns the default web3 errors - * - * @method createErrors - * - * @returns {Object} - */ -CoreFactory.prototype.createErrors = function () { - return helpers.errors; -}; diff --git a/packages/web3/src/factories/PackageFactory.js b/packages/web3/src/factories/PackageFactory.js deleted file mode 100644 index 4d53bb31214..00000000000 --- a/packages/web3/src/factories/PackageFactory.js +++ /dev/null @@ -1,98 +0,0 @@ -var Shh = require('web3-shh'); -var Bzz = require('web3-bzz'); -var ENS = require('web3-eth-ens'); -var Accounts = require('web3-eth-accounts'); -var Personal = require('web3-eth-personal'); -var EthPackage = require('web3-eth'); -var Iban = require('web3-eth-iban'); -var Contract = require('web3-eth-contract'); -var ABI = require('web3-eth-abi'); -var ProvidersPackageFactory = require('web3-core-providers').ProvidersPackageFactory; - -/** - * @param {CoreFactory} coreFactory - * - * @constructor - */ -function PackageFactory(coreFactory) { - this.coreFactory = coreFactory; -} - -/** - * @returns {Shh} - */ -PackageFactory.prototype.createShhPackage = function (connectionModel) { - return new Shh(connectionModel, this.coreFactory); -}; - -/** - * @returns {Bzz} - */ -PackageFactory.prototype.createBzzPackage = function (connectionModel) { - return new Bzz(connectionModel); -}; - -/** - * @returns {ENS} - */ -PackageFactory.prototype.createEnsPackage = function (connectionModel) { - return new ENS(connectionModel, this.createEthPackage()); -}; - -/** - * @returns {Accounts} - */ -PackageFactory.prototype.createAccountsPackage = function (connectionModel) { - return new Accounts(connectionModel, this.coreFactory); -}; - -/** - * @returns {Personal} - */ -PackageFactory.prototype.createPersonalPackage = function (connectionModel) { - return new Personal(connectionModel, this.coreFactory); -}; - -/** - * @returns {Eth} - */ -PackageFactory.prototype.createEthPackage = function (connectionModel) { - return new EthPackage.Eth( - connectionModel, - this, - this.coreFactory, - new EthPackage.SubscriptionsResolver(connectionModel) - ); -}; - -/** - * Bind ConnectionModel and Accounts package to Contract and return the uninstantiated Contract object. - * - * @returns {Contract} // TODO: Refactor Contract for usage of binded properties - */ -PackageFactory.prototype.createContractPackage = function (connectionModel) { - return Contract.bind({connectionModel: connectionModel, accounts: this.createAccountsPackage()}); -}; - -/** - * @returns {Iban} - */ -PackageFactory.prototype.createIbanPackage = function () { - return Iban;// have a closer look later -}; - -/** - * @returns {ABI} - */ -PackageFactory.prototype.createAbiPackage = function () { - return new ABI(this.coreFactory.createUtils()); -}; - -/** - * Return the ProvidersPackageFactory from web3-core-providers - * - * @returns ProvidersPackageFactory - */ -PackageFactory.prototype.createProvidersPackageFactory = function () { - return new ProvidersPackageFactory() -}; diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index c8844d98b29..9293d4e3f26 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -70,7 +70,7 @@ Object.defineProperty(Web3, 'connectionModel', { */ Object.defineProperty(Web3, 'givenProvider', { get: function () { - return this.connectionModel; + return this.connectionModel.givenProvider; }, set: function (connectionModel) { if (this.connectionModel) { @@ -116,9 +116,5 @@ Web3.providers = { IpcProvider: require('web3-core-providers').IpcProvider }; -Web3.givenProvider = function () { - return new PackageFactory(new CoreFactory()).createProvidersPackageFactory().createProviderDetector().detect(); -}; - module.exports = Web3; From 72b24a3adfa85948959c41e752622f7f3422cab1 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 18:11:29 +0200 Subject: [PATCH 0070/1045] Eth packge 'loader' updated and EthPackageFactory removed --- packages/web3-eth-ens/src/ENS.js | 2 +- packages/web3-eth/package.json | 30 ++++-- .../src/factories/EthPackageFactory.js | 100 ------------------ packages/web3-eth/src/index.js | 68 ++++++++---- .../src/resolvers/SubscriptionsResolver.js | 16 +-- 5 files changed, 74 insertions(+), 142 deletions(-) delete mode 100644 packages/web3-eth/src/factories/EthPackageFactory.js diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index 9ef972abdf7..c95ec1b0211 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -31,7 +31,7 @@ var ResolverMethodHandler = require('./lib/ResolverMethodHandler'); * @param {Object} eth * @constructor */ -function ENS(eth) { +function ENS(eth) { // TODO: Remove circular dependency. this.eth = eth; } diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index 9a2cd5bc84d..e4509f3c6b2 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -1,12 +1,22 @@ { - "name": "web3-eth", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Web3 module to interact with the Ethereum blockchain and smart contracts.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "underscore": "1.8.3" - } + "name": "web3-eth", + "namespace": "ethereum", + "version": "1.0.0-beta.35", + "description": "Web3 module to interact with the Ethereum blockchain and smart contracts.", + "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth", + "license": "LGPL-3.0", + "main": "src/index.js", + "peerDependencies": { + "underscore": "1.8.3", + "web3-eth-contract": "1.0.0-beta.35", + "web3-eth-accounts": "1.0.0-beta.35", + "web3-eth-personal": "1.0.0-beta.35", + "web3-eth-iban": "1.0.0-beta.35", + "web3-eth-abi": "1.0.0-beta.35", + "web3-eth-ens": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35", + "web3-core-helpers": "1.0.0-beta.35", + "web3-core-subscription": "1.0.0-beta.35", + "web3-core-promiEvent": "1.0.0-beta.35" + } } diff --git a/packages/web3-eth/src/factories/EthPackageFactory.js b/packages/web3-eth/src/factories/EthPackageFactory.js deleted file mode 100644 index d667ae337eb..00000000000 --- a/packages/web3-eth/src/factories/EthPackageFactory.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - 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 . -*/ -/** - * @file EthPackageFactory.js - * @authors: Samuel Furter - * @date 2018 - */ - -"use strict"; - -var SubscriptionsResolver = require('../resolvers/SubscriptionsResolver'); -var Eth = require('../Eth'); - - -function EthPackageFactory () { } - -/** - * Returns object of type SubscriptionsResolver - * - * @method createSubscriptionsResolver - * - * @param {Object} provider - * @param {Object} formatters - * @param {SubscriptionPackageFactory} subscriptionPackageFactory - * @param {PromiEventPackageFactory} promiEventPackageFactory - * - * @returns {SubscriptionsResolver} - */ -EthPackageFactory.prototype.createSubscriptionsResolver = function ( - provider, - formatters, - subscriptionPackageFactory, - promiEventPackageFactory -) { - return new SubscriptionsResolver(provider, formatters, subscriptionPackageFactory, promiEventPackageFactory) -}; - -/** - * Returns object of type Eth - * - * @method createEth - * - * @param {ConnectionModel} connectionModel - * @param {Contract} contract - * @param {Accounts} accounts - * @param {Personal} personal - * @param {Iban} iban - * @param {Abi} abi - * @param {ENS} ens - * @param {Utils} utils - * @param {Object} formatters - * @param {SubscriptionPackageFactory} subscriptionPackageFactory - * @param {PromiEventPackageFactory} promiEventPackageFactory - * - * @returns {Eth} - */ -EthPackageFactory.prototype.createEth = function ( - connectionModel, - contract, - accounts, - personal, - iban, - abi, - ens, - utils, - formatters, - subscriptionPackageFactory, - promiEventPackageFactory -) { - return new Eth( - connectionModel, - contract, - accounts, - personal, - iban, - abi, - ens, - utils, - formatters, - this.createSubscriptionsResolver( - connectionModel.provider, - subscriptionPackageFactory, - promiEventPackageFactory - ) - ); -}; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 7d2068cdcf7..4e806962fc6 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -1,36 +1,58 @@ +/* + This file is part of web3.js. -var EthPackageFactory = require('./factories/EthPackageFactory'); + 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 . +*/ +/** + * @file index.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var version = require('./package.json').version; +var Eth = require('./Eth'); var Contract = require('web3-eth-contract'); var Accounts = require('web3-eth-accounts'); var Personal = require('web3-eth-personal'); -var Iban = require('web3-eth-iban'); -var Abi = require('web3-eth-abi'); var ENS = require('web3-eth-ens'); -var Utils = require('web3-utils'); -var formatters = require('web3-core-helpers').formatters; +var Abi = require('web3-eth-abi'); var Subscription = require('web3-core-subscription'); var PromiEvent = require('web3-core-promiEvent'); +var Iban = require('web3-eth-iban').create(); +var formatters = require('web3-core-helpers').create().formatters; +var Utils = require('web3-utils').create(); -var utils = Utils.createUtils(); -var ethPackageFactory = new EthPackageFactory(); - - -module.exports = { - createEth: function (connectionModel) { - return ethPackageFactory.createEth( +var EthPackage = { + version: version, + create: function (connectionModel) { + return new Eth( connectionModel, - Contract.createContract(connectionModel), - Accounts.createAccounts(connectionModel), - Personal.createPersonal(connectionModel), - Iban.createIban(), - Abi.createAbi(utils), - ENS.createEns(connectionModel), - utils, + Contract.create(connectionModel), + Accounts.create(connectionModel), + Personal.create(connectionModel), + Iban, + Abi.create(utils), + ENS.create(connectionModel), + Utils, formatters, - Subscription.SubscriptionPackageFactory, - PromiEvent.PromiEventPackageFactory + new SubscriptionsResolver(connectionModel.provider, formatters, Subscription, PromiEvent) ); - }, - EthPackageFactory: ethPackageFactory + } }; + + +module.exports = EthPackage; diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index fc5ee327b9f..e9bfe30cede 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -25,16 +25,16 @@ /** * @param {Object} provider * @param {Object} formatters - * @param {SubscriptionPackageFactory} subscriptionPackageFactory - * @param {PromiEventPackageFactory} promiEventPackageFactory + * @param {Subscription} subscriptionPackage + * @param {PromiEvent} promiEventPackage * * @constructor */ -function SubscriptionsResolver(provider, formatters, subscriptionPackageFactory, promiEventPackageFactory) { +function SubscriptionsResolver(provider, formatters, subscriptionPackage, promiEventPackage) { this.provider = provider; this.formatters = formatters; - this.subscriptionPackageFactory = subscriptionPackageFactory; - this.promiEventPackageFactory = promiEventPackageFactory; + this.subscriptionPackage = subscriptionPackage; + this.promiEventPackage = promiEventPackage; } /** @@ -87,7 +87,7 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in parameters = []; } - return this.subscriptionPackageFactory.createSubscription( + return this.subscriptionPackage.create( this.provider, type, parameters, @@ -108,7 +108,7 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in * @returns {eventifiedPromise} */ SubscriptionsResolver.prototype.getLogsSubscription = function (parameters, callback) { - var promiEvent = this.promiEventPackageFactory.createPromiEvent(); + var promiEvent = this.promiEventPackage.create(); if (this.hasFromBlockProperty(parameters[1])) { this.handleLogsSubscriptionWithFromBlock(parameters, promiEvent, callback); @@ -195,7 +195,7 @@ SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function ( * @returns {eventifiedPromise} */ SubscriptionsResolver.prototype.getSyncingSubscription = function (callback) { - var promiEvent = this.promiEventPackageFactory.createPromiEvent(); + var promiEvent = this.promiEventPackage.create(); this.getSubscription( 'syncing', From dc2577b7c9c297e3b6583f2c5202dda2f14ea650 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 18:30:54 +0200 Subject: [PATCH 0071/1045] dependency handling updated in web3 package --- packages/web3-eth/src/index.js | 1 + packages/web3/src/index.js | 61 ++++++++++----------- packages/web3/src/models/ConnectionModel.js | 19 ++++--- 3 files changed, 41 insertions(+), 40 deletions(-) diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 4e806962fc6..93e0f590ba6 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -23,6 +23,7 @@ "use strict"; var version = require('./package.json').version; +var SubscriptionsResolver = require('./resolvers/SubscriptionsResolver'); var Eth = require('./Eth'); var Contract = require('web3-eth-contract'); var Accounts = require('web3-eth-accounts'); diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 9293d4e3f26..c8db2476f71 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -22,8 +22,8 @@ "use strict"; -var PackageFactory = require('./factories/PackageFactory'); -var CoreFactory = require('./factories/CoreFactory'); +var ProvidersPackage = require('web3-core-providers'); +var EthPackage = require('web3-eth'); var version = require('../package.json').version; /** @@ -33,19 +33,14 @@ var version = require('../package.json').version; * @constructor */ var Web3 = function Web3(provider, net) { - this.coreFactory = new CoreFactory(); - this.packageFactory = new PackageFactory(this.coreFactory); - this.connectionModel = new ConnectionModel( - this.packageFactory.createProvidersPackageFactory().createProviderAdapterResolver().resolve(provider, net), - this.coreFactory - ); - this.version = version; - - this.utils = this.coreFactory.createUtils(); - this.eth = this.packageFactory.createEthPackage(this.connectionModel); - this.shh = this.packageFactory.createShhPackage(this.connectionModel); - this.bzz = this.packageFactory.createBzzPackage(this.connectionModel); + this.connectionModel = Web3.createConnectionModel( + ProvidersPackage.resolve(provider, net) + ); + this.utils = UtilsPackage.create(); + this.eth = EthPackage.create(this.connectionModel); + this.shh = ShhPackage.create(this.connectionModel); + this.bzz = BzzPackage.create(this.connectionModel); }; /** @@ -87,33 +82,35 @@ Web3.version = version; Web3.utils = new CoreFactory().createUtils(); Web3.modules = { - Eth: function (provider) { - var coreFactory = new CoreFactory(); - return new PackageFactory(coreFactory).createEthPackage(new ConnectionModel(provider, coreFactory)); + Eth: function (provider, net) { + return EthPackage.create(this.createConnectionModel(provider, net)); }, - Net: function (provider) { - var coreFactory = new CoreFactory(); - return new ConnectionModel(provider, coreFactory).getNetworkMethodsAsObject(); + Net: function (provider, net) { + return this.createConnectionModel(provider, net).getNetworkMethodsAsObject(); }, - Personal: function (provider) { - var coreFactory = new CoreFactory(); - return new PackageFactory(coreFactory).createPersonalPackage(new ConnectionModel(provider, coreFactory)); + Personal: function (provider, net) { + return PersonalPackage.create(this.createConnectionModel(provider, net)); }, - Shh: function (provider) { - var coreFactory = new CoreFactory(); - return new PackageFactory(coreFactory).createShhPackage(new ConnectionModel(provider, coreFactory)); + Shh: function (provider, net) { + return ShhPackage.create(this.createConnectionModel(provider, net)); }, - Bzz: function (provider) { - var coreFactory = new CoreFactory(); - return new PackageFactory(coreFactory).createBzzPackage(new ConnectionModel(provider, coreFactory)); + Bzz: function (provider, net) { + return new BzzPackage.create(this.createConnectionModel(provider, net)); } }; +Web3.createConnectionModel = function(provider, net) { + return new ConnectionModel( + ProvidersPackage.resolve(provider, net), UtilsPackage.create(), + HelpersPackage.create().formatters + ) +}; + Web3.providers = { - HttpProvider: require('web3-core-providers').HttpProvider, - WebsocketProvider: require('web3-core-providers').WebsocketProvider, - IpcProvider: require('web3-core-providers').IpcProvider + HttpProvider: ProvidersPackage.HttpProvider, + WebsocketProvider: ProvidersPackage.WebsocketProvider, + IpcProvider: ProvidersPackage.IpcProvider }; module.exports = Web3; diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index b7287bc2e3e..2e4ee30d850 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -23,14 +23,17 @@ /** * @param {Object} provider - * @param {CoreFactory} coreFactory + * @param {MethodPackage} method + * @param {Utils} utils + * @param {Object} formatters * @constructor */ -function ConnectionModel(provider, coreFactory) { +function ConnectionModel(provider, method, utils, formatters) { this.provider = provider; this.coreFactory = coreFactory; - this.utils = this.coreFactory.createUtils(); - this.formatters = this.coreFactory.createFormatters(); + this.utils = utils; + this.formatters = formatters; + this.method = method; } /** @@ -125,7 +128,7 @@ ConnectionModel.prototype.getNetworkType = function (callback) { * @returns {Promise|eventifiedPromise} */ ConnectionModel.prototype.getId = function (callback) { - return this.coreFactory.createMethod(this.provider, 'net_version', [], null, this.utils.hexToNumber).send(callback); + return this.method.create(this.provider, 'net_version', [], null, this.utils.hexToNumber).send(callback); }; /** @@ -139,7 +142,7 @@ ConnectionModel.prototype.getId = function (callback) { * @returns {Promise|eventifiedPromise} */ ConnectionModel.prototype.isListening = function (callback) { - return this.coreFactory.createMethod(this.provider, 'net_listening', [], null, null).send(callback); + return this.method.create(this.provider, 'net_listening', [], null, null).send(callback); }; /** @@ -153,7 +156,7 @@ ConnectionModel.prototype.isListening = function (callback) { * @returns {Promise|eventifiedPromise} */ ConnectionModel.prototype.getPeerCount = function (callback) { - return this.coreFactory.createMethod(this.provider, 'net_peerCount', [], null, this.utils.hexToNumber).send(callback); + return this.method.create(this.provider, 'net_peerCount', [], null, this.utils.hexToNumber).send(callback); }; /** @@ -169,7 +172,7 @@ ConnectionModel.prototype.getPeerCount = function (callback) { * @returns {Promise|eventifiedPromise} */ ConnectionModel.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { - return this.coreFactory.createMethod( + return this.method.create( this.provider, 'eth_getBlockByNumber', [blockNumber, returnTransactionObjects], From 63e600e22145cb30a7571a39d1a6ec055fb85fd7 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 31 Aug 2018 19:00:08 +0200 Subject: [PATCH 0072/1045] Comments added and simplified --- packages/web3-core-method/src/Method.js | 2 +- .../src/factories/MethodPackageFactory.js | 6 +-- packages/web3-core-method/src/index.js | 30 ++++++++++++- .../src/signers/MessageSigner.js | 2 +- packages/web3-core-providers/src/index.js | 30 ++++++++++++- packages/web3-core-subscription/src/index.js | 45 ++++++++++++++++++- packages/web3-eth/src/index.js | 16 ++++--- 7 files changed, 117 insertions(+), 14 deletions(-) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index 6a6bbc38e63..ccea14dd64b 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -71,7 +71,7 @@ function Method( * @param {Function} callback * * @callback callback callback(error, result) - * @returns {Promise | eventifiedPromise} + * @returns {Promise | eventifiedPromise | String | boolean} */ Method.prototype.send = function (callback) { var self = this; diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index cfea3748e1c..b8a395d5435 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -42,7 +42,7 @@ function MethodPackageFactory() { } * @method createMethod * * @param {Object} provider - * @param {CoreFactory} coreFactory + * @param {Accounts} coreFactory * @param {String} rpcMethod * @param {Array} parameters * @param {Array} inputFormatters @@ -53,7 +53,7 @@ function MethodPackageFactory() { } */ MethodPackageFactory.prototype.createMethod = function ( provider, - coreFactory, + accounts, rpcMethod, parameters, inputFormatters, @@ -62,7 +62,7 @@ MethodPackageFactory.prototype.createMethod = function ( ) { return new Method( provider, - coreFactory.createAccountsPackage(), + accounts, rpcMethod, parameters, inputFormatters, diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index ca59ecc9642..9a30146b4f4 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -21,6 +21,34 @@ * @date 2018 */ +"use strict"; + +var version = require('./package.json'); +var AccountsPackage = require('web3-eth-accounts'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); -module.exports = MethodPackageFactory; +module.exports = { + version: version, + + /** + * Creates the Method object + * + * @param {Object} provider + * @param {String} rpcMethod + * @param {Array} parameters + * @param {Function} inputFormatters + * @param {Function} outputFormatters + * @param (PromiEvent) promiEvent + */ + create: function (provider, rpcMethod, parameters, inputFormatters, outputFormatters, promiEvent) { + new MethodPackageFactory().createMethod( + provider, + AccountsPackage.create(), + rpcMethod, + parameters, + inputFormatters, + outputFormatters, + promiEvent.create() + ); + } +}; diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 565c310e028..eae975c0557 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -37,7 +37,7 @@ function MessageSigner() { } * @param {String} data * @param {any} address * - * @returns {any} + * @returns {String | boolean} */ MessageSigner.prototype.sign = function(data, address) { var wallet = this.getWallet(address); diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index 113f9c12986..8b1d8fcd9a0 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -20,14 +20,40 @@ "use strict"; +var version = require('./package.json').version; var ProvidersPackageFactory = require('./factories/ProvidersPackageFactory'); var HttpProvider = require('./providers/HttpProvider'); var IpcProvider = require('./providers/IpcProvider'); var WebsocketProvider = require('./providers/WebsocketProvider'); module.exports = { - ProvidersPackageFactory: ProvidersPackageFactory, + version: version, HttpProvider: HttpProvider, IpcProvider: IpcProvider, - WebsocketProvider: WebsocketProvider + WebsocketProvider: WebsocketProvider, + + /** + * Resolves the right provider adapter by the given parameters + * + * @method resolve + * + * @param {Object} provider + * @param {Net} net + * + * @returns {Object} + */ + resolve: function (provider, net) { + return new ProvidersPackageFactory().createProviderAdapterResolver().resolve(provider, net); + }, + + /** + * Detects the given provider in the global scope + * + * @method detect + * + * @returns {Object} + */ + detect: function () { + return new ProvidersPackageFactory().createProviderDetector().detect(); + } }; diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js index d332966b4ca..91f0b2fc9ec 100644 --- a/packages/web3-core-subscription/src/index.js +++ b/packages/web3-core-subscription/src/index.js @@ -1,4 +1,47 @@ +/* + 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 . +*/ +/** + * @file index.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var version = require('./package.json').version; var Subscription = require('./Subscription'); -module.exports = Subscription; +module.exports = { + version: version, + + /** + * Creates Subscription object + * + * @method create + * + * @param {Object} provider + * @param {String} type + * @param {Array} parameters + * @param {Function} inputFormatters + * @param {Function} outputFormatter + * + * @returns {Subscription} + */ + create: function (provider, type, parameters, inputFormatters, outputFormatter) { + return new Subscription(provider, type, parameters, inputFormatters, outputFormatter) + } +}; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 93e0f590ba6..006f96c9040 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -36,9 +36,18 @@ var Iban = require('web3-eth-iban').create(); var formatters = require('web3-core-helpers').create().formatters; var Utils = require('web3-utils').create(); - -var EthPackage = { +module.exports = { version: version, + + /** + * Creates the Eth object + * + * @method create + * + * @param {ConnectionModel} connectionModel + * + * @returns {Eth} + */ create: function (connectionModel) { return new Eth( connectionModel, @@ -54,6 +63,3 @@ var EthPackage = { ); } }; - - -module.exports = EthPackage; From ca9b7a2d91377c6ae120e1b99ab98e9b207b7ea0 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 3 Sep 2018 12:04:17 +0200 Subject: [PATCH 0073/1045] Index files added to each package for the dependency handling. Todo's added for refactoring and web3/index.js updated --- packages/web3-bzz/src/Bzz.js | 88 ++ packages/web3-bzz/src/index.js | 83 +- packages/web3-core-batch/src/index.js | 17 +- packages/web3-core-method/src/index.js | 12 +- .../web3-core-promievent/src/PromiEvent.js | 75 ++ packages/web3-core-promievent/src/index.js | 68 +- packages/web3-eth-abi/src/ABICoder.js | 309 +++++++ packages/web3-eth-abi/src/index.js | 300 +----- packages/web3-eth-accounts/src/Accounts.js | 534 +++++++++++ packages/web3-eth-accounts/src/index.js | 525 +---------- packages/web3-eth-contract/src/Contract.js | 868 ++++++++++++++++++ packages/web3-eth-contract/src/index.js | 852 +---------------- packages/web3-eth-ens/src/index.js | 18 +- packages/web3-eth-iban/src/Iban.js | 267 ++++++ packages/web3-eth-iban/src/index.js | 262 +----- packages/web3-eth-personal/src/Personal.js | 150 +++ packages/web3-eth-personal/src/index.js | 143 +-- packages/web3-eth/src/Eth.js | 81 +- packages/web3-eth/src/index.js | 32 +- packages/web3-shh/src/Shh.js | 185 ++++ packages/web3-shh/src/index.js | 184 +--- packages/web3/src/index.js | 13 +- packages/web3/src/models/ConnectionModel.js | 15 +- 23 files changed, 2723 insertions(+), 2358 deletions(-) create mode 100644 packages/web3-bzz/src/Bzz.js create mode 100644 packages/web3-core-promievent/src/PromiEvent.js create mode 100644 packages/web3-eth-abi/src/ABICoder.js create mode 100644 packages/web3-eth-accounts/src/Accounts.js create mode 100644 packages/web3-eth-contract/src/Contract.js create mode 100644 packages/web3-eth-iban/src/Iban.js create mode 100644 packages/web3-eth-personal/src/Personal.js create mode 100644 packages/web3-shh/src/Shh.js diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js new file mode 100644 index 00000000000..3ad2b25e248 --- /dev/null +++ b/packages/web3-bzz/src/Bzz.js @@ -0,0 +1,88 @@ +/* + 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 . +*/ +/** + * @file Bzz.js + * @author Fabian Vogelsteller + * @date 2017 + */ + +"use strict"; + +var _ = require('underscore'); +var swarm = require("swarm-js"); + + +var Bzz = function Bzz(provider) { + + this.givenProvider = Bzz.givenProvider; + + if (provider && provider._requestManager) { + provider = provider.currentProvider; + } + + // only allow file picker when in browser + if(typeof document !== 'undefined') { + this.pick = swarm.pick; + } + + this.setProvider(provider); +}; + +// set default ethereum provider +/* jshint ignore:start */ +Bzz.givenProvider = null; +if(typeof ethereumProvider !== 'undefined' && ethereumProvider.bzz) { + Bzz.givenProvider = ethereumProvider.bzz; +} +/* jshint ignore:end */ + +Bzz.prototype.setProvider = function(provider) { + // is ethereum provider + if(_.isObject(provider) && _.isString(provider.bzz)) { + provider = provider.bzz; + // is no string, set default + } + // else if(!_.isString(provider)) { + // provider = 'http://swarm-gateways.net'; // default to gateway + // } + + + if(_.isString(provider)) { + this.currentProvider = provider; + } else { + this.currentProvider = null; + + var noProviderError = new Error('No provider set, please set one using bzz.setProvider().'); + + this.download = this.upload = this.isAvailable = function(){ + throw noProviderError; + }; + + return false; + } + + // add functions + this.download = swarm.at(provider).download; + this.upload = swarm.at(provider).upload; + this.isAvailable = swarm.at(provider).isAvailable; + + return true; +}; + + +module.exports = Bzz; + diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index cde9de05972..2a28a8810f2 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -16,73 +16,28 @@ */ /** * @file index.js - * @author Fabian Vogelsteller - * @date 2017 + * @author Samuel Furter + * @date 2018 */ "use strict"; -var _ = require('underscore'); -var swarm = require("swarm-js"); - - -var Bzz = function Bzz(provider) { - - this.givenProvider = Bzz.givenProvider; - - if (provider && provider._requestManager) { - provider = provider.currentProvider; - } - - // only allow file picker when in browser - if(typeof document !== 'undefined') { - this.pick = swarm.pick; - } - - this.setProvider(provider); -}; - -// set default ethereum provider -/* jshint ignore:start */ -Bzz.givenProvider = null; -if(typeof ethereumProvider !== 'undefined' && ethereumProvider.bzz) { - Bzz.givenProvider = ethereumProvider.bzz; -} -/* jshint ignore:end */ - -Bzz.prototype.setProvider = function(provider) { - // is ethereum provider - if(_.isObject(provider) && _.isString(provider.bzz)) { - provider = provider.bzz; - // is no string, set default +var version = require('./package.json').version; +var Bzz = require('./Bzz'); + +module.exports = { + version: version, + + /** + * Returns the Bzz object + * + * @method create + * + * @param {ConnectionModel} connectionModel + * + * @returns {Bzz} + */ + create: function (connectionModel) {//TODO: Refactor the bzz object + return new Bzz(connectionModel.provider); } - // else if(!_.isString(provider)) { - // provider = 'http://swarm-gateways.net'; // default to gateway - // } - - - if(_.isString(provider)) { - this.currentProvider = provider; - } else { - this.currentProvider = null; - - var noProviderError = new Error('No provider set, please set one using bzz.setProvider().'); - - this.download = this.upload = this.isAvailable = function(){ - throw noProviderError; - }; - - return false; - } - - // add functions - this.download = swarm.at(provider).download; - this.upload = swarm.at(provider).upload; - this.isAvailable = swarm.at(provider).isAvailable; - - return true; }; - - -module.exports = Bzz; - diff --git a/packages/web3-core-batch/src/index.js b/packages/web3-core-batch/src/index.js index 6e60e89022d..fc6ab836e26 100644 --- a/packages/web3-core-batch/src/index.js +++ b/packages/web3-core-batch/src/index.js @@ -20,6 +20,21 @@ "use strict"; +var version = require('./package.json').version; var Batch = require('./Batch'); -module.exports = Batch; +module.exports = { + version: version, + + /** + * Returns the Batch object + * + * @param {ConnectionModel} connectionModel + * + * @returns {Batch} + */ + create: function (connectionModel) { + return new Batch(connectionModel); + } + +}; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 9a30146b4f4..371e2cb5527 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -26,6 +26,7 @@ var version = require('./package.json'); var AccountsPackage = require('web3-eth-accounts'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); +var PromiEventPackage = require('web3-core-promievent'); module.exports = { version: version, @@ -33,22 +34,25 @@ module.exports = { /** * Creates the Method object * + * @method create + * * @param {Object} provider * @param {String} rpcMethod * @param {Array} parameters * @param {Function} inputFormatters * @param {Function} outputFormatters - * @param (PromiEvent) promiEvent + * + * @returns {Method} */ - create: function (provider, rpcMethod, parameters, inputFormatters, outputFormatters, promiEvent) { - new MethodPackageFactory().createMethod( + create: function (provider, rpcMethod, parameters, inputFormatters, outputFormatters) { + return new MethodPackageFactory().createMethod( provider, AccountsPackage.create(), rpcMethod, parameters, inputFormatters, outputFormatters, - promiEvent.create() + PromiEventPackage.create() ); } }; diff --git a/packages/web3-core-promievent/src/PromiEvent.js b/packages/web3-core-promievent/src/PromiEvent.js new file mode 100644 index 00000000000..3b13ed4f26d --- /dev/null +++ b/packages/web3-core-promievent/src/PromiEvent.js @@ -0,0 +1,75 @@ +/* + 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 . + */ +/** + * @file index.js + * @author Fabian Vogelsteller + * @date 2016 + */ + +"use strict"; + +var EventEmitter = require('eventemitter3'); +var Promise = require("any-promise"); + +/** + * This function generates a defer promise and adds eventEmitter functionality to it + * + * @method eventifiedPromise + */ +var PromiEvent = function PromiEvent(justPromise) {// TODO: Just promise is no longer required + var resolve, reject, + eventEmitter = new Promise(function() { + resolve = arguments[0]; + reject = arguments[1]; + }); + + if(justPromise) { + return { + resolve: resolve, + reject: reject, + eventEmitter: eventEmitter + }; + } + + // get eventEmitter + var emitter = new EventEmitter(); + + // add eventEmitter to the promise + eventEmitter._events = emitter._events; + eventEmitter.emit = emitter.emit; + eventEmitter.on = emitter.on; + eventEmitter.once = emitter.once; + eventEmitter.off = emitter.off; + eventEmitter.listeners = emitter.listeners; + eventEmitter.addListener = emitter.addListener; + eventEmitter.removeListener = emitter.removeListener; + eventEmitter.removeAllListeners = emitter.removeAllListeners; + + return { + resolve: resolve, + reject: reject, + eventEmitter: eventEmitter + }; +}; + +PromiEvent.resolve = function(value) { + var promise = PromiEvent(true); + promise.resolve(value); + return promise.eventEmitter; +}; + +module.exports = PromiEvent; diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index 3b13ed4f26d..579c9d65524 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -16,60 +16,26 @@ */ /** * @file index.js - * @author Fabian Vogelsteller - * @date 2016 + * @author Samuel Furter + * @date 2018 */ "use strict"; -var EventEmitter = require('eventemitter3'); -var Promise = require("any-promise"); - -/** - * This function generates a defer promise and adds eventEmitter functionality to it - * - * @method eventifiedPromise - */ -var PromiEvent = function PromiEvent(justPromise) {// TODO: Just promise is no longer required - var resolve, reject, - eventEmitter = new Promise(function() { - resolve = arguments[0]; - reject = arguments[1]; - }); - - if(justPromise) { - return { - resolve: resolve, - reject: reject, - eventEmitter: eventEmitter - }; +var version = require('./package.json').version; +var PromiEvent = require('./PromiEvent'); + +module.exports = { + version: version, + + /** + * Returns PromiEvent object + * + * @method create + * + * @param {Boolean} justPromise + */ + create: function(justPromise) { + return new PromiEvent(justPromise); } - - // get eventEmitter - var emitter = new EventEmitter(); - - // add eventEmitter to the promise - eventEmitter._events = emitter._events; - eventEmitter.emit = emitter.emit; - eventEmitter.on = emitter.on; - eventEmitter.once = emitter.once; - eventEmitter.off = emitter.off; - eventEmitter.listeners = emitter.listeners; - eventEmitter.addListener = emitter.addListener; - eventEmitter.removeListener = emitter.removeListener; - eventEmitter.removeAllListeners = emitter.removeAllListeners; - - return { - resolve: resolve, - reject: reject, - eventEmitter: eventEmitter - }; }; - -PromiEvent.resolve = function(value) { - var promise = PromiEvent(true); - promise.resolve(value); - return promise.eventEmitter; -}; - -module.exports = PromiEvent; diff --git a/packages/web3-eth-abi/src/ABICoder.js b/packages/web3-eth-abi/src/ABICoder.js new file mode 100644 index 00000000000..f8e3f959b8d --- /dev/null +++ b/packages/web3-eth-abi/src/ABICoder.js @@ -0,0 +1,309 @@ +/* + 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 . + */ +/** + * @file index.js + * @author Marek Kotewicz + * @author Fabian Vogelsteller + * @date 2018 + */ + +var _ = require('underscore'); +var utils = require('web3-utils'); + +var EthersAbi = require('ethers/utils/abi-coder').AbiCoder; +var ethersAbiCoder = new EthersAbi(function (type, value) { + if (type.match(/^u?int/) && !_.isArray(value) && (!_.isObject(value) || value.constructor.name !== 'BN')) { + return value.toString(); + } + return value; +}); + +// result method +function Result() { +} + +/** + * ABICoder prototype should be used to encode/decode solidity params of any type + */ +var ABICoder = function () { +}; + +/** + * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. + * + * @method encodeFunctionSignature + * @param {String|Object} functionName + * @return {String} encoded function name + */ +ABICoder.prototype.encodeFunctionSignature = function (functionName) { + if (_.isObject(functionName)) { + functionName = utils._jsonInterfaceMethodToString(functionName); + } + + return utils.sha3(functionName).slice(0, 10); +}; + +/** + * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. + * + * @method encodeEventSignature + * @param {String|Object} functionName + * @return {String} encoded function name + */ +ABICoder.prototype.encodeEventSignature = function (functionName) { + if (_.isObject(functionName)) { + functionName = utils._jsonInterfaceMethodToString(functionName); + } + + return utils.sha3(functionName); +}; + +/** + * Should be used to encode plain param + * + * @method encodeParameter + * @param {String} type + * @param {Object} param + * @return {String} encoded plain param + */ +ABICoder.prototype.encodeParameter = function (type, param) { + return this.encodeParameters([type], [param]); +}; + +/** + * Should be used to encode list of params + * + * @method encodeParameters + * @param {Array} types + * @param {Array} params + * @return {String} encoded list of params + */ +ABICoder.prototype.encodeParameters = function (types, params) { + return ethersAbiCoder.encode(this.mapTypes(types), params); +}; + +/** + * Map types if simplified format is used + * + * @method mapTypes + * @param {Array} types + * @return {Array} + */ +ABICoder.prototype.mapTypes = function (types) { + var self = this; + var mappedTypes = []; + types.forEach(function (type) { + if (self.isSimplifiedStructFormat(type)) { + var structName = Object.keys(type)[0]; + mappedTypes.push( + Object.assign( + self.mapStructNameAndType(structName), + { + components: self.mapStructToCoderFormat(type[structName]) + } + ) + ); + + return; + } + + mappedTypes.push(type); + }); + + return mappedTypes; +}; + +/** + * Check if type is simplified struct format + * + * @method isSimplifiedStructFormat + * @param {String | Object} type + * @returns {boolean} + */ +ABICoder.prototype.isSimplifiedStructFormat = function (type) { + return typeof type === 'object' && typeof type.components === 'undefined' && typeof type.name === 'undefined'; +}; + +/** + * Maps the correct tuple type and name when the simplified format in encode/decodeParameter is used + * + * @method mapStructNameAndType + * @param {String} structName + * @return {{type: string, name: *}} + */ +ABICoder.prototype.mapStructNameAndType = function (structName) { + var type = 'tuple'; + + if (structName.indexOf('[]') > -1) { + type = 'tuple[]'; + structName = structName.slice(0, -2); + } + + return {type: type, name: structName}; +}; + +/** + * Maps the simplified format in to the expected format of the ABICoder + * + * @method mapStructToCoderFormat + * @param {Object} struct + * @return {Array} + */ +ABICoder.prototype.mapStructToCoderFormat = function (struct) { + var self = this; + var components = []; + Object.keys(struct).forEach(function (key) { + if (typeof struct[key] === 'object') { + components.push( + Object.assign( + self.mapStructNameAndType(key), + { + components: self.mapStructToCoderFormat(struct[key]) + } + ) + ); + + return; + } + + components.push({ + name: key, + type: struct[key] + }); + }); + + return components; +}; + +/** + * Encodes a function call from its json interface and parameters. + * + * @method encodeFunctionCall + * @param {Array} jsonInterface + * @param {Array} params + * @return {String} The encoded ABI for this function call + */ +ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { + return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface.inputs, params).replace('0x', ''); +}; + +/** + * Should be used to decode bytes to plain param + * + * @method decodeParameter + * @param {String} type + * @param {String} bytes + * @return {Object} plain param + */ +ABICoder.prototype.decodeParameter = function (type, bytes) { + return this.decodeParameters([type], bytes)[0]; +}; + +/** + * Should be used to decode list of params + * + * @method decodeParameter + * @param {Array} outputs + * @param {String} bytes + * @return {Array} array of plain params + */ +ABICoder.prototype.decodeParameters = function (outputs, bytes) { + if (!bytes || bytes === '0x' || bytes === '0X') { + throw new Error('Returned values aren\'t valid, did it run Out of Gas?'); + } + + var res = ethersAbiCoder.decode(this.mapTypes(outputs), '0x' + bytes.replace(/0x/i, '')); + var returnValue = new Result(); + returnValue.__length__ = 0; + + outputs.forEach(function (output, i) { + var decodedValue = res[returnValue.__length__]; + decodedValue = (decodedValue === '0x') ? null : decodedValue; + + returnValue[i] = decodedValue; + + if (_.isObject(output) && output.name) { + returnValue[output.name] = decodedValue; + } + + returnValue.__length__++; + }); + + return returnValue; +}; + +/** + * Decodes events non- and indexed parameters. + * + * @method decodeLog + * @param {Object} inputs + * @param {String} data + * @param {Array} topics + * @return {Array} array of plain params + */ +ABICoder.prototype.decodeLog = function (inputs, data, topics) { + var _this = this; + topics = _.isArray(topics) ? topics : [topics]; + + data = data || ''; + + var notIndexedInputs = []; + var indexedParams = []; + var topicCount = 0; + + // TODO check for anonymous logs? + + inputs.forEach(function (input, i) { + if (input.indexed) { + indexedParams[i] = (['bool', 'int', 'uint', 'address', 'fixed', 'ufixed'].find(function (staticType) { + return input.type.indexOf(staticType) !== -1; + })) ? _this.decodeParameter(input.type, topics[topicCount]) : topics[topicCount]; + topicCount++; + } else { + notIndexedInputs[i] = input; + } + }); + + + var nonIndexedData = data; + var notIndexedParams = (nonIndexedData) ? this.decodeParameters(notIndexedInputs, nonIndexedData) : []; + + var returnValue = new Result(); + returnValue.__length__ = 0; + + + inputs.forEach(function (res, i) { + returnValue[i] = (res.type === 'string') ? '' : null; + + if (typeof notIndexedParams[i] !== 'undefined') { + returnValue[i] = notIndexedParams[i]; + } + if (typeof indexedParams[i] !== 'undefined') { + returnValue[i] = indexedParams[i]; + } + + if (res.name) { + returnValue[res.name] = returnValue[i]; + } + + returnValue.__length__++; + }); + + return returnValue; +}; + +module.exports = ABICoder; diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index 24b15398a4b..438a04b63cb 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -16,296 +16,26 @@ */ /** * @file index.js - * @author Marek Kotewicz - * @author Fabian Vogelsteller + * @author Samuel Furter * @date 2018 */ -var _ = require('underscore'); -var utils = require('web3-utils'); +'use strict'; -var EthersAbi = require('ethers/utils/abi-coder').AbiCoder; -var ethersAbiCoder = new EthersAbi(function (type, value) { - if (type.match(/^u?int/) && !_.isArray(value) && (!_.isObject(value) || value.constructor.name !== 'BN')) { - return value.toString(); - } - return value; -}); - -// result method -function Result() { -} - -/** - * ABICoder prototype should be used to encode/decode solidity params of any type - */ -var ABICoder = function () { -}; +var version = require('./package.json').version; +var ABICoder = require('./ABICoder'); -/** - * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. - * - * @method encodeFunctionSignature - * @param {String|Object} functionName - * @return {String} encoded function name - */ -ABICoder.prototype.encodeFunctionSignature = function (functionName) { - if (_.isObject(functionName)) { - functionName = utils._jsonInterfaceMethodToString(functionName); - } - - return utils.sha3(functionName).slice(0, 10); -}; +module.exports = { + version: version, -/** - * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. - * - * @method encodeEventSignature - * @param {String|Object} functionName - * @return {String} encoded function name - */ -ABICoder.prototype.encodeEventSignature = function (functionName) { - if (_.isObject(functionName)) { - functionName = utils._jsonInterfaceMethodToString(functionName); + /** + * Returns the ABICoder object + * + * @method create + * + * @returns {ABICoder} + */ + create: function() { + return new ABICoder(); } - - return utils.sha3(functionName); -}; - -/** - * Should be used to encode plain param - * - * @method encodeParameter - * @param {String} type - * @param {Object} param - * @return {String} encoded plain param - */ -ABICoder.prototype.encodeParameter = function (type, param) { - return this.encodeParameters([type], [param]); -}; - -/** - * Should be used to encode list of params - * - * @method encodeParameters - * @param {Array} types - * @param {Array} params - * @return {String} encoded list of params - */ -ABICoder.prototype.encodeParameters = function (types, params) { - return ethersAbiCoder.encode(this.mapTypes(types), params); }; - -/** - * Map types if simplified format is used - * - * @method mapTypes - * @param {Array} types - * @return {Array} - */ -ABICoder.prototype.mapTypes = function (types) { - var self = this; - var mappedTypes = []; - types.forEach(function (type) { - if (self.isSimplifiedStructFormat(type)) { - var structName = Object.keys(type)[0]; - mappedTypes.push( - Object.assign( - self.mapStructNameAndType(structName), - { - components: self.mapStructToCoderFormat(type[structName]) - } - ) - ); - - return; - } - - mappedTypes.push(type); - }); - - return mappedTypes; -}; - -/** - * Check if type is simplified struct format - * - * @method isSimplifiedStructFormat - * @param {String | Object} type - * @returns {boolean} - */ -ABICoder.prototype.isSimplifiedStructFormat = function (type) { - return typeof type === 'object' && typeof type.components === 'undefined' && typeof type.name === 'undefined'; -}; - -/** - * Maps the correct tuple type and name when the simplified format in encode/decodeParameter is used - * - * @method mapStructNameAndType - * @param {String} structName - * @return {{type: string, name: *}} - */ -ABICoder.prototype.mapStructNameAndType = function (structName) { - var type = 'tuple'; - - if (structName.indexOf('[]') > -1) { - type = 'tuple[]'; - structName = structName.slice(0, -2); - } - - return {type: type, name: structName}; -}; - -/** - * Maps the simplified format in to the expected format of the ABICoder - * - * @method mapStructToCoderFormat - * @param {Object} struct - * @return {Array} - */ -ABICoder.prototype.mapStructToCoderFormat = function (struct) { - var self = this; - var components = []; - Object.keys(struct).forEach(function (key) { - if (typeof struct[key] === 'object') { - components.push( - Object.assign( - self.mapStructNameAndType(key), - { - components: self.mapStructToCoderFormat(struct[key]) - } - ) - ); - - return; - } - - components.push({ - name: key, - type: struct[key] - }); - }); - - return components; -}; - -/** - * Encodes a function call from its json interface and parameters. - * - * @method encodeFunctionCall - * @param {Array} jsonInterface - * @param {Array} params - * @return {String} The encoded ABI for this function call - */ -ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { - return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface.inputs, params).replace('0x', ''); -}; - -/** - * Should be used to decode bytes to plain param - * - * @method decodeParameter - * @param {String} type - * @param {String} bytes - * @return {Object} plain param - */ -ABICoder.prototype.decodeParameter = function (type, bytes) { - return this.decodeParameters([type], bytes)[0]; -}; - -/** - * Should be used to decode list of params - * - * @method decodeParameter - * @param {Array} outputs - * @param {String} bytes - * @return {Array} array of plain params - */ -ABICoder.prototype.decodeParameters = function (outputs, bytes) { - if (!bytes || bytes === '0x' || bytes === '0X') { - throw new Error('Returned values aren\'t valid, did it run Out of Gas?'); - } - - var res = ethersAbiCoder.decode(this.mapTypes(outputs), '0x' + bytes.replace(/0x/i, '')); - var returnValue = new Result(); - returnValue.__length__ = 0; - - outputs.forEach(function (output, i) { - var decodedValue = res[returnValue.__length__]; - decodedValue = (decodedValue === '0x') ? null : decodedValue; - - returnValue[i] = decodedValue; - - if (_.isObject(output) && output.name) { - returnValue[output.name] = decodedValue; - } - - returnValue.__length__++; - }); - - return returnValue; -}; - -/** - * Decodes events non- and indexed parameters. - * - * @method decodeLog - * @param {Object} inputs - * @param {String} data - * @param {Array} topics - * @return {Array} array of plain params - */ -ABICoder.prototype.decodeLog = function (inputs, data, topics) { - var _this = this; - topics = _.isArray(topics) ? topics : [topics]; - - data = data || ''; - - var notIndexedInputs = []; - var indexedParams = []; - var topicCount = 0; - - // TODO check for anonymous logs? - - inputs.forEach(function (input, i) { - if (input.indexed) { - indexedParams[i] = (['bool', 'int', 'uint', 'address', 'fixed', 'ufixed'].find(function (staticType) { - return input.type.indexOf(staticType) !== -1; - })) ? _this.decodeParameter(input.type, topics[topicCount]) : topics[topicCount]; - topicCount++; - } else { - notIndexedInputs[i] = input; - } - }); - - - var nonIndexedData = data; - var notIndexedParams = (nonIndexedData) ? this.decodeParameters(notIndexedInputs, nonIndexedData) : []; - - var returnValue = new Result(); - returnValue.__length__ = 0; - - - inputs.forEach(function (res, i) { - returnValue[i] = (res.type === 'string') ? '' : null; - - if (typeof notIndexedParams[i] !== 'undefined') { - returnValue[i] = notIndexedParams[i]; - } - if (typeof indexedParams[i] !== 'undefined') { - returnValue[i] = indexedParams[i]; - } - - if (res.name) { - returnValue[res.name] = returnValue[i]; - } - - returnValue.__length__++; - }); - - return returnValue; -}; - -var coder = new ABICoder(); - -module.exports = coder; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js new file mode 100644 index 00000000000..dfaf98ea45b --- /dev/null +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -0,0 +1,534 @@ +/* + 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 . + */ +/** + * @file Accounts.js + * @author Fabian Vogelsteller + * @date 2017 + */ + +"use strict"; + +var _ = require("underscore"); +var core = require('web3-core'); +var Method = require('web3-core-method'); +var Promise = require('any-promise'); +var Account = require("eth-lib/lib/account"); +var Hash = require("eth-lib/lib/hash"); +var RLP = require("eth-lib/lib/rlp"); +var Nat = require("eth-lib/lib/nat"); +var Bytes = require("eth-lib/lib/bytes"); +var cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); +var scryptsy = require('scrypt.js'); +var uuid = require('uuid'); +var utils = require('web3-utils'); +var helpers = require('web3-core-helpers'); + +var isNot = function(value) { + return (_.isUndefined(value) || _.isNull(value)); +}; + +var trimLeadingZero = function (hex) { + while (hex && hex.startsWith('0x0')) { + hex = '0x' + hex.slice(3); + } + return hex; +}; + +var makeEven = function (hex) { + if(hex.length % 2 === 1) { + hex = hex.replace('0x', '0x0'); + } + return hex; +}; + + +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 + }), + new Method({ + name: 'getTransactionCount', + call: 'eth_getTransactionCount', + params: 2, + inputFormatter: [function (address) { + if (utils.isAddress(address)) { + return address; + } else { + throw new Error('Address '+ address +' is not a valid address to get the "transactionCount".'); + } + }, function () { return 'latest'; }] + }) + ]; + // attach methods to this._ethereumCall + this._ethereumCall = {}; + _.each(_ethereumCall, function (method) { + method.attachToObject(_this._ethereumCall); + method.setRequestManager(_this._requestManager); + }); + + + this.wallet = new Wallet(this); +}; + +Accounts.prototype._addAccountFunctions = function (account) { + var _this = this; + + // add sign functions + account.signTransaction = function signTransaction(tx, callback) { + return _this.signTransaction(tx, account.privateKey, callback); + }; + account.sign = function sign(data) { + return _this.sign(data, account.privateKey); + }; + + account.encrypt = function encrypt(password, options) { + return _this.encrypt(account.privateKey, password, options); + }; + + + return account; +}; + +Accounts.prototype.create = function create(entropy) { + return this._addAccountFunctions(Account.create(entropy || utils.randomHex(32))); +}; + +Accounts.prototype.privateKeyToAccount = function privateKeyToAccount(privateKey) { + return this._addAccountFunctions(Account.fromPrivate(privateKey)); +}; + +Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, callback) { + var _this = this, + error = false, + result; + + callback = callback || function () {}; + + if (!tx) { + error = new Error('No transaction object given!'); + + callback(error); + return Promise.reject(error); + } + + function signed (tx) { + + if (!tx.gas && !tx.gasLimit) { + error = new Error('"gas" is missing'); + } + + if (tx.nonce < 0 || + tx.gas < 0 || + tx.gasPrice < 0 || + tx.chainId < 0) { + error = new Error('Gas, gasPrice, nonce or chainId is lower than 0'); + } + + if (error) { + callback(error); + return Promise.reject(error); + } + + try { + tx = helpers.formatters.inputCallFormatter(tx); + + var transaction = tx; + transaction.to = tx.to || '0x'; + transaction.data = tx.data || '0x'; + transaction.value = tx.value || '0x'; + transaction.chainId = utils.numberToHex(tx.chainId); + + var rlpEncoded = RLP.encode([ + Bytes.fromNat(transaction.nonce), + Bytes.fromNat(transaction.gasPrice), + Bytes.fromNat(transaction.gas), + transaction.to.toLowerCase(), + Bytes.fromNat(transaction.value), + transaction.data, + Bytes.fromNat(transaction.chainId || "0x1"), + "0x", + "0x"]); + + + var hash = Hash.keccak256(rlpEncoded); + + var signature = Account.makeSigner(Nat.toNumber(transaction.chainId || "0x1") * 2 + 35)(Hash.keccak256(rlpEncoded), privateKey); + + var rawTx = RLP.decode(rlpEncoded).slice(0, 6).concat(Account.decodeSignature(signature)); + + rawTx[6] = makeEven(trimLeadingZero(rawTx[6])); + rawTx[7] = makeEven(trimLeadingZero(rawTx[7])); + rawTx[8] = makeEven(trimLeadingZero(rawTx[8])); + + var rawTransaction = RLP.encode(rawTx); + + var values = RLP.decode(rawTransaction); + result = { + messageHash: hash, + v: trimLeadingZero(values[6]), + r: trimLeadingZero(values[7]), + s: trimLeadingZero(values[8]), + rawTransaction: rawTransaction + }; + + } catch(e) { + callback(e); + return Promise.reject(e); + } + + callback(null, result); + return result; + } + + // Resolve immediately if nonce, chainId and price are provided + if (tx.nonce !== undefined && tx.chainId !== undefined && tx.gasPrice !== undefined) { + return Promise.resolve(signed(tx)); + } + + + // Otherwise, get the missing info from the Ethereum Node + return Promise.all([ + isNot(tx.chainId) ? _this._ethereumCall.getId() : tx.chainId, + isNot(tx.gasPrice) ? _this._ethereumCall.getGasPrice() : tx.gasPrice, + isNot(tx.nonce) ? _this._ethereumCall.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce + ]).then(function (args) { + if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) { + throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: '+ JSON.stringify(args)); + } + return signed(_.extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2]})); + }); +}; + +/* jshint ignore:start */ +Accounts.prototype.recoverTransaction = function recoverTransaction(rawTx) { + var values = RLP.decode(rawTx); + var signature = Account.encodeSignature(values.slice(6,9)); + var recovery = Bytes.toNumber(values[6]); + var extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), "0x", "0x"]; + var signingData = values.slice(0,6).concat(extraData); + var signingDataHex = RLP.encode(signingData); + return Account.recover(Hash.keccak256(signingDataHex), signature); +}; +/* jshint ignore:end */ + +Accounts.prototype.hashMessage = function hashMessage(data) { + var message = utils.isHexStrict(data) ? utils.hexToBytes(data) : data; + var messageBuffer = Buffer.from(message); + var preamble = "\x19Ethereum Signed Message:\n" + message.length; + var preambleBuffer = Buffer.from(preamble); + var ethMessage = Buffer.concat([preambleBuffer, messageBuffer]); + return Hash.keccak256s(ethMessage); +}; + +Accounts.prototype.sign = function sign(data, privateKey) { + var hash = this.hashMessage(data); + var signature = Account.sign(hash, privateKey); + var vrs = Account.decodeSignature(signature); + return { + message: data, + messageHash: hash, + v: vrs[0], + r: vrs[1], + s: vrs[2], + signature: signature + }; +}; + +Accounts.prototype.recover = function recover(message, signature, preFixed) { + var args = [].slice.apply(arguments); + + + if (_.isObject(message)) { + return this.recover(message.messageHash, Account.encodeSignature([message.v, message.r, message.s]), true); + } + + if (!preFixed) { + message = this.hashMessage(message); + } + + if (args.length >= 4) { + preFixed = args.slice(-1)[0]; + preFixed = _.isBoolean(preFixed) ? !!preFixed : false; + + return this.recover(message, Account.encodeSignature(args.slice(1, 4)), preFixed); // v, r, s + } + return Account.recover(message, signature); +}; + +// Taken from https://github.com/ethereumjs/ethereumjs-wallet +Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) { + /* jshint maxcomplexity: 10 */ + + if(!_.isString(password)) { + throw new Error('No password given.'); + } + + var json = (_.isObject(v3Keystore)) ? v3Keystore : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore); + + if (json.version !== 3) { + throw new Error('Not a valid V3 wallet'); + } + + var derivedKey; + var kdfparams; + if (json.crypto.kdf === 'scrypt') { + kdfparams = json.crypto.kdfparams; + + // FIXME: support progress reporting callback + derivedKey = scryptsy(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen); + } else if (json.crypto.kdf === 'pbkdf2') { + kdfparams = json.crypto.kdfparams; + + if (kdfparams.prf !== 'hmac-sha256') { + throw new Error('Unsupported parameters to PBKDF2'); + } + + derivedKey = cryp.pbkdf2Sync(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256'); + } else { + throw new Error('Unsupported key derivation scheme'); + } + + var ciphertext = new Buffer(json.crypto.ciphertext, 'hex'); + + var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ])).replace('0x',''); + if (mac !== json.crypto.mac) { + throw new Error('Key derivation failed - possibly wrong password'); + } + + var decipher = cryp.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), new Buffer(json.crypto.cipherparams.iv, 'hex')); + var seed = '0x'+ Buffer.concat([ decipher.update(ciphertext), decipher.final() ]).toString('hex'); + + return this.privateKeyToAccount(seed); +}; + +Accounts.prototype.encrypt = function (privateKey, password, options) { + /* jshint maxcomplexity: 20 */ + var account = this.privateKeyToAccount(privateKey); + + options = options || {}; + var salt = options.salt || cryp.randomBytes(32); + var iv = options.iv || cryp.randomBytes(16); + + var derivedKey; + var kdf = options.kdf || 'scrypt'; + var kdfparams = { + dklen: options.dklen || 32, + salt: salt.toString('hex') + }; + + if (kdf === 'pbkdf2') { + kdfparams.c = options.c || 262144; + kdfparams.prf = 'hmac-sha256'; + derivedKey = cryp.pbkdf2Sync(new Buffer(password), salt, kdfparams.c, kdfparams.dklen, 'sha256'); + } else if (kdf === 'scrypt') { + // FIXME: support progress reporting callback + kdfparams.n = options.n || 8192; // 2048 4096 8192 16384 + kdfparams.r = options.r || 8; + kdfparams.p = options.p || 1; + derivedKey = scryptsy(new Buffer(password), salt, kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen); + } else { + throw new Error('Unsupported kdf'); + } + + var cipher = cryp.createCipheriv(options.cipher || 'aes-128-ctr', derivedKey.slice(0, 16), iv); + if (!cipher) { + throw new Error('Unsupported cipher'); + } + + var ciphertext = Buffer.concat([ cipher.update(new Buffer(account.privateKey.replace('0x',''), 'hex')), cipher.final() ]); + + var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex') ])).replace('0x',''); + + return { + version: 3, + id: uuid.v4({ random: options.uuid || cryp.randomBytes(16) }), + address: account.address.toLowerCase().replace('0x',''), + crypto: { + ciphertext: ciphertext.toString('hex'), + cipherparams: { + iv: iv.toString('hex') + }, + cipher: options.cipher || 'aes-128-ctr', + kdf: kdf, + kdfparams: kdfparams, + mac: mac.toString('hex') + } + }; +}; + + +// Note: this is trying to follow closely the specs on +// http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html + +function Wallet(accounts) { + this._accounts = accounts; + this.length = 0; + this.defaultKeyName = "web3js_wallet"; +} + +Wallet.prototype._findSafeIndex = function (pointer) { + pointer = pointer || 0; + if (_.has(this, pointer)) { + return this._findSafeIndex(pointer + 1); + } else { + return pointer; + } +}; + +Wallet.prototype._currentIndexes = function () { + var keys = Object.keys(this); + var indexes = keys + .map(function(key) { return parseInt(key); }) + .filter(function(n) { return (n < 9e20); }); + + return indexes; +}; + +Wallet.prototype.create = function (numberOfAccounts, entropy) { + for (var i = 0; i < numberOfAccounts; ++i) { + this.add(this._accounts.create(entropy).privateKey); + } + return this; +}; + +Wallet.prototype.add = function (account) { + + if (_.isString(account)) { + account = this._accounts.privateKeyToAccount(account); + } + if (!this[account.address]) { + account = this._accounts.privateKeyToAccount(account.privateKey); + account.index = this._findSafeIndex(); + + this[account.index] = account; + this[account.address] = account; + this[account.address.toLowerCase()] = account; + + this.length++; + + return account; + } else { + return this[account.address]; + } +}; + +Wallet.prototype.remove = function (addressOrIndex) { + var account = this[addressOrIndex]; + + if (account && account.address) { + // address + this[account.address].privateKey = null; + delete this[account.address]; + // address lowercase + this[account.address.toLowerCase()].privateKey = null; + delete this[account.address.toLowerCase()]; + // index + this[account.index].privateKey = null; + delete this[account.index]; + + this.length--; + + return true; + } else { + return false; + } +}; + +Wallet.prototype.clear = function () { + var _this = this; + var indexes = this._currentIndexes(); + + indexes.forEach(function(index) { + _this.remove(index); + }); + + return this; +}; + +Wallet.prototype.encrypt = function (password, options) { + var _this = this; + var indexes = this._currentIndexes(); + + var accounts = indexes.map(function(index) { + return _this[index].encrypt(password, options); + }); + + return accounts; +}; + + +Wallet.prototype.decrypt = function (encryptedWallet, password) { + var _this = this; + + encryptedWallet.forEach(function (keystore) { + var account = _this._accounts.decrypt(keystore, password); + + if (account) { + _this.add(account); + } else { + throw new Error('Couldn\'t decrypt accounts. Password wrong?'); + } + }); + + return this; +}; + +Wallet.prototype.save = function (password, keyName) { + localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password))); + + return true; +}; + +Wallet.prototype.load = function (password, keyName) { + var keystore = localStorage.getItem(keyName || this.defaultKeyName); + + if (keystore) { + try { + keystore = JSON.parse(keystore); + } catch(e) { + + } + } + + return this.decrypt(keystore || [], password); +}; + +if (typeof localStorage === 'undefined') { + delete Wallet.prototype.save; + delete Wallet.prototype.load; +} + + +module.exports = Accounts; diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index f3da6f30f34..987bc964d17 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -15,520 +15,27 @@ along with web3.js. If not, see . */ /** - * @file accounts.js - * @author Fabian Vogelsteller - * @date 2017 + * @file index.js + * @author Samuel Furter + * @date 2018 */ "use strict"; -var _ = require("underscore"); -var core = require('web3-core'); -var Method = require('web3-core-method'); -var Promise = require('any-promise'); -var Account = require("eth-lib/lib/account"); -var Hash = require("eth-lib/lib/hash"); -var RLP = require("eth-lib/lib/rlp"); -var Nat = require("eth-lib/lib/nat"); -var Bytes = require("eth-lib/lib/bytes"); -var cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); -var scryptsy = require('scrypt.js'); -var uuid = require('uuid'); -var utils = require('web3-utils'); -var helpers = require('web3-core-helpers'); +var version = require('./package.json').version; +var Accounts = require('./Accounts'); -var isNot = function(value) { - return (_.isUndefined(value) || _.isNull(value)); -}; +module.exports = { + version: version, -var trimLeadingZero = function (hex) { - while (hex && hex.startsWith('0x0')) { - hex = '0x' + hex.slice(3); + /** + * Returns the Accounts object + * + * @method create + * + * @returns {Accounts} + */ + create: function() { // TODO: Refactor the accounts object because of the new method and connection handling. + return new Accounts(); } - return hex; }; - -var makeEven = function (hex) { - if(hex.length % 2 === 1) { - hex = hex.replace('0x', '0x0'); - } - return hex; -}; - - -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 - }), - new Method({ - name: 'getTransactionCount', - call: 'eth_getTransactionCount', - params: 2, - inputFormatter: [function (address) { - if (utils.isAddress(address)) { - return address; - } else { - throw new Error('Address '+ address +' is not a valid address to get the "transactionCount".'); - } - }, function () { return 'latest'; }] - }) - ]; - // attach methods to this._ethereumCall - this._ethereumCall = {}; - _.each(_ethereumCall, function (method) { - method.attachToObject(_this._ethereumCall); - method.setRequestManager(_this._requestManager); - }); - - - this.wallet = new Wallet(this); -}; - -Accounts.prototype._addAccountFunctions = function (account) { - var _this = this; - - // add sign functions - account.signTransaction = function signTransaction(tx, callback) { - return _this.signTransaction(tx, account.privateKey, callback); - }; - account.sign = function sign(data) { - return _this.sign(data, account.privateKey); - }; - - account.encrypt = function encrypt(password, options) { - return _this.encrypt(account.privateKey, password, options); - }; - - - return account; -}; - -Accounts.prototype.create = function create(entropy) { - return this._addAccountFunctions(Account.create(entropy || utils.randomHex(32))); -}; - -Accounts.prototype.privateKeyToAccount = function privateKeyToAccount(privateKey) { - return this._addAccountFunctions(Account.fromPrivate(privateKey)); -}; - -Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, callback) { - var _this = this, - error = false, - result; - - callback = callback || function () {}; - - if (!tx) { - error = new Error('No transaction object given!'); - - callback(error); - return Promise.reject(error); - } - - function signed (tx) { - - if (!tx.gas && !tx.gasLimit) { - error = new Error('"gas" is missing'); - } - - if (tx.nonce < 0 || - tx.gas < 0 || - tx.gasPrice < 0 || - tx.chainId < 0) { - error = new Error('Gas, gasPrice, nonce or chainId is lower than 0'); - } - - if (error) { - callback(error); - return Promise.reject(error); - } - - try { - tx = helpers.formatters.inputCallFormatter(tx); - - var transaction = tx; - transaction.to = tx.to || '0x'; - transaction.data = tx.data || '0x'; - transaction.value = tx.value || '0x'; - transaction.chainId = utils.numberToHex(tx.chainId); - - var rlpEncoded = RLP.encode([ - Bytes.fromNat(transaction.nonce), - Bytes.fromNat(transaction.gasPrice), - Bytes.fromNat(transaction.gas), - transaction.to.toLowerCase(), - Bytes.fromNat(transaction.value), - transaction.data, - Bytes.fromNat(transaction.chainId || "0x1"), - "0x", - "0x"]); - - - var hash = Hash.keccak256(rlpEncoded); - - var signature = Account.makeSigner(Nat.toNumber(transaction.chainId || "0x1") * 2 + 35)(Hash.keccak256(rlpEncoded), privateKey); - - var rawTx = RLP.decode(rlpEncoded).slice(0, 6).concat(Account.decodeSignature(signature)); - - rawTx[6] = makeEven(trimLeadingZero(rawTx[6])); - rawTx[7] = makeEven(trimLeadingZero(rawTx[7])); - rawTx[8] = makeEven(trimLeadingZero(rawTx[8])); - - var rawTransaction = RLP.encode(rawTx); - - var values = RLP.decode(rawTransaction); - result = { - messageHash: hash, - v: trimLeadingZero(values[6]), - r: trimLeadingZero(values[7]), - s: trimLeadingZero(values[8]), - rawTransaction: rawTransaction - }; - - } catch(e) { - callback(e); - return Promise.reject(e); - } - - callback(null, result); - return result; - } - - // Resolve immediately if nonce, chainId and price are provided - if (tx.nonce !== undefined && tx.chainId !== undefined && tx.gasPrice !== undefined) { - return Promise.resolve(signed(tx)); - } - - - // Otherwise, get the missing info from the Ethereum Node - return Promise.all([ - isNot(tx.chainId) ? _this._ethereumCall.getId() : tx.chainId, - isNot(tx.gasPrice) ? _this._ethereumCall.getGasPrice() : tx.gasPrice, - isNot(tx.nonce) ? _this._ethereumCall.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce - ]).then(function (args) { - if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) { - throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: '+ JSON.stringify(args)); - } - return signed(_.extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2]})); - }); -}; - -/* jshint ignore:start */ -Accounts.prototype.recoverTransaction = function recoverTransaction(rawTx) { - var values = RLP.decode(rawTx); - var signature = Account.encodeSignature(values.slice(6,9)); - var recovery = Bytes.toNumber(values[6]); - var extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), "0x", "0x"]; - var signingData = values.slice(0,6).concat(extraData); - var signingDataHex = RLP.encode(signingData); - return Account.recover(Hash.keccak256(signingDataHex), signature); -}; -/* jshint ignore:end */ - -Accounts.prototype.hashMessage = function hashMessage(data) { - var message = utils.isHexStrict(data) ? utils.hexToBytes(data) : data; - var messageBuffer = Buffer.from(message); - var preamble = "\x19Ethereum Signed Message:\n" + message.length; - var preambleBuffer = Buffer.from(preamble); - var ethMessage = Buffer.concat([preambleBuffer, messageBuffer]); - return Hash.keccak256s(ethMessage); -}; - -Accounts.prototype.sign = function sign(data, privateKey) { - var hash = this.hashMessage(data); - var signature = Account.sign(hash, privateKey); - var vrs = Account.decodeSignature(signature); - return { - message: data, - messageHash: hash, - v: vrs[0], - r: vrs[1], - s: vrs[2], - signature: signature - }; -}; - -Accounts.prototype.recover = function recover(message, signature, preFixed) { - var args = [].slice.apply(arguments); - - - if (_.isObject(message)) { - return this.recover(message.messageHash, Account.encodeSignature([message.v, message.r, message.s]), true); - } - - if (!preFixed) { - message = this.hashMessage(message); - } - - if (args.length >= 4) { - preFixed = args.slice(-1)[0]; - preFixed = _.isBoolean(preFixed) ? !!preFixed : false; - - return this.recover(message, Account.encodeSignature(args.slice(1, 4)), preFixed); // v, r, s - } - return Account.recover(message, signature); -}; - -// Taken from https://github.com/ethereumjs/ethereumjs-wallet -Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) { - /* jshint maxcomplexity: 10 */ - - if(!_.isString(password)) { - throw new Error('No password given.'); - } - - var json = (_.isObject(v3Keystore)) ? v3Keystore : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore); - - if (json.version !== 3) { - throw new Error('Not a valid V3 wallet'); - } - - var derivedKey; - var kdfparams; - if (json.crypto.kdf === 'scrypt') { - kdfparams = json.crypto.kdfparams; - - // FIXME: support progress reporting callback - derivedKey = scryptsy(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen); - } else if (json.crypto.kdf === 'pbkdf2') { - kdfparams = json.crypto.kdfparams; - - if (kdfparams.prf !== 'hmac-sha256') { - throw new Error('Unsupported parameters to PBKDF2'); - } - - derivedKey = cryp.pbkdf2Sync(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256'); - } else { - throw new Error('Unsupported key derivation scheme'); - } - - var ciphertext = new Buffer(json.crypto.ciphertext, 'hex'); - - var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ])).replace('0x',''); - if (mac !== json.crypto.mac) { - throw new Error('Key derivation failed - possibly wrong password'); - } - - var decipher = cryp.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), new Buffer(json.crypto.cipherparams.iv, 'hex')); - var seed = '0x'+ Buffer.concat([ decipher.update(ciphertext), decipher.final() ]).toString('hex'); - - return this.privateKeyToAccount(seed); -}; - -Accounts.prototype.encrypt = function (privateKey, password, options) { - /* jshint maxcomplexity: 20 */ - var account = this.privateKeyToAccount(privateKey); - - options = options || {}; - var salt = options.salt || cryp.randomBytes(32); - var iv = options.iv || cryp.randomBytes(16); - - var derivedKey; - var kdf = options.kdf || 'scrypt'; - var kdfparams = { - dklen: options.dklen || 32, - salt: salt.toString('hex') - }; - - if (kdf === 'pbkdf2') { - kdfparams.c = options.c || 262144; - kdfparams.prf = 'hmac-sha256'; - derivedKey = cryp.pbkdf2Sync(new Buffer(password), salt, kdfparams.c, kdfparams.dklen, 'sha256'); - } else if (kdf === 'scrypt') { - // FIXME: support progress reporting callback - kdfparams.n = options.n || 8192; // 2048 4096 8192 16384 - kdfparams.r = options.r || 8; - kdfparams.p = options.p || 1; - derivedKey = scryptsy(new Buffer(password), salt, kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen); - } else { - throw new Error('Unsupported kdf'); - } - - var cipher = cryp.createCipheriv(options.cipher || 'aes-128-ctr', derivedKey.slice(0, 16), iv); - if (!cipher) { - throw new Error('Unsupported cipher'); - } - - var ciphertext = Buffer.concat([ cipher.update(new Buffer(account.privateKey.replace('0x',''), 'hex')), cipher.final() ]); - - var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex') ])).replace('0x',''); - - return { - version: 3, - id: uuid.v4({ random: options.uuid || cryp.randomBytes(16) }), - address: account.address.toLowerCase().replace('0x',''), - crypto: { - ciphertext: ciphertext.toString('hex'), - cipherparams: { - iv: iv.toString('hex') - }, - cipher: options.cipher || 'aes-128-ctr', - kdf: kdf, - kdfparams: kdfparams, - mac: mac.toString('hex') - } - }; -}; - - -// Note: this is trying to follow closely the specs on -// http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html - -function Wallet(accounts) { - this._accounts = accounts; - this.length = 0; - this.defaultKeyName = "web3js_wallet"; -} - -Wallet.prototype._findSafeIndex = function (pointer) { - pointer = pointer || 0; - if (_.has(this, pointer)) { - return this._findSafeIndex(pointer + 1); - } else { - return pointer; - } -}; - -Wallet.prototype._currentIndexes = function () { - var keys = Object.keys(this); - var indexes = keys - .map(function(key) { return parseInt(key); }) - .filter(function(n) { return (n < 9e20); }); - - return indexes; -}; - -Wallet.prototype.create = function (numberOfAccounts, entropy) { - for (var i = 0; i < numberOfAccounts; ++i) { - this.add(this._accounts.create(entropy).privateKey); - } - return this; -}; - -Wallet.prototype.add = function (account) { - - if (_.isString(account)) { - account = this._accounts.privateKeyToAccount(account); - } - if (!this[account.address]) { - account = this._accounts.privateKeyToAccount(account.privateKey); - account.index = this._findSafeIndex(); - - this[account.index] = account; - this[account.address] = account; - this[account.address.toLowerCase()] = account; - - this.length++; - - return account; - } else { - return this[account.address]; - } -}; - -Wallet.prototype.remove = function (addressOrIndex) { - var account = this[addressOrIndex]; - - if (account && account.address) { - // address - this[account.address].privateKey = null; - delete this[account.address]; - // address lowercase - this[account.address.toLowerCase()].privateKey = null; - delete this[account.address.toLowerCase()]; - // index - this[account.index].privateKey = null; - delete this[account.index]; - - this.length--; - - return true; - } else { - return false; - } -}; - -Wallet.prototype.clear = function () { - var _this = this; - var indexes = this._currentIndexes(); - - indexes.forEach(function(index) { - _this.remove(index); - }); - - return this; -}; - -Wallet.prototype.encrypt = function (password, options) { - var _this = this; - var indexes = this._currentIndexes(); - - var accounts = indexes.map(function(index) { - return _this[index].encrypt(password, options); - }); - - return accounts; -}; - - -Wallet.prototype.decrypt = function (encryptedWallet, password) { - var _this = this; - - encryptedWallet.forEach(function (keystore) { - var account = _this._accounts.decrypt(keystore, password); - - if (account) { - _this.add(account); - } else { - throw new Error('Couldn\'t decrypt accounts. Password wrong?'); - } - }); - - return this; -}; - -Wallet.prototype.save = function (password, keyName) { - localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password))); - - return true; -}; - -Wallet.prototype.load = function (password, keyName) { - var keystore = localStorage.getItem(keyName || this.defaultKeyName); - - if (keystore) { - try { - keystore = JSON.parse(keystore); - } catch(e) { - - } - } - - return this.decrypt(keystore || [], password); -}; - -if (typeof localStorage === 'undefined') { - delete Wallet.prototype.save; - delete Wallet.prototype.load; -} - - -module.exports = Accounts; diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js new file mode 100644 index 00000000000..f777f7e044e --- /dev/null +++ b/packages/web3-eth-contract/src/Contract.js @@ -0,0 +1,868 @@ +/* + 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 . +*/ +/** + * @file Contract.js + * + * To initialize a contract use: + * + * var Contract = require('web3-eth-contract'); + * Contract.setProvider('ws://localhost:8546'); + * var contract = new Contract(abi, address, ...); + * + * @author Fabian Vogelsteller + * @date 2017 + */ + + +"use strict"; + + +var _ = require('underscore'); +var core = require('web3-core'); +var Method = require('web3-core-method'); +var utils = require('web3-utils'); +var Subscription = require('web3-core-subscriptions').subscription; +var formatters = require('web3-core-helpers').formatters; +var errors = require('web3-core-helpers').errors; +var promiEvent = require('web3-core-promievent'); +var abi = require('web3-eth-abi'); + + +/** + * Should be called to create new contract instance + * + * @method Contract + * @constructor + * @param {Array} jsonInterface + * @param {String} address + * @param {Object} options + */ +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!'); + } + + this.clearSubscriptions = this.connectionModel.provider.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)) { + options = lastArg; + + this.options = _.extend(this.options, this._getOrSetDefaultOptions(options)); + if(_.isObject(address)) { + address = null; + } + } + + // set address + Object.defineProperty(this.options, 'address', { + set: function(value){ + if(value) { + _this._address = utils.toChecksumAddress(formatters.inputAddressFormatter(value)); + } + }, + get: function(){ + return _this._address; + }, + enumerable: true + }); + + // add method and event signatures, when the jsonInterface gets set + Object.defineProperty(this.options, 'jsonInterface', { + set: function(value){ + _this.methods = {}; + _this.events = {}; + + _this._jsonInterface = value.map(function(method) { + var func, + funcName; + + // make constant and payable backwards compatible + method.constant = (method.stateMutability === "view" || method.stateMutability === "pure" || method.constant); + method.payable = (method.stateMutability === "payable" || method.payable); + + + if (method.name) { + funcName = utils._jsonInterfaceMethodToString(method); + } + + + // function + if (method.type === 'function') { + method.signature = abi.encodeFunctionSignature(funcName); + func = _this._createTxObject.bind({ + method: method, + parent: _this + }); + + + // add method only if not one already exists + if(!_this.methods[method.name]) { + _this.methods[method.name] = func; + } else { + var cascadeFunc = _this._createTxObject.bind({ + method: method, + parent: _this, + nextMethod: _this.methods[method.name] + }); + _this.methods[method.name] = cascadeFunc; + } + + // definitely add the method based on its signature + _this.methods[method.signature] = func; + + // add method by name + _this.methods[funcName] = func; + + + // event + } else if (method.type === 'event') { + method.signature = abi.encodeEventSignature(funcName); + var event = _this._on.bind(_this, method.signature); + + // add method only if not already exists + if(!_this.events[method.name] || _this.events[method.name].name === 'bound ') + _this.events[method.name] = event; + + // definitely add the method based on its signature + _this.events[method.signature] = event; + + // add event by name + _this.events[funcName] = event; + } + + + return method; + }); + + // add allEvents + _this.events.allEvents = _this._on.bind(_this, 'allevents'); + + return _this._jsonInterface; + }, + get: function(){ + return _this._jsonInterface; + }, + enumerable: true + }); + + // properties + this.methods = {}; + this.events = {}; + + this._address = null; + this._jsonInterface = []; + + // set getter/setter properties + this.options.address = address; + this.options.jsonInterface = jsonInterface; + +}; + +Contract.setProvider = function(provider, accounts) { + this.connectionModel.provider = provider; + this.accounts = accounts; +}; + + +/** + * Get the callback and modiufy the array if necessary + * + * @method _getCallback + * @param {Array} args + * @return {Function} the callback + */ +Contract.prototype._getCallback = function getCallback(args) { + if (args && _.isFunction(args[args.length - 1])) { + return args.pop(); // modify the args array! + } +}; + +/** + * Checks that no listener with name "newListener" or "removeListener" is added. + * + * @method _checkListener + * @param {String} type + * @param {String} event + * @return {Object} the contract instance + */ +Contract.prototype._checkListener = function(type, event){ + if(event === type) { + throw new Error('The event "'+ type +'" is a reserved event name, you can\'t use it.'); + } +}; + + +/** + * Use default values, if options are not available + * + * @method _getOrSetDefaultOptions + * @param {Object} options the options gived by the user + * @return {Object} the options with gaps filled by defaults + */ +Contract.prototype._getOrSetDefaultOptions = function getOrSetDefaultOptions(options) { + var gasPrice = options.gasPrice ? String(options.gasPrice): null; + var from = options.from ? utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)) : null; + + options.data = options.data || this.options.data; + + options.from = from || this.options.from; + options.gasPrice = gasPrice || this.options.gasPrice; + options.gas = options.gas || options.gasLimit || this.options.gas; + + // TODO replace with only gasLimit? + delete options.gasLimit; + + return options; +}; + + +/** + * Should be used to encode indexed params and options to one final object + * + * @method _encodeEventABI + * @param {Object} event + * @param {Object} options + * @return {Object} everything combined together and encoded + */ +Contract.prototype._encodeEventABI = function (event, options) { + options = options || {}; + var filter = options.filter || {}, + result = {}; + + ['fromBlock', 'toBlock'].filter(function (f) { + return options[f] !== undefined; + }).forEach(function (f) { + result[f] = formatters.inputBlockNumberFormatter(options[f]); + }); + + // use given topics + if(_.isArray(options.topics)) { + result.topics = options.topics; + + // create topics based on filter + } else { + + result.topics = []; + + // add event signature + if (event && !event.anonymous && event.name !== 'ALLEVENTS') { + result.topics.push(event.signature); + } + + // add event topics (indexed arguments) + if (event.name !== 'ALLEVENTS') { + var indexedTopics = event.inputs.filter(function (i) { + return i.indexed === true; + }).map(function (i) { + var value = filter[i.name]; + if (!value) { + return null; + } + + // TODO: https://github.com/ethereum/web3.js/issues/344 + // TODO: deal properly with components + + if (_.isArray(value)) { + return value.map(function (v) { + return abi.encodeParameter(i.type, v); + }); + } + return abi.encodeParameter(i.type, value); + }); + + result.topics = result.topics.concat(indexedTopics); + } + + if(!result.topics.length) + delete result.topics; + } + + if(this.options.address) { + result.address = this.options.address.toLowerCase(); + } + + return result; +}; + +/** + * Should be used to decode indexed params and options + * + * @method _decodeEventABI + * @param {Object} data + * @return {Object} result object with decoded indexed && not indexed params + */ +Contract.prototype._decodeEventABI = function (data) { + var event = this; + + data.data = data.data || ''; + data.topics = data.topics || []; + var result = formatters.outputLogFormatter(data); + + // if allEvents get the right event + if(event.name === 'ALLEVENTS') { + event = event.jsonInterface.find(function (intf) { + return (intf.signature === data.topics[0]); + }) || {anonymous: true}; + } + + // create empty inputs if none are present (e.g. anonymous events on allEvents) + event.inputs = event.inputs || []; + + + var argTopics = event.anonymous ? data.topics : data.topics.slice(1); + + result.returnValues = abi.decodeLog(event.inputs, data.data, argTopics); + delete result.returnValues.__length__; + + // add name + result.event = event.name; + + // add signature + result.signature = (event.anonymous || !data.topics[0]) ? null : data.topics[0]; + + // move the data and topics to "raw" + result.raw = { + data: result.data, + topics: result.topics + }; + delete result.data; + delete result.topics; + + + return result; +}; + +/** + * Encodes an ABI for a method, including signature or the method. + * Or when constructor encodes only the constructor parameters. + * + * @method _encodeMethodABI + * @param {Mixed} args the arguments to encode + * @param {String} the encoded ABI + */ +Contract.prototype._encodeMethodABI = function _encodeMethodABI() { + var methodSignature = this._method.signature, + args = this.arguments || []; + + var signature = false, + paramsABI = this._parent.options.jsonInterface.filter(function (json) { + return ((methodSignature === 'constructor' && json.type === methodSignature) || + ((json.signature === methodSignature || json.signature === methodSignature.replace('0x','') || json.name === methodSignature) && json.type === 'function')); + }).map(function (json) { + var inputLength = (_.isArray(json.inputs)) ? json.inputs.length : 0; + + if (inputLength !== args.length) { + throw new Error('The number of arguments is not matching the methods required number. You need to pass '+ inputLength +' arguments.'); + } + + if (json.type === 'function') { + signature = json.signature; + } + return _.isArray(json.inputs) ? json.inputs : []; + }).map(function (inputs) { + return abi.encodeParameters(inputs, args).replace('0x',''); + })[0] || ''; + + // return constructor + if(methodSignature === 'constructor') { + if(!this._deployData) + throw new Error('The contract has no contract data option set. This is necessary to append the constructor parameters.'); + + return this._deployData + paramsABI; + + // return method + } else { + + var returnValue = (signature) ? signature + paramsABI : paramsABI; + + if(!returnValue) { + throw new Error('Couldn\'t find a matching contract method named "'+ this._method.name +'".'); + } else { + return returnValue; + } + } + +}; + + +/** + * Decode method return values + * + * @method _decodeMethodReturn + * @param {Array} outputs + * @param {String} returnValues + * @return {Object} decoded output return values + */ +Contract.prototype._decodeMethodReturn = function (outputs, returnValues) { + if (!returnValues) { + return null; + } + + returnValues = returnValues.length >= 2 ? returnValues.slice(2) : returnValues; + var result = abi.decodeParameters(outputs, returnValues); + + if (result.__length__ === 1) { + return result[0]; + } else { + delete result.__length__; + return result; + } +}; + + +/** + * Deploys a contract and fire events based on its state: transactionHash, receipt + * + * All event listeners will be removed, once the last possible event is fired ("error", or "receipt") + * + * @method deploy + * @param {Object} options + * @param {Function} callback + * @return {Object} EventEmitter possible events are "error", "transactionHash" and "receipt" + */ +Contract.prototype.deploy = function (options, callback) { + options = options || {}; + + options.arguments = options.arguments || []; + options = this._getOrSetDefaultOptions(options); + + + // return error, if no "data" is specified + if(!options.data) { + return utils._fireError(new Error('No "data" specified in neither the given options, nor the default options.'), null, null, callback); + } + + var constructor = _.find(this.options.jsonInterface, function (method) { + return (method.type === 'constructor'); + }) || {}; + constructor.signature = 'constructor'; + + return this._createTxObject.apply({ + method: constructor, + parent: this, + deployData: options.data, + _ethAccounts: this.accounts + }, options.arguments); + +}; + +/** + * Gets the event signature and outputformatters + * + * @method _generateEventOptions + * @param {Object} event + * @param {Object} options + * @param {Function} callback + * @return {Object} the event options object + */ +Contract.prototype._generateEventOptions = function() { + var args = Array.prototype.slice.call(arguments); + + // get the callback + var callback = this._getCallback(args); + + // get the options + var options = (_.isObject(args[args.length - 1])) ? args.pop() : {}; + + var event = (_.isString(args[0])) ? args[0] : 'allevents'; + event = (event.toLowerCase() === 'allevents') ? { + name: 'ALLEVENTS', + jsonInterface: this.options.jsonInterface + } : this.options.jsonInterface.find(function (json) { + return (json.type === 'event' && (json.name === event || json.signature === '0x'+ event.replace('0x',''))); + }); + + if (!event) { + throw new Error('Event "' + event.name + '" doesn\'t exist in this contract.'); + } + + if (!utils.isAddress(this.options.address)) { + throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); + } + + return { + params: this._encodeEventABI(event, options), + event: event, + callback: callback + }; +}; + +/** + * Adds event listeners and creates a subscription, and remove it once its fired. + * + * @method clone + * @return {Object} the event subscription + */ +Contract.prototype.clone = function() { + return new this.constructor(this.options.jsonInterface, this.options.address, this.options); +}; + + +/** + * Adds event listeners and creates a subscription, and remove it once its fired. + * + * @method once + * @param {String} event + * @param {Object} options + * @param {Function} callback + * @return {Object} the event subscription + */ +Contract.prototype.once = function(event, options, callback) { + var args = Array.prototype.slice.call(arguments); + + // get the callback + callback = this._getCallback(args); + + if (!callback) { + throw new Error('Once requires a callback as the second parameter.'); + } + + // don't allow fromBlock + if (options) + delete options.fromBlock; + + // don't return as once shouldn't provide "on" + this._on(event, options, function (err, res, sub) { + sub.unsubscribe(); + if(_.isFunction(callback)){ + callback(err, res, sub); + } + }); + + return undefined; +}; + +/** + * Adds event listeners and creates a subscription. + * + * @method _on + * @param {String} event + * @param {Object} options + * @param {Function} callback + * @return {Object} the event subscription + */ +Contract.prototype._on = function(){ + var subOptions = this._generateEventOptions.apply(this, arguments); + + + // prevent the event "newListener" and "removeListener" from being overwritten + this._checkListener('newListener', subOptions.event.name, subOptions.callback); + this._checkListener('removeListener', subOptions.event.name, subOptions.callback); + + // TODO check if listener already exists? and reuse subscription if options are the same. + + // create new subscription + var subscription = new Subscription({ + subscription: { + params: 1, + inputFormatter: [formatters.inputLogFormatter], + outputFormatter: this._decodeEventABI.bind(subOptions.event), + // DUBLICATE, also in web3-eth + subscriptionHandler: function (output) { + if(output.removed) { + this.emit('changed', output); + } else { + this.emit('data', output); + } + + if (_.isFunction(this.callback)) { + this.callback(null, output, this); + } + } + }, + type: 'eth', + requestManager: this._requestManager + }); + subscription.subscribe('logs', subOptions.params, subOptions.callback || function () {}); + + return subscription; +}; + +/** + * Get past events from contracts + * + * @method getPastEvents + * @param {String} event + * @param {Object} options + * @param {Function} callback + * @return {Object} the promievent + */ +Contract.prototype.getPastEvents = function(){ + var subOptions = this._generateEventOptions.apply(this, arguments); + + var getPastLogs = new Method({ + name: 'getPastLogs', + call: 'eth_getLogs', + params: 1, + inputFormatter: [formatters.inputLogFormatter], + outputFormatter: this._decodeEventABI.bind(subOptions.event) + }); + getPastLogs.setRequestManager(this._requestManager); + var call = getPastLogs.buildCall(); + + getPastLogs = null; + + return call(subOptions.params, subOptions.callback); +}; + + +/** + * returns the an object with call, send, estimate functions + * + * @method _createTxObject + * @returns {Object} an object with functions to call the methods + */ +Contract.prototype._createTxObject = function _createTxObject(){ + var args = Array.prototype.slice.call(arguments); + var txObject = {}; + + if(this.method.type === 'function') { + + txObject.call = this.parent._executeMethod.bind(txObject, 'call'); + txObject.call.request = this.parent._executeMethod.bind(txObject, 'call', true); // to make batch requests + + } + + txObject.send = this.parent._executeMethod.bind(txObject, 'send'); + txObject.send.request = this.parent._executeMethod.bind(txObject, 'send', true); // to make batch requests + txObject.encodeABI = this.parent._encodeMethodABI.bind(txObject); + txObject.estimateGas = this.parent._executeMethod.bind(txObject, 'estimate'); + + if (args && this.method.inputs && args.length !== this.method.inputs.length) { + if (this.nextMethod) { + return this.nextMethod.apply(null, args); + } + throw errors.InvalidNumberOfParams(args.length, this.method.inputs.length, this.method.name); + } + + txObject.arguments = args || []; + txObject._method = this.method; + txObject._parent = this.parent; + txObject._ethAccounts = this.parent.accounts || this._ethAccounts; + + if(this.deployData) { + txObject._deployData = this.deployData; + } + + return txObject; +}; + + +/** + * Generates the options for the execute call + * + * @method _processExecuteArguments + * @param {Array} args + * @param {Promise} defer + */ +Contract.prototype._processExecuteArguments = function _processExecuteArguments(args, defer) { + var processedArgs = {}; + + processedArgs.type = args.shift(); + + // get the callback + processedArgs.callback = this._parent._getCallback(args); + + // get block number to use for call + if(processedArgs.type === 'call' && args[args.length - 1] !== true && (_.isString(args[args.length - 1]) || isFinite(args[args.length - 1]))) + processedArgs.defaultBlock = args.pop(); + + // get the options + processedArgs.options = (_.isObject(args[args.length - 1])) ? args.pop() : {}; + + // get the generateRequest argument for batch requests + processedArgs.generateRequest = (args[args.length - 1] === true)? args.pop() : false; + + processedArgs.options = this._parent._getOrSetDefaultOptions(processedArgs.options); + processedArgs.options.data = this.encodeABI(); + + // add contract address + if(!this._deployData && !utils.isAddress(this._parent.options.address)) + throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); + + if(!this._deployData) + processedArgs.options.to = this._parent.options.address; + + // return error, if no "data" is specified + if(!processedArgs.options.data) + return utils._fireError(new Error('Couldn\'t find a matching contract method, or the number of parameters is wrong.'), defer.eventEmitter, defer.reject, processedArgs.callback); + + return processedArgs; +}; + +/** + * Executes a call, transact or estimateGas on a contract function + * + * @method _executeMethod + * @param {String} type the type this execute function should execute + * @param {Boolean} makeRequest if true, it simply returns the request parameters, rather than executing it + */ +Contract.prototype._executeMethod = function _executeMethod(){ + var _this = this, + args = this._parent._processExecuteArguments.call(this, Array.prototype.slice.call(arguments), defer), + defer = promiEvent((args.type !== 'send')), + ethAccounts = _this.accounts || _this._ethAccounts; + + // simple return request for batch requests + if(args.generateRequest) { + + var payload = { + params: [formatters.inputCallFormatter.call(this._parent, args.options)], + callback: args.callback + }; + + if(args.type === 'call') { + payload.params.push(formatters.inputDefaultBlockNumberFormatter.call(this._parent, args.defaultBlock)); + payload.method = 'eth_call'; + payload.format = this._parent._decodeMethodReturn.bind(null, this._method.outputs); + } else { + payload.method = 'eth_sendTransaction'; + } + + return payload; + + } else { + + switch (args.type) { + case 'estimate': + + var estimateGas = (new Method({ + name: 'estimateGas', + call: 'eth_estimateGas', + params: 1, + inputFormatter: [formatters.inputCallFormatter], + outputFormatter: utils.hexToNumber, + requestManager: _this._parent._requestManager, + accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) + defaultAccount: _this._parent.connectionModel.defaultAccount, + defaultBlock: _this._parent.connectionModel.defaultBlock + })).createFunction(); + + return estimateGas(args.options, args.callback); + + case 'call': + + // TODO check errors: missing "from" should give error on deploy and send, call ? + + var call = (new Method({ + name: 'call', + call: 'eth_call', + params: 2, + inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter], + // add output formatter for decoding + outputFormatter: function (result) { + return _this._parent._decodeMethodReturn(_this._method.outputs, result); + }, + requestManager: _this._parent._requestManager, + accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) + defaultAccount: _this._parent.connectionModel.defaultAccount, + defaultBlock: _this._parent.connectionModel.defaultBlock + })).createFunction(); + + return call(args.options, args.defaultBlock, args.callback); + + case 'send': + + // return error, if no "from" is specified + if(!utils.isAddress(args.options.from)) { + return utils._fireError(new Error('No "from" address specified in neither the given options, nor the default options.'), defer.eventEmitter, defer.reject, args.callback); + } + + if (_.isBoolean(this._method.payable) && !this._method.payable && args.options.value && args.options.value > 0) { + return utils._fireError(new Error('Can not send value to non-payable contract method or constructor'), defer.eventEmitter, defer.reject, args.callback); + } + + + // make sure receipt logs are decoded + var extraFormatters = {// TODO: The new method package does not support the extraFormatters + receiptFormatter: function (receipt) { + if (_.isArray(receipt.logs)) { + + // decode logs + var events = _.map(receipt.logs, function(log) { + return _this._parent._decodeEventABI.call({ + name: 'ALLEVENTS', + jsonInterface: _this._parent.options.jsonInterface + }, log); + }); + + // make log names keys + receipt.events = {}; + var count = 0; + events.forEach(function (ev) { + if (ev.event) { + // if > 1 of the same event, don't overwrite any existing events + if (receipt.events[ev.event]) { + if (Array.isArray(receipt.events[ ev.event ])) { + receipt.events[ ev.event ].push(ev); + } else { + receipt.events[ev.event] = [receipt.events[ev.event], ev]; + } + } else { + receipt.events[ ev.event ] = ev; + } + } else { + receipt.events[count] = ev; + count++; + } + }); + + delete receipt.logs; + } + return receipt; + }, + contractDeployFormatter: function (receipt) { + var newContract = _this._parent.clone(); + newContract.options.address = receipt.contractAddress; + return newContract; + } + }; + + var sendTransaction = (new Method({ + name: 'sendTransaction', + call: 'eth_sendTransaction', + params: 1, + inputFormatter: [formatters.inputTransactionFormatter], + requestManager: _this._parent._requestManager, + accounts: _this.accounts || _this._ethAccounts, // is eth.accounts (necessary for wallet signing) + defaultAccount: _this._parent.connectionModel.defaultAccount, + defaultBlock: _this._parent.connectionModel.defaultBlock, + extraFormatters: extraFormatters // TODO: the new method package does not support extraFormatters + })).createFunction(); + + return sendTransaction(args.options, args.callback); + + } + + } + +}; + +module.exports = Contract; diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 1023e365363..3a64f0860cf 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -15,854 +15,20 @@ along with web3.js. If not, see . */ /** - * @file contract.js - * - * To initialize a contract use: - * - * var Contract = require('web3-eth-contract'); - * Contract.setProvider('ws://localhost:8546'); - * var contract = new Contract(abi, address, ...); - * - * @author Fabian Vogelsteller - * @date 2017 + * @file Contract.js + * @author Samuel Furter + * @date 2018 */ - "use strict"; +var version = require('./package.json').version; +var Contract = require('./Contract'); -var _ = require('underscore'); -var core = require('web3-core'); -var Method = require('web3-core-method'); -var utils = require('web3-utils'); -var Subscription = require('web3-core-subscriptions').subscription; -var formatters = require('web3-core-helpers').formatters; -var errors = require('web3-core-helpers').errors; -var promiEvent = require('web3-core-promievent'); -var abi = require('web3-eth-abi'); - - -/** - * Should be called to create new contract instance - * - * @method Contract - * @constructor - * @param {Array} jsonInterface - * @param {String} address - * @param {Object} options - */ -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!'); - } - - this.clearSubscriptions = this.connectionModel.provider.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)) { - options = lastArg; - - this.options = _.extend(this.options, this._getOrSetDefaultOptions(options)); - if(_.isObject(address)) { - address = null; - } - } - - // set address - Object.defineProperty(this.options, 'address', { - set: function(value){ - if(value) { - _this._address = utils.toChecksumAddress(formatters.inputAddressFormatter(value)); - } - }, - get: function(){ - return _this._address; - }, - enumerable: true - }); - - // add method and event signatures, when the jsonInterface gets set - Object.defineProperty(this.options, 'jsonInterface', { - set: function(value){ - _this.methods = {}; - _this.events = {}; - - _this._jsonInterface = value.map(function(method) { - var func, - funcName; - - // make constant and payable backwards compatible - method.constant = (method.stateMutability === "view" || method.stateMutability === "pure" || method.constant); - method.payable = (method.stateMutability === "payable" || method.payable); - - - if (method.name) { - funcName = utils._jsonInterfaceMethodToString(method); - } - - - // function - if (method.type === 'function') { - method.signature = abi.encodeFunctionSignature(funcName); - func = _this._createTxObject.bind({ - method: method, - parent: _this - }); - - - // add method only if not one already exists - if(!_this.methods[method.name]) { - _this.methods[method.name] = func; - } else { - var cascadeFunc = _this._createTxObject.bind({ - method: method, - parent: _this, - nextMethod: _this.methods[method.name] - }); - _this.methods[method.name] = cascadeFunc; - } - - // definitely add the method based on its signature - _this.methods[method.signature] = func; - - // add method by name - _this.methods[funcName] = func; - - - // event - } else if (method.type === 'event') { - method.signature = abi.encodeEventSignature(funcName); - var event = _this._on.bind(_this, method.signature); - - // add method only if not already exists - if(!_this.events[method.name] || _this.events[method.name].name === 'bound ') - _this.events[method.name] = event; - - // definitely add the method based on its signature - _this.events[method.signature] = event; - - // add event by name - _this.events[funcName] = event; - } - - - return method; - }); - - // add allEvents - _this.events.allEvents = _this._on.bind(_this, 'allevents'); - - return _this._jsonInterface; - }, - get: function(){ - return _this._jsonInterface; - }, - enumerable: true - }); - - // properties - this.methods = {}; - this.events = {}; - - this._address = null; - this._jsonInterface = []; - - // set getter/setter properties - this.options.address = address; - this.options.jsonInterface = jsonInterface; - -}; - -Contract.setProvider = function(provider, accounts) { - this.connectionModel.provider = provider; - this.accounts = accounts; -}; - - -/** - * Get the callback and modiufy the array if necessary - * - * @method _getCallback - * @param {Array} args - * @return {Function} the callback - */ -Contract.prototype._getCallback = function getCallback(args) { - if (args && _.isFunction(args[args.length - 1])) { - return args.pop(); // modify the args array! - } -}; - -/** - * Checks that no listener with name "newListener" or "removeListener" is added. - * - * @method _checkListener - * @param {String} type - * @param {String} event - * @return {Object} the contract instance - */ -Contract.prototype._checkListener = function(type, event){ - if(event === type) { - throw new Error('The event "'+ type +'" is a reserved event name, you can\'t use it.'); - } -}; - - -/** - * Use default values, if options are not available - * - * @method _getOrSetDefaultOptions - * @param {Object} options the options gived by the user - * @return {Object} the options with gaps filled by defaults - */ -Contract.prototype._getOrSetDefaultOptions = function getOrSetDefaultOptions(options) { - var gasPrice = options.gasPrice ? String(options.gasPrice): null; - var from = options.from ? utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)) : null; - - options.data = options.data || this.options.data; - - options.from = from || this.options.from; - options.gasPrice = gasPrice || this.options.gasPrice; - options.gas = options.gas || options.gasLimit || this.options.gas; - - // TODO replace with only gasLimit? - delete options.gasLimit; - - return options; -}; - - -/** - * Should be used to encode indexed params and options to one final object - * - * @method _encodeEventABI - * @param {Object} event - * @param {Object} options - * @return {Object} everything combined together and encoded - */ -Contract.prototype._encodeEventABI = function (event, options) { - options = options || {}; - var filter = options.filter || {}, - result = {}; - - ['fromBlock', 'toBlock'].filter(function (f) { - return options[f] !== undefined; - }).forEach(function (f) { - result[f] = formatters.inputBlockNumberFormatter(options[f]); - }); - - // use given topics - if(_.isArray(options.topics)) { - result.topics = options.topics; - - // create topics based on filter - } else { - - result.topics = []; - - // add event signature - if (event && !event.anonymous && event.name !== 'ALLEVENTS') { - result.topics.push(event.signature); - } - - // add event topics (indexed arguments) - if (event.name !== 'ALLEVENTS') { - var indexedTopics = event.inputs.filter(function (i) { - return i.indexed === true; - }).map(function (i) { - var value = filter[i.name]; - if (!value) { - return null; - } - - // TODO: https://github.com/ethereum/web3.js/issues/344 - // TODO: deal properly with components - - if (_.isArray(value)) { - return value.map(function (v) { - return abi.encodeParameter(i.type, v); - }); - } - return abi.encodeParameter(i.type, value); - }); - - result.topics = result.topics.concat(indexedTopics); - } - - if(!result.topics.length) - delete result.topics; - } - - if(this.options.address) { - result.address = this.options.address.toLowerCase(); - } - - return result; -}; - -/** - * Should be used to decode indexed params and options - * - * @method _decodeEventABI - * @param {Object} data - * @return {Object} result object with decoded indexed && not indexed params - */ -Contract.prototype._decodeEventABI = function (data) { - var event = this; - - data.data = data.data || ''; - data.topics = data.topics || []; - var result = formatters.outputLogFormatter(data); - - // if allEvents get the right event - if(event.name === 'ALLEVENTS') { - event = event.jsonInterface.find(function (intf) { - return (intf.signature === data.topics[0]); - }) || {anonymous: true}; - } - - // create empty inputs if none are present (e.g. anonymous events on allEvents) - event.inputs = event.inputs || []; - - - var argTopics = event.anonymous ? data.topics : data.topics.slice(1); - - result.returnValues = abi.decodeLog(event.inputs, data.data, argTopics); - delete result.returnValues.__length__; - - // add name - result.event = event.name; - - // add signature - result.signature = (event.anonymous || !data.topics[0]) ? null : data.topics[0]; - - // move the data and topics to "raw" - result.raw = { - data: result.data, - topics: result.topics - }; - delete result.data; - delete result.topics; - - - return result; -}; - -/** - * Encodes an ABI for a method, including signature or the method. - * Or when constructor encodes only the constructor parameters. - * - * @method _encodeMethodABI - * @param {Mixed} args the arguments to encode - * @param {String} the encoded ABI - */ -Contract.prototype._encodeMethodABI = function _encodeMethodABI() { - var methodSignature = this._method.signature, - args = this.arguments || []; - - var signature = false, - paramsABI = this._parent.options.jsonInterface.filter(function (json) { - return ((methodSignature === 'constructor' && json.type === methodSignature) || - ((json.signature === methodSignature || json.signature === methodSignature.replace('0x','') || json.name === methodSignature) && json.type === 'function')); - }).map(function (json) { - var inputLength = (_.isArray(json.inputs)) ? json.inputs.length : 0; - - if (inputLength !== args.length) { - throw new Error('The number of arguments is not matching the methods required number. You need to pass '+ inputLength +' arguments.'); - } - - if (json.type === 'function') { - signature = json.signature; - } - return _.isArray(json.inputs) ? json.inputs : []; - }).map(function (inputs) { - return abi.encodeParameters(inputs, args).replace('0x',''); - })[0] || ''; - - // return constructor - if(methodSignature === 'constructor') { - if(!this._deployData) - throw new Error('The contract has no contract data option set. This is necessary to append the constructor parameters.'); - - return this._deployData + paramsABI; - - // return method - } else { - - var returnValue = (signature) ? signature + paramsABI : paramsABI; - - if(!returnValue) { - throw new Error('Couldn\'t find a matching contract method named "'+ this._method.name +'".'); - } else { - return returnValue; - } - } - -}; - - -/** - * Decode method return values - * - * @method _decodeMethodReturn - * @param {Array} outputs - * @param {String} returnValues - * @return {Object} decoded output return values - */ -Contract.prototype._decodeMethodReturn = function (outputs, returnValues) { - if (!returnValues) { - return null; - } - - returnValues = returnValues.length >= 2 ? returnValues.slice(2) : returnValues; - var result = abi.decodeParameters(outputs, returnValues); +module.exports = { + version: version, - if (result.__length__ === 1) { - return result[0]; - } else { - delete result.__length__; - return result; + create: function () {// TODO: Refactor the contract object because of the new provider, method and subscription handling. + return Contract; } }; - - -/** - * Deploys a contract and fire events based on its state: transactionHash, receipt - * - * All event listeners will be removed, once the last possible event is fired ("error", or "receipt") - * - * @method deploy - * @param {Object} options - * @param {Function} callback - * @return {Object} EventEmitter possible events are "error", "transactionHash" and "receipt" - */ -Contract.prototype.deploy = function (options, callback) { - options = options || {}; - - options.arguments = options.arguments || []; - options = this._getOrSetDefaultOptions(options); - - - // return error, if no "data" is specified - if(!options.data) { - return utils._fireError(new Error('No "data" specified in neither the given options, nor the default options.'), null, null, callback); - } - - var constructor = _.find(this.options.jsonInterface, function (method) { - return (method.type === 'constructor'); - }) || {}; - constructor.signature = 'constructor'; - - return this._createTxObject.apply({ - method: constructor, - parent: this, - deployData: options.data, - _ethAccounts: this.accounts - }, options.arguments); - -}; - -/** - * Gets the event signature and outputformatters - * - * @method _generateEventOptions - * @param {Object} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the event options object - */ -Contract.prototype._generateEventOptions = function() { - var args = Array.prototype.slice.call(arguments); - - // get the callback - var callback = this._getCallback(args); - - // get the options - var options = (_.isObject(args[args.length - 1])) ? args.pop() : {}; - - var event = (_.isString(args[0])) ? args[0] : 'allevents'; - event = (event.toLowerCase() === 'allevents') ? { - name: 'ALLEVENTS', - jsonInterface: this.options.jsonInterface - } : this.options.jsonInterface.find(function (json) { - return (json.type === 'event' && (json.name === event || json.signature === '0x'+ event.replace('0x',''))); - }); - - if (!event) { - throw new Error('Event "' + event.name + '" doesn\'t exist in this contract.'); - } - - if (!utils.isAddress(this.options.address)) { - throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); - } - - return { - params: this._encodeEventABI(event, options), - event: event, - callback: callback - }; -}; - -/** - * Adds event listeners and creates a subscription, and remove it once its fired. - * - * @method clone - * @return {Object} the event subscription - */ -Contract.prototype.clone = function() { - return new this.constructor(this.options.jsonInterface, this.options.address, this.options); -}; - - -/** - * Adds event listeners and creates a subscription, and remove it once its fired. - * - * @method once - * @param {String} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the event subscription - */ -Contract.prototype.once = function(event, options, callback) { - var args = Array.prototype.slice.call(arguments); - - // get the callback - callback = this._getCallback(args); - - if (!callback) { - throw new Error('Once requires a callback as the second parameter.'); - } - - // don't allow fromBlock - if (options) - delete options.fromBlock; - - // don't return as once shouldn't provide "on" - this._on(event, options, function (err, res, sub) { - sub.unsubscribe(); - if(_.isFunction(callback)){ - callback(err, res, sub); - } - }); - - return undefined; -}; - -/** - * Adds event listeners and creates a subscription. - * - * @method _on - * @param {String} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the event subscription - */ -Contract.prototype._on = function(){ - var subOptions = this._generateEventOptions.apply(this, arguments); - - - // prevent the event "newListener" and "removeListener" from being overwritten - this._checkListener('newListener', subOptions.event.name, subOptions.callback); - this._checkListener('removeListener', subOptions.event.name, subOptions.callback); - - // TODO check if listener already exists? and reuse subscription if options are the same. - - // create new subscription - var subscription = new Subscription({ - subscription: { - params: 1, - inputFormatter: [formatters.inputLogFormatter], - outputFormatter: this._decodeEventABI.bind(subOptions.event), - // DUBLICATE, also in web3-eth - subscriptionHandler: function (output) { - if(output.removed) { - this.emit('changed', output); - } else { - this.emit('data', output); - } - - if (_.isFunction(this.callback)) { - this.callback(null, output, this); - } - } - }, - type: 'eth', - requestManager: this._requestManager - }); - subscription.subscribe('logs', subOptions.params, subOptions.callback || function () {}); - - return subscription; -}; - -/** - * Get past events from contracts - * - * @method getPastEvents - * @param {String} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the promievent - */ -Contract.prototype.getPastEvents = function(){ - var subOptions = this._generateEventOptions.apply(this, arguments); - - var getPastLogs = new Method({ - name: 'getPastLogs', - call: 'eth_getLogs', - params: 1, - inputFormatter: [formatters.inputLogFormatter], - outputFormatter: this._decodeEventABI.bind(subOptions.event) - }); - getPastLogs.setRequestManager(this._requestManager); - var call = getPastLogs.buildCall(); - - getPastLogs = null; - - return call(subOptions.params, subOptions.callback); -}; - - -/** - * returns the an object with call, send, estimate functions - * - * @method _createTxObject - * @returns {Object} an object with functions to call the methods - */ -Contract.prototype._createTxObject = function _createTxObject(){ - var args = Array.prototype.slice.call(arguments); - var txObject = {}; - - if(this.method.type === 'function') { - - txObject.call = this.parent._executeMethod.bind(txObject, 'call'); - txObject.call.request = this.parent._executeMethod.bind(txObject, 'call', true); // to make batch requests - - } - - txObject.send = this.parent._executeMethod.bind(txObject, 'send'); - txObject.send.request = this.parent._executeMethod.bind(txObject, 'send', true); // to make batch requests - txObject.encodeABI = this.parent._encodeMethodABI.bind(txObject); - txObject.estimateGas = this.parent._executeMethod.bind(txObject, 'estimate'); - - if (args && this.method.inputs && args.length !== this.method.inputs.length) { - if (this.nextMethod) { - return this.nextMethod.apply(null, args); - } - throw errors.InvalidNumberOfParams(args.length, this.method.inputs.length, this.method.name); - } - - txObject.arguments = args || []; - txObject._method = this.method; - txObject._parent = this.parent; - txObject._ethAccounts = this.parent.accounts || this._ethAccounts; - - if(this.deployData) { - txObject._deployData = this.deployData; - } - - return txObject; -}; - - -/** - * Generates the options for the execute call - * - * @method _processExecuteArguments - * @param {Array} args - * @param {Promise} defer - */ -Contract.prototype._processExecuteArguments = function _processExecuteArguments(args, defer) { - var processedArgs = {}; - - processedArgs.type = args.shift(); - - // get the callback - processedArgs.callback = this._parent._getCallback(args); - - // get block number to use for call - if(processedArgs.type === 'call' && args[args.length - 1] !== true && (_.isString(args[args.length - 1]) || isFinite(args[args.length - 1]))) - processedArgs.defaultBlock = args.pop(); - - // get the options - processedArgs.options = (_.isObject(args[args.length - 1])) ? args.pop() : {}; - - // get the generateRequest argument for batch requests - processedArgs.generateRequest = (args[args.length - 1] === true)? args.pop() : false; - - processedArgs.options = this._parent._getOrSetDefaultOptions(processedArgs.options); - processedArgs.options.data = this.encodeABI(); - - // add contract address - if(!this._deployData && !utils.isAddress(this._parent.options.address)) - throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); - - if(!this._deployData) - processedArgs.options.to = this._parent.options.address; - - // return error, if no "data" is specified - if(!processedArgs.options.data) - return utils._fireError(new Error('Couldn\'t find a matching contract method, or the number of parameters is wrong.'), defer.eventEmitter, defer.reject, processedArgs.callback); - - return processedArgs; -}; - -/** - * Executes a call, transact or estimateGas on a contract function - * - * @method _executeMethod - * @param {String} type the type this execute function should execute - * @param {Boolean} makeRequest if true, it simply returns the request parameters, rather than executing it - */ -Contract.prototype._executeMethod = function _executeMethod(){ - var _this = this, - args = this._parent._processExecuteArguments.call(this, Array.prototype.slice.call(arguments), defer), - defer = promiEvent((args.type !== 'send')), - ethAccounts = _this.accounts || _this._ethAccounts; - - // simple return request for batch requests - if(args.generateRequest) { - - var payload = { - params: [formatters.inputCallFormatter.call(this._parent, args.options)], - callback: args.callback - }; - - if(args.type === 'call') { - payload.params.push(formatters.inputDefaultBlockNumberFormatter.call(this._parent, args.defaultBlock)); - payload.method = 'eth_call'; - payload.format = this._parent._decodeMethodReturn.bind(null, this._method.outputs); - } else { - payload.method = 'eth_sendTransaction'; - } - - return payload; - - } else { - - switch (args.type) { - case 'estimate': - - var estimateGas = (new Method({ - name: 'estimateGas', - call: 'eth_estimateGas', - params: 1, - inputFormatter: [formatters.inputCallFormatter], - outputFormatter: utils.hexToNumber, - requestManager: _this._parent._requestManager, - accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.connectionModel.defaultAccount, - defaultBlock: _this._parent.connectionModel.defaultBlock - })).createFunction(); - - return estimateGas(args.options, args.callback); - - case 'call': - - // TODO check errors: missing "from" should give error on deploy and send, call ? - - var call = (new Method({ - name: 'call', - call: 'eth_call', - params: 2, - inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter], - // add output formatter for decoding - outputFormatter: function (result) { - return _this._parent._decodeMethodReturn(_this._method.outputs, result); - }, - requestManager: _this._parent._requestManager, - accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.connectionModel.defaultAccount, - defaultBlock: _this._parent.connectionModel.defaultBlock - })).createFunction(); - - return call(args.options, args.defaultBlock, args.callback); - - case 'send': - - // return error, if no "from" is specified - if(!utils.isAddress(args.options.from)) { - return utils._fireError(new Error('No "from" address specified in neither the given options, nor the default options.'), defer.eventEmitter, defer.reject, args.callback); - } - - if (_.isBoolean(this._method.payable) && !this._method.payable && args.options.value && args.options.value > 0) { - return utils._fireError(new Error('Can not send value to non-payable contract method or constructor'), defer.eventEmitter, defer.reject, args.callback); - } - - - // make sure receipt logs are decoded - var extraFormatters = {// TODO: The new method package does not support the extraFormatters - receiptFormatter: function (receipt) { - if (_.isArray(receipt.logs)) { - - // decode logs - var events = _.map(receipt.logs, function(log) { - return _this._parent._decodeEventABI.call({ - name: 'ALLEVENTS', - jsonInterface: _this._parent.options.jsonInterface - }, log); - }); - - // make log names keys - receipt.events = {}; - var count = 0; - events.forEach(function (ev) { - if (ev.event) { - // if > 1 of the same event, don't overwrite any existing events - if (receipt.events[ev.event]) { - if (Array.isArray(receipt.events[ ev.event ])) { - receipt.events[ ev.event ].push(ev); - } else { - receipt.events[ev.event] = [receipt.events[ev.event], ev]; - } - } else { - receipt.events[ ev.event ] = ev; - } - } else { - receipt.events[count] = ev; - count++; - } - }); - - delete receipt.logs; - } - return receipt; - }, - contractDeployFormatter: function (receipt) { - var newContract = _this._parent.clone(); - newContract.options.address = receipt.contractAddress; - return newContract; - } - }; - - var sendTransaction = (new Method({ - name: 'sendTransaction', - call: 'eth_sendTransaction', - params: 1, - inputFormatter: [formatters.inputTransactionFormatter], - requestManager: _this._parent._requestManager, - accounts: _this.accounts || _this._ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.connectionModel.defaultAccount, - defaultBlock: _this._parent.connectionModel.defaultBlock, - extraFormatters: extraFormatters // TODO: the new method package does not support extraFormatters - })).createFunction(); - - return sendTransaction(args.options, args.callback); - - } - - } - -}; - -module.exports = Contract; diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index cb39092a827..e737543c7f9 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -20,6 +20,22 @@ "use strict"; +var version = require('package.json').version; var ENS = require('./ENS'); -module.exports = ENS; +module.exports = { + version: version, + + /** + * Returns the ENS object + * + * @method create + * + * @param {Eth} eth + * + * @returns {ENS} + */ + create: function (eth) { //TODO: Remove circular dependency and refactore ENS because of the new method and connection handling + return new ENS(eth); + } +}; diff --git a/packages/web3-eth-iban/src/Iban.js b/packages/web3-eth-iban/src/Iban.js new file mode 100644 index 00000000000..94bc7caa812 --- /dev/null +++ b/packages/web3-eth-iban/src/Iban.js @@ -0,0 +1,267 @@ +/* + 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 . +*/ +/** + * @file Iban.js + * + * Details: https://github.com/ethereum/wiki/wiki/ICAP:-Inter-exchange-Client-Address-Protocol + * + * @author Marek Kotewicz + * @date 2015 + */ + +"use strict"; + +var utils = require('web3-utils'); +var BigNumber = require('bn.js'); + + +var leftPad = function (string, bytes) { + var result = string; + while (result.length < bytes * 2) { + result = '0' + result; + } + return result; +}; + +/** + * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to + * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616. + * + * @method iso13616Prepare + * @param {String} iban the IBAN + * @returns {String} the prepared IBAN + */ +var iso13616Prepare = function (iban) { + var A = 'A'.charCodeAt(0); + var Z = 'Z'.charCodeAt(0); + + iban = iban.toUpperCase(); + iban = iban.substr(4) + iban.substr(0,4); + + return iban.split('').map(function(n){ + var code = n.charCodeAt(0); + if (code >= A && code <= Z){ + // A = 10, B = 11, ... Z = 35 + return code - A + 10; + } else { + return n; + } + }).join(''); +}; + +/** + * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064. + * + * @method mod9710 + * @param {String} iban + * @returns {Number} + */ +var mod9710 = function (iban) { + var remainder = iban, + block; + + while (remainder.length > 2){ + block = remainder.slice(0, 9); + remainder = parseInt(block, 10) % 97 + remainder.slice(block.length); + } + + return parseInt(remainder, 10) % 97; +}; + +/** + * This prototype should be used to create iban object from iban correct string + * + * @param {String} iban + */ +var Iban = function Iban(iban) { + this._iban = iban; +}; + +/** + * This method should be used to create an ethereum address from a direct iban address + * + * @method toAddress + * @param {String} iban address + * @return {String} the ethereum address + */ +Iban.toAddress = function (ib) { + ib = new Iban(ib); + + if(!ib.isDirect()) { + throw new Error('IBAN is indirect and can\'t be converted'); + } + + return ib.toAddress(); +}; + +/** + * This method should be used to create iban address from an ethereum address + * + * @method toIban + * @param {String} address + * @return {String} the IBAN address + */ +Iban.toIban = function (address) { + return Iban.fromAddress(address).toString(); +}; + +/** + * This method should be used to create iban object from an ethereum address + * + * @method fromAddress + * @param {String} address + * @return {Iban} the IBAN object + */ +Iban.fromAddress = function (address) { + if(!utils.isAddress(address)){ + throw new Error('Provided address is not a valid address: '+ address); + } + + address = address.replace('0x','').replace('0X',''); + + var asBn = new BigNumber(address, 16); + var base36 = asBn.toString(36); + var padded = leftPad(base36, 15); + return Iban.fromBban(padded.toUpperCase()); +}; + +/** + * Convert the passed BBAN to an IBAN for this country specification. + * Please note that "generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account". + * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits + * + * @method fromBban + * @param {String} bban the BBAN to convert to IBAN + * @returns {Iban} the IBAN object + */ +Iban.fromBban = function (bban) { + var countryCode = 'XE'; + + var remainder = mod9710(iso13616Prepare(countryCode + '00' + bban)); + var checkDigit = ('0' + (98 - remainder)).slice(-2); + + return new Iban(countryCode + checkDigit + bban); +}; + +/** + * Should be used to create IBAN object for given institution and identifier + * + * @method createIndirect + * @param {Object} options, required options are "institution" and "identifier" + * @return {Iban} the IBAN object + */ +Iban.createIndirect = function (options) { + return Iban.fromBban('ETH' + options.institution + options.identifier); +}; + +/** + * This method should be used to check if given string is valid iban object + * + * @method isValid + * @param {String} iban string + * @return {Boolean} true if it is valid IBAN + */ +Iban.isValid = function (iban) { + var i = new Iban(iban); + return i.isValid(); +}; + +/** + * Should be called to check if iban is correct + * + * @method isValid + * @returns {Boolean} true if it is, otherwise false + */ +Iban.prototype.isValid = function () { + return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) && + mod9710(iso13616Prepare(this._iban)) === 1; +}; + +/** + * Should be called to check if iban number is direct + * + * @method isDirect + * @returns {Boolean} true if it is, otherwise false + */ +Iban.prototype.isDirect = function () { + return this._iban.length === 34 || this._iban.length === 35; +}; + +/** + * Should be called to check if iban number if indirect + * + * @method isIndirect + * @returns {Boolean} true if it is, otherwise false + */ +Iban.prototype.isIndirect = function () { + return this._iban.length === 20; +}; + +/** + * Should be called to get iban checksum + * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003) + * + * @method checksum + * @returns {String} checksum + */ +Iban.prototype.checksum = function () { + return this._iban.substr(2, 2); +}; + +/** + * Should be called to get institution identifier + * eg. XREG + * + * @method institution + * @returns {String} institution identifier + */ +Iban.prototype.institution = function () { + return this.isIndirect() ? this._iban.substr(7, 4) : ''; +}; + +/** + * Should be called to get client identifier within institution + * eg. GAVOFYORK + * + * @method client + * @returns {String} client identifier + */ +Iban.prototype.client = function () { + return this.isIndirect() ? this._iban.substr(11) : ''; +}; + +/** + * Should be called to get client direct address + * + * @method toAddress + * @returns {String} ethereum address + */ +Iban.prototype.toAddress = function () { + if (this.isDirect()) { + var base36 = this._iban.substr(4); + var asBn = new BigNumber(base36, 36); + return utils.toChecksumAddress(asBn.toString(16, 20)); + } + + return ''; +}; + +Iban.prototype.toString = function () { + return this._iban; +}; + +module.exports = Iban; diff --git a/packages/web3-eth-iban/src/index.js b/packages/web3-eth-iban/src/index.js index 6fdbc99fcb8..9f787065802 100644 --- a/packages/web3-eth-iban/src/index.js +++ b/packages/web3-eth-iban/src/index.js @@ -15,253 +15,27 @@ along with web3.js. If not, see . */ /** - * @file iban.js - * - * Details: https://github.com/ethereum/wiki/wiki/ICAP:-Inter-exchange-Client-Address-Protocol - * - * @author Marek Kotewicz - * @date 2015 + * @file index.js + * @author Samuel Furter + * @date 2018 */ "use strict"; -var utils = require('web3-utils'); -var BigNumber = require('bn.js'); - - -var leftPad = function (string, bytes) { - var result = string; - while (result.length < bytes * 2) { - result = '0' + result; - } - return result; -}; - -/** - * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to - * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616. - * - * @method iso13616Prepare - * @param {String} iban the IBAN - * @returns {String} the prepared IBAN - */ -var iso13616Prepare = function (iban) { - var A = 'A'.charCodeAt(0); - var Z = 'Z'.charCodeAt(0); - - iban = iban.toUpperCase(); - iban = iban.substr(4) + iban.substr(0,4); - - return iban.split('').map(function(n){ - var code = n.charCodeAt(0); - if (code >= A && code <= Z){ - // A = 10, B = 11, ... Z = 35 - return code - A + 10; - } else { - return n; - } - }).join(''); -}; - -/** - * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064. - * - * @method mod9710 - * @param {String} iban - * @returns {Number} - */ -var mod9710 = function (iban) { - var remainder = iban, - block; - - while (remainder.length > 2){ - block = remainder.slice(0, 9); - remainder = parseInt(block, 10) % 97 + remainder.slice(block.length); - } - - return parseInt(remainder, 10) % 97; -}; - -/** - * This prototype should be used to create iban object from iban correct string - * - * @param {String} iban - */ -var Iban = function Iban(iban) { - this._iban = iban; -}; - -/** - * This method should be used to create an ethereum address from a direct iban address - * - * @method toAddress - * @param {String} iban address - * @return {String} the ethereum address - */ -Iban.toAddress = function (ib) { - ib = new Iban(ib); - - if(!ib.isDirect()) { - throw new Error('IBAN is indirect and can\'t be converted'); - } - - return ib.toAddress(); -}; - -/** - * This method should be used to create iban address from an ethereum address - * - * @method toIban - * @param {String} address - * @return {String} the IBAN address - */ -Iban.toIban = function (address) { - return Iban.fromAddress(address).toString(); -}; - -/** - * This method should be used to create iban object from an ethereum address - * - * @method fromAddress - * @param {String} address - * @return {Iban} the IBAN object - */ -Iban.fromAddress = function (address) { - if(!utils.isAddress(address)){ - throw new Error('Provided address is not a valid address: '+ address); - } - - address = address.replace('0x','').replace('0X',''); - - var asBn = new BigNumber(address, 16); - var base36 = asBn.toString(36); - var padded = leftPad(base36, 15); - return Iban.fromBban(padded.toUpperCase()); -}; - -/** - * Convert the passed BBAN to an IBAN for this country specification. - * Please note that "generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account". - * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits - * - * @method fromBban - * @param {String} bban the BBAN to convert to IBAN - * @returns {Iban} the IBAN object - */ -Iban.fromBban = function (bban) { - var countryCode = 'XE'; - - var remainder = mod9710(iso13616Prepare(countryCode + '00' + bban)); - var checkDigit = ('0' + (98 - remainder)).slice(-2); - - return new Iban(countryCode + checkDigit + bban); -}; - -/** - * Should be used to create IBAN object for given institution and identifier - * - * @method createIndirect - * @param {Object} options, required options are "institution" and "identifier" - * @return {Iban} the IBAN object - */ -Iban.createIndirect = function (options) { - return Iban.fromBban('ETH' + options.institution + options.identifier); -}; - -/** - * This method should be used to check if given string is valid iban object - * - * @method isValid - * @param {String} iban string - * @return {Boolean} true if it is valid IBAN - */ -Iban.isValid = function (iban) { - var i = new Iban(iban); - return i.isValid(); -}; - -/** - * Should be called to check if iban is correct - * - * @method isValid - * @returns {Boolean} true if it is, otherwise false - */ -Iban.prototype.isValid = function () { - return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) && - mod9710(iso13616Prepare(this._iban)) === 1; -}; - -/** - * Should be called to check if iban number is direct - * - * @method isDirect - * @returns {Boolean} true if it is, otherwise false - */ -Iban.prototype.isDirect = function () { - return this._iban.length === 34 || this._iban.length === 35; -}; - -/** - * Should be called to check if iban number if indirect - * - * @method isIndirect - * @returns {Boolean} true if it is, otherwise false - */ -Iban.prototype.isIndirect = function () { - return this._iban.length === 20; -}; - -/** - * Should be called to get iban checksum - * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003) - * - * @method checksum - * @returns {String} checksum - */ -Iban.prototype.checksum = function () { - return this._iban.substr(2, 2); -}; - -/** - * Should be called to get institution identifier - * eg. XREG - * - * @method institution - * @returns {String} institution identifier - */ -Iban.prototype.institution = function () { - return this.isIndirect() ? this._iban.substr(7, 4) : ''; -}; - -/** - * Should be called to get client identifier within institution - * eg. GAVOFYORK - * - * @method client - * @returns {String} client identifier - */ -Iban.prototype.client = function () { - return this.isIndirect() ? this._iban.substr(11) : ''; -}; - -/** - * Should be called to get client direct address - * - * @method toAddress - * @returns {String} ethereum address - */ -Iban.prototype.toAddress = function () { - if (this.isDirect()) { - var base36 = this._iban.substr(4); - var asBn = new BigNumber(base36, 36); - return utils.toChecksumAddress(asBn.toString(16, 20)); +var version = require('./package.json').version; +var Iban = require('./Iban.js'); + +module.exports = { + version: version, + + /** + * Returns the uninitiadted Iban object. + * + * @method create + * + * @returns {Iban} + */ + create: function () {// TODO: Determine if this is the correct approach to do this with a create method. + return Iban; } - - return ''; }; - -Iban.prototype.toString = function () { - return this._iban; -}; - -module.exports = Iban; diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js new file mode 100644 index 00000000000..54f12ab35ef --- /dev/null +++ b/packages/web3-eth-personal/src/Personal.js @@ -0,0 +1,150 @@ +/* + 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 . +*/ +/** + * @file index.js + * @author Fabian Vogelsteller + * @date 2017 + */ + +"use strict"; + +var core = require('web3-core'); +var Method = require('web3-core-method'); +var utils = require('web3-utils'); +var Net = require('web3-net'); + +var formatters = require('web3-core-helpers').formatters; + + +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 + methods.forEach(function(method) { + method.defaultAccount = defaultAccount; + }); + + return val; + }, + enumerable: true + }); + Object.defineProperty(this, 'defaultBlock', { + get: function () { + return defaultBlock; + }, + set: function (val) { + defaultBlock = val; + + // update defaultBlock + methods.forEach(function(method) { + method.defaultBlock = defaultBlock; + }); + + return val; + }, + enumerable: true + }); + + + var methods = [ + new Method({ + name: 'getAccounts', + call: 'personal_listAccounts', + params: 0, + outputFormatter: utils.toChecksumAddress + }), + new Method({ + name: 'newAccount', + call: 'personal_newAccount', + params: 1, + inputFormatter: [null], + outputFormatter: utils.toChecksumAddress + }), + new Method({ + name: 'unlockAccount', + call: 'personal_unlockAccount', + params: 3, + inputFormatter: [formatters.inputAddressFormatter, null, null] + }), + new Method({ + name: 'lockAccount', + call: 'personal_lockAccount', + params: 1, + inputFormatter: [formatters.inputAddressFormatter] + }), + new Method({ + name: 'importRawKey', + call: 'personal_importRawKey', + params: 2 + }), + new Method({ + name: 'sendTransaction', + call: 'personal_sendTransaction', + params: 2, + inputFormatter: [formatters.inputTransactionFormatter, null] + }), + new Method({ + name: 'signTransaction', + call: 'personal_signTransaction', + params: 2, + inputFormatter: [formatters.inputTransactionFormatter, null] + }), + new Method({ + name: 'sign', + call: 'personal_sign', + params: 3, + inputFormatter: [formatters.inputSignFormatter, formatters.inputAddressFormatter, null] + }), + new Method({ + name: 'ecRecover', + call: 'personal_ecRecover', + params: 2, + inputFormatter: [formatters.inputSignFormatter, null] + }) + ]; + methods.forEach(function(method) { + method.attachToObject(_this); + method.setRequestManager(_this._requestManager); + method.defaultBlock = _this.defaultBlock; + method.defaultAccount = _this.defaultAccount; + }); +}; + +core.addProviders(Personal); + + + +module.exports = Personal; + + diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 54f12ab35ef..7c4bba81cf1 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -16,135 +16,28 @@ */ /** * @file index.js - * @author Fabian Vogelsteller - * @date 2017 + * @author Samuel Furter + * @date 2018 */ "use strict"; -var core = require('web3-core'); -var Method = require('web3-core-method'); -var utils = require('web3-utils'); -var Net = require('web3-net'); - -var formatters = require('web3-core-helpers').formatters; - - -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 - methods.forEach(function(method) { - method.defaultAccount = defaultAccount; - }); - - return val; - }, - enumerable: true - }); - Object.defineProperty(this, 'defaultBlock', { - get: function () { - return defaultBlock; - }, - set: function (val) { - defaultBlock = val; - - // update defaultBlock - methods.forEach(function(method) { - method.defaultBlock = defaultBlock; - }); - - return val; - }, - enumerable: true - }); - - - var methods = [ - new Method({ - name: 'getAccounts', - call: 'personal_listAccounts', - params: 0, - outputFormatter: utils.toChecksumAddress - }), - new Method({ - name: 'newAccount', - call: 'personal_newAccount', - params: 1, - inputFormatter: [null], - outputFormatter: utils.toChecksumAddress - }), - new Method({ - name: 'unlockAccount', - call: 'personal_unlockAccount', - params: 3, - inputFormatter: [formatters.inputAddressFormatter, null, null] - }), - new Method({ - name: 'lockAccount', - call: 'personal_lockAccount', - params: 1, - inputFormatter: [formatters.inputAddressFormatter] - }), - new Method({ - name: 'importRawKey', - call: 'personal_importRawKey', - params: 2 - }), - new Method({ - name: 'sendTransaction', - call: 'personal_sendTransaction', - params: 2, - inputFormatter: [formatters.inputTransactionFormatter, null] - }), - new Method({ - name: 'signTransaction', - call: 'personal_signTransaction', - params: 2, - inputFormatter: [formatters.inputTransactionFormatter, null] - }), - new Method({ - name: 'sign', - call: 'personal_sign', - params: 3, - inputFormatter: [formatters.inputSignFormatter, formatters.inputAddressFormatter, null] - }), - new Method({ - name: 'ecRecover', - call: 'personal_ecRecover', - params: 2, - inputFormatter: [formatters.inputSignFormatter, null] - }) - ]; - methods.forEach(function(method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - method.defaultBlock = _this.defaultBlock; - method.defaultAccount = _this.defaultAccount; - }); +var version = require('./package.json').version; +var Personal = require('./Personal'); + +module.exports = { + version: version, + + /** + * Returns the Personal object + * + * @method create + * + * @returns {Personal} + */ + create: function () { //TODO: Refactor the personal object because of the new method and connection handling. + return new Personal(); + } }; -core.addProviders(Personal); - - - -module.exports = Personal; - diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index e754ce8e332..b187195f7ca 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -26,14 +26,15 @@ var _ = require('underscore'); /** * @param {ConnectionModel} connectionModel - * @param {Contract} contract - * @param {Accounts} accounts - * @param {Personal} personal + * @param {ContractPackage} contract + * @param {AccountsPackage} accounts + * @param {PersonalPackage} personal * @param {Iban} iban - * @param {Abi} abi - * @param {ENS} ens + * @param {AbiPackage} abi + * @param {ENSPackage} ens * @param {Utils} utils * @param {Object} formatters + * @param {MethodPackage} methodPackage * @param {SubscriptionsResolver} subscriptionsResolver * * @constructor @@ -48,6 +49,7 @@ var Eth = function Eth( ens, utils, formatters, + methodPackage, subscriptionsResolver ) { this.connectionModel = connectionModel; @@ -61,6 +63,7 @@ var Eth = function Eth( this.utils = utils; this.formatters = formatters; this.subscriptionsResolver = subscriptionsResolver; + this.methodPackage = methodPackage; }; /** @@ -90,7 +93,7 @@ Eth.prototype.subscribe = function (type, parameters, callback) { * @returns {Promise} */ Eth.prototype.getNodeInfo = function (callback) { - return this.coreFactory.createMethod(this.connectionModel.provider, 'web3_clientVersion', [], null, null).send(callback); + return this.methodPackage.create(this.connectionModel.provider, 'web3_clientVersion', [], null, null).send(callback); }; /** @@ -104,7 +107,7 @@ Eth.prototype.getNodeInfo = function (callback) { * @returns {Promise} */ Eth.prototype.getProtocolVersion = function (callback) { - return this.coreFactory.createMethod(this.connectionModel.provider, 'eth_protocolVersion', [], null, null).send(callback); + return this.methodPackage.create(this.connectionModel.provider, 'eth_protocolVersion', [], null, null).send(callback); }; /** @@ -118,7 +121,7 @@ Eth.prototype.getProtocolVersion = function (callback) { * @returns {Promise} */ Eth.prototype.getCoinbase = function (callback) { - return this.coreFactory.createMethod(this.connectionModel.provider, 'eth_coinbase', [], null, null).send(callback); + return this.methodPackage.create(this.connectionModel.provider, 'eth_coinbase', [], null, null).send(callback); }; /** @@ -132,7 +135,7 @@ Eth.prototype.getCoinbase = function (callback) { * @returns {Promise} */ Eth.prototype.isMining = function (callback) { - return this.coreFactory.createMethod(this.connectionModel.provider, 'eth_mining', [], null, null).send(callback); + return this.methodPackage.create(this.connectionModel.provider, 'eth_mining', [], null, null).send(callback); }; /** @@ -146,7 +149,7 @@ Eth.prototype.isMining = function (callback) { * @returns {Promise} */ Eth.prototype.getHashrate = function (callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_hashrate', [], @@ -166,7 +169,7 @@ Eth.prototype.getHashrate = function (callback) { * @returns {Promise} */ Eth.prototype.isSyncing = function (callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_syncing', [], @@ -186,7 +189,7 @@ Eth.prototype.isSyncing = function (callback) { * @returns {Promise} */ Eth.prototype.getGasPrice = function (callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_gasPrice', [], @@ -206,7 +209,7 @@ Eth.prototype.getGasPrice = function (callback) { * @returns {Promise} */ Eth.prototype.getAccounts = function (callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_accounts', [], @@ -226,7 +229,7 @@ Eth.prototype.getAccounts = function (callback) { * @returns {Promise} */ Eth.prototype.getBlockNumber = function (callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_blockNumber', [], @@ -252,7 +255,7 @@ Eth.prototype.getBalance = function (address, block, callback) { block = this.connectionModel.defaultBlock; } - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getBalance', [address, block], @@ -282,7 +285,7 @@ Eth.prototype.getStorageAt = function (address, position, block, callback) { block = this.connectionModel.defaultBlock; } - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getStorageAt', [address, position, block], @@ -312,7 +315,7 @@ Eth.prototype.getCode = function (address, block, callback) { block = this.connectionModel.defaultBlock; } - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getCode', [address, block], @@ -337,7 +340,7 @@ Eth.prototype.getCode = function (address, block, callback) { * @returns {Promise} */ Eth.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getBlockByNumber', [blockNumber, returnTransactionObjects], @@ -364,7 +367,7 @@ Eth.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects * @returns {Promise} */ Eth.prototype.getBlockByHash = function (blockHash, returnTransactionObjects, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getBlockByHash', [blockHash, returnTransactionObjects], @@ -435,7 +438,7 @@ Eth.prototype.getUncle = function (blockHashOrBlockNumber, uncleIndex, callback) * @returns {Promise} */ Eth.prototype.getUncleByBlockNumber = function (blockNumber, uncleIndex, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getUncleByBlockNumberAndIndex', [blockNumber, uncleIndex], @@ -460,7 +463,7 @@ Eth.prototype.getUncleByBlockNumber = function (blockNumber, uncleIndex, callbac * @returns {Promise} */ Eth.prototype.getUnlceByBlockHash = function (blockHash, uncleIndex, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getUncleByBlockHashAndIndex', [blockHash, uncleIndex], @@ -506,7 +509,7 @@ Eth.prototype.getBlockTransactionCount = function (blockHashOrBlockNumber, callb * @returns {Promise} */ Eth.prototype.getBlockTransactionCountByBlockNumber = function (blockNumber, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getBlockTransactionCountByNumber', [blockNumber], @@ -530,7 +533,7 @@ Eth.prototype.getBlockTransactionCountByBlockNumber = function (blockNumber, cal * @returns {Promise} */ Eth.prototype.getBlockTransactionCountByBlockHash = function (blockHash, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getBlockTransactionCountByHash', [blockNumber], @@ -574,7 +577,7 @@ Eth.prototype.getBlockUncleCount = function (blockHashOrBlockNumber, callback) { * @returns {Promise} */ Eth.prototype.getBlockUncleCountByBlockHash = function (blockHash, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getUncleCountByBlockHash', [blockHash], @@ -597,7 +600,7 @@ Eth.prototype.getBlockUncleCountByBlockHash = function (blockHash, callback) { * @returns {Promise} */ Eth.prototype.getBlockUncleCountByBlockNumber = function (blockNumber, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getUncleCountByBlockNumber', [blockNumber], @@ -620,7 +623,7 @@ Eth.prototype.getBlockUncleCountByBlockNumber = function (blockNumber, callback) * @returns {Promise} */ Eth.prototype.getTransaction = function (transactionHash, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getTransactionByHash', [transactionHash], @@ -664,7 +667,7 @@ Eth.prototype.getTransactionFromBlock = function (hashStringOrNumber, indexNumbe * @returns {Promise} */ Eth.prototype.getTransactionFromBlockByBlockHash = function (transactionHash, indexNumber, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getTransactionByBlockHashAndIndex', [transactionHash, indexNumber], @@ -690,7 +693,7 @@ Eth.prototype.getTransactionFromBlockByBlockHash = function (transactionHash, in * @returns {Promise} */ Eth.prototype.getTransactionFromBlockByBlockNumber = function (blockNumber, indexNumber, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getTransactionByBlockNumberAndIndex', [blockNumber, indexNumber], @@ -714,7 +717,7 @@ Eth.prototype.getTransactionFromBlockByBlockNumber = function (blockNumber, inde * @returns {Promise} */ Eth.prototype.getTransactionReceipt = function (transactionHash, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getTransactionReceipt', [transactionHash], @@ -740,7 +743,7 @@ Eth.prototype.getTransactionCount = function (address, block, callback) { block = this.connectionModel.defaultBlock; } - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getTransactionCount', [address, block], @@ -764,7 +767,7 @@ Eth.prototype.getTransactionCount = function (address, block, callback) { * @returns {Promise} */ Eth.prototype.sendSignedTransaction = function (signedTransactionData, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_sendRawTransaction', [signedTransactionData], @@ -785,7 +788,7 @@ Eth.prototype.sendSignedTransaction = function (signedTransactionData, callback) * @returns {Promise} */ Eth.prototype.signTransaction = function (transactionObject, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_signTransaction', [transactionObject], @@ -806,7 +809,7 @@ Eth.prototype.signTransaction = function (transactionObject, callback) { * @returns {Promise} */ Eth.prototype.sendTransaction = function (transactionObject, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_sendTransaction', [transactionObject], @@ -828,7 +831,7 @@ Eth.prototype.sendTransaction = function (transactionObject, callback) { * @returns {Promise} */ Eth.prototype.sign = function (dataToSign, address, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_sign', [address, dataToSign], @@ -857,7 +860,7 @@ Eth.prototype.call = function (callObject, block, callback) { block = this.connectionModel.defaultBlock; } - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_call', [callObject, block], @@ -881,7 +884,7 @@ Eth.prototype.call = function (callObject, block, callback) { * @returns {Promise} */ Eth.prototype.estimateGas = function (callObject, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_estimateGas', [callObject], @@ -904,7 +907,7 @@ Eth.prototype.estimateGas = function (callObject, callback) { * @returns {Promise} */ Eth.prototype.submitWork = function (nonce, powHash, digest, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_submitWork', [nonce, powHash, digest], @@ -925,7 +928,7 @@ Eth.prototype.submitWork = function (nonce, powHash, digest, callback) { * @returns {Promise} */ Eth.prototype.getWork = function (callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getWork', [], @@ -946,7 +949,7 @@ Eth.prototype.getWork = function (callback) { * @returns {Promise} */ Eth.prototype.getPastLogs = function (options, callback) { - return this.coreFactory.createMethod( + return this.methodPackage.create( this.connectionModel.provider, 'eth_getLogs', [], diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 006f96c9040..dea6a5fa6fc 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -25,16 +25,17 @@ var version = require('./package.json').version; var SubscriptionsResolver = require('./resolvers/SubscriptionsResolver'); var Eth = require('./Eth'); -var Contract = require('web3-eth-contract'); -var Accounts = require('web3-eth-accounts'); -var Personal = require('web3-eth-personal'); -var ENS = require('web3-eth-ens'); -var Abi = require('web3-eth-abi'); -var Subscription = require('web3-core-subscription'); -var PromiEvent = require('web3-core-promiEvent'); +var ContractPackage = require('web3-eth-contract'); +var AccountsPackage = require('web3-eth-accounts'); +var PersonalPackage = require('web3-eth-personal'); +var ENSPackage = require('web3-eth-ens'); +var AbiPackage = require('web3-eth-abi'); +var SubscriptionPackage = require('web3-core-subscription'); +var PromiEventPackage = require('web3-core-promiEvent'); var Iban = require('web3-eth-iban').create(); -var formatters = require('web3-core-helpers').create().formatters; -var Utils = require('web3-utils').create(); +var formatters = require('web3-core-helpers').formatters; +var Utils = require('web3-utils'); +var MethodPackage = require('web3-core-method'); module.exports = { version: version, @@ -51,15 +52,16 @@ module.exports = { create: function (connectionModel) { return new Eth( connectionModel, - Contract.create(connectionModel), - Accounts.create(connectionModel), - Personal.create(connectionModel), + ContractPackage.create(connectionModel), + AccountsPackage.create(connectionModel), + PersonalPackage.create(connectionModel), Iban, - Abi.create(utils), - ENS.create(connectionModel), + AbiPackage.create(utils), + ENSPackage.create(connectionModel), Utils, formatters, - new SubscriptionsResolver(connectionModel.provider, formatters, Subscription, PromiEvent) + MethodPackage, + new SubscriptionsResolver(connectionModel.provider, formatters, SubscriptionPackage, PromiEventPackage) ); } }; diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js new file mode 100644 index 00000000000..df49b42a441 --- /dev/null +++ b/packages/web3-shh/src/Shh.js @@ -0,0 +1,185 @@ +/* + 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 . +*/ +/** + * @file index.js + * @author Fabian Vogelsteller + * @date 2017 + */ + +"use strict"; + +var core = require('web3-core'); +var Subscriptions = require('web3-core-subscriptions').subscriptions; +var Method = require('web3-core-method'); +// var formatters = require('web3-core-helpers').formatters; +var Net = require('web3-net'); + + +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.clearSubscriptions = _this._requestManager.clearSubscriptions; + + this.net = new Net(this.currentProvider); + + + [ + new Subscriptions({ + name: 'subscribe', + type: 'shh', + subscriptions: { + 'messages': { + params: 1 + // inputFormatter: [formatters.inputPostFormatter], + // outputFormatter: formatters.outputPostFormatter + } + } + }), + + new Method({ + name: 'getVersion', + call: 'shh_version', + params: 0 + }), + new Method({ + name: 'getInfo', + call: 'shh_info', + params: 0 + }), + new Method({ + name: 'setMaxMessageSize', + call: 'shh_setMaxMessageSize', + params: 1 + }), + new Method({ + name: 'setMinPoW', + call: 'shh_setMinPoW', + params: 1 + }), + new Method({ + name: 'markTrustedPeer', + call: 'shh_markTrustedPeer', + params: 1 + }), + new Method({ + name: 'newKeyPair', + call: 'shh_newKeyPair', + params: 0 + }), + new Method({ + name: 'addPrivateKey', + call: 'shh_addPrivateKey', + params: 1 + }), + new Method({ + name: 'deleteKeyPair', + call: 'shh_deleteKeyPair', + params: 1 + }), + new Method({ + name: 'hasKeyPair', + call: 'shh_hasKeyPair', + params: 1 + }), + new Method({ + name: 'getPublicKey', + call: 'shh_getPublicKey', + params: 1 + }), + new Method({ + name: 'getPrivateKey', + call: 'shh_getPrivateKey', + params: 1 + }), + new Method({ + name: 'newSymKey', + call: 'shh_newSymKey', + params: 0 + }), + new Method({ + name: 'addSymKey', + call: 'shh_addSymKey', + params: 1 + }), + new Method({ + name: 'generateSymKeyFromPassword', + call: 'shh_generateSymKeyFromPassword', + params: 1 + }), + new Method({ + name: 'hasSymKey', + call: 'shh_hasSymKey', + params: 1 + }), + new Method({ + name: 'getSymKey', + call: 'shh_getSymKey', + params: 1 + }), + new Method({ + name: 'deleteSymKey', + call: 'shh_deleteSymKey', + params: 1 + }), + + new Method({ + name: 'newMessageFilter', + call: 'shh_newMessageFilter', + params: 1 + }), + new Method({ + name: 'getFilterMessages', + call: 'shh_getFilterMessages', + params: 1 + }), + new Method({ + name: 'deleteMessageFilter', + call: 'shh_deleteMessageFilter', + params: 1 + }), + + new Method({ + name: 'post', + call: 'shh_post', + params: 1, + inputFormatter: [null] + }), + + new Method({ + name: 'unsubscribe', + call: 'shh_unsubscribe', + params: 1 + }) + ].forEach(function(method) { + method.attachToObject(_this); + method.setRequestManager(_this._requestManager); + }); +}; + +core.addProviders(Shh); + +module.exports = Shh; diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index d723d884ff9..2b4584604be 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -16,174 +16,26 @@ */ /** * @file index.js - * @author Fabian Vogelsteller - * @date 2017 + * @author Samuel Furer + * @date 2018 */ "use strict"; -var core = require('web3-core'); -var Subscriptions = require('web3-core-subscriptions').subscriptions; -var Method = require('web3-core-method'); -// var formatters = require('web3-core-helpers').formatters; -var Net = require('web3-net'); - - -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.clearSubscriptions = _this._requestManager.clearSubscriptions; - - this.net = new Net(this.currentProvider); - - - [ - new Subscriptions({ - name: 'subscribe', - type: 'shh', - subscriptions: { - 'messages': { - params: 1 - // inputFormatter: [formatters.inputPostFormatter], - // outputFormatter: formatters.outputPostFormatter - } - } - }), - - new Method({ - name: 'getVersion', - call: 'shh_version', - params: 0 - }), - new Method({ - name: 'getInfo', - call: 'shh_info', - params: 0 - }), - new Method({ - name: 'setMaxMessageSize', - call: 'shh_setMaxMessageSize', - params: 1 - }), - new Method({ - name: 'setMinPoW', - call: 'shh_setMinPoW', - params: 1 - }), - new Method({ - name: 'markTrustedPeer', - call: 'shh_markTrustedPeer', - params: 1 - }), - new Method({ - name: 'newKeyPair', - call: 'shh_newKeyPair', - params: 0 - }), - new Method({ - name: 'addPrivateKey', - call: 'shh_addPrivateKey', - params: 1 - }), - new Method({ - name: 'deleteKeyPair', - call: 'shh_deleteKeyPair', - params: 1 - }), - new Method({ - name: 'hasKeyPair', - call: 'shh_hasKeyPair', - params: 1 - }), - new Method({ - name: 'getPublicKey', - call: 'shh_getPublicKey', - params: 1 - }), - new Method({ - name: 'getPrivateKey', - call: 'shh_getPrivateKey', - params: 1 - }), - new Method({ - name: 'newSymKey', - call: 'shh_newSymKey', - params: 0 - }), - new Method({ - name: 'addSymKey', - call: 'shh_addSymKey', - params: 1 - }), - new Method({ - name: 'generateSymKeyFromPassword', - call: 'shh_generateSymKeyFromPassword', - params: 1 - }), - new Method({ - name: 'hasSymKey', - call: 'shh_hasSymKey', - params: 1 - }), - new Method({ - name: 'getSymKey', - call: 'shh_getSymKey', - params: 1 - }), - new Method({ - name: 'deleteSymKey', - call: 'shh_deleteSymKey', - params: 1 - }), - - new Method({ - name: 'newMessageFilter', - call: 'shh_newMessageFilter', - params: 1 - }), - new Method({ - name: 'getFilterMessages', - call: 'shh_getFilterMessages', - params: 1 - }), - new Method({ - name: 'deleteMessageFilter', - call: 'shh_deleteMessageFilter', - params: 1 - }), - - new Method({ - name: 'post', - call: 'shh_post', - params: 1, - inputFormatter: [null] - }), - - new Method({ - name: 'unsubscribe', - call: 'shh_unsubscribe', - params: 1 - }) - ].forEach(function(method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - }); +var version = require('./package.json'); +var Shh = require('./Shh'); + +module.exports = { + version: version, + + /** + * Returns the Shh object. + * + * @method create + * + * @returns {Shh} + */ + create: function () { // TODO: Refactor the Shh object because of the new method and connection handling. + return new Shh(); + } }; - -core.addProviders(Shh); - - - -module.exports = Shh; - - diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index c8db2476f71..932e8ccd068 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -24,6 +24,11 @@ var ProvidersPackage = require('web3-core-providers'); var EthPackage = require('web3-eth'); +var MethodPackage = require('web3-core-method'); +var Utils = require('web3-utils'); +var ShhPackage = require('web3-shh'); +var BzzPackage = require('web3-bzz'); +var HelpersPackage = require('web3-helpers'); var version = require('../package.json').version; /** @@ -37,7 +42,7 @@ var Web3 = function Web3(provider, net) { this.connectionModel = Web3.createConnectionModel( ProvidersPackage.resolve(provider, net) ); - this.utils = UtilsPackage.create(); + this.utils = Utils; this.eth = EthPackage.create(this.connectionModel); this.shh = ShhPackage.create(this.connectionModel); this.bzz = BzzPackage.create(this.connectionModel); @@ -79,7 +84,7 @@ Object.defineProperty(Web3, 'givenProvider', { Web3.version = version; -Web3.utils = new CoreFactory().createUtils(); +Web3.utils = Utils; Web3.modules = { Eth: function (provider, net) { @@ -101,7 +106,9 @@ Web3.modules = { Web3.createConnectionModel = function(provider, net) { return new ConnectionModel( - ProvidersPackage.resolve(provider, net), UtilsPackage.create(), + ProvidersPackage.resolve(provider, net), + MethodPackage, + UtilsPackage.create(), HelpersPackage.create().formatters ) }; diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index 2e4ee30d850..818763d8ad9 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -23,17 +23,16 @@ /** * @param {Object} provider - * @param {MethodPackage} method + * @param {MethodPackage} methodPackage * @param {Utils} utils * @param {Object} formatters * @constructor */ -function ConnectionModel(provider, method, utils, formatters) { +function ConnectionModel(provider, methodPackage, utils, formatters) { this.provider = provider; - this.coreFactory = coreFactory; this.utils = utils; this.formatters = formatters; - this.method = method; + this.methodPackage = methodPackage; } /** @@ -128,7 +127,7 @@ ConnectionModel.prototype.getNetworkType = function (callback) { * @returns {Promise|eventifiedPromise} */ ConnectionModel.prototype.getId = function (callback) { - return this.method.create(this.provider, 'net_version', [], null, this.utils.hexToNumber).send(callback); + return this.methodPackage.create(this.provider, 'net_version', [], null, this.utils.hexToNumber).send(callback); }; /** @@ -142,7 +141,7 @@ ConnectionModel.prototype.getId = function (callback) { * @returns {Promise|eventifiedPromise} */ ConnectionModel.prototype.isListening = function (callback) { - return this.method.create(this.provider, 'net_listening', [], null, null).send(callback); + return this.methodPackage.create(this.provider, 'net_listening', [], null, null).send(callback); }; /** @@ -156,7 +155,7 @@ ConnectionModel.prototype.isListening = function (callback) { * @returns {Promise|eventifiedPromise} */ ConnectionModel.prototype.getPeerCount = function (callback) { - return this.method.create(this.provider, 'net_peerCount', [], null, this.utils.hexToNumber).send(callback); + return this.methodPackage.create(this.provider, 'net_peerCount', [], null, this.utils.hexToNumber).send(callback); }; /** @@ -172,7 +171,7 @@ ConnectionModel.prototype.getPeerCount = function (callback) { * @returns {Promise|eventifiedPromise} */ ConnectionModel.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { - return this.method.create( + return this.methodPackage.create( this.provider, 'eth_getBlockByNumber', [blockNumber, returnTransactionObjects], From 401aeac8f90a88d5f9c0266699ab569badca6bb4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 3 Sep 2018 13:31:40 +0200 Subject: [PATCH 0074/1045] Bzz refactored --- packages/web3-bzz/src/Bzz.js | 145 +++++++++++++++++++------- packages/web3-bzz/src/index.js | 2 +- packages/web3-core-batch/src/index.js | 1 - packages/web3/src/index.js | 2 +- 4 files changed, 109 insertions(+), 41 deletions(-) diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index 3ad2b25e248..4b3a79f562b 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -25,64 +25,133 @@ var _ = require('underscore'); var swarm = require("swarm-js"); +/** + * @param {any} provider + * + * @constructor + */ +function Bzz(provider) { + this.givenProvider = Bzz.givenProvider; + this.currentProvider = null; + this.setProvider(provider); +} -var Bzz = function Bzz(provider) { +/** + * Gets the pick methods from swarm if it is executed in the browser + * + * @method pick + * + * @returns {Object|Boolean} + */ +Bzz.prototype.pick = function () { + if (typeof document !== 'undefined') { + return swarm.pick; + } - this.givenProvider = Bzz.givenProvider; + return false; +}; - if (provider && provider._requestManager) { - provider = provider.currentProvider; +/** + * Downloads a file from the swarm network + * + * @method download + * + * @param {String} bzzHash + * @param {String} localPath + * + * @returns {Promise} + */ +Bzz.prototype.download = function (bzzHash, localPath) { + if (this.hasProvider()) { + return this.swarm.download(bzzHash, localPath); } - // only allow file picker when in browser - if(typeof document !== 'undefined') { - this.pick = swarm.pick; + this.throwProviderError(); +}; + +/** + * Uploads the given data to swarm + * + * @method upload + * + * @param {String|Buffer|Uint8Array|Object} data + * + * @returns {Promise} + */ +Bzz.prototype.upload = function (data) { + if (this.hasProvider()) { + return this.swarm.upload(data); } - this.setProvider(provider); + this.throwProviderError(); }; -// set default ethereum provider -/* jshint ignore:start */ -Bzz.givenProvider = null; -if(typeof ethereumProvider !== 'undefined' && ethereumProvider.bzz) { - Bzz.givenProvider = ethereumProvider.bzz; -} -/* jshint ignore:end */ +/** + * Checks if swarm is available + * + * @returns {Promise} + */ +Bzz.prototype.isAvailable = function () { + if (this.hasProvider()) { + return this.swarm.isAvailable(); + } + + this.throwProviderError(); +}; + +/** + * Checks if currentProvider is set + * + * @method hasProvider + * + * @returns {boolean} + */ +Bzz.prototype.hasProvider = function () { + return !!this.currentProvider; +}; -Bzz.prototype.setProvider = function(provider) { +/** + * Throws the provider error + */ +Bzz.prototype.throwProviderError = function () { + throw new Error('No provider set, please set one using bzz.setProvider().'); +}; + +/** + * Sets the provider for swarm + * + * @method setProvider + * + * @param {Object} provider + * + * @returns {boolean} + */ +Bzz.prototype.setProvider = function (provider) { // is ethereum provider - if(_.isObject(provider) && _.isString(provider.bzz)) { + if (_.isObject(provider) && _.isString(provider.bzz)) { provider = provider.bzz; - // is no string, set default } - // else if(!_.isString(provider)) { - // provider = 'http://swarm-gateways.net'; // default to gateway - // } - - if(_.isString(provider)) { + if (_.isString(provider)) { this.currentProvider = provider; - } else { - this.currentProvider = null; - - var noProviderError = new Error('No provider set, please set one using bzz.setProvider().'); - - this.download = this.upload = this.isAvailable = function(){ - throw noProviderError; - }; + this.swarm = swarm.at(provider); - return false; + return true; } - // add functions - this.download = swarm.at(provider).download; - this.upload = swarm.at(provider).upload; - this.isAvailable = swarm.at(provider).isAvailable; + this.currentProvider = null; + this.throwProviderError(); - return true; + return false; }; +// set default ethereum provider +/* jshint ignore:start */ +Bzz.givenProvider = null; +if(typeof ethereumProvider !== 'undefined' && ethereumProvider.bzz) { + Bzz.givenProvider = ethereumProvider.bzz; +} +/* jshint ignore:end */ + module.exports = Bzz; - diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index 2a28a8810f2..106cbae2d01 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -37,7 +37,7 @@ module.exports = { * * @returns {Bzz} */ - create: function (connectionModel) {//TODO: Refactor the bzz object + create: function (connectionModel) { return new Bzz(connectionModel.provider); } }; diff --git a/packages/web3-core-batch/src/index.js b/packages/web3-core-batch/src/index.js index fc6ab836e26..5d6805a438b 100644 --- a/packages/web3-core-batch/src/index.js +++ b/packages/web3-core-batch/src/index.js @@ -36,5 +36,4 @@ module.exports = { create: function (connectionModel) { return new Batch(connectionModel); } - }; diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 932e8ccd068..782bb8422b6 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -37,7 +37,7 @@ var version = require('../package.json').version; * * @constructor */ -var Web3 = function Web3(provider, net) { +var Web3 = function Web3(provider, net) { // TODO: throw error if no provider is given and also no provider is found with the detector this.version = version; this.connectionModel = Web3.createConnectionModel( ProvidersPackage.resolve(provider, net) From 311fb479d138cd96719c91801cc6e108d229d6c3 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 3 Sep 2018 14:48:10 +0200 Subject: [PATCH 0075/1045] Wallet moved to seperate file, refactoring started in Accounts.js, ABICoder funcDocs improved --- packages/web3-eth-abi/src/ABICoder.js | 62 +++-- packages/web3-eth-accounts/src/Accounts.js | 272 +++++---------------- packages/web3-eth-accounts/src/Wallet.js | 261 ++++++++++++++++++++ 3 files changed, 372 insertions(+), 223 deletions(-) create mode 100644 packages/web3-eth-accounts/src/Wallet.js diff --git a/packages/web3-eth-abi/src/ABICoder.js b/packages/web3-eth-abi/src/ABICoder.js index f8e3f959b8d..0481bae4f81 100644 --- a/packages/web3-eth-abi/src/ABICoder.js +++ b/packages/web3-eth-abi/src/ABICoder.js @@ -21,6 +21,8 @@ * @date 2018 */ +'use strict'; + var _ = require('underscore'); var utils = require('web3-utils'); @@ -33,21 +35,22 @@ var ethersAbiCoder = new EthersAbi(function (type, value) { }); // result method -function Result() { -} +function Result() { } /** * ABICoder prototype should be used to encode/decode solidity params of any type */ -var ABICoder = function () { -}; +function ABICoder() { } /** - * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. + * Encodes the function name to its ABI representation, + * which are the first 4 bytes of the sha3 of the function name including types. * * @method encodeFunctionSignature + * * @param {String|Object} functionName - * @return {String} encoded function name + * + * @returns {String} encoded function name */ ABICoder.prototype.encodeFunctionSignature = function (functionName) { if (_.isObject(functionName)) { @@ -58,11 +61,14 @@ ABICoder.prototype.encodeFunctionSignature = function (functionName) { }; /** - * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. + * Encodes the function name to its ABI representation, + * which are the first 4 bytes of the sha3 of the function name including types. * * @method encodeEventSignature + * * @param {String|Object} functionName - * @return {String} encoded function name + * + * @returns {String} encoded function name */ ABICoder.prototype.encodeEventSignature = function (functionName) { if (_.isObject(functionName)) { @@ -76,9 +82,11 @@ ABICoder.prototype.encodeEventSignature = function (functionName) { * Should be used to encode plain param * * @method encodeParameter + * * @param {String} type * @param {Object} param - * @return {String} encoded plain param + * + * @returns {String} encoded plain param */ ABICoder.prototype.encodeParameter = function (type, param) { return this.encodeParameters([type], [param]); @@ -88,9 +96,11 @@ ABICoder.prototype.encodeParameter = function (type, param) { * Should be used to encode list of params * * @method encodeParameters + * * @param {Array} types * @param {Array} params - * @return {String} encoded list of params + * + * @returns {String} encoded list of params */ ABICoder.prototype.encodeParameters = function (types, params) { return ethersAbiCoder.encode(this.mapTypes(types), params); @@ -100,8 +110,10 @@ ABICoder.prototype.encodeParameters = function (types, params) { * Map types if simplified format is used * * @method mapTypes + * * @param {Array} types - * @return {Array} + * + * @returns {Array} */ ABICoder.prototype.mapTypes = function (types) { var self = this; @@ -131,7 +143,9 @@ ABICoder.prototype.mapTypes = function (types) { * Check if type is simplified struct format * * @method isSimplifiedStructFormat - * @param {String | Object} type + * + * @param {String|Object} type + * * @returns {boolean} */ ABICoder.prototype.isSimplifiedStructFormat = function (type) { @@ -142,8 +156,10 @@ ABICoder.prototype.isSimplifiedStructFormat = function (type) { * Maps the correct tuple type and name when the simplified format in encode/decodeParameter is used * * @method mapStructNameAndType + * * @param {String} structName - * @return {{type: string, name: *}} + * + * @returns {{type: string, name: *}} */ ABICoder.prototype.mapStructNameAndType = function (structName) { var type = 'tuple'; @@ -160,8 +176,10 @@ ABICoder.prototype.mapStructNameAndType = function (structName) { * Maps the simplified format in to the expected format of the ABICoder * * @method mapStructToCoderFormat + * * @param {Object} struct - * @return {Array} + * + * @returns {Array} */ ABICoder.prototype.mapStructToCoderFormat = function (struct) { var self = this; @@ -193,9 +211,11 @@ ABICoder.prototype.mapStructToCoderFormat = function (struct) { * Encodes a function call from its json interface and parameters. * * @method encodeFunctionCall + * * @param {Array} jsonInterface * @param {Array} params - * @return {String} The encoded ABI for this function call + * + * @returns {String} The encoded ABI for this function call */ ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface.inputs, params).replace('0x', ''); @@ -205,9 +225,11 @@ ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { * Should be used to decode bytes to plain param * * @method decodeParameter + * * @param {String} type * @param {String} bytes - * @return {Object} plain param + * + * @returns {Object} plain param */ ABICoder.prototype.decodeParameter = function (type, bytes) { return this.decodeParameters([type], bytes)[0]; @@ -217,9 +239,11 @@ ABICoder.prototype.decodeParameter = function (type, bytes) { * Should be used to decode list of params * * @method decodeParameter + * * @param {Array} outputs * @param {String} bytes - * @return {Array} array of plain params + * + * @returns {Array} array of plain params */ ABICoder.prototype.decodeParameters = function (outputs, bytes) { if (!bytes || bytes === '0x' || bytes === '0X') { @@ -250,10 +274,12 @@ ABICoder.prototype.decodeParameters = function (outputs, bytes) { * Decodes events non- and indexed parameters. * * @method decodeLog + * * @param {Object} inputs * @param {String} data * @param {Array} topics - * @return {Array} array of plain params + * + * @returns {Array} array of plain params */ ABICoder.prototype.decodeLog = function (inputs, data, topics) { var _this = this; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index dfaf98ea45b..f28f7cbd29e 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -23,8 +23,6 @@ "use strict"; var _ = require("underscore"); -var core = require('web3-core'); -var Method = require('web3-core-method'); var Promise = require('any-promise'); var Account = require("eth-lib/lib/account"); var Hash = require("eth-lib/lib/hash"); @@ -34,10 +32,8 @@ var Bytes = require("eth-lib/lib/bytes"); var cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); var scryptsy = require('scrypt.js'); var uuid = require('uuid'); -var utils = require('web3-utils'); -var helpers = require('web3-core-helpers'); -var isNot = function(value) { +var isNot = function (value) { return (_.isUndefined(value) || _.isNull(value)); }; @@ -49,57 +45,65 @@ var trimLeadingZero = function (hex) { }; var makeEven = function (hex) { - if(hex.length % 2 === 1) { + if (hex.length % 2 === 1) { hex = hex.replace('0x', '0x0'); } return hex; }; +/** + * @param {MethodPackage} methodPackage + * @param {Wallet} wallet + * @param {Helpers} helpers + * @param {Utils} utils + * + * @constructor + */ +function Accounts(methodPackage, wallet, helpers, utils) { + this.methodPackage = methodPackage; + this.wallet = wallet; + this.helpers = helpers; + this.utils = utils; +} -var Accounts = function Accounts() { - var _this = this; +/** + * Gets the actual gasPrice from the connected node + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * + * @returns {Promise} + */ +Accounts.prototype.getGasPrice = function (callback) { + return this.methodPackage.create(this.connectionModel.provider, 'eth_gasPrice', null, null, null).send(callback); +}; - // 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 - }), - new Method({ - name: 'getTransactionCount', - call: 'eth_getTransactionCount', - params: 2, - inputFormatter: [function (address) { +/** + * Gets the transaction count of an address + * + * @param {String} address + * @param {Function} callback + * + * @callback callback callback(error, result) + * + * @returns {Promise} + */ +Accounts.prototype.getTransactionCount = function (address, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'eth_getTransactionCount', + [address, 'latest'], + [ + function (address) { if (utils.isAddress(address)) { return address; - } else { - throw new Error('Address '+ address +' is not a valid address to get the "transactionCount".'); } - }, function () { return 'latest'; }] - }) - ]; - // attach methods to this._ethereumCall - this._ethereumCall = {}; - _.each(_ethereumCall, function (method) { - method.attachToObject(_this._ethereumCall); - method.setRequestManager(_this._requestManager); - }); - - this.wallet = new Wallet(this); + throw new Error('Address ' + address + ' is not a valid address to get the "transactionCount".'); + } + ] + ).send(callback); }; Accounts.prototype._addAccountFunctions = function (account) { @@ -134,7 +138,8 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca error = false, result; - callback = callback || function () {}; + callback = callback || function () { + }; if (!tx) { error = new Error('No transaction object given!'); @@ -143,16 +148,16 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca return Promise.reject(error); } - function signed (tx) { + function signed(tx) { if (!tx.gas && !tx.gasLimit) { error = new Error('"gas" is missing'); } - if (tx.nonce < 0 || - tx.gas < 0 || - tx.gasPrice < 0 || - tx.chainId < 0) { + if (tx.nonce < 0 || + tx.gas < 0 || + tx.gasPrice < 0 || + tx.chainId < 0) { error = new Error('Gas, gasPrice, nonce or chainId is lower than 0'); } @@ -203,7 +208,7 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca rawTransaction: rawTransaction }; - } catch(e) { + } catch (e) { callback(e); return Promise.reject(e); } @@ -225,7 +230,7 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca isNot(tx.nonce) ? _this._ethereumCall.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce ]).then(function (args) { if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) { - throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: '+ JSON.stringify(args)); + throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: ' + JSON.stringify(args)); } return signed(_.extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2]})); }); @@ -234,10 +239,10 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca /* jshint ignore:start */ Accounts.prototype.recoverTransaction = function recoverTransaction(rawTx) { var values = RLP.decode(rawTx); - var signature = Account.encodeSignature(values.slice(6,9)); + var signature = Account.encodeSignature(values.slice(6, 9)); var recovery = Bytes.toNumber(values[6]); var extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), "0x", "0x"]; - var signingData = values.slice(0,6).concat(extraData); + var signingData = values.slice(0, 6).concat(extraData); var signingDataHex = RLP.encode(signingData); return Account.recover(Hash.keccak256(signingDataHex), signature); }; @@ -291,7 +296,7 @@ Accounts.prototype.recover = function recover(message, signature, preFixed) { Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) { /* jshint maxcomplexity: 10 */ - if(!_.isString(password)) { + if (!_.isString(password)) { throw new Error('No password given.'); } @@ -322,13 +327,13 @@ Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) { var ciphertext = new Buffer(json.crypto.ciphertext, 'hex'); - var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ])).replace('0x',''); + var mac = utils.sha3(Buffer.concat([derivedKey.slice(16, 32), ciphertext])).replace('0x', ''); if (mac !== json.crypto.mac) { throw new Error('Key derivation failed - possibly wrong password'); } var decipher = cryp.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), new Buffer(json.crypto.cipherparams.iv, 'hex')); - var seed = '0x'+ Buffer.concat([ decipher.update(ciphertext), decipher.final() ]).toString('hex'); + var seed = '0x' + Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('hex'); return this.privateKeyToAccount(seed); }; @@ -367,14 +372,14 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { throw new Error('Unsupported cipher'); } - var ciphertext = Buffer.concat([ cipher.update(new Buffer(account.privateKey.replace('0x',''), 'hex')), cipher.final() ]); + var ciphertext = Buffer.concat([cipher.update(new Buffer(account.privateKey.replace('0x', ''), 'hex')), cipher.final()]); - var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex') ])).replace('0x',''); + var mac = utils.sha3(Buffer.concat([derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex')])).replace('0x', ''); return { version: 3, - id: uuid.v4({ random: options.uuid || cryp.randomBytes(16) }), - address: account.address.toLowerCase().replace('0x',''), + id: uuid.v4({random: options.uuid || cryp.randomBytes(16)}), + address: account.address.toLowerCase().replace('0x', ''), crypto: { ciphertext: ciphertext.toString('hex'), cipherparams: { @@ -388,147 +393,4 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { }; }; - -// Note: this is trying to follow closely the specs on -// http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html - -function Wallet(accounts) { - this._accounts = accounts; - this.length = 0; - this.defaultKeyName = "web3js_wallet"; -} - -Wallet.prototype._findSafeIndex = function (pointer) { - pointer = pointer || 0; - if (_.has(this, pointer)) { - return this._findSafeIndex(pointer + 1); - } else { - return pointer; - } -}; - -Wallet.prototype._currentIndexes = function () { - var keys = Object.keys(this); - var indexes = keys - .map(function(key) { return parseInt(key); }) - .filter(function(n) { return (n < 9e20); }); - - return indexes; -}; - -Wallet.prototype.create = function (numberOfAccounts, entropy) { - for (var i = 0; i < numberOfAccounts; ++i) { - this.add(this._accounts.create(entropy).privateKey); - } - return this; -}; - -Wallet.prototype.add = function (account) { - - if (_.isString(account)) { - account = this._accounts.privateKeyToAccount(account); - } - if (!this[account.address]) { - account = this._accounts.privateKeyToAccount(account.privateKey); - account.index = this._findSafeIndex(); - - this[account.index] = account; - this[account.address] = account; - this[account.address.toLowerCase()] = account; - - this.length++; - - return account; - } else { - return this[account.address]; - } -}; - -Wallet.prototype.remove = function (addressOrIndex) { - var account = this[addressOrIndex]; - - if (account && account.address) { - // address - this[account.address].privateKey = null; - delete this[account.address]; - // address lowercase - this[account.address.toLowerCase()].privateKey = null; - delete this[account.address.toLowerCase()]; - // index - this[account.index].privateKey = null; - delete this[account.index]; - - this.length--; - - return true; - } else { - return false; - } -}; - -Wallet.prototype.clear = function () { - var _this = this; - var indexes = this._currentIndexes(); - - indexes.forEach(function(index) { - _this.remove(index); - }); - - return this; -}; - -Wallet.prototype.encrypt = function (password, options) { - var _this = this; - var indexes = this._currentIndexes(); - - var accounts = indexes.map(function(index) { - return _this[index].encrypt(password, options); - }); - - return accounts; -}; - - -Wallet.prototype.decrypt = function (encryptedWallet, password) { - var _this = this; - - encryptedWallet.forEach(function (keystore) { - var account = _this._accounts.decrypt(keystore, password); - - if (account) { - _this.add(account); - } else { - throw new Error('Couldn\'t decrypt accounts. Password wrong?'); - } - }); - - return this; -}; - -Wallet.prototype.save = function (password, keyName) { - localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password))); - - return true; -}; - -Wallet.prototype.load = function (password, keyName) { - var keystore = localStorage.getItem(keyName || this.defaultKeyName); - - if (keystore) { - try { - keystore = JSON.parse(keystore); - } catch(e) { - - } - } - - return this.decrypt(keystore || [], password); -}; - -if (typeof localStorage === 'undefined') { - delete Wallet.prototype.save; - delete Wallet.prototype.load; -} - - module.exports = Accounts; diff --git a/packages/web3-eth-accounts/src/Wallet.js b/packages/web3-eth-accounts/src/Wallet.js new file mode 100644 index 00000000000..e758754b596 --- /dev/null +++ b/packages/web3-eth-accounts/src/Wallet.js @@ -0,0 +1,261 @@ +/* + 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 . + */ +/** + * @file Wallet.js + * @author Fabian Vogelsteller + * @date 2017 + */ + +// Note: this is trying to follow closely the specs on +// http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html + +/** + * @param {Accounts} accounts + * + * @constructor + */ +function Wallet(accounts) { + this._accounts = accounts; + this.length = 0; + this.defaultKeyName = "web3js_wallet"; +} + +/** + * Find the safe index in the given pointer + * + * @method _findSafeIndex + * @private + * + * @param {Number} pointer + * + * @returns {number} + */ +Wallet.prototype._findSafeIndex = function (pointer) { + pointer = pointer || 0; + if (_.has(this, pointer)) { + return this._findSafeIndex(pointer + 1); + } + + return pointer; +}; + +/** + * Gets the current indexes as array + * + * @private + * + * @returns {Number[]} + */ +Wallet.prototype._currentIndexes = function () { + return Object.keys(this).map(function (key) { + return parseInt(key); + }).filter(function (n) { + return (n < 9e20); + }); +}; + +/** + * Creates a new wallet + * + * @method create + * + * @param {Number} numberOfAccounts + * @param {Number} entropy + * + * @returns {Wallet} + */ +Wallet.prototype.create = function (numberOfAccounts, entropy) { + for (var i = 0; i < numberOfAccounts; ++i) { + this.add(this._accounts.create(entropy).privateKey); + } + + return this; +}; + +/** + * Adds a account to the wallets + * + * @method add + * + * @param {Account} account + * + * @returns {Account | Account[]} + */ +Wallet.prototype.add = function (account) { + + if (_.isString(account)) { + account = this._accounts.privateKeyToAccount(account); + } + + if (!this[account.address]) { + account = this._accounts.privateKeyToAccount(account.privateKey); + account.index = this._findSafeIndex(); + + this[account.index] = account; + this[account.address] = account; + this[account.address.toLowerCase()] = account; + + this.length++; + + return account; + } + + return this[account.address]; +}; + +/** + * Removes an account from the wallet array + * + * @method remove + * + * @param {Number} addressOrIndex + * + * @returns {boolean} + */ +Wallet.prototype.remove = function (addressOrIndex) { + var account = this[addressOrIndex]; + + if (account && account.address) { + // address + this[account.address].privateKey = null; + delete this[account.address]; + // address lowercase + this[account.address.toLowerCase()].privateKey = null; + delete this[account.address.toLowerCase()]; + // index + this[account.index].privateKey = null; + delete this[account.index]; + + this.length--; + + return true; + } + + return false; +}; + +/** + * Removes all addresses from the wallet + * + * @method clear + * + * @returns {Wallet} + */ +Wallet.prototype.clear = function () { + var _this = this; + var indexes = this._currentIndexes(); + + indexes.forEach(function (index) { + _this.remove(index); + }); + + return this; +}; + +/** + * Encodes the wallet + * + * @method encrypt + * + * @param {String} password + * @param {Object} options + * + * @returns {Account[]} + */ +Wallet.prototype.encrypt = function (password, options) { + var self = this; + + return this._currentIndexes().map(function (index) { + return self[index].encrypt(password, options); + }); +}; + +/** + * Decodes the wallet + * + * @method decrypt + * + * @param {Array} encryptedWallet + * @param {String} password + * + * @returns {Wallet} + */ +Wallet.prototype.decrypt = function (encryptedWallet, password) { + var _this = this; + + encryptedWallet.forEach(function (keystore) { + var account = _this._accounts.decrypt(keystore, password); + + if (account) { + _this.add(account); + } else { + throw new Error('Couldn\'t decrypt accounts. Password wrong?'); + } + }); + + return this; +}; + +/** + * Saves the wallet in the localStorage + * + * @method save + * + * @param {String} password + * @param {String} keyName + * + * @returns {boolean} + */ +Wallet.prototype.save = function (password, keyName) { + if (typeof localStorage !== 'undefined') { + localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password))); + + return true; + } + + throw new Error('Can\'t save wallet in localStorage. It is not supported in this environment.'); +}; + +/** + * Load the stored wallet from localStorage + * + * @method load + * + * @param {String} password + * @param {String} keyName + * + * @returns {Wallet} + */ +Wallet.prototype.load = function (password, keyName) { + if (typeof localStorage !== 'undefined') { + var keystore = localStorage.getItem(keyName || this.defaultKeyName); + + if (keystore) { + try { + keystore = JSON.parse(keystore); + + return this.decrypt(keystore, password); + } catch (e) { + throw new Error('Invalid keystore in localStorage found!'); + } + } + + return this; + } + + throw new Error('Can\'t load wallet from localStorage. It is not supported in this environment'); +}; From 345dadbf1c58987290368b4a2e5562f0fe897813 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 3 Sep 2018 14:50:50 +0200 Subject: [PATCH 0076/1045] method clear in Wallet.js simplified --- packages/web3-eth-accounts/src/Wallet.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/web3-eth-accounts/src/Wallet.js b/packages/web3-eth-accounts/src/Wallet.js index e758754b596..d0f42dd0f90 100644 --- a/packages/web3-eth-accounts/src/Wallet.js +++ b/packages/web3-eth-accounts/src/Wallet.js @@ -49,7 +49,7 @@ Wallet.prototype._findSafeIndex = function (pointer) { if (_.has(this, pointer)) { return this._findSafeIndex(pointer + 1); } - + return pointer; }; @@ -157,9 +157,7 @@ Wallet.prototype.remove = function (addressOrIndex) { */ Wallet.prototype.clear = function () { var _this = this; - var indexes = this._currentIndexes(); - - indexes.forEach(function (index) { + this._currentIndexes().forEach(function (index) { _this.remove(index); }); From 3163fa508922aae9f57f7d945016260ad02035a5 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 6 Sep 2018 16:45:37 +0200 Subject: [PATCH 0077/1045] Revert "method clear in Wallet.js simplified" This reverts commit 345dadbf1c58987290368b4a2e5562f0fe897813. --- packages/web3-eth-accounts/src/Wallet.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/web3-eth-accounts/src/Wallet.js b/packages/web3-eth-accounts/src/Wallet.js index d0f42dd0f90..e758754b596 100644 --- a/packages/web3-eth-accounts/src/Wallet.js +++ b/packages/web3-eth-accounts/src/Wallet.js @@ -49,7 +49,7 @@ Wallet.prototype._findSafeIndex = function (pointer) { if (_.has(this, pointer)) { return this._findSafeIndex(pointer + 1); } - + return pointer; }; @@ -157,7 +157,9 @@ Wallet.prototype.remove = function (addressOrIndex) { */ Wallet.prototype.clear = function () { var _this = this; - this._currentIndexes().forEach(function (index) { + var indexes = this._currentIndexes(); + + indexes.forEach(function (index) { _this.remove(index); }); From 036e39b029941675a48fb9ee9f7747c88e5921c1 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 6 Sep 2018 16:45:46 +0200 Subject: [PATCH 0078/1045] Revert "Wallet moved to seperate file, refactoring started in Accounts.js, ABICoder funcDocs improved" This reverts commit 311fb479d138cd96719c91801cc6e108d229d6c3. --- packages/web3-eth-abi/src/ABICoder.js | 62 ++--- packages/web3-eth-accounts/src/Accounts.js | 272 ++++++++++++++++----- packages/web3-eth-accounts/src/Wallet.js | 261 -------------------- 3 files changed, 223 insertions(+), 372 deletions(-) delete mode 100644 packages/web3-eth-accounts/src/Wallet.js diff --git a/packages/web3-eth-abi/src/ABICoder.js b/packages/web3-eth-abi/src/ABICoder.js index 0481bae4f81..f8e3f959b8d 100644 --- a/packages/web3-eth-abi/src/ABICoder.js +++ b/packages/web3-eth-abi/src/ABICoder.js @@ -21,8 +21,6 @@ * @date 2018 */ -'use strict'; - var _ = require('underscore'); var utils = require('web3-utils'); @@ -35,22 +33,21 @@ var ethersAbiCoder = new EthersAbi(function (type, value) { }); // result method -function Result() { } +function Result() { +} /** * ABICoder prototype should be used to encode/decode solidity params of any type */ -function ABICoder() { } +var ABICoder = function () { +}; /** - * Encodes the function name to its ABI representation, - * which are the first 4 bytes of the sha3 of the function name including types. + * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. * * @method encodeFunctionSignature - * * @param {String|Object} functionName - * - * @returns {String} encoded function name + * @return {String} encoded function name */ ABICoder.prototype.encodeFunctionSignature = function (functionName) { if (_.isObject(functionName)) { @@ -61,14 +58,11 @@ ABICoder.prototype.encodeFunctionSignature = function (functionName) { }; /** - * Encodes the function name to its ABI representation, - * which are the first 4 bytes of the sha3 of the function name including types. + * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. * * @method encodeEventSignature - * * @param {String|Object} functionName - * - * @returns {String} encoded function name + * @return {String} encoded function name */ ABICoder.prototype.encodeEventSignature = function (functionName) { if (_.isObject(functionName)) { @@ -82,11 +76,9 @@ ABICoder.prototype.encodeEventSignature = function (functionName) { * Should be used to encode plain param * * @method encodeParameter - * * @param {String} type * @param {Object} param - * - * @returns {String} encoded plain param + * @return {String} encoded plain param */ ABICoder.prototype.encodeParameter = function (type, param) { return this.encodeParameters([type], [param]); @@ -96,11 +88,9 @@ ABICoder.prototype.encodeParameter = function (type, param) { * Should be used to encode list of params * * @method encodeParameters - * * @param {Array} types * @param {Array} params - * - * @returns {String} encoded list of params + * @return {String} encoded list of params */ ABICoder.prototype.encodeParameters = function (types, params) { return ethersAbiCoder.encode(this.mapTypes(types), params); @@ -110,10 +100,8 @@ ABICoder.prototype.encodeParameters = function (types, params) { * Map types if simplified format is used * * @method mapTypes - * * @param {Array} types - * - * @returns {Array} + * @return {Array} */ ABICoder.prototype.mapTypes = function (types) { var self = this; @@ -143,9 +131,7 @@ ABICoder.prototype.mapTypes = function (types) { * Check if type is simplified struct format * * @method isSimplifiedStructFormat - * - * @param {String|Object} type - * + * @param {String | Object} type * @returns {boolean} */ ABICoder.prototype.isSimplifiedStructFormat = function (type) { @@ -156,10 +142,8 @@ ABICoder.prototype.isSimplifiedStructFormat = function (type) { * Maps the correct tuple type and name when the simplified format in encode/decodeParameter is used * * @method mapStructNameAndType - * * @param {String} structName - * - * @returns {{type: string, name: *}} + * @return {{type: string, name: *}} */ ABICoder.prototype.mapStructNameAndType = function (structName) { var type = 'tuple'; @@ -176,10 +160,8 @@ ABICoder.prototype.mapStructNameAndType = function (structName) { * Maps the simplified format in to the expected format of the ABICoder * * @method mapStructToCoderFormat - * * @param {Object} struct - * - * @returns {Array} + * @return {Array} */ ABICoder.prototype.mapStructToCoderFormat = function (struct) { var self = this; @@ -211,11 +193,9 @@ ABICoder.prototype.mapStructToCoderFormat = function (struct) { * Encodes a function call from its json interface and parameters. * * @method encodeFunctionCall - * * @param {Array} jsonInterface * @param {Array} params - * - * @returns {String} The encoded ABI for this function call + * @return {String} The encoded ABI for this function call */ ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface.inputs, params).replace('0x', ''); @@ -225,11 +205,9 @@ ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { * Should be used to decode bytes to plain param * * @method decodeParameter - * * @param {String} type * @param {String} bytes - * - * @returns {Object} plain param + * @return {Object} plain param */ ABICoder.prototype.decodeParameter = function (type, bytes) { return this.decodeParameters([type], bytes)[0]; @@ -239,11 +217,9 @@ ABICoder.prototype.decodeParameter = function (type, bytes) { * Should be used to decode list of params * * @method decodeParameter - * * @param {Array} outputs * @param {String} bytes - * - * @returns {Array} array of plain params + * @return {Array} array of plain params */ ABICoder.prototype.decodeParameters = function (outputs, bytes) { if (!bytes || bytes === '0x' || bytes === '0X') { @@ -274,12 +250,10 @@ ABICoder.prototype.decodeParameters = function (outputs, bytes) { * Decodes events non- and indexed parameters. * * @method decodeLog - * * @param {Object} inputs * @param {String} data * @param {Array} topics - * - * @returns {Array} array of plain params + * @return {Array} array of plain params */ ABICoder.prototype.decodeLog = function (inputs, data, topics) { var _this = this; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index f28f7cbd29e..dfaf98ea45b 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -23,6 +23,8 @@ "use strict"; var _ = require("underscore"); +var core = require('web3-core'); +var Method = require('web3-core-method'); var Promise = require('any-promise'); var Account = require("eth-lib/lib/account"); var Hash = require("eth-lib/lib/hash"); @@ -32,8 +34,10 @@ var Bytes = require("eth-lib/lib/bytes"); var cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); var scryptsy = require('scrypt.js'); var uuid = require('uuid'); +var utils = require('web3-utils'); +var helpers = require('web3-core-helpers'); -var isNot = function (value) { +var isNot = function(value) { return (_.isUndefined(value) || _.isNull(value)); }; @@ -45,65 +49,57 @@ var trimLeadingZero = function (hex) { }; var makeEven = function (hex) { - if (hex.length % 2 === 1) { + if(hex.length % 2 === 1) { hex = hex.replace('0x', '0x0'); } return hex; }; -/** - * @param {MethodPackage} methodPackage - * @param {Wallet} wallet - * @param {Helpers} helpers - * @param {Utils} utils - * - * @constructor - */ -function Accounts(methodPackage, wallet, helpers, utils) { - this.methodPackage = methodPackage; - this.wallet = wallet; - this.helpers = helpers; - this.utils = utils; -} -/** - * Gets the actual gasPrice from the connected node - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * - * @returns {Promise} - */ -Accounts.prototype.getGasPrice = function (callback) { - return this.methodPackage.create(this.connectionModel.provider, 'eth_gasPrice', null, null, null).send(callback); -}; +var Accounts = function Accounts() { + var _this = this; -/** - * Gets the transaction count of an address - * - * @param {String} address - * @param {Function} callback - * - * @callback callback callback(error, result) - * - * @returns {Promise} - */ -Accounts.prototype.getTransactionCount = function (address, callback) { - return this.methodPackage.create( - this.connectionModel.provider, - 'eth_getTransactionCount', - [address, 'latest'], - [ - function (address) { + // 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 + }), + new Method({ + name: 'getTransactionCount', + call: 'eth_getTransactionCount', + params: 2, + inputFormatter: [function (address) { if (utils.isAddress(address)) { return address; + } else { + throw new Error('Address '+ address +' is not a valid address to get the "transactionCount".'); } + }, function () { return 'latest'; }] + }) + ]; + // attach methods to this._ethereumCall + this._ethereumCall = {}; + _.each(_ethereumCall, function (method) { + method.attachToObject(_this._ethereumCall); + method.setRequestManager(_this._requestManager); + }); - throw new Error('Address ' + address + ' is not a valid address to get the "transactionCount".'); - } - ] - ).send(callback); + + this.wallet = new Wallet(this); }; Accounts.prototype._addAccountFunctions = function (account) { @@ -138,8 +134,7 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca error = false, result; - callback = callback || function () { - }; + callback = callback || function () {}; if (!tx) { error = new Error('No transaction object given!'); @@ -148,16 +143,16 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca return Promise.reject(error); } - function signed(tx) { + function signed (tx) { if (!tx.gas && !tx.gasLimit) { error = new Error('"gas" is missing'); } - if (tx.nonce < 0 || - tx.gas < 0 || - tx.gasPrice < 0 || - tx.chainId < 0) { + if (tx.nonce < 0 || + tx.gas < 0 || + tx.gasPrice < 0 || + tx.chainId < 0) { error = new Error('Gas, gasPrice, nonce or chainId is lower than 0'); } @@ -208,7 +203,7 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca rawTransaction: rawTransaction }; - } catch (e) { + } catch(e) { callback(e); return Promise.reject(e); } @@ -230,7 +225,7 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca isNot(tx.nonce) ? _this._ethereumCall.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce ]).then(function (args) { if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) { - throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: ' + JSON.stringify(args)); + throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: '+ JSON.stringify(args)); } return signed(_.extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2]})); }); @@ -239,10 +234,10 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca /* jshint ignore:start */ Accounts.prototype.recoverTransaction = function recoverTransaction(rawTx) { var values = RLP.decode(rawTx); - var signature = Account.encodeSignature(values.slice(6, 9)); + var signature = Account.encodeSignature(values.slice(6,9)); var recovery = Bytes.toNumber(values[6]); var extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), "0x", "0x"]; - var signingData = values.slice(0, 6).concat(extraData); + var signingData = values.slice(0,6).concat(extraData); var signingDataHex = RLP.encode(signingData); return Account.recover(Hash.keccak256(signingDataHex), signature); }; @@ -296,7 +291,7 @@ Accounts.prototype.recover = function recover(message, signature, preFixed) { Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) { /* jshint maxcomplexity: 10 */ - if (!_.isString(password)) { + if(!_.isString(password)) { throw new Error('No password given.'); } @@ -327,13 +322,13 @@ Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) { var ciphertext = new Buffer(json.crypto.ciphertext, 'hex'); - var mac = utils.sha3(Buffer.concat([derivedKey.slice(16, 32), ciphertext])).replace('0x', ''); + var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ])).replace('0x',''); if (mac !== json.crypto.mac) { throw new Error('Key derivation failed - possibly wrong password'); } var decipher = cryp.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), new Buffer(json.crypto.cipherparams.iv, 'hex')); - var seed = '0x' + Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('hex'); + var seed = '0x'+ Buffer.concat([ decipher.update(ciphertext), decipher.final() ]).toString('hex'); return this.privateKeyToAccount(seed); }; @@ -372,14 +367,14 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { throw new Error('Unsupported cipher'); } - var ciphertext = Buffer.concat([cipher.update(new Buffer(account.privateKey.replace('0x', ''), 'hex')), cipher.final()]); + var ciphertext = Buffer.concat([ cipher.update(new Buffer(account.privateKey.replace('0x',''), 'hex')), cipher.final() ]); - var mac = utils.sha3(Buffer.concat([derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex')])).replace('0x', ''); + var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex') ])).replace('0x',''); return { version: 3, - id: uuid.v4({random: options.uuid || cryp.randomBytes(16)}), - address: account.address.toLowerCase().replace('0x', ''), + id: uuid.v4({ random: options.uuid || cryp.randomBytes(16) }), + address: account.address.toLowerCase().replace('0x',''), crypto: { ciphertext: ciphertext.toString('hex'), cipherparams: { @@ -393,4 +388,147 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { }; }; + +// Note: this is trying to follow closely the specs on +// http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html + +function Wallet(accounts) { + this._accounts = accounts; + this.length = 0; + this.defaultKeyName = "web3js_wallet"; +} + +Wallet.prototype._findSafeIndex = function (pointer) { + pointer = pointer || 0; + if (_.has(this, pointer)) { + return this._findSafeIndex(pointer + 1); + } else { + return pointer; + } +}; + +Wallet.prototype._currentIndexes = function () { + var keys = Object.keys(this); + var indexes = keys + .map(function(key) { return parseInt(key); }) + .filter(function(n) { return (n < 9e20); }); + + return indexes; +}; + +Wallet.prototype.create = function (numberOfAccounts, entropy) { + for (var i = 0; i < numberOfAccounts; ++i) { + this.add(this._accounts.create(entropy).privateKey); + } + return this; +}; + +Wallet.prototype.add = function (account) { + + if (_.isString(account)) { + account = this._accounts.privateKeyToAccount(account); + } + if (!this[account.address]) { + account = this._accounts.privateKeyToAccount(account.privateKey); + account.index = this._findSafeIndex(); + + this[account.index] = account; + this[account.address] = account; + this[account.address.toLowerCase()] = account; + + this.length++; + + return account; + } else { + return this[account.address]; + } +}; + +Wallet.prototype.remove = function (addressOrIndex) { + var account = this[addressOrIndex]; + + if (account && account.address) { + // address + this[account.address].privateKey = null; + delete this[account.address]; + // address lowercase + this[account.address.toLowerCase()].privateKey = null; + delete this[account.address.toLowerCase()]; + // index + this[account.index].privateKey = null; + delete this[account.index]; + + this.length--; + + return true; + } else { + return false; + } +}; + +Wallet.prototype.clear = function () { + var _this = this; + var indexes = this._currentIndexes(); + + indexes.forEach(function(index) { + _this.remove(index); + }); + + return this; +}; + +Wallet.prototype.encrypt = function (password, options) { + var _this = this; + var indexes = this._currentIndexes(); + + var accounts = indexes.map(function(index) { + return _this[index].encrypt(password, options); + }); + + return accounts; +}; + + +Wallet.prototype.decrypt = function (encryptedWallet, password) { + var _this = this; + + encryptedWallet.forEach(function (keystore) { + var account = _this._accounts.decrypt(keystore, password); + + if (account) { + _this.add(account); + } else { + throw new Error('Couldn\'t decrypt accounts. Password wrong?'); + } + }); + + return this; +}; + +Wallet.prototype.save = function (password, keyName) { + localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password))); + + return true; +}; + +Wallet.prototype.load = function (password, keyName) { + var keystore = localStorage.getItem(keyName || this.defaultKeyName); + + if (keystore) { + try { + keystore = JSON.parse(keystore); + } catch(e) { + + } + } + + return this.decrypt(keystore || [], password); +}; + +if (typeof localStorage === 'undefined') { + delete Wallet.prototype.save; + delete Wallet.prototype.load; +} + + module.exports = Accounts; diff --git a/packages/web3-eth-accounts/src/Wallet.js b/packages/web3-eth-accounts/src/Wallet.js deleted file mode 100644 index e758754b596..00000000000 --- a/packages/web3-eth-accounts/src/Wallet.js +++ /dev/null @@ -1,261 +0,0 @@ -/* - 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 . - */ -/** - * @file Wallet.js - * @author Fabian Vogelsteller - * @date 2017 - */ - -// Note: this is trying to follow closely the specs on -// http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html - -/** - * @param {Accounts} accounts - * - * @constructor - */ -function Wallet(accounts) { - this._accounts = accounts; - this.length = 0; - this.defaultKeyName = "web3js_wallet"; -} - -/** - * Find the safe index in the given pointer - * - * @method _findSafeIndex - * @private - * - * @param {Number} pointer - * - * @returns {number} - */ -Wallet.prototype._findSafeIndex = function (pointer) { - pointer = pointer || 0; - if (_.has(this, pointer)) { - return this._findSafeIndex(pointer + 1); - } - - return pointer; -}; - -/** - * Gets the current indexes as array - * - * @private - * - * @returns {Number[]} - */ -Wallet.prototype._currentIndexes = function () { - return Object.keys(this).map(function (key) { - return parseInt(key); - }).filter(function (n) { - return (n < 9e20); - }); -}; - -/** - * Creates a new wallet - * - * @method create - * - * @param {Number} numberOfAccounts - * @param {Number} entropy - * - * @returns {Wallet} - */ -Wallet.prototype.create = function (numberOfAccounts, entropy) { - for (var i = 0; i < numberOfAccounts; ++i) { - this.add(this._accounts.create(entropy).privateKey); - } - - return this; -}; - -/** - * Adds a account to the wallets - * - * @method add - * - * @param {Account} account - * - * @returns {Account | Account[]} - */ -Wallet.prototype.add = function (account) { - - if (_.isString(account)) { - account = this._accounts.privateKeyToAccount(account); - } - - if (!this[account.address]) { - account = this._accounts.privateKeyToAccount(account.privateKey); - account.index = this._findSafeIndex(); - - this[account.index] = account; - this[account.address] = account; - this[account.address.toLowerCase()] = account; - - this.length++; - - return account; - } - - return this[account.address]; -}; - -/** - * Removes an account from the wallet array - * - * @method remove - * - * @param {Number} addressOrIndex - * - * @returns {boolean} - */ -Wallet.prototype.remove = function (addressOrIndex) { - var account = this[addressOrIndex]; - - if (account && account.address) { - // address - this[account.address].privateKey = null; - delete this[account.address]; - // address lowercase - this[account.address.toLowerCase()].privateKey = null; - delete this[account.address.toLowerCase()]; - // index - this[account.index].privateKey = null; - delete this[account.index]; - - this.length--; - - return true; - } - - return false; -}; - -/** - * Removes all addresses from the wallet - * - * @method clear - * - * @returns {Wallet} - */ -Wallet.prototype.clear = function () { - var _this = this; - var indexes = this._currentIndexes(); - - indexes.forEach(function (index) { - _this.remove(index); - }); - - return this; -}; - -/** - * Encodes the wallet - * - * @method encrypt - * - * @param {String} password - * @param {Object} options - * - * @returns {Account[]} - */ -Wallet.prototype.encrypt = function (password, options) { - var self = this; - - return this._currentIndexes().map(function (index) { - return self[index].encrypt(password, options); - }); -}; - -/** - * Decodes the wallet - * - * @method decrypt - * - * @param {Array} encryptedWallet - * @param {String} password - * - * @returns {Wallet} - */ -Wallet.prototype.decrypt = function (encryptedWallet, password) { - var _this = this; - - encryptedWallet.forEach(function (keystore) { - var account = _this._accounts.decrypt(keystore, password); - - if (account) { - _this.add(account); - } else { - throw new Error('Couldn\'t decrypt accounts. Password wrong?'); - } - }); - - return this; -}; - -/** - * Saves the wallet in the localStorage - * - * @method save - * - * @param {String} password - * @param {String} keyName - * - * @returns {boolean} - */ -Wallet.prototype.save = function (password, keyName) { - if (typeof localStorage !== 'undefined') { - localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password))); - - return true; - } - - throw new Error('Can\'t save wallet in localStorage. It is not supported in this environment.'); -}; - -/** - * Load the stored wallet from localStorage - * - * @method load - * - * @param {String} password - * @param {String} keyName - * - * @returns {Wallet} - */ -Wallet.prototype.load = function (password, keyName) { - if (typeof localStorage !== 'undefined') { - var keystore = localStorage.getItem(keyName || this.defaultKeyName); - - if (keystore) { - try { - keystore = JSON.parse(keystore); - - return this.decrypt(keystore, password); - } catch (e) { - throw new Error('Invalid keystore in localStorage found!'); - } - } - - return this; - } - - throw new Error('Can\'t load wallet from localStorage. It is not supported in this environment'); -}; From f5fdf71518fa5db92f10c85af93f265d4029b382 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 6 Sep 2018 17:15:16 +0200 Subject: [PATCH 0079/1045] new method handling implemented in accounts package --- packages/web3-eth-accounts/src/Accounts.js | 257 +++++++++++++++++---- 1 file changed, 212 insertions(+), 45 deletions(-) diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index dfaf98ea45b..7bb0499d626 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -56,52 +56,55 @@ var makeEven = function (hex) { }; -var Accounts = function Accounts() { - var _this = this; +/** + * @param {MethodPackage} methodPackage + * @param {ConnectionModel} connectionModel + * + * @constructor + */ +var Accounts = function Accounts(methodPackage, connectionModel) { + this.methodPackage = methodPackage; + this.connectionModel = connectionModel; + this.wallet = new Wallet(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 - }), - new Method({ - name: 'getTransactionCount', - call: 'eth_getTransactionCount', - params: 2, - inputFormatter: [function (address) { - if (utils.isAddress(address)) { - return address; - } else { - throw new Error('Address '+ address +' is not a valid address to get the "transactionCount".'); - } - }, function () { return 'latest'; }] - }) - ]; - // attach methods to this._ethereumCall - this._ethereumCall = {}; - _.each(_ethereumCall, function (method) { - method.attachToObject(_this._ethereumCall); - method.setRequestManager(_this._requestManager); - }); +/** + * Gets the gasPrice of the connected node + * + * @method getGasPrice + * + * @returns {Promise} + */ +Accounts.prototype.getGasPrice = function () { + return this.methodPackage.create(this.connectionModel.provider, 'eth_gasPrice').send(); +}; +/** + * Gets the transaction count of an address + * + * @method getTransactionCount + * + * @param {String} address + * + * @returns {Promise} + */ +Accounts.prototype.getTransactionCount = function (address) { + if (this.utils.isAddress(address)) { + throw new Error('Address '+ address +' is not a valid address to get the "transactionCount".'); + } - this.wallet = new Wallet(this); + return this.methodPackage.create(this.connectionModel.provider, 'eth_getTransactionCount', [address, 'latest'], ).send(); }; +/** + * Adds the account functions to the given object + * + * @method _addAccountFunctions + * + * @param {Object} account + * + * @returns {Object} + */ Accounts.prototype._addAccountFunctions = function (account) { var _this = this; @@ -121,14 +124,42 @@ Accounts.prototype._addAccountFunctions = function (account) { return account; }; +/** + * Creates an account with a given entropy + * + * @method create + * + * @param {String} entropy + * + * @returns {Object} + */ Accounts.prototype.create = function create(entropy) { return this._addAccountFunctions(Account.create(entropy || utils.randomHex(32))); }; +/** + * Creates an Account object from a privateKey + * + * @method privateKeyToAccount + * + * @param {String} privateKey + * + * @returns {Object} + */ Accounts.prototype.privateKeyToAccount = function privateKeyToAccount(privateKey) { return this._addAccountFunctions(Account.fromPrivate(privateKey)); }; +/** + * Signs a transaction object with the given privateKey + * + * @param {Object} tx + * @param {String} privateKey + * @param {Function} callback + * + * @returns {Promise} + * @callback callback callback(error, result) + */ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, callback) { var _this = this, error = false, @@ -220,9 +251,9 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca // Otherwise, get the missing info from the Ethereum Node return Promise.all([ - isNot(tx.chainId) ? _this._ethereumCall.getId() : tx.chainId, - isNot(tx.gasPrice) ? _this._ethereumCall.getGasPrice() : tx.gasPrice, - isNot(tx.nonce) ? _this._ethereumCall.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce + isNot(tx.chainId) ? _this.connectionModel.getId() : tx.chainId, + isNot(tx.gasPrice) ? _this.getGasPrice() : tx.gasPrice, + isNot(tx.nonce) ? _this.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce ]).then(function (args) { if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) { throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: '+ JSON.stringify(args)); @@ -243,6 +274,15 @@ Accounts.prototype.recoverTransaction = function recoverTransaction(rawTx) { }; /* jshint ignore:end */ +/** + * Hashes a given message + * + * @method hashMessage + * + * @param {String} data + * + * @returns {String} + */ Accounts.prototype.hashMessage = function hashMessage(data) { var message = utils.isHexStrict(data) ? utils.hexToBytes(data) : data; var messageBuffer = Buffer.from(message); @@ -252,6 +292,16 @@ Accounts.prototype.hashMessage = function hashMessage(data) { return Hash.keccak256s(ethMessage); }; +/** + * Signs a string with the given privateKey + * + * @method sign + * + * @param {String} data + * @param {String} privateKey + * + * @returns {Object} + */ Accounts.prototype.sign = function sign(data, privateKey) { var hash = this.hashMessage(data); var signature = Account.sign(hash, privateKey); @@ -266,6 +316,15 @@ Accounts.prototype.sign = function sign(data, privateKey) { }; }; +/** + * Recovers + * + * @param {String} message + * @param {String} signature + * @param preFixed + * + * @returns {*} + */ Accounts.prototype.recover = function recover(message, signature, preFixed) { var args = [].slice.apply(arguments); @@ -333,6 +392,17 @@ Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) { return this.privateKeyToAccount(seed); }; +/** + * Encrypts the account + * + * @method encrypt + * + * @param {String} privateKey + * @param {String} password + * @param {Object} options + * + * @returns {Object} + */ Accounts.prototype.encrypt = function (privateKey, password, options) { /* jshint maxcomplexity: 20 */ var account = this.privateKeyToAccount(privateKey); @@ -392,12 +462,27 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { // Note: this is trying to follow closely the specs on // http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html +/** + * @param {Object} accounts + * + * @constructor + */ function Wallet(accounts) { this._accounts = accounts; this.length = 0; this.defaultKeyName = "web3js_wallet"; } +/** + * Finds the safe index + * + * @method _findSafeIndex + * @private + * + * @param {Number} pointer + * + * @returns {*} + */ Wallet.prototype._findSafeIndex = function (pointer) { pointer = pointer || 0; if (_.has(this, pointer)) { @@ -407,6 +492,14 @@ Wallet.prototype._findSafeIndex = function (pointer) { } }; +/** + * Gets the correntIndexes array + * + * @method _currentIndexes + * @private + * + * @returns {Number[]} + */ Wallet.prototype._currentIndexes = function () { var keys = Object.keys(this); var indexes = keys @@ -416,6 +509,16 @@ Wallet.prototype._currentIndexes = function () { return indexes; }; +/** + * Creates new accounts with a given entropy + * + * @method create + * + * @param {Number} numberOfAccounts + * @param {String} entropy + * + * @returns {Wallet} + */ Wallet.prototype.create = function (numberOfAccounts, entropy) { for (var i = 0; i < numberOfAccounts; ++i) { this.add(this._accounts.create(entropy).privateKey); @@ -423,6 +526,15 @@ Wallet.prototype.create = function (numberOfAccounts, entropy) { return this; }; +/** + * Adds a account to the wallet + * + * @method add + * + * @param {Object} account + * + * @returns {Object} + */ Wallet.prototype.add = function (account) { if (_.isString(account)) { @@ -444,6 +556,15 @@ Wallet.prototype.add = function (account) { } }; +/** + * Removes a account from the number by his address or index + * + * @method remove + * + * @param {String|Number} addressOrIndex + * + * @returns {boolean} + */ Wallet.prototype.remove = function (addressOrIndex) { var account = this[addressOrIndex]; @@ -466,6 +587,13 @@ Wallet.prototype.remove = function (addressOrIndex) { } }; +/** + * Clears the wallet + * + * @method clear + * + * @returns {Wallet} + */ Wallet.prototype.clear = function () { var _this = this; var indexes = this._currentIndexes(); @@ -477,6 +605,16 @@ Wallet.prototype.clear = function () { return this; }; +/** + * Encrypts all accounts + * + * @method encrypt + * + * @param {String} password + * @param {Object} options + * + * @returns {any[]} + */ Wallet.prototype.encrypt = function (password, options) { var _this = this; var indexes = this._currentIndexes(); @@ -488,7 +626,16 @@ Wallet.prototype.encrypt = function (password, options) { return accounts; }; - +/** + * Decrypts all accounts + * + * @method decrypt + * + * @param {Wallet} encryptedWallet + * @param {String} password + * + * @returns {Wallet} + */ Wallet.prototype.decrypt = function (encryptedWallet, password) { var _this = this; @@ -505,12 +652,32 @@ Wallet.prototype.decrypt = function (encryptedWallet, password) { return this; }; +/** + * Saves the current wallet in the localStorage of the browser + * + * @method save + * + * @param {String} password + * @param {String} keyName + * + * @returns {boolean} + */ Wallet.prototype.save = function (password, keyName) { localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password))); return true; }; +/** + * Loads the stored wallet by his keyName from the localStorage of the browser + * + * @method load + * + * @param {String} password + * @param {String} keyName + * + * @returns {Wallet} + */ Wallet.prototype.load = function (password, keyName) { var keystore = localStorage.getItem(keyName || this.defaultKeyName); From 68a2823af3034008f55c042015a28f4fa4ec0da4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 6 Sep 2018 17:36:23 +0200 Subject: [PATCH 0080/1045] Accounts dependency handling updated --- packages/web3-eth-accounts/src/Accounts.js | 22 +++++++++++----------- packages/web3-eth-accounts/src/index.js | 9 +++++++-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 7bb0499d626..0f8762fbfb9 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -23,8 +23,6 @@ "use strict"; var _ = require("underscore"); -var core = require('web3-core'); -var Method = require('web3-core-method'); var Promise = require('any-promise'); var Account = require("eth-lib/lib/account"); var Hash = require("eth-lib/lib/hash"); @@ -34,8 +32,6 @@ var Bytes = require("eth-lib/lib/bytes"); var cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); var scryptsy = require('scrypt.js'); var uuid = require('uuid'); -var utils = require('web3-utils'); -var helpers = require('web3-core-helpers'); var isNot = function(value) { return (_.isUndefined(value) || _.isNull(value)); @@ -57,14 +53,18 @@ var makeEven = function (hex) { /** - * @param {MethodPackage} methodPackage * @param {ConnectionModel} connectionModel + * @param {MethodPackage} methodPackage + * @param {Utils} utils + * @param {Object} formatters * * @constructor */ -var Accounts = function Accounts(methodPackage, connectionModel) { +var Accounts = function Accounts(connectionModel, methodPackage, utils, formatters) { this.methodPackage = methodPackage; this.connectionModel = connectionModel; + this.utils = utils; + this.formatters = formatters; this.wallet = new Wallet(this); }; @@ -134,7 +134,7 @@ Accounts.prototype._addAccountFunctions = function (account) { * @returns {Object} */ Accounts.prototype.create = function create(entropy) { - return this._addAccountFunctions(Account.create(entropy || utils.randomHex(32))); + return this._addAccountFunctions(Account.create(entropy || this.utils.randomHex(32))); }; /** @@ -193,13 +193,13 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca } try { - tx = helpers.formatters.inputCallFormatter(tx); + tx = _this.formatters.inputCallFormatter(tx); var transaction = tx; transaction.to = tx.to || '0x'; transaction.data = tx.data || '0x'; transaction.value = tx.value || '0x'; - transaction.chainId = utils.numberToHex(tx.chainId); + transaction.chainId = _this.utils.numberToHex(tx.chainId); var rlpEncoded = RLP.encode([ Bytes.fromNat(transaction.nonce), @@ -284,7 +284,7 @@ Accounts.prototype.recoverTransaction = function recoverTransaction(rawTx) { * @returns {String} */ Accounts.prototype.hashMessage = function hashMessage(data) { - var message = utils.isHexStrict(data) ? utils.hexToBytes(data) : data; + var message = this.utils.isHexStrict(data) ? this.utils.hexToBytes(data) : data; var messageBuffer = Buffer.from(message); var preamble = "\x19Ethereum Signed Message:\n" + message.length; var preambleBuffer = Buffer.from(preamble); @@ -439,7 +439,7 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { var ciphertext = Buffer.concat([ cipher.update(new Buffer(account.privateKey.replace('0x',''), 'hex')), cipher.final() ]); - var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex') ])).replace('0x',''); + var mac = this.utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex') ])).replace('0x',''); return { version: 3, diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 987bc964d17..ad3e2d06f3f 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -24,6 +24,9 @@ var version = require('./package.json').version; var Accounts = require('./Accounts'); +var MethodPackage = require('web3-core-method'); +var Utils = require('web3-utils'); +var formatters = require('web3-helpers').formatters; module.exports = { version: version, @@ -33,9 +36,11 @@ module.exports = { * * @method create * + * @params {ConnectionModel} connectionModel + * * @returns {Accounts} */ - create: function() { // TODO: Refactor the accounts object because of the new method and connection handling. - return new Accounts(); + create: function(connectionModel) { + return new Accounts(connectionModel, MethodPackage, Utils, formatters); } }; From 657a840d89a1f8a6f567ea415af9dda4b376d578 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 7 Sep 2018 21:32:25 +0200 Subject: [PATCH 0081/1045] Personal package refactored --- packages/web3-eth-accounts/src/Accounts.js | 1 + packages/web3-eth-personal/src/Personal.js | 332 +++++++++++++-------- packages/web3-eth-personal/src/index.js | 7 +- 3 files changed, 220 insertions(+), 120 deletions(-) diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 0f8762fbfb9..1bd43f0e830 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -306,6 +306,7 @@ Accounts.prototype.sign = function sign(data, privateKey) { var hash = this.hashMessage(data); var signature = Account.sign(hash, privateKey); var vrs = Account.decodeSignature(signature); + return { message: data, messageHash: hash, diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 54f12ab35ef..6880024970c 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -22,128 +22,224 @@ "use strict"; -var core = require('web3-core'); -var Method = require('web3-core-method'); -var utils = require('web3-utils'); -var Net = require('web3-net'); - -var formatters = require('web3-core-helpers').formatters; - - -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 - methods.forEach(function(method) { - method.defaultAccount = defaultAccount; - }); - - return val; - }, - enumerable: true - }); - Object.defineProperty(this, 'defaultBlock', { - get: function () { - return defaultBlock; - }, - set: function (val) { - defaultBlock = val; - - // update defaultBlock - methods.forEach(function(method) { - method.defaultBlock = defaultBlock; - }); - - return val; - }, - enumerable: true - }); - - - var methods = [ - new Method({ - name: 'getAccounts', - call: 'personal_listAccounts', - params: 0, - outputFormatter: utils.toChecksumAddress - }), - new Method({ - name: 'newAccount', - call: 'personal_newAccount', - params: 1, - inputFormatter: [null], - outputFormatter: utils.toChecksumAddress - }), - new Method({ - name: 'unlockAccount', - call: 'personal_unlockAccount', - params: 3, - inputFormatter: [formatters.inputAddressFormatter, null, null] - }), - new Method({ - name: 'lockAccount', - call: 'personal_lockAccount', - params: 1, - inputFormatter: [formatters.inputAddressFormatter] - }), - new Method({ - name: 'importRawKey', - call: 'personal_importRawKey', - params: 2 - }), - new Method({ - name: 'sendTransaction', - call: 'personal_sendTransaction', - params: 2, - inputFormatter: [formatters.inputTransactionFormatter, null] - }), - new Method({ - name: 'signTransaction', - call: 'personal_signTransaction', - params: 2, - inputFormatter: [formatters.inputTransactionFormatter, null] - }), - new Method({ - name: 'sign', - call: 'personal_sign', - params: 3, - inputFormatter: [formatters.inputSignFormatter, formatters.inputAddressFormatter, null] - }), - new Method({ - name: 'ecRecover', - call: 'personal_ecRecover', - params: 2, - inputFormatter: [formatters.inputSignFormatter, null] - }) - ]; - methods.forEach(function(method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - method.defaultBlock = _this.defaultBlock; - method.defaultAccount = _this.defaultAccount; - }); +/** + * TODO: Add missing documenation for getAccounts, lockAccount, importRawKey and sendTransaction! + * + * @param {ConnectionModel} connectionModel + * @param {MethodPackage} methodPackage + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +var Personal = function Personal(connectionModel, methodPackage, utils, formatters) { + this.connectionModel = connectionModel; + this.methodPackage = methodPackage; + this.utils = utils; + this.formatters = formatters; + this.net = this.connectionModel.getNetworkMethodsAsObject(); +}; + +/** + * Gets a list of accounts + * + * @method getAccounts + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * + * @returns {Promise} + */ +Personal.prototype.getAccounts = function (callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'personal_listAccounts', + null, + null, + this.utils.toChecksumAddress + ).send(callback); +}; + +/** + * Creates an new account + * + * @method newAccount + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Personal.prototype.newAccount = function (callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'personal_newAccount', + null, + null, + this.utils.toChecksumAddress + ).send(callback); }; -core.addProviders(Personal); +/** + * Unlocks an account + * TODO: Fix typo in documentation + * + * @method unlockAccount + * + * @param {String} address + * @param {String} password + * @param {Number} unlockDuration + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Personal.prototype.unlockAccount = function (address, password, unlockDuration, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'personal_unlockAccount', + [address, password, unlockDuration], + [ + this.formmaters.inputAddressFormatter, + null, + null + ], + null + ).send(callback); +}; +/** + * Locks a account by the given address + * + * @method lockAccount + * + * @param {String} address + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Personal.prototype.lockAccount = function (address, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'personal_lockAccount', + [address], + [this.formmaters.inputAddressFormatter], + null + ).send(callback); +}; +/** + * Imports the unencrypted key in to the keystore and encrypt it with the given passphrase + * + * @method importRawKey + * + * @param {String} keydata + * @param {String} passphrase + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Personal.prototype.importRawKey = function (keydata, passphrase, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'personal_importRawKey', + [keydata, passphrase], + null, + null + ).send(callback); +}; + +/** + * Sends the transaction + * + * @method sendTransaction + * + * @param {Object} transactionObject + * @param {String} passphrase + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Personal.prototype.sendTransaction = function (transactionObject, passphrase, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'personal_sendTransaction', + [transactionObject, passphrase], + [this.formatters.inputTransactionFormatter, null], + null + ).send(callback); +}; + +/** + * Signs the given transaction + * + * @method signTransaction + * + * @param {Object} transactionObject + * @param {String} passphrase + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Personal.prototype.signTransaction = function (transactionObject, passphrase, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'personal_signTransaction', + [transactionObject, passphrase], + [this.formatters.inputTransactionFormatter, null], + null + ).send(callback); +}; + +/** + * Signs a given string + * + * @method sign + * + * @param {String} data + * @param {String} address + * @param {String} password + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Personal.prototype.sign = function (data, address, password, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'personal_sign', + [data, address, password], + [this.formatters.inputSignFormatter, this.formatters.inputAddressFormatter, null], + null + ).send(callback); +}; + +/** + * Recovers a signed string + * + * @method ecRecover + * + * @param {String} data + * @param {String} signature + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Personal.prototype.ecRecover = function (data, signature, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'personal_ecRecover', + [data, address, password], + [this.formatters.inputSignFormatter, this.formatters.inputAddressFormatter, null], + null + ).send(callback); +}; module.exports = Personal; diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 7c4bba81cf1..fc34a4becaa 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -24,6 +24,9 @@ var version = require('./package.json').version; var Personal = require('./Personal'); +var MethodPackage = require('web3-core-method'); +var Utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; module.exports = { version: version, @@ -35,8 +38,8 @@ module.exports = { * * @returns {Personal} */ - create: function () { //TODO: Refactor the personal object because of the new method and connection handling. - return new Personal(); + create: function (connectionModel) { + return new Personal(connectionModel, MethodPackage, Utils, formatters); } }; From f1092ff30675bbdb1340db593611abc29593177d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 13 Sep 2018 12:39:55 +0200 Subject: [PATCH 0082/1045] Shh refactored, subscription handling extend for handling of shh subscriptions --- .../src/adapters/SocketProviderAdapter.js | 39 +- .../src/Subscription.js | 38 +- packages/web3-core-subscription/src/index.js | 12 +- packages/web3-shh/src/Shh.js | 598 +++++++++++++----- 4 files changed, 495 insertions(+), 192 deletions(-) diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index f531d05a215..d418bb81ee2 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -40,17 +40,18 @@ function SocketProviderAdapter(provider) { * * @method subscribe * - * @param {String} subscriptionType + * @param {String} subscriptionMethod * @param {Array} parameters + * @param {String} subscriptionType * * @returns {Promise} */ -SocketProviderAdapter.prototype.subscribe = function (subscriptionType, parameters) { +SocketProviderAdapter.prototype.subscribe = function (subscriptionType, subscriptionMethod, parameters) { var self = this; - return this.send('eth_subscribe', parameters.unshift(subscriptionType)).then(function (error, subscriptionId) { + return this.send(subscriptionType + '_subscribe', parameters.unshift(subscriptionMethod)).then(function (error, subscriptionId) { if (!error) { - self.subscriptions[subscriptionId]({subscriptionType: subscriptionType, type: 'eth'}); + self.subscriptions.push(subscriptionId); return subscriptionId; } @@ -65,11 +66,12 @@ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, paramete * @method unsubscribe * * @param {String} subscriptionId + * @param {String} subscriptionType * * @returns {Promise} */ -SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId) { - return this.send('eth_unsubscribe', [subscriptionId]).then(function (result) { +SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId, subscriptionType) { + return this.send(subscriptionType + '_unsubscribe', [subscriptionId]).then(function (result) { if (result) { this.subscriptions = this.subscriptions.filter(function (subscription) { return subscription !== subscriptionId; @@ -94,12 +96,25 @@ SocketProviderAdapter.prototype.registerSubscriptionListener = function () { response = response || deprecatedResponse; // check for result.method, to prevent old providers errors to pass as result - if (response.method && self.subscriptions[response.params.subscription]) { + if (response.method && self.hasSubscription(response.params.subscription)) { self.emit(response.params.subscription, response.params.result); } }); }; +/** + * Checks if the given subscription id exists + * + * @method hasSubscription + * + * @param {String} subscriptionId + * + * @returns {Boolean} + */ +SocketProviderAdapter.prototype.hasSubscription = function (subscriptionId) { + return this.subscriptions.indexOf(subscriptionId) > -1; +}; + /** * Clears all subscriptions and listeners * @@ -109,7 +124,7 @@ SocketProviderAdapter.prototype.clearSubscriptions = function () { var self = this; var unsubscribePromises = []; - Object.keys(this.subscriptions).forEach(function (subscriptionId) { + this.subscriptions.forEach(function (subscriptionId) { unsubscribePromises.push(self.unsubscribe(subscriptionId)); }); @@ -126,13 +141,13 @@ SocketProviderAdapter.prototype.clearSubscriptions = function () { * * @param {String} subscriptionId * - * @returns {Promise} + * @returns {Promise} */ SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId) { var self = this; - return this.subscriptions[subscriptionId].unsubscribe().then(function(result) { + return this.unsubscribe(subscriptionId).then(function (result) { if (result) { - delete self.subscriptions[subscriptionId]; + delete self.subscriptions[this.subscriptions.indexOf(subscriptionId)]; return true; } @@ -146,7 +161,7 @@ SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId) { * * @method isConnected * - * @returns {boolean} + * @returns {Boolean} */ SocketProviderAdapter.prototype.isConnected = function () { return this.provider.connected; diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 285a47ae55c..737f77ea379 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -27,20 +27,22 @@ var EventEmitter = require('eventemitter3'); /** * @param {Object} provider - * @param {String} type + * @param {String} method * @param {Array} parameters * @param {Array} inputFormatters * @param {Function} outputFormatter + * @param {String} subscriptionType * * @constructor */ -function Subscription(provider, type, parameters, inputFormatters, outputFormatter) { +function Subscription(provider, method, parameters, inputFormatters, outputFormatter, subscriptionType) { this.provider = provider; - this.type = type; + this.method = method; this.parameters = parameters; this.inputFormatters = inputFormatters; this.outputFormatter = outputFormatter; this.subscriptionId = null; + this.subscriptionType = subscriptionType || 'eth'; } /** @@ -55,8 +57,13 @@ function Subscription(provider, type, parameters, inputFormatters, outputFormatt */ Subscription.prototype.subscribe = function (callback) { var self = this; - this.provider.subscribe(this.type, this.formatInput(this.parameters)).then(function (subscriptionId) { + + this.provider.subscribe( + this.subscriptionType, + this.method, this.getFormattedInput() + ).then(function (subscriptionId) { self.subscriptionId = subscriptionId; + self.provider.on(self.subscriptionId, function (error, response) { if (!error) { self.handleSubscriptionResponse(response, callback); @@ -65,7 +72,7 @@ Subscription.prototype.subscribe = function (callback) { } if (self.provider.once) { - self.reconnect(type, parameters, subscriptionId, callback); + self.reconnect(callback); } if (_.isFunction(callback)) { @@ -107,14 +114,11 @@ Subscription.prototype.handleSubscriptionResponse = function (response, callback * * @method reconnect * - * @param {String} type - * @param {Array} parameters - * @param {String} subscriptionId * @param {Function} callback * * @callback callback callback(error, result) */ -Subscription.prototype.reconnect = function (type, parameters, subscriptionId, callback) { +Subscription.prototype.reconnect = function (callback) { var self = this; var interval = setInterval(function () { @@ -127,7 +131,7 @@ Subscription.prototype.reconnect = function (type, parameters, subscriptionId, c clearInterval(interval); self.unsubscribe(function (error, result) { if (result) { - self.subscribe(type, parameters, callback); + self.subscribe(callback); } if (_.isFunction(callback)) { @@ -160,18 +164,18 @@ Subscription.prototype.formatOutput = function (output) { * * @method formatInput * - * @param {Array} parameters - * - * @returns {any} + * @returns {any[]} */ -Subscription.prototype.formatInput = function (parameters) { +Subscription.prototype.getFormattedInput = function () { + var self = this; + if (_.isArray(this.inputFormatters)) { return this.inputFormatters.map(function (formatter, index) { if (_.isFunction(formatter)) { - return formatter(parameters[index]); + return formatter(self.parameters[index]); } - return parameters[index]; + return self.parameters[index]; }); } @@ -190,7 +194,7 @@ Subscription.prototype.formatInput = function (parameters) { */ Subscription.prototype.unsubscribe = function (callback) { var self = this; - return this.provider.unsubscribe(this.subscriptionId).then(function (response) { + return this.provider.unsubscribe(this.subscriptionId, this.subscriptionType).then(function (response) { if (!response) { self.subscriptionId = null; callback(true, false); diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js index 91f0b2fc9ec..93bcd3ce5cf 100644 --- a/packages/web3-core-subscription/src/index.js +++ b/packages/web3-core-subscription/src/index.js @@ -38,10 +38,16 @@ module.exports = { * @param {Array} parameters * @param {Function} inputFormatters * @param {Function} outputFormatter + * @param {String} subscriptionType * * @returns {Subscription} */ - create: function (provider, type, parameters, inputFormatters, outputFormatter) { - return new Subscription(provider, type, parameters, inputFormatters, outputFormatter) - } + create: function (provider, type, parameters, inputFormatters, outputFormatter, subscriptionType) { + return new Subscription(provider, type, parameters, inputFormatters, outputFormatter, subscriptionType) + }, + + /** + * Used for extending the ShhSubscription + */ + Subscription: Subscription }; diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index df49b42a441..6b6b7266150 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -15,171 +15,449 @@ along with web3.js. If not, see . */ /** - * @file index.js + * @file Shh.js * @author Fabian Vogelsteller * @date 2017 */ "use strict"; -var core = require('web3-core'); -var Subscriptions = require('web3-core-subscriptions').subscriptions; -var Method = require('web3-core-method'); -// var formatters = require('web3-core-helpers').formatters; -var Net = require('web3-net'); - - -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.clearSubscriptions = _this._requestManager.clearSubscriptions; - - this.net = new Net(this.currentProvider); - - - [ - new Subscriptions({ - name: 'subscribe', - type: 'shh', - subscriptions: { - 'messages': { - params: 1 - // inputFormatter: [formatters.inputPostFormatter], - // outputFormatter: formatters.outputPostFormatter - } - } - }), - - new Method({ - name: 'getVersion', - call: 'shh_version', - params: 0 - }), - new Method({ - name: 'getInfo', - call: 'shh_info', - params: 0 - }), - new Method({ - name: 'setMaxMessageSize', - call: 'shh_setMaxMessageSize', - params: 1 - }), - new Method({ - name: 'setMinPoW', - call: 'shh_setMinPoW', - params: 1 - }), - new Method({ - name: 'markTrustedPeer', - call: 'shh_markTrustedPeer', - params: 1 - }), - new Method({ - name: 'newKeyPair', - call: 'shh_newKeyPair', - params: 0 - }), - new Method({ - name: 'addPrivateKey', - call: 'shh_addPrivateKey', - params: 1 - }), - new Method({ - name: 'deleteKeyPair', - call: 'shh_deleteKeyPair', - params: 1 - }), - new Method({ - name: 'hasKeyPair', - call: 'shh_hasKeyPair', - params: 1 - }), - new Method({ - name: 'getPublicKey', - call: 'shh_getPublicKey', - params: 1 - }), - new Method({ - name: 'getPrivateKey', - call: 'shh_getPrivateKey', - params: 1 - }), - new Method({ - name: 'newSymKey', - call: 'shh_newSymKey', - params: 0 - }), - new Method({ - name: 'addSymKey', - call: 'shh_addSymKey', - params: 1 - }), - new Method({ - name: 'generateSymKeyFromPassword', - call: 'shh_generateSymKeyFromPassword', - params: 1 - }), - new Method({ - name: 'hasSymKey', - call: 'shh_hasSymKey', - params: 1 - }), - new Method({ - name: 'getSymKey', - call: 'shh_getSymKey', - params: 1 - }), - new Method({ - name: 'deleteSymKey', - call: 'shh_deleteSymKey', - params: 1 - }), - - new Method({ - name: 'newMessageFilter', - call: 'shh_newMessageFilter', - params: 1 - }), - new Method({ - name: 'getFilterMessages', - call: 'shh_getFilterMessages', - params: 1 - }), - new Method({ - name: 'deleteMessageFilter', - call: 'shh_deleteMessageFilter', - params: 1 - }), - - new Method({ - name: 'post', - call: 'shh_post', - params: 1, - inputFormatter: [null] - }), - - new Method({ - name: 'unsubscribe', - call: 'shh_unsubscribe', - params: 1 - }) - ].forEach(function(method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - }); -}; - -core.addProviders(Shh); +/** + * @param {ConnectionModel} connectionModel + * @param {MethodPackage} methodPackage + * @param {SubscriptionPackage} subscriptionPackage + * + * @constructor + */ +function Shh(connectionModel, methodPackage, subscriptionPackage) { + this.connectionModel = connectionModel; + this.methodPackage = methodPackage; + this.subscriptionPackage = subscriptionPackage; + this.clearSubscriptions = this.connectionModel.provider.clearSubscriptions; + this.net = this.connectionModel.getNetworkMethodsAsObject(); +} + +/** + * Subscribe to whisper streams + * + * @method subscribe + * + * @param {string} method + * @param {Object} options + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {eventifiedPromise} + */ +Shh.prototype.subscribe = function (method, options, callback) { + return this.subscriptionPackage.create( + this.connectionModel.provider, + method, + [options], + null, + null, + 'shh' + ).subscribe(callback); +}; + +/** + * Gets the current version of whisper from the connected node + * + * @method getVersion + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.getVersion = function (callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_version', + null, + null, + null + ).send(callback); +}; + +/** + * Gets information about the current whisper node. + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.getInfo = function (callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_info', + null, + null, + null + ).send(callback); +}; + +/** + * Sets the maximal message size allowed by this node. + * + * @param {Number} size + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.setMaxMessageSize = function (size, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_setMaxMessageSize', + size, + null, + null + ).send(callback); +}; + +/** + * Sets the minimal PoW required by this node. + * + * @param {Number} pow + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.setMinPoW = function (pow, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_setMinPoW', + pow, + null, + null + ).send(callback); +}; + +/** + * Marks specific peer trusted, which will allow it to send historic (expired) messages. + * + * @param {String} enode + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.markTrustedPeer = function (enode, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_markTrustedPeer', + pow, + null, + null + ).send(callback); +}; + +/** + * Generates a new public and private key pair for message decryption and encryption. + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.newKeyPair = function (callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_newKeyPair', + null, + null, + null + ).send(callback); +}; + +/** + * Generates a new public and private key pair for message decryption and encryption. + * + * @param {String} privateKey + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.addPrivateKey = function (privateKey, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_addPrivateKey', + privateKey, + null, + null + ).send(callback); +}; + +/** + * Deletes the specifies key if it exists. + * + * @param {String} id + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.deleteKeyPair = function (id, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_deleteKeyPair', + id, + null, + null + ).send(callback); +}; + +/** + * Checks if the whisper node has a private key of a key pair matching the given ID. + * + * @param {String} id + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.hasKeyPair = function (id, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_hasKeyPair', + id, + null, + null + ).send(callback); +}; + +/** + * Returns the public key for a key pair ID. + * + * @param {String} id + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.getPublicKey = function (id, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'id', + id, + null, + null + ).send(callback); +}; + +/** + * Returns the private key for a key pair ID. + * + * @param {String} id + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.getPrivateKey = function (id, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_getPrivateKey', + id, + null, + null + ).send(callback); +}; + +/** + * Generates a random symmetric key and stores it under an ID + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.newSymKey = function (callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_newSymKey', + null, + null, + null + ).send(callback); +}; + +/** + * Generates a random symmetric key and stores it under an ID + * + * @param {String} symKey + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.addSymKey = function (symKey, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_addSymKey', + symKey, + null, + null + ).send(callback); +}; + +/** + * Generates the key from password, stores it, and returns its ID. + * + * @param {String} password + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.generateSymKeyFromPassword = function (password, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_generateSymKeyFromPassword', + password, + null, + null + ).send(callback); +}; + +/** + * Generates the key from password, stores it, and returns its ID. + * + * @param {String} id + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.hasSymKey = function (id, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_hasSymKey', + id, + null, + null + ).send(callback); +}; + +/** + * Returns the symmetric key associated with the given ID. + * + * @param {String} id + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.getSymKey = function (id, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_getSymKey', + id, + null, + null + ).send(callback); +}; + +/** + * Deletes the symmetric key associated with the given ID. + * + * @param {String} id + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.deleteSymKey = function (id, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_deleteSymKey', + id, + null, + null + ).send(callback); +}; + +/** + * Create a new filter within the node. + * + * @param {Object} options + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.newMessageFilter = function (options, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_newMessageFilter', + options, + null, + null + ).send(callback); +}; + +/** + * Deletes a message filter in the node. + * + * @param {String} id + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.deleteMessageFilter = function (id, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_deleteMessageFilter', + id, + null, + null + ).send(callback); +}; + +/** + * Retrieve messages that match the filter criteria and are received between + * the last time this function was called and now. + * + * @param {String} id + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.getFilterMessages = function (id, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_getFilterMessages', + id, + null, + null + ).send(callback); +}; + + +/** + * Retrieve messages that match the filter criteria and are received between + * the last time this function was called and now. + * + * @param {object} object + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Shh.prototype.post = function (object, callback) { + return this.methodPackage.create( + this.connectionModel.provider, + 'shh_post', + object, + null, + null + ).send(callback); +}; module.exports = Shh; From 7293f29619cbb56897834ecd3fd5d00137cd1cfc Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 13 Sep 2018 13:01:59 +0200 Subject: [PATCH 0083/1045] CodeStyle improvement --- packages/web3-bzz/src/Bzz.js | 5 +++ .../web3-core-promievent/src/PromiEvent.js | 10 +----- packages/web3-core-promievent/src/index.js | 6 ++-- .../lib/mappers/JSONRpcMapper.js | 2 +- .../validators/JSONRpcResponseValidator.js | 14 ++++---- .../src/adapters/InpageProviderAdapter.js | 4 ++- .../src/detectors/ProviderDetector.js | 11 +++++-- .../src/Subscription.js | 3 +- packages/web3-core-subscription/src/index.js | 7 +--- packages/web3-eth-accounts/src/Accounts.js | 32 +++++++++++++++++-- packages/web3-eth-iban/src/index.js | 2 +- packages/web3-eth-personal/src/Personal.js | 4 +-- .../src/resolvers/SubscriptionsResolver.js | 3 +- packages/web3/src/models/ConnectionModel.js | 1 + 14 files changed, 65 insertions(+), 39 deletions(-) diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index 4b3a79f562b..58c8a873b59 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -89,6 +89,8 @@ Bzz.prototype.upload = function (data) { /** * Checks if swarm is available * + * @method isAvailable + * * @returns {Promise} */ Bzz.prototype.isAvailable = function () { @@ -112,6 +114,9 @@ Bzz.prototype.hasProvider = function () { /** * Throws the provider error + * + * @method throwProviderError + * */ Bzz.prototype.throwProviderError = function () { throw new Error('No provider set, please set one using bzz.setProvider().'); diff --git a/packages/web3-core-promievent/src/PromiEvent.js b/packages/web3-core-promievent/src/PromiEvent.js index 3b13ed4f26d..818f95395cb 100644 --- a/packages/web3-core-promievent/src/PromiEvent.js +++ b/packages/web3-core-promievent/src/PromiEvent.js @@ -30,21 +30,13 @@ var Promise = require("any-promise"); * * @method eventifiedPromise */ -var PromiEvent = function PromiEvent(justPromise) {// TODO: Just promise is no longer required +var PromiEvent = function PromiEvent() { var resolve, reject, eventEmitter = new Promise(function() { resolve = arguments[0]; reject = arguments[1]; }); - if(justPromise) { - return { - resolve: resolve, - reject: reject, - eventEmitter: eventEmitter - }; - } - // get eventEmitter var emitter = new EventEmitter(); diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index 579c9d65524..8f92e8a93cd 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -32,10 +32,8 @@ module.exports = { * Returns PromiEvent object * * @method create - * - * @param {Boolean} justPromise */ - create: function(justPromise) { - return new PromiEvent(justPromise); + create: function() { + return new PromiEvent(); } }; diff --git a/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js b/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js index 181bc01c1d3..1ce25cf8a9f 100644 --- a/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js +++ b/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js @@ -34,7 +34,7 @@ var JSONRpcMapper = { * * @method toPayload * - * @param {Function} method of jsonrpc call, required + * @param {String} method of jsonrpc call, required * @param {Array} params, an Array of method params, optional * * @returns {Object} valid jsonrpc payload object diff --git a/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js b/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js index 61ce57d0140..2e6a1d73cad 100644 --- a/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js +++ b/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js @@ -31,26 +31,26 @@ var JSONRpcResponseValidator = {}; * * @param {Object} response * - * @returns {Boolean} true if response is valid, otherwise false + * @returns {Boolean} */ JSONRpcResponseValidator.isValid = function (response) { if (Array.isArray(response)) { - return response.every(this.validateSingleMessage) + return response.every(this.isResponseItemValid) } - return this.validateSingleMessage(response); + return this.isResponseItemValid(response); }; /** - * Checks if jsonrpc response is valid + * Validates response item from a JSON-RPC response * - * @method validateSingleMessage + * @method isResponseItemValid * * @param {Object} response * - * @returns {Boolean} true if response is valid, otherwise false + * @returns {Boolean} */ -JSONRpcResponseValidator.validateSingleMessage = function (response) { +JSONRpcResponseValidator.isResponseItemValid = function (response) { return !!response && !response.error && response.jsonrpc === '2.0' && diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js index 6de5aec2d47..6406ae720f7 100644 --- a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js @@ -94,7 +94,9 @@ InpageProviderAdapter.prototype.unsubscribe = function () { * * @returns {boolean} */ -InpageProviderAdapter.prototype.isConnected = this.provider.isConnected; +InpageProviderAdapter.prototype.isConnected = function () { + return this.provider.isConnected; +}; InpageProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); diff --git a/packages/web3-core-providers/src/detectors/ProviderDetector.js b/packages/web3-core-providers/src/detectors/ProviderDetector.js index dee9e0f8c1d..390026335da 100644 --- a/packages/web3-core-providers/src/detectors/ProviderDetector.js +++ b/packages/web3-core-providers/src/detectors/ProviderDetector.js @@ -20,7 +20,12 @@ * @date 2018 */ -var global = Function('return this')(); +var global; +try { + global = Function('return this')(); +} catch (e) { + global = window; +} function ProviderDetector() { } @@ -64,9 +69,9 @@ ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { * * @method addSubscriptionsToIpcProviderWrapper * - * @param {Object} provider ipcProviderWrapper + * @param {Object} provider * - * @returns {Object} ipcProviderWrapper + * @returns {Object} */ ProviderDetector.prototype.addSubscriptionsToIpcProviderWrapper = function (provider) { provider.on = function (type, callback) { diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 737f77ea379..457682b390f 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -60,7 +60,8 @@ Subscription.prototype.subscribe = function (callback) { this.provider.subscribe( this.subscriptionType, - this.method, this.getFormattedInput() + this.method, + this.getFormattedInput() ).then(function (subscriptionId) { self.subscriptionId = subscriptionId; diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js index 93bcd3ce5cf..291a5199150 100644 --- a/packages/web3-core-subscription/src/index.js +++ b/packages/web3-core-subscription/src/index.js @@ -44,10 +44,5 @@ module.exports = { */ create: function (provider, type, parameters, inputFormatters, outputFormatter, subscriptionType) { return new Subscription(provider, type, parameters, inputFormatters, outputFormatter, subscriptionType) - }, - - /** - * Used for extending the ShhSubscription - */ - Subscription: Subscription + } }; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 1bd43f0e830..6bf5cd97bcc 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -153,6 +153,8 @@ Accounts.prototype.privateKeyToAccount = function privateKeyToAccount(privateKey /** * Signs a transaction object with the given privateKey * + * @method signTransaction + * * @param {Object} tx * @param {String} privateKey * @param {Function} callback @@ -263,6 +265,15 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca }; /* jshint ignore:start */ +/** + * Recovers transaction + * + * @method recoverTransaction + * + * @param {String} rawTx + * + * @returns {String} + */ Accounts.prototype.recoverTransaction = function recoverTransaction(rawTx) { var values = RLP.decode(rawTx); var signature = Account.encodeSignature(values.slice(6,9)); @@ -270,6 +281,7 @@ Accounts.prototype.recoverTransaction = function recoverTransaction(rawTx) { var extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), "0x", "0x"]; var signingData = values.slice(0,6).concat(extraData); var signingDataHex = RLP.encode(signingData); + return Account.recover(Hash.keccak256(signingDataHex), signature); }; /* jshint ignore:end */ @@ -320,9 +332,11 @@ Accounts.prototype.sign = function sign(data, privateKey) { /** * Recovers * - * @param {String} message + * @method recover + * + * @param {String|Object} message * @param {String} signature - * @param preFixed + * @param {Boolean} preFixed * * @returns {*} */ @@ -347,7 +361,19 @@ Accounts.prototype.recover = function recover(message, signature, preFixed) { return Account.recover(message, signature); }; -// Taken from https://github.com/ethereumjs/ethereumjs-wallet +/** + * Decrypts account + * + * Note: Taken from https://github.com/ethereumjs/ethereumjs-wallet + * + * @method decrypt + * + * @param {Object|String} v3Keystore + * @param {String} password + * @param {Boolean} nonStrict + * + * @returns {Object} + */ Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) { /* jshint maxcomplexity: 10 */ diff --git a/packages/web3-eth-iban/src/index.js b/packages/web3-eth-iban/src/index.js index 9f787065802..73766b77d0f 100644 --- a/packages/web3-eth-iban/src/index.js +++ b/packages/web3-eth-iban/src/index.js @@ -35,7 +35,7 @@ module.exports = { * * @returns {Iban} */ - create: function () {// TODO: Determine if this is the correct approach to do this with a create method. + create: function () { return Iban; } }; diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 6880024970c..c8d49d590b8 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -32,13 +32,13 @@ * * @constructor */ -var Personal = function Personal(connectionModel, methodPackage, utils, formatters) { +function Personal(connectionModel, methodPackage, utils, formatters) { this.connectionModel = connectionModel; this.methodPackage = methodPackage; this.utils = utils; this.formatters = formatters; this.net = this.connectionModel.getNetworkMethodsAsObject(); -}; +} /** * Gets a list of accounts diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index e9bfe30cede..5ca12334fae 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -92,7 +92,8 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in type, parameters, inputFormatter, - outputFormatter + outputFormatter, + 'eth' ).subscribe(callback); }; diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3/src/models/ConnectionModel.js index 818763d8ad9..ad8f8cf2361 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3/src/models/ConnectionModel.js @@ -26,6 +26,7 @@ * @param {MethodPackage} methodPackage * @param {Utils} utils * @param {Object} formatters + * * @constructor */ function ConnectionModel(provider, methodPackage, utils, formatters) { From 5ebe727ddf8eee46becbe7d78946520f2a92acd4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 14 Sep 2018 12:24:26 +0200 Subject: [PATCH 0084/1045] Provider handling fixed, connectionModel removed, network package created, AbstractWeb3Object created --- .../src/AbstractWeb3Object.js | 114 ++++++++++++++++++ .../src/AbstractWeb3Package.js | 77 ------------ .../src/resolvers/ProviderAdapterResolver.js | 4 +- packages/web3-eth/src/Eth.js | 30 +++++ packages/web3-net/README.md | 43 +++++++ packages/web3-net/package.json | 16 +++ .../src/Network.js} | 71 +++-------- packages/web3-net/src/index.js | 47 ++++++++ packages/web3/src/index.js | 106 ++++++++-------- 9 files changed, 321 insertions(+), 187 deletions(-) create mode 100644 packages/web3-core-package/src/AbstractWeb3Object.js delete mode 100644 packages/web3-core-package/src/AbstractWeb3Package.js create mode 100644 packages/web3-net/README.md create mode 100644 packages/web3-net/package.json rename packages/{web3/src/models/ConnectionModel.js => web3-net/src/Network.js} (72%) create mode 100644 packages/web3-net/src/index.js diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js new file mode 100644 index 00000000000..5949d39b656 --- /dev/null +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -0,0 +1,114 @@ +/* + 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 . + */ +/** + * @file AbstractWeb3Object.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {Object} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodPackage} methodPackage + * @param {SubscriptionPackage} subscriptionPackage + * @param {BatchRequest} batchRequest + * + * @constructor + */ +function AbstractWeb3Object(provider, providersPackage, methodPackage, subscriptionPackage, batchRequest) { + this.providersPackage = providersPackage; + this._provider = this.providersPackage.resolve(provider); + this.givenProvider = this.providersPackage.detect(); + + this.providers = { + HttpProvider: this.providersPackage.HttpProvider, + IpcProvider: this.providersPackage.IpcProvider, + WebsocketProvider: this.providersPackage.WebsocketProvider, + }; + + this.BatchRequest = batchRequest; + this.methodPackage = methodPackage; + this.subscriptionPackage = subscriptionPackage; + + Object.defineProperty(this, 'currentProvider', { + set: function (provider) { + if (typeof this._provider.clearSubscriptions !== 'undefined' && this._provider.subscriptions.length > 0) { + this._provider.clearSubscriptions(); + } + + this._provider = this.providersPackage.resolve(provider); + }, + enumerable: true + }); + +} + +/** + * Sets the currentProvider and provider property + * + * @method setProvider + * + * @param {any} provider + */ +AbstractWeb3Object.prototype.setProvider = function (provider) { + this.currentProvider = provider; +}; + +/** + * Extends the current object with JSON-RPC methods + * + * @method extend + * + * @param {Object} extension + */ +AbstractWeb3Object.prototype.extend = function (extension) { + var namespace = extension.property || null, + extendedObject, + self = this; + + if (namespace) { + extendedObject = this[namespace] = {}; + } else { + extendedObject = this; + } + + if (extension.methods.length > 0) { + extension.methods.forEach(function(method) { + extendedObject[method.name] = function () { + var parameters = null; + var callback = arguments[0]; + + if (method.params && method.params > 0) { + parameters = arguments.slice(0, (method.params - 1 )); + callback = arguments.slice(-1); + } + + return this.methodPackage.create( + self.currentProvider, + method.call, + parameters, + method.inputFormatter, + method.outputFormatter + ).send(callback); + }; + }); + } +}; + +module.exports = AbstractWeb3Object; diff --git a/packages/web3-core-package/src/AbstractWeb3Package.js b/packages/web3-core-package/src/AbstractWeb3Package.js deleted file mode 100644 index 6c0883b49ee..00000000000 --- a/packages/web3-core-package/src/AbstractWeb3Package.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - 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 . - */ -/** - * @file AbstractWeb3Package.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -/** - * @param {Object} connectionModel - * @constructor - */ -function AbstractWeb3Package(connectionModel) { - this.connectionModel = connectionModel; - this.givenProvider = connectionModel.givenProvider; - this.currentProvider = this.connectionModel.provider; - this.BatchRequest = ''; -} - -AbstractWeb3Package.prototype.setProvider = function (provider) { - this.connectionModel.setProvider(provider); -}; - -AbstractWeb3Package.prototype.extend = function () { - // TODO: Implement extend in a readable way - - // var extend = function (pckg) { - // /* jshint maxcomplexity:5 */ - // var ex = function (extension) { - // - // var extendedObject; - // if (extension.property) { - // if (!pckg[extension.property]) { - // pckg[extension.property] = {}; - // } - // extendedObject = pckg[extension.property]; - // } else { - // extendedObject = pckg; - // } - // - // if (extension.methods) { - // extension.methods.forEach(function (method) { - // if(!(method instanceof Method)) { - // method = new Method(method); - // } - // - // method.attachToObject(extendedObject); - // method.setRequestManager(pckg._requestManager); - // }); - // } - // - // return pckg; - // }; - // - // ex.formatters = formatters; - // ex.utils = utils; - // ex.Method = Method; - // - // return ex; - // }; -}; diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index d7c5fcdea45..723d0c8b49a 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -41,7 +41,7 @@ function ProviderAdapterResolver(providersPackageFactory) { * @param {Object} provider * @param {Net} net * - * @returns {Object} + * @returns {Object|Boolean} */ ProviderAdapterResolver.prototype.resolve = function (provider, net) { @@ -74,6 +74,8 @@ ProviderAdapterResolver.prototype.resolve = function (provider, net) { if (_.isFunction(provider.sendAsync)) { return this.providersPackageFactory.createInpageProviderAdapter(provider); } + + return false; }; module.exports = ProviderAdapterResolver; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index b187195f7ca..7d1ea23a933 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -64,6 +64,36 @@ var Eth = function Eth( this.formatters = formatters; this.subscriptionsResolver = subscriptionsResolver; this.methodPackage = methodPackage; + this._defaultAccount = null; + this._defaultBlock = 'latest'; + + /** + * Defines accessors for defaultAccount + */ + Object.defineProperty(this, 'defaultAccount', { + get: function () { + return this._defaultAccount; + }, + set: function (val) { + if (val) { + this._defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); + } + }, + enumerable: true + }); + + /** + * Defines accessors for defaultBlock + */ + Object.defineProperty(this, 'defaultBlock', { + get: function () { + return this._defaultBlock; + }, + set: function (val) { + this._defaultBlock = val; + }, + enumerable: true + }); }; /** diff --git a/packages/web3-net/README.md b/packages/web3-net/README.md new file mode 100644 index 00000000000..5ce25be1e76 --- /dev/null +++ b/packages/web3-net/README.md @@ -0,0 +1,43 @@ +# web3-net + +This is a sub package of [web3.js][repo] + +This is the net package to be used in other web3.js packages. +Please read the [documentation][docs] for more. + +## Installation + +### Node.js + +```bash +npm install web3-net +``` + +### In the Browser + +Build running the following in the [web3.js][repo] repository: + +```bash +npm run-script build-all +``` + +Then include `dist/web3-net.js` in your html file. +This will expose the `Web3Net` object on the window object. + + +## Usage + +```js +// TODO: update usage example + +// in node.js +var Web3Net = require('web3-net'); + +var net = new Web3Net('ws://localhost:8546'); +``` + + +[docs]: http://web3js.readthedocs.io/en/1.0/ +[repo]: https://github.com/ethereum/web3.js + + diff --git a/packages/web3-net/package.json b/packages/web3-net/package.json new file mode 100644 index 00000000000..c747640f76d --- /dev/null +++ b/packages/web3-net/package.json @@ -0,0 +1,16 @@ +{ + "name": "web3-net", + "namespace": "ethereum", + "version": "1.0.0-beta.35", + "description": "Web3 module to interact with the Ethereum nodes networking properties.", + "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-net", + "license": "LGPL-3.0", + "main": "src/index.js", + "dependencies": { + "web3-core-providers": "1.0.0-beta.35", + "web3-core-method": "1.0.0-beta.35", + "web3-core-helpers": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35", + "web3-core-package": "1.0.0-beta.35" + } +} diff --git a/packages/web3/src/models/ConnectionModel.js b/packages/web3-net/src/Network.js similarity index 72% rename from packages/web3/src/models/ConnectionModel.js rename to packages/web3-net/src/Network.js index ad8f8cf2361..e9428a5010c 100644 --- a/packages/web3/src/models/ConnectionModel.js +++ b/packages/web3-net/src/Network.js @@ -16,53 +16,30 @@ */ /** - * @file ConnectionModel.js + * @file Network.js * @author Samuel Furter * @date 2018 */ +"use strict"; + +var AbstractWeb3Object = require('web3-core-package'); + /** * @param {Object} provider + * @param {ProvidersPackage} providersPackage * @param {MethodPackage} methodPackage - * @param {Utils} utils * @param {Object} formatters + * @param {Object} utils * * @constructor */ -function ConnectionModel(provider, methodPackage, utils, formatters) { - this.provider = provider; - this.utils = utils; +function Network(provider, providersPackage, methodPackage, formatters, utils) { + AbstractWeb3Object.call(provider, providersPackage, methodPackage); this.formatters = formatters; - this.methodPackage = methodPackage; + this.utils = utils; } -/** - * Defines accessors for defaultAccount - */ -Object.defineProperty(Eth, 'defaultAccount', { - get: function () { - return this.defaultAccount || null; - }, - set: function (val) { - if (val) { - this.defaultAccount = utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); - } - }, - enumerable: true -}); - -/** - * Defines accessors for defaultBlock - */ -Object.defineProperty(Eth, 'defaultBlock', { - get: function () { - return this.defaultBlock || 'latest'; - }, - set: function (val) { - this.defaultBlock = val; - }, - enumerable: true -}); /** * Determines to which network web3 is currently connected @@ -74,7 +51,7 @@ Object.defineProperty(Eth, 'defaultBlock', { * @callback callback(error, result) * @returns {Promise} */ -ConnectionModel.prototype.getNetworkType = function (callback) { +Network.prototype.getNetworkType = function (callback) { var self = this, id; return this.getId().then(function (givenId) { @@ -127,7 +104,7 @@ ConnectionModel.prototype.getNetworkType = function (callback) { * @callback callback callback(error, result) * @returns {Promise|eventifiedPromise} */ -ConnectionModel.prototype.getId = function (callback) { +Network.prototype.getId = function (callback) { return this.methodPackage.create(this.provider, 'net_version', [], null, this.utils.hexToNumber).send(callback); }; @@ -141,7 +118,7 @@ ConnectionModel.prototype.getId = function (callback) { * @callback callback callback(error, result) * @returns {Promise|eventifiedPromise} */ -ConnectionModel.prototype.isListening = function (callback) { +Network.prototype.isListening = function (callback) { return this.methodPackage.create(this.provider, 'net_listening', [], null, null).send(callback); }; @@ -155,7 +132,7 @@ ConnectionModel.prototype.isListening = function (callback) { * @callback callback callback(error, result) * @returns {Promise|eventifiedPromise} */ -ConnectionModel.prototype.getPeerCount = function (callback) { +Network.prototype.getPeerCount = function (callback) { return this.methodPackage.create(this.provider, 'net_peerCount', [], null, this.utils.hexToNumber).send(callback); }; @@ -171,7 +148,7 @@ ConnectionModel.prototype.getPeerCount = function (callback) { * @callback callback callback(error, result) * @returns {Promise|eventifiedPromise} */ -ConnectionModel.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { +Network.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { return this.methodPackage.create( this.provider, 'eth_getBlockByNumber', @@ -183,18 +160,6 @@ ConnectionModel.prototype.getBlockByNumber = function (blockNumber, returnTransa ).send(callback); }; -/** - * Returns the network methods for the public API - * - * @method getNetworkMethodsAsObject - * - * @returns {Object} - */ -ConnectionModel.prototype.getNetworkMethodsAsObject = function () { - return { - getId: this.getId.bind(this), - isListening: this.isListening.bind(this), - getPeerCount: this.getPeerCount.bind(this), - getNetworkType: this.getNetworkType.bind(this) - } -}; +Network.prototype = Object.create(AbstractWeb3Object.prototype); + +module.exports = Network; diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js new file mode 100644 index 00000000000..a3f268111fb --- /dev/null +++ b/packages/web3-net/src/index.js @@ -0,0 +1,47 @@ +/* + 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 . + */ + +/** + * @file Network.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var version = require('../package.json').version; +var ProvidersPackage = require('web3-core-providers'); +var MethodPackage = require('web3-core-method'); +var formatters = require('web3-core-helpers').formatters; +var utils = require('web3-utils'); +var Network = require('./Network'); + + +module.exports = { + version: version, + + /** + * Creates the Network Object + * + * @method create + * + * @param {Object} provider + */ + create: function (provider) { + return new Network(provider, ProvidersPackage, MethodPackage, formatters, utils) + } +}; diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 782bb8422b6..cff392b2061 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -24,11 +24,9 @@ var ProvidersPackage = require('web3-core-providers'); var EthPackage = require('web3-eth'); -var MethodPackage = require('web3-core-method'); var Utils = require('web3-utils'); var ShhPackage = require('web3-shh'); var BzzPackage = require('web3-bzz'); -var HelpersPackage = require('web3-helpers'); var version = require('../package.json').version; /** @@ -37,50 +35,56 @@ var version = require('../package.json').version; * * @constructor */ -var Web3 = function Web3(provider, net) { // TODO: throw error if no provider is given and also no provider is found with the detector +var Web3 = function Web3(provider, net) { this.version = version; - this.connectionModel = Web3.createConnectionModel( - ProvidersPackage.resolve(provider, net) - ); - this.utils = Utils; - this.eth = EthPackage.create(this.connectionModel); - this.shh = ShhPackage.create(this.connectionModel); - this.bzz = BzzPackage.create(this.connectionModel); -}; -/** - * Defines accessors for connectionModel - */ -Object.defineProperty(Web3, 'connectionModel', { - get: function () { - return this.connectionModel; - }, - set: function (connectionModel) { - if (this.connectionModel) { - return; - } + if (typeof provider === 'undefined') { + throw new Error('No provider given as constructor parameter!'); + } - this.connectionModel = connectionModel; - }, - enumerable: true -}); + this._provider = ProvidersPackage.resolve(provider, net); -/** - * Defines accessors for connectionModel - */ -Object.defineProperty(Web3, 'givenProvider', { - get: function () { - return this.connectionModel.givenProvider; - }, - set: function (connectionModel) { - if (this.connectionModel) { - return; - } + if (!this._provider) { + throw new Error('Invalid provider given as constructor parameter!'); + } - this.connectionModel = connectionModel; - }, - enumerable: true -}); + this.utils = Utils; + this.eth = EthPackage.create(this._provider); + this.shh = ShhPackage.create(this._provider); + this.bzz = BzzPackage.create(this._provider); + + /** + * Defines accessors for connectionModel + */ + Object.defineProperty(this, 'givenProvider', { + get: function () { + return this.givenProvider; + }, + set: function (provider) { + this.givenProvider = provider; + }, + enumerable: true + }); + + Object.defineProperty(this, 'currentProvider', { + get: function () { + return this._provider + }, + set: function (provider) { + if (typeof this._provider.clearSubscriptions !== 'undefined') { + this._provider.clearSubscriptions(); + } + + this._provider = ProvidersPackage.resolve(provider, net); + this.eth.setProvider(provider); + this.shh.setProvider(provider); + this.bzz.setProvider(provider); + }, + enumerable: true + }); +}; + +Web3.givenProvider = ProvidersPackage.detect(); Web3.version = version; @@ -88,32 +92,22 @@ Web3.utils = Utils; Web3.modules = { Eth: function (provider, net) { - return EthPackage.create(this.createConnectionModel(provider, net)); + return EthPackage.create(ProvidersPackage.resolve(provider, net)); }, Net: function (provider, net) { - return this.createConnectionModel(provider, net).getNetworkMethodsAsObject(); + // return this.createConnectionModel(provider, net).getNetworkMethodsAsObject(); }, Personal: function (provider, net) { - return PersonalPackage.create(this.createConnectionModel(provider, net)); + return PersonalPackage.create(ProvidersPackage.resolve(provider, net)); }, Shh: function (provider, net) { - return ShhPackage.create(this.createConnectionModel(provider, net)); + return ShhPackage.create(ProvidersPackage.resolve(provider, net)); }, Bzz: function (provider, net) { - return new BzzPackage.create(this.createConnectionModel(provider, net)); + return new BzzPackage.create(ProvidersPackage.resolve(provider, net)); } }; -Web3.createConnectionModel = function(provider, net) { - return new ConnectionModel( - ProvidersPackage.resolve(provider, net), - MethodPackage, - UtilsPackage.create(), - HelpersPackage.create().formatters - ) -}; - - Web3.providers = { HttpProvider: ProvidersPackage.HttpProvider, WebsocketProvider: ProvidersPackage.WebsocketProvider, From 0bcc4f4229bd97db56425b48579c8228727ddbe4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 14 Sep 2018 16:35:35 +0200 Subject: [PATCH 0085/1045] AbstractWeb3Object implemented in Eth --- packages/web3-eth/src/Eth.js | 123 +++++++++++------- packages/web3-eth/src/index.js | 18 +-- .../src/resolvers/SubscriptionsResolver.js | 14 +- 3 files changed, 92 insertions(+), 63 deletions(-) diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 7d1ea23a933..92acbeb8ff0 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file index.js + * @file Eth.js * @author Samuel Furter * @date 2018 */ @@ -23,24 +23,26 @@ "use strict"; var _ = require('underscore'); +var AbstractWeb3Object = require('web3-core-package'); /** - * @param {ConnectionModel} connectionModel - * @param {ContractPackage} contract - * @param {AccountsPackage} accounts - * @param {PersonalPackage} personal + * @param {Network} net + * @param {Contract} contract + * @param {Accounts} accounts + * @param {Personal} personal * @param {Iban} iban - * @param {AbiPackage} abi - * @param {ENSPackage} ens + * @param {Abi} abi + * @param {ENS} ens * @param {Utils} utils * @param {Object} formatters * @param {MethodPackage} methodPackage + * @param {ProvidersPackage} providersPackage * @param {SubscriptionsResolver} subscriptionsResolver * * @constructor */ var Eth = function Eth( - connectionModel, + net, contract, accounts, personal, @@ -50,10 +52,11 @@ var Eth = function Eth( utils, formatters, methodPackage, + providersPackage, subscriptionsResolver ) { - this.connectionModel = connectionModel; - this.net = this.connectionModel.getNetworkMethodsAsObject(); + AbstractWeb3Object.call(provider, providersPackage, methodPackage); + this.net = net; this.Contract = contract; this.accounts = accounts; this.personal = personal; @@ -123,7 +126,7 @@ Eth.prototype.subscribe = function (type, parameters, callback) { * @returns {Promise} */ Eth.prototype.getNodeInfo = function (callback) { - return this.methodPackage.create(this.connectionModel.provider, 'web3_clientVersion', [], null, null).send(callback); + return this.methodPackage.create(this.currentProvider, 'web3_clientVersion', [], null, null).send(callback); }; /** @@ -137,7 +140,7 @@ Eth.prototype.getNodeInfo = function (callback) { * @returns {Promise} */ Eth.prototype.getProtocolVersion = function (callback) { - return this.methodPackage.create(this.connectionModel.provider, 'eth_protocolVersion', [], null, null).send(callback); + return this.methodPackage.create(this.currentProvider, 'eth_protocolVersion', [], null, null).send(callback); }; /** @@ -151,7 +154,7 @@ Eth.prototype.getProtocolVersion = function (callback) { * @returns {Promise} */ Eth.prototype.getCoinbase = function (callback) { - return this.methodPackage.create(this.connectionModel.provider, 'eth_coinbase', [], null, null).send(callback); + return this.methodPackage.create(this.currentProvider, 'eth_coinbase', [], null, null).send(callback); }; /** @@ -165,7 +168,7 @@ Eth.prototype.getCoinbase = function (callback) { * @returns {Promise} */ Eth.prototype.isMining = function (callback) { - return this.methodPackage.create(this.connectionModel.provider, 'eth_mining', [], null, null).send(callback); + return this.methodPackage.create(this.currentProvider, 'eth_mining', [], null, null).send(callback); }; /** @@ -180,7 +183,7 @@ Eth.prototype.isMining = function (callback) { */ Eth.prototype.getHashrate = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_hashrate', [], null, @@ -200,7 +203,7 @@ Eth.prototype.getHashrate = function (callback) { */ Eth.prototype.isSyncing = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_syncing', [], null, @@ -220,7 +223,7 @@ Eth.prototype.isSyncing = function (callback) { */ Eth.prototype.getGasPrice = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_gasPrice', [], null, @@ -240,7 +243,7 @@ Eth.prototype.getGasPrice = function (callback) { */ Eth.prototype.getAccounts = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_accounts', [], null, @@ -260,7 +263,7 @@ Eth.prototype.getAccounts = function (callback) { */ Eth.prototype.getBlockNumber = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_blockNumber', [], null, @@ -282,11 +285,11 @@ Eth.prototype.getBlockNumber = function (callback) { */ Eth.prototype.getBalance = function (address, block, callback) { if (!block) { - block = this.connectionModel.defaultBlock; + block = this.defaultBlock; } return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getBalance', [address, block], [ @@ -312,11 +315,11 @@ Eth.prototype.getBalance = function (address, block, callback) { */ Eth.prototype.getStorageAt = function (address, position, block, callback) { if (!block) { - block = this.connectionModel.defaultBlock; + block = this.defaultBlock; } return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getStorageAt', [address, position, block], [ @@ -342,11 +345,11 @@ Eth.prototype.getStorageAt = function (address, position, block, callback) { */ Eth.prototype.getCode = function (address, block, callback) { if (!block) { - block = this.connectionModel.defaultBlock; + block = this.defaultBlock; } return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getCode', [address, block], [ @@ -371,7 +374,7 @@ Eth.prototype.getCode = function (address, block, callback) { */ Eth.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getBlockByNumber', [blockNumber, returnTransactionObjects], [ @@ -398,7 +401,7 @@ Eth.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects */ Eth.prototype.getBlockByHash = function (blockHash, returnTransactionObjects, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getBlockByHash', [blockHash, returnTransactionObjects], [ @@ -469,7 +472,7 @@ Eth.prototype.getUncle = function (blockHashOrBlockNumber, uncleIndex, callback) */ Eth.prototype.getUncleByBlockNumber = function (blockNumber, uncleIndex, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getUncleByBlockNumberAndIndex', [blockNumber, uncleIndex], [ @@ -494,7 +497,7 @@ Eth.prototype.getUncleByBlockNumber = function (blockNumber, uncleIndex, callbac */ Eth.prototype.getUnlceByBlockHash = function (blockHash, uncleIndex, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getUncleByBlockHashAndIndex', [blockHash, uncleIndex], [ @@ -540,7 +543,7 @@ Eth.prototype.getBlockTransactionCount = function (blockHashOrBlockNumber, callb */ Eth.prototype.getBlockTransactionCountByBlockNumber = function (blockNumber, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getBlockTransactionCountByNumber', [blockNumber], [ @@ -564,7 +567,7 @@ Eth.prototype.getBlockTransactionCountByBlockNumber = function (blockNumber, cal */ Eth.prototype.getBlockTransactionCountByBlockHash = function (blockHash, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getBlockTransactionCountByHash', [blockNumber], [ @@ -608,7 +611,7 @@ Eth.prototype.getBlockUncleCount = function (blockHashOrBlockNumber, callback) { */ Eth.prototype.getBlockUncleCountByBlockHash = function (blockHash, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getUncleCountByBlockHash', [blockHash], [ @@ -631,7 +634,7 @@ Eth.prototype.getBlockUncleCountByBlockHash = function (blockHash, callback) { */ Eth.prototype.getBlockUncleCountByBlockNumber = function (blockNumber, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getUncleCountByBlockNumber', [blockNumber], [ @@ -654,7 +657,7 @@ Eth.prototype.getBlockUncleCountByBlockNumber = function (blockNumber, callback) */ Eth.prototype.getTransaction = function (transactionHash, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getTransactionByHash', [transactionHash], null, @@ -698,7 +701,7 @@ Eth.prototype.getTransactionFromBlock = function (hashStringOrNumber, indexNumbe */ Eth.prototype.getTransactionFromBlockByBlockHash = function (transactionHash, indexNumber, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getTransactionByBlockHashAndIndex', [transactionHash, indexNumber], [ @@ -724,7 +727,7 @@ Eth.prototype.getTransactionFromBlockByBlockHash = function (transactionHash, in */ Eth.prototype.getTransactionFromBlockByBlockNumber = function (blockNumber, indexNumber, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getTransactionByBlockNumberAndIndex', [blockNumber, indexNumber], [ @@ -748,7 +751,7 @@ Eth.prototype.getTransactionFromBlockByBlockNumber = function (blockNumber, inde */ Eth.prototype.getTransactionReceipt = function (transactionHash, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getTransactionReceipt', [transactionHash], null, @@ -770,11 +773,11 @@ Eth.prototype.getTransactionReceipt = function (transactionHash, callback) { */ Eth.prototype.getTransactionCount = function (address, block, callback) { if (!block) { - block = this.connectionModel.defaultBlock; + block = this.defaultBlock; } return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getTransactionCount', [address, block], [ @@ -798,7 +801,7 @@ Eth.prototype.getTransactionCount = function (address, block, callback) { */ Eth.prototype.sendSignedTransaction = function (signedTransactionData, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_sendRawTransaction', [signedTransactionData], null, @@ -819,7 +822,7 @@ Eth.prototype.sendSignedTransaction = function (signedTransactionData, callback) */ Eth.prototype.signTransaction = function (transactionObject, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_signTransaction', [transactionObject], [this.formatters.inputTransactionFormatter], @@ -840,7 +843,7 @@ Eth.prototype.signTransaction = function (transactionObject, callback) { */ Eth.prototype.sendTransaction = function (transactionObject, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_sendTransaction', [transactionObject], [this.formatters.inputTransactionFormatter], @@ -862,7 +865,7 @@ Eth.prototype.sendTransaction = function (transactionObject, callback) { */ Eth.prototype.sign = function (dataToSign, address, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_sign', [address, dataToSign], [ @@ -887,11 +890,11 @@ Eth.prototype.sign = function (dataToSign, address, callback) { */ Eth.prototype.call = function (callObject, block, callback) { if (!block) { - block = this.connectionModel.defaultBlock; + block = this.defaultBlock; } return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_call', [callObject, block], [ @@ -915,7 +918,7 @@ Eth.prototype.call = function (callObject, block, callback) { */ Eth.prototype.estimateGas = function (callObject, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_estimateGas', [callObject], [this.formatters.inputCallFormatter], @@ -938,7 +941,7 @@ Eth.prototype.estimateGas = function (callObject, callback) { */ Eth.prototype.submitWork = function (nonce, powHash, digest, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_submitWork', [nonce, powHash, digest], null, @@ -959,7 +962,7 @@ Eth.prototype.submitWork = function (nonce, powHash, digest, callback) { */ Eth.prototype.getWork = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getWork', [], null, @@ -980,7 +983,7 @@ Eth.prototype.getWork = function (callback) { */ Eth.prototype.getPastLogs = function (options, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'eth_getLogs', [], [this.formatters.inputLogFormatter], @@ -1003,6 +1006,26 @@ Eth.prototype.isBlockHash = function (blockParameter) { /** * Extends Eth with clearSubscriptions from the current provider */ -Eth.prototype.clearSubscriptions = this.connectionModel.provider.clearSubscriptions; +Eth.prototype.clearSubscriptions = function () { + this.currentProvider.clearSubscriptions(); +}; + +/** + * Extends setProvider method from AbstractWeb3Object. + * This is required for updating the provider also in the sub packages and objects related to Eth. + * + * @param {any} provider + */ +Eth.prototype.setProvider = function (provider) { + AbstractWeb3Object.setProvider.call(provider); + + this.subscriptionsResolver.setProvider(provider); + this.net.setProvider(provider); + this.accounts.setProvider(provider); + this.personal.setProvider(provider); + this.ens.setProvider(provider); +}; + +Eth.prototype = Object.create(AbstractWeb3Object.prototype); module.exports = Eth; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index dea6a5fa6fc..5e447f8c5b7 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -25,6 +25,7 @@ var version = require('./package.json').version; var SubscriptionsResolver = require('./resolvers/SubscriptionsResolver'); var Eth = require('./Eth'); +var NetPackage = require('web3-net'); var ContractPackage = require('web3-eth-contract'); var AccountsPackage = require('web3-eth-accounts'); var PersonalPackage = require('web3-eth-personal'); @@ -32,6 +33,7 @@ var ENSPackage = require('web3-eth-ens'); var AbiPackage = require('web3-eth-abi'); var SubscriptionPackage = require('web3-core-subscription'); var PromiEventPackage = require('web3-core-promiEvent'); +var ProvidersPackage = require('web3-core-providers'); var Iban = require('web3-eth-iban').create(); var formatters = require('web3-core-helpers').formatters; var Utils = require('web3-utils'); @@ -45,23 +47,23 @@ module.exports = { * * @method create * - * @param {ConnectionModel} connectionModel + * @param {any} provider * * @returns {Eth} */ - create: function (connectionModel) { + create: function (provider) { return new Eth( - connectionModel, - ContractPackage.create(connectionModel), - AccountsPackage.create(connectionModel), - PersonalPackage.create(connectionModel), + NetPackage.create(provider), + ContractPackage.create(provider), + AccountsPackage.create(provider), + PersonalPackage.create(provider), Iban, AbiPackage.create(utils), - ENSPackage.create(connectionModel), + ENSPackage.create(provider), Utils, formatters, MethodPackage, - new SubscriptionsResolver(connectionModel.provider, formatters, SubscriptionPackage, PromiEventPackage) + new SubscriptionsResolver(provider, formatters, SubscriptionPackage, PromiEventPackage, ProvidersPackage) ); } }; diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index 5ca12334fae..3e17c216b19 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -22,18 +22,20 @@ "use strict"; +var AbstractWeb3Object = require('web3-core-package'); + /** * @param {Object} provider * @param {Object} formatters * @param {Subscription} subscriptionPackage * @param {PromiEvent} promiEventPackage + * @param {ProvidersPackage} providersPackage * * @constructor */ -function SubscriptionsResolver(provider, formatters, subscriptionPackage, promiEventPackage) { - this.provider = provider; +function SubscriptionsResolver(provider, formatters, subscriptionPackage, promiEventPackage, providersPackage) { + AbstractWeb3Object.call(provider, providersPackage, null, subscriptionPackage); this.formatters = formatters; - this.subscriptionPackage = subscriptionPackage; this.promiEventPackage = promiEventPackage; } @@ -88,7 +90,7 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in } return this.subscriptionPackage.create( - this.provider, + this.currentProvider, type, parameters, inputFormatter, @@ -168,7 +170,7 @@ SubscriptionsResolver.prototype.subscribeToLogs = function (parameters, promiEve */ SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function (parameters, promiEvent, callback) { var self = this; - this.provider.send('eth_getLogs', parameters).then(function (logs) { + this.currentProvider.send('eth_getLogs', parameters).then(function (logs) { logs.forEach(function (log) { var output = self.formatters.outputLogFormatter(log); callback(false, output); @@ -270,4 +272,6 @@ SubscriptionsResolver.prototype.hasFromBlockProperty = function (parameter) { return _.isObject(parameter) && parameter.hasOwnProperty('fromBlock') && _.isNumber(parameter.fromBlock); }; +SubscriptionsResolver.prototype = Object.create(AbstractWeb3Object); + module.exports = SubscriptionsResolver; From 7f38b3ab128b1dc57270abb9bc4f571c37bbabe0 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 14 Sep 2018 17:08:21 +0200 Subject: [PATCH 0086/1045] AbstractWeb3Object implemented --- .../src/AbstractWeb3Object.js | 28 ++++++- packages/web3-core-package/src/index.js | 31 ++++++++ packages/web3-eth-accounts/src/Accounts.js | 15 ++-- packages/web3-eth-accounts/src/index.js | 7 +- packages/web3-eth-personal/src/Personal.js | 70 +++++++++++++----- packages/web3-eth-personal/src/index.js | 8 +- packages/web3-eth/src/Eth.js | 9 +-- .../src/resolvers/SubscriptionsResolver.js | 2 +- packages/web3-net/src/Network.js | 2 +- packages/web3-shh/src/Shh.js | 74 +++++++++++-------- packages/web3-shh/src/index.js | 10 ++- 11 files changed, 180 insertions(+), 76 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 5949d39b656..4ca3dc8c66f 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -42,11 +42,22 @@ function AbstractWeb3Object(provider, providersPackage, methodPackage, subscript WebsocketProvider: this.providersPackage.WebsocketProvider, }; - this.BatchRequest = batchRequest; - this.methodPackage = methodPackage; - this.subscriptionPackage = subscriptionPackage; + if (typeof batchRequest !== 'undefined') { + this.BatchRequest = batchRequest; + } + + if (typeof methodPackage !== 'undefined') { + this.methodPackage = methodPackage; + } + + if (typeof subscriptionPackage !== 'undefined') { + this.subscriptionPackage = subscriptionPackage; + } Object.defineProperty(this, 'currentProvider', { + get: function() { + return this._provider; + }, set: function (provider) { if (typeof this._provider.clearSubscriptions !== 'undefined' && this._provider.subscriptions.length > 0) { this._provider.clearSubscriptions(); @@ -70,6 +81,17 @@ AbstractWeb3Object.prototype.setProvider = function (provider) { this.currentProvider = provider; }; +/** + * Clears all subscriptions and listeners of the provider if it has any subscriptions + * + * @method clearSubscriptions + */ +AbstractWeb3Object.prototype.clearSubscriptions = function() { + if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && this.currentProvider.subscriptions.length > 0) { + this.currentProvider.clearSubscriptions(); + } +}; + /** * Extends the current object with JSON-RPC methods * diff --git a/packages/web3-core-package/src/index.js b/packages/web3-core-package/src/index.js index e69de29bb2d..a9792570ba8 100644 --- a/packages/web3-core-package/src/index.js +++ b/packages/web3-core-package/src/index.js @@ -0,0 +1,31 @@ +/* + 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 . + */ +/** + * @file index.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var version = require('../package.json').version; +var AbstractWeb3Object = require('./AbstractWeb3Object'); + +module.exports = { + version: version, + AbstractWeb3Object: AbstractWeb3Object +}; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 6bf5cd97bcc..e6972f99cfe 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -32,6 +32,7 @@ var Bytes = require("eth-lib/lib/bytes"); var cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); var scryptsy = require('scrypt.js'); var uuid = require('uuid'); +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var isNot = function(value) { return (_.isUndefined(value) || _.isNull(value)); @@ -53,16 +54,16 @@ var makeEven = function (hex) { /** - * @param {ConnectionModel} connectionModel + * @param {any} provider + * @param {ProvidersPackage} providersPackage * @param {MethodPackage} methodPackage * @param {Utils} utils * @param {Object} formatters * * @constructor */ -var Accounts = function Accounts(connectionModel, methodPackage, utils, formatters) { - this.methodPackage = methodPackage; - this.connectionModel = connectionModel; +var Accounts = function Accounts(provider, providersPackage, methodPackage, utils, formatters) { + AbstractWeb3Object.call(provider, providersPackage, methodPackage); this.utils = utils; this.formatters = formatters; this.wallet = new Wallet(this); @@ -76,7 +77,7 @@ var Accounts = function Accounts(connectionModel, methodPackage, utils, formatte * @returns {Promise} */ Accounts.prototype.getGasPrice = function () { - return this.methodPackage.create(this.connectionModel.provider, 'eth_gasPrice').send(); + return this.methodPackage.create(this.currentProvider, 'eth_gasPrice').send(); }; /** @@ -93,7 +94,7 @@ Accounts.prototype.getTransactionCount = function (address) { throw new Error('Address '+ address +' is not a valid address to get the "transactionCount".'); } - return this.methodPackage.create(this.connectionModel.provider, 'eth_getTransactionCount', [address, 'latest'], ).send(); + return this.methodPackage.create(this.currentProvider, 'eth_getTransactionCount', [address, 'latest'], ).send(); }; /** @@ -485,6 +486,8 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { }; }; +Accounts.prototype = Object.create(AbstractWeb3Object.prototype); + // Note: this is trying to follow closely the specs on // http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index ad3e2d06f3f..393b4bfd5e0 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -25,6 +25,7 @@ var version = require('./package.json').version; var Accounts = require('./Accounts'); var MethodPackage = require('web3-core-method'); +var ProvidersPackage = require('web3-core-providers'); var Utils = require('web3-utils'); var formatters = require('web3-helpers').formatters; @@ -36,11 +37,11 @@ module.exports = { * * @method create * - * @params {ConnectionModel} connectionModel + * @params {any} provider * * @returns {Accounts} */ - create: function(connectionModel) { - return new Accounts(connectionModel, MethodPackage, Utils, formatters); + create: function(provider) { + return new Accounts(provider, ProvidersPackage, MethodPackage, Utils, formatters); } }; diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index c8d49d590b8..d89d58b1e41 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -22,22 +22,25 @@ "use strict"; +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; + /** * TODO: Add missing documenation for getAccounts, lockAccount, importRawKey and sendTransaction! * - * @param {ConnectionModel} connectionModel + * @param {any} provider + * @param {ProvidersPackage} providersPackage * @param {MethodPackage} methodPackage + * @param {Network} net * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function Personal(connectionModel, methodPackage, utils, formatters) { - this.connectionModel = connectionModel; - this.methodPackage = methodPackage; +function Personal(provider, providersPackage, methodPackage, net, utils, formatters) { + AbstractWeb3Object.call(provider, providersPackage, methodPackage); this.utils = utils; this.formatters = formatters; - this.net = this.connectionModel.getNetworkMethodsAsObject(); + this.net = net; } /** @@ -53,7 +56,7 @@ function Personal(connectionModel, methodPackage, utils, formatters) { */ Personal.prototype.getAccounts = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'personal_listAccounts', null, null, @@ -73,7 +76,7 @@ Personal.prototype.getAccounts = function (callback) { */ Personal.prototype.newAccount = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'personal_newAccount', null, null, @@ -97,11 +100,11 @@ Personal.prototype.newAccount = function (callback) { */ Personal.prototype.unlockAccount = function (address, password, unlockDuration, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'personal_unlockAccount', [address, password, unlockDuration], [ - this.formmaters.inputAddressFormatter, + this.formatters.inputAddressFormatter, null, null ], @@ -122,10 +125,10 @@ Personal.prototype.unlockAccount = function (address, password, unlockDuration, */ Personal.prototype.lockAccount = function (address, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'personal_lockAccount', [address], - [this.formmaters.inputAddressFormatter], + [this.formatters.inputAddressFormatter], null ).send(callback); }; @@ -144,7 +147,7 @@ Personal.prototype.lockAccount = function (address, callback) { */ Personal.prototype.importRawKey = function (keydata, passphrase, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'personal_importRawKey', [keydata, passphrase], null, @@ -166,10 +169,13 @@ Personal.prototype.importRawKey = function (keydata, passphrase, callback) { */ Personal.prototype.sendTransaction = function (transactionObject, passphrase, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'personal_sendTransaction', [transactionObject, passphrase], - [this.formatters.inputTransactionFormatter, null], + [ + this.formatters.inputTransactionFormatter, + null + ], null ).send(callback); }; @@ -188,10 +194,13 @@ Personal.prototype.sendTransaction = function (transactionObject, passphrase, ca */ Personal.prototype.signTransaction = function (transactionObject, passphrase, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'personal_signTransaction', [transactionObject, passphrase], - [this.formatters.inputTransactionFormatter, null], + [ + this.formatters.inputTransactionFormatter, + null + ], null ).send(callback); }; @@ -211,10 +220,14 @@ Personal.prototype.signTransaction = function (transactionObject, passphrase, ca */ Personal.prototype.sign = function (data, address, password, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'personal_sign', [data, address, password], - [this.formatters.inputSignFormatter, this.formatters.inputAddressFormatter, null], + [ + this.formatters.inputSignFormatter, + this.formatters.inputAddressFormatter, + null + ], null ).send(callback); }; @@ -233,14 +246,31 @@ Personal.prototype.sign = function (data, address, password, callback) { */ Personal.prototype.ecRecover = function (data, signature, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'personal_ecRecover', [data, address, password], - [this.formatters.inputSignFormatter, this.formatters.inputAddressFormatter, null], + [ + this.formatters.inputSignFormatter, + this.formatters.inputAddressFormatter, + null + ], null ).send(callback); }; +/** + * Extends setProvider method from AbstractWeb3Object. + * This is required for updating the provider also in the sub package Net. + * + * @param {any} provider + */ +Personal.prototype.setProvider = function (provider) { + AbstractWeb3Object.setProvider.call(provider); + this.net.setProvider(provider); +}; + +Personal.prototype = Object.create(AbstractWeb3Object); + module.exports = Personal; diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index fc34a4becaa..00c6f3b3d7d 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -25,6 +25,8 @@ var version = require('./package.json').version; var Personal = require('./Personal'); var MethodPackage = require('web3-core-method'); +var NetworkPackage = require('web3-net'); +var ProvidersPackage = require('web3-core-providers'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; @@ -34,12 +36,14 @@ module.exports = { /** * Returns the Personal object * + * @param {any} provider + * * @method create * * @returns {Personal} */ - create: function (connectionModel) { - return new Personal(connectionModel, MethodPackage, Utils, formatters); + create: function (provider) { + return new Personal(provider, ProvidersPackage, MethodPackage, NetworkPackage.create(provider), Utils, formatters); } }; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 92acbeb8ff0..bd9c178912c 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -23,7 +23,7 @@ "use strict"; var _ = require('underscore'); -var AbstractWeb3Object = require('web3-core-package'); +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {Network} net @@ -1003,13 +1003,6 @@ Eth.prototype.isBlockHash = function (blockParameter) { return _.isString(blockParameter) && blockParameter.indexOf('0x') === 0 }; -/** - * Extends Eth with clearSubscriptions from the current provider - */ -Eth.prototype.clearSubscriptions = function () { - this.currentProvider.clearSubscriptions(); -}; - /** * Extends setProvider method from AbstractWeb3Object. * This is required for updating the provider also in the sub packages and objects related to Eth. diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index 3e17c216b19..aea0cf2a74f 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractWeb3Object = require('web3-core-package'); +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {Object} provider diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index e9428a5010c..bcee4c41480 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -23,7 +23,7 @@ "use strict"; -var AbstractWeb3Object = require('web3-core-package'); +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {Object} provider diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index 6b6b7266150..0e7729f75b4 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -16,25 +16,26 @@ */ /** * @file Shh.js - * @author Fabian Vogelsteller + * @author Samuel Furter , Fabian Vogelsteller * @date 2017 */ "use strict"; +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; + /** - * @param {ConnectionModel} connectionModel + * @param {any} provider + * @param {ProvidersPackage} providersPackage * @param {MethodPackage} methodPackage * @param {SubscriptionPackage} subscriptionPackage + * @param {Network} net * * @constructor */ -function Shh(connectionModel, methodPackage, subscriptionPackage) { - this.connectionModel = connectionModel; - this.methodPackage = methodPackage; - this.subscriptionPackage = subscriptionPackage; - this.clearSubscriptions = this.connectionModel.provider.clearSubscriptions; - this.net = this.connectionModel.getNetworkMethodsAsObject(); +function Shh(provider, providersPackage, methodPackage, subscriptionPackage, net) { + AbstractWeb3Object.call(provider, providersPackage, methodPackage, subscriptionPackage); + this.net = net; } /** @@ -51,7 +52,7 @@ function Shh(connectionModel, methodPackage, subscriptionPackage) { */ Shh.prototype.subscribe = function (method, options, callback) { return this.subscriptionPackage.create( - this.connectionModel.provider, + this.currentProvider, method, [options], null, @@ -72,7 +73,7 @@ Shh.prototype.subscribe = function (method, options, callback) { */ Shh.prototype.getVersion = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_version', null, null, @@ -90,7 +91,7 @@ Shh.prototype.getVersion = function (callback) { */ Shh.prototype.getInfo = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_info', null, null, @@ -109,7 +110,7 @@ Shh.prototype.getInfo = function (callback) { */ Shh.prototype.setMaxMessageSize = function (size, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_setMaxMessageSize', size, null, @@ -128,7 +129,7 @@ Shh.prototype.setMaxMessageSize = function (size, callback) { */ Shh.prototype.setMinPoW = function (pow, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_setMinPoW', pow, null, @@ -147,7 +148,7 @@ Shh.prototype.setMinPoW = function (pow, callback) { */ Shh.prototype.markTrustedPeer = function (enode, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_markTrustedPeer', pow, null, @@ -165,7 +166,7 @@ Shh.prototype.markTrustedPeer = function (enode, callback) { */ Shh.prototype.newKeyPair = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_newKeyPair', null, null, @@ -184,7 +185,7 @@ Shh.prototype.newKeyPair = function (callback) { */ Shh.prototype.addPrivateKey = function (privateKey, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_addPrivateKey', privateKey, null, @@ -203,7 +204,7 @@ Shh.prototype.addPrivateKey = function (privateKey, callback) { */ Shh.prototype.deleteKeyPair = function (id, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_deleteKeyPair', id, null, @@ -222,7 +223,7 @@ Shh.prototype.deleteKeyPair = function (id, callback) { */ Shh.prototype.hasKeyPair = function (id, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_hasKeyPair', id, null, @@ -241,7 +242,7 @@ Shh.prototype.hasKeyPair = function (id, callback) { */ Shh.prototype.getPublicKey = function (id, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'id', id, null, @@ -260,7 +261,7 @@ Shh.prototype.getPublicKey = function (id, callback) { */ Shh.prototype.getPrivateKey = function (id, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_getPrivateKey', id, null, @@ -278,7 +279,7 @@ Shh.prototype.getPrivateKey = function (id, callback) { */ Shh.prototype.newSymKey = function (callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_newSymKey', null, null, @@ -297,7 +298,7 @@ Shh.prototype.newSymKey = function (callback) { */ Shh.prototype.addSymKey = function (symKey, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_addSymKey', symKey, null, @@ -316,7 +317,7 @@ Shh.prototype.addSymKey = function (symKey, callback) { */ Shh.prototype.generateSymKeyFromPassword = function (password, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_generateSymKeyFromPassword', password, null, @@ -335,7 +336,7 @@ Shh.prototype.generateSymKeyFromPassword = function (password, callback) { */ Shh.prototype.hasSymKey = function (id, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_hasSymKey', id, null, @@ -354,7 +355,7 @@ Shh.prototype.hasSymKey = function (id, callback) { */ Shh.prototype.getSymKey = function (id, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_getSymKey', id, null, @@ -373,7 +374,7 @@ Shh.prototype.getSymKey = function (id, callback) { */ Shh.prototype.deleteSymKey = function (id, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_deleteSymKey', id, null, @@ -392,7 +393,7 @@ Shh.prototype.deleteSymKey = function (id, callback) { */ Shh.prototype.newMessageFilter = function (options, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_newMessageFilter', options, null, @@ -411,7 +412,7 @@ Shh.prototype.newMessageFilter = function (options, callback) { */ Shh.prototype.deleteMessageFilter = function (id, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_deleteMessageFilter', id, null, @@ -431,7 +432,7 @@ Shh.prototype.deleteMessageFilter = function (id, callback) { */ Shh.prototype.getFilterMessages = function (id, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_getFilterMessages', id, null, @@ -452,7 +453,7 @@ Shh.prototype.getFilterMessages = function (id, callback) { */ Shh.prototype.post = function (object, callback) { return this.methodPackage.create( - this.connectionModel.provider, + this.currentProvider, 'shh_post', object, null, @@ -460,4 +461,17 @@ Shh.prototype.post = function (object, callback) { ).send(callback); }; +/** + * Extends setProvider method from AbstractWeb3Object. + * This is required for updating the provider also in the sub package Net. + * + * @param {any} provider + */ +Shh.prototype.setProvider = function (provider) { + AbstractWeb3Object.setProvider.call(provider); + this.net.setProvider(provider); +}; + +Shh.prototype = Object.create(AbstractWeb3Object.prototype); + module.exports = Shh; diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 2b4584604be..b76ed61563d 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -23,6 +23,10 @@ "use strict"; var version = require('./package.json'); +var ProvidersPackage = require('web3-core-providers'); +var MethodPackage = require('web3-core-method'); +var SubscriptionPackage = require('web3-core-subscription'); +var NetworkPackage = require('web3-net'); var Shh = require('./Shh'); module.exports = { @@ -31,11 +35,13 @@ module.exports = { /** * Returns the Shh object. * + * @param {any} provider + * * @method create * * @returns {Shh} */ - create: function () { // TODO: Refactor the Shh object because of the new method and connection handling. - return new Shh(); + create: function (provider) { + return new Shh(provider, ProvidersPackage, MethodPackage, SubscriptionPackage, NetworkPackage.create(provider)); } }; From a8ed12b7a0bd6e208486474c45be182b6a05c9b3 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 14 Sep 2018 17:16:10 +0200 Subject: [PATCH 0087/1045] Todo added to bzz package, MethodPackage fixed --- packages/web3-bzz/src/Bzz.js | 2 +- .../src/factories/MethodPackageFactory.js | 21 +++++++++++-------- packages/web3-core-method/src/index.js | 4 +++- .../src/watchers/NewHeadsWatcher.js | 8 +++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index 58c8a873b59..2af78a7d4de 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -30,7 +30,7 @@ var swarm = require("swarm-js"); * * @constructor */ -function Bzz(provider) { +function Bzz(provider) {// TODO: have a closer look on the provider detection for Bzz maybe this could be done with the AbstractWeb3Object too. this.givenProvider = Bzz.givenProvider; this.currentProvider = null; this.setProvider(provider); diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index b8a395d5435..ca97a15e1cc 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -28,6 +28,7 @@ var MessageSigner = require('../signers/MessageSigner'); var TransactionConfirmationModel = require('../models/TransactionConfirmationModel'); var TransactionReceiptValidator = require('../validators/TransactionReceiptValidator'); var NewHeadsWatcher = require('../watchers/NewHeadsWatcher'); +var Method = require('../Method'); /** @@ -42,12 +43,13 @@ function MethodPackageFactory() { } * @method createMethod * * @param {Object} provider - * @param {Accounts} coreFactory + * @param {Accounts} accounts * @param {String} rpcMethod * @param {Array} parameters * @param {Array} inputFormatters * @param {Function} outputFormatter * @param {PromiEvent} promiEvent + * @param {SubscriptionPackage} subscriptionPackage * * @returns {Method} */ @@ -58,7 +60,8 @@ MethodPackageFactory.prototype.createMethod = function ( parameters, inputFormatters, outputFormatter, - promiEvent + promiEvent, + subscriptionPackage ) { return new Method( provider, @@ -68,7 +71,7 @@ MethodPackageFactory.prototype.createMethod = function ( inputFormatters, outputFormatter, promiEvent, - this.createTransactionConfirmationWorkflow(provider, coreFactory), + this.createTransactionConfirmationWorkflow(provider, subscriptionPackage), this.createTransactionSigner(), this.createMessageSigner() ); @@ -80,16 +83,16 @@ MethodPackageFactory.prototype.createMethod = function ( * @method createTransactionConfirmationWorkflow * * @param {Object} provider - * @param {CoreFactory} coreFactory + * @param {SubscriptionPackage} subscriptionPackage * * @returns {TransactionConfirmationWorkflow} */ -MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (provider, coreFactory) { +MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (provider, subscriptionPackage) { new TransactionConfirmationWorkflow( provider, this.createTransactionConfirmationModel(), this.createTransactionReceiptValidator(), - this.createNewHeadsWatcher(provider, coreFactory) + this.createNewHeadsWatcher(provider, subscriptionPackage) ); }; @@ -139,10 +142,10 @@ MethodPackageFactory.prototype.createTransactionReceiptValidator = function() { * Returns NewHeadsWatcher object * * @param {Object} provider - * @param {CoreFactory} coreFactory + * @param {SubscriptionPackage} subscriptionPackage * * @returns {NewHeadsWatcher} */ -MethodPackageFactory.prototype.createNewHeadsWatcher = function (provider, coreFactory) { - return new NewHeadsWatcher(provider, coreFactory); +MethodPackageFactory.prototype.createNewHeadsWatcher = function (provider, subscriptionPackage) { + return new NewHeadsWatcher(provider, subscriptionPackage); }; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 371e2cb5527..577406b7562 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -27,6 +27,7 @@ var version = require('./package.json'); var AccountsPackage = require('web3-eth-accounts'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); var PromiEventPackage = require('web3-core-promievent'); +var SubscriptionPackage = require('web3-core-subscription'); module.exports = { version: version, @@ -52,7 +53,8 @@ module.exports = { parameters, inputFormatters, outputFormatters, - PromiEventPackage.create() + PromiEventPackage.create(), + SubscriptionPackage ); } }; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index f21271c9664..6dca33e2619 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -22,12 +22,12 @@ /** * @param {Object} provider - * @param {CoreFactory} coreFactory + * @param {SubscriptionPackage} subscriptionPackage * @constructor */ -function NewHeadsWatcher(provider, coreFactory) { +function NewHeadsWatcher(provider, subscriptionPackage) { this.provider = provider; - this.coreFactory = coreFactory; + this.subscriptionPackage = subscriptionPackage; this.confirmationInterval = null; this.confirmationSubscription = null; this.isPolling = false; @@ -46,7 +46,7 @@ NewHeadsWatcher.prototype.watch = function (transactionHash) { var self = this; try { - this.confirmationSubscription = this.coreFactory.createSubscription( + this.confirmationSubscription = this.subscriptionPackage.create( this.provider, 'newHeads', transactionHash, From 34a32d5ae7263474dc01a7373c4b46e1848c3cf5 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 14 Sep 2018 17:34:37 +0200 Subject: [PATCH 0088/1045] CodeStyle improvements and smaller fixes --- packages/web3-bzz/src/Bzz.js | 2 +- packages/web3-bzz/src/index.js | 6 +++--- packages/web3-core-package/src/AbstractWeb3Object.js | 2 +- packages/web3-eth-accounts/src/index.js | 2 +- packages/web3-eth-contract/src/Contract.js | 4 ++-- packages/web3-eth-personal/src/Personal.js | 2 +- packages/web3-eth/src/Eth.js | 2 ++ packages/web3-eth/src/index.js | 4 +++- packages/web3-net/src/index.js | 2 ++ packages/web3-shh/src/Shh.js | 2 +- packages/web3-shh/src/index.js | 2 +- packages/web3/src/index.js | 4 +++- 12 files changed, 21 insertions(+), 13 deletions(-) diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index 2af78a7d4de..f515f5700a8 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -26,7 +26,7 @@ var _ = require('underscore'); var swarm = require("swarm-js"); /** - * @param {any} provider + * @param {Object} provider * * @constructor */ diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index 106cbae2d01..2ca7b6254a7 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -33,11 +33,11 @@ module.exports = { * * @method create * - * @param {ConnectionModel} connectionModel + * @param {Object} provider * * @returns {Bzz} */ - create: function (connectionModel) { - return new Bzz(connectionModel.provider); + create: function (provider) { + return new Bzz(provider); } }; diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 4ca3dc8c66f..cc5e981dece 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -100,7 +100,7 @@ AbstractWeb3Object.prototype.clearSubscriptions = function() { * @param {Object} extension */ AbstractWeb3Object.prototype.extend = function (extension) { - var namespace = extension.property || null, + var namespace = extension.property || false, extendedObject, self = this; diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 393b4bfd5e0..5e0d4290e1b 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -37,7 +37,7 @@ module.exports = { * * @method create * - * @params {any} provider + * @params {Object} provider * * @returns {Accounts} */ diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index f777f7e044e..791225ead11 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -45,11 +45,11 @@ var abi = require('web3-eth-abi'); /** * Should be called to create new contract instance * - * @method Contract - * @constructor * @param {Array} jsonInterface * @param {String} address * @param {Object} options + * + * @constructor */ var Contract = function Contract(jsonInterface, address, options) { var _this = this, diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index d89d58b1e41..2f56795624d 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -25,7 +25,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * TODO: Add missing documenation for getAccounts, lockAccount, importRawKey and sendTransaction! + * TODO: Add missing documentation for getAccounts, lockAccount, importRawKey and sendTransaction! * * @param {any} provider * @param {ProvidersPackage} providersPackage diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index bd9c178912c..b990a5493a4 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -26,6 +26,7 @@ var _ = require('underscore'); var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** + * @param {Object} provider * @param {Network} net * @param {Contract} contract * @param {Accounts} accounts @@ -42,6 +43,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @constructor */ var Eth = function Eth( + provider, net, contract, accounts, diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 5e447f8c5b7..002fed8ae58 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -47,12 +47,13 @@ module.exports = { * * @method create * - * @param {any} provider + * @param {Object} provider * * @returns {Eth} */ create: function (provider) { return new Eth( + provider, NetPackage.create(provider), ContractPackage.create(provider), AccountsPackage.create(provider), @@ -63,6 +64,7 @@ module.exports = { Utils, formatters, MethodPackage, + ProvidersPackage, new SubscriptionsResolver(provider, formatters, SubscriptionPackage, PromiEventPackage, ProvidersPackage) ); } diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index a3f268111fb..4eac6e28907 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -40,6 +40,8 @@ module.exports = { * @method create * * @param {Object} provider + * + * @returns {Network} */ create: function (provider) { return new Network(provider, ProvidersPackage, MethodPackage, formatters, utils) diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index 0e7729f75b4..aa852d550e7 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -25,7 +25,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {any} provider + * @param {Object} provider * @param {ProvidersPackage} providersPackage * @param {MethodPackage} methodPackage * @param {SubscriptionPackage} subscriptionPackage diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index b76ed61563d..66a74eb2ab9 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -35,7 +35,7 @@ module.exports = { /** * Returns the Shh object. * - * @param {any} provider + * @param {Object} provider * * @method create * diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index cff392b2061..c1f9ae1dd54 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -24,9 +24,11 @@ var ProvidersPackage = require('web3-core-providers'); var EthPackage = require('web3-eth'); +var PersonalPackage = require('web3-eth-personal'); var Utils = require('web3-utils'); var ShhPackage = require('web3-shh'); var BzzPackage = require('web3-bzz'); +var NetworkPackage = require('web3-net'); var version = require('../package.json').version; /** @@ -95,7 +97,7 @@ Web3.modules = { return EthPackage.create(ProvidersPackage.resolve(provider, net)); }, Net: function (provider, net) { - // return this.createConnectionModel(provider, net).getNetworkMethodsAsObject(); + return NetworkPackage.create(ProvidersPackage.resolve(provider, net)); }, Personal: function (provider, net) { return PersonalPackage.create(ProvidersPackage.resolve(provider, net)); From bacf5ec7d1f2490d2765e6ba87aaf4ffb5c5aa23 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 15:28:40 +0200 Subject: [PATCH 0089/1045] POC of method handling with the JS Proxy object --- packages/web3-core-batch/src/Batch.js | 21 +- .../factories/AbstractMethodModelFactory.js | 45 + .../lib/models/AbstractMethodModel.js | 101 ++ .../lib/{ => signer}/AbstractSigner.js | 0 packages/web3-core-method/src/Method.js | 303 +++--- .../src/factories/MethodPackageFactory.js | 22 +- packages/web3-core-method/src/index.js | 4 + .../src/AbstractWeb3Object.js | 42 +- .../lib/adapters/AbstractProviderAdapter.js | 10 +- packages/web3-core-providers/src/index.js | 2 + packages/web3-eth/src/Eth.js | 904 +----------------- .../src/factory/MethodModelFactory.js | 101 ++ .../web3-eth/src/methods/CallMethodModel.js | 50 + .../src/methods/EstimateGasMethodModel.js | 47 + .../src/methods/GetCodeMethodModel.js | 50 + .../src/methods/GetPastLogslMethodModel.js | 47 + .../src/methods/GetStorageAtMethodModel.js | 51 + .../web3-eth/src/methods/SignMethodModel.js | 50 + .../methods/account/GetAccountsMethodModel.js | 47 + .../methods/account/GetBalanceMethodModel.js | 50 + .../src/methods/block/GetBlockMethodModel.js | 58 ++ .../block/GetBlockNumberMethodModel.js | 47 + .../GetBlockTransactionCountMethodModel.js | 55 ++ .../block/GetBlockUncleCountMethodModel.js | 55 ++ .../src/methods/block/GetUncleMethodModel.js | 56 ++ .../network/GetProtocolVersionMethodModel.js | 47 + .../methods/node/GetCoinbaseMethodModel.js | 47 + .../methods/node/GetGasPriceMethodModel.js | 47 + .../methods/node/GetHashrateMethodModel.js | 47 + .../methods/node/GetNodeInfoMethodModel.js | 47 + .../src/methods/node/GetWorkMethodModel.js | 47 + .../src/methods/node/IsMiningMethodModel.js | 47 + .../src/methods/node/IsSyncingMethodModel.js | 47 + .../src/methods/node/SubmitWorkMethodModel.js | 47 + .../GetTransactionCountMethodModel.js | 50 + .../GetTransactionFromBlockMethodModel.js | 56 ++ .../transaction/GetTransactionMethodModel.js | 47 + .../GetTransactionReceiptMethodModel.js | 47 + .../SendSignedTransactionMethodModel.js | 47 + .../transaction/SendTransactionMethodModel.js | 47 + .../transaction/SignTransactionMethodModel.js | 47 + 41 files changed, 1909 insertions(+), 1073 deletions(-) create mode 100644 packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js create mode 100644 packages/web3-core-method/lib/models/AbstractMethodModel.js rename packages/web3-core-method/lib/{ => signer}/AbstractSigner.js (100%) create mode 100644 packages/web3-eth/src/factory/MethodModelFactory.js create mode 100644 packages/web3-eth/src/methods/CallMethodModel.js create mode 100644 packages/web3-eth/src/methods/EstimateGasMethodModel.js create mode 100644 packages/web3-eth/src/methods/GetCodeMethodModel.js create mode 100644 packages/web3-eth/src/methods/GetPastLogslMethodModel.js create mode 100644 packages/web3-eth/src/methods/GetStorageAtMethodModel.js create mode 100644 packages/web3-eth/src/methods/SignMethodModel.js create mode 100644 packages/web3-eth/src/methods/account/GetAccountsMethodModel.js create mode 100644 packages/web3-eth/src/methods/account/GetBalanceMethodModel.js create mode 100644 packages/web3-eth/src/methods/block/GetBlockMethodModel.js create mode 100644 packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js create mode 100644 packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js create mode 100644 packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js create mode 100644 packages/web3-eth/src/methods/block/GetUncleMethodModel.js create mode 100644 packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js create mode 100644 packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js create mode 100644 packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js create mode 100644 packages/web3-eth/src/methods/node/GetHashrateMethodModel.js create mode 100644 packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js create mode 100644 packages/web3-eth/src/methods/node/GetWorkMethodModel.js create mode 100644 packages/web3-eth/src/methods/node/IsMiningMethodModel.js create mode 100644 packages/web3-eth/src/methods/node/IsSyncingMethodModel.js create mode 100644 packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js create mode 100644 packages/web3-eth/src/methods/transaction/GetTransactionCountMethodModel.js create mode 100644 packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js create mode 100644 packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js create mode 100644 packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js create mode 100644 packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js create mode 100644 packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js create mode 100644 packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js diff --git a/packages/web3-core-batch/src/Batch.js b/packages/web3-core-batch/src/Batch.js index 7bb3505b60a..78479722670 100644 --- a/packages/web3-core-batch/src/Batch.js +++ b/packages/web3-core-batch/src/Batch.js @@ -22,13 +22,20 @@ "use strict"; -var JSONRpcResponseValidator = require('web3-provider').JSONRpcResponseValidator; var errors = require('web3-core-helpers').errors; -var Batch = function (provider) { +/** + * + * @param {AbstractProviderAdapter} provider + * @param {JSONRpcMapper} jsonRpcMapper + * + * @constructor + */ +function Batch(provider, jsonRpcMapper) { this.provider = provider; + this.jsonRpcMapper = jsonRpcMapper; this.requests = []; -}; +} /** * Should be called to add create new request to batch request @@ -46,9 +53,13 @@ Batch.prototype.add = function (request) { * * @method execute */ -Batch.prototype.execute = function () {// TODO: refactore because of new method package +Batch.prototype.execute = function () { var requests = this.requests; - this.provider.sendBatch(requests, function (err, results) { + + var payload = this.jsonRpcMapper.toBatchPayload(this.requests); + var request = this.requests[0] + request.method().apply(request.arguments); + this.provider.send(payload, function (err, results) { results = results || []; requests.map(function (request, index) { return results[index] || {}; diff --git a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js new file mode 100644 index 00000000000..6f64a00bf68 --- /dev/null +++ b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js @@ -0,0 +1,45 @@ +/* + 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 . + */ +/** + * @file AbstractMethodModelFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function AbstractMethodModelFactory(formatters, accounts) { + this.formatters = formatters; + this.accounts = accounts; + this.methodModels = {}; +} + +AbstractMethodModelFactory.prototype.hasMethodModel = function (name) { + return typeof this.methodModels[name] !== 'undefined'; +}; + +AbstractMethodModelFactory.prototype.createMethodModel = function (name) { + return new this.methodModels[name](this.formatters, this.accounts); +}; + +module.exports = AbstractMethodModelFactory; diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js new file mode 100644 index 00000000000..d899716b532 --- /dev/null +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -0,0 +1,101 @@ +/* + 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 . + */ +/** + * @file AbstractMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {String|Function} rpcMethod + * @param {Number} parametersAmount + * @param {Array} inputFormatters + * @param {Function} outputFormatter + * + * @constructor + */ +function AbstractMethodModel(rpcMethod, parametersAmount, inputFormatters, outputFormatter) { + this.rpcMethod = rpcMethod; + this.parametersAmount = parametersAmount; + this.inputFormatters = inputFormatters; + this.outputFormatter = outputFormatter; +} + +/** + * Returns the given function arguments and the current model + * + * @method request + * + * @returns {Object} + */ +AbstractMethodModel.prototype.request = function () { + return { + methodModel: this, + parameters: arguments + } +}; + +/** + * Determines if the JSON-RPC method is sign. + * + * @method isSign + * + * @returns {boolean} + */ +AbstractMethodModel.prototype.isSign = function () { + return this.rpcMethod === 'eth_sign'; +}; + +/** + * Determines if the JSON-RPC method is sendTransaction + * + * @method isSendTransaction + * + * @returns {boolean} + */ +AbstractMethodModel.prototype.isSendTransaction = function () { + return this.rpcMethod === 'eth_sendTransaction'; +}; + +/** + * Determines if the JSON-RPC method is sendRawTransaction + * + * @method isSendRawTransaction + * + * @returns {boolean} + */ +AbstractMethodModel.prototype.isSendRawTransaction = function () { + return this.rpcMethod === 'eth_sendRawTransaction'; +}; + +/** + * Checks if the given parameter is of type hash + * + * @method isHash + * + * @param {any} parameter + * + * @returns {boolean} + */ +AbstractMethodModel.prototype.isHash = function (parameter) { + return _.isString(parameter) && parameter.indexOf('0x') === 0 +}; + + +module.exports = AbstractMethodModel; diff --git a/packages/web3-core-method/lib/AbstractSigner.js b/packages/web3-core-method/lib/signer/AbstractSigner.js similarity index 100% rename from packages/web3-core-method/lib/AbstractSigner.js rename to packages/web3-core-method/lib/signer/AbstractSigner.js diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/Method.js index ccea14dd64b..1907eb286ed 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/Method.js @@ -16,7 +16,7 @@ */ /** - * @file Method.js + * @file MethodService.js * @author Samuel Furter * @date 2018 */ @@ -26,85 +26,114 @@ var _ = require('underscore'); /** - * @param {Object} provider - * @param {Accounts} accounts - * @param {String} rpcMethod - * @param {Array} parameters - * @param {Array} inputFormatters - * @param {Function} outputFormatter - * @param {PromiEvent} promiEvent + * @param {PromiEvent} promiEventPackage * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow * @param {TransactionSigner} transactionSigner * @param {MessageSigner} messageSigner * * @constructor */ -function Method( - provider, - accounts, - rpcMethod, - parameters, - inputFormatters, - outputFormatter, - promiEvent, +function MethodService( + promiEventPackage, transactionConfirmationWorkflow, transactionSigner, messageSigner ) { - this.provider = provider; - this.accounts = accounts; - this.rpcMethod = rpcMethod; - this.parameters = parameters; - this.inputFormatters = inputFormatters; - this.outputFormatter = outputFormatter; - this.promiEvent = promiEvent; + this.promiEventPackage = promiEventPackage; this.transactionConfirmationWorkflow = transactionConfirmationWorkflow; this.transactionSigner = transactionSigner; this.messageSigner = messageSigner; } +/** + * Executes the given method + * + * @method execute + * + * @returns {Promise|eventifiedPromise|String|boolean} + */ +MethodService.prototype.execute = function () { + var mappedFunctionArguments = this.mapFunctionArguments(arguments); + + return this.send( + arguments[0], + arguments[1], + arguments[2], + mappedFunctionArguments.parameters, + mappedFunctionArguments.callback + ); +}; + /** * Sends the JSON-RPC request * * @method send * - * @param {Function} callback - * * @callback callback callback(error, result) * @returns {Promise | eventifiedPromise | String | boolean} */ -Method.prototype.send = function (callback) { +MethodService.prototype.send = function (methodModel, provider, accounts, parameters, callback) { var self = this; + var promiEvent = this.promiEventPackage.createPromiEvent(); - if (this.hasWallets()) { - if (this.isSign(this.rpcMethod)) { - return this.messageSigner.sign(this.parameters[0], this.parameters[1]); + if (accounts.wallet.length > 0) { + if (this.methodModel.isSign()) { + return this.messageSigner.sign(parameters[0], parameters[1], accounts); } - if (this.isSendTransaction(this.rpcMethod)) { - this.rpcMethod = 'eth_sendRawTransaction'; - this.parameters = [this.transactionSigner.sign(this.parameters[0]).rawTransaction]; - return this.sendTransaction(null, callback); + if (this.methodModel.isSendTransaction()) { + this.methodModel.rpcMethod = 'eth_sendRawTransaction'; + return this.sendTransaction( + promiEvent, + [this.transactionSigner.sign(parameters[0], accounts).rawTransaction], + null, + callback + ); } } - if (this.isSendTransaction(this.rpcMethod) || this.isSendRawTransaction(this.rpcMethod)) { + if (this.methodModel.isSendTransaction() || this.methodModel.isSendRawTransaction()) { if (this.isGasPriceDefined()) { - return this.sendTransaction(null, callback); + return this.sendTransaction( + provider, + promiEvent, + methodModel, + parameters, + null, + callback + ); } this.getGasPrice().then(function (gasPrice) { - self.sendTransaction(gasPrice, callback) + self.sendTransaction( + provider, + promiEvent, + methodModel, + parameters, + gasPrice, + callback + ) }); - return this.promiEvent; + return promiEvent; } - if (this.isSign(this.rpcMethod)) { - return this.messageSigner.sign(this.parameters[0], this.parameters[1]); + if (this.methodModel.isSign()) { + return this.messageSigner.sign(parameters[0], parameters[1], accounts); } - return this.call(callback); + return this.call(provider, methodModel, parameters, callback); +}; + +/** + * Determines if gasPrice is defined in the method options + * + * @method isGasPriceDefined + * + * @returns {boolean} + */ +MethodService.prototype.isGasPriceDefined = function () { + return _.isObject(this.parameters[0]) && typeof this.parameters[0].gasPrice !== 'undefined'; }; /** @@ -112,100 +141,101 @@ Method.prototype.send = function (callback) { * * @method call * + * @param {AbstractProviderAdapter} provider + * @param {AbstractMethodModel} methodModel + * @param {Array} parameters * @param {Function} callback * * @callback callback callback(error, result) * @returns {Promise} */ -Method.prototype.call = function (callback) { +MethodService.prototype.call = function (provider, methodModel, parameters, callback) { var self = this; - return this.provider.send(this.rpcMethod, this.formatInput(this.parameters)).then(function (response) { - return self.formatOutput(response, callback) + + return provider.send( + methodModel.rpcMethod, + this.formatInput(parameters, methodModel.inputFormatters) + ).then(function (response) { + return self.formatOutput(response, methodModel.outputFormatter, callback) }); }; - /** - * Formats the output of an JSON-RPC call request + * Returns the mapped function arguments * - * @method formatOutput + * @method mapFunctionArguments * - * @param {Array | String} response - * @param {Function} callback + * @param {IArguments} args * - * @callback callback callback(error, result) - * @returns {Array | String} + * @returns {Object} */ -Method.prototype.formatOutput = function (response, callback) { - var self = this; - - if (_.isArray(response)) { - response = response.map(function (responseItem) { - if (self.outputFormatter && responseItem) { - return self.outputFormatter(responseItem); - } +MethodService.prototype.mapFunctionArguments = function (args) { + var parameters = args; + var callback = null; - return responseItem; - }); - - callback(false, response); - - return response; + if (arguments.length < this.parametersAmount) { + throw new Error( + 'Arguments length is not correct: expected: ' + this.parametersAmount + ', given: ' + arguments.length + ); } - if (self.outputFormatter && result) { - response = self.outputFormatter(response); + if (arguments.length > this.parametersAmount) { + callback = arguments.slice(-1); + if(!_.isFunction(callback)) { + throw new Error( + 'The latest parameter should be a function otherwise it can not be used as callback' + ); + } + parameters = arguments.slice(0, -1); } - callback(false, response); - - return response; + return { + callback: callback, + parameters: parameters + } }; + /** * Sends the JSON-RPC sendTransaction request * * @method sendTransaction * + * @param {AbstractProviderAdapter} provider + * @param {PromiEvent} promiEvent + * @param {AbstractMethodModel} methodModel + * @param {Array} parameters * @param {String} gasPrice * @param {Function} callback * * @callback callback callback(error, result) * @returns {eventifiedPromise} */ -Method.prototype.sendTransaction = function (gasPrice, callback) { +MethodService.prototype.sendTransaction = function (provider, promiEvent, methodModel, parameters, gasPrice, callback) { var self = this; - if (gasPrice && _.isObject(this.parameters[0])) { - this.parameters.gasPrice = gasPrice; + if (gasPrice && _.isObject(parameters[0])) { + parameters[0].gasPrice = gasPrice; } - this.provider.send(this.rpcMethod, this.formatInput(this.parameters)).then(function (response) { + provider.send( + methodModel.rpcMethod, + this.formatInput(parameters, methodModel.inputFormatters) + ).then(function (response) { self.transactionConfirmationWorkflow.execute( response, - self.promiEvent, + promiEvent, callback ); - self.promiEvent.eventEmitter.emit('transactionHash', response) + promiEvent.eventEmitter.emit('transactionHash', response) }).catch(function (error) { - self.promiEvent.reject(error); - self.promiEvent.on('error', error); - self.promiEvent.eventEmitter.removeAllListeners(); + promiEvent.reject(error); + promiEvent.on('error', error); + promiEvent.eventEmitter.removeAllListeners(); }); - return this.promiEvent; -}; - -/** - * Should be called to get the request which can be used in a batch request - * - * @method request - * - * @returns {Function} - */ -Method.prototype.request = function () { - return this.send.bind(this); + return promiEvent; }; /** @@ -214,85 +244,50 @@ Method.prototype.request = function () { * @method formatInput * * @param {Array} parameters + * @param {Array} inputFormatters * * @returns {Array} */ -Method.prototype.formatInput = function (parameters) { - return this.inputFormatters.map(function (formatter, key) { +MethodService.prototype.formatInput = function (parameters, inputFormatters) { + return inputFormatters.map(function (formatter, key) { return formatter ? formatter(parameters[key]) : parameters[key]; }); }; /** - * Gets the gasPrice with the eth_gasPrice RPC call. - * - * @method getGasPrice - * - * @returns {Promise} - */ -Method.prototype.getGasPrice = function () { - return this.provider.send('eth_gasPrice', []); -}; - -/** - * Determines if the JSON-RPC method is sendTransaction + * Formats the output of an JSON-RPC call request * - * @method isSendTransaction + * @method formatOutput * - * @param {String} rpcMethod + * @param {Function|null} outputFormatter + * @param {Array | String} response + * @param {Function} callback * - * @returns {boolean} + * @callback callback callback(error, result) + * @returns {Array | String} */ -Method.prototype.isSendTransaction = function (rpcMethod) { - return rpcMethod === 'eth_sendTransaction'; -}; +MethodService.prototype.formatOutput = function (outputFormatter, response, callback) { + if (_.isArray(response)) { + response = response.map(function (responseItem) { + if (outputFormatter && responseItem) { + return outputFormatter(responseItem); + } -/** - * Determines if the JSON-RPC method is sendRawTransaction - * - * @method isSendRawTransaction - * - * @param {String} rpcMethod - * - * @returns {boolean} - */ -Method.prototype.isSendRawTransaction = function (rpcMethod) { - return rpcMethod === 'eth_sendRawTransaction'; -}; + return responseItem; + }); -/** - * Determines if the JSON-RPC method is sign. - * - * @method isSign - * - * @param {String} rpcMethod - * - * @returns {boolean} - */ -Method.prototype.isSign = function (rpcMethod) { - return rpcMethod === 'eth_sign'; -}; + callback(false, response); -/** - * Determines if gasPrice is defined in the method options - * - * @method isGasPriceDefined - * - * @returns {boolean} - */ -Method.prototype.isGasPriceDefined = function () { - return _.isObject(this.parameters[0]) && typeof this.parameters[0].gasPrice !== 'undefined'; -}; + return response; + } -/** - * Check if wallets are defined in the accounts package - * - * @method hasWallets - * - * @returns {boolean} - */ -Method.prototype.hasWallets = function() { - return this.accounts.wallet.length > 0; + if (outputFormatter && result) { + response = outputFormatter(response); + } + + callback(false, response); + + return response; }; -module.exports = Method; +module.exports = MethodService; diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index ca97a15e1cc..8cb56df49c8 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -88,12 +88,12 @@ MethodPackageFactory.prototype.createMethod = function ( * @returns {TransactionConfirmationWorkflow} */ MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (provider, subscriptionPackage) { - new TransactionConfirmationWorkflow( - provider, - this.createTransactionConfirmationModel(), - this.createTransactionReceiptValidator(), - this.createNewHeadsWatcher(provider, subscriptionPackage) - ); + new TransactionConfirmationWorkflow( + provider, + this.createTransactionConfirmationModel(), + this.createTransactionReceiptValidator(), + this.createNewHeadsWatcher(provider, subscriptionPackage) + ); }; /** @@ -104,7 +104,7 @@ MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function * @returns {TransactionSigner} */ MethodPackageFactory.prototype.createTransactionSigner = function () { - return new TransactionSigner(); + return new TransactionSigner(); }; /** @@ -115,7 +115,7 @@ MethodPackageFactory.prototype.createTransactionSigner = function () { * @returns {MessageSigner} */ MethodPackageFactory.prototype.createMessageSigner = function () { - new MessageSigner(); + return new MessageSigner(); }; /** @@ -125,7 +125,7 @@ MethodPackageFactory.prototype.createMessageSigner = function () { * * @returns {TransactionConfirmationModel} */ -MethodPackageFactory.prototype.createTransactionConfirmationModel = function() { +MethodPackageFactory.prototype.createTransactionConfirmationModel = function () { return new TransactionConfirmationModel() }; @@ -134,7 +134,7 @@ MethodPackageFactory.prototype.createTransactionConfirmationModel = function() { * * @returns {TransactionReceiptValidator} */ -MethodPackageFactory.prototype.createTransactionReceiptValidator = function() { +MethodPackageFactory.prototype.createTransactionReceiptValidator = function () { return new TransactionReceiptValidator(); }; @@ -147,5 +147,5 @@ MethodPackageFactory.prototype.createTransactionReceiptValidator = function() { * @returns {NewHeadsWatcher} */ MethodPackageFactory.prototype.createNewHeadsWatcher = function (provider, subscriptionPackage) { - return new NewHeadsWatcher(provider, subscriptionPackage); + return new NewHeadsWatcher(provider, subscriptionPackage); }; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 577406b7562..6d296a1fc9b 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -26,11 +26,15 @@ var version = require('./package.json'); var AccountsPackage = require('web3-eth-accounts'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); +var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); +var AbstractMethodModel = require('../lib/models/AbstractMethodModel'); var PromiEventPackage = require('web3-core-promievent'); var SubscriptionPackage = require('web3-core-subscription'); module.exports = { version: version, + AbstractMethodModelFactory: AbstractMethodModelFactory, + AbstractMethodModel: AbstractMethodModel, /** * Creates the Method object diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index cc5e981dece..35ab7dd42f9 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -25,13 +25,26 @@ /** * @param {Object} provider * @param {ProvidersPackage} providersPackage - * @param {MethodPackage} methodPackage + * @param {Accounts} accounts + * @param {MethodService} methodService + * @param {MethodModelFactory} methodModelFactory * @param {SubscriptionPackage} subscriptionPackage * @param {BatchRequest} batchRequest * * @constructor */ -function AbstractWeb3Object(provider, providersPackage, methodPackage, subscriptionPackage, batchRequest) { +function AbstractWeb3Object( + provider, + providersPackage, + accounts, + methodService, + methodModelFactory, + subscriptionPackage, + batchRequest +) { + this.methodModelFactory = methodModelFactory; + this.methodService = methodService; + this.accounts = accounts; this.providersPackage = providersPackage; this._provider = this.providersPackage.resolve(provider); this.givenProvider = this.providersPackage.detect(); @@ -68,6 +81,11 @@ function AbstractWeb3Object(provider, providersPackage, methodPackage, subscript enumerable: true }); + return new Proxy(this, + { + get: this.proxyHandler + } + ) } /** @@ -133,4 +151,24 @@ AbstractWeb3Object.prototype.extend = function (extension) { } }; +AbstractWeb3Object.prototype.proxyHandler = function(target, name) { + if (target.methodModelFactory.hasMethodModel(name)) { + var methodModel = target.methodModelFactory.createMethodModel(name); + + var anonymousFunction = function() { + var methodArguments = [methodModel, target.currentProvider, target.accounts].concat(arguments); + + return target.methodService.execute().apply(methodArguments); + }; + + anonymousFunction.methodModel = methodModel; + anonymousFunction.request = methodModel.request; + + return anonymousFunction; + } + + return target[name]; +}; + + module.exports = AbstractWeb3Object; diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js index 9bb7795d3f8..b8e81aff82b 100644 --- a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js @@ -49,8 +49,8 @@ AbstractProviderAdapter.prototype.send = function (method, parameters) { var self = this; var payload = JSONRpcMapper.toPayload(method, parameters); - return new Promise(function(resolve, reject) { - self.provider.send(payload, function(error, response) { + return new Promise(function (resolve, reject) { + self.provider.send(payload, function (error, response) { self.handleResponse(reject, resolve, error, response) }); @@ -70,7 +70,7 @@ AbstractProviderAdapter.prototype.send = function (method, parameters) { AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, error, response) { if (response && response.id && payload.id !== response.id) { reject( - new Error('Wrong response id "'+ response.id +'" (expected: "'+ payload.id +'") in '+ JSON.stringify(payload)) + new Error('Wrong response id "' + response.id + '" (expected: "' + payload.id + '") in ' + JSON.stringify(payload)) ); return; @@ -83,13 +83,13 @@ AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, er } - if(!JSONRpcResponseValidator.isValid(response.result)) { + if (!JSONRpcResponseValidator.isValid(response.result)) { reject(errors.InvalidResponse(response)); return; } - if(!error) { + if (!error) { resolve(response.result); return; diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index 8b1d8fcd9a0..b7708e28aa0 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -25,12 +25,14 @@ var ProvidersPackageFactory = require('./factories/ProvidersPackageFactory'); var HttpProvider = require('./providers/HttpProvider'); var IpcProvider = require('./providers/IpcProvider'); var WebsocketProvider = require('./providers/WebsocketProvider'); +var JSONRpcMapper = require('../lib/mappers/JSONRpcMapper'); module.exports = { version: version, HttpProvider: HttpProvider, IpcProvider: IpcProvider, WebsocketProvider: WebsocketProvider, + JSONRpcMapper: JSONRpcMapper, /** * Resolves the right provider adapter by the given parameters diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index b990a5493a4..f12e98649b2 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -57,7 +57,7 @@ var Eth = function Eth( providersPackage, subscriptionsResolver ) { - AbstractWeb3Object.call(provider, providersPackage, methodPackage); + AbstractWeb3Object.call(this, provider, providersPackage, methodPackage); this.net = net; this.Contract = contract; this.accounts = accounts; @@ -68,20 +68,20 @@ var Eth = function Eth( this.utils = utils; this.formatters = formatters; this.subscriptionsResolver = subscriptionsResolver; - this.methodPackage = methodPackage; - this._defaultAccount = null; - this._defaultBlock = 'latest'; + + var defaultAccount = null; + var defaultBlock = 'latest'; /** * Defines accessors for defaultAccount */ Object.defineProperty(this, 'defaultAccount', { get: function () { - return this._defaultAccount; + return defaultAccount; }, set: function (val) { if (val) { - this._defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); + defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); } }, enumerable: true @@ -92,10 +92,10 @@ var Eth = function Eth( */ Object.defineProperty(this, 'defaultBlock', { get: function () { - return this._defaultBlock; + return defaultBlock; }, set: function (val) { - this._defaultBlock = val; + defaultBlock = val; }, enumerable: true }); @@ -117,894 +117,6 @@ Eth.prototype.subscribe = function (type, parameters, callback) { return this.subscriptionsResolver.resolve(type, parameters, callback); }; -/** - * Sends the JSON-RPC request web3_clientVersion and gets the node information - * - * @method getNodeInfo - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getNodeInfo = function (callback) { - return this.methodPackage.create(this.currentProvider, 'web3_clientVersion', [], null, null).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_protocolVersion and gets the protocol version. - * - * @method getProtocolVersion - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getProtocolVersion = function (callback) { - return this.methodPackage.create(this.currentProvider, 'eth_protocolVersion', [], null, null).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_coinbase and gets the coinbase - * - * @method getCoinbase - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getCoinbase = function (callback) { - return this.methodPackage.create(this.currentProvider, 'eth_coinbase', [], null, null).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_mining and checks if the node is mining - * - * @method isMining - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.isMining = function (callback) { - return this.methodPackage.create(this.currentProvider, 'eth_mining', [], null, null).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_hashrate and returns the current hashrate - * - * @method getHashrate - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getHashrate = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_hashrate', - [], - null, - this.utils.hexToNumber - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_syncing and checks if the node is syncing - * - * @method isSyncing - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.isSyncing = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_syncing', - [], - null, - this.formatters.outputSyncingFormatter - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_gasPrice and returns the current gasPrice from this node - * - * @method getGasPrice - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getGasPrice = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_gasPrice', - [], - null, - this.formatters.outputBigNumberFormatter - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_accounts and returns a list of addresses owned by client. - * - * @method getAccounts - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getAccounts = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_accounts', - [], - null, - this.utils.toChecksumAddress - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_blockNumber and returns the current block number. - * - * @method getBlockNumber - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlockNumber = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_blockNumber', - [], - null, - this.utils.hexToNumber - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getBalance and returns the balance of an address - * - * @method getBalance - * - * @param {String} address - * @param {Number} block - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBalance = function (address, block, callback) { - if (!block) { - block = this.defaultBlock; - } - - return this.methodPackage.create( - this.currentProvider, - 'eth_getBalance', - [address, block], - [ - this.formatters.inputAddressFormatter, - this.formatters.inputDefaultBlockNumberFormatter - ], - this.formatters.outputBigNumberFormatter - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getStorageAt and returns the value from a storage position at a given address - * - * @method getStorageAt - * - * @param {String} address - * @param {Number} position - * @param {Number} block - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getStorageAt = function (address, position, block, callback) { - if (!block) { - block = this.defaultBlock; - } - - return this.methodPackage.create( - this.currentProvider, - 'eth_getStorageAt', - [address, position, block], - [ - this.formatters.inputAddressFormatter, - this.utils.numberToHex, - this.formatters.inputDefaultBlockNumberFormatter - ], - null - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getCode and returns the code of a contract at a given address - * - * @method getCode - * - * @param {String} address - * @param {Number} block - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getCode = function (address, block, callback) { - if (!block) { - block = this.defaultBlock; - } - - return this.methodPackage.create( - this.currentProvider, - 'eth_getCode', - [address, block], - [ - this.formatters.inputAddressFormatter, - this.formatters.inputDefaultBlockNumberFormatter - ], - null - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getBlockByNumber and returns a block by his number. - * - * @method getBlockByNumber - * - * @param {Number} blockNumber - * @param {boolean} returnTransactionObjects - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getBlockByNumber', - [blockNumber, returnTransactionObjects], - [ - this.formatters.inputBlockNumberFormatter, - function (val) { - return !!val; - } - ], - this.formatters.outputBlockFormatter - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getBlockByHash and return a block by his hash. - * - * @method getBlockByHash - * - * @param {String} blockHash - * @param {boolean} returnTransactionObjects - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlockByHash = function (blockHash, returnTransactionObjects, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getBlockByHash', - [blockHash, returnTransactionObjects], - [ - this.formatters.inputBlockNumberFormatter, - function (val) { - return !!val; - } - ], - this.formatters.outputBlockFormatter - ).send(callback); -}; - -/** - * Gets block by hash or number. - * - * TODO: Define this method as deprecated - * - * @method getBlock - * - * @param {String|Number} blockHashOrBlockNumber - * @param {boolean} returnTransactionObjects - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlock = function (blockHashOrBlockNumber, returnTransactionObjects, callback) { - if (this.isBlockHash(blockHashOrBlockNumber)) { - return this.getBlockByHash(returnTransactionObjects, callback); - } - - return this.getBlockByNumber(blockHashOrBlockNumber, returnTransactionObjects, callback); -}; - -/** - * Gets uncle by hash or number. - * - * TODO: Define this method as deprecated - * - * @method getUncle - * - * @param {String|Number} blockHashOrBlockNumber - * @param {Number} uncleIndex - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getUncle = function (blockHashOrBlockNumber, uncleIndex, callback) { - if (this.isBlockHash(blockHashOrBlockNumber)) { - return this.getUnlceByBlockHash(blockHashOrBlockNumber, uncleIndex, callback); - } - - return this.getUncleByBlockNumber(blockHashOrBlockNumber, uncleIndex, callback); -}; - -/** - * Sends the JSON-RPC request eth_getUncleByBlockNumberAndIndex and returns the uncle block by his number and index - * - * @method getUncleByBlockNumber - * - * @param {Number} blockNumber - * @param {Number} uncleIndex - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getUncleByBlockNumber = function (blockNumber, uncleIndex, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getUncleByBlockNumberAndIndex', - [blockNumber, uncleIndex], - [ - this.formatters.inputBlockNumberFormatter, - this.utils.numberToHex - ], - this.formatters.outputBlockFormatter - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getUncleByBlockHashAndIndex and returns the uncle block by his hash and index - * - * @method getUnlceByBlockHash - * - * @param {String} blockHash - * @param {Number} uncleIndex - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getUnlceByBlockHash = function (blockHash, uncleIndex, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getUncleByBlockHashAndIndex', - [blockHash, uncleIndex], - [ - this.formatters.inputBlockNumberFormatter, - this.utils.numberToHex - ], - this.formatters.outputBlockFormatter - ).send(callback); -}; - -/** - * Gets block transaction count by hash or number. - * - * TODO: Define this method as deprecated - * - * @method getBlockTransactionCount - * - * @param {String|Number} blockHashOrBlockNumber - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlockTransactionCount = function (blockHashOrBlockNumber, callback) { - if (this.isBlockHash(blockHashOrBlockNumber)) { - return this.getBlockTransactionCountByBlockHash(blockHashOrBlockNumber, callback); - } - - return this.getBlockTransactionCountByBlockNumber(blockHashOrBlockNumber, callback); -}; - -/** - * Sends the JSON-RPC request eth_getBlockTransactionCountByNumber and returns the block transaction count - * from a block by his number - * - * @method getBlockTransactionCountByBlockNumber - * - * @param {Number} blockNumber - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlockTransactionCountByBlockNumber = function (blockNumber, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getBlockTransactionCountByNumber', - [blockNumber], - [ - this.formatters.inputBlockNumberFormatter - ], - this.utils.hexToNumber - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getBlockTransactionCountByHash and returns the block transaction count - * from a block by his hash - * - * @method getBlockTransactionCountByBlockHash - * - * @param {String} blockHash - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlockTransactionCountByBlockHash = function (blockHash, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getBlockTransactionCountByHash', - [blockNumber], - [ - this.formatters.inputBlockNumberFormatter - ], - this.utils.hexToNumber - ).send(callback); -}; - -/** - * Gets block transaction count by hash or number. - * - * TODO: Define this method as deprecated - * - * @method getBlockUncleCount - * - * @param {String|number} blockHashOrBlockNumber - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlockUncleCount = function (blockHashOrBlockNumber, callback) { - if (this.isBlockHash(blockHashOrBlockNumber)) { - return this.getBlockUncleCountByBlockHash(blockHashOrBlockNumber, callback); - } - - return this.getBlockUncleCountByBlockNumber(blockHashOrBlockNumber, callback); -}; - -/** - * Sends the JSON-RPC request eth_getUncleCountByBlockHash and returns the uncle count of a block by his hash - * - * @method getBlockUncleCountByBlockHash - * - * @param {String} blockHash - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlockUncleCountByBlockHash = function (blockHash, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getUncleCountByBlockHash', - [blockHash], - [ - this.formatters.inputBlockNumberFormatter - ], - this.utils.hexToNumber - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getUncleCountByBlockHash and returns the uncle count of a block by his number - * - * @method getBlockUncleCountByBlockNumber - * - * @param {Number} blockNumber - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getBlockUncleCountByBlockNumber = function (blockNumber, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getUncleCountByBlockNumber', - [blockNumber], - [ - this.formatters.inputBlockNumberFormatter - ], - this.utils.hexToNumber - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getTransactionByHash and returns the transaction by his hash - * - * @method getTransaction - * - * @param {String} transactionHash - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getTransaction = function (transactionHash, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getTransactionByHash', - [transactionHash], - null, - this.formatters.outputTransactionFormatter - ).send(callback); -}; - -/** - * Gets transaction from block hash or number and index. - * - * TODO: Define this method as deprecated - * - * @method getTransactionFromBlock - * - * @param {String|Number} hashStringOrNumber - * @param {Number} indexNumber - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getTransactionFromBlock = function (hashStringOrNumber, indexNumber, callback) { - if (this.isBlockHash(hashStringOrNumber)) { - return this.getTransactionFromBlockByBlockHash(hashStringOrNumber, indexNumber, callback); - } - return this.getTransactionFromBlockByBlockNumber(hashStringOrNumber, indexNumber, callback); -}; - -/** - * Sends the JSON-RPC request eth_getTransactionByBlockHashAndIndex and returns a transaction - * by his index from a block with the block hash. - * - * @method getTransactionFromBlockByBlockHash - * - * @param {String} transactionHash - * @param {Number} indexNumber - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getTransactionFromBlockByBlockHash = function (transactionHash, indexNumber, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getTransactionByBlockHashAndIndex', - [transactionHash, indexNumber], - [ - this.formatters.inputBlockNumberFormatter, - this.utils.numberToHex - ], - this.formatters.outputTransactionFormatter - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getTransactionByBlockHashAndIndex and returns a transaction - * by his index from a block with the block number. - * - * @method getTransactionFromBlockByBlockNumber - * - * @param {Number} blockNumber - * @param {Number} indexNumber - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getTransactionFromBlockByBlockNumber = function (blockNumber, indexNumber, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getTransactionByBlockNumberAndIndex', - [blockNumber, indexNumber], - [ - this.formatters.inputBlockNumberFormatter, - this.utils.numberToHex - ], - this.formatters.outputTransactionFormatter - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getTransactionReceipt and returns the transaction receipt by his transaction hash - * - * @method getTransactionReceipt - * - * @param {String} transactionHash - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getTransactionReceipt = function (transactionHash, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getTransactionReceipt', - [transactionHash], - null, - this.formatters.outputTransactionReceiptFormatter - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getTransactionCount and returns the transaction count of an address - * - * @method getTransactionCount - * - * @param {String} address - * @param {Number} block - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getTransactionCount = function (address, block, callback) { - if (!block) { - block = this.defaultBlock; - } - - return this.methodPackage.create( - this.currentProvider, - 'eth_getTransactionCount', - [address, block], - [ - this.formatters.inputAddressFormatter, - this.formatters.inputDefaultBlockNumberFormatter - ], - this.utils.hexToNumber - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_sendRawTransaction and returns the transaction hash - * - * @method sendSignedTransaction - * - * @param {String} signedTransactionData - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.sendSignedTransaction = function (signedTransactionData, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_sendRawTransaction', - [signedTransactionData], - null, - null - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_signTransaction and returns the signed transaction - * - * @method signTransaction - * - * @param {Object} transactionObject - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.signTransaction = function (transactionObject, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_signTransaction', - [transactionObject], - [this.formatters.inputTransactionFormatter], - null - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_sendTransaction and returns the transaction hash - * - * @method sendTransaction - * - * @param {Object} transactionObject - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.sendTransaction = function (transactionObject, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_sendTransaction', - [transactionObject], - [this.formatters.inputTransactionFormatter], - null - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_sign and returns the signed data - * - * @method sign - * - * @param {String} dataToSign - * @param {String} address - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.sign = function (dataToSign, address, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_sign', - [address, dataToSign], - [ - this.formatters.inputSignFormatter, - this.formatters.inputAddressFormatter - ], - null - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_call and returns the return value of the executed contract - * - * @method call - * - * @param {Object} callObject - * @param {Number|String} block - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.call = function (callObject, block, callback) { - if (!block) { - block = this.defaultBlock; - } - - return this.methodPackage.create( - this.currentProvider, - 'eth_call', - [callObject, block], - [ - this.formatters.inputCallFormatter, - this.formatters.inputDefaultBlockNumberFormatter - ], - null - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_estimateGas and returns the estimated gas - * - * @method estimateGas - * - * @param {Object} callObject - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.estimateGas = function (callObject, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_estimateGas', - [callObject], - [this.formatters.inputCallFormatter], - this.utils.hexToNumber - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_submitWork and returns the validation result - * - * @method submitWork - * - * @param {String} nonce - * @param {String} powHash - * @param {String} digest - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.submitWork = function (nonce, powHash, digest, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_submitWork', - [nonce, powHash, digest], - null, - null - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getWork and returns the hash of the current block, the seedHash, and the - * boundary condition to be met ("target"). - * - * @method getWork - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getWork = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getWork', - [], - null, - null - ).send(callback); -}; - -/** - * Sends the JSON-RPC request eth_getLogs and returns an array of all logs matching a given filter object - * - * @method getPastLogs - * - * @param {Object} options - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Eth.prototype.getPastLogs = function (options, callback) { - return this.methodPackage.create( - this.currentProvider, - 'eth_getLogs', - [], - [this.formatters.inputLogFormatter], - this.formatters.outputLogFormatter - ).send(callback); -}; - -/** - * Determines if given block parameter is of type hash or number - * - * @method isBlockHash - * - * @param {String|Number} blockParameter - * @returns {boolean} - */ -Eth.prototype.isBlockHash = function (blockParameter) { - return _.isString(blockParameter) && blockParameter.indexOf('0x') === 0 -}; - /** * Extends setProvider method from AbstractWeb3Object. * This is required for updating the provider also in the sub packages and objects related to Eth. diff --git a/packages/web3-eth/src/factory/MethodModelFactory.js b/packages/web3-eth/src/factory/MethodModelFactory.js new file mode 100644 index 00000000000..fbc4bc15c5a --- /dev/null +++ b/packages/web3-eth/src/factory/MethodModelFactory.js @@ -0,0 +1,101 @@ +/* + 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 . + */ +/** + * @file MethodModelFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModelFactory = require('web3-core-method').AbstractMethodModelFactory; +var GetNodeInfoMethodModel = require('../methods/GetNodeInfoMethodModel'); +var GetProtocolVersionMethodModel = require('../methods/GetProtocolVersionMethodModel'); +var GetCoinbaseMethodModel = require('../methods/GetCoinbaseMethodModel'); +var IsMiningMethodModel = require('../methods/IsMiningMethodModel'); +var GetHashrateMethodModel = require('../methods/GetHashrateMethodModel'); +var IsSyncingMethodModel = require('../methods/IsSyncingMethodModel'); +var GetGasPriceMethodModel = require('../methods/GetGasPriceMethodModel'); +var GetAccountsMethodModel = require('../methods/GetAccountsMethodModel'); +var GetBlockNumberMethodModel = require('../methods/GetBlockNumberMethodModel'); +var GetBalanceMethodModel = require('../methods/GetBalanceMethodModel'); +var GetStroageAtMethodModel = require('../methods/GetStroageAtMethodModel'); +var GetCodeMethodModel = require('../methods/GetCodeMethodModel'); +var GetBlockMethodModel = require('../methods/GetBlockMethodModel'); +var GetUncleMethodModel = require('../methods/GetUncleMethodModel'); +var GetBlockTransactionCountMethodModel = require('../methods/GetBlockTransactionCountMethodModel'); +var GetBlockUncleCountMethodModel = require('../methods/GetBlockUncleCountMethodModel'); +var GetTransactionMethodModel = require('../methods/GetTransactionMethodModel'); +var GetTransactionFromBlockMethodModel = require('../methods/GetTransactionFromBlockMethodModel'); +var GetTransactionReceipt = require('../methods/GetTransactionReceipt'); +var GetTransactionCountMethodModel = require('../methods/GetTransactionCountMethodModel'); +var SendSignedTransactionMethodModel = require('../methods/SendSignedTransactionMethodModel'); +var SignTransactionMethodModel = require('../methods/SignTransactionMethodModel'); +var SendTransactionMethodModel = require('../methods/SendTransactionMethodModel'); +var SignMethodModel = require('../methods/SignMethodModel'); +var CallMethodModel = require('../methods/CallMethodModel'); +var EstimateGasMethodModel = require('../methods/EstimateGasMethodModel'); +var SubmitWorkMethodModel = require('../methods/SubmitWorkMethodModel'); +var GetWorkMethodModel = require('../methods/GetWorkMethodModel'); +var GetPastLogsMethodModel = require('../methods/GetPastLogsMethodModel'); + +/** + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function MethodModelFactory(formatters, accounts) { + AbstractMethodModelFactory.call(this, formatters, accounts); + + this.methodModels = { + getNodeInfo: GetNodeInfoMethodModel, + getProtocolVersion: GetProtocolVersionMethodModel, + getCoinbase: GetCoinbaseMethodModel, + isMining: IsMiningMethodModel, + getHashrate: GetHashrateMethodModel, + isSyncing: IsSyncingMethodModel, + getGasPrice: GetGasPriceMethodModel, + getAccounts: GetAccountsMethodModel, + getBlockNumber: GetBlockNumberMethodModel, + getBalance: GetBalanceMethodModel, + getStorageAt: GetStroageAtMethodModel, + getCode: GetCodeMethodModel, + getBlock: GetBlockMethodModel, + getUncle: GetUncleMethodModel, + getBlockTransactionCount: GetBlockTransactionCountMethodModel, + getBlockUncleCount: GetBlockUncleCountMethodModel, + getTransaction: GetTransactionMethodModel, + getTransactionFromBlock: GetTransactionFromBlockMethodModel, + getTransactionReceipt: GetTransactionReceipt, + getTransactionCount: GetTransactionCountMethodModel, + sendSignedTransaction: SendSignedTransactionMethodModel, + signTransaction: SignTransactionMethodModel, + sendTransaction: SendTransactionMethodModel, + sign: SignMethodModel, + call: CallMethodModel, + estimateGas: EstimateGasMethodModel, + submitWork: SubmitWorkMethodModel, + getWork: GetWorkMethodModel, + getPastLogs: GetPastLogsMethodModel + }; + +} + +MethodModelFactory.prototype = Object.create(AbstractMethodModelFactory); + +module.exports = MethodModelFactory; diff --git a/packages/web3-eth/src/methods/CallMethodModel.js b/packages/web3-eth/src/methods/CallMethodModel.js new file mode 100644 index 00000000000..fee0c0c3976 --- /dev/null +++ b/packages/web3-eth/src/methods/CallMethodModel.js @@ -0,0 +1,50 @@ +/* + 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 . + */ +/** + * @file CallMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function CallMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_call', + 2, + [ + formatters.inputCallFormatter, + formatters.inputDefaultBlockNumberFormatter + ], + null, + accounts + ) +} + +CallMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = CallMethodModel; diff --git a/packages/web3-eth/src/methods/EstimateGasMethodModel.js b/packages/web3-eth/src/methods/EstimateGasMethodModel.js new file mode 100644 index 00000000000..5db7ed9e5b2 --- /dev/null +++ b/packages/web3-eth/src/methods/EstimateGasMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file EstimateGasMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function EstimateGasMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_estimateGas', + 1, + [formatters.inputCallFormatter], + utils.hexToNumber, + accounts + ) +} + +EstimateGasMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = EstimateGasMethodModel; diff --git a/packages/web3-eth/src/methods/GetCodeMethodModel.js b/packages/web3-eth/src/methods/GetCodeMethodModel.js new file mode 100644 index 00000000000..f89191f5ebc --- /dev/null +++ b/packages/web3-eth/src/methods/GetCodeMethodModel.js @@ -0,0 +1,50 @@ +/* + 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 . + */ +/** + * @file GetCodeMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetCodeMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getCode', + 2, + [ + formatters.inputAddressFormatter, + formatters.inputDefaultBlockNumberFormatter + ], + null, + accounts + ) +} + +GetCodeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetCodeMethodModel; diff --git a/packages/web3-eth/src/methods/GetPastLogslMethodModel.js b/packages/web3-eth/src/methods/GetPastLogslMethodModel.js new file mode 100644 index 00000000000..47e09093697 --- /dev/null +++ b/packages/web3-eth/src/methods/GetPastLogslMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetPastLogsMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetPastLogsMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getLogs', + 1, + [formatters.inputLogFormatter], + formatters.outputLogFormatter, + accounts + ) +} + +GetPastLogsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetPastLogsMethodModel; diff --git a/packages/web3-eth/src/methods/GetStorageAtMethodModel.js b/packages/web3-eth/src/methods/GetStorageAtMethodModel.js new file mode 100644 index 00000000000..701918dfbd3 --- /dev/null +++ b/packages/web3-eth/src/methods/GetStorageAtMethodModel.js @@ -0,0 +1,51 @@ +/* + 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 . + */ +/** + * @file GetStorageAtMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetStorageAtMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getStorageAt', + 3, + [ + formatters.inputAddressFormatter, + utils.numberToHex, + formatters.inputDefaultBlockNumberFormatter + ], + null, + accounts + ) +} + +GetStorageAtMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetStorageAtMethodModel; diff --git a/packages/web3-eth/src/methods/SignMethodModel.js b/packages/web3-eth/src/methods/SignMethodModel.js new file mode 100644 index 00000000000..c7bdd558edb --- /dev/null +++ b/packages/web3-eth/src/methods/SignMethodModel.js @@ -0,0 +1,50 @@ +/* + 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 . + */ +/** + * @file SignMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function SignMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_signTransaction', + 2, + [ + formatters.inputSignFormatter, + formatters.inputAddressFormatter + ], + null, + accounts + ) +} + +SignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = SignMethodModel; diff --git a/packages/web3-eth/src/methods/account/GetAccountsMethodModel.js b/packages/web3-eth/src/methods/account/GetAccountsMethodModel.js new file mode 100644 index 00000000000..f321909c605 --- /dev/null +++ b/packages/web3-eth/src/methods/account/GetAccountsMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetAccountsMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetAccountsMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_accounts', + 0, + null, + utils.toChecksumAddress, + accounts + ) +} + +GetAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetAccountsMethodModel; diff --git a/packages/web3-eth/src/methods/account/GetBalanceMethodModel.js b/packages/web3-eth/src/methods/account/GetBalanceMethodModel.js new file mode 100644 index 00000000000..3ed9319cbe9 --- /dev/null +++ b/packages/web3-eth/src/methods/account/GetBalanceMethodModel.js @@ -0,0 +1,50 @@ +/* + 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 . + */ +/** + * @file GetBalanceMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetBalanceMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getBalance', + 2, + [ + formatters.inputAddressFormatter, + formatters.inputDefaultBlockNumberFormatter + ], + formatters.outputBigNumberFormatter, + accounts + ) +} + +GetBalanceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetBalanceMethodModel; diff --git a/packages/web3-eth/src/methods/block/GetBlockMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockMethodModel.js new file mode 100644 index 00000000000..798947ed737 --- /dev/null +++ b/packages/web3-eth/src/methods/block/GetBlockMethodModel.js @@ -0,0 +1,58 @@ +/* + 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 . + */ +/** + * @file GetBlockMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetBlockMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getBlockByNumber', + 2, + [ + formatters.inputBlockNumberFormatter, + function (val) { + return !!val; + } + ], + formatters.outputBlockFormatter, + accounts + ) +} + +GetBlockMethodModel.prototype.beforeExecute = function (parameters) { + if (this.isHash(parameters[0])) { + this.rpcMethod = 'eth_getBlockByHash'; + } +}; + +GetBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetBlockMethodModel; diff --git a/packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js new file mode 100644 index 00000000000..be8648019a2 --- /dev/null +++ b/packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetBlockNumberMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetBlockNumberMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_blockNumber', + 0, + null, + utils.hexToNumber, + accounts + ) +} + +GetBlockNumberMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetBlockNumberMethodModel; diff --git a/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js new file mode 100644 index 00000000000..a78c50d9ab7 --- /dev/null +++ b/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js @@ -0,0 +1,55 @@ +/* + 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 . + */ +/** + * @file GetBlockTransactionCountMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetBlockTransactionCountMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getTransactionByBlockNumberAndIndex', + 1, + [ + formatters.inputBlockNumberFormatter + ], + utils.hexToNumber, + accounts + ) +} + +GetBlockTransactionCountMethodModel.prototype.beforeExecute = function (parameters) { + if (this.isHash(parameters[0])) { + this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; + } +}; + +GetBlockTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetBlockTransactionCountMethodModel; diff --git a/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js new file mode 100644 index 00000000000..e676cb3ce1e --- /dev/null +++ b/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js @@ -0,0 +1,55 @@ +/* + 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 . + */ +/** + * @file GetBlockUncleCountMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetBlockUncleCountMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getUncleCountByBlockNumber', + 1, + [ + formatters.inputBlockNumberFormatter + ], + utils.hexToNumber, + accounts + ) +} + +GetBlockUncleCountMethodModel.prototype.beforeExecute = function (parameters) { + if (this.isHash(parameters[0])) { + this.rpcMethod = 'eth_getUncleCountByBlockHash'; + } +}; + +GetBlockUncleCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetBlockUncleCountMethodModel; diff --git a/packages/web3-eth/src/methods/block/GetUncleMethodModel.js b/packages/web3-eth/src/methods/block/GetUncleMethodModel.js new file mode 100644 index 00000000000..7835bb437aa --- /dev/null +++ b/packages/web3-eth/src/methods/block/GetUncleMethodModel.js @@ -0,0 +1,56 @@ +/* + 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 . + */ +/** + * @file GetUncleMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetUncleMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getUncleByBlockNumberAndIndex', + 2, + [ + formatters.inputBlockNumberFormatter, + utils.numberToHex + ], + formatters.outputBlockFormatter, + accounts + ) +} + +GetUncleMethodModel.prototype.beforeExecute = function (parameters) { + if (this.isHash(parameters[0])) { + this.rpcMethod = 'eth_getUncleByBlockHashAndIndex'; + } +}; + +GetUncleMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetUncleMethodModel; diff --git a/packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js new file mode 100644 index 00000000000..9843330468a --- /dev/null +++ b/packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetProtocolVersionMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetProtocolVersionMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_protocolVersion', + 0, + null, + null, + accounts + ) +} + +GetProtocolVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetProtocolVersionMethodModel; diff --git a/packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js b/packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js new file mode 100644 index 00000000000..f849b660b56 --- /dev/null +++ b/packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetCoinbaseMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetCoinbaseMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_coinbase', + 0, + null, + null, + accounts + ) +} + +GetCoinbaseMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetCoinbaseMethodModel; diff --git a/packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js b/packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js new file mode 100644 index 00000000000..8467c803708 --- /dev/null +++ b/packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetGasPriceMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetGasPriceMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_gasPrice', + 0, + null, + formatters.outputBigNumberFormatter, + accounts + ) +} + +GetGasPriceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetGasPriceMethodModel; diff --git a/packages/web3-eth/src/methods/node/GetHashrateMethodModel.js b/packages/web3-eth/src/methods/node/GetHashrateMethodModel.js new file mode 100644 index 00000000000..3004212de92 --- /dev/null +++ b/packages/web3-eth/src/methods/node/GetHashrateMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetHashrateMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetHashrateMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_hashrate', + 0, + null, + utils.hexToNumber, + accounts + ) +} + +GetHashrateMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetHashrateMethodModel; diff --git a/packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js b/packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js new file mode 100644 index 00000000000..83dbd640125 --- /dev/null +++ b/packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetNodeInfoMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetNodeInfoMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'web3_clientVersion', + 0, + null, + null, + accounts + ) +} + +GetNodeInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetNodeInfoMethodModel; diff --git a/packages/web3-eth/src/methods/node/GetWorkMethodModel.js b/packages/web3-eth/src/methods/node/GetWorkMethodModel.js new file mode 100644 index 00000000000..8af0bf37eeb --- /dev/null +++ b/packages/web3-eth/src/methods/node/GetWorkMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetWorkMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetWorkMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getWork', + 0, + null, + null, + accounts + ) +} + +GetWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetWorkMethodModel; diff --git a/packages/web3-eth/src/methods/node/IsMiningMethodModel.js b/packages/web3-eth/src/methods/node/IsMiningMethodModel.js new file mode 100644 index 00000000000..95e98b862f8 --- /dev/null +++ b/packages/web3-eth/src/methods/node/IsMiningMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file IsMiningMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function IsMiningMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_mining', + 0, + null, + null, + accounts + ) +} + +IsMiningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = IsMiningMethodModel; diff --git a/packages/web3-eth/src/methods/node/IsSyncingMethodModel.js b/packages/web3-eth/src/methods/node/IsSyncingMethodModel.js new file mode 100644 index 00000000000..8b13963d3df --- /dev/null +++ b/packages/web3-eth/src/methods/node/IsSyncingMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file IsSyncingMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function IsSyncingMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_syncing', + 0, + null, + formatters.outputSyncingFormatter, + accounts + ) +} + +IsSyncingMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = IsSyncingMethodModel; diff --git a/packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js b/packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js new file mode 100644 index 00000000000..a4ff60dbeb4 --- /dev/null +++ b/packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file SubmitWorkMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function SubmitWorkMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_submitWork', + 3, + null, + null, + accounts + ) +} + +SubmitWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = SubmitWorkMethodModel; diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionCountMethodModel.js b/packages/web3-eth/src/methods/transaction/GetTransactionCountMethodModel.js new file mode 100644 index 00000000000..721b3e9d57c --- /dev/null +++ b/packages/web3-eth/src/methods/transaction/GetTransactionCountMethodModel.js @@ -0,0 +1,50 @@ +/* + 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 . + */ +/** + * @file GetTransactionCountMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetTransactionCountMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getTransactionCount', + 2, + [ + formatters.inputAddressFormatter, + formatters.inputDefaultBlockNumberFormatter + ], + utils.hexToNumber, + accounts + ) +} + +GetTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetTransactionCountMethodModel; diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js new file mode 100644 index 00000000000..26d931db103 --- /dev/null +++ b/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -0,0 +1,56 @@ +/* + 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 . + */ +/** + * @file GetTransactionFromBlockMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetTransactionFromBlockMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getTransactionByBlockNumberAndIndex', + 2, + [ + formatters.inputBlockNumberFormatter, + utils.numberToHex + ], + formatters.outputTransactionFormatter, + accounts + ) +} + +GetTransactionFromBlockMethodModel.prototype.beforeExecute = function (parameters) { + if (this.isHash(parameters[0])) { + this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; + } +}; + +GetTransactionFromBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetTransactionFromBlockMethodModel; diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js b/packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js new file mode 100644 index 00000000000..11cc39bf962 --- /dev/null +++ b/packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetTransactionMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetTransactionMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getTransactionByHash', + 1, + null, + formatters.outputTransactionFormatter, + accounts + ) +} + +GetTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetTransactionMethodModel; diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js new file mode 100644 index 00000000000..db572065ce3 --- /dev/null +++ b/packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetTransactionReceiptMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetTransactionReceiptMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_getTransactionReceipt', + 1, + null, + formatters.outputTransactionReceiptFormatter, + accounts + ) +} + +GetTransactionReceiptMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetTransactionReceiptMethodModel; diff --git a/packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js new file mode 100644 index 00000000000..f07121c3c21 --- /dev/null +++ b/packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file SendSignedTransactionMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function SendSignedTransactionMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_sendRawTransaction', + 1, + null, + null, + accounts + ) +} + +SendSignedTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = SendSignedTransactionMethodModel; diff --git a/packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js b/packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js new file mode 100644 index 00000000000..4870de20aaa --- /dev/null +++ b/packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file SendTransactionMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function SendTransactionMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_sendTransaction', + 1, + [formatters.inputTransactionFormatter], + null, + accounts + ) +} + +SendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = SendTransactionMethodModel; diff --git a/packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js b/packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js new file mode 100644 index 00000000000..4d579c2420a --- /dev/null +++ b/packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file SignTransactionMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function SignTransactionMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_signTransaction', + 1, + [formatters.inputTransactionFormatter], + null, + accounts + ) +} + +SignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = SignTransactionMethodModel; From 376db54b42ff95ae20287b971a26e53af65cc1b8 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 15:56:14 +0200 Subject: [PATCH 0090/1045] Imports fixed in method models of the eth package --- .../src/factory/MethodModelFactory.js | 48 +++++++++---------- .../web3-eth/src/methods/CallMethodModel.js | 2 +- .../src/methods/EstimateGasMethodModel.js | 2 +- .../src/methods/GetCodeMethodModel.js | 2 +- .../src/methods/GetPastLogslMethodModel.js | 2 +- .../src/methods/GetStorageAtMethodModel.js | 2 +- .../web3-eth/src/methods/SignMethodModel.js | 2 +- .../methods/account/GetAccountsMethodModel.js | 2 +- .../methods/account/GetBalanceMethodModel.js | 2 +- .../GetTransactionCountMethodModel.js | 2 +- .../src/methods/block/GetBlockMethodModel.js | 2 +- .../block/GetBlockNumberMethodModel.js | 2 +- .../GetBlockTransactionCountMethodModel.js | 2 +- .../block/GetBlockUncleCountMethodModel.js | 2 +- .../src/methods/block/GetUncleMethodModel.js | 2 +- .../network/GetProtocolVersionMethodModel.js | 2 +- .../methods/node/GetCoinbaseMethodModel.js | 2 +- .../methods/node/GetGasPriceMethodModel.js | 2 +- .../methods/node/GetHashrateMethodModel.js | 2 +- .../methods/node/GetNodeInfoMethodModel.js | 2 +- .../src/methods/node/GetWorkMethodModel.js | 2 +- .../src/methods/node/IsMiningMethodModel.js | 2 +- .../src/methods/node/IsSyncingMethodModel.js | 2 +- .../src/methods/node/SubmitWorkMethodModel.js | 2 +- .../GetTransactionFromBlockMethodModel.js | 2 +- .../transaction/GetTransactionMethodModel.js | 2 +- .../GetTransactionReceiptMethodModel.js | 2 +- .../SendSignedTransactionMethodModel.js | 2 +- .../transaction/SendTransactionMethodModel.js | 2 +- .../transaction/SignTransactionMethodModel.js | 2 +- 30 files changed, 53 insertions(+), 53 deletions(-) rename packages/web3-eth/src/methods/{transaction => account}/GetTransactionCountMethodModel.js (94%) diff --git a/packages/web3-eth/src/factory/MethodModelFactory.js b/packages/web3-eth/src/factory/MethodModelFactory.js index fbc4bc15c5a..0d98a7894c8 100644 --- a/packages/web3-eth/src/factory/MethodModelFactory.js +++ b/packages/web3-eth/src/factory/MethodModelFactory.js @@ -23,34 +23,34 @@ "use strict"; var AbstractMethodModelFactory = require('web3-core-method').AbstractMethodModelFactory; -var GetNodeInfoMethodModel = require('../methods/GetNodeInfoMethodModel'); -var GetProtocolVersionMethodModel = require('../methods/GetProtocolVersionMethodModel'); -var GetCoinbaseMethodModel = require('../methods/GetCoinbaseMethodModel'); -var IsMiningMethodModel = require('../methods/IsMiningMethodModel'); -var GetHashrateMethodModel = require('../methods/GetHashrateMethodModel'); -var IsSyncingMethodModel = require('../methods/IsSyncingMethodModel'); -var GetGasPriceMethodModel = require('../methods/GetGasPriceMethodModel'); -var GetAccountsMethodModel = require('../methods/GetAccountsMethodModel'); -var GetBlockNumberMethodModel = require('../methods/GetBlockNumberMethodModel'); -var GetBalanceMethodModel = require('../methods/GetBalanceMethodModel'); -var GetStroageAtMethodModel = require('../methods/GetStroageAtMethodModel'); +var GetProtocolVersionMethodModel = require('../methods/network/GetProtocolVersionMethodModel'); +var GetNodeInfoMethodModel = require('../methods/node/GetNodeInfoMethodModel'); +var GetCoinbaseMethodModel = require('../methods/node/GetCoinbaseMethodModel'); +var IsMiningMethodModel = require('../methods/node/IsMiningMethodModel'); +var GetHashrateMethodModel = require('../methods/node/GetHashrateMethodModel'); +var IsSyncingMethodModel = require('../methods/node/IsSyncingMethodModel'); +var GetGasPriceMethodModel = require('../methods/node/GetGasPriceMethodModel'); +var SubmitWorkMethodModel = require('../methods/node/SubmitWorkMethodModel'); +var GetWorkMethodModel = require('../methods/node/GetWorkMethodModel'); +var GetAccountsMethodModel = require('../methods/account/GetAccountsMethodModel'); +var GetBalanceMethodModel = require('../methods/account/GetBalanceMethodModel'); +var GetTransactionCountMethodModel = require('../methods/account/GetTransactionCountMethodModel'); +var GetBlockNumberMethodModel = require('../methods/block/GetBlockNumberMethodModel'); +var GetBlockMethodModel = require('../methods/block/GetBlockMethodModel'); +var GetUncleMethodModel = require('../methods/block/GetUncleMethodModel'); +var GetBlockTransactionCountMethodModel = require('../methods/block/GetBlockTransactionCountMethodModel'); +var GetBlockUncleCountMethodModel = require('../methods/block/GetBlockUncleCountMethodModel'); +var GetTransactionMethodModel = require('../methods/transaction/GetTransactionMethodModel'); +var GetTransactionFromBlockMethodModel = require('../methods/transaction/GetTransactionFromBlockMethodModel'); +var GetTransactionReceipt = require('../methods/transaction/GetTransactionReceipt'); +var SendSignedTransactionMethodModel = require('../methods/transaction/SendSignedTransactionMethodModel'); +var SignTransactionMethodModel = require('../methods/transaction/SignTransactionMethodModel'); +var SendTransactionMethodModel = require('../methods/transaction/SendTransactionMethodModel'); var GetCodeMethodModel = require('../methods/GetCodeMethodModel'); -var GetBlockMethodModel = require('../methods/GetBlockMethodModel'); -var GetUncleMethodModel = require('../methods/GetUncleMethodModel'); -var GetBlockTransactionCountMethodModel = require('../methods/GetBlockTransactionCountMethodModel'); -var GetBlockUncleCountMethodModel = require('../methods/GetBlockUncleCountMethodModel'); -var GetTransactionMethodModel = require('../methods/GetTransactionMethodModel'); -var GetTransactionFromBlockMethodModel = require('../methods/GetTransactionFromBlockMethodModel'); -var GetTransactionReceipt = require('../methods/GetTransactionReceipt'); -var GetTransactionCountMethodModel = require('../methods/GetTransactionCountMethodModel'); -var SendSignedTransactionMethodModel = require('../methods/SendSignedTransactionMethodModel'); -var SignTransactionMethodModel = require('../methods/SignTransactionMethodModel'); -var SendTransactionMethodModel = require('../methods/SendTransactionMethodModel'); var SignMethodModel = require('../methods/SignMethodModel'); var CallMethodModel = require('../methods/CallMethodModel'); +var GetStroageAtMethodModel = require('../methods/GetStroageAtMethodModel'); var EstimateGasMethodModel = require('../methods/EstimateGasMethodModel'); -var SubmitWorkMethodModel = require('../methods/SubmitWorkMethodModel'); -var GetWorkMethodModel = require('../methods/GetWorkMethodModel'); var GetPastLogsMethodModel = require('../methods/GetPastLogsMethodModel'); /** diff --git a/packages/web3-eth/src/methods/CallMethodModel.js b/packages/web3-eth/src/methods/CallMethodModel.js index fee0c0c3976..ceb00ad1dfd 100644 --- a/packages/web3-eth/src/methods/CallMethodModel.js +++ b/packages/web3-eth/src/methods/CallMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/EstimateGasMethodModel.js b/packages/web3-eth/src/methods/EstimateGasMethodModel.js index 5db7ed9e5b2..db1026d69a1 100644 --- a/packages/web3-eth/src/methods/EstimateGasMethodModel.js +++ b/packages/web3-eth/src/methods/EstimateGasMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/GetCodeMethodModel.js b/packages/web3-eth/src/methods/GetCodeMethodModel.js index f89191f5ebc..63311932e01 100644 --- a/packages/web3-eth/src/methods/GetCodeMethodModel.js +++ b/packages/web3-eth/src/methods/GetCodeMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/GetPastLogslMethodModel.js b/packages/web3-eth/src/methods/GetPastLogslMethodModel.js index 47e09093697..57db6c8214e 100644 --- a/packages/web3-eth/src/methods/GetPastLogslMethodModel.js +++ b/packages/web3-eth/src/methods/GetPastLogslMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/GetStorageAtMethodModel.js b/packages/web3-eth/src/methods/GetStorageAtMethodModel.js index 701918dfbd3..e1f561b43a0 100644 --- a/packages/web3-eth/src/methods/GetStorageAtMethodModel.js +++ b/packages/web3-eth/src/methods/GetStorageAtMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/SignMethodModel.js b/packages/web3-eth/src/methods/SignMethodModel.js index c7bdd558edb..fdc0ab1359d 100644 --- a/packages/web3-eth/src/methods/SignMethodModel.js +++ b/packages/web3-eth/src/methods/SignMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/account/GetAccountsMethodModel.js b/packages/web3-eth/src/methods/account/GetAccountsMethodModel.js index f321909c605..b638d566041 100644 --- a/packages/web3-eth/src/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-eth/src/methods/account/GetAccountsMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/account/GetBalanceMethodModel.js b/packages/web3-eth/src/methods/account/GetBalanceMethodModel.js index 3ed9319cbe9..54914dd094f 100644 --- a/packages/web3-eth/src/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-eth/src/methods/account/GetBalanceMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionCountMethodModel.js b/packages/web3-eth/src/methods/account/GetTransactionCountMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/transaction/GetTransactionCountMethodModel.js rename to packages/web3-eth/src/methods/account/GetTransactionCountMethodModel.js index 721b3e9d57c..1abd45fe39d 100644 --- a/packages/web3-eth/src/methods/transaction/GetTransactionCountMethodModel.js +++ b/packages/web3-eth/src/methods/account/GetTransactionCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetBlockMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockMethodModel.js index 798947ed737..c3eda527834 100644 --- a/packages/web3-eth/src/methods/block/GetBlockMethodModel.js +++ b/packages/web3-eth/src/methods/block/GetBlockMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js index be8648019a2..1de0e0d69e5 100644 --- a/packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js index a78c50d9ab7..d9998ccf436 100644 --- a/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js index e676cb3ce1e..7233fff638e 100644 --- a/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetUncleMethodModel.js b/packages/web3-eth/src/methods/block/GetUncleMethodModel.js index 7835bb437aa..044007f42b7 100644 --- a/packages/web3-eth/src/methods/block/GetUncleMethodModel.js +++ b/packages/web3-eth/src/methods/block/GetUncleMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js index 9843330468a..947cdba13d7 100644 --- a/packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js b/packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js index f849b660b56..88add101173 100644 --- a/packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js b/packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js index 8467c803708..d9daa842a88 100644 --- a/packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetHashrateMethodModel.js b/packages/web3-eth/src/methods/node/GetHashrateMethodModel.js index 3004212de92..3684dba5932 100644 --- a/packages/web3-eth/src/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-eth/src/methods/node/GetHashrateMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js b/packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js index 83dbd640125..92d829d703b 100644 --- a/packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetWorkMethodModel.js b/packages/web3-eth/src/methods/node/GetWorkMethodModel.js index 8af0bf37eeb..11712b86704 100644 --- a/packages/web3-eth/src/methods/node/GetWorkMethodModel.js +++ b/packages/web3-eth/src/methods/node/GetWorkMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/IsMiningMethodModel.js b/packages/web3-eth/src/methods/node/IsMiningMethodModel.js index 95e98b862f8..2471dd38102 100644 --- a/packages/web3-eth/src/methods/node/IsMiningMethodModel.js +++ b/packages/web3-eth/src/methods/node/IsMiningMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/IsSyncingMethodModel.js b/packages/web3-eth/src/methods/node/IsSyncingMethodModel.js index 8b13963d3df..64f88549e56 100644 --- a/packages/web3-eth/src/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-eth/src/methods/node/IsSyncingMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js b/packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js index a4ff60dbeb4..71494423c61 100644 --- a/packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js index 26d931db103..72141809be6 100644 --- a/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js b/packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js index 11cc39bf962..094b78c61ca 100644 --- a/packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js index db572065ce3..ef83a108aea 100644 --- a/packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js index f07121c3c21..a2372c2d80d 100644 --- a/packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js b/packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js index 4870de20aaa..d9f061efb33 100644 --- a/packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js b/packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js index 4d579c2420a..e08c731af8a 100644 --- a/packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; /** * @param {Utils} utils From 2e8b139d40ffecef0a3824d044cf918444112a9d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 16:04:28 +0200 Subject: [PATCH 0091/1045] Method renamed to MethodService, beforeExecute renamed to beforeExecution, beforeExecution added to MethodService --- packages/web3-core-method/src/{Method.js => MethodService.js} | 4 ++++ packages/web3-eth/src/methods/block/GetBlockMethodModel.js | 2 +- .../src/methods/block/GetBlockTransactionCountMethodModel.js | 2 +- .../src/methods/block/GetBlockUncleCountMethodModel.js | 2 +- packages/web3-eth/src/methods/block/GetUncleMethodModel.js | 2 +- .../methods/transaction/GetTransactionFromBlockMethodModel.js | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) rename packages/web3-core-method/src/{Method.js => MethodService.js} (98%) diff --git a/packages/web3-core-method/src/Method.js b/packages/web3-core-method/src/MethodService.js similarity index 98% rename from packages/web3-core-method/src/Method.js rename to packages/web3-core-method/src/MethodService.js index 1907eb286ed..9ce7130410b 100644 --- a/packages/web3-core-method/src/Method.js +++ b/packages/web3-core-method/src/MethodService.js @@ -55,6 +55,10 @@ function MethodService( MethodService.prototype.execute = function () { var mappedFunctionArguments = this.mapFunctionArguments(arguments); + if (_.isFunction(arguments[0].beforeExecution)) { + arguments[0].beforeExecute(mappedFunctionArguments.parameters); + } + return this.send( arguments[0], arguments[1], diff --git a/packages/web3-eth/src/methods/block/GetBlockMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockMethodModel.js index c3eda527834..eb26148d75e 100644 --- a/packages/web3-eth/src/methods/block/GetBlockMethodModel.js +++ b/packages/web3-eth/src/methods/block/GetBlockMethodModel.js @@ -47,7 +47,7 @@ function GetBlockMethodModel(utils, formatters, accounts) { ) } -GetBlockMethodModel.prototype.beforeExecute = function (parameters) { +GetBlockMethodModel.prototype.beforeExecution = function (parameters) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getBlockByHash'; } diff --git a/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js index d9998ccf436..d7a1b546643 100644 --- a/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js @@ -44,7 +44,7 @@ function GetBlockTransactionCountMethodModel(utils, formatters, accounts) { ) } -GetBlockTransactionCountMethodModel.prototype.beforeExecute = function (parameters) { +GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (parameters) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } diff --git a/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js index 7233fff638e..357ca347b37 100644 --- a/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js @@ -44,7 +44,7 @@ function GetBlockUncleCountMethodModel(utils, formatters, accounts) { ) } -GetBlockUncleCountMethodModel.prototype.beforeExecute = function (parameters) { +GetBlockUncleCountMethodModel.prototype.beforeExecution = function (parameters) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getUncleCountByBlockHash'; } diff --git a/packages/web3-eth/src/methods/block/GetUncleMethodModel.js b/packages/web3-eth/src/methods/block/GetUncleMethodModel.js index 044007f42b7..2f11dbc34a6 100644 --- a/packages/web3-eth/src/methods/block/GetUncleMethodModel.js +++ b/packages/web3-eth/src/methods/block/GetUncleMethodModel.js @@ -45,7 +45,7 @@ function GetUncleMethodModel(utils, formatters, accounts) { ) } -GetUncleMethodModel.prototype.beforeExecute = function (parameters) { +GetUncleMethodModel.prototype.beforeExecution = function (parameters) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getUncleByBlockHashAndIndex'; } diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js index 72141809be6..6184ab366b9 100644 --- a/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -45,7 +45,7 @@ function GetTransactionFromBlockMethodModel(utils, formatters, accounts) { ) } -GetTransactionFromBlockMethodModel.prototype.beforeExecute = function (parameters) { +GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (parameters) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } From 1a6ae133169633f0b429aa632853bea34863ff49 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 16:49:23 +0200 Subject: [PATCH 0092/1045] MethodService and related objects refactored, proxy handler method in AbstractWeb3Object optimized --- .../lib/signer/AbstractSigner.js | 12 ++-- .../web3-core-method/src/MethodService.js | 57 ++++++++++++------- .../src/factories/MethodPackageFactory.js | 39 +++---------- packages/web3-core-method/src/index.js | 21 ++----- .../src/signers/MessageSigner.js | 13 +++-- .../src/signers/TransactionSigner.js | 28 +++++---- .../src/watchers/NewHeadsWatcher.js | 10 ++-- .../TransactionConfirmationWorkflow.js | 15 ++--- .../src/AbstractWeb3Object.js | 9 ++- 9 files changed, 99 insertions(+), 105 deletions(-) diff --git a/packages/web3-core-method/lib/signer/AbstractSigner.js b/packages/web3-core-method/lib/signer/AbstractSigner.js index 2c9ab05464e..3240fa33105 100644 --- a/packages/web3-core-method/lib/signer/AbstractSigner.js +++ b/packages/web3-core-method/lib/signer/AbstractSigner.js @@ -25,24 +25,22 @@ var _ = require('underscore'); /** - * @param {Accounts} accounts * @constructor */ -function AbstractSigner(accounts) { - this.accounts = accounts; -} +function AbstractSigner() { } /** * Get wallet for address with accounts package * * @param {any} from + * @param {Accounts} accounts * * @returns {any} */ -AbstractSigner.prototype.getWallet = function (from) { +AbstractSigner.prototype.getWallet = function (from, accounts) { // is index given if (_.isNumber(from)) { - return this.accounts.wallet[from]; + return accounts.wallet[from]; } @@ -51,7 +49,7 @@ AbstractSigner.prototype.getWallet = function (from) { return from; } - var searchedWalletForAddress = this.accounts.wallet[from.toLowerCase()]; + var searchedWalletForAddress = accounts.wallet[from.toLowerCase()]; if (searchedWalletForAddress) { return searchedWalletForAddress; } diff --git a/packages/web3-core-method/src/MethodService.js b/packages/web3-core-method/src/MethodService.js index 9ce7130410b..f27ad3ae310 100644 --- a/packages/web3-core-method/src/MethodService.js +++ b/packages/web3-core-method/src/MethodService.js @@ -50,19 +50,24 @@ function MethodService( * * @method execute * + * @param {AbstractMethodModel} methodModel + * @param {AbstractProviderAdapter} provider + * @param {Accounts} accounts + * @param {Array} methodArguments + * * @returns {Promise|eventifiedPromise|String|boolean} */ -MethodService.prototype.execute = function () { - var mappedFunctionArguments = this.mapFunctionArguments(arguments); +MethodService.prototype.execute = function (methodModel, provider, accounts, methodArguments) { + var mappedFunctionArguments = this.mapFunctionArguments(methodArguments); - if (_.isFunction(arguments[0].beforeExecution)) { - arguments[0].beforeExecute(mappedFunctionArguments.parameters); + if (_.isFunction(methodModel.beforeExecution)) { + methodModel.beforeExecution(mappedFunctionArguments.parameters); } return this.send( - arguments[0], - arguments[1], - arguments[2], + methodModel, + provider, + accounts, mappedFunctionArguments.parameters, mappedFunctionArguments.callback ); @@ -87,21 +92,32 @@ MethodService.prototype.send = function (methodModel, provider, accounts, parame if (this.methodModel.isSendTransaction()) { this.methodModel.rpcMethod = 'eth_sendRawTransaction'; - return this.sendTransaction( - promiEvent, - [this.transactionSigner.sign(parameters[0], accounts).rawTransaction], - null, - callback - ); + this.transactionSigner.sign(parameters[0], accounts).then(function(response) { + self.sendTransaction( + methodModel, + provider, + promiEvent, + [response.rawTransaction], + null, + callback + ); + }).catch(function(error) { + promiEvent.reject(error); + promiEvent.on('error', error); + promiEvent.eventEmitter.removeAllListeners(); + callback(error, null); + }); + + return promiEvent; } } if (this.methodModel.isSendTransaction() || this.methodModel.isSendRawTransaction()) { if (this.isGasPriceDefined()) { return this.sendTransaction( + methodModel, provider, promiEvent, - methodModel, parameters, null, callback @@ -110,9 +126,9 @@ MethodService.prototype.send = function (methodModel, provider, accounts, parame this.getGasPrice().then(function (gasPrice) { self.sendTransaction( + methodModel, provider, promiEvent, - methodModel, parameters, gasPrice, callback @@ -126,7 +142,7 @@ MethodService.prototype.send = function (methodModel, provider, accounts, parame return this.messageSigner.sign(parameters[0], parameters[1], accounts); } - return this.call(provider, methodModel, parameters, callback); + return this.call(methodModel, provider, parameters, callback); }; /** @@ -145,15 +161,15 @@ MethodService.prototype.isGasPriceDefined = function () { * * @method call * - * @param {AbstractProviderAdapter} provider * @param {AbstractMethodModel} methodModel + * @param {AbstractProviderAdapter} provider * @param {Array} parameters * @param {Function} callback * * @callback callback callback(error, result) * @returns {Promise} */ -MethodService.prototype.call = function (provider, methodModel, parameters, callback) { +MethodService.prototype.call = function (methodModel, provider, parameters, callback) { var self = this; return provider.send( @@ -205,9 +221,9 @@ MethodService.prototype.mapFunctionArguments = function (args) { * * @method sendTransaction * + * @param {AbstractMethodModel} methodModel * @param {AbstractProviderAdapter} provider * @param {PromiEvent} promiEvent - * @param {AbstractMethodModel} methodModel * @param {Array} parameters * @param {String} gasPrice * @param {Function} callback @@ -215,7 +231,7 @@ MethodService.prototype.mapFunctionArguments = function (args) { * @callback callback callback(error, result) * @returns {eventifiedPromise} */ -MethodService.prototype.sendTransaction = function (provider, promiEvent, methodModel, parameters, gasPrice, callback) { +MethodService.prototype.sendTransaction = function (methodModel, provider, promiEvent, parameters, gasPrice, callback) { var self = this; if (gasPrice && _.isObject(parameters[0])) { @@ -227,6 +243,7 @@ MethodService.prototype.sendTransaction = function (provider, promiEvent, method this.formatInput(parameters, methodModel.inputFormatters) ).then(function (response) { self.transactionConfirmationWorkflow.execute( + provider, response, promiEvent, callback diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index 8cb56df49c8..28418d28466 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -28,7 +28,7 @@ var MessageSigner = require('../signers/MessageSigner'); var TransactionConfirmationModel = require('../models/TransactionConfirmationModel'); var TransactionReceiptValidator = require('../validators/TransactionReceiptValidator'); var NewHeadsWatcher = require('../watchers/NewHeadsWatcher'); -var Method = require('../Method'); +var MethodService = require('../MethodService'); /** @@ -42,36 +42,18 @@ function MethodPackageFactory() { } * * @method createMethod * - * @param {Object} provider - * @param {Accounts} accounts - * @param {String} rpcMethod - * @param {Array} parameters - * @param {Array} inputFormatters - * @param {Function} outputFormatter * @param {PromiEvent} promiEvent * @param {SubscriptionPackage} subscriptionPackage * - * @returns {Method} + * @returns {MethodService} */ -MethodPackageFactory.prototype.createMethod = function ( - provider, - accounts, - rpcMethod, - parameters, - inputFormatters, - outputFormatter, +MethodPackageFactory.prototype.createMethodService = function ( promiEvent, subscriptionPackage ) { - return new Method( - provider, - accounts, - rpcMethod, - parameters, - inputFormatters, - outputFormatter, + return new MethodService( promiEvent, - this.createTransactionConfirmationWorkflow(provider, subscriptionPackage), + this.createTransactionConfirmationWorkflow(subscriptionPackage), this.createTransactionSigner(), this.createMessageSigner() ); @@ -82,17 +64,15 @@ MethodPackageFactory.prototype.createMethod = function ( * * @method createTransactionConfirmationWorkflow * - * @param {Object} provider * @param {SubscriptionPackage} subscriptionPackage * * @returns {TransactionConfirmationWorkflow} */ -MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (provider, subscriptionPackage) { +MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (subscriptionPackage) { new TransactionConfirmationWorkflow( - provider, this.createTransactionConfirmationModel(), this.createTransactionReceiptValidator(), - this.createNewHeadsWatcher(provider, subscriptionPackage) + this.createNewHeadsWatcher(subscriptionPackage) ); }; @@ -141,11 +121,10 @@ MethodPackageFactory.prototype.createTransactionReceiptValidator = function () { /** * Returns NewHeadsWatcher object * - * @param {Object} provider * @param {SubscriptionPackage} subscriptionPackage * * @returns {NewHeadsWatcher} */ -MethodPackageFactory.prototype.createNewHeadsWatcher = function (provider, subscriptionPackage) { - return new NewHeadsWatcher(provider, subscriptionPackage); +MethodPackageFactory.prototype.createNewHeadsWatcher = function (subscriptionPackage) { + return new NewHeadsWatcher(subscriptionPackage); }; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 6d296a1fc9b..3b46c228733 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -24,7 +24,6 @@ "use strict"; var version = require('./package.json'); -var AccountsPackage = require('web3-eth-accounts'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); var AbstractMethodModel = require('../lib/models/AbstractMethodModel'); @@ -41,23 +40,11 @@ module.exports = { * * @method create * - * @param {Object} provider - * @param {String} rpcMethod - * @param {Array} parameters - * @param {Function} inputFormatters - * @param {Function} outputFormatters - * - * @returns {Method} + * @returns {MethodService} */ - create: function (provider, rpcMethod, parameters, inputFormatters, outputFormatters) { - return new MethodPackageFactory().createMethod( - provider, - AccountsPackage.create(), - rpcMethod, - parameters, - inputFormatters, - outputFormatters, - PromiEventPackage.create(), + createMethodService: function () { + return new MethodPackageFactory().createMethodService( + PromiEventPackage, SubscriptionPackage ); } diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index eae975c0557..258382d701e 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -35,17 +35,18 @@ function MessageSigner() { } * @method sign * * @param {String} data - * @param {any} address + * @param {String} address + * @param {Accounts} accounts * - * @returns {String | boolean} + * @returns {String | Error} */ -MessageSigner.prototype.sign = function(data, address) { - var wallet = this.getWallet(address); +MessageSigner.prototype.sign = function(data, address, accounts) { + var wallet = this.getWallet(address, accounts); if (wallet && wallet.privateKey) { - return this.accounts.sign(data, wallet.privateKey).signature; + return accounts.sign(data, wallet.privateKey).signature; } - return false; + return new Error('Wallet or privateKey for wallet is not set!'); }; // Inherit from AbstractSigner diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index a3e023d5b1c..c85cce702af 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -32,18 +32,26 @@ function TransactionSigner() { } * @method sign * * @param {Object} transaction + * @param {Accounts} accounts * - * @returns {boolean | String} + * @returns {Promise} */ -TransactionSigner.prototype.sign = function (transaction) { - var wallet = this.getWallet(transaction.from); - if (wallet && wallet.privateKey) { - delete transaction.from; - - return this.accounts.signTransaction(transaction, wallet.privateKey); - } - - return false; +TransactionSigner.prototype.sign = function (transaction, accounts) { + var wallet = this.getWallet(transaction.from, accounts); + + return new Promise(function(resolve, reject) { + if (wallet && wallet.privateKey) { + delete transaction.from; + + accounts.signTransaction(transaction, wallet.privateKey).then(function(response) { + resolve(response); + }).catch(function(error) { + reject(error); + }); + } + + reject(new Error('Wallet or privateKey for wallet is not set!')); + }); }; // Inherit from AbstractSigner diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 6dca33e2619..7f8433077d0 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -21,12 +21,11 @@ */ /** - * @param {Object} provider * @param {SubscriptionPackage} subscriptionPackage + * * @constructor */ -function NewHeadsWatcher(provider, subscriptionPackage) { - this.provider = provider; +function NewHeadsWatcher(subscriptionPackage) { this.subscriptionPackage = subscriptionPackage; this.confirmationInterval = null; this.confirmationSubscription = null; @@ -38,16 +37,17 @@ function NewHeadsWatcher(provider, subscriptionPackage) { * * @method watch * + * @param {AbstractProviderAdapter} provider * @param {String} transactionHash * * @returns {this} */ -NewHeadsWatcher.prototype.watch = function (transactionHash) { +NewHeadsWatcher.prototype.watch = function (provider, transactionHash) { var self = this; try { this.confirmationSubscription = this.subscriptionPackage.create( - this.provider, + provider, 'newHeads', transactionHash, null, diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 68d873d9c3c..894a6fe497c 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -31,7 +31,6 @@ * @constructor */ function TransactionConfirmationWorkflow( - provider, transactionConfirmationModel, transactionReceiptValidator, newHeadsWatcher @@ -39,7 +38,6 @@ function TransactionConfirmationWorkflow( this.transactionConfirmationModel = transactionConfirmationModel; this.transactionReceiptValidator = transactionReceiptValidator; this.newHeadsWatcher = newHeadsWatcher; - this.provider = provider; } /** @@ -47,6 +45,7 @@ function TransactionConfirmationWorkflow( * * @method execute * + * @param {AbstractProviderAdapter} provider * @param {String} transactionHash * @param {Object} promiEvent * @param {Function} callback @@ -54,13 +53,14 @@ function TransactionConfirmationWorkflow( * @callback callback callback(error, result) */ TransactionConfirmationWorkflow.prototype.execute = function ( + provider, transactionHash, promiEvent, callback ) { var self = this; - this.getTransactionReceipt(transactionHash).then(function (receipt) { + this.getTransactionReceipt(provider, transactionHash).then(function (receipt) { if (receipt && receipt.blockHash) { var validationResult = this.transactionReceiptValidator.validate(receipt); if (validationResult === true) { @@ -74,10 +74,10 @@ TransactionConfirmationWorkflow.prototype.execute = function ( return; } - self.newHeadsWatcher.watch().on('newHead', function () { + self.newHeadsWatcher.watch(provider).on('newHead', function () { self.transactionConfirmationModel.timeoutCounter++; if (!self.transactionConfirmationModel.isTimeoutTimeExceeded()) { - self.getTransactionReceipt(transactionHash).then(function (receipt) { + self.getTransactionReceipt(provider, transactionHash).then(function (receipt) { var validationResult = self.transactionReceiptValidator.validate(receipt); if (validationResult === true) { self.transactionConfirmationModel.addConfirmation(receipt); @@ -123,12 +123,13 @@ TransactionConfirmationWorkflow.prototype.execute = function ( * * @method execute * + * @param {AbstractProviderAdapter} provider * @param {String} transactionHash * * @returns {Promise} */ -TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (transactionHash) { - return this.provider.send('eth_getTransactionReceipt', transactionHash).then(function (receipt) { +TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (provider, transactionHash) { + return provider.send('eth_getTransactionReceipt', [transactionHash]).then(function (receipt) { return this.formatters.outputTransactionReceiptFormatter(receipt); }) }; diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 35ab7dd42f9..248e11d51b8 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -156,9 +156,12 @@ AbstractWeb3Object.prototype.proxyHandler = function(target, name) { var methodModel = target.methodModelFactory.createMethodModel(name); var anonymousFunction = function() { - var methodArguments = [methodModel, target.currentProvider, target.accounts].concat(arguments); - - return target.methodService.execute().apply(methodArguments); + return target.methodService.execute( + methodModel, + target.currentProvider, + target.accounts, + arguments + ); }; anonymousFunction.methodModel = methodModel; From a863f4c945697b6c94a0625439a09c88ada07f15 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 17:50:31 +0200 Subject: [PATCH 0093/1045] BatchRequest refactored --- packages/web3-core-batch/src/Batch.js | 76 ++++++++++++------- packages/web3-core-batch/src/index.js | 9 ++- .../lib/models/AbstractMethodModel.js | 38 +++++++++- .../lib/adapters/AbstractProviderAdapter.js | 14 ++++ .../lib/mappers/JSONRpcMapper.js | 12 ++- 5 files changed, 113 insertions(+), 36 deletions(-) diff --git a/packages/web3-core-batch/src/Batch.js b/packages/web3-core-batch/src/Batch.js index 78479722670..a963153e038 100644 --- a/packages/web3-core-batch/src/Batch.js +++ b/packages/web3-core-batch/src/Batch.js @@ -16,24 +16,27 @@ */ /** * @file Batch.js - * @author Marek Kotewicz - * @date 2015 + * @author Samuel Furter , Marek Kotewicz + * @date 2018 */ "use strict"; var errors = require('web3-core-helpers').errors; +var _ = require('underscore'); /** * * @param {AbstractProviderAdapter} provider * @param {JSONRpcMapper} jsonRpcMapper + * @param {JSONRpcResponseValidator} jsonRpcResponseValidator * * @constructor */ -function Batch(provider, jsonRpcMapper) { +function Batch(provider, jsonRpcMapper, jsonRpcResponseValidator) { this.provider = provider; this.jsonRpcMapper = jsonRpcMapper; + this.jsonRpcResponseValidator = jsonRpcResponseValidator; this.requests = []; } @@ -54,34 +57,51 @@ Batch.prototype.add = function (request) { * @method execute */ Batch.prototype.execute = function () { - var requests = this.requests; - - var payload = this.jsonRpcMapper.toBatchPayload(this.requests); - var request = this.requests[0] - request.method().apply(request.arguments); - this.provider.send(payload, function (err, results) { - results = results || []; - requests.map(function (request, index) { - return results[index] || {}; - }).forEach(function (result, index) { - if (requests[index].callback) { - if (result && result.error) { - return requests[index].callback(errors.ErrorResponse(result)); - } + var self = this; + this.provider.sendBatch( + this.jsonRpcMapper.toBatchPayload(this.requests), + function (err, results) { + self.requests.forEach(function (request, index) { + var result = results[index] || null; - if (!JSONRpcResponseValidator.isValid(result)) { - return requests[index].callback(errors.InvalidResponse(result)); - } + if (_.isFunction(request.callback)) { + if (_.isObject(result) && result.error) { + request.callback(errors.ErrorResponse(result)); + } + + if (!this.jsonRpcResponseValidator.isValid(result)) { + request.callback(errors.InvalidResponse(result)); + } + + try { + var mappedResult = result.result; - try { - requests[index].callback(null, requests[index].format ? requests[index].format(result.result) : result.result); - } catch (err) { - requests[index].callback(err); + if (self.hasOutputFormatter(request)) { + mappedResult = request.methodModel.outputFormatter(mappedResult); + } + + request.callback(null, mappedResult); + + } catch (err) { + request.callback(err, null); + } } - } - }); - }); + }); + } + ); }; -module.exports = Batch; +/** + * Checks if the method has an outputFormatter defined + * + * @method hasOutputFormatter + * + * @param {Object} request + * + * @returns {Boolean} + */ +Batch.prototype.hasOutputFormatter = function (request) { + return _.isFunction(request.methodModel.outputFormatter); +}; +module.exports = Batch; diff --git a/packages/web3-core-batch/src/index.js b/packages/web3-core-batch/src/index.js index 5d6805a438b..cc332a27f5f 100644 --- a/packages/web3-core-batch/src/index.js +++ b/packages/web3-core-batch/src/index.js @@ -22,6 +22,7 @@ var version = require('./package.json').version; var Batch = require('./Batch'); +var JSONRpcMapper = require('web3-core-providers').JSONRpcMapper; module.exports = { version: version, @@ -29,11 +30,13 @@ module.exports = { /** * Returns the Batch object * - * @param {ConnectionModel} connectionModel + * @method create + * + * @param {AbstractProviderAdapter} provider * * @returns {Batch} */ - create: function (connectionModel) { - return new Batch(connectionModel); + create: function (provider) { + return new Batch(provider, JSONRpcMapper); } }; diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index d899716b532..9d5fcbfb02b 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -45,9 +45,45 @@ function AbstractMethodModel(rpcMethod, parametersAmount, inputFormatters, outpu * @returns {Object} */ AbstractMethodModel.prototype.request = function () { + var mappedFunctionArguments = this.mapFunctionArguments(arguments); + return { methodModel: this, - parameters: arguments + parameters: mappedFunctionArguments.parameters, + callback: mappedFunctionArguments.callback + } +}; + +/** + * Splits the parameters and the callback function and returns it as object + * + * @param {Array} args + * + * @returns {Object} + */ +AbstractMethodModel.mapFunctionArguments = function (args) { + var parameters = args; + var callback = null; + + if (arguments.length < this.parametersAmount) { + throw new Error( + 'Arguments length is not correct: expected: ' + this.parametersAmount + ', given: ' + arguments.length + ); + } + + if (arguments.length > this.parametersAmount) { + callback = arguments.slice(-1); + if(!_.isFunction(callback)) { + throw new Error( + 'The latest parameter should be a function otherwise it can not be used as callback' + ); + } + parameters = arguments.slice(0, -1); + } + + return { + callback: callback, + parameters: parameters } }; diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js index b8e81aff82b..d94bc70bb92 100644 --- a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js @@ -57,6 +57,20 @@ AbstractProviderAdapter.prototype.send = function (method, parameters) { }); }; +/** + * Sends batch payload + * + * @method sendBatch + * + * @param {Array} payload + * @param {Function} callback + * + * @callback callback callback(error, result) + */ +AbstractProviderAdapter.prototype.sendBatch = function (payload, callback) { + self.provider.send(payload, callback); +}; + /** * Handles the JSON-RPC response * diff --git a/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js b/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js index 1ce25cf8a9f..bd294867d5c 100644 --- a/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js +++ b/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js @@ -60,13 +60,17 @@ JSONRpcMapper.toPayload = function (method, params) { * * @method toBatchPayload * - * @param {Array} messages, an array of objects with method (required) and params (optional) fields + * @param {Array} requests, an array of objects with method (required) and params (optional) fields * * @returns {Array} batch payload */ -JSONRpcMapper.toBatchPayload = function (messages) { - return messages.map(function (message) { - return Jsonrpc.toPayload(message.method, message.params); +JSONRpcMapper.toBatchPayload = function (requests) { + return requests.map(function (request) { + if(_.isFunction(request.methodModel.beforeExecution)) { + request.methodModel.beforeExecution(); + } + + return JSONRpcMapper.toPayload(request.methodModel.rpcMethod, request.parameters); }); }; From 6cd00abc17c624843bb44ea159d944794975c5ab Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 18:00:13 +0200 Subject: [PATCH 0094/1045] create function in batchRequestPackage updated, batchRequest added to AbstractWeb3Object, JSONRpcResponseValidator to index.js added of web3-core-providers package --- packages/web3-core-batch/src/index.js | 3 ++- .../web3-core-package/src/AbstractWeb3Object.js | 14 ++++++-------- packages/web3-core-providers/src/index.js | 2 ++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/web3-core-batch/src/index.js b/packages/web3-core-batch/src/index.js index cc332a27f5f..352663e5f55 100644 --- a/packages/web3-core-batch/src/index.js +++ b/packages/web3-core-batch/src/index.js @@ -23,6 +23,7 @@ var version = require('./package.json').version; var Batch = require('./Batch'); var JSONRpcMapper = require('web3-core-providers').JSONRpcMapper; +var JSONRpcResponseValidator = require('web3-core-providers').JSONRpcResponseValidator; module.exports = { version: version, @@ -37,6 +38,6 @@ module.exports = { * @returns {Batch} */ create: function (provider) { - return new Batch(provider, JSONRpcMapper); + return new Batch(provider, JSONRpcMapper, JSONRpcResponseValidator); } }; diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 248e11d51b8..4e08e927214 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -29,7 +29,7 @@ * @param {MethodService} methodService * @param {MethodModelFactory} methodModelFactory * @param {SubscriptionPackage} subscriptionPackage - * @param {BatchRequest} batchRequest + * @param {BatchRequestPackage} batchRequestPackage * * @constructor */ @@ -40,7 +40,7 @@ function AbstractWeb3Object( methodService, methodModelFactory, subscriptionPackage, - batchRequest + batchRequestPackage ) { this.methodModelFactory = methodModelFactory; this.methodService = methodService; @@ -55,12 +55,10 @@ function AbstractWeb3Object( WebsocketProvider: this.providersPackage.WebsocketProvider, }; - if (typeof batchRequest !== 'undefined') { - this.BatchRequest = batchRequest; - } - - if (typeof methodPackage !== 'undefined') { - this.methodPackage = methodPackage; + if (typeof batchRequestPackage !== 'undefined') { + this.BatchRequest = function BatchRequest() { + return batchRequestPackage.create(self.currentProvider); + }; } if (typeof subscriptionPackage !== 'undefined') { diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index b7708e28aa0..ae5f7031e72 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -26,6 +26,7 @@ var HttpProvider = require('./providers/HttpProvider'); var IpcProvider = require('./providers/IpcProvider'); var WebsocketProvider = require('./providers/WebsocketProvider'); var JSONRpcMapper = require('../lib/mappers/JSONRpcMapper'); +var JSONRpcResponseValidator = require('../lib/validators/JSONRpcResponseValidator'); module.exports = { version: version, @@ -33,6 +34,7 @@ module.exports = { IpcProvider: IpcProvider, WebsocketProvider: WebsocketProvider, JSONRpcMapper: JSONRpcMapper, + JSONRpcResponseValidator: JSONRpcResponseValidator, /** * Resolves the right provider adapter by the given parameters From d1dd87c4380ac3677d8b2424fd31ae728c90a08a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 18:44:17 +0200 Subject: [PATCH 0095/1045] naming of 'create' methods optimized, SubscriptionsResolver in eth package updated, AbstractWeb3Object optimized and codestyle improvements --- packages/web3-bzz/src/index.js | 4 +- .../src/{Batch.js => BatchRequest.js} | 10 +-- packages/web3-core-batch/src/index.js | 10 +-- packages/web3-core-method/src/index.js | 2 +- .../src/AbstractWeb3Object.js | 69 ++++++++++++++----- packages/web3-core-promievent/src/index.js | 4 +- packages/web3-core-subscription/src/index.js | 4 +- packages/web3-eth-abi/src/index.js | 4 +- packages/web3-eth-accounts/src/index.js | 4 +- packages/web3-eth-contract/src/index.js | 5 +- packages/web3-eth-ens/src/index.js | 4 +- packages/web3-eth-iban/src/index.js | 12 +--- packages/web3-eth-personal/src/index.js | 8 +-- packages/web3-eth/src/Eth.js | 22 ++++-- .../MethodModelFactory.js | 0 packages/web3-eth/src/index.js | 30 ++++---- .../src/resolvers/SubscriptionsResolver.js | 8 +-- packages/web3-net/src/index.js | 4 +- packages/web3-shh/src/index.js | 6 +- packages/web3/src/index.js | 16 ++--- 20 files changed, 133 insertions(+), 93 deletions(-) rename packages/web3-core-batch/src/{Batch.js => BatchRequest.js} (91%) rename packages/web3-eth/src/{factory => factories}/MethodModelFactory.js (100%) diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index 2ca7b6254a7..fee5ac2ab9c 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -31,13 +31,13 @@ module.exports = { /** * Returns the Bzz object * - * @method create + * @method createBzz * * @param {Object} provider * * @returns {Bzz} */ - create: function (provider) { + createBzz: function (provider) { return new Bzz(provider); } }; diff --git a/packages/web3-core-batch/src/Batch.js b/packages/web3-core-batch/src/BatchRequest.js similarity index 91% rename from packages/web3-core-batch/src/Batch.js rename to packages/web3-core-batch/src/BatchRequest.js index a963153e038..feb34330bd2 100644 --- a/packages/web3-core-batch/src/Batch.js +++ b/packages/web3-core-batch/src/BatchRequest.js @@ -33,7 +33,7 @@ var _ = require('underscore'); * * @constructor */ -function Batch(provider, jsonRpcMapper, jsonRpcResponseValidator) { +function BatchRequest(provider, jsonRpcMapper, jsonRpcResponseValidator) { this.provider = provider; this.jsonRpcMapper = jsonRpcMapper; this.jsonRpcResponseValidator = jsonRpcResponseValidator; @@ -47,7 +47,7 @@ function Batch(provider, jsonRpcMapper, jsonRpcResponseValidator) { * * @param {Object} request */ -Batch.prototype.add = function (request) { +BatchRequest.prototype.add = function (request) { this.requests.push(request); }; @@ -56,7 +56,7 @@ Batch.prototype.add = function (request) { * * @method execute */ -Batch.prototype.execute = function () { +BatchRequest.prototype.execute = function () { var self = this; this.provider.sendBatch( this.jsonRpcMapper.toBatchPayload(this.requests), @@ -100,8 +100,8 @@ Batch.prototype.execute = function () { * * @returns {Boolean} */ -Batch.prototype.hasOutputFormatter = function (request) { +BatchRequest.prototype.hasOutputFormatter = function (request) { return _.isFunction(request.methodModel.outputFormatter); }; -module.exports = Batch; +module.exports = BatchRequest; diff --git a/packages/web3-core-batch/src/index.js b/packages/web3-core-batch/src/index.js index 352663e5f55..e103ce4b276 100644 --- a/packages/web3-core-batch/src/index.js +++ b/packages/web3-core-batch/src/index.js @@ -21,7 +21,7 @@ "use strict"; var version = require('./package.json').version; -var Batch = require('./Batch'); +var BatchRequest = require('./BatchRequest'); var JSONRpcMapper = require('web3-core-providers').JSONRpcMapper; var JSONRpcResponseValidator = require('web3-core-providers').JSONRpcResponseValidator; @@ -31,13 +31,13 @@ module.exports = { /** * Returns the Batch object * - * @method create + * @method createBatchRequest * * @param {AbstractProviderAdapter} provider * - * @returns {Batch} + * @returns {BatchRequest} */ - create: function (provider) { - return new Batch(provider, JSONRpcMapper, JSONRpcResponseValidator); + createBatchRequest: function (provider) { + return new BatchRequest(provider, JSONRpcMapper, JSONRpcResponseValidator); } }; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 3b46c228733..ac8a33c8fe1 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -38,7 +38,7 @@ module.exports = { /** * Creates the Method object * - * @method create + * @method createMethodService * * @returns {MethodService} */ diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 4e08e927214..bbdbd49374c 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -42,9 +42,10 @@ function AbstractWeb3Object( subscriptionPackage, batchRequestPackage ) { - this.methodModelFactory = methodModelFactory; - this.methodService = methodService; - this.accounts = accounts; + if (!this.isDependencyGiven(providersPackage) && !this.isDependencyGiven(provider)) { + throw Error('Provider and the ProviderPackage not found!'); + } + this.providersPackage = providersPackage; this._provider = this.providersPackage.resolve(provider); this.givenProvider = this.providersPackage.detect(); @@ -55,16 +56,6 @@ function AbstractWeb3Object( WebsocketProvider: this.providersPackage.WebsocketProvider, }; - if (typeof batchRequestPackage !== 'undefined') { - this.BatchRequest = function BatchRequest() { - return batchRequestPackage.create(self.currentProvider); - }; - } - - if (typeof subscriptionPackage !== 'undefined') { - this.subscriptionPackage = subscriptionPackage; - } - Object.defineProperty(this, 'currentProvider', { get: function() { return this._provider; @@ -79,13 +70,45 @@ function AbstractWeb3Object( enumerable: true }); - return new Proxy(this, - { - get: this.proxyHandler - } - ) + if (this.isDependencyGiven(batchRequestPackage)) { + this.BatchRequest = function BatchRequest() { + return batchRequestPackage.createBatchRequest(self.currentProvider); + }; + } + + if (this.isDependencyGiven(subscriptionPackage)) { + this.subscriptionPackage = subscriptionPackage; + } + + if (this.isDependencyGiven(accounts)) { + this.accounts = accounts; + } + + if (this.isDependencyGiven(methodModelFactory) && this.isDependencyGiven(methodService)) { + this.methodModelFactory = methodModelFactory; + this.methodService = methodService; + + return new Proxy(this, + { + get: this.proxyHandler + } + ) + } } +/** + * Checks if the parameter is defined + * + * @method isDependencyGiven + * + * @param {*} object + * + * @returns {boolean} + */ +AbstractWeb3Object.prototype.isDependencyGiven = function(object) { + return object !== null || typeof object !== 'undefined'; +}; + /** * Sets the currentProvider and provider property * @@ -149,6 +172,16 @@ AbstractWeb3Object.prototype.extend = function (extension) { } }; +/** + * Handles method execution + * + * @method proxyHandler + * + * @param {Object} target + * @param {String} name + * + * @returns {*} + */ AbstractWeb3Object.prototype.proxyHandler = function(target, name) { if (target.methodModelFactory.hasMethodModel(name)) { var methodModel = target.methodModelFactory.createMethodModel(name); diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index 8f92e8a93cd..5230d659a83 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -31,9 +31,9 @@ module.exports = { /** * Returns PromiEvent object * - * @method create + * @method createPromiEvent */ - create: function() { + createPromiEvent: function() { return new PromiEvent(); } }; diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js index 291a5199150..850d5bab918 100644 --- a/packages/web3-core-subscription/src/index.js +++ b/packages/web3-core-subscription/src/index.js @@ -31,7 +31,7 @@ module.exports = { /** * Creates Subscription object * - * @method create + * @method createSubscription * * @param {Object} provider * @param {String} type @@ -42,7 +42,7 @@ module.exports = { * * @returns {Subscription} */ - create: function (provider, type, parameters, inputFormatters, outputFormatter, subscriptionType) { + createSubscription: function (provider, type, parameters, inputFormatters, outputFormatter, subscriptionType) { return new Subscription(provider, type, parameters, inputFormatters, outputFormatter, subscriptionType) } }; diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index 438a04b63cb..e0405ddef11 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -31,11 +31,11 @@ module.exports = { /** * Returns the ABICoder object * - * @method create + * @method createAbiCoder * * @returns {ABICoder} */ - create: function() { + createAbiCoder: function() { return new ABICoder(); } }; diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 5e0d4290e1b..01c335c05c3 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -35,13 +35,13 @@ module.exports = { /** * Returns the Accounts object * - * @method create + * @method createAccounts * * @params {Object} provider * * @returns {Accounts} */ - create: function(provider) { + createAccounts: function(provider) { return new Accounts(provider, ProvidersPackage, MethodPackage, Utils, formatters); } }; diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 3a64f0860cf..aeb9bf71269 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -27,8 +27,5 @@ var Contract = require('./Contract'); module.exports = { version: version, - - create: function () {// TODO: Refactor the contract object because of the new provider, method and subscription handling. - return Contract; - } + Contract: Contract }; diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index e737543c7f9..193d205e30c 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -29,13 +29,13 @@ module.exports = { /** * Returns the ENS object * - * @method create + * @method createENS * * @param {Eth} eth * * @returns {ENS} */ - create: function (eth) { //TODO: Remove circular dependency and refactore ENS because of the new method and connection handling + createENS: function (eth) { //TODO: Remove circular dependency and refactore ENS because of the new method and connection handling return new ENS(eth); } }; diff --git a/packages/web3-eth-iban/src/index.js b/packages/web3-eth-iban/src/index.js index 73766b77d0f..b1f897cffa5 100644 --- a/packages/web3-eth-iban/src/index.js +++ b/packages/web3-eth-iban/src/index.js @@ -27,15 +27,5 @@ var Iban = require('./Iban.js'); module.exports = { version: version, - - /** - * Returns the uninitiadted Iban object. - * - * @method create - * - * @returns {Iban} - */ - create: function () { - return Iban; - } + Iban: Iban }; diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 00c6f3b3d7d..dc36fa5b8b7 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -36,14 +36,14 @@ module.exports = { /** * Returns the Personal object * - * @param {any} provider + * @method createPersonal * - * @method create + * @param {any} provider * * @returns {Personal} */ - create: function (provider) { - return new Personal(provider, ProvidersPackage, MethodPackage, NetworkPackage.create(provider), Utils, formatters); + createPersonal: function (provider) { + return new Personal(provider, ProvidersPackage, MethodPackage, NetworkPackage.createNetwork(provider), Utils, formatters); } }; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index f12e98649b2..258dd5da136 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -36,9 +36,11 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {ENS} ens * @param {Utils} utils * @param {Object} formatters - * @param {MethodPackage} methodPackage * @param {ProvidersPackage} providersPackage * @param {SubscriptionsResolver} subscriptionsResolver + * @param {MethodModelFactory} methodModelFactory + * @param {MethodService} methodService + * @param {BatchRequestPackage} batchRequestPackage * * @constructor */ @@ -53,11 +55,23 @@ var Eth = function Eth( ens, utils, formatters, - methodPackage, providersPackage, - subscriptionsResolver + subscriptionsResolver, + methodService, + methodModelFactory, + batchRequestPackage ) { - AbstractWeb3Object.call(this, provider, providersPackage, methodPackage); + AbstractWeb3Object.call( + this, + provider, + providersPackage, + accounts, + methodService, + methodModelFactory, + null, + batchRequestPackage + ); + this.net = net; this.Contract = contract; this.accounts = accounts; diff --git a/packages/web3-eth/src/factory/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js similarity index 100% rename from packages/web3-eth/src/factory/MethodModelFactory.js rename to packages/web3-eth/src/factories/MethodModelFactory.js diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 002fed8ae58..66c3ccca340 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -24,9 +24,10 @@ var version = require('./package.json').version; var SubscriptionsResolver = require('./resolvers/SubscriptionsResolver'); +var MethodModelFactory = require('./factories/MethodModelFactory'); var Eth = require('./Eth'); var NetPackage = require('web3-net'); -var ContractPackage = require('web3-eth-contract'); +var Contract = require('web3-eth-contract').Contract; var AccountsPackage = require('web3-eth-accounts'); var PersonalPackage = require('web3-eth-personal'); var ENSPackage = require('web3-eth-ens'); @@ -34,10 +35,11 @@ var AbiPackage = require('web3-eth-abi'); var SubscriptionPackage = require('web3-core-subscription'); var PromiEventPackage = require('web3-core-promiEvent'); var ProvidersPackage = require('web3-core-providers'); -var Iban = require('web3-eth-iban').create(); +var Iban = require('web3-eth-iban').Iban; var formatters = require('web3-core-helpers').formatters; var Utils = require('web3-utils'); var MethodPackage = require('web3-core-method'); +var BatchRequestPackage = require('web3-core-batch'); module.exports = { version: version, @@ -45,27 +47,31 @@ module.exports = { /** * Creates the Eth object * - * @method create + * @method createEth * * @param {Object} provider * * @returns {Eth} */ - create: function (provider) { + createEth: function (provider) { + var accounts = AccountsPackage.createAccounts(provider); + return new Eth( provider, - NetPackage.create(provider), - ContractPackage.create(provider), - AccountsPackage.create(provider), - PersonalPackage.create(provider), + NetPackage.createNetwork(provider), + Contract, + accounts, + PersonalPackage.createPersonal(provider), Iban, - AbiPackage.create(utils), - ENSPackage.create(provider), + AbiPackage.createAbiCoder(utils), + ENSPackage.createENS(provider), Utils, formatters, - MethodPackage, ProvidersPackage, - new SubscriptionsResolver(provider, formatters, SubscriptionPackage, PromiEventPackage, ProvidersPackage) + new SubscriptionsResolver(provider, formatters, SubscriptionPackage, PromiEventPackage, ProvidersPackage), + MethodPackage.createMethodService(), + new MethodModelFactory(formatters, accounts), + BatchRequestPackage ); } }; diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index aea0cf2a74f..dc4198faa19 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -34,7 +34,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @constructor */ function SubscriptionsResolver(provider, formatters, subscriptionPackage, promiEventPackage, providersPackage) { - AbstractWeb3Object.call(provider, providersPackage, null, subscriptionPackage); + AbstractWeb3Object.call(this, provider, providersPackage, null, null, null, subscriptionPackage); this.formatters = formatters; this.promiEventPackage = promiEventPackage; } @@ -89,7 +89,7 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in parameters = []; } - return this.subscriptionPackage.create( + return this.subscriptionPackage.createSubscription( this.currentProvider, type, parameters, @@ -111,7 +111,7 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in * @returns {eventifiedPromise} */ SubscriptionsResolver.prototype.getLogsSubscription = function (parameters, callback) { - var promiEvent = this.promiEventPackage.create(); + var promiEvent = this.promiEventPackage.createPromiEvent(); if (this.hasFromBlockProperty(parameters[1])) { this.handleLogsSubscriptionWithFromBlock(parameters, promiEvent, callback); @@ -198,7 +198,7 @@ SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function ( * @returns {eventifiedPromise} */ SubscriptionsResolver.prototype.getSyncingSubscription = function (callback) { - var promiEvent = this.promiEventPackage.create(); + var promiEvent = this.promiEventPackage.createPromiEvent(); this.getSubscription( 'syncing', diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index 4eac6e28907..4730f0ee334 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -37,13 +37,13 @@ module.exports = { /** * Creates the Network Object * - * @method create + * @method createNetwork * * @param {Object} provider * * @returns {Network} */ - create: function (provider) { + createNetwork: function (provider) { return new Network(provider, ProvidersPackage, MethodPackage, formatters, utils) } }; diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 66a74eb2ab9..934c8ff352f 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -37,11 +37,11 @@ module.exports = { * * @param {Object} provider * - * @method create + * @method createShh * * @returns {Shh} */ - create: function (provider) { - return new Shh(provider, ProvidersPackage, MethodPackage, SubscriptionPackage, NetworkPackage.create(provider)); + createShh: function (provider) { + return new Shh(provider, ProvidersPackage, MethodPackage, SubscriptionPackage, NetworkPackage.createNetwork(provider)); } }; diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index c1f9ae1dd54..954cf58ef93 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -51,9 +51,9 @@ var Web3 = function Web3(provider, net) { } this.utils = Utils; - this.eth = EthPackage.create(this._provider); - this.shh = ShhPackage.create(this._provider); - this.bzz = BzzPackage.create(this._provider); + this.eth = EthPackage.createEth(this._provider); + this.shh = ShhPackage.createShh(this._provider); + this.bzz = BzzPackage.createBzz(this._provider); /** * Defines accessors for connectionModel @@ -94,19 +94,19 @@ Web3.utils = Utils; Web3.modules = { Eth: function (provider, net) { - return EthPackage.create(ProvidersPackage.resolve(provider, net)); + return EthPackage.createEth(ProvidersPackage.resolve(provider, net)); }, Net: function (provider, net) { - return NetworkPackage.create(ProvidersPackage.resolve(provider, net)); + return NetworkPackage.createNetwork(ProvidersPackage.resolve(provider, net)); }, Personal: function (provider, net) { - return PersonalPackage.create(ProvidersPackage.resolve(provider, net)); + return PersonalPackage.createPersonal(ProvidersPackage.resolve(provider, net)); }, Shh: function (provider, net) { - return ShhPackage.create(ProvidersPackage.resolve(provider, net)); + return ShhPackage.createShh(ProvidersPackage.resolve(provider, net)); }, Bzz: function (provider, net) { - return new BzzPackage.create(ProvidersPackage.resolve(provider, net)); + return new BzzPackage.createBzz(ProvidersPackage.resolve(provider, net)); } }; From 0eee16aceae8d98a5da08761113b91cbb953102a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 19:00:44 +0200 Subject: [PATCH 0096/1045] duplicated method error added to proxy handler in AbstractWeb3Object --- packages/web3-core-package/src/AbstractWeb3Object.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index bbdbd49374c..afbfc581add 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -184,6 +184,10 @@ AbstractWeb3Object.prototype.extend = function (extension) { */ AbstractWeb3Object.prototype.proxyHandler = function(target, name) { if (target.methodModelFactory.hasMethodModel(name)) { + if (typeof target[name] !== 'undefined') { + throw new Error('Duplicated method ' + name + '. This method is defined as RPC call and as Object method.'); + } + var methodModel = target.methodModelFactory.createMethodModel(name); var anonymousFunction = function() { From bed8938232f0bba1c880917c48d90cae701d99c1 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 19:23:29 +0200 Subject: [PATCH 0097/1045] MethodModels moved to web3-core-method because of duplication and refactoring of Accounts started --- packages/web3-core-method/src/index.js | 66 ++++++++++++- .../src/methods/CallMethodModel.js | 2 +- .../src/methods/EstimateGasMethodModel.js | 2 +- .../src/methods/GetCodeMethodModel.js | 2 +- .../src/methods/GetPastLogslMethodModel.js | 2 +- .../src/methods/GetStorageAtMethodModel.js | 2 +- .../src/methods/SignMethodModel.js | 2 +- .../methods/account/GetAccountsMethodModel.js | 2 +- .../methods/account/GetBalanceMethodModel.js | 2 +- .../account/GetTransactionCountMethodModel.js | 2 +- .../src/methods/block/GetBlockMethodModel.js | 2 +- .../block/GetBlockNumberMethodModel.js | 2 +- .../GetBlockTransactionCountMethodModel.js | 2 +- .../block/GetBlockUncleCountMethodModel.js | 2 +- .../src/methods/block/GetUncleMethodModel.js | 2 +- .../network/GetProtocolVersionMethodModel.js | 2 +- .../methods/node/GetCoinbaseMethodModel.js | 2 +- .../methods/node/GetGasPriceMethodModel.js | 2 +- .../methods/node/GetHashrateMethodModel.js | 2 +- .../methods/node/GetNodeInfoMethodModel.js | 2 +- .../src/methods/node/GetWorkMethodModel.js | 2 +- .../src/methods/node/IsMiningMethodModel.js | 2 +- .../src/methods/node/IsSyncingMethodModel.js | 2 +- .../src/methods/node/SubmitWorkMethodModel.js | 2 +- .../GetTransactionFromBlockMethodModel.js | 2 +- .../transaction/GetTransactionMethodModel.js | 2 +- .../GetTransactionReceiptMethodModel.js | 2 +- .../SendSignedTransactionMethodModel.js | 2 +- .../transaction/SendTransactionMethodModel.js | 2 +- .../transaction/SignTransactionMethodModel.js | 2 +- .../src/factories/MethodModelFactory.js | 45 +++++++++ .../src/factories/MethodModelFactory.js | 93 +++++++------------ 32 files changed, 170 insertions(+), 92 deletions(-) rename packages/{web3-eth => web3-core-method}/src/methods/CallMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/EstimateGasMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/GetCodeMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/GetPastLogslMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/GetStorageAtMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/SignMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/account/GetAccountsMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/account/GetBalanceMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/account/GetTransactionCountMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/block/GetBlockMethodModel.js (95%) rename packages/{web3-eth => web3-core-method}/src/methods/block/GetBlockNumberMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/block/GetBlockTransactionCountMethodModel.js (95%) rename packages/{web3-eth => web3-core-method}/src/methods/block/GetBlockUncleCountMethodModel.js (95%) rename packages/{web3-eth => web3-core-method}/src/methods/block/GetUncleMethodModel.js (95%) rename packages/{web3-eth => web3-core-method}/src/methods/network/GetProtocolVersionMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/node/GetCoinbaseMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/node/GetGasPriceMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/node/GetHashrateMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/node/GetNodeInfoMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/node/GetWorkMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/node/IsMiningMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/node/IsSyncingMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/node/SubmitWorkMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/transaction/GetTransactionFromBlockMethodModel.js (95%) rename packages/{web3-eth => web3-core-method}/src/methods/transaction/GetTransactionMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/transaction/GetTransactionReceiptMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/transaction/SendSignedTransactionMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/transaction/SendTransactionMethodModel.js (94%) rename packages/{web3-eth => web3-core-method}/src/methods/transaction/SignTransactionMethodModel.js (94%) create mode 100644 packages/web3-eth-accounts/src/factories/MethodModelFactory.js diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index ac8a33c8fe1..b5f4eb9bdb6 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -26,14 +26,76 @@ var version = require('./package.json'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); -var AbstractMethodModel = require('../lib/models/AbstractMethodModel'); var PromiEventPackage = require('web3-core-promievent'); var SubscriptionPackage = require('web3-core-subscription'); +// Methods +var GetProtocolVersionMethodModel = require('./methods/network/GetProtocolVersionMethodModel'); +var GetNodeInfoMethodModel = require('./methods/node/GetNodeInfoMethodModel'); +var GetCoinbaseMethodModel = require('./methods/node/GetCoinbaseMethodModel'); +var IsMiningMethodModel = require('./methods/node/IsMiningMethodModel'); +var GetHashrateMethodModel = require('./methods/node/GetHashrateMethodModel'); +var IsSyncingMethodModel = require('./methods/node/IsSyncingMethodModel'); +var GetGasPriceMethodModel = require('./methods/node/GetGasPriceMethodModel'); +var SubmitWorkMethodModel = require('./methods/node/SubmitWorkMethodModel'); +var GetWorkMethodModel = require('./methods/node/GetWorkMethodModel'); +var GetAccountsMethodModel = require('./methods/account/GetAccountsMethodModel'); +var GetBalanceMethodModel = require('./methods/account/GetBalanceMethodModel'); +var GetTransactionCountMethodModel = require('./methods/account/GetTransactionCountMethodModel'); +var GetBlockNumberMethodModel = require('./methods/block/GetBlockNumberMethodModel'); +var GetBlockMethodModel = require('./methods/block/GetBlockMethodModel'); +var GetUncleMethodModel = require('./methods/block/GetUncleMethodModel'); +var GetBlockTransactionCountMethodModel = require('./methods/block/GetBlockTransactionCountMethodModel'); +var GetBlockUncleCountMethodModel = require('./methods/block/GetBlockUncleCountMethodModel'); +var GetTransactionMethodModel = require('./methods/transaction/GetTransactionMethodModel'); +var GetTransactionFromBlockMethodModel = require('./methods/transaction/GetTransactionFromBlockMethodModel'); +var GetTransactionReceipt = require('./methods/transaction/GetTransactionReceipt'); +var SendSignedTransactionMethodModel = require('./methods/transaction/SendSignedTransactionMethodModel'); +var SignTransactionMethodModel = require('./methods/transaction/SignTransactionMethodModel'); +var SendTransactionMethodModel = require('./methods/transaction/SendTransactionMethodModel'); +var GetCodeMethodModel = require('./methods/GetCodeMethodModel'); +var SignMethodModel = require('./methods/SignMethodModel'); +var CallMethodModel = require('./methods/CallMethodModel'); +var GetStroageAtMethodModel = require('./methods/GetStroageAtMethodModel'); +var EstimateGasMethodModel = require('./methods/EstimateGasMethodModel'); +var GetPastLogsMethodModel = require('./methods/GetPastLogsMethodModel'); + module.exports = { version: version, AbstractMethodModelFactory: AbstractMethodModelFactory, - AbstractMethodModel: AbstractMethodModel, + + /** + * Methods + */ + GetNodeInfoMethodModel: GetNodeInfoMethodModel, + GetProtocolVersionMethodModel: GetProtocolVersionMethodModel, + GetCoinbaseMethodModel: GetCoinbaseMethodModel, + IsMiningMethodModel: IsMiningMethodModel, + GetHashrateMethodModel: GetHashrateMethodModel, + IsSyncingMethodModel: IsSyncingMethodModel, + GetGasPriceMethodModel: GetGasPriceMethodModel, + GetAccountsMethodModel: GetAccountsMethodModel, + GetBlockNumberMethodModel: GetBlockNumberMethodModel, + GetBalanceMethodModel: GetBalanceMethodModel, + GetStroageAtMethodModel: GetStroageAtMethodModel, + GetCodeMethodModel: GetCodeMethodModel, + GetBlockMethodModel: GetBlockMethodModel, + GetUncleMethodModel: GetUncleMethodModel, + GetBlockTransactionCountMethodModel: GetBlockTransactionCountMethodModel, + GetBlockUncleCountMethodModel: GetBlockUncleCountMethodModel, + GetTransactionMethodModel: GetTransactionMethodModel, + GetTransactionFromBlockMethodModel: GetTransactionFromBlockMethodModel, + GetTransactionReceipt: GetTransactionReceipt, + GetTransactionCountMethodModel: GetTransactionCountMethodModel, + SendSignedTransactionMethodModel: SendSignedTransactionMethodModel, + SignTransactionMethodModel: SignTransactionMethodModel, + SendTransactionMethodModel: SendTransactionMethodModel, + SignMethodModel: SignMethodModel, + CallMethodModel: CallMethodModel, + EstimateGasMethodModel: EstimateGasMethodModel, + SubmitWorkMethodModel: SubmitWorkMethodModel, + GetWorkMethodModel: GetWorkMethodModel, + GetPastLogsMethodModel: GetPastLogsMethodModel, /** * Creates the Method object diff --git a/packages/web3-eth/src/methods/CallMethodModel.js b/packages/web3-core-method/src/methods/CallMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/CallMethodModel.js rename to packages/web3-core-method/src/methods/CallMethodModel.js index ceb00ad1dfd..fee0c0c3976 100644 --- a/packages/web3-eth/src/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/methods/CallMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/methods/EstimateGasMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/EstimateGasMethodModel.js rename to packages/web3-core-method/src/methods/EstimateGasMethodModel.js index db1026d69a1..5db7ed9e5b2 100644 --- a/packages/web3-eth/src/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/methods/EstimateGasMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/methods/GetCodeMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/GetCodeMethodModel.js rename to packages/web3-core-method/src/methods/GetCodeMethodModel.js index 63311932e01..f89191f5ebc 100644 --- a/packages/web3-eth/src/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/methods/GetCodeMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/GetPastLogslMethodModel.js b/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/GetPastLogslMethodModel.js rename to packages/web3-core-method/src/methods/GetPastLogslMethodModel.js index 57db6c8214e..47e09093697 100644 --- a/packages/web3-eth/src/methods/GetPastLogslMethodModel.js +++ b/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/GetStorageAtMethodModel.js rename to packages/web3-core-method/src/methods/GetStorageAtMethodModel.js index e1f561b43a0..701918dfbd3 100644 --- a/packages/web3-eth/src/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/SignMethodModel.js b/packages/web3-core-method/src/methods/SignMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/SignMethodModel.js rename to packages/web3-core-method/src/methods/SignMethodModel.js index fdc0ab1359d..c7bdd558edb 100644 --- a/packages/web3-eth/src/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/methods/SignMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/account/GetAccountsMethodModel.js rename to packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js index b638d566041..f321909c605 100644 --- a/packages/web3-eth/src/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/account/GetBalanceMethodModel.js rename to packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js index 54914dd094f..3ed9319cbe9 100644 --- a/packages/web3-eth/src/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/account/GetTransactionCountMethodModel.js rename to packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js index 1abd45fe39d..721b3e9d57c 100644 --- a/packages/web3-eth/src/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js similarity index 95% rename from packages/web3-eth/src/methods/block/GetBlockMethodModel.js rename to packages/web3-core-method/src/methods/block/GetBlockMethodModel.js index eb26148d75e..0184a801a57 100644 --- a/packages/web3-eth/src/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js rename to packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js index 1de0e0d69e5..be8648019a2 100644 --- a/packages/web3-eth/src/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js similarity index 95% rename from packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js rename to packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js index d7a1b546643..76663c12b7b 100644 --- a/packages/web3-eth/src/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js similarity index 95% rename from packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js rename to packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js index 357ca347b37..04f90eda913 100644 --- a/packages/web3-eth/src/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js similarity index 95% rename from packages/web3-eth/src/methods/block/GetUncleMethodModel.js rename to packages/web3-core-method/src/methods/block/GetUncleMethodModel.js index 2f11dbc34a6..1d0bc5e440f 100644 --- a/packages/web3-eth/src/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js rename to packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js index 947cdba13d7..9843330468a 100644 --- a/packages/web3-eth/src/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js rename to packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js index 88add101173..f849b660b56 100644 --- a/packages/web3-eth/src/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js rename to packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js index d9daa842a88..8467c803708 100644 --- a/packages/web3-eth/src/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/node/GetHashrateMethodModel.js rename to packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js index 3684dba5932..3004212de92 100644 --- a/packages/web3-eth/src/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js rename to packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js index 92d829d703b..83dbd640125 100644 --- a/packages/web3-eth/src/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/node/GetWorkMethodModel.js rename to packages/web3-core-method/src/methods/node/GetWorkMethodModel.js index 11712b86704..8af0bf37eeb 100644 --- a/packages/web3-eth/src/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/node/IsMiningMethodModel.js rename to packages/web3-core-method/src/methods/node/IsMiningMethodModel.js index 2471dd38102..95e98b862f8 100644 --- a/packages/web3-eth/src/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/node/IsSyncingMethodModel.js rename to packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js index 64f88549e56..8b13963d3df 100644 --- a/packages/web3-eth/src/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js rename to packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js index 71494423c61..a4ff60dbeb4 100644 --- a/packages/web3-eth/src/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js similarity index 95% rename from packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js rename to packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js index 6184ab366b9..365a4f285ed 100644 --- a/packages/web3-eth/src/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js rename to packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js index 094b78c61ca..11cc39bf962 100644 --- a/packages/web3-eth/src/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js rename to packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js index ef83a108aea..db572065ce3 100644 --- a/packages/web3-eth/src/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js rename to packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js index a2372c2d80d..f07121c3c21 100644 --- a/packages/web3-eth/src/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js rename to packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js index d9f061efb33..4870de20aaa 100644 --- a/packages/web3-eth/src/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js similarity index 94% rename from packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js rename to packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js index e08c731af8a..4d579c2420a 100644 --- a/packages/web3-eth/src/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('web3-core-method').AbstractMethodModel; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js new file mode 100644 index 00000000000..ae8025e459d --- /dev/null +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -0,0 +1,45 @@ +/* + 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 . + */ +/** + * @file MethodModelFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var web3CoreMethod = require('web3-core-method'); + +/** + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function MethodModelFactory(formatters, accounts) { + web3CoreMethod.AbstractMethodModelFactory.call(this, formatters, accounts); + + this.methodModels = { + getGasPrice: web3CoreMethod.GetGasPriceMethodModel, + getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel + }; + +} + +MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); + +module.exports = MethodModelFactory; diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 0d98a7894c8..742cf4f2d06 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -22,36 +22,7 @@ "use strict"; -var AbstractMethodModelFactory = require('web3-core-method').AbstractMethodModelFactory; -var GetProtocolVersionMethodModel = require('../methods/network/GetProtocolVersionMethodModel'); -var GetNodeInfoMethodModel = require('../methods/node/GetNodeInfoMethodModel'); -var GetCoinbaseMethodModel = require('../methods/node/GetCoinbaseMethodModel'); -var IsMiningMethodModel = require('../methods/node/IsMiningMethodModel'); -var GetHashrateMethodModel = require('../methods/node/GetHashrateMethodModel'); -var IsSyncingMethodModel = require('../methods/node/IsSyncingMethodModel'); -var GetGasPriceMethodModel = require('../methods/node/GetGasPriceMethodModel'); -var SubmitWorkMethodModel = require('../methods/node/SubmitWorkMethodModel'); -var GetWorkMethodModel = require('../methods/node/GetWorkMethodModel'); -var GetAccountsMethodModel = require('../methods/account/GetAccountsMethodModel'); -var GetBalanceMethodModel = require('../methods/account/GetBalanceMethodModel'); -var GetTransactionCountMethodModel = require('../methods/account/GetTransactionCountMethodModel'); -var GetBlockNumberMethodModel = require('../methods/block/GetBlockNumberMethodModel'); -var GetBlockMethodModel = require('../methods/block/GetBlockMethodModel'); -var GetUncleMethodModel = require('../methods/block/GetUncleMethodModel'); -var GetBlockTransactionCountMethodModel = require('../methods/block/GetBlockTransactionCountMethodModel'); -var GetBlockUncleCountMethodModel = require('../methods/block/GetBlockUncleCountMethodModel'); -var GetTransactionMethodModel = require('../methods/transaction/GetTransactionMethodModel'); -var GetTransactionFromBlockMethodModel = require('../methods/transaction/GetTransactionFromBlockMethodModel'); -var GetTransactionReceipt = require('../methods/transaction/GetTransactionReceipt'); -var SendSignedTransactionMethodModel = require('../methods/transaction/SendSignedTransactionMethodModel'); -var SignTransactionMethodModel = require('../methods/transaction/SignTransactionMethodModel'); -var SendTransactionMethodModel = require('../methods/transaction/SendTransactionMethodModel'); -var GetCodeMethodModel = require('../methods/GetCodeMethodModel'); -var SignMethodModel = require('../methods/SignMethodModel'); -var CallMethodModel = require('../methods/CallMethodModel'); -var GetStroageAtMethodModel = require('../methods/GetStroageAtMethodModel'); -var EstimateGasMethodModel = require('../methods/EstimateGasMethodModel'); -var GetPastLogsMethodModel = require('../methods/GetPastLogsMethodModel'); +var web3CoreMethod = require('web3-core-method'); /** * @param {Object} formatters @@ -60,42 +31,42 @@ var GetPastLogsMethodModel = require('../methods/GetPastLogsMethodModel'); * @constructor */ function MethodModelFactory(formatters, accounts) { - AbstractMethodModelFactory.call(this, formatters, accounts); + web3CoreMethod.AbstractMethodModelFactory.call(this, formatters, accounts); this.methodModels = { - getNodeInfo: GetNodeInfoMethodModel, - getProtocolVersion: GetProtocolVersionMethodModel, - getCoinbase: GetCoinbaseMethodModel, - isMining: IsMiningMethodModel, - getHashrate: GetHashrateMethodModel, - isSyncing: IsSyncingMethodModel, - getGasPrice: GetGasPriceMethodModel, - getAccounts: GetAccountsMethodModel, - getBlockNumber: GetBlockNumberMethodModel, - getBalance: GetBalanceMethodModel, - getStorageAt: GetStroageAtMethodModel, - getCode: GetCodeMethodModel, - getBlock: GetBlockMethodModel, - getUncle: GetUncleMethodModel, - getBlockTransactionCount: GetBlockTransactionCountMethodModel, - getBlockUncleCount: GetBlockUncleCountMethodModel, - getTransaction: GetTransactionMethodModel, - getTransactionFromBlock: GetTransactionFromBlockMethodModel, - getTransactionReceipt: GetTransactionReceipt, - getTransactionCount: GetTransactionCountMethodModel, - sendSignedTransaction: SendSignedTransactionMethodModel, - signTransaction: SignTransactionMethodModel, - sendTransaction: SendTransactionMethodModel, - sign: SignMethodModel, - call: CallMethodModel, - estimateGas: EstimateGasMethodModel, - submitWork: SubmitWorkMethodModel, - getWork: GetWorkMethodModel, - getPastLogs: GetPastLogsMethodModel + getNodeInfo: web3CoreMethod.GetNodeInfoMethodModel, + getProtocolVersion: web3CoreMethod.GetProtocolVersionMethodModel, + getCoinbase: web3CoreMethod.GetCoinbaseMethodModel, + isMining: web3CoreMethod.IsMiningMethodModel, + getHashrate: web3CoreMethod.GetHashrateMethodModel, + isSyncing: web3CoreMethod.IsSyncingMethodModel, + getGasPrice: web3CoreMethod.GetGasPriceMethodModel, + getAccounts: web3CoreMethod.GetAccountsMethodModel, + getBlockNumber: web3CoreMethod.GetBlockNumberMethodModel, + getBalance: web3CoreMethod.GetBalanceMethodModel, + getStorageAt: web3CoreMethod.GetStroageAtMethodModel, + getCode: web3CoreMethod.GetCodeMethodModel, + getBlock: web3CoreMethod.GetBlockMethodModel, + getUncle: web3CoreMethod.GetUncleMethodModel, + getBlockTransactionCount: web3CoreMethod.GetBlockTransactionCountMethodModel, + getBlockUncleCount: web3CoreMethod.GetBlockUncleCountMethodModel, + getTransaction: web3CoreMethod.GetTransactionMethodModel, + getTransactionFromBlock: web3CoreMethod.GetTransactionFromBlockMethodModel, + getTransactionReceipt: web3CoreMethod.GetTransactionReceipt, + getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, + sendSignedTransaction: web3CoreMethod.SendSignedTransactionMethodModel, + signTransaction: web3CoreMethod.SignTransactionMethodModel, + sendTransaction: web3CoreMethod.SendTransactionMethodModel, + sign: web3CoreMethod.SignMethodModel, + call: web3CoreMethod.CallMethodModel, + estimateGas: web3CoreMethod.EstimateGasMethodModel, + submitWork: web3CoreMethod.SubmitWorkMethodModel, + getWork: web3CoreMethod.GetWorkMethodModel, + getPastLogs: web3CoreMethod.GetPastLogsMethodModel }; } -MethodModelFactory.prototype = Object.create(AbstractMethodModelFactory); +MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); module.exports = MethodModelFactory; From a29e442711a249796867939fecbf25cab0420322 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 19:45:56 +0200 Subject: [PATCH 0098/1045] GetIdMethodModel added, utils added to MethodModelFactories, Accounts refactored and refactoring of Personal started --- .../factories/AbstractMethodModelFactory.js | 6 ++- .../web3-core-method/src/MethodService.js | 2 +- packages/web3-core-method/src/index.js | 4 +- .../src/methods/network/GetIdMethodModel.js | 47 +++++++++++++++++++ packages/web3-eth-accounts/src/Accounts.js | 37 ++------------- .../src/factories/MethodModelFactory.js | 9 ++-- packages/web3-eth-accounts/src/index.js | 10 +++- packages/web3-eth-personal/src/Personal.js | 8 ++-- .../src/factories/MethodModelFactory.js | 5 +- packages/web3-eth/src/index.js | 2 +- 10 files changed, 83 insertions(+), 47 deletions(-) create mode 100644 packages/web3-core-method/src/methods/network/GetIdMethodModel.js diff --git a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js index 6f64a00bf68..100420c2874 100644 --- a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js +++ b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js @@ -23,12 +23,14 @@ "use strict"; /** + * @param {Utils} utils * @param {Object} formatters * @param {Accounts} accounts * * @constructor */ -function AbstractMethodModelFactory(formatters, accounts) { +function AbstractMethodModelFactory(utils, formatters, accounts) { + this.utils = utils; this.formatters = formatters; this.accounts = accounts; this.methodModels = {}; @@ -39,7 +41,7 @@ AbstractMethodModelFactory.prototype.hasMethodModel = function (name) { }; AbstractMethodModelFactory.prototype.createMethodModel = function (name) { - return new this.methodModels[name](this.formatters, this.accounts); + return new this.methodModels[name](this.utils, this.formatters, this.accounts); }; module.exports = AbstractMethodModelFactory; diff --git a/packages/web3-core-method/src/MethodService.js b/packages/web3-core-method/src/MethodService.js index f27ad3ae310..dac7698682e 100644 --- a/packages/web3-core-method/src/MethodService.js +++ b/packages/web3-core-method/src/MethodService.js @@ -85,7 +85,7 @@ MethodService.prototype.send = function (methodModel, provider, accounts, parame var self = this; var promiEvent = this.promiEventPackage.createPromiEvent(); - if (accounts.wallet.length > 0) { + if (accounts && accounts.wallet.length > 0) { if (this.methodModel.isSign()) { return this.messageSigner.sign(parameters[0], parameters[1], accounts); } diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index b5f4eb9bdb6..358d6cecbc2 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -31,6 +31,7 @@ var SubscriptionPackage = require('web3-core-subscription'); // Methods var GetProtocolVersionMethodModel = require('./methods/network/GetProtocolVersionMethodModel'); +var GetIdMethodModel = require('./methods/network/GetIdMethodModel'); var GetNodeInfoMethodModel = require('./methods/node/GetNodeInfoMethodModel'); var GetCoinbaseMethodModel = require('./methods/node/GetCoinbaseMethodModel'); var IsMiningMethodModel = require('./methods/node/IsMiningMethodModel'); @@ -67,8 +68,9 @@ module.exports = { /** * Methods */ - GetNodeInfoMethodModel: GetNodeInfoMethodModel, GetProtocolVersionMethodModel: GetProtocolVersionMethodModel, + GetIdMethodModel: GetIdMethodModel, + GetNodeInfoMethodModel: GetNodeInfoMethodModel, GetCoinbaseMethodModel: GetCoinbaseMethodModel, IsMiningMethodModel: IsMiningMethodModel, GetHashrateMethodModel: GetHashrateMethodModel, diff --git a/packages/web3-core-method/src/methods/network/GetIdMethodModel.js b/packages/web3-core-method/src/methods/network/GetIdMethodModel.js new file mode 100644 index 00000000000..c601519d324 --- /dev/null +++ b/packages/web3-core-method/src/methods/network/GetIdMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetIdMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetIdMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'eth_protocolVersion', + 0, + null, + utils.hexToNumber, + accounts + ) +} + +GetIdMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetIdMethodModel; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index e6972f99cfe..7cb2811d1b7 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -56,47 +56,20 @@ var makeEven = function (hex) { /** * @param {any} provider * @param {ProvidersPackage} providersPackage - * @param {MethodPackage} methodPackage + * @param {MethodService} methodService + * @param {MethodModelFactory} methodModelFactory * @param {Utils} utils * @param {Object} formatters * * @constructor */ -var Accounts = function Accounts(provider, providersPackage, methodPackage, utils, formatters) { - AbstractWeb3Object.call(provider, providersPackage, methodPackage); +var Accounts = function Accounts(provider, providersPackage, methodService, methodModelFactory, utils, formatters) { + AbstractWeb3Object.call(this, provider, providersPackage, this, methodService, methodModelFactory); this.utils = utils; this.formatters = formatters; this.wallet = new Wallet(this); }; -/** - * Gets the gasPrice of the connected node - * - * @method getGasPrice - * - * @returns {Promise} - */ -Accounts.prototype.getGasPrice = function () { - return this.methodPackage.create(this.currentProvider, 'eth_gasPrice').send(); -}; - -/** - * Gets the transaction count of an address - * - * @method getTransactionCount - * - * @param {String} address - * - * @returns {Promise} - */ -Accounts.prototype.getTransactionCount = function (address) { - if (this.utils.isAddress(address)) { - throw new Error('Address '+ address +' is not a valid address to get the "transactionCount".'); - } - - return this.methodPackage.create(this.currentProvider, 'eth_getTransactionCount', [address, 'latest'], ).send(); -}; - /** * Adds the account functions to the given object * @@ -254,7 +227,7 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca // Otherwise, get the missing info from the Ethereum Node return Promise.all([ - isNot(tx.chainId) ? _this.connectionModel.getId() : tx.chainId, + isNot(tx.chainId) ? _this.getId() : tx.chainId, isNot(tx.gasPrice) ? _this.getGasPrice() : tx.gasPrice, isNot(tx.nonce) ? _this.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce ]).then(function (args) { diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js index ae8025e459d..b6a1ad2e996 100644 --- a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -25,17 +25,18 @@ var web3CoreMethod = require('web3-core-method'); /** + * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function MethodModelFactory(formatters, accounts) { - web3CoreMethod.AbstractMethodModelFactory.call(this, formatters, accounts); +function MethodModelFactory(utils, formatters) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); this.methodModels = { getGasPrice: web3CoreMethod.GetGasPriceMethodModel, - getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel + getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, + getId: web3CoreMethod.GetIdMethodModel }; } diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 01c335c05c3..addd4fcab36 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -28,6 +28,7 @@ var MethodPackage = require('web3-core-method'); var ProvidersPackage = require('web3-core-providers'); var Utils = require('web3-utils'); var formatters = require('web3-helpers').formatters; +var MethodModelFactory = require('./factories/MethodModelFactory'); module.exports = { version: version, @@ -42,6 +43,13 @@ module.exports = { * @returns {Accounts} */ createAccounts: function(provider) { - return new Accounts(provider, ProvidersPackage, MethodPackage, Utils, formatters); + return new Accounts( + provider, + ProvidersPackage, + MethodPackage.createMethodService(), + new MethodModelFactory(Utils, formatters), + Utils, + formatters + ); } }; diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 2f56795624d..98cfcc12efc 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -29,15 +29,17 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * * @param {any} provider * @param {ProvidersPackage} providersPackage - * @param {MethodPackage} methodPackage + * @param {Accounts} accounts + * @param {MethodService} methodService + * @param {MethodModelFactory} methodModelFactory * @param {Network} net * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function Personal(provider, providersPackage, methodPackage, net, utils, formatters) { - AbstractWeb3Object.call(provider, providersPackage, methodPackage); +function Personal(provider, providersPackage, accounts, methodService, methodModelFactory, net, utils, formatters) { + AbstractWeb3Object.call(provider, providersPackage, accounts, methodService, methodModelFactory); this.utils = utils; this.formatters = formatters; this.net = net; diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 742cf4f2d06..1c8e2b84e0a 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -25,13 +25,14 @@ var web3CoreMethod = require('web3-core-method'); /** + * @param {Utils} utils * @param {Object} formatters * @param {Accounts} accounts * * @constructor */ -function MethodModelFactory(formatters, accounts) { - web3CoreMethod.AbstractMethodModelFactory.call(this, formatters, accounts); +function MethodModelFactory(utils, formatters, accounts) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters, accounts); this.methodModels = { getNodeInfo: web3CoreMethod.GetNodeInfoMethodModel, diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 66c3ccca340..35e0b0c5efc 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -70,7 +70,7 @@ module.exports = { ProvidersPackage, new SubscriptionsResolver(provider, formatters, SubscriptionPackage, PromiEventPackage, ProvidersPackage), MethodPackage.createMethodService(), - new MethodModelFactory(formatters, accounts), + new MethodModelFactory(Utils, formatters, accounts), BatchRequestPackage ); } From 8d47290dd8038be434a936ccd2b79bca844a671f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 20:13:31 +0200 Subject: [PATCH 0099/1045] Personal refactored --- packages/web3-core-method/src/index.js | 18 ++ .../methods/personal/EcRecoverMethodModel.js | 51 +++++ .../personal/ImportRawKeyMethodModel.js | 47 ++++ .../personal/ListAccountsMethodModel.js | 47 ++++ .../personal/LockAccountMethodModel.js | 47 ++++ .../methods/personal/NewAccountMethodModel.js | 47 ++++ .../PersonalSendTransactionMethodModel.js | 50 ++++ .../personal/PersonalSignMethodModel.js | 51 +++++ .../PersonalSignTransactionMethodModel.js | 50 ++++ .../personal/UnlockAccountMethodModel.js | 51 +++++ packages/web3-eth-personal/src/Personal.js | 215 ------------------ .../src/factories/MethodModelFactory.js | 52 +++++ packages/web3-eth-personal/src/index.js | 12 +- .../src/factories/MethodModelFactory.js | 52 +++++ 14 files changed, 574 insertions(+), 216 deletions(-) create mode 100644 packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js create mode 100644 packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js create mode 100644 packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js create mode 100644 packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js create mode 100644 packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js create mode 100644 packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js create mode 100644 packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js create mode 100644 packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js create mode 100644 packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js create mode 100644 packages/web3-eth-personal/src/factories/MethodModelFactory.js create mode 100644 packages/web3-net/src/factories/MethodModelFactory.js diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 358d6cecbc2..8befc08b41e 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -60,6 +60,15 @@ var CallMethodModel = require('./methods/CallMethodModel'); var GetStroageAtMethodModel = require('./methods/GetStroageAtMethodModel'); var EstimateGasMethodModel = require('./methods/EstimateGasMethodModel'); var GetPastLogsMethodModel = require('./methods/GetPastLogsMethodModel'); +var EcRecoverMethodModel = require('./methods/personal/EcRecoverMethodModel'); +var ImportRawKeyMethodModel = require('./methods/personal/ImportRawKeyMethodModel'); +var ListAccountsMethodModel = require('./methods/personal/ListAccountsMethodModel'); +var LockAccountMethodModel = require('./methods/personal/LockAccountMethodModel'); +var NewAccountMethodModel = require('./methods/personal/NewAccountMethodModel'); +var PersonalSendTransactionMethodModel = require('./methods/personal/PersonalSendTransactionMethodModel'); +var PersonalSignMethodModel = require('./methods/personal/PersonalSignMethodModel'); +var PersonalSignTransactionMethodModel = require('./methods/personal/PersonalSignTransactionMethodModel'); +var UnlockAccountMethodModel = require('./methods/personal/UnlockAccountMethodModel'); module.exports = { version: version, @@ -98,6 +107,15 @@ module.exports = { SubmitWorkMethodModel: SubmitWorkMethodModel, GetWorkMethodModel: GetWorkMethodModel, GetPastLogsMethodModel: GetPastLogsMethodModel, + EcRecoverMethodModel: EcRecoverMethodModel, + ImportRawKeyMethodModel: ImportRawKeyMethodModel, + ListAccountsMethodModel: ListAccountsMethodModel, + LockAccountMethodModel: LockAccountMethodModel, + NewAccountMethodModel: NewAccountMethodModel, + PersonalSendTransactionMethodModel: PersonalSendTransactionMethodModel, + PersonalSignMethodModel: PersonalSignMethodModel, + PersonalSignTransactionMethodModel: PersonalSignTransactionMethodModel, + UnlockAccountMethodModel: UnlockAccountMethodModel, /** * Creates the Method object diff --git a/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js new file mode 100644 index 00000000000..b0507f23a9c --- /dev/null +++ b/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js @@ -0,0 +1,51 @@ +/* + 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 . + */ +/** + * @file EcRecoverMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function EcRecoverMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'personal_ecRecover', + 3, + [ + formatters.inputSignFormatter, + formatters.inputAddressFormatter, + null + ], + null, + accounts + ) +} + +EcRecoverMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = EcRecoverMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js new file mode 100644 index 00000000000..cf82a0b7767 --- /dev/null +++ b/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file ImportRawKeyMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function ImportRawKeyMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'personal_importRawKey', + 2, + null, + null, + accounts + ) +} + +ImportRawKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = ImportRawKeyMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js new file mode 100644 index 00000000000..3de70395543 --- /dev/null +++ b/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file ListAccountsMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function ListAccountsMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'personal_listAccounts', + 0, + null, + utils.toChecksumAddress, + accounts + ) +} + +ListAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = ListAccountsMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js new file mode 100644 index 00000000000..daf811ae890 --- /dev/null +++ b/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file LockAccountMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function LockAccountMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'personal_lockAccount', + 1, + [formatters.inputAddressFormatter], + null, + accounts + ) +} + +LockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = LockAccountMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js new file mode 100644 index 00000000000..31123c12041 --- /dev/null +++ b/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file NewAccountMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function NewAccountMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'personal_newAccount', + 0, + null, + utils.toChecksumAddress, + accounts + ) +} + +NewAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = NewAccountMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js new file mode 100644 index 00000000000..b5a3d972936 --- /dev/null +++ b/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js @@ -0,0 +1,50 @@ +/* + 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 . + */ +/** + * @file PersonalSendTransactionMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function PersonalSendTransactionMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'personal_sendTransaction', + 2, + [ + formatters.inputTransactionFormatter, + null + ], + null, + accounts + ) +} + +PersonalSendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = PersonalSendTransactionMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js new file mode 100644 index 00000000000..2a0e06a407f --- /dev/null +++ b/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js @@ -0,0 +1,51 @@ +/* + 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 . + */ +/** + * @file PersonalSignMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function PersonalSignMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'personal_sign', + 3, + [ + formatters.inputSignFormatter, + formatters.inputAddressFormatter, + null + ], + null, + accounts + ) +} + +PersonalSignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = PersonalSignMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js new file mode 100644 index 00000000000..300443ca7d6 --- /dev/null +++ b/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js @@ -0,0 +1,50 @@ +/* + 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 . + */ +/** + * @file PersonalSignTransactionMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function PersonalSignTransactionMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'personal_signTransaction', + 2, + [ + formatters.inputTransactionFormatter, + null + ], + null, + accounts + ) +} + +PersonalSignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = PersonalSignTransactionMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js new file mode 100644 index 00000000000..38ea8508fb2 --- /dev/null +++ b/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js @@ -0,0 +1,51 @@ +/* + 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 . + */ +/** + * @file UnlockAccountMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function UnlockAccountMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'personal_unlockAccount', + 3, + [ + formatters.inputAddressFormatter, + null, + null + ], + null, + accounts + ) +} + +UnlockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = UnlockAccountMethodModel; diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 98cfcc12efc..0cafb05e9a8 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -45,221 +45,6 @@ function Personal(provider, providersPackage, accounts, methodService, methodMod this.net = net; } -/** - * Gets a list of accounts - * - * @method getAccounts - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * - * @returns {Promise} - */ -Personal.prototype.getAccounts = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'personal_listAccounts', - null, - null, - this.utils.toChecksumAddress - ).send(callback); -}; - -/** - * Creates an new account - * - * @method newAccount - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Personal.prototype.newAccount = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'personal_newAccount', - null, - null, - this.utils.toChecksumAddress - ).send(callback); -}; - -/** - * Unlocks an account - * TODO: Fix typo in documentation - * - * @method unlockAccount - * - * @param {String} address - * @param {String} password - * @param {Number} unlockDuration - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Personal.prototype.unlockAccount = function (address, password, unlockDuration, callback) { - return this.methodPackage.create( - this.currentProvider, - 'personal_unlockAccount', - [address, password, unlockDuration], - [ - this.formatters.inputAddressFormatter, - null, - null - ], - null - ).send(callback); -}; - -/** - * Locks a account by the given address - * - * @method lockAccount - * - * @param {String} address - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Personal.prototype.lockAccount = function (address, callback) { - return this.methodPackage.create( - this.currentProvider, - 'personal_lockAccount', - [address], - [this.formatters.inputAddressFormatter], - null - ).send(callback); -}; - -/** - * Imports the unencrypted key in to the keystore and encrypt it with the given passphrase - * - * @method importRawKey - * - * @param {String} keydata - * @param {String} passphrase - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Personal.prototype.importRawKey = function (keydata, passphrase, callback) { - return this.methodPackage.create( - this.currentProvider, - 'personal_importRawKey', - [keydata, passphrase], - null, - null - ).send(callback); -}; - -/** - * Sends the transaction - * - * @method sendTransaction - * - * @param {Object} transactionObject - * @param {String} passphrase - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Personal.prototype.sendTransaction = function (transactionObject, passphrase, callback) { - return this.methodPackage.create( - this.currentProvider, - 'personal_sendTransaction', - [transactionObject, passphrase], - [ - this.formatters.inputTransactionFormatter, - null - ], - null - ).send(callback); -}; - -/** - * Signs the given transaction - * - * @method signTransaction - * - * @param {Object} transactionObject - * @param {String} passphrase - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Personal.prototype.signTransaction = function (transactionObject, passphrase, callback) { - return this.methodPackage.create( - this.currentProvider, - 'personal_signTransaction', - [transactionObject, passphrase], - [ - this.formatters.inputTransactionFormatter, - null - ], - null - ).send(callback); -}; - -/** - * Signs a given string - * - * @method sign - * - * @param {String} data - * @param {String} address - * @param {String} password - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Personal.prototype.sign = function (data, address, password, callback) { - return this.methodPackage.create( - this.currentProvider, - 'personal_sign', - [data, address, password], - [ - this.formatters.inputSignFormatter, - this.formatters.inputAddressFormatter, - null - ], - null - ).send(callback); -}; - -/** - * Recovers a signed string - * - * @method ecRecover - * - * @param {String} data - * @param {String} signature - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Personal.prototype.ecRecover = function (data, signature, callback) { - return this.methodPackage.create( - this.currentProvider, - 'personal_ecRecover', - [data, address, password], - [ - this.formatters.inputSignFormatter, - this.formatters.inputAddressFormatter, - null - ], - null - ).send(callback); -}; - /** * Extends setProvider method from AbstractWeb3Object. * This is required for updating the provider also in the sub package Net. diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js new file mode 100644 index 00000000000..2c9331f880d --- /dev/null +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -0,0 +1,52 @@ +/* + 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 . + */ +/** + * @file MethodModelFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var web3CoreMethod = require('web3-core-method'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function MethodModelFactory(utils, formatters) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); + + this.methodModels = { + getAccounts: web3CoreMethod.GetAccountsMethodModel, + newAccount: web3CoreMethod.NewAccountMethodModel, + unlockAccount: web3CoreMethod.UnlockAccountMethodModel, + lockAccount: web3CoreMethod.LockAccountMethodModel, + importRawKey: web3CoreMethod.ImportRawKeyMethodModel, + sendTransaction: web3CoreMethod.PersonalSendTransactionMethodModel, + signTransaction: web3CoreMethod.PersonalSignTransactionMethodModel, + sign: web3CoreMethod.PersonalSignMethodModel, + ecRecover: web3CoreMethod.EcRecoverMethodModel + }; + +} + +MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); + +module.exports = MethodModelFactory; diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index dc36fa5b8b7..8fbb238fa11 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -29,6 +29,7 @@ var NetworkPackage = require('web3-net'); var ProvidersPackage = require('web3-core-providers'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; +var MethodModelFactory = require('./factories/MethodModelFactory'); module.exports = { version: version, @@ -43,7 +44,16 @@ module.exports = { * @returns {Personal} */ createPersonal: function (provider) { - return new Personal(provider, ProvidersPackage, MethodPackage, NetworkPackage.createNetwork(provider), Utils, formatters); + return new Personal( + provider, + ProvidersPackage, + null, + MethodPackage.createMethodService(), + new MethodModelFactory(Utils, formatters), + NetworkPackage.createNetwork(provider), + Utils, + formatters + ); } }; diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js new file mode 100644 index 00000000000..2c9331f880d --- /dev/null +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -0,0 +1,52 @@ +/* + 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 . + */ +/** + * @file MethodModelFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var web3CoreMethod = require('web3-core-method'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function MethodModelFactory(utils, formatters) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); + + this.methodModels = { + getAccounts: web3CoreMethod.GetAccountsMethodModel, + newAccount: web3CoreMethod.NewAccountMethodModel, + unlockAccount: web3CoreMethod.UnlockAccountMethodModel, + lockAccount: web3CoreMethod.LockAccountMethodModel, + importRawKey: web3CoreMethod.ImportRawKeyMethodModel, + sendTransaction: web3CoreMethod.PersonalSendTransactionMethodModel, + signTransaction: web3CoreMethod.PersonalSignTransactionMethodModel, + sign: web3CoreMethod.PersonalSignMethodModel, + ecRecover: web3CoreMethod.EcRecoverMethodModel + }; + +} + +MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); + +module.exports = MethodModelFactory; From 116833ab15966a4080e5d120e8a9e591ad7f39a8 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 20:28:23 +0200 Subject: [PATCH 0100/1045] Network refactored --- packages/web3-core-method/src/index.js | 8 +- .../methods/network/ListeningMethodModel.js | 47 ++++++++++++ .../methods/network/PeerCountMethodModel.js | 47 ++++++++++++ ...IdMethodModel.js => VersionMethodModel.js} | 8 +- .../src/factories/MethodModelFactory.js | 2 +- .../src/factories/MethodModelFactory.js | 5 +- packages/web3-eth-personal/src/index.js | 7 +- packages/web3-net/src/Network.js | 76 ++----------------- .../src/factories/MethodModelFactory.js | 18 ++--- packages/web3-net/src/index.js | 14 +++- 10 files changed, 139 insertions(+), 93 deletions(-) create mode 100644 packages/web3-core-method/src/methods/network/ListeningMethodModel.js create mode 100644 packages/web3-core-method/src/methods/network/PeerCountMethodModel.js rename packages/web3-core-method/src/methods/network/{GetIdMethodModel.js => VersionMethodModel.js} (84%) diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 8befc08b41e..10602bbc059 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -31,7 +31,9 @@ var SubscriptionPackage = require('web3-core-subscription'); // Methods var GetProtocolVersionMethodModel = require('./methods/network/GetProtocolVersionMethodModel'); -var GetIdMethodModel = require('./methods/network/GetIdMethodModel'); +var VersionMethodModel = require('./methods/network/VersionMethodModel'); +var ListeningMethodModel = require('./methods/network/ListeningMethodModel'); +var PeerCountMethodModel = require('./methods/network/PeerCountMethodModel'); var GetNodeInfoMethodModel = require('./methods/node/GetNodeInfoMethodModel'); var GetCoinbaseMethodModel = require('./methods/node/GetCoinbaseMethodModel'); var IsMiningMethodModel = require('./methods/node/IsMiningMethodModel'); @@ -78,7 +80,9 @@ module.exports = { * Methods */ GetProtocolVersionMethodModel: GetProtocolVersionMethodModel, - GetIdMethodModel: GetIdMethodModel, + VersionMethodModel: VersionMethodModel, + ListeningMethodModel: ListeningMethodModel, + PeerCountMethodModel: PeerCountMethodModel, GetNodeInfoMethodModel: GetNodeInfoMethodModel, GetCoinbaseMethodModel: GetCoinbaseMethodModel, IsMiningMethodModel: IsMiningMethodModel, diff --git a/packages/web3-core-method/src/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/methods/network/ListeningMethodModel.js new file mode 100644 index 00000000000..f11d1f546f6 --- /dev/null +++ b/packages/web3-core-method/src/methods/network/ListeningMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file ListeningMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function ListeningMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'net_listening', + 0, + null, + null, + accounts + ) +} + +ListeningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = ListeningMethodModel; diff --git a/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js new file mode 100644 index 00000000000..d9a87d0909f --- /dev/null +++ b/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file ListeningMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function ListeningMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'net_peerCount', + 0, + null, + utils.hexToNumber, + accounts + ) +} + +ListeningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = ListeningMethodModel; diff --git a/packages/web3-core-method/src/methods/network/GetIdMethodModel.js b/packages/web3-core-method/src/methods/network/VersionMethodModel.js similarity index 84% rename from packages/web3-core-method/src/methods/network/GetIdMethodModel.js rename to packages/web3-core-method/src/methods/network/VersionMethodModel.js index c601519d324..8d201cca5b4 100644 --- a/packages/web3-core-method/src/methods/network/GetIdMethodModel.js +++ b/packages/web3-core-method/src/methods/network/VersionMethodModel.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file GetIdMethodModel.js + * @file VersionMethodModel.js * @author Samuel Furter * @date 2018 */ @@ -31,7 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * * @constructor */ -function GetIdMethodModel(utils, formatters, accounts) { +function VersionMethodModel(utils, formatters, accounts) { AbstractMethodModel.call( this, 'eth_protocolVersion', @@ -42,6 +42,6 @@ function GetIdMethodModel(utils, formatters, accounts) { ) } -GetIdMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +VersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -module.exports = GetIdMethodModel; +module.exports = VersionMethodModel; diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js index b6a1ad2e996..5608b7797fe 100644 --- a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -36,7 +36,7 @@ function MethodModelFactory(utils, formatters) { this.methodModels = { getGasPrice: web3CoreMethod.GetGasPriceMethodModel, getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, - getId: web3CoreMethod.GetIdMethodModel + getId: web3CoreMethod.VersionMethodModel }; } diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index 2c9331f880d..48eee3a5165 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -27,11 +27,12 @@ var web3CoreMethod = require('web3-core-method'); /** * @param {Utils} utils * @param {Object} formatters + * @param {Accounts} accounts * * @constructor */ -function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); +function MethodModelFactory(utils, formatters, accounts) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters, accounts); this.methodModels = { getAccounts: web3CoreMethod.GetAccountsMethodModel, diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 8fbb238fa11..a94c70cf6f7 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -25,6 +25,7 @@ var version = require('./package.json').version; var Personal = require('./Personal'); var MethodPackage = require('web3-core-method'); +var AccountsPackage = require('web3-eth-accounts'); var NetworkPackage = require('web3-net'); var ProvidersPackage = require('web3-core-providers'); var Utils = require('web3-utils'); @@ -44,12 +45,14 @@ module.exports = { * @returns {Personal} */ createPersonal: function (provider) { + var accounts = AccountsPackage.createAccounts(provider); + return new Personal( provider, ProvidersPackage, - null, + accounts, MethodPackage.createMethodService(), - new MethodModelFactory(Utils, formatters), + new MethodModelFactory(Utils, formatters, accounts), NetworkPackage.createNetwork(provider), Utils, formatters diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index bcee4c41480..97eb414ddd5 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -28,14 +28,16 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {Object} provider * @param {ProvidersPackage} providersPackage - * @param {MethodPackage} methodPackage + * @param {Accounts} accounts + * @param {MethodService} methodService + * @param {MethodModelFactory} methodModelFactory * @param {Object} formatters * @param {Object} utils * * @constructor */ -function Network(provider, providersPackage, methodPackage, formatters, utils) { - AbstractWeb3Object.call(provider, providersPackage, methodPackage); +function Network(provider, providersPackage, accounts, methodService, methodModelFactory, formatters, utils) { + AbstractWeb3Object.call(this, provider, providersPackage, accounts, methodService, methodModelFactory); this.formatters = formatters; this.utils = utils; } @@ -57,7 +59,7 @@ Network.prototype.getNetworkType = function (callback) { return this.getId().then(function (givenId) { id = givenId; - return self.getBlockByNumber(0, false); + return self.getBlock(0, false); }).then(function (genesis) { var returnValue = 'private'; switch (genesis) { @@ -94,72 +96,6 @@ Network.prototype.getNetworkType = function (callback) { }); }; -/** - * Executes the JSON-RPC method net_version - * - * @method getId - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise|eventifiedPromise} - */ -Network.prototype.getId = function (callback) { - return this.methodPackage.create(this.provider, 'net_version', [], null, this.utils.hexToNumber).send(callback); -}; - -/** - * Executes the JSON-RPC method net_listening - * - * @method isListening - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise|eventifiedPromise} - */ -Network.prototype.isListening = function (callback) { - return this.methodPackage.create(this.provider, 'net_listening', [], null, null).send(callback); -}; - -/** - * Executes the JSON-RPC method net_peerCount - * - * @method getPeerCount - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise|eventifiedPromise} - */ -Network.prototype.getPeerCount = function (callback) { - return this.methodPackage.create(this.provider, 'net_peerCount', [], null, this.utils.hexToNumber).send(callback); -}; - -/** - * Gets a block by his number - * - * @method getBlockByNumber - * - * @param {Number} blockNumber - * @param {Boolean} returnTransactionObjects - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise|eventifiedPromise} - */ -Network.prototype.getBlockByNumber = function (blockNumber, returnTransactionObjects, callback) { - return this.methodPackage.create( - this.provider, - 'eth_getBlockByNumber', - [blockNumber, returnTransactionObjects], - [this.formatters.inputBlockNumberFormatter, function (val) { - return !!val - }], - this.formatters.outputBlockFormatter - ).send(callback); -}; - Network.prototype = Object.create(AbstractWeb3Object.prototype); module.exports = Network; diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index 2c9331f880d..e60c7d892a9 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -27,22 +27,18 @@ var web3CoreMethod = require('web3-core-method'); /** * @param {Utils} utils * @param {Object} formatters + * @param {Accounts} accounts * * @constructor */ -function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); +function MethodModelFactory(utils, formatters, accounts) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters, accounts); this.methodModels = { - getAccounts: web3CoreMethod.GetAccountsMethodModel, - newAccount: web3CoreMethod.NewAccountMethodModel, - unlockAccount: web3CoreMethod.UnlockAccountMethodModel, - lockAccount: web3CoreMethod.LockAccountMethodModel, - importRawKey: web3CoreMethod.ImportRawKeyMethodModel, - sendTransaction: web3CoreMethod.PersonalSendTransactionMethodModel, - signTransaction: web3CoreMethod.PersonalSignTransactionMethodModel, - sign: web3CoreMethod.PersonalSignMethodModel, - ecRecover: web3CoreMethod.EcRecoverMethodModel + getId: web3CoreMethod.VersionMethodModel, + getBlock: web3CoreMethod.GetBlockMethodModel, + isListening: web3CoreMethod.ListeningMethodModel, + getPeerCount: web3CoreMethod.PeerCountMethodModel, }; } diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index 4730f0ee334..f73eb575b50 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -26,9 +26,11 @@ var version = require('../package.json').version; var ProvidersPackage = require('web3-core-providers'); var MethodPackage = require('web3-core-method'); +var AccountsPackage = require('web3-eth-accounts'); var formatters = require('web3-core-helpers').formatters; var utils = require('web3-utils'); var Network = require('./Network'); +var MethodModelFactory = require('./factories/MethodModelFactory'); module.exports = { @@ -44,6 +46,16 @@ module.exports = { * @returns {Network} */ createNetwork: function (provider) { - return new Network(provider, ProvidersPackage, MethodPackage, formatters, utils) + var accounts = AccountsPackage.createAccounts(); + + return new Network( + provider, + ProvidersPackage, + accounts, + MethodPackage.createMethodService(), + new MethodModelFactory(Utils, formatters, accounts), + formatters, + utils + ) } }; From ad9dee5f32364e57b460cc693176bd9d3ecd6d7b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 18 Sep 2018 21:19:18 +0200 Subject: [PATCH 0101/1045] Shh method added and Shh refactored --- packages/web3-core-method/src/index.js | 247 +++++++---- .../methods/shh/AddPrivateKeyMethodModel.js | 47 ++ .../src/methods/shh/AddSymKeyMethodModel.js | 47 ++ .../methods/shh/DeleteKeyPairMethodModel.js | 47 ++ .../shh/DeleteMessageFilterMethodModel.js | 47 ++ .../methods/shh/DeleteSymKeyMethodModel.js | 47 ++ .../GenerateSymKeyFromPasswordMethodModel.js | 47 ++ .../shh/GetFilterMessagesMethodModel.js | 47 ++ .../src/methods/shh/GetInfoMethodModel.js | 47 ++ .../methods/shh/GetPrivateKeyMethodModel.js | 47 ++ .../methods/shh/GetPublicKeyMethodModel.js | 47 ++ .../src/methods/shh/GetSymKeyMethodModel.js | 47 ++ .../src/methods/shh/HasKeyPairMethodModel.js | 47 ++ .../src/methods/shh/HasSymKeyMethodModel.js | 47 ++ .../methods/shh/MarkTrustedPeerMethodModel.js | 47 ++ .../src/methods/shh/NewKeyPairMethodModel.js | 47 ++ .../shh/NewMessageFilterMethodModel.js | 47 ++ .../src/methods/shh/NewSymKeyMethodModel.js | 47 ++ .../src/methods/shh/PostMethodModel.js | 47 ++ .../shh/SetMaxMessageSizeMethodModel.js | 47 ++ .../src/methods/shh/SetMinPoWMethodModel.js | 47 ++ .../src/methods/shh/ShhVersionMethodModel.js | 47 ++ packages/web3-shh/src/Shh.js | 419 +----------------- .../src/factories/MethodModelFactory.js | 65 +++ packages/web3-shh/src/index.js | 16 +- 25 files changed, 1242 insertions(+), 492 deletions(-) create mode 100644 packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/PostMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js create mode 100644 packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js create mode 100644 packages/web3-shh/src/factories/MethodModelFactory.js diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 10602bbc059..379ade308dd 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -30,97 +30,88 @@ var PromiEventPackage = require('web3-core-promievent'); var SubscriptionPackage = require('web3-core-subscription'); // Methods -var GetProtocolVersionMethodModel = require('./methods/network/GetProtocolVersionMethodModel'); -var VersionMethodModel = require('./methods/network/VersionMethodModel'); -var ListeningMethodModel = require('./methods/network/ListeningMethodModel'); -var PeerCountMethodModel = require('./methods/network/PeerCountMethodModel'); -var GetNodeInfoMethodModel = require('./methods/node/GetNodeInfoMethodModel'); -var GetCoinbaseMethodModel = require('./methods/node/GetCoinbaseMethodModel'); -var IsMiningMethodModel = require('./methods/node/IsMiningMethodModel'); -var GetHashrateMethodModel = require('./methods/node/GetHashrateMethodModel'); -var IsSyncingMethodModel = require('./methods/node/IsSyncingMethodModel'); -var GetGasPriceMethodModel = require('./methods/node/GetGasPriceMethodModel'); -var SubmitWorkMethodModel = require('./methods/node/SubmitWorkMethodModel'); -var GetWorkMethodModel = require('./methods/node/GetWorkMethodModel'); -var GetAccountsMethodModel = require('./methods/account/GetAccountsMethodModel'); -var GetBalanceMethodModel = require('./methods/account/GetBalanceMethodModel'); -var GetTransactionCountMethodModel = require('./methods/account/GetTransactionCountMethodModel'); -var GetBlockNumberMethodModel = require('./methods/block/GetBlockNumberMethodModel'); -var GetBlockMethodModel = require('./methods/block/GetBlockMethodModel'); -var GetUncleMethodModel = require('./methods/block/GetUncleMethodModel'); -var GetBlockTransactionCountMethodModel = require('./methods/block/GetBlockTransactionCountMethodModel'); -var GetBlockUncleCountMethodModel = require('./methods/block/GetBlockUncleCountMethodModel'); -var GetTransactionMethodModel = require('./methods/transaction/GetTransactionMethodModel'); -var GetTransactionFromBlockMethodModel = require('./methods/transaction/GetTransactionFromBlockMethodModel'); -var GetTransactionReceipt = require('./methods/transaction/GetTransactionReceipt'); -var SendSignedTransactionMethodModel = require('./methods/transaction/SendSignedTransactionMethodModel'); -var SignTransactionMethodModel = require('./methods/transaction/SignTransactionMethodModel'); -var SendTransactionMethodModel = require('./methods/transaction/SendTransactionMethodModel'); -var GetCodeMethodModel = require('./methods/GetCodeMethodModel'); -var SignMethodModel = require('./methods/SignMethodModel'); -var CallMethodModel = require('./methods/CallMethodModel'); -var GetStroageAtMethodModel = require('./methods/GetStroageAtMethodModel'); -var EstimateGasMethodModel = require('./methods/EstimateGasMethodModel'); -var GetPastLogsMethodModel = require('./methods/GetPastLogsMethodModel'); -var EcRecoverMethodModel = require('./methods/personal/EcRecoverMethodModel'); -var ImportRawKeyMethodModel = require('./methods/personal/ImportRawKeyMethodModel'); -var ListAccountsMethodModel = require('./methods/personal/ListAccountsMethodModel'); -var LockAccountMethodModel = require('./methods/personal/LockAccountMethodModel'); -var NewAccountMethodModel = require('./methods/personal/NewAccountMethodModel'); -var PersonalSendTransactionMethodModel = require('./methods/personal/PersonalSendTransactionMethodModel'); -var PersonalSignMethodModel = require('./methods/personal/PersonalSignMethodModel'); -var PersonalSignTransactionMethodModel = require('./methods/personal/PersonalSignTransactionMethodModel'); -var UnlockAccountMethodModel = require('./methods/personal/UnlockAccountMethodModel'); + // Network + var GetProtocolVersionMethodModel = require('./methods/network/GetProtocolVersionMethodModel'); + var VersionMethodModel = require('./methods/network/VersionMethodModel'); + var ListeningMethodModel = require('./methods/network/ListeningMethodModel'); + var PeerCountMethodModel = require('./methods/network/PeerCountMethodModel'); + + // Node + var GetNodeInfoMethodModel = require('./methods/node/GetNodeInfoMethodModel'); + var GetCoinbaseMethodModel = require('./methods/node/GetCoinbaseMethodModel'); + var IsMiningMethodModel = require('./methods/node/IsMiningMethodModel'); + var GetHashrateMethodModel = require('./methods/node/GetHashrateMethodModel'); + var IsSyncingMethodModel = require('./methods/node/IsSyncingMethodModel'); + var GetGasPriceMethodModel = require('./methods/node/GetGasPriceMethodModel'); + var SubmitWorkMethodModel = require('./methods/node/SubmitWorkMethodModel'); + var GetWorkMethodModel = require('./methods/node/GetWorkMethodModel'); + + // Account + var GetAccountsMethodModel = require('./methods/account/GetAccountsMethodModel'); + var GetBalanceMethodModel = require('./methods/account/GetBalanceMethodModel'); + var GetTransactionCountMethodModel = require('./methods/account/GetTransactionCountMethodModel'); + + // Block + var GetBlockNumberMethodModel = require('./methods/block/GetBlockNumberMethodModel'); + var GetBlockMethodModel = require('./methods/block/GetBlockMethodModel'); + var GetUncleMethodModel = require('./methods/block/GetUncleMethodModel'); + var GetBlockTransactionCountMethodModel = require('./methods/block/GetBlockTransactionCountMethodModel'); + var GetBlockUncleCountMethodModel = require('./methods/block/GetBlockUncleCountMethodModel'); + + // Transaction + var GetTransactionMethodModel = require('./methods/transaction/GetTransactionMethodModel'); + var GetTransactionFromBlockMethodModel = require('./methods/transaction/GetTransactionFromBlockMethodModel'); + var GetTransactionReceipt = require('./methods/transaction/GetTransactionReceipt'); + var SendSignedTransactionMethodModel = require('./methods/transaction/SendSignedTransactionMethodModel'); + var SignTransactionMethodModel = require('./methods/transaction/SignTransactionMethodModel'); + var SendTransactionMethodModel = require('./methods/transaction/SendTransactionMethodModel'); + + // Global + var GetCodeMethodModel = require('./methods/GetCodeMethodModel'); + var SignMethodModel = require('./methods/SignMethodModel'); + var CallMethodModel = require('./methods/CallMethodModel'); + var GetStroageAtMethodModel = require('./methods/GetStroageAtMethodModel'); + var EstimateGasMethodModel = require('./methods/EstimateGasMethodModel'); + var GetPastLogsMethodModel = require('./methods/GetPastLogsMethodModel'); + + // Personal + var EcRecoverMethodModel = require('./methods/personal/EcRecoverMethodModel'); + var ImportRawKeyMethodModel = require('./methods/personal/ImportRawKeyMethodModel'); + var ListAccountsMethodModel = require('./methods/personal/ListAccountsMethodModel'); + var LockAccountMethodModel = require('./methods/personal/LockAccountMethodModel'); + var NewAccountMethodModel = require('./methods/personal/NewAccountMethodModel'); + var PersonalSendTransactionMethodModel = require('./methods/personal/PersonalSendTransactionMethodModel'); + var PersonalSignMethodModel = require('./methods/personal/PersonalSignMethodModel'); + var PersonalSignTransactionMethodModel = require('./methods/personal/PersonalSignTransactionMethodModel'); + var UnlockAccountMethodModel = require('./methods/personal/UnlockAccountMethodModel'); + + // SHH + var AddPrivateKeyMethodModel = require('./methods/shh/AddPrivateKeyMethodModel'); + var AddSymKeyMethodModel = require('./methods/shh/AddSymKeyMethodModel'); + var DeleteKeyPairMethodModel = require('./methods/shh/DeleteKeyPairMethodModel'); + var DeleteMessageFilterMethodModel = require('./methods/shh/DeleteMessageFilterMethodModel'); + var DeleteSymKeyMethodModel = require('./methods/shh/DeleteSymKeyMethodModel'); + var GenerateSymKeyFromPasswordMethodModel = require('./methods/shh/GenerateSymKeyFromPasswordMethodModel'); + var GetFilterMessagesMethodModel = require('./methods/shh/GetFilterMessagesMethodModel'); + var GetInfoMethodModel = require('./methods/shh/GetInfoMethodModel'); + var GetPrivateKeyMethodModel = require('./methods/shh/GetPrivateKeyMethodModel'); + var GetPublicKeyMethodModel = require('./methods/shh/GetPublicKeyMethodModel'); + var GetSymKeyMethodModel = require('./methods/shh/GetSymKeyMethodModel'); + var HasKeyPairMethodModel = require('./methods/shh/HasKeyPairMethodModel'); + var HasSymKeyMethodModel = require('./methods/shh/HasSymKeyMethodModel'); + var MarkTrustedPeerMethodModel = require('./methods/shh/MarkTrustedPeerMethodModel'); + var NewKeyPairMethodModel = require('./methods/shh/NewKeyPairMethodModel'); + var NewMessageFilterMethodModel = require('./methods/shh/NewMessageFilterMethodModel'); + var NewSymKeyMethodModel = require('./methods/shh/NewSymKeyMethodModel'); + var PostMethodModel = require('./methods/shh/PostMethodModel'); + var SetMaxMessageSizeMethodModel = require('./methods/shh/SetMaxMessageSizeMethodModel'); + var SetMinPoWMethodModel = require('./methods/shh/SetMinPoWMethodModel'); + var ShhVersionMethodModel = require('./methods/shh/ShhVersionMethodModel'); module.exports = { version: version, AbstractMethodModelFactory: AbstractMethodModelFactory, - /** - * Methods - */ - GetProtocolVersionMethodModel: GetProtocolVersionMethodModel, - VersionMethodModel: VersionMethodModel, - ListeningMethodModel: ListeningMethodModel, - PeerCountMethodModel: PeerCountMethodModel, - GetNodeInfoMethodModel: GetNodeInfoMethodModel, - GetCoinbaseMethodModel: GetCoinbaseMethodModel, - IsMiningMethodModel: IsMiningMethodModel, - GetHashrateMethodModel: GetHashrateMethodModel, - IsSyncingMethodModel: IsSyncingMethodModel, - GetGasPriceMethodModel: GetGasPriceMethodModel, - GetAccountsMethodModel: GetAccountsMethodModel, - GetBlockNumberMethodModel: GetBlockNumberMethodModel, - GetBalanceMethodModel: GetBalanceMethodModel, - GetStroageAtMethodModel: GetStroageAtMethodModel, - GetCodeMethodModel: GetCodeMethodModel, - GetBlockMethodModel: GetBlockMethodModel, - GetUncleMethodModel: GetUncleMethodModel, - GetBlockTransactionCountMethodModel: GetBlockTransactionCountMethodModel, - GetBlockUncleCountMethodModel: GetBlockUncleCountMethodModel, - GetTransactionMethodModel: GetTransactionMethodModel, - GetTransactionFromBlockMethodModel: GetTransactionFromBlockMethodModel, - GetTransactionReceipt: GetTransactionReceipt, - GetTransactionCountMethodModel: GetTransactionCountMethodModel, - SendSignedTransactionMethodModel: SendSignedTransactionMethodModel, - SignTransactionMethodModel: SignTransactionMethodModel, - SendTransactionMethodModel: SendTransactionMethodModel, - SignMethodModel: SignMethodModel, - CallMethodModel: CallMethodModel, - EstimateGasMethodModel: EstimateGasMethodModel, - SubmitWorkMethodModel: SubmitWorkMethodModel, - GetWorkMethodModel: GetWorkMethodModel, - GetPastLogsMethodModel: GetPastLogsMethodModel, - EcRecoverMethodModel: EcRecoverMethodModel, - ImportRawKeyMethodModel: ImportRawKeyMethodModel, - ListAccountsMethodModel: ListAccountsMethodModel, - LockAccountMethodModel: LockAccountMethodModel, - NewAccountMethodModel: NewAccountMethodModel, - PersonalSendTransactionMethodModel: PersonalSendTransactionMethodModel, - PersonalSignMethodModel: PersonalSignMethodModel, - PersonalSignTransactionMethodModel: PersonalSignTransactionMethodModel, - UnlockAccountMethodModel: UnlockAccountMethodModel, - /** * Creates the Method object * @@ -133,5 +124,87 @@ module.exports = { PromiEventPackage, SubscriptionPackage ); - } + }, + + /** + * Methods + */ + + // Network + GetProtocolVersionMethodModel: GetProtocolVersionMethodModel, + VersionMethodModel: VersionMethodModel, + ListeningMethodModel: ListeningMethodModel, + PeerCountMethodModel: PeerCountMethodModel, + + // Node + GetNodeInfoMethodModel: GetNodeInfoMethodModel, + GetCoinbaseMethodModel: GetCoinbaseMethodModel, + IsMiningMethodModel: IsMiningMethodModel, + GetHashrateMethodModel: GetHashrateMethodModel, + IsSyncingMethodModel: IsSyncingMethodModel, + GetWorkMethodModel: GetWorkMethodModel, + GetGasPriceMethodModel: GetGasPriceMethodModel, + SubmitWorkMethodModel: SubmitWorkMethodModel, + + // Account + GetAccountsMethodModel: GetAccountsMethodModel, + GetBalanceMethodModel: GetBalanceMethodModel, + GetTransactionCountMethodModel: GetTransactionCountMethodModel, + + // Block + GetBlockNumberMethodModel: GetBlockNumberMethodModel, + GetBlockMethodModel: GetBlockMethodModel, + GetUncleMethodModel: GetUncleMethodModel, + GetBlockTransactionCountMethodModel: GetBlockTransactionCountMethodModel, + GetBlockUncleCountMethodModel: GetBlockUncleCountMethodModel, + + // Transaction + GetTransactionMethodModel: GetTransactionMethodModel, + GetTransactionFromBlockMethodModel: GetTransactionFromBlockMethodModel, + SendSignedTransactionMethodModel: SendSignedTransactionMethodModel, + SignTransactionMethodModel: SignTransactionMethodModel, + SendTransactionMethodModel: SendTransactionMethodModel, + GetTransactionReceipt: GetTransactionReceipt, + + // Global + GetStroageAtMethodModel: GetStroageAtMethodModel, + GetCodeMethodModel: GetCodeMethodModel, + SignMethodModel: SignMethodModel, + CallMethodModel: CallMethodModel, + EstimateGasMethodModel: EstimateGasMethodModel, + GetPastLogsMethodModel: GetPastLogsMethodModel, + + // Personal + EcRecoverMethodModel: EcRecoverMethodModel, + ImportRawKeyMethodModel: ImportRawKeyMethodModel, + ListAccountsMethodModel: ListAccountsMethodModel, + LockAccountMethodModel: LockAccountMethodModel, + NewAccountMethodModel: NewAccountMethodModel, + PersonalSendTransactionMethodModel: PersonalSendTransactionMethodModel, + PersonalSignMethodModel: PersonalSignMethodModel, + PersonalSignTransactionMethodModel: PersonalSignTransactionMethodModel, + UnlockAccountMethodModel: UnlockAccountMethodModel, + + // SHH + AddPrivateKeyMethodModel: AddPrivateKeyMethodModel, + AddSymKeyMethodModel: AddSymKeyMethodModel, + DeleteKeyPairMethodModel: DeleteKeyPairMethodModel, + DeleteMessageFilterMethodModel: DeleteMessageFilterMethodModel, + DeleteSymKeyMethodModel: DeleteSymKeyMethodModel, + GenerateSymKeyFromPasswordMethodModel: GenerateSymKeyFromPasswordMethodModel, + GetFilterMessagesMethodModel: GetFilterMessagesMethodModel, + GetInfoMethodModel: GetInfoMethodModel, + GetPrivateKeyMethodModel: GetPrivateKeyMethodModel, + GetPublicKeyMethodModel: GetPublicKeyMethodModel, + GetSymKeyMethodModel: GetSymKeyMethodModel, + HasKeyPairMethodModel: HasKeyPairMethodModel, + HasSymKeyMethodModel: HasSymKeyMethodModel, + MarkTrustedPeerMethodModel: MarkTrustedPeerMethodModel, + NewKeyPairMethodModel: NewKeyPairMethodModel, + NewMessageFilterMethodModel: NewMessageFilterMethodModel, + NewSymKeyMethodModel: NewSymKeyMethodModel, + PostMethodModel: PostMethodModel, + SetMaxMessageSizeMethodModel: SetMaxMessageSizeMethodModel, + SetMinPoWMethodModel: SetMinPoWMethodModel, + ShhVersionMethodModel: ShhVersionMethodModel }; diff --git a/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js new file mode 100644 index 00000000000..02ebc687d1f --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file AddPrivateKeyMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function AddPrivateKeyMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_addPrivateKey', + 1, + null, + null, + accounts + ) +} + +AddPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = AddPrivateKeyMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js new file mode 100644 index 00000000000..89b50121b35 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file AddSymKeyMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function AddSymKeyMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_addSymKey', + 1, + null, + null, + accounts + ) +} + +AddSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = AddSymKeyMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js new file mode 100644 index 00000000000..29305866411 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file DeleteKeyPairMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function DeleteKeyPairMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_deleteKeyPair', + 1, + null, + null, + accounts + ) +} + +DeleteKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = DeleteKeyPairMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js new file mode 100644 index 00000000000..3f0358b2096 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file DeleteMessageFilterMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function DeleteMessageFilterMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_deleteMessageFilter', + 1, + null, + null, + accounts + ) +} + +DeleteMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = DeleteMessageFilterMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js new file mode 100644 index 00000000000..73c40411e04 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file DeleteSymKeyMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function DeleteSymKeyMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_deleteSymKey', + 1, + null, + null, + accounts + ) +} + +DeleteSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = DeleteSymKeyMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js new file mode 100644 index 00000000000..65860b197f5 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GenerateSymKeyFromPasswordMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GenerateSymKeyFromPasswordMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_generateSymKeyFromPassword', + 1, + null, + null, + accounts + ) +} + +GenerateSymKeyFromPasswordMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GenerateSymKeyFromPasswordMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js new file mode 100644 index 00000000000..e25e68c1f5d --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetFilterMessagesMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetFilterMessagesMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_getFilterMessages', + 1, + null, + null, + accounts + ) +} + +GetFilterMessagesMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetFilterMessagesMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js new file mode 100644 index 00000000000..d785cfd5d58 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetInfoMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetInfoMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_info', + 0, + null, + null, + accounts + ) +} + +GetInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetInfoMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js new file mode 100644 index 00000000000..32af90500bf --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetPrivateKeyMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetPrivateKeyMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_getPrivateKey', + 1, + null, + null, + accounts + ) +} + +GetPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetPrivateKeyMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js new file mode 100644 index 00000000000..24dcaf29aaa --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetPublicKeyMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetPublicKeyMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_getPublicKey', + 1, + null, + null, + accounts + ) +} + +GetPublicKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetPublicKeyMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js new file mode 100644 index 00000000000..0f95a97d151 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file GetSymKeyMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function GetSymKeyMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_getSymKey', + 1, + null, + null, + accounts + ) +} + +GetSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = GetSymKeyMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js new file mode 100644 index 00000000000..2ffc594a6ff --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file HasKeyPairMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function HasKeyPairMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_hasKeyPair', + 1, + null, + null, + accounts + ) +} + +HasKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = HasKeyPairMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js new file mode 100644 index 00000000000..4d001c5a4d3 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file HasSymKeyMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function HasSymKeyMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_hasSymKey', + 1, + null, + null, + accounts + ) +} + +HasSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = HasSymKeyMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js new file mode 100644 index 00000000000..8e11173c9af --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file MarkTrustedPeerMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function MarkTrustedPeerMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_markTrustedPeer', + 1, + null, + null, + accounts + ) +} + +MarkTrustedPeerMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = MarkTrustedPeerMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js new file mode 100644 index 00000000000..db854c0fab3 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file NewKeyPairMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function NewKeyPairMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_newKeyPair', + 1, + null, + null, + accounts + ) +} + +NewKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = NewKeyPairMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js new file mode 100644 index 00000000000..92aa6777b90 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file NewMessageFilterMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function NewMessageFilterMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_newMessageFilter', + 1, + null, + null, + accounts + ) +} + +NewMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = NewMessageFilterMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js new file mode 100644 index 00000000000..864b6a5314e --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file NewSymKeyMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function NewSymKeyMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_newSymKey', + 0, + null, + null, + accounts + ) +} + +NewSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = NewSymKeyMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/methods/shh/PostMethodModel.js new file mode 100644 index 00000000000..3462e6fb16b --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/PostMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file PostMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function PostMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_post', + 1, + null, + null, + accounts + ) +} + +PostMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = PostMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js new file mode 100644 index 00000000000..022e1315282 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file SetMaxMessageSizeMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function SetMaxMessageSizeMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_setMaxMessageSize', + 1, + null, + null, + accounts + ) +} + +SetMaxMessageSizeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = SetMaxMessageSizeMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js new file mode 100644 index 00000000000..58289e6f5d0 --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file SetMinPoWMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function SetMinPoWMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_setMinPoW', + 1, + null, + null, + accounts + ) +} + +SetMinPoWMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = SetMinPoWMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js new file mode 100644 index 00000000000..670ba621eeb --- /dev/null +++ b/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js @@ -0,0 +1,47 @@ +/* + 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 . + */ +/** + * @file ShhVersionMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function ShhVersionMethodModel(utils, formatters, accounts) { + AbstractMethodModel.call( + this, + 'shh_version', + 0, + null, + null, + accounts + ) +} + +ShhVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + +module.exports = ShhVersionMethodModel; diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index aa852d550e7..343e4076129 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -27,14 +27,25 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {Object} provider * @param {ProvidersPackage} providersPackage - * @param {MethodPackage} methodPackage + * @param {Accounts} accounts + * @param {MethodService} methodService + * @param {MethodModelFactory} methodModelFactory * @param {SubscriptionPackage} subscriptionPackage * @param {Network} net * * @constructor - */ -function Shh(provider, providersPackage, methodPackage, subscriptionPackage, net) { - AbstractWeb3Object.call(provider, providersPackage, methodPackage, subscriptionPackage); + * //TODO: Accounts should not be a default dependency of AbstractWeb3Object + */ +function Shh(provider, providersPackage, accounts, methodService, methodModelFactory, subscriptionPackage, net) { + AbstractWeb3Object.call( + this, + provider, + providersPackage, + accounts, + methodService, + methodModelFactory, + subscriptionPackage + ); this.net = net; } @@ -61,406 +72,6 @@ Shh.prototype.subscribe = function (method, options, callback) { ).subscribe(callback); }; -/** - * Gets the current version of whisper from the connected node - * - * @method getVersion - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.getVersion = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_version', - null, - null, - null - ).send(callback); -}; - -/** - * Gets information about the current whisper node. - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.getInfo = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_info', - null, - null, - null - ).send(callback); -}; - -/** - * Sets the maximal message size allowed by this node. - * - * @param {Number} size - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.setMaxMessageSize = function (size, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_setMaxMessageSize', - size, - null, - null - ).send(callback); -}; - -/** - * Sets the minimal PoW required by this node. - * - * @param {Number} pow - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.setMinPoW = function (pow, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_setMinPoW', - pow, - null, - null - ).send(callback); -}; - -/** - * Marks specific peer trusted, which will allow it to send historic (expired) messages. - * - * @param {String} enode - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.markTrustedPeer = function (enode, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_markTrustedPeer', - pow, - null, - null - ).send(callback); -}; - -/** - * Generates a new public and private key pair for message decryption and encryption. - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.newKeyPair = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_newKeyPair', - null, - null, - null - ).send(callback); -}; - -/** - * Generates a new public and private key pair for message decryption and encryption. - * - * @param {String} privateKey - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.addPrivateKey = function (privateKey, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_addPrivateKey', - privateKey, - null, - null - ).send(callback); -}; - -/** - * Deletes the specifies key if it exists. - * - * @param {String} id - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.deleteKeyPair = function (id, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_deleteKeyPair', - id, - null, - null - ).send(callback); -}; - -/** - * Checks if the whisper node has a private key of a key pair matching the given ID. - * - * @param {String} id - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.hasKeyPair = function (id, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_hasKeyPair', - id, - null, - null - ).send(callback); -}; - -/** - * Returns the public key for a key pair ID. - * - * @param {String} id - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.getPublicKey = function (id, callback) { - return this.methodPackage.create( - this.currentProvider, - 'id', - id, - null, - null - ).send(callback); -}; - -/** - * Returns the private key for a key pair ID. - * - * @param {String} id - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.getPrivateKey = function (id, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_getPrivateKey', - id, - null, - null - ).send(callback); -}; - -/** - * Generates a random symmetric key and stores it under an ID - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.newSymKey = function (callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_newSymKey', - null, - null, - null - ).send(callback); -}; - -/** - * Generates a random symmetric key and stores it under an ID - * - * @param {String} symKey - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.addSymKey = function (symKey, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_addSymKey', - symKey, - null, - null - ).send(callback); -}; - -/** - * Generates the key from password, stores it, and returns its ID. - * - * @param {String} password - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.generateSymKeyFromPassword = function (password, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_generateSymKeyFromPassword', - password, - null, - null - ).send(callback); -}; - -/** - * Generates the key from password, stores it, and returns its ID. - * - * @param {String} id - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.hasSymKey = function (id, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_hasSymKey', - id, - null, - null - ).send(callback); -}; - -/** - * Returns the symmetric key associated with the given ID. - * - * @param {String} id - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.getSymKey = function (id, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_getSymKey', - id, - null, - null - ).send(callback); -}; - -/** - * Deletes the symmetric key associated with the given ID. - * - * @param {String} id - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.deleteSymKey = function (id, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_deleteSymKey', - id, - null, - null - ).send(callback); -}; - -/** - * Create a new filter within the node. - * - * @param {Object} options - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.newMessageFilter = function (options, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_newMessageFilter', - options, - null, - null - ).send(callback); -}; - -/** - * Deletes a message filter in the node. - * - * @param {String} id - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.deleteMessageFilter = function (id, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_deleteMessageFilter', - id, - null, - null - ).send(callback); -}; - -/** - * Retrieve messages that match the filter criteria and are received between - * the last time this function was called and now. - * - * @param {String} id - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.getFilterMessages = function (id, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_getFilterMessages', - id, - null, - null - ).send(callback); -}; - - -/** - * Retrieve messages that match the filter criteria and are received between - * the last time this function was called and now. - * - * @param {object} object - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Shh.prototype.post = function (object, callback) { - return this.methodPackage.create( - this.currentProvider, - 'shh_post', - object, - null, - null - ).send(callback); -}; - /** * Extends setProvider method from AbstractWeb3Object. * This is required for updating the provider also in the sub package Net. diff --git a/packages/web3-shh/src/factories/MethodModelFactory.js b/packages/web3-shh/src/factories/MethodModelFactory.js new file mode 100644 index 00000000000..eb1d6672075 --- /dev/null +++ b/packages/web3-shh/src/factories/MethodModelFactory.js @@ -0,0 +1,65 @@ +/* + 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 . + */ +/** + * @file MethodModelFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var web3CoreMethod = require('web3-core-method'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function MethodModelFactory(utils, formatters, accounts) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters, accounts); + + this.methodModels = { + getVersion: web3CoreMethod.ShhVersionMethodModel, + getInfo: web3CoreMethod.GetInfoMethodModel, + setMaxMessageSize: web3CoreMethod.SetMaxMessageSizeMethodModel, + setMinPoW: web3CoreMethod.SetMinPoWMethodModel, + markTrustedPeer: web3CoreMethod.MarkTrustedPeerMethodModel, + newKeyPair: web3CoreMethod.NewKeyPairMethodModel, + addPrivateKey: web3CoreMethod.AddPrivateKeyMethodModel, + deleteKeyPair: web3CoreMethod.DeleteKeyPairMethodModel, + hasKeyPair: web3CoreMethod.HasKeyPairMethodModel, + getPublicKey: web3CoreMethod.GetPublicKeyMethodModel, + getPrivateKey: web3CoreMethod.GetPrivateKeyMethodModel, + newSymKey: web3CoreMethod.NewSymKeyMethodModel, + addSymKey: web3CoreMethod.AddSymKeyMethodModel, + generateSymKeyFromPassword: web3CoreMethod.GenerateSymKeyFromPasswordMethodModel, + hasSymKey: web3CoreMethod.HasSymKeyMethodModel, + getSymKey: web3CoreMethod.GetSymKeyMethodModel, + deleteSymKey: web3CoreMethod.DeleteSymKeyMethodModel, + newMessageFilter: web3CoreMethod.NewMessageFilterMethodModel, + getFilterMessages: web3CoreMethod.GetFilterMessagesMethodModel, + deleteMessageFilter: web3CoreMethod.DeleteMessageFilterMethodModel, + post: web3CoreMethod.PostMethodModel, + }; + +} + +MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); + +module.exports = MethodModelFactory; diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 934c8ff352f..823d450087f 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -24,10 +24,14 @@ var version = require('./package.json'); var ProvidersPackage = require('web3-core-providers'); +var AccountsPackage = require('web3-eth-accounts'); var MethodPackage = require('web3-core-method'); var SubscriptionPackage = require('web3-core-subscription'); var NetworkPackage = require('web3-net'); +var Utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; var Shh = require('./Shh'); +var MethodModelFactory = require('./factories/MethodModelFactory'); module.exports = { version: version, @@ -42,6 +46,16 @@ module.exports = { * @returns {Shh} */ createShh: function (provider) { - return new Shh(provider, ProvidersPackage, MethodPackage, SubscriptionPackage, NetworkPackage.createNetwork(provider)); + var accounts = AccountsPackage.createAccounts(provider); + + return new Shh( + provider, + ProvidersPackage, + accounts, + MethodPackage.createMethodService(), + new MethodModelFactory(Utils, formatters, accounts), + SubscriptionPackage, + NetworkPackage.createNetwork(provider) + ); } }; From 56d129004997870f6e3f4a407823f9499716d1f9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 10:06:00 +0200 Subject: [PATCH 0102/1045] inheritance fixed and funcDoc updated in TransactionConfirmationWorkflow --- .../src/workflows/TransactionConfirmationWorkflow.js | 1 - .../web3-core-providers/src/adapters/HttpProviderAdapter.js | 2 +- .../web3-core-providers/src/adapters/InpageProviderAdapter.js | 2 +- .../web3-core-providers/src/adapters/SocketProviderAdapter.js | 2 +- packages/web3-eth-personal/src/Personal.js | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 894a6fe497c..bd7c50048b3 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -23,7 +23,6 @@ "use strict"; /** - * @param {Object} provider * @param {TransactionConfirmationModel} transactionConfirmationModel * @param {TransactionReceiptValidator} transactionReceiptValidator * @param {NewHeadsWatcher} newHeadsWatcher diff --git a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js index 8de542ea5e5..315a57eacd4 100644 --- a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js @@ -30,7 +30,7 @@ var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapte * @constructor */ function HttpProviderAdapter (httpProvider) { - AbstractProviderAdapter.call(httpProvider); + AbstractProviderAdapter.call(this, httpProvider); } diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js index 6406ae720f7..afea49bf6da 100644 --- a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js @@ -32,7 +32,7 @@ var errors = require('web3-core-helpers').errors; * @constructor */ function InpageProviderAdapter(inpageProvider) { - AbstractProviderAdapter.call(inpageProvider); + AbstractProviderAdapter.call(this, inpageProvider); this.provider.send = this.provider.sendAsync; delete this.provider.sendAsync; } diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index d418bb81ee2..3117a0fb94a 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -30,7 +30,7 @@ var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapte * @constructor */ function SocketProviderAdapter(provider) { - AbstractProviderAdapter.call(provider); + AbstractProviderAdapter.call(this, provider); this.subscriptions = []; this.registerSubscriptionListener(); } diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 0cafb05e9a8..a5ea492d765 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -39,7 +39,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @constructor */ function Personal(provider, providersPackage, accounts, methodService, methodModelFactory, net, utils, formatters) { - AbstractWeb3Object.call(provider, providersPackage, accounts, methodService, methodModelFactory); + AbstractWeb3Object.call(this, provider, providersPackage, accounts, methodService, methodModelFactory); this.utils = utils; this.formatters = formatters; this.net = net; From 78d25fe23c497840820233e2bf48a4ad15cbe902 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 10:36:02 +0200 Subject: [PATCH 0103/1045] Accounts removed as default property of MethodModelFactories and MethodModels --- .../lib/factories/AbstractMethodModelFactory.js | 5 ++--- packages/web3-core-method/src/methods/CallMethodModel.js | 8 +++----- .../src/methods/EstimateGasMethodModel.js | 8 +++----- .../web3-core-method/src/methods/GetCodeMethodModel.js | 8 +++----- .../src/methods/GetPastLogslMethodModel.js | 6 ++---- .../src/methods/GetStorageAtMethodModel.js | 8 +++----- packages/web3-core-method/src/methods/SignMethodModel.js | 9 +++++---- .../src/methods/account/GetAccountsMethodModel.js | 8 +++----- .../src/methods/account/GetBalanceMethodModel.js | 8 +++----- .../methods/account/GetTransactionCountMethodModel.js | 8 +++----- .../src/methods/block/GetBlockMethodModel.js | 8 +++----- .../src/methods/block/GetBlockNumberMethodModel.js | 8 +++----- .../methods/block/GetBlockTransactionCountMethodModel.js | 6 ++---- .../src/methods/block/GetBlockUncleCountMethodModel.js | 8 +++----- .../src/methods/block/GetUncleMethodModel.js | 5 ++--- .../src/methods/network/GetProtocolVersionMethodModel.js | 8 +++----- .../src/methods/network/ListeningMethodModel.js | 8 +++----- .../src/methods/network/PeerCountMethodModel.js | 8 +++----- .../src/methods/network/VersionMethodModel.js | 8 +++----- .../src/methods/node/GetCoinbaseMethodModel.js | 8 +++----- .../src/methods/node/GetGasPriceMethodModel.js | 8 +++----- .../src/methods/node/GetHashrateMethodModel.js | 8 +++----- .../src/methods/node/GetNodeInfoMethodModel.js | 8 +++----- .../src/methods/node/GetWorkMethodModel.js | 8 +++----- .../src/methods/node/IsMiningMethodModel.js | 8 +++----- .../src/methods/node/IsSyncingMethodModel.js | 8 +++----- .../src/methods/node/SubmitWorkMethodModel.js | 6 ++---- .../src/methods/personal/EcRecoverMethodModel.js | 8 +++----- .../src/methods/personal/ImportRawKeyMethodModel.js | 8 +++----- .../src/methods/personal/ListAccountsMethodModel.js | 8 +++----- .../src/methods/personal/LockAccountMethodModel.js | 8 +++----- .../src/methods/personal/NewAccountMethodModel.js | 8 +++----- .../personal/PersonalSendTransactionMethodModel.js | 8 +++----- .../src/methods/personal/PersonalSignMethodModel.js | 8 +++----- .../personal/PersonalSignTransactionMethodModel.js | 8 +++----- .../src/methods/personal/UnlockAccountMethodModel.js | 8 +++----- .../src/methods/shh/AddPrivateKeyMethodModel.js | 8 +++----- .../src/methods/shh/AddSymKeyMethodModel.js | 8 +++----- .../src/methods/shh/DeleteKeyPairMethodModel.js | 8 +++----- .../src/methods/shh/DeleteMessageFilterMethodModel.js | 8 +++----- .../src/methods/shh/DeleteSymKeyMethodModel.js | 8 +++----- .../methods/shh/GenerateSymKeyFromPasswordMethodModel.js | 8 +++----- .../src/methods/shh/GetFilterMessagesMethodModel.js | 8 +++----- .../src/methods/shh/GetInfoMethodModel.js | 8 +++----- .../src/methods/shh/GetPrivateKeyMethodModel.js | 8 +++----- .../src/methods/shh/GetPublicKeyMethodModel.js | 8 +++----- .../src/methods/shh/GetSymKeyMethodModel.js | 8 +++----- .../src/methods/shh/HasKeyPairMethodModel.js | 8 +++----- .../src/methods/shh/HasSymKeyMethodModel.js | 8 +++----- .../src/methods/shh/MarkTrustedPeerMethodModel.js | 8 +++----- .../src/methods/shh/NewKeyPairMethodModel.js | 8 +++----- .../src/methods/shh/NewMessageFilterMethodModel.js | 8 +++----- .../src/methods/shh/NewSymKeyMethodModel.js | 8 +++----- .../web3-core-method/src/methods/shh/PostMethodModel.js | 8 +++----- .../src/methods/shh/SetMaxMessageSizeMethodModel.js | 8 +++----- .../src/methods/shh/SetMinPoWMethodModel.js | 8 +++----- .../src/methods/shh/ShhVersionMethodModel.js | 8 +++----- .../transaction/GetTransactionFromBlockMethodModel.js | 8 +++----- .../src/methods/transaction/GetTransactionMethodModel.js | 8 +++----- .../transaction/GetTransactionReceiptMethodModel.js | 8 +++----- .../transaction/SendSignedTransactionMethodModel.js | 8 +++----- .../methods/transaction/SendTransactionMethodModel.js | 7 ++++--- .../methods/transaction/SignTransactionMethodModel.js | 8 +++----- .../src/factories/MethodModelFactory.js | 5 ++--- packages/web3-eth-personal/src/index.js | 2 +- packages/web3-eth/src/factories/MethodModelFactory.js | 4 ++++ packages/web3-net/src/factories/MethodModelFactory.js | 5 ++--- packages/web3-net/src/index.js | 4 ++-- 68 files changed, 198 insertions(+), 314 deletions(-) diff --git a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js index 100420c2874..f1cd0aea4f7 100644 --- a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js +++ b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js @@ -29,10 +29,9 @@ * * @constructor */ -function AbstractMethodModelFactory(utils, formatters, accounts) { +function AbstractMethodModelFactory(utils, formatters) { this.utils = utils; this.formatters = formatters; - this.accounts = accounts; this.methodModels = {}; } @@ -41,7 +40,7 @@ AbstractMethodModelFactory.prototype.hasMethodModel = function (name) { }; AbstractMethodModelFactory.prototype.createMethodModel = function (name) { - return new this.methodModels[name](this.utils, this.formatters, this.accounts); + return new this.methodModels[name](this.utils, this.formatters); }; module.exports = AbstractMethodModelFactory; diff --git a/packages/web3-core-method/src/methods/CallMethodModel.js b/packages/web3-core-method/src/methods/CallMethodModel.js index fee0c0c3976..538798d6a8f 100644 --- a/packages/web3-core-method/src/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/methods/CallMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function CallMethodModel(utils, formatters, accounts) { +function CallMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_call', @@ -40,9 +39,8 @@ function CallMethodModel(utils, formatters, accounts) { formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter ], - null, - accounts - ) + null + ); } CallMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/methods/EstimateGasMethodModel.js index 5db7ed9e5b2..d9d61e8190f 100644 --- a/packages/web3-core-method/src/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/methods/EstimateGasMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function EstimateGasMethodModel(utils, formatters, accounts) { +function EstimateGasMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_estimateGas', 1, [formatters.inputCallFormatter], - utils.hexToNumber, - accounts - ) + utils.hexToNumber + ); } EstimateGasMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/methods/GetCodeMethodModel.js index f89191f5ebc..671c05cd438 100644 --- a/packages/web3-core-method/src/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/methods/GetCodeMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetCodeMethodModel(utils, formatters, accounts) { +function GetCodeMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getCode', @@ -40,9 +39,8 @@ function GetCodeMethodModel(utils, formatters, accounts) { formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter ], - null, - accounts - ) + null + ); } GetCodeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js b/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js index 47e09093697..d1ec9e6d2d4 100644 --- a/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js +++ b/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetPastLogsMethodModel(utils, formatters, accounts) { +function GetPastLogsMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getLogs', 1, [formatters.inputLogFormatter], formatters.outputLogFormatter, - accounts - ) + ); } GetPastLogsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js index 701918dfbd3..6172e5ed7f9 100644 --- a/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetStorageAtMethodModel(utils, formatters, accounts) { +function GetStorageAtMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getStorageAt', @@ -41,9 +40,8 @@ function GetStorageAtMethodModel(utils, formatters, accounts) { utils.numberToHex, formatters.inputDefaultBlockNumberFormatter ], - null, - accounts - ) + null + ); } GetStorageAtMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/SignMethodModel.js b/packages/web3-core-method/src/methods/SignMethodModel.js index c7bdd558edb..e9e0f2b98a2 100644 --- a/packages/web3-core-method/src/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/methods/SignMethodModel.js @@ -34,15 +34,16 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); function SignMethodModel(utils, formatters, accounts) { AbstractMethodModel.call( this, - 'eth_signTransaction', + 'eth_sign', 2, [ formatters.inputSignFormatter, formatters.inputAddressFormatter ], - null, - accounts - ) + null + ); + + this.accounts = accounts; } SignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js index f321909c605..8730514f5a5 100644 --- a/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetAccountsMethodModel(utils, formatters, accounts) { +function GetAccountsMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_accounts', 0, null, - utils.toChecksumAddress, - accounts - ) + utils.toChecksumAddress + ); } GetAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js index 3ed9319cbe9..5933541d15a 100644 --- a/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetBalanceMethodModel(utils, formatters, accounts) { +function GetBalanceMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getBalance', @@ -40,9 +39,8 @@ function GetBalanceMethodModel(utils, formatters, accounts) { formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter ], - formatters.outputBigNumberFormatter, - accounts - ) + formatters.outputBigNumberFormatter + ); } GetBalanceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js index 721b3e9d57c..00753d9e828 100644 --- a/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetTransactionCountMethodModel(utils, formatters, accounts) { +function GetTransactionCountMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getTransactionCount', @@ -40,9 +39,8 @@ function GetTransactionCountMethodModel(utils, formatters, accounts) { formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter ], - utils.hexToNumber, - accounts - ) + utils.hexToNumber + ); } GetTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js index 0184a801a57..0a735c55ed7 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetBlockMethodModel(utils, formatters, accounts) { +function GetBlockMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getBlockByNumber', @@ -42,9 +41,8 @@ function GetBlockMethodModel(utils, formatters, accounts) { return !!val; } ], - formatters.outputBlockFormatter, - accounts - ) + formatters.outputBlockFormatter + ); } GetBlockMethodModel.prototype.beforeExecution = function (parameters) { diff --git a/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js index be8648019a2..de9844b6ad3 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetBlockNumberMethodModel(utils, formatters, accounts) { +function GetBlockNumberMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_blockNumber', 0, null, - utils.hexToNumber, - accounts - ) + utils.hexToNumber + ); } GetBlockNumberMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js index 76663c12b7b..f86ac92d060 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetBlockTransactionCountMethodModel(utils, formatters, accounts) { +function GetBlockTransactionCountMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getTransactionByBlockNumberAndIndex', @@ -40,8 +39,7 @@ function GetBlockTransactionCountMethodModel(utils, formatters, accounts) { formatters.inputBlockNumberFormatter ], utils.hexToNumber, - accounts - ) + ); } GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (parameters) { diff --git a/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js index 04f90eda913..de955c7c73c 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetBlockUncleCountMethodModel(utils, formatters, accounts) { +function GetBlockUncleCountMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getUncleCountByBlockNumber', @@ -39,9 +38,8 @@ function GetBlockUncleCountMethodModel(utils, formatters, accounts) { [ formatters.inputBlockNumberFormatter ], - utils.hexToNumber, - accounts - ) + utils.hexToNumber + ); } GetBlockUncleCountMethodModel.prototype.beforeExecution = function (parameters) { diff --git a/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js index 1d0bc5e440f..497e9fbd385 100644 --- a/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetUncleMethodModel(utils, formatters, accounts) { +function GetUncleMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getUncleByBlockNumberAndIndex', @@ -42,7 +41,7 @@ function GetUncleMethodModel(utils, formatters, accounts) { ], formatters.outputBlockFormatter, accounts - ) + ); } GetUncleMethodModel.prototype.beforeExecution = function (parameters) { diff --git a/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js index 9843330468a..edcdf31093e 100644 --- a/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetProtocolVersionMethodModel(utils, formatters, accounts) { +function GetProtocolVersionMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_protocolVersion', 0, null, - null, - accounts - ) + null + ); } GetProtocolVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/methods/network/ListeningMethodModel.js index f11d1f546f6..ec75bc79846 100644 --- a/packages/web3-core-method/src/methods/network/ListeningMethodModel.js +++ b/packages/web3-core-method/src/methods/network/ListeningMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function ListeningMethodModel(utils, formatters, accounts) { +function ListeningMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'net_listening', 0, null, - null, - accounts - ) + null + ); } ListeningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js index d9a87d0909f..9cb8aee587b 100644 --- a/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function ListeningMethodModel(utils, formatters, accounts) { +function ListeningMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'net_peerCount', 0, null, - utils.hexToNumber, - accounts - ) + utils.hexToNumber + ); } ListeningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/methods/network/VersionMethodModel.js index 8d201cca5b4..ddd32e7cd57 100644 --- a/packages/web3-core-method/src/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/methods/network/VersionMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function VersionMethodModel(utils, formatters, accounts) { +function VersionMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_protocolVersion', 0, null, - utils.hexToNumber, - accounts - ) + utils.hexToNumber + ); } VersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js index f849b660b56..9b88db98599 100644 --- a/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetCoinbaseMethodModel(utils, formatters, accounts) { +function GetCoinbaseMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_coinbase', 0, null, - null, - accounts - ) + null + ); } GetCoinbaseMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js index 8467c803708..5baac705353 100644 --- a/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetGasPriceMethodModel(utils, formatters, accounts) { +function GetGasPriceMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_gasPrice', 0, null, - formatters.outputBigNumberFormatter, - accounts - ) + formatters.outputBigNumberFormatter + ); } GetGasPriceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js index 3004212de92..b2f3534979e 100644 --- a/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetHashrateMethodModel(utils, formatters, accounts) { +function GetHashrateMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_hashrate', 0, null, - utils.hexToNumber, - accounts - ) + utils.hexToNumber + ); } GetHashrateMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js index 83dbd640125..0b093b29315 100644 --- a/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetNodeInfoMethodModel(utils, formatters, accounts) { +function GetNodeInfoMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'web3_clientVersion', 0, null, - null, - accounts - ) + null + ); } GetNodeInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js index 8af0bf37eeb..470eed12c1b 100644 --- a/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetWorkMethodModel(utils, formatters, accounts) { +function GetWorkMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getWork', 0, null, - null, - accounts - ) + null + ); } GetWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js index 95e98b862f8..610cfb8421f 100644 --- a/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function IsMiningMethodModel(utils, formatters, accounts) { +function IsMiningMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_mining', 0, null, - null, - accounts - ) + null + ); } IsMiningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js index 8b13963d3df..fde0316aa86 100644 --- a/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function IsSyncingMethodModel(utils, formatters, accounts) { +function IsSyncingMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_syncing', 0, null, - formatters.outputSyncingFormatter, - accounts - ) + formatters.outputSyncingFormatter + ); } IsSyncingMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js index a4ff60dbeb4..455f8902b79 100644 --- a/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function SubmitWorkMethodModel(utils, formatters, accounts) { +function SubmitWorkMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_submitWork', 3, null, null, - accounts - ) + ); } SubmitWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js index b0507f23a9c..193367eab92 100644 --- a/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function EcRecoverMethodModel(utils, formatters, accounts) { +function EcRecoverMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'personal_ecRecover', @@ -41,9 +40,8 @@ function EcRecoverMethodModel(utils, formatters, accounts) { formatters.inputAddressFormatter, null ], - null, - accounts - ) + null + ); } EcRecoverMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js index cf82a0b7767..d86f9ee5bd8 100644 --- a/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function ImportRawKeyMethodModel(utils, formatters, accounts) { +function ImportRawKeyMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'personal_importRawKey', 2, null, - null, - accounts - ) + null + ); } ImportRawKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js index 3de70395543..d5b2a942ef0 100644 --- a/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function ListAccountsMethodModel(utils, formatters, accounts) { +function ListAccountsMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'personal_listAccounts', 0, null, - utils.toChecksumAddress, - accounts - ) + utils.toChecksumAddress + ); } ListAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js index daf811ae890..45e90c389ed 100644 --- a/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function LockAccountMethodModel(utils, formatters, accounts) { +function LockAccountMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'personal_lockAccount', 1, [formatters.inputAddressFormatter], - null, - accounts - ) + null + ); } LockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js index 31123c12041..43957270b34 100644 --- a/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function NewAccountMethodModel(utils, formatters, accounts) { +function NewAccountMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'personal_newAccount', 0, null, - utils.toChecksumAddress, - accounts - ) + utils.toChecksumAddress + ); } NewAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js index b5a3d972936..c81a0ff5afa 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function PersonalSendTransactionMethodModel(utils, formatters, accounts) { +function PersonalSendTransactionMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'personal_sendTransaction', @@ -40,9 +39,8 @@ function PersonalSendTransactionMethodModel(utils, formatters, accounts) { formatters.inputTransactionFormatter, null ], - null, - accounts - ) + null + ); } PersonalSendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js index 2a0e06a407f..954d1d4ed12 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function PersonalSignMethodModel(utils, formatters, accounts) { +function PersonalSignMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'personal_sign', @@ -41,9 +40,8 @@ function PersonalSignMethodModel(utils, formatters, accounts) { formatters.inputAddressFormatter, null ], - null, - accounts - ) + null + ); } PersonalSignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js index 300443ca7d6..d896c2881a0 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function PersonalSignTransactionMethodModel(utils, formatters, accounts) { +function PersonalSignTransactionMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'personal_signTransaction', @@ -40,9 +39,8 @@ function PersonalSignTransactionMethodModel(utils, formatters, accounts) { formatters.inputTransactionFormatter, null ], - null, - accounts - ) + null + ); } PersonalSignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js index 38ea8508fb2..d5da9046ab7 100644 --- a/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function UnlockAccountMethodModel(utils, formatters, accounts) { +function UnlockAccountMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'personal_unlockAccount', @@ -41,9 +40,8 @@ function UnlockAccountMethodModel(utils, formatters, accounts) { null, null ], - null, - accounts - ) + null + ); } UnlockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js index 02ebc687d1f..80724689b11 100644 --- a/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function AddPrivateKeyMethodModel(utils, formatters, accounts) { +function AddPrivateKeyMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_addPrivateKey', 1, null, - null, - accounts - ) + null + ); } AddPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js index 89b50121b35..a48e51d8b9b 100644 --- a/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function AddSymKeyMethodModel(utils, formatters, accounts) { +function AddSymKeyMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_addSymKey', 1, null, - null, - accounts - ) + null + ); } AddSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js index 29305866411..4de52a7ae6c 100644 --- a/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function DeleteKeyPairMethodModel(utils, formatters, accounts) { +function DeleteKeyPairMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_deleteKeyPair', 1, null, - null, - accounts - ) + null + ); } DeleteKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js index 3f0358b2096..751308bf4dc 100644 --- a/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function DeleteMessageFilterMethodModel(utils, formatters, accounts) { +function DeleteMessageFilterMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_deleteMessageFilter', 1, null, - null, - accounts - ) + null + ); } DeleteMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js index 73c40411e04..75e7b465b38 100644 --- a/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function DeleteSymKeyMethodModel(utils, formatters, accounts) { +function DeleteSymKeyMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_deleteSymKey', 1, null, - null, - accounts - ) + null + ); } DeleteSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js index 65860b197f5..d6a579b474f 100644 --- a/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GenerateSymKeyFromPasswordMethodModel(utils, formatters, accounts) { +function GenerateSymKeyFromPasswordMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_generateSymKeyFromPassword', 1, null, - null, - accounts - ) + null + ); } GenerateSymKeyFromPasswordMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js index e25e68c1f5d..1ecc5f92dbb 100644 --- a/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetFilterMessagesMethodModel(utils, formatters, accounts) { +function GetFilterMessagesMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_getFilterMessages', 1, null, - null, - accounts - ) + null + ); } GetFilterMessagesMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js index d785cfd5d58..37fb1fda6a3 100644 --- a/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetInfoMethodModel(utils, formatters, accounts) { +function GetInfoMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_info', 0, null, - null, - accounts - ) + null + ); } GetInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js index 32af90500bf..8f69b10739e 100644 --- a/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetPrivateKeyMethodModel(utils, formatters, accounts) { +function GetPrivateKeyMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_getPrivateKey', 1, null, - null, - accounts - ) + null + ); } GetPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js index 24dcaf29aaa..9bd9a1ee63c 100644 --- a/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetPublicKeyMethodModel(utils, formatters, accounts) { +function GetPublicKeyMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_getPublicKey', 1, null, - null, - accounts - ) + null + ); } GetPublicKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js index 0f95a97d151..578951b265a 100644 --- a/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetSymKeyMethodModel(utils, formatters, accounts) { +function GetSymKeyMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_getSymKey', 1, null, - null, - accounts - ) + null + ); } GetSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js index 2ffc594a6ff..fda3fb32796 100644 --- a/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function HasKeyPairMethodModel(utils, formatters, accounts) { +function HasKeyPairMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_hasKeyPair', 1, null, - null, - accounts - ) + null + ); } HasKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js index 4d001c5a4d3..9c6fec09256 100644 --- a/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function HasSymKeyMethodModel(utils, formatters, accounts) { +function HasSymKeyMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_hasSymKey', 1, null, - null, - accounts - ) + null + ); } HasSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js index 8e11173c9af..f051009742c 100644 --- a/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function MarkTrustedPeerMethodModel(utils, formatters, accounts) { +function MarkTrustedPeerMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_markTrustedPeer', 1, null, - null, - accounts - ) + null + ); } MarkTrustedPeerMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js index db854c0fab3..b36fd9dc107 100644 --- a/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function NewKeyPairMethodModel(utils, formatters, accounts) { +function NewKeyPairMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_newKeyPair', 1, null, - null, - accounts - ) + null + ); } NewKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js index 92aa6777b90..c05e4bbfd1b 100644 --- a/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function NewMessageFilterMethodModel(utils, formatters, accounts) { +function NewMessageFilterMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_newMessageFilter', 1, null, - null, - accounts - ) + null + ); } NewMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js index 864b6a5314e..e25c445875d 100644 --- a/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function NewSymKeyMethodModel(utils, formatters, accounts) { +function NewSymKeyMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_newSymKey', 0, null, - null, - accounts - ) + null + ); } NewSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/methods/shh/PostMethodModel.js index 3462e6fb16b..561be8f6f8c 100644 --- a/packages/web3-core-method/src/methods/shh/PostMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/PostMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function PostMethodModel(utils, formatters, accounts) { +function PostMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_post', 1, null, - null, - accounts - ) + null + ); } PostMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js index 022e1315282..0bdf4a3cb0b 100644 --- a/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function SetMaxMessageSizeMethodModel(utils, formatters, accounts) { +function SetMaxMessageSizeMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_setMaxMessageSize', 1, null, - null, - accounts - ) + null + ); } SetMaxMessageSizeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js index 58289e6f5d0..446f3c9633a 100644 --- a/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function SetMinPoWMethodModel(utils, formatters, accounts) { +function SetMinPoWMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_setMinPoW', 1, null, - null, - accounts - ) + null + ); } SetMinPoWMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js index 670ba621eeb..6d4438cb0d4 100644 --- a/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function ShhVersionMethodModel(utils, formatters, accounts) { +function ShhVersionMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'shh_version', 0, null, - null, - accounts - ) + null + ); } ShhVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js index 365a4f285ed..11c54d286cd 100644 --- a/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -27,11 +27,10 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetTransactionFromBlockMethodModel(utils, formatters, accounts) { +function GetTransactionFromBlockMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getTransactionByBlockNumberAndIndex', @@ -40,9 +39,8 @@ function GetTransactionFromBlockMethodModel(utils, formatters, accounts) { formatters.inputBlockNumberFormatter, utils.numberToHex ], - formatters.outputTransactionFormatter, - accounts - ) + formatters.outputTransactionFormatter + ); } GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (parameters) { diff --git a/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js index 11cc39bf962..e99ebf7a11e 100644 --- a/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetTransactionMethodModel(utils, formatters, accounts) { +function GetTransactionMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getTransactionByHash', 1, null, - formatters.outputTransactionFormatter, - accounts - ) + formatters.outputTransactionFormatter + ); } GetTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js index db572065ce3..7ea6b32789e 100644 --- a/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function GetTransactionReceiptMethodModel(utils, formatters, accounts) { +function GetTransactionReceiptMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_getTransactionReceipt', 1, null, - formatters.outputTransactionReceiptFormatter, - accounts - ) + formatters.outputTransactionReceiptFormatter + ); } GetTransactionReceiptMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js index f07121c3c21..223c772dc07 100644 --- a/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function SendSignedTransactionMethodModel(utils, formatters, accounts) { +function SendSignedTransactionMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_sendRawTransaction', 1, null, - null, - accounts - ) + null + ); } SendSignedTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js index 4870de20aaa..d54a04111e6 100644 --- a/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js @@ -37,9 +37,10 @@ function SendTransactionMethodModel(utils, formatters, accounts) { 'eth_sendTransaction', 1, [formatters.inputTransactionFormatter], - null, - accounts - ) + null + ); + + this.accounts = accounts; } SendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js index 4d579c2420a..39f0ed509fb 100644 --- a/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js @@ -27,19 +27,17 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function SignTransactionMethodModel(utils, formatters, accounts) { +function SignTransactionMethodModel(utils, formatters) { AbstractMethodModel.call( this, 'eth_signTransaction', 1, [formatters.inputTransactionFormatter], - null, - accounts - ) + null + ); } SignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index 48eee3a5165..2c9331f880d 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -27,12 +27,11 @@ var web3CoreMethod = require('web3-core-method'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function MethodModelFactory(utils, formatters, accounts) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters, accounts); +function MethodModelFactory(utils, formatters) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); this.methodModels = { getAccounts: web3CoreMethod.GetAccountsMethodModel, diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index a94c70cf6f7..1de7ad5ed2b 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -52,7 +52,7 @@ module.exports = { ProvidersPackage, accounts, MethodPackage.createMethodService(), - new MethodModelFactory(Utils, formatters, accounts), + new MethodModelFactory(Utils, formatters), NetworkPackage.createNetwork(provider), Utils, formatters diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 1c8e2b84e0a..9b3ef4867b8 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -68,6 +68,10 @@ function MethodModelFactory(utils, formatters, accounts) { } +MethodModelFactory.prototype.createMethodModel = function (name) { + return new this.methodModels[name](this.utils, this.formatters, this.accounts); +}; + MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); module.exports = MethodModelFactory; diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index e60c7d892a9..be5bcb8a315 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -27,12 +27,11 @@ var web3CoreMethod = require('web3-core-method'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function MethodModelFactory(utils, formatters, accounts) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters, accounts); +function MethodModelFactory(utils, formatters) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); this.methodModels = { getId: web3CoreMethod.VersionMethodModel, diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index f73eb575b50..ace9464a6b6 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -47,13 +47,13 @@ module.exports = { */ createNetwork: function (provider) { var accounts = AccountsPackage.createAccounts(); - + return new Network( provider, ProvidersPackage, accounts, MethodPackage.createMethodService(), - new MethodModelFactory(Utils, formatters, accounts), + new MethodModelFactory(Utils, formatters), formatters, utils ) From ba1a47457201e1738ebc2fc180f59c0100a251b2 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 10:40:00 +0200 Subject: [PATCH 0104/1045] Accounts removed as dependency of AbstractWeb3Object --- packages/web3-core-package/src/AbstractWeb3Object.js | 5 ----- packages/web3-eth-accounts/src/Accounts.js | 2 +- packages/web3-eth-personal/src/Personal.js | 5 ++--- packages/web3-eth/src/Eth.js | 1 - packages/web3-eth/src/resolvers/SubscriptionsResolver.js | 2 +- packages/web3-net/src/Network.js | 5 ++--- packages/web3-shh/src/Shh.js | 5 +---- 7 files changed, 7 insertions(+), 18 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index afbfc581add..c3288b6ec68 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -36,7 +36,6 @@ function AbstractWeb3Object( provider, providersPackage, - accounts, methodService, methodModelFactory, subscriptionPackage, @@ -80,10 +79,6 @@ function AbstractWeb3Object( this.subscriptionPackage = subscriptionPackage; } - if (this.isDependencyGiven(accounts)) { - this.accounts = accounts; - } - if (this.isDependencyGiven(methodModelFactory) && this.isDependencyGiven(methodService)) { this.methodModelFactory = methodModelFactory; this.methodService = methodService; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 7cb2811d1b7..ed81e08237a 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -64,7 +64,7 @@ var makeEven = function (hex) { * @constructor */ var Accounts = function Accounts(provider, providersPackage, methodService, methodModelFactory, utils, formatters) { - AbstractWeb3Object.call(this, provider, providersPackage, this, methodService, methodModelFactory); + AbstractWeb3Object.call(this, provider, providersPackage, methodService, methodModelFactory); this.utils = utils; this.formatters = formatters; this.wallet = new Wallet(this); diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index a5ea492d765..8508f85f3c0 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -29,7 +29,6 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * * @param {any} provider * @param {ProvidersPackage} providersPackage - * @param {Accounts} accounts * @param {MethodService} methodService * @param {MethodModelFactory} methodModelFactory * @param {Network} net @@ -38,8 +37,8 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * * @constructor */ -function Personal(provider, providersPackage, accounts, methodService, methodModelFactory, net, utils, formatters) { - AbstractWeb3Object.call(this, provider, providersPackage, accounts, methodService, methodModelFactory); +function Personal(provider, providersPackage, methodService, methodModelFactory, net, utils, formatters) { + AbstractWeb3Object.call(this, provider, providersPackage, methodService, methodModelFactory); this.utils = utils; this.formatters = formatters; this.net = net; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 258dd5da136..4ccd3299202 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -65,7 +65,6 @@ var Eth = function Eth( this, provider, providersPackage, - accounts, methodService, methodModelFactory, null, diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index dc4198faa19..852fe1aee20 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -34,7 +34,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @constructor */ function SubscriptionsResolver(provider, formatters, subscriptionPackage, promiEventPackage, providersPackage) { - AbstractWeb3Object.call(this, provider, providersPackage, null, null, null, subscriptionPackage); + AbstractWeb3Object.call(this, provider, providersPackage, null, null, subscriptionPackage); this.formatters = formatters; this.promiEventPackage = promiEventPackage; } diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index 97eb414ddd5..7148cc4e51f 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -28,7 +28,6 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {Object} provider * @param {ProvidersPackage} providersPackage - * @param {Accounts} accounts * @param {MethodService} methodService * @param {MethodModelFactory} methodModelFactory * @param {Object} formatters @@ -36,8 +35,8 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * * @constructor */ -function Network(provider, providersPackage, accounts, methodService, methodModelFactory, formatters, utils) { - AbstractWeb3Object.call(this, provider, providersPackage, accounts, methodService, methodModelFactory); +function Network(provider, providersPackage, methodService, methodModelFactory, formatters, utils) { + AbstractWeb3Object.call(this, provider, providersPackage, methodService, methodModelFactory); this.formatters = formatters; this.utils = utils; } diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index 343e4076129..c0e7208446b 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -27,21 +27,18 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {Object} provider * @param {ProvidersPackage} providersPackage - * @param {Accounts} accounts * @param {MethodService} methodService * @param {MethodModelFactory} methodModelFactory * @param {SubscriptionPackage} subscriptionPackage * @param {Network} net * * @constructor - * //TODO: Accounts should not be a default dependency of AbstractWeb3Object */ -function Shh(provider, providersPackage, accounts, methodService, methodModelFactory, subscriptionPackage, net) { +function Shh(provider, providersPackage, methodService, methodModelFactory, subscriptionPackage, net) { AbstractWeb3Object.call( this, provider, providersPackage, - accounts, methodService, methodModelFactory, subscriptionPackage From 8328f5b9ea8594019d35d8f85cf6d1380df3e88f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 10:53:28 +0200 Subject: [PATCH 0105/1045] Accounts removed from Shh, Net and Personal package --- packages/web3-eth-personal/src/index.js | 4 ---- packages/web3-net/src/index.js | 4 ---- packages/web3-shh/src/factories/MethodModelFactory.js | 5 ++--- packages/web3-shh/src/index.js | 6 +----- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 1de7ad5ed2b..392161df433 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -25,7 +25,6 @@ var version = require('./package.json').version; var Personal = require('./Personal'); var MethodPackage = require('web3-core-method'); -var AccountsPackage = require('web3-eth-accounts'); var NetworkPackage = require('web3-net'); var ProvidersPackage = require('web3-core-providers'); var Utils = require('web3-utils'); @@ -45,12 +44,9 @@ module.exports = { * @returns {Personal} */ createPersonal: function (provider) { - var accounts = AccountsPackage.createAccounts(provider); - return new Personal( provider, ProvidersPackage, - accounts, MethodPackage.createMethodService(), new MethodModelFactory(Utils, formatters), NetworkPackage.createNetwork(provider), diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index ace9464a6b6..f5df7afeacf 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -26,7 +26,6 @@ var version = require('../package.json').version; var ProvidersPackage = require('web3-core-providers'); var MethodPackage = require('web3-core-method'); -var AccountsPackage = require('web3-eth-accounts'); var formatters = require('web3-core-helpers').formatters; var utils = require('web3-utils'); var Network = require('./Network'); @@ -46,12 +45,9 @@ module.exports = { * @returns {Network} */ createNetwork: function (provider) { - var accounts = AccountsPackage.createAccounts(); - return new Network( provider, ProvidersPackage, - accounts, MethodPackage.createMethodService(), new MethodModelFactory(Utils, formatters), formatters, diff --git a/packages/web3-shh/src/factories/MethodModelFactory.js b/packages/web3-shh/src/factories/MethodModelFactory.js index eb1d6672075..6ae87ecbf6b 100644 --- a/packages/web3-shh/src/factories/MethodModelFactory.js +++ b/packages/web3-shh/src/factories/MethodModelFactory.js @@ -27,12 +27,11 @@ var web3CoreMethod = require('web3-core-method'); /** * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function MethodModelFactory(utils, formatters, accounts) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters, accounts); +function MethodModelFactory(utils, formatters) { + web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); this.methodModels = { getVersion: web3CoreMethod.ShhVersionMethodModel, diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 823d450087f..25064693146 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -24,7 +24,6 @@ var version = require('./package.json'); var ProvidersPackage = require('web3-core-providers'); -var AccountsPackage = require('web3-eth-accounts'); var MethodPackage = require('web3-core-method'); var SubscriptionPackage = require('web3-core-subscription'); var NetworkPackage = require('web3-net'); @@ -46,14 +45,11 @@ module.exports = { * @returns {Shh} */ createShh: function (provider) { - var accounts = AccountsPackage.createAccounts(provider); - return new Shh( provider, ProvidersPackage, - accounts, MethodPackage.createMethodService(), - new MethodModelFactory(Utils, formatters, accounts), + new MethodModelFactory(Utils, formatters), SubscriptionPackage, NetworkPackage.createNetwork(provider) ); From 494ad1ed9b098178bb186072a93c0897e08662ac Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 11:14:25 +0200 Subject: [PATCH 0106/1045] unused if removed in MethodService, MessageSigner error message updated --- packages/web3-core-method/src/MethodService.js | 4 ---- packages/web3-core-method/src/signers/MessageSigner.js | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/web3-core-method/src/MethodService.js b/packages/web3-core-method/src/MethodService.js index dac7698682e..42679de6217 100644 --- a/packages/web3-core-method/src/MethodService.js +++ b/packages/web3-core-method/src/MethodService.js @@ -138,10 +138,6 @@ MethodService.prototype.send = function (methodModel, provider, accounts, parame return promiEvent; } - if (this.methodModel.isSign()) { - return this.messageSigner.sign(parameters[0], parameters[1], accounts); - } - return this.call(methodModel, provider, parameters, callback); }; diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 258382d701e..7e2d8a13a3a 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -46,7 +46,7 @@ MessageSigner.prototype.sign = function(data, address, accounts) { return accounts.sign(data, wallet.privateKey).signature; } - return new Error('Wallet or privateKey for wallet is not set!'); + return new Error('Wallet or privateKey in wallet is not set!'); }; // Inherit from AbstractSigner From 4e69e8fbed3f868131ae0cbcad882eb4f8c374a2 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 11:29:47 +0200 Subject: [PATCH 0107/1045] any-promise removed because of official support since node version 6.4 and it is also supported since seven versions and more in the Edge, Chrome, Firefox, Opera and Safari browser --- packages/web3-core-promievent/package.json | 1 - packages/web3-core-promievent/src/PromiEvent.js | 7 ------- 2 files changed, 8 deletions(-) diff --git a/packages/web3-core-promievent/package.json b/packages/web3-core-promievent/package.json index a4426fe3021..014c44cb19a 100644 --- a/packages/web3-core-promievent/package.json +++ b/packages/web3-core-promievent/package.json @@ -7,7 +7,6 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "any-promise": "1.3.0", "eventemitter3": "1.1.1" } } diff --git a/packages/web3-core-promievent/src/PromiEvent.js b/packages/web3-core-promievent/src/PromiEvent.js index 818f95395cb..617da45b0ee 100644 --- a/packages/web3-core-promievent/src/PromiEvent.js +++ b/packages/web3-core-promievent/src/PromiEvent.js @@ -23,7 +23,6 @@ "use strict"; var EventEmitter = require('eventemitter3'); -var Promise = require("any-promise"); /** * This function generates a defer promise and adds eventEmitter functionality to it @@ -58,10 +57,4 @@ var PromiEvent = function PromiEvent() { }; }; -PromiEvent.resolve = function(value) { - var promise = PromiEvent(true); - promise.resolve(value); - return promise.eventEmitter; -}; - module.exports = PromiEvent; From 8569eee5508465c82575b85c09fa7b25a6ed18e5 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 11:47:46 +0200 Subject: [PATCH 0108/1045] DefaultBlock handling added to rpc methods --- packages/web3-core-method/src/MethodService.js | 5 +++-- .../src/methods/CallMethodModel.js | 14 ++++++++++++++ .../src/methods/GetCodeMethodModel.js | 14 ++++++++++++++ .../src/methods/GetStorageAtMethodModel.js | 14 ++++++++++++++ .../src/methods/account/GetBalanceMethodModel.js | 14 ++++++++++++++ .../account/GetTransactionCountMethodModel.js | 14 ++++++++++++++ .../web3-core-package/src/AbstractWeb3Object.js | 1 + 7 files changed, 74 insertions(+), 2 deletions(-) diff --git a/packages/web3-core-method/src/MethodService.js b/packages/web3-core-method/src/MethodService.js index 42679de6217..01290aad566 100644 --- a/packages/web3-core-method/src/MethodService.js +++ b/packages/web3-core-method/src/MethodService.js @@ -53,15 +53,16 @@ function MethodService( * @param {AbstractMethodModel} methodModel * @param {AbstractProviderAdapter} provider * @param {Accounts} accounts + * @param {Object} parentObject - The object from which the method is called. * @param {Array} methodArguments * * @returns {Promise|eventifiedPromise|String|boolean} */ -MethodService.prototype.execute = function (methodModel, provider, accounts, methodArguments) { +MethodService.prototype.execute = function (methodModel, provider, accounts, parentObject, methodArguments) { var mappedFunctionArguments = this.mapFunctionArguments(methodArguments); if (_.isFunction(methodModel.beforeExecution)) { - methodModel.beforeExecution(mappedFunctionArguments.parameters); + methodModel.beforeExecution(mappedFunctionArguments.parameters, parentObject); } return this.send( diff --git a/packages/web3-core-method/src/methods/CallMethodModel.js b/packages/web3-core-method/src/methods/CallMethodModel.js index 538798d6a8f..966c4f9a257 100644 --- a/packages/web3-core-method/src/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/methods/CallMethodModel.js @@ -43,6 +43,20 @@ function CallMethodModel(utils, formatters) { ); } +/** + * This method will be executed before the effective execution. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} parentObject + */ +CallMethodModel.prototype.beforeExecution = function (parameters, parentObject) { + if (!parameters[1]) { + parameters[1] = parentObject.defaultBlock; + } +}; + CallMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = CallMethodModel; diff --git a/packages/web3-core-method/src/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/methods/GetCodeMethodModel.js index 671c05cd438..7520ad21add 100644 --- a/packages/web3-core-method/src/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/methods/GetCodeMethodModel.js @@ -43,6 +43,20 @@ function GetCodeMethodModel(utils, formatters) { ); } +/** + * This method will be executed before the effective execution. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} parentObject + */ +GetCodeMethodModel.prototype.beforeExecution = function (parameters, parentObject) { + if (!parameters[1]) { + parameters[1] = parentObject.defaultBlock; + } +}; + GetCodeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetCodeMethodModel; diff --git a/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js index 6172e5ed7f9..e20a505e87a 100644 --- a/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js @@ -44,6 +44,20 @@ function GetStorageAtMethodModel(utils, formatters) { ); } +/** + * This method will be executed before the effective execution. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} parentObject + */ +GetStorageAtMethodModel.prototype.beforeExecution = function (parameters, parentObject) { + if (!parameters[2]) { + parameters[2] = parentObject.defaultBlock; + } +}; + GetStorageAtMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetStorageAtMethodModel; diff --git a/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js index 5933541d15a..4d608108e74 100644 --- a/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js @@ -43,6 +43,20 @@ function GetBalanceMethodModel(utils, formatters) { ); } +/** + * This method will be executed before the effective execution. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} parentObject + */ +GetBalanceMethodModel.prototype.beforeExecution = function (parameters, parentObject) { + if (!parameters[1]) { + parameters[1] = parentObject.defaultBlock; + } +}; + GetBalanceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetBalanceMethodModel; diff --git a/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js index 00753d9e828..9fabd091dc2 100644 --- a/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js @@ -43,6 +43,20 @@ function GetTransactionCountMethodModel(utils, formatters) { ); } +/** + * This method will be executed before the effective execution. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} parentObject + */ +GetTransactionCountMethodModel.prototype.beforeExecution = function (parameters, parentObject) { + if (!parameters[1]) { + parameters[1] = parentObject.defaultBlock; + } +}; + GetTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetTransactionCountMethodModel; diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index c3288b6ec68..f0b8d2e4a15 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -190,6 +190,7 @@ AbstractWeb3Object.prototype.proxyHandler = function(target, name) { methodModel, target.currentProvider, target.accounts, + target, arguments ); }; From c180dd64b53f0bd4f405d05a26d75cb39a825c3a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 11:54:58 +0200 Subject: [PATCH 0109/1045] setter of defaultBlock and defaultAccount in Eth will now set the block and the account also for the sub packages Personal and Contract, defaultBlock and defaultAccount added to Personal --- packages/web3-eth-personal/src/Personal.js | 24 ++++++++++++++++++++++ packages/web3-eth/src/Eth.js | 6 ++++++ 2 files changed, 30 insertions(+) diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 8508f85f3c0..d72b501f1c5 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -42,6 +42,30 @@ function Personal(provider, providersPackage, methodService, methodModelFactory, this.utils = utils; this.formatters = formatters; this.net = net; + 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)); + } + }, + enumerable: true + }); + + Object.defineProperty(this, 'defaultBlock', { + get: function () { + return defaultBlock; + }, + set: function (val) { + defaultBlock = val; + }, + enumerable: true + }); } /** diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 4ccd3299202..6fee1a907d2 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -96,6 +96,9 @@ var Eth = function Eth( if (val) { defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); } + + self.Contract.defaultAccount = defaultAccount; + self.personal.defaultAccount = defaultAccount; }, enumerable: true }); @@ -109,6 +112,9 @@ var Eth = function Eth( }, set: function (val) { defaultBlock = val; + + self.Contract.defaultAccount = defaultBlock; + self.personal.defaultAccount = defaultBlock; }, enumerable: true }); From bed26d44f4b400afa3228ebb5d8c308776aa8239 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 14:54:39 +0200 Subject: [PATCH 0110/1045] extend method in AbstractWeb3Object refactored because of the new method handling --- .../src/AbstractWeb3Object.js | 76 ++++++++++++------- 1 file changed, 49 insertions(+), 27 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index f0b8d2e4a15..97eba608d43 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -56,7 +56,7 @@ function AbstractWeb3Object( }; Object.defineProperty(this, 'currentProvider', { - get: function() { + get: function () { return this._provider; }, set: function (provider) { @@ -100,7 +100,7 @@ function AbstractWeb3Object( * * @returns {boolean} */ -AbstractWeb3Object.prototype.isDependencyGiven = function(object) { +AbstractWeb3Object.prototype.isDependencyGiven = function (object) { return object !== null || typeof object !== 'undefined'; }; @@ -120,7 +120,7 @@ AbstractWeb3Object.prototype.setProvider = function (provider) { * * @method clearSubscriptions */ -AbstractWeb3Object.prototype.clearSubscriptions = function() { +AbstractWeb3Object.prototype.clearSubscriptions = function () { if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && this.currentProvider.subscriptions.length > 0) { this.currentProvider.clearSubscriptions(); } @@ -135,34 +135,56 @@ AbstractWeb3Object.prototype.clearSubscriptions = function() { */ AbstractWeb3Object.prototype.extend = function (extension) { var namespace = extension.property || false, - extendedObject, - self = this; + extendedObject; if (namespace) { - extendedObject = this[namespace] = {}; + extendedObject = this[namespace] = new this.constructor( + this.provider, + this.providersPackage, + this.methodService, + new this.methodModelFactory.constructor(this.methodModelFactory.utils, this.methodModelFactory.formatters) + ); } else { extendedObject = this; } - if (extension.methods.length > 0) { - extension.methods.forEach(function(method) { - extendedObject[method.name] = function () { - var parameters = null; - var callback = arguments[0]; - - if (method.params && method.params > 0) { - parameters = arguments.slice(0, (method.params - 1 )); - callback = arguments.slice(-1); - } - - return this.methodPackage.create( - self.currentProvider, - method.call, - parameters, - method.inputFormatter, - method.outputFormatter - ).send(callback); - }; + if (extension.methods) { + extension.methods.forEach(function (method) { + function ExtensionMethodModel(utils, formatters) { + AbstractMethodModel.call(this, method.call, method.params, utils, formatters); + } + + ExtensionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + method.inputFormatters.forEach(function (formatter, key) { + if (formatter) { + parameters[key] = formatter(parameters[key], web3Package); + } + }); + }; + + ExtensionMethodModel.prototype.afterExecution = function (response) { + if (_.isArray(response)) { + response = response.map(function (responseItem) { + if (method.outputFormatter && responseItem) { + return method.outputFormatter(responseItem); + } + + return responseItem; + }); + + return response; + } + + if (method.outputFormatter && result) { + response = method.outputFormatter(response); + } + + return response; + }; + + ExtensionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + + extendedObject.methodModelFactory.methodModels[method.name] = ExtensionMethodModel; }); } }; @@ -177,7 +199,7 @@ AbstractWeb3Object.prototype.extend = function (extension) { * * @returns {*} */ -AbstractWeb3Object.prototype.proxyHandler = function(target, name) { +AbstractWeb3Object.prototype.proxyHandler = function (target, name) { if (target.methodModelFactory.hasMethodModel(name)) { if (typeof target[name] !== 'undefined') { throw new Error('Duplicated method ' + name + '. This method is defined as RPC call and as Object method.'); @@ -185,7 +207,7 @@ AbstractWeb3Object.prototype.proxyHandler = function(target, name) { var methodModel = target.methodModelFactory.createMethodModel(name); - var anonymousFunction = function() { + var anonymousFunction = function () { return target.methodService.execute( methodModel, target.currentProvider, From 4036440976bec160f2d02136ae5d82bfd02d8fd8 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 15:01:18 +0200 Subject: [PATCH 0111/1045] setProvider in AbstractWeb3Object will now update the provider also for the dynamicly added packages --- packages/web3-core-package/src/AbstractWeb3Object.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 97eba608d43..c96169ae169 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -45,6 +45,7 @@ function AbstractWeb3Object( throw Error('Provider and the ProviderPackage not found!'); } + this.extendedPackages = []; this.providersPackage = providersPackage; this._provider = this.providersPackage.resolve(provider); this.givenProvider = this.providersPackage.detect(); @@ -112,7 +113,15 @@ AbstractWeb3Object.prototype.isDependencyGiven = function (object) { * @param {any} provider */ AbstractWeb3Object.prototype.setProvider = function (provider) { + var self = this; + this.currentProvider = provider; + + if (this.extendedPackages.length > 0) { + this.extendedPackages.forEach(function(extendedPackage) { + extendedPackage.setProvider(self.currentProvider) + }); + } }; /** @@ -144,6 +153,8 @@ AbstractWeb3Object.prototype.extend = function (extension) { this.methodService, new this.methodModelFactory.constructor(this.methodModelFactory.utils, this.methodModelFactory.formatters) ); + + this.extendedPackages.push(extendedObject); } else { extendedObject = this; } From 683d799dcd9ce229a24d1468158a2627b297ac95 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 15:03:14 +0200 Subject: [PATCH 0112/1045] naming improved in extend method of AbstractWeb3Object --- packages/web3-core-package/src/AbstractWeb3Object.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index c96169ae169..341d9bf28eb 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -144,19 +144,19 @@ AbstractWeb3Object.prototype.clearSubscriptions = function () { */ AbstractWeb3Object.prototype.extend = function (extension) { var namespace = extension.property || false, - extendedObject; + object; if (namespace) { - extendedObject = this[namespace] = new this.constructor( + object = this[namespace] = new this.constructor( this.provider, this.providersPackage, this.methodService, new this.methodModelFactory.constructor(this.methodModelFactory.utils, this.methodModelFactory.formatters) ); - this.extendedPackages.push(extendedObject); + this.extendedPackages.push(object); } else { - extendedObject = this; + object = this; } if (extension.methods) { @@ -195,7 +195,7 @@ AbstractWeb3Object.prototype.extend = function (extension) { ExtensionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); - extendedObject.methodModelFactory.methodModels[method.name] = ExtensionMethodModel; + object.methodModelFactory.methodModels[method.name] = ExtensionMethodModel; }); } }; From 2aff50c7f4d77d0a36d560e15691cf197f0ce84b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 15:24:13 +0200 Subject: [PATCH 0113/1045] afterExecution & beforeExecution added to AbstractMethodModel, MethodService & TransactionConfirmationWorkflow extended with afterExecution & beforeExecution, inputDefaultBlockNumberFormatter refactored in formatters.js, GetBalanceMethodModel refactored because of afterExecution & beforeExecution --- packages/web3-core-helpers/src/formatters.js | 21 ++++-- .../lib/models/AbstractMethodModel.js | 21 ++++++ .../web3-core-method/src/MethodService.js | 68 +++---------------- .../methods/account/GetBalanceMethodModel.js | 35 +++++----- .../TransactionConfirmationWorkflow.js | 59 ++++++++-------- 5 files changed, 96 insertions(+), 108 deletions(-) diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index e82b7a37c78..7f992be446b 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -43,13 +43,24 @@ var isPredefinedBlockNumber = function (blockNumber) { return blockNumber === 'latest' || blockNumber === 'pending' || blockNumber === 'earliest'; }; -var inputDefaultBlockNumberFormatter = function (blockNumber) { - if (this && (blockNumber === undefined || blockNumber === null)) { - return this.defaultBlock; +/** + * Determines if it should use the default block by the given package or not, + * will map 'genesis' and 'earlist' to '0x0' and runs the inputBlockNumberFormatter. + * + * @param {String|Number} blockNumber + * @param {AbstractWeb3Object} web3Package + * + * @returns {String} + */ +var inputDefaultBlockNumberFormatter = function (blockNumber, web3Package) { + if (blockNumber === undefined || blockNumber === null) { + return web3Package.defaultBlock; } + if (blockNumber === 'genesis' || blockNumber === 'earliest') { return '0x0'; } + return inputBlockNumberFormatter(blockNumber); }; @@ -142,7 +153,7 @@ var inputTransactionFormatter = function (options) { throw new Error('The send transactions "from" field must be defined!'); } - options.from = inputAddressFormatter(options.from); + options.from = (options.from); } return options; @@ -401,11 +412,13 @@ var outputPostFormatter = function(post){ var inputAddressFormatter = function (address) { var iban = new Iban(address); + if (iban.isValid() && iban.isDirect()) { return iban.toAddress().toLowerCase(); } else if (utils.isAddress(address)) { return '0x' + address.toLowerCase().replace('0x',''); } + throw new Error('Provided address "'+ address +'" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can\'t be converted.'); }; diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 9d5fcbfb02b..7c6138be49d 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -37,6 +37,27 @@ function AbstractMethodModel(rpcMethod, parametersAmount, inputFormatters, outpu this.outputFormatter = outputFormatter; } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +AbstractMethodModel.prototype.beforeExecution = function(parameters, web3Package) { }; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {*} + */ +AbstractMethodModel.prototype.afterExecution = function(response) { }; + /** * Returns the given function arguments and the current model * diff --git a/packages/web3-core-method/src/MethodService.js b/packages/web3-core-method/src/MethodService.js index 01290aad566..64005e8b18e 100644 --- a/packages/web3-core-method/src/MethodService.js +++ b/packages/web3-core-method/src/MethodService.js @@ -61,9 +61,7 @@ function MethodService( MethodService.prototype.execute = function (methodModel, provider, accounts, parentObject, methodArguments) { var mappedFunctionArguments = this.mapFunctionArguments(methodArguments); - if (_.isFunction(methodModel.beforeExecution)) { - methodModel.beforeExecution(mappedFunctionArguments.parameters, parentObject); - } + methodModel.beforeExecution(mappedFunctionArguments.parameters, parentObject); return this.send( methodModel, @@ -167,13 +165,14 @@ MethodService.prototype.isGasPriceDefined = function () { * @returns {Promise} */ MethodService.prototype.call = function (methodModel, provider, parameters, callback) { - var self = this; - return provider.send( methodModel.rpcMethod, - this.formatInput(parameters, methodModel.inputFormatters) + parameters ).then(function (response) { - return self.formatOutput(response, methodModel.outputFormatter, callback) + var mappedResponse = methodModel.afterExecution(response); + callback(mappedResponse); + + return mappedResponse; }); }; @@ -237,9 +236,10 @@ MethodService.prototype.sendTransaction = function (methodModel, provider, promi provider.send( methodModel.rpcMethod, - this.formatInput(parameters, methodModel.inputFormatters) + parameters ).then(function (response) { self.transactionConfirmationWorkflow.execute( + methodModel, provider, response, promiEvent, @@ -256,56 +256,4 @@ MethodService.prototype.sendTransaction = function (methodModel, provider, promi return promiEvent; }; -/** - * Formats the input parameters - * - * @method formatInput - * - * @param {Array} parameters - * @param {Array} inputFormatters - * - * @returns {Array} - */ -MethodService.prototype.formatInput = function (parameters, inputFormatters) { - return inputFormatters.map(function (formatter, key) { - return formatter ? formatter(parameters[key]) : parameters[key]; - }); -}; - -/** - * Formats the output of an JSON-RPC call request - * - * @method formatOutput - * - * @param {Function|null} outputFormatter - * @param {Array | String} response - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Array | String} - */ -MethodService.prototype.formatOutput = function (outputFormatter, response, callback) { - if (_.isArray(response)) { - response = response.map(function (responseItem) { - if (outputFormatter && responseItem) { - return outputFormatter(responseItem); - } - - return responseItem; - }); - - callback(false, response); - - return response; - } - - if (outputFormatter && result) { - response = outputFormatter(response); - } - - callback(false, response); - - return response; -}; - module.exports = MethodService; diff --git a/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js index 4d608108e74..ed7e1bbdbdf 100644 --- a/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js @@ -31,30 +31,33 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetBalanceMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getBalance', - 2, - [ - formatters.inputAddressFormatter, - formatters.inputDefaultBlockNumberFormatter - ], - formatters.outputBigNumberFormatter - ); + AbstractMethodModel.call(this, 'eth_getBalance', 2, utils, formatters); } /** - * This method will be executed before the effective execution. + * This method will be executed before the RPC request. * * @method beforeExecution * * @param {Array} parameters - * @param {Object} parentObject + * @param {Object} web3Package - The package where the method is called from for example Eth. */ -GetBalanceMethodModel.prototype.beforeExecution = function (parameters, parentObject) { - if (!parameters[1]) { - parameters[1] = parentObject.defaultBlock; - } +GetBalanceMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); + parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(parameters[1], web3Package); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {BigNumber} + */ +GetBalanceMethodModel.prototype.afterExecution = function(response) { + return this.formatters.outputBigNumberFormatter(response); }; GetBalanceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index bd7c50048b3..cac8c9ddada 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -44,6 +44,7 @@ function TransactionConfirmationWorkflow( * * @method execute * + * @param {AbstractMethodModel} methodModel * @param {AbstractProviderAdapter} provider * @param {String} transactionHash * @param {Object} promiEvent @@ -52,23 +53,28 @@ function TransactionConfirmationWorkflow( * @callback callback callback(error, result) */ TransactionConfirmationWorkflow.prototype.execute = function ( + methodModel, provider, transactionHash, promiEvent, callback ) { var self = this; + this.methodModel = methodModel; + this.provider = provider; + this.promiEvent = promiEvent; + this.callback = callback; - this.getTransactionReceipt(provider, transactionHash).then(function (receipt) { + this.getTransactionReceipt(transactionHash).then(function (receipt) { if (receipt && receipt.blockHash) { var validationResult = this.transactionReceiptValidator.validate(receipt); if (validationResult === true) { - this.handleSuccessState(receipt, promiEvent, callback); + this.handleSuccessState(receipt); return; } - self.handleErrorState(validationResult, promiEvent, callback); + self.handleErrorState(validationResult); return; } @@ -76,18 +82,18 @@ TransactionConfirmationWorkflow.prototype.execute = function ( self.newHeadsWatcher.watch(provider).on('newHead', function () { self.transactionConfirmationModel.timeoutCounter++; if (!self.transactionConfirmationModel.isTimeoutTimeExceeded()) { - self.getTransactionReceipt(provider, transactionHash).then(function (receipt) { + self.getTransactionReceipt(transactionHash).then(function (receipt) { var validationResult = self.transactionReceiptValidator.validate(receipt); if (validationResult === true) { self.transactionConfirmationModel.addConfirmation(receipt); - self.promiEvent.eventEmitter.emit( + promiEvent.eventEmitter.emit( 'confirmation', self.transactionConfirmationModel.confirmationsCount, receipt ); if (self.transactionConfirmationModel.isConfirmed()) { - self.handleSuccessState(receipt, promiEvent, callback); + self.handleSuccessState(receipt); } return; @@ -108,11 +114,7 @@ TransactionConfirmationWorkflow.prototype.execute = function ( error = new Error('Transaction was not mined within' + self.transactionConfirmationModel.POLLINGTIMEOUT + ' seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!') } - self.handleErrorState( - error, - promiEvent, - callback - ); + self.handleErrorState(error); }); }); }; @@ -122,13 +124,12 @@ TransactionConfirmationWorkflow.prototype.execute = function ( * * @method execute * - * @param {AbstractProviderAdapter} provider * @param {String} transactionHash * * @returns {Promise} */ -TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (provider, transactionHash) { - return provider.send('eth_getTransactionReceipt', [transactionHash]).then(function (receipt) { +TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (transactionHash) { + return this.provider.send('eth_getTransactionReceipt', [transactionHash]).then(function (receipt) { return this.formatters.outputTransactionReceiptFormatter(receipt); }) }; @@ -139,17 +140,19 @@ TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (prov * @method handleSuccessState * * @param {Object} receipt - * @param {PromiEvent} promiEvent - * @param {Function} callback * * @callback callback callback(error, result) */ -TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt, promiEvent, callback) { +TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt) { this.newHeadsWatcher.stop(); - promiEvent.resolve(receipt); - promiEvent.eventEmitter.emit('receipt', receipt); - promiEvent.eventEmitter.removeAllListeners(); - callback(false, receipt); + + var mappedReceipt = this.methodModel.afterExecution(receipt); + + this.promiEvent.resolve(mappedReceipt); + this.promiEvent.eventEmitter.emit('receipt', mappedReceipt); + this.promiEvent.eventEmitter.removeAllListeners(); + + this.callback(false, mappedReceipt); }; /** @@ -158,17 +161,17 @@ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt * @method handleErrorState * * @param {Error} error - * @param {PromiEvent} promiEvent - * @param {Function} callback * * @callback callback callback(error, result) */ -TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, promiEvent, callback) { +TransactionConfirmationWorkflow.prototype.handleErrorState = function (error) { this.newHeadsWatcher.stop(); - promiEvent.reject(error).apply(error); - promiEvent.eventEmitter.emit('error', error); - promiEvent.eventEmitter.removeAllListeners(); - callback(error, null); + + this.promiEvent.reject(error).apply(error); + this.promiEvent.eventEmitter.emit('error', error); + this.promiEvent.eventEmitter.removeAllListeners(); + + this.callback(error, null); }; module.exports = TransactionConfirmationWorkflow; From b4070097360ce58de73d97d3529ed1d1436a9211 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 16:38:49 +0200 Subject: [PATCH 0114/1045] before- & afterExecution added to MethodModels --- .../lib/models/AbstractMethodModel.js | 14 ++++--- .../src/methods/CallMethodModel.js | 22 +++-------- .../src/methods/EstimateGasMethodModel.js | 33 ++++++++++++---- .../src/methods/GetCodeMethodModel.js | 22 +++-------- .../src/methods/GetPastLogslMethodModel.js | 33 +++++++++++++++- .../src/methods/GetStorageAtMethodModel.js | 20 ++++------ .../src/methods/SignMethodModel.js | 25 ++++++------ .../methods/account/GetAccountsMethodModel.js | 25 ++++++++---- .../account/GetTransactionCountMethodModel.js | 33 +++++++++------- .../src/methods/block/GetBlockMethodModel.js | 39 ++++++++++++------- .../block/GetBlockNumberMethodModel.js | 21 ++++++---- .../GetBlockTransactionCountMethodModel.js | 35 ++++++++++++----- .../block/GetBlockUncleCountMethodModel.js | 35 ++++++++++++----- .../src/methods/block/GetUncleMethodModel.js | 38 ++++++++++++------ .../network/GetProtocolVersionMethodModel.js | 8 +--- .../methods/network/ListeningMethodModel.js | 8 +--- .../methods/network/PeerCountMethodModel.js | 29 ++++++++------ .../src/methods/network/VersionMethodModel.js | 21 ++++++---- .../methods/node/GetCoinbaseMethodModel.js | 8 +--- .../methods/node/GetGasPriceMethodModel.js | 21 ++++++---- .../methods/node/GetHashrateMethodModel.js | 21 ++++++---- .../methods/node/GetNodeInfoMethodModel.js | 8 +--- .../src/methods/node/GetWorkMethodModel.js | 8 +--- .../src/methods/node/IsMiningMethodModel.js | 8 +--- .../src/methods/node/IsSyncingMethodModel.js | 21 ++++++---- .../src/methods/node/SubmitWorkMethodModel.js | 8 +--- .../methods/personal/EcRecoverMethodModel.js | 25 ++++++------ .../personal/ImportRawKeyMethodModel.js | 8 +--- .../personal/ListAccountsMethodModel.js | 25 ++++++++---- .../personal/LockAccountMethodModel.js | 20 ++++++---- .../methods/personal/NewAccountMethodModel.js | 21 ++++++---- .../PersonalSendTransactionMethodModel.js | 23 ++++++----- .../personal/PersonalSignMethodModel.js | 25 ++++++------ .../PersonalSignTransactionMethodModel.js | 23 ++++++----- .../personal/UnlockAccountMethodModel.js | 24 ++++++------ .../methods/shh/AddPrivateKeyMethodModel.js | 8 +--- .../src/methods/shh/AddSymKeyMethodModel.js | 8 +--- .../methods/shh/DeleteKeyPairMethodModel.js | 8 +--- .../shh/DeleteMessageFilterMethodModel.js | 8 +--- .../methods/shh/DeleteSymKeyMethodModel.js | 8 +--- .../GenerateSymKeyFromPasswordMethodModel.js | 8 +--- .../shh/GetFilterMessagesMethodModel.js | 8 +--- .../src/methods/shh/GetInfoMethodModel.js | 8 +--- .../methods/shh/GetPrivateKeyMethodModel.js | 8 +--- .../methods/shh/GetPublicKeyMethodModel.js | 8 +--- .../src/methods/shh/GetSymKeyMethodModel.js | 8 +--- .../src/methods/shh/HasKeyPairMethodModel.js | 8 +--- .../src/methods/shh/HasSymKeyMethodModel.js | 8 +--- .../methods/shh/MarkTrustedPeerMethodModel.js | 8 +--- .../src/methods/shh/NewKeyPairMethodModel.js | 8 +--- .../shh/NewMessageFilterMethodModel.js | 8 +--- .../src/methods/shh/NewSymKeyMethodModel.js | 8 +--- .../src/methods/shh/PostMethodModel.js | 8 +--- .../shh/SetMaxMessageSizeMethodModel.js | 8 +--- .../src/methods/shh/SetMinPoWMethodModel.js | 8 +--- .../src/methods/shh/ShhVersionMethodModel.js | 8 +--- .../GetTransactionFromBlockMethodModel.js | 37 ++++++++++++------ .../transaction/GetTransactionMethodModel.js | 21 ++++++---- .../GetTransactionReceiptMethodModel.js | 21 ++++++---- .../SendSignedTransactionMethodModel.js | 8 +--- .../transaction/SendTransactionMethodModel.js | 21 ++++++---- .../transaction/SignTransactionMethodModel.js | 20 ++++++---- 62 files changed, 547 insertions(+), 507 deletions(-) diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 7c6138be49d..1a3c5d94b8c 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -25,16 +25,16 @@ /** * @param {String|Function} rpcMethod * @param {Number} parametersAmount - * @param {Array} inputFormatters - * @param {Function} outputFormatter + * @param {Utils} utils + * @param {Object} formatters * * @constructor */ -function AbstractMethodModel(rpcMethod, parametersAmount, inputFormatters, outputFormatter) { +function AbstractMethodModel(rpcMethod, parametersAmount, utils, formatters) { this.rpcMethod = rpcMethod; this.parametersAmount = parametersAmount; - this.inputFormatters = inputFormatters; - this.outputFormatter = outputFormatter; + this.utils = utils; + this.formatters = formatters; } /** @@ -56,7 +56,9 @@ AbstractMethodModel.prototype.beforeExecution = function(parameters, web3Package * * @returns {*} */ -AbstractMethodModel.prototype.afterExecution = function(response) { }; +AbstractMethodModel.prototype.afterExecution = function(response) { + return response; +}; /** * Returns the given function arguments and the current model diff --git a/packages/web3-core-method/src/methods/CallMethodModel.js b/packages/web3-core-method/src/methods/CallMethodModel.js index 966c4f9a257..cec426a1bc4 100644 --- a/packages/web3-core-method/src/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/methods/CallMethodModel.js @@ -31,30 +31,20 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function CallMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_call', - 2, - [ - formatters.inputCallFormatter, - formatters.inputDefaultBlockNumberFormatter - ], - null - ); + AbstractMethodModel.call(this, 'eth_call', 2, utils, formatters); } /** - * This method will be executed before the effective execution. + * This method will be executed before the RPC request. * * @method beforeExecution * * @param {Array} parameters - * @param {Object} parentObject + * @param {Object} web3Package - The package where the method is called from for example Eth. */ -CallMethodModel.prototype.beforeExecution = function (parameters, parentObject) { - if (!parameters[1]) { - parameters[1] = parentObject.defaultBlock; - } +CallMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputCallFormatter(parameters[0]); + parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(parameters[1], web3Package); }; CallMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/methods/EstimateGasMethodModel.js index d9d61e8190f..ecc11fcfcd7 100644 --- a/packages/web3-core-method/src/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/methods/EstimateGasMethodModel.js @@ -31,15 +31,34 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function EstimateGasMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_estimateGas', - 1, - [formatters.inputCallFormatter], - utils.hexToNumber - ); + AbstractMethodModel.call(this, 'eth_estimateGas', 1, utils, formatters); } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +EstimateGasMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputCallFormatter(parameters[0]); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ +EstimateGasMethodModel.prototype.afterExecution = function (response) { + return this.utils.hexToNumber(response); +}; + EstimateGasMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = EstimateGasMethodModel; diff --git a/packages/web3-core-method/src/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/methods/GetCodeMethodModel.js index 7520ad21add..f59e3c2d011 100644 --- a/packages/web3-core-method/src/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/methods/GetCodeMethodModel.js @@ -31,30 +31,20 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetCodeMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getCode', - 2, - [ - formatters.inputAddressFormatter, - formatters.inputDefaultBlockNumberFormatter - ], - null - ); + AbstractMethodModel.call(this, 'eth_getCode', 2, utils, formatters); } /** - * This method will be executed before the effective execution. + * This method will be executed before the RPC request. * * @method beforeExecution * * @param {Array} parameters - * @param {Object} parentObject + * @param {Object} web3Package - The package where the method is called from for example Eth. */ -GetCodeMethodModel.prototype.beforeExecution = function (parameters, parentObject) { - if (!parameters[1]) { - parameters[1] = parentObject.defaultBlock; - } +GetCodeMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); + parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(parameters[1], web3Package); }; GetCodeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js b/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js index d1ec9e6d2d4..afe3e2aa9ae 100644 --- a/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js +++ b/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js @@ -35,11 +35,40 @@ function GetPastLogsMethodModel(utils, formatters) { this, 'eth_getLogs', 1, - [formatters.inputLogFormatter], - formatters.outputLogFormatter, + utils, + formatters, ); } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +GetPastLogsMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputLogFormatter(parameters[0]); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Array} + */ +GetPastLogsMethodModel.prototype.afterExecution = function (response) { + var self = this; + + return response.map(function(responseItem) { + return self.formatters.outputLogFormatter(responseItem); + }); +}; + GetPastLogsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetPastLogsMethodModel; diff --git a/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js index e20a505e87a..49cc4bd391e 100644 --- a/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js @@ -35,27 +35,23 @@ function GetStorageAtMethodModel(utils, formatters) { this, 'eth_getStorageAt', 3, - [ - formatters.inputAddressFormatter, - utils.numberToHex, - formatters.inputDefaultBlockNumberFormatter - ], - null + utils, + formatters ); } /** - * This method will be executed before the effective execution. + * This method will be executed before the RPC request. * * @method beforeExecution * * @param {Array} parameters - * @param {Object} parentObject + * @param {Object} web3Package - The package where the method is called from for example Eth. */ -GetStorageAtMethodModel.prototype.beforeExecution = function (parameters, parentObject) { - if (!parameters[2]) { - parameters[2] = parentObject.defaultBlock; - } +GetStorageAtMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); + parameters[1] = this.utils.numberToHex(parameters[1]); + parameters[2] = this.formatters.inputDefaultBlockNumberFormatter(parameters[2], web3Package); }; GetStorageAtMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/SignMethodModel.js b/packages/web3-core-method/src/methods/SignMethodModel.js index e9e0f2b98a2..a00d7fd0663 100644 --- a/packages/web3-core-method/src/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/methods/SignMethodModel.js @@ -32,20 +32,23 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function SignMethodModel(utils, formatters, accounts) { - AbstractMethodModel.call( - this, - 'eth_sign', - 2, - [ - formatters.inputSignFormatter, - formatters.inputAddressFormatter - ], - null - ); - + AbstractMethodModel.call(this, 'eth_sign', 2, utils, formatters); this.accounts = accounts; } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +SignMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputSignFormatter(parameters[0]); + parameters[1] = this.formatters.inputAddressFormatter(parameters[1]); +}; + SignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = SignMethodModel; diff --git a/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js index 8730514f5a5..925b3e09c09 100644 --- a/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js @@ -31,15 +31,26 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetAccountsMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_accounts', - 0, - null, - utils.toChecksumAddress - ); + AbstractMethodModel.call(this, 'eth_accounts', 0, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Array} + */ +GetAccountsMethodModel.prototype.afterExecution = function (response) { + var self = this; + + return response.map(function(responseItem) { + return self.utils.toChecksumAddress(responseItem); + }); +}; + GetAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetAccountsMethodModel; diff --git a/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js index 9fabd091dc2..88c2593d78f 100644 --- a/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js @@ -31,16 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetTransactionCountMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getTransactionCount', - 2, - [ - formatters.inputAddressFormatter, - formatters.inputDefaultBlockNumberFormatter - ], - utils.hexToNumber - ); + AbstractMethodModel.call(this, 'eth_getTransactionCount', 2, utils, formatters); } /** @@ -49,12 +40,24 @@ function GetTransactionCountMethodModel(utils, formatters) { * @method beforeExecution * * @param {Array} parameters - * @param {Object} parentObject + * @param {Object} web3Package */ -GetTransactionCountMethodModel.prototype.beforeExecution = function (parameters, parentObject) { - if (!parameters[1]) { - parameters[1] = parentObject.defaultBlock; - } +GetTransactionCountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); + parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(parameters[1], web3Package); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ +GetTransactionCountMethodModel.prototype.afterExecution = function (response) { + return this.utils.hexToNumber(response); }; GetTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js index 0a735c55ed7..2b5bf706a24 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js @@ -31,24 +31,37 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetBlockMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getBlockByNumber', - 2, - [ - formatters.inputBlockNumberFormatter, - function (val) { - return !!val; - } - ], - formatters.outputBlockFormatter - ); + AbstractMethodModel.call(this, 'eth_getBlockByNumber', 2, utils, formatters); } -GetBlockMethodModel.prototype.beforeExecution = function (parameters) { +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +GetBlockMethodModel.prototype.beforeExecution = function (parameters, web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getBlockByHash'; } + + parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); + parameters[1] = !!parameters[1]; +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ +GetBlockMethodModel.prototype.afterExecution = function(response) { + return this.formatters.outputBlockFormatter(response); }; GetBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js index de9844b6ad3..d1cca18cdf0 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js @@ -31,15 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetBlockNumberMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_blockNumber', - 0, - null, - utils.hexToNumber - ); + AbstractMethodModel.call(this, 'eth_blockNumber', 0, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ +GetBlockNumberMethodModel.prototype.afterExecution = function (response) { + return this.utils.hexToNumber(response); +}; + GetBlockNumberMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetBlockNumberMethodModel; diff --git a/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js index f86ac92d060..155459baf5d 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js @@ -31,21 +31,36 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetBlockTransactionCountMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getTransactionByBlockNumberAndIndex', - 1, - [ - formatters.inputBlockNumberFormatter - ], - utils.hexToNumber, - ); + AbstractMethodModel.call(this, 'eth_getTransactionByBlockNumberAndIndex', 1, utils, formatters); } -GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (parameters) { +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {AbstractWeb3Object} web3Package + */ +GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } + + parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ +GetBlockTransactionCountMethodModel.prototype.afterExecution = function (response) { + return this.utils.hexToNumber(response); }; GetBlockTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js index de955c7c73c..946d774c933 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js @@ -31,21 +31,36 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetBlockUncleCountMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getUncleCountByBlockNumber', - 1, - [ - formatters.inputBlockNumberFormatter - ], - utils.hexToNumber - ); + AbstractMethodModel.call(this, 'eth_getUncleCountByBlockNumber', 1, utils, formatters); } -GetBlockUncleCountMethodModel.prototype.beforeExecution = function (parameters) { +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {AbstractWeb3Object} web3Package + */ +GetBlockUncleCountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getUncleCountByBlockHash'; } + + parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ +GetBlockUncleCountMethodModel.prototype.afterExecution = function (response) { + return this.utils.hexToNumber(response); }; GetBlockUncleCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js index 497e9fbd385..ea09f161c8a 100644 --- a/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js @@ -31,23 +31,37 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetUncleMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getUncleByBlockNumberAndIndex', - 2, - [ - formatters.inputBlockNumberFormatter, - utils.numberToHex - ], - formatters.outputBlockFormatter, - accounts - ); + AbstractMethodModel.call(this, 'eth_getUncleByBlockNumberAndIndex', 2, utils, formatters); } -GetUncleMethodModel.prototype.beforeExecution = function (parameters) { +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {AbstractWeb3Object} web3Package + */ +GetUncleMethodModel.prototype.beforeExecution = function (parameters, web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getUncleByBlockHashAndIndex'; } + + parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); + parameters[1] = this.utils.numberToHex(parameters[1]); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ +GetUncleMethodModel.prototype.afterExecution = function (response) { + return this.formatters.outputBlockFormatter(response); }; GetUncleMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js index edcdf31093e..c925af898d2 100644 --- a/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetProtocolVersionMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_protocolVersion', - 0, - null, - null - ); + AbstractMethodModel.call(this, 'eth_protocolVersion', 0, utils, formatters); } GetProtocolVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/methods/network/ListeningMethodModel.js index ec75bc79846..df658f643fc 100644 --- a/packages/web3-core-method/src/methods/network/ListeningMethodModel.js +++ b/packages/web3-core-method/src/methods/network/ListeningMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function ListeningMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'net_listening', - 0, - null, - null - ); + AbstractMethodModel.call(this, 'net_listening', 0, utils, formatters); } ListeningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js index 9cb8aee587b..cdc3ae2188e 100644 --- a/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file ListeningMethodModel.js + * @file PeerCountMethodModel.js * @author Samuel Furter * @date 2018 */ @@ -30,16 +30,23 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * * @constructor */ -function ListeningMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'net_peerCount', - 0, - null, - utils.hexToNumber - ); +function PeerCountMethodModel(utils, formatters) { + AbstractMethodModel.call(this, 'net_peerCount', 0, utils, formatters); } -ListeningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ +PeerCountMethodModel.prototype.afterExecution = function (response) { + return this.utils.hexToNumber(response); +}; + +PeerCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -module.exports = ListeningMethodModel; +module.exports = PeerCountMethodModel; diff --git a/packages/web3-core-method/src/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/methods/network/VersionMethodModel.js index ddd32e7cd57..fd7f8d09637 100644 --- a/packages/web3-core-method/src/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/methods/network/VersionMethodModel.js @@ -31,15 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function VersionMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_protocolVersion', - 0, - null, - utils.hexToNumber - ); + AbstractMethodModel.call(this, 'eth_protocolVersion', 0, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ +VersionMethodModel.prototype.afterExecution = function (response) { + return this.utils.hexToNumber(response); +}; + VersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = VersionMethodModel; diff --git a/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js index 9b88db98599..3d6d6d66bfd 100644 --- a/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetCoinbaseMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_coinbase', - 0, - null, - null - ); + AbstractMethodModel.call(this, 'eth_coinbase', 0, utils, formatters); } GetCoinbaseMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js index 5baac705353..b130fe5041e 100644 --- a/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js @@ -31,15 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetGasPriceMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_gasPrice', - 0, - null, - formatters.outputBigNumberFormatter - ); + AbstractMethodModel.call(this, 'eth_gasPrice', 0, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {BigNumber} + */ +GetGasPriceMethodModel.prototype.afterExecution = function (response) { + return this.formatters.outputBigNumberFormatter(response); +}; + GetGasPriceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetGasPriceMethodModel; diff --git a/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js index b2f3534979e..74776497738 100644 --- a/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js @@ -31,15 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetHashrateMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_hashrate', - 0, - null, - utils.hexToNumber - ); + AbstractMethodModel.call(this, 'eth_hashrate', 0, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ +GetHashrateMethodModel.prototype.afterExecution = function (response) { + return this.utils.hexToNumber(response); +}; + GetHashrateMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetHashrateMethodModel; diff --git a/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js index 0b093b29315..f31d4ec9952 100644 --- a/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetNodeInfoMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'web3_clientVersion', - 0, - null, - null - ); + AbstractMethodModel.call(this, 'web3_clientVersion', 0, utils, formatters); } GetNodeInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js index 470eed12c1b..ec00fc8e643 100644 --- a/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetWorkMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getWork', - 0, - null, - null - ); + AbstractMethodModel.call(this, 'eth_getWork', 0, utils, formatters); } GetWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js index 610cfb8421f..b1b8019d737 100644 --- a/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function IsMiningMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_mining', - 0, - null, - null - ); + AbstractMethodModel.call(this, 'eth_mining', 0, utils, formatters); } IsMiningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js index fde0316aa86..8a55eb0f41b 100644 --- a/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js @@ -31,15 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function IsSyncingMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_syncing', - 0, - null, - formatters.outputSyncingFormatter - ); + AbstractMethodModel.call(this, 'eth_syncing', 0, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ +IsSyncingMethodModel.prototype.afterExecution = function (response) { + return this.formatters.outputSyncingFormatter(response); +}; + IsSyncingMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = IsSyncingMethodModel; diff --git a/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js index 455f8902b79..9d73f3cae0d 100644 --- a/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function SubmitWorkMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_submitWork', - 3, - null, - null, - ); + AbstractMethodModel.call(this, 'eth_submitWork', 3, utils, formatters); } SubmitWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js index 193367eab92..c436073d8ec 100644 --- a/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js @@ -31,19 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function EcRecoverMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'personal_ecRecover', - 3, - [ - formatters.inputSignFormatter, - formatters.inputAddressFormatter, - null - ], - null - ); + AbstractMethodModel.call(this, 'personal_ecRecover', 3, utils, formatters); } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +EcRecoverMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputSignFormatter(parameters[0]); + parameters[1] = this.formatters.inputAddressFormatter(parameters[1]); +}; + EcRecoverMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = EcRecoverMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js index d86f9ee5bd8..b4ed724a8c2 100644 --- a/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function ImportRawKeyMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'personal_importRawKey', - 2, - null, - null - ); + AbstractMethodModel.call(this, 'personal_importRawKey', 2, utils, formatters); } ImportRawKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js index d5b2a942ef0..6b266f1a8f3 100644 --- a/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js @@ -31,15 +31,26 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function ListAccountsMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'personal_listAccounts', - 0, - null, - utils.toChecksumAddress - ); + AbstractMethodModel.call(this, 'personal_listAccounts', 0, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Array} + */ +ListAccountsMethodModel.prototype.afterExecution = function (response) { + var self = this; + + return response.map(function(responseItem) { + return self.utils.toChecksumAddress(responseItem); + }); +}; + ListAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = ListAccountsMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js index 45e90c389ed..c15660b8d30 100644 --- a/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js @@ -31,15 +31,21 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function LockAccountMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'personal_lockAccount', - 1, - [formatters.inputAddressFormatter], - null - ); + AbstractMethodModel.call(this, 'personal_lockAccount', 1, utils, formatters); } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +LockAccountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); +}; + LockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = LockAccountMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js index 43957270b34..a084bdca12b 100644 --- a/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js @@ -31,15 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function NewAccountMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'personal_newAccount', - 0, - null, - utils.toChecksumAddress - ); + AbstractMethodModel.call(this, 'personal_newAccount', 0, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {String} + */ +NewAccountMethodModel.prototype.afterExecution = function (response) { + return this.utils.toChecksumAddress(response); +}; + NewAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = NewAccountMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js index c81a0ff5afa..3b6747ff98d 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js @@ -31,18 +31,21 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function PersonalSendTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'personal_sendTransaction', - 2, - [ - formatters.inputTransactionFormatter, - null - ], - null - ); + AbstractMethodModel.call(this, 'personal_sendTransaction', 2, utils, formatters); } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +PersonalSendTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputTransactionFormatter(parameters[0]); +}; + PersonalSendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = PersonalSendTransactionMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js index 954d1d4ed12..ca2aa22a3f3 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js @@ -31,19 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function PersonalSignMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'personal_sign', - 3, - [ - formatters.inputSignFormatter, - formatters.inputAddressFormatter, - null - ], - null - ); + AbstractMethodModel.call(this, 'personal_sign', 3, utils, formatters); } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +PersonalSignMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputSignFormatter(parameters[0]); + parameters[1] = this.formatters.inputAddressFormatter(parameters[1]); +}; + PersonalSignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = PersonalSignMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js index d896c2881a0..989c5a764b4 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js @@ -31,18 +31,21 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function PersonalSignTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'personal_signTransaction', - 2, - [ - formatters.inputTransactionFormatter, - null - ], - null - ); + AbstractMethodModel.call(this, 'personal_signTransaction', 2, utils, formatters); } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +PersonalSignTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputTransactionFormatter(parameters[0]); +}; + PersonalSignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = PersonalSignTransactionMethodModel; diff --git a/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js index d5da9046ab7..7d2bb83eb4f 100644 --- a/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js @@ -31,19 +31,21 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function UnlockAccountMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'personal_unlockAccount', - 3, - [ - formatters.inputAddressFormatter, - null, - null - ], - null - ); + AbstractMethodModel.call(this, 'personal_unlockAccount', 3, utils, formatters); } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +UnlockAccountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); +}; + UnlockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = UnlockAccountMethodModel; diff --git a/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js index 80724689b11..9322cef6a2c 100644 --- a/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function AddPrivateKeyMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_addPrivateKey', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_addPrivateKey', 1, utils, formatters); } AddPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js index a48e51d8b9b..6491e93143e 100644 --- a/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function AddSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_addSymKey', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_addSymKey', 1, utils, formatters); } AddSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js index 4de52a7ae6c..765837a610d 100644 --- a/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function DeleteKeyPairMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_deleteKeyPair', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_deleteKeyPair', 1, utils, formatters); } DeleteKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js index 751308bf4dc..c13f007b5d5 100644 --- a/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function DeleteMessageFilterMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_deleteMessageFilter', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_deleteMessageFilter', 1, utils, formatters); } DeleteMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js index 75e7b465b38..bc3ef9b95ed 100644 --- a/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function DeleteSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_deleteSymKey', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_deleteSymKey', 1, utils, formatters); } DeleteSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js index d6a579b474f..2508ab2bced 100644 --- a/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GenerateSymKeyFromPasswordMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_generateSymKeyFromPassword', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_generateSymKeyFromPassword', 1, utils, formatters); } GenerateSymKeyFromPasswordMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js index 1ecc5f92dbb..81a81f12017 100644 --- a/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetFilterMessagesMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_getFilterMessages', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_getFilterMessages', 1, utils, formatters); } GetFilterMessagesMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js index 37fb1fda6a3..767eb3f9790 100644 --- a/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetInfoMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_info', - 0, - null, - null - ); + AbstractMethodModel.call(this, 'shh_info', 0, utils, formatters); } GetInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js index 8f69b10739e..43877d0e23c 100644 --- a/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetPrivateKeyMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_getPrivateKey', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_getPrivateKey', 1, utils, formatters); } GetPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js index 9bd9a1ee63c..0d6ddf48265 100644 --- a/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetPublicKeyMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_getPublicKey', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_getPublicKey', 1, utils, formatters); } GetPublicKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js index 578951b265a..81173184047 100644 --- a/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_getSymKey', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_getSymKey', 1, utils, formatters); } GetSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js index fda3fb32796..f4eeb9a9b79 100644 --- a/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function HasKeyPairMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_hasKeyPair', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_hasKeyPair', 1, utils, formatters); } HasKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js index 9c6fec09256..cb0db6cc109 100644 --- a/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function HasSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_hasSymKey', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_hasSymKey', 1, utils, formatters); } HasSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js index f051009742c..b26fc24794c 100644 --- a/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function MarkTrustedPeerMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_markTrustedPeer', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_markTrustedPeer', 1, utils, formatters); } MarkTrustedPeerMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js index b36fd9dc107..47a5bf66ef8 100644 --- a/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function NewKeyPairMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_newKeyPair', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_newKeyPair', 1, utils, formatters); } NewKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js index c05e4bbfd1b..0da599e7d15 100644 --- a/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function NewMessageFilterMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_newMessageFilter', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_newMessageFilter', 1, utils, formatters); } NewMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js index e25c445875d..754be14be97 100644 --- a/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function NewSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_newSymKey', - 0, - null, - null - ); + AbstractMethodModel.call(this, 'shh_newSymKey', 0, utils, formatters); } NewSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/methods/shh/PostMethodModel.js index 561be8f6f8c..90c5d894f39 100644 --- a/packages/web3-core-method/src/methods/shh/PostMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/PostMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function PostMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_post', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_post', 1, utils, formatters); } PostMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js index 0bdf4a3cb0b..80f74cf0d7c 100644 --- a/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function SetMaxMessageSizeMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_setMaxMessageSize', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_setMaxMessageSize', 1, utils, formatters); } SetMaxMessageSizeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js index 446f3c9633a..6426ccf9212 100644 --- a/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function SetMinPoWMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_setMinPoW', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'shh_setMinPoW', 1, utils, formatters); } SetMinPoWMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js index 6d4438cb0d4..5579022113a 100644 --- a/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js +++ b/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function ShhVersionMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'shh_version', - 0, - null, - null - ); + AbstractMethodModel.call(this, 'shh_version', 0, utils, formatters); } ShhVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js index 11c54d286cd..fad6dfda8f5 100644 --- a/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -31,22 +31,37 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetTransactionFromBlockMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getTransactionByBlockNumberAndIndex', - 2, - [ - formatters.inputBlockNumberFormatter, - utils.numberToHex - ], - formatters.outputTransactionFormatter - ); + AbstractMethodModel.call(this, 'eth_getTransactionByBlockNumberAndIndex', 2, utils, formatters); } -GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (parameters) { +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (parameters, web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } + + parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); + parameters[1] = this.utils.numberToHex(parameters[1]); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ +GetTransactionFromBlockMethodModel.prototype.afterExecution = function (response) { + return this.formatters.outputTransactionFormatter(response); }; GetTransactionFromBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js index e99ebf7a11e..5bb48d1353a 100644 --- a/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js @@ -31,15 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getTransactionByHash', - 1, - null, - formatters.outputTransactionFormatter - ); + AbstractMethodModel.call(this, 'eth_getTransactionByHash', 1, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ +GetTransactionMethodModel.prototype.afterExecution = function (response) { + return this.formatters.outputTransactionFormatter(response); +}; + GetTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetTransactionMethodModel; diff --git a/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js index 7ea6b32789e..c6fd2d014bd 100644 --- a/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js @@ -31,15 +31,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function GetTransactionReceiptMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getTransactionReceipt', - 1, - null, - formatters.outputTransactionReceiptFormatter - ); + AbstractMethodModel.call(this, 'eth_getTransactionReceipt', 1, utils, formatters); } +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ +GetTransactionReceiptMethodModel.prototype.afterExecution = function (response) { + return this.formatters.outputTransactionFormatter(response); +}; + GetTransactionReceiptMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = GetTransactionReceiptMethodModel; diff --git a/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js index 223c772dc07..cf4077d4ca5 100644 --- a/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function SendSignedTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_sendRawTransaction', - 1, - null, - null - ); + AbstractMethodModel.call(this, 'eth_sendRawTransaction', 1, utils, formatters); } SendSignedTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js index d54a04111e6..66b41ae355d 100644 --- a/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js @@ -32,17 +32,22 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function SendTransactionMethodModel(utils, formatters, accounts) { - AbstractMethodModel.call( - this, - 'eth_sendTransaction', - 1, - [formatters.inputTransactionFormatter], - null - ); - + AbstractMethodModel.call(this, 'eth_sendTransaction', 1, utils, formatters); this.accounts = accounts; } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +SendTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputTransactionFormatter(parameters[0]); +}; + SendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = SendTransactionMethodModel; diff --git a/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js index 39f0ed509fb..f0392b3fb72 100644 --- a/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js @@ -31,15 +31,21 @@ var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); * @constructor */ function SignTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_signTransaction', - 1, - [formatters.inputTransactionFormatter], - null - ); + AbstractMethodModel.call(this, 'eth_signTransaction', 1, utils, formatters); } +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Array} parameters + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +SignTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + parameters[0] = this.formatters.inputTransactionFormatter(parameters[0]); +}; + SignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); module.exports = SignTransactionMethodModel; From 24454ee02943309d15fc4c8fe186c6b49ea10214 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 17:04:54 +0200 Subject: [PATCH 0115/1045] formatters and related MethodModels updated for new default- & defaultBlock handling --- packages/web3-core-helpers/src/formatters.js | 25 ++++++++++++------- .../src/methods/CallMethodModel.js | 2 +- .../src/methods/EstimateGasMethodModel.js | 2 +- .../PersonalSendTransactionMethodModel.js | 2 +- .../PersonalSignTransactionMethodModel.js | 2 +- .../transaction/SendTransactionMethodModel.js | 2 +- .../transaction/SignTransactionMethodModel.js | 2 +- 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index 7f992be446b..08ec3199aa2 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -117,20 +117,24 @@ var _txInputFormatter = function (options){ * Formats the input of a transaction and converts all values to HEX * * @method inputCallFormatter - * @param {Object} transaction options + * + * @param {Object} options + * @param {AbstractWeb3Object} web3Package + * * @returns object */ -var inputCallFormatter = function (options){ - +var inputCallFormatter = function (options, web3Package){ options = _txInputFormatter(options); + var from = web3Package.defaultAccount; - var from = options.from || (this ? this.defaultAccount : null); + if (options.from) { + from = options.from + } if (from) { options.from = inputAddressFormatter(from); } - return options; }; @@ -138,16 +142,19 @@ var inputCallFormatter = function (options){ * Formats the input of a transaction and converts all values to HEX * * @method inputTransactionFormatter + * * @param {Object} options + * @param {AbstractWeb3Object} web3Package + * * @returns object */ -var inputTransactionFormatter = function (options) { - +var inputTransactionFormatter = function (options, web3Package) { options = _txInputFormatter(options); - // check from, only if not number, or object if (!_.isNumber(options.from) && !_.isObject(options.from)) { - options.from = options.from || (this ? this.defaultAccount : null); + if (!options.from) { + options.from = web3Package.defaultAccount; + } if (!options.from && !_.isNumber(options.from)) { throw new Error('The send transactions "from" field must be defined!'); diff --git a/packages/web3-core-method/src/methods/CallMethodModel.js b/packages/web3-core-method/src/methods/CallMethodModel.js index cec426a1bc4..04a0df26868 100644 --- a/packages/web3-core-method/src/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/methods/CallMethodModel.js @@ -43,7 +43,7 @@ function CallMethodModel(utils, formatters) { * @param {Object} web3Package - The package where the method is called from for example Eth. */ CallMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputCallFormatter(parameters[0]); + parameters[0] = this.formatters.inputCallFormatter(parameters[0], web3Package); parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(parameters[1], web3Package); }; diff --git a/packages/web3-core-method/src/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/methods/EstimateGasMethodModel.js index ecc11fcfcd7..e78c1261a00 100644 --- a/packages/web3-core-method/src/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/methods/EstimateGasMethodModel.js @@ -43,7 +43,7 @@ function EstimateGasMethodModel(utils, formatters) { * @param {Object} web3Package - The package where the method is called from for example Eth. */ EstimateGasMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputCallFormatter(parameters[0]); + parameters[0] = this.formatters.inputCallFormatter(parameters[0], web3Package); }; /** diff --git a/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js index 3b6747ff98d..ca340672135 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js @@ -43,7 +43,7 @@ function PersonalSendTransactionMethodModel(utils, formatters) { * @param {Object} web3Package - The package where the method is called from for example Eth. */ PersonalSendTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputTransactionFormatter(parameters[0]); + parameters[0] = this.formatters.inputTransactionFormatter(parameters[0], web3Package); }; PersonalSendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js index 989c5a764b4..b7ded44bcfc 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js @@ -43,7 +43,7 @@ function PersonalSignTransactionMethodModel(utils, formatters) { * @param {Object} web3Package - The package where the method is called from for example Eth. */ PersonalSignTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputTransactionFormatter(parameters[0]); + parameters[0] = this.formatters.inputTransactionFormatter(parameters[0], web3Package); }; PersonalSignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js index 66b41ae355d..1348c1db599 100644 --- a/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js @@ -45,7 +45,7 @@ function SendTransactionMethodModel(utils, formatters, accounts) { * @param {Object} web3Package - The package where the method is called from for example Eth. */ SendTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputTransactionFormatter(parameters[0]); + parameters[0] = this.formatters.inputTransactionFormatter(parameters[0], web3Package); }; SendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js index f0392b3fb72..62340c1e0f7 100644 --- a/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js @@ -43,7 +43,7 @@ function SignTransactionMethodModel(utils, formatters) { * @param {Object} web3Package - The package where the method is called from for example Eth. */ SignTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputTransactionFormatter(parameters[0]); + parameters[0] = this.formatters.inputTransactionFormatter(parameters[0], web3Package); }; SignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); From 9bdc1422a61585c57bfb16e32d76bcaf397b169d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 17:11:00 +0200 Subject: [PATCH 0116/1045] validators and mappers of the providers package moved to src folder --- .../lib/adapters/AbstractProviderAdapter.js | 4 ++-- packages/web3-core-providers/src/index.js | 4 ++-- .../web3-core-providers/{lib => src}/mappers/JSONRpcMapper.js | 0 .../{lib => src}/validators/JSONRpcResponseValidator.js | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename packages/web3-core-providers/{lib => src}/mappers/JSONRpcMapper.js (100%) rename packages/web3-core-providers/{lib => src}/validators/JSONRpcResponseValidator.js (100%) diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js index d94bc70bb92..f3220e76398 100644 --- a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js @@ -22,8 +22,8 @@ "use strict"; -var JSONRpcMapper = require('../mappers/JSONRpcMapper.js'); -var JSONRpcResponseValidator = require('../validators/JSONRpcResponseValidator.js'); +var JSONRpcMapper = require('../../src/mappers/JSONRpcMapper.js'); +var JSONRpcResponseValidator = require('../../src/validators/JSONRpcResponseValidator.js'); var errors = require('web3-core-helpers').errors; /** diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index ae5f7031e72..4b4acb01d41 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -25,8 +25,8 @@ var ProvidersPackageFactory = require('./factories/ProvidersPackageFactory'); var HttpProvider = require('./providers/HttpProvider'); var IpcProvider = require('./providers/IpcProvider'); var WebsocketProvider = require('./providers/WebsocketProvider'); -var JSONRpcMapper = require('../lib/mappers/JSONRpcMapper'); -var JSONRpcResponseValidator = require('../lib/validators/JSONRpcResponseValidator'); +var JSONRpcMapper = require('./mappers/JSONRpcMapper'); +var JSONRpcResponseValidator = require('./validators/JSONRpcResponseValidator'); module.exports = { version: version, diff --git a/packages/web3-core-providers/lib/mappers/JSONRpcMapper.js b/packages/web3-core-providers/src/mappers/JSONRpcMapper.js similarity index 100% rename from packages/web3-core-providers/lib/mappers/JSONRpcMapper.js rename to packages/web3-core-providers/src/mappers/JSONRpcMapper.js diff --git a/packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js b/packages/web3-core-providers/src/validators/JSONRpcResponseValidator.js similarity index 100% rename from packages/web3-core-providers/lib/validators/JSONRpcResponseValidator.js rename to packages/web3-core-providers/src/validators/JSONRpcResponseValidator.js From 31d8c940f84bcb5cfe5bda16673fe1af4c5f14e5 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 17:18:15 +0200 Subject: [PATCH 0117/1045] MethodModels moved to correct folder in web3-core-method --- .../src/{ => models}/methods/CallMethodModel.js | 2 +- .../src/{ => models}/methods/EstimateGasMethodModel.js | 2 +- .../src/{ => models}/methods/GetCodeMethodModel.js | 2 +- .../src/{ => models}/methods/GetPastLogslMethodModel.js | 2 +- .../src/{ => models}/methods/GetStorageAtMethodModel.js | 2 +- .../src/{ => models}/methods/SignMethodModel.js | 2 +- .../src/{ => models}/methods/account/GetAccountsMethodModel.js | 2 +- .../src/{ => models}/methods/account/GetBalanceMethodModel.js | 2 +- .../methods/account/GetTransactionCountMethodModel.js | 2 +- .../src/{ => models}/methods/block/GetBlockMethodModel.js | 2 +- .../src/{ => models}/methods/block/GetBlockNumberMethodModel.js | 2 +- .../methods/block/GetBlockTransactionCountMethodModel.js | 2 +- .../{ => models}/methods/block/GetBlockUncleCountMethodModel.js | 2 +- .../src/{ => models}/methods/block/GetUncleMethodModel.js | 2 +- .../methods/network/GetProtocolVersionMethodModel.js | 2 +- .../src/{ => models}/methods/network/ListeningMethodModel.js | 2 +- .../src/{ => models}/methods/network/PeerCountMethodModel.js | 2 +- .../src/{ => models}/methods/network/VersionMethodModel.js | 2 +- .../src/{ => models}/methods/node/GetCoinbaseMethodModel.js | 2 +- .../src/{ => models}/methods/node/GetGasPriceMethodModel.js | 2 +- .../src/{ => models}/methods/node/GetHashrateMethodModel.js | 2 +- .../src/{ => models}/methods/node/GetNodeInfoMethodModel.js | 2 +- .../src/{ => models}/methods/node/GetWorkMethodModel.js | 2 +- .../src/{ => models}/methods/node/IsMiningMethodModel.js | 2 +- .../src/{ => models}/methods/node/IsSyncingMethodModel.js | 2 +- .../src/{ => models}/methods/node/SubmitWorkMethodModel.js | 2 +- .../src/{ => models}/methods/personal/EcRecoverMethodModel.js | 2 +- .../{ => models}/methods/personal/ImportRawKeyMethodModel.js | 2 +- .../{ => models}/methods/personal/ListAccountsMethodModel.js | 2 +- .../src/{ => models}/methods/personal/LockAccountMethodModel.js | 2 +- .../src/{ => models}/methods/personal/NewAccountMethodModel.js | 2 +- .../methods/personal/PersonalSendTransactionMethodModel.js | 2 +- .../{ => models}/methods/personal/PersonalSignMethodModel.js | 2 +- .../methods/personal/PersonalSignTransactionMethodModel.js | 2 +- .../{ => models}/methods/personal/UnlockAccountMethodModel.js | 2 +- .../src/{ => models}/methods/shh/AddPrivateKeyMethodModel.js | 2 +- .../src/{ => models}/methods/shh/AddSymKeyMethodModel.js | 2 +- .../src/{ => models}/methods/shh/DeleteKeyPairMethodModel.js | 2 +- .../{ => models}/methods/shh/DeleteMessageFilterMethodModel.js | 2 +- .../src/{ => models}/methods/shh/DeleteSymKeyMethodModel.js | 2 +- .../methods/shh/GenerateSymKeyFromPasswordMethodModel.js | 2 +- .../{ => models}/methods/shh/GetFilterMessagesMethodModel.js | 2 +- .../src/{ => models}/methods/shh/GetInfoMethodModel.js | 2 +- .../src/{ => models}/methods/shh/GetPrivateKeyMethodModel.js | 2 +- .../src/{ => models}/methods/shh/GetPublicKeyMethodModel.js | 2 +- .../src/{ => models}/methods/shh/GetSymKeyMethodModel.js | 2 +- .../src/{ => models}/methods/shh/HasKeyPairMethodModel.js | 2 +- .../src/{ => models}/methods/shh/HasSymKeyMethodModel.js | 2 +- .../src/{ => models}/methods/shh/MarkTrustedPeerMethodModel.js | 2 +- .../src/{ => models}/methods/shh/NewKeyPairMethodModel.js | 2 +- .../src/{ => models}/methods/shh/NewMessageFilterMethodModel.js | 2 +- .../src/{ => models}/methods/shh/NewSymKeyMethodModel.js | 2 +- .../src/{ => models}/methods/shh/PostMethodModel.js | 2 +- .../{ => models}/methods/shh/SetMaxMessageSizeMethodModel.js | 2 +- .../src/{ => models}/methods/shh/SetMinPoWMethodModel.js | 2 +- .../src/{ => models}/methods/shh/ShhVersionMethodModel.js | 2 +- .../methods/transaction/GetTransactionFromBlockMethodModel.js | 2 +- .../methods/transaction/GetTransactionMethodModel.js | 2 +- .../methods/transaction/GetTransactionReceiptMethodModel.js | 2 +- .../methods/transaction/SendSignedTransactionMethodModel.js | 2 +- .../methods/transaction/SendTransactionMethodModel.js | 2 +- .../methods/transaction/SignTransactionMethodModel.js | 2 +- 62 files changed, 62 insertions(+), 62 deletions(-) rename packages/web3-core-method/src/{ => models}/methods/CallMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/EstimateGasMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/GetCodeMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/GetPastLogslMethodModel.js (96%) rename packages/web3-core-method/src/{ => models}/methods/GetStorageAtMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/SignMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/account/GetAccountsMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/account/GetBalanceMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/account/GetTransactionCountMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/block/GetBlockMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/block/GetBlockNumberMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/block/GetBlockTransactionCountMethodModel.js (96%) rename packages/web3-core-method/src/{ => models}/methods/block/GetBlockUncleCountMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/block/GetUncleMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/network/GetProtocolVersionMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/network/ListeningMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/network/PeerCountMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/network/VersionMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/node/GetCoinbaseMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/node/GetGasPriceMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/node/GetHashrateMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/node/GetNodeInfoMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/node/GetWorkMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/node/IsMiningMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/node/IsSyncingMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/node/SubmitWorkMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/personal/EcRecoverMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/personal/ImportRawKeyMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/personal/ListAccountsMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/personal/LockAccountMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/personal/NewAccountMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/personal/PersonalSendTransactionMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/personal/PersonalSignMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/personal/PersonalSignTransactionMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/personal/UnlockAccountMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/shh/AddPrivateKeyMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/AddSymKeyMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/DeleteKeyPairMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/DeleteMessageFilterMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/DeleteSymKeyMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/GenerateSymKeyFromPasswordMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/GetFilterMessagesMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/GetInfoMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/GetPrivateKeyMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/GetPublicKeyMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/GetSymKeyMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/HasKeyPairMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/HasSymKeyMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/MarkTrustedPeerMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/NewKeyPairMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/NewMessageFilterMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/NewSymKeyMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/PostMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/SetMaxMessageSizeMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/SetMinPoWMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/shh/ShhVersionMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/transaction/GetTransactionFromBlockMethodModel.js (96%) rename packages/web3-core-method/src/{ => models}/methods/transaction/GetTransactionMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/transaction/GetTransactionReceiptMethodModel.js (94%) rename packages/web3-core-method/src/{ => models}/methods/transaction/SendSignedTransactionMethodModel.js (93%) rename packages/web3-core-method/src/{ => models}/methods/transaction/SendTransactionMethodModel.js (95%) rename packages/web3-core-method/src/{ => models}/methods/transaction/SignTransactionMethodModel.js (95%) diff --git a/packages/web3-core-method/src/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/CallMethodModel.js rename to packages/web3-core-method/src/models/methods/CallMethodModel.js index 04a0df26868..c80a837a829 100644 --- a/packages/web3-core-method/src/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/EstimateGasMethodModel.js rename to packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index e78c1261a00..18e3ddb85fb 100644 --- a/packages/web3-core-method/src/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/GetCodeMethodModel.js rename to packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index f59e3c2d011..34e6a63b819 100644 --- a/packages/web3-core-method/src/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js similarity index 96% rename from packages/web3-core-method/src/methods/GetPastLogslMethodModel.js rename to packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js index afe3e2aa9ae..7a85857f7c7 100644 --- a/packages/web3-core-method/src/methods/GetPastLogslMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/GetStorageAtMethodModel.js rename to packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index 49cc4bd391e..d77bd4c38bb 100644 --- a/packages/web3-core-method/src/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/SignMethodModel.js rename to packages/web3-core-method/src/models/methods/SignMethodModel.js index a00d7fd0663..2c95ae497f1 100644 --- a/packages/web3-core-method/src/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js rename to packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js index 925b3e09c09..7378a0eae81 100644 --- a/packages/web3-core-method/src/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js rename to packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index ed7e1bbdbdf..5dfc57104e7 100644 --- a/packages/web3-core-method/src/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js rename to packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index 88c2593d78f..ea72ea18a63 100644 --- a/packages/web3-core-method/src/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/block/GetBlockMethodModel.js rename to packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index 2b5bf706a24..5d1465b498a 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js rename to packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js index d1cca18cdf0..0ef3064bb0f 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js similarity index 96% rename from packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js rename to packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index 155459baf5d..4a9702324c8 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js rename to packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index 946d774c933..3c3b1950cf9 100644 --- a/packages/web3-core-method/src/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/block/GetUncleMethodModel.js rename to packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index ea09f161c8a..58adfe8b26e 100644 --- a/packages/web3-core-method/src/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js rename to packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js index c925af898d2..9f7df35a2bf 100644 --- a/packages/web3-core-method/src/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/network/ListeningMethodModel.js rename to packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js index df658f643fc..b45a923b8b9 100644 --- a/packages/web3-core-method/src/methods/network/ListeningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/network/PeerCountMethodModel.js rename to packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js index cdc3ae2188e..58a9e5fda26 100644 --- a/packages/web3-core-method/src/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/network/VersionMethodModel.js rename to packages/web3-core-method/src/models/methods/network/VersionMethodModel.js index fd7f8d09637..a2b5f9003b9 100644 --- a/packages/web3-core-method/src/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js rename to packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js index 3d6d6d66bfd..812e3de87f6 100644 --- a/packages/web3-core-method/src/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js rename to packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js index b130fe5041e..29c6f129c6f 100644 --- a/packages/web3-core-method/src/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js rename to packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js index 74776497738..6afbb9f6cb4 100644 --- a/packages/web3-core-method/src/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js rename to packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js index f31d4ec9952..7b4292e6348 100644 --- a/packages/web3-core-method/src/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/node/GetWorkMethodModel.js rename to packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js index ec00fc8e643..166f8d35d9b 100644 --- a/packages/web3-core-method/src/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/node/IsMiningMethodModel.js rename to packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js index b1b8019d737..0e71202c31f 100644 --- a/packages/web3-core-method/src/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js rename to packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js index 8a55eb0f41b..770d93b6581 100644 --- a/packages/web3-core-method/src/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js rename to packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js index 9d73f3cae0d..5fa1ee15b71 100644 --- a/packages/web3-core-method/src/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js rename to packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index c436073d8ec..7241653b0cb 100644 --- a/packages/web3-core-method/src/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js rename to packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js index b4ed724a8c2..775519fee2d 100644 --- a/packages/web3-core-method/src/methods/personal/ImportRawKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js rename to packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js index 6b266f1a8f3..cf0e9beb6f8 100644 --- a/packages/web3-core-method/src/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js rename to packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index c15660b8d30..51505ae2093 100644 --- a/packages/web3-core-method/src/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js rename to packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js index a084bdca12b..5a4cdc0bfd3 100644 --- a/packages/web3-core-method/src/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js rename to packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index ca340672135..41a3db7b791 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js rename to packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index ca2aa22a3f3..f517f23c49a 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js rename to packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js index b7ded44bcfc..c1da06d1d5f 100644 --- a/packages/web3-core-method/src/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js rename to packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index 7d2bb83eb4f..6e48ab74265 100644 --- a/packages/web3-core-method/src/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js index 9322cef6a2c..5aeae17e5d5 100644 --- a/packages/web3-core-method/src/methods/shh/AddPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js index 6491e93143e..b7fc0d4f02a 100644 --- a/packages/web3-core-method/src/methods/shh/AddSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js index 765837a610d..5d4400a8198 100644 --- a/packages/web3-core-method/src/methods/shh/DeleteKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js index c13f007b5d5..73975dd7df4 100644 --- a/packages/web3-core-method/src/methods/shh/DeleteMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js index bc3ef9b95ed..591a193ee08 100644 --- a/packages/web3-core-method/src/methods/shh/DeleteSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js index 2508ab2bced..a59491c18ac 100644 --- a/packages/web3-core-method/src/methods/shh/GenerateSymKeyFromPasswordMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js index 81a81f12017..d1aa2abb9ab 100644 --- a/packages/web3-core-method/src/methods/shh/GetFilterMessagesMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js index 767eb3f9790..c2f9a9c299c 100644 --- a/packages/web3-core-method/src/methods/shh/GetInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js index 43877d0e23c..5e25c6084cd 100644 --- a/packages/web3-core-method/src/methods/shh/GetPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js index 0d6ddf48265..811700f798c 100644 --- a/packages/web3-core-method/src/methods/shh/GetPublicKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js index 81173184047..0cecd136cc9 100644 --- a/packages/web3-core-method/src/methods/shh/GetSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js index f4eeb9a9b79..9c3d7f7e946 100644 --- a/packages/web3-core-method/src/methods/shh/HasKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js index cb0db6cc109..a5f65d0e13f 100644 --- a/packages/web3-core-method/src/methods/shh/HasSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js index b26fc24794c..e2190ab4e28 100644 --- a/packages/web3-core-method/src/methods/shh/MarkTrustedPeerMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js index 47a5bf66ef8..baecd4d9997 100644 --- a/packages/web3-core-method/src/methods/shh/NewKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js index 0da599e7d15..71d35f65268 100644 --- a/packages/web3-core-method/src/methods/shh/NewMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js index 754be14be97..fe0b7409be8 100644 --- a/packages/web3-core-method/src/methods/shh/NewSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/PostMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/PostMethodModel.js index 90c5d894f39..382db4d619f 100644 --- a/packages/web3-core-method/src/methods/shh/PostMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js index 80f74cf0d7c..022d2b6f5ba 100644 --- a/packages/web3-core-method/src/methods/shh/SetMaxMessageSizeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js index 6426ccf9212..99a5da827a1 100644 --- a/packages/web3-core-method/src/methods/shh/SetMinPoWMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js rename to packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js index 5579022113a..aef53d5d188 100644 --- a/packages/web3-core-method/src/methods/shh/ShhVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js similarity index 96% rename from packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js rename to packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index fad6dfda8f5..7f72544d8e7 100644 --- a/packages/web3-core-method/src/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js rename to packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js index 5bb48d1353a..f0388265c20 100644 --- a/packages/web3-core-method/src/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js similarity index 94% rename from packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js rename to packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js index c6fd2d014bd..1c8260e6cd6 100644 --- a/packages/web3-core-method/src/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js similarity index 93% rename from packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js rename to packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js index cf4077d4ca5..c52a3f491bf 100644 --- a/packages/web3-core-method/src/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js rename to packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index 1348c1db599..8166b6f2e04 100644 --- a/packages/web3-core-method/src/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils diff --git a/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js similarity index 95% rename from packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js rename to packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index 62340c1e0f7..ef140ccd3c4 100644 --- a/packages/web3-core-method/src/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** * @param {Utils} utils From d565bdbb0e677daf3748f2145c6118fbb28f1fbb Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 19 Sep 2018 17:48:07 +0200 Subject: [PATCH 0118/1045] POC MethodController: This is required because of the single responsibility principle --- .../lib/commands/AbstractCommand.js | 0 .../lib/commands/AbstractSendCommand.js | 0 .../src/commands/CallMethodCommand.js | 27 +++++ .../src/commands/SendMethodCommand.js | 27 +++++ .../src/commands/SignAndSendMethodCommand.js | 5 + .../src/commands/SignMessageCommand.js | 4 + .../src/controllers/MethodController.js | 104 ++++++++++++++++++ 7 files changed, 167 insertions(+) create mode 100644 packages/web3-core-method/lib/commands/AbstractCommand.js create mode 100644 packages/web3-core-method/lib/commands/AbstractSendCommand.js create mode 100644 packages/web3-core-method/src/commands/CallMethodCommand.js create mode 100644 packages/web3-core-method/src/commands/SendMethodCommand.js create mode 100644 packages/web3-core-method/src/commands/SignAndSendMethodCommand.js create mode 100644 packages/web3-core-method/src/commands/SignMessageCommand.js create mode 100644 packages/web3-core-method/src/controllers/MethodController.js diff --git a/packages/web3-core-method/lib/commands/AbstractCommand.js b/packages/web3-core-method/lib/commands/AbstractCommand.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/web3-core-method/lib/commands/AbstractSendCommand.js b/packages/web3-core-method/lib/commands/AbstractSendCommand.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js new file mode 100644 index 00000000000..78728532ad2 --- /dev/null +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -0,0 +1,27 @@ +/* + 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 . + */ +/** + * @file CallMethodCommand.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +function CallMethodCommand() { + +} diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js new file mode 100644 index 00000000000..8020a0cfd54 --- /dev/null +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -0,0 +1,27 @@ +/* + 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 . + */ +/** + * @file SendMethodCommand.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +function SendMethodCommand() { + +} diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js new file mode 100644 index 00000000000..c6ad577563e --- /dev/null +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -0,0 +1,5 @@ + + +function SignAndSendMethodCommand() { + +} diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js new file mode 100644 index 00000000000..699a9f5b133 --- /dev/null +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -0,0 +1,4 @@ + +function SignMessageCommand() { + +} diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js new file mode 100644 index 00000000000..be08bf8d2c4 --- /dev/null +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -0,0 +1,104 @@ +/* + 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 . + */ +/** + * @file MethodController.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {CallMethodCommand} callMethodCommand + * @param {SendMethodCommand} sendMethodCommand + * @param {SignAndSendMethodCommand} signAndSendMethodCommand + * @param {SignMessageCommand} signMessageCommand + * + * @constructor + */ +function MethodController(callMethodCommand, sendMethodCommand, signAndSendMethodCommand, signMessageCommand) { + this.callMethodCommand = callMethodCommand; + this.sendMethodCommand = sendMethodCommand; + this.signAndSendMethodCommand = signAndSendMethodCommand; + this.signMessageCommand = signMessageCommand; +} + +/** + * Determines which command should be executed + * + * @method execute + * + * @param {AbstractMethodModel} methodModel + * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {Accounts} accounts + * @param {AbstractWeb3Object} web3Package + * @param {Array} methodArguments + * + * @returns {Promise | eventifiedPromise | String | boolean} + */ +MethodController.prototype.execute = function (methodModel, provider, accounts, web3Package, methodArguments) { + var promiEvent = {}, + mappedMethodArguments = this.mapFunctionArguments(methodArguments); + + if (this.hasWallets(accounts)) { + if (methodModel.isSign()) { + return this.signMessageCommand.execute( + mappedMethodArguments.parameters, + accounts, + mappedMethodArguments.callback + ); + } + + if (methodModel.isSendTransaction()) { + return this.signAndSendMethodCommand.execute( + methodModel, + provider, + promiEvent, + mappedMethodArguments.callback + ); + } + } + + if (methodModel.isSendTransaction() || methodModel.isSendRawTransaction()) { + return this.sendMethodCommand.execute( + methodModel, + provider, + promiEvent, + mappedMethodArguments.callback + ); + } + + return this.callMethodCommand.execute( + methodModel, + provider, + mappedMethodArguments.parameters, + mappedMethodArguments.callback + ); +}; + +/** + * Determines if accounts is defined and if wallet is not empty + * + * @method hasWallet + * + * @param accounts + * + * @returns {Boolean} + */ +MethodController.prototype.hasWallets = function (accounts) { + return (accounts && accounts.wallet.length > 0); +}; From 7a96e6a7b1c5dc0f5a2ff5e87e3be974f1fc6d9b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 11:39:37 +0200 Subject: [PATCH 0119/1045] MethodController, SendMethodCommand, SendAndSignMethodCommand, CallMethodCommand and SignMessageCommand created. MethodPackageFactory and package index of web3-core-method updated --- .../lib/commands/AbstractCommand.js | 0 .../lib/commands/AbstractSendCommand.js | 0 .../lib/commands/AbstractSendMethodCommand.js | 99 +++++++ .../lib/{signer => signers}/AbstractSigner.js | 0 .../web3-core-method/src/MethodService.js | 259 ------------------ .../src/commands/CallMethodCommand.js | 36 ++- .../src/commands/SendMethodCommand.js | 48 +++- .../src/commands/SignAndSendMethodCommand.js | 86 +++++- .../src/commands/SignMessageCommand.js | 59 +++- .../src/controllers/MethodController.js | 48 +++- .../src/factories/MethodPackageFactory.js | 94 +++++-- packages/web3-core-method/src/index.js | 10 +- .../src/signers/MessageSigner.js | 4 +- .../src/signers/TransactionSigner.js | 2 +- 14 files changed, 451 insertions(+), 294 deletions(-) delete mode 100644 packages/web3-core-method/lib/commands/AbstractCommand.js delete mode 100644 packages/web3-core-method/lib/commands/AbstractSendCommand.js create mode 100644 packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js rename packages/web3-core-method/lib/{signer => signers}/AbstractSigner.js (100%) delete mode 100644 packages/web3-core-method/src/MethodService.js diff --git a/packages/web3-core-method/lib/commands/AbstractCommand.js b/packages/web3-core-method/lib/commands/AbstractCommand.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/packages/web3-core-method/lib/commands/AbstractSendCommand.js b/packages/web3-core-method/lib/commands/AbstractSendCommand.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js new file mode 100644 index 00000000000..221fa9141cd --- /dev/null +++ b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js @@ -0,0 +1,99 @@ +/* + 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 . + */ +/** + * @file AbstractSendMethodCommand.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow + * + * @constructor + */ +function AbstractSendMethodCommand(transactionConfirmationWorkflow) { + this.transactionConfirmationWorkflow = transactionConfirmationWorkflow; +} + + +/** + * Sends the JSON-RPC request + * + * @method send + * + * @param {AbstractMethodModel} methodModel + * @param {Array} parameters + * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {PromiEvent} promiEvent + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ +AbstractSendMethodCommand.prototype.send = function (methodModel, parameters, provider, promiEvent, callback) { + provider.send( + methodModel.rpcMethod, + parameters + ).then(function (response) { + self.transactionConfirmationWorkflow.execute( + methodModel, + provider, + response, + promiEvent, + callback + ); + + promiEvent.eventEmitter.emit('transactionHash', response); + callback(false, response); + }).catch(function (error) { + promiEvent.reject(error); + promiEvent.on('error', error); + promiEvent.eventEmitter.removeAllListeners(); + callback(error, null); + }); + + return promiEvent; +}; + + +/** + * Determines if gasPrice is defined in the method options + * + * @method isGasPriceDefined + * + * @param {Array} parameters + * + * @returns {boolean} + */ +AbstractSendMethodCommand.prototype.isGasPriceDefined = function (parameters) { + return _.isObject(parameters[0]) && typeof parameters[0].gasPrice !== 'undefined'; +}; + +/** + * Returns the current gasPrice of the connected node + * + * @param {AbstractProviderAdapter | EthereumProvider} provider + * + * @returns {Promise} + */ +AbstractSendMethodCommand.prototype.getGasPrice = function (provider) { + return provider.send('eth_gasPrice', []); +}; + +module.exports = AbstractSendMethodCommand; diff --git a/packages/web3-core-method/lib/signer/AbstractSigner.js b/packages/web3-core-method/lib/signers/AbstractSigner.js similarity index 100% rename from packages/web3-core-method/lib/signer/AbstractSigner.js rename to packages/web3-core-method/lib/signers/AbstractSigner.js diff --git a/packages/web3-core-method/src/MethodService.js b/packages/web3-core-method/src/MethodService.js deleted file mode 100644 index 64005e8b18e..00000000000 --- a/packages/web3-core-method/src/MethodService.js +++ /dev/null @@ -1,259 +0,0 @@ -/* - 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 . - */ - -/** - * @file MethodService.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var _ = require('underscore'); - -/** - * @param {PromiEvent} promiEventPackage - * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow - * @param {TransactionSigner} transactionSigner - * @param {MessageSigner} messageSigner - * - * @constructor - */ -function MethodService( - promiEventPackage, - transactionConfirmationWorkflow, - transactionSigner, - messageSigner -) { - this.promiEventPackage = promiEventPackage; - this.transactionConfirmationWorkflow = transactionConfirmationWorkflow; - this.transactionSigner = transactionSigner; - this.messageSigner = messageSigner; -} - -/** - * Executes the given method - * - * @method execute - * - * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter} provider - * @param {Accounts} accounts - * @param {Object} parentObject - The object from which the method is called. - * @param {Array} methodArguments - * - * @returns {Promise|eventifiedPromise|String|boolean} - */ -MethodService.prototype.execute = function (methodModel, provider, accounts, parentObject, methodArguments) { - var mappedFunctionArguments = this.mapFunctionArguments(methodArguments); - - methodModel.beforeExecution(mappedFunctionArguments.parameters, parentObject); - - return this.send( - methodModel, - provider, - accounts, - mappedFunctionArguments.parameters, - mappedFunctionArguments.callback - ); -}; - -/** - * Sends the JSON-RPC request - * - * @method send - * - * @callback callback callback(error, result) - * @returns {Promise | eventifiedPromise | String | boolean} - */ -MethodService.prototype.send = function (methodModel, provider, accounts, parameters, callback) { - var self = this; - var promiEvent = this.promiEventPackage.createPromiEvent(); - - if (accounts && accounts.wallet.length > 0) { - if (this.methodModel.isSign()) { - return this.messageSigner.sign(parameters[0], parameters[1], accounts); - } - - if (this.methodModel.isSendTransaction()) { - this.methodModel.rpcMethod = 'eth_sendRawTransaction'; - this.transactionSigner.sign(parameters[0], accounts).then(function(response) { - self.sendTransaction( - methodModel, - provider, - promiEvent, - [response.rawTransaction], - null, - callback - ); - }).catch(function(error) { - promiEvent.reject(error); - promiEvent.on('error', error); - promiEvent.eventEmitter.removeAllListeners(); - callback(error, null); - }); - - return promiEvent; - } - } - - if (this.methodModel.isSendTransaction() || this.methodModel.isSendRawTransaction()) { - if (this.isGasPriceDefined()) { - return this.sendTransaction( - methodModel, - provider, - promiEvent, - parameters, - null, - callback - ); - } - - this.getGasPrice().then(function (gasPrice) { - self.sendTransaction( - methodModel, - provider, - promiEvent, - parameters, - gasPrice, - callback - ) - }); - - return promiEvent; - } - - return this.call(methodModel, provider, parameters, callback); -}; - -/** - * Determines if gasPrice is defined in the method options - * - * @method isGasPriceDefined - * - * @returns {boolean} - */ -MethodService.prototype.isGasPriceDefined = function () { - return _.isObject(this.parameters[0]) && typeof this.parameters[0].gasPrice !== 'undefined'; -}; - -/** - * Sends a JSON-RPC call request - * - * @method call - * - * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter} provider - * @param {Array} parameters - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -MethodService.prototype.call = function (methodModel, provider, parameters, callback) { - return provider.send( - methodModel.rpcMethod, - parameters - ).then(function (response) { - var mappedResponse = methodModel.afterExecution(response); - callback(mappedResponse); - - return mappedResponse; - }); -}; - -/** - * Returns the mapped function arguments - * - * @method mapFunctionArguments - * - * @param {IArguments} args - * - * @returns {Object} - */ -MethodService.prototype.mapFunctionArguments = function (args) { - var parameters = args; - var callback = null; - - if (arguments.length < this.parametersAmount) { - throw new Error( - 'Arguments length is not correct: expected: ' + this.parametersAmount + ', given: ' + arguments.length - ); - } - - if (arguments.length > this.parametersAmount) { - callback = arguments.slice(-1); - if(!_.isFunction(callback)) { - throw new Error( - 'The latest parameter should be a function otherwise it can not be used as callback' - ); - } - parameters = arguments.slice(0, -1); - } - - return { - callback: callback, - parameters: parameters - } -}; - - -/** - * Sends the JSON-RPC sendTransaction request - * - * @method sendTransaction - * - * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter} provider - * @param {PromiEvent} promiEvent - * @param {Array} parameters - * @param {String} gasPrice - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {eventifiedPromise} - */ -MethodService.prototype.sendTransaction = function (methodModel, provider, promiEvent, parameters, gasPrice, callback) { - var self = this; - - if (gasPrice && _.isObject(parameters[0])) { - parameters[0].gasPrice = gasPrice; - } - - provider.send( - methodModel.rpcMethod, - parameters - ).then(function (response) { - self.transactionConfirmationWorkflow.execute( - methodModel, - provider, - response, - promiEvent, - callback - ); - - promiEvent.eventEmitter.emit('transactionHash', response) - }).catch(function (error) { - promiEvent.reject(error); - promiEvent.on('error', error); - promiEvent.eventEmitter.removeAllListeners(); - }); - - return promiEvent; -}; - -module.exports = MethodService; diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 78728532ad2..1b378377317 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -22,6 +22,38 @@ "use strict"; -function CallMethodCommand() { +/** + * @constructor + */ +function CallMethodCommand() { } + +/** + * Sends a JSON-RPC call request + * + * @method execute + * + * @param {AbstractWeb3Object} web3Package + * @param {AbstractMethodModel} methodModel + * @param {AbstractProviderAdapter} provider + * @param {Array} parameters + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +CallMethodCommand.prototype.execute = function (web3Package, methodModel, provider, parameters, callback) { + + methodModel.beforeExecution(parameters, web3Package); + + return provider.send( + methodModel.rpcMethod, + parameters + ).then(function (response) { + var mappedResponse = methodModel.afterExecution(response); + + callback(mappedResponse); + return mappedResponse; + }); +}; -} +module.exports = CallMethodCommand; diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 8020a0cfd54..90d39b790e6 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -22,6 +22,52 @@ "use strict"; -function SendMethodCommand() { +var AbstractSendMethodCommand = require('../../lib/commands/AbstractSendMethodCommand'); +/** + * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow + * + * @constructor + */ +function SendMethodCommand(transactionConfirmationWorkflow) { + AbstractSendMethodCommand.call(this, transactionConfirmationWorkflow); } + +/** + * Determines if gasPrice is set, sends the request and returns a PromiEvent Object + * + * @method execute + * + * @param {AbstractWeb3Object} web3Package + * @param {AbstractMethodModel} methodModel + * @param {Array} parameters + * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {PromiEvent} promiEvent + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ +SendMethodCommand.prototype.execute = function (web3Package, methodModel, parameters, provider, promiEvent, callback) { + var self = this; + + methodModel.beforeExecution(parameters, web3Package); + + if (this.isGasPriceDefined(parameters)) { + return this.send(methodModel, parameters, provider, promiEvent, callback); + } + + this.getGasPrice(provider).then(function(gasPrice) { + if (_.isObject(parameters[0])) { + parameters[0].gasPrice = gasPrice; + } + + self.send(methodModel, parameters, provider, promiEvent, callback); + }); + + return promiEvent; +}; + +SendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); + +module.exports = SendMethodCommand; diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index c6ad577563e..c89e171d961 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -1,5 +1,89 @@ +/* + 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. -function SignAndSendMethodCommand() { + 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 . + */ +/** + * @file SignAndSendMethodCommand.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractSendMethodCommand = require('../../lib/commands/AbstractSendMethodCommand'); + +/** + * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow + * @param {TransactionSigner} transactionSigner + * + * @constructor + */ +function SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSigner) { + AbstractSendCommand.call(this, transactionConfirmationWorkflow); + this.transactionSigner = transactionSigner; } + +/** + * TODO: Add gasPrice check + * + * Sends the JSON-RPC request and returns an PromiEvent object + * + * @method execute + * + * @param {AbstractWeb3Object} web3Package + * @param {AbstractMethodModel} methodModel + * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {Array} parameters + * @param {Accounts} accounts + * @param {PromiEvent} promiEvent + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ +SignAndSendMethodCommand.prototype.execute = function ( + web3Package, + methodModel, + provider, + parameters, + accounts, + promiEvent, + callback +) { + methodModel.beforeExecution(parameters, web3Package); + methodModel.rpcMethod = 'eth_sendRawTransaction'; + + this.transactionSigner.sign(parameters[0], accounts).then(function(response) { + self.send( + methodModel, + provider, + promiEvent, + [response.rawTransaction], + null, + callback + ); + }).catch(function(error) { + promiEvent.reject(error); + promiEvent.on('error', error); + promiEvent.eventEmitter.removeAllListeners(); + callback(error, null); + }); + + return promiEvent; +}; + +SignAndSendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); + +module.exports = SignAndSendMethodCommand; diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js index 699a9f5b133..abc2bd244ce 100644 --- a/packages/web3-core-method/src/commands/SignMessageCommand.js +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -1,4 +1,61 @@ +/* + This file is part of web3.js. -function SignMessageCommand() { + 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 . + */ +/** + * @file SignAndSendMethodCommand.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {MessageSigner} messageSigner + * + * @constructor + */ +function SignMessageCommand(messageSigner) { + this.messageSigner = messageSigner; } + +/** + * Executes the SignMessageCommand and returns the signed message + * + * @param {String} data + * @param {String} address + * @param {Accounts} accounts + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {String} + */ +SignMessageCommand.prototype.execute = function (data, address, accounts, callback) { + var signedMessage; + + try { + signedMessage = this.messageSigner.sign(data, address, accounts); + } catch(error) { + callback(error, null); + + throw error; + } + + callback(null, signedMessage); + + return signedMessage; +}; + +module.exports = SignMessageCommand; diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index be08bf8d2c4..6238913da20 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -27,14 +27,16 @@ * @param {SendMethodCommand} sendMethodCommand * @param {SignAndSendMethodCommand} signAndSendMethodCommand * @param {SignMessageCommand} signMessageCommand + * @param {PromiEventPackage} promiEventPackage * * @constructor */ -function MethodController(callMethodCommand, sendMethodCommand, signAndSendMethodCommand, signMessageCommand) { +function MethodController(callMethodCommand, sendMethodCommand, signAndSendMethodCommand, signMessageCommand, promiEventPackage) { this.callMethodCommand = callMethodCommand; this.sendMethodCommand = sendMethodCommand; this.signAndSendMethodCommand = signAndSendMethodCommand; this.signMessageCommand = signMessageCommand; + this.promiEventPackage = promiEventPackage; } /** @@ -46,18 +48,19 @@ function MethodController(callMethodCommand, sendMethodCommand, signAndSendMetho * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {Accounts} accounts * @param {AbstractWeb3Object} web3Package - * @param {Array} methodArguments + * @param {IArguments} methodArguments * * @returns {Promise | eventifiedPromise | String | boolean} */ MethodController.prototype.execute = function (methodModel, provider, accounts, web3Package, methodArguments) { - var promiEvent = {}, + var promiEvent = this.promiEventPackage.createPromiEvent(), mappedMethodArguments = this.mapFunctionArguments(methodArguments); if (this.hasWallets(accounts)) { if (methodModel.isSign()) { return this.signMessageCommand.execute( - mappedMethodArguments.parameters, + mappedMethodArguments.parameters[0], + mappedMethodArguments.parameters[1], accounts, mappedMethodArguments.callback ); @@ -75,6 +78,7 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, if (methodModel.isSendTransaction() || methodModel.isSendRawTransaction()) { return this.sendMethodCommand.execute( + web3Package, methodModel, provider, promiEvent, @@ -83,6 +87,7 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, } return this.callMethodCommand.execute( + web3Package, methodModel, provider, mappedMethodArguments.parameters, @@ -102,3 +107,38 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, MethodController.prototype.hasWallets = function (accounts) { return (accounts && accounts.wallet.length > 0); }; + +/** + * Returns the mapped function arguments + * + * @method mapFunctionArguments + * + * @param {IArguments} args + * + * @returns {Object} + */ +MethodController.prototype.mapFunctionArguments = function (args) { + var parameters = args; + var callback = null; + + if (arguments.length < this.parametersAmount) { + throw new Error( + 'Arguments length is not correct: expected: ' + this.parametersAmount + ', given: ' + arguments.length + ); + } + + if (arguments.length > this.parametersAmount) { + callback = arguments.slice(-1); + if(!_.isFunction(callback)) { + throw new Error( + 'The latest parameter should be a function otherwise it can not be used as callback' + ); + } + parameters = arguments.slice(0, -1); + } + + return { + callback: callback, + parameters: parameters + } +}; diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index 28418d28466..2ef59398435 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -28,39 +28,97 @@ var MessageSigner = require('../signers/MessageSigner'); var TransactionConfirmationModel = require('../models/TransactionConfirmationModel'); var TransactionReceiptValidator = require('../validators/TransactionReceiptValidator'); var NewHeadsWatcher = require('../watchers/NewHeadsWatcher'); -var MethodService = require('../MethodService'); - +var MethodController = require('../controllers/MethodController'); +var CallMethodCommand = require('../commands/CallMethodCommand'); +var SendMethodCommand = require('../commands/SendMethodCommand'); +var SignAndSendMethodCommand = require('../commands/SignAndSendMethodCommand'); +var SignMessageCommand = require('../commands/SignMessageCommand'); /** * @constructor */ function MethodPackageFactory() { } - /** - * Return Method object + * Returns the MethodController object * - * @method createMethod + * @method createMethodController * - * @param {PromiEvent} promiEvent + * @param {PromiEventPackage} promiEventPackage * @param {SubscriptionPackage} subscriptionPackage * - * @returns {MethodService} + * @returns {MethodController} */ -MethodPackageFactory.prototype.createMethodService = function ( - promiEvent, +MethodPackageFactory.prototype.createMethodController = function ( + promiEventPackage, subscriptionPackage ) { - return new MethodService( - promiEvent, + return new MethodController( + this.createCallMethodCommand(), + this.createSendMethodCommand(subscriptionPackage), + this.createSignAndSendMethodCommand(subscriptionPackage), + this.createSignMessageCommand(), + promiEventPackage + ); +}; + +/** + * Returns the CallMethodCommand object + * + * @method createCallMethodCommand + * + * @returns {CallMethodCommand} + */ +MethodPackageFactory.prototype.createCallMethodCommand = function () { + return new CallMethodCommand(); +}; + +/** + * Returns the SendMethodCommand object + * + * @method createSendMethodCommand + * + * @param {SubscriptionPackage} subscriptionPackage + * + * @returns {SendMethodCommand} + */ +MethodPackageFactory.prototype.createSendMethodCommand = function (subscriptionPackage) { + return new SendMethodCommand( + this.createTransactionConfirmationWorkflow(subscriptionPackage) + ); +}; + +/** + * Returns the SignAndSendCommand object + * + * @method createSingAndSendMethodCommand + * + * @param {SubscriptionPackage} subscriptionPackage + * + * @returns {SignAndSendMethodCommand} + */ +MethodPackageFactory.prototype.createSignAndSendMethodCommand = function (subscriptionPackage) { + return new SignAndSendMethodCommand( this.createTransactionConfirmationWorkflow(subscriptionPackage), - this.createTransactionSigner(), + this.createTransactionSigner() + ); +}; + +/** + * Returns the SignMessageCommand object + * + * @method createSignMessageCommand + * + * @returns {SignMessageCommand} + */ +MethodPackageFactory.prototype.createSignMessageCommand = function () { + return new SignMessageCommand( this.createMessageSigner() ); }; /** - * Returns TransactionConfirmationWorkflow object + * Returns the TransactionConfirmationWorkflow object * * @method createTransactionConfirmationWorkflow * @@ -77,7 +135,7 @@ MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function }; /** - * Returns TransactionSigner object + * Returns the TransactionSigner object * * @method createTransactionSigner * @@ -88,7 +146,7 @@ MethodPackageFactory.prototype.createTransactionSigner = function () { }; /** - * Returns MessageSigner object + * Returns the MessageSigner object * * @method createMessageSigner * @@ -99,7 +157,7 @@ MethodPackageFactory.prototype.createMessageSigner = function () { }; /** - * Returns TransactionConfirmationModel object + * Returns the TransactionConfirmationModel object * * @method createTransactionConfirmationModel * @@ -110,7 +168,7 @@ MethodPackageFactory.prototype.createTransactionConfirmationModel = function () }; /** - * Returns TransactionReceiptValidator object + * Returns the TransactionReceiptValidator object * * @returns {TransactionReceiptValidator} */ @@ -119,7 +177,7 @@ MethodPackageFactory.prototype.createTransactionReceiptValidator = function () { }; /** - * Returns NewHeadsWatcher object + * Returns the NewHeadsWatcher object * * @param {SubscriptionPackage} subscriptionPackage * diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 379ade308dd..82b6182d344 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -113,14 +113,14 @@ module.exports = { AbstractMethodModelFactory: AbstractMethodModelFactory, /** - * Creates the Method object + * Returns the MethodController object * - * @method createMethodService + * @method createMethodController * - * @returns {MethodService} + * @returns {MethodController} */ - createMethodService: function () { - return new MethodPackageFactory().createMethodService( + createMethodController: function () { + return new MethodPackageFactory().createMethodController( PromiEventPackage, SubscriptionPackage ); diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 7e2d8a13a3a..4bc1592ca26 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractSigner = require('../../AbstractSigner'); +var AbstractSigner = require('../../lib/signers/AbstractSigner'); /** * @constructor @@ -46,7 +46,7 @@ MessageSigner.prototype.sign = function(data, address, accounts) { return accounts.sign(data, wallet.privateKey).signature; } - return new Error('Wallet or privateKey in wallet is not set!'); + throw new Error('Wallet or privateKey in wallet is not set!'); }; // Inherit from AbstractSigner diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index c85cce702af..824131c8edf 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractSigner = require('../../lib/AbstractSigner'); +var AbstractSigner = require('../../lib/signers/AbstractSigner'); function TransactionSigner() { } From e434d7c4bf3b2bce4f973dc5acbd1707c3282c3a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 12:29:27 +0200 Subject: [PATCH 0120/1045] MethodService renamed to MethodController in all packages, AbstractWeb3Object updated because of MethodController, method parameters handling simplified in web3-core-method package and all beforeExecution methods updated because of the new parameters handling --- .../lib/commands/AbstractSendMethodCommand.js | 13 ++-- .../lib/models/AbstractMethodModel.js | 17 +++++ .../src/commands/CallMethodCommand.js | 10 ++- .../src/commands/SendMethodCommand.js | 16 +++-- .../src/commands/SignAndSendMethodCommand.js | 22 ++----- .../src/commands/SignMessageCommand.js | 12 ++-- .../src/controllers/MethodController.js | 63 ++++--------------- .../src/factories/MethodPackageFactory.js | 24 ++++--- packages/web3-core-method/src/index.js | 4 +- .../src/models/methods/CallMethodModel.js | 7 +-- .../models/methods/EstimateGasMethodModel.js | 5 +- .../src/models/methods/GetCodeMethodModel.js | 7 +-- .../models/methods/GetPastLogslMethodModel.js | 5 +- .../models/methods/GetStorageAtMethodModel.js | 9 ++- .../src/models/methods/SignMethodModel.js | 7 +-- .../methods/account/GetBalanceMethodModel.js | 7 +-- .../account/GetTransactionCountMethodModel.js | 7 +-- .../methods/block/GetBlockMethodModel.js | 7 +-- .../GetBlockTransactionCountMethodModel.js | 5 +- .../block/GetBlockUncleCountMethodModel.js | 5 +- .../methods/block/GetUncleMethodModel.js | 7 +-- .../methods/personal/EcRecoverMethodModel.js | 7 +-- .../personal/LockAccountMethodModel.js | 5 +- .../PersonalSendTransactionMethodModel.js | 5 +- .../personal/PersonalSignMethodModel.js | 7 +-- .../PersonalSignTransactionMethodModel.js | 5 +- .../personal/UnlockAccountMethodModel.js | 5 +- .../GetTransactionFromBlockMethodModel.js | 7 +-- .../transaction/SendTransactionMethodModel.js | 5 +- .../transaction/SignTransactionMethodModel.js | 5 +- .../TransactionConfirmationWorkflow.js | 53 ++++++++-------- .../src/AbstractWeb3Object.js | 21 +++---- packages/web3-eth-accounts/src/Accounts.js | 8 +-- packages/web3-eth-accounts/src/index.js | 2 +- packages/web3-eth-personal/src/Personal.js | 6 +- packages/web3-eth-personal/src/index.js | 2 +- packages/web3-eth/src/Eth.js | 6 +- packages/web3-eth/src/index.js | 2 +- packages/web3-net/src/Network.js | 6 +- packages/web3-net/src/index.js | 2 +- packages/web3-shh/src/Shh.js | 6 +- packages/web3-shh/src/index.js | 2 +- 42 files changed, 183 insertions(+), 243 deletions(-) diff --git a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js index 221fa9141cd..e0c7964da91 100644 --- a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js +++ b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js @@ -38,34 +38,31 @@ function AbstractSendMethodCommand(transactionConfirmationWorkflow) { * @method send * * @param {AbstractMethodModel} methodModel - * @param {Array} parameters * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {PromiEvent} promiEvent - * @param {Function} callback * * @callback callback callback(error, result) * @returns {PromiEvent} */ -AbstractSendMethodCommand.prototype.send = function (methodModel, parameters, provider, promiEvent, callback) { +AbstractSendMethodCommand.prototype.send = function (methodModel, provider, promiEvent) { provider.send( methodModel.rpcMethod, - parameters + methodModel.parameters ).then(function (response) { self.transactionConfirmationWorkflow.execute( methodModel, provider, response, - promiEvent, - callback + promiEvent ); promiEvent.eventEmitter.emit('transactionHash', response); - callback(false, response); + methodModel.callback(false, response); }).catch(function (error) { promiEvent.reject(error); promiEvent.on('error', error); promiEvent.eventEmitter.removeAllListeners(); - callback(error, null); + methodModel.callback(error, null); }); return promiEvent; diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 1a3c5d94b8c..3f8ab4f97aa 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -35,6 +35,23 @@ function AbstractMethodModel(rpcMethod, parametersAmount, utils, formatters) { this.parametersAmount = parametersAmount; this.utils = utils; this.formatters = formatters; + var methodArguments = {}; + + /** + * Defines accessors for defaultAccount + */ + Object.defineProperty(this, 'methodArguments', { + get: function () { + return methodArguments; + }, + set: function (methodArguments) { + methodArguments = this.mapFunctionArguments(methodArguments); + }, + enumerable: true + }); + + this.parameters = this.methodArguments.parameters; + this.callback = this.methodArguments.callback; } /** diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 1b378377317..1692f908503 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -35,23 +35,21 @@ function CallMethodCommand() { } * @param {AbstractWeb3Object} web3Package * @param {AbstractMethodModel} methodModel * @param {AbstractProviderAdapter} provider - * @param {Array} parameters - * @param {Function} callback * * @callback callback callback(error, result) * @returns {Promise} */ -CallMethodCommand.prototype.execute = function (web3Package, methodModel, provider, parameters, callback) { +CallMethodCommand.prototype.execute = function (web3Package, methodModel, provider) { - methodModel.beforeExecution(parameters, web3Package); + methodModel.beforeExecution(web3Package); return provider.send( methodModel.rpcMethod, - parameters + methodModel.parameters ).then(function (response) { var mappedResponse = methodModel.afterExecution(response); - callback(mappedResponse); + methodModel.callback(mappedResponse); return mappedResponse; }); }; diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 90d39b790e6..88ed2a8ac9d 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -40,29 +40,27 @@ function SendMethodCommand(transactionConfirmationWorkflow) { * * @param {AbstractWeb3Object} web3Package * @param {AbstractMethodModel} methodModel - * @param {Array} parameters * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {PromiEvent} promiEvent - * @param {Function} callback * * @callback callback callback(error, result) * @returns {PromiEvent} */ -SendMethodCommand.prototype.execute = function (web3Package, methodModel, parameters, provider, promiEvent, callback) { +SendMethodCommand.prototype.execute = function (web3Package, methodModel, provider, promiEvent) { var self = this; - methodModel.beforeExecution(parameters, web3Package); + methodModel.beforeExecution(web3Package); - if (this.isGasPriceDefined(parameters)) { - return this.send(methodModel, parameters, provider, promiEvent, callback); + if (this.isGasPriceDefined(methodModel.parameters)) { + return this.send(methodModel, provider, promiEvent); } this.getGasPrice(provider).then(function(gasPrice) { - if (_.isObject(parameters[0])) { - parameters[0].gasPrice = gasPrice; + if (_.isObject(methodModel.parameters[0])) { + methodModel.parameters[0].gasPrice = gasPrice; } - self.send(methodModel, parameters, provider, promiEvent, callback); + self.send(methodModel, provider, promiEvent); }); return promiEvent; diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index c89e171d961..22c731e321b 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -31,7 +31,7 @@ var AbstractSendMethodCommand = require('../../lib/commands/AbstractSendMethodCo * @constructor */ function SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSigner) { - AbstractSendCommand.call(this, transactionConfirmationWorkflow); + AbstractSendMethodCommand.call(this, transactionConfirmationWorkflow); this.transactionSigner = transactionSigner; } @@ -45,10 +45,8 @@ function SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSi * @param {AbstractWeb3Object} web3Package * @param {AbstractMethodModel} methodModel * @param {AbstractProviderAdapter | EthereumProvider} provider - * @param {Array} parameters * @param {Accounts} accounts * @param {PromiEvent} promiEvent - * @param {Function} callback * * @callback callback callback(error, result) * @returns {PromiEvent} @@ -57,28 +55,20 @@ SignAndSendMethodCommand.prototype.execute = function ( web3Package, methodModel, provider, - parameters, accounts, promiEvent, - callback ) { - methodModel.beforeExecution(parameters, web3Package); + methodModel.beforeExecution(web3Package); methodModel.rpcMethod = 'eth_sendRawTransaction'; - this.transactionSigner.sign(parameters[0], accounts).then(function(response) { - self.send( - methodModel, - provider, - promiEvent, - [response.rawTransaction], - null, - callback - ); + this.transactionSigner.sign(methodModel.parameters[0], accounts).then(function(response) { + methodModel.parameters = [response.rawTransaction]; + self.send(methodModel, provider, promiEvent); }).catch(function(error) { promiEvent.reject(error); promiEvent.on('error', error); promiEvent.eventEmitter.removeAllListeners(); - callback(error, null); + methodModel.callback(error, null); }); return promiEvent; diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js index abc2bd244ce..c54ad131b34 100644 --- a/packages/web3-core-method/src/commands/SignMessageCommand.js +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -34,26 +34,24 @@ function SignMessageCommand(messageSigner) { /** * Executes the SignMessageCommand and returns the signed message * - * @param {String} data - * @param {String} address + * @param {AbstractMethodModel} methodModel * @param {Accounts} accounts - * @param {Function} callback * * @callback callback callback(error, result) * @returns {String} */ -SignMessageCommand.prototype.execute = function (data, address, accounts, callback) { +SignMessageCommand.prototype.execute = function (methodModel, accounts) { var signedMessage; try { - signedMessage = this.messageSigner.sign(data, address, accounts); + signedMessage = this.messageSigner.sign(methodModel.parameters[0], methodModel.parameters[1], accounts); } catch(error) { - callback(error, null); + methodModel.callback(error, null); throw error; } - callback(null, signedMessage); + methodModel.callback(null, signedMessage); return signedMessage; }; diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 6238913da20..2c05b3aac9e 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -31,7 +31,13 @@ * * @constructor */ -function MethodController(callMethodCommand, sendMethodCommand, signAndSendMethodCommand, signMessageCommand, promiEventPackage) { +function MethodController( + callMethodCommand, + sendMethodCommand, + signAndSendMethodCommand, + signMessageCommand, + promiEventPackage +) { this.callMethodCommand = callMethodCommand; this.sendMethodCommand = sendMethodCommand; this.signAndSendMethodCommand = signAndSendMethodCommand; @@ -48,21 +54,17 @@ function MethodController(callMethodCommand, sendMethodCommand, signAndSendMetho * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {Accounts} accounts * @param {AbstractWeb3Object} web3Package - * @param {IArguments} methodArguments * * @returns {Promise | eventifiedPromise | String | boolean} */ -MethodController.prototype.execute = function (methodModel, provider, accounts, web3Package, methodArguments) { - var promiEvent = this.promiEventPackage.createPromiEvent(), - mappedMethodArguments = this.mapFunctionArguments(methodArguments); +MethodController.prototype.execute = function (methodModel, provider, accounts, web3Package) { + var promiEvent = this.promiEventPackage.createPromiEvent(); if (this.hasWallets(accounts)) { if (methodModel.isSign()) { return this.signMessageCommand.execute( - mappedMethodArguments.parameters[0], - mappedMethodArguments.parameters[1], + methodModel, accounts, - mappedMethodArguments.callback ); } @@ -70,8 +72,7 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, return this.signAndSendMethodCommand.execute( methodModel, provider, - promiEvent, - mappedMethodArguments.callback + promiEvent ); } } @@ -81,17 +82,14 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, web3Package, methodModel, provider, - promiEvent, - mappedMethodArguments.callback + promiEvent ); } return this.callMethodCommand.execute( web3Package, methodModel, - provider, - mappedMethodArguments.parameters, - mappedMethodArguments.callback + provider ); }; @@ -107,38 +105,3 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, MethodController.prototype.hasWallets = function (accounts) { return (accounts && accounts.wallet.length > 0); }; - -/** - * Returns the mapped function arguments - * - * @method mapFunctionArguments - * - * @param {IArguments} args - * - * @returns {Object} - */ -MethodController.prototype.mapFunctionArguments = function (args) { - var parameters = args; - var callback = null; - - if (arguments.length < this.parametersAmount) { - throw new Error( - 'Arguments length is not correct: expected: ' + this.parametersAmount + ', given: ' + arguments.length - ); - } - - if (arguments.length > this.parametersAmount) { - callback = arguments.slice(-1); - if(!_.isFunction(callback)) { - throw new Error( - 'The latest parameter should be a function otherwise it can not be used as callback' - ); - } - parameters = arguments.slice(0, -1); - } - - return { - callback: callback, - parameters: parameters - } -}; diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index 2ef59398435..68424947d21 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -46,17 +46,19 @@ function MethodPackageFactory() { } * * @param {PromiEventPackage} promiEventPackage * @param {SubscriptionPackage} subscriptionPackage + * @param {Object} formatters * * @returns {MethodController} */ MethodPackageFactory.prototype.createMethodController = function ( promiEventPackage, - subscriptionPackage + subscriptionPackage, + formatters ) { return new MethodController( this.createCallMethodCommand(), - this.createSendMethodCommand(subscriptionPackage), - this.createSignAndSendMethodCommand(subscriptionPackage), + this.createSendMethodCommand(subscriptionPackage, formatters), + this.createSignAndSendMethodCommand(subscriptionPackage, formatters), this.createSignMessageCommand(), promiEventPackage ); @@ -79,12 +81,13 @@ MethodPackageFactory.prototype.createCallMethodCommand = function () { * @method createSendMethodCommand * * @param {SubscriptionPackage} subscriptionPackage + * @param {Object} formatters * * @returns {SendMethodCommand} */ -MethodPackageFactory.prototype.createSendMethodCommand = function (subscriptionPackage) { +MethodPackageFactory.prototype.createSendMethodCommand = function (subscriptionPackage, formatters) { return new SendMethodCommand( - this.createTransactionConfirmationWorkflow(subscriptionPackage) + this.createTransactionConfirmationWorkflow(subscriptionPackage, formatters) ); }; @@ -94,12 +97,13 @@ MethodPackageFactory.prototype.createSendMethodCommand = function (subscriptionP * @method createSingAndSendMethodCommand * * @param {SubscriptionPackage} subscriptionPackage + * @param {Object} formatters * * @returns {SignAndSendMethodCommand} */ -MethodPackageFactory.prototype.createSignAndSendMethodCommand = function (subscriptionPackage) { +MethodPackageFactory.prototype.createSignAndSendMethodCommand = function (subscriptionPackage, formatters) { return new SignAndSendMethodCommand( - this.createTransactionConfirmationWorkflow(subscriptionPackage), + this.createTransactionConfirmationWorkflow(subscriptionPackage, formatters), this.createTransactionSigner() ); }; @@ -123,14 +127,16 @@ MethodPackageFactory.prototype.createSignMessageCommand = function () { * @method createTransactionConfirmationWorkflow * * @param {SubscriptionPackage} subscriptionPackage + * @param {Object} formatters * * @returns {TransactionConfirmationWorkflow} */ -MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (subscriptionPackage) { +MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (subscriptionPackage, formatters) { new TransactionConfirmationWorkflow( this.createTransactionConfirmationModel(), this.createTransactionReceiptValidator(), - this.createNewHeadsWatcher(subscriptionPackage) + this.createNewHeadsWatcher(subscriptionPackage), + formatters ); }; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 82b6182d344..5a5f0feb4c4 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -28,6 +28,7 @@ var MethodPackageFactory = require('./factories/MethodPackageFactory'); var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); var PromiEventPackage = require('web3-core-promievent'); var SubscriptionPackage = require('web3-core-subscription'); +var formatters = require('web3-core-helpers').formatters; // Methods // Network @@ -122,7 +123,8 @@ module.exports = { createMethodController: function () { return new MethodPackageFactory().createMethodController( PromiEventPackage, - SubscriptionPackage + SubscriptionPackage, + formatters ); }, diff --git a/packages/web3-core-method/src/models/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js index c80a837a829..6eea2b53763 100644 --- a/packages/web3-core-method/src/models/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -39,12 +39,11 @@ function CallMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -CallMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputCallFormatter(parameters[0], web3Package); - parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(parameters[1], web3Package); +CallMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], web3Package); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); }; CallMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index 18e3ddb85fb..7b255bfc1e5 100644 --- a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -39,11 +39,10 @@ function EstimateGasMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -EstimateGasMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputCallFormatter(parameters[0], web3Package); +EstimateGasMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], web3Package); }; /** diff --git a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index 34e6a63b819..d249616d9af 100644 --- a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -39,12 +39,11 @@ function GetCodeMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -GetCodeMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); - parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(parameters[1], web3Package); +GetCodeMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); }; GetCodeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js index 7a85857f7c7..6f1cf38a037 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js @@ -45,11 +45,10 @@ function GetPastLogsMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -GetPastLogsMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputLogFormatter(parameters[0]); +GetPastLogsMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputLogFormatter(this.parameters[0]); }; /** diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index d77bd4c38bb..7c08b3ffb3c 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -45,13 +45,12 @@ function GetStorageAtMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -GetStorageAtMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); - parameters[1] = this.utils.numberToHex(parameters[1]); - parameters[2] = this.formatters.inputDefaultBlockNumberFormatter(parameters[2], web3Package); +GetStorageAtMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + this.parameters[1] = this.utils.numberToHex(this.parameters[1]); + this.parameters[2] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2], web3Package); }; GetStorageAtMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js index 2c95ae497f1..1d71440e44a 100644 --- a/packages/web3-core-method/src/models/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -41,12 +41,11 @@ function SignMethodModel(utils, formatters, accounts) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -SignMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputSignFormatter(parameters[0]); - parameters[1] = this.formatters.inputAddressFormatter(parameters[1]); +SignMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); }; SignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index 5dfc57104e7..e18a34a5b80 100644 --- a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -39,12 +39,11 @@ function GetBalanceMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -GetBalanceMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); - parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(parameters[1], web3Package); +GetBalanceMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); }; /** diff --git a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index ea72ea18a63..fcec23c178f 100644 --- a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -39,12 +39,11 @@ function GetTransactionCountMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package */ -GetTransactionCountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); - parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(parameters[1], web3Package); +GetTransactionCountMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); }; /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index 5d1465b498a..edc253e9e63 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -39,16 +39,15 @@ function GetBlockMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -GetBlockMethodModel.prototype.beforeExecution = function (parameters, web3Package) { +GetBlockMethodModel.prototype.beforeExecution = function (web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getBlockByHash'; } - parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); - parameters[1] = !!parameters[1]; + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); + this.parameters[1] = !!this.parameters[1]; }; /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index 4a9702324c8..bb773d33495 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -39,15 +39,14 @@ function GetBlockTransactionCountMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {AbstractWeb3Object} web3Package */ -GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { +GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } - parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); }; /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index 3c3b1950cf9..4e65d2727b5 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -39,15 +39,14 @@ function GetBlockUncleCountMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {AbstractWeb3Object} web3Package */ -GetBlockUncleCountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { +GetBlockUncleCountMethodModel.prototype.beforeExecution = function (web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getUncleCountByBlockHash'; } - parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); }; /** diff --git a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index 58adfe8b26e..57a41d81156 100644 --- a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -39,16 +39,15 @@ function GetUncleMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {AbstractWeb3Object} web3Package */ -GetUncleMethodModel.prototype.beforeExecution = function (parameters, web3Package) { +GetUncleMethodModel.prototype.beforeExecution = function (web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getUncleByBlockHashAndIndex'; } - parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); - parameters[1] = this.utils.numberToHex(parameters[1]); + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); + this.parameters[1] = this.utils.numberToHex(this.parameters[1]); }; /** diff --git a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index 7241653b0cb..dbe588f8960 100644 --- a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -39,12 +39,11 @@ function EcRecoverMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -EcRecoverMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputSignFormatter(parameters[0]); - parameters[1] = this.formatters.inputAddressFormatter(parameters[1]); +EcRecoverMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); }; EcRecoverMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index 51505ae2093..8d0ed3fdcda 100644 --- a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -39,11 +39,10 @@ function LockAccountMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -LockAccountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); +LockAccountMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); }; LockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index 41a3db7b791..0445e2577d3 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -39,11 +39,10 @@ function PersonalSendTransactionMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -PersonalSendTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputTransactionFormatter(parameters[0], web3Package); +PersonalSendTransactionMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); }; PersonalSendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index f517f23c49a..891bbc8befe 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -39,12 +39,11 @@ function PersonalSignMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -PersonalSignMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputSignFormatter(parameters[0]); - parameters[1] = this.formatters.inputAddressFormatter(parameters[1]); +PersonalSignMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); }; PersonalSignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js index c1da06d1d5f..a0d14f44611 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js @@ -39,11 +39,10 @@ function PersonalSignTransactionMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -PersonalSignTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputTransactionFormatter(parameters[0], web3Package); +PersonalSignTransactionMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); }; PersonalSignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index 6e48ab74265..b542ab226d2 100644 --- a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -39,11 +39,10 @@ function UnlockAccountMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -UnlockAccountMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputAddressFormatter(parameters[0]); +UnlockAccountMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); }; UnlockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index 7f72544d8e7..f1be082e05c 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -39,16 +39,15 @@ function GetTransactionFromBlockMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (parameters, web3Package) { +GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (web3Package) { if (this.isHash(parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } - parameters[0] = this.formatters.inputBlockNumberFormatter(parameters[0]); - parameters[1] = this.utils.numberToHex(parameters[1]); + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); + this.parameters[1] = this.utils.numberToHex(this.parameters[1]); }; /** diff --git a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index 8166b6f2e04..ff97eb9c596 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -41,11 +41,10 @@ function SendTransactionMethodModel(utils, formatters, accounts) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -SendTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputTransactionFormatter(parameters[0], web3Package); +SendTransactionMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); }; SendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index ef140ccd3c4..6ceda876db4 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -39,11 +39,10 @@ function SignTransactionMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -SignTransactionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { - parameters[0] = this.formatters.inputTransactionFormatter(parameters[0], web3Package); +SignTransactionMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); }; SignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index cac8c9ddada..f11e4ffc759 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -26,17 +26,20 @@ * @param {TransactionConfirmationModel} transactionConfirmationModel * @param {TransactionReceiptValidator} transactionReceiptValidator * @param {NewHeadsWatcher} newHeadsWatcher + * @param {Object} formatters * * @constructor */ function TransactionConfirmationWorkflow( transactionConfirmationModel, transactionReceiptValidator, - newHeadsWatcher + newHeadsWatcher, + formatters ) { this.transactionConfirmationModel = transactionConfirmationModel; this.transactionReceiptValidator = transactionReceiptValidator; this.newHeadsWatcher = newHeadsWatcher; + this.formatters = formatters; } /** @@ -48,33 +51,23 @@ function TransactionConfirmationWorkflow( * @param {AbstractProviderAdapter} provider * @param {String} transactionHash * @param {Object} promiEvent - * @param {Function} callback * * @callback callback callback(error, result) */ -TransactionConfirmationWorkflow.prototype.execute = function ( - methodModel, - provider, - transactionHash, - promiEvent, - callback -) { +TransactionConfirmationWorkflow.prototype.execute = function (methodModel, provider, transactionHash, promiEvent) { var self = this; - this.methodModel = methodModel; this.provider = provider; - this.promiEvent = promiEvent; - this.callback = callback; this.getTransactionReceipt(transactionHash).then(function (receipt) { if (receipt && receipt.blockHash) { var validationResult = this.transactionReceiptValidator.validate(receipt); if (validationResult === true) { - this.handleSuccessState(receipt); + this.handleSuccessState(receipt, methodModel, promiEvent); return; } - self.handleErrorState(validationResult); + self.handleErrorState(validationResult, methodModel, promiEvent); return; } @@ -93,7 +86,7 @@ TransactionConfirmationWorkflow.prototype.execute = function ( ); if (self.transactionConfirmationModel.isConfirmed()) { - self.handleSuccessState(receipt); + self.handleSuccessState(receipt, methodModel, promiEvent); } return; @@ -102,7 +95,7 @@ TransactionConfirmationWorkflow.prototype.execute = function ( promiEvent.reject(validationResult); promiEvent.eventEmitter.emit('error', validationResult, receipt); promiEvent.eventEmitter.removeAllListeners(); - callback(validationResult, null); + methodModel.callback(validationResult, null); }); return; @@ -114,7 +107,7 @@ TransactionConfirmationWorkflow.prototype.execute = function ( error = new Error('Transaction was not mined within' + self.transactionConfirmationModel.POLLINGTIMEOUT + ' seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!') } - self.handleErrorState(error); + self.handleErrorState(error, methodModel, promiEvent); }); }); }; @@ -140,19 +133,21 @@ TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (tran * @method handleSuccessState * * @param {Object} receipt + * @param {AbstractMethodModel} methodModel + * @param {PromiEvent} promiEvent * * @callback callback callback(error, result) */ -TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt) { +TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt, methodModel, promiEvent) { this.newHeadsWatcher.stop(); - var mappedReceipt = this.methodModel.afterExecution(receipt); + var mappedReceipt = methodModel.afterExecution(receipt); - this.promiEvent.resolve(mappedReceipt); - this.promiEvent.eventEmitter.emit('receipt', mappedReceipt); - this.promiEvent.eventEmitter.removeAllListeners(); + promiEvent.resolve(mappedReceipt); + promiEvent.eventEmitter.emit('receipt', mappedReceipt); + promiEvent.eventEmitter.removeAllListeners(); - this.callback(false, mappedReceipt); + methodModel.callback(false, mappedReceipt); }; /** @@ -161,17 +156,19 @@ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt * @method handleErrorState * * @param {Error} error + * @param {AbstractMethodModel} methodModel + * @param {PromiEvent} promiEvent * * @callback callback callback(error, result) */ -TransactionConfirmationWorkflow.prototype.handleErrorState = function (error) { +TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, methodModel, promiEvent) { this.newHeadsWatcher.stop(); - this.promiEvent.reject(error).apply(error); - this.promiEvent.eventEmitter.emit('error', error); - this.promiEvent.eventEmitter.removeAllListeners(); + promiEvent.reject(error).apply(error); + promiEvent.eventEmitter.emit('error', error); + promiEvent.eventEmitter.removeAllListeners(); - this.callback(error, null); + methodModel.callback(error, null); }; module.exports = TransactionConfirmationWorkflow; diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 341d9bf28eb..16f6dbfae16 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -25,8 +25,7 @@ /** * @param {Object} provider * @param {ProvidersPackage} providersPackage - * @param {Accounts} accounts - * @param {MethodService} methodService + * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {SubscriptionPackage} subscriptionPackage * @param {BatchRequestPackage} batchRequestPackage @@ -36,7 +35,7 @@ function AbstractWeb3Object( provider, providersPackage, - methodService, + methodController, methodModelFactory, subscriptionPackage, batchRequestPackage @@ -80,9 +79,9 @@ function AbstractWeb3Object( this.subscriptionPackage = subscriptionPackage; } - if (this.isDependencyGiven(methodModelFactory) && this.isDependencyGiven(methodService)) { + if (this.isDependencyGiven(methodModelFactory) && this.isDependencyGiven(methodController)) { this.methodModelFactory = methodModelFactory; - this.methodService = methodService; + this.methodController = methodController; return new Proxy(this, { @@ -150,7 +149,7 @@ AbstractWeb3Object.prototype.extend = function (extension) { object = this[namespace] = new this.constructor( this.provider, this.providersPackage, - this.methodService, + this.methodController, new this.methodModelFactory.constructor(this.methodModelFactory.utils, this.methodModelFactory.formatters) ); @@ -219,13 +218,9 @@ AbstractWeb3Object.prototype.proxyHandler = function (target, name) { var methodModel = target.methodModelFactory.createMethodModel(name); var anonymousFunction = function () { - return target.methodService.execute( - methodModel, - target.currentProvider, - target.accounts, - target, - arguments - ); + methodModel.methodArguments = arguments; + + return target.methodController.execute(methodModel, target.currentProvider, target.accounts, target); }; anonymousFunction.methodModel = methodModel; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index ed81e08237a..da73ebd3d3f 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -56,15 +56,15 @@ var makeEven = function (hex) { /** * @param {any} provider * @param {ProvidersPackage} providersPackage - * @param {MethodService} methodService + * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {Utils} utils * @param {Object} formatters * * @constructor */ -var Accounts = function Accounts(provider, providersPackage, methodService, methodModelFactory, utils, formatters) { - AbstractWeb3Object.call(this, provider, providersPackage, methodService, methodModelFactory); +var Accounts = function Accounts(provider, providersPackage, methodController, methodModelFactory, utils, formatters) { + AbstractWeb3Object.call(this, provider, providersPackage, methodController, methodModelFactory); this.utils = utils; this.formatters = formatters; this.wallet = new Wallet(this); @@ -133,8 +133,8 @@ Accounts.prototype.privateKeyToAccount = function privateKeyToAccount(privateKey * @param {String} privateKey * @param {Function} callback * - * @returns {Promise} * @callback callback callback(error, result) + * @returns {Promise} */ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, callback) { var _this = this, diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index addd4fcab36..2f044eeb393 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -46,7 +46,7 @@ module.exports = { return new Accounts( provider, ProvidersPackage, - MethodPackage.createMethodService(), + MethodPackage.createMethodController(), new MethodModelFactory(Utils, formatters), Utils, formatters diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index d72b501f1c5..c0e530d654a 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -29,7 +29,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * * @param {any} provider * @param {ProvidersPackage} providersPackage - * @param {MethodService} methodService + * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {Network} net * @param {Utils} utils @@ -37,8 +37,8 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * * @constructor */ -function Personal(provider, providersPackage, methodService, methodModelFactory, net, utils, formatters) { - AbstractWeb3Object.call(this, provider, providersPackage, methodService, methodModelFactory); +function Personal(provider, providersPackage, methodController, methodModelFactory, net, utils, formatters) { + AbstractWeb3Object.call(this, provider, providersPackage, methodController, methodModelFactory); this.utils = utils; this.formatters = formatters; this.net = net; diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 392161df433..28e38cc0b14 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -47,7 +47,7 @@ module.exports = { return new Personal( provider, ProvidersPackage, - MethodPackage.createMethodService(), + MethodPackage.createMethodController(), new MethodModelFactory(Utils, formatters), NetworkPackage.createNetwork(provider), Utils, diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 6fee1a907d2..5da1c6ad9e3 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -39,7 +39,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {ProvidersPackage} providersPackage * @param {SubscriptionsResolver} subscriptionsResolver * @param {MethodModelFactory} methodModelFactory - * @param {MethodService} methodService + * @param {MethodController} methodController * @param {BatchRequestPackage} batchRequestPackage * * @constructor @@ -57,7 +57,7 @@ var Eth = function Eth( formatters, providersPackage, subscriptionsResolver, - methodService, + methodController, methodModelFactory, batchRequestPackage ) { @@ -65,7 +65,7 @@ var Eth = function Eth( this, provider, providersPackage, - methodService, + methodController, methodModelFactory, null, batchRequestPackage diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 35e0b0c5efc..7caa458fa30 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -69,7 +69,7 @@ module.exports = { formatters, ProvidersPackage, new SubscriptionsResolver(provider, formatters, SubscriptionPackage, PromiEventPackage, ProvidersPackage), - MethodPackage.createMethodService(), + MethodPackage.createMethodController(), new MethodModelFactory(Utils, formatters, accounts), BatchRequestPackage ); diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index 7148cc4e51f..3c06f208341 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -28,15 +28,15 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {Object} provider * @param {ProvidersPackage} providersPackage - * @param {MethodService} methodService + * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {Object} formatters * @param {Object} utils * * @constructor */ -function Network(provider, providersPackage, methodService, methodModelFactory, formatters, utils) { - AbstractWeb3Object.call(this, provider, providersPackage, methodService, methodModelFactory); +function Network(provider, providersPackage, methodController, methodModelFactory, formatters, utils) { + AbstractWeb3Object.call(this, provider, providersPackage, methodController, methodModelFactory); this.formatters = formatters; this.utils = utils; } diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index f5df7afeacf..2640f67cd25 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -48,7 +48,7 @@ module.exports = { return new Network( provider, ProvidersPackage, - MethodPackage.createMethodService(), + MethodPackage.createMethodController(), new MethodModelFactory(Utils, formatters), formatters, utils diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index c0e7208446b..bccdb762f04 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -27,19 +27,19 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {Object} provider * @param {ProvidersPackage} providersPackage - * @param {MethodService} methodService + * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {SubscriptionPackage} subscriptionPackage * @param {Network} net * * @constructor */ -function Shh(provider, providersPackage, methodService, methodModelFactory, subscriptionPackage, net) { +function Shh(provider, providersPackage, methodController, methodModelFactory, subscriptionPackage, net) { AbstractWeb3Object.call( this, provider, providersPackage, - methodService, + methodController, methodModelFactory, subscriptionPackage ); diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 25064693146..b4b29ffa647 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -48,7 +48,7 @@ module.exports = { return new Shh( provider, ProvidersPackage, - MethodPackage.createMethodService(), + MethodPackage.createMethodController(), new MethodModelFactory(Utils, formatters), SubscriptionPackage, NetworkPackage.createNetwork(provider) From 3abbf86148c59dd7eb193bf96f9f06ce49824f44 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 13:45:06 +0200 Subject: [PATCH 0121/1045] BatchRequest, AbstractMethodModel request method and JSONRpcMapper toBatchPayload refactored because of the new parameters handling in AbstractMethodModel --- packages/web3-core-batch/src/BatchRequest.js | 8 +------- .../web3-core-method/lib/models/AbstractMethodModel.js | 8 ++------ packages/web3-core-providers/src/mappers/JSONRpcMapper.js | 6 ++---- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/packages/web3-core-batch/src/BatchRequest.js b/packages/web3-core-batch/src/BatchRequest.js index feb34330bd2..7abb5ab5759 100644 --- a/packages/web3-core-batch/src/BatchRequest.js +++ b/packages/web3-core-batch/src/BatchRequest.js @@ -74,14 +74,8 @@ BatchRequest.prototype.execute = function () { } try { - var mappedResult = result.result; - - if (self.hasOutputFormatter(request)) { - mappedResult = request.methodModel.outputFormatter(mappedResult); - } - + var mappedResult = request.afterExecution(result.result); request.callback(null, mappedResult); - } catch (err) { request.callback(err, null); } diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 3f8ab4f97aa..d5e9b55b7ab 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -85,13 +85,9 @@ AbstractMethodModel.prototype.afterExecution = function(response) { * @returns {Object} */ AbstractMethodModel.prototype.request = function () { - var mappedFunctionArguments = this.mapFunctionArguments(arguments); + this.methodArguments = arguments; - return { - methodModel: this, - parameters: mappedFunctionArguments.parameters, - callback: mappedFunctionArguments.callback - } + return this; }; /** diff --git a/packages/web3-core-providers/src/mappers/JSONRpcMapper.js b/packages/web3-core-providers/src/mappers/JSONRpcMapper.js index bd294867d5c..a439bcd92d7 100644 --- a/packages/web3-core-providers/src/mappers/JSONRpcMapper.js +++ b/packages/web3-core-providers/src/mappers/JSONRpcMapper.js @@ -66,11 +66,9 @@ JSONRpcMapper.toPayload = function (method, params) { */ JSONRpcMapper.toBatchPayload = function (requests) { return requests.map(function (request) { - if(_.isFunction(request.methodModel.beforeExecution)) { - request.methodModel.beforeExecution(); - } + request.beforeExecution(); - return JSONRpcMapper.toPayload(request.methodModel.rpcMethod, request.parameters); + return JSONRpcMapper.toPayload(request.rpcMethod, request.parameters); }); }; From 825f8fd9c765a69ac98a1ff04c3dc95702e345c0 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 13:46:06 +0200 Subject: [PATCH 0122/1045] missing semicolon added --- packages/web3-core-method/lib/models/AbstractMethodModel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index d5e9b55b7ab..6a1aaadaf4b 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -166,7 +166,7 @@ AbstractMethodModel.prototype.isSendRawTransaction = function () { * @returns {boolean} */ AbstractMethodModel.prototype.isHash = function (parameter) { - return _.isString(parameter) && parameter.indexOf('0x') === 0 + return _.isString(parameter) && parameter.indexOf('0x') === 0; }; From a889dc47d2739f98aa7195f478161cb17a322af1 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 13:47:48 +0200 Subject: [PATCH 0123/1045] Missing type declaration in funcDoc added --- packages/web3-core-method/src/controllers/MethodController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 2c05b3aac9e..df1c8928514 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -98,7 +98,7 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, * * @method hasWallet * - * @param accounts + * @param {Accounts} accounts * * @returns {Boolean} */ From 1b5cf09b73adb2c0d748fd005a175419b140e378 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 13:50:26 +0200 Subject: [PATCH 0124/1045] property accessors declaration of TransactionConfirmationModel moved to constructor --- .../models/TransactionConfirmationModel.js | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index f53578c5e53..78f036f719d 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -26,57 +26,57 @@ function TransactionConfirmationModel() { this.confirmations = []; this.timeoutCounter = 0; -} -/** - * Defines accessors for POLLINGTIMEOUT. This is the average block time (seconds) * TIMEOUTBLOCK - * - * Created empty setter that it acts like a constant. - */ -Object.defineProperty(TransactionConfirmationModel, 'POLLINGTIMEOUT', { - get: function () { - return 15 * this.TIMEOUTBLOCK; - }, - set: function () {}, - enumerable: true -}); + /** + * Defines accessors for POLLINGTIMEOUT. This is the average block time (seconds) * TIMEOUTBLOCK + * + * Created empty setter that it acts like a constant. + */ + Object.defineProperty(this, 'POLLINGTIMEOUT', { + get: function () { + return 15 * this.TIMEOUTBLOCK; + }, + set: function () {}, + enumerable: true + }); -/** - * Defines accessors for TIMEOUTBLOCK - * - * Created empty setter that it acts like a constant. - */ -Object.defineProperty(TransactionConfirmationModel, 'TIMEOUTBLOCK', { - get: function () { - return 50; - }, - set: function () {}, - enumerable: true -}); + /** + * Defines accessors for TIMEOUTBLOCK + * + * Created empty setter that it acts like a constant. + */ + Object.defineProperty(this, 'TIMEOUTBLOCK', { + get: function () { + return 50; + }, + set: function () {}, + enumerable: true + }); -/** - * Defines accessors for CONFIRMATIONBLOCKS - * - * Created empty setter that it acts like a constant. - */ -Object.defineProperty(TransactionConfirmationModel, 'CONFIRMATIONBLOCKS', { - get: function () { - return 24; - }, - set: function () {}, - enumerable: true -}); + /** + * Defines accessors for CONFIRMATIONBLOCKS + * + * Created empty setter that it acts like a constant. + */ + Object.defineProperty(this, 'CONFIRMATIONBLOCKS', { + get: function () { + return 24; + }, + set: function () {}, + enumerable: true + }); -/** - * Defines accessors for confirmationsCount - */ -Object.defineProperty(TransactionConfirmationModel, 'confirmationsCount', { - get: function () { - return this.confirmations.length; - }, - set: function () {}, - enumerable: true -}); + /** + * Defines accessors for confirmationsCount + */ + Object.defineProperty(this, 'confirmationsCount', { + get: function () { + return this.confirmations.length; + }, + set: function () {}, + enumerable: true + }); +} /** * Adds a receipt to the confirmation array From 591b3281b5336729471d8266a39f7dccee1b2906 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 13:53:05 +0200 Subject: [PATCH 0125/1045] call of AbstractMethodModel constructor and file name of GetPastLogsMethodModel fixed --- ...tPastLogslMethodModel.js => GetPastLogsMethodModel.js} | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) rename packages/web3-core-method/src/models/methods/{GetPastLogslMethodModel.js => GetPastLogsMethodModel.js} (93%) diff --git a/packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js similarity index 93% rename from packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js rename to packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index 6f1cf38a037..d9ab6d17748 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogslMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); * @constructor */ function GetPastLogsMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getLogs', - 1, - utils, - formatters, - ); + AbstractMethodModel.call(this, 'eth_getLogs', 1, utils, formatters); } /** From 969236cbdb6c2aa908421242a2908a81bcf9b646 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 13:54:42 +0200 Subject: [PATCH 0126/1045] GetStorageAtMethodModel code style improved and parameters removed as method parameter of beforeExecution in AbstractMethodModel --- .../web3-core-method/lib/models/AbstractMethodModel.js | 3 +-- .../src/models/methods/GetStorageAtMethodModel.js | 8 +------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 6a1aaadaf4b..068e29169f6 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -59,10 +59,9 @@ function AbstractMethodModel(rpcMethod, parametersAmount, utils, formatters) { * * @method beforeExecution * - * @param {Array} parameters * @param {Object} web3Package - The package where the method is called from for example Eth. */ -AbstractMethodModel.prototype.beforeExecution = function(parameters, web3Package) { }; +AbstractMethodModel.prototype.beforeExecution = function(web3Package) { }; /** * This method will be executed after the RPC request. diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index 7c08b3ffb3c..b9c82fda72f 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -31,13 +31,7 @@ var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); * @constructor */ function GetStorageAtMethodModel(utils, formatters) { - AbstractMethodModel.call( - this, - 'eth_getStorageAt', - 3, - utils, - formatters - ); + AbstractMethodModel.call(this, 'eth_getStorageAt', 3, utils, formatters); } /** From 451b6a6985298a24c32e1bf561e35b20fb5cfa24 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 14:08:16 +0200 Subject: [PATCH 0127/1045] clearSubscriptions in AbstractWeb3Object refactored --- packages/web3-core-package/src/AbstractWeb3Object.js | 2 +- .../web3-core-providers/src/adapters/HttpProviderAdapter.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 16f6dbfae16..fcdeea72f6b 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -129,7 +129,7 @@ AbstractWeb3Object.prototype.setProvider = function (provider) { * @method clearSubscriptions */ AbstractWeb3Object.prototype.clearSubscriptions = function () { - if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && this.currentProvider.subscriptions.length > 0) { + if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && this.currentProvider.hasSubscription()) { this.currentProvider.clearSubscriptions(); } }; diff --git a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js index 315a57eacd4..c43154a03df 100644 --- a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js @@ -29,7 +29,7 @@ var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapte * * @constructor */ -function HttpProviderAdapter (httpProvider) { +function HttpProviderAdapter(httpProvider) { AbstractProviderAdapter.call(this, httpProvider); } From 9297a8e0afac0dc8cb6d91633c07fa1a19513937 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 14:14:26 +0200 Subject: [PATCH 0128/1045] code syle improvements --- .../src/resolvers/ProviderAdapterResolver.js | 1 - packages/web3-core-subscription/src/Subscription.js | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index 723d0c8b49a..1ab46e44154 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -44,7 +44,6 @@ function ProviderAdapterResolver(providersPackageFactory) { * @returns {Object|Boolean} */ ProviderAdapterResolver.prototype.resolve = function (provider, net) { - if (typeof provider === 'string') { // HTTP if (/^http(s)?:\/\//i.test(provider)) { diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 457682b390f..110eccca441 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -27,7 +27,7 @@ var EventEmitter = require('eventemitter3'); /** * @param {Object} provider - * @param {String} method + * @param {String} subscriptionMethod * @param {Array} parameters * @param {Array} inputFormatters * @param {Function} outputFormatter @@ -35,9 +35,9 @@ var EventEmitter = require('eventemitter3'); * * @constructor */ -function Subscription(provider, method, parameters, inputFormatters, outputFormatter, subscriptionType) { +function Subscription(provider, subscriptionMethod, parameters, inputFormatters, outputFormatter, subscriptionType) { this.provider = provider; - this.method = method; + this.subscriptionMethod = subscriptionMethod; this.parameters = parameters; this.inputFormatters = inputFormatters; this.outputFormatter = outputFormatter; @@ -60,7 +60,7 @@ Subscription.prototype.subscribe = function (callback) { this.provider.subscribe( this.subscriptionType, - this.method, + this.subscriptionMethod, this.getFormattedInput() ).then(function (subscriptionId) { self.subscriptionId = subscriptionId; From 198a074c326c75f93e8b20ae710d2ee3a9c51462 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 18:11:43 +0200 Subject: [PATCH 0129/1045] prototype inheritance fixed --- packages/web3-core-method/src/commands/SendMethodCommand.js | 1 + .../web3-core-method/src/commands/SignAndSendMethodCommand.js | 1 + packages/web3-core-method/src/models/methods/CallMethodModel.js | 1 + .../src/models/methods/EstimateGasMethodModel.js | 1 + .../web3-core-method/src/models/methods/GetCodeMethodModel.js | 1 + .../src/models/methods/GetPastLogsMethodModel.js | 1 + .../src/models/methods/GetStorageAtMethodModel.js | 1 + packages/web3-core-method/src/models/methods/SignMethodModel.js | 1 + .../src/models/methods/account/GetAccountsMethodModel.js | 1 + .../src/models/methods/account/GetBalanceMethodModel.js | 1 + .../models/methods/account/GetTransactionCountMethodModel.js | 1 + .../src/models/methods/block/GetBlockMethodModel.js | 1 + .../src/models/methods/block/GetBlockNumberMethodModel.js | 1 + .../models/methods/block/GetBlockTransactionCountMethodModel.js | 1 + .../src/models/methods/block/GetBlockUncleCountMethodModel.js | 1 + .../src/models/methods/block/GetUncleMethodModel.js | 1 + .../src/models/methods/network/GetProtocolVersionMethodModel.js | 1 + .../src/models/methods/network/ListeningMethodModel.js | 1 + .../src/models/methods/network/PeerCountMethodModel.js | 1 + .../src/models/methods/network/VersionMethodModel.js | 1 + .../src/models/methods/node/GetCoinbaseMethodModel.js | 1 + .../src/models/methods/node/GetGasPriceMethodModel.js | 1 + .../src/models/methods/node/GetHashrateMethodModel.js | 1 + .../src/models/methods/node/GetNodeInfoMethodModel.js | 1 + .../src/models/methods/node/GetWorkMethodModel.js | 1 + .../src/models/methods/node/IsMiningMethodModel.js | 1 + .../src/models/methods/node/IsSyncingMethodModel.js | 1 + .../src/models/methods/node/SubmitWorkMethodModel.js | 1 + .../src/models/methods/personal/EcRecoverMethodModel.js | 1 + .../src/models/methods/personal/ImportRawKeyMethodModel.js | 1 + .../src/models/methods/personal/ListAccountsMethodModel.js | 1 + .../src/models/methods/personal/LockAccountMethodModel.js | 1 + .../src/models/methods/personal/NewAccountMethodModel.js | 1 + .../methods/personal/PersonalSendTransactionMethodModel.js | 1 + .../src/models/methods/personal/PersonalSignMethodModel.js | 1 + .../methods/personal/PersonalSignTransactionMethodModel.js | 1 + .../src/models/methods/personal/UnlockAccountMethodModel.js | 1 + .../src/models/methods/shh/AddPrivateKeyMethodModel.js | 1 + .../src/models/methods/shh/AddSymKeyMethodModel.js | 1 + .../src/models/methods/shh/DeleteKeyPairMethodModel.js | 1 + .../src/models/methods/shh/DeleteMessageFilterMethodModel.js | 1 + .../src/models/methods/shh/DeleteSymKeyMethodModel.js | 1 + .../models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js | 1 + .../src/models/methods/shh/GetFilterMessagesMethodModel.js | 1 + .../src/models/methods/shh/GetInfoMethodModel.js | 1 + .../src/models/methods/shh/GetPrivateKeyMethodModel.js | 1 + .../src/models/methods/shh/GetPublicKeyMethodModel.js | 1 + .../src/models/methods/shh/GetSymKeyMethodModel.js | 1 + .../src/models/methods/shh/HasKeyPairMethodModel.js | 1 + .../src/models/methods/shh/HasSymKeyMethodModel.js | 1 + .../src/models/methods/shh/MarkTrustedPeerMethodModel.js | 1 + .../src/models/methods/shh/NewKeyPairMethodModel.js | 1 + .../src/models/methods/shh/NewMessageFilterMethodModel.js | 1 + .../src/models/methods/shh/NewSymKeyMethodModel.js | 1 + .../web3-core-method/src/models/methods/shh/PostMethodModel.js | 1 + .../src/models/methods/shh/SetMaxMessageSizeMethodModel.js | 1 + .../src/models/methods/shh/SetMinPoWMethodModel.js | 1 + .../src/models/methods/shh/ShhVersionMethodModel.js | 1 + .../methods/transaction/GetTransactionFromBlockMethodModel.js | 1 + .../src/models/methods/transaction/GetTransactionMethodModel.js | 1 + .../methods/transaction/GetTransactionReceiptMethodModel.js | 1 + .../methods/transaction/SendSignedTransactionMethodModel.js | 1 + .../models/methods/transaction/SendTransactionMethodModel.js | 1 + .../models/methods/transaction/SignTransactionMethodModel.js | 1 + packages/web3-core-method/src/signers/MessageSigner.js | 2 +- packages/web3-core-method/src/signers/TransactionSigner.js | 2 +- .../web3-core-providers/src/adapters/HttpProviderAdapter.js | 1 + .../web3-core-providers/src/adapters/InpageProviderAdapter.js | 1 + .../web3-core-providers/src/adapters/SocketProviderAdapter.js | 1 + packages/web3-eth-accounts/src/Accounts.js | 1 + packages/web3-eth-accounts/src/factories/MethodModelFactory.js | 1 + packages/web3-eth-personal/src/Personal.js | 1 + packages/web3-eth-personal/src/factories/MethodModelFactory.js | 1 + packages/web3-eth/src/Eth.js | 1 + packages/web3-eth/src/factories/MethodModelFactory.js | 1 + packages/web3-eth/src/resolvers/SubscriptionsResolver.js | 1 + packages/web3-net/src/Network.js | 1 + packages/web3-net/src/factories/MethodModelFactory.js | 1 + packages/web3-shh/src/Shh.js | 1 + packages/web3-shh/src/factories/MethodModelFactory.js | 1 + 80 files changed, 80 insertions(+), 2 deletions(-) diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 88ed2a8ac9d..a69377548a9 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -67,5 +67,6 @@ SendMethodCommand.prototype.execute = function (web3Package, methodModel, provid }; SendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); +SendMethodCommand.prototype.constructor = SendMethodCommand; module.exports = SendMethodCommand; diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index 22c731e321b..198289ffcee 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -75,5 +75,6 @@ SignAndSendMethodCommand.prototype.execute = function ( }; SignAndSendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); +SignAndSendMethodCommand.prototype.constructor = SignAndSendMethodCommand; module.exports = SignAndSendMethodCommand; diff --git a/packages/web3-core-method/src/models/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js index 6eea2b53763..89ab00e4836 100644 --- a/packages/web3-core-method/src/models/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -47,5 +47,6 @@ CallMethodModel.prototype.beforeExecution = function (web3Package) { }; CallMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +CallMethodModel.prototype.constructor = CallMethodModel; module.exports = CallMethodModel; diff --git a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index 7b255bfc1e5..e982456c627 100644 --- a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -59,5 +59,6 @@ EstimateGasMethodModel.prototype.afterExecution = function (response) { }; EstimateGasMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +EstimateGasMethodModel.prototype.constructor = EstimateGasMethodModel; module.exports = EstimateGasMethodModel; diff --git a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index d249616d9af..ffdd3c09aaa 100644 --- a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -47,5 +47,6 @@ GetCodeMethodModel.prototype.beforeExecution = function (web3Package) { }; GetCodeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetCodeMethodModel.prototype.constructor = GetCodeMethodModel; module.exports = GetCodeMethodModel; diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index d9ab6d17748..6870bcad832 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -63,5 +63,6 @@ GetPastLogsMethodModel.prototype.afterExecution = function (response) { }; GetPastLogsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetPastLogsMethodModel.prototype.constructor = GetPastLogsMethodModel; module.exports = GetPastLogsMethodModel; diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index b9c82fda72f..8f0ea0df40a 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -48,5 +48,6 @@ GetStorageAtMethodModel.prototype.beforeExecution = function (web3Package) { }; GetStorageAtMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetStorageAtMethodModel.prototype.constructor = GetStorageAtMethodModel; module.exports = GetStorageAtMethodModel; diff --git a/packages/web3-core-method/src/models/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js index 1d71440e44a..1db45bdfca6 100644 --- a/packages/web3-core-method/src/models/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -49,5 +49,6 @@ SignMethodModel.prototype.beforeExecution = function (web3Package) { }; SignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SignMethodModel.prototype.constructor = SignMethodModel; module.exports = SignMethodModel; diff --git a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js index 7378a0eae81..0e744074b50 100644 --- a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js @@ -52,5 +52,6 @@ GetAccountsMethodModel.prototype.afterExecution = function (response) { }; GetAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetAccountsMethodModel.prototype.constructor = GetAccountsMethodModel; module.exports = GetAccountsMethodModel; diff --git a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index e18a34a5b80..6292db16be8 100644 --- a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -60,5 +60,6 @@ GetBalanceMethodModel.prototype.afterExecution = function(response) { }; GetBalanceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBalanceMethodModel.prototype.constructor = GetBalanceMethodModel; module.exports = GetBalanceMethodModel; diff --git a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index fcec23c178f..932e59f0ea8 100644 --- a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -60,5 +60,6 @@ GetTransactionCountMethodModel.prototype.afterExecution = function (response) { }; GetTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetTransactionCountMethodModel.prototype.constructor = GetTransactionCountMethodModel; module.exports = GetTransactionCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index edc253e9e63..887b1820c9c 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -64,5 +64,6 @@ GetBlockMethodModel.prototype.afterExecution = function(response) { }; GetBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBlockMethodModel.prototype.constructor = GetBlockMethodModel; module.exports = GetBlockMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js index 0ef3064bb0f..ac330105c7b 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js @@ -48,5 +48,6 @@ GetBlockNumberMethodModel.prototype.afterExecution = function (response) { }; GetBlockNumberMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBlockNumberMethodModel.prototype.constructor = GetBlockNumberMethodModel; module.exports = GetBlockNumberMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index bb773d33495..214793d3f52 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -63,5 +63,6 @@ GetBlockTransactionCountMethodModel.prototype.afterExecution = function (respons }; GetBlockTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBlockTransactionCountMethodModel.prototype.constructor = GetBlockTransactionCountMethodModel; module.exports = GetBlockTransactionCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index 4e65d2727b5..0a566a2f5f9 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -63,5 +63,6 @@ GetBlockUncleCountMethodModel.prototype.afterExecution = function (response) { }; GetBlockUncleCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBlockUncleCountMethodModel.prototype.constructor = GetBlockUncleCountMethodModel; module.exports = GetBlockUncleCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index 57a41d81156..ce8ae8bf9e9 100644 --- a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -64,5 +64,6 @@ GetUncleMethodModel.prototype.afterExecution = function (response) { }; GetUncleMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetUncleMethodModel.prototype.constructor = GetUncleMethodModel; module.exports = GetUncleMethodModel; diff --git a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js index 9f7df35a2bf..87deeebd483 100644 --- a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js @@ -35,5 +35,6 @@ function GetProtocolVersionMethodModel(utils, formatters) { } GetProtocolVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetProtocolVersionMethodModel.prototype.constructor = GetProtocolVersionMethodModel; module.exports = GetProtocolVersionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js index b45a923b8b9..af1d9a9013e 100644 --- a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js @@ -35,5 +35,6 @@ function ListeningMethodModel(utils, formatters) { } ListeningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +ListeningMethodModel.prototype.constructor = ListeningMethodModel; module.exports = ListeningMethodModel; diff --git a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js index 58a9e5fda26..0d5a96c331f 100644 --- a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js @@ -48,5 +48,6 @@ PeerCountMethodModel.prototype.afterExecution = function (response) { }; PeerCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +PeerCountMethodModel.prototype.constructor = PeerCountMethodModel; module.exports = PeerCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js index a2b5f9003b9..62345ce67c7 100644 --- a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js @@ -48,5 +48,6 @@ VersionMethodModel.prototype.afterExecution = function (response) { }; VersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +VersionMethodModel.prototype.constructor = VersionMethodModel; module.exports = VersionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js index 812e3de87f6..d21e9ccfb14 100644 --- a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js @@ -35,5 +35,6 @@ function GetCoinbaseMethodModel(utils, formatters) { } GetCoinbaseMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetCoinbaseMethodModel.prototype.constructor = GetCoinbaseMethodModel; module.exports = GetCoinbaseMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js index 29c6f129c6f..b8bc1fc239a 100644 --- a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js @@ -48,5 +48,6 @@ GetGasPriceMethodModel.prototype.afterExecution = function (response) { }; GetGasPriceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetGasPriceMethodModel.prototype.constructor = GetGasPriceMethodModel; module.exports = GetGasPriceMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js index 6afbb9f6cb4..d3d6055d823 100644 --- a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js @@ -48,5 +48,6 @@ GetHashrateMethodModel.prototype.afterExecution = function (response) { }; GetHashrateMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetHashrateMethodModel.prototype.constructor = GetHashrateMethodModel; module.exports = GetHashrateMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js index 7b4292e6348..4bca61e5cd0 100644 --- a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js @@ -35,5 +35,6 @@ function GetNodeInfoMethodModel(utils, formatters) { } GetNodeInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetNodeInfoMethodModel.prototype.constructor = GetNodeInfoMethodModel; module.exports = GetNodeInfoMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js index 166f8d35d9b..9c7a0748586 100644 --- a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js @@ -35,5 +35,6 @@ function GetWorkMethodModel(utils, formatters) { } GetWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetWorkMethodModel.prototype.constructor = GetWorkMethodModel; module.exports = GetWorkMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js index 0e71202c31f..8ca563db190 100644 --- a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js @@ -35,5 +35,6 @@ function IsMiningMethodModel(utils, formatters) { } IsMiningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +IsMiningMethodModel.prototype.constructor = IsMiningMethodModel; module.exports = IsMiningMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js index 770d93b6581..bf5c35c882b 100644 --- a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js @@ -48,5 +48,6 @@ IsSyncingMethodModel.prototype.afterExecution = function (response) { }; IsSyncingMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +IsSyncingMethodModel.prototype.constructor = IsSyncingMethodModel; module.exports = IsSyncingMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js index 5fa1ee15b71..198ebc1f0ed 100644 --- a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js @@ -35,5 +35,6 @@ function SubmitWorkMethodModel(utils, formatters) { } SubmitWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SubmitWorkMethodModel.prototype.constructor = SubmitWorkMethodModel; module.exports = SubmitWorkMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index dbe588f8960..f4786f5ca19 100644 --- a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -47,5 +47,6 @@ EcRecoverMethodModel.prototype.beforeExecution = function (web3Package) { }; EcRecoverMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +EcRecoverMethodModel.prototype.constructor = EcRecoverMethodModel; module.exports = EcRecoverMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js index 775519fee2d..f51224a1434 100644 --- a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js @@ -35,5 +35,6 @@ function ImportRawKeyMethodModel(utils, formatters) { } ImportRawKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +ImportRawKeyMethodModel.prototype.constructor = ImportRawKeyMethodModel; module.exports = ImportRawKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js index cf0e9beb6f8..943b2e0cd0f 100644 --- a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js @@ -52,5 +52,6 @@ ListAccountsMethodModel.prototype.afterExecution = function (response) { }; ListAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +ListAccountsMethodModel.prototype.constructor = ListAccountsMethodModel; module.exports = ListAccountsMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index 8d0ed3fdcda..c426561bacf 100644 --- a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -46,5 +46,6 @@ LockAccountMethodModel.prototype.beforeExecution = function (web3Package) { }; LockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +LockAccountMethodModel.prototype.constructor = LockAccountMethodModel; module.exports = LockAccountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js index 5a4cdc0bfd3..dc2d2873f60 100644 --- a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js @@ -48,5 +48,6 @@ NewAccountMethodModel.prototype.afterExecution = function (response) { }; NewAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +NewAccountMethodModel.prototype.constructor = NewAccountMethodModel; module.exports = NewAccountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index 0445e2577d3..1d7f939466a 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -46,5 +46,6 @@ PersonalSendTransactionMethodModel.prototype.beforeExecution = function (web3Pac }; PersonalSendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +PersonalSendTransactionMethodModel.prototype.constructor = PersonalSendTransactionMethodModel; module.exports = PersonalSendTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index 891bbc8befe..724c0c21a1a 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -47,5 +47,6 @@ PersonalSignMethodModel.prototype.beforeExecution = function (web3Package) { }; PersonalSignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +PersonalSignMethodModel.prototype.constructor = PersonalSignMethodModel; module.exports = PersonalSignMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js index a0d14f44611..bc80e49b30c 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js @@ -46,5 +46,6 @@ PersonalSignTransactionMethodModel.prototype.beforeExecution = function (web3Pac }; PersonalSignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +PersonalSignTransactionMethodModel.prototype.constructor = PersonalSignTransactionMethodModel; module.exports = PersonalSignTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index b542ab226d2..2e960632c54 100644 --- a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -46,5 +46,6 @@ UnlockAccountMethodModel.prototype.beforeExecution = function (web3Package) { }; UnlockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +UnlockAccountMethodModel.prototype.constructor = UnlockAccountMethodModel; module.exports = UnlockAccountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js index 5aeae17e5d5..ef1cbee78e1 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js @@ -35,5 +35,6 @@ function AddPrivateKeyMethodModel(utils, formatters) { } AddPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +AddPrivateKeyMethodModel.prototype.constructor = AddPrivateKeyMethodModel; module.exports = AddPrivateKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js index b7fc0d4f02a..215b3c5cfe9 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js @@ -35,5 +35,6 @@ function AddSymKeyMethodModel(utils, formatters) { } AddSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +AddSymKeyMethodModel.prototype.constructor = AddSymKeyMethodModel; module.exports = AddSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js index 5d4400a8198..6e937872a0a 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js @@ -35,5 +35,6 @@ function DeleteKeyPairMethodModel(utils, formatters) { } DeleteKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +DeleteKeyPairMethodModel.prototype.constructor = DeleteKeyPairMethodModel; module.exports = DeleteKeyPairMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js index 73975dd7df4..021c079d2b5 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js @@ -35,5 +35,6 @@ function DeleteMessageFilterMethodModel(utils, formatters) { } DeleteMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +DeleteMessageFilterMethodModel.prototype.constructor = DeleteMessageFilterMethodModel; module.exports = DeleteMessageFilterMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js index 591a193ee08..3e6057a59a4 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js @@ -35,5 +35,6 @@ function DeleteSymKeyMethodModel(utils, formatters) { } DeleteSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +DeleteSymKeyMethodModel.prototype.constructor = DeleteSymKeyMethodModel; module.exports = DeleteSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js index a59491c18ac..c0ed565fd68 100644 --- a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -35,5 +35,6 @@ function GenerateSymKeyFromPasswordMethodModel(utils, formatters) { } GenerateSymKeyFromPasswordMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GenerateSymKeyFromPasswordMethodModel.prototype.constructor = GenerateSymKeyFromPasswordMethodModel; module.exports = GenerateSymKeyFromPasswordMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js index d1aa2abb9ab..0efdb7da6bd 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js @@ -35,5 +35,6 @@ function GetFilterMessagesMethodModel(utils, formatters) { } GetFilterMessagesMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetFilterMessagesMethodModel.prototype.constructor = GetFilterMessagesMethodModel; module.exports = GetFilterMessagesMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js index c2f9a9c299c..b4bede65154 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js @@ -35,5 +35,6 @@ function GetInfoMethodModel(utils, formatters) { } GetInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetInfoMethodModel.prototype.constructor = GetInfoMethodModel; module.exports = GetInfoMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js index 5e25c6084cd..779136c3800 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js @@ -35,5 +35,6 @@ function GetPrivateKeyMethodModel(utils, formatters) { } GetPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetPrivateKeyMethodModel.prototype.constructor = GetPrivateKeyMethodModel; module.exports = GetPrivateKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js index 811700f798c..9d5a3334f1b 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js @@ -35,5 +35,6 @@ function GetPublicKeyMethodModel(utils, formatters) { } GetPublicKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetPublicKeyMethodModel.prototype.constructor = GetPublicKeyMethodModel; module.exports = GetPublicKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js index 0cecd136cc9..4380f344684 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js @@ -35,5 +35,6 @@ function GetSymKeyMethodModel(utils, formatters) { } GetSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetSymKeyMethodModel.prototype.constructor = GetSymKeyMethodModel; module.exports = GetSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js index 9c3d7f7e946..6a6adcdf3f7 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js @@ -35,5 +35,6 @@ function HasKeyPairMethodModel(utils, formatters) { } HasKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +HasKeyPairMethodModel.prototype.constructor = HasKeyPairMethodModel; module.exports = HasKeyPairMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js index a5f65d0e13f..344fb988be7 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js @@ -35,5 +35,6 @@ function HasSymKeyMethodModel(utils, formatters) { } HasSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +HasSymKeyMethodModel.prototype.constructor = HasSymKeyMethodModel; module.exports = HasSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js index e2190ab4e28..ca8f7a3f8df 100644 --- a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js @@ -35,5 +35,6 @@ function MarkTrustedPeerMethodModel(utils, formatters) { } MarkTrustedPeerMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +MarkTrustedPeerMethodModel.prototype.constructor = MarkTrustedPeerMethodModel; module.exports = MarkTrustedPeerMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js index baecd4d9997..3d7c28fd0ac 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js @@ -35,5 +35,6 @@ function NewKeyPairMethodModel(utils, formatters) { } NewKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +NewKeyPairMethodModel.prototype.constructor = NewKeyPairMethodModel; module.exports = NewKeyPairMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js index 71d35f65268..436dbe9b175 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js @@ -35,5 +35,6 @@ function NewMessageFilterMethodModel(utils, formatters) { } NewMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +NewMessageFilterMethodModel.prototype.constructor = NewMessageFilterMethodModel; module.exports = NewMessageFilterMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js index fe0b7409be8..f27661d067e 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js @@ -35,5 +35,6 @@ function NewSymKeyMethodModel(utils, formatters) { } NewSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +NewSymKeyMethodModel.prototype.constructor = NewSymKeyMethodModel; module.exports = NewSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js index 382db4d619f..a01896f48a3 100644 --- a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js @@ -35,5 +35,6 @@ function PostMethodModel(utils, formatters) { } PostMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +PostMethodModel.prototype.constructor = PostMethodModel; module.exports = PostMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js index 022d2b6f5ba..eadc83739c6 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js @@ -35,5 +35,6 @@ function SetMaxMessageSizeMethodModel(utils, formatters) { } SetMaxMessageSizeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SetMaxMessageSizeMethodModel.prototype.constructor = SetMaxMessageSizeMethodModel; module.exports = SetMaxMessageSizeMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js index 99a5da827a1..81ee9b6d70b 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js @@ -35,5 +35,6 @@ function SetMinPoWMethodModel(utils, formatters) { } SetMinPoWMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SetMinPoWMethodModel.prototype.constructor = SetMinPoWMethodModel; module.exports = SetMinPoWMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js index aef53d5d188..7dceb51d0d0 100644 --- a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js @@ -35,5 +35,6 @@ function ShhVersionMethodModel(utils, formatters) { } ShhVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +ShhVersionMethodModel.prototype.constructor = ShhVersionMethodModel; module.exports = ShhVersionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index f1be082e05c..79f61f6cb87 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -64,5 +64,6 @@ GetTransactionFromBlockMethodModel.prototype.afterExecution = function (response }; GetTransactionFromBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetTransactionFromBlockMethodModel.prototype.constructor = GetTransactionFromBlockMethodModel; module.exports = GetTransactionFromBlockMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js index f0388265c20..4d7476c2eed 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js @@ -48,5 +48,6 @@ GetTransactionMethodModel.prototype.afterExecution = function (response) { }; GetTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetTransactionMethodModel.prototype.constructor = GetTransactionMethodModel; module.exports = GetTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js index 1c8260e6cd6..42b950dc339 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js @@ -48,5 +48,6 @@ GetTransactionReceiptMethodModel.prototype.afterExecution = function (response) }; GetTransactionReceiptMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetTransactionReceiptMethodModel.prototype.constructor = GetTransactionReceiptMethodModel; module.exports = GetTransactionReceiptMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js index c52a3f491bf..7c830fd3b7a 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js @@ -35,5 +35,6 @@ function SendSignedTransactionMethodModel(utils, formatters) { } SendSignedTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SendSignedTransactionMethodModel.prototype.constructor = SendSignedTransactionMethodModel; module.exports = SendSignedTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index ff97eb9c596..f1c07b6fe4e 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -48,5 +48,6 @@ SendTransactionMethodModel.prototype.beforeExecution = function (web3Package) { }; SendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SendTransactionMethodModel.prototype.constructor = SendTransactionMethodModel; module.exports = SendTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index 6ceda876db4..cbf8576c7e7 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -46,5 +46,6 @@ SignTransactionMethodModel.prototype.beforeExecution = function (web3Package) { }; SignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SignTransactionMethodModel.prototype.constructor = SignTransactionMethodModel; module.exports = SignTransactionMethodModel; diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 4bc1592ca26..584b53811c0 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -51,6 +51,6 @@ MessageSigner.prototype.sign = function(data, address, accounts) { // Inherit from AbstractSigner MessageSigner.prototype = Object.create(AbstractSigner.prototype); -MessageSigner.prototype.constructor = AbstractSigner.prototype.constructor; +MessageSigner.prototype.constructor = MessageSigner; module.exports = MessageSigner; diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index 824131c8edf..ea3221cc930 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -56,6 +56,6 @@ TransactionSigner.prototype.sign = function (transaction, accounts) { // Inherit from AbstractSigner TransactionSigner.prototype = Object.create(AbstractSigner.prototype); -TransactionSigner.prototype.constructor = AbstractSigner.prototype.constructor; +TransactionSigner.prototype.constructor = TransactionSigner; module.exports = TransactionSigner; diff --git a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js index c43154a03df..f8fd9359c60 100644 --- a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js @@ -74,5 +74,6 @@ HttpProviderAdapter.prototype.isConnected = function () { }; HttpProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); +HttpProviderAdapter.prototype.constructor = HttpProviderAdapter; module.exports = HttpProviderAdapter; diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js index afea49bf6da..a1eaa923dc0 100644 --- a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js @@ -99,5 +99,6 @@ InpageProviderAdapter.prototype.isConnected = function () { }; InpageProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); +InpageProviderAdapter.prototype.constructor = InpageProviderAdapter; module.exports = InpageProviderAdapter; diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index 3117a0fb94a..a70a37422aa 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -168,5 +168,6 @@ SocketProviderAdapter.prototype.isConnected = function () { }; SocketProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); +SocketProviderAdapter.prototype.constructor = SocketProviderAdapter; module.exports = SocketProviderAdapter; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index da73ebd3d3f..4234040cb2c 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -460,6 +460,7 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { }; Accounts.prototype = Object.create(AbstractWeb3Object.prototype); +Accounts.prototype.constructor = Accounts; // Note: this is trying to follow closely the specs on diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js index 5608b7797fe..06ac28e8a49 100644 --- a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -42,5 +42,6 @@ function MethodModelFactory(utils, formatters) { } MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); +MethodModelFactory.prototype.constructor = MethodModelFactory; module.exports = MethodModelFactory; diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index c0e530d654a..14abdd3aa0c 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -80,6 +80,7 @@ Personal.prototype.setProvider = function (provider) { }; Personal.prototype = Object.create(AbstractWeb3Object); +Personal.prototype.constructor = Personal; module.exports = Personal; diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index 2c9331f880d..604fbd42d2d 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -48,5 +48,6 @@ function MethodModelFactory(utils, formatters) { } MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); +MethodModelFactory.prototype.constructor = MethodModelFactory; module.exports = MethodModelFactory; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 5da1c6ad9e3..56ad78ed669 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -153,5 +153,6 @@ Eth.prototype.setProvider = function (provider) { }; Eth.prototype = Object.create(AbstractWeb3Object.prototype); +Eth.prototype.constructor = Eth; module.exports = Eth; diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 9b3ef4867b8..470ad83803b 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -73,5 +73,6 @@ MethodModelFactory.prototype.createMethodModel = function (name) { }; MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); +MethodModelFactory.prototype.constructor = MethodModelFactory; module.exports = MethodModelFactory; diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index 852fe1aee20..d280fd50b3c 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -273,5 +273,6 @@ SubscriptionsResolver.prototype.hasFromBlockProperty = function (parameter) { }; SubscriptionsResolver.prototype = Object.create(AbstractWeb3Object); +SubscriptionsResolver.prototype.constructor = SubscriptionsResolver; module.exports = SubscriptionsResolver; diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index 3c06f208341..cb75807e9e7 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -96,5 +96,6 @@ Network.prototype.getNetworkType = function (callback) { }; Network.prototype = Object.create(AbstractWeb3Object.prototype); +Network.prototype.constructor = Network; module.exports = Network; diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index be5bcb8a315..1409c4fb669 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -43,5 +43,6 @@ function MethodModelFactory(utils, formatters) { } MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); +MethodModelFacotry.prototype.constructor = MethodModelFactory; module.exports = MethodModelFactory; diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index bccdb762f04..fad6e93c981 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -81,5 +81,6 @@ Shh.prototype.setProvider = function (provider) { }; Shh.prototype = Object.create(AbstractWeb3Object.prototype); +Shh.prototype.constructor = Shh; module.exports = Shh; diff --git a/packages/web3-shh/src/factories/MethodModelFactory.js b/packages/web3-shh/src/factories/MethodModelFactory.js index 6ae87ecbf6b..3d31e713fba 100644 --- a/packages/web3-shh/src/factories/MethodModelFactory.js +++ b/packages/web3-shh/src/factories/MethodModelFactory.js @@ -60,5 +60,6 @@ function MethodModelFactory(utils, formatters) { } MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); +MethodModelFactory.prototype.constructor = MethodModelFactory; module.exports = MethodModelFactory; From cb318b7a672a813c3b4e06f0fbdbc07ee62184fe Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 18:14:39 +0200 Subject: [PATCH 0130/1045] provider assertion in AbstractWeb3Object improved --- packages/web3-core-package/src/AbstractWeb3Object.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index fcdeea72f6b..838654f08c8 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -40,8 +40,13 @@ function AbstractWeb3Object( subscriptionPackage, batchRequestPackage ) { - if (!this.isDependencyGiven(providersPackage) && !this.isDependencyGiven(provider)) { - throw Error('Provider and the ProviderPackage not found!'); + + if (!this.isDependencyGiven(provider)) { + throw Error('Provider not found!'); + } + + if (!this.isDependencyGiven(providersPackage)) { + throw Error('ProviderPackage not found!'); } this.extendedPackages = []; From 6768d04c8c2d5ddb59988e0dd500b0f83b328137 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 18:22:26 +0200 Subject: [PATCH 0131/1045] isValidGasUsage fixed in TransactionReceiptValidator --- .../src/validators/TransactionReceiptValidator.js | 14 +++++++++++--- .../workflows/TransactionConfirmationWorkflow.js | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index dc9db022824..d97732c0317 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -33,11 +33,12 @@ function TransactionReceiptValidator() { } * @method validate * * @param {Object} receipt + * @param {Array} methodParameters * * @returns {Error | boolean} */ -TransactionReceiptValidator.prototype.validate = function (receipt) { - if (this.isValidGasUsage(receipt) && this.isValidReceiptStatus(receipt)) { +TransactionReceiptValidator.prototype.validate = function (receipt, methodParameters) { + if (this.isValidGasUsage(receipt, methodParameters) && this.isValidReceiptStatus(receipt)) { return true; } @@ -69,10 +70,17 @@ TransactionReceiptValidator.prototype.isValidReceiptStatus = function (receipt) * @method isValidGasUsage * * @param {Object} receipt + * @param {Array} methodParameters * * @returns {boolean} */ -TransactionReceiptValidator.prototype.isValidGasUsage = function (receipt) { +TransactionReceiptValidator.prototype.isValidGasUsage = function (receipt, methodParameters) { + var gasProvided = null; + + if(_.isObject(methodParameters[0]) && methodParameters[0].gas) { + gasProvided = methodParameters[0].gas; + } + return !receipt.outOfGas && (!gasProvided || gasProvided !== receipt.gasUsed); }; diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index f11e4ffc759..d7455bd76b6 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -76,7 +76,8 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, provi self.transactionConfirmationModel.timeoutCounter++; if (!self.transactionConfirmationModel.isTimeoutTimeExceeded()) { self.getTransactionReceipt(transactionHash).then(function (receipt) { - var validationResult = self.transactionReceiptValidator.validate(receipt); + var validationResult = self.transactionReceiptValidator.validate(receipt, methodModel.parameters); + if (validationResult === true) { self.transactionConfirmationModel.addConfirmation(receipt); promiEvent.eventEmitter.emit( From 3091dc5601a763c445d7dff2d1e0fb23068b80ee Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 23:12:45 +0200 Subject: [PATCH 0132/1045] default- and defaultBlock handling fixed in the eth and personal package --- packages/web3-core-package/src/AbstractWeb3Object.js | 1 - packages/web3-eth-personal/src/Personal.js | 3 ++- packages/web3-eth/src/Eth.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 838654f08c8..aa6758e3ede 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -40,7 +40,6 @@ function AbstractWeb3Object( subscriptionPackage, batchRequestPackage ) { - if (!this.isDependencyGiven(provider)) { throw Error('Provider not found!'); } diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 14abdd3aa0c..6b6fe5adef1 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -42,6 +42,7 @@ function Personal(provider, providersPackage, methodController, methodModelFacto this.utils = utils; this.formatters = formatters; this.net = net; + var defaultAccount = null; var defaultBlock = 'latest'; @@ -51,7 +52,7 @@ function Personal(provider, providersPackage, methodController, methodModelFacto }, set: function (val) { if(val) { - defaultAccount = utils.toChecksumAddress(formatters.inputAddressFormatter(val)); + defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); } }, enumerable: true diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 56ad78ed669..48ba39c8174 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -113,8 +113,8 @@ var Eth = function Eth( set: function (val) { defaultBlock = val; - self.Contract.defaultAccount = defaultBlock; - self.personal.defaultAccount = defaultBlock; + self.Contract.defaultBlock = defaultBlock; + self.personal.defaultBlock = defaultBlock; }, enumerable: true }); From df252cd572e0f6e8fb7ec2ca73682d7ef1e35251 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 20 Sep 2018 23:40:26 +0200 Subject: [PATCH 0133/1045] code style improvements --- .../src/commands/CallMethodCommand.js | 2 +- .../src/watchers/NewHeadsWatcher.js | 2 +- .../TransactionConfirmationWorkflow.js | 2 +- .../src/AbstractWeb3Object.js | 17 +++++++++++------ .../src/resolvers/ProviderAdapterResolver.js | 2 +- packages/web3-eth-accounts/src/Accounts.js | 2 +- packages/web3-eth-personal/src/Personal.js | 2 +- packages/web3-eth/src/Eth.js | 2 +- .../src/resolvers/SubscriptionsResolver.js | 2 +- packages/web3-net/src/Network.js | 2 +- packages/web3-shh/src/Shh.js | 2 +- packages/web3/src/index.js | 18 +++++++++--------- 12 files changed, 30 insertions(+), 25 deletions(-) diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 1692f908503..74b599fd78e 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -34,7 +34,7 @@ function CallMethodCommand() { } * * @param {AbstractWeb3Object} web3Package * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter} provider + * @param {AbstractProviderAdapter | EthereumProvider} provider * * @callback callback callback(error, result) * @returns {Promise} diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 7f8433077d0..39a5b82d51e 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -37,7 +37,7 @@ function NewHeadsWatcher(subscriptionPackage) { * * @method watch * - * @param {AbstractProviderAdapter} provider + * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {String} transactionHash * * @returns {this} diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index d7455bd76b6..d377fb5cb79 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -48,7 +48,7 @@ function TransactionConfirmationWorkflow( * @method execute * * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter} provider + * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {String} transactionHash * @param {Object} promiEvent * diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index aa6758e3ede..30b7160d249 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -23,7 +23,7 @@ "use strict"; /** - * @param {Object} provider + * @param {any} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory @@ -50,7 +50,7 @@ function AbstractWeb3Object( this.extendedPackages = []; this.providersPackage = providersPackage; - this._provider = this.providersPackage.resolve(provider); + this.currentProvider = provider; this.givenProvider = this.providersPackage.detect(); this.providers = { @@ -59,16 +59,21 @@ function AbstractWeb3Object( WebsocketProvider: this.providersPackage.WebsocketProvider, }; + var currentProvider = null; + + /** + * Defines the accessors of currentProvider + */ Object.defineProperty(this, 'currentProvider', { get: function () { - return this._provider; + return currentProvider; }, set: function (provider) { - if (typeof this._provider.clearSubscriptions !== 'undefined' && this._provider.subscriptions.length > 0) { - this._provider.clearSubscriptions(); + if (typeof currentProvider.clearSubscriptions !== 'undefined' && currentProvider.subscriptions.length > 0) { + currentProvider.clearSubscriptions(); } - this._provider = this.providersPackage.resolve(provider); + currentProvider = this.providersPackage.resolve(provider); }, enumerable: true }); diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index 1ab46e44154..eb517e04229 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -38,7 +38,7 @@ function ProviderAdapterResolver(providersPackageFactory) { * * @method resolve * - * @param {Object} provider + * @param {any} provider * @param {Net} net * * @returns {Object|Boolean} diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 4234040cb2c..7e3e25ab9d4 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -54,7 +54,7 @@ var makeEven = function (hex) { /** - * @param {any} provider + * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 6b6fe5adef1..abbf3a6d400 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -27,7 +27,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * TODO: Add missing documentation for getAccounts, lockAccount, importRawKey and sendTransaction! * - * @param {any} provider + * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 48ba39c8174..7b922da74b2 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -26,7 +26,7 @@ var _ = require('underscore'); var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {Object} provider + * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {Network} net * @param {Contract} contract * @param {Accounts} accounts diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index d280fd50b3c..6ada19151ed 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -25,7 +25,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {Object} provider + * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {Object} formatters * @param {Subscription} subscriptionPackage * @param {PromiEvent} promiEventPackage diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index cb75807e9e7..2450f03eefd 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -26,7 +26,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {Object} provider + * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index fad6e93c981..cffa4374152 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -25,7 +25,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {Object} provider + * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 954cf58ef93..764f21790a7 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -32,7 +32,7 @@ var NetworkPackage = require('web3-net'); var version = require('../package.json').version; /** - * @param {Object} provider + * @param {any} provider * @param {Net} net * * @constructor @@ -44,16 +44,16 @@ var Web3 = function Web3(provider, net) { throw new Error('No provider given as constructor parameter!'); } - this._provider = ProvidersPackage.resolve(provider, net); + var currentProvider = ProvidersPackage.resolve(provider, net); if (!this._provider) { throw new Error('Invalid provider given as constructor parameter!'); } this.utils = Utils; - this.eth = EthPackage.createEth(this._provider); - this.shh = ShhPackage.createShh(this._provider); - this.bzz = BzzPackage.createBzz(this._provider); + this.eth = EthPackage.createEth(this.currentProvider); + this.shh = ShhPackage.createShh(this.currentProvider); + this.bzz = BzzPackage.createBzz(this.currentProvider); /** * Defines accessors for connectionModel @@ -70,14 +70,14 @@ var Web3 = function Web3(provider, net) { Object.defineProperty(this, 'currentProvider', { get: function () { - return this._provider + return currentProvider; }, set: function (provider) { - if (typeof this._provider.clearSubscriptions !== 'undefined') { - this._provider.clearSubscriptions(); + if (typeof currentProvider.clearSubscriptions !== 'undefined') { + currentProvider.clearSubscriptions(); } - this._provider = ProvidersPackage.resolve(provider, net); + currentProvider = ProvidersPackage.resolve(provider); this.eth.setProvider(provider); this.shh.setProvider(provider); this.bzz.setProvider(provider); From 455c59328dbab154baeecd69b3a8d7ca6db805ae Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 21 Sep 2018 11:28:41 +0200 Subject: [PATCH 0134/1045] standard web3 provider detection added to ProviderAdapterResolver --- .../src/resolvers/ProviderAdapterResolver.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index eb517e04229..7ad4d7a1a53 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -66,15 +66,23 @@ ProviderAdapterResolver.prototype.resolve = function (provider, net) { } } - if (provider.constructor.name === 'EthereumProvider') { - return provider; - } - if (_.isFunction(provider.sendAsync)) { return this.providersPackageFactory.createInpageProviderAdapter(provider); } - return false; + switch (provider.constructor.name) { + case 'EthereumProvider': + return provider; + case 'HttpProvider': + return this.providersPackageFactory.createHttpProviderAdapter(provider); + case 'WebsocketProvider': + return this.providersPackageFactory.createSocketProviderAdapter(provider); + case 'IpcProvider': + return this.providersPackageFactory.createSocketProviderAdapter(provider); + + } + + throw Error('Please provide an Web3 provider or the EthereumProvider'); }; module.exports = ProviderAdapterResolver; From 68bdf440b859ff54e6d77bf99779c036d2c71f91 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 21 Sep 2018 11:35:42 +0200 Subject: [PATCH 0135/1045] paths of method models updated --- packages/web3-core-method/src/index.js | 124 ++++++++++++------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 5a5f0feb4c4..3bf9692f2c2 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -32,82 +32,82 @@ var formatters = require('web3-core-helpers').formatters; // Methods // Network - var GetProtocolVersionMethodModel = require('./methods/network/GetProtocolVersionMethodModel'); - var VersionMethodModel = require('./methods/network/VersionMethodModel'); - var ListeningMethodModel = require('./methods/network/ListeningMethodModel'); - var PeerCountMethodModel = require('./methods/network/PeerCountMethodModel'); + var GetProtocolVersionMethodModel = require('./models/methods/network/GetProtocolVersionMethodModel'); + var VersionMethodModel = require('./models/methods/network/VersionMethodModel'); + var ListeningMethodModel = require('./models/methods/network/ListeningMethodModel'); + var PeerCountMethodModel = require('./models/methods/network/PeerCountMethodModel'); // Node - var GetNodeInfoMethodModel = require('./methods/node/GetNodeInfoMethodModel'); - var GetCoinbaseMethodModel = require('./methods/node/GetCoinbaseMethodModel'); - var IsMiningMethodModel = require('./methods/node/IsMiningMethodModel'); - var GetHashrateMethodModel = require('./methods/node/GetHashrateMethodModel'); - var IsSyncingMethodModel = require('./methods/node/IsSyncingMethodModel'); - var GetGasPriceMethodModel = require('./methods/node/GetGasPriceMethodModel'); - var SubmitWorkMethodModel = require('./methods/node/SubmitWorkMethodModel'); - var GetWorkMethodModel = require('./methods/node/GetWorkMethodModel'); + var GetNodeInfoMethodModel = require('./models/methods/node/GetNodeInfoMethodModel'); + var GetCoinbaseMethodModel = require('./models/methods/node/GetCoinbaseMethodModel'); + var IsMiningMethodModel = require('./models/methods/node/IsMiningMethodModel'); + var GetHashrateMethodModel = require('./models/methods/node/GetHashrateMethodModel'); + var IsSyncingMethodModel = require('./models/methods/node/IsSyncingMethodModel'); + var GetGasPriceMethodModel = require('./models/methods/node/GetGasPriceMethodModel'); + var SubmitWorkMethodModel = require('./models/methods/node/SubmitWorkMethodModel'); + var GetWorkMethodModel = require('./models/methods/node/GetWorkMethodModel'); // Account - var GetAccountsMethodModel = require('./methods/account/GetAccountsMethodModel'); - var GetBalanceMethodModel = require('./methods/account/GetBalanceMethodModel'); - var GetTransactionCountMethodModel = require('./methods/account/GetTransactionCountMethodModel'); + var GetAccountsMethodModel = require('./models/methods/account/GetAccountsMethodModel'); + var GetBalanceMethodModel = require('./models/methods/account/GetBalanceMethodModel'); + var GetTransactionCountMethodModel = require('./models/methods/account/GetTransactionCountMethodModel'); // Block - var GetBlockNumberMethodModel = require('./methods/block/GetBlockNumberMethodModel'); - var GetBlockMethodModel = require('./methods/block/GetBlockMethodModel'); - var GetUncleMethodModel = require('./methods/block/GetUncleMethodModel'); - var GetBlockTransactionCountMethodModel = require('./methods/block/GetBlockTransactionCountMethodModel'); - var GetBlockUncleCountMethodModel = require('./methods/block/GetBlockUncleCountMethodModel'); + var GetBlockNumberMethodModel = require('./models/methods/block/GetBlockNumberMethodModel'); + var GetBlockMethodModel = require('./models/methods/block/GetBlockMethodModel'); + var GetUncleMethodModel = require('./models/methods/block/GetUncleMethodModel'); + var GetBlockTransactionCountMethodModel = require('./models/methods/block/GetBlockTransactionCountMethodModel'); + var GetBlockUncleCountMethodModel = require('./models/methods/block/GetBlockUncleCountMethodModel'); // Transaction - var GetTransactionMethodModel = require('./methods/transaction/GetTransactionMethodModel'); - var GetTransactionFromBlockMethodModel = require('./methods/transaction/GetTransactionFromBlockMethodModel'); - var GetTransactionReceipt = require('./methods/transaction/GetTransactionReceipt'); - var SendSignedTransactionMethodModel = require('./methods/transaction/SendSignedTransactionMethodModel'); - var SignTransactionMethodModel = require('./methods/transaction/SignTransactionMethodModel'); - var SendTransactionMethodModel = require('./methods/transaction/SendTransactionMethodModel'); + var GetTransactionMethodModel = require('./models/methods/transaction/GetTransactionMethodModel'); + var GetTransactionFromBlockMethodModel = require('./models/methods/transaction/GetTransactionFromBlockMethodModel'); + var GetTransactionReceipt = require('./models/methods/transaction/GetTransactionReceipt'); + var SendSignedTransactionMethodModel = require('./models/methods/transaction/SendSignedTransactionMethodModel'); + var SignTransactionMethodModel = require('./models/methods/transaction/SignTransactionMethodModel'); + var SendTransactionMethodModel = require('./models/methods/transaction/SendTransactionMethodModel'); // Global - var GetCodeMethodModel = require('./methods/GetCodeMethodModel'); - var SignMethodModel = require('./methods/SignMethodModel'); - var CallMethodModel = require('./methods/CallMethodModel'); - var GetStroageAtMethodModel = require('./methods/GetStroageAtMethodModel'); - var EstimateGasMethodModel = require('./methods/EstimateGasMethodModel'); - var GetPastLogsMethodModel = require('./methods/GetPastLogsMethodModel'); + var GetCodeMethodModel = require('./models/methods/GetCodeMethodModel'); + var SignMethodModel = require('./models/methods/SignMethodModel'); + var CallMethodModel = require('./models/methods/CallMethodModel'); + var GetStroageAtMethodModel = require('./models/methods/GetStroageAtMethodModel'); + var EstimateGasMethodModel = require('./models/methods/EstimateGasMethodModel'); + var GetPastLogsMethodModel = require('./models/methods/GetPastLogsMethodModel'); // Personal - var EcRecoverMethodModel = require('./methods/personal/EcRecoverMethodModel'); - var ImportRawKeyMethodModel = require('./methods/personal/ImportRawKeyMethodModel'); - var ListAccountsMethodModel = require('./methods/personal/ListAccountsMethodModel'); - var LockAccountMethodModel = require('./methods/personal/LockAccountMethodModel'); - var NewAccountMethodModel = require('./methods/personal/NewAccountMethodModel'); - var PersonalSendTransactionMethodModel = require('./methods/personal/PersonalSendTransactionMethodModel'); - var PersonalSignMethodModel = require('./methods/personal/PersonalSignMethodModel'); - var PersonalSignTransactionMethodModel = require('./methods/personal/PersonalSignTransactionMethodModel'); - var UnlockAccountMethodModel = require('./methods/personal/UnlockAccountMethodModel'); + var EcRecoverMethodModel = require('./models/methods/personal/EcRecoverMethodModel'); + var ImportRawKeyMethodModel = require('./models/methods/personal/ImportRawKeyMethodModel'); + var ListAccountsMethodModel = require('./models/methods/personal/ListAccountsMethodModel'); + var LockAccountMethodModel = require('./models/methods/personal/LockAccountMethodModel'); + var NewAccountMethodModel = require('./models/methods/personal/NewAccountMethodModel'); + var PersonalSendTransactionMethodModel = require('./models/methods/personal/PersonalSendTransactionMethodModel'); + var PersonalSignMethodModel = require('./models/methods/personal/PersonalSignMethodModel'); + var PersonalSignTransactionMethodModel = require('./models/methods/personal/PersonalSignTransactionMethodModel'); + var UnlockAccountMethodModel = require('./models/methods/personal/UnlockAccountMethodModel'); // SHH - var AddPrivateKeyMethodModel = require('./methods/shh/AddPrivateKeyMethodModel'); - var AddSymKeyMethodModel = require('./methods/shh/AddSymKeyMethodModel'); - var DeleteKeyPairMethodModel = require('./methods/shh/DeleteKeyPairMethodModel'); - var DeleteMessageFilterMethodModel = require('./methods/shh/DeleteMessageFilterMethodModel'); - var DeleteSymKeyMethodModel = require('./methods/shh/DeleteSymKeyMethodModel'); - var GenerateSymKeyFromPasswordMethodModel = require('./methods/shh/GenerateSymKeyFromPasswordMethodModel'); - var GetFilterMessagesMethodModel = require('./methods/shh/GetFilterMessagesMethodModel'); - var GetInfoMethodModel = require('./methods/shh/GetInfoMethodModel'); - var GetPrivateKeyMethodModel = require('./methods/shh/GetPrivateKeyMethodModel'); - var GetPublicKeyMethodModel = require('./methods/shh/GetPublicKeyMethodModel'); - var GetSymKeyMethodModel = require('./methods/shh/GetSymKeyMethodModel'); - var HasKeyPairMethodModel = require('./methods/shh/HasKeyPairMethodModel'); - var HasSymKeyMethodModel = require('./methods/shh/HasSymKeyMethodModel'); - var MarkTrustedPeerMethodModel = require('./methods/shh/MarkTrustedPeerMethodModel'); - var NewKeyPairMethodModel = require('./methods/shh/NewKeyPairMethodModel'); - var NewMessageFilterMethodModel = require('./methods/shh/NewMessageFilterMethodModel'); - var NewSymKeyMethodModel = require('./methods/shh/NewSymKeyMethodModel'); - var PostMethodModel = require('./methods/shh/PostMethodModel'); - var SetMaxMessageSizeMethodModel = require('./methods/shh/SetMaxMessageSizeMethodModel'); - var SetMinPoWMethodModel = require('./methods/shh/SetMinPoWMethodModel'); - var ShhVersionMethodModel = require('./methods/shh/ShhVersionMethodModel'); + var AddPrivateKeyMethodModel = require('./models/methods/shh/AddPrivateKeyMethodModel'); + var AddSymKeyMethodModel = require('./models/methods/shh/AddSymKeyMethodModel'); + var DeleteKeyPairMethodModel = require('./models/methods/shh/DeleteKeyPairMethodModel'); + var DeleteMessageFilterMethodModel = require('./models/methods/shh/DeleteMessageFilterMethodModel'); + var DeleteSymKeyMethodModel = require('./models/methods/shh/DeleteSymKeyMethodModel'); + var GenerateSymKeyFromPasswordMethodModel = require('./models/methods/shh/GenerateSymKeyFromPasswordMethodModel'); + var GetFilterMessagesMethodModel = require('./models/methods/shh/GetFilterMessagesMethodModel'); + var GetInfoMethodModel = require('./models/methods/shh/GetInfoMethodModel'); + var GetPrivateKeyMethodModel = require('./models/methods/shh/GetPrivateKeyMethodModel'); + var GetPublicKeyMethodModel = require('./models/methods/shh/GetPublicKeyMethodModel'); + var GetSymKeyMethodModel = require('./models/methods/shh/GetSymKeyMethodModel'); + var HasKeyPairMethodModel = require('./models/methods/shh/HasKeyPairMethodModel'); + var HasSymKeyMethodModel = require('./models/methods/shh/HasSymKeyMethodModel'); + var MarkTrustedPeerMethodModel = require('./models/methods/shh/MarkTrustedPeerMethodModel'); + var NewKeyPairMethodModel = require('./models/methods/shh/NewKeyPairMethodModel'); + var NewMessageFilterMethodModel = require('./models/methods/shh/NewMessageFilterMethodModel'); + var NewSymKeyMethodModel = require('./models/methods/shh/NewSymKeyMethodModel'); + var PostMethodModel = require('./models/methods/shh/PostMethodModel'); + var SetMaxMessageSizeMethodModel = require('./models/methods/shh/SetMaxMessageSizeMethodModel'); + var SetMinPoWMethodModel = require('./models/methods/shh/SetMinPoWMethodModel'); + var ShhVersionMethodModel = require('./models/methods/shh/ShhVersionMethodModel'); module.exports = { version: version, From 4fa91756275858f05b7dded05ccc1bb4b1f9172d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 21 Sep 2018 11:56:35 +0200 Subject: [PATCH 0136/1045] SubscriptionsResolver refactored because of the new method handling and fixed some smaller issues --- packages/web3-eth/src/index.js | 16 ++++- .../src/resolvers/SubscriptionsResolver.js | 65 ++++++++++--------- 2 files changed, 46 insertions(+), 35 deletions(-) diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 7caa458fa30..6ae34a7852b 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -55,6 +55,8 @@ module.exports = { */ createEth: function (provider) { var accounts = AccountsPackage.createAccounts(provider); + var methodModelFactory = new MethodModelFactory(Utils, formatters, accounts); + var methodController = MethodPackage.createMethodController(); return new Eth( provider, @@ -68,9 +70,17 @@ module.exports = { Utils, formatters, ProvidersPackage, - new SubscriptionsResolver(provider, formatters, SubscriptionPackage, PromiEventPackage, ProvidersPackage), - MethodPackage.createMethodController(), - new MethodModelFactory(Utils, formatters, accounts), + new SubscriptionsResolver( + provider, + formatters, + SubscriptionPackage, + PromiEventPackage, + ProvidersPackage, + methodModelFactory, + methodController + ), + methodController, + methodModelFactory, BatchRequestPackage ); } diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index 6ada19151ed..11039097da5 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -30,11 +30,21 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {Subscription} subscriptionPackage * @param {PromiEvent} promiEventPackage * @param {ProvidersPackage} providersPackage + * @param {MethodModelFactory} methodModelFactory + * @param {MethodController} methodController * * @constructor */ -function SubscriptionsResolver(provider, formatters, subscriptionPackage, promiEventPackage, providersPackage) { - AbstractWeb3Object.call(this, provider, providersPackage, null, null, subscriptionPackage); +function SubscriptionsResolver( + provider, + formatters, + subscriptionPackage, + promiEventPackage, + providersPackage, + methodModelFactory, + methodController +) { + AbstractWeb3Object.call(this, provider, providersPackage, methodController, methodModelFactory, subscriptionPackage); this.formatters = formatters; this.promiEventPackage = promiEventPackage; } @@ -45,26 +55,22 @@ function SubscriptionsResolver(provider, formatters, subscriptionPackage, promiE * @method resolve * * @param {String} type - * @param {Array} parameters + * @param {Object} parameter * @param {Function} callback * * @callback callback callback(error, result) * @returns {eventifiedPromise | Subscription} */ -SubscriptionsResolver.prototype.resolve = function (type, parameters, callback) { +SubscriptionsResolver.prototype.resolve = function (type, parameter, callback) { switch (type) { case 'newBlockHeaders': return this.getSubscription('newHeads', null, null, this.formatters.outputBlockFormatter, callback); - break; case 'pendingTransactions': return this.getSubscription('newPendingTransactions', null, null, null, callback); - break; case 'logs': - return this.getLogsSubscription(parameters, callback); - break; + return this.getLogsSubscription(parameter, callback); case 'syncing': return this.getSyncingSubscription(callback); - break; default: throw Error('Unknown subscription: ' + type); } @@ -76,7 +82,7 @@ SubscriptionsResolver.prototype.resolve = function (type, parameters, callback) * @method getSubscription * * @param {String} type - * @param {Array} parameters + * @param {Object} parameter * @param {Function} inputFormatter * @param {Function} outputFormatter * @param {Function} callback @@ -84,15 +90,11 @@ SubscriptionsResolver.prototype.resolve = function (type, parameters, callback) * @callback callback callback(error, result) * @returns {Subscription} */ -SubscriptionsResolver.prototype.getSubscription = function (type, parameters, inputFormatter, outputFormatter, callback) { - if (!parameters) { - parameters = []; - } - +SubscriptionsResolver.prototype.getSubscription = function (type, parameter, inputFormatter, outputFormatter, callback) { return this.subscriptionPackage.createSubscription( this.currentProvider, type, - parameters, + [parameter], inputFormatter, outputFormatter, 'eth' @@ -104,22 +106,22 @@ SubscriptionsResolver.prototype.getSubscription = function (type, parameters, in * * @method getLogsSubscription * - * @param {Array} parameters + * @param {Object} parameter * @param {Function} callback * * @callback callback callback(error, result) * @returns {eventifiedPromise} */ -SubscriptionsResolver.prototype.getLogsSubscription = function (parameters, callback) { +SubscriptionsResolver.prototype.getLogsSubscription = function (parameter, callback) { var promiEvent = this.promiEventPackage.createPromiEvent(); - if (this.hasFromBlockProperty(parameters[1])) { - this.handleLogsSubscriptionWithFromBlock(parameters, promiEvent, callback); + if (this.hasFromBlockProperty(parameter)) { + this.handleLogsSubscriptionWithFromBlock(parameter, promiEvent, callback); return promiEvent; } - this.subscribeToLogs(parameters, promiEvent, callback); + this.subscribeToLogs(parameter, promiEvent, callback); return promiEvent; }; @@ -129,16 +131,16 @@ SubscriptionsResolver.prototype.getLogsSubscription = function (parameters, call * * @method subscribeToLogs * - * @param {Array} parameters + * @param {Object} parameter * @param {PromiEvent} promiEvent * @param {Function} callback * * @callback callback callback(error, result) */ -SubscriptionsResolver.prototype.subscribeToLogs = function (parameters, promiEvent, callback) { +SubscriptionsResolver.prototype.subscribeToLogs = function (parameter, promiEvent, callback) { this.getSubscription( 'logs', - parameters, + parameter, null, this.formatters.outputLogFormatter, function (error, logs) { @@ -162,24 +164,23 @@ SubscriptionsResolver.prototype.subscribeToLogs = function (parameters, promiEve * * @method handleLogsSubscriptionWithFromBlock * - * @param {Array} parameters + * @param {Object} parameter * @param {PromiEvent} promiEvent * @param {Function} callback * * @callback callback callback(error,result) */ -SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function (parameters, promiEvent, callback) { +SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function (parameter, promiEvent, callback) { var self = this; - this.currentProvider.send('eth_getLogs', parameters).then(function (logs) { + this.getLogs(parameter).then(function (logs) { logs.forEach(function (log) { - var output = self.formatters.outputLogFormatter(log); - callback(false, output); - promiEvent.eventEmitter.emit('data', output); + callback(false, log); + promiEvent.eventEmitter.emit('data', log); }); - delete parameters[1].fromBlock; + delete parameter.fromBlock; - self.subscribeToLogs(parameters, outputFormatter, promiEvent, callback); + self.subscribeToLogs(parameter, promiEvent, callback); }).catch(function (error) { promiEvent.eventEmitter.emit('error', error); From 84c9b7850ce906797aad1e31070ba60ecb6382ad Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 24 Sep 2018 16:23:06 +0200 Subject: [PATCH 0137/1045] methodModels will now be defined over the constructor in AbstractMethodModelFactory --- .../factories/AbstractMethodModelFactory.js | 6 +- .../src/factories/MethodModelFactory.js | 18 ++--- .../src/factories/MethodModelFactory.js | 30 ++++---- .../src/factories/MethodModelFactory.js | 70 ++++++++++--------- .../src/factories/MethodModelFactory.js | 19 ++--- .../src/factories/MethodModelFactory.js | 54 +++++++------- 6 files changed, 105 insertions(+), 92 deletions(-) diff --git a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js index f1cd0aea4f7..7144f3a6809 100644 --- a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js +++ b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js @@ -23,16 +23,16 @@ "use strict"; /** + * @param {Object} methodModels * @param {Utils} utils * @param {Object} formatters - * @param {Accounts} accounts * * @constructor */ -function AbstractMethodModelFactory(utils, formatters) { +function AbstractMethodModelFactory(methodModels, utils, formatters) { this.utils = utils; this.formatters = formatters; - this.methodModels = {}; + this.methodModels = methodModels; } AbstractMethodModelFactory.prototype.hasMethodModel = function (name) { diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js index 06ac28e8a49..a29e839aefa 100644 --- a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -31,14 +31,16 @@ var web3CoreMethod = require('web3-core-method'); * @constructor */ function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); - - this.methodModels = { - getGasPrice: web3CoreMethod.GetGasPriceMethodModel, - getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, - getId: web3CoreMethod.VersionMethodModel - }; - + web3CoreMethod.AbstractMethodModelFactory.call( + this, + { + getGasPrice: web3CoreMethod.GetGasPriceMethodModel, + getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, + getId: web3CoreMethod.VersionMethodModel + }, + utils, + formatters + ); } MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index 604fbd42d2d..b18a6abe918 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -31,20 +31,22 @@ var web3CoreMethod = require('web3-core-method'); * @constructor */ function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); - - this.methodModels = { - getAccounts: web3CoreMethod.GetAccountsMethodModel, - newAccount: web3CoreMethod.NewAccountMethodModel, - unlockAccount: web3CoreMethod.UnlockAccountMethodModel, - lockAccount: web3CoreMethod.LockAccountMethodModel, - importRawKey: web3CoreMethod.ImportRawKeyMethodModel, - sendTransaction: web3CoreMethod.PersonalSendTransactionMethodModel, - signTransaction: web3CoreMethod.PersonalSignTransactionMethodModel, - sign: web3CoreMethod.PersonalSignMethodModel, - ecRecover: web3CoreMethod.EcRecoverMethodModel - }; - + web3CoreMethod.AbstractMethodModelFactory.call( + this, + { + getAccounts: web3CoreMethod.GetAccountsMethodModel, + newAccount: web3CoreMethod.NewAccountMethodModel, + unlockAccount: web3CoreMethod.UnlockAccountMethodModel, + lockAccount: web3CoreMethod.LockAccountMethodModel, + importRawKey: web3CoreMethod.ImportRawKeyMethodModel, + sendTransaction: web3CoreMethod.PersonalSendTransactionMethodModel, + signTransaction: web3CoreMethod.PersonalSignTransactionMethodModel, + sign: web3CoreMethod.PersonalSignMethodModel, + ecRecover: web3CoreMethod.EcRecoverMethodModel + }, + utils, + formatters + ); } MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 470ad83803b..9b7f658a689 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -32,40 +32,44 @@ var web3CoreMethod = require('web3-core-method'); * @constructor */ function MethodModelFactory(utils, formatters, accounts) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters, accounts); - - this.methodModels = { - getNodeInfo: web3CoreMethod.GetNodeInfoMethodModel, - getProtocolVersion: web3CoreMethod.GetProtocolVersionMethodModel, - getCoinbase: web3CoreMethod.GetCoinbaseMethodModel, - isMining: web3CoreMethod.IsMiningMethodModel, - getHashrate: web3CoreMethod.GetHashrateMethodModel, - isSyncing: web3CoreMethod.IsSyncingMethodModel, - getGasPrice: web3CoreMethod.GetGasPriceMethodModel, - getAccounts: web3CoreMethod.GetAccountsMethodModel, - getBlockNumber: web3CoreMethod.GetBlockNumberMethodModel, - getBalance: web3CoreMethod.GetBalanceMethodModel, - getStorageAt: web3CoreMethod.GetStroageAtMethodModel, - getCode: web3CoreMethod.GetCodeMethodModel, - getBlock: web3CoreMethod.GetBlockMethodModel, - getUncle: web3CoreMethod.GetUncleMethodModel, - getBlockTransactionCount: web3CoreMethod.GetBlockTransactionCountMethodModel, - getBlockUncleCount: web3CoreMethod.GetBlockUncleCountMethodModel, - getTransaction: web3CoreMethod.GetTransactionMethodModel, - getTransactionFromBlock: web3CoreMethod.GetTransactionFromBlockMethodModel, - getTransactionReceipt: web3CoreMethod.GetTransactionReceipt, - getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, - sendSignedTransaction: web3CoreMethod.SendSignedTransactionMethodModel, - signTransaction: web3CoreMethod.SignTransactionMethodModel, - sendTransaction: web3CoreMethod.SendTransactionMethodModel, - sign: web3CoreMethod.SignMethodModel, - call: web3CoreMethod.CallMethodModel, - estimateGas: web3CoreMethod.EstimateGasMethodModel, - submitWork: web3CoreMethod.SubmitWorkMethodModel, - getWork: web3CoreMethod.GetWorkMethodModel, - getPastLogs: web3CoreMethod.GetPastLogsMethodModel - }; + this.accounts = accounts; + web3CoreMethod.AbstractMethodModelFactory.call( + this, + { + getNodeInfo: web3CoreMethod.GetNodeInfoMethodModel, + getProtocolVersion: web3CoreMethod.GetProtocolVersionMethodModel, + getCoinbase: web3CoreMethod.GetCoinbaseMethodModel, + isMining: web3CoreMethod.IsMiningMethodModel, + getHashrate: web3CoreMethod.GetHashrateMethodModel, + isSyncing: web3CoreMethod.IsSyncingMethodModel, + getGasPrice: web3CoreMethod.GetGasPriceMethodModel, + getAccounts: web3CoreMethod.GetAccountsMethodModel, + getBlockNumber: web3CoreMethod.GetBlockNumberMethodModel, + getBalance: web3CoreMethod.GetBalanceMethodModel, + getStorageAt: web3CoreMethod.GetStroageAtMethodModel, + getCode: web3CoreMethod.GetCodeMethodModel, + getBlock: web3CoreMethod.GetBlockMethodModel, + getUncle: web3CoreMethod.GetUncleMethodModel, + getBlockTransactionCount: web3CoreMethod.GetBlockTransactionCountMethodModel, + getBlockUncleCount: web3CoreMethod.GetBlockUncleCountMethodModel, + getTransaction: web3CoreMethod.GetTransactionMethodModel, + getTransactionFromBlock: web3CoreMethod.GetTransactionFromBlockMethodModel, + getTransactionReceipt: web3CoreMethod.GetTransactionReceipt, + getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, + sendSignedTransaction: web3CoreMethod.SendSignedTransactionMethodModel, + signTransaction: web3CoreMethod.SignTransactionMethodModel, + sendTransaction: web3CoreMethod.SendTransactionMethodModel, + sign: web3CoreMethod.SignMethodModel, + call: web3CoreMethod.CallMethodModel, + estimateGas: web3CoreMethod.EstimateGasMethodModel, + submitWork: web3CoreMethod.SubmitWorkMethodModel, + getWork: web3CoreMethod.GetWorkMethodModel, + getPastLogs: web3CoreMethod.GetPastLogsMethodModel + }, + utils, + formatters + ); } MethodModelFactory.prototype.createMethodModel = function (name) { diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index 1409c4fb669..7985c8ff27a 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -31,14 +31,17 @@ var web3CoreMethod = require('web3-core-method'); * @constructor */ function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); - - this.methodModels = { - getId: web3CoreMethod.VersionMethodModel, - getBlock: web3CoreMethod.GetBlockMethodModel, - isListening: web3CoreMethod.ListeningMethodModel, - getPeerCount: web3CoreMethod.PeerCountMethodModel, - }; + web3CoreMethod.AbstractMethodModelFactory.call( + this, + { + getId: web3CoreMethod.VersionMethodModel, + getBlock: web3CoreMethod.GetBlockMethodModel, + isListening: web3CoreMethod.ListeningMethodModel, + getPeerCount: web3CoreMethod.PeerCountMethodModel, + }, + utils, + formatters + ); } diff --git a/packages/web3-shh/src/factories/MethodModelFactory.js b/packages/web3-shh/src/factories/MethodModelFactory.js index 3d31e713fba..1db97939d4b 100644 --- a/packages/web3-shh/src/factories/MethodModelFactory.js +++ b/packages/web3-shh/src/factories/MethodModelFactory.js @@ -31,32 +31,34 @@ var web3CoreMethod = require('web3-core-method'); * @constructor */ function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call(this, utils, formatters); - - this.methodModels = { - getVersion: web3CoreMethod.ShhVersionMethodModel, - getInfo: web3CoreMethod.GetInfoMethodModel, - setMaxMessageSize: web3CoreMethod.SetMaxMessageSizeMethodModel, - setMinPoW: web3CoreMethod.SetMinPoWMethodModel, - markTrustedPeer: web3CoreMethod.MarkTrustedPeerMethodModel, - newKeyPair: web3CoreMethod.NewKeyPairMethodModel, - addPrivateKey: web3CoreMethod.AddPrivateKeyMethodModel, - deleteKeyPair: web3CoreMethod.DeleteKeyPairMethodModel, - hasKeyPair: web3CoreMethod.HasKeyPairMethodModel, - getPublicKey: web3CoreMethod.GetPublicKeyMethodModel, - getPrivateKey: web3CoreMethod.GetPrivateKeyMethodModel, - newSymKey: web3CoreMethod.NewSymKeyMethodModel, - addSymKey: web3CoreMethod.AddSymKeyMethodModel, - generateSymKeyFromPassword: web3CoreMethod.GenerateSymKeyFromPasswordMethodModel, - hasSymKey: web3CoreMethod.HasSymKeyMethodModel, - getSymKey: web3CoreMethod.GetSymKeyMethodModel, - deleteSymKey: web3CoreMethod.DeleteSymKeyMethodModel, - newMessageFilter: web3CoreMethod.NewMessageFilterMethodModel, - getFilterMessages: web3CoreMethod.GetFilterMessagesMethodModel, - deleteMessageFilter: web3CoreMethod.DeleteMessageFilterMethodModel, - post: web3CoreMethod.PostMethodModel, - }; - + web3CoreMethod.AbstractMethodModelFactory.call( + this, + { + getVersion: web3CoreMethod.ShhVersionMethodModel, + getInfo: web3CoreMethod.GetInfoMethodModel, + setMaxMessageSize: web3CoreMethod.SetMaxMessageSizeMethodModel, + setMinPoW: web3CoreMethod.SetMinPoWMethodModel, + markTrustedPeer: web3CoreMethod.MarkTrustedPeerMethodModel, + newKeyPair: web3CoreMethod.NewKeyPairMethodModel, + addPrivateKey: web3CoreMethod.AddPrivateKeyMethodModel, + deleteKeyPair: web3CoreMethod.DeleteKeyPairMethodModel, + hasKeyPair: web3CoreMethod.HasKeyPairMethodModel, + getPublicKey: web3CoreMethod.GetPublicKeyMethodModel, + getPrivateKey: web3CoreMethod.GetPrivateKeyMethodModel, + newSymKey: web3CoreMethod.NewSymKeyMethodModel, + addSymKey: web3CoreMethod.AddSymKeyMethodModel, + generateSymKeyFromPassword: web3CoreMethod.GenerateSymKeyFromPasswordMethodModel, + hasSymKey: web3CoreMethod.HasSymKeyMethodModel, + getSymKey: web3CoreMethod.GetSymKeyMethodModel, + deleteSymKey: web3CoreMethod.DeleteSymKeyMethodModel, + newMessageFilter: web3CoreMethod.NewMessageFilterMethodModel, + getFilterMessages: web3CoreMethod.GetFilterMessagesMethodModel, + deleteMessageFilter: web3CoreMethod.DeleteMessageFilterMethodModel, + post: web3CoreMethod.PostMethodModel, + }, + utils, + formatters + ); } MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); From ee339dd70ab80e9e0172528faddb0c3dae19ed69 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 25 Sep 2018 11:08:26 +0200 Subject: [PATCH 0138/1045] POC contract methods handling --- .../lib/models/AbstractMethodModel.js | 2 +- .../ContractEventSubscriptionsFactory.js | 81 ++++++++++++++ .../src/factories/ContractMethodsFactory.js | 99 +++++++++++++++++ .../src/models/ContractCallMethodModel.js | 45 ++++++++ .../src/models/ContractSendMethodModel.js | 45 ++++++++ .../ContractEventSubscriptionsProxy.js | 70 ++++++++++++ .../src/proxies/ContractMethodsProxy.js | 101 ++++++++++++++++++ 7 files changed, 442 insertions(+), 1 deletion(-) create mode 100644 packages/web3-eth-contract/src/factories/ContractEventSubscriptionsFactory.js create mode 100644 packages/web3-eth-contract/src/factories/ContractMethodsFactory.js create mode 100644 packages/web3-eth-contract/src/models/ContractCallMethodModel.js create mode 100644 packages/web3-eth-contract/src/models/ContractSendMethodModel.js create mode 100644 packages/web3-eth-contract/src/proxies/ContractEventSubscriptionsProxy.js create mode 100644 packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 068e29169f6..f2d957535f2 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -96,7 +96,7 @@ AbstractMethodModel.prototype.request = function () { * * @returns {Object} */ -AbstractMethodModel.mapFunctionArguments = function (args) { +AbstractMethodModel.prototype.mapFunctionArguments = function (args) { var parameters = args; var callback = null; diff --git a/packages/web3-eth-contract/src/factories/ContractEventSubscriptionsFactory.js b/packages/web3-eth-contract/src/factories/ContractEventSubscriptionsFactory.js new file mode 100644 index 00000000000..8baf72c685f --- /dev/null +++ b/packages/web3-eth-contract/src/factories/ContractEventSubscriptionsFactory.js @@ -0,0 +1,81 @@ +/* + 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 . + */ +/** + * @file ContractEventSubscriptionsFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {Array} eventAbiItems + * @param {ContractPackageFactory} contractPackageFactory + * @param {SubscriptionPackage} subscriptionPackage + * + * @constructor + */ +function ContractEventSubscriptionsFactory(eventAbiItems, contractPackageFactory, subscriptionPackage) { + this.eventAbiItems = eventAbiItems; + this.contractPackageFactory = contractPackageFactory; + this.subscriptionPackage = subscriptionPackage; +} + +/** + * Checks if an event exists on the contract by the given name + * + * @method hasEvent + * + * @param {String} name + * + * @returns {Boolean} + */ +ContractEventSubscriptionsFactory.prototype.hasEvent = function (name) { + return this.getEventFromAbi(name) !== undefined; +}; + +/** + * Returns an event from the contract if it exists otherwise it returns undefined + * + * @method getEventFromAbi + * + * @param {String} name + * + * @returns {Object|undefined} + */ +ContractEventSubscriptionsFactory.prototype.getEventFromAbi = function (name) { + return this.eventAbiItems.find(function (eventAbiItem) { + // check for all three name types (funcName, name, signature) + }); +}; + +/** + * TODO: SubscriptionModel is strange and maybe not needed overthink this solution + * + * Returns the subscription model for an event + * + * @method createEventSubscriptionModel + * + * @param {String} name + * + * @returns {Object} + */ +ContractEventSubscriptionsFactory.prototype.createEventSubscriptionModel = function (name) { + return this.contractPackageFactory.createEventSubscriptionModel( + this.eventAbiItems[name] + ); +}; diff --git a/packages/web3-eth-contract/src/factories/ContractMethodsFactory.js b/packages/web3-eth-contract/src/factories/ContractMethodsFactory.js new file mode 100644 index 00000000000..cc5b63b7710 --- /dev/null +++ b/packages/web3-eth-contract/src/factories/ContractMethodsFactory.js @@ -0,0 +1,99 @@ +/* + 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 . + */ +/** + * @file ContractMethodsFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {Array} methodAbiItems + * @param {ContractPackageFactory} contractPackageFactory + * + * @constructor + */ +function ContractMethodsFactory(methodAbiItems, contractPackageFactory) { + this.eventAbiItems = eventAbiItems; + this.contractPackageFactory = contractPackageFactory; +} + +/** + * Checks if an method exists on the contract by the given name + * + * @method hasMethod + * + * @param {String} name + * + * @returns {Boolean} + */ +ContractMethodsFactory.prototype.hasMethod = function (name) { + return this.getMethodFromAbi(name) !== undefined; +}; + +/** + * Returns an method from the contract if it exists otherwise it returns undefined + * + * @method getEventFromAbi + * + * @param {String} name + * + * @returns {Object|undefined} + */ +ContractMethodsFactory.prototype.getMethodFromAbi = function (name) { + return this.eventAbiItems.find(function (eventAbiItem) { + // check for all three name types (funcName, name, signature) + }); +}; + +/** + * Creates an method model by his name + * + * @method createEventSubscriptionModel + * + * @param {String} name + * + * @returns {Object} + */ +ContractMethodsFactory.prototype.createMethodModel = function (name) { + var method = this.getMethodFromAbi(name); + + if (this.isSend(method)) { + return this.contractPackageFactory.createSendMethodModel( + this.getMethodFromAbi(name) + ); + } + + return this.contractPackageFactory.createCallMethodModel( + this.getMethodFromAbi(name) + ); +}; + +/** + * Checks if the ABI item is an sendTransaction method + * + * @method isSend + * + * @param {Object} abiItem + * + * @returns {Boolean} + */ +ContractMethodsFactory.prototype.isSend = function (abiItem) { + // pseudo-code + return abiItem.type === 'send'; +}; diff --git a/packages/web3-eth-contract/src/models/ContractCallMethodModel.js b/packages/web3-eth-contract/src/models/ContractCallMethodModel.js new file mode 100644 index 00000000000..8dcdbbafbbb --- /dev/null +++ b/packages/web3-eth-contract/src/models/ContractCallMethodModel.js @@ -0,0 +1,45 @@ +/* + 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 . + */ +/** + * @file ContractCallMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var CallMethodModel = require('web3-core-method').CallMethodModel; + +function ContractCallMethodModel(abiItem, utils, formatters) { + CallMethodModel.call(this, utils, formatters); + this.contractMethodName = ''; + this.funcName = ''; + this.signature = ''; + this.requestOptions = null; + this.parameters = null; +} + +ContractCallMethodModel.prototype.beforeExecution = function (web3Package) { + // extend CallMethodModel beforeExecution (encoding and creation of tx object) +}; + +ContractCallMethodModel.prototype.afterExecution = function (web3Package) { + // extend CallMethodModel afterExecution (decoding) +}; + +ContractCallMethodModel.prototype = Object.create(CallMethodModel.prototype); +ContractCallMethodModel.prototype.constructor = ContractCallMethodModel; diff --git a/packages/web3-eth-contract/src/models/ContractSendMethodModel.js b/packages/web3-eth-contract/src/models/ContractSendMethodModel.js new file mode 100644 index 00000000000..15e52974afa --- /dev/null +++ b/packages/web3-eth-contract/src/models/ContractSendMethodModel.js @@ -0,0 +1,45 @@ +/* + 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 . + */ +/** + * @file ContractCallMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; + +function ContractSendMethodModel(abiItem, utils, formatters) { + SendTransactionMethodModel.call(this, utils, formatters); + this.contractMethodName = ''; + this.funcName = ''; + this.signature = ''; + this.requestOptions = null; + this.parameters = null; +} + +ContractSendMethodModel.prototype.beforeExecution = function (web3Package) { + // extend SendTransactionMethodModel beforeExecution (encoding and creation of tx object) +}; + +ContractSendMethodModel.prototype.afterExecution = function (web3Package) { + // extend SendTransactionMethodModel afterExecution (decoding) +}; + +ContractSendMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); +ContractSendMethodModel.prototype.constructor = ContractSendMethodModel; diff --git a/packages/web3-eth-contract/src/proxies/ContractEventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/ContractEventSubscriptionsProxy.js new file mode 100644 index 00000000000..41df04a8a34 --- /dev/null +++ b/packages/web3-eth-contract/src/proxies/ContractEventSubscriptionsProxy.js @@ -0,0 +1,70 @@ +/* + 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 . + */ +/** + * @file ContractEventSubscriptionsProxy.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {ContractEventSubscriptionsFactory} contractEventSubscriptionsFactory + * + * @constructor + */ +function ContractEventSubscriptionsProxy(contractEventSubscriptionsFactory) { + this.contractEventSubscriptionsFactory = contractEventSubscriptionsFactory; + + return new Proxy(this, { + get: this.proxyHandler + }); +} + +/** + * Checks if a contract event exists by the given name and returns the subscription otherwise it throws an error + * + * @method proxyHandler + * + * @param {Object} target + * @param {String} name + * + * @returns {Function|Error} + */ +ContractEventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { + if (this.contractEventSubscriptionsFactory.hasEvent(name)) { + var eventSubscriptionModel = this.contractEventSubscriptionsFactory.createEventSubscriptionModel(name); + + return function (options, callback) { + eventSubscriptionModel.options = options; + + return eventSubscriptionModel.subscription.subscribe(callback); + } + } + + if (name === 'allEvents') { + var allEventsSubscriptionModel = this.contractEventSubscriptionsFactory.getAllEventsModel(); + + return function (options, callback) { + allEventsSubscriptionModel.options = options; + + return allEventsSubscriptionModel.subscription.subscribe(callback); + } + } + + throw Error('Event with name "' + name + '" not found'); +}; diff --git a/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js b/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js new file mode 100644 index 00000000000..db26f6d8aab --- /dev/null +++ b/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js @@ -0,0 +1,101 @@ +/* + 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 . + */ +/** + * @file ContractMethodsProxy.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {ContractMethodsFactory} contractMethodsFactory + * @param {MethodController} methodController + * + * @constructor + */ +function ContractMethodsProxy(contractMethodsFactory, methodController) { + this.contractMethodsFactory = contractMethodsFactory; + this.methodController = methodController; + + return new Proxy(this, { + get: this.proxyHandler + }); +} + +/** + * Checks if a contract event exists by the given name and returns the subscription otherwise it throws an error + * + * @method proxyHandler + * + * @param {Object} target + * @param {String} name + * + * @returns {Function|Error} + */ +ContractMethodsProxy.prototype.proxyHandler = function (target, name) { + if (this.contractMethodsFactory.hasMethod(name)) { + var methodModel = this.contractMethodsFactory.createMethodModel(name); + var requestType = this.getRequestType(methodModel); + + var anonymousFunction = function () { + methodModel.parameters = arguments; + }; + + anonymousFunction[requestType] = function (options, callback) { + methodModel.requestOptions = options; + methodModel.callback = callback; + + return self.methodController.execute( + methodModel, + target.currentProvider, + target.accounts, + target + ); + }; + + anonymousFunction[requestType].request = methodModel.request; + + anonymousFunction.estimateGas = function () { + + }; + + anonymousFunction.encodeAbi = function () { + + }; + + } + + throw Error('Method with name "' + name + '" not found'); +}; + +/** + * Determines which type of JSON-RPC request it is. + * + * @method getRequestType + * + * @param {AbstractMethodModel} methodModel + * + * @returns {string} + */ +ContractMethodsProxy.prototype.getRequestType = function (methodModel) { + if (methodModel.constructor.name === 'ContractCallMethodModel') { + return 'call'; + } + + return 'send'; +}; From 3fdbb308ea0e442ab33e3f38b2f7d662b8aa4f9b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 25 Sep 2018 12:10:53 +0200 Subject: [PATCH 0139/1045] ContractMethodEncoder implemented --- .../src/encoders/ContractMethodEncoder.js | 78 +++++++++++++++++++ .../src/factories/ContractMethodsFactory.js | 2 +- .../src/models/ContractCallMethodModel.js | 7 +- .../src/models/ContractSendMethodModel.js | 15 +++- .../src/proxies/ContractMethodsProxy.js | 12 +-- 5 files changed, 106 insertions(+), 8 deletions(-) create mode 100644 packages/web3-eth-contract/src/encoders/ContractMethodEncoder.js diff --git a/packages/web3-eth-contract/src/encoders/ContractMethodEncoder.js b/packages/web3-eth-contract/src/encoders/ContractMethodEncoder.js new file mode 100644 index 00000000000..fa738e38a45 --- /dev/null +++ b/packages/web3-eth-contract/src/encoders/ContractMethodEncoder.js @@ -0,0 +1,78 @@ +/* + 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 . + */ +/** + * @file ContractMethodEncoder.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +function ContractMethodEncoder(abiCoder) { + this.abiCoder = abiCoder; +} + +/** + * Encodes the method with the given parameters + * + * @method encode + * + * @param {AbstractMethodModel} methodModel + * + * @returns {string} + */ +ContractMethodEncoder.prototype.encode = function (methodModel) { + var inputLength = 0; + var methodParameterTypes = []; + + if (_.isArray(this.methodModel.abiItem.inputs)) { + inputLength = this.methodModel.abiItem.inputs.length; + } + + if (inputLength !== this.methodModel.parameters.length) { + throw new Error( + 'The number of arguments is not matching the methods required number. You need to pass ' + + inputLength + + ' arguments.' + ); + } + + if (_.isArray(json.inputs)) { + methodParameterTypes = this.methodModel.abiItem.inputs; + } + + var encodedParameters = this.abiCoder.encodeParameters( + methodParameterTypes, + this.methodModel.parameters + ).replace('0x',''); + + if(this.methodModel.signature === 'constructor') { + if(!this.methodModel.deployData) { + throw new Error( + 'The contract has no contract data option set. This is necessary to append the constructor parameters.' + ); + } + + return this.methodModel.deployData + encodedParameters; + } + + if (this.methodModel.abiItem.type === 'function') { + return this.methodModel.signature + encodedParameters; + } + + return encodedParameters; +}; diff --git a/packages/web3-eth-contract/src/factories/ContractMethodsFactory.js b/packages/web3-eth-contract/src/factories/ContractMethodsFactory.js index cc5b63b7710..fa91882429b 100644 --- a/packages/web3-eth-contract/src/factories/ContractMethodsFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractMethodsFactory.js @@ -68,7 +68,7 @@ ContractMethodsFactory.prototype.getMethodFromAbi = function (name) { * * @param {String} name * - * @returns {Object} + * @returns {AbstractMethodModel} */ ContractMethodsFactory.prototype.createMethodModel = function (name) { var method = this.getMethodFromAbi(name); diff --git a/packages/web3-eth-contract/src/models/ContractCallMethodModel.js b/packages/web3-eth-contract/src/models/ContractCallMethodModel.js index 8dcdbbafbbb..a23a8874dd6 100644 --- a/packages/web3-eth-contract/src/models/ContractCallMethodModel.js +++ b/packages/web3-eth-contract/src/models/ContractCallMethodModel.js @@ -24,13 +24,14 @@ var CallMethodModel = require('web3-core-method').CallMethodModel; -function ContractCallMethodModel(abiItem, utils, formatters) { +function ContractCallMethodModel(abiItem, utils, formatters, contractMethodEncoder) { CallMethodModel.call(this, utils, formatters); this.contractMethodName = ''; this.funcName = ''; this.signature = ''; this.requestOptions = null; this.parameters = null; + this.contractMethodEncoder = contractMethodEncoder; } ContractCallMethodModel.prototype.beforeExecution = function (web3Package) { @@ -41,5 +42,9 @@ ContractCallMethodModel.prototype.afterExecution = function (web3Package) { // extend CallMethodModel afterExecution (decoding) }; +ContractCallMethodModel.prototype.getEncodedMethodAbi = function () { + return this.contractMethodEncoder.encode(this); +}; + ContractCallMethodModel.prototype = Object.create(CallMethodModel.prototype); ContractCallMethodModel.prototype.constructor = ContractCallMethodModel; diff --git a/packages/web3-eth-contract/src/models/ContractSendMethodModel.js b/packages/web3-eth-contract/src/models/ContractSendMethodModel.js index 15e52974afa..f46e80f342d 100644 --- a/packages/web3-eth-contract/src/models/ContractSendMethodModel.js +++ b/packages/web3-eth-contract/src/models/ContractSendMethodModel.js @@ -24,13 +24,15 @@ var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; -function ContractSendMethodModel(abiItem, utils, formatters) { +function ContractSendMethodModel(abiItem, utils, formatters, contractMethodEncoder) { SendTransactionMethodModel.call(this, utils, formatters); this.contractMethodName = ''; this.funcName = ''; this.signature = ''; this.requestOptions = null; this.parameters = null; + this.abiItem = abiItem; + this.contractMethodEncoder = contractMethodEncoder; } ContractSendMethodModel.prototype.beforeExecution = function (web3Package) { @@ -41,5 +43,16 @@ ContractSendMethodModel.prototype.afterExecution = function (web3Package) { // extend SendTransactionMethodModel afterExecution (decoding) }; +/** + * Encodes the method abi + * + * @method getEncodedMethodAbi + * + * @returns {string} + */ +ContractSendMethodModel.prototype.getEncodedMethodAbi = function () { + return this.contractMethodEncoder.encode(this); +}; + ContractSendMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); ContractSendMethodModel.prototype.constructor = ContractSendMethodModel; diff --git a/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js b/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js index db26f6d8aab..0d8e9829ca9 100644 --- a/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js @@ -71,13 +71,15 @@ ContractMethodsProxy.prototype.proxyHandler = function (target, name) { anonymousFunction[requestType].request = methodModel.request; anonymousFunction.estimateGas = function () { - - }; - - anonymousFunction.encodeAbi = function () { - + return self.methodController.execute( + self.contractMethodsFactory.createEstimateGasMethodModel(methodModel), + target.currentProvider, + target.accounts, + target + ); }; + anonymousFunction.encodeAbi = methodModel.getEncodedMethodAbi; } throw Error('Method with name "' + name + '" not found'); From 6376f9cb6866b087dcc969b5d00a6b3c14e87394 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 25 Sep 2018 12:12:33 +0200 Subject: [PATCH 0140/1045] Method encoding moved to methods proxy --- .../src/models/ContractCallMethodModel.js | 7 +------ .../src/models/ContractSendMethodModel.js | 14 +------------- .../src/proxies/ContractMethodsProxy.js | 6 ++++-- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/packages/web3-eth-contract/src/models/ContractCallMethodModel.js b/packages/web3-eth-contract/src/models/ContractCallMethodModel.js index a23a8874dd6..8dcdbbafbbb 100644 --- a/packages/web3-eth-contract/src/models/ContractCallMethodModel.js +++ b/packages/web3-eth-contract/src/models/ContractCallMethodModel.js @@ -24,14 +24,13 @@ var CallMethodModel = require('web3-core-method').CallMethodModel; -function ContractCallMethodModel(abiItem, utils, formatters, contractMethodEncoder) { +function ContractCallMethodModel(abiItem, utils, formatters) { CallMethodModel.call(this, utils, formatters); this.contractMethodName = ''; this.funcName = ''; this.signature = ''; this.requestOptions = null; this.parameters = null; - this.contractMethodEncoder = contractMethodEncoder; } ContractCallMethodModel.prototype.beforeExecution = function (web3Package) { @@ -42,9 +41,5 @@ ContractCallMethodModel.prototype.afterExecution = function (web3Package) { // extend CallMethodModel afterExecution (decoding) }; -ContractCallMethodModel.prototype.getEncodedMethodAbi = function () { - return this.contractMethodEncoder.encode(this); -}; - ContractCallMethodModel.prototype = Object.create(CallMethodModel.prototype); ContractCallMethodModel.prototype.constructor = ContractCallMethodModel; diff --git a/packages/web3-eth-contract/src/models/ContractSendMethodModel.js b/packages/web3-eth-contract/src/models/ContractSendMethodModel.js index f46e80f342d..cfa353837e7 100644 --- a/packages/web3-eth-contract/src/models/ContractSendMethodModel.js +++ b/packages/web3-eth-contract/src/models/ContractSendMethodModel.js @@ -24,7 +24,7 @@ var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; -function ContractSendMethodModel(abiItem, utils, formatters, contractMethodEncoder) { +function ContractSendMethodModel(abiItem, utils, formatters) { SendTransactionMethodModel.call(this, utils, formatters); this.contractMethodName = ''; this.funcName = ''; @@ -32,7 +32,6 @@ function ContractSendMethodModel(abiItem, utils, formatters, contractMethodEncod this.requestOptions = null; this.parameters = null; this.abiItem = abiItem; - this.contractMethodEncoder = contractMethodEncoder; } ContractSendMethodModel.prototype.beforeExecution = function (web3Package) { @@ -43,16 +42,5 @@ ContractSendMethodModel.prototype.afterExecution = function (web3Package) { // extend SendTransactionMethodModel afterExecution (decoding) }; -/** - * Encodes the method abi - * - * @method getEncodedMethodAbi - * - * @returns {string} - */ -ContractSendMethodModel.prototype.getEncodedMethodAbi = function () { - return this.contractMethodEncoder.encode(this); -}; - ContractSendMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); ContractSendMethodModel.prototype.constructor = ContractSendMethodModel; diff --git a/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js b/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js index 0d8e9829ca9..e0a03aabf1a 100644 --- a/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js @@ -25,12 +25,14 @@ /** * @param {ContractMethodsFactory} contractMethodsFactory * @param {MethodController} methodController + * @param {ContractMethodEncoder} contractMethodEncoder * * @constructor */ -function ContractMethodsProxy(contractMethodsFactory, methodController) { +function ContractMethodsProxy(contractMethodsFactory, methodController, contractMethodEncoder) { this.contractMethodsFactory = contractMethodsFactory; this.methodController = methodController; + this.contractMethodEncoder = contractMethodEncoder; return new Proxy(this, { get: this.proxyHandler @@ -79,7 +81,7 @@ ContractMethodsProxy.prototype.proxyHandler = function (target, name) { ); }; - anonymousFunction.encodeAbi = methodModel.getEncodedMethodAbi; + anonymousFunction.encodeAbi = this.contractMethodEncoder.encode(methodModel); } throw Error('Method with name "' + name + '" not found'); From a96d7637aa52f467001aeaa3bcb660fb6244d6f9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 25 Sep 2018 15:01:42 +0200 Subject: [PATCH 0141/1045] send, call & estimateGas method model created. MethodProxy refactored, MethodEncoder refactored, MethodsFactory extended --- .../src/decoders/MethodResponseDecoder.js | 62 +++++++++++++ ...tractMethodEncoder.js => MethodEncoder.js} | 92 +++++++++++++------ ...actory.js => EventSubscriptionsFactory.js} | 10 +- ...actMethodsFactory.js => MethodsFactory.js} | 56 +++++++++-- .../src/models/CallContractMethodModel.js | 79 ++++++++++++++++ .../src/models/ContractCallMethodModel.js | 45 --------- .../src/models/ContractSendMethodModel.js | 46 ---------- .../EstimateGasOfContractMethodModel.js | 64 +++++++++++++ .../src/models/SendMethodModel.js | 79 ++++++++++++++++ ...onsProxy.js => EventSubscriptionsProxy.js} | 16 ++-- ...ontractMethodsProxy.js => MethodsProxy.js} | 41 +++++---- 11 files changed, 431 insertions(+), 159 deletions(-) create mode 100644 packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js rename packages/web3-eth-contract/src/encoders/{ContractMethodEncoder.js => MethodEncoder.js} (50%) rename packages/web3-eth-contract/src/factories/{ContractEventSubscriptionsFactory.js => EventSubscriptionsFactory.js} (83%) rename packages/web3-eth-contract/src/factories/{ContractMethodsFactory.js => MethodsFactory.js} (57%) create mode 100644 packages/web3-eth-contract/src/models/CallContractMethodModel.js delete mode 100644 packages/web3-eth-contract/src/models/ContractCallMethodModel.js delete mode 100644 packages/web3-eth-contract/src/models/ContractSendMethodModel.js create mode 100644 packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js create mode 100644 packages/web3-eth-contract/src/models/SendMethodModel.js rename packages/web3-eth-contract/src/proxies/{ContractEventSubscriptionsProxy.js => EventSubscriptionsProxy.js} (71%) rename packages/web3-eth-contract/src/proxies/{ContractMethodsProxy.js => MethodsProxy.js} (63%) diff --git a/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js b/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js new file mode 100644 index 00000000000..73cfa25574d --- /dev/null +++ b/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js @@ -0,0 +1,62 @@ +/* + 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 . + */ +/** + * @file MethodResponseDecoder.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {ABICoder} abiCoder + * + * @constructor + */ +function MethodResponseDecoder(abiCoder) { + this.abiCoder = abiCoder; +} + +/** + * Decodes the method response + * + * @method decode + * + * @param {Array} methodOutputTypes + * @param {Array} response + * + * @returns {*} + */ +MethodResponseDecoder.prototype.decode = function (methodOutputTypes, response) { + if (!response) { + return null; + } + + if (response.length >= 2) { + response = response.slice(2); + } + + var result = this.abiCoder.decodeParameters(methodOutputTypes, response); + + if (result.__length__ === 1) { + return result[0]; + } + + delete result.__length__; + + return result; +}; diff --git a/packages/web3-eth-contract/src/encoders/ContractMethodEncoder.js b/packages/web3-eth-contract/src/encoders/MethodEncoder.js similarity index 50% rename from packages/web3-eth-contract/src/encoders/ContractMethodEncoder.js rename to packages/web3-eth-contract/src/encoders/MethodEncoder.js index fa738e38a45..73b6ca74188 100644 --- a/packages/web3-eth-contract/src/encoders/ContractMethodEncoder.js +++ b/packages/web3-eth-contract/src/encoders/MethodEncoder.js @@ -22,7 +22,12 @@ "use strict"; -function ContractMethodEncoder(abiCoder) { +/** + * @param {ABICoder} abiCoder + * + * @constructor + */ +function MethodEncoder(abiCoder) { this.abiCoder = abiCoder; } @@ -31,48 +36,77 @@ function ContractMethodEncoder(abiCoder) { * * @method encode * - * @param {AbstractMethodModel} methodModel + * @param {Array} contractMethodParameters + * @param {Object} abiItem + * @param {String} signature + * @param {String} deployData * * @returns {string} */ -ContractMethodEncoder.prototype.encode = function (methodModel) { - var inputLength = 0; - var methodParameterTypes = []; - - if (_.isArray(this.methodModel.abiItem.inputs)) { - inputLength = this.methodModel.abiItem.inputs.length; - } - - if (inputLength !== this.methodModel.parameters.length) { - throw new Error( - 'The number of arguments is not matching the methods required number. You need to pass ' - + inputLength + - ' arguments.' - ); - } - - if (_.isArray(json.inputs)) { - methodParameterTypes = this.methodModel.abiItem.inputs; - } +MethodEncoder.prototype.encode = function (contractMethodParameters, abiItem, signature, deployData) { + this.validateInputLength(abiItem, contractMethodParameters); var encodedParameters = this.abiCoder.encodeParameters( - methodParameterTypes, - this.methodModel.parameters - ).replace('0x',''); + this.getMethodParameterTypes(abiItem), + contractMethodParameters + ).replace('0x', ''); - if(this.methodModel.signature === 'constructor') { - if(!this.methodModel.deployData) { + if (signature === 'constructor') { + if (!deployData) { throw new Error( 'The contract has no contract data option set. This is necessary to append the constructor parameters.' ); } - return this.methodModel.deployData + encodedParameters; + return deployData + encodedParameters; } - if (this.methodModel.abiItem.type === 'function') { - return this.methodModel.signature + encodedParameters; + if (abiItem.type === 'function') { + return signature + encodedParameters; } return encodedParameters; }; + +/** + * Returns the method parameter types from the abi + * + * @method getMethodParameterTypes + * + * @param {Object} abiItem + * + * @returns {Array} + */ +MethodEncoder.prototype.getMethodParameterTypes = function (abiItem) { + var methodParameterTypes = []; + + if (_.isArray(abiItem.inputs)) { + methodParameterTypes = abiItem.inputs; + } + + return methodParameterTypes; +}; + +/** + * Validates the input length and throws an error if they are wrong + * + * @method validateInputLength + * + * @param {Object} abiItem + * @param {Array} contractMethodParameters + */ +MethodEncoder.prototype.validateInputLength = function (abiItem, contractMethodParameters) { + var inputLength = 0; + + if (_.isArray(abiItem.inputs)) { + inputLength = abiItem.inputs.length; + } + + if (inputLength !== contractMethodParameters.length) { + throw new Error( + 'The number of arguments is not matching the methods required number. You need to pass ' + + inputLength + + ' arguments.' + ); + } +}; diff --git a/packages/web3-eth-contract/src/factories/ContractEventSubscriptionsFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionsFactory.js similarity index 83% rename from packages/web3-eth-contract/src/factories/ContractEventSubscriptionsFactory.js rename to packages/web3-eth-contract/src/factories/EventSubscriptionsFactory.js index 8baf72c685f..cc35ecfc13e 100644 --- a/packages/web3-eth-contract/src/factories/ContractEventSubscriptionsFactory.js +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionsFactory.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file ContractEventSubscriptionsFactory.js + * @file EventSubscriptionsFactory.js * @author Samuel Furter * @date 2018 */ @@ -29,7 +29,7 @@ * * @constructor */ -function ContractEventSubscriptionsFactory(eventAbiItems, contractPackageFactory, subscriptionPackage) { +function EventSubscriptionsFactory(eventAbiItems, contractPackageFactory, subscriptionPackage) { this.eventAbiItems = eventAbiItems; this.contractPackageFactory = contractPackageFactory; this.subscriptionPackage = subscriptionPackage; @@ -44,7 +44,7 @@ function ContractEventSubscriptionsFactory(eventAbiItems, contractPackageFactory * * @returns {Boolean} */ -ContractEventSubscriptionsFactory.prototype.hasEvent = function (name) { +EventSubscriptionsFactory.prototype.hasEvent = function (name) { return this.getEventFromAbi(name) !== undefined; }; @@ -57,7 +57,7 @@ ContractEventSubscriptionsFactory.prototype.hasEvent = function (name) { * * @returns {Object|undefined} */ -ContractEventSubscriptionsFactory.prototype.getEventFromAbi = function (name) { +EventSubscriptionsFactory.prototype.getEventFromAbi = function (name) { return this.eventAbiItems.find(function (eventAbiItem) { // check for all three name types (funcName, name, signature) }); @@ -74,7 +74,7 @@ ContractEventSubscriptionsFactory.prototype.getEventFromAbi = function (name) { * * @returns {Object} */ -ContractEventSubscriptionsFactory.prototype.createEventSubscriptionModel = function (name) { +EventSubscriptionsFactory.prototype.createEventSubscriptionModel = function (name) { return this.contractPackageFactory.createEventSubscriptionModel( this.eventAbiItems[name] ); diff --git a/packages/web3-eth-contract/src/factories/ContractMethodsFactory.js b/packages/web3-eth-contract/src/factories/MethodsFactory.js similarity index 57% rename from packages/web3-eth-contract/src/factories/ContractMethodsFactory.js rename to packages/web3-eth-contract/src/factories/MethodsFactory.js index fa91882429b..38b1f176412 100644 --- a/packages/web3-eth-contract/src/factories/ContractMethodsFactory.js +++ b/packages/web3-eth-contract/src/factories/MethodsFactory.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file ContractMethodsFactory.js + * @file MethodsFactory.js * @author Samuel Furter * @date 2018 */ @@ -25,12 +25,27 @@ /** * @param {Array} methodAbiItems * @param {ContractPackageFactory} contractPackageFactory + * @param {Utils} utils + * @param {Object} formatters + * @param {MethodEncoder} methodEncoder + * @param {MethodResponseDecoder} methodResponseDecoder * * @constructor */ -function ContractMethodsFactory(methodAbiItems, contractPackageFactory) { - this.eventAbiItems = eventAbiItems; +function MethodsFactory( + methodAbiItems, + contractPackageFactory, + utils, + formatters, + methodEncoder, + methodResponseDecoder +) { + this.methodAbiItems = methodAbiItems; this.contractPackageFactory = contractPackageFactory; + this.utils = utils; + this.formatters = formatters; + this.methodEncoder = methodEncoder; + this.methodResponseDecoder = methodResponseDecoder; } /** @@ -42,7 +57,7 @@ function ContractMethodsFactory(methodAbiItems, contractPackageFactory) { * * @returns {Boolean} */ -ContractMethodsFactory.prototype.hasMethod = function (name) { +MethodsFactory.prototype.hasMethod = function (name) { return this.getMethodFromAbi(name) !== undefined; }; @@ -55,12 +70,31 @@ ContractMethodsFactory.prototype.hasMethod = function (name) { * * @returns {Object|undefined} */ -ContractMethodsFactory.prototype.getMethodFromAbi = function (name) { - return this.eventAbiItems.find(function (eventAbiItem) { +MethodsFactory.prototype.getMethodFromAbi = function (name) { + return this.methodAbiItems.find(function (methodAbiItem) { // check for all three name types (funcName, name, signature) }); }; +/** + * Return the EstimateGasOfContractMethodModel object + * + * @method createEstimateGasOfContractMethodModel + * + * @param {AbstractMethodModel} methodModel + * + * @returns {*} + */ +MethodsFactory.prototype.createEstimateGasOfContractMethodModel = function (methodModel) { + return this.contractPackageFactory.createEstimateGasOfContractMethodModel( + methodModel, + this.utils, + this.formatters, + this.methodEncoder, + this.methodResponseDecoder + ); +}; + /** * Creates an method model by his name * @@ -70,12 +104,16 @@ ContractMethodsFactory.prototype.getMethodFromAbi = function (name) { * * @returns {AbstractMethodModel} */ -ContractMethodsFactory.prototype.createMethodModel = function (name) { +MethodsFactory.prototype.createMethodModel = function (name) { var method = this.getMethodFromAbi(name); if (this.isSend(method)) { return this.contractPackageFactory.createSendMethodModel( - this.getMethodFromAbi(name) + this.getMethodFromAbi(name), + this.utils, + this.formatters, + this.methodEncoder, + this.methodResponseDecoder ); } @@ -93,7 +131,7 @@ ContractMethodsFactory.prototype.createMethodModel = function (name) { * * @returns {Boolean} */ -ContractMethodsFactory.prototype.isSend = function (abiItem) { +MethodsFactory.prototype.isSend = function (abiItem) { // pseudo-code return abiItem.type === 'send'; }; diff --git a/packages/web3-eth-contract/src/models/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/CallContractMethodModel.js new file mode 100644 index 00000000000..bbe7a4a5402 --- /dev/null +++ b/packages/web3-eth-contract/src/models/CallContractMethodModel.js @@ -0,0 +1,79 @@ +/* + 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 . + */ +/** + * @file CallContractMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var CallMethodModel = require('web3-core-method').CallMethodModel; + +/** + * @param {Object} abiItem + * @param {Utils} utils + * @param {Object} formatters + * @param {MethodEncoder} methodEncoder + * @param {MethodResponseDecoder} methodResponseDecoder + * + * @constructor + */ +function CallContractMethodModel(abiItem, utils, formatters, methodEncoder, methodResponseDecoder) { + CallContractMethodModel.call(this, utils, formatters); + this.contractMethodParameters = null; + this.abiItem = abiItem; + this.methodEncoder = methodEncoder; + this.methodResponseDecoder = methodResponseDecoder; + this.signature = ''; +} + +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +CallContractMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0]['data'] = self.methodEncoder.encode( + this.contractMethodParameters, + this.abiItem, + this.signature, + web3Package.contractOptions.data + ); + + CallMethodModel.prototype.beforeExecution.call(this, web3Package); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {*} + */ +CallContractMethodModel.prototype.afterExecution = function (response) { + return this.methodResponseDecoder.decode(this.abiItem, response); +}; + +CallContractMethodModel.prototype = Object.create(CallMethodModel.prototype); +CallContractMethodModel.prototype.constructor = CallContractMethodModel; + +module.exports = CallContractMethodModel; diff --git a/packages/web3-eth-contract/src/models/ContractCallMethodModel.js b/packages/web3-eth-contract/src/models/ContractCallMethodModel.js deleted file mode 100644 index 8dcdbbafbbb..00000000000 --- a/packages/web3-eth-contract/src/models/ContractCallMethodModel.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - 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 . - */ -/** - * @file ContractCallMethodModel.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var CallMethodModel = require('web3-core-method').CallMethodModel; - -function ContractCallMethodModel(abiItem, utils, formatters) { - CallMethodModel.call(this, utils, formatters); - this.contractMethodName = ''; - this.funcName = ''; - this.signature = ''; - this.requestOptions = null; - this.parameters = null; -} - -ContractCallMethodModel.prototype.beforeExecution = function (web3Package) { - // extend CallMethodModel beforeExecution (encoding and creation of tx object) -}; - -ContractCallMethodModel.prototype.afterExecution = function (web3Package) { - // extend CallMethodModel afterExecution (decoding) -}; - -ContractCallMethodModel.prototype = Object.create(CallMethodModel.prototype); -ContractCallMethodModel.prototype.constructor = ContractCallMethodModel; diff --git a/packages/web3-eth-contract/src/models/ContractSendMethodModel.js b/packages/web3-eth-contract/src/models/ContractSendMethodModel.js deleted file mode 100644 index cfa353837e7..00000000000 --- a/packages/web3-eth-contract/src/models/ContractSendMethodModel.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - 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 . - */ -/** - * @file ContractCallMethodModel.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; - -function ContractSendMethodModel(abiItem, utils, formatters) { - SendTransactionMethodModel.call(this, utils, formatters); - this.contractMethodName = ''; - this.funcName = ''; - this.signature = ''; - this.requestOptions = null; - this.parameters = null; - this.abiItem = abiItem; -} - -ContractSendMethodModel.prototype.beforeExecution = function (web3Package) { - // extend SendTransactionMethodModel beforeExecution (encoding and creation of tx object) -}; - -ContractSendMethodModel.prototype.afterExecution = function (web3Package) { - // extend SendTransactionMethodModel afterExecution (decoding) -}; - -ContractSendMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); -ContractSendMethodModel.prototype.constructor = ContractSendMethodModel; diff --git a/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js b/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js new file mode 100644 index 00000000000..be882c4caca --- /dev/null +++ b/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js @@ -0,0 +1,64 @@ +/* + 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 . + */ +/** + * @file EstimateGasOfContractMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; + +/** + * @param {AbstractMethodModel} contractMethodModel + * @param {Utils} utils + * @param {Object} formatters + * @param {MethodEncoder} methodEncoder + * + * @constructor + */ +function EstimateGasOfContractMethodModel(contractMethodModel, utils, formatters, methodEncoder) { + EstimateGasMethodModel.call(this, utils, formatters); + this.contractMethodParameters = contractMethodModel.contractMethodParameters; + this.abiItem = contractMethodModel.abiItem; + this.signature = contractMethodModel.signature; + this.methodEncoder = methodEncoder; +} + +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +EstimateGasOfContractMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0]['data'] = self.methodEncoder.encode( + this.contractMethodParameters, + this.abiItem, + this.signature, + web3Package.contractOptions.data + ); + + EstimateGasMethodModel.prototype.beforeExecution.call(this, web3Package); +}; + +EstimateGasOfContractMethodModel.prototype = Object.create(EstimateGasMethodModel.prototype); +EstimateGasOfContractMethodModel.prototype.constructor = EstimateGasOfContractMethodModel; + +module.exports = EstimateGasOfContractMethodModel; diff --git a/packages/web3-eth-contract/src/models/SendMethodModel.js b/packages/web3-eth-contract/src/models/SendMethodModel.js new file mode 100644 index 00000000000..bd34270e699 --- /dev/null +++ b/packages/web3-eth-contract/src/models/SendMethodModel.js @@ -0,0 +1,79 @@ +/* + 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 . + */ +/** + * @file SendMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; + +/** + * @param {Object} abiItem + * @param {Utils} utils + * @param {Object} formatters + * @param {MethodEncoder} methodEncoder + * @param {MethodResponseDecoder} methodResponseDecoder + * + * @constructor + */ +function SendMethodModel(abiItem, utils, formatters, methodEncoder, methodResponseDecoder) { + SendTransactionMethodModel.call(this, utils, formatters); + this.contractMethodParameters = null; + this.abiItem = abiItem; + this.methodEncoder = methodEncoder; + this.methodResponseDecoder = methodResponseDecoder; + this.signature = ''; +} + +/** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {Object} web3Package - The package where the method is called from for example Eth. + */ +SendMethodModel.prototype.beforeExecution = function (web3Package) { + this.parameters[0]['data'] = self.methodEncoder.encode( + this.contractMethodParameters, + this.abiItem, + this.signature, + web3Package.contractOptions.data + ); + this.parameters[0]['to'] = web3Package.contractOptions.address; + SendTransactionMethodModel.prototype.beforeExecution.call(this, web3Package); +}; + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {*} + */ +SendMethodModel.prototype.afterExecution = function (response) { + return this.methodResponseDecoder.decode(this.abiItem, response); +}; + +SendMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); +SendMethodModel.prototype.constructor = SendMethodModel; + +module.exports = SendMethodModel; diff --git a/packages/web3-eth-contract/src/proxies/ContractEventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js similarity index 71% rename from packages/web3-eth-contract/src/proxies/ContractEventSubscriptionsProxy.js rename to packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 41df04a8a34..8731a382be9 100644 --- a/packages/web3-eth-contract/src/proxies/ContractEventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file ContractEventSubscriptionsProxy.js + * @file EventSubscriptionsProxy.js * @author Samuel Furter * @date 2018 */ @@ -23,12 +23,12 @@ "use strict"; /** - * @param {ContractEventSubscriptionsFactory} contractEventSubscriptionsFactory + * @param {EventSubscriptionsFactory} eventSubscriptionsFactory * * @constructor */ -function ContractEventSubscriptionsProxy(contractEventSubscriptionsFactory) { - this.contractEventSubscriptionsFactory = contractEventSubscriptionsFactory; +function EventSubscriptionsProxy(eventSubscriptionsFactory) { + this.eventSubscriptionsFactory = eventSubscriptionsFactory; return new Proxy(this, { get: this.proxyHandler @@ -45,9 +45,9 @@ function ContractEventSubscriptionsProxy(contractEventSubscriptionsFactory) { * * @returns {Function|Error} */ -ContractEventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { - if (this.contractEventSubscriptionsFactory.hasEvent(name)) { - var eventSubscriptionModel = this.contractEventSubscriptionsFactory.createEventSubscriptionModel(name); +EventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { + if (this.eventSubscriptionsFactory.hasEvent(name)) { + var eventSubscriptionModel = this.eventSubscriptionsFactory.createEventSubscriptionModel(name); return function (options, callback) { eventSubscriptionModel.options = options; @@ -57,7 +57,7 @@ ContractEventSubscriptionsProxy.prototype.proxyHandler = function (target, name) } if (name === 'allEvents') { - var allEventsSubscriptionModel = this.contractEventSubscriptionsFactory.getAllEventsModel(); + var allEventsSubscriptionModel = this.eventSubscriptionsFactory.getAllEventsModel(); return function (options, callback) { allEventsSubscriptionModel.options = options; diff --git a/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js similarity index 63% rename from packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js rename to packages/web3-eth-contract/src/proxies/MethodsProxy.js index e0a03aabf1a..515af67865e 100644 --- a/packages/web3-eth-contract/src/proxies/ContractMethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file ContractMethodsProxy.js + * @file MethodsProxy.js * @author Samuel Furter * @date 2018 */ @@ -23,16 +23,16 @@ "use strict"; /** - * @param {ContractMethodsFactory} contractMethodsFactory + * @param {MethodsFactory} methodsFactory * @param {MethodController} methodController - * @param {ContractMethodEncoder} contractMethodEncoder + * @param {MethodEncoder} methodEncoder * * @constructor */ -function ContractMethodsProxy(contractMethodsFactory, methodController, contractMethodEncoder) { - this.contractMethodsFactory = contractMethodsFactory; +function MethodsProxy(methodsFactory, methodController, methodEncoder) { + this.methodsFactory = methodsFactory; this.methodController = methodController; - this.contractMethodEncoder = contractMethodEncoder; + this.methodEncoder = methodEncoder; return new Proxy(this, { get: this.proxyHandler @@ -49,18 +49,17 @@ function ContractMethodsProxy(contractMethodsFactory, methodController, contract * * @returns {Function|Error} */ -ContractMethodsProxy.prototype.proxyHandler = function (target, name) { - if (this.contractMethodsFactory.hasMethod(name)) { - var methodModel = this.contractMethodsFactory.createMethodModel(name); +MethodsProxy.prototype.proxyHandler = function (target, name) { + if (this.methodsFactory.hasMethod(name)) { + var methodModel = this.methodsFactory.createMethodModel(name); var requestType = this.getRequestType(methodModel); var anonymousFunction = function () { - methodModel.parameters = arguments; + methodModel.contractMethodParameters = arguments; }; - anonymousFunction[requestType] = function (options, callback) { - methodModel.requestOptions = options; - methodModel.callback = callback; + anonymousFunction[requestType] = function () { + methodModel.methodArguments = arguments; return self.methodController.execute( methodModel, @@ -73,15 +72,23 @@ ContractMethodsProxy.prototype.proxyHandler = function (target, name) { anonymousFunction[requestType].request = methodModel.request; anonymousFunction.estimateGas = function () { + var estimateGasOfContractMethodModel = self.methodFactory.createEstimateGasOfContractMethodModel(methodModel); + estimateGasOfContractMethodModel.methodArguments = arguments; + return self.methodController.execute( - self.contractMethodsFactory.createEstimateGasMethodModel(methodModel), + estimateGasOfContractMethodModel, target.currentProvider, target.accounts, target ); }; - anonymousFunction.encodeAbi = this.contractMethodEncoder.encode(methodModel); + anonymousFunction.encodeAbi = this.methodEncoder.encode( + methodModel.contractMethodParameters, + methodModel.abiItem, + methodModel.signature, + target.contractOptions.data + ); } throw Error('Method with name "' + name + '" not found'); @@ -96,8 +103,8 @@ ContractMethodsProxy.prototype.proxyHandler = function (target, name) { * * @returns {string} */ -ContractMethodsProxy.prototype.getRequestType = function (methodModel) { - if (methodModel.constructor.name === 'ContractCallMethodModel') { +MethodsProxy.prototype.getRequestType = function (methodModel) { + if (methodModel.constructor.name === 'CallContractMethodModel') { return 'call'; } From 75738f8c192991a3eace2856a00317bfee1ec80c Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 25 Sep 2018 15:17:36 +0200 Subject: [PATCH 0142/1045] handling of default options added to method models --- .../src/models/CallContractMethodModel.js | 34 +++++++++++++++++ .../EstimateGasOfContractMethodModel.js | 34 +++++++++++++++++ .../src/models/SendMethodModel.js | 37 ++++++++++++++++++- 3 files changed, 104 insertions(+), 1 deletion(-) diff --git a/packages/web3-eth-contract/src/models/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/CallContractMethodModel.js index bbe7a4a5402..6e4f3d6d236 100644 --- a/packages/web3-eth-contract/src/models/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/CallContractMethodModel.js @@ -57,9 +57,43 @@ CallContractMethodModel.prototype.beforeExecution = function (web3Package) { web3Package.contractOptions.data ); + this.parameters[0] = this.getOrSetDefaultOptions(this.parameters[0], web3Package); + CallMethodModel.prototype.beforeExecution.call(this, web3Package); }; +/** + * Use default values, if options are not available + * + * @method getOrSetDefaultOptions + * + * @param {Object} options the options gived by the user + * @param {Object} web3Package - The package where the method is called from for example Eth. + * + * @returns {Object} the options with gaps filled by defaults + */ +CallContractMethodModel.prototype.getOrSetDefaultOptions = function getOrSetDefaultOptions(options, web3Package) { + var from = null; + var gasPrice = null; + + if (options.gasPrice) { + gasPrice = String(options.gasPrice); + } + + if (options.from) { + from = this.utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)); + } + + options.from = from || web3Package.contractOptions.from; + options.gasPrice = gasPrice || web3Package.contractOptions.gasPrice; + options.gas = options.gas || options.gasLimit || web3Package.contractOptions.gas; + + // TODO replace with only gasLimit? + delete options.gasLimit; + + return options; +}; + /** * This method will be executed after the RPC request. * diff --git a/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js b/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js index be882c4caca..4dc1ac45d25 100644 --- a/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js @@ -55,9 +55,43 @@ EstimateGasOfContractMethodModel.prototype.beforeExecution = function (web3Packa web3Package.contractOptions.data ); + this.parameters[0] = this.getOrSetDefaultOptions(this.parameters[0], web3Package); + EstimateGasMethodModel.prototype.beforeExecution.call(this, web3Package); }; +/** + * Use default values, if options are not available + * + * @method getOrSetDefaultOptions + * + * @param {Object} options the options gived by the user + * @param {Object} web3Package - The package where the method is called from for example Eth. + * + * @returns {Object} the options with gaps filled by defaults + */ +EstimateGasOfContractMethodModel.prototype.getOrSetDefaultOptions = function getOrSetDefaultOptions(options, web3Package) { + var from = null; + var gasPrice = null; + + if (options.gasPrice) { + gasPrice = String(options.gasPrice); + } + + if (options.from) { + from = this.utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)); + } + + options.from = from || web3Package.contractOptions.from; + options.gasPrice = gasPrice || web3Package.contractOptions.gasPrice; + options.gas = options.gas || options.gasLimit || web3Package.contractOptions.gas; + + // TODO replace with only gasLimit? + delete options.gasLimit; + + return options; +}; + EstimateGasOfContractMethodModel.prototype = Object.create(EstimateGasMethodModel.prototype); EstimateGasOfContractMethodModel.prototype.constructor = EstimateGasOfContractMethodModel; diff --git a/packages/web3-eth-contract/src/models/SendMethodModel.js b/packages/web3-eth-contract/src/models/SendMethodModel.js index bd34270e699..3e1a6462d9f 100644 --- a/packages/web3-eth-contract/src/models/SendMethodModel.js +++ b/packages/web3-eth-contract/src/models/SendMethodModel.js @@ -56,7 +56,9 @@ SendMethodModel.prototype.beforeExecution = function (web3Package) { this.signature, web3Package.contractOptions.data ); - this.parameters[0]['to'] = web3Package.contractOptions.address; + + this.parameters[0] = this.getOrSetDefaultOptions(this.parameters[0], web3Package); + SendTransactionMethodModel.prototype.beforeExecution.call(this, web3Package); }; @@ -73,6 +75,39 @@ SendMethodModel.prototype.afterExecution = function (response) { return this.methodResponseDecoder.decode(this.abiItem, response); }; +/** + * Use default values, if options are not available + * + * @method getOrSetDefaultOptions + * + * @param {Object} options the options gived by the user + * @param {Object} web3Package - The package where the method is called from for example Eth. + * + * @returns {Object} the options with gaps filled by defaults + */ +SendMethodModel.prototype.getOrSetDefaultOptions = function getOrSetDefaultOptions(options, web3Package) { + var from = null; + var gasPrice = null; + + if (options.gasPrice) { + gasPrice = String(options.gasPrice); + } + + if (options.from) { + from = this.utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)); + } + + options.from = from || web3Package.contractOptions.from; + options.gasPrice = gasPrice || web3Package.contractOptions.gasPrice; + options.gas = options.gas || options.gasLimit || web3Package.contractOptions.gas; + options.to = web3Package.contractOptions.address; + + // TODO replace with only gasLimit? + delete options.gasLimit; + + return options; +}; + SendMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); SendMethodModel.prototype.constructor = SendMethodModel; From bdc95dcaa62f0a4a1a61b9ac4a650fcf45de7918 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 01:28:51 +0200 Subject: [PATCH 0143/1045] RpcMethodFactory, AbiMapper, MethodOptionsMapper, AbiItemModel, AbiModel, RpcMethodOptionsValidator and ContractPackageFactory created. MethodsProxy refactored for new contract method handling concept. MethodEncoder improved. MethodModels, MethodsFactory and EventSubscriptionsFactory removed. --- .../src/encoders/MethodEncoder.js | 26 +-- .../src/factories/ContractPackageFactory.js | 177 ++++++++++++++++++ .../factories/EventSubscriptionsFactory.js | 81 -------- .../src/factories/MethodsFactory.js | 137 -------------- .../src/factories/RpcMethodFactory.js | 80 ++++++++ .../src/mappers/AbiMapper.js | 125 +++++++++++++ .../src/mappers/MethodOptionsMapper.js | 60 ++++++ .../src/models/AbiItemModel.js | 46 +++++ .../web3-eth-contract/src/models/AbiModel.js | 94 ++++++++++ .../src/models/CallContractMethodModel.js | 113 ----------- .../EstimateGasOfContractMethodModel.js | 98 ---------- .../src/models/SendMethodModel.js | 114 ----------- .../src/proxies/EventSubscriptionsProxy.js | 18 +- .../src/proxies/MethodsProxy.js | 75 ++++---- .../validators/RpcMethodOptionsValidator.js | 83 ++++++++ 15 files changed, 712 insertions(+), 615 deletions(-) create mode 100644 packages/web3-eth-contract/src/factories/ContractPackageFactory.js delete mode 100644 packages/web3-eth-contract/src/factories/EventSubscriptionsFactory.js delete mode 100644 packages/web3-eth-contract/src/factories/MethodsFactory.js create mode 100644 packages/web3-eth-contract/src/factories/RpcMethodFactory.js create mode 100644 packages/web3-eth-contract/src/mappers/AbiMapper.js create mode 100644 packages/web3-eth-contract/src/mappers/MethodOptionsMapper.js create mode 100644 packages/web3-eth-contract/src/models/AbiItemModel.js create mode 100644 packages/web3-eth-contract/src/models/AbiModel.js delete mode 100644 packages/web3-eth-contract/src/models/CallContractMethodModel.js delete mode 100644 packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js delete mode 100644 packages/web3-eth-contract/src/models/SendMethodModel.js create mode 100644 packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js diff --git a/packages/web3-eth-contract/src/encoders/MethodEncoder.js b/packages/web3-eth-contract/src/encoders/MethodEncoder.js index 73b6ca74188..6264cb4ba2f 100644 --- a/packages/web3-eth-contract/src/encoders/MethodEncoder.js +++ b/packages/web3-eth-contract/src/encoders/MethodEncoder.js @@ -44,8 +44,6 @@ function MethodEncoder(abiCoder) { * @returns {string} */ MethodEncoder.prototype.encode = function (contractMethodParameters, abiItem, signature, deployData) { - this.validateInputLength(abiItem, contractMethodParameters); - var encodedParameters = this.abiCoder.encodeParameters( this.getMethodParameterTypes(abiItem), contractMethodParameters @@ -87,26 +85,4 @@ MethodEncoder.prototype.getMethodParameterTypes = function (abiItem) { return methodParameterTypes; }; -/** - * Validates the input length and throws an error if they are wrong - * - * @method validateInputLength - * - * @param {Object} abiItem - * @param {Array} contractMethodParameters - */ -MethodEncoder.prototype.validateInputLength = function (abiItem, contractMethodParameters) { - var inputLength = 0; - - if (_.isArray(abiItem.inputs)) { - inputLength = abiItem.inputs.length; - } - - if (inputLength !== contractMethodParameters.length) { - throw new Error( - 'The number of arguments is not matching the methods required number. You need to pass ' - + inputLength + - ' arguments.' - ); - } -}; +module.exports = MethodEncoder; diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js new file mode 100644 index 00000000000..8c395ddf810 --- /dev/null +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -0,0 +1,177 @@ +/* + 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 . + */ +/** + * @file MethodValidator.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbiModel = require('../models/AbiModel'); +var AbiItemModel = require('../models/AbiItemModel'); +var MethodEncoder = require('../encoders/MethodEncoder'); +var MethodResponseDecoder = require('../decoders/MethodResponseDecoder'); +var AbiMapper = require('../mappers/AbiMapper'); +var MethodOptionsMapper = require('../mappers/MethodOptionsMapper'); +var MethodsProxy = require('../proxies/MethodsProxy'); +var MethodValidator = require('../validators/MethodValidator'); +var RpcMethodFactory = require('../factories/RpcMethodFactory'); + +function ContractPackageFactory() { } + +/** + * Returns an object of AbiModel + * + * @method createAbiModel + * + * @param {Object} mappedAbi + * + * @returns {AbiModel} + */ +ContractPackageFactory.prototype.createAbiModel = function (mappedAbi) { + return new AbiModel(mappedAbi); +}; + +/** + * Returns an object of AbiItemModel + * + * @methode createAbiItemModel + * + * @param {Object} abiItem + * + * @returns {AbiItemModel} + */ +ContractPackageFactory.prototype.createAbiItemModel = function (abiItem) { + return new AbiItemModel(abiItem); +}; + +/** + * Returns an object of MethodEncoder + * + * @method createMethodEncoder + * + * @param {AbiCoder} abiCoder + * + * @returns {MethodEncoder} + */ +ContractPackageFactory.prototype.createMethodEncoder = function (abiCoder) { + return new MethodEncoder(abiCoder); +}; + +/** + * Returns an object of AbiMapper + * + * @method createAbiMapper + * + * @param {AbiCoder} abiCoder + * @param {Utils} utils + * + * @returns {AbiMapper} + */ +ContractPackageFactory.prototype.createAbiMapper = function (abiCoder, utils) { + return new AbiMapper(this, abiCoder, utils); +}; + +/** + * Returns an object of MethodResponseDecoder + * + * @method createMethodResponseDecoder + * + * @param {AbiCoder} abiCoder + * + * @returns {MethodResponseDecoder} + */ +ContractPackageFactory.prototype.createMethodResponseDecoder = function (abiCoder) { + return new MethodResponseDecoder(abiCoder); +}; + +/** + * Returns an object of MethodValidator + * + * @method createMethodValidator + * + * @param {Utils} utils + * + * @returns {MethodValidator} + */ +ContractPackageFactory.prototype.createMethodValidator = function (utils) { + return new MethodValidator(utils); +}; + +/** + * Returns an object of MethodOptionsMapper + * + * @returns MethodOptionsMapper + */ +ContractPackageFactory.prototype.createMethodOptionsMapper = function () { + return new MethodOptionsMapper(); +}; + +/** + * Returns an object of RpcMethodFactory + * + * @method createRpcMethodFactory + * + * @param {AbiCoder} abiCoder + * @param {MethodPackage} methodPackage + * @param {Utils} utils + * @param {Object} formatters + * + * @returns {RpcMethodFactory} + */ +ContractPackageFactory.prototype.createRpcMethodFactory = function (abiCoder, methodPackage, utils, formatters) { + return new RpcMethodFactory( + methodPackage, + this.createMethodOptionsMapper(), + this.createMethodEncoder(abiCoder), + utils, + formatters + ); +}; + +/** + * Returns an Object of MethodsProxy + * + * @method createMethodsProxy + * + * @param {AbiModel} abiModel + * @param methodPackage + * @param {MethodController} methodController + * @param {AbiCoder} abiCoder + * @param {Utils} utils + * @param {Object} formatters + * + * @returns {MethodsProxy} + */ +ContractPackageFactory.prototype.createMethodsProxy = function ( + abiModel, + methodPackage, + methodController, + abiCoder, + utils, + formatters +) { + return new MethodsProxy( + abiModel, + this.createRpcMethodFactory(abiCoder, methodPackage, utils, formatters), + methodController, + this.createMethodEncoder(abiCoder) + ); +}; + +module.exports = ContractPackageFactory; diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionsFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionsFactory.js deleted file mode 100644 index cc35ecfc13e..00000000000 --- a/packages/web3-eth-contract/src/factories/EventSubscriptionsFactory.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - 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 . - */ -/** - * @file EventSubscriptionsFactory.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -/** - * @param {Array} eventAbiItems - * @param {ContractPackageFactory} contractPackageFactory - * @param {SubscriptionPackage} subscriptionPackage - * - * @constructor - */ -function EventSubscriptionsFactory(eventAbiItems, contractPackageFactory, subscriptionPackage) { - this.eventAbiItems = eventAbiItems; - this.contractPackageFactory = contractPackageFactory; - this.subscriptionPackage = subscriptionPackage; -} - -/** - * Checks if an event exists on the contract by the given name - * - * @method hasEvent - * - * @param {String} name - * - * @returns {Boolean} - */ -EventSubscriptionsFactory.prototype.hasEvent = function (name) { - return this.getEventFromAbi(name) !== undefined; -}; - -/** - * Returns an event from the contract if it exists otherwise it returns undefined - * - * @method getEventFromAbi - * - * @param {String} name - * - * @returns {Object|undefined} - */ -EventSubscriptionsFactory.prototype.getEventFromAbi = function (name) { - return this.eventAbiItems.find(function (eventAbiItem) { - // check for all three name types (funcName, name, signature) - }); -}; - -/** - * TODO: SubscriptionModel is strange and maybe not needed overthink this solution - * - * Returns the subscription model for an event - * - * @method createEventSubscriptionModel - * - * @param {String} name - * - * @returns {Object} - */ -EventSubscriptionsFactory.prototype.createEventSubscriptionModel = function (name) { - return this.contractPackageFactory.createEventSubscriptionModel( - this.eventAbiItems[name] - ); -}; diff --git a/packages/web3-eth-contract/src/factories/MethodsFactory.js b/packages/web3-eth-contract/src/factories/MethodsFactory.js deleted file mode 100644 index 38b1f176412..00000000000 --- a/packages/web3-eth-contract/src/factories/MethodsFactory.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - 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 . - */ -/** - * @file MethodsFactory.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -/** - * @param {Array} methodAbiItems - * @param {ContractPackageFactory} contractPackageFactory - * @param {Utils} utils - * @param {Object} formatters - * @param {MethodEncoder} methodEncoder - * @param {MethodResponseDecoder} methodResponseDecoder - * - * @constructor - */ -function MethodsFactory( - methodAbiItems, - contractPackageFactory, - utils, - formatters, - methodEncoder, - methodResponseDecoder -) { - this.methodAbiItems = methodAbiItems; - this.contractPackageFactory = contractPackageFactory; - this.utils = utils; - this.formatters = formatters; - this.methodEncoder = methodEncoder; - this.methodResponseDecoder = methodResponseDecoder; -} - -/** - * Checks if an method exists on the contract by the given name - * - * @method hasMethod - * - * @param {String} name - * - * @returns {Boolean} - */ -MethodsFactory.prototype.hasMethod = function (name) { - return this.getMethodFromAbi(name) !== undefined; -}; - -/** - * Returns an method from the contract if it exists otherwise it returns undefined - * - * @method getEventFromAbi - * - * @param {String} name - * - * @returns {Object|undefined} - */ -MethodsFactory.prototype.getMethodFromAbi = function (name) { - return this.methodAbiItems.find(function (methodAbiItem) { - // check for all three name types (funcName, name, signature) - }); -}; - -/** - * Return the EstimateGasOfContractMethodModel object - * - * @method createEstimateGasOfContractMethodModel - * - * @param {AbstractMethodModel} methodModel - * - * @returns {*} - */ -MethodsFactory.prototype.createEstimateGasOfContractMethodModel = function (methodModel) { - return this.contractPackageFactory.createEstimateGasOfContractMethodModel( - methodModel, - this.utils, - this.formatters, - this.methodEncoder, - this.methodResponseDecoder - ); -}; - -/** - * Creates an method model by his name - * - * @method createEventSubscriptionModel - * - * @param {String} name - * - * @returns {AbstractMethodModel} - */ -MethodsFactory.prototype.createMethodModel = function (name) { - var method = this.getMethodFromAbi(name); - - if (this.isSend(method)) { - return this.contractPackageFactory.createSendMethodModel( - this.getMethodFromAbi(name), - this.utils, - this.formatters, - this.methodEncoder, - this.methodResponseDecoder - ); - } - - return this.contractPackageFactory.createCallMethodModel( - this.getMethodFromAbi(name) - ); -}; - -/** - * Checks if the ABI item is an sendTransaction method - * - * @method isSend - * - * @param {Object} abiItem - * - * @returns {Boolean} - */ -MethodsFactory.prototype.isSend = function (abiItem) { - // pseudo-code - return abiItem.type === 'send'; -}; diff --git a/packages/web3-eth-contract/src/factories/RpcMethodFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodFactory.js new file mode 100644 index 00000000000..dc7cb0735cd --- /dev/null +++ b/packages/web3-eth-contract/src/factories/RpcMethodFactory.js @@ -0,0 +1,80 @@ +/* + 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 . + */ +/** + * @file RpcMethodFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {MethodPackage} methodPackage + * @param {MethodOptionsMapper} methodOptionsMapper + * @param {MethodEncoder} methodEncoder + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function RpcMethodFactory(methodPackage, methodOptionsMapper, methodEncoder, utils, formatters) { + this.methodPackage = methodPackage; + this.utils = utils; + this.formatters = formatters; + this.methodOptionsMapper = methodOptionsMapper; + this.methodEncoder = methodEncoder; +} + +/** + * Returns the correct JSON-RPC MethodModel + * + * @method createRpcMethod + * + * @param {AbiItemModel} abiItemModel + * + * @returns {AbstractMethodModel} + */ +RpcMethodFactory.prototype.createRpcMethod = function (abiItemModel) { + var rpcMethod; + + switch (abiItemModel.requestType) { + case 'call': + rpcMethod = new this.methodPackage.CallMethodModel(this.utils, this.formatters); + + break; + case 'send' : + rpcMethod = new this.methodPackage.SendTransactionMethodModel(this.utils, this.formatters); + + break; + case 'estimate': + rpcMethod = new this.methodPackage.EstimateGasMethodModel(this.utils, this.formatters); + + break; + } + + if (typeof rpcMethod === 'undefined') { + throw Error('Unknown call type with name "' + abiItemModel.requestType + '"'); + } + + rpcMethod.methodArguments = arguments; + rpcMethod.parameters[0]['data'] = this.methodEncoder.encode(abiItemModel.contractMethodParameters); + rpcMethod.parameters = this.methodOptionsMapper.map(rpcMethod.parameters); + + return rpcMethod; +}; + +module.exports = RpcMethodFactory; diff --git a/packages/web3-eth-contract/src/mappers/AbiMapper.js b/packages/web3-eth-contract/src/mappers/AbiMapper.js new file mode 100644 index 00000000000..04e0fa2585d --- /dev/null +++ b/packages/web3-eth-contract/src/mappers/AbiMapper.js @@ -0,0 +1,125 @@ +/* + 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 . + */ +/** + * @file AbiMapper.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {ContractPackageFactory} contractPackageFactory + * @param {AbiCoder} abiCoder + * @param {Utils} utils + * + * @constructor + */ +function AbiMapper(contractPackageFactory, abiCoder, utils) { + this.utils = utils; + this.abiCoder = abiCoder; + this.contractPackageFactory = contractPackageFactory; +} + +/** + * Maps the abi to an object of methods and events as AbiItemModel + * + * @param {Array} abi + * + * @returns {AbiModel} + */ +AbiMapper.prototype.map = function(abi) { + var self = this; + var mappedAbiItem = { + methods: {}, + events: {} + }; + + abi.forEach(function(abiItem) { + abiItem.constant = self.isConstant(abiItem); + abiItem.payable = self.isPayable(abiItem); + + if (abiItem.name) { + abiItem.funcName = self.utils._jsonInterfaceMethodToString(abiItem); + } + + var abiItemModel; + + if (abiItem.type === 'function') { + abiItem.signature = self.abiCoder.encodeFunctionSignature(abiItem.funcName); + + abiItemModel = self.contractPackageFactory.createAbiItemModel(abiItem); + + if(!mappedAbiItem.methods[abiItem.name]) { + mappedAbiItem.methods[abiItem.name] = abiItemModel; + } else { + //TODO: cascade method + mappedAbiItem.methods[abiItem.name] = abiItemModel; + } + + mappedAbiItem.methods[abiItem.signature] = abiItemModel; + mappedAbiItem.methods[abiItem.funcName] = abiItemModel; + + return abiItem; + } + + if (abiItem.type === 'event') { + abiItem.signature = self.abiCoder.encodeEventSignature(abiItem.funcName); + + abiItem = self.contractPackageFactory.createAbiItemModel(event); + + if(!mappedAbiItem.events[abiItem.name] || mappedAbiItem.events[abiItem.name].name === 'bound ') { + mappedAbiItem.events[abiItem.name] = abiItemModel; + } + + mappedAbiItem.events[abiItem.signature] = abiItemModel; + mappedAbiItem.events[abiItem.funcName] = abiItemModel; + + return method; + } + }); + + return this.contractPackage.createAbiModel(mappedAbiItem); +}; + +/** + * Checks if the given abiItem is a constant + * + * @method isConstant + * + * @param {Object} abiItem + * + * @returns {Boolean} + */ +AbiMapper.prototype.isConstant = function (abiItem) { + return (abiItem.stateMutability === "view" || abiItem.stateMutability === "pure" || abiItem.constant); +}; + +/** + * Checks if the given abiItem is payable + * + * @method isPayable + * + * @param {Object} abiItem + * + * @returns {Boolean} + */ +AbiMapper.prototype.isPayable = function (abiItem) { + return (abiItem.stateMutability === "payable" || abiItem.payable); +}; + +module.exports = AbiMapper; diff --git a/packages/web3-eth-contract/src/mappers/MethodOptionsMapper.js b/packages/web3-eth-contract/src/mappers/MethodOptionsMapper.js new file mode 100644 index 00000000000..de628567aab --- /dev/null +++ b/packages/web3-eth-contract/src/mappers/MethodOptionsMapper.js @@ -0,0 +1,60 @@ +/* + 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 . + */ +/** + * @file MethodOptionsMapper.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +function MethodOptionsMapper(utils, formatters) { + this.utils = utils; + this.formatters = formatters; +} + +/** + * Sets the default options where it is required + * + * @param {Contract} contract + * @param {Object} options + * + * @returns {Object} + */ +MethodOptionsMapper.prototype.map = function (contract, options) { + var gasPrice = null; + if (options.gasPrice) { + gasPrice = String(options.gasPrice); + } + + var from = null; + if (options.from) { + from = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(options.from)) + } + + options.data = options.data || contract.options.data; + + options.from = from || contract.options.from; + options.gasPrice = gasPrice || contract.options.gasPrice; + options.gas = options.gas || options.gasLimit || contract.options.gas; + + delete options.gasLimit; + + return options; +}; + +module.exports = MethodOptionsMapper; diff --git a/packages/web3-eth-contract/src/models/AbiItemModel.js b/packages/web3-eth-contract/src/models/AbiItemModel.js new file mode 100644 index 00000000000..311baba870b --- /dev/null +++ b/packages/web3-eth-contract/src/models/AbiItemModel.js @@ -0,0 +1,46 @@ +/* + 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 . + */ +/** + * @file AbiItemModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var _ = require('underscore'); + +function AbiItemModel(abiItem) { + this.abiItem = abiItem; +} + +/** + * Returns the input length of the abiItem + * + * @method getInputLength + * + * @returns {Number} + */ +AbiItemModel.prototype.getInputLength = function () { + if (_.isArray(this.abiItem.inputs)) { + return this.abiItem.inputs.length; + } + + return 0; +}; + +module.export = AbiItemModel; diff --git a/packages/web3-eth-contract/src/models/AbiModel.js b/packages/web3-eth-contract/src/models/AbiModel.js new file mode 100644 index 00000000000..d22719a22cd --- /dev/null +++ b/packages/web3-eth-contract/src/models/AbiModel.js @@ -0,0 +1,94 @@ +/* + 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 . + */ +/** + * @file AbiModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {Object} mappedAbi + * + * @constructor + */ +function AbiModel(mappedAbi) { + this.abi = mappedAbi; +} + +/** + * Checks if the method exists and returns it otherwise it will return false + * + * @method getMethod + * + * @param {String} name + * + * @returns {AbiItemModel|Boolean} + */ +AbiModel.prototype.getMethod = function (name) { + if (this.hasMethod(name)) { + return this.abi.methods[name]; + } + + return false; +}; + +/** + * Checks if the event exists and returns it otherwise it will return false + * + * @method getEvent + * + * @param {String} name + * + * @returns {AbiItemModel|Boolean} + */ +AbiModel.prototype.getEvent = function (name) { + if (this.hasEvent(name)) { + return this.abi.events[name]; + } + + return false; +}; + +/** + * Checks if the method exists + * + * @method hasMethod + * + * @param name + * + * @returns {Boolean} + */ +AbiModel.prototype.hasMethod = function (name) { + return typeof this.abi.methods[name] !== 'undefined'; +}; + +/** + * Checks if the event exists + * + * @method hasEvent + * + * @param name + * + * @returns {Boolean} + */ +AbiModel.prototype.hasEvent = function (name) { + return typeof this.abi.events[name] !== 'undefined'; +}; + +module.exports = AbiModel; diff --git a/packages/web3-eth-contract/src/models/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/CallContractMethodModel.js deleted file mode 100644 index 6e4f3d6d236..00000000000 --- a/packages/web3-eth-contract/src/models/CallContractMethodModel.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - 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 . - */ -/** - * @file CallContractMethodModel.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var CallMethodModel = require('web3-core-method').CallMethodModel; - -/** - * @param {Object} abiItem - * @param {Utils} utils - * @param {Object} formatters - * @param {MethodEncoder} methodEncoder - * @param {MethodResponseDecoder} methodResponseDecoder - * - * @constructor - */ -function CallContractMethodModel(abiItem, utils, formatters, methodEncoder, methodResponseDecoder) { - CallContractMethodModel.call(this, utils, formatters); - this.contractMethodParameters = null; - this.abiItem = abiItem; - this.methodEncoder = methodEncoder; - this.methodResponseDecoder = methodResponseDecoder; - this.signature = ''; -} - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {Object} web3Package - The package where the method is called from for example Eth. - */ -CallContractMethodModel.prototype.beforeExecution = function (web3Package) { - this.parameters[0]['data'] = self.methodEncoder.encode( - this.contractMethodParameters, - this.abiItem, - this.signature, - web3Package.contractOptions.data - ); - - this.parameters[0] = this.getOrSetDefaultOptions(this.parameters[0], web3Package); - - CallMethodModel.prototype.beforeExecution.call(this, web3Package); -}; - -/** - * Use default values, if options are not available - * - * @method getOrSetDefaultOptions - * - * @param {Object} options the options gived by the user - * @param {Object} web3Package - The package where the method is called from for example Eth. - * - * @returns {Object} the options with gaps filled by defaults - */ -CallContractMethodModel.prototype.getOrSetDefaultOptions = function getOrSetDefaultOptions(options, web3Package) { - var from = null; - var gasPrice = null; - - if (options.gasPrice) { - gasPrice = String(options.gasPrice); - } - - if (options.from) { - from = this.utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)); - } - - options.from = from || web3Package.contractOptions.from; - options.gasPrice = gasPrice || web3Package.contractOptions.gasPrice; - options.gas = options.gas || options.gasLimit || web3Package.contractOptions.gas; - - // TODO replace with only gasLimit? - delete options.gasLimit; - - return options; -}; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {*} - */ -CallContractMethodModel.prototype.afterExecution = function (response) { - return this.methodResponseDecoder.decode(this.abiItem, response); -}; - -CallContractMethodModel.prototype = Object.create(CallMethodModel.prototype); -CallContractMethodModel.prototype.constructor = CallContractMethodModel; - -module.exports = CallContractMethodModel; diff --git a/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js b/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js deleted file mode 100644 index 4dc1ac45d25..00000000000 --- a/packages/web3-eth-contract/src/models/EstimateGasOfContractMethodModel.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - 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 . - */ -/** - * @file EstimateGasOfContractMethodModel.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; - -/** - * @param {AbstractMethodModel} contractMethodModel - * @param {Utils} utils - * @param {Object} formatters - * @param {MethodEncoder} methodEncoder - * - * @constructor - */ -function EstimateGasOfContractMethodModel(contractMethodModel, utils, formatters, methodEncoder) { - EstimateGasMethodModel.call(this, utils, formatters); - this.contractMethodParameters = contractMethodModel.contractMethodParameters; - this.abiItem = contractMethodModel.abiItem; - this.signature = contractMethodModel.signature; - this.methodEncoder = methodEncoder; -} - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {Object} web3Package - The package where the method is called from for example Eth. - */ -EstimateGasOfContractMethodModel.prototype.beforeExecution = function (web3Package) { - this.parameters[0]['data'] = self.methodEncoder.encode( - this.contractMethodParameters, - this.abiItem, - this.signature, - web3Package.contractOptions.data - ); - - this.parameters[0] = this.getOrSetDefaultOptions(this.parameters[0], web3Package); - - EstimateGasMethodModel.prototype.beforeExecution.call(this, web3Package); -}; - -/** - * Use default values, if options are not available - * - * @method getOrSetDefaultOptions - * - * @param {Object} options the options gived by the user - * @param {Object} web3Package - The package where the method is called from for example Eth. - * - * @returns {Object} the options with gaps filled by defaults - */ -EstimateGasOfContractMethodModel.prototype.getOrSetDefaultOptions = function getOrSetDefaultOptions(options, web3Package) { - var from = null; - var gasPrice = null; - - if (options.gasPrice) { - gasPrice = String(options.gasPrice); - } - - if (options.from) { - from = this.utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)); - } - - options.from = from || web3Package.contractOptions.from; - options.gasPrice = gasPrice || web3Package.contractOptions.gasPrice; - options.gas = options.gas || options.gasLimit || web3Package.contractOptions.gas; - - // TODO replace with only gasLimit? - delete options.gasLimit; - - return options; -}; - -EstimateGasOfContractMethodModel.prototype = Object.create(EstimateGasMethodModel.prototype); -EstimateGasOfContractMethodModel.prototype.constructor = EstimateGasOfContractMethodModel; - -module.exports = EstimateGasOfContractMethodModel; diff --git a/packages/web3-eth-contract/src/models/SendMethodModel.js b/packages/web3-eth-contract/src/models/SendMethodModel.js deleted file mode 100644 index 3e1a6462d9f..00000000000 --- a/packages/web3-eth-contract/src/models/SendMethodModel.js +++ /dev/null @@ -1,114 +0,0 @@ -/* - 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 . - */ -/** - * @file SendMethodModel.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; - -/** - * @param {Object} abiItem - * @param {Utils} utils - * @param {Object} formatters - * @param {MethodEncoder} methodEncoder - * @param {MethodResponseDecoder} methodResponseDecoder - * - * @constructor - */ -function SendMethodModel(abiItem, utils, formatters, methodEncoder, methodResponseDecoder) { - SendTransactionMethodModel.call(this, utils, formatters); - this.contractMethodParameters = null; - this.abiItem = abiItem; - this.methodEncoder = methodEncoder; - this.methodResponseDecoder = methodResponseDecoder; - this.signature = ''; -} - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {Object} web3Package - The package where the method is called from for example Eth. - */ -SendMethodModel.prototype.beforeExecution = function (web3Package) { - this.parameters[0]['data'] = self.methodEncoder.encode( - this.contractMethodParameters, - this.abiItem, - this.signature, - web3Package.contractOptions.data - ); - - this.parameters[0] = this.getOrSetDefaultOptions(this.parameters[0], web3Package); - - SendTransactionMethodModel.prototype.beforeExecution.call(this, web3Package); -}; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {*} - */ -SendMethodModel.prototype.afterExecution = function (response) { - return this.methodResponseDecoder.decode(this.abiItem, response); -}; - -/** - * Use default values, if options are not available - * - * @method getOrSetDefaultOptions - * - * @param {Object} options the options gived by the user - * @param {Object} web3Package - The package where the method is called from for example Eth. - * - * @returns {Object} the options with gaps filled by defaults - */ -SendMethodModel.prototype.getOrSetDefaultOptions = function getOrSetDefaultOptions(options, web3Package) { - var from = null; - var gasPrice = null; - - if (options.gasPrice) { - gasPrice = String(options.gasPrice); - } - - if (options.from) { - from = this.utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)); - } - - options.from = from || web3Package.contractOptions.from; - options.gasPrice = gasPrice || web3Package.contractOptions.gasPrice; - options.gas = options.gas || options.gasLimit || web3Package.contractOptions.gas; - options.to = web3Package.contractOptions.address; - - // TODO replace with only gasLimit? - delete options.gasLimit; - - return options; -}; - -SendMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); -SendMethodModel.prototype.constructor = SendMethodModel; - -module.exports = SendMethodModel; diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 8731a382be9..fdd5f5f529d 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -23,12 +23,12 @@ "use strict"; /** - * @param {EventSubscriptionsFactory} eventSubscriptionsFactory + * @param {AbiModel} abiModel * * @constructor */ -function EventSubscriptionsProxy(eventSubscriptionsFactory) { - this.eventSubscriptionsFactory = eventSubscriptionsFactory; +function EventSubscriptionsProxy(abiModel) { + this.abiModel = abiModel; return new Proxy(this, { get: this.proxyHandler @@ -46,23 +46,19 @@ function EventSubscriptionsProxy(eventSubscriptionsFactory) { * @returns {Function|Error} */ EventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { - if (this.eventSubscriptionsFactory.hasEvent(name)) { - var eventSubscriptionModel = this.eventSubscriptionsFactory.createEventSubscriptionModel(name); + var eventModel = this.abiModel.getEvent(name); + if (eventModel) { return function (options, callback) { - eventSubscriptionModel.options = options; + eventModel.options = options; - return eventSubscriptionModel.subscription.subscribe(callback); } } if (name === 'allEvents') { - var allEventsSubscriptionModel = this.eventSubscriptionsFactory.getAllEventsModel(); - return function (options, callback) { - allEventsSubscriptionModel.options = options; + eventModel.options = options; - return allEventsSubscriptionModel.subscription.subscribe(callback); } } diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 515af67865e..d5ae820bbad 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -23,14 +23,16 @@ "use strict"; /** - * @param {MethodsFactory} methodsFactory + * @param {AbiModel} abiModel + * @param {RpcMethodFactory} rpcMethodFactory * @param {MethodController} methodController * @param {MethodEncoder} methodEncoder * * @constructor */ -function MethodsProxy(methodsFactory, methodController, methodEncoder) { - this.methodsFactory = methodsFactory; +function MethodsProxy(abiModel, rpcMethodFactory, methodController, methodEncoder) { + this.abiModel = abiModel; + this.rpcMethodFactory = rpcMethodFactory; this.methodController = methodController; this.methodEncoder = methodEncoder; @@ -50,63 +52,64 @@ function MethodsProxy(methodsFactory, methodController, methodEncoder) { * @returns {Function|Error} */ MethodsProxy.prototype.proxyHandler = function (target, name) { - if (this.methodsFactory.hasMethod(name)) { - var methodModel = this.methodsFactory.createMethodModel(name); - var requestType = this.getRequestType(methodModel); + var abiItemModel = this.abiModel.getMethod(name); + if (abiItemModel) { var anonymousFunction = function () { - methodModel.contractMethodParameters = arguments; + abiItemModel.contractMethodParameters = arguments; }; - anonymousFunction[requestType] = function () { - methodModel.methodArguments = arguments; + anonymousFunction[abiItemModel.requestType] = function () { + var rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); + rpcMethod.methodArguments = arguments; + + var contractMethodArgumentsValidationResult = self.contractMethodArgumentsValidator.validate(abiItemModel); + var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(rpcMethod); + + if (contractMethodArgumentsValidationResult !== true && rpcMethodOptionsValidationResult !== true) { + var promiEvent = new PromiEvent(); + var errorsObject = { + errors: [ + contractMethodArgumentsValidationResult, + rpcMethodOptionsValidationResult + ] + }; + + promiEvent.resolve(null); + promiEvent.reject(errorsObject); + promiEvent.eventEmitter.emit('error', errorsObject); + + return promiEvent + } return self.methodController.execute( - methodModel, + rcpMethod, target.currentProvider, target.accounts, target ); }; - anonymousFunction[requestType].request = methodModel.request; + anonymousFunction[abiItemModel.requestType].request = abiItemModel.request; anonymousFunction.estimateGas = function () { - var estimateGasOfContractMethodModel = self.methodFactory.createEstimateGasOfContractMethodModel(methodModel); - estimateGasOfContractMethodModel.methodArguments = arguments; + abiItemModel.requestType = 'estimate'; + + var rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); + rpcMethod.methodArguments = arguments; return self.methodController.execute( - estimateGasOfContractMethodModel, + rpcMethod, target.currentProvider, target.accounts, target ); }; - anonymousFunction.encodeAbi = this.methodEncoder.encode( - methodModel.contractMethodParameters, - methodModel.abiItem, - methodModel.signature, - target.contractOptions.data - ); + anonymousFunction.encodeAbi = this.methodEncoder.encode(abiItemModel, target.contractOptions.data); } throw Error('Method with name "' + name + '" not found'); }; -/** - * Determines which type of JSON-RPC request it is. - * - * @method getRequestType - * - * @param {AbstractMethodModel} methodModel - * - * @returns {string} - */ -MethodsProxy.prototype.getRequestType = function (methodModel) { - if (methodModel.constructor.name === 'CallContractMethodModel') { - return 'call'; - } - - return 'send'; -}; +module.exports = MethodsProxy; diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js new file mode 100644 index 00000000000..dc378ab5cff --- /dev/null +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -0,0 +1,83 @@ +/* + 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 . + */ +/** + * @file RpcMethodOptionsValidator.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var _ = require('underscore'); + +function RpcMethodOptionsValidator(utils) { + this.utils = utils; +} + +RpcMethodOptionsValidator.prototype.validate = function (methodModel, rpcMethodModel) { + // errors.push(new Error('This contract object doesn\'t have address set yet, please set an address first.')); + // errors.push(new Error('No "from" address specified in neither the given options, nor the default options.')); + // errors.push(new Error('Can not send value to non-payable contract method or constructor')); + // errors.push(new Error('Invalid arguments length')); +}; + +/** + * Checks if the property to is set in the options object + * + * @method isToSet + * + * @param {AbiItemModel} abiItemModel + * @param {AbstractMethodModel} rpcMethodModel + * + * @returns {Boolean} + */ +RpcMethodOptionsValidator.prototype.isToSet = function(abiItemModel, rpcMethodModel) { + return !(abiItemModel.signature !== 'constructor' && !rpcMethodModel.parameters[0].to); +}; + +/** + * Checks if the property from of the options object is set and a valid address + * + * @method isFromNotSet + * + * @param {AbstractMethodModel} rpcMethodModel + * + * @returns {Boolean} + */ +RpcMethodOptionsValidator.prototype.isFromNotSet = function (rpcMethodModel) { + return this.utils.isAddress(rpcMethodModel.parameters[0].from); +}; + +/** + * Checks if no value is set for an non-payable method + * + * @method isValueEmptyForNonPayable + * + * @param {AbiItemModel} abiItemModel + * @param {AbstractMethodModel} rpcMethodModel + * + * @returns {Boolean} + */ +RpcMethodOptionsValidator.prototype.isValueEmptyForNonPayable = function (abiItemModel, rpcMethodModel) { + return !( + !abiItemModel.payable && + rpcMethodModel.parameters[0].options.value && + rpcMethodModel.parameters[0].options.value > 0 + ); +}; + +module.exports = RpcMethodOptionsValidator; From 3412b86696860c4f0879aecb39fb1b9a85c7aeb3 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 01:58:22 +0200 Subject: [PATCH 0144/1045] code style improvements --- packages/web3-eth-contract/src/encoders/MethodEncoder.js | 4 ++-- .../src/factories/ContractPackageFactory.js | 5 ++++- packages/web3-eth-contract/src/models/AbiItemModel.js | 5 +++++ .../src/proxies/EventSubscriptionsProxy.js | 2 ++ packages/web3-eth-contract/src/proxies/MethodsProxy.js | 8 ++++++++ .../src/validators/RpcMethodOptionsValidator.js | 7 ++++++- 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/packages/web3-eth-contract/src/encoders/MethodEncoder.js b/packages/web3-eth-contract/src/encoders/MethodEncoder.js index 6264cb4ba2f..2d673720709 100644 --- a/packages/web3-eth-contract/src/encoders/MethodEncoder.js +++ b/packages/web3-eth-contract/src/encoders/MethodEncoder.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file ContractMethodEncoder.js + * @file MethodEncoder.js * @author Samuel Furter * @date 2018 */ @@ -41,7 +41,7 @@ function MethodEncoder(abiCoder) { * @param {String} signature * @param {String} deployData * - * @returns {string} + * @returns {String} */ MethodEncoder.prototype.encode = function (contractMethodParameters, abiItem, signature, deployData) { var encodedParameters = this.abiCoder.encodeParameters( diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index 8c395ddf810..b879e1bd15c 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file MethodValidator.js + * @file ContractPackageFactory.js * @author Samuel Furter * @date 2018 */ @@ -32,6 +32,9 @@ var MethodsProxy = require('../proxies/MethodsProxy'); var MethodValidator = require('../validators/MethodValidator'); var RpcMethodFactory = require('../factories/RpcMethodFactory'); +/** + * @constructor + */ function ContractPackageFactory() { } /** diff --git a/packages/web3-eth-contract/src/models/AbiItemModel.js b/packages/web3-eth-contract/src/models/AbiItemModel.js index 311baba870b..722d0c079d4 100644 --- a/packages/web3-eth-contract/src/models/AbiItemModel.js +++ b/packages/web3-eth-contract/src/models/AbiItemModel.js @@ -24,6 +24,11 @@ var _ = require('underscore'); +/** + * @param {Object} abiItem + * + * @constructor + */ function AbiItemModel(abiItem) { this.abiItem = abiItem; } diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index fdd5f5f529d..c2214d5e792 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -64,3 +64,5 @@ EventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { throw Error('Event with name "' + name + '" not found'); }; + +module.exports = EventSubscriptionsProxy; diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index d5ae820bbad..7ca4295cb71 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -112,4 +112,12 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { throw Error('Method with name "' + name + '" not found'); }; +MethodsProxy.prototype.handleValidationErrors = function (errors) { + // return PromiEvent if errors +}; + +MethodsProxy.prototype.extendRpcMethodWithResponseDecoder = function (rpcMethod) { + // Extend afterExecution of the AbstractMethodModel with decoding of the response +}; + module.exports = MethodsProxy; diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js index dc378ab5cff..930b9d6c1ee 100644 --- a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -24,11 +24,16 @@ var _ = require('underscore'); +/** + * @param {Utils} utils + * + * @constructor + */ function RpcMethodOptionsValidator(utils) { this.utils = utils; } -RpcMethodOptionsValidator.prototype.validate = function (methodModel, rpcMethodModel) { +RpcMethodOptionsValidator.prototype.validate = function (abiItemModel, rpcMethodModel) { // errors.push(new Error('This contract object doesn\'t have address set yet, please set an address first.')); // errors.push(new Error('No "from" address specified in neither the given options, nor the default options.')); // errors.push(new Error('Can not send value to non-payable contract method or constructor')); From 013dca7b47138838679a6eefd3da27ac45259c85 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 02:00:17 +0200 Subject: [PATCH 0145/1045] code syle improvements --- packages/web3-eth-contract/src/Contract.js | 110 +++++++++--------- .../src/factories/ContractPackageFactory.js | 3 +- .../src/mappers/AbiMapper.js | 8 +- .../validators/RpcMethodOptionsValidator.js | 10 +- 4 files changed, 66 insertions(+), 65 deletions(-) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 791225ead11..af5dc4c206c 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -55,39 +55,38 @@ var Contract = function Contract(jsonInterface, address, options) { var _this = this, args = Array.prototype.slice.call(arguments); - if(!(this instanceof Contract)) { + if (!(this instanceof Contract)) { throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!'); } this.clearSubscriptions = this.connectionModel.provider.clearSubscriptions; - if(!jsonInterface || !(Array.isArray(jsonInterface))) { + 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)) { + if (_.isObject(lastArg) && !_.isArray(lastArg)) { options = lastArg; this.options = _.extend(this.options, this._getOrSetDefaultOptions(options)); - if(_.isObject(address)) { + if (_.isObject(address)) { address = null; } } // set address Object.defineProperty(this.options, 'address', { - set: function(value){ - if(value) { + set: function (value) { + if (value) { _this._address = utils.toChecksumAddress(formatters.inputAddressFormatter(value)); } }, - get: function(){ + get: function () { return _this._address; }, enumerable: true @@ -95,11 +94,11 @@ var Contract = function Contract(jsonInterface, address, options) { // add method and event signatures, when the jsonInterface gets set Object.defineProperty(this.options, 'jsonInterface', { - set: function(value){ + set: function (value) { _this.methods = {}; _this.events = {}; - _this._jsonInterface = value.map(function(method) { + _this._jsonInterface = value.map(function (method) { var func, funcName; @@ -123,7 +122,7 @@ var Contract = function Contract(jsonInterface, address, options) { // add method only if not one already exists - if(!_this.methods[method.name]) { + if (!_this.methods[method.name]) { _this.methods[method.name] = func; } else { var cascadeFunc = _this._createTxObject.bind({ @@ -147,7 +146,7 @@ var Contract = function Contract(jsonInterface, address, options) { var event = _this._on.bind(_this, method.signature); // add method only if not already exists - if(!_this.events[method.name] || _this.events[method.name].name === 'bound ') + if (!_this.events[method.name] || _this.events[method.name].name === 'bound ') _this.events[method.name] = event; // definitely add the method based on its signature @@ -166,7 +165,7 @@ var Contract = function Contract(jsonInterface, address, options) { return _this._jsonInterface; }, - get: function(){ + get: function () { return _this._jsonInterface; }, enumerable: true @@ -185,7 +184,7 @@ var Contract = function Contract(jsonInterface, address, options) { }; -Contract.setProvider = function(provider, accounts) { +Contract.setProvider = function (provider, accounts) { this.connectionModel.provider = provider; this.accounts = accounts; }; @@ -212,9 +211,9 @@ Contract.prototype._getCallback = function getCallback(args) { * @param {String} event * @return {Object} the contract instance */ -Contract.prototype._checkListener = function(type, event){ - if(event === type) { - throw new Error('The event "'+ type +'" is a reserved event name, you can\'t use it.'); +Contract.prototype._checkListener = function (type, event) { + if (event === type) { + throw new Error('The event "' + type + '" is a reserved event name, you can\'t use it.'); } }; @@ -227,7 +226,7 @@ Contract.prototype._checkListener = function(type, event){ * @return {Object} the options with gaps filled by defaults */ Contract.prototype._getOrSetDefaultOptions = function getOrSetDefaultOptions(options) { - var gasPrice = options.gasPrice ? String(options.gasPrice): null; + var gasPrice = options.gasPrice ? String(options.gasPrice) : null; var from = options.from ? utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)) : null; options.data = options.data || this.options.data; @@ -263,7 +262,7 @@ Contract.prototype._encodeEventABI = function (event, options) { }); // use given topics - if(_.isArray(options.topics)) { + if (_.isArray(options.topics)) { result.topics = options.topics; // create topics based on filter @@ -300,11 +299,11 @@ Contract.prototype._encodeEventABI = function (event, options) { result.topics = result.topics.concat(indexedTopics); } - if(!result.topics.length) + if (!result.topics.length) delete result.topics; } - if(this.options.address) { + if (this.options.address) { result.address = this.options.address.toLowerCase(); } @@ -326,7 +325,7 @@ Contract.prototype._decodeEventABI = function (data) { var result = formatters.outputLogFormatter(data); // if allEvents get the right event - if(event.name === 'ALLEVENTS') { + if (event.name === 'ALLEVENTS') { event = event.jsonInterface.find(function (intf) { return (intf.signature === data.topics[0]); }) || {anonymous: true}; @@ -374,12 +373,12 @@ Contract.prototype._encodeMethodABI = function _encodeMethodABI() { var signature = false, paramsABI = this._parent.options.jsonInterface.filter(function (json) { return ((methodSignature === 'constructor' && json.type === methodSignature) || - ((json.signature === methodSignature || json.signature === methodSignature.replace('0x','') || json.name === methodSignature) && json.type === 'function')); + ((json.signature === methodSignature || json.signature === methodSignature.replace('0x', '') || json.name === methodSignature) && json.type === 'function')); }).map(function (json) { var inputLength = (_.isArray(json.inputs)) ? json.inputs.length : 0; if (inputLength !== args.length) { - throw new Error('The number of arguments is not matching the methods required number. You need to pass '+ inputLength +' arguments.'); + throw new Error('The number of arguments is not matching the methods required number. You need to pass ' + inputLength + ' arguments.'); } if (json.type === 'function') { @@ -387,12 +386,12 @@ Contract.prototype._encodeMethodABI = function _encodeMethodABI() { } return _.isArray(json.inputs) ? json.inputs : []; }).map(function (inputs) { - return abi.encodeParameters(inputs, args).replace('0x',''); + return abi.encodeParameters(inputs, args).replace('0x', ''); })[0] || ''; // return constructor - if(methodSignature === 'constructor') { - if(!this._deployData) + if (methodSignature === 'constructor') { + if (!this._deployData) throw new Error('The contract has no contract data option set. This is necessary to append the constructor parameters.'); return this._deployData + paramsABI; @@ -402,8 +401,8 @@ Contract.prototype._encodeMethodABI = function _encodeMethodABI() { var returnValue = (signature) ? signature + paramsABI : paramsABI; - if(!returnValue) { - throw new Error('Couldn\'t find a matching contract method named "'+ this._method.name +'".'); + if (!returnValue) { + throw new Error('Couldn\'t find a matching contract method named "' + this._method.name + '".'); } else { return returnValue; } @@ -455,7 +454,7 @@ Contract.prototype.deploy = function (options, callback) { // return error, if no "data" is specified - if(!options.data) { + if (!options.data) { return utils._fireError(new Error('No "data" specified in neither the given options, nor the default options.'), null, null, callback); } @@ -482,7 +481,7 @@ Contract.prototype.deploy = function (options, callback) { * @param {Function} callback * @return {Object} the event options object */ -Contract.prototype._generateEventOptions = function() { +Contract.prototype._generateEventOptions = function () { var args = Array.prototype.slice.call(arguments); // get the callback @@ -496,7 +495,7 @@ Contract.prototype._generateEventOptions = function() { name: 'ALLEVENTS', jsonInterface: this.options.jsonInterface } : this.options.jsonInterface.find(function (json) { - return (json.type === 'event' && (json.name === event || json.signature === '0x'+ event.replace('0x',''))); + return (json.type === 'event' && (json.name === event || json.signature === '0x' + event.replace('0x', ''))); }); if (!event) { @@ -520,7 +519,7 @@ Contract.prototype._generateEventOptions = function() { * @method clone * @return {Object} the event subscription */ -Contract.prototype.clone = function() { +Contract.prototype.clone = function () { return new this.constructor(this.options.jsonInterface, this.options.address, this.options); }; @@ -534,7 +533,7 @@ Contract.prototype.clone = function() { * @param {Function} callback * @return {Object} the event subscription */ -Contract.prototype.once = function(event, options, callback) { +Contract.prototype.once = function (event, options, callback) { var args = Array.prototype.slice.call(arguments); // get the callback @@ -551,7 +550,7 @@ Contract.prototype.once = function(event, options, callback) { // don't return as once shouldn't provide "on" this._on(event, options, function (err, res, sub) { sub.unsubscribe(); - if(_.isFunction(callback)){ + if (_.isFunction(callback)) { callback(err, res, sub); } }); @@ -568,7 +567,7 @@ Contract.prototype.once = function(event, options, callback) { * @param {Function} callback * @return {Object} the event subscription */ -Contract.prototype._on = function(){ +Contract.prototype._on = function () { var subOptions = this._generateEventOptions.apply(this, arguments); @@ -586,7 +585,7 @@ Contract.prototype._on = function(){ outputFormatter: this._decodeEventABI.bind(subOptions.event), // DUBLICATE, also in web3-eth subscriptionHandler: function (output) { - if(output.removed) { + if (output.removed) { this.emit('changed', output); } else { this.emit('data', output); @@ -600,7 +599,8 @@ Contract.prototype._on = function(){ type: 'eth', requestManager: this._requestManager }); - subscription.subscribe('logs', subOptions.params, subOptions.callback || function () {}); + subscription.subscribe('logs', subOptions.params, subOptions.callback || function () { + }); return subscription; }; @@ -614,7 +614,7 @@ Contract.prototype._on = function(){ * @param {Function} callback * @return {Object} the promievent */ -Contract.prototype.getPastEvents = function(){ +Contract.prototype.getPastEvents = function () { var subOptions = this._generateEventOptions.apply(this, arguments); var getPastLogs = new Method({ @@ -639,11 +639,11 @@ Contract.prototype.getPastEvents = function(){ * @method _createTxObject * @returns {Object} an object with functions to call the methods */ -Contract.prototype._createTxObject = function _createTxObject(){ +Contract.prototype._createTxObject = function _createTxObject() { var args = Array.prototype.slice.call(arguments); var txObject = {}; - if(this.method.type === 'function') { + if (this.method.type === 'function') { txObject.call = this.parent._executeMethod.bind(txObject, 'call'); txObject.call.request = this.parent._executeMethod.bind(txObject, 'call', true); // to make batch requests @@ -667,7 +667,7 @@ Contract.prototype._createTxObject = function _createTxObject(){ txObject._parent = this.parent; txObject._ethAccounts = this.parent.accounts || this._ethAccounts; - if(this.deployData) { + if (this.deployData) { txObject._deployData = this.deployData; } @@ -691,27 +691,27 @@ Contract.prototype._processExecuteArguments = function _processExecuteArguments( processedArgs.callback = this._parent._getCallback(args); // get block number to use for call - if(processedArgs.type === 'call' && args[args.length - 1] !== true && (_.isString(args[args.length - 1]) || isFinite(args[args.length - 1]))) + if (processedArgs.type === 'call' && args[args.length - 1] !== true && (_.isString(args[args.length - 1]) || isFinite(args[args.length - 1]))) processedArgs.defaultBlock = args.pop(); // get the options processedArgs.options = (_.isObject(args[args.length - 1])) ? args.pop() : {}; // get the generateRequest argument for batch requests - processedArgs.generateRequest = (args[args.length - 1] === true)? args.pop() : false; + processedArgs.generateRequest = (args[args.length - 1] === true) ? args.pop() : false; processedArgs.options = this._parent._getOrSetDefaultOptions(processedArgs.options); processedArgs.options.data = this.encodeABI(); // add contract address - if(!this._deployData && !utils.isAddress(this._parent.options.address)) + if (!this._deployData && !utils.isAddress(this._parent.options.address)) throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); - if(!this._deployData) + if (!this._deployData) processedArgs.options.to = this._parent.options.address; // return error, if no "data" is specified - if(!processedArgs.options.data) + if (!processedArgs.options.data) return utils._fireError(new Error('Couldn\'t find a matching contract method, or the number of parameters is wrong.'), defer.eventEmitter, defer.reject, processedArgs.callback); return processedArgs; @@ -724,21 +724,21 @@ Contract.prototype._processExecuteArguments = function _processExecuteArguments( * @param {String} type the type this execute function should execute * @param {Boolean} makeRequest if true, it simply returns the request parameters, rather than executing it */ -Contract.prototype._executeMethod = function _executeMethod(){ +Contract.prototype._executeMethod = function _executeMethod() { var _this = this, args = this._parent._processExecuteArguments.call(this, Array.prototype.slice.call(arguments), defer), defer = promiEvent((args.type !== 'send')), ethAccounts = _this.accounts || _this._ethAccounts; // simple return request for batch requests - if(args.generateRequest) { + if (args.generateRequest) { var payload = { params: [formatters.inputCallFormatter.call(this._parent, args.options)], callback: args.callback }; - if(args.type === 'call') { + if (args.type === 'call') { payload.params.push(formatters.inputDefaultBlockNumberFormatter.call(this._parent, args.defaultBlock)); payload.method = 'eth_call'; payload.format = this._parent._decodeMethodReturn.bind(null, this._method.outputs); @@ -791,7 +791,7 @@ Contract.prototype._executeMethod = function _executeMethod(){ case 'send': // return error, if no "from" is specified - if(!utils.isAddress(args.options.from)) { + if (!utils.isAddress(args.options.from)) { return utils._fireError(new Error('No "from" address specified in neither the given options, nor the default options.'), defer.eventEmitter, defer.reject, args.callback); } @@ -806,7 +806,7 @@ Contract.prototype._executeMethod = function _executeMethod(){ if (_.isArray(receipt.logs)) { // decode logs - var events = _.map(receipt.logs, function(log) { + var events = _.map(receipt.logs, function (log) { return _this._parent._decodeEventABI.call({ name: 'ALLEVENTS', jsonInterface: _this._parent.options.jsonInterface @@ -820,13 +820,13 @@ Contract.prototype._executeMethod = function _executeMethod(){ if (ev.event) { // if > 1 of the same event, don't overwrite any existing events if (receipt.events[ev.event]) { - if (Array.isArray(receipt.events[ ev.event ])) { - receipt.events[ ev.event ].push(ev); + if (Array.isArray(receipt.events[ev.event])) { + receipt.events[ev.event].push(ev); } else { receipt.events[ev.event] = [receipt.events[ev.event], ev]; } } else { - receipt.events[ ev.event ] = ev; + receipt.events[ev.event] = ev; } } else { receipt.events[count] = ev; diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index b879e1bd15c..a5dee062a6c 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -35,7 +35,8 @@ var RpcMethodFactory = require('../factories/RpcMethodFactory'); /** * @constructor */ -function ContractPackageFactory() { } +function ContractPackageFactory() { +} /** * Returns an object of AbiModel diff --git a/packages/web3-eth-contract/src/mappers/AbiMapper.js b/packages/web3-eth-contract/src/mappers/AbiMapper.js index 04e0fa2585d..c191431f355 100644 --- a/packages/web3-eth-contract/src/mappers/AbiMapper.js +++ b/packages/web3-eth-contract/src/mappers/AbiMapper.js @@ -42,14 +42,14 @@ function AbiMapper(contractPackageFactory, abiCoder, utils) { * * @returns {AbiModel} */ -AbiMapper.prototype.map = function(abi) { +AbiMapper.prototype.map = function (abi) { var self = this; var mappedAbiItem = { methods: {}, events: {} }; - abi.forEach(function(abiItem) { + abi.forEach(function (abiItem) { abiItem.constant = self.isConstant(abiItem); abiItem.payable = self.isPayable(abiItem); @@ -64,7 +64,7 @@ AbiMapper.prototype.map = function(abi) { abiItemModel = self.contractPackageFactory.createAbiItemModel(abiItem); - if(!mappedAbiItem.methods[abiItem.name]) { + if (!mappedAbiItem.methods[abiItem.name]) { mappedAbiItem.methods[abiItem.name] = abiItemModel; } else { //TODO: cascade method @@ -82,7 +82,7 @@ AbiMapper.prototype.map = function(abi) { abiItem = self.contractPackageFactory.createAbiItemModel(event); - if(!mappedAbiItem.events[abiItem.name] || mappedAbiItem.events[abiItem.name].name === 'bound ') { + if (!mappedAbiItem.events[abiItem.name] || mappedAbiItem.events[abiItem.name].name === 'bound ') { mappedAbiItem.events[abiItem.name] = abiItemModel; } diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js index 930b9d6c1ee..89aedd6cebe 100644 --- a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -34,10 +34,10 @@ function RpcMethodOptionsValidator(utils) { } RpcMethodOptionsValidator.prototype.validate = function (abiItemModel, rpcMethodModel) { - // errors.push(new Error('This contract object doesn\'t have address set yet, please set an address first.')); - // errors.push(new Error('No "from" address specified in neither the given options, nor the default options.')); - // errors.push(new Error('Can not send value to non-payable contract method or constructor')); - // errors.push(new Error('Invalid arguments length')); + // errors.push(new Error('This contract object doesn\'t have address set yet, please set an address first.')); + // errors.push(new Error('No "from" address specified in neither the given options, nor the default options.')); + // errors.push(new Error('Can not send value to non-payable contract method or constructor')); + // errors.push(new Error('Invalid arguments length')); }; /** @@ -50,7 +50,7 @@ RpcMethodOptionsValidator.prototype.validate = function (abiItemModel, rpcMethod * * @returns {Boolean} */ -RpcMethodOptionsValidator.prototype.isToSet = function(abiItemModel, rpcMethodModel) { +RpcMethodOptionsValidator.prototype.isToSet = function (abiItemModel, rpcMethodModel) { return !(abiItemModel.signature !== 'constructor' && !rpcMethodModel.parameters[0].to); }; From c33fcf12a1f8abfa8108860000638a9e0af3e1a3 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 12:34:57 +0200 Subject: [PATCH 0146/1045] Validators implemented, code style improvements, method models created, todo's added --- .../src/decoders/MethodResponseDecoder.js | 8 +- .../src/encoders/MethodEncoder.js | 39 +++------- .../src/factories/ContractPackageFactory.js | 63 +++++++-------- .../src/factories/RpcMethodFactory.js | 42 +++++----- packages/web3-eth-contract/src/index.js | 5 +- .../src/mappers/AbiMapper.js | 4 +- ...onsMapper.js => RpcMethodOptionsMapper.js} | 14 +++- .../src/models/{ => abi}/AbiItemModel.js | 50 ++++++++++++ .../src/models/{ => abi}/AbiModel.js | 0 .../models/methods/CallContractMethodModel.js | 58 ++++++++++++++ .../models/methods/SendContractMethodModel.js | 59 ++++++++++++++ .../src/proxies/EventSubscriptionsProxy.js | 1 + .../src/proxies/MethodsProxy.js | 77 +++++++++++++------ .../validators/RpcMethodOptionsValidator.js | 47 +++++++---- 14 files changed, 342 insertions(+), 125 deletions(-) rename packages/web3-eth-contract/src/mappers/{MethodOptionsMapper.js => RpcMethodOptionsMapper.js} (84%) rename packages/web3-eth-contract/src/models/{ => abi}/AbiItemModel.js (53%) rename packages/web3-eth-contract/src/models/{ => abi}/AbiModel.js (100%) create mode 100644 packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js create mode 100644 packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js diff --git a/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js b/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js index 73cfa25574d..7604b018e8e 100644 --- a/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js +++ b/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js @@ -36,12 +36,12 @@ function MethodResponseDecoder(abiCoder) { * * @method decode * - * @param {Array} methodOutputTypes + * @param {Array} abiItemOutputTypes * @param {Array} response - * + * //TODO: Fix response handling * @returns {*} */ -MethodResponseDecoder.prototype.decode = function (methodOutputTypes, response) { +MethodResponseDecoder.prototype.decode = function (abiItemOutputTypes, response) { if (!response) { return null; } @@ -50,7 +50,7 @@ MethodResponseDecoder.prototype.decode = function (methodOutputTypes, response) response = response.slice(2); } - var result = this.abiCoder.decodeParameters(methodOutputTypes, response); + var result = this.abiCoder.decodeParameters(abiItemOutputTypes, response); if (result.__length__ === 1) { return result[0]; diff --git a/packages/web3-eth-contract/src/encoders/MethodEncoder.js b/packages/web3-eth-contract/src/encoders/MethodEncoder.js index 2d673720709..dc75d1b19e0 100644 --- a/packages/web3-eth-contract/src/encoders/MethodEncoder.js +++ b/packages/web3-eth-contract/src/encoders/MethodEncoder.js @@ -36,22 +36,20 @@ function MethodEncoder(abiCoder) { * * @method encode * - * @param {Array} contractMethodParameters - * @param {Object} abiItem - * @param {String} signature + * @param {AbiItemModel} abiItemModel * @param {String} deployData * - * @returns {String} + * @returns {String|Error} */ -MethodEncoder.prototype.encode = function (contractMethodParameters, abiItem, signature, deployData) { +MethodEncoder.prototype.encode = function (abiItemModel, deployData) { var encodedParameters = this.abiCoder.encodeParameters( - this.getMethodParameterTypes(abiItem), - contractMethodParameters + abiItemModel.getInputs(), + abiItemModel.contractMethodParameters ).replace('0x', ''); - if (signature === 'constructor') { + if (abiItemModel.signature === 'constructor') { if (!deployData) { - throw new Error( + return new Error( 'The contract has no contract data option set. This is necessary to append the constructor parameters.' ); } @@ -59,30 +57,11 @@ MethodEncoder.prototype.encode = function (contractMethodParameters, abiItem, si return deployData + encodedParameters; } - if (abiItem.type === 'function') { - return signature + encodedParameters; + if (abiItemModel.isOfType('function')) { + return abiItemModel.signature + encodedParameters; } return encodedParameters; }; -/** - * Returns the method parameter types from the abi - * - * @method getMethodParameterTypes - * - * @param {Object} abiItem - * - * @returns {Array} - */ -MethodEncoder.prototype.getMethodParameterTypes = function (abiItem) { - var methodParameterTypes = []; - - if (_.isArray(abiItem.inputs)) { - methodParameterTypes = abiItem.inputs; - } - - return methodParameterTypes; -}; - module.exports = MethodEncoder; diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index a5dee062a6c..6be93669d04 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -22,21 +22,20 @@ "use strict"; -var AbiModel = require('../models/AbiModel'); -var AbiItemModel = require('../models/AbiItemModel'); +var AbiModel = require('../models/abi/AbiModel'); +var AbiItemModel = require('../models/abi/AbiItemModel'); var MethodEncoder = require('../encoders/MethodEncoder'); var MethodResponseDecoder = require('../decoders/MethodResponseDecoder'); var AbiMapper = require('../mappers/AbiMapper'); -var MethodOptionsMapper = require('../mappers/MethodOptionsMapper'); +var RpcMethodOptionsMapper = require('../mappers/RpcMethodOptionsMapper'); var MethodsProxy = require('../proxies/MethodsProxy'); -var MethodValidator = require('../validators/MethodValidator'); +var RpcMethodOptionsValidator = require('../validators/RpcMethodOptionsValidator'); var RpcMethodFactory = require('../factories/RpcMethodFactory'); /** * @constructor */ -function ContractPackageFactory() { -} +function ContractPackageFactory() { } /** * Returns an object of AbiModel @@ -54,7 +53,7 @@ ContractPackageFactory.prototype.createAbiModel = function (mappedAbi) { /** * Returns an object of AbiItemModel * - * @methode createAbiItemModel + * @method createAbiItemModel * * @param {Object} abiItem * @@ -69,7 +68,7 @@ ContractPackageFactory.prototype.createAbiItemModel = function (abiItem) { * * @method createMethodEncoder * - * @param {AbiCoder} abiCoder + * @param {ABICoder} abiCoder * * @returns {MethodEncoder} */ @@ -82,7 +81,7 @@ ContractPackageFactory.prototype.createMethodEncoder = function (abiCoder) { * * @method createAbiMapper * - * @param {AbiCoder} abiCoder + * @param {ABICoder} abiCoder * @param {Utils} utils * * @returns {AbiMapper} @@ -96,7 +95,7 @@ ContractPackageFactory.prototype.createAbiMapper = function (abiCoder, utils) { * * @method createMethodResponseDecoder * - * @param {AbiCoder} abiCoder + * @param {ABICoder} abiCoder * * @returns {MethodResponseDecoder} */ @@ -105,25 +104,30 @@ ContractPackageFactory.prototype.createMethodResponseDecoder = function (abiCode }; /** - * Returns an object of MethodValidator + * Returns an object of RpcMethodOptionsValidator * - * @method createMethodValidator + * @method createRpcMethodOptionsValidator * * @param {Utils} utils * - * @returns {MethodValidator} + * @returns {RpcMethodOptionsValidator} */ -ContractPackageFactory.prototype.createMethodValidator = function (utils) { - return new MethodValidator(utils); +ContractPackageFactory.prototype.createRpcMethodOptionsValidator = function (utils) { + return new RpcMethodOptionsValidator(utils); }; /** - * Returns an object of MethodOptionsMapper + * Returns an object of RpcMethodOptionsMapper * - * @returns MethodOptionsMapper + * @method createRpcMethodOptionsMapper + * + * @param {Utils} utils + * @param {Object} formatters + * + * @returns {RpcMethodOptionsMapper} */ -ContractPackageFactory.prototype.createMethodOptionsMapper = function () { - return new MethodOptionsMapper(); +ContractPackageFactory.prototype.createRpcMethodOptionsMapper = function (utils, formatters) { + return new RpcMethodOptionsMapper(utils, formatters); }; /** @@ -131,18 +135,17 @@ ContractPackageFactory.prototype.createMethodOptionsMapper = function () { * * @method createRpcMethodFactory * - * @param {AbiCoder} abiCoder - * @param {MethodPackage} methodPackage + * @param {ABICoder} abiCoder * @param {Utils} utils * @param {Object} formatters + * @param {Accounts} accounts * * @returns {RpcMethodFactory} */ -ContractPackageFactory.prototype.createRpcMethodFactory = function (abiCoder, methodPackage, utils, formatters) { +ContractPackageFactory.prototype.createRpcMethodFactory = function (abiCoder, utils, formatters, accounts) { return new RpcMethodFactory( - methodPackage, - this.createMethodOptionsMapper(), - this.createMethodEncoder(abiCoder), + this.createMethodResponseDecoder(abiCoder), + accounts, utils, formatters ); @@ -154,25 +157,25 @@ ContractPackageFactory.prototype.createRpcMethodFactory = function (abiCoder, me * @method createMethodsProxy * * @param {AbiModel} abiModel - * @param methodPackage * @param {MethodController} methodController - * @param {AbiCoder} abiCoder + * @param {ABICoder} abiCoder * @param {Utils} utils * @param {Object} formatters + * @param {Accounts} accounts * * @returns {MethodsProxy} */ ContractPackageFactory.prototype.createMethodsProxy = function ( abiModel, - methodPackage, methodController, abiCoder, utils, - formatters + formatters, + accounts ) { return new MethodsProxy( abiModel, - this.createRpcMethodFactory(abiCoder, methodPackage, utils, formatters), + this.createRpcMethodFactory(abiCoder, utils, formatters, accounts), methodController, this.createMethodEncoder(abiCoder) ); diff --git a/packages/web3-eth-contract/src/factories/RpcMethodFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodFactory.js index dc7cb0735cd..12ed99a5f41 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodFactory.js @@ -22,21 +22,23 @@ "use strict"; +var SendContractMethodModel = require('../models/methods/SendContractMethodModel'); +var CallContractMethodModel = require('../models/methods/CallContractMethodModel'); +var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; + /** - * @param {MethodPackage} methodPackage - * @param {MethodOptionsMapper} methodOptionsMapper - * @param {MethodEncoder} methodEncoder + * @param {MethodResponseDecoder} methodResponseDecoder + * @param {Accounts} accounts * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function RpcMethodFactory(methodPackage, methodOptionsMapper, methodEncoder, utils, formatters) { - this.methodPackage = methodPackage; +function RpcMethodFactory(methodResponseDecoder, accounts, utils, formatters) { this.utils = utils; this.formatters = formatters; - this.methodOptionsMapper = methodOptionsMapper; - this.methodEncoder = methodEncoder; + this.methodResponseDecoder = methodResponseDecoder; + this.accounts = accounts; } /** @@ -53,27 +55,31 @@ RpcMethodFactory.prototype.createRpcMethod = function (abiItemModel) { switch (abiItemModel.requestType) { case 'call': - rpcMethod = new this.methodPackage.CallMethodModel(this.utils, this.formatters); - + rpcMethod = new CallContractMethodModel( + abiItemModel, + this.methodResponseDecoder, + this.utils, + this.formatters + ); break; case 'send' : - rpcMethod = new this.methodPackage.SendTransactionMethodModel(this.utils, this.formatters); - + rpcMethod = new SendContractMethodModel( + abiItemModel, + this.methodResponseDecoder, + this.utils, + this.formatters, + this.accounts + ); break; case 'estimate': - rpcMethod = new this.methodPackage.EstimateGasMethodModel(this.utils, this.formatters); - + rpcMethod = new EstimateGasMethodModel(this.utils, this.formatters); break; } if (typeof rpcMethod === 'undefined') { - throw Error('Unknown call type with name "' + abiItemModel.requestType + '"'); + throw Error('Unknown RPC call with name "' + abiItemModel.requestType + '"'); } - rpcMethod.methodArguments = arguments; - rpcMethod.parameters[0]['data'] = this.methodEncoder.encode(abiItemModel.contractMethodParameters); - rpcMethod.parameters = this.methodOptionsMapper.map(rpcMethod.parameters); - return rpcMethod; }; diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index aeb9bf71269..78ae52614ab 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file Contract.js + * @file index.js * @author Samuel Furter * @date 2018 */ @@ -25,7 +25,10 @@ var version = require('./package.json').version; var Contract = require('./Contract'); +// TODO: define public api module.exports = { version: version, Contract: Contract +// TODO: Refactor Contract object because of the new handling +// TODO: don't forget the currentProvider, defaultBlock, defaultAccount and accounts handling }; diff --git a/packages/web3-eth-contract/src/mappers/AbiMapper.js b/packages/web3-eth-contract/src/mappers/AbiMapper.js index c191431f355..274f8714c96 100644 --- a/packages/web3-eth-contract/src/mappers/AbiMapper.js +++ b/packages/web3-eth-contract/src/mappers/AbiMapper.js @@ -24,7 +24,7 @@ /** * @param {ContractPackageFactory} contractPackageFactory - * @param {AbiCoder} abiCoder + * @param {ABICoder} abiCoder * @param {Utils} utils * * @constructor @@ -93,7 +93,7 @@ AbiMapper.prototype.map = function (abi) { } }); - return this.contractPackage.createAbiModel(mappedAbiItem); + return this.contractPackageFactory.createAbiModel(mappedAbiItem); }; /** diff --git a/packages/web3-eth-contract/src/mappers/MethodOptionsMapper.js b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js similarity index 84% rename from packages/web3-eth-contract/src/mappers/MethodOptionsMapper.js rename to packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js index de628567aab..24182cfbc61 100644 --- a/packages/web3-eth-contract/src/mappers/MethodOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js @@ -15,14 +15,20 @@ along with web3.js. If not, see . */ /** - * @file MethodOptionsMapper.js + * @file RpcMethodOptionsMapper.js * @author Samuel Furter * @date 2018 */ "use strict"; -function MethodOptionsMapper(utils, formatters) { +/** + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function RpcMethodOptionsMapper(utils, formatters) { this.utils = utils; this.formatters = formatters; } @@ -35,7 +41,7 @@ function MethodOptionsMapper(utils, formatters) { * * @returns {Object} */ -MethodOptionsMapper.prototype.map = function (contract, options) { +RpcMethodOptionsMapper.prototype.map = function (contract, options) { var gasPrice = null; if (options.gasPrice) { gasPrice = String(options.gasPrice); @@ -57,4 +63,4 @@ MethodOptionsMapper.prototype.map = function (contract, options) { return options; }; -module.exports = MethodOptionsMapper; +module.exports = RpcMethodOptionsMapper; diff --git a/packages/web3-eth-contract/src/models/AbiItemModel.js b/packages/web3-eth-contract/src/models/abi/AbiItemModel.js similarity index 53% rename from packages/web3-eth-contract/src/models/AbiItemModel.js rename to packages/web3-eth-contract/src/models/abi/AbiItemModel.js index 722d0c079d4..dc1562fe5d9 100644 --- a/packages/web3-eth-contract/src/models/AbiItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/AbiItemModel.js @@ -31,6 +31,8 @@ var _ = require('underscore'); */ function AbiItemModel(abiItem) { this.abiItem = abiItem; + this.signature = this.abiItem.signature; + this.contractMethodParameters = []; } /** @@ -48,4 +50,52 @@ AbiItemModel.prototype.getInputLength = function () { return 0; }; +/** + * Checks if the given parameter array length matches the abiItem inputs length + * + * @method givenParametersLengthIsValid + * + * @returns {Error|Boolean} + */ +AbiItemModel.prototype.givenParametersLengthIsValid = function () { + var inputLength = this.getInputLength(); + + if (this.contractMethodParameters.length === inputLength) { + return true; + } + + return new Error( + 'The number of arguments is not matching the methods required number. You need to pass ' + + inputLength + ' arguments.' + ); +}; + +/** + * Returns all inputs of the abi item + * + * @method getInputs + * + * @returns {Array} + */ +AbiItemModel.prototype.getInputs = function () { + var inputs = []; + + if (_.isArray(this.abiItem.inputs)) { + inputs = this.abiItem.inputs; + } + + return inputs; +}; + +/** + * Checks the type of this abiItem + * + * @method isOfType + * + * @returns {Boolean} + */ +AbiItemModel.prototype.isOfType = function (type) { + return this.abiItem.type === type; +}; + module.export = AbiItemModel; diff --git a/packages/web3-eth-contract/src/models/AbiModel.js b/packages/web3-eth-contract/src/models/abi/AbiModel.js similarity index 100% rename from packages/web3-eth-contract/src/models/AbiModel.js rename to packages/web3-eth-contract/src/models/abi/AbiModel.js diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js new file mode 100644 index 00000000000..cf11bdb38a6 --- /dev/null +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -0,0 +1,58 @@ +/* + 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 . + */ +/** + * @file CallContractMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var CallMethodModel = require('web3-core-method').CallMethodModel; + +/** + * @param {AbiItemModel} abiItemModel + * @param {MethodResponseDecoder} methodResponseDecoder + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function CallContractMethodModel(abiItemModel, methodResponseDecoder, utils, formatters) { + CallMethodModel.call(this, utils, formatters); + + this.methodResponseDecoder = methodResponseDecoder; + this.abiItemModel = abiItemModel; +} + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Array} response + * + * @returns {*} + */ +CallContractMethodModel.prototype.afterExecution = function (response) { + return this.methodResponseDecoder.decode(this.abiItemModel, response); +}; + +CallContractMethodModel.prototype = Object.create(CallMethodModel.prototype); +CallContractMethodModel.prototype.constructor = CallContractMethodModel; + +module.exports = CallContractMethodModel; diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js new file mode 100644 index 00000000000..f39b132e3d0 --- /dev/null +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -0,0 +1,59 @@ +/* + 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 . + */ +/** + * @file SendContractMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; + +/** + * @param {AbiItemModel} abiItemModel + * @param {MethodResponseDecoder} methodResponseDecoder + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function SendContractMethodModel(abiItemModel, methodResponseDecoder, utils, formatters, accounts) { + SendTransactionMethodModel.call(this, utils, formatters, accounts); + + this.methodResponseDecoder = methodResponseDecoder; + this.abiItemModel = abiItemModel; +} + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {*} + */ +SendContractMethodModel.prototype.afterExecution = function (response) { + return this.methodResponseDecoder.decode(this.abiItemModel, response); +}; + +SendContractMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); +SendContractMethodModel.prototype.constructor = SendContractMethodModel; + +module.exports = SendContractMethodModel; diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index c2214d5e792..0dbd28d48e5 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -36,6 +36,7 @@ function EventSubscriptionsProxy(abiModel) { } /** + * TODO: Implement event handling * Checks if a contract event exists by the given name and returns the subscription otherwise it throws an error * * @method proxyHandler diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 7ca4295cb71..3e209b0e6ed 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -27,14 +27,28 @@ * @param {RpcMethodFactory} rpcMethodFactory * @param {MethodController} methodController * @param {MethodEncoder} methodEncoder + * @param {RpcMethodOptionsValidator} rpcMethodOptionsValidator + * @param {RpcMethodOptionsMapper} rpcMethodOptionsMapper + * @param {PromiEventPackage} promiEventPackage * * @constructor */ -function MethodsProxy(abiModel, rpcMethodFactory, methodController, methodEncoder) { +function MethodsProxy( + abiModel, + rpcMethodFactory, + methodController, + methodEncoder, + rpcMethodOptionsValidator, + rpcMethodOptionsMapper, + promiEventPackage +) { this.abiModel = abiModel; this.rpcMethodFactory = rpcMethodFactory; this.methodController = methodController; this.methodEncoder = methodEncoder; + this.rpcMethodOptionsValidator = rpcMethodOptionsValidator; + this.rpcMethodOptionsMapper = rpcMethodOptionsMapper; + this.promiEventPackage = promiEventPackage; return new Proxy(this, { get: this.proxyHandler @@ -52,6 +66,7 @@ function MethodsProxy(abiModel, rpcMethodFactory, methodController, methodEncode * @returns {Function|Error} */ MethodsProxy.prototype.proxyHandler = function (target, name) { + var self = this; var abiItemModel = this.abiModel.getMethod(name); if (abiItemModel) { @@ -63,27 +78,28 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { var rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); rpcMethod.methodArguments = arguments; - var contractMethodArgumentsValidationResult = self.contractMethodArgumentsValidator.validate(abiItemModel); - var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(rpcMethod); + var contractMethodParametersLengthIsValid = abiItemModel.givenParametersLengthIsValid(); - if (contractMethodArgumentsValidationResult !== true && rpcMethodOptionsValidationResult !== true) { - var promiEvent = new PromiEvent(); - var errorsObject = { - errors: [ - contractMethodArgumentsValidationResult, - rpcMethodOptionsValidationResult - ] - }; + if (contractMethodParametersLengthIsValid !== true) { + return this.handleValidationError(contractMethodParametersLengthIsValid, rpcMethod.callback); + } + + var encodedContractMethod = self.methodEncoder.encode(abiItemModel, target.contract.options.data); + if (encodedContractMethod instanceof Error) { + return this.handleValidationError(encodedContractMethod, rpcMethod.callback); + } + + rpcMethod.parameters[0]['data'] = encodedContractMethod; + rpcMethod.parameters = self.rpcMethodOptionsMapper.map(target.contract, rpcMethod.parameters[0]); - promiEvent.resolve(null); - promiEvent.reject(errorsObject); - promiEvent.eventEmitter.emit('error', errorsObject); + var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethod); - return promiEvent + if (rpcMethodOptionsValidationResult !== true) { + return self.handleValidationError(rpcMethodOptionsValidationResult, rpcMethod.callback); } return self.methodController.execute( - rcpMethod, + rpcMethod, target.currentProvider, target.accounts, target @@ -106,18 +122,35 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { ); }; - anonymousFunction.encodeAbi = this.methodEncoder.encode(abiItemModel, target.contractOptions.data); + anonymousFunction.encodeAbi = this.methodEncoder.encode(abiItemModel, target.contract.options.data); } throw Error('Method with name "' + name + '" not found'); }; -MethodsProxy.prototype.handleValidationErrors = function (errors) { - // return PromiEvent if errors -}; +/** + * Creates an promiEvent and rejects it with an error + * + * @method handleValidationError + * + * @param {Error} error + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ +MethodsProxy.prototype.handleValidationError = function (error, callback) { + var promiEvent = this.promiEventPackage.createPromiEvent(); + + promiEvent.resolve(null); + promiEvent.reject(error); + promiEvent.eventEmitter.emit('error', error); + + if (_.isFunction(callback)) { + callback(error, null); + } -MethodsProxy.prototype.extendRpcMethodWithResponseDecoder = function (rpcMethod) { - // Extend afterExecution of the AbstractMethodModel with decoding of the response + return promiEvent; }; module.exports = MethodsProxy; diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js index 89aedd6cebe..4ebeb5afd13 100644 --- a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -33,11 +33,30 @@ function RpcMethodOptionsValidator(utils) { this.utils = utils; } +/** + * Validates the options object for the RPC-Method call + * + * @method validate + * + * @param {AbiItemModel} abiItemModel + * @param {AbstractMethodModel} rpcMethodModel + * + * @returns {Error|Boolean} + */ RpcMethodOptionsValidator.prototype.validate = function (abiItemModel, rpcMethodModel) { - // errors.push(new Error('This contract object doesn\'t have address set yet, please set an address first.')); - // errors.push(new Error('No "from" address specified in neither the given options, nor the default options.')); - // errors.push(new Error('Can not send value to non-payable contract method or constructor')); - // errors.push(new Error('Invalid arguments length')); + if (this.isToSet(abiItemModel, rpcMethodModel)) { + return new Error('This contract object doesn\'t have address set yet, please set an address first.'); + } + + if (this.isFromSet(rpcMethodModel)) { + return new Error('No "from" address specified in neither the given options, nor the default options.'); + } + + if (this.isValueValid(abiItemModel, rpcMethodModel)) { + return new Error('Can not send value to non-payable contract method or constructor') + } + + return true; }; /** @@ -51,38 +70,38 @@ RpcMethodOptionsValidator.prototype.validate = function (abiItemModel, rpcMethod * @returns {Boolean} */ RpcMethodOptionsValidator.prototype.isToSet = function (abiItemModel, rpcMethodModel) { - return !(abiItemModel.signature !== 'constructor' && !rpcMethodModel.parameters[0].to); + if (abiItemModel.signature === 'constructor') { + return true; + } + + return !!rpcMethodModel.parameters[0].to; }; /** * Checks if the property from of the options object is set and a valid address * - * @method isFromNotSet + * @method isFromSet * * @param {AbstractMethodModel} rpcMethodModel * * @returns {Boolean} */ -RpcMethodOptionsValidator.prototype.isFromNotSet = function (rpcMethodModel) { +RpcMethodOptionsValidator.prototype.isFromSet = function (rpcMethodModel) { return this.utils.isAddress(rpcMethodModel.parameters[0].from); }; /** * Checks if no value is set for an non-payable method * - * @method isValueEmptyForNonPayable + * @method isValueValid * * @param {AbiItemModel} abiItemModel * @param {AbstractMethodModel} rpcMethodModel * * @returns {Boolean} */ -RpcMethodOptionsValidator.prototype.isValueEmptyForNonPayable = function (abiItemModel, rpcMethodModel) { - return !( - !abiItemModel.payable && - rpcMethodModel.parameters[0].options.value && - rpcMethodModel.parameters[0].options.value > 0 - ); +RpcMethodOptionsValidator.prototype.isValueValid = function (abiItemModel, rpcMethodModel) { + return !(!abiItemModel.payable && rpcMethodModel.parameters[0].value && rpcMethodModel.parameters[0].value > 0); }; module.exports = RpcMethodOptionsValidator; From 291dc0aec16ca73a45005f9cc2dc16e251cfe11f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 12:42:57 +0200 Subject: [PATCH 0147/1045] because of the complexity I've added inline comments to the proxyHandler of MethodsProxy --- packages/web3-eth-contract/src/proxies/MethodsProxy.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 3e209b0e6ed..96bc38c8d1c 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -75,29 +75,35 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { }; anonymousFunction[abiItemModel.requestType] = function () { + // Get correct rpc method model var rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); rpcMethod.methodArguments = arguments; + // Validate contract method parameters length var contractMethodParametersLengthIsValid = abiItemModel.givenParametersLengthIsValid(); - if (contractMethodParametersLengthIsValid !== true) { return this.handleValidationError(contractMethodParametersLengthIsValid, rpcMethod.callback); } + // Encode contract method and check if there was an error var encodedContractMethod = self.methodEncoder.encode(abiItemModel, target.contract.options.data); if (encodedContractMethod instanceof Error) { return this.handleValidationError(encodedContractMethod, rpcMethod.callback); } + // Set encoded contractMethod as data property of the transaction or call rpcMethod.parameters[0]['data'] = encodedContractMethod; + + // Set default options in the TxObject if needed rpcMethod.parameters = self.rpcMethodOptionsMapper.map(target.contract, rpcMethod.parameters[0]); + // Validate TxObject options var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethod); - if (rpcMethodOptionsValidationResult !== true) { return self.handleValidationError(rpcMethodOptionsValidationResult, rpcMethod.callback); } + // Send JSON-RPC request return self.methodController.execute( rpcMethod, target.currentProvider, From b1ff2968380d82d46c3f849412c1ba53efb58ff1 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 12:48:48 +0200 Subject: [PATCH 0148/1045] try/catch added in MethodEncoder --- .../web3-eth-contract/src/encoders/MethodEncoder.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/web3-eth-contract/src/encoders/MethodEncoder.js b/packages/web3-eth-contract/src/encoders/MethodEncoder.js index dc75d1b19e0..c02f4e27800 100644 --- a/packages/web3-eth-contract/src/encoders/MethodEncoder.js +++ b/packages/web3-eth-contract/src/encoders/MethodEncoder.js @@ -42,10 +42,14 @@ function MethodEncoder(abiCoder) { * @returns {String|Error} */ MethodEncoder.prototype.encode = function (abiItemModel, deployData) { - var encodedParameters = this.abiCoder.encodeParameters( - abiItemModel.getInputs(), - abiItemModel.contractMethodParameters - ).replace('0x', ''); + try { + var encodedParameters = this.abiCoder.encodeParameters( + abiItemModel.getInputs(), + abiItemModel.contractMethodParameters + ).replace('0x', ''); + } catch (error) { + return error; + } if (abiItemModel.signature === 'constructor') { if (!deployData) { From e7adb8ab3e795c7c803f7a7a8419fcfebb1b4955 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 13:57:58 +0200 Subject: [PATCH 0149/1045] POC implementation of Contract --- packages/web3-eth-contract/src/Contract.js | 959 ++++----------------- 1 file changed, 150 insertions(+), 809 deletions(-) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index af5dc4c206c..97c5e999d49 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -1,868 +1,209 @@ /* - This file is part of web3.js. + 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 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. + 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 . -*/ + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ /** * @file Contract.js - * - * To initialize a contract use: - * - * var Contract = require('web3-eth-contract'); - * Contract.setProvider('ws://localhost:8546'); - * var contract = new Contract(abi, address, ...); - * - * @author Fabian Vogelsteller - * @date 2017 + * @author Samuel Furter + * @date 2018 */ - "use strict"; - -var _ = require('underscore'); -var core = require('web3-core'); -var Method = require('web3-core-method'); -var utils = require('web3-utils'); -var Subscription = require('web3-core-subscriptions').subscription; -var formatters = require('web3-core-helpers').formatters; -var errors = require('web3-core-helpers').errors; -var promiEvent = require('web3-core-promievent'); -var abi = require('web3-eth-abi'); - - -/** - * Should be called to create new contract instance - * - * @param {Array} jsonInterface +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; + +/** + * @param {AbstractProviderAdapter} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {SubscriptionPackage} subscriptionPackage + * @param {BatchRequestPackage} batchRequestPackage + * @param {ContractPackageFactory} contractPackageFactory + * @param {AbiCoder} abiCoder + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * @param {AbiMapper} abiMapper + * @param {Array} abi * @param {String} address * @param {Object} options * * @constructor */ -var Contract = function Contract(jsonInterface, address, options) { - var _this = this, - args = Array.prototype.slice.call(arguments); - +function Contract( + provider, + providersPackage, + methodController, + subscriptionPackage, + batchRequestPackage, + contractPackageFactory, + abiCoder, + utils, + formatters, + accounts, + abiMapper, + abi, + address, + options, +) { if (!(this instanceof Contract)) { throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!'); } - this.clearSubscriptions = this.connectionModel.provider.clearSubscriptions; - - if (!jsonInterface || !(Array.isArray(jsonInterface))) { + if (!abi || !(Array.isArray(abi))) { throw new Error('You must provide the json interface of the contract when instantiating a contract object.'); } + this.provider = provider; + this.providersPackage = providersPackage; + this.methodController = methodController; + this.subscriptionPackage = subscriptionPackage; + this.batchRequestPackage = batchRequestPackage; + this.contractPackageFactory = contractPackageFactory; + this.abiCoder = abiCoder; + this.utils = utils; + this.formatters = formatters; + this.accounts = accounts; + this.abiMapper = abiMapper; + this.options = options; + + AbstractWeb3Object.call( + this, + this.provider, + this.providersPackage, + null, + null, + this.subscriptionPackage, + this.batchRequestPackage + ); + + var self = this, + _address = null, + abiModel = abiMapper.map(abi); - // create the options object - this.options = {}; - - var lastArg = args[args.length - 1]; - if (_.isObject(lastArg) && !_.isArray(lastArg)) { - options = lastArg; - - this.options = _.extend(this.options, this._getOrSetDefaultOptions(options)); - if (_.isObject(address)) { - address = null; - } - } - - // set address Object.defineProperty(this.options, 'address', { set: function (value) { if (value) { - _this._address = utils.toChecksumAddress(formatters.inputAddressFormatter(value)); + _address = self.utils.toChecksumAddress(self.formatters.inputAddressFormatter(value)); } }, get: function () { - return _this._address; + return _address; }, enumerable: true }); - // add method and event signatures, when the jsonInterface gets set Object.defineProperty(this.options, 'jsonInterface', { set: function (value) { - _this.methods = {}; - _this.events = {}; - - _this._jsonInterface = value.map(function (method) { - var func, - funcName; - - // make constant and payable backwards compatible - method.constant = (method.stateMutability === "view" || method.stateMutability === "pure" || method.constant); - method.payable = (method.stateMutability === "payable" || method.payable); - - - if (method.name) { - funcName = utils._jsonInterfaceMethodToString(method); - } - - - // function - if (method.type === 'function') { - method.signature = abi.encodeFunctionSignature(funcName); - func = _this._createTxObject.bind({ - method: method, - parent: _this - }); - - - // add method only if not one already exists - if (!_this.methods[method.name]) { - _this.methods[method.name] = func; - } else { - var cascadeFunc = _this._createTxObject.bind({ - method: method, - parent: _this, - nextMethod: _this.methods[method.name] - }); - _this.methods[method.name] = cascadeFunc; - } - - // definitely add the method based on its signature - _this.methods[method.signature] = func; - - // add method by name - _this.methods[funcName] = func; - - - // event - } else if (method.type === 'event') { - method.signature = abi.encodeEventSignature(funcName); - var event = _this._on.bind(_this, method.signature); - - // add method only if not already exists - if (!_this.events[method.name] || _this.events[method.name].name === 'bound ') - _this.events[method.name] = event; - - // definitely add the method based on its signature - _this.events[method.signature] = event; - - // add event by name - _this.events[funcName] = event; - } - - - return method; - }); - - // add allEvents - _this.events.allEvents = _this._on.bind(_this, 'allevents'); - - return _this._jsonInterface; + abiModel = self.abiMapper.map(value); + self.methods.abiModel = abiModel; + self.events.abiModel = abiModel; }, get: function () { - return _this._jsonInterface; + return abiModel; }, enumerable: true }); - // properties - this.methods = {}; - this.events = {}; + this.methods = contractPackageFactory.createMethodsProxy( + abiModel, + this.methodController, + this.abiCoder, + this.utils, + this.formatters, + this.accounts + ); - this._address = null; - this._jsonInterface = []; - - // set getter/setter properties + this.events = contractPackageFactory.createEventsSubscriptionsProxy(); this.options.address = address; - this.options.jsonInterface = jsonInterface; - -}; - -Contract.setProvider = function (provider, accounts) { - this.connectionModel.provider = provider; - this.accounts = accounts; -}; - - -/** - * Get the callback and modiufy the array if necessary - * - * @method _getCallback - * @param {Array} args - * @return {Function} the callback - */ -Contract.prototype._getCallback = function getCallback(args) { - if (args && _.isFunction(args[args.length - 1])) { - return args.pop(); // modify the args array! - } -}; - -/** - * Checks that no listener with name "newListener" or "removeListener" is added. - * - * @method _checkListener - * @param {String} type - * @param {String} event - * @return {Object} the contract instance - */ -Contract.prototype._checkListener = function (type, event) { - if (event === type) { - throw new Error('The event "' + type + '" is a reserved event name, you can\'t use it.'); - } -}; - - -/** - * Use default values, if options are not available - * - * @method _getOrSetDefaultOptions - * @param {Object} options the options gived by the user - * @return {Object} the options with gaps filled by defaults - */ -Contract.prototype._getOrSetDefaultOptions = function getOrSetDefaultOptions(options) { - var gasPrice = options.gasPrice ? String(options.gasPrice) : null; - var from = options.from ? utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)) : null; - - options.data = options.data || this.options.data; - - options.from = from || this.options.from; - options.gasPrice = gasPrice || this.options.gasPrice; - options.gas = options.gas || options.gasLimit || this.options.gas; - - // TODO replace with only gasLimit? - delete options.gasLimit; - - return options; -}; - - -/** - * Should be used to encode indexed params and options to one final object - * - * @method _encodeEventABI - * @param {Object} event - * @param {Object} options - * @return {Object} everything combined together and encoded - */ -Contract.prototype._encodeEventABI = function (event, options) { - options = options || {}; - var filter = options.filter || {}, - result = {}; - - ['fromBlock', 'toBlock'].filter(function (f) { - return options[f] !== undefined; - }).forEach(function (f) { - result[f] = formatters.inputBlockNumberFormatter(options[f]); - }); - - // use given topics - if (_.isArray(options.topics)) { - result.topics = options.topics; - - // create topics based on filter - } else { - - result.topics = []; - - // add event signature - if (event && !event.anonymous && event.name !== 'ALLEVENTS') { - result.topics.push(event.signature); - } - - // add event topics (indexed arguments) - if (event.name !== 'ALLEVENTS') { - var indexedTopics = event.inputs.filter(function (i) { - return i.indexed === true; - }).map(function (i) { - var value = filter[i.name]; - if (!value) { - return null; - } - - // TODO: https://github.com/ethereum/web3.js/issues/344 - // TODO: deal properly with components - - if (_.isArray(value)) { - return value.map(function (v) { - return abi.encodeParameter(i.type, v); - }); - } - return abi.encodeParameter(i.type, value); - }); - - result.topics = result.topics.concat(indexedTopics); - } - - if (!result.topics.length) - delete result.topics; - } - - if (this.options.address) { - result.address = this.options.address.toLowerCase(); - } - - return result; -}; - -/** - * Should be used to decode indexed params and options - * - * @method _decodeEventABI - * @param {Object} data - * @return {Object} result object with decoded indexed && not indexed params - */ -Contract.prototype._decodeEventABI = function (data) { - var event = this; - - data.data = data.data || ''; - data.topics = data.topics || []; - var result = formatters.outputLogFormatter(data); - - // if allEvents get the right event - if (event.name === 'ALLEVENTS') { - event = event.jsonInterface.find(function (intf) { - return (intf.signature === data.topics[0]); - }) || {anonymous: true}; - } - - // create empty inputs if none are present (e.g. anonymous events on allEvents) - event.inputs = event.inputs || []; - - - var argTopics = event.anonymous ? data.topics : data.topics.slice(1); - - result.returnValues = abi.decodeLog(event.inputs, data.data, argTopics); - delete result.returnValues.__length__; - - // add name - result.event = event.name; - - // add signature - result.signature = (event.anonymous || !data.topics[0]) ? null : data.topics[0]; - - // move the data and topics to "raw" - result.raw = { - data: result.data, - topics: result.topics - }; - delete result.data; - delete result.topics; - - - return result; -}; - -/** - * Encodes an ABI for a method, including signature or the method. - * Or when constructor encodes only the constructor parameters. - * - * @method _encodeMethodABI - * @param {Mixed} args the arguments to encode - * @param {String} the encoded ABI - */ -Contract.prototype._encodeMethodABI = function _encodeMethodABI() { - var methodSignature = this._method.signature, - args = this.arguments || []; - - var signature = false, - paramsABI = this._parent.options.jsonInterface.filter(function (json) { - return ((methodSignature === 'constructor' && json.type === methodSignature) || - ((json.signature === methodSignature || json.signature === methodSignature.replace('0x', '') || json.name === methodSignature) && json.type === 'function')); - }).map(function (json) { - var inputLength = (_.isArray(json.inputs)) ? json.inputs.length : 0; - - if (inputLength !== args.length) { - throw new Error('The number of arguments is not matching the methods required number. You need to pass ' + inputLength + ' arguments.'); - } - - if (json.type === 'function') { - signature = json.signature; - } - return _.isArray(json.inputs) ? json.inputs : []; - }).map(function (inputs) { - return abi.encodeParameters(inputs, args).replace('0x', ''); - })[0] || ''; - - // return constructor - if (methodSignature === 'constructor') { - if (!this._deployData) - throw new Error('The contract has no contract data option set. This is necessary to append the constructor parameters.'); - - return this._deployData + paramsABI; - - // return method - } else { - - var returnValue = (signature) ? signature + paramsABI : paramsABI; - - if (!returnValue) { - throw new Error('Couldn\'t find a matching contract method named "' + this._method.name + '".'); - } else { - return returnValue; - } - } - -}; - - -/** - * Decode method return values - * - * @method _decodeMethodReturn - * @param {Array} outputs - * @param {String} returnValues - * @return {Object} decoded output return values - */ -Contract.prototype._decodeMethodReturn = function (outputs, returnValues) { - if (!returnValues) { - return null; - } - - returnValues = returnValues.length >= 2 ? returnValues.slice(2) : returnValues; - var result = abi.decodeParameters(outputs, returnValues); - - if (result.__length__ === 1) { - return result[0]; - } else { - delete result.__length__; - return result; - } -}; +} - -/** - * Deploys a contract and fire events based on its state: transactionHash, receipt - * - * All event listeners will be removed, once the last possible event is fired ("error", or "receipt") - * - * @method deploy - * @param {Object} options - * @param {Function} callback - * @return {Object} EventEmitter possible events are "error", "transactionHash" and "receipt" - */ -Contract.prototype.deploy = function (options, callback) { - options = options || {}; - - options.arguments = options.arguments || []; - options = this._getOrSetDefaultOptions(options); - - - // return error, if no "data" is specified - if (!options.data) { - return utils._fireError(new Error('No "data" specified in neither the given options, nor the default options.'), null, null, callback); - } - - var constructor = _.find(this.options.jsonInterface, function (method) { - return (method.type === 'constructor'); - }) || {}; - constructor.signature = 'constructor'; - - return this._createTxObject.apply({ - method: constructor, - parent: this, - deployData: options.data, - _ethAccounts: this.accounts - }, options.arguments); - -}; - -/** - * Gets the event signature and outputformatters - * - * @method _generateEventOptions - * @param {Object} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the event options object - */ -Contract.prototype._generateEventOptions = function () { - var args = Array.prototype.slice.call(arguments); - - // get the callback - var callback = this._getCallback(args); - - // get the options - var options = (_.isObject(args[args.length - 1])) ? args.pop() : {}; - - var event = (_.isString(args[0])) ? args[0] : 'allevents'; - event = (event.toLowerCase() === 'allevents') ? { - name: 'ALLEVENTS', - jsonInterface: this.options.jsonInterface - } : this.options.jsonInterface.find(function (json) { - return (json.type === 'event' && (json.name === event || json.signature === '0x' + event.replace('0x', ''))); - }); - - if (!event) { - throw new Error('Event "' + event.name + '" doesn\'t exist in this contract.'); - } - - if (!utils.isAddress(this.options.address)) { - throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); - } - - return { - params: this._encodeEventABI(event, options), - event: event, - callback: callback - }; -}; - -/** - * Adds event listeners and creates a subscription, and remove it once its fired. - * - * @method clone - * @return {Object} the event subscription - */ -Contract.prototype.clone = function () { - return new this.constructor(this.options.jsonInterface, this.options.address, this.options); -}; - - -/** - * Adds event listeners and creates a subscription, and remove it once its fired. - * - * @method once - * @param {String} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the event subscription - */ Contract.prototype.once = function (event, options, callback) { - var args = Array.prototype.slice.call(arguments); - - // get the callback - callback = this._getCallback(args); - - if (!callback) { - throw new Error('Once requires a callback as the second parameter.'); - } - - // don't allow fromBlock - if (options) - delete options.fromBlock; - - // don't return as once shouldn't provide "on" - this._on(event, options, function (err, res, sub) { - sub.unsubscribe(); - if (_.isFunction(callback)) { - callback(err, res, sub); - } - }); - - return undefined; + // var args = Array.prototype.slice.call(arguments); + // + // // get the callback + // callback = this._getCallback(args); + // + // if (!callback) { + // throw new Error('Once requires a callback as the second parameter.'); + // } + // + // // don't allow fromBlock + // if (options) + // delete options.fromBlock; + // + // // don't return as once shouldn't provide "on" + // this._on(event, options, function (err, res, sub) { + // sub.unsubscribe(); + // if (_.isFunction(callback)) { + // callback(err, res, sub); + // } + // }); + // + // return undefined; }; -/** - * Adds event listeners and creates a subscription. - * - * @method _on - * @param {String} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the event subscription - */ -Contract.prototype._on = function () { - var subOptions = this._generateEventOptions.apply(this, arguments); - - - // prevent the event "newListener" and "removeListener" from being overwritten - this._checkListener('newListener', subOptions.event.name, subOptions.callback); - this._checkListener('removeListener', subOptions.event.name, subOptions.callback); - - // TODO check if listener already exists? and reuse subscription if options are the same. - - // create new subscription - var subscription = new Subscription({ - subscription: { - params: 1, - inputFormatter: [formatters.inputLogFormatter], - outputFormatter: this._decodeEventABI.bind(subOptions.event), - // DUBLICATE, also in web3-eth - subscriptionHandler: function (output) { - if (output.removed) { - this.emit('changed', output); - } else { - this.emit('data', output); - } - - if (_.isFunction(this.callback)) { - this.callback(null, output, this); - } - } - }, - type: 'eth', - requestManager: this._requestManager - }); - subscription.subscribe('logs', subOptions.params, subOptions.callback || function () { - }); - - return subscription; -}; - -/** - * Get past events from contracts - * - * @method getPastEvents - * @param {String} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the promievent - */ Contract.prototype.getPastEvents = function () { - var subOptions = this._generateEventOptions.apply(this, arguments); - - var getPastLogs = new Method({ - name: 'getPastLogs', - call: 'eth_getLogs', - params: 1, - inputFormatter: [formatters.inputLogFormatter], - outputFormatter: this._decodeEventABI.bind(subOptions.event) - }); - getPastLogs.setRequestManager(this._requestManager); - var call = getPastLogs.buildCall(); - - getPastLogs = null; - - return call(subOptions.params, subOptions.callback); + // var subOptions = this._generateEventOptions.apply(this, arguments); + // + // var getPastLogs = new Method({ + // name: 'getPastLogs', + // call: 'eth_getLogs', + // params: 1, + // inputFormatter: [formatters.inputLogFormatter], + // outputFormatter: this._decodeEventABI.bind(subOptions.event) + // }); + // getPastLogs.setRequestManager(this._requestManager); + // var call = getPastLogs.buildCall(); + // + // getPastLogs = null; + // + // return call(subOptions.params, subOptions.callback); }; +Contract.prototype.deploy = function () { -/** - * returns the an object with call, send, estimate functions - * - * @method _createTxObject - * @returns {Object} an object with functions to call the methods - */ -Contract.prototype._createTxObject = function _createTxObject() { - var args = Array.prototype.slice.call(arguments); - var txObject = {}; - - if (this.method.type === 'function') { - - txObject.call = this.parent._executeMethod.bind(txObject, 'call'); - txObject.call.request = this.parent._executeMethod.bind(txObject, 'call', true); // to make batch requests - - } - - txObject.send = this.parent._executeMethod.bind(txObject, 'send'); - txObject.send.request = this.parent._executeMethod.bind(txObject, 'send', true); // to make batch requests - txObject.encodeABI = this.parent._encodeMethodABI.bind(txObject); - txObject.estimateGas = this.parent._executeMethod.bind(txObject, 'estimate'); - - if (args && this.method.inputs && args.length !== this.method.inputs.length) { - if (this.nextMethod) { - return this.nextMethod.apply(null, args); - } - throw errors.InvalidNumberOfParams(args.length, this.method.inputs.length, this.method.name); - } - - txObject.arguments = args || []; - txObject._method = this.method; - txObject._parent = this.parent; - txObject._ethAccounts = this.parent.accounts || this._ethAccounts; - - if (this.deployData) { - txObject._deployData = this.deployData; - } - - return txObject; }; - /** - * Generates the options for the execute call + * Return an new instance of the Contract object * - * @method _processExecuteArguments - * @param {Array} args - * @param {Promise} defer - */ -Contract.prototype._processExecuteArguments = function _processExecuteArguments(args, defer) { - var processedArgs = {}; - - processedArgs.type = args.shift(); - - // get the callback - processedArgs.callback = this._parent._getCallback(args); - - // get block number to use for call - if (processedArgs.type === 'call' && args[args.length - 1] !== true && (_.isString(args[args.length - 1]) || isFinite(args[args.length - 1]))) - processedArgs.defaultBlock = args.pop(); - - // get the options - processedArgs.options = (_.isObject(args[args.length - 1])) ? args.pop() : {}; - - // get the generateRequest argument for batch requests - processedArgs.generateRequest = (args[args.length - 1] === true) ? args.pop() : false; - - processedArgs.options = this._parent._getOrSetDefaultOptions(processedArgs.options); - processedArgs.options.data = this.encodeABI(); - - // add contract address - if (!this._deployData && !utils.isAddress(this._parent.options.address)) - throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); - - if (!this._deployData) - processedArgs.options.to = this._parent.options.address; - - // return error, if no "data" is specified - if (!processedArgs.options.data) - return utils._fireError(new Error('Couldn\'t find a matching contract method, or the number of parameters is wrong.'), defer.eventEmitter, defer.reject, processedArgs.callback); - - return processedArgs; -}; - -/** - * Executes a call, transact or estimateGas on a contract function + * @method clone * - * @method _executeMethod - * @param {String} type the type this execute function should execute - * @param {Boolean} makeRequest if true, it simply returns the request parameters, rather than executing it + * @returns {Contract} */ -Contract.prototype._executeMethod = function _executeMethod() { - var _this = this, - args = this._parent._processExecuteArguments.call(this, Array.prototype.slice.call(arguments), defer), - defer = promiEvent((args.type !== 'send')), - ethAccounts = _this.accounts || _this._ethAccounts; - - // simple return request for batch requests - if (args.generateRequest) { - - var payload = { - params: [formatters.inputCallFormatter.call(this._parent, args.options)], - callback: args.callback - }; - - if (args.type === 'call') { - payload.params.push(formatters.inputDefaultBlockNumberFormatter.call(this._parent, args.defaultBlock)); - payload.method = 'eth_call'; - payload.format = this._parent._decodeMethodReturn.bind(null, this._method.outputs); - } else { - payload.method = 'eth_sendTransaction'; - } - - return payload; - - } else { - - switch (args.type) { - case 'estimate': - - var estimateGas = (new Method({ - name: 'estimateGas', - call: 'eth_estimateGas', - params: 1, - inputFormatter: [formatters.inputCallFormatter], - outputFormatter: utils.hexToNumber, - requestManager: _this._parent._requestManager, - accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.connectionModel.defaultAccount, - defaultBlock: _this._parent.connectionModel.defaultBlock - })).createFunction(); - - return estimateGas(args.options, args.callback); - - case 'call': - - // TODO check errors: missing "from" should give error on deploy and send, call ? - - var call = (new Method({ - name: 'call', - call: 'eth_call', - params: 2, - inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter], - // add output formatter for decoding - outputFormatter: function (result) { - return _this._parent._decodeMethodReturn(_this._method.outputs, result); - }, - requestManager: _this._parent._requestManager, - accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.connectionModel.defaultAccount, - defaultBlock: _this._parent.connectionModel.defaultBlock - })).createFunction(); - - return call(args.options, args.defaultBlock, args.callback); - - case 'send': - - // return error, if no "from" is specified - if (!utils.isAddress(args.options.from)) { - return utils._fireError(new Error('No "from" address specified in neither the given options, nor the default options.'), defer.eventEmitter, defer.reject, args.callback); - } - - if (_.isBoolean(this._method.payable) && !this._method.payable && args.options.value && args.options.value > 0) { - return utils._fireError(new Error('Can not send value to non-payable contract method or constructor'), defer.eventEmitter, defer.reject, args.callback); - } - - - // make sure receipt logs are decoded - var extraFormatters = {// TODO: The new method package does not support the extraFormatters - receiptFormatter: function (receipt) { - if (_.isArray(receipt.logs)) { - - // decode logs - var events = _.map(receipt.logs, function (log) { - return _this._parent._decodeEventABI.call({ - name: 'ALLEVENTS', - jsonInterface: _this._parent.options.jsonInterface - }, log); - }); - - // make log names keys - receipt.events = {}; - var count = 0; - events.forEach(function (ev) { - if (ev.event) { - // if > 1 of the same event, don't overwrite any existing events - if (receipt.events[ev.event]) { - if (Array.isArray(receipt.events[ev.event])) { - receipt.events[ev.event].push(ev); - } else { - receipt.events[ev.event] = [receipt.events[ev.event], ev]; - } - } else { - receipt.events[ev.event] = ev; - } - } else { - receipt.events[count] = ev; - count++; - } - }); - - delete receipt.logs; - } - return receipt; - }, - contractDeployFormatter: function (receipt) { - var newContract = _this._parent.clone(); - newContract.options.address = receipt.contractAddress; - return newContract; - } - }; - - var sendTransaction = (new Method({ - name: 'sendTransaction', - call: 'eth_sendTransaction', - params: 1, - inputFormatter: [formatters.inputTransactionFormatter], - requestManager: _this._parent._requestManager, - accounts: _this.accounts || _this._ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.connectionModel.defaultAccount, - defaultBlock: _this._parent.connectionModel.defaultBlock, - extraFormatters: extraFormatters // TODO: the new method package does not support extraFormatters - })).createFunction(); - - return sendTransaction(args.options, args.callback); - - } - - } - -}; +Contract.prototype.clone = function () { + return new this.constructor( + this.provider, + this.providersPackage, + this.methodController, + this.subscriptionPackage, + this.batchRequestPackage, + this.contractPackageFactory, + this.abiCoder, + this.utils, + this.formatters, + this.accounts, + this.abiMapper, + this.options.jsonInterface, + this.options.address, + this.options + ); +}; + +Contract.prototype = Object.create(AbstractWeb3Object.prototype); +Contract.prototype.constructor = Contract; module.exports = Contract; From 22d73413873809df0ea0d48c0954f0aceb58fc25 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 15:09:14 +0200 Subject: [PATCH 0150/1045] funcDoc updated for MethodResponseDecoder, Contract constructor improved --- packages/web3-eth-contract/src/Contract.js | 3 +-- .../web3-eth-contract/src/decoders/MethodResponseDecoder.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 97c5e999d49..fafb4f0fafe 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -90,7 +90,7 @@ function Contract( ); var self = this, - _address = null, + _address = self.utils.toChecksumAddress(self.formatters.inputAddressFormatter(address)), abiModel = abiMapper.map(abi); Object.defineProperty(this.options, 'address', { @@ -127,7 +127,6 @@ function Contract( ); this.events = contractPackageFactory.createEventsSubscriptionsProxy(); - this.options.address = address; } Contract.prototype.once = function (event, options, callback) { diff --git a/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js b/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js index 7604b018e8e..500f6491bda 100644 --- a/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js +++ b/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js @@ -37,8 +37,7 @@ function MethodResponseDecoder(abiCoder) { * @method decode * * @param {Array} abiItemOutputTypes - * @param {Array} response - * //TODO: Fix response handling + * @param {String} response * @returns {*} */ MethodResponseDecoder.prototype.decode = function (abiItemOutputTypes, response) { From 2f1312946c5aabd08bb7e1718c85f2da3ceaaa28 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 15:25:19 +0200 Subject: [PATCH 0151/1045] funcDoc improved in MethodController, proxyHandler method in MethodsProxy splited otherwise I would have a code duplication --- .../src/controllers/MethodController.js | 2 +- .../src/proxies/MethodsProxy.js | 122 +++++++++++------- 2 files changed, 78 insertions(+), 46 deletions(-) diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index df1c8928514..c07673e96e4 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -55,7 +55,7 @@ function MethodController( * @param {Accounts} accounts * @param {AbstractWeb3Object} web3Package * - * @returns {Promise | eventifiedPromise | String | boolean} + * @returns {Promise|PromiEvent|String|Boolean} */ MethodController.prototype.execute = function (methodModel, provider, accounts, web3Package) { var promiEvent = this.promiEventPackage.createPromiEvent(); diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 96bc38c8d1c..694e29d4af7 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -60,7 +60,7 @@ function MethodsProxy( * * @method proxyHandler * - * @param {Object} target + * @param {MethodsProxy} target * @param {String} name * * @returns {Function|Error} @@ -75,41 +75,7 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { }; anonymousFunction[abiItemModel.requestType] = function () { - // Get correct rpc method model - var rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); - rpcMethod.methodArguments = arguments; - - // Validate contract method parameters length - var contractMethodParametersLengthIsValid = abiItemModel.givenParametersLengthIsValid(); - if (contractMethodParametersLengthIsValid !== true) { - return this.handleValidationError(contractMethodParametersLengthIsValid, rpcMethod.callback); - } - - // Encode contract method and check if there was an error - var encodedContractMethod = self.methodEncoder.encode(abiItemModel, target.contract.options.data); - if (encodedContractMethod instanceof Error) { - return this.handleValidationError(encodedContractMethod, rpcMethod.callback); - } - - // Set encoded contractMethod as data property of the transaction or call - rpcMethod.parameters[0]['data'] = encodedContractMethod; - - // Set default options in the TxObject if needed - rpcMethod.parameters = self.rpcMethodOptionsMapper.map(target.contract, rpcMethod.parameters[0]); - - // Validate TxObject options - var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethod); - if (rpcMethodOptionsValidationResult !== true) { - return self.handleValidationError(rpcMethodOptionsValidationResult, rpcMethod.callback); - } - - // Send JSON-RPC request - return self.methodController.execute( - rpcMethod, - target.currentProvider, - target.accounts, - target - ); + return self.executeMethod(abiItemModel, target, arguments); }; anonymousFunction[abiItemModel.requestType].request = abiItemModel.request; @@ -117,15 +83,7 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { anonymousFunction.estimateGas = function () { abiItemModel.requestType = 'estimate'; - var rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); - rpcMethod.methodArguments = arguments; - - return self.methodController.execute( - rpcMethod, - target.currentProvider, - target.accounts, - target - ); + return self.executeMethod(abiItemModel, target, arguments); }; anonymousFunction.encodeAbi = this.methodEncoder.encode(abiItemModel, target.contract.options.data); @@ -134,6 +92,80 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { throw Error('Method with name "' + name + '" not found'); }; +/** + * Executes the RPC method with the methodController + * + * @param {AbiItemModel} abiItemModel + * @param {MethodsProxy} target + * @param {IArguments} methodArguments + * + * @returns {Promise|PromiEvent|String|Boolean} + */ +MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArguments) { + var rpcMethod = self.createRpcMethod(abiItemModel, target, methodArguments); + + if (typeof rpcMethod.error !== 'undefined') { + return self.handleValidationError(rpcMethod.error, rpcMethod.callback); + } + + return self.methodController.execute( + rpcMethod, + target.currentProvider, + target.accounts, + target + ); +}; + +/** + * Creates the rpc method, encodes the contract method and validate the objects. + * + * @param {AbiItemModel} abiItemModel + * @param {MethodsProxy} target + * @param {IArguments} methodArguments + * + * @returns {AbstractMethodModel} + */ +MethodsProxy.prototype.createRpcMethod = function (abiItemModel, target, methodArguments) { + // Get correct rpc method model + var rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); + rpcMethod.methodArguments = methodArguments; + + // Validate contract method parameters length + var contractMethodParametersLengthIsValid = abiItemModel.givenParametersLengthIsValid(); + if (contractMethodParametersLengthIsValid !== true) { + return { + error: contractMethodParametersLengthIsValid, + callback: rpcMethod.callback + }; + } + + // Encode contract method and check if there was an error + var encodedContractMethod = self.methodEncoder.encode(abiItemModel, target.contract.options.data); + if (encodedContractMethod instanceof Error) { + return { + error: encodedContractMethod, + callback: rpcMethod.callback + }; + } + + // Set encoded contractMethod as data property of the transaction or call + rpcMethod.parameters[0]['data'] = encodedContractMethod; + + // Set default options in the TxObject if needed + rpcMethod.parameters = self.rpcMethodOptionsMapper.map(target.contract, rpcMethod.parameters[0]); + + // Validate TxObject options + var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethod); + if (rpcMethodOptionsValidationResult !== true) { + return { + error: rpcMethodOptionsValidationResult, + callback: rpcMethod.callback + }; + } + + return rpcMethod; +}; + /** * Creates an promiEvent and rejects it with an error * From e00ad06c470358afb2eb4a1b70111871918dba77 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 15:28:25 +0200 Subject: [PATCH 0152/1045] batchRequest fixed in contract package --- packages/web3-eth-contract/src/proxies/MethodsProxy.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 694e29d4af7..708b67e0b10 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -78,7 +78,9 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { return self.executeMethod(abiItemModel, target, arguments); }; - anonymousFunction[abiItemModel.requestType].request = abiItemModel.request; + anonymousFunction[abiItemModel.requestType].request = function () { + return self.createRpcMethod(abiItemModel, target, arguments); + }; anonymousFunction.estimateGas = function () { abiItemModel.requestType = 'estimate'; From f4405da7c67af11f56a195cef99237729ceb03a5 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 15:31:16 +0200 Subject: [PATCH 0153/1045] encodeAbi correctly implemented --- packages/web3-eth-contract/src/proxies/MethodsProxy.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 708b67e0b10..8c161db9d4d 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -88,7 +88,9 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { return self.executeMethod(abiItemModel, target, arguments); }; - anonymousFunction.encodeAbi = this.methodEncoder.encode(abiItemModel, target.contract.options.data); + anonymousFunction.encodeAbi = function () { + return self.methodEncoder.encode(abiItemModel, target.contract.options.data); + }; } throw Error('Method with name "' + name + '" not found'); From 57e5be23dde1abbecd502f8656c8bed86936f7ae Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 15:37:35 +0200 Subject: [PATCH 0154/1045] Contract added as dependency for MethodsProxy because of default- & defaultAccount and currentProvider handling --- packages/web3-eth-contract/src/Contract.js | 1 + .../src/factories/ContractPackageFactory.js | 3 +++ .../src/mappers/RpcMethodOptionsMapper.js | 12 ++++++------ .../web3-eth-contract/src/proxies/MethodsProxy.js | 11 +++++++---- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index fafb4f0fafe..11f48efe5e4 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -118,6 +118,7 @@ function Contract( }); this.methods = contractPackageFactory.createMethodsProxy( + this, abiModel, this.methodController, this.abiCoder, diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index 6be93669d04..89ada841f99 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -156,6 +156,7 @@ ContractPackageFactory.prototype.createRpcMethodFactory = function (abiCoder, ut * * @method createMethodsProxy * + * @param {Contract} contract * @param {AbiModel} abiModel * @param {MethodController} methodController * @param {ABICoder} abiCoder @@ -166,6 +167,7 @@ ContractPackageFactory.prototype.createRpcMethodFactory = function (abiCoder, ut * @returns {MethodsProxy} */ ContractPackageFactory.prototype.createMethodsProxy = function ( + contract, abiModel, methodController, abiCoder, @@ -174,6 +176,7 @@ ContractPackageFactory.prototype.createMethodsProxy = function ( accounts ) { return new MethodsProxy( + contract, abiModel, this.createRpcMethodFactory(abiCoder, utils, formatters, accounts), methodController, diff --git a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js index 24182cfbc61..0470f4d503e 100644 --- a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js @@ -36,12 +36,12 @@ function RpcMethodOptionsMapper(utils, formatters) { /** * Sets the default options where it is required * - * @param {Contract} contract + * @param {Object} contractOptions * @param {Object} options * * @returns {Object} */ -RpcMethodOptionsMapper.prototype.map = function (contract, options) { +RpcMethodOptionsMapper.prototype.map = function (contractOptions, options) { var gasPrice = null; if (options.gasPrice) { gasPrice = String(options.gasPrice); @@ -52,11 +52,11 @@ RpcMethodOptionsMapper.prototype.map = function (contract, options) { from = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(options.from)) } - options.data = options.data || contract.options.data; + options.data = options.data || contractOptions.data; - options.from = from || contract.options.from; - options.gasPrice = gasPrice || contract.options.gasPrice; - options.gas = options.gas || options.gasLimit || contract.options.gas; + options.from = from || contractOptions.from; + options.gasPrice = gasPrice || contractOptions.gasPrice; + options.gas = options.gas || options.gasLimit || contractOptions.gas; delete options.gasLimit; diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 8c161db9d4d..cce317a0f66 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -23,6 +23,7 @@ "use strict"; /** + * @param {Contract} contract * @param {AbiModel} abiModel * @param {RpcMethodFactory} rpcMethodFactory * @param {MethodController} methodController @@ -34,6 +35,7 @@ * @constructor */ function MethodsProxy( + contract, abiModel, rpcMethodFactory, methodController, @@ -42,6 +44,7 @@ function MethodsProxy( rpcMethodOptionsMapper, promiEventPackage ) { + this.contract = contract; this.abiModel = abiModel; this.rpcMethodFactory = rpcMethodFactory; this.methodController = methodController; @@ -114,9 +117,9 @@ MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArg return self.methodController.execute( rpcMethod, - target.currentProvider, - target.accounts, - target + target.contract.currentProvider, + target.contract.accounts, + target.contract ); }; @@ -156,7 +159,7 @@ MethodsProxy.prototype.createRpcMethod = function (abiItemModel, target, methodA rpcMethod.parameters[0]['data'] = encodedContractMethod; // Set default options in the TxObject if needed - rpcMethod.parameters = self.rpcMethodOptionsMapper.map(target.contract, rpcMethod.parameters[0]); + rpcMethod.parameters = self.rpcMethodOptionsMapper.map(target.contract.options, rpcMethod.parameters[0]); // Validate TxObject options var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethod); From 5d26267b2c08da7c82046281261e5a2bfab09b3e Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 16:38:30 +0200 Subject: [PATCH 0155/1045] Methods with same method name but with different arguments length are now supported in the MethodsProxy --- .../src/mappers/AbiMapper.js | 10 ++++-- .../src/proxies/MethodsProxy.js | 35 ++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/packages/web3-eth-contract/src/mappers/AbiMapper.js b/packages/web3-eth-contract/src/mappers/AbiMapper.js index 274f8714c96..a0463936ee8 100644 --- a/packages/web3-eth-contract/src/mappers/AbiMapper.js +++ b/packages/web3-eth-contract/src/mappers/AbiMapper.js @@ -67,8 +67,14 @@ AbiMapper.prototype.map = function (abi) { if (!mappedAbiItem.methods[abiItem.name]) { mappedAbiItem.methods[abiItem.name] = abiItemModel; } else { - //TODO: cascade method - mappedAbiItem.methods[abiItem.name] = abiItemModel; + if (_.isArray(mappedAbiItem.methods[abiItem.name])) { + mappedAbiItem.methods[abiItem.name].push(abiItemModel); + } else { + mappedAbiItem.methods[abiItem.name] = [ + mappedAbiItem.methods[abiItem.name], + abiItemModel + ]; + } } mappedAbiItem.methods[abiItem.signature] = abiItemModel; diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index cce317a0f66..d66c4350337 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -126,16 +126,43 @@ MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArg /** * Creates the rpc method, encodes the contract method and validate the objects. * - * @param {AbiItemModel} abiItemModel + * @param {AbiItemModel|Array} abiItemModel * @param {MethodsProxy} target * @param {IArguments} methodArguments * * @returns {AbstractMethodModel} */ MethodsProxy.prototype.createRpcMethod = function (abiItemModel, target, methodArguments) { - // Get correct rpc method model - var rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); - rpcMethod.methodArguments = methodArguments; + var rpcMethod, self = this; + + // If it is an array than check which AbiItemModel should be used + // (this is used if two methods with the same name exists but with different arguments length) + if (_.isArray(abiItemModel)) { + var isContractMethodParametersLengthValid; + + // Check if one of the AbiItemModel in this array does match the arguments length + abiItemModel.some(function(method) { + // Get correct rpc method model + rpcMethod = self.rpcMethodFactory.createRpcMethod(method); + rpcMethod.methodArguments = methodArguments; + isContractMethodParametersLengthValid = abiItemModel.givenParametersLengthIsValid(); + + return isContractMethodParametersLengthValid === true; + }); + + // Return error if no AbiItemModel found with the correct arguments length + if (isContractMethodParametersLengthValid !== true) { + return { + error: isContractMethodParametersLengthValid, + callback: rpcMethod.callback + }; + } + } else { + // Get correct rpc method model + rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); + rpcMethod.methodArguments = methodArguments; + } + // Validate contract method parameters length var contractMethodParametersLengthIsValid = abiItemModel.givenParametersLengthIsValid(); From 6652c16f232128a59046111f5c51579a5fce16bd Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 16:41:22 +0200 Subject: [PATCH 0156/1045] inline comment added to AbiMapper because of the complexity --- packages/web3-eth-contract/src/mappers/AbiMapper.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/web3-eth-contract/src/mappers/AbiMapper.js b/packages/web3-eth-contract/src/mappers/AbiMapper.js index a0463936ee8..89c49b9035d 100644 --- a/packages/web3-eth-contract/src/mappers/AbiMapper.js +++ b/packages/web3-eth-contract/src/mappers/AbiMapper.js @@ -64,6 +64,8 @@ AbiMapper.prototype.map = function (abi) { abiItemModel = self.contractPackageFactory.createAbiItemModel(abiItem); + // Check if an method already exists with this name and if it exists than create an array and push this abiItem + // into it. This is used if there are methods with the same name but with different arguments. if (!mappedAbiItem.methods[abiItem.name]) { mappedAbiItem.methods[abiItem.name] = abiItemModel; } else { From 60cefdfc36cc364361fe399ed8c5f3caf55fe1a9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 16:43:57 +0200 Subject: [PATCH 0157/1045] typo corrected --- packages/web3-eth-contract/src/mappers/AbiMapper.js | 2 +- packages/web3-eth-contract/src/proxies/MethodsProxy.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web3-eth-contract/src/mappers/AbiMapper.js b/packages/web3-eth-contract/src/mappers/AbiMapper.js index 89c49b9035d..1d55d945fb5 100644 --- a/packages/web3-eth-contract/src/mappers/AbiMapper.js +++ b/packages/web3-eth-contract/src/mappers/AbiMapper.js @@ -65,7 +65,7 @@ AbiMapper.prototype.map = function (abi) { abiItemModel = self.contractPackageFactory.createAbiItemModel(abiItem); // Check if an method already exists with this name and if it exists than create an array and push this abiItem - // into it. This is used if there are methods with the same name but with different arguments. + // into it. This will be used if there are methods with the same name but with different arguments. if (!mappedAbiItem.methods[abiItem.name]) { mappedAbiItem.methods[abiItem.name] = abiItemModel; } else { diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index d66c4350337..bf4aafc7917 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -135,8 +135,8 @@ MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArg MethodsProxy.prototype.createRpcMethod = function (abiItemModel, target, methodArguments) { var rpcMethod, self = this; - // If it is an array than check which AbiItemModel should be used - // (this is used if two methods with the same name exists but with different arguments length) + // If it is an array than check which AbiItemModel should be used. + // This will be used if two methods with the same name exists but with different arguments. if (_.isArray(abiItemModel)) { var isContractMethodParametersLengthValid; From 02ec12079e8da6b572c34e5121441f4c48d8ff87 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 17:08:35 +0200 Subject: [PATCH 0158/1045] Naming improved --- packages/web3-eth-contract/src/Contract.js | 2 +- .../src/encoders/MethodEncoder.js | 2 +- .../src/factories/ContractPackageFactory.js | 38 +++++++++---------- .../src/factories/RpcMethodFactory.js | 2 +- .../mappers/{AbiMapper.js => ABIMapper.js} | 14 +++---- .../abi/{AbiItemModel.js => ABIItemModel.js} | 14 +++---- .../models/abi/{AbiModel.js => ABIModel.js} | 18 ++++----- .../models/methods/CallContractMethodModel.js | 2 +- .../models/methods/SendContractMethodModel.js | 2 +- .../src/proxies/EventSubscriptionsProxy.js | 2 +- .../src/proxies/MethodsProxy.js | 6 +-- .../validators/RpcMethodOptionsValidator.js | 6 +-- 12 files changed, 54 insertions(+), 54 deletions(-) rename packages/web3-eth-contract/src/mappers/{AbiMapper.js => ABIMapper.js} (92%) rename packages/web3-eth-contract/src/models/abi/{AbiItemModel.js => ABIItemModel.js} (86%) rename packages/web3-eth-contract/src/models/abi/{AbiModel.js => ABIModel.js} (82%) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 11f48efe5e4..64b414bd0d7 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -35,7 +35,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {Utils} utils * @param {Object} formatters * @param {Accounts} accounts - * @param {AbiMapper} abiMapper + * @param {ABIMapper} abiMapper * @param {Array} abi * @param {String} address * @param {Object} options diff --git a/packages/web3-eth-contract/src/encoders/MethodEncoder.js b/packages/web3-eth-contract/src/encoders/MethodEncoder.js index c02f4e27800..fbd29e43023 100644 --- a/packages/web3-eth-contract/src/encoders/MethodEncoder.js +++ b/packages/web3-eth-contract/src/encoders/MethodEncoder.js @@ -36,7 +36,7 @@ function MethodEncoder(abiCoder) { * * @method encode * - * @param {AbiItemModel} abiItemModel + * @param {ABIItemModel} abiItemModel * @param {String} deployData * * @returns {String|Error} diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index 89ada841f99..f67b4e74af2 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -22,11 +22,11 @@ "use strict"; -var AbiModel = require('../models/abi/AbiModel'); -var AbiItemModel = require('../models/abi/AbiItemModel'); +var ABIModel = require('../models/abi/ABIModel'); +var ABIItemModel = require('../models/abi/ABIItemModel'); var MethodEncoder = require('../encoders/MethodEncoder'); var MethodResponseDecoder = require('../decoders/MethodResponseDecoder'); -var AbiMapper = require('../mappers/AbiMapper'); +var ABIMapper = require('../mappers/ABIMapper'); var RpcMethodOptionsMapper = require('../mappers/RpcMethodOptionsMapper'); var MethodsProxy = require('../proxies/MethodsProxy'); var RpcMethodOptionsValidator = require('../validators/RpcMethodOptionsValidator'); @@ -38,29 +38,29 @@ var RpcMethodFactory = require('../factories/RpcMethodFactory'); function ContractPackageFactory() { } /** - * Returns an object of AbiModel + * Returns an object of ABIModel * - * @method createAbiModel + * @method createABIModel * * @param {Object} mappedAbi * - * @returns {AbiModel} + * @returns {ABIModel} */ -ContractPackageFactory.prototype.createAbiModel = function (mappedAbi) { - return new AbiModel(mappedAbi); +ContractPackageFactory.prototype.createABIModel = function (mappedAbi) { + return new ABIModel(mappedAbi); }; /** - * Returns an object of AbiItemModel + * Returns an object of ABIItemModel * - * @method createAbiItemModel + * @method createABIItemModel * * @param {Object} abiItem * - * @returns {AbiItemModel} + * @returns {ABIItemModel} */ -ContractPackageFactory.prototype.createAbiItemModel = function (abiItem) { - return new AbiItemModel(abiItem); +ContractPackageFactory.prototype.createABIItemModel = function (abiItem) { + return new ABIItemModel(abiItem); }; /** @@ -77,17 +77,17 @@ ContractPackageFactory.prototype.createMethodEncoder = function (abiCoder) { }; /** - * Returns an object of AbiMapper + * Returns an object of ABIMapper * - * @method createAbiMapper + * @method createABIMapper * * @param {ABICoder} abiCoder * @param {Utils} utils * - * @returns {AbiMapper} + * @returns {ABIMapper} */ -ContractPackageFactory.prototype.createAbiMapper = function (abiCoder, utils) { - return new AbiMapper(this, abiCoder, utils); +ContractPackageFactory.prototype.createABIMapper = function (abiCoder, utils) { + return new ABIMapper(this, abiCoder, utils); }; /** @@ -157,7 +157,7 @@ ContractPackageFactory.prototype.createRpcMethodFactory = function (abiCoder, ut * @method createMethodsProxy * * @param {Contract} contract - * @param {AbiModel} abiModel + * @param {ABIModel} abiModel * @param {MethodController} methodController * @param {ABICoder} abiCoder * @param {Utils} utils diff --git a/packages/web3-eth-contract/src/factories/RpcMethodFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodFactory.js index 12ed99a5f41..944a8abfd89 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodFactory.js @@ -46,7 +46,7 @@ function RpcMethodFactory(methodResponseDecoder, accounts, utils, formatters) { * * @method createRpcMethod * - * @param {AbiItemModel} abiItemModel + * @param {ABIItemModel} abiItemModel * * @returns {AbstractMethodModel} */ diff --git a/packages/web3-eth-contract/src/mappers/AbiMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js similarity index 92% rename from packages/web3-eth-contract/src/mappers/AbiMapper.js rename to packages/web3-eth-contract/src/mappers/ABIMapper.js index 1d55d945fb5..36da2cbe27c 100644 --- a/packages/web3-eth-contract/src/mappers/AbiMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file AbiMapper.js + * @file ABIMapper.js * @author Samuel Furter * @date 2018 */ @@ -29,7 +29,7 @@ * * @constructor */ -function AbiMapper(contractPackageFactory, abiCoder, utils) { +function ABIMapper(contractPackageFactory, abiCoder, utils) { this.utils = utils; this.abiCoder = abiCoder; this.contractPackageFactory = contractPackageFactory; @@ -40,9 +40,9 @@ function AbiMapper(contractPackageFactory, abiCoder, utils) { * * @param {Array} abi * - * @returns {AbiModel} + * @returns {ABIModel} */ -AbiMapper.prototype.map = function (abi) { +ABIMapper.prototype.map = function (abi) { var self = this; var mappedAbiItem = { methods: {}, @@ -113,7 +113,7 @@ AbiMapper.prototype.map = function (abi) { * * @returns {Boolean} */ -AbiMapper.prototype.isConstant = function (abiItem) { +ABIMapper.prototype.isConstant = function (abiItem) { return (abiItem.stateMutability === "view" || abiItem.stateMutability === "pure" || abiItem.constant); }; @@ -126,8 +126,8 @@ AbiMapper.prototype.isConstant = function (abiItem) { * * @returns {Boolean} */ -AbiMapper.prototype.isPayable = function (abiItem) { +ABIMapper.prototype.isPayable = function (abiItem) { return (abiItem.stateMutability === "payable" || abiItem.payable); }; -module.exports = AbiMapper; +module.exports = ABIMapper; diff --git a/packages/web3-eth-contract/src/models/abi/AbiItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js similarity index 86% rename from packages/web3-eth-contract/src/models/abi/AbiItemModel.js rename to packages/web3-eth-contract/src/models/abi/ABIItemModel.js index dc1562fe5d9..c41ede5da03 100644 --- a/packages/web3-eth-contract/src/models/abi/AbiItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file AbiItemModel.js + * @file ABIItemModel.js * @author Samuel Furter * @date 2018 */ @@ -29,7 +29,7 @@ var _ = require('underscore'); * * @constructor */ -function AbiItemModel(abiItem) { +function ABIItemModel(abiItem) { this.abiItem = abiItem; this.signature = this.abiItem.signature; this.contractMethodParameters = []; @@ -42,7 +42,7 @@ function AbiItemModel(abiItem) { * * @returns {Number} */ -AbiItemModel.prototype.getInputLength = function () { +ABIItemModel.prototype.getInputLength = function () { if (_.isArray(this.abiItem.inputs)) { return this.abiItem.inputs.length; } @@ -57,7 +57,7 @@ AbiItemModel.prototype.getInputLength = function () { * * @returns {Error|Boolean} */ -AbiItemModel.prototype.givenParametersLengthIsValid = function () { +ABIItemModel.prototype.givenParametersLengthIsValid = function () { var inputLength = this.getInputLength(); if (this.contractMethodParameters.length === inputLength) { @@ -77,7 +77,7 @@ AbiItemModel.prototype.givenParametersLengthIsValid = function () { * * @returns {Array} */ -AbiItemModel.prototype.getInputs = function () { +ABIItemModel.prototype.getInputs = function () { var inputs = []; if (_.isArray(this.abiItem.inputs)) { @@ -94,8 +94,8 @@ AbiItemModel.prototype.getInputs = function () { * * @returns {Boolean} */ -AbiItemModel.prototype.isOfType = function (type) { +ABIItemModel.prototype.isOfType = function (type) { return this.abiItem.type === type; }; -module.export = AbiItemModel; +module.export = ABIItemModel; diff --git a/packages/web3-eth-contract/src/models/abi/AbiModel.js b/packages/web3-eth-contract/src/models/abi/ABIModel.js similarity index 82% rename from packages/web3-eth-contract/src/models/abi/AbiModel.js rename to packages/web3-eth-contract/src/models/abi/ABIModel.js index d22719a22cd..e8795a31f6d 100644 --- a/packages/web3-eth-contract/src/models/abi/AbiModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIModel.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file AbiModel.js + * @file ABIModel.js * @author Samuel Furter * @date 2018 */ @@ -27,7 +27,7 @@ * * @constructor */ -function AbiModel(mappedAbi) { +function ABIModel(mappedAbi) { this.abi = mappedAbi; } @@ -38,9 +38,9 @@ function AbiModel(mappedAbi) { * * @param {String} name * - * @returns {AbiItemModel|Boolean} + * @returns {ABIItemModel|Boolean} */ -AbiModel.prototype.getMethod = function (name) { +ABIModel.prototype.getMethod = function (name) { if (this.hasMethod(name)) { return this.abi.methods[name]; } @@ -55,9 +55,9 @@ AbiModel.prototype.getMethod = function (name) { * * @param {String} name * - * @returns {AbiItemModel|Boolean} + * @returns {ABIItemModel|Boolean} */ -AbiModel.prototype.getEvent = function (name) { +ABIModel.prototype.getEvent = function (name) { if (this.hasEvent(name)) { return this.abi.events[name]; } @@ -74,7 +74,7 @@ AbiModel.prototype.getEvent = function (name) { * * @returns {Boolean} */ -AbiModel.prototype.hasMethod = function (name) { +ABIModel.prototype.hasMethod = function (name) { return typeof this.abi.methods[name] !== 'undefined'; }; @@ -87,8 +87,8 @@ AbiModel.prototype.hasMethod = function (name) { * * @returns {Boolean} */ -AbiModel.prototype.hasEvent = function (name) { +ABIModel.prototype.hasEvent = function (name) { return typeof this.abi.events[name] !== 'undefined'; }; -module.exports = AbiModel; +module.exports = ABIModel; diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js index cf11bdb38a6..e1d4a13e724 100644 --- a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -25,7 +25,7 @@ var CallMethodModel = require('web3-core-method').CallMethodModel; /** - * @param {AbiItemModel} abiItemModel + * @param {ABIItemModel} abiItemModel * @param {MethodResponseDecoder} methodResponseDecoder * @param {Utils} utils * @param {Object} formatters diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js index f39b132e3d0..c7f2ea9d1c5 100644 --- a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -25,7 +25,7 @@ var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; /** - * @param {AbiItemModel} abiItemModel + * @param {ABIItemModel} abiItemModel * @param {MethodResponseDecoder} methodResponseDecoder * @param {Utils} utils * @param {Object} formatters diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 0dbd28d48e5..3d88885aa41 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -23,7 +23,7 @@ "use strict"; /** - * @param {AbiModel} abiModel + * @param {ABIModel} abiModel * * @constructor */ diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index bf4aafc7917..5284f445549 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -24,7 +24,7 @@ /** * @param {Contract} contract - * @param {AbiModel} abiModel + * @param {ABIModel} abiModel * @param {RpcMethodFactory} rpcMethodFactory * @param {MethodController} methodController * @param {MethodEncoder} methodEncoder @@ -102,7 +102,7 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { /** * Executes the RPC method with the methodController * - * @param {AbiItemModel} abiItemModel + * @param {ABIItemModel} abiItemModel * @param {MethodsProxy} target * @param {IArguments} methodArguments * @@ -126,7 +126,7 @@ MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArg /** * Creates the rpc method, encodes the contract method and validate the objects. * - * @param {AbiItemModel|Array} abiItemModel + * @param {ABIItemModel|Array} abiItemModel * @param {MethodsProxy} target * @param {IArguments} methodArguments * diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js index 4ebeb5afd13..3b01f8e8043 100644 --- a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -38,7 +38,7 @@ function RpcMethodOptionsValidator(utils) { * * @method validate * - * @param {AbiItemModel} abiItemModel + * @param {ABIItemModel} abiItemModel * @param {AbstractMethodModel} rpcMethodModel * * @returns {Error|Boolean} @@ -64,7 +64,7 @@ RpcMethodOptionsValidator.prototype.validate = function (abiItemModel, rpcMethod * * @method isToSet * - * @param {AbiItemModel} abiItemModel + * @param {ABIItemModel} abiItemModel * @param {AbstractMethodModel} rpcMethodModel * * @returns {Boolean} @@ -95,7 +95,7 @@ RpcMethodOptionsValidator.prototype.isFromSet = function (rpcMethodModel) { * * @method isValueValid * - * @param {AbiItemModel} abiItemModel + * @param {ABIItemModel} abiItemModel * @param {AbstractMethodModel} rpcMethodModel * * @returns {Boolean} From 862e1f37f5ec72bf2327e5b8169a0d75f13f3b44 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 26 Sep 2018 17:10:11 +0200 Subject: [PATCH 0159/1045] type on constructor funcDoc of Contract.js updated --- packages/web3-eth-contract/src/Contract.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 64b414bd0d7..47f04eeaf6c 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -31,7 +31,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {SubscriptionPackage} subscriptionPackage * @param {BatchRequestPackage} batchRequestPackage * @param {ContractPackageFactory} contractPackageFactory - * @param {AbiCoder} abiCoder + * @param {ABICoder} abiCoder * @param {Utils} utils * @param {Object} formatters * @param {Accounts} accounts From ebf6d85cf6388853ecde3b97c8344ca61315b288 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 27 Sep 2018 16:12:13 +0200 Subject: [PATCH 0160/1045] POC event subscription handling --- packages/web3-core-subscription/src/index.js | 8 +-- .../src/decoders/EventLogDecoder.js | 33 +++++++++ .../src/encoders/EventFilterEncoder.js | 61 ++++++++++++++++ .../src/factories/RpcMethodFactory.js | 1 + .../src/mappers/EventOptionsMapper.js | 67 ++++++++++++++++++ .../src/models/abi/ABIItemModel.js | 2 + .../src/models/abi/ABIModel.js | 15 ++++ .../src/proxies/EventSubscriptionsProxy.js | 70 ++++++++++++++++--- .../src/proxies/MethodsProxy.js | 48 ++++++------- 9 files changed, 269 insertions(+), 36 deletions(-) create mode 100644 packages/web3-eth-contract/src/decoders/EventLogDecoder.js create mode 100644 packages/web3-eth-contract/src/encoders/EventFilterEncoder.js create mode 100644 packages/web3-eth-contract/src/mappers/EventOptionsMapper.js diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js index 850d5bab918..d5524a54199 100644 --- a/packages/web3-core-subscription/src/index.js +++ b/packages/web3-core-subscription/src/index.js @@ -34,15 +34,15 @@ module.exports = { * @method createSubscription * * @param {Object} provider - * @param {String} type + * @param {String} method * @param {Array} parameters * @param {Function} inputFormatters * @param {Function} outputFormatter - * @param {String} subscriptionType + * @param {String} rpcSubscriptionMethod * * @returns {Subscription} */ - createSubscription: function (provider, type, parameters, inputFormatters, outputFormatter, subscriptionType) { - return new Subscription(provider, type, parameters, inputFormatters, outputFormatter, subscriptionType) + createSubscription: function (provider, method, parameters, inputFormatters, outputFormatter, rpcSubscriptionMethod) { + return new Subscription(provider, method, parameters, inputFormatters, outputFormatter, rpcSubscriptionMethod) } }; diff --git a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js new file mode 100644 index 00000000000..6f08ddfde9c --- /dev/null +++ b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js @@ -0,0 +1,33 @@ +/* + 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 . +*/ +/** + * @file EventLogDecoder.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +function EventLogDecoder() { + +} + +EventLogDecoder.prototype.decoder = function() { + +}; + +module.exports = EventLogDecoder; diff --git a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js new file mode 100644 index 00000000000..cc1b522f37e --- /dev/null +++ b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js @@ -0,0 +1,61 @@ +/* + 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 . +*/ +/** + * @file EventFilterEncoder.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +function EventFilterEncoder(abiCoder) { + this.abiCoder = abiCoder; +} + +/** + * Creates encoded topics from filter option of an event. + * + * @param {ABIItemModel} abiItemModel + * @param {*} filter + * + * @returns {Array} + */ +EventFilterEncoder.prototype.encode = function (abiItemModel, filter) { + var indexedInputs = abiItemModel.getIndexedInputs(), + topics = [], + self = this; + + indexedInputs.forEach(function(indexedInput) { + if (typeof filter[indexedInput.name] !== 'undefined') { + var filterItem = filter[indexedInput.name]; + + if (_.isArray(filterItem)) { + filterItem.map(function(item) { + return self.abiCoder.encodeParameter(indexedInput.type, item); + }); + + topics.push(filterItem); + + return; + } + + topics.push(self.abiCoder.encodeParameter(indexedInput.type, filterItem)); + } + }); + + return topics; +}; diff --git a/packages/web3-eth-contract/src/factories/RpcMethodFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodFactory.js index 944a8abfd89..c2168b95112 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodFactory.js @@ -27,6 +27,7 @@ var CallContractMethodModel = require('../models/methods/CallContractMethodModel var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; /** + * TODO: Rename it to RpcMethodModelFactory * @param {MethodResponseDecoder} methodResponseDecoder * @param {Accounts} accounts * @param {Utils} utils diff --git a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js new file mode 100644 index 00000000000..866b484f363 --- /dev/null +++ b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js @@ -0,0 +1,67 @@ +/* + 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 . +*/ +/** + * @file EventOptionsMapper.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {Object} formatters + * @param {EventFilterEncoder} eventFilterEncoder + * + * @constructor + */ +function EventOptionsMapper(formatters, eventFilterEncoder) { + this.formatters = formatters; + this.eventFilterEncoder = eventFilterEncoder; +} + +/** + * @param {ABIItemModel} abiItemModel + * @param {EventSubscriptionsProxy} target + * @param {Object} options + * + * @returns {Object} + */ +EventOptionsMapper.prototype.map = function(abiItemModel, target, options) { + var topics = []; + + if (typeof options.fromBlock !== 'undefined') { + options.fromBlock = this.formatters.inputBlockNumberFormatter(options.fromBlock); + } + + if (typeof options.toBlock !== 'undefined') { + options.toBlock = this.formatters.inputBlockNumberFormatter(options.toBlock); + } + + if (!event.anonymous) { + topics.push(event.signature); + } + + if (typeof options.filter !== 'undefined') { + topics.concat(this.eventFilterEncoder.encode(abiItemModel, options.filter)); + } + + options.address = target.contract.options.address; + + return options; +}; + +module.exports = EventOptionsMapper; diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index c41ede5da03..f749d945b4d 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -25,6 +25,7 @@ var _ = require('underscore'); /** + * TODO: Add requestType getter * @param {Object} abiItem * * @constructor @@ -32,6 +33,7 @@ var _ = require('underscore'); function ABIItemModel(abiItem) { this.abiItem = abiItem; this.signature = this.abiItem.signature; + this.name = this.abiItem.name; this.contractMethodParameters = []; } diff --git a/packages/web3-eth-contract/src/models/abi/ABIModel.js b/packages/web3-eth-contract/src/models/abi/ABIModel.js index e8795a31f6d..f19a14616d1 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIModel.js @@ -22,6 +22,8 @@ "use strict"; +var _ = require('underscore'); + /** * @param {Object} mappedAbi * @@ -91,4 +93,17 @@ ABIModel.prototype.hasEvent = function (name) { return typeof this.abi.events[name] !== 'undefined'; }; +/** + * Returns the constructor of the contract + * + * @method getConstructor + * + * @returns {ABIItemModel} + */ +ABIModel.prototype.getConstructor = function () { + return this.abi.methods.find(function (abiItemModel) { + return !_.isArray(abiItemModel) && abiItemModel.name && abiItemModel.name === 'constructor'; + }) +}; + module.exports = ABIModel; diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 3d88885aa41..639a6ca3790 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -24,11 +24,17 @@ /** * @param {ABIModel} abiModel + * @param {SubscriptionPackage} subscriptionPackage + * @param {EventOptionsMapper} eventOptionsMapper + * @param {EventLogDecoder} eventLogDecoder * * @constructor */ -function EventSubscriptionsProxy(abiModel) { +function EventSubscriptionsProxy(abiModel, subscriptionPackage, eventOptionsMapper, eventLogDecoder) { + this.subscriptionPackage = subscriptionPackage; this.abiModel = abiModel; + this.eventLogDecoder = eventLogDecoder; + this.eventOptionsMapper = eventOptionsMapper; return new Proxy(this, { get: this.proxyHandler @@ -36,7 +42,6 @@ function EventSubscriptionsProxy(abiModel) { } /** - * TODO: Implement event handling * Checks if a contract event exists by the given name and returns the subscription otherwise it throws an error * * @method proxyHandler @@ -47,23 +52,72 @@ function EventSubscriptionsProxy(abiModel) { * @returns {Function|Error} */ EventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { - var eventModel = this.abiModel.getEvent(name); + var self = this; - if (eventModel) { + if (this.abiModel.hasEvent(name)) { return function (options, callback) { - eventModel.options = options; - + return this.subscribe(self.abiModel.getEvent(name), options, callback, target); } } if (name === 'allEvents') { return function (options, callback) { - eventModel.options = options; - + return this.subscribeAll(options, target, callback); } } throw Error('Event with name "' + name + '" not found'); }; +/** + * Returns an subscription on the given event + * + * @param {ABIItemModel} abiItemModel + * @param {EventSubscriptionsProxy} target + * @param {Object} options + * @param {Function} callback + * + * @returns {Subscription} + */ +EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, target, options, callback) { + if (options.filters && options.topics) { + this.handleValidationError(new Error('Please set only topics or filters but not both.'), callback); + } + + options = this.eventOptionsMapper.map(abiItemModel, target, options); + + return this.subscriptionPackage.createSubscription( + target.contract.currentProvider, + 'logs', + [options], + this.formatters.inputLogFormatter, + this.eventLogDecoder.decode, + 'eth' + ).subscribe(callback); +}; + +/** + * TODO: Move this to an AbstractContractEntityProxy object and let both proxies inherit from it + * + * Creates an promiEvent and rejects it with an error + * + * @method handleValidationError + * + * @param {Error} error + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ +EventSubscriptionsProxy.prototype.handleValidationError = function (error, callback) { + var promiEvent = this.promiEventPackage.createPromiEvent(); + promiEvent.eventEmitter.emit('error', error); + + if (_.isFunction(callback)) { + callback(error, null); + } + + return promiEvent; +}; + module.exports = EventSubscriptionsProxy; diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 5284f445549..d1ad843087c 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -109,14 +109,14 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { * @returns {Promise|PromiEvent|String|Boolean} */ MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArguments) { - var rpcMethod = self.createRpcMethod(abiItemModel, target, methodArguments); + var rpcMethodModel = this.createRpcMethodModel(abiItemModel, target, methodArguments); - if (typeof rpcMethod.error !== 'undefined') { - return self.handleValidationError(rpcMethod.error, rpcMethod.callback); + if (typeof rpcMethodModel.error !== 'undefined') { + return this.handleValidationError(rpcMethodModel.error, rpcMethodModel.callback); } - return self.methodController.execute( - rpcMethod, + return this.methodController.execute( + rpcMethodModel, target.contract.currentProvider, target.contract.accounts, target.contract @@ -132,19 +132,19 @@ MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArg * * @returns {AbstractMethodModel} */ -MethodsProxy.prototype.createRpcMethod = function (abiItemModel, target, methodArguments) { - var rpcMethod, self = this; +MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, methodArguments) { + var rpcMethodModel, self = this; // If it is an array than check which AbiItemModel should be used. // This will be used if two methods with the same name exists but with different arguments. if (_.isArray(abiItemModel)) { - var isContractMethodParametersLengthValid; + var isContractMethodParametersLengthValid = false; // Check if one of the AbiItemModel in this array does match the arguments length abiItemModel.some(function(method) { // Get correct rpc method model - rpcMethod = self.rpcMethodFactory.createRpcMethod(method); - rpcMethod.methodArguments = methodArguments; + rpcMethodModel = self.rpcMethodFactory.createRpcMethod(method); + rpcMethodModel.methodArguments = methodArguments; isContractMethodParametersLengthValid = abiItemModel.givenParametersLengthIsValid(); return isContractMethodParametersLengthValid === true; @@ -154,22 +154,22 @@ MethodsProxy.prototype.createRpcMethod = function (abiItemModel, target, methodA if (isContractMethodParametersLengthValid !== true) { return { error: isContractMethodParametersLengthValid, - callback: rpcMethod.callback + callback: rpcMethodModel.callback }; } } else { // Get correct rpc method model - rpcMethod = this.rpcMethodFactory.createRpcMethod(abiItemModel); - rpcMethod.methodArguments = methodArguments; + rpcMethodModel = this.rpcMethodFactory.createRpcMethod(abiItemModel); + rpcMethodModel.methodArguments = methodArguments; } // Validate contract method parameters length var contractMethodParametersLengthIsValid = abiItemModel.givenParametersLengthIsValid(); - if (contractMethodParametersLengthIsValid !== true) { + if (contractMethodParametersLengthIsValid instanceof Error) { return { error: contractMethodParametersLengthIsValid, - callback: rpcMethod.callback + callback: rpcMethodModel.callback }; } @@ -178,26 +178,26 @@ MethodsProxy.prototype.createRpcMethod = function (abiItemModel, target, methodA if (encodedContractMethod instanceof Error) { return { error: encodedContractMethod, - callback: rpcMethod.callback + callback: rpcMethodModel.callback }; } // Set encoded contractMethod as data property of the transaction or call - rpcMethod.parameters[0]['data'] = encodedContractMethod; + rpcMethodModel.parameters[0]['data'] = encodedContractMethod; - // Set default options in the TxObject if needed - rpcMethod.parameters = self.rpcMethodOptionsMapper.map(target.contract.options, rpcMethod.parameters[0]); + // Set default options in the TxObject if required + rpcMethodModel.parameters = self.rpcMethodOptionsMapper.map(target.contract.options, rpcMethodModel.parameters[0]); - // Validate TxObject options - var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethod); - if (rpcMethodOptionsValidationResult !== true) { + // Validate TxObject + var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethodModel); + if (rpcMethodOptionsValidationResult instanceof Error) { return { error: rpcMethodOptionsValidationResult, - callback: rpcMethod.callback + callback: rpcMethodModel.callback }; } - return rpcMethod; + return rpcMethodModel; }; /** From 6372f90a086ac0c98bced03f0af099d96e947958 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 13:12:21 +0200 Subject: [PATCH 0161/1045] POC for improved subscription handling --- .../lib/models/AbstractSubscriptionModel.js | 68 ++++++++++++ .../src/Subscription.js | 100 +++++------------- .../src/factories/SubscriptionsFactory.js | 62 +++++++++++ .../EthSubscriptions/LogSubscriptionModel.js | 88 +++++++++++++++ .../NewHeadSubscriptionModel.js | 0 .../NewPendingTransactionSubscriptionModel.js | 0 .../SyncingSubscriptionModel.js | 0 .../MessagesSubscriptionModel.js | 0 .../src/decoders/MethodResponseDecoder.js | 1 + .../src/encoders/EventFilterEncoder.js | 5 + .../src/proxies/EventSubscriptionsProxy.js | 10 +- .../src/resolvers/SubscriptionsResolver.js | 2 +- 12 files changed, 255 insertions(+), 81 deletions(-) create mode 100644 packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js create mode 100644 packages/web3-core-subscription/src/factories/SubscriptionsFactory.js create mode 100644 packages/web3-core-subscription/src/models/EthSubscriptions/LogSubscriptionModel.js create mode 100644 packages/web3-core-subscription/src/models/EthSubscriptions/NewHeadSubscriptionModel.js create mode 100644 packages/web3-core-subscription/src/models/EthSubscriptions/NewPendingTransactionSubscriptionModel.js create mode 100644 packages/web3-core-subscription/src/models/EthSubscriptions/SyncingSubscriptionModel.js create mode 100644 packages/web3-core-subscription/src/models/ShhSubscriptions/MessagesSubscriptionModel.js diff --git a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js new file mode 100644 index 00000000000..2610f266e7c --- /dev/null +++ b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js @@ -0,0 +1,68 @@ +/* + 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 . +*/ +/** + * @file AbstractSubscriptionModel.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {String} subscriptionType + * @param {String} subscriptionMethod + * @param {Array} parameters + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function AbstractSubscriptionModel(subscriptionType, subscriptionMethod, parameters, utils, formatters) { + this.subscriptionType = subscriptionType; + this.subscriptionMethod = subscriptionMethod; + this.parameters = parameters; + this.util = utils; + this.formatters = formatters; +} + +/** + * This method will be executed before the subscription starts. + * + * @method beforeSubscription + * + * @param {Subscription} subscription + * @param {AbstractWeb3Object} web3Package + * @param {Function} callback + */ +AbstractSubscriptionModel.prototype.beforeSubscription = function (subscription, web3Package, callback) { + +}; + +/** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {*} subscriptionItem + * + * @returns {*} + */ +AbstractSubscriptionModel.prototype.onNewSubscriptionItem = function (subscriptionItem) { + return this.formatters.outputLogFormatter(subscriptionItem); +}; + +module.exports = AbstractSubscriptionModel; diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 110eccca441..19dca34bfdb 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -26,23 +26,15 @@ var _ = require('underscore'); var EventEmitter = require('eventemitter3'); /** - * @param {Object} provider - * @param {String} subscriptionMethod - * @param {Array} parameters - * @param {Array} inputFormatters - * @param {Function} outputFormatter - * @param {String} subscriptionType + * @param {AbstractSubscriptionModel} subscriptionModel + * @param {AbstractWeb3Object} web3Package * * @constructor */ -function Subscription(provider, subscriptionMethod, parameters, inputFormatters, outputFormatter, subscriptionType) { - this.provider = provider; - this.subscriptionMethod = subscriptionMethod; - this.parameters = parameters; - this.inputFormatters = inputFormatters; - this.outputFormatter = outputFormatter; +function Subscription(subscriptionModel, web3Package) { + this.subscriptionModel = subscriptionModel; + this.web3Package = web3Package; this.subscriptionId = null; - this.subscriptionType = subscriptionType || 'eth'; } /** @@ -58,21 +50,23 @@ function Subscription(provider, subscriptionMethod, parameters, inputFormatters, Subscription.prototype.subscribe = function (callback) { var self = this; - this.provider.subscribe( - this.subscriptionType, - this.subscriptionMethod, - this.getFormattedInput() + this.subscriptionModel.beforeSubscription(this, this.web3Package, callback); + + this.web3Package.currentProvider.subscribe( + this.subscriptionModel.subscriptionType, + this.subscriptionModel.subscriptionMethod, + this.subscriptionModel.parameters ).then(function (subscriptionId) { self.subscriptionId = subscriptionId; - self.provider.on(self.subscriptionId, function (error, response) { + self.web3Package.currentProvider.on(self.subscriptionId, function (error, response) { if (!error) { self.handleSubscriptionResponse(response, callback); return; } - if (self.provider.once) { + if (self.web3Package.currentProvider.once) { self.reconnect(callback); } @@ -102,7 +96,8 @@ Subscription.prototype.handleSubscriptionResponse = function (response, callback } response.forEach(function (item) { - var formattedOutput = this.formatOutput(item); + var formattedOutput = this.subscriptionModel.onNewSubscriptionItem(item); + this.emit('data', formattedOutput); if (_.isFunction(callback)) { callback(false, formattedOutput); @@ -111,6 +106,7 @@ Subscription.prototype.handleSubscriptionResponse = function (response, callback }; /** + * TODO: Improve reconnecting! * Reconnects provider and restarts subscription * * @method reconnect @@ -123,66 +119,21 @@ Subscription.prototype.reconnect = function (callback) { var self = this; var interval = setInterval(function () { - if (self.provider.reconnect) { - self.provider.reconnect(); + if (self.web3Package.currentProvider.reconnect) { + self.web3Package.currentProvider.reconnect(); } }, 500); - self.provider.once('connect', function () { + this.web3Package.currentProvider.once('connect', function () { clearInterval(interval); - self.unsubscribe(function (error, result) { - if (result) { - self.subscribe(callback); - } - - if (_.isFunction(callback)) { - callback(error, null); - } + self.unsubscribe().then(function () { + self.subscribe(callback); + }).catch(function (error) { + callback(error, null); }); }); }; -/** - * Executes outputFormatter if defined - * - * @method formatOutput - * - * @param {any} output - * - * @returns {any} - * @callback callback callback(error, result) - */ -Subscription.prototype.formatOutput = function (output) { - if (_.isFunction(this.outputFormatter) && output) { - return this.outputFormatter(output); - } - - return output; -}; - -/** - * Executes inputFormatters if defined - * - * @method formatInput - * - * @returns {any[]} - */ -Subscription.prototype.getFormattedInput = function () { - var self = this; - - if (_.isArray(this.inputFormatters)) { - return this.inputFormatters.map(function (formatter, index) { - if (_.isFunction(formatter)) { - return formatter(self.parameters[index]); - } - - return self.parameters[index]; - }); - } - - return parameters; -}; - /** * Unsubscribes subscription * @@ -195,7 +146,10 @@ Subscription.prototype.getFormattedInput = function () { */ Subscription.prototype.unsubscribe = function (callback) { var self = this; - return this.provider.unsubscribe(this.subscriptionId, this.subscriptionType).then(function (response) { + return this.web3Package.currentProvider.unsubscribe( + this.subscriptionId, + this.subscriptionModel.subscriptionType + ).then(function (response) { if (!response) { self.subscriptionId = null; callback(true, false); diff --git a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js new file mode 100644 index 00000000000..c6b6b393a0e --- /dev/null +++ b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js @@ -0,0 +1,62 @@ +/* + 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 . +*/ +/** + * @file SubscriptionModelsFactory.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; +var Subscription = require('../Subscription'); +var LogSubscriptionModel = require('../models/EthSubscriptions/LogSubscriptionModel'); + +function SubscriptionsFactory() { } + +/** + * Returns an subscription how is initiated with LogSubscriptionModel + * + * @method createLogSubscription + * + * @param {AbstractWeb3Object} web3Package + * @param {Array} parameters + * @param {Utils} utils + * @param {Object} formatters + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * + * @returns {Subscription} + */ +SubscriptionsFactory.prototype.createLogSubscription = function ( + web3Package, + parameters, + utils, + formatters, + getPastLogsMethodModel, + methodController +) { + return new Subscription(web3Package, + new LogSubscriptionModel( + parameters, + utils, + formatters, + getPastLogsMethodModel, + methodController + ) + ); +}; + +module.exports = SubscriptionsFactory; diff --git a/packages/web3-core-subscription/src/models/EthSubscriptions/LogSubscriptionModel.js b/packages/web3-core-subscription/src/models/EthSubscriptions/LogSubscriptionModel.js new file mode 100644 index 00000000000..3b0c6a84567 --- /dev/null +++ b/packages/web3-core-subscription/src/models/EthSubscriptions/LogSubscriptionModel.js @@ -0,0 +1,88 @@ +/* + 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 . +*/ +/** + * @file LogSubscriptionModel.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractSubscriptionModel = require('../../../lib/models/AbstractSubscriptionModel'); + +/** + * @param {Array} parameters + * @param {Utils} utils + * @param {Object} formatters + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * + * @constructor + */ +function LogSubscriptionModel(parameters, utils, formatters, getPastLogsMethodModel, methodController) { + AbstractSubscriptionModel.call(this, 'eth_subscribe', 'logs', parameters, utils, formatters); + this.getPastLogsMethodModel = getPastLogsMethodModel; + this.methodController = methodController; +} + +/** + * This method will be executed before the subscription starts. + * + * @method beforeSubscription + * + * @param {Subscription} subscription + * @param {AbstractWeb3Object} web3Package + * @param {Function} callback + */ +LogSubscriptionModel.prototype.beforeSubscription = function (subscription, web3Package, callback) { + this.parameters[0] = this.formatters.inputLogFormatter(this.parameters[0]); + this.getPastLogsMethodModel.parameters = this.parameters; + + this.methodController.execute( + this.getPastLogsMethodModel, + web3Package.currentProvider, + null, + web3Package + ).then(function (logs) { + logs.forEach(function (log) { + callback(false, log); + subscription.emit('data', log); + }); + + delete this.parameters[0].fromBlock; + }).catch(function (error) { + subscription.emit('error', error); + callback(error, null); + }); +}; + +/** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {*} subscriptionItem + * + * @returns {*} + */ +LogSubscriptionModel.prototype.onNewSubscriptionItem = function (subscriptionItem) { + return subscriptionItem; +}; + +LogSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +LogSubscriptionModel.prototype.constructor = LogSubscriptionModel; + diff --git a/packages/web3-core-subscription/src/models/EthSubscriptions/NewHeadSubscriptionModel.js b/packages/web3-core-subscription/src/models/EthSubscriptions/NewHeadSubscriptionModel.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/web3-core-subscription/src/models/EthSubscriptions/NewPendingTransactionSubscriptionModel.js b/packages/web3-core-subscription/src/models/EthSubscriptions/NewPendingTransactionSubscriptionModel.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/web3-core-subscription/src/models/EthSubscriptions/SyncingSubscriptionModel.js b/packages/web3-core-subscription/src/models/EthSubscriptions/SyncingSubscriptionModel.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/web3-core-subscription/src/models/ShhSubscriptions/MessagesSubscriptionModel.js b/packages/web3-core-subscription/src/models/ShhSubscriptions/MessagesSubscriptionModel.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js b/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js index 500f6491bda..122f145876d 100644 --- a/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js +++ b/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js @@ -38,6 +38,7 @@ function MethodResponseDecoder(abiCoder) { * * @param {Array} abiItemOutputTypes * @param {String} response + * * @returns {*} */ MethodResponseDecoder.prototype.decode = function (abiItemOutputTypes, response) { diff --git a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js index cc1b522f37e..fae3dc2faba 100644 --- a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js +++ b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js @@ -22,6 +22,11 @@ "use strict"; +/** + * @param {ABICoder} abiCoder + * + * @constructor + */ function EventFilterEncoder(abiCoder) { this.abiCoder = abiCoder; } diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 639a6ca3790..2a73e4e36cf 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -84,12 +84,10 @@ EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, target, op this.handleValidationError(new Error('Please set only topics or filters but not both.'), callback); } - options = this.eventOptionsMapper.map(abiItemModel, target, options); - return this.subscriptionPackage.createSubscription( target.contract.currentProvider, 'logs', - [options], + [this.eventOptionsMapper.map(abiItemModel, target, options)], this.formatters.inputLogFormatter, this.eventLogDecoder.decode, 'eth' @@ -97,8 +95,6 @@ EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, target, op }; /** - * TODO: Move this to an AbstractContractEntityProxy object and let both proxies inherit from it - * * Creates an promiEvent and rejects it with an error * * @method handleValidationError @@ -107,7 +103,7 @@ EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, target, op * @param {Function} callback * * @callback callback callback(error, result) - * @returns {PromiEvent} + * @returns {EventEmitter} */ EventSubscriptionsProxy.prototype.handleValidationError = function (error, callback) { var promiEvent = this.promiEventPackage.createPromiEvent(); @@ -117,7 +113,7 @@ EventSubscriptionsProxy.prototype.handleValidationError = function (error, callb callback(error, null); } - return promiEvent; + return promiEvent.eventEmitter; }; module.exports = EventSubscriptionsProxy; diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js index 11039097da5..d06939adc6d 100644 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js @@ -172,7 +172,7 @@ SubscriptionsResolver.prototype.subscribeToLogs = function (parameter, promiEven */ SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function (parameter, promiEvent, callback) { var self = this; - this.getLogs(parameter).then(function (logs) { + this.getPastLogs(parameter).then(function (logs) { logs.forEach(function (log) { callback(false, log); promiEvent.eventEmitter.emit('data', log); From 4cc85214aa116cc0fc104c36e701f0381a855da0 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 13:14:40 +0200 Subject: [PATCH 0162/1045] models folder structure improved in subscription package --- .../src/factories/SubscriptionsFactory.js | 2 +- .../eth}/LogSubscriptionModel.js | 2 +- .../eth}/NewHeadSubscriptionModel.js | 0 .../eth}/NewPendingTransactionSubscriptionModel.js | 0 .../eth}/SyncingSubscriptionModel.js | 0 .../shh}/MessagesSubscriptionModel.js | 0 6 files changed, 2 insertions(+), 2 deletions(-) rename packages/web3-core-subscription/src/models/{EthSubscriptions => subscriptions/eth}/LogSubscriptionModel.js (96%) rename packages/web3-core-subscription/src/models/{EthSubscriptions => subscriptions/eth}/NewHeadSubscriptionModel.js (100%) rename packages/web3-core-subscription/src/models/{EthSubscriptions => subscriptions/eth}/NewPendingTransactionSubscriptionModel.js (100%) rename packages/web3-core-subscription/src/models/{EthSubscriptions => subscriptions/eth}/SyncingSubscriptionModel.js (100%) rename packages/web3-core-subscription/src/models/{ShhSubscriptions => subscriptions/shh}/MessagesSubscriptionModel.js (100%) diff --git a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js index c6b6b393a0e..8009d63672a 100644 --- a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js +++ b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js @@ -22,7 +22,7 @@ "use strict"; var Subscription = require('../Subscription'); -var LogSubscriptionModel = require('../models/EthSubscriptions/LogSubscriptionModel'); +var LogSubscriptionModel = require('../models/subscriptions/eth/LogSubscriptionModel'); function SubscriptionsFactory() { } diff --git a/packages/web3-core-subscription/src/models/EthSubscriptions/LogSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js similarity index 96% rename from packages/web3-core-subscription/src/models/EthSubscriptions/LogSubscriptionModel.js rename to packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js index 3b0c6a84567..8c1ecfa7b2b 100644 --- a/packages/web3-core-subscription/src/models/EthSubscriptions/LogSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractSubscriptionModel = require('../../../lib/models/AbstractSubscriptionModel'); +var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); /** * @param {Array} parameters diff --git a/packages/web3-core-subscription/src/models/EthSubscriptions/NewHeadSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/src/models/EthSubscriptions/NewHeadSubscriptionModel.js rename to packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadSubscriptionModel.js diff --git a/packages/web3-core-subscription/src/models/EthSubscriptions/NewPendingTransactionSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/src/models/EthSubscriptions/NewPendingTransactionSubscriptionModel.js rename to packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionSubscriptionModel.js diff --git a/packages/web3-core-subscription/src/models/EthSubscriptions/SyncingSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/src/models/EthSubscriptions/SyncingSubscriptionModel.js rename to packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js diff --git a/packages/web3-core-subscription/src/models/ShhSubscriptions/MessagesSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/src/models/ShhSubscriptions/MessagesSubscriptionModel.js rename to packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js From 94f06ff56c8c28f34573787c7bbcd10fa3132bee Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 13:51:56 +0200 Subject: [PATCH 0163/1045] subscription models implemented --- .../lib/models/AbstractSubscriptionModel.js | 3 +- .../src/Subscription.js | 2 +- .../subscriptions/eth/LogSubscriptionModel.js | 7 +- .../eth/NewHeadSubscriptionModel.js | 54 ++++++++++++++ .../NewPendingTransactionSubscriptionModel.js | 40 +++++++++++ .../eth/SyncingSubscriptionModel.js | 72 +++++++++++++++++++ 6 files changed, 173 insertions(+), 5 deletions(-) diff --git a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js index 2610f266e7c..9a762e78ebf 100644 --- a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js +++ b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js @@ -57,11 +57,12 @@ AbstractSubscriptionModel.prototype.beforeSubscription = function (subscription, * * @method onNewSubscriptionItem * + * @param {Subscription} subscription * @param {*} subscriptionItem * * @returns {*} */ -AbstractSubscriptionModel.prototype.onNewSubscriptionItem = function (subscriptionItem) { +AbstractSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { return this.formatters.outputLogFormatter(subscriptionItem); }; diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 19dca34bfdb..2e36254ffdf 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -96,7 +96,7 @@ Subscription.prototype.handleSubscriptionResponse = function (response, callback } response.forEach(function (item) { - var formattedOutput = this.subscriptionModel.onNewSubscriptionItem(item); + var formattedOutput = this.subscriptionModel.onNewSubscriptionItem(this, item); this.emit('data', formattedOutput); if (_.isFunction(callback)) { diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js index 8c1ecfa7b2b..47a1aa98fea 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -75,12 +75,13 @@ LogSubscriptionModel.prototype.beforeSubscription = function (subscription, web3 * * @method onNewSubscriptionItem * + * @param {Subscription} subscription * @param {*} subscriptionItem * - * @returns {*} + * @returns {Object} */ -LogSubscriptionModel.prototype.onNewSubscriptionItem = function (subscriptionItem) { - return subscriptionItem; +LogSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { + return this.formatters.outputLogFormatter(subscriptionItem); }; LogSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadSubscriptionModel.js index e69de29bb2d..354d066c3de 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadSubscriptionModel.js @@ -0,0 +1,54 @@ +/* + 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 . +*/ +/** + * @file NewHeadSubscriptionModel.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); + +/** + * @param {Array} parameters + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function NewHeadSubscriptionModel(parameters, utils, formatters) { + NewHeadSubscriptionModel.call(this, 'eth_subscribe', 'newHeads', parameters, utils, formatters); +} + +/** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {Object} + */ +NewHeadSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { + return this.formatters.outputBlockFormatter(subscriptionItem); +}; + +NewHeadSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +NewHeadSubscriptionModel.prototype.constructor = NewHeadSubscriptionModel; + diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionSubscriptionModel.js index e69de29bb2d..0865edc8235 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionSubscriptionModel.js @@ -0,0 +1,40 @@ +/* + 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 . +*/ +/** + * @file NewHeadSubscriptionModel.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); + +/** + * @param {Array} parameters + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function NewPendingTransactionSubscriptionModel(parameters, utils, formatters) { + NewPendingTransactionSubscriptionModel.call(this, 'eth_subscribe', 'newPendingTransactions', parameters, utils, formatters); +} + +NewPendingTransactionSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +NewPendingTransactionSubscriptionModel.prototype.constructor = NewPendingTransactionSubscriptionModel; + diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js index e69de29bb2d..1f5bfc16109 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -0,0 +1,72 @@ +/* + 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 . +*/ +/** + * @file SyncingSubscriptionModel.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); + +/** + * @param {Array} parameters + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function SyncingSubscriptionModel(parameters, utils, formatters) { + AbstractSubscriptionModel.call(this, 'eth_subscribe', 'syncing', parameters, utils, formatters); + this.isSyncing = null; +} + +/** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {Object} + */ +SyncingSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { + var isSyncing = subscriptionItem.result.syncing; + + if (this.isSyncing === null) { + this.isSyncing = isSyncing; + subscription.emit('changed', this.isSyncing); + } + + if (this.isSyncing === true && isSyncing === false) { + this.isSyncing = isSyncing; + subscription.emit('changed', this.isSyncing); + } + + if (this.isSyncing === false && isSyncing === true) { + this.isSyncing = isSyncing; + subscription.emit('changed', this.isSyncing); + } + + return this.formatters.outputSyncingFormatter(subscriptionItem); +}; + +SyncingSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +SyncingSubscriptionModel.prototype.constructor = SyncingSubscriptionModel; + From 930d88f7bea9675c0755034951656ccdedf488ec Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 14:05:37 +0200 Subject: [PATCH 0164/1045] SubscriptionsFactory implemented, naming of some subscriptions fixed, whipser messages subscription implemented --- .../lib/models/AbstractSubscriptionModel.js | 4 +- .../src/factories/SubscriptionsFactory.js | 96 +++++++++++++++++-- .../subscriptions/eth/LogSubscriptionModel.js | 1 + ...nModel.js => NewHeadsSubscriptionModel.js} | 13 +-- ...ewPendingTransactionsSubscriptionModel.js} | 9 +- .../eth/SyncingSubscriptionModel.js | 1 + .../shh/MessagesSubscriptionModel.js | 42 ++++++++ 7 files changed, 144 insertions(+), 22 deletions(-) rename packages/web3-core-subscription/src/models/subscriptions/eth/{NewHeadSubscriptionModel.js => NewHeadsSubscriptionModel.js} (71%) rename packages/web3-core-subscription/src/models/subscriptions/eth/{NewPendingTransactionSubscriptionModel.js => NewPendingTransactionsSubscriptionModel.js} (68%) diff --git a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js index 9a762e78ebf..77965681720 100644 --- a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js +++ b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js @@ -48,9 +48,7 @@ function AbstractSubscriptionModel(subscriptionType, subscriptionMethod, paramet * @param {AbstractWeb3Object} web3Package * @param {Function} callback */ -AbstractSubscriptionModel.prototype.beforeSubscription = function (subscription, web3Package, callback) { - -}; +AbstractSubscriptionModel.prototype.beforeSubscription = function (subscription, web3Package, callback) { }; /** * This method will be executed on each new subscription item. diff --git a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js index 8009d63672a..ce9589e18b7 100644 --- a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js +++ b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js @@ -15,26 +15,38 @@ along with web3.js. If not, see . */ /** - * @file SubscriptionModelsFactory.js + * @file SubscriptionsFactory.js * @authors: Samuel Furter * @date 2018 */ "use strict"; + var Subscription = require('../Subscription'); var LogSubscriptionModel = require('../models/subscriptions/eth/LogSubscriptionModel'); +var NewHeadsSubscriptionModel = require('../models/subscriptions/eth/NewHeadsSubscriptionModel'); +var NewPendingTransactionsSubscriptionModel = require('../models/subscriptions/eth/NewPendingTransactionsSubscriptionModel'); +var SyncingSubscriptionModel = require('../models/subscriptions/eth/SyncingSubscriptionModel'); +var MessagesSubscriptionModel = require('../models/subscriptions/shh/MessagesSubscriptionModel'); -function SubscriptionsFactory() { } +/** + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function SubscriptionsFactory(utils, formatters) { + this.utils = utils; + this.formatters = formatters; +} /** - * Returns an subscription how is initiated with LogSubscriptionModel + * Returns an eth log subscription * * @method createLogSubscription * * @param {AbstractWeb3Object} web3Package * @param {Array} parameters - * @param {Utils} utils - * @param {Object} formatters * @param {GetPastLogsMethodModel} getPastLogsMethodModel * @param {MethodController} methodController * @@ -43,20 +55,86 @@ function SubscriptionsFactory() { } SubscriptionsFactory.prototype.createLogSubscription = function ( web3Package, parameters, - utils, - formatters, getPastLogsMethodModel, methodController ) { return new Subscription(web3Package, new LogSubscriptionModel( parameters, - utils, - formatters, + this.utils, + this.formatters, getPastLogsMethodModel, methodController ) ); }; +/** + * Returns an eth newHeads subscription + * + * @method createNewHeadSubscription + * + * @param {AbstractWeb3Object} web3Package + * @param {Array} parameters + * + * @returns {Subscription} + */ +SubscriptionsFactory.prototype.createNewHeadSubscription = function (web3Package, parameters) { + return new Subscription( + web3Package, + new NewHeadsSubscriptionModel(parameters, this.utils, this.formatters) + ); +}; + +/** + * Returns an eth newPendingTransactions subscription + * + * @method createNewPendingTransactionsSubscription + * + * @param {AbstractWeb3Object} web3Package + * @param {Array} parameters + * + * @returns {Subscription} + */ +SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = function (web3Package, parameters) { + return new Subscription( + web3Package, + new NewPendingTransactionsSubscriptionModel(parameters, this.utils, this.formatters) + ); +}; + +/** + * Returns an eth syncing subscription + * + * @method createSyncingSubscriptionModel + * + * @param {AbstractWeb3Object} web3Package + * @param {Array} parameters + * + * @returns {Subscription} + */ +SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (web3Package, parameters) { + return new Subscription( + web3Package, + new SyncingSubscriptionModel(parameters, this.utils, this.formatters) + ); +}; + +/** + * Returns an shh messages subscription + * + * @method createShhMessagesSubscription + * + * @param {AbstractWeb3Object} web3Package + * @param {Array} parameters + * + * @returns {Subscription} + */ +SubscriptionsFactory.prototype.createShhMessagesSubscription = function (web3Package, parameters) { + return new Subscription( + web3Package, + new MessagesSubscriptionModel(parameters, this.utils, this.formatters) + ); +}; + module.exports = SubscriptionsFactory; diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js index 47a1aa98fea..59ae1ca294c 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -87,3 +87,4 @@ LogSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, s LogSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); LogSubscriptionModel.prototype.constructor = LogSubscriptionModel; +module.exports = LogSubscriptionModel; diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js similarity index 71% rename from packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadSubscriptionModel.js rename to packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js index 354d066c3de..bb5d924d750 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file NewHeadSubscriptionModel.js + * @file NewHeadsSubscriptionModel.js * @authors: Samuel Furter * @date 2018 */ @@ -31,8 +31,8 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscrip * * @constructor */ -function NewHeadSubscriptionModel(parameters, utils, formatters) { - NewHeadSubscriptionModel.call(this, 'eth_subscribe', 'newHeads', parameters, utils, formatters); +function NewHeadsSubscriptionModel(parameters, utils, formatters) { + NewHeadsSubscriptionModel.call(this, 'eth_subscribe', 'newHeads', parameters, utils, formatters); } /** @@ -45,10 +45,11 @@ function NewHeadSubscriptionModel(parameters, utils, formatters) { * * @returns {Object} */ -NewHeadSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { +NewHeadsSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { return this.formatters.outputBlockFormatter(subscriptionItem); }; -NewHeadSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); -NewHeadSubscriptionModel.prototype.constructor = NewHeadSubscriptionModel; +NewHeadsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +NewHeadsSubscriptionModel.prototype.constructor = NewHeadsSubscriptionModel; +module.expors = NewHeadsSubscriptionModel; diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js similarity index 68% rename from packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionSubscriptionModel.js rename to packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js index 0865edc8235..a240c6ec2a0 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js @@ -31,10 +31,11 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscrip * * @constructor */ -function NewPendingTransactionSubscriptionModel(parameters, utils, formatters) { - NewPendingTransactionSubscriptionModel.call(this, 'eth_subscribe', 'newPendingTransactions', parameters, utils, formatters); +function NewPendingTransactionsSubscriptionModel(parameters, utils, formatters) { + NewPendingTransactionsSubscriptionModel.call(this, 'eth_subscribe', 'newPendingTransactions', parameters, utils, formatters); } -NewPendingTransactionSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); -NewPendingTransactionSubscriptionModel.prototype.constructor = NewPendingTransactionSubscriptionModel; +NewPendingTransactionsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +NewPendingTransactionsSubscriptionModel.prototype.constructor = NewPendingTransactionsSubscriptionModel; +module.exports = NewPendingTransactionsSubscriptionModel; diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js index 1f5bfc16109..0d50eb52240 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -70,3 +70,4 @@ SyncingSubscriptionModel.prototype.onNewSubscriptionItem = function (subscriptio SyncingSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); SyncingSubscriptionModel.prototype.constructor = SyncingSubscriptionModel; +module.exports = SyncingSubscriptionModel; diff --git a/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js index e69de29bb2d..f3943dd6135 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js @@ -0,0 +1,42 @@ +/* + 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 . +*/ +/** + * @file MessagesSubscriptionModel.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); + +/** + * @param {Array} parameters + * @param {Utils} utils + * @param {Object} formatters + * + * @constructor + */ +function MessagesSubscriptionModel(parameters, utils, formatters) { + AbstractSubscriptionModel.call(this, 'shh_subscribe', 'messages', parameters, utils, formatters); +} + +MessagesSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +MessagesSubscriptionModel.prototype.constructor = MessagesSubscriptionModel; + +module.exports = MessagesSubscriptionModel; + From cfc974a3a041310426264df6879218690630ed77 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 14:41:41 +0200 Subject: [PATCH 0165/1045] code clean up, new subscriptions handling implemented in eth and shh package --- .../src/AbstractWeb3Object.js | 6 - .../lib/models/AbstractSubscriptionModel.js | 6 +- .../src/factories/SubscriptionsFactory.js | 29 +- packages/web3-core-subscription/src/index.js | 21 +- .../subscriptions/eth/LogSubscriptionModel.js | 13 +- .../eth/NewHeadsSubscriptionModel.js | 5 +- ...NewPendingTransactionsSubscriptionModel.js | 12 +- .../eth/SyncingSubscriptionModel.js | 5 +- .../shh/MessagesSubscriptionModel.js | 6 +- packages/web3-eth/src/Eth.js | 31 +- packages/web3-eth/src/index.js | 16 +- .../src/resolvers/SubscriptionsResolver.js | 279 ------------------ packages/web3-shh/src/Shh.js | 22 +- packages/web3-shh/src/index.js | 4 +- 14 files changed, 77 insertions(+), 378 deletions(-) delete mode 100644 packages/web3-eth/src/resolvers/SubscriptionsResolver.js diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 30b7160d249..1a0dcd4ac40 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -27,7 +27,6 @@ * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory - * @param {SubscriptionPackage} subscriptionPackage * @param {BatchRequestPackage} batchRequestPackage * * @constructor @@ -37,7 +36,6 @@ function AbstractWeb3Object( providersPackage, methodController, methodModelFactory, - subscriptionPackage, batchRequestPackage ) { if (!this.isDependencyGiven(provider)) { @@ -84,10 +82,6 @@ function AbstractWeb3Object( }; } - if (this.isDependencyGiven(subscriptionPackage)) { - this.subscriptionPackage = subscriptionPackage; - } - if (this.isDependencyGiven(methodModelFactory) && this.isDependencyGiven(methodController)) { this.methodModelFactory = methodModelFactory; this.methodController = methodController; diff --git a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js index 77965681720..4dee44356e6 100644 --- a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js +++ b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js @@ -25,16 +25,16 @@ /** * @param {String} subscriptionType * @param {String} subscriptionMethod - * @param {Array} parameters + * @param {Object} options * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function AbstractSubscriptionModel(subscriptionType, subscriptionMethod, parameters, utils, formatters) { +function AbstractSubscriptionModel(subscriptionType, subscriptionMethod, options, utils, formatters) { this.subscriptionType = subscriptionType; this.subscriptionMethod = subscriptionMethod; - this.parameters = parameters; + this.options = options; this.util = utils; this.formatters = formatters; } diff --git a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js index ce9589e18b7..be4e7903c9d 100644 --- a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js +++ b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js @@ -46,7 +46,7 @@ function SubscriptionsFactory(utils, formatters) { * @method createLogSubscription * * @param {AbstractWeb3Object} web3Package - * @param {Array} parameters + * @param {Object} options * @param {GetPastLogsMethodModel} getPastLogsMethodModel * @param {MethodController} methodController * @@ -54,13 +54,13 @@ function SubscriptionsFactory(utils, formatters) { */ SubscriptionsFactory.prototype.createLogSubscription = function ( web3Package, - parameters, + options, getPastLogsMethodModel, methodController ) { return new Subscription(web3Package, new LogSubscriptionModel( - parameters, + options, this.utils, this.formatters, getPastLogsMethodModel, @@ -72,17 +72,16 @@ SubscriptionsFactory.prototype.createLogSubscription = function ( /** * Returns an eth newHeads subscription * - * @method createNewHeadSubscription + * @method createNewHeadsSubscription * * @param {AbstractWeb3Object} web3Package - * @param {Array} parameters * * @returns {Subscription} */ -SubscriptionsFactory.prototype.createNewHeadSubscription = function (web3Package, parameters) { +SubscriptionsFactory.prototype.createNewHeadsSubscription = function (web3Package) { return new Subscription( web3Package, - new NewHeadsSubscriptionModel(parameters, this.utils, this.formatters) + new NewHeadsSubscriptionModel(this.utils, this.formatters) ); }; @@ -92,14 +91,13 @@ SubscriptionsFactory.prototype.createNewHeadSubscription = function (web3Package * @method createNewPendingTransactionsSubscription * * @param {AbstractWeb3Object} web3Package - * @param {Array} parameters * * @returns {Subscription} */ -SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = function (web3Package, parameters) { +SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = function (web3Package) { return new Subscription( web3Package, - new NewPendingTransactionsSubscriptionModel(parameters, this.utils, this.formatters) + new NewPendingTransactionsSubscriptionModel(this.utils, this.formatters) ); }; @@ -109,14 +107,13 @@ SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = functi * @method createSyncingSubscriptionModel * * @param {AbstractWeb3Object} web3Package - * @param {Array} parameters * * @returns {Subscription} */ -SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (web3Package, parameters) { +SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (web3Package) { return new Subscription( web3Package, - new SyncingSubscriptionModel(parameters, this.utils, this.formatters) + new SyncingSubscriptionModel(this.utils, this.formatters) ); }; @@ -126,14 +123,14 @@ SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (web3Pa * @method createShhMessagesSubscription * * @param {AbstractWeb3Object} web3Package - * @param {Array} parameters + * @param {Object} options * * @returns {Subscription} */ -SubscriptionsFactory.prototype.createShhMessagesSubscription = function (web3Package, parameters) { +SubscriptionsFactory.prototype.createShhMessagesSubscription = function (web3Package, options) { return new Subscription( web3Package, - new MessagesSubscriptionModel(parameters, this.utils, this.formatters) + new MessagesSubscriptionModel(options, this.utils, this.formatters) ); }; diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js index d5524a54199..49c03a401c6 100644 --- a/packages/web3-core-subscription/src/index.js +++ b/packages/web3-core-subscription/src/index.js @@ -23,26 +23,9 @@ "use strict"; var version = require('./package.json').version; -var Subscription = require('./Subscription'); +var SubscriptionsFactory = require('./factories/SubscriptionsFactory'); module.exports = { version: version, - - /** - * Creates Subscription object - * - * @method createSubscription - * - * @param {Object} provider - * @param {String} method - * @param {Array} parameters - * @param {Function} inputFormatters - * @param {Function} outputFormatter - * @param {String} rpcSubscriptionMethod - * - * @returns {Subscription} - */ - createSubscription: function (provider, method, parameters, inputFormatters, outputFormatter, rpcSubscriptionMethod) { - return new Subscription(provider, method, parameters, inputFormatters, outputFormatter, rpcSubscriptionMethod) - } + SubscriptionsFactory: SubscriptionsFactory }; diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js index 59ae1ca294c..6a0d5d88a07 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -25,7 +25,7 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); /** - * @param {Array} parameters + * @param {Object} options * @param {Utils} utils * @param {Object} formatters * @param {GetPastLogsMethodModel} getPastLogsMethodModel @@ -33,8 +33,8 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscrip * * @constructor */ -function LogSubscriptionModel(parameters, utils, formatters, getPastLogsMethodModel, methodController) { - AbstractSubscriptionModel.call(this, 'eth_subscribe', 'logs', parameters, utils, formatters); +function LogSubscriptionModel(options, utils, formatters, getPastLogsMethodModel, methodController) { + AbstractSubscriptionModel.call(this, 'eth_subscribe', 'logs', options, utils, formatters); this.getPastLogsMethodModel = getPastLogsMethodModel; this.methodController = methodController; } @@ -49,8 +49,9 @@ function LogSubscriptionModel(parameters, utils, formatters, getPastLogsMethodMo * @param {Function} callback */ LogSubscriptionModel.prototype.beforeSubscription = function (subscription, web3Package, callback) { - this.parameters[0] = this.formatters.inputLogFormatter(this.parameters[0]); - this.getPastLogsMethodModel.parameters = this.parameters; + var self = this; + this.options = this.formatters.inputLogFormatter(this.options); + this.getPastLogsMethodModel.parameters = [options]; this.methodController.execute( this.getPastLogsMethodModel, @@ -63,7 +64,7 @@ LogSubscriptionModel.prototype.beforeSubscription = function (subscription, web3 subscription.emit('data', log); }); - delete this.parameters[0].fromBlock; + delete self.options.fromBlock; }).catch(function (error) { subscription.emit('error', error); callback(error, null); diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js index bb5d924d750..766d9709a2f 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js @@ -25,14 +25,13 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); /** - * @param {Array} parameters * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function NewHeadsSubscriptionModel(parameters, utils, formatters) { - NewHeadsSubscriptionModel.call(this, 'eth_subscribe', 'newHeads', parameters, utils, formatters); +function NewHeadsSubscriptionModel(utils, formatters) { + NewHeadsSubscriptionModel.call(this, 'eth_subscribe', 'newHeads', null, utils, formatters); } /** diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js index a240c6ec2a0..8e8d783841c 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js @@ -25,14 +25,20 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); /** - * @param {Array} parameters * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function NewPendingTransactionsSubscriptionModel(parameters, utils, formatters) { - NewPendingTransactionsSubscriptionModel.call(this, 'eth_subscribe', 'newPendingTransactions', parameters, utils, formatters); +function NewPendingTransactionsSubscriptionModel(utils, formatters) { + NewPendingTransactionsSubscriptionModel.call( + this, + 'eth_subscribe', + 'newPendingTransactions', + null, + utils, + formatters + ); } NewPendingTransactionsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js index 0d50eb52240..35d2b386dea 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -25,14 +25,13 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); /** - * @param {Array} parameters * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function SyncingSubscriptionModel(parameters, utils, formatters) { - AbstractSubscriptionModel.call(this, 'eth_subscribe', 'syncing', parameters, utils, formatters); +function SyncingSubscriptionModel(utils, formatters) { + AbstractSubscriptionModel.call(this, 'eth_subscribe', 'syncing', null, utils, formatters); this.isSyncing = null; } diff --git a/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js index f3943dd6135..ba4100d3b7a 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js @@ -25,14 +25,14 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); /** - * @param {Array} parameters + * @param {Object} options * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function MessagesSubscriptionModel(parameters, utils, formatters) { - AbstractSubscriptionModel.call(this, 'shh_subscribe', 'messages', parameters, utils, formatters); +function MessagesSubscriptionModel(options, utils, formatters) { + AbstractSubscriptionModel.call(this, 'shh_subscribe', 'messages', options, utils, formatters); } MessagesSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 7b922da74b2..f74e60eded0 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -37,7 +37,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {Utils} utils * @param {Object} formatters * @param {ProvidersPackage} providersPackage - * @param {SubscriptionsResolver} subscriptionsResolver + * @param {SubscriptionsFactory} subscriptionsFactory * @param {MethodModelFactory} methodModelFactory * @param {MethodController} methodController * @param {BatchRequestPackage} batchRequestPackage @@ -56,7 +56,7 @@ var Eth = function Eth( utils, formatters, providersPackage, - subscriptionsResolver, + subscriptionsFactory, methodController, methodModelFactory, batchRequestPackage @@ -67,7 +67,6 @@ var Eth = function Eth( providersPackage, methodController, methodModelFactory, - null, batchRequestPackage ); @@ -80,7 +79,7 @@ var Eth = function Eth( this.ens = ens; this.utils = utils; this.formatters = formatters; - this.subscriptionsResolver = subscriptionsResolver; + this.subscriptionsFactory = subscriptionsFactory; var defaultAccount = null; var defaultBlock = 'latest'; @@ -126,14 +125,30 @@ var Eth = function Eth( * @method subscribe * * @param {String} type - * @param {Array} parameters + * @param {Object} options * @param {Function} callback * * @callback callback callback(error, result) * @returns {eventifiedPromise | Subscription} */ -Eth.prototype.subscribe = function (type, parameters, callback) { - return this.subscriptionsResolver.resolve(type, parameters, callback); +Eth.prototype.subscribe = function (type, options, callback) { + switch (type) { + case 'logs': + return this.subscriptionsFactory.createLogSubscription( + this, + options, + this.methodModelFactory.createMethodModel('getPastLogs'), + this.methodController + ).subscribe(callback); + case 'newBlockHeaders': + return this.subscriptionsFactory.createNewHeadsSubscription(this).subscribe(callback); + case 'pendingTransactions': + return this.subscriptionsFactory.createNewPendingTransactionsSubscription(this).subscribe(callback); + case 'syncing': + return this.subscriptionsFactory.createSyncingSubscriptionModel(this).subscribe(callback); + default: + throw Error('Unknown subscription: ' + type); + } }; /** @@ -144,8 +159,6 @@ Eth.prototype.subscribe = function (type, parameters, callback) { */ Eth.prototype.setProvider = function (provider) { AbstractWeb3Object.setProvider.call(provider); - - this.subscriptionsResolver.setProvider(provider); this.net.setProvider(provider); this.accounts.setProvider(provider); this.personal.setProvider(provider); diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 6ae34a7852b..b5fb6ea84e9 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -23,7 +23,6 @@ "use strict"; var version = require('./package.json').version; -var SubscriptionsResolver = require('./resolvers/SubscriptionsResolver'); var MethodModelFactory = require('./factories/MethodModelFactory'); var Eth = require('./Eth'); var NetPackage = require('web3-net'); @@ -32,8 +31,7 @@ var AccountsPackage = require('web3-eth-accounts'); var PersonalPackage = require('web3-eth-personal'); var ENSPackage = require('web3-eth-ens'); var AbiPackage = require('web3-eth-abi'); -var SubscriptionPackage = require('web3-core-subscription'); -var PromiEventPackage = require('web3-core-promiEvent'); +var SubscriptionsFactory = require('web3-core-subscription').SubscriptionsFactory; var ProvidersPackage = require('web3-core-providers'); var Iban = require('web3-eth-iban').Iban; var formatters = require('web3-core-helpers').formatters; @@ -49,7 +47,7 @@ module.exports = { * * @method createEth * - * @param {Object} provider + * @param {AbstractProviderAdapter} provider * * @returns {Eth} */ @@ -70,15 +68,7 @@ module.exports = { Utils, formatters, ProvidersPackage, - new SubscriptionsResolver( - provider, - formatters, - SubscriptionPackage, - PromiEventPackage, - ProvidersPackage, - methodModelFactory, - methodController - ), + new SubscriptionsFactory(Utils, formatters), methodController, methodModelFactory, BatchRequestPackage diff --git a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js b/packages/web3-eth/src/resolvers/SubscriptionsResolver.js deleted file mode 100644 index d06939adc6d..00000000000 --- a/packages/web3-eth/src/resolvers/SubscriptionsResolver.js +++ /dev/null @@ -1,279 +0,0 @@ -/* - 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 . -*/ -/** - * @file SubscriptionsResolver.js - * @authors: Samuel Furter - * @date 2018 - */ - -"use strict"; - -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; - -/** - * @param {AbstractProviderAdapter | EthereumProvider} provider - * @param {Object} formatters - * @param {Subscription} subscriptionPackage - * @param {PromiEvent} promiEventPackage - * @param {ProvidersPackage} providersPackage - * @param {MethodModelFactory} methodModelFactory - * @param {MethodController} methodController - * - * @constructor - */ -function SubscriptionsResolver( - provider, - formatters, - subscriptionPackage, - promiEventPackage, - providersPackage, - methodModelFactory, - methodController -) { - AbstractWeb3Object.call(this, provider, providersPackage, methodController, methodModelFactory, subscriptionPackage); - this.formatters = formatters; - this.promiEventPackage = promiEventPackage; -} - -/** - * Resolves the requested subscription - * - * @method resolve - * - * @param {String} type - * @param {Object} parameter - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {eventifiedPromise | Subscription} - */ -SubscriptionsResolver.prototype.resolve = function (type, parameter, callback) { - switch (type) { - case 'newBlockHeaders': - return this.getSubscription('newHeads', null, null, this.formatters.outputBlockFormatter, callback); - case 'pendingTransactions': - return this.getSubscription('newPendingTransactions', null, null, null, callback); - case 'logs': - return this.getLogsSubscription(parameter, callback); - case 'syncing': - return this.getSyncingSubscription(callback); - default: - throw Error('Unknown subscription: ' + type); - } -}; - -/** - * Create Subscription object - * - * @method getSubscription - * - * @param {String} type - * @param {Object} parameter - * @param {Function} inputFormatter - * @param {Function} outputFormatter - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Subscription} - */ -SubscriptionsResolver.prototype.getSubscription = function (type, parameter, inputFormatter, outputFormatter, callback) { - return this.subscriptionPackage.createSubscription( - this.currentProvider, - type, - [parameter], - inputFormatter, - outputFormatter, - 'eth' - ).subscribe(callback); -}; - -/** - * Determines if fromBlock is set and returns the expected subscription. - * - * @method getLogsSubscription - * - * @param {Object} parameter - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {eventifiedPromise} - */ -SubscriptionsResolver.prototype.getLogsSubscription = function (parameter, callback) { - var promiEvent = this.promiEventPackage.createPromiEvent(); - - if (this.hasFromBlockProperty(parameter)) { - this.handleLogsSubscriptionWithFromBlock(parameter, promiEvent, callback); - - return promiEvent; - } - - this.subscribeToLogs(parameter, promiEvent, callback); - - return promiEvent; -}; - -/** - * Subscribes to logs and emits promiEvent events - * - * @method subscribeToLogs - * - * @param {Object} parameter - * @param {PromiEvent} promiEvent - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -SubscriptionsResolver.prototype.subscribeToLogs = function (parameter, promiEvent, callback) { - this.getSubscription( - 'logs', - parameter, - null, - this.formatters.outputLogFormatter, - function (error, logs) { - if (error) { - callback(error, null); - promiEvent.eventEmitter.emit('error', error); - - return; - } - - logs.forEach(function (log) { - callback(false, log); - promiEvent.eventEmitter.emit('data', log); - }); - } - ); -}; - -/** - * Sends the JSON-RPC request eth_getLogs to get the past logs and after that it subscribes to the comming logs. - * - * @method handleLogsSubscriptionWithFromBlock - * - * @param {Object} parameter - * @param {PromiEvent} promiEvent - * @param {Function} callback - * - * @callback callback callback(error,result) - */ -SubscriptionsResolver.prototype.handleLogsSubscriptionWithFromBlock = function (parameter, promiEvent, callback) { - var self = this; - this.getPastLogs(parameter).then(function (logs) { - logs.forEach(function (log) { - callback(false, log); - promiEvent.eventEmitter.emit('data', log); - }); - - delete parameter.fromBlock; - - self.subscribeToLogs(parameter, promiEvent, callback); - - }).catch(function (error) { - promiEvent.eventEmitter.emit('error', error); - callback(error, null); - }); -}; - -/** - * Checks if node is syncing and returns PromiEvent - * - * @method getSyncingSubscription - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {eventifiedPromise} - */ -SubscriptionsResolver.prototype.getSyncingSubscription = function (callback) { - var promiEvent = this.promiEventPackage.createPromiEvent(); - - this.getSubscription( - 'syncing', - null, - null, - this.formatters.outputSyncingFormatter, - function (error, output) { - var self = this; - - if (error) { - promiEvent.eventEmitter.emit('error', error); - callback(error, null, this); - - return; - } - - // fire TRUE at start - if (this.isSyncing !== true) { - this.isSyncing = true; - promiEvent.eventEmitter.emit('changed', this.isSyncing); - - if (_.isFunction(callback)) { - callback(null, this.isSyncing, this); - } - - setTimeout(function () { - promiEvent.eventEmitter.emit('data', output); - - if (_.isFunction(self.callback)) { - callback(null, output, self); - } - }, 0); - - return; - } - - // fire sync status - promiEvent.eventEmitter.emit('data', output); - if (_.isFunction(callback)) { - callback(null, output, this); - } - - // wait for some time before fireing the FALSE - clearTimeout(this.isSyncingTimeout); - this.isSyncingTimeout = setTimeout(function () { - if (output.currentBlock > output.highestBlock - 200) { - self.isSyncing = false; - promiEvent.eventEmitter.emit('changed', self.isSyncing); - - if (_.isFunction(callback)) { - callback(null, self.isSyncing, self); - } - } - }, 500); - } - ); - - return promiEvent; -}; - -/** - * Checks if fromBlock property is set in parameter object - * - * @method hasFromBlockProperty - * - * @param {Object} parameter - * - * @returns {boolean} - */ -SubscriptionsResolver.prototype.hasFromBlockProperty = function (parameter) { - return _.isObject(parameter) && parameter.hasOwnProperty('fromBlock') && _.isNumber(parameter.fromBlock); -}; - -SubscriptionsResolver.prototype = Object.create(AbstractWeb3Object); -SubscriptionsResolver.prototype.constructor = SubscriptionsResolver; - -module.exports = SubscriptionsResolver; diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index cffa4374152..3b432196422 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -29,19 +29,18 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory - * @param {SubscriptionPackage} subscriptionPackage + * @param {SubscriptionsFactory} subscriptionsFactory * @param {Network} net * * @constructor */ -function Shh(provider, providersPackage, methodController, methodModelFactory, subscriptionPackage, net) { +function Shh(provider, providersPackage, methodController, methodModelFactory, subscriptionsFactory, net) { AbstractWeb3Object.call( this, provider, providersPackage, methodController, - methodModelFactory, - subscriptionPackage + methodModelFactory ); this.net = net; } @@ -56,17 +55,14 @@ function Shh(provider, providersPackage, methodController, methodModelFactory, s * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {Subscription} */ Shh.prototype.subscribe = function (method, options, callback) { - return this.subscriptionPackage.create( - this.currentProvider, - method, - [options], - null, - null, - 'shh' - ).subscribe(callback); + if (method === 'messages') { + return this.subscriptionsFactory.createShhMessagesSubscription(this, options).subscribe(callback); + } + + throw Error('Unknown subscription: ' + method); }; /** diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index b4b29ffa647..510c837eeb2 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -25,7 +25,7 @@ var version = require('./package.json'); var ProvidersPackage = require('web3-core-providers'); var MethodPackage = require('web3-core-method'); -var SubscriptionPackage = require('web3-core-subscription'); +var SubscriptionsFactory = require('web3-core-subscription').SubscriptionsFactory; var NetworkPackage = require('web3-net'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; @@ -50,7 +50,7 @@ module.exports = { ProvidersPackage, MethodPackage.createMethodController(), new MethodModelFactory(Utils, formatters), - SubscriptionPackage, + new SubscriptionsFactory(Utils, formatters), NetworkPackage.createNetwork(provider) ); } From 10901dbfac3d9e3bfbeb440b7744c54ff40e0735 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 15:00:02 +0200 Subject: [PATCH 0166/1045] inheritance fixed and EventLogSubscription created in contract package --- packages/web3-core-subscription/src/index.js | 3 + .../subscriptions/eth/LogSubscriptionModel.js | 2 +- .../eth/NewHeadsSubscriptionModel.js | 2 +- ...NewPendingTransactionsSubscriptionModel.js | 2 +- .../eth/SyncingSubscriptionModel.js | 2 +- .../subscriptions/EventLogSubscription.js | 57 +++++++++++++++++++ 6 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js index 49c03a401c6..e7fc979f2a0 100644 --- a/packages/web3-core-subscription/src/index.js +++ b/packages/web3-core-subscription/src/index.js @@ -24,8 +24,11 @@ var version = require('./package.json').version; var SubscriptionsFactory = require('./factories/SubscriptionsFactory'); +var LogSubscriptionModel = require('./models/subscriptions/eth/LogSubscriptionModel'); module.exports = { version: version, + + LogSubscriptionModel: LogSubscriptionModel, SubscriptionsFactory: SubscriptionsFactory }; diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js index 6a0d5d88a07..11e44d0d7bc 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -85,7 +85,7 @@ LogSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, s return this.formatters.outputLogFormatter(subscriptionItem); }; -LogSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +LogSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); LogSubscriptionModel.prototype.constructor = LogSubscriptionModel; module.exports = LogSubscriptionModel; diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js index 766d9709a2f..749b2502358 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js @@ -48,7 +48,7 @@ NewHeadsSubscriptionModel.prototype.onNewSubscriptionItem = function (subscripti return this.formatters.outputBlockFormatter(subscriptionItem); }; -NewHeadsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +NewHeadsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); NewHeadsSubscriptionModel.prototype.constructor = NewHeadsSubscriptionModel; module.expors = NewHeadsSubscriptionModel; diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js index 8e8d783841c..3155799c71b 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js @@ -41,7 +41,7 @@ function NewPendingTransactionsSubscriptionModel(utils, formatters) { ); } -NewPendingTransactionsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +NewPendingTransactionsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); NewPendingTransactionsSubscriptionModel.prototype.constructor = NewPendingTransactionsSubscriptionModel; module.exports = NewPendingTransactionsSubscriptionModel; diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js index 35d2b386dea..9315c9786af 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -66,7 +66,7 @@ SyncingSubscriptionModel.prototype.onNewSubscriptionItem = function (subscriptio return this.formatters.outputSyncingFormatter(subscriptionItem); }; -SyncingSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); +SyncingSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); SyncingSubscriptionModel.prototype.constructor = SyncingSubscriptionModel; module.exports = SyncingSubscriptionModel; diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js new file mode 100644 index 00000000000..77526742500 --- /dev/null +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -0,0 +1,57 @@ +/* + 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 . +*/ +/** + * @file EventLogSubscription.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var LogSubscriptionModel = require('web3-core-subscription').LogSubscriptionModel; + +/** + * @param {Object} options + * @param {Utils} utils + * @param {Object} formatters + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * @param {EventLogDecoder} eventLogDecoder + * + * @constructor + */ +function EventLogSubscription(options, utils, formatters, getPastLogsMethodModel, methodController, eventLogDecoder) { + LogSubscriptionModel.call(this, options, utils, formatters, getPastLogsMethodModel, methodController); + this.eventLogDecoder = eventLogDecoder; +} + +/** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {Object} + */ +EventLogSubscription.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { + return this.eventLogDecoder.decode(this.formatters.outputLogFormatter(subscriptionItem)); +}; + +EventLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); +EventLogSubscription.prototye.constructor = EventLogSubscription; From 7238a3740b100190b0059062112ea4ebd4a4b3cf Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 16:16:26 +0200 Subject: [PATCH 0167/1045] event log subscription implemented, factory extended and dependencies fixed --- packages/web3-core-subscription/src/index.js | 2 + packages/web3-eth-contract/src/Contract.js | 7 +- .../src/factories/ContractPackageFactory.js | 167 +++++++++++++----- .../src/factories/EventSubscriptionFactory.js | 64 +++++++ ...hodFactory.js => RpcMethodModelFactory.js} | 7 +- .../src/mappers/EventOptionsMapper.js | 6 +- .../subscriptions/EventLogSubscription.js | 2 + .../src/proxies/EventSubscriptionsProxy.js | 30 ++-- .../src/proxies/MethodsProxy.js | 41 +++-- 9 files changed, 238 insertions(+), 88 deletions(-) create mode 100644 packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js rename packages/web3-eth-contract/src/factories/{RpcMethodFactory.js => RpcMethodModelFactory.js} (91%) diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js index e7fc979f2a0..9ba6a8689d9 100644 --- a/packages/web3-core-subscription/src/index.js +++ b/packages/web3-core-subscription/src/index.js @@ -25,10 +25,12 @@ var version = require('./package.json').version; var SubscriptionsFactory = require('./factories/SubscriptionsFactory'); var LogSubscriptionModel = require('./models/subscriptions/eth/LogSubscriptionModel'); +var Subscription = require('./Subscription'); module.exports = { version: version, + Subscription: Subscription, LogSubscriptionModel: LogSubscriptionModel, SubscriptionsFactory: SubscriptionsFactory }; diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 47f04eeaf6c..02d6cc419c2 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -31,6 +31,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {SubscriptionPackage} subscriptionPackage * @param {BatchRequestPackage} batchRequestPackage * @param {ContractPackageFactory} contractPackageFactory + * @param {PromiEventPackage} promiEventPackage * @param {ABICoder} abiCoder * @param {Utils} utils * @param {Object} formatters @@ -49,6 +50,7 @@ function Contract( subscriptionPackage, batchRequestPackage, contractPackageFactory, + promiEventPackage, abiCoder, utils, formatters, @@ -78,6 +80,7 @@ function Contract( this.accounts = accounts; this.abiMapper = abiMapper; this.options = options; + this.promiEventPackage = promiEventPackage; AbstractWeb3Object.call( this, @@ -124,7 +127,8 @@ function Contract( this.abiCoder, this.utils, this.formatters, - this.accounts + this.accounts, + this.promiEventPackage ); this.events = contractPackageFactory.createEventsSubscriptionsProxy(); @@ -192,6 +196,7 @@ Contract.prototype.clone = function () { this.subscriptionPackage, this.batchRequestPackage, this.contractPackageFactory, + this.promiEventPackage, this.abiCoder, this.utils, this.formatters, diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index f67b4e74af2..1cba1c87cf5 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -25,17 +25,32 @@ var ABIModel = require('../models/abi/ABIModel'); var ABIItemModel = require('../models/abi/ABIItemModel'); var MethodEncoder = require('../encoders/MethodEncoder'); +var EventFilterEncoder = require('../encoders/EventFilterEncoder'); var MethodResponseDecoder = require('../decoders/MethodResponseDecoder'); +var EventLogDecoder = require('../decoders/EventLogDecoder'); var ABIMapper = require('../mappers/ABIMapper'); var RpcMethodOptionsMapper = require('../mappers/RpcMethodOptionsMapper'); +var EventOptionsMapper = require('../mappers/EventOptionsMapper'); var MethodsProxy = require('../proxies/MethodsProxy'); +var EventSubscriptionsProxy = require('../proxies/EventSubscriptionsProxy'); var RpcMethodOptionsValidator = require('../validators/RpcMethodOptionsValidator'); var RpcMethodFactory = require('../factories/RpcMethodFactory'); +var EventSubscriptionFactory = require('../factories/EventSubscriptionFactory'); /** + * @param {Utils} utils + * @param {Object} formatters + * @param {ABICoder} abiCoder + * @param {Accounts} accounts + * * @constructor */ -function ContractPackageFactory() { } +function ContractPackageFactory(utils, formatters, abiCoder, accounts) { + this.utils = utils; + this.formatters = formatters; + this.abiCoder = abiCoder; + this.accounts = accounts; +} /** * Returns an object of ABIModel @@ -68,12 +83,21 @@ ContractPackageFactory.prototype.createABIItemModel = function (abiItem) { * * @method createMethodEncoder * - * @param {ABICoder} abiCoder - * * @returns {MethodEncoder} */ -ContractPackageFactory.prototype.createMethodEncoder = function (abiCoder) { - return new MethodEncoder(abiCoder); +ContractPackageFactory.prototype.createMethodEncoder = function () { + return new MethodEncoder(this.abiCoder); +}; + +/** + * Returns an object of EventFilterEncoder + * + * @method createEventFilterEncoder + * + * @returns {EventFilterEncoder} + */ +ContractPackageFactory.prototype.createEventFilterEncoder = function () { + return new EventFilterEncoder(this.abiCoder) }; /** @@ -81,13 +105,10 @@ ContractPackageFactory.prototype.createMethodEncoder = function (abiCoder) { * * @method createABIMapper * - * @param {ABICoder} abiCoder - * @param {Utils} utils - * * @returns {ABIMapper} */ -ContractPackageFactory.prototype.createABIMapper = function (abiCoder, utils) { - return new ABIMapper(this, abiCoder, utils); +ContractPackageFactory.prototype.createABIMapper = function () { + return new ABIMapper(this, this.abiCoder, this.utils); }; /** @@ -95,12 +116,21 @@ ContractPackageFactory.prototype.createABIMapper = function (abiCoder, utils) { * * @method createMethodResponseDecoder * - * @param {ABICoder} abiCoder - * * @returns {MethodResponseDecoder} */ -ContractPackageFactory.prototype.createMethodResponseDecoder = function (abiCoder) { - return new MethodResponseDecoder(abiCoder); +ContractPackageFactory.prototype.createMethodResponseDecoder = function () { + return new MethodResponseDecoder(this.abiCoder); +}; + +/** + * Returns an object of EventLogDecoder + * + * @method EventLogDecoder + * + * @returns {EventLogDecoder} + */ +ContractPackageFactory.prototype.createEventLogDecoder = function () { + return new EventLogDecoder(); }; /** @@ -108,12 +138,10 @@ ContractPackageFactory.prototype.createMethodResponseDecoder = function (abiCode * * @method createRpcMethodOptionsValidator * - * @param {Utils} utils - * * @returns {RpcMethodOptionsValidator} */ -ContractPackageFactory.prototype.createRpcMethodOptionsValidator = function (utils) { - return new RpcMethodOptionsValidator(utils); +ContractPackageFactory.prototype.createRpcMethodOptionsValidator = function () { + return new RpcMethodOptionsValidator(this.utils); }; /** @@ -121,33 +149,36 @@ ContractPackageFactory.prototype.createRpcMethodOptionsValidator = function (uti * * @method createRpcMethodOptionsMapper * - * @param {Utils} utils - * @param {Object} formatters - * * @returns {RpcMethodOptionsMapper} */ -ContractPackageFactory.prototype.createRpcMethodOptionsMapper = function (utils, formatters) { - return new RpcMethodOptionsMapper(utils, formatters); +ContractPackageFactory.prototype.createRpcMethodOptionsMapper = function () { + return new RpcMethodOptionsMapper(this.utils, this.formatters); }; /** - * Returns an object of RpcMethodFactory + * Returns an object of EventOptionsMapper * - * @method createRpcMethodFactory + * @method createEventOptionsMapper * - * @param {ABICoder} abiCoder - * @param {Utils} utils - * @param {Object} formatters - * @param {Accounts} accounts + * @returns {EventOptionsMapper} + */ +ContractPackageFactory.prototype.createEventOptionsMapper = function () { + return new EventOptionsMapper(this.formatters, this.createEventFilterEncoder()); +}; + +/** + * Returns an object of RpcMethodModelFactory + * + * @method createRpcMethodModelFactory * - * @returns {RpcMethodFactory} + * @returns {RpcMethodModelFactory} */ -ContractPackageFactory.prototype.createRpcMethodFactory = function (abiCoder, utils, formatters, accounts) { +ContractPackageFactory.prototype.createRpcMethodModelFactory = function () { return new RpcMethodFactory( - this.createMethodResponseDecoder(abiCoder), - accounts, - utils, - formatters + this.createMethodResponseDecoder(), + this.accounts, + this.utils, + this.formatters ); }; @@ -159,10 +190,7 @@ ContractPackageFactory.prototype.createRpcMethodFactory = function (abiCoder, ut * @param {Contract} contract * @param {ABIModel} abiModel * @param {MethodController} methodController - * @param {ABICoder} abiCoder - * @param {Utils} utils - * @param {Object} formatters - * @param {Accounts} accounts + * @param {PromiEventPackage} promiEventPackage * * @returns {MethodsProxy} */ @@ -170,17 +198,66 @@ ContractPackageFactory.prototype.createMethodsProxy = function ( contract, abiModel, methodController, - abiCoder, - utils, - formatters, - accounts + promiEventPackage ) { return new MethodsProxy( contract, abiModel, - this.createRpcMethodFactory(abiCoder, utils, formatters, accounts), + this.createRpcMethodModelFactory(), + methodController, + this.createMethodEncoder(), + this.createRpcMethodOptionsValidator(), + this.createRpcMethodOptionsMapper(), + promiEventPackage + ); +}; + +/** + * Returns an object of EventSubscriptionsProxy + * + * @method createEventSubscriptionsProxy + * + * @param {Contract} contract + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * + * @returns {EventSubscriptionsProxy} + */ +ContractPackageFactory.prototype.createEventSubscriptionsProxy = function ( + contract, + getPastLogsMethodModel, + methodController +) { + new EventSubscriptionsProxy( + contract, + abiModel, + this.createEventSubscriptionFactory( + this.utils, + this.formatters, + getPastLogsMethodModel, + methodController + ), + this.createEventOptionsMapper() + ); +}; + +/** + * Returns an object of SubscriptionFactory + * + * @method createEventSubscriptionFactory + * + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * + * @returns {EventSubscriptionFactory} + */ +ContractPackageFactory.prototype.createEventSubscriptionFactory = function (getPastLogsMethodModel, methodController) { + new EventSubscriptionFactory( + this.utils, + this.formatters, + getPastLogsMethodModel, methodController, - this.createMethodEncoder(abiCoder) + this.createEventLogDecoder() ); }; diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js new file mode 100644 index 00000000000..b560eebc236 --- /dev/null +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js @@ -0,0 +1,64 @@ +/* + 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 . + */ +/** + * @file SubscriptionFactory.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var Subscription = require('web3-core-subscription').Subscription; +var EventLogSubscription = require('../models/subscriptions/EventLogSubscription'); + +/** + * @param {Utils} utils + * @param {Object} formatters + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * @param {EventLogDecoder} eventLogDecoder + * + * @constructor + */ +function EventSubscriptionFactory(utils, formatters, getPastLogsMethodModel, methodController, eventLogDecoder) { + this.getPastLogsMethodModel = getPastLogsMethodModel; + this.methodController = methodController; + this.eventLogDecoder = eventLogDecoder; +} + +/** + * Returns an event log subscription + * + * @param {AbstractWeb3Object} web3Package + * @param {Object} options + * + * @returns {Subscription} + */ +EventSubscriptionFactory.prototype.createEventLogSubscription = function (web3Package, options) { + return new Subscription(web3Package, + new EventLogSubscription( + options, + this.utils, + this.formatters, + this.getPastLogsMethodModel, + this.methodController, + this.eventLogDecoder + ) + ); +}; + +module.exports = EventSubscriptionFactory; diff --git a/packages/web3-eth-contract/src/factories/RpcMethodFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js similarity index 91% rename from packages/web3-eth-contract/src/factories/RpcMethodFactory.js rename to packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js index c2168b95112..656c6943e7d 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js @@ -27,7 +27,6 @@ var CallContractMethodModel = require('../models/methods/CallContractMethodModel var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; /** - * TODO: Rename it to RpcMethodModelFactory * @param {MethodResponseDecoder} methodResponseDecoder * @param {Accounts} accounts * @param {Utils} utils @@ -35,7 +34,7 @@ var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; * * @constructor */ -function RpcMethodFactory(methodResponseDecoder, accounts, utils, formatters) { +function RpcMethodModelFactory(methodResponseDecoder, accounts, utils, formatters) { this.utils = utils; this.formatters = formatters; this.methodResponseDecoder = methodResponseDecoder; @@ -51,7 +50,7 @@ function RpcMethodFactory(methodResponseDecoder, accounts, utils, formatters) { * * @returns {AbstractMethodModel} */ -RpcMethodFactory.prototype.createRpcMethod = function (abiItemModel) { +RpcMethodModelFactory.prototype.createRpcMethod = function (abiItemModel) { var rpcMethod; switch (abiItemModel.requestType) { @@ -84,4 +83,4 @@ RpcMethodFactory.prototype.createRpcMethod = function (abiItemModel) { return rpcMethod; }; -module.exports = RpcMethodFactory; +module.exports = RpcMethodModelFactory; diff --git a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js index 866b484f363..04bb0acaccb 100644 --- a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js @@ -35,12 +35,12 @@ function EventOptionsMapper(formatters, eventFilterEncoder) { /** * @param {ABIItemModel} abiItemModel - * @param {EventSubscriptionsProxy} target + * @param {Contract} contract * @param {Object} options * * @returns {Object} */ -EventOptionsMapper.prototype.map = function(abiItemModel, target, options) { +EventOptionsMapper.prototype.map = function(abiItemModel, contract, options) { var topics = []; if (typeof options.fromBlock !== 'undefined') { @@ -59,7 +59,7 @@ EventOptionsMapper.prototype.map = function(abiItemModel, target, options) { topics.concat(this.eventFilterEncoder.encode(abiItemModel, options.filter)); } - options.address = target.contract.options.address; + options.address = contract.options.address; return options; }; diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index 77526742500..39424f7853e 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -55,3 +55,5 @@ EventLogSubscription.prototype.onNewSubscriptionItem = function (subscription, s EventLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); EventLogSubscription.prototye.constructor = EventLogSubscription; + +module.exports = EventLogSubscription; diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 2a73e4e36cf..64d90a1b8fb 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -23,17 +23,17 @@ "use strict"; /** + * @param {Contract} contract * @param {ABIModel} abiModel - * @param {SubscriptionPackage} subscriptionPackage + * @param {EventSubscriptionFactory} subscriptionFactory * @param {EventOptionsMapper} eventOptionsMapper - * @param {EventLogDecoder} eventLogDecoder * * @constructor */ -function EventSubscriptionsProxy(abiModel, subscriptionPackage, eventOptionsMapper, eventLogDecoder) { - this.subscriptionPackage = subscriptionPackage; +function EventSubscriptionsProxy(contract, abiModel, subscriptionFactory, eventOptionsMapper) { + this.contract = contract; + this.subscriptionFactory = subscriptionFactory; this.abiModel = abiModel; - this.eventLogDecoder = eventLogDecoder; this.eventOptionsMapper = eventOptionsMapper; return new Proxy(this, { @@ -52,20 +52,22 @@ function EventSubscriptionsProxy(abiModel, subscriptionPackage, eventOptionsMapp * @returns {Function|Error} */ EventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { - var self = this; - if (this.abiModel.hasEvent(name)) { return function (options, callback) { - return this.subscribe(self.abiModel.getEvent(name), options, callback, target); + return target.subscribe(target.abiModel.getEvent(name), target, options, callback); } } if (name === 'allEvents') { return function (options, callback) { - return this.subscribeAll(options, target, callback); + return target.subscribeAll(options, target, callback); } } + if (target[name]) { + return target[name]; + } + throw Error('Event with name "' + name + '" not found'); }; @@ -84,13 +86,9 @@ EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, target, op this.handleValidationError(new Error('Please set only topics or filters but not both.'), callback); } - return this.subscriptionPackage.createSubscription( - target.contract.currentProvider, - 'logs', - [this.eventOptionsMapper.map(abiItemModel, target, options)], - this.formatters.inputLogFormatter, - this.eventLogDecoder.decode, - 'eth' + return this.subscriptionFactory.createEventLogSubscription( + target.contract, + target.eventOptionsMapper.map(abiItemModel, target.contract, options) ).subscribe(callback); }; diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index d1ad843087c..6745a45cdb6 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -25,7 +25,7 @@ /** * @param {Contract} contract * @param {ABIModel} abiModel - * @param {RpcMethodFactory} rpcMethodFactory + * @param {RpcMethodModelFactory} rpcMethodModelFactory * @param {MethodController} methodController * @param {MethodEncoder} methodEncoder * @param {RpcMethodOptionsValidator} rpcMethodOptionsValidator @@ -37,7 +37,7 @@ function MethodsProxy( contract, abiModel, - rpcMethodFactory, + rpcMethodModelFactory, methodController, methodEncoder, rpcMethodOptionsValidator, @@ -46,7 +46,7 @@ function MethodsProxy( ) { this.contract = contract; this.abiModel = abiModel; - this.rpcMethodFactory = rpcMethodFactory; + this.rpcMethodModelFactory = rpcMethodModelFactory; this.methodController = methodController; this.methodEncoder = methodEncoder; this.rpcMethodOptionsValidator = rpcMethodOptionsValidator; @@ -69,8 +69,7 @@ function MethodsProxy( * @returns {Function|Error} */ MethodsProxy.prototype.proxyHandler = function (target, name) { - var self = this; - var abiItemModel = this.abiModel.getMethod(name); + var abiItemModel = target.abiModel.getMethod(name); if (abiItemModel) { var anonymousFunction = function () { @@ -78,24 +77,28 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { }; anonymousFunction[abiItemModel.requestType] = function () { - return self.executeMethod(abiItemModel, target, arguments); + return target.executeMethod(abiItemModel, target, arguments); }; anonymousFunction[abiItemModel.requestType].request = function () { - return self.createRpcMethod(abiItemModel, target, arguments); + return target.createRpcMethod(abiItemModel, target, arguments); }; anonymousFunction.estimateGas = function () { abiItemModel.requestType = 'estimate'; - return self.executeMethod(abiItemModel, target, arguments); + return target.executeMethod(abiItemModel, target, arguments); }; anonymousFunction.encodeAbi = function () { - return self.methodEncoder.encode(abiItemModel, target.contract.options.data); + return target.methodEncoder.encode(abiItemModel, target.contract.options.data); }; } + if (target[name]) { + return target[name]; + } + throw Error('Method with name "' + name + '" not found'); }; @@ -109,13 +112,13 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { * @returns {Promise|PromiEvent|String|Boolean} */ MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArguments) { - var rpcMethodModel = this.createRpcMethodModel(abiItemModel, target, methodArguments); + var rpcMethodModel = target.createRpcMethodModel(abiItemModel, target, methodArguments); if (typeof rpcMethodModel.error !== 'undefined') { - return this.handleValidationError(rpcMethodModel.error, rpcMethodModel.callback); + return target.handleValidationError(rpcMethodModel.error, rpcMethodModel.callback); } - return this.methodController.execute( + return target.methodController.execute( rpcMethodModel, target.contract.currentProvider, target.contract.accounts, @@ -130,10 +133,10 @@ MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArg * @param {MethodsProxy} target * @param {IArguments} methodArguments * - * @returns {AbstractMethodModel} + * @returns {AbstractMethodModel|Object} */ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, methodArguments) { - var rpcMethodModel, self = this; + var rpcMethodModel; // If it is an array than check which AbiItemModel should be used. // This will be used if two methods with the same name exists but with different arguments. @@ -143,7 +146,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, me // Check if one of the AbiItemModel in this array does match the arguments length abiItemModel.some(function(method) { // Get correct rpc method model - rpcMethodModel = self.rpcMethodFactory.createRpcMethod(method); + rpcMethodModel = target.rpcMethodFactory.createRpcMethod(method); rpcMethodModel.methodArguments = methodArguments; isContractMethodParametersLengthValid = abiItemModel.givenParametersLengthIsValid(); @@ -159,7 +162,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, me } } else { // Get correct rpc method model - rpcMethodModel = this.rpcMethodFactory.createRpcMethod(abiItemModel); + rpcMethodModel = target.rpcMethodModelFactory.createRpcMethod(abiItemModel); rpcMethodModel.methodArguments = methodArguments; } @@ -174,7 +177,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, me } // Encode contract method and check if there was an error - var encodedContractMethod = self.methodEncoder.encode(abiItemModel, target.contract.options.data); + var encodedContractMethod = target.methodEncoder.encode(abiItemModel, target.contract.options.data); if (encodedContractMethod instanceof Error) { return { error: encodedContractMethod, @@ -186,10 +189,10 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, me rpcMethodModel.parameters[0]['data'] = encodedContractMethod; // Set default options in the TxObject if required - rpcMethodModel.parameters = self.rpcMethodOptionsMapper.map(target.contract.options, rpcMethodModel.parameters[0]); + rpcMethodModel.parameters = target.rpcMethodOptionsMapper.map(target.contract.options, rpcMethodModel.parameters[0]); // Validate TxObject - var rpcMethodOptionsValidationResult = self.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethodModel); + var rpcMethodOptionsValidationResult = target.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethodModel); if (rpcMethodOptionsValidationResult instanceof Error) { return { error: rpcMethodOptionsValidationResult, From d62481bdb033ee07643f7b38d0b8b2fcce4146e0 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 17:04:14 +0200 Subject: [PATCH 0168/1045] requestType getter implemented in ABIItemModel --- .../src/models/abi/ABIItemModel.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index f749d945b4d..1053b4e9873 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -25,7 +25,6 @@ var _ = require('underscore'); /** - * TODO: Add requestType getter * @param {Object} abiItem * * @constructor @@ -35,6 +34,18 @@ function ABIItemModel(abiItem) { this.signature = this.abiItem.signature; this.name = this.abiItem.name; this.contractMethodParameters = []; + + Object.defineProperty(this, 'requestType', { + get: function () { + if (abiItem.type === 'function') { + if (abiItem.constant === true) { + return 'call'; + } + + return 'send'; + } + } + }) } /** From 02438ce7a56a1007b8d8b3364ffb062dc6e3852d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 17:24:22 +0200 Subject: [PATCH 0169/1045] EventLogDecoder implemented --- .../src/decoders/EventLogDecoder.js | 61 ++++++++++++++++++- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js index 6f08ddfde9c..9c7aa2aef07 100644 --- a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js @@ -22,12 +22,67 @@ "use strict"; -function EventLogDecoder() { - +/** + * @param {ABICoder} abiCoder + * @param {Object} formatters + * + * @constructor + */ +function EventLogDecoder(abiCoder, formatters) { + this.abiCoder = abiCoder; + this.formatters = formatters; } -EventLogDecoder.prototype.decoder = function() { +/** + * Decodes the event subscription response + * + * @method decoder + * + * @param {ABIItemModel} abiItemModel + * @param {Object} response + * + * @returns {Object} + */ +EventLogDecoder.prototype.decode = function(abiItemModel, response) { + response.data = response.data || ''; + response.topics = response.topics || []; + + // // if allEvents get the right event + // if(event.name === 'ALLEVENTS') { + // event = event.jsonInterface.find(function (intf) { + // return (intf.signature === data.topics[0]); + // }) || {anonymous: true}; + // } + + var argTopics = response.topics; + if (abiItemModel.anonymous) { + argTopics = response.topics.slice(1); + } + + var result = this.formatters.outputLogFormatter(response); + result.returnValues = this.abiCoder.decodeLog(abiItemModel.getInputs(), response.data, argTopics); + + // add name + result.event = abiItemModel.name; + + // add signature + result.signature = data.topics[0]; + + if (event.anonymous || !data.topics[0]) { + result.signature = null; + } + + // move the data and topics to "raw" + result.raw = { + data: result.data, + topics: result.topics + }; + + delete result.returnValues.__length__; + delete result.data; + delete result.topics; + return result; }; module.exports = EventLogDecoder; From 1d988946ae6e7eda32e7da64010d1dccd3260dff Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 17:27:51 +0200 Subject: [PATCH 0170/1045] code style improvements in EventLogDecoder --- .../src/decoders/EventLogDecoder.js | 17 ++++++----------- .../src/models/abi/ABIItemModel.js | 1 + 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js index 9c7aa2aef07..856c98606e2 100644 --- a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js @@ -60,24 +60,19 @@ EventLogDecoder.prototype.decode = function(abiItemModel, response) { } var result = this.formatters.outputLogFormatter(response); - result.returnValues = this.abiCoder.decodeLog(abiItemModel.getInputs(), response.data, argTopics); - // add name + result.returnValues = this.abiCoder.decodeLog(abiItemModel.getInputs(), response.data, argTopics); result.event = abiItemModel.name; - - // add signature - result.signature = data.topics[0]; - - if (event.anonymous || !data.topics[0]) { - result.signature = null; - } - - // move the data and topics to "raw" + result.signature = abiItemModel.signature; result.raw = { data: result.data, topics: result.topics }; + if (abiItemModel.anonymous || !response.topics[0]) { + result.signature = null; + } + delete result.returnValues.__length__; delete result.data; delete result.topics; diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index 1053b4e9873..1cadf662b57 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -33,6 +33,7 @@ function ABIItemModel(abiItem) { this.abiItem = abiItem; this.signature = this.abiItem.signature; this.name = this.abiItem.name; + this.anonymous = this.abitItem.anonymous; this.contractMethodParameters = []; Object.defineProperty(this, 'requestType', { From 0d92c2bf4953a75edca80aec190b7f981845a53a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 17:39:47 +0200 Subject: [PATCH 0171/1045] ouputLogFormatter removed from the decoder because the response is already formatted in the EventLogDecoder --- .../src/decoders/EventLogDecoder.js | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js index 856c98606e2..465f9b2de37 100644 --- a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js @@ -44,9 +44,6 @@ function EventLogDecoder(abiCoder, formatters) { * @returns {Object} */ EventLogDecoder.prototype.decode = function(abiItemModel, response) { - response.data = response.data || ''; - response.topics = response.topics || []; - // // if allEvents get the right event // if(event.name === 'ALLEVENTS') { // event = event.jsonInterface.find(function (intf) { @@ -59,25 +56,23 @@ EventLogDecoder.prototype.decode = function(abiItemModel, response) { argTopics = response.topics.slice(1); } - var result = this.formatters.outputLogFormatter(response); - - result.returnValues = this.abiCoder.decodeLog(abiItemModel.getInputs(), response.data, argTopics); - result.event = abiItemModel.name; - result.signature = abiItemModel.signature; - result.raw = { - data: result.data, - topics: result.topics + response.returnValues = this.abiCoder.decodeLog(abiItemModel.getInputs(), response.data, argTopics); + response.event = abiItemModel.name; + response.signature = abiItemModel.signature; + response.raw = { + data: response.data, + topics: response.topics }; if (abiItemModel.anonymous || !response.topics[0]) { - result.signature = null; + response.signature = null; } - delete result.returnValues.__length__; - delete result.data; - delete result.topics; + delete response.returnValues.__length__; + delete response.data; + delete response.topics; - return result; + return response; }; module.exports = EventLogDecoder; From 7d0ba569123e6851b5e902fbf0f3bd53cb7b983d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 17:43:19 +0200 Subject: [PATCH 0172/1045] ABIItemModel added to EventLogSubscription because of the EventLogDecoder --- .../src/factories/EventSubscriptionFactory.js | 4 +++- .../src/models/subscriptions/EventLogSubscription.js | 6 ++++-- .../src/proxies/EventSubscriptionsProxy.js | 9 +++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js index b560eebc236..e65a456e35b 100644 --- a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js @@ -43,14 +43,16 @@ function EventSubscriptionFactory(utils, formatters, getPastLogsMethodModel, met /** * Returns an event log subscription * + * @param {ABIItemModel} abiItemModel * @param {AbstractWeb3Object} web3Package * @param {Object} options * * @returns {Subscription} */ -EventSubscriptionFactory.prototype.createEventLogSubscription = function (web3Package, options) { +EventSubscriptionFactory.prototype.createEventLogSubscription = function (abiItemModel, web3Package, options) { return new Subscription(web3Package, new EventLogSubscription( + abiItemModel, options, this.utils, this.formatters, diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index 39424f7853e..610440b4825 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -25,6 +25,7 @@ var LogSubscriptionModel = require('web3-core-subscription').LogSubscriptionModel; /** + * @param {ABIItemModel} abiItemModel * @param {Object} options * @param {Utils} utils * @param {Object} formatters @@ -34,9 +35,10 @@ var LogSubscriptionModel = require('web3-core-subscription').LogSubscriptionMode * * @constructor */ -function EventLogSubscription(options, utils, formatters, getPastLogsMethodModel, methodController, eventLogDecoder) { +function EventLogSubscription(abiItemModel, options, utils, formatters, getPastLogsMethodModel, methodController, eventLogDecoder) { LogSubscriptionModel.call(this, options, utils, formatters, getPastLogsMethodModel, methodController); this.eventLogDecoder = eventLogDecoder; + this.abiItemModel = abiItemModel; } /** @@ -50,7 +52,7 @@ function EventLogSubscription(options, utils, formatters, getPastLogsMethodModel * @returns {Object} */ EventLogSubscription.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { - return this.eventLogDecoder.decode(this.formatters.outputLogFormatter(subscriptionItem)); + return this.eventLogDecoder.decode(this.abiItemModel, this.formatters.outputLogFormatter(subscriptionItem)); }; EventLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 64d90a1b8fb..c1f263767ce 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -25,14 +25,14 @@ /** * @param {Contract} contract * @param {ABIModel} abiModel - * @param {EventSubscriptionFactory} subscriptionFactory + * @param {EventSubscriptionFactory} eventSubscriptionFactory * @param {EventOptionsMapper} eventOptionsMapper * * @constructor */ -function EventSubscriptionsProxy(contract, abiModel, subscriptionFactory, eventOptionsMapper) { +function EventSubscriptionsProxy(contract, abiModel, eventSubscriptionFactory, eventOptionsMapper) { this.contract = contract; - this.subscriptionFactory = subscriptionFactory; + this.eventSubscriptionFactory = eventSubscriptionFactory; this.abiModel = abiModel; this.eventOptionsMapper = eventOptionsMapper; @@ -86,7 +86,8 @@ EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, target, op this.handleValidationError(new Error('Please set only topics or filters but not both.'), callback); } - return this.subscriptionFactory.createEventLogSubscription( + return this.eventSubscriptionFactory.createEventLogSubscription( + abiItemModel, target.contract, target.eventOptionsMapper.map(abiItemModel, target.contract, options) ).subscribe(callback); From cfa26e41e137cb865ad2648fc199d78e89b06f50 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 1 Oct 2018 17:44:26 +0200 Subject: [PATCH 0173/1045] codestyle improved in EventLogSubscription --- .../src/models/subscriptions/EventLogSubscription.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index 610440b4825..ebf1416a3ae 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -35,7 +35,15 @@ var LogSubscriptionModel = require('web3-core-subscription').LogSubscriptionMode * * @constructor */ -function EventLogSubscription(abiItemModel, options, utils, formatters, getPastLogsMethodModel, methodController, eventLogDecoder) { +function EventLogSubscription( + abiItemModel, + options, + utils, + formatters, + getPastLogsMethodModel, + methodController, + eventLogDecoder +) { LogSubscriptionModel.call(this, options, utils, formatters, getPastLogsMethodModel, methodController); this.eventLogDecoder = eventLogDecoder; this.abiItemModel = abiItemModel; From 26037c42ed6ba9f30c30425f90ebe970f6316530 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 2 Oct 2018 16:51:31 +0200 Subject: [PATCH 0174/1045] AllEvents subscription implemented in contract package --- .../src/Subscription.js | 2 +- packages/web3-eth-contract/src/Contract.js | 10 +-- .../src/decoders/AllEventsLogDecoder.js | 58 +++++++++++++++ .../src/decoders/EventLogDecoder.js | 7 -- .../src/encoders/AllEventsFilterEncoder.js | 59 ++++++++++++++++ .../src/encoders/EventFilterEncoder.js | 2 + .../src/factories/ContractPackageFactory.js | 64 ++++++++++++----- .../src/factories/EventSubscriptionFactory.js | 37 +++++++--- .../src/mappers/AllEventsOptionsMapper.js | 65 +++++++++++++++++ .../src/mappers/EventOptionsMapper.js | 18 +++-- .../src/models/abi/ABIItemModel.js | 35 ++++++---- .../src/models/abi/ABIModel.js | 32 ++++++++- .../subscriptions/AllEventsLogSubscription.js | 66 +++++++++++++++++ .../src/proxies/EventSubscriptionsProxy.js | 70 +++++++++++++++---- .../src/proxies/MethodsProxy.js | 41 ++++++----- 15 files changed, 472 insertions(+), 94 deletions(-) create mode 100644 packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js create mode 100644 packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js create mode 100644 packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js create mode 100644 packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 2e36254ffdf..f7cf2cc1080 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -106,7 +106,7 @@ Subscription.prototype.handleSubscriptionResponse = function (response, callback }; /** - * TODO: Improve reconnecting! + * TODO: The reconnecting handling should only be in the provider the subscription should not care about it. * Reconnects provider and restarts subscription * * @method reconnect diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 02d6cc419c2..57d6bf63d54 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -124,14 +124,14 @@ function Contract( this, abiModel, this.methodController, - this.abiCoder, - this.utils, - this.formatters, - this.accounts, this.promiEventPackage ); - this.events = contractPackageFactory.createEventsSubscriptionsProxy(); + this.events = contractPackageFactory.createEventSubscriptionsProxy( + this, + abiModel, + this.methodController + ); } Contract.prototype.once = function (event, options, callback) { diff --git a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js new file mode 100644 index 00000000000..e099cb757a4 --- /dev/null +++ b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js @@ -0,0 +1,58 @@ +/* + 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 . +*/ +/** + * @file AllEventsLogDecoder.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var EventLogDecoder = require('./EventLogDecoder'); + +/** + * @param {ABIModel} abiModel + * @param {ABICoder} abiCoder + * @param {Object} formatters + * + * @constructor + */ +function AllEventsLogDecoder(abiModel, abiCoder, formatters) { + EventLogDecoder.call(this, abiCoder, formatters); + this.abiModel = abiModel; +} + +/** + * Decodes the event subscription response + * + * @method decoder + * + * @param {ABIItemModel} abiItemModel + * @param {Object} response + * + * @returns {Object} + */ +AllEventsLogDecoder.prototype.decode = function (abiItemModel, response) { + return EventLogDecoder.prototype.decode.call( + this, + this.abiModel.getEventBySignature(response.topics[0]), + response + ); +}; + +AllEventsLogDecoder.prototype = Object.create(EventLogDecoder.prototype); +AllEventsLogDecoder.prototype.constructor = AllEventsLogDecoder; diff --git a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js index 465f9b2de37..32a92da3e57 100644 --- a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js @@ -44,13 +44,6 @@ function EventLogDecoder(abiCoder, formatters) { * @returns {Object} */ EventLogDecoder.prototype.decode = function(abiItemModel, response) { - // // if allEvents get the right event - // if(event.name === 'ALLEVENTS') { - // event = event.jsonInterface.find(function (intf) { - // return (intf.signature === data.topics[0]); - // }) || {anonymous: true}; - // } - var argTopics = response.topics; if (abiItemModel.anonymous) { argTopics = response.topics.slice(1); diff --git a/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js new file mode 100644 index 00000000000..97e7ad7c0f5 --- /dev/null +++ b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js @@ -0,0 +1,59 @@ +/* + 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 . +*/ +/** + * @file AllEventsFilterEncoder.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var EventFilterEncoder = require('./EventFilterEncoder'); + +/** + * @param {ABICoder} abiCoder + * + * @constructor + */ +function AllEventsFilterEncoder(abiCoder) { + EventFilterEncoder.call(this, abiCoder); +} + +/** + * Creates encoded topics from filter option of an event. + * + * @param {ABIModel} abiModel + * @param {*} filter + * + * @returns {Array} + */ +AllEventsFilterEncoder.prototype.encode = function (abiModel, filter) { + var self = this, + events = abiModel.getEvents(), + topics = []; + + Object.keys(events).forEach(function (key) { + topics.push(EventFilterEncoder.prototype.encode.call(self, events[key], filter)); + }); + + return topics; +}; + +AllEventsFilterEncoder.prototype = Object.create(EventFilterEncoder.prototype); +AllEventsFilterEncoder.prototype.constructor = AllEventsFilterEncoder; + +module.exports = AllEventsFilterEncoder; diff --git a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js index fae3dc2faba..6e5557761b8 100644 --- a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js +++ b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js @@ -64,3 +64,5 @@ EventFilterEncoder.prototype.encode = function (abiItemModel, filter) { return topics; }; + +module.exports = EventFilterEncoder; diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index 1cba1c87cf5..8f641b66b10 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -26,11 +26,14 @@ var ABIModel = require('../models/abi/ABIModel'); var ABIItemModel = require('../models/abi/ABIItemModel'); var MethodEncoder = require('../encoders/MethodEncoder'); var EventFilterEncoder = require('../encoders/EventFilterEncoder'); +var AllEventsFilterEncoder = require('../encoders/AllEventsFilterEncoder'); var MethodResponseDecoder = require('../decoders/MethodResponseDecoder'); var EventLogDecoder = require('../decoders/EventLogDecoder'); +var AllEventsLogDecoder = require('../decoders/AllEventsLogDecoder'); var ABIMapper = require('../mappers/ABIMapper'); var RpcMethodOptionsMapper = require('../mappers/RpcMethodOptionsMapper'); var EventOptionsMapper = require('../mappers/EventOptionsMapper'); +var AllEventsOptionsMapper = require('../mappers/AllEventsOptionsMapper'); var MethodsProxy = require('../proxies/MethodsProxy'); var EventSubscriptionsProxy = require('../proxies/EventSubscriptionsProxy'); var RpcMethodOptionsValidator = require('../validators/RpcMethodOptionsValidator'); @@ -100,6 +103,17 @@ ContractPackageFactory.prototype.createEventFilterEncoder = function () { return new EventFilterEncoder(this.abiCoder) }; +/** + * Returns an object of AllEventsFilterEncoder + * + * @method createAllEventsFilterEncoder + * + * @returns {AllEventsFilterEncoder} + */ +ContractPackageFactory.prototype.createAllEventsFilterEncoder = function () { + return new AllEventsFilterEncoder(this.abiCoder) +}; + /** * Returns an object of ABIMapper * @@ -125,12 +139,24 @@ ContractPackageFactory.prototype.createMethodResponseDecoder = function () { /** * Returns an object of EventLogDecoder * - * @method EventLogDecoder + * @method createEventLogDecoder * * @returns {EventLogDecoder} */ ContractPackageFactory.prototype.createEventLogDecoder = function () { - return new EventLogDecoder(); + return new EventLogDecoder(this.abiCoder, this.formatters); +}; + + +/** + * Returns an object of AllEventsLogDecoder + * + * @method createAllEventsLogDecoder + * + * @returns {AllEventsLogDecoder} + */ +ContractPackageFactory.prototype.createAllEventsLogDecoder = function () { + return new AllEventsLogDecoder(this.abiCoder, this.formatters); }; /** @@ -166,6 +192,17 @@ ContractPackageFactory.prototype.createEventOptionsMapper = function () { return new EventOptionsMapper(this.formatters, this.createEventFilterEncoder()); }; +/** + * Returns an object of AllEventsOptionsMapper + * + * @method createAllEventsOptionsMapper + * + * @returns {AllEventsOptionsMapper} + */ +ContractPackageFactory.prototype.createAllEventsOptionsMapper = function () { + return new AllEventsOptionsMapper(this.formatters, this.createAllEventsFilterEncoder()); +}; + /** * Returns an object of RpcMethodModelFactory * @@ -218,26 +255,24 @@ ContractPackageFactory.prototype.createMethodsProxy = function ( * @method createEventSubscriptionsProxy * * @param {Contract} contract - * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {ABIModel} abiModel * @param {MethodController} methodController * * @returns {EventSubscriptionsProxy} */ ContractPackageFactory.prototype.createEventSubscriptionsProxy = function ( contract, - getPastLogsMethodModel, + abiModel, methodController ) { new EventSubscriptionsProxy( contract, abiModel, - this.createEventSubscriptionFactory( - this.utils, - this.formatters, - getPastLogsMethodModel, - methodController - ), - this.createEventOptionsMapper() + this.createEventSubscriptionFactory(methodController), + this.createEventOptionsMapper(), + this.createEventLogDecoder(), + this.createAllEventsLogDecoder(), + this.createAllEventsOptionsMapper() ); }; @@ -246,18 +281,15 @@ ContractPackageFactory.prototype.createEventSubscriptionsProxy = function ( * * @method createEventSubscriptionFactory * - * @param {GetPastLogsMethodModel} getPastLogsMethodModel * @param {MethodController} methodController * * @returns {EventSubscriptionFactory} */ -ContractPackageFactory.prototype.createEventSubscriptionFactory = function (getPastLogsMethodModel, methodController) { +ContractPackageFactory.prototype.createEventSubscriptionFactory = function (methodController) { new EventSubscriptionFactory( this.utils, this.formatters, - getPastLogsMethodModel, - methodController, - this.createEventLogDecoder() + methodController ); }; diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js index e65a456e35b..434e3d343bd 100644 --- a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js @@ -23,42 +23,63 @@ "use strict"; var Subscription = require('web3-core-subscription').Subscription; +var GetPastLogsMethodModel = require('web3-core-method').GetPastLogsMethodModel; var EventLogSubscription = require('../models/subscriptions/EventLogSubscription'); +var AllEventsLogSubscription = require('../models/subscriptions/AllEventsLogSubscription'); /** * @param {Utils} utils * @param {Object} formatters - * @param {GetPastLogsMethodModel} getPastLogsMethodModel * @param {MethodController} methodController - * @param {EventLogDecoder} eventLogDecoder * * @constructor */ -function EventSubscriptionFactory(utils, formatters, getPastLogsMethodModel, methodController, eventLogDecoder) { - this.getPastLogsMethodModel = getPastLogsMethodModel; +function EventSubscriptionFactory(utils, formatters, methodController) { this.methodController = methodController; - this.eventLogDecoder = eventLogDecoder; } /** * Returns an event log subscription * + * @param {EventLogDecoder} eventLogDecoder * @param {ABIItemModel} abiItemModel * @param {AbstractWeb3Object} web3Package * @param {Object} options * * @returns {Subscription} */ -EventSubscriptionFactory.prototype.createEventLogSubscription = function (abiItemModel, web3Package, options) { +EventSubscriptionFactory.prototype.createEventLogSubscription = function (eventLogDecoder, abiItemModel, web3Package, options) { return new Subscription(web3Package, new EventLogSubscription( abiItemModel, options, this.utils, this.formatters, - this.getPastLogsMethodModel, + new GetPastLogsMethodModel(this.utils, this.formatters), + this.methodController, + eventLogDecoder + ) + ); +}; + +/** + * Returns an log subscription for all events + * + * @param {AllEventsLogDecoder} allEventsLogDecoder + * @param {AbstractWeb3Object} web3Package + * @param {Object} options + * + * @returns {Subscription} + */ +EventSubscriptionFactory.prototype.createAllEventLogSubscription = function (allEventsLogDecoder, web3Package, options) { + return new Subscription(web3Package, + new AllEventsLogSubscription( + options, + this.utils, + this.formatters, + new GetPastLogsMethodModel(this.utils, this.formatters), this.methodController, - this.eventLogDecoder + allEventsLogDecoder ) ); }; diff --git a/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js b/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js new file mode 100644 index 00000000000..bd0e7c7dd8b --- /dev/null +++ b/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js @@ -0,0 +1,65 @@ +/* + 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 . +*/ +/** + * @file AllEventsOptionsMapper.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {Object} formatters + * @param {AllEventsFilterEncoder} allEventsFilterEncoder + * + * @constructor + */ +function AllEventsOptionsMapper(formatters, allEventsFilterEncoder) { + this.formatters = formatters; + this.allEventsFilterEncoder = allEventsFilterEncoder; +} + +/** + * @param {ABIModel} abiModel + * @param {Contract} contract + * @param {Object} options + * + * @returns {Object} + */ +AllEventsOptionsMapper.prototype.map = function (abiModel, contract, options) { + options.topics = []; + + if (typeof options.fromBlock !== 'undefined') { + options.fromBlock = this.formatters.inputBlockNumberFormatter(options.fromBlock); + } + + if (typeof options.toBlock !== 'undefined') { + options.toBlock = this.formatters.inputBlockNumberFormatter(options.toBlock); + } + + if (typeof options.filters !== 'undefined') { + options.topics.concat(this.allEventsFilterEncoder.encode(abiModel, options.filter)); + } + + if (!options.address) { + options.address = contract.options.address; + } + + return options; +}; + +module.exports = AllEventsOptionsMapper; diff --git a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js index 04bb0acaccb..7ae894e407a 100644 --- a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js @@ -40,8 +40,10 @@ function EventOptionsMapper(formatters, eventFilterEncoder) { * * @returns {Object} */ -EventOptionsMapper.prototype.map = function(abiItemModel, contract, options) { - var topics = []; +EventOptionsMapper.prototype.map = function (abiItemModel, contract, options) { + if (typeof options.topics === 'undefined') { + options.topics = []; + } if (typeof options.fromBlock !== 'undefined') { options.fromBlock = this.formatters.inputBlockNumberFormatter(options.fromBlock); @@ -51,15 +53,17 @@ EventOptionsMapper.prototype.map = function(abiItemModel, contract, options) { options.toBlock = this.formatters.inputBlockNumberFormatter(options.toBlock); } - if (!event.anonymous) { - topics.push(event.signature); + if (!abiItemModel.anonymous) { + options.topics.unshift(abiItemModel.signature); } - if (typeof options.filter !== 'undefined') { - topics.concat(this.eventFilterEncoder.encode(abiItemModel, options.filter)); + if (typeof options.filters !== 'undefined') { + options.topics.concat(this.eventFilterEncoder.encode(abiItemModel, options.filter)); } - options.address = contract.options.address; + if (!options.address) { + options.address = contract.options.address; + } return options; }; diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index 1cadf662b57..2509dc6fb8a 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -33,7 +33,7 @@ function ABIItemModel(abiItem) { this.abiItem = abiItem; this.signature = this.abiItem.signature; this.name = this.abiItem.name; - this.anonymous = this.abitItem.anonymous; + this.anonymous = this.abiItem.anonymous; this.contractMethodParameters = []; Object.defineProperty(this, 'requestType', { @@ -64,6 +64,23 @@ ABIItemModel.prototype.getInputLength = function () { return 0; }; +/** + * Returns all inputs of the abi item + * + * @method getInputs + * + * @returns {Array} + */ +ABIItemModel.prototype.getInputs = function () { + var inputs = []; + + if (_.isArray(this.abiItem.inputs)) { + inputs = this.abiItem.inputs; + } + + return inputs; +}; + /** * Checks if the given parameter array length matches the abiItem inputs length * @@ -85,20 +102,14 @@ ABIItemModel.prototype.givenParametersLengthIsValid = function () { }; /** - * Returns all inputs of the abi item - * - * @method getInputs + * Returns the indexed input of this abiItem * * @returns {Array} */ -ABIItemModel.prototype.getInputs = function () { - var inputs = []; - - if (_.isArray(this.abiItem.inputs)) { - inputs = this.abiItem.inputs; - } - - return inputs; +ABIItemModel.prototype.getIndexedInputs = function () { + return this.getInputs().filter(function (input) { + return input.indexed === true; + }); }; /** diff --git a/packages/web3-eth-contract/src/models/abi/ABIModel.js b/packages/web3-eth-contract/src/models/abi/ABIModel.js index f19a14616d1..2913a87d0a0 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIModel.js @@ -67,6 +67,32 @@ ABIModel.prototype.getEvent = function (name) { return false; }; +/** + * Returns all events from this ABIModel + * + * @method getEvents + * + * @returns {Object} + */ +ABIModel.prototype.getEvents = function () { + return this.abi.events; +}; + +/** + * Returns an event by his signature + * + * @method getEventBySignature + * + * @param {String} signature + * + * @returns {Object} + */ +ABIModel.prototype.getEventBySignature = function (signature) { + return this.abi.events.find(function (event) { + return event.signature === signature; + }); +}; + /** * Checks if the method exists * @@ -101,9 +127,9 @@ ABIModel.prototype.hasEvent = function (name) { * @returns {ABIItemModel} */ ABIModel.prototype.getConstructor = function () { - return this.abi.methods.find(function (abiItemModel) { - return !_.isArray(abiItemModel) && abiItemModel.name && abiItemModel.name === 'constructor'; - }) + return this.abi.methods.find(function (abiItemModel) { + return !_.isArray(abiItemModel) && abiItemModel.name && abiItemModel.name === 'constructor'; + }) }; module.exports = ABIModel; diff --git a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js new file mode 100644 index 00000000000..390c598a436 --- /dev/null +++ b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js @@ -0,0 +1,66 @@ +/* + 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 . +*/ +/** + * @file AllEventsLogSubscription.js + * @authors: Samuel Furter + * @date 2018 + */ + +"use strict"; + +var LogSubscriptionModel = require('web3-core-subscription').LogSubscriptionModel; + +/** + * @param {Object} options + * @param {Utils} utils + * @param {Object} formatters + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * @param {EventLogDecoder} allEventsLogDecoder + * + * @constructor + */ +function AllEventsLogSubscription( + options, + utils, + formatters, + getPastLogsMethodModel, + methodController, + allEventsLogDecoder +) { + LogSubscriptionModel.call(this, options, utils, formatters, getPastLogsMethodModel, methodController); + this.allEventsLogDecoder = allEventsLogDecoder; +} + +/** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {Object} + */ +AllEventsLogSubscription.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { + return this.allEventsLogDecoder.decode(null, this.formatters.outputLogFormatter(subscriptionItem)); +}; + +AllEventsLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); +AllEventsLogSubscription.prototye.constructor = AllEventsLogSubscription; + +module.exports = AllEventsLogSubscription; diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index c1f263767ce..7bea7f9a372 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -27,14 +27,28 @@ * @param {ABIModel} abiModel * @param {EventSubscriptionFactory} eventSubscriptionFactory * @param {EventOptionsMapper} eventOptionsMapper + * @param {EventLogDecoder} eventLogDecoder + * @param {AllEventsLogDecoder} allEventsLogDecoder + * @param {AllEventsOptionsMapper} allEventsOptionsMapper * * @constructor */ -function EventSubscriptionsProxy(contract, abiModel, eventSubscriptionFactory, eventOptionsMapper) { +function EventSubscriptionsProxy( + contract, + abiModel, + eventSubscriptionFactory, + eventOptionsMapper, + eventLogDecoder, + allEventsLogDecoder, + allEventsOptionsMapper, +) { this.contract = contract; this.eventSubscriptionFactory = eventSubscriptionFactory; this.abiModel = abiModel; this.eventOptionsMapper = eventOptionsMapper; + this.eventLogDecoder = eventLogDecoder; + this.allEventsLogDecoder = allEventsLogDecoder; + this.allEventsOptionsMapper = allEventsOptionsMapper; return new Proxy(this, { get: this.proxyHandler @@ -46,7 +60,7 @@ function EventSubscriptionsProxy(contract, abiModel, eventSubscriptionFactory, e * * @method proxyHandler * - * @param {Object} target + * @param {EventSubscriptionsProxy} target * @param {String} name * * @returns {Function|Error} @@ -54,13 +68,13 @@ function EventSubscriptionsProxy(contract, abiModel, eventSubscriptionFactory, e EventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { if (this.abiModel.hasEvent(name)) { return function (options, callback) { - return target.subscribe(target.abiModel.getEvent(name), target, options, callback); + return target.subscribe(target.abiModel.getEvent(name), options, callback); } } if (name === 'allEvents') { return function (options, callback) { - return target.subscribeAll(options, target, callback); + return target.subscribeAll(options, callback); } } @@ -75,21 +89,49 @@ EventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { * Returns an subscription on the given event * * @param {ABIItemModel} abiItemModel - * @param {EventSubscriptionsProxy} target * @param {Object} options * @param {Function} callback * - * @returns {Subscription} + * @returns {Subscription|EventEmitter} */ -EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, target, options, callback) { - if (options.filters && options.topics) { - this.handleValidationError(new Error('Please set only topics or filters but not both.'), callback); +EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, options, callback) { + if (typeof options.filters !== 'undefined' && typeof options.topics !== 'undefined') { + return this.handleValidationError( + 'Invalid subscription options: Only filter or topics are allowed and not both', + callback + ); } return this.eventSubscriptionFactory.createEventLogSubscription( + this.eventLogDecoder, abiItemModel, - target.contract, - target.eventOptionsMapper.map(abiItemModel, target.contract, options) + this.contract, + this.eventOptionsMapper.map(abiItemModel, this.contract, options) + ).subscribe(callback); +}; + +/** + * Returns an subscription for all contract events + * + * @method subscribeAll + * + * @param {Object} options + * @param {Function} callback + * + * @returns {Subscription|EventEmitter} + */ +EventSubscriptionsProxy.prototype.subscribeAll = function (options, callback) { + if (typeof options.topics !== 'undefined') { + return this.handleValidationError( + 'Invalid subscription options: Topics are not allowed for the "allEvents" subscription', + callback + ); + } + + return this.eventSubscriptionFactory.createAllEventLogSubscription( + this.allEventsLogDecoder, + this.contract, + this.allEventsOptionsMapper.map(this.abiModel, this.contract, options) ).subscribe(callback); }; @@ -98,15 +140,15 @@ EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, target, op * * @method handleValidationError * - * @param {Error} error + * @param {String} errorMessage * @param {Function} callback * * @callback callback callback(error, result) * @returns {EventEmitter} */ -EventSubscriptionsProxy.prototype.handleValidationError = function (error, callback) { +EventSubscriptionsProxy.prototype.handleValidationError = function (errorMessage, callback) { var promiEvent = this.promiEventPackage.createPromiEvent(); - promiEvent.eventEmitter.emit('error', error); + promiEvent.eventEmitter.emit('error', new Error(errorMessage)); if (_.isFunction(callback)) { callback(error, null); diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 6745a45cdb6..54e6dfb54e8 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -69,7 +69,7 @@ function MethodsProxy( * @returns {Function|Error} */ MethodsProxy.prototype.proxyHandler = function (target, name) { - var abiItemModel = target.abiModel.getMethod(name); + var abiItemModel = this.abiModel.getMethod(name); if (abiItemModel) { var anonymousFunction = function () { @@ -77,17 +77,17 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { }; anonymousFunction[abiItemModel.requestType] = function () { - return target.executeMethod(abiItemModel, target, arguments); + return target.executeMethod(abiItemModel, arguments); }; anonymousFunction[abiItemModel.requestType].request = function () { - return target.createRpcMethod(abiItemModel, target, arguments); + return target.createRpcMethodModel(abiItemModel, arguments); }; anonymousFunction.estimateGas = function () { abiItemModel.requestType = 'estimate'; - return target.executeMethod(abiItemModel, target, arguments); + return target.executeMethod(abiItemModel, arguments); }; anonymousFunction.encodeAbi = function () { @@ -96,7 +96,7 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { } if (target[name]) { - return target[name]; + return this[name]; } throw Error('Method with name "' + name + '" not found'); @@ -106,23 +106,22 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { * Executes the RPC method with the methodController * * @param {ABIItemModel} abiItemModel - * @param {MethodsProxy} target * @param {IArguments} methodArguments * * @returns {Promise|PromiEvent|String|Boolean} */ -MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArguments) { - var rpcMethodModel = target.createRpcMethodModel(abiItemModel, target, methodArguments); +MethodsProxy.prototype.executeMethod = function (abiItemModel, methodArguments) { + var rpcMethodModel = this.createRpcMethodModel(abiItemModel, methodArguments); if (typeof rpcMethodModel.error !== 'undefined') { - return target.handleValidationError(rpcMethodModel.error, rpcMethodModel.callback); + return this.handleValidationError(rpcMethodModel.error, rpcMethodModel.callback); } - return target.methodController.execute( + return this.methodController.execute( rpcMethodModel, - target.contract.currentProvider, - target.contract.accounts, - target.contract + this.contract.currentProvider, + this.contract.accounts, + this.contract ); }; @@ -130,13 +129,13 @@ MethodsProxy.prototype.executeMethod = function (abiItemModel, target, methodArg * Creates the rpc method, encodes the contract method and validate the objects. * * @param {ABIItemModel|Array} abiItemModel - * @param {MethodsProxy} target * @param {IArguments} methodArguments * * @returns {AbstractMethodModel|Object} */ -MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, methodArguments) { - var rpcMethodModel; +MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, methodArguments) { + var rpcMethodModel, + self = this; // If it is an array than check which AbiItemModel should be used. // This will be used if two methods with the same name exists but with different arguments. @@ -146,7 +145,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, me // Check if one of the AbiItemModel in this array does match the arguments length abiItemModel.some(function(method) { // Get correct rpc method model - rpcMethodModel = target.rpcMethodFactory.createRpcMethod(method); + rpcMethodModel = self.rpcMethodModelFactory.createRpcMethod(method); rpcMethodModel.methodArguments = methodArguments; isContractMethodParametersLengthValid = abiItemModel.givenParametersLengthIsValid(); @@ -162,7 +161,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, me } } else { // Get correct rpc method model - rpcMethodModel = target.rpcMethodModelFactory.createRpcMethod(abiItemModel); + rpcMethodModel = this.rpcMethodModelFactory.createRpcMethod(abiItemModel); rpcMethodModel.methodArguments = methodArguments; } @@ -177,7 +176,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, me } // Encode contract method and check if there was an error - var encodedContractMethod = target.methodEncoder.encode(abiItemModel, target.contract.options.data); + var encodedContractMethod = this.methodEncoder.encode(abiItemModel, this.contract.options.data); if (encodedContractMethod instanceof Error) { return { error: encodedContractMethod, @@ -189,10 +188,10 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, target, me rpcMethodModel.parameters[0]['data'] = encodedContractMethod; // Set default options in the TxObject if required - rpcMethodModel.parameters = target.rpcMethodOptionsMapper.map(target.contract.options, rpcMethodModel.parameters[0]); + rpcMethodModel.parameters = this.rpcMethodOptionsMapper.map(this.contract.options, rpcMethodModel.parameters[0]); // Validate TxObject - var rpcMethodOptionsValidationResult = target.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethodModel); + var rpcMethodOptionsValidationResult = this.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethodModel); if (rpcMethodOptionsValidationResult instanceof Error) { return { error: rpcMethodOptionsValidationResult, From b85271fa86caeccbc0a93a7206c236770d4ac177 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 3 Oct 2018 13:52:44 +0200 Subject: [PATCH 0175/1045] smaller fixes and code style improvements --- .../lib/commands/AbstractSendMethodCommand.js | 9 ++-- .../factories/AbstractMethodModelFactory.js | 16 ++++++ .../lib/models/AbstractMethodModel.js | 5 +- .../lib/signers/AbstractSigner.js | 4 +- .../src/commands/CallMethodCommand.js | 6 +-- .../src/commands/SendMethodCommand.js | 9 ++-- .../src/commands/SignAndSendMethodCommand.js | 8 +-- .../src/controllers/MethodController.js | 10 ++-- .../src/factories/MethodPackageFactory.js | 36 +++++++------ packages/web3-core-method/src/index.js | 5 +- .../models/TransactionConfirmationModel.js | 4 +- .../src/signers/MessageSigner.js | 1 - .../src/signers/TransactionSigner.js | 3 +- .../validators/TransactionReceiptValidator.js | 6 +-- .../src/watchers/NewHeadsWatcher.js | 42 +++++++-------- .../TransactionConfirmationWorkflow.js | 8 +-- .../src/AbstractWeb3Object.js | 9 ++-- packages/web3-core-package/src/index.js | 1 + .../lib/adapters/AbstractProviderAdapter.js | 1 - .../src/adapters/HttpProviderAdapter.js | 2 +- .../src/adapters/InpageProviderAdapter.js | 2 +- .../src/adapters/SocketProviderAdapter.js | 5 +- .../src/detectors/ProviderDetector.js | 14 +++-- .../src/factories/ProvidersPackageFactory.js | 18 +++---- packages/web3-core-providers/src/index.js | 5 ++ .../src/mappers/JSONRpcMapper.js | 5 +- .../src/providers/HttpProvider.js | 1 - .../src/Subscription.js | 1 - packages/web3-eth-abi/src/ABICoder.js | 53 ++++++++++++++----- packages/web3-eth-contract/src/Contract.js | 37 +++++++++++-- .../src/mappers/ABIMapper.js | 32 ++++++----- .../src/mappers/RpcMethodOptionsMapper.js | 12 ++--- .../src/proxies/MethodsProxy.js | 3 +- packages/web3-eth-iban/src/Iban.js | 31 ++++++++--- packages/web3-eth-personal/src/Personal.js | 1 + packages/web3-eth/src/Eth.js | 4 +- .../src/factories/MethodModelFactory.js | 9 ++++ packages/web3-eth/src/index.js | 6 +-- packages/web3-net/src/Network.js | 1 - .../src/factories/MethodModelFactory.js | 2 +- 40 files changed, 262 insertions(+), 165 deletions(-) diff --git a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js index e0c7964da91..2e005dc9652 100644 --- a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js +++ b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js @@ -33,25 +33,26 @@ function AbstractSendMethodCommand(transactionConfirmationWorkflow) { /** + * TODO: Add gasPrice check * Sends the JSON-RPC request * * @method send * * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {AbstractWeb3Object} web3Package * @param {PromiEvent} promiEvent * * @callback callback callback(error, result) * @returns {PromiEvent} */ -AbstractSendMethodCommand.prototype.send = function (methodModel, provider, promiEvent) { - provider.send( +AbstractSendMethodCommand.prototype.send = function (methodModel, promiEvent, web3Package) { + web3Package.currentProvider.send( methodModel.rpcMethod, methodModel.parameters ).then(function (response) { self.transactionConfirmationWorkflow.execute( methodModel, - provider, + web3Package, response, promiEvent ); diff --git a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js index 7144f3a6809..0cc814ad8af 100644 --- a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js +++ b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js @@ -35,10 +35,26 @@ function AbstractMethodModelFactory(methodModels, utils, formatters) { this.methodModels = methodModels; } +/** + * Checks if the method exists + * + * @method hasMethodModel + * + * @param {String} name + * + * @returns {Boolean} + */ AbstractMethodModelFactory.prototype.hasMethodModel = function (name) { return typeof this.methodModels[name] !== 'undefined'; }; +/** + * Returns an MethodModel + * + * @param {String} name + * + * @returns {AbstractMethodModel} + */ AbstractMethodModelFactory.prototype.createMethodModel = function (name) { return new this.methodModels[name](this.utils, this.formatters); }; diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index f2d957535f2..5875c5d218b 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -81,7 +81,7 @@ AbstractMethodModel.prototype.afterExecution = function(response) { * * @method request * - * @returns {Object} + * @returns {AbstractMethodModel} */ AbstractMethodModel.prototype.request = function () { this.methodArguments = arguments; @@ -92,6 +92,8 @@ AbstractMethodModel.prototype.request = function () { /** * Splits the parameters and the callback function and returns it as object * + * @method mapFunctionArguments + * * @param {Array} args * * @returns {Object} @@ -168,5 +170,4 @@ AbstractMethodModel.prototype.isHash = function (parameter) { return _.isString(parameter) && parameter.indexOf('0x') === 0; }; - module.exports = AbstractMethodModel; diff --git a/packages/web3-core-method/lib/signers/AbstractSigner.js b/packages/web3-core-method/lib/signers/AbstractSigner.js index 3240fa33105..ed1182cc3f9 100644 --- a/packages/web3-core-method/lib/signers/AbstractSigner.js +++ b/packages/web3-core-method/lib/signers/AbstractSigner.js @@ -32,10 +32,10 @@ function AbstractSigner() { } /** * Get wallet for address with accounts package * - * @param {any} from + * @param {*} from * @param {Accounts} accounts * - * @returns {any} + * @returns {*} */ AbstractSigner.prototype.getWallet = function (from, accounts) { // is index given diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 74b599fd78e..5251a778bb3 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -34,16 +34,14 @@ function CallMethodCommand() { } * * @param {AbstractWeb3Object} web3Package * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter | EthereumProvider} provider * * @callback callback callback(error, result) * @returns {Promise} */ -CallMethodCommand.prototype.execute = function (web3Package, methodModel, provider) { - +CallMethodCommand.prototype.execute = function (web3Package, methodModel) { methodModel.beforeExecution(web3Package); - return provider.send( + return web3Package.currentProvider.send( methodModel.rpcMethod, methodModel.parameters ).then(function (response) { diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index a69377548a9..11351f434bf 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -40,27 +40,26 @@ function SendMethodCommand(transactionConfirmationWorkflow) { * * @param {AbstractWeb3Object} web3Package * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {PromiEvent} promiEvent * * @callback callback callback(error, result) * @returns {PromiEvent} */ -SendMethodCommand.prototype.execute = function (web3Package, methodModel, provider, promiEvent) { +SendMethodCommand.prototype.execute = function (web3Package, methodModel, promiEvent) { var self = this; methodModel.beforeExecution(web3Package); if (this.isGasPriceDefined(methodModel.parameters)) { - return this.send(methodModel, provider, promiEvent); + return this.send(methodModel, promiEvent, web3Package); } - this.getGasPrice(provider).then(function(gasPrice) { + this.getGasPrice(web3Package.currentProvider).then(function(gasPrice) { if (_.isObject(methodModel.parameters[0])) { methodModel.parameters[0].gasPrice = gasPrice; } - self.send(methodModel, provider, promiEvent); + self.send(methodModel, promiEvent, web3Package); }); return promiEvent; diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index 198289ffcee..4495f7d8c71 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -36,15 +36,12 @@ function SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSi } /** - * TODO: Add gasPrice check - * * Sends the JSON-RPC request and returns an PromiEvent object * * @method execute * * @param {AbstractWeb3Object} web3Package * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {Accounts} accounts * @param {PromiEvent} promiEvent * @@ -52,9 +49,8 @@ function SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSi * @returns {PromiEvent} */ SignAndSendMethodCommand.prototype.execute = function ( - web3Package, methodModel, - provider, + web3Package, accounts, promiEvent, ) { @@ -63,7 +59,7 @@ SignAndSendMethodCommand.prototype.execute = function ( this.transactionSigner.sign(methodModel.parameters[0], accounts).then(function(response) { methodModel.parameters = [response.rawTransaction]; - self.send(methodModel, provider, promiEvent); + self.send(methodModel, promiEvent, web3Package); }).catch(function(error) { promiEvent.reject(error); promiEvent.on('error', error); diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index c07673e96e4..43b302b06a4 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -51,13 +51,12 @@ function MethodController( * @method execute * * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {Accounts} accounts * @param {AbstractWeb3Object} web3Package * * @returns {Promise|PromiEvent|String|Boolean} */ -MethodController.prototype.execute = function (methodModel, provider, accounts, web3Package) { +MethodController.prototype.execute = function (methodModel, accounts, web3Package) { var promiEvent = this.promiEventPackage.createPromiEvent(); if (this.hasWallets(accounts)) { @@ -71,8 +70,9 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, if (methodModel.isSendTransaction()) { return this.signAndSendMethodCommand.execute( methodModel, - provider, - promiEvent + web3Package, + accounts, + promiEvent, ); } } @@ -81,7 +81,6 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, return this.sendMethodCommand.execute( web3Package, methodModel, - provider, promiEvent ); } @@ -89,7 +88,6 @@ MethodController.prototype.execute = function (methodModel, provider, accounts, return this.callMethodCommand.execute( web3Package, methodModel, - provider ); }; diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index 68424947d21..c381e1d73dc 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -45,20 +45,20 @@ function MethodPackageFactory() { } * @method createMethodController * * @param {PromiEventPackage} promiEventPackage - * @param {SubscriptionPackage} subscriptionPackage + * @param {SubscriptionsFactory} subscriptionsFactory * @param {Object} formatters * * @returns {MethodController} */ MethodPackageFactory.prototype.createMethodController = function ( promiEventPackage, - subscriptionPackage, + subscriptionsFactory, formatters ) { return new MethodController( this.createCallMethodCommand(), - this.createSendMethodCommand(subscriptionPackage, formatters), - this.createSignAndSendMethodCommand(subscriptionPackage, formatters), + this.createSendMethodCommand(subscriptionsFactory, formatters), + this.createSignAndSendMethodCommand(subscriptionsFactory, formatters), this.createSignMessageCommand(), promiEventPackage ); @@ -80,14 +80,14 @@ MethodPackageFactory.prototype.createCallMethodCommand = function () { * * @method createSendMethodCommand * - * @param {SubscriptionPackage} subscriptionPackage + * @param {SubscriptionsFactory} subscriptionsFactory * @param {Object} formatters * * @returns {SendMethodCommand} */ -MethodPackageFactory.prototype.createSendMethodCommand = function (subscriptionPackage, formatters) { +MethodPackageFactory.prototype.createSendMethodCommand = function (subscriptionsFactory, formatters) { return new SendMethodCommand( - this.createTransactionConfirmationWorkflow(subscriptionPackage, formatters) + this.createTransactionConfirmationWorkflow(subscriptionsFactory, formatters) ); }; @@ -96,14 +96,14 @@ MethodPackageFactory.prototype.createSendMethodCommand = function (subscriptionP * * @method createSingAndSendMethodCommand * - * @param {SubscriptionPackage} subscriptionPackage + * @param {SubscriptionsFactory} subscriptionsFactory * @param {Object} formatters * * @returns {SignAndSendMethodCommand} */ -MethodPackageFactory.prototype.createSignAndSendMethodCommand = function (subscriptionPackage, formatters) { +MethodPackageFactory.prototype.createSignAndSendMethodCommand = function (subscriptionsFactory, formatters) { return new SignAndSendMethodCommand( - this.createTransactionConfirmationWorkflow(subscriptionPackage, formatters), + this.createTransactionConfirmationWorkflow(subscriptionsFactory, formatters), this.createTransactionSigner() ); }; @@ -126,16 +126,16 @@ MethodPackageFactory.prototype.createSignMessageCommand = function () { * * @method createTransactionConfirmationWorkflow * - * @param {SubscriptionPackage} subscriptionPackage + * @param {SubscriptionsFactory} subscriptionsFactory * @param {Object} formatters * * @returns {TransactionConfirmationWorkflow} */ -MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (subscriptionPackage, formatters) { +MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (subscriptionsFactory, formatters) { new TransactionConfirmationWorkflow( this.createTransactionConfirmationModel(), this.createTransactionReceiptValidator(), - this.createNewHeadsWatcher(subscriptionPackage), + this.createNewHeadsWatcher(subscriptionsFactory), formatters ); }; @@ -176,6 +176,8 @@ MethodPackageFactory.prototype.createTransactionConfirmationModel = function () /** * Returns the TransactionReceiptValidator object * + * @method createTransactionReceiptValidator + * * @returns {TransactionReceiptValidator} */ MethodPackageFactory.prototype.createTransactionReceiptValidator = function () { @@ -185,10 +187,12 @@ MethodPackageFactory.prototype.createTransactionReceiptValidator = function () { /** * Returns the NewHeadsWatcher object * - * @param {SubscriptionPackage} subscriptionPackage + * @method createNewHeadsWatcher + * + * @param {SubscriptionsFactory} subscriptionsFactory * * @returns {NewHeadsWatcher} */ -MethodPackageFactory.prototype.createNewHeadsWatcher = function (subscriptionPackage) { - return new NewHeadsWatcher(subscriptionPackage); +MethodPackageFactory.prototype.createNewHeadsWatcher = function (subscriptionsFactory) { + return new NewHeadsWatcher(subscriptionsFactory); }; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 3bf9692f2c2..46e98347b51 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -27,7 +27,8 @@ var version = require('./package.json'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); var PromiEventPackage = require('web3-core-promievent'); -var SubscriptionPackage = require('web3-core-subscription'); +var SubscriptionsFactory = require('web3-core-subscription').SubscriptionsFactory; +var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; // Methods @@ -123,7 +124,7 @@ module.exports = { createMethodController: function () { return new MethodPackageFactory().createMethodController( PromiEventPackage, - SubscriptionPackage, + new SubscriptionsFactory(Utils, formatters), formatters ); }, diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index 78f036f719d..5de6bcae976 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -94,7 +94,7 @@ TransactionConfirmationModel.prototype.addConfirmation = function (receipt) { * * @method isConfirmed * - * @returns {boolean} + * @returns {Boolean} */ TransactionConfirmationModel.prototype.isConfirmed = function () { return this.confirmationsCount === (this.CONFIRMATIONBLOCKS + 1); @@ -105,7 +105,7 @@ TransactionConfirmationModel.prototype.isConfirmed = function () { * * @method isTimeoutTimeExceeded * - * @returns {boolean} + * @returns {Boolean} */ TransactionConfirmationModel.prototype.isTimeoutTimeExceeded = function (watcherIsPolling) { if (watcherIsPolling) { diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 584b53811c0..c75562891cf 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -49,7 +49,6 @@ MessageSigner.prototype.sign = function(data, address, accounts) { throw new Error('Wallet or privateKey in wallet is not set!'); }; -// Inherit from AbstractSigner MessageSigner.prototype = Object.create(AbstractSigner.prototype); MessageSigner.prototype.constructor = MessageSigner; diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index ea3221cc930..1ae4b123f58 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -34,7 +34,7 @@ function TransactionSigner() { } * @param {Object} transaction * @param {Accounts} accounts * - * @returns {Promise} + * @returns {Promise} */ TransactionSigner.prototype.sign = function (transaction, accounts) { var wallet = this.getWallet(transaction.from, accounts); @@ -54,7 +54,6 @@ TransactionSigner.prototype.sign = function (transaction, accounts) { }); }; -// Inherit from AbstractSigner TransactionSigner.prototype = Object.create(AbstractSigner.prototype); TransactionSigner.prototype.constructor = TransactionSigner; diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index d97732c0317..51b5ab87283 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -35,7 +35,7 @@ function TransactionReceiptValidator() { } * @param {Object} receipt * @param {Array} methodParameters * - * @returns {Error | boolean} + * @returns {Error|Boolean} */ TransactionReceiptValidator.prototype.validate = function (receipt, methodParameters) { if (this.isValidGasUsage(receipt, methodParameters) && this.isValidReceiptStatus(receipt)) { @@ -58,7 +58,7 @@ TransactionReceiptValidator.prototype.validate = function (receipt, methodParame * * @param {Object} receipt * - * @returns {boolean} + * @returns {Boolean} */ TransactionReceiptValidator.prototype.isValidReceiptStatus = function (receipt) { return receipt.status === true || receipt.status === '0x1' || typeof receipt.status === 'undefined' @@ -72,7 +72,7 @@ TransactionReceiptValidator.prototype.isValidReceiptStatus = function (receipt) * @param {Object} receipt * @param {Array} methodParameters * - * @returns {boolean} + * @returns {Boolean} */ TransactionReceiptValidator.prototype.isValidGasUsage = function (receipt, methodParameters) { var gasProvided = null; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 39a5b82d51e..9ab96f1513b 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -20,13 +20,15 @@ * @date 2018 */ +var SocketProviderAdapter = require('web3-core-providers').SocketProviderAdapter; + /** - * @param {SubscriptionPackage} subscriptionPackage + * @param {SubscriptionsFactory} subscriptionsFactory * * @constructor */ -function NewHeadsWatcher(subscriptionPackage) { - this.subscriptionPackage = subscriptionPackage; +function NewHeadsWatcher(subscriptionsFactory) { + this.subscriptionsFactory = subscriptionsFactory; this.confirmationInterval = null; this.confirmationSubscription = null; this.isPolling = false; @@ -37,29 +39,26 @@ function NewHeadsWatcher(subscriptionPackage) { * * @method watch * - * @param {AbstractProviderAdapter | EthereumProvider} provider - * @param {String} transactionHash + * @param {AbstractWeb3Object} web3Package * * @returns {this} */ -NewHeadsWatcher.prototype.watch = function (provider, transactionHash) { +NewHeadsWatcher.prototype.watch = function (web3Package) { var self = this; - try { - this.confirmationSubscription = this.subscriptionPackage.create( - provider, - 'newHeads', - transactionHash, - null, - null - ).subscribe(function () { - self.emit('newHead'); - }); - } catch (error) { - this.isPolling = true; - this.confirmationInterval = setInterval(this.emit('newHead'), 1000); + if (web3Package.currentProvider instanceof SocketProviderAdapter) { + this.confirmationSubscription = this.subscriptionsFactory.createNewHeadsSubscription(web3Package).subscribe( + function () { + self.emit('newHead'); + } + ); + + return this; } + this.isPolling = true; + this.confirmationInterval = setInterval(this.emit('newHead'), 1000); + return this; }; @@ -69,16 +68,15 @@ NewHeadsWatcher.prototype.watch = function (provider, transactionHash) { * @method stop */ NewHeadsWatcher.prototype.stop = function () { - if(this.confirmationSubscription) { + if (this.confirmationSubscription) { this.confirmationSubscription.unsubscribe(); } - if(this.confirmationInterval) { + if (this.confirmationInterval) { clearInterval(this.confirmationInterval); } }; -// Inherit EventEmitter NewHeadsWatcher.prototype = Object.create(EventEmitter.prototype); NewHeadsWatcher.prototype.constructor = NewHeadsWatcher; diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index d377fb5cb79..52f3cdb456b 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -48,15 +48,15 @@ function TransactionConfirmationWorkflow( * @method execute * * @param {AbstractMethodModel} methodModel - * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {AbstractWeb3Object} web3Package * @param {String} transactionHash * @param {Object} promiEvent * * @callback callback callback(error, result) */ -TransactionConfirmationWorkflow.prototype.execute = function (methodModel, provider, transactionHash, promiEvent) { +TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3Package, transactionHash, promiEvent) { var self = this; - this.provider = provider; + this.provider = web3Package.currentProvider; this.getTransactionReceipt(transactionHash).then(function (receipt) { if (receipt && receipt.blockHash) { @@ -72,7 +72,7 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, provi return; } - self.newHeadsWatcher.watch(provider).on('newHead', function () { + self.newHeadsWatcher.watch(web3Package).on('newHead', function () { self.transactionConfirmationModel.timeoutCounter++; if (!self.transactionConfirmationModel.isTimeoutTimeExceeded()) { self.getTransactionReceipt(transactionHash).then(function (receipt) { diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 1a0dcd4ac40..21204b864df 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -23,6 +23,7 @@ "use strict"; /** + * TODO: Split this AbstractWeb3Object in smaller objects and find a better naming for the AbstractWeb3Object * @param {any} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController @@ -48,7 +49,6 @@ function AbstractWeb3Object( this.extendedPackages = []; this.providersPackage = providersPackage; - this.currentProvider = provider; this.givenProvider = this.providersPackage.detect(); this.providers = { @@ -76,6 +76,8 @@ function AbstractWeb3Object( enumerable: true }); + this.currentProvider = provider; + if (this.isDependencyGiven(batchRequestPackage)) { this.BatchRequest = function BatchRequest() { return batchRequestPackage.createBatchRequest(self.currentProvider); @@ -99,7 +101,7 @@ function AbstractWeb3Object( * * @method isDependencyGiven * - * @param {*} object + * @param {Object} object * * @returns {boolean} */ @@ -223,7 +225,7 @@ AbstractWeb3Object.prototype.proxyHandler = function (target, name) { var anonymousFunction = function () { methodModel.methodArguments = arguments; - return target.methodController.execute(methodModel, target.currentProvider, target.accounts, target); + return target.methodController.execute(methodModel, target.accounts, target); }; anonymousFunction.methodModel = methodModel; @@ -235,5 +237,4 @@ AbstractWeb3Object.prototype.proxyHandler = function (target, name) { return target[name]; }; - module.exports = AbstractWeb3Object; diff --git a/packages/web3-core-package/src/index.js b/packages/web3-core-package/src/index.js index a9792570ba8..3301bd86e78 100644 --- a/packages/web3-core-package/src/index.js +++ b/packages/web3-core-package/src/index.js @@ -27,5 +27,6 @@ var AbstractWeb3Object = require('./AbstractWeb3Object'); module.exports = { version: version, + AbstractWeb3Object: AbstractWeb3Object }; diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js index f3220e76398..483a2fde452 100644 --- a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js @@ -112,7 +112,6 @@ AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, er reject(error); }; -// Inherit EventEmitter AbstractProviderAdapter.prototype = Object.create(EventEmitter.prototype); AbstractProviderAdapter.prototype.constructor = AbstractProviderAdapter; diff --git a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js index f8fd9359c60..50ab5e35568 100644 --- a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js @@ -67,7 +67,7 @@ HttpProviderAdapter.prototype.unsubscribe = function () { * * @method isConnected * - * @returns {boolean} + * @returns {Boolean} */ HttpProviderAdapter.prototype.isConnected = function () { return this.provider.connected; diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js index a1eaa923dc0..d6158ba5896 100644 --- a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js @@ -92,7 +92,7 @@ InpageProviderAdapter.prototype.unsubscribe = function () { * * @method isConnected * - * @returns {boolean} + * @returns {Boolean} */ InpageProviderAdapter.prototype.isConnected = function () { return this.provider.isConnected; diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index a70a37422aa..c96a3fcedf2 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -121,8 +121,8 @@ SocketProviderAdapter.prototype.hasSubscription = function (subscriptionId) { * @method clearSubscriptions */ SocketProviderAdapter.prototype.clearSubscriptions = function () { - var self = this; - var unsubscribePromises = []; + var self = this, + unsubscribePromises = []; this.subscriptions.forEach(function (subscriptionId) { unsubscribePromises.push(self.unsubscribe(subscriptionId)); @@ -145,6 +145,7 @@ SocketProviderAdapter.prototype.clearSubscriptions = function () { */ SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId) { var self = this; + return this.unsubscribe(subscriptionId).then(function (result) { if (result) { delete self.subscriptions[this.subscriptions.indexOf(subscriptionId)]; diff --git a/packages/web3-core-providers/src/detectors/ProviderDetector.js b/packages/web3-core-providers/src/detectors/ProviderDetector.js index 390026335da..30631dee478 100644 --- a/packages/web3-core-providers/src/detectors/ProviderDetector.js +++ b/packages/web3-core-providers/src/detectors/ProviderDetector.js @@ -27,6 +27,9 @@ try { global = window; } +/** + * @constructor + */ function ProviderDetector() { } /** @@ -58,10 +61,12 @@ ProviderDetector.prototype.detect = function () { * * @param {Object} currentProvider * - * @returns {boolean} + * @returns {Boolean} */ ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { - return !currentProvider.on && currentProvider.connection && currentProvider.connection.constructor.name === 'ipcProviderWrapper'; + return !currentProvider.on && + currentProvider.connection && + currentProvider.connection.constructor.name === 'ipcProviderWrapper'; }; /** @@ -75,9 +80,9 @@ ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { */ ProviderDetector.prototype.addSubscriptionsToIpcProviderWrapper = function (provider) { provider.on = function (type, callback) { - - if (typeof callback !== 'function') + if (typeof callback !== 'function') { throw new Error('The second parameter callback must be a function.'); + } switch (type) { case 'data': @@ -99,7 +104,6 @@ ProviderDetector.prototype.addSubscriptionsToIpcProviderWrapper = function (prov }); break; - default: this.connection.on(type, callback); break; diff --git a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js index e06f1a317a8..b858e125a80 100644 --- a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js +++ b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js @@ -34,7 +34,7 @@ var HttpProvider = require('../providers/HttpProvider'); function ProvidersPackageFactory() { } /** - * Return ProviderAdapterResolver object + * Returns an ProviderAdapterResolver object * * @method createProviderAdapterResolver * @@ -45,7 +45,7 @@ ProvidersPackageFactory.prototype.createProviderAdapterResolver = function () { }; /** - * Return ProviderDetector object + * Returns an ProviderDetector object * * @method createProviderDetector * @@ -56,7 +56,7 @@ ProvidersPackageFactory.prototype.createProviderDetector = function () { }; /** - * Return HttpProvider object + * Returns an HttpProvider object * * @method createHttpProvider * @@ -69,7 +69,7 @@ ProvidersPackageFactory.prototype.createHttpProvider = function (url) { }; /** - * Return WebsocketProvider object + * Return an WebsocketProvider object * * @method createWebsocketProvider * @@ -82,7 +82,7 @@ ProvidersPackageFactory.prototype.createWebsocketProvider = function (url) { }; /** - * Return IpcProvider object + * Returns an IpcProvider object * * @method createIpcProvider * @@ -96,7 +96,7 @@ ProvidersPackageFactory.prototype.createIpcProvider = function (path, net) { }; /** - * Returns HttpProviderAdapter object + * Returns an HttpProviderAdapter object * * @method createHttpProviderAdapter * @@ -109,11 +109,11 @@ ProvidersPackageFactory.prototype.createHttpProviderAdapter = function (provider }; /** - * Returns SocketProviderAdapter object + * Returns an SocketProviderAdapter object * * @method createSocketProviderAdapter * - * @param {WebsocketProvider | IpcProvider} provider + * @param {WebsocketProvider|IpcProvider} provider * * @returns {SocketProviderAdapter} */ @@ -122,7 +122,7 @@ ProvidersPackageFactory.prototype.createSocketProviderAdapter = function (provid }; /** - * Returns InpageProviderAdapter object + * Returns an InpageProviderAdapter object * * @method createInpageProviderAdapter * diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index 4b4acb01d41..470d556a86c 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -22,6 +22,7 @@ var version = require('./package.json').version; var ProvidersPackageFactory = require('./factories/ProvidersPackageFactory'); +var SocketProviderAdapter = require('./adapters/SocketProviderAdapter'); var HttpProvider = require('./providers/HttpProvider'); var IpcProvider = require('./providers/IpcProvider'); var WebsocketProvider = require('./providers/WebsocketProvider'); @@ -30,9 +31,13 @@ var JSONRpcResponseValidator = require('./validators/JSONRpcResponseValidator'); module.exports = { version: version, + + SocketProviderAdapter: SocketProviderAdapter, + HttpProvider: HttpProvider, IpcProvider: IpcProvider, WebsocketProvider: WebsocketProvider, + JSONRpcMapper: JSONRpcMapper, JSONRpcResponseValidator: JSONRpcResponseValidator, diff --git a/packages/web3-core-providers/src/mappers/JSONRpcMapper.js b/packages/web3-core-providers/src/mappers/JSONRpcMapper.js index a439bcd92d7..842c5199adf 100644 --- a/packages/web3-core-providers/src/mappers/JSONRpcMapper.js +++ b/packages/web3-core-providers/src/mappers/JSONRpcMapper.js @@ -30,7 +30,7 @@ var JSONRpcMapper = { }; /** - * Should be called to valid json create payload object + * Creates a valid json payload object * * @method toPayload * @@ -56,7 +56,7 @@ JSONRpcMapper.toPayload = function (method, params) { }; /** - * Should be called to create batch payload object + * Creates a batch payload object * * @method toBatchPayload * @@ -73,4 +73,3 @@ JSONRpcMapper.toBatchPayload = function (requests) { }; module.exports = JSONRpcMapper; - diff --git a/packages/web3-core-providers/src/providers/HttpProvider.js b/packages/web3-core-providers/src/providers/HttpProvider.js index f7b0d3e9ad8..0321264aa15 100644 --- a/packages/web3-core-providers/src/providers/HttpProvider.js +++ b/packages/web3-core-providers/src/providers/HttpProvider.js @@ -81,7 +81,6 @@ HttpProvider.prototype._prepareRequest = function () { * @method send * * @param {Object} payload - * * @param {Function} callback * * @callback callback callback(error, result) diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index f7cf2cc1080..1aa6a364a06 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -165,6 +165,5 @@ Subscription.prototype.unsubscribe = function (callback) { }); }; -// Inherit from EventEmitter Subscription.prototype = Object.create(EventEmitter.prototype); Subscription.prototype.constructor = Subscription; diff --git a/packages/web3-eth-abi/src/ABICoder.js b/packages/web3-eth-abi/src/ABICoder.js index f8e3f959b8d..3e205f66237 100644 --- a/packages/web3-eth-abi/src/ABICoder.js +++ b/packages/web3-eth-abi/src/ABICoder.js @@ -38,16 +38,19 @@ function Result() { /** * ABICoder prototype should be used to encode/decode solidity params of any type + * + * @constructor */ -var ABICoder = function () { -}; +function ABICoder () { } /** * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. * * @method encodeFunctionSignature + * * @param {String|Object} functionName - * @return {String} encoded function name + * + * @returns {String} encoded function name */ ABICoder.prototype.encodeFunctionSignature = function (functionName) { if (_.isObject(functionName)) { @@ -61,8 +64,10 @@ ABICoder.prototype.encodeFunctionSignature = function (functionName) { * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. * * @method encodeEventSignature + * * @param {String|Object} functionName - * @return {String} encoded function name + * + * @returns {String} encoded function name */ ABICoder.prototype.encodeEventSignature = function (functionName) { if (_.isObject(functionName)) { @@ -76,9 +81,11 @@ ABICoder.prototype.encodeEventSignature = function (functionName) { * Should be used to encode plain param * * @method encodeParameter + * * @param {String} type * @param {Object} param - * @return {String} encoded plain param + * + * @returns {String} encoded plain param */ ABICoder.prototype.encodeParameter = function (type, param) { return this.encodeParameters([type], [param]); @@ -88,9 +95,11 @@ ABICoder.prototype.encodeParameter = function (type, param) { * Should be used to encode list of params * * @method encodeParameters + * * @param {Array} types * @param {Array} params - * @return {String} encoded list of params + * + * @returns {String} encoded list of params */ ABICoder.prototype.encodeParameters = function (types, params) { return ethersAbiCoder.encode(this.mapTypes(types), params); @@ -100,8 +109,10 @@ ABICoder.prototype.encodeParameters = function (types, params) { * Map types if simplified format is used * * @method mapTypes + * * @param {Array} types - * @return {Array} + * + * @returns {Array} */ ABICoder.prototype.mapTypes = function (types) { var self = this; @@ -131,8 +142,10 @@ ABICoder.prototype.mapTypes = function (types) { * Check if type is simplified struct format * * @method isSimplifiedStructFormat + * * @param {String | Object} type - * @returns {boolean} + * + * @returns {Boolean} */ ABICoder.prototype.isSimplifiedStructFormat = function (type) { return typeof type === 'object' && typeof type.components === 'undefined' && typeof type.name === 'undefined'; @@ -142,8 +155,10 @@ ABICoder.prototype.isSimplifiedStructFormat = function (type) { * Maps the correct tuple type and name when the simplified format in encode/decodeParameter is used * * @method mapStructNameAndType + * * @param {String} structName - * @return {{type: string, name: *}} + * + * @returns {{type: string, name: *}} */ ABICoder.prototype.mapStructNameAndType = function (structName) { var type = 'tuple'; @@ -160,8 +175,10 @@ ABICoder.prototype.mapStructNameAndType = function (structName) { * Maps the simplified format in to the expected format of the ABICoder * * @method mapStructToCoderFormat + * * @param {Object} struct - * @return {Array} + * + * @returns {Array} */ ABICoder.prototype.mapStructToCoderFormat = function (struct) { var self = this; @@ -193,9 +210,11 @@ ABICoder.prototype.mapStructToCoderFormat = function (struct) { * Encodes a function call from its json interface and parameters. * * @method encodeFunctionCall + * * @param {Array} jsonInterface * @param {Array} params - * @return {String} The encoded ABI for this function call + * + * @returns {String} The encoded ABI for this function call */ ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface.inputs, params).replace('0x', ''); @@ -205,9 +224,11 @@ ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { * Should be used to decode bytes to plain param * * @method decodeParameter + * * @param {String} type * @param {String} bytes - * @return {Object} plain param + * + * @returns {Object} plain param */ ABICoder.prototype.decodeParameter = function (type, bytes) { return this.decodeParameters([type], bytes)[0]; @@ -217,9 +238,11 @@ ABICoder.prototype.decodeParameter = function (type, bytes) { * Should be used to decode list of params * * @method decodeParameter + * * @param {Array} outputs * @param {String} bytes - * @return {Array} array of plain params + * + * @returns {Array} array of plain params */ ABICoder.prototype.decodeParameters = function (outputs, bytes) { if (!bytes || bytes === '0x' || bytes === '0X') { @@ -250,10 +273,12 @@ ABICoder.prototype.decodeParameters = function (outputs, bytes) { * Decodes events non- and indexed parameters. * * @method decodeLog + * * @param {Object} inputs * @param {String} data * @param {Array} topics - * @return {Array} array of plain params + * + * @returns {Array} array of plain params */ ABICoder.prototype.decodeLog = function (inputs, data, topics) { var _this = this; diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 57d6bf63d54..8245b43f95e 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -92,22 +92,31 @@ function Contract( this.batchRequestPackage ); + this.defaultBlock = 'latest'; + address = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(address)); + var self = this, - _address = self.utils.toChecksumAddress(self.formatters.inputAddressFormatter(address)), - abiModel = abiMapper.map(abi); + abiModel = abiMapper.map(abi), + defaultAccount = null; + /** + * Defines accessors for contract address + */ Object.defineProperty(this.options, 'address', { set: function (value) { if (value) { - _address = self.utils.toChecksumAddress(self.formatters.inputAddressFormatter(value)); + address = self.utils.toChecksumAddress(self.formatters.inputAddressFormatter(value)); } }, get: function () { - return _address; + return address; }, enumerable: true }); + /** + * Defines accessors for jsonInterface + */ Object.defineProperty(this.options, 'jsonInterface', { set: function (value) { abiModel = self.abiMapper.map(value); @@ -120,6 +129,26 @@ function Contract( enumerable: true }); + /** + * Defines accessors for defaultAccount + */ + Object.defineProperty(this, 'defaultAccount', { + get: function () { + if (!defaultAccount) { + return this.options.from; + } + + return defaultAccount; + }, + set: function (val) { + if (val) { + defaultAccount = self.utils.toChecksumAddress(self.formatters.inputAddressFormatter(val)); + } + + }, + enumerable: true + }); + this.methods = contractPackageFactory.createMethodsProxy( this, abiModel, diff --git a/packages/web3-eth-contract/src/mappers/ABIMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js index 36da2cbe27c..670870ce8a2 100644 --- a/packages/web3-eth-contract/src/mappers/ABIMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -44,7 +44,7 @@ function ABIMapper(contractPackageFactory, abiCoder, utils) { */ ABIMapper.prototype.map = function (abi) { var self = this; - var mappedAbiItem = { + var mappedAbiItems = { methods: {}, events: {} }; @@ -66,23 +66,23 @@ ABIMapper.prototype.map = function (abi) { // Check if an method already exists with this name and if it exists than create an array and push this abiItem // into it. This will be used if there are methods with the same name but with different arguments. - if (!mappedAbiItem.methods[abiItem.name]) { - mappedAbiItem.methods[abiItem.name] = abiItemModel; + if (!mappedAbiItems.methods[abiItem.name]) { + mappedAbiItems.methods[abiItem.name] = abiItemModel; } else { - if (_.isArray(mappedAbiItem.methods[abiItem.name])) { - mappedAbiItem.methods[abiItem.name].push(abiItemModel); + if (_.isArray(mappedAbiItems.methods[abiItem.name])) { + mappedAbiItems.methods[abiItem.name].push(abiItemModel); } else { - mappedAbiItem.methods[abiItem.name] = [ - mappedAbiItem.methods[abiItem.name], + mappedAbiItems.methods[abiItem.name] = [ + mappedAbiItems.methods[abiItem.name], abiItemModel ]; } } - mappedAbiItem.methods[abiItem.signature] = abiItemModel; - mappedAbiItem.methods[abiItem.funcName] = abiItemModel; + mappedAbiItems.methods[abiItem.signature] = abiItemModel; + mappedAbiItems.methods[abiItem.funcName] = abiItemModel; - return abiItem; + return; } if (abiItem.type === 'event') { @@ -90,18 +90,16 @@ ABIMapper.prototype.map = function (abi) { abiItem = self.contractPackageFactory.createAbiItemModel(event); - if (!mappedAbiItem.events[abiItem.name] || mappedAbiItem.events[abiItem.name].name === 'bound ') { - mappedAbiItem.events[abiItem.name] = abiItemModel; + if (!mappedAbiItems.events[abiItem.name] || mappedAbiItems.events[abiItem.name].name === 'bound ') { + mappedAbiItems.events[abiItem.name] = abiItemModel; } - mappedAbiItem.events[abiItem.signature] = abiItemModel; - mappedAbiItem.events[abiItem.funcName] = abiItemModel; - - return method; + mappedAbiItems.events[abiItem.signature] = abiItemModel; + mappedAbiItems.events[abiItem.funcName] = abiItemModel; } }); - return this.contractPackageFactory.createAbiModel(mappedAbiItem); + return this.contractPackageFactory.createABIModel(mappedAbiItems); }; /** diff --git a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js index 0470f4d503e..5fc63f1ce9e 100644 --- a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js @@ -36,12 +36,12 @@ function RpcMethodOptionsMapper(utils, formatters) { /** * Sets the default options where it is required * - * @param {Object} contractOptions + * @param {Contract} contract * @param {Object} options * * @returns {Object} */ -RpcMethodOptionsMapper.prototype.map = function (contractOptions, options) { +RpcMethodOptionsMapper.prototype.map = function (contract, options) { var gasPrice = null; if (options.gasPrice) { gasPrice = String(options.gasPrice); @@ -52,11 +52,11 @@ RpcMethodOptionsMapper.prototype.map = function (contractOptions, options) { from = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(options.from)) } - options.data = options.data || contractOptions.data; + options.data = options.data || contract.options.data; - options.from = from || contractOptions.from; - options.gasPrice = gasPrice || contractOptions.gasPrice; - options.gas = options.gas || options.gasLimit || contractOptions.gas; + options.from = from || contract.defaultAccount; + options.gasPrice = gasPrice || contract.options.gasPrice; + options.gas = options.gas || options.gasLimit || contract.options.gas; delete options.gasLimit; diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 54e6dfb54e8..0d3943773f8 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -119,7 +119,6 @@ MethodsProxy.prototype.executeMethod = function (abiItemModel, methodArguments) return this.methodController.execute( rpcMethodModel, - this.contract.currentProvider, this.contract.accounts, this.contract ); @@ -188,7 +187,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, methodArgu rpcMethodModel.parameters[0]['data'] = encodedContractMethod; // Set default options in the TxObject if required - rpcMethodModel.parameters = this.rpcMethodOptionsMapper.map(this.contract.options, rpcMethodModel.parameters[0]); + rpcMethodModel.parameters = this.rpcMethodOptionsMapper.map(this.contract, rpcMethodModel.parameters[0]); // Validate TxObject var rpcMethodOptionsValidationResult = this.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethodModel); diff --git a/packages/web3-eth-iban/src/Iban.js b/packages/web3-eth-iban/src/Iban.js index 94bc7caa812..747122a31c0 100644 --- a/packages/web3-eth-iban/src/Iban.js +++ b/packages/web3-eth-iban/src/Iban.js @@ -95,8 +95,10 @@ var Iban = function Iban(iban) { * This method should be used to create an ethereum address from a direct iban address * * @method toAddress - * @param {String} iban address - * @return {String} the ethereum address + * + * @param {String} ib + * + * @returns {String} */ Iban.toAddress = function (ib) { ib = new Iban(ib); @@ -112,8 +114,10 @@ Iban.toAddress = function (ib) { * This method should be used to create iban address from an ethereum address * * @method toIban + * * @param {String} address - * @return {String} the IBAN address + * + * @returns {String} the IBAN address */ Iban.toIban = function (address) { return Iban.fromAddress(address).toString(); @@ -123,8 +127,10 @@ Iban.toIban = function (address) { * This method should be used to create iban object from an ethereum address * * @method fromAddress + * * @param {String} address - * @return {Iban} the IBAN object + * + * @returns {Iban} the IBAN object */ Iban.fromAddress = function (address) { if(!utils.isAddress(address)){ @@ -145,7 +151,9 @@ Iban.fromAddress = function (address) { * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits * * @method fromBban + * * @param {String} bban the BBAN to convert to IBAN + * * @returns {Iban} the IBAN object */ Iban.fromBban = function (bban) { @@ -161,8 +169,10 @@ Iban.fromBban = function (bban) { * Should be used to create IBAN object for given institution and identifier * * @method createIndirect + * * @param {Object} options, required options are "institution" and "identifier" - * @return {Iban} the IBAN object + * + * @returns {Iban} the IBAN object */ Iban.createIndirect = function (options) { return Iban.fromBban('ETH' + options.institution + options.identifier); @@ -172,8 +182,10 @@ Iban.createIndirect = function (options) { * This method should be used to check if given string is valid iban object * * @method isValid + * * @param {String} iban string - * @return {Boolean} true if it is valid IBAN + * + * @returns {Boolean} true if it is valid IBAN */ Iban.isValid = function (iban) { var i = new Iban(iban); @@ -184,6 +196,7 @@ Iban.isValid = function (iban) { * Should be called to check if iban is correct * * @method isValid + * * @returns {Boolean} true if it is, otherwise false */ Iban.prototype.isValid = function () { @@ -195,6 +208,7 @@ Iban.prototype.isValid = function () { * Should be called to check if iban number is direct * * @method isDirect + * * @returns {Boolean} true if it is, otherwise false */ Iban.prototype.isDirect = function () { @@ -205,6 +219,7 @@ Iban.prototype.isDirect = function () { * Should be called to check if iban number if indirect * * @method isIndirect + * * @returns {Boolean} true if it is, otherwise false */ Iban.prototype.isIndirect = function () { @@ -216,6 +231,7 @@ Iban.prototype.isIndirect = function () { * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003) * * @method checksum + * * @returns {String} checksum */ Iban.prototype.checksum = function () { @@ -227,6 +243,7 @@ Iban.prototype.checksum = function () { * eg. XREG * * @method institution + * * @returns {String} institution identifier */ Iban.prototype.institution = function () { @@ -238,6 +255,7 @@ Iban.prototype.institution = function () { * eg. GAVOFYORK * * @method client + * * @returns {String} client identifier */ Iban.prototype.client = function () { @@ -248,6 +266,7 @@ Iban.prototype.client = function () { * Should be called to get client direct address * * @method toAddress + * * @returns {String} ethereum address */ Iban.prototype.toAddress = function () { diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index abbf3a6d400..eab3c4129f0 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -39,6 +39,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; */ function Personal(provider, providersPackage, methodController, methodModelFactory, net, utils, formatters) { AbstractWeb3Object.call(this, provider, providersPackage, methodController, methodModelFactory); + this.utils = utils; this.formatters = formatters; this.net = net; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index f74e60eded0..2d03f44d5d1 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -93,11 +93,11 @@ var Eth = function Eth( }, set: function (val) { if (val) { + self.Contract.defaultAccount = val; + self.personal.defaultAccount = val; defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); } - self.Contract.defaultAccount = defaultAccount; - self.personal.defaultAccount = defaultAccount; }, enumerable: true }); diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 9b7f658a689..dfa9e2512e4 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -72,6 +72,15 @@ function MethodModelFactory(utils, formatters, accounts) { ); } +/** + * Returns an MethodModel object + * + * @method createMethodModel + * + * @param {String} name + * + * @returns {AbstractMethodModel} + */ MethodModelFactory.prototype.createMethodModel = function (name) { return new this.methodModels[name](this.utils, this.formatters, this.accounts); }; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index b5fb6ea84e9..e715c44143a 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -52,9 +52,9 @@ module.exports = { * @returns {Eth} */ createEth: function (provider) { - var accounts = AccountsPackage.createAccounts(provider); - var methodModelFactory = new MethodModelFactory(Utils, formatters, accounts); - var methodController = MethodPackage.createMethodController(); + var accounts = AccountsPackage.createAccounts(provider), + methodModelFactory = new MethodModelFactory(Utils, formatters, accounts), + methodController = MethodPackage.createMethodController(); return new Eth( provider, diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index 2450f03eefd..e359957affe 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -41,7 +41,6 @@ function Network(provider, providersPackage, methodController, methodModelFactor this.utils = utils; } - /** * Determines to which network web3 is currently connected * diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index 7985c8ff27a..6663ed5ac8e 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -46,6 +46,6 @@ function MethodModelFactory(utils, formatters) { } MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); -MethodModelFacotry.prototype.constructor = MethodModelFactory; +MethodModelFactory.prototype.constructor = MethodModelFactory; module.exports = MethodModelFactory; From 61bdc356956ea55fda6a3462d02f8d474fb64583 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 3 Oct 2018 14:17:12 +0200 Subject: [PATCH 0176/1045] Contract constructor parameters updated --- packages/web3-eth-contract/src/Contract.js | 5 ----- .../src/factories/ContractPackageFactory.js | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 8245b43f95e..b7f9f6eaa2f 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -28,7 +28,6 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {AbstractProviderAdapter} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController - * @param {SubscriptionPackage} subscriptionPackage * @param {BatchRequestPackage} batchRequestPackage * @param {ContractPackageFactory} contractPackageFactory * @param {PromiEventPackage} promiEventPackage @@ -47,7 +46,6 @@ function Contract( provider, providersPackage, methodController, - subscriptionPackage, batchRequestPackage, contractPackageFactory, promiEventPackage, @@ -71,7 +69,6 @@ function Contract( this.provider = provider; this.providersPackage = providersPackage; this.methodController = methodController; - this.subscriptionPackage = subscriptionPackage; this.batchRequestPackage = batchRequestPackage; this.contractPackageFactory = contractPackageFactory; this.abiCoder = abiCoder; @@ -88,7 +85,6 @@ function Contract( this.providersPackage, null, null, - this.subscriptionPackage, this.batchRequestPackage ); @@ -222,7 +218,6 @@ Contract.prototype.clone = function () { this.provider, this.providersPackage, this.methodController, - this.subscriptionPackage, this.batchRequestPackage, this.contractPackageFactory, this.promiEventPackage, diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index 8f641b66b10..9ece69103dd 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -277,7 +277,7 @@ ContractPackageFactory.prototype.createEventSubscriptionsProxy = function ( }; /** - * Returns an object of SubscriptionFactory + * Returns an object of EventSubscriptionFactory * * @method createEventSubscriptionFactory * From 3cd4b9faaac554669404021285f3cd5feb0ef480 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 3 Oct 2018 14:33:43 +0200 Subject: [PATCH 0177/1045] method once implemented in Contract, unsubscribe improved in Subscription --- .../src/adapters/SocketProviderAdapter.js | 11 ++-- .../src/Subscription.js | 5 +- packages/web3-eth-contract/src/Contract.js | 51 ++++++++++--------- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index c96a3fcedf2..700e5aaa17b 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -41,15 +41,15 @@ function SocketProviderAdapter(provider) { * @method subscribe * * @param {String} subscriptionMethod - * @param {Array} parameters * @param {String} subscriptionType + * @param {Array} parameters * * @returns {Promise} */ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, subscriptionMethod, parameters) { var self = this; - return this.send(subscriptionType + '_subscribe', parameters.unshift(subscriptionMethod)).then(function (error, subscriptionId) { + return this.send(subscriptionType, parameters.unshift(subscriptionMethod)).then(function (error, subscriptionId) { if (!error) { self.subscriptions.push(subscriptionId); @@ -71,7 +71,7 @@ SocketProviderAdapter.prototype.subscribe = function (subscriptionType, subscrip * @returns {Promise} */ SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId, subscriptionType) { - return this.send(subscriptionType + '_unsubscribe', [subscriptionId]).then(function (result) { + return this.send(subscriptionType, [subscriptionId]).then(function (result) { if (result) { this.subscriptions = this.subscriptions.filter(function (subscription) { return subscription !== subscriptionId; @@ -140,13 +140,14 @@ SocketProviderAdapter.prototype.clearSubscriptions = function () { * @method removeSubscription * * @param {String} subscriptionId + * @param {String} subscriptionType * * @returns {Promise} */ -SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId) { +SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId, subscriptionType) { var self = this; - return this.unsubscribe(subscriptionId).then(function (result) { + return this.unsubscribe(subscriptionId, subscriptionType).then(function (result) { if (result) { delete self.subscriptions[this.subscriptions.indexOf(subscriptionId)]; diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 1aa6a364a06..33007a15406 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -55,7 +55,7 @@ Subscription.prototype.subscribe = function (callback) { this.web3Package.currentProvider.subscribe( this.subscriptionModel.subscriptionType, this.subscriptionModel.subscriptionMethod, - this.subscriptionModel.parameters + [this.subscriptionModel.options] ).then(function (subscriptionId) { self.subscriptionId = subscriptionId; @@ -150,6 +150,9 @@ Subscription.prototype.unsubscribe = function (callback) { this.subscriptionId, this.subscriptionModel.subscriptionType ).then(function (response) { + self.removeAllListeners('data'); + self.removeAllListeners('error'); + if (!response) { self.subscriptionId = null; callback(true, false); diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index b7f9f6eaa2f..446b06a7ca5 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -159,29 +159,34 @@ function Contract( ); } -Contract.prototype.once = function (event, options, callback) { - // var args = Array.prototype.slice.call(arguments); - // - // // get the callback - // callback = this._getCallback(args); - // - // if (!callback) { - // throw new Error('Once requires a callback as the second parameter.'); - // } - // - // // don't allow fromBlock - // if (options) - // delete options.fromBlock; - // - // // don't return as once shouldn't provide "on" - // this._on(event, options, function (err, res, sub) { - // sub.unsubscribe(); - // if (_.isFunction(callback)) { - // callback(err, res, sub); - // } - // }); - // - // return undefined; +/** + * Adds event listeners and creates a subscription, and remove it once its fired. + * + * @method once + * + * @param {String} eventName + * @param {Object} options + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {undefined} + */ +Contract.prototype.once = function (eventName, options, callback) { + if (!callback) { + throw new Error('Once requires a callback.'); + } + + if (options) { + delete options.fromBlock; + } + + var eventSubscription = this.events[event](options, callback); + + eventSubscription.on('data', function() { + eventSubscription.unsubscribe(); + }); + + return undefined; }; Contract.prototype.getPastEvents = function () { From a74bc7988378f120f8dd3ed2cd5796a2e2289b94 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 3 Oct 2018 15:01:52 +0200 Subject: [PATCH 0178/1045] getPastEvents implemented in Contract --- .../lib/models/AbstractMethodModel.js | 2 +- .../models/methods/GetPastLogsMethodModel.js | 2 +- packages/web3-eth-contract/src/Contract.js | 47 ++++++----- .../src/factories/RpcMethodModelFactory.js | 83 +++++++++++++++---- .../methods/PastEventLogsMethodModel.js | 62 ++++++++++++++ .../src/proxies/MethodsProxy.js | 4 +- 6 files changed, 161 insertions(+), 39 deletions(-) create mode 100644 packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 5875c5d218b..2c9dc3d2173 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -68,7 +68,7 @@ AbstractMethodModel.prototype.beforeExecution = function(web3Package) { }; * * @method afterExecution * - * @param {Object} response + * @param {*} response * * @returns {*} */ diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index 6870bcad832..b6864d998ed 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -50,7 +50,7 @@ GetPastLogsMethodModel.prototype.beforeExecution = function (web3Package) { * * @method afterExecution * - * @param {Object} response + * @param {Array} response * * @returns {Array} */ diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 446b06a7ca5..655d7c2e57d 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -173,7 +173,7 @@ function Contract( */ Contract.prototype.once = function (eventName, options, callback) { if (!callback) { - throw new Error('Once requires a callback.'); + throw new Error('Once requires a callback function.'); } if (options) { @@ -185,26 +185,35 @@ Contract.prototype.once = function (eventName, options, callback) { eventSubscription.on('data', function() { eventSubscription.unsubscribe(); }); - - return undefined; }; -Contract.prototype.getPastEvents = function () { - // var subOptions = this._generateEventOptions.apply(this, arguments); - // - // var getPastLogs = new Method({ - // name: 'getPastLogs', - // call: 'eth_getLogs', - // params: 1, - // inputFormatter: [formatters.inputLogFormatter], - // outputFormatter: this._decodeEventABI.bind(subOptions.event) - // }); - // getPastLogs.setRequestManager(this._requestManager); - // var call = getPastLogs.buildCall(); - // - // getPastLogs = null; - // - // return call(subOptions.params, subOptions.callback); +/** + * Returns the past event logs by his name + * + * @method getPastEvents + * + * @param {String} eventName + * @param {Object} options + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ +Contract.prototype.getPastEvents = function (eventName, options, callback) { + if (!this.options.jsonInterface.hasEvent(eventName)) { + throw Error('Event with name "' + eventName + 'does not exists.'); + } + + var abiItemModel = this.options.jsonInterface.getEvent(eventName); + abiItemModel.parameters = [options]; + abiItemModel.callback = callback; + + return this.methodController.execute( + this.contractPackageFactory.createRpcMethodModelFactory().createPastEventLogsMethodModel(abiItemModel), + this.currentProvider, + this.accounts, + this + ); }; Contract.prototype.deploy = function () { diff --git a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js index 656c6943e7d..c9f1c15e120 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js @@ -24,6 +24,7 @@ var SendContractMethodModel = require('../models/methods/SendContractMethodModel'); var CallContractMethodModel = require('../models/methods/CallContractMethodModel'); +var PastEventLogsMethodModel = require('../models/methods/PastEventLogsMethodModel'); var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; /** @@ -50,37 +51,87 @@ function RpcMethodModelFactory(methodResponseDecoder, accounts, utils, formatter * * @returns {AbstractMethodModel} */ -RpcMethodModelFactory.prototype.createRpcMethod = function (abiItemModel) { +RpcMethodModelFactory.prototype.createRpcMethodByRequestType = function (abiItemModel) { var rpcMethod; switch (abiItemModel.requestType) { case 'call': - rpcMethod = new CallContractMethodModel( - abiItemModel, - this.methodResponseDecoder, - this.utils, - this.formatters - ); + rpcMethod = this.createCallContractMethodModel(abiItemModel); break; case 'send' : - rpcMethod = new SendContractMethodModel( - abiItemModel, - this.methodResponseDecoder, - this.utils, - this.formatters, - this.accounts - ); + rpcMethod = this.createSendContractMethodModel(abiItemModel); break; case 'estimate': - rpcMethod = new EstimateGasMethodModel(this.utils, this.formatters); + rpcMethod = this.createEstimateGasMethodModel(); break; } if (typeof rpcMethod === 'undefined') { - throw Error('Unknown RPC call with name "' + abiItemModel.requestType + '"'); + throw Error('Unknown RPC call with requestType "' + abiItemModel.requestType + '"'); } return rpcMethod; }; +/** + * Returns an object of type PastEventLogsMethodModel + * + * @method createPastEventLogsMethodModel + * + * @param {ABIItemModel} abiItemModel + * + * @returns {PastEventLogsMethodModel} + */ +RpcMethodModelFactory.prototype.createPastEventLogsMethodModel = function (abiItemModel) { + return new PastEventLogsMethodModel(abiItemModel, this.utils, this.formatters); +}; + +/** + * Returns an object of type CallContractMethodModel + * + * @method createCallContractMethodModel + * + * @param {ABIItemModel} abiItemModel + * + * @returns {CallContractMethodModel} + */ +RpcMethodModelFactory.prototype.createCallContractMethodModel = function (abiItemModel) { + return new CallContractMethodModel( + abiItemModel, + this.methodResponseDecoder, + this.utils, + this.formatters + ); +}; + +/** + * Returns an object of type SendContractMethodModel + * + * @method createSendContractMethodModel + * + * @param {ABIItemModel} abiItemModel + * + * @returns {SendContractMethodModel} + */ +RpcMethodModelFactory.prototype.createSendContractMethodModel = function (abiItemModel) { + return new SendContractMethodModel( + abiItemModel, + this.methodResponseDecoder, + this.utils, + this.formatters, + this.accounts + ); +}; + +/** + * Returns an object of type EstimateGasMethodModel + * + * @method createEstimateGasMethodModel + * + * @returns {EstimateGasMethodModel} + */ +RpcMethodModelFactory.prototype.createEstimateGasMethodModel = function () { + return new EstimateGasMethodModel(this.utils, this.formatters) +}; + module.exports = RpcMethodModelFactory; diff --git a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js new file mode 100644 index 00000000000..b9a7222afd2 --- /dev/null +++ b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js @@ -0,0 +1,62 @@ +/* + 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 . + */ +/** + * @file PastEventLogsMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var GetPastLogsMethodModel = require('web3-core-method').GetPastLogsMethodModel; + +/** + * @param {ABIItemModel} abiItemModel + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ +function PastEventLogsMethodModel(abiItemModel, utils, formatters) { + GetPastLogsMethodModel.call(this, utils, formatters); + this.abiItemModel = abiItemModel; +} + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Array} response + * + * @returns {Array} + */ +PastEventLogsMethodModel.prototype.afterExecution = function (response) { + var formattedLogs = GetPastLogsMethodModel.prototype.afterExecution.call(response), + self = this; + + formattedLogs.map(function(logItem) { + return self.eventLogDecoder.decode(self.abiItemModel, logItem); + }); + + return formattedLogs; +}; + +PastEventLogsMethodModel.prototype = Object.create(GetPastLogsMethodModel.prototype); +PastEventLogsMethodModel.prototype.constructor = PastEventLogsMethodModel; + +module.exports = PastEventLogsMethodModel; diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 0d3943773f8..79f9d044ea8 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -144,7 +144,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, methodArgu // Check if one of the AbiItemModel in this array does match the arguments length abiItemModel.some(function(method) { // Get correct rpc method model - rpcMethodModel = self.rpcMethodModelFactory.createRpcMethod(method); + rpcMethodModel = self.rpcMethodModelFactory.createRpcMethodByRequestType(method); rpcMethodModel.methodArguments = methodArguments; isContractMethodParametersLengthValid = abiItemModel.givenParametersLengthIsValid(); @@ -160,7 +160,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, methodArgu } } else { // Get correct rpc method model - rpcMethodModel = this.rpcMethodModelFactory.createRpcMethod(abiItemModel); + rpcMethodModel = this.rpcMethodModelFactory.createRpcMethodByRequestType(abiItemModel); rpcMethodModel.methodArguments = methodArguments; } From e30b87fe6021d22d04290f2f243aec2bfa490f09 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 3 Oct 2018 16:04:20 +0200 Subject: [PATCH 0179/1045] SendContractMethodModel fixed --- ...ecoder.js => CallMethodResponseDecoder.js} | 10 ++--- .../src/factories/ContractPackageFactory.js | 14 +++---- .../src/factories/RpcMethodModelFactory.js | 10 ++--- .../src/models/abi/ABIModel.js | 2 +- .../models/methods/CallContractMethodModel.js | 8 ++-- .../models/methods/SendContractMethodModel.js | 42 ++++++++++++++++--- 6 files changed, 58 insertions(+), 28 deletions(-) rename packages/web3-eth-contract/src/decoders/{MethodResponseDecoder.js => CallMethodResponseDecoder.js} (85%) diff --git a/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js similarity index 85% rename from packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js rename to packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js index 122f145876d..84df84f830f 100644 --- a/packages/web3-eth-contract/src/decoders/MethodResponseDecoder.js +++ b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file MethodResponseDecoder.js + * @file CallMethodResponseDecoder.js * @author Samuel Furter * @date 2018 */ @@ -27,7 +27,7 @@ * * @constructor */ -function MethodResponseDecoder(abiCoder) { +function CallMethodResponseDecoder(abiCoder) { this.abiCoder = abiCoder; } @@ -37,11 +37,11 @@ function MethodResponseDecoder(abiCoder) { * @method decode * * @param {Array} abiItemOutputTypes - * @param {String} response + * @param {Object} response * * @returns {*} */ -MethodResponseDecoder.prototype.decode = function (abiItemOutputTypes, response) { +CallMethodResponseDecoder.prototype.decode = function (abiItemOutputTypes, response) { if (!response) { return null; } @@ -56,7 +56,5 @@ MethodResponseDecoder.prototype.decode = function (abiItemOutputTypes, response) return result[0]; } - delete result.__length__; - return result; }; diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index 9ece69103dd..0e785a7f0cd 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -27,7 +27,7 @@ var ABIItemModel = require('../models/abi/ABIItemModel'); var MethodEncoder = require('../encoders/MethodEncoder'); var EventFilterEncoder = require('../encoders/EventFilterEncoder'); var AllEventsFilterEncoder = require('../encoders/AllEventsFilterEncoder'); -var MethodResponseDecoder = require('../decoders/MethodResponseDecoder'); +var CallMethodResponseDecoder = require('../decoders/CallMethodResponseDecoder'); var EventLogDecoder = require('../decoders/EventLogDecoder'); var AllEventsLogDecoder = require('../decoders/AllEventsLogDecoder'); var ABIMapper = require('../mappers/ABIMapper'); @@ -126,14 +126,14 @@ ContractPackageFactory.prototype.createABIMapper = function () { }; /** - * Returns an object of MethodResponseDecoder + * Returns an object of CallMethodResponseDecoder * - * @method createMethodResponseDecoder + * @method createCallMethodResponseDecoder * - * @returns {MethodResponseDecoder} + * @returns {CallMethodResponseDecoder} */ -ContractPackageFactory.prototype.createMethodResponseDecoder = function () { - return new MethodResponseDecoder(this.abiCoder); +ContractPackageFactory.prototype.createCallMethodResponseDecoder = function () { + return new CallMethodResponseDecoder(this.abiCoder); }; /** @@ -212,7 +212,7 @@ ContractPackageFactory.prototype.createAllEventsOptionsMapper = function () { */ ContractPackageFactory.prototype.createRpcMethodModelFactory = function () { return new RpcMethodFactory( - this.createMethodResponseDecoder(), + this.createCallMethodResponseDecoder(), this.accounts, this.utils, this.formatters diff --git a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js index c9f1c15e120..bbc2f9eebd2 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js @@ -28,17 +28,17 @@ var PastEventLogsMethodModel = require('../models/methods/PastEventLogsMethodMod var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; /** - * @param {MethodResponseDecoder} methodResponseDecoder + * @param {CallMethodResponseDecoder} callMethodResponseDecoder * @param {Accounts} accounts * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function RpcMethodModelFactory(methodResponseDecoder, accounts, utils, formatters) { +function RpcMethodModelFactory(callMethodResponseDecoder, accounts, utils, formatters) { this.utils = utils; this.formatters = formatters; - this.methodResponseDecoder = methodResponseDecoder; + this.callMethodResponseDecoder = callMethodResponseDecoder; this.accounts = accounts; } @@ -98,7 +98,7 @@ RpcMethodModelFactory.prototype.createPastEventLogsMethodModel = function (abiIt RpcMethodModelFactory.prototype.createCallContractMethodModel = function (abiItemModel) { return new CallContractMethodModel( abiItemModel, - this.methodResponseDecoder, + this.callMethodResponseDecoder, this.utils, this.formatters ); @@ -116,7 +116,7 @@ RpcMethodModelFactory.prototype.createCallContractMethodModel = function (abiIte RpcMethodModelFactory.prototype.createSendContractMethodModel = function (abiItemModel) { return new SendContractMethodModel( abiItemModel, - this.methodResponseDecoder, + this.allEventsLogDecoder, this.utils, this.formatters, this.accounts diff --git a/packages/web3-eth-contract/src/models/abi/ABIModel.js b/packages/web3-eth-contract/src/models/abi/ABIModel.js index 2913a87d0a0..8c169d7a0f4 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIModel.js @@ -85,7 +85,7 @@ ABIModel.prototype.getEvents = function () { * * @param {String} signature * - * @returns {Object} + * @returns {ABIItemModel} */ ABIModel.prototype.getEventBySignature = function (signature) { return this.abi.events.find(function (event) { diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js index e1d4a13e724..7777cadcbe6 100644 --- a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -26,16 +26,16 @@ var CallMethodModel = require('web3-core-method').CallMethodModel; /** * @param {ABIItemModel} abiItemModel - * @param {MethodResponseDecoder} methodResponseDecoder + * @param {CallMethodResponseDecoder} callMethodResponseDecoder * @param {Utils} utils * @param {Object} formatters * * @constructor */ -function CallContractMethodModel(abiItemModel, methodResponseDecoder, utils, formatters) { +function CallContractMethodModel(abiItemModel, callMethodResponseDecoder, utils, formatters) { CallMethodModel.call(this, utils, formatters); - this.methodResponseDecoder = methodResponseDecoder; + this.callMethodResponseDecoder = callMethodResponseDecoder; this.abiItemModel = abiItemModel; } @@ -49,7 +49,7 @@ function CallContractMethodModel(abiItemModel, methodResponseDecoder, utils, for * @returns {*} */ CallContractMethodModel.prototype.afterExecution = function (response) { - return this.methodResponseDecoder.decode(this.abiItemModel, response); + return this.callMethodResponseDecoder.decode(this.abiItemModel, response); }; CallContractMethodModel.prototype = Object.create(CallMethodModel.prototype); diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js index c7f2ea9d1c5..d574e67d296 100644 --- a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -21,23 +21,23 @@ */ "use strict"; - +var _ = require('underscore'); var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; /** * @param {ABIItemModel} abiItemModel - * @param {MethodResponseDecoder} methodResponseDecoder + * @param {AllEventsLogDecoder} allEventsLogDecoder * @param {Utils} utils * @param {Object} formatters * @param {Accounts} accounts * * @constructor */ -function SendContractMethodModel(abiItemModel, methodResponseDecoder, utils, formatters, accounts) { +function SendContractMethodModel(abiItemModel, allEventsLogDecoder, utils, formatters, accounts) { SendTransactionMethodModel.call(this, utils, formatters, accounts); - this.methodResponseDecoder = methodResponseDecoder; this.abiItemModel = abiItemModel; + this.allEventsLogDecoder = allEventsLogDecoder; } /** @@ -50,7 +50,39 @@ function SendContractMethodModel(abiItemModel, methodResponseDecoder, utils, for * @returns {*} */ SendContractMethodModel.prototype.afterExecution = function (response) { - return this.methodResponseDecoder.decode(this.abiItemModel, response); + if (_.isArray(response.logs)) { + response.events = {}; + + response.logs.map(function (log) { + return this.allEventsLogDecoder.decode(null, log); + }); + + response.logs.forEach(function (log, index) { + if(log.event) { + if (response.events[log.event]) { + if (_.isArray(response.events[log.event])) { + response.events[log.event].push(log); + + return; + } + + response.events[log.event] = [response.events[log.event], log]; + + return; + } + + response.events[log.event] = log; + + return; + } + + response.events[index] = log; + }); + + delete response.logs; + } + + return response; }; SendContractMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); From 374910be5cad2ce8a41c361a953e7720ffcdad5f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 3 Oct 2018 17:35:38 +0200 Subject: [PATCH 0180/1045] contract deployment implemented --- .../TransactionConfirmationWorkflow.js | 11 ++++ packages/web3-eth-contract/src/Contract.js | 25 +++++--- .../src/factories/RpcMethodModelFactory.js | 28 +++++++-- packages/web3-eth-contract/src/index.js | 4 +- .../src/mappers/ABIMapper.js | 9 ++- .../src/models/abi/ABIItemModel.js | 4 ++ .../methods/ContractDeployMethodModel.js | 59 +++++++++++++++++++ .../src/proxies/MethodsProxy.js | 30 ++++++++-- 8 files changed, 150 insertions(+), 20 deletions(-) create mode 100644 packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 52f3cdb456b..e28f34299d3 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -22,6 +22,8 @@ "use strict"; +var ContractDeployMethodModel = require('web3-eth-contract').ContractDeployMethodModel; + /** * @param {TransactionConfirmationModel} transactionConfirmationModel * @param {TransactionReceiptValidator} transactionReceiptValidator @@ -142,6 +144,15 @@ TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (tran TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt, methodModel, promiEvent) { this.newHeadsWatcher.stop(); + if (methodModel instanceof ContractDeployMethodModel) { + promiEvent.resolve(methodModel.afterExecution(receipt)); + promiEvent.eventEmitter.emit('receipt', receipt); + promiEvent.eventEmitter.removeAllListeners(); + methodModel.callback(false, receipt); + + return; + } + var mappedReceipt = methodModel.afterExecution(receipt); promiEvent.resolve(mappedReceipt); diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 655d7c2e57d..02133ddefae 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -78,6 +78,7 @@ function Contract( this.abiMapper = abiMapper; this.options = options; this.promiEventPackage = promiEventPackage; + this.rpcMethodModelFactory = contractPackageFactory.createRpcMethodModelFactory(); AbstractWeb3Object.call( this, @@ -204,20 +205,30 @@ Contract.prototype.getPastEvents = function (eventName, options, callback) { throw Error('Event with name "' + eventName + 'does not exists.'); } - var abiItemModel = this.options.jsonInterface.getEvent(eventName); - abiItemModel.parameters = [options]; - abiItemModel.callback = callback; + var pastEventLogsMethodModel = this.rpcMethodModelFactory.createPastEventLogsMethodModel( + this.options.jsonInterface.getEvent(eventName) + ); + pastEventLogsMethodModel.parameters = [options]; + pastEventLogsMethodModel.callback = callback; return this.methodController.execute( - this.contractPackageFactory.createRpcMethodModelFactory().createPastEventLogsMethodModel(abiItemModel), - this.currentProvider, + pastEventLogsMethodModel, this.accounts, this ); }; -Contract.prototype.deploy = function () { - +/** + * Deploy an contract and returns an new Contract instance with the correct address set + * + * @method deploy + * + * @param {Object} options + * + * @returns {Promise|EventEmitter} + */ +Contract.prototype.deploy = function (options) { + return this.methods.constructor(options); }; /** diff --git a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js index bbc2f9eebd2..aaf687e89ca 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js @@ -22,9 +22,10 @@ "use strict"; -var SendContractMethodModel = require('../models/methods/SendContractMethodModel'); var CallContractMethodModel = require('../models/methods/CallContractMethodModel'); +var ContractDeployMethodModel = require('../models/methods/ContractDeployMethodModel'); var PastEventLogsMethodModel = require('../models/methods/PastEventLogsMethodModel'); +var SendContractMethodModel = require('../models/methods/SendContractMethodModel'); var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; /** @@ -48,22 +49,26 @@ function RpcMethodModelFactory(callMethodResponseDecoder, accounts, utils, forma * @method createRpcMethod * * @param {ABIItemModel} abiItemModel + * @param {Contract} contract * * @returns {AbstractMethodModel} */ -RpcMethodModelFactory.prototype.createRpcMethodByRequestType = function (abiItemModel) { +RpcMethodModelFactory.prototype.createRpcMethodByRequestType = function (abiItemModel, contract) { var rpcMethod; switch (abiItemModel.requestType) { case 'call': rpcMethod = this.createCallContractMethodModel(abiItemModel); - break; + break; case 'send' : rpcMethod = this.createSendContractMethodModel(abiItemModel); - break; + break; case 'estimate': rpcMethod = this.createEstimateGasMethodModel(); - break; + break; + case 'contract-deployment': + rpcMethod = this.createContractDeployMethodModel(contract); + break; } if (typeof rpcMethod === 'undefined') { @@ -123,6 +128,19 @@ RpcMethodModelFactory.prototype.createSendContractMethodModel = function (abiIte ); }; +/** + * Returns an object of type ContractDeployMethodModel + * + * @method createContractDeployMethodModel + * + * @param {Contract} contract + * + * @returns {ContractDeployMethodModel} + */ +RpcMethodModelFactory.prototype.createContractDeployMethodModel = function (contract) { + return new ContractDeployMethodModel(contract, this.utils, this.formatters, this.accounts); +}; + /** * Returns an object of type EstimateGasMethodModel * diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 78ae52614ab..d31bc8b628b 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -24,11 +24,13 @@ var version = require('./package.json').version; var Contract = require('./Contract'); +var ContractDeployMethodModel = require('./models/methods/ContractDeployMethodModel'); // TODO: define public api module.exports = { version: version, - Contract: Contract + Contract: Contract, + ContractDeployMethodModel: ContractDeployMethodModel, // TODO: Refactor Contract object because of the new handling // TODO: don't forget the currentProvider, defaultBlock, defaultAccount and accounts handling }; diff --git a/packages/web3-eth-contract/src/mappers/ABIMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js index 670870ce8a2..be6e3dcfe5a 100644 --- a/packages/web3-eth-contract/src/mappers/ABIMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -62,7 +62,7 @@ ABIMapper.prototype.map = function (abi) { if (abiItem.type === 'function') { abiItem.signature = self.abiCoder.encodeFunctionSignature(abiItem.funcName); - abiItemModel = self.contractPackageFactory.createAbiItemModel(abiItem); + abiItemModel = self.contractPackageFactory.createABIItemModel(abiItem); // Check if an method already exists with this name and if it exists than create an array and push this abiItem // into it. This will be used if there are methods with the same name but with different arguments. @@ -88,7 +88,7 @@ ABIMapper.prototype.map = function (abi) { if (abiItem.type === 'event') { abiItem.signature = self.abiCoder.encodeEventSignature(abiItem.funcName); - abiItem = self.contractPackageFactory.createAbiItemModel(event); + abiItem = self.contractPackageFactory.createABIItemModel(event); if (!mappedAbiItems.events[abiItem.name] || mappedAbiItems.events[abiItem.name].name === 'bound ') { mappedAbiItems.events[abiItem.name] = abiItemModel; @@ -97,6 +97,11 @@ ABIMapper.prototype.map = function (abi) { mappedAbiItems.events[abiItem.signature] = abiItemModel; mappedAbiItems.events[abiItem.funcName] = abiItemModel; } + + if (abiItem.type === 'constructor') { + abiItem.signature = abiItem.type; + mappedAbiItems.methods[abiItem.type] = self.contractPackageFactory.createABIItemModel(abiItem); + } }); return this.contractPackageFactory.createABIModel(mappedAbiItems); diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index 2509dc6fb8a..d64189e7d1e 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -45,6 +45,10 @@ function ABIItemModel(abiItem) { return 'send'; } + + if (abiItem.type === 'constructor') { + return 'contract-deployment'; + } } }) } diff --git a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js new file mode 100644 index 00000000000..d0774b10f5c --- /dev/null +++ b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js @@ -0,0 +1,59 @@ +/* + 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 . + */ +/** + * @file ContractDeployMethodModel.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; +var _ = require('underscore'); +var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; + +/** + * @param {Contract} contract + * @param {Utils} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ +function ContractDeployMethodModel(contract, utils, formatters, accounts) { + SendTransactionMethodModel.call(this, utils, formatters, accounts); + this.contract = contract; +} + +/** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {*} + */ +ContractDeployMethodModel.prototype.afterExecution = function (response) { + var clonedContract = this.contract.clone(); + clonedContract.options.address = response.contractAddress; + + return clonedContract; +}; + +ContractDeployMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); +ContractDeployMethodModel.prototype.constructor = ContractDeployMethodModel; + +module.exports = ContractDeployMethodModel; diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 79f9d044ea8..dd56e62170d 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -72,15 +72,35 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { var abiItemModel = this.abiModel.getMethod(name); if (abiItemModel) { + var requestType = abiItemModel.requestType; + if (requestType === 'contract-deployment') { + requestType = 'send'; + } + var anonymousFunction = function () { - abiItemModel.contractMethodParameters = arguments; + var methodArguments = arguments; + + // Because of the possibility to overwrite the contract data if I call contract.deploy() have I to check + // here if it is an contract deployment. If this call is a deployment then I have to set the correct + // contract data and to map the arguments. TODO: Change API or improve this + if (requestType === 'contract-deployment') { + if (arguments[0]['data']) { + target.contract.options.data = target.contract.options.data || arguments[0]['data']; + } + + if (arguments[0]['arguments']) { + methodArguments = arguments[0]['arguments']; + } + } + + abiItemModel.contractMethodParameters = methodArguments; }; - anonymousFunction[abiItemModel.requestType] = function () { + anonymousFunction[requestType] = function () { return target.executeMethod(abiItemModel, arguments); }; - anonymousFunction[abiItemModel.requestType].request = function () { + anonymousFunction[requestType].request = function () { return target.createRpcMethodModel(abiItemModel, arguments); }; @@ -144,7 +164,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, methodArgu // Check if one of the AbiItemModel in this array does match the arguments length abiItemModel.some(function(method) { // Get correct rpc method model - rpcMethodModel = self.rpcMethodModelFactory.createRpcMethodByRequestType(method); + rpcMethodModel = self.rpcMethodModelFactory.createRpcMethodByRequestType(method, self.contract); rpcMethodModel.methodArguments = methodArguments; isContractMethodParametersLengthValid = abiItemModel.givenParametersLengthIsValid(); @@ -160,7 +180,7 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, methodArgu } } else { // Get correct rpc method model - rpcMethodModel = this.rpcMethodModelFactory.createRpcMethodByRequestType(abiItemModel); + rpcMethodModel = this.rpcMethodModelFactory.createRpcMethodByRequestType(abiItemModel, this.contract); rpcMethodModel.methodArguments = methodArguments; } From fd5d4b2b0afd7430fa0ce2e4dcbe3620e735f264 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 3 Oct 2018 17:45:30 +0200 Subject: [PATCH 0181/1045] changed this.methods.constructor to this.methods.contractConstructor because constructor is reserved property for each js object --- packages/web3-eth-contract/src/Contract.js | 2 +- packages/web3-eth-contract/src/mappers/ABIMapper.js | 2 +- packages/web3-eth-contract/src/proxies/MethodsProxy.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 02133ddefae..40cccf9bca6 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -228,7 +228,7 @@ Contract.prototype.getPastEvents = function (eventName, options, callback) { * @returns {Promise|EventEmitter} */ Contract.prototype.deploy = function (options) { - return this.methods.constructor(options); + return this.methods.contractConstructor(options); }; /** diff --git a/packages/web3-eth-contract/src/mappers/ABIMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js index be6e3dcfe5a..25953474d9b 100644 --- a/packages/web3-eth-contract/src/mappers/ABIMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -100,7 +100,7 @@ ABIMapper.prototype.map = function (abi) { if (abiItem.type === 'constructor') { abiItem.signature = abiItem.type; - mappedAbiItems.methods[abiItem.type] = self.contractPackageFactory.createABIItemModel(abiItem); + mappedAbiItems.methods['contractConstructor'] = self.contractPackageFactory.createABIItemModel(abiItem); } }); diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index dd56e62170d..81344216aa4 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -81,7 +81,7 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { var methodArguments = arguments; // Because of the possibility to overwrite the contract data if I call contract.deploy() have I to check - // here if it is an contract deployment. If this call is a deployment then I have to set the correct + // here if it is a contract deployment. If this call is a contract deployment then I have to set the right // contract data and to map the arguments. TODO: Change API or improve this if (requestType === 'contract-deployment') { if (arguments[0]['data']) { From 8e2ce3dd07952cae3f28d7cbb9d450e4c7196920 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 3 Oct 2018 17:46:22 +0200 Subject: [PATCH 0182/1045] unused method removed --- .../web3-eth-contract/src/models/abi/ABIModel.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/packages/web3-eth-contract/src/models/abi/ABIModel.js b/packages/web3-eth-contract/src/models/abi/ABIModel.js index 8c169d7a0f4..b5f5d273a45 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIModel.js @@ -119,17 +119,4 @@ ABIModel.prototype.hasEvent = function (name) { return typeof this.abi.events[name] !== 'undefined'; }; -/** - * Returns the constructor of the contract - * - * @method getConstructor - * - * @returns {ABIItemModel} - */ -ABIModel.prototype.getConstructor = function () { - return this.abi.methods.find(function (abiItemModel) { - return !_.isArray(abiItemModel) && abiItemModel.name && abiItemModel.name === 'constructor'; - }) -}; - module.exports = ABIModel; From b4a4930135f0651ecdd5ec174e5dd87314d25365 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 4 Oct 2018 10:00:52 +0200 Subject: [PATCH 0183/1045] ContractPackage index created --- packages/web3-eth-contract/src/Contract.js | 2 +- .../src/factories/ContractPackageFactory.js | 78 +++++++++++++++---- packages/web3-eth-contract/src/index.js | 41 +++++++++- 3 files changed, 100 insertions(+), 21 deletions(-) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 40cccf9bca6..d94e682385d 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -36,7 +36,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {Object} formatters * @param {Accounts} accounts * @param {ABIMapper} abiMapper - * @param {Array} abi + * @param {Object} abi * @param {String} address * @param {Object} options * diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index 0e785a7f0cd..ff036b8b285 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -56,7 +56,51 @@ function ContractPackageFactory(utils, formatters, abiCoder, accounts) { } /** - * Returns an object of ABIModel + * Returns an object of type Contract + * + * @method createContract + * + * @param {*} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {BatchRequestPackage} batchRequestPackage + * @param {PromiEventPackage} promiEventPackage + * @param {Object} abi + * @param {String} address + * @param {Object} options + * + * @returns {Contract} + */ +ContractPackageFactory.prototype.createContract = function ( + provider, + providersPackage, + methodController, + batchRequestPackage, + promiEventPackage, + abi, + address, + options +) { + return new Contract( + provider, + providersPackage, + new MethodController(), + batchRequestPackage, + this, + promiEventPackage, + this.abiCoder, + this.utils, + this.formatters, + this.accounts, + this.createABIMapper(), + abi, + address, + options + ); +}; + +/** + * Returns an object of type ABIModel * * @method createABIModel * @@ -69,7 +113,7 @@ ContractPackageFactory.prototype.createABIModel = function (mappedAbi) { }; /** - * Returns an object of ABIItemModel + * Returns an object of type ABIItemModel * * @method createABIItemModel * @@ -82,7 +126,7 @@ ContractPackageFactory.prototype.createABIItemModel = function (abiItem) { }; /** - * Returns an object of MethodEncoder + * Returns an object of type MethodEncoder * * @method createMethodEncoder * @@ -93,7 +137,7 @@ ContractPackageFactory.prototype.createMethodEncoder = function () { }; /** - * Returns an object of EventFilterEncoder + * Returns an object of type EventFilterEncoder * * @method createEventFilterEncoder * @@ -104,7 +148,7 @@ ContractPackageFactory.prototype.createEventFilterEncoder = function () { }; /** - * Returns an object of AllEventsFilterEncoder + * Returns an object of type AllEventsFilterEncoder * * @method createAllEventsFilterEncoder * @@ -115,7 +159,7 @@ ContractPackageFactory.prototype.createAllEventsFilterEncoder = function () { }; /** - * Returns an object of ABIMapper + * Returns an object oftype ABIMapper * * @method createABIMapper * @@ -126,7 +170,7 @@ ContractPackageFactory.prototype.createABIMapper = function () { }; /** - * Returns an object of CallMethodResponseDecoder + * Returns an object of type CallMethodResponseDecoder * * @method createCallMethodResponseDecoder * @@ -137,7 +181,7 @@ ContractPackageFactory.prototype.createCallMethodResponseDecoder = function () { }; /** - * Returns an object of EventLogDecoder + * Returns an object of type EventLogDecoder * * @method createEventLogDecoder * @@ -149,7 +193,7 @@ ContractPackageFactory.prototype.createEventLogDecoder = function () { /** - * Returns an object of AllEventsLogDecoder + * Returns an object of type AllEventsLogDecoder * * @method createAllEventsLogDecoder * @@ -160,7 +204,7 @@ ContractPackageFactory.prototype.createAllEventsLogDecoder = function () { }; /** - * Returns an object of RpcMethodOptionsValidator + * Returns an object of type RpcMethodOptionsValidator * * @method createRpcMethodOptionsValidator * @@ -171,7 +215,7 @@ ContractPackageFactory.prototype.createRpcMethodOptionsValidator = function () { }; /** - * Returns an object of RpcMethodOptionsMapper + * Returns an object of type RpcMethodOptionsMapper * * @method createRpcMethodOptionsMapper * @@ -182,7 +226,7 @@ ContractPackageFactory.prototype.createRpcMethodOptionsMapper = function () { }; /** - * Returns an object of EventOptionsMapper + * Returns an object of type EventOptionsMapper * * @method createEventOptionsMapper * @@ -193,7 +237,7 @@ ContractPackageFactory.prototype.createEventOptionsMapper = function () { }; /** - * Returns an object of AllEventsOptionsMapper + * Returns an object of type AllEventsOptionsMapper * * @method createAllEventsOptionsMapper * @@ -204,7 +248,7 @@ ContractPackageFactory.prototype.createAllEventsOptionsMapper = function () { }; /** - * Returns an object of RpcMethodModelFactory + * Returns an object of type RpcMethodModelFactory * * @method createRpcMethodModelFactory * @@ -220,7 +264,7 @@ ContractPackageFactory.prototype.createRpcMethodModelFactory = function () { }; /** - * Returns an Object of MethodsProxy + * Returns an object of type MethodsProxy * * @method createMethodsProxy * @@ -250,7 +294,7 @@ ContractPackageFactory.prototype.createMethodsProxy = function ( }; /** - * Returns an object of EventSubscriptionsProxy + * Returns an object of type EventSubscriptionsProxy * * @method createEventSubscriptionsProxy * @@ -277,7 +321,7 @@ ContractPackageFactory.prototype.createEventSubscriptionsProxy = function ( }; /** - * Returns an object of EventSubscriptionFactory + * Returns an object of type EventSubscriptionFactory * * @method createEventSubscriptionFactory * diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index d31bc8b628b..0fe55bd837a 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -23,14 +23,49 @@ "use strict"; var version = require('./package.json').version; +var PromiEventPackage = require('web3-core-promievent'); +var MethodPackage = require('web3-core-method'); +var ProvidersPackage = require('web3-core-providers'); +var BatchRequestPackage = require('web3-core-batch'); +var ABIPackage = require('web3-eth-abi'); +var Utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; var Contract = require('./Contract'); var ContractDeployMethodModel = require('./models/methods/ContractDeployMethodModel'); +var ContractPackageFactory = require('./factories/ContractPackageFactory'); -// TODO: define public api module.exports = { version: version, + Contract: Contract, ContractDeployMethodModel: ContractDeployMethodModel, -// TODO: Refactor Contract object because of the new handling -// TODO: don't forget the currentProvider, defaultBlock, defaultAccount and accounts handling + + /** + * Returns an object of type Contract + * + * @param {*} provider + * @param {Accounts} accounts + * @param {Object} abi + * @param {String} address + * @param {Object} options + * + * @returns {Contract} + */ + createContract: function (provider, accounts, abi, address, options) { + return new ContractPackageFactory( + Utils, + formatters, + ABIPackage.createAbiCoder(), + accounts + ).createContract( + provider, + ProvidersPackage, + MethodPackage.createMethodController(), + BatchRequestPackage, + PromiEventPackage, + abi, + address, + options + ); + } }; From a3e161818fcb98841f281d6d58fdf6ebf009c380 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 4 Oct 2018 10:14:08 +0200 Subject: [PATCH 0184/1045] gasPrice implemented for SignAndSendMethodCommand and SendMethodCommand --- .../lib/commands/AbstractSendMethodCommand.js | 31 ++++++++++++++++--- .../src/commands/SendMethodCommand.js | 16 +--------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js index 2e005dc9652..9d4452eb664 100644 --- a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js +++ b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js @@ -33,8 +33,7 @@ function AbstractSendMethodCommand(transactionConfirmationWorkflow) { /** - * TODO: Add gasPrice check - * Sends the JSON-RPC request + * Checks the gasPrice and sends the JSON-RPC request * * @method send * @@ -42,10 +41,34 @@ function AbstractSendMethodCommand(transactionConfirmationWorkflow) { * @param {AbstractWeb3Object} web3Package * @param {PromiEvent} promiEvent * - * @callback callback callback(error, result) * @returns {PromiEvent} */ AbstractSendMethodCommand.prototype.send = function (methodModel, promiEvent, web3Package) { + if (this.isGasPriceDefined(methodModel.parameters)) { + this.sendMethod(methodModel, promiEvent, web3Package); + } + + this.getGasPrice(web3Package.currentProvider).then(function(gasPrice) { + if (_.isObject(methodModel.parameters[0])) { + methodModel.parameters[0].gasPrice = gasPrice; + } + + self.sendMethod(methodModel, promiEvent, web3Package); + }); + + return promiEvent; +}; + +/** + * Sends the JSON-RPC request + * + * @method send + * + * @param {AbstractMethodModel} methodModel + * @param {AbstractWeb3Object} web3Package + * @param {PromiEvent} promiEvent + */ +AbstractSendMethodCommand.prototype.sendMethod = function (methodModel, promiEvent, web3Package) { web3Package.currentProvider.send( methodModel.rpcMethod, methodModel.parameters @@ -65,8 +88,6 @@ AbstractSendMethodCommand.prototype.send = function (methodModel, promiEvent, we promiEvent.eventEmitter.removeAllListeners(); methodModel.callback(error, null); }); - - return promiEvent; }; diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 11351f434bf..12fa860b533 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -46,23 +46,9 @@ function SendMethodCommand(transactionConfirmationWorkflow) { * @returns {PromiEvent} */ SendMethodCommand.prototype.execute = function (web3Package, methodModel, promiEvent) { - var self = this; - methodModel.beforeExecution(web3Package); - if (this.isGasPriceDefined(methodModel.parameters)) { - return this.send(methodModel, promiEvent, web3Package); - } - - this.getGasPrice(web3Package.currentProvider).then(function(gasPrice) { - if (_.isObject(methodModel.parameters[0])) { - methodModel.parameters[0].gasPrice = gasPrice; - } - - self.send(methodModel, promiEvent, web3Package); - }); - - return promiEvent; + return this.send(methodModel, promiEvent, web3Package); }; SendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); From c62da99bae5c9fd0fbf3717503e5b58482e33bdb Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 4 Oct 2018 10:22:25 +0200 Subject: [PATCH 0185/1045] Contract added to Eth --- packages/web3-eth/src/Eth.js | 34 ++++++++++++++++++++++++++-------- packages/web3-eth/src/index.js | 4 ++-- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 2d03f44d5d1..02908941b34 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -28,7 +28,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * @param {AbstractProviderAdapter | EthereumProvider} provider * @param {Network} net - * @param {Contract} contract + * @param {ContractPackage} contractPackage * @param {Accounts} accounts * @param {Personal} personal * @param {Iban} iban @@ -47,7 +47,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var Eth = function Eth( provider, net, - contract, + contractPackage, accounts, personal, iban, @@ -70,8 +70,9 @@ var Eth = function Eth( batchRequestPackage ); + var self = this; + this.net = net; - this.Contract = contract; this.accounts = accounts; this.personal = personal; this.iban = iban; @@ -80,9 +81,17 @@ var Eth = function Eth( this.utils = utils; this.formatters = formatters; this.subscriptionsFactory = subscriptionsFactory; + this.initiatedContracts = []; + + this.Contract = function (abi, address, options) { + var contract = contractPackage.createContract(self.currentProvider, self.accounts, abi, address, options); + self.initiatedContracts.push(contract); + + return contract; + }; - var defaultAccount = null; - var defaultBlock = 'latest'; + var defaultAccount = null, + defaultBlock = 'latest'; /** * Defines accessors for defaultAccount @@ -93,7 +102,10 @@ var Eth = function Eth( }, set: function (val) { if (val) { - self.Contract.defaultAccount = val; + self.initiatedContracts.forEach(function (contract) { + contract.defaultAccount = val; + }); + self.personal.defaultAccount = val; defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); } @@ -111,8 +123,10 @@ var Eth = function Eth( }, set: function (val) { defaultBlock = val; - - self.Contract.defaultBlock = defaultBlock; + self.initiatedContracts.forEach(function (contract) { + contract.defaultAccount = val; + }); + self.personal.defaultBlock = defaultBlock; }, enumerable: true @@ -163,6 +177,10 @@ Eth.prototype.setProvider = function (provider) { this.accounts.setProvider(provider); this.personal.setProvider(provider); this.ens.setProvider(provider); + + this.initiatedContracts.forEach(function (contract) { + contract.setProvider(provider); + }); }; Eth.prototype = Object.create(AbstractWeb3Object.prototype); diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index e715c44143a..e9892061af6 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -26,7 +26,7 @@ var version = require('./package.json').version; var MethodModelFactory = require('./factories/MethodModelFactory'); var Eth = require('./Eth'); var NetPackage = require('web3-net'); -var Contract = require('web3-eth-contract').Contract; +var ContractPackage = require('web3-eth-contract'); var AccountsPackage = require('web3-eth-accounts'); var PersonalPackage = require('web3-eth-personal'); var ENSPackage = require('web3-eth-ens'); @@ -59,7 +59,7 @@ module.exports = { return new Eth( provider, NetPackage.createNetwork(provider), - Contract, + ContractPackage, accounts, PersonalPackage.createPersonal(provider), Iban, From a31b83965e9f1b184b2d3033f6e45f2a4cfb9494 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 4 Oct 2018 10:36:10 +0200 Subject: [PATCH 0186/1045] createSubscriptionsFactory method created in index.js of the SubscriptionPackage and related packages updated --- packages/web3-core-subscription/src/index.js | 14 +++++++++++- packages/web3-eth/src/Eth.js | 24 ++++++++++++++------ packages/web3-eth/src/index.js | 12 ++++------ packages/web3-shh/src/index.js | 4 ++-- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscription/src/index.js index 9ba6a8689d9..6104c0444de 100644 --- a/packages/web3-core-subscription/src/index.js +++ b/packages/web3-core-subscription/src/index.js @@ -26,11 +26,23 @@ var version = require('./package.json').version; var SubscriptionsFactory = require('./factories/SubscriptionsFactory'); var LogSubscriptionModel = require('./models/subscriptions/eth/LogSubscriptionModel'); var Subscription = require('./Subscription'); +var Utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; module.exports = { version: version, Subscription: Subscription, LogSubscriptionModel: LogSubscriptionModel, - SubscriptionsFactory: SubscriptionsFactory + + /** + * Returns an object of type SubscriptionsFactory + * + * @method createSubscriptionsFactory + * + * @returns {SubscriptionsFactory} + */ + createSubscriptionsFactory: function () { + return new SubscriptionsFactory(Utils, formatters); + } }; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 02908941b34..e5dc740247a 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -26,7 +26,7 @@ var _ = require('underscore'); var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Network} net * @param {ContractPackage} contractPackage * @param {Accounts} accounts @@ -126,7 +126,7 @@ var Eth = function Eth( self.initiatedContracts.forEach(function (contract) { contract.defaultAccount = val; }); - + self.personal.defaultBlock = defaultBlock; }, enumerable: true @@ -154,12 +154,22 @@ Eth.prototype.subscribe = function (type, options, callback) { this.methodModelFactory.createMethodModel('getPastLogs'), this.methodController ).subscribe(callback); + case 'newBlockHeaders': - return this.subscriptionsFactory.createNewHeadsSubscription(this).subscribe(callback); + return this.subscriptionsFactory.createNewHeadsSubscription( + this + ).subscribe(callback); + case 'pendingTransactions': - return this.subscriptionsFactory.createNewPendingTransactionsSubscription(this).subscribe(callback); + return this.subscriptionsFactory.createNewPendingTransactionsSubscription( + this + ).subscribe(callback); + case 'syncing': - return this.subscriptionsFactory.createSyncingSubscriptionModel(this).subscribe(callback); + return this.subscriptionsFactory.createSyncingSubscriptionModel( + this + ).subscribe(callback); + default: throw Error('Unknown subscription: ' + type); } @@ -177,9 +187,9 @@ Eth.prototype.setProvider = function (provider) { this.accounts.setProvider(provider); this.personal.setProvider(provider); this.ens.setProvider(provider); - + this.initiatedContracts.forEach(function (contract) { - contract.setProvider(provider); + contract.setProvider(provider); }); }; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index e9892061af6..b083382fe6e 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -31,7 +31,7 @@ var AccountsPackage = require('web3-eth-accounts'); var PersonalPackage = require('web3-eth-personal'); var ENSPackage = require('web3-eth-ens'); var AbiPackage = require('web3-eth-abi'); -var SubscriptionsFactory = require('web3-core-subscription').SubscriptionsFactory; +var SubscriptionPackage = require('web3-core-subscription'); var ProvidersPackage = require('web3-core-providers'); var Iban = require('web3-eth-iban').Iban; var formatters = require('web3-core-helpers').formatters; @@ -52,9 +52,7 @@ module.exports = { * @returns {Eth} */ createEth: function (provider) { - var accounts = AccountsPackage.createAccounts(provider), - methodModelFactory = new MethodModelFactory(Utils, formatters, accounts), - methodController = MethodPackage.createMethodController(); + var accounts = AccountsPackage.createAccounts(provider); return new Eth( provider, @@ -68,9 +66,9 @@ module.exports = { Utils, formatters, ProvidersPackage, - new SubscriptionsFactory(Utils, formatters), - methodController, - methodModelFactory, + SubscriptionPackage.createSubscriptionsFactory(), + MethodPackage.createMethodController(), + new MethodModelFactory(Utils, formatters, accounts), BatchRequestPackage ); } diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 510c837eeb2..d4ded05d0f3 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -25,7 +25,7 @@ var version = require('./package.json'); var ProvidersPackage = require('web3-core-providers'); var MethodPackage = require('web3-core-method'); -var SubscriptionsFactory = require('web3-core-subscription').SubscriptionsFactory; +var SubscriptionPackage = require('web3-core-subscription'); var NetworkPackage = require('web3-net'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; @@ -50,7 +50,7 @@ module.exports = { ProvidersPackage, MethodPackage.createMethodController(), new MethodModelFactory(Utils, formatters), - new SubscriptionsFactory(Utils, formatters), + SubscriptionPackage.createSubscriptionsFactory(), NetworkPackage.createNetwork(provider) ); } From 8b1b4c9e75cff561519a0f19240863b6f58ba48c Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 4 Oct 2018 10:42:08 +0200 Subject: [PATCH 0187/1045] funcDoc updated --- .../lib/factories/AbstractMethodModelFactory.js | 2 +- packages/web3-core-method/lib/models/AbstractMethodModel.js | 2 +- packages/web3-core-method/src/index.js | 5 ++--- .../web3-core-method/src/models/methods/CallMethodModel.js | 2 +- .../src/models/methods/EstimateGasMethodModel.js | 2 +- .../src/models/methods/GetCodeMethodModel.js | 2 +- .../src/models/methods/GetPastLogsMethodModel.js | 2 +- .../src/models/methods/GetStorageAtMethodModel.js | 2 +- .../web3-core-method/src/models/methods/SignMethodModel.js | 2 +- .../src/models/methods/account/GetAccountsMethodModel.js | 2 +- .../src/models/methods/account/GetBalanceMethodModel.js | 2 +- .../models/methods/account/GetTransactionCountMethodModel.js | 2 +- .../src/models/methods/block/GetBlockMethodModel.js | 2 +- .../src/models/methods/block/GetBlockNumberMethodModel.js | 2 +- .../methods/block/GetBlockTransactionCountMethodModel.js | 2 +- .../models/methods/block/GetBlockUncleCountMethodModel.js | 2 +- .../src/models/methods/block/GetUncleMethodModel.js | 2 +- .../models/methods/network/GetProtocolVersionMethodModel.js | 2 +- .../src/models/methods/network/ListeningMethodModel.js | 2 +- .../src/models/methods/network/PeerCountMethodModel.js | 2 +- .../src/models/methods/network/VersionMethodModel.js | 2 +- .../src/models/methods/node/GetCoinbaseMethodModel.js | 2 +- .../src/models/methods/node/GetGasPriceMethodModel.js | 2 +- .../src/models/methods/node/GetHashrateMethodModel.js | 2 +- .../src/models/methods/node/GetNodeInfoMethodModel.js | 2 +- .../src/models/methods/node/GetWorkMethodModel.js | 2 +- .../src/models/methods/node/IsMiningMethodModel.js | 2 +- .../src/models/methods/node/IsSyncingMethodModel.js | 2 +- .../src/models/methods/node/SubmitWorkMethodModel.js | 2 +- .../src/models/methods/personal/EcRecoverMethodModel.js | 2 +- .../src/models/methods/personal/ImportRawKeyMethodModel.js | 2 +- .../src/models/methods/personal/ListAccountsMethodModel.js | 2 +- .../src/models/methods/personal/LockAccountMethodModel.js | 2 +- .../src/models/methods/personal/NewAccountMethodModel.js | 2 +- .../methods/personal/PersonalSendTransactionMethodModel.js | 2 +- .../src/models/methods/personal/PersonalSignMethodModel.js | 2 +- .../methods/personal/PersonalSignTransactionMethodModel.js | 2 +- .../src/models/methods/personal/UnlockAccountMethodModel.js | 2 +- .../src/models/methods/shh/AddPrivateKeyMethodModel.js | 2 +- .../src/models/methods/shh/AddSymKeyMethodModel.js | 2 +- .../src/models/methods/shh/DeleteKeyPairMethodModel.js | 2 +- .../src/models/methods/shh/DeleteMessageFilterMethodModel.js | 2 +- .../src/models/methods/shh/DeleteSymKeyMethodModel.js | 2 +- .../methods/shh/GenerateSymKeyFromPasswordMethodModel.js | 2 +- .../src/models/methods/shh/GetFilterMessagesMethodModel.js | 2 +- .../src/models/methods/shh/GetInfoMethodModel.js | 2 +- .../src/models/methods/shh/GetPrivateKeyMethodModel.js | 2 +- .../src/models/methods/shh/GetPublicKeyMethodModel.js | 2 +- .../src/models/methods/shh/GetSymKeyMethodModel.js | 2 +- .../src/models/methods/shh/HasKeyPairMethodModel.js | 2 +- .../src/models/methods/shh/HasSymKeyMethodModel.js | 2 +- .../src/models/methods/shh/MarkTrustedPeerMethodModel.js | 2 +- .../src/models/methods/shh/NewKeyPairMethodModel.js | 2 +- .../src/models/methods/shh/NewMessageFilterMethodModel.js | 2 +- .../src/models/methods/shh/NewSymKeyMethodModel.js | 2 +- .../src/models/methods/shh/PostMethodModel.js | 2 +- .../src/models/methods/shh/SetMaxMessageSizeMethodModel.js | 2 +- .../src/models/methods/shh/SetMinPoWMethodModel.js | 2 +- .../src/models/methods/shh/ShhVersionMethodModel.js | 2 +- .../transaction/GetTransactionFromBlockMethodModel.js | 2 +- .../models/methods/transaction/GetTransactionMethodModel.js | 2 +- .../methods/transaction/GetTransactionReceiptMethodModel.js | 2 +- .../methods/transaction/SendSignedTransactionMethodModel.js | 2 +- .../models/methods/transaction/SendTransactionMethodModel.js | 2 +- .../models/methods/transaction/SignTransactionMethodModel.js | 2 +- .../lib/models/AbstractSubscriptionModel.js | 2 +- .../src/factories/SubscriptionsFactory.js | 2 +- .../src/models/subscriptions/eth/LogSubscriptionModel.js | 2 +- .../models/subscriptions/eth/NewHeadsSubscriptionModel.js | 2 +- .../eth/NewPendingTransactionsSubscriptionModel.js | 2 +- .../src/models/subscriptions/eth/SyncingSubscriptionModel.js | 2 +- .../models/subscriptions/shh/MessagesSubscriptionModel.js | 2 +- packages/web3-eth-accounts/src/Accounts.js | 2 +- .../web3-eth-accounts/src/factories/MethodModelFactory.js | 2 +- packages/web3-eth-contract/src/Contract.js | 2 +- .../src/factories/ContractPackageFactory.js | 2 +- .../src/factories/EventSubscriptionFactory.js | 2 +- .../web3-eth-contract/src/factories/RpcMethodModelFactory.js | 2 +- packages/web3-eth-contract/src/mappers/ABIMapper.js | 2 +- .../web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js | 2 +- .../src/models/methods/CallContractMethodModel.js | 2 +- .../src/models/methods/ContractDeployMethodModel.js | 2 +- .../src/models/methods/SendContractMethodModel.js | 2 +- .../src/models/subscriptions/AllEventsLogSubscription.js | 2 +- .../src/models/subscriptions/EventLogSubscription.js | 2 +- .../src/validators/RpcMethodOptionsValidator.js | 2 +- packages/web3-eth-personal/src/Personal.js | 2 +- .../web3-eth-personal/src/factories/MethodModelFactory.js | 2 +- packages/web3-eth/src/Eth.js | 2 +- packages/web3-eth/src/factories/MethodModelFactory.js | 2 +- packages/web3-net/src/factories/MethodModelFactory.js | 2 +- packages/web3-shh/src/factories/MethodModelFactory.js | 2 +- 92 files changed, 93 insertions(+), 94 deletions(-) diff --git a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js index 0cc814ad8af..b700a711814 100644 --- a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js +++ b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js @@ -24,7 +24,7 @@ /** * @param {Object} methodModels - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 2c9dc3d2173..9b409a58577 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -25,7 +25,7 @@ /** * @param {String|Function} rpcMethod * @param {Number} parametersAmount - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 46e98347b51..cb5e812ce07 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -27,8 +27,7 @@ var version = require('./package.json'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); var PromiEventPackage = require('web3-core-promievent'); -var SubscriptionsFactory = require('web3-core-subscription').SubscriptionsFactory; -var Utils = require('web3-utils'); +var SubscriptionPackage = require('web3-core-subscription'); var formatters = require('web3-core-helpers').formatters; // Methods @@ -124,7 +123,7 @@ module.exports = { createMethodController: function () { return new MethodPackageFactory().createMethodController( PromiEventPackage, - new SubscriptionsFactory(Utils, formatters), + SubscriptionPackage.createSubscriptionsFactory(), formatters ); }, diff --git a/packages/web3-core-method/src/models/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js index 89ab00e4836..f2d4425b882 100644 --- a/packages/web3-core-method/src/models/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index e982456c627..b7ddd8cfc31 100644 --- a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index ffdd3c09aaa..b7737ece91d 100644 --- a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index b6864d998ed..7857633b9c4 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index 8f0ea0df40a..a93445d2a9f 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js index 1db45bdfca6..8740eed0643 100644 --- a/packages/web3-core-method/src/models/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {Accounts} accounts * diff --git a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js index 0e744074b50..0bcb703be84 100644 --- a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index 6292db16be8..583e06c89b1 100644 --- a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index 932e59f0ea8..edb6f0fccf0 100644 --- a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index 887b1820c9c..be5a06ca483 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js index ac330105c7b..c6e364cd7ee 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index 214793d3f52..3bb47b3d341 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index 0a566a2f5f9..6f926dc15fc 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index ce8ae8bf9e9..bbab674188b 100644 --- a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js index 87deeebd483..247f6a93c76 100644 --- a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js index af1d9a9013e..fa2d1ed2be2 100644 --- a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js index 0d5a96c331f..bcb18b27e17 100644 --- a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js index 62345ce67c7..c315f8237d1 100644 --- a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js index d21e9ccfb14..fd5af51d026 100644 --- a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js index b8bc1fc239a..1a2b8f0197c 100644 --- a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js index d3d6055d823..e0ee786ac45 100644 --- a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js index 4bca61e5cd0..fdb451d87cb 100644 --- a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js index 9c7a0748586..b7b44133c5e 100644 --- a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js index 8ca563db190..1c40464d48f 100644 --- a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js index bf5c35c882b..f9009045338 100644 --- a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js index 198ebc1f0ed..a124062b6e0 100644 --- a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index f4786f5ca19..b6d64beefce 100644 --- a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js index f51224a1434..57366ad247b 100644 --- a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js index 943b2e0cd0f..372fdeca01a 100644 --- a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index c426561bacf..27c7e1257b9 100644 --- a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js index dc2d2873f60..e1f31504b42 100644 --- a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index 1d7f939466a..423ff074270 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index 724c0c21a1a..54d43ba0d50 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js index bc80e49b30c..76d7c40c44b 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index 2e960632c54..d7a1f45acaf 100644 --- a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js index ef1cbee78e1..5637f30de11 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js index 215b3c5cfe9..4ddab44dca0 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js index 6e937872a0a..328afec0ee4 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js index 021c079d2b5..61483b91391 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js index 3e6057a59a4..af6977c9202 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js index c0ed565fd68..baa7921d4f1 100644 --- a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js index 0efdb7da6bd..7adcc574c97 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js index b4bede65154..27f80118fab 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js index 779136c3800..99b6753b491 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js index 9d5a3334f1b..06c6438e62c 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js index 4380f344684..42f7ff0f0d3 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js index 6a6adcdf3f7..1e72e2e6095 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js index 344fb988be7..18298df976b 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js index ca8f7a3f8df..3a9dcdb362a 100644 --- a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js index 3d7c28fd0ac..f1fb1279a99 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js index 436dbe9b175..d977904bd81 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js index f27661d067e..5710b97ed3d 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js index a01896f48a3..44bea28aa9d 100644 --- a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js index eadc83739c6..309d9681d5b 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js index 81ee9b6d70b..b6d8e58fad2 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js index 7dceb51d0d0..5b2f5600af3 100644 --- a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index 79f61f6cb87..316667001b9 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js index 4d7476c2eed..160775a586a 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js index 42b950dc339..37dea0dca75 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js index 7c830fd3b7a..e0073d47fbd 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index f1c07b6fe4e..81cde1dd899 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {Accounts} accounts * diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index cbf8576c7e7..90f86c1285f 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -25,7 +25,7 @@ var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js index 4dee44356e6..1a931967c03 100644 --- a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js +++ b/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js @@ -26,7 +26,7 @@ * @param {String} subscriptionType * @param {String} subscriptionMethod * @param {Object} options - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js index be4e7903c9d..80463510849 100644 --- a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js +++ b/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js @@ -30,7 +30,7 @@ var SyncingSubscriptionModel = require('../models/subscriptions/eth/SyncingSubsc var MessagesSubscriptionModel = require('../models/subscriptions/shh/MessagesSubscriptionModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js index 11e44d0d7bc..50ddc022905 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -26,7 +26,7 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscrip /** * @param {Object} options - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {GetPastLogsMethodModel} getPastLogsMethodModel * @param {MethodController} methodController diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js index 749b2502358..3458e3169fd 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js @@ -25,7 +25,7 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js index 3155799c71b..4490ea35348 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js @@ -25,7 +25,7 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js index 9315c9786af..75aeeee1438 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -25,7 +25,7 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js b/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js index ba4100d3b7a..1788d02705f 100644 --- a/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js +++ b/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js @@ -26,7 +26,7 @@ var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscrip /** * @param {Object} options - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 7e3e25ab9d4..1f1681ed9a6 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -58,7 +58,7 @@ var makeEven = function (hex) { * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js index a29e839aefa..29caae4996d 100644 --- a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -25,7 +25,7 @@ var web3CoreMethod = require('web3-core-method'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index d94e682385d..eee507ef560 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -32,7 +32,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {ContractPackageFactory} contractPackageFactory * @param {PromiEventPackage} promiEventPackage * @param {ABICoder} abiCoder - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {Accounts} accounts * @param {ABIMapper} abiMapper diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index ff036b8b285..f7062cd2564 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -41,7 +41,7 @@ var RpcMethodFactory = require('../factories/RpcMethodFactory'); var EventSubscriptionFactory = require('../factories/EventSubscriptionFactory'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {ABICoder} abiCoder * @param {Accounts} accounts diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js index 434e3d343bd..70fe83c6d3c 100644 --- a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js @@ -28,7 +28,7 @@ var EventLogSubscription = require('../models/subscriptions/EventLogSubscription var AllEventsLogSubscription = require('../models/subscriptions/AllEventsLogSubscription'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {MethodController} methodController * diff --git a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js index aaf687e89ca..ffbd835996e 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js @@ -31,7 +31,7 @@ var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; /** * @param {CallMethodResponseDecoder} callMethodResponseDecoder * @param {Accounts} accounts - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-eth-contract/src/mappers/ABIMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js index 25953474d9b..019a8941689 100644 --- a/packages/web3-eth-contract/src/mappers/ABIMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -25,7 +25,7 @@ /** * @param {ContractPackageFactory} contractPackageFactory * @param {ABICoder} abiCoder - * @param {Utils} utils + * @param {Object} utils * * @constructor */ diff --git a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js index 5fc63f1ce9e..3bb78a835f6 100644 --- a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js @@ -23,7 +23,7 @@ "use strict"; /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js index 7777cadcbe6..b42f324d20c 100644 --- a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -27,7 +27,7 @@ var CallMethodModel = require('web3-core-method').CallMethodModel; /** * @param {ABIItemModel} abiItemModel * @param {CallMethodResponseDecoder} callMethodResponseDecoder - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js index d0774b10f5c..42d6937eec3 100644 --- a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js @@ -26,7 +26,7 @@ var SendTransactionMethodModel = require('web3-core-method').SendTransactionMeth /** * @param {Contract} contract - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {Accounts} accounts * diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js index d574e67d296..cc64f1337ef 100644 --- a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -27,7 +27,7 @@ var SendTransactionMethodModel = require('web3-core-method').SendTransactionMeth /** * @param {ABIItemModel} abiItemModel * @param {AllEventsLogDecoder} allEventsLogDecoder - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {Accounts} accounts * diff --git a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js index 390c598a436..e86cc03ffb0 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js @@ -26,7 +26,7 @@ var LogSubscriptionModel = require('web3-core-subscription').LogSubscriptionMode /** * @param {Object} options - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {GetPastLogsMethodModel} getPastLogsMethodModel * @param {MethodController} methodController diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index ebf1416a3ae..997124d07dc 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -27,7 +27,7 @@ var LogSubscriptionModel = require('web3-core-subscription').LogSubscriptionMode /** * @param {ABIItemModel} abiItemModel * @param {Object} options - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {GetPastLogsMethodModel} getPastLogsMethodModel * @param {MethodController} methodController diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js index 3b01f8e8043..f1fbfafb734 100644 --- a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -25,7 +25,7 @@ var _ = require('underscore'); /** - * @param {Utils} utils + * @param {Object} utils * * @constructor */ diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index eab3c4129f0..dabe68e95f7 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -32,7 +32,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {Network} net - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index b18a6abe918..e1e3aa8d95c 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -25,7 +25,7 @@ var web3CoreMethod = require('web3-core-method'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index e5dc740247a..beaa43a2214 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -34,7 +34,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {Iban} iban * @param {Abi} abi * @param {ENS} ens - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {ProvidersPackage} providersPackage * @param {SubscriptionsFactory} subscriptionsFactory diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index dfa9e2512e4..70720e61e47 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -25,7 +25,7 @@ var web3CoreMethod = require('web3-core-method'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * @param {Accounts} accounts * diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index 6663ed5ac8e..0210c49e6c6 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -25,7 +25,7 @@ var web3CoreMethod = require('web3-core-method'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor diff --git a/packages/web3-shh/src/factories/MethodModelFactory.js b/packages/web3-shh/src/factories/MethodModelFactory.js index 1db97939d4b..d67b2ecf080 100644 --- a/packages/web3-shh/src/factories/MethodModelFactory.js +++ b/packages/web3-shh/src/factories/MethodModelFactory.js @@ -25,7 +25,7 @@ var web3CoreMethod = require('web3-core-method'); /** - * @param {Utils} utils + * @param {Object} utils * @param {Object} formatters * * @constructor From 812ebe7c2e12ba96785a386b186adbf776cf5d52 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 4 Oct 2018 11:57:12 +0200 Subject: [PATCH 0188/1045] callback handling updated --- .../lib/commands/AbstractSendMethodCommand.js | 10 ++++++++-- .../lib/models/AbstractMethodModel.js | 14 ++++++------- .../src/commands/CallMethodCommand.js | 5 ++++- .../src/commands/SignAndSendMethodCommand.js | 5 ++++- .../src/commands/SignMessageCommand.js | 4 +++- .../src/watchers/NewHeadsWatcher.js | 8 ++++---- .../TransactionConfirmationWorkflow.js | 20 ++++++++++++++----- .../src/Subscription.js | 9 +++++++-- 8 files changed, 52 insertions(+), 23 deletions(-) diff --git a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js index 9d4452eb664..10d45964341 100644 --- a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js +++ b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js @@ -81,12 +81,18 @@ AbstractSendMethodCommand.prototype.sendMethod = function (methodModel, promiEve ); promiEvent.eventEmitter.emit('transactionHash', response); - methodModel.callback(false, response); + + if (methodModel.callback) { + methodModel.callback(false, response); + } }).catch(function (error) { promiEvent.reject(error); promiEvent.on('error', error); promiEvent.eventEmitter.removeAllListeners(); - methodModel.callback(error, null); + + if (methodModel.callback) { + methodModel.callback(error, null); + } }); }; diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 9b409a58577..99e63a60ff6 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -99,23 +99,23 @@ AbstractMethodModel.prototype.request = function () { * @returns {Object} */ AbstractMethodModel.prototype.mapFunctionArguments = function (args) { - var parameters = args; - var callback = null; + var parameters = args, + callback = false; - if (arguments.length < this.parametersAmount) { + if (args.length < this.parametersAmount) { throw new Error( - 'Arguments length is not correct: expected: ' + this.parametersAmount + ', given: ' + arguments.length + 'Arguments length is not correct: expected: ' + this.parametersAmount + ', given: ' + args.length ); } - if (arguments.length > this.parametersAmount) { - callback = arguments.slice(-1); + if (args.length > this.parametersAmount) { + callback = args.slice(-1); if(!_.isFunction(callback)) { throw new Error( 'The latest parameter should be a function otherwise it can not be used as callback' ); } - parameters = arguments.slice(0, -1); + parameters = args.slice(0, -1); } return { diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 5251a778bb3..05a340d7c06 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -47,7 +47,10 @@ CallMethodCommand.prototype.execute = function (web3Package, methodModel) { ).then(function (response) { var mappedResponse = methodModel.afterExecution(response); - methodModel.callback(mappedResponse); + if (methodModel.callback) { + methodModel.callback(mappedResponse); + } + return mappedResponse; }); }; diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index 4495f7d8c71..a144642a19f 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -64,7 +64,10 @@ SignAndSendMethodCommand.prototype.execute = function ( promiEvent.reject(error); promiEvent.on('error', error); promiEvent.eventEmitter.removeAllListeners(); - methodModel.callback(error, null); + + if (methodModel.callback) { + methodModel.callback(error, null); + } }); return promiEvent; diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js index c54ad131b34..c072e057cea 100644 --- a/packages/web3-core-method/src/commands/SignMessageCommand.js +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -51,7 +51,9 @@ SignMessageCommand.prototype.execute = function (methodModel, accounts) { throw error; } - methodModel.callback(null, signedMessage); + if (methodModel.callback) { + methodModel.callback(null, signedMessage); + } return signedMessage; }; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 9ab96f1513b..8d1aa5b07c9 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -47,11 +47,11 @@ NewHeadsWatcher.prototype.watch = function (web3Package) { var self = this; if (web3Package.currentProvider instanceof SocketProviderAdapter) { - this.confirmationSubscription = this.subscriptionsFactory.createNewHeadsSubscription(web3Package).subscribe( - function () { + this.confirmationSubscription = this.subscriptionsFactory + .createNewHeadsSubscription(web3Package) + .subscribe(function () { self.emit('newHead'); - } - ); + }); return this; } diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index e28f34299d3..6d8ff20d930 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -96,9 +96,12 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3P } promiEvent.reject(validationResult); - promiEvent.eventEmitter.emit('error', validationResult, receipt); + promiEvent.eventEmitter.emit('error', [validationResult, receipt]); promiEvent.eventEmitter.removeAllListeners(); - methodModel.callback(validationResult, null); + + if (methodModel.callback) { + methodModel.callback(validationResult, null); + } }); return; @@ -148,7 +151,10 @@ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt promiEvent.resolve(methodModel.afterExecution(receipt)); promiEvent.eventEmitter.emit('receipt', receipt); promiEvent.eventEmitter.removeAllListeners(); - methodModel.callback(false, receipt); + + if (methodModel.callback) { + methodModel.callback(false, receipt); + } return; } @@ -159,7 +165,9 @@ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt promiEvent.eventEmitter.emit('receipt', mappedReceipt); promiEvent.eventEmitter.removeAllListeners(); - methodModel.callback(false, mappedReceipt); + if (methodModel.callback) { + methodModel.callback(false, mappedReceipt); + } }; /** @@ -180,7 +188,9 @@ TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, me promiEvent.eventEmitter.emit('error', error); promiEvent.eventEmitter.removeAllListeners(); - methodModel.callback(error, null); + if (methodModel.callback) { + methodModel.callback(error, null); + } }; module.exports = TransactionConfirmationWorkflow; diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 33007a15406..0d1d59a373e 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -129,7 +129,9 @@ Subscription.prototype.reconnect = function (callback) { self.unsubscribe().then(function () { self.subscribe(callback); }).catch(function (error) { - callback(error, null); + if(_.isFunction(callback)) { + callback(error, null); + } }); }); }; @@ -155,7 +157,10 @@ Subscription.prototype.unsubscribe = function (callback) { if (!response) { self.subscriptionId = null; - callback(true, false); + + if(_.isFunction(callback)) { + callback(true, false); + } return true; } From 79639a46b60f3e39aade4eaffb4040645039a657 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 4 Oct 2018 11:58:37 +0200 Subject: [PATCH 0189/1045] Subscription emit error added to reconnect method --- packages/web3-core-subscription/src/Subscription.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscription/src/Subscription.js index 0d1d59a373e..4bd583e36e5 100644 --- a/packages/web3-core-subscription/src/Subscription.js +++ b/packages/web3-core-subscription/src/Subscription.js @@ -73,6 +73,7 @@ Subscription.prototype.subscribe = function (callback) { if (_.isFunction(callback)) { callback(error, null); } + self.emit('error', error); }); }); @@ -99,6 +100,7 @@ Subscription.prototype.handleSubscriptionResponse = function (response, callback var formattedOutput = this.subscriptionModel.onNewSubscriptionItem(this, item); this.emit('data', formattedOutput); + if (_.isFunction(callback)) { callback(false, formattedOutput); } @@ -129,6 +131,8 @@ Subscription.prototype.reconnect = function (callback) { self.unsubscribe().then(function () { self.subscribe(callback); }).catch(function (error) { + self.emit('error', error); + if(_.isFunction(callback)) { callback(error, null); } From 758aec182854d95fc45e2396f7377db70081373f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 4 Oct 2018 17:02:06 +0200 Subject: [PATCH 0190/1045] POC ENS package --- .../TransactionConfirmationWorkflow.js | 2 +- .../src/proxies/MethodsProxy.js | 11 +- packages/web3-eth-ens/src/config.js | 2 +- .../web3-eth-ens/src/contracts/Registry.js | 114 +++++------ .../web3-eth-ens/src/contracts/Resolver.js | 85 ++++++++ .../src/detector/ENSNetworkDetector.js | 76 +++++++ .../src/factories/ENSPackageFactory.js | 99 +++++++++ .../src/lib/ResolverMethodHandler.js | 189 ------------------ .../src/proxies/ContractMethodsProxy.js | 13 ++ 9 files changed, 330 insertions(+), 261 deletions(-) create mode 100644 packages/web3-eth-ens/src/contracts/Resolver.js create mode 100644 packages/web3-eth-ens/src/detector/ENSNetworkDetector.js create mode 100644 packages/web3-eth-ens/src/factories/ENSPackageFactory.js delete mode 100644 packages/web3-eth-ens/src/lib/ResolverMethodHandler.js create mode 100644 packages/web3-eth-ens/src/proxies/ContractMethodsProxy.js diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 6d8ff20d930..519f2c8666f 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -96,7 +96,7 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3P } promiEvent.reject(validationResult); - promiEvent.eventEmitter.emit('error', [validationResult, receipt]); + promiEvent.eventEmitter.emit('error', validationResult, receipt); promiEvent.eventEmitter.removeAllListeners(); if (methodModel.callback) { diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 81344216aa4..ce46242b187 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -69,8 +69,11 @@ function MethodsProxy( * @returns {Function|Error} */ MethodsProxy.prototype.proxyHandler = function (target, name) { - var abiItemModel = this.abiModel.getMethod(name); + if (target[name]) { + return this[name]; + } + var abiItemModel = this.abiModel.getMethod(name); if (abiItemModel) { var requestType = abiItemModel.requestType; if (requestType === 'contract-deployment') { @@ -82,7 +85,7 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { // Because of the possibility to overwrite the contract data if I call contract.deploy() have I to check // here if it is a contract deployment. If this call is a contract deployment then I have to set the right - // contract data and to map the arguments. TODO: Change API or improve this + // contract data and to map the arguments. if (requestType === 'contract-deployment') { if (arguments[0]['data']) { target.contract.options.data = target.contract.options.data || arguments[0]['data']; @@ -115,10 +118,6 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { }; } - if (target[name]) { - return this[name]; - } - throw Error('Method with name "' + name + '" not found'); }; diff --git a/packages/web3-eth-ens/src/config.js b/packages/web3-eth-ens/src/config.js index 7656840b3a0..d67da380b8e 100644 --- a/packages/web3-eth-ens/src/config.js +++ b/packages/web3-eth-ens/src/config.js @@ -1,6 +1,6 @@ "use strict"; -var config = { +var config = { // TODO: Move this in to the ENSNetworkDetector addresses: { main: "0x314159265dD8dbb310642f98f50C066173C1259b", ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index bb60ce78e84..544f1121cef 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -13,7 +13,6 @@ */ /** * @file Registry.js - * * @author Samuel Furter * @date 2018 */ @@ -21,80 +20,67 @@ "use strict"; var _ = require('underscore'); -var Contract = require('web3-eth-contract'); -var namehash = require('eth-ens-namehash'); -var PromiEvent = require('web3-core-promievent'); +var Contract = require('web3-eth-contract').Contract; var REGISTRY_ABI = require('../ressources/ABI/Registry'); -var RESOLVER_ABI = require('../ressources/ABI/Resolver'); /** * A wrapper around the ENS registry contract. * - * @method Registry - * @param {Ens} ens + * @param {ENSNetworkDetector} ensNetworkDetector + * @param {*} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {BatchRequestPackage} batchRequestPackage + * @param {ContractPackageFactory} contractPackageFactory + * @param {PromiEventPackage} promiEventPackage + * @param {ABICoder} abiCoder + * @param {Object} utils + * @param {Object}formatters + * @param {Accounts} accounts + * @param {ABIMapper} abiMapper + * @param {Object} options + * * @constructor */ -function Registry(ens) { - var self = this; - this.ens = ens; - this.contract = ens.checkNetwork().then(function (address) { - var contract = new Contract(REGISTRY_ABI, address); - contract.setProvider(self.ens.eth.currentProvider); +function Registry( + ensNetworkDetector, + provider, + providersPackage, + methodController, + batchRequestPackage, + contractPackageFactory, + promiEventPackage, + abiCoder, + utils, + formatters, + accounts, + abiMapper, + options +) { + Contract.call(this, + provider, + providersPackage, + methodController, + batchRequestPackage, + contractPackageFactory, + promiEventPackage, + abiCoder, + utils, + formatters, + accounts, + abiMapper, + REGISTRY_ABI, + null, + options + ); - return contract; + ensNetworkDetector.detect().then(function (address) { + self.options.address = address; }); } -/** - * Returns the address of the owner of an ENS name. - * - * @method owner - * @param {String} name - * @param {function} callback - * @return {Promise} - */ -Registry.prototype.owner = function (name, callback) { - var promiEvent = new PromiEvent(true); - - this.contract.then(function (contract) { - contract.methods.owner(namehash.hash(name)).call() - .then(function (receipt) { - promiEvent.resolve(receipt); - - if (_.isFunction(callback)) { - callback(receipt); - } - }) - .catch(function (error) { - promiEvent.reject(error); - - if (_.isFunction(callback)) { - callback(error); - } - }); - }); - - return promiEvent.eventEmitter; -}; - -/** - * Returns the resolver contract associated with a name. - * - * @method resolver - * @param {String} name - * @return {Promise} - */ -Registry.prototype.resolver = function (name) { - var self = this; - - return this.contract.then(function (contract) { - return contract.methods.resolver(namehash.hash(name)).call(); - }).then(function (address) { - var contract = new Contract(RESOLVER_ABI, address); - contract.setProvider(self.ens.eth.currentProvider); - return contract; - }); -}; +Registry.prototype = Object.create(Contract.prototype); +Registry.prototype.constructor = Registry; module.exports = Registry; diff --git a/packages/web3-eth-ens/src/contracts/Resolver.js b/packages/web3-eth-ens/src/contracts/Resolver.js new file mode 100644 index 00000000000..2eeda808be0 --- /dev/null +++ b/packages/web3-eth-ens/src/contracts/Resolver.js @@ -0,0 +1,85 @@ +/* + 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 . +*/ +/** + * @file Registry.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var Contract = require('web3-eth-contract').Contract; +var RESOLVER_ABI = require('../ressources/ABI/Resolver'); + + +/** + * A wrapper around the ENS resolver contract. + * + * @param {ENSNetworkDetector} ensNetworkDetector + * @param {*} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {BatchRequestPackage} batchRequestPackage + * @param {ContractPackageFactory} contractPackageFactory + * @param {PromiEventPackage} promiEventPackage + * @param {ABICoder} abiCoder + * @param {Object} utils + * @param {Object}formatters + * @param {Accounts} accounts + * @param {ABIMapper} abiMapper + * @param {Object} options + * + * @constructor + */ +function Resolver( + ensNetworkDetector, + provider, + providersPackage, + methodController, + batchRequestPackage, + contractPackageFactory, + promiEventPackage, + abiCoder, + utils, + formatters, + accounts, + abiMapper, + options +) { + Contract.call(this, + provider, + providersPackage, + methodController, + batchRequestPackage, + contractPackageFactory, + promiEventPackage, + abiCoder, + utils, + formatters, + accounts, + abiMapper, + RESOLVER_ABI, + null, + options + ); + + ensNetworkDetector.detect().then(function (address) { + self.options.address = address; + }); +} + +Resolver.prototype = Object.create(Contract.prototype); +Resolver.prototype.constructor = Resolver; + +module.exports = Resolver; diff --git a/packages/web3-eth-ens/src/detector/ENSNetworkDetector.js b/packages/web3-eth-ens/src/detector/ENSNetworkDetector.js new file mode 100644 index 00000000000..555a426638d --- /dev/null +++ b/packages/web3-eth-ens/src/detector/ENSNetworkDetector.js @@ -0,0 +1,76 @@ +/* + 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 . + */ +/** + * @file ENSNetworkDetector.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +/** + * @param {MethodController} methodController + * @param {Accounts} accounts + * @param {AbstractWeb3Object} web3Package + * @param {GetLatestBlockMethodModel} getLatestBlockMethodModel + * @param {GetNetworkTypeMethodModel} getNetworkTypeMethodModel + * + * @constructor + */ +function ENSNetworkDetector(methodController, accounts, web3Package, getLatestBlockMethodModel, getNetworkTypeMethodModel) { + this.methodController = methodController; + this.accounts = accounts; + this.web3Package = web3Package; + this.getLatestBlockMethodModel = getLatestBlockMethodModel; + this.getNetworkTypeMethodModel = getNetworkTypeMethodModel; + + this.addresses = { + main: "0x314159265dD8dbb310642f98f50C066173C1259b", + ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", + rinkeby: "0xe7410170f87102df0055eb195163a03b7f2bff4a" + }; +} + +/** + * Detects the current registry address of ENS and throws an error if the network is not supported. + * + * @method detect + * + * @returns {Promise} + */ +ENSNetworkDetector.prototype.detect = function () { + var self = this; + + return this.methodController.execute(this.getLatestBlockMethodModel, this.accounts, this.web3Package).then(function (block) { + var headAge = new Date() / 1000 - block.timestamp; + + if (headAge > 3600) { + throw new Error("Network not synced; last block was " + headAge + " seconds ago"); + } + + return self.methodController.execute(this.getNetworkTypeMethodModel, self.accounts, self.web3Package); + }).then(function (networkType) { + var addr = self.addresses[networkType]; + if (typeof addr === 'undefined') { + throw new Error("ENS is not supported on network " + networkType); + } + + return addr; + }); +}; + +module.exports = ENSNetworkDetector; diff --git a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js new file mode 100644 index 00000000000..c0c48a57079 --- /dev/null +++ b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js @@ -0,0 +1,99 @@ +/* + 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 . +*/ +/** + * @file Registry.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var Registry = require('../contracts/Registry'); +var Resolver = require('../contracts/Resolver'); +var AccountsPackage = require('web3-eth-accounts'); +var ContractPackage = require('web3-eth-contract'); +var ABIPackage = require('web3-eth-abi'); +var PromiEventPackage = require('web3-core-promievent'); +var BatchRequestPackage = require('web3-core-batch'); +var MethodPackage = require('web3-core-method'); +var ProvidersPackage = require('web3-core-providers'); +var Utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; + +function ENSPackageFactory() { + +} + +/** + * Returns an object of type Registry + * + * @method createRegistry + * + * @param {AbstractProviderAdapter} provider + * @param {Object} contractOptions + * + * @returns {Registry} + */ +ENSPackageFactory.prototype.createRegistry = function (provider, contractOptions) { + return new Registry( + this.createENSNetworkDetector(), + provider, + ProvidersPackage, + MethodPackage.createMethodController(), + BatchRequestPackage, + ContractPackage.createContractPackageFactory(), + PromiEventPackage, + ABIPackage.createAbiCoder(), + Utils, + formatters, + AccountsPackage.createAccounts(), + ContractPackage.createABIMapper(), + contractOptions + ); +}; + +/** + * Returns an object of type Resolver + * + * @method createResolver + * + * @param {AbstractProviderAdapter} provider + * @param {Object} contractOptions + * + * @returns {Resolver} + */ +ENSPackageFactory.prototype.createResolver = function (provider, contractOptions) { + return new Resolver( + this.createENSNetworkDetector(), + provider, + ProvidersPackage, + MethodPackage.createMethodController(), + BatchRequestPackage, + ContractPackage.createContractPackageFactory(), + PromiEventPackage, + ABIPackage.createAbiCoder(), + Utils, + formatters, + AccountsPackage.createAccounts(), + ContractPackage.createABIMapper(), + contractOptions + ); +}; + +ENSPackageFactory.prototype.createENS = function () { +}; + +ENSPackageFactory.prototype.createENSNetworkDetector = function () { + +}; diff --git a/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js b/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js deleted file mode 100644 index a1bfe7297cc..00000000000 --- a/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js +++ /dev/null @@ -1,189 +0,0 @@ -/* - 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 . -*/ -/** - * @file ResolverMethodHandler.js - * - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var PromiEvent = require('web3-core-promievent'); -var namehash = require('eth-ens-namehash'); -var _ = require('underscore'); - -/** - * @param {Registry} registry - * @constructor - */ -function ResolverMethodHandler(registry) { - this.registry = registry; -} - -/** - * Executes an resolver method and returns an eventifiedPromise - * - * @param {String} ensName - * @param {String} methodName - * @param {Array} methodArguments - * @param {function} callback - * @returns {Object} - */ -ResolverMethodHandler.prototype.method = function (ensName, methodName, methodArguments, callback) { - return { - call: this.call.bind({ - ensName: ensName, - methodName: methodName, - methodArguments: methodArguments, - callback: callback, - parent: this - }), - send: this.send.bind({ - ensName: ensName, - methodName: methodName, - methodArguments: methodArguments, - callback: callback, - parent: this - }) - }; -}; - -/** - * Executes call - * - * @returns {eventifiedPromise} - */ -ResolverMethodHandler.prototype.call = function (callback) { - var self = this; - var promiEvent = new PromiEvent(); - var preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); - - this.parent.registry.resolver(this.ensName).then(function (resolver) { - self.parent.handleCall(promiEvent, resolver.methods[self.methodName], preparedArguments, callback); - }).catch(function (error) { - promiEvent.reject(error); - }); - - return promiEvent.eventEmitter; -}; - - -/** - * Executes send - * - * @param {Object} sendOptions - * @param {function} callback - * @returns {eventifiedPromise} - */ -ResolverMethodHandler.prototype.send = function (sendOptions, callback) { - var self = this; - var promiEvent = new PromiEvent(); - var preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); - - this.parent.registry.resolver(this.ensName).then(function (resolver) { - self.parent.handleSend(promiEvent, resolver.methods[self.methodName], preparedArguments, sendOptions, callback); - }).catch(function (error) { - promiEvent.reject(error); - }); - - return promiEvent.eventEmitter; -}; - -/** - * Handles a call method - * - * @param {eventifiedPromise} promiEvent - * @param {function} method - * @param {Array} preparedArguments - * @param {function} callback - * @returns {eventifiedPromise} - */ -ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, preparedArguments, callback) { - method.apply(this, preparedArguments).call() - .then(function (receipt) { - promiEvent.resolve(receipt); - - if (_.isFunction(callback)) { - callback(receipt); - } - }).catch(function (error) { - promiEvent.reject(error); - - if (_.isFunction(callback)) { - callback(error); - } - }); - - return promiEvent; -}; - -/** - * Handles a send method - * - * @param {eventifiedPromise} promiEvent - * @param {function} method - * @param {Array} preparedArguments - * @param {Object} sendOptions - * @param {function} callback - * @returns {eventifiedPromise} - */ -ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, preparedArguments, sendOptions, callback) { - method.apply(this, preparedArguments).send(sendOptions) - .on('transactionHash', function (hash) { - promiEvent.eventEmitter.emit('transactionHash', hash); - }) - .on('confirmation', function (confirmationNumber, receipt) { - promiEvent.eventEmitter.emit('confirmation', confirmationNumber, receipt); - }) - .on('receipt', function (receipt) { - promiEvent.eventEmitter.emit('receipt', receipt); - promiEvent.resolve(receipt); - - if (_.isFunction(callback)) { - callback(receipt); - } - }) - .on('error', function (error) { - promiEvent.eventEmitter.emit('error', error); - promiEvent.reject(error); - - if (_.isFunction(callback)) { - callback(error); - } - }); - - return promiEvent; -}; - -/** - * Adds the ENS node to the arguments - * - * @param {String} name - * @param {Array} methodArguments - * @returns {Array} - */ -ResolverMethodHandler.prototype.prepareArguments = function (name, methodArguments) { - var node = namehash.hash(name); - - if (methodArguments.length > 0) { - methodArguments.unshift(node); - - return methodArguments; - } - - return [node]; -}; - -module.exports = ResolverMethodHandler; diff --git a/packages/web3-eth-ens/src/proxies/ContractMethodsProxy.js b/packages/web3-eth-ens/src/proxies/ContractMethodsProxy.js new file mode 100644 index 00000000000..664467a4c3c --- /dev/null +++ b/packages/web3-eth-ens/src/proxies/ContractMethodsProxy.js @@ -0,0 +1,13 @@ + +var MethodsProxy = require('web3-eth-contract').MethodsProxy; + +function ContractMethodsProxy() { + MethodsProxy.call(this, ); +} + +ContractMethodsProxy.prototype.proxyHandler = function(target, name) { + // overwrite method because of namehash +}; + +ContractMethodsProxy.prototype = Object.create(MethodsProxy); +ContractMethodsProxy.prototype.constructor = ContractMethodsProxy; From c0b70024a222f76a46153ee964c0b4f3bb80cece Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 09:48:17 +0200 Subject: [PATCH 0191/1045] Revert "POC ENS package" This reverts commit 758aec182854d95fc45e2396f7377db70081373f. --- .../TransactionConfirmationWorkflow.js | 2 +- .../src/proxies/MethodsProxy.js | 11 +- packages/web3-eth-ens/src/config.js | 2 +- .../web3-eth-ens/src/contracts/Registry.js | 114 ++++++----- .../web3-eth-ens/src/contracts/Resolver.js | 85 -------- .../src/detector/ENSNetworkDetector.js | 76 ------- .../src/factories/ENSPackageFactory.js | 99 --------- .../src/lib/ResolverMethodHandler.js | 189 ++++++++++++++++++ .../src/proxies/ContractMethodsProxy.js | 13 -- 9 files changed, 261 insertions(+), 330 deletions(-) delete mode 100644 packages/web3-eth-ens/src/contracts/Resolver.js delete mode 100644 packages/web3-eth-ens/src/detector/ENSNetworkDetector.js delete mode 100644 packages/web3-eth-ens/src/factories/ENSPackageFactory.js create mode 100644 packages/web3-eth-ens/src/lib/ResolverMethodHandler.js delete mode 100644 packages/web3-eth-ens/src/proxies/ContractMethodsProxy.js diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 519f2c8666f..6d8ff20d930 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -96,7 +96,7 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3P } promiEvent.reject(validationResult); - promiEvent.eventEmitter.emit('error', validationResult, receipt); + promiEvent.eventEmitter.emit('error', [validationResult, receipt]); promiEvent.eventEmitter.removeAllListeners(); if (methodModel.callback) { diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index ce46242b187..81344216aa4 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -69,11 +69,8 @@ function MethodsProxy( * @returns {Function|Error} */ MethodsProxy.prototype.proxyHandler = function (target, name) { - if (target[name]) { - return this[name]; - } - var abiItemModel = this.abiModel.getMethod(name); + if (abiItemModel) { var requestType = abiItemModel.requestType; if (requestType === 'contract-deployment') { @@ -85,7 +82,7 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { // Because of the possibility to overwrite the contract data if I call contract.deploy() have I to check // here if it is a contract deployment. If this call is a contract deployment then I have to set the right - // contract data and to map the arguments. + // contract data and to map the arguments. TODO: Change API or improve this if (requestType === 'contract-deployment') { if (arguments[0]['data']) { target.contract.options.data = target.contract.options.data || arguments[0]['data']; @@ -118,6 +115,10 @@ MethodsProxy.prototype.proxyHandler = function (target, name) { }; } + if (target[name]) { + return this[name]; + } + throw Error('Method with name "' + name + '" not found'); }; diff --git a/packages/web3-eth-ens/src/config.js b/packages/web3-eth-ens/src/config.js index d67da380b8e..7656840b3a0 100644 --- a/packages/web3-eth-ens/src/config.js +++ b/packages/web3-eth-ens/src/config.js @@ -1,6 +1,6 @@ "use strict"; -var config = { // TODO: Move this in to the ENSNetworkDetector +var config = { addresses: { main: "0x314159265dD8dbb310642f98f50C066173C1259b", ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index 544f1121cef..bb60ce78e84 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -13,6 +13,7 @@ */ /** * @file Registry.js + * * @author Samuel Furter * @date 2018 */ @@ -20,67 +21,80 @@ "use strict"; var _ = require('underscore'); -var Contract = require('web3-eth-contract').Contract; +var Contract = require('web3-eth-contract'); +var namehash = require('eth-ens-namehash'); +var PromiEvent = require('web3-core-promievent'); var REGISTRY_ABI = require('../ressources/ABI/Registry'); +var RESOLVER_ABI = require('../ressources/ABI/Resolver'); /** * A wrapper around the ENS registry contract. * - * @param {ENSNetworkDetector} ensNetworkDetector - * @param {*} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {BatchRequestPackage} batchRequestPackage - * @param {ContractPackageFactory} contractPackageFactory - * @param {PromiEventPackage} promiEventPackage - * @param {ABICoder} abiCoder - * @param {Object} utils - * @param {Object}formatters - * @param {Accounts} accounts - * @param {ABIMapper} abiMapper - * @param {Object} options - * + * @method Registry + * @param {Ens} ens * @constructor */ -function Registry( - ensNetworkDetector, - provider, - providersPackage, - methodController, - batchRequestPackage, - contractPackageFactory, - promiEventPackage, - abiCoder, - utils, - formatters, - accounts, - abiMapper, - options -) { - Contract.call(this, - provider, - providersPackage, - methodController, - batchRequestPackage, - contractPackageFactory, - promiEventPackage, - abiCoder, - utils, - formatters, - accounts, - abiMapper, - REGISTRY_ABI, - null, - options - ); +function Registry(ens) { + var self = this; + this.ens = ens; + this.contract = ens.checkNetwork().then(function (address) { + var contract = new Contract(REGISTRY_ABI, address); + contract.setProvider(self.ens.eth.currentProvider); - ensNetworkDetector.detect().then(function (address) { - self.options.address = address; + return contract; }); } -Registry.prototype = Object.create(Contract.prototype); -Registry.prototype.constructor = Registry; +/** + * Returns the address of the owner of an ENS name. + * + * @method owner + * @param {String} name + * @param {function} callback + * @return {Promise} + */ +Registry.prototype.owner = function (name, callback) { + var promiEvent = new PromiEvent(true); + + this.contract.then(function (contract) { + contract.methods.owner(namehash.hash(name)).call() + .then(function (receipt) { + promiEvent.resolve(receipt); + + if (_.isFunction(callback)) { + callback(receipt); + } + }) + .catch(function (error) { + promiEvent.reject(error); + + if (_.isFunction(callback)) { + callback(error); + } + }); + }); + + return promiEvent.eventEmitter; +}; + +/** + * Returns the resolver contract associated with a name. + * + * @method resolver + * @param {String} name + * @return {Promise} + */ +Registry.prototype.resolver = function (name) { + var self = this; + + return this.contract.then(function (contract) { + return contract.methods.resolver(namehash.hash(name)).call(); + }).then(function (address) { + var contract = new Contract(RESOLVER_ABI, address); + contract.setProvider(self.ens.eth.currentProvider); + return contract; + }); +}; module.exports = Registry; diff --git a/packages/web3-eth-ens/src/contracts/Resolver.js b/packages/web3-eth-ens/src/contracts/Resolver.js deleted file mode 100644 index 2eeda808be0..00000000000 --- a/packages/web3-eth-ens/src/contracts/Resolver.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - 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 . -*/ -/** - * @file Registry.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var Contract = require('web3-eth-contract').Contract; -var RESOLVER_ABI = require('../ressources/ABI/Resolver'); - - -/** - * A wrapper around the ENS resolver contract. - * - * @param {ENSNetworkDetector} ensNetworkDetector - * @param {*} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {BatchRequestPackage} batchRequestPackage - * @param {ContractPackageFactory} contractPackageFactory - * @param {PromiEventPackage} promiEventPackage - * @param {ABICoder} abiCoder - * @param {Object} utils - * @param {Object}formatters - * @param {Accounts} accounts - * @param {ABIMapper} abiMapper - * @param {Object} options - * - * @constructor - */ -function Resolver( - ensNetworkDetector, - provider, - providersPackage, - methodController, - batchRequestPackage, - contractPackageFactory, - promiEventPackage, - abiCoder, - utils, - formatters, - accounts, - abiMapper, - options -) { - Contract.call(this, - provider, - providersPackage, - methodController, - batchRequestPackage, - contractPackageFactory, - promiEventPackage, - abiCoder, - utils, - formatters, - accounts, - abiMapper, - RESOLVER_ABI, - null, - options - ); - - ensNetworkDetector.detect().then(function (address) { - self.options.address = address; - }); -} - -Resolver.prototype = Object.create(Contract.prototype); -Resolver.prototype.constructor = Resolver; - -module.exports = Resolver; diff --git a/packages/web3-eth-ens/src/detector/ENSNetworkDetector.js b/packages/web3-eth-ens/src/detector/ENSNetworkDetector.js deleted file mode 100644 index 555a426638d..00000000000 --- a/packages/web3-eth-ens/src/detector/ENSNetworkDetector.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - 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 . - */ -/** - * @file ENSNetworkDetector.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -/** - * @param {MethodController} methodController - * @param {Accounts} accounts - * @param {AbstractWeb3Object} web3Package - * @param {GetLatestBlockMethodModel} getLatestBlockMethodModel - * @param {GetNetworkTypeMethodModel} getNetworkTypeMethodModel - * - * @constructor - */ -function ENSNetworkDetector(methodController, accounts, web3Package, getLatestBlockMethodModel, getNetworkTypeMethodModel) { - this.methodController = methodController; - this.accounts = accounts; - this.web3Package = web3Package; - this.getLatestBlockMethodModel = getLatestBlockMethodModel; - this.getNetworkTypeMethodModel = getNetworkTypeMethodModel; - - this.addresses = { - main: "0x314159265dD8dbb310642f98f50C066173C1259b", - ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", - rinkeby: "0xe7410170f87102df0055eb195163a03b7f2bff4a" - }; -} - -/** - * Detects the current registry address of ENS and throws an error if the network is not supported. - * - * @method detect - * - * @returns {Promise} - */ -ENSNetworkDetector.prototype.detect = function () { - var self = this; - - return this.methodController.execute(this.getLatestBlockMethodModel, this.accounts, this.web3Package).then(function (block) { - var headAge = new Date() / 1000 - block.timestamp; - - if (headAge > 3600) { - throw new Error("Network not synced; last block was " + headAge + " seconds ago"); - } - - return self.methodController.execute(this.getNetworkTypeMethodModel, self.accounts, self.web3Package); - }).then(function (networkType) { - var addr = self.addresses[networkType]; - if (typeof addr === 'undefined') { - throw new Error("ENS is not supported on network " + networkType); - } - - return addr; - }); -}; - -module.exports = ENSNetworkDetector; diff --git a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js deleted file mode 100644 index c0c48a57079..00000000000 --- a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - 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 . -*/ -/** - * @file Registry.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var Registry = require('../contracts/Registry'); -var Resolver = require('../contracts/Resolver'); -var AccountsPackage = require('web3-eth-accounts'); -var ContractPackage = require('web3-eth-contract'); -var ABIPackage = require('web3-eth-abi'); -var PromiEventPackage = require('web3-core-promievent'); -var BatchRequestPackage = require('web3-core-batch'); -var MethodPackage = require('web3-core-method'); -var ProvidersPackage = require('web3-core-providers'); -var Utils = require('web3-utils'); -var formatters = require('web3-core-helpers').formatters; - -function ENSPackageFactory() { - -} - -/** - * Returns an object of type Registry - * - * @method createRegistry - * - * @param {AbstractProviderAdapter} provider - * @param {Object} contractOptions - * - * @returns {Registry} - */ -ENSPackageFactory.prototype.createRegistry = function (provider, contractOptions) { - return new Registry( - this.createENSNetworkDetector(), - provider, - ProvidersPackage, - MethodPackage.createMethodController(), - BatchRequestPackage, - ContractPackage.createContractPackageFactory(), - PromiEventPackage, - ABIPackage.createAbiCoder(), - Utils, - formatters, - AccountsPackage.createAccounts(), - ContractPackage.createABIMapper(), - contractOptions - ); -}; - -/** - * Returns an object of type Resolver - * - * @method createResolver - * - * @param {AbstractProviderAdapter} provider - * @param {Object} contractOptions - * - * @returns {Resolver} - */ -ENSPackageFactory.prototype.createResolver = function (provider, contractOptions) { - return new Resolver( - this.createENSNetworkDetector(), - provider, - ProvidersPackage, - MethodPackage.createMethodController(), - BatchRequestPackage, - ContractPackage.createContractPackageFactory(), - PromiEventPackage, - ABIPackage.createAbiCoder(), - Utils, - formatters, - AccountsPackage.createAccounts(), - ContractPackage.createABIMapper(), - contractOptions - ); -}; - -ENSPackageFactory.prototype.createENS = function () { -}; - -ENSPackageFactory.prototype.createENSNetworkDetector = function () { - -}; diff --git a/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js b/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js new file mode 100644 index 00000000000..a1bfe7297cc --- /dev/null +++ b/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js @@ -0,0 +1,189 @@ +/* + 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 . +*/ +/** + * @file ResolverMethodHandler.js + * + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var PromiEvent = require('web3-core-promievent'); +var namehash = require('eth-ens-namehash'); +var _ = require('underscore'); + +/** + * @param {Registry} registry + * @constructor + */ +function ResolverMethodHandler(registry) { + this.registry = registry; +} + +/** + * Executes an resolver method and returns an eventifiedPromise + * + * @param {String} ensName + * @param {String} methodName + * @param {Array} methodArguments + * @param {function} callback + * @returns {Object} + */ +ResolverMethodHandler.prototype.method = function (ensName, methodName, methodArguments, callback) { + return { + call: this.call.bind({ + ensName: ensName, + methodName: methodName, + methodArguments: methodArguments, + callback: callback, + parent: this + }), + send: this.send.bind({ + ensName: ensName, + methodName: methodName, + methodArguments: methodArguments, + callback: callback, + parent: this + }) + }; +}; + +/** + * Executes call + * + * @returns {eventifiedPromise} + */ +ResolverMethodHandler.prototype.call = function (callback) { + var self = this; + var promiEvent = new PromiEvent(); + var preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); + + this.parent.registry.resolver(this.ensName).then(function (resolver) { + self.parent.handleCall(promiEvent, resolver.methods[self.methodName], preparedArguments, callback); + }).catch(function (error) { + promiEvent.reject(error); + }); + + return promiEvent.eventEmitter; +}; + + +/** + * Executes send + * + * @param {Object} sendOptions + * @param {function} callback + * @returns {eventifiedPromise} + */ +ResolverMethodHandler.prototype.send = function (sendOptions, callback) { + var self = this; + var promiEvent = new PromiEvent(); + var preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); + + this.parent.registry.resolver(this.ensName).then(function (resolver) { + self.parent.handleSend(promiEvent, resolver.methods[self.methodName], preparedArguments, sendOptions, callback); + }).catch(function (error) { + promiEvent.reject(error); + }); + + return promiEvent.eventEmitter; +}; + +/** + * Handles a call method + * + * @param {eventifiedPromise} promiEvent + * @param {function} method + * @param {Array} preparedArguments + * @param {function} callback + * @returns {eventifiedPromise} + */ +ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, preparedArguments, callback) { + method.apply(this, preparedArguments).call() + .then(function (receipt) { + promiEvent.resolve(receipt); + + if (_.isFunction(callback)) { + callback(receipt); + } + }).catch(function (error) { + promiEvent.reject(error); + + if (_.isFunction(callback)) { + callback(error); + } + }); + + return promiEvent; +}; + +/** + * Handles a send method + * + * @param {eventifiedPromise} promiEvent + * @param {function} method + * @param {Array} preparedArguments + * @param {Object} sendOptions + * @param {function} callback + * @returns {eventifiedPromise} + */ +ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, preparedArguments, sendOptions, callback) { + method.apply(this, preparedArguments).send(sendOptions) + .on('transactionHash', function (hash) { + promiEvent.eventEmitter.emit('transactionHash', hash); + }) + .on('confirmation', function (confirmationNumber, receipt) { + promiEvent.eventEmitter.emit('confirmation', confirmationNumber, receipt); + }) + .on('receipt', function (receipt) { + promiEvent.eventEmitter.emit('receipt', receipt); + promiEvent.resolve(receipt); + + if (_.isFunction(callback)) { + callback(receipt); + } + }) + .on('error', function (error) { + promiEvent.eventEmitter.emit('error', error); + promiEvent.reject(error); + + if (_.isFunction(callback)) { + callback(error); + } + }); + + return promiEvent; +}; + +/** + * Adds the ENS node to the arguments + * + * @param {String} name + * @param {Array} methodArguments + * @returns {Array} + */ +ResolverMethodHandler.prototype.prepareArguments = function (name, methodArguments) { + var node = namehash.hash(name); + + if (methodArguments.length > 0) { + methodArguments.unshift(node); + + return methodArguments; + } + + return [node]; +}; + +module.exports = ResolverMethodHandler; diff --git a/packages/web3-eth-ens/src/proxies/ContractMethodsProxy.js b/packages/web3-eth-ens/src/proxies/ContractMethodsProxy.js deleted file mode 100644 index 664467a4c3c..00000000000 --- a/packages/web3-eth-ens/src/proxies/ContractMethodsProxy.js +++ /dev/null @@ -1,13 +0,0 @@ - -var MethodsProxy = require('web3-eth-contract').MethodsProxy; - -function ContractMethodsProxy() { - MethodsProxy.call(this, ); -} - -ContractMethodsProxy.prototype.proxyHandler = function(target, name) { - // overwrite method because of namehash -}; - -ContractMethodsProxy.prototype = Object.create(MethodsProxy); -ContractMethodsProxy.prototype.constructor = ContractMethodsProxy; From 4d200a6fec717c7fb915db253e1b83a1900fb25b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 11:07:16 +0200 Subject: [PATCH 0192/1045] new contract handling added to ENS package and improved the dependency handling --- .../TransactionConfirmationWorkflow.js | 2 +- packages/web3-eth-ens/src/ENS.js | 36 ++++------ .../web3-eth-ens/src/contracts/Registry.js | 72 +++++++++++-------- packages/web3-eth-ens/src/index.js | 11 ++- .../src/lib/ResolverMethodHandler.js | 51 +++++++++---- 5 files changed, 101 insertions(+), 71 deletions(-) diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 6d8ff20d930..519f2c8666f 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -96,7 +96,7 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3P } promiEvent.reject(validationResult); - promiEvent.eventEmitter.emit('error', [validationResult, receipt]); + promiEvent.eventEmitter.emit('error', validationResult, receipt); promiEvent.eventEmitter.removeAllListeners(); if (methodModel.callback) { diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index c95ec1b0211..69197426755 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -25,30 +25,21 @@ var Registry = require('./contracts/Registry'); var ResolverMethodHandler = require('./lib/ResolverMethodHandler'); /** - * Constructs a new instance of ENS + * @param {Network} net + * @param {Accounts} accounts + * @param {ContractPackage} contractPackage + * @param {Object} registryAbi + * @param {Object} resolverAbi + * @param {PromiEventPackage} promiEventPackage * - * @method ENS - * @param {Object} eth * @constructor */ -function ENS(eth) { // TODO: Remove circular dependency. - this.eth = eth; +function ENS(net, accounts, contractPackage, registryAbi, resolverAbi, promiEventPackage) { + this.net = net; + this.registry = new Registry(net, accounts, contractPackage, registryAbi, resolverAbi); + this.resolverMethodHandler = new ResolverMethodHandler(this.registry, promiEventPackage); } -Object.defineProperty(ENS.prototype, 'registry', { - get: function () { - return new Registry(this); - }, - enumerable: true -}); - -Object.defineProperty(ENS.prototype, 'resolverMethodHandler', { - get: function () { - return new ResolverMethodHandler(this.registry); - }, - enumerable: true -}); - /** * @param {String} name * @returns {Promise} @@ -92,7 +83,7 @@ ENS.prototype.setAddress = function (name, address, sendOptions, callback) { * @returns {eventifiedPromise} */ ENS.prototype.getPubkey = function (name, callback) { - return this.resolverMethodHandler.method(name, 'pubkey', [], callback).call(callback); + return this.resolverMethodHandler.method(name, 'pubkey', []).call(callback); }; /** @@ -170,12 +161,13 @@ ENS.prototype.setMultihash = function (name, hash, sendOptions, callback) { */ ENS.prototype.checkNetwork = function () { var self = this; - return self.eth.getBlock('latest').then(function (block) { + return self.net.getBlock('latest', false).then(function (block) { var headAge = new Date() / 1000 - block.timestamp; if (headAge > 3600) { throw new Error("Network not synced; last block was " + headAge + " seconds ago"); } - return self.eth.net.getNetworkType(); + + return self.net.getNetworkType(); }).then(function (networkType) { var addr = config.addresses[networkType]; if (typeof addr === 'undefined') { diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index bb60ce78e84..37e9963195c 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -13,7 +13,6 @@ */ /** * @file Registry.js - * * @author Samuel Furter * @date 2018 */ @@ -21,28 +20,32 @@ "use strict"; var _ = require('underscore'); -var Contract = require('web3-eth-contract'); var namehash = require('eth-ens-namehash'); -var PromiEvent = require('web3-core-promievent'); -var REGISTRY_ABI = require('../ressources/ABI/Registry'); -var RESOLVER_ABI = require('../ressources/ABI/Resolver'); - /** - * A wrapper around the ENS registry contract. + * @param {Network} net + * @param {Accounts} accounts + * @param {ContractPackage} contractPackage + * @param {Object} registryABI + * @param {Object} resolverABI * - * @method Registry - * @param {Ens} ens * @constructor */ -function Registry(ens) { +function Registry(net, accounts, contractPackage, registryABI, resolverABI) { var self = this; - this.ens = ens; - this.contract = ens.checkNetwork().then(function (address) { - var contract = new Contract(REGISTRY_ABI, address); - contract.setProvider(self.ens.eth.currentProvider); + this.net = net; + this.accounts = accounts; + this.contractPackage = contractPackage; + this.registryABI = registryABI; + this.resolverABI = resolverABI; - return contract; + this.contract = ens.checkNetwork().then(function (address) { + return self.contractPackage.createContract( + self.net.currentProvider, + self.accounts, + self.registryABI, + address + ); }); } @@ -50,40 +53,46 @@ function Registry(ens) { * Returns the address of the owner of an ENS name. * * @method owner + * * @param {String} name - * @param {function} callback - * @return {Promise} + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} */ Registry.prototype.owner = function (name, callback) { - var promiEvent = new PromiEvent(true); + var self = this; - this.contract.then(function (contract) { - contract.methods.owner(namehash.hash(name)).call() + return new Promise(function (resolve, reject) { + self.contract.then(function (contract) { + contract.methods.owner(namehash.hash(name)) + .call() .then(function (receipt) { - promiEvent.resolve(receipt); + resolve(receipt); if (_.isFunction(callback)) { - callback(receipt); + callback(false, receipt); } }) .catch(function (error) { - promiEvent.reject(error); + reject(error); if (_.isFunction(callback)) { - callback(error); + callback(error, null); } }); + }); }); - - return promiEvent.eventEmitter; }; /** * Returns the resolver contract associated with a name. * * @method resolver + * * @param {String} name - * @return {Promise} + * + * @returns {Promise} */ Registry.prototype.resolver = function (name) { var self = this; @@ -91,9 +100,12 @@ Registry.prototype.resolver = function (name) { return this.contract.then(function (contract) { return contract.methods.resolver(namehash.hash(name)).call(); }).then(function (address) { - var contract = new Contract(RESOLVER_ABI, address); - contract.setProvider(self.ens.eth.currentProvider); - return contract; + return self.contractPackage.createContract( + self.net.currentProvider, + self.accounts, + self.resolverABI, + address + ); }); }; diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index 193d205e30c..f550921f5e9 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -22,6 +22,10 @@ var version = require('package.json').version; var ENS = require('./ENS'); +var ContractPackage = require('web3-eth-contract'); +var PromiEventPackage = require('web3-core-promievent'); +var REGISTRY_ABI = require('./ressources/ABI/Registry'); +var RESOLVER_ABI = require('./ressources/ABI/Resolver'); module.exports = { version: version, @@ -31,11 +35,12 @@ module.exports = { * * @method createENS * - * @param {Eth} eth + * @param {Network} net + * @param {Accounts} accounts * * @returns {ENS} */ - createENS: function (eth) { //TODO: Remove circular dependency and refactore ENS because of the new method and connection handling - return new ENS(eth); + createENS: function (net, accounts) { + return new ENS(net, accounts, ContractPackage, REGISTRY_ABI, RESOLVER_ABI, PromiEventPackage); } }; diff --git a/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js b/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js index a1bfe7297cc..5d91411185a 100644 --- a/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js +++ b/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js @@ -20,16 +20,18 @@ "use strict"; -var PromiEvent = require('web3-core-promievent'); var namehash = require('eth-ens-namehash'); var _ = require('underscore'); /** * @param {Registry} registry + * @param {PromiEventPackage} promiEventPackage + * * @constructor */ -function ResolverMethodHandler(registry) { +function ResolverMethodHandler(registry, promiEventPackage) { this.registry = registry; + this.promiEventPackage = promiEventPackage; } /** @@ -38,23 +40,22 @@ function ResolverMethodHandler(registry) { * @param {String} ensName * @param {String} methodName * @param {Array} methodArguments - * @param {function} callback + * @param {Function} callback + * * @returns {Object} */ -ResolverMethodHandler.prototype.method = function (ensName, methodName, methodArguments, callback) { +ResolverMethodHandler.prototype.method = function (ensName, methodName, methodArguments) { return { call: this.call.bind({ ensName: ensName, methodName: methodName, methodArguments: methodArguments, - callback: callback, parent: this }), send: this.send.bind({ ensName: ensName, methodName: methodName, methodArguments: methodArguments, - callback: callback, parent: this }) }; @@ -63,12 +64,17 @@ ResolverMethodHandler.prototype.method = function (ensName, methodName, methodAr /** * Executes call * + * @method call + * + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ResolverMethodHandler.prototype.call = function (callback) { - var self = this; - var promiEvent = new PromiEvent(); - var preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); + var self = this, + promiEvent = this.promiEventPackage.createPromiEvent(), + preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); this.parent.registry.resolver(this.ensName).then(function (resolver) { self.parent.handleCall(promiEvent, resolver.methods[self.methodName], preparedArguments, callback); @@ -83,14 +89,18 @@ ResolverMethodHandler.prototype.call = function (callback) { /** * Executes send * + * @method send + * * @param {Object} sendOptions - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ResolverMethodHandler.prototype.send = function (sendOptions, callback) { - var self = this; - var promiEvent = new PromiEvent(); - var preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); + var self = this, + promiEvent = this.promiEventPackage.createPromiEvent(), + preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); this.parent.registry.resolver(this.ensName).then(function (resolver) { self.parent.handleSend(promiEvent, resolver.methods[self.methodName], preparedArguments, sendOptions, callback); @@ -104,10 +114,14 @@ ResolverMethodHandler.prototype.send = function (sendOptions, callback) { /** * Handles a call method * + * @method handleCall + * * @param {eventifiedPromise} promiEvent * @param {function} method * @param {Array} preparedArguments - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, preparedArguments, callback) { @@ -132,11 +146,15 @@ ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, prepa /** * Handles a send method * + * @method handleSend + * * @param {eventifiedPromise} promiEvent * @param {function} method * @param {Array} preparedArguments * @param {Object} sendOptions - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, preparedArguments, sendOptions, callback) { @@ -170,8 +188,11 @@ ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, prepa /** * Adds the ENS node to the arguments * + * @method prepareArguments + * * @param {String} name * @param {Array} methodArguments + * * @returns {Array} */ ResolverMethodHandler.prototype.prepareArguments = function (name, methodArguments) { From 0c725ea5bdb8c91c0b730f65147b4e913b14b285 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 11:35:30 +0200 Subject: [PATCH 0193/1045] ENS refactored --- .../{src => }/ressources/ABI/Registry.js | 0 .../{src => }/ressources/ABI/Resolver.js | 0 packages/web3-eth-ens/src/ENS.js | 90 +++++++++---------- packages/web3-eth-ens/src/config.js | 11 --- .../web3-eth-ens/src/contracts/Registry.js | 60 ++++++++++--- .../src/factories/ENSPackageFactory.js | 86 ++++++++++++++++++ .../ResolverMethodHandler.js | 0 packages/web3-eth-ens/src/index.js | 17 ++-- 8 files changed, 187 insertions(+), 77 deletions(-) rename packages/web3-eth-ens/{src => }/ressources/ABI/Registry.js (100%) rename packages/web3-eth-ens/{src => }/ressources/ABI/Resolver.js (100%) delete mode 100644 packages/web3-eth-ens/src/config.js create mode 100644 packages/web3-eth-ens/src/factories/ENSPackageFactory.js rename packages/web3-eth-ens/src/{lib => handlers}/ResolverMethodHandler.js (100%) diff --git a/packages/web3-eth-ens/src/ressources/ABI/Registry.js b/packages/web3-eth-ens/ressources/ABI/Registry.js similarity index 100% rename from packages/web3-eth-ens/src/ressources/ABI/Registry.js rename to packages/web3-eth-ens/ressources/ABI/Registry.js diff --git a/packages/web3-eth-ens/src/ressources/ABI/Resolver.js b/packages/web3-eth-ens/ressources/ABI/Resolver.js similarity index 100% rename from packages/web3-eth-ens/src/ressources/ABI/Resolver.js rename to packages/web3-eth-ens/ressources/ABI/Resolver.js diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index 69197426755..41f6d9f28cd 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -20,28 +20,24 @@ "use strict"; -var config = require('./config'); -var Registry = require('./contracts/Registry'); -var ResolverMethodHandler = require('./lib/ResolverMethodHandler'); - /** - * @param {Network} net - * @param {Accounts} accounts - * @param {ContractPackage} contractPackage - * @param {Object} registryAbi - * @param {Object} resolverAbi - * @param {PromiEventPackage} promiEventPackage + * @param {Registry} registry + * @param {ResolverMethodHandler} resolverMethodHandler * * @constructor */ -function ENS(net, accounts, contractPackage, registryAbi, resolverAbi, promiEventPackage) { - this.net = net; - this.registry = new Registry(net, accounts, contractPackage, registryAbi, resolverAbi); - this.resolverMethodHandler = new ResolverMethodHandler(this.registry, promiEventPackage); +function ENS(registry, resolverMethodHandler) { + this.registry = registry; + this.resolverMethodHandler = resolverMethodHandler; } /** + * Returns an contract of type resolver + * + * @method resolver + * * @param {String} name + * * @returns {Promise} */ ENS.prototype.resolver = function (name) { @@ -52,8 +48,12 @@ ENS.prototype.resolver = function (name) { * Returns the address record associated with a name. * * @method getAddress + * + * @method getAddress * @param {String} name - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @return {eventifiedPromise} */ ENS.prototype.getAddress = function (name, callback) { @@ -64,10 +64,13 @@ ENS.prototype.getAddress = function (name, callback) { * Sets a new address * * @method setAddress + * * @param {String} name * @param {String} address * @param {Object} sendOptions - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ENS.prototype.setAddress = function (name, address, sendOptions, callback) { @@ -78,8 +81,11 @@ ENS.prototype.setAddress = function (name, address, sendOptions, callback) { * Returns the public key * * @method getPubkey + * * @param {String} name - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ENS.prototype.getPubkey = function (name, callback) { @@ -90,11 +96,14 @@ ENS.prototype.getPubkey = function (name, callback) { * Set the new public key * * @method setPubkey + * * @param {String} name * @param {String} x * @param {String} y * @param {Object} sendOptions - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ENS.prototype.setPubkey = function (name, x, y, sendOptions, callback) { @@ -105,8 +114,11 @@ ENS.prototype.setPubkey = function (name, x, y, sendOptions, callback) { * Returns the content * * @method getContent + * * @param {String} name - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ENS.prototype.getContent = function (name, callback) { @@ -117,10 +129,13 @@ ENS.prototype.getContent = function (name, callback) { * Set the content * * @method setContent + * * @param {String} name * @param {String} hash - * @param {function} callback * @param {Object} sendOptions + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ENS.prototype.setContent = function (name, hash, sendOptions, callback) { @@ -131,8 +146,11 @@ ENS.prototype.setContent = function (name, hash, sendOptions, callback) { * Get the multihash * * @method getMultihash + * * @param {String} name - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ENS.prototype.getMultihash = function (name, callback) { @@ -143,39 +161,17 @@ ENS.prototype.getMultihash = function (name, callback) { * Set the multihash * * @method setMultihash + * * @param {String} name * @param {String} hash * @param {Object} sendOptions - * @param {function} callback + * @param {Function} callback + * + * @callback callback callback(error, result) * @returns {eventifiedPromise} */ ENS.prototype.setMultihash = function (name, hash, sendOptions, callback) { return this.resolverMethodHandler.method(name, 'multihash', [hash]).send(sendOptions, callback); }; -/** - * Checks if the current used network is synced and looks for ENS support there. - * Throws an error if not. - * - * @returns {Promise} - */ -ENS.prototype.checkNetwork = function () { - var self = this; - return self.net.getBlock('latest', false).then(function (block) { - var headAge = new Date() / 1000 - block.timestamp; - if (headAge > 3600) { - throw new Error("Network not synced; last block was " + headAge + " seconds ago"); - } - - return self.net.getNetworkType(); - }).then(function (networkType) { - var addr = config.addresses[networkType]; - if (typeof addr === 'undefined') { - throw new Error("ENS is not supported on network " + networkType); - } - - return addr; - }); -}; - module.exports = ENS; diff --git a/packages/web3-eth-ens/src/config.js b/packages/web3-eth-ens/src/config.js deleted file mode 100644 index 7656840b3a0..00000000000 --- a/packages/web3-eth-ens/src/config.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -var config = { - addresses: { - main: "0x314159265dD8dbb310642f98f50C066173C1259b", - ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", - rinkeby: "0xe7410170f87102df0055eb195163a03b7f2bff4a" - }, -}; - -module.exports = config; diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index 37e9963195c..c01d28b372b 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -39,7 +39,7 @@ function Registry(net, accounts, contractPackage, registryABI, resolverABI) { this.registryABI = registryABI; this.resolverABI = resolverABI; - this.contract = ens.checkNetwork().then(function (address) { + this.contract = this.checkNetwork().then(function (address) { return self.contractPackage.createContract( self.net.currentProvider, self.accounts, @@ -66,21 +66,21 @@ Registry.prototype.owner = function (name, callback) { return new Promise(function (resolve, reject) { self.contract.then(function (contract) { contract.methods.owner(namehash.hash(name)) - .call() - .then(function (receipt) { - resolve(receipt); + .call() + .then(function (receipt) { + resolve(receipt); - if (_.isFunction(callback)) { - callback(false, receipt); - } - }) - .catch(function (error) { - reject(error); + if (_.isFunction(callback)) { + callback(false, receipt); + } + }) + .catch(function (error) { + reject(error); - if (_.isFunction(callback)) { - callback(error, null); - } - }); + if (_.isFunction(callback)) { + callback(error, null); + } + }); }); }); }; @@ -109,4 +109,36 @@ Registry.prototype.resolver = function (name) { }); }; +/** + * Checks if the current used network is synced and looks for ENS support there. + * Throws an error if not. + * + * @method checkNetwork + * + * @returns {Promise} + */ +Registry.prototype.checkNetwork = function () { + var self = this, ensAddresses = { + main: "0x314159265dD8dbb310642f98f50C066173C1259b", + ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", + rinkeby: "0xe7410170f87102df0055eb195163a03b7f2bff4a" + }; + + return this.net.getBlock('latest', false).then(function (block) { + var headAge = new Date() / 1000 - block.timestamp; + if (headAge > 3600) { + throw new Error("Network not synced; last block was " + headAge + " seconds ago"); + } + + return self.net.getNetworkType(); + }).then(function (networkType) { + var addr = ensAddresses[networkType]; + if (typeof addr === 'undefined') { + throw new Error("ENS is not supported on network " + networkType); + } + + return addr; + }); +}; + module.exports = Registry; diff --git a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js new file mode 100644 index 00000000000..001e9cf8fed --- /dev/null +++ b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js @@ -0,0 +1,86 @@ +/* + 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 . +*/ +/** + * @file ENS.js + * @author Samuel Furter + * @date 2018 + */ + +"use strict"; + +var ENS = require('./ENS'); +var Registry = require('./contracts/Registry'); +var ResolverMethodHandler = require('../handlers/ResolverMethodHandler'); + +function ENSPackageFactory () { } + +/** + * Returns an object of type ENS + * + * @method createENS + * + * @param {Network} net + * @param {Accounts} accounts + * @param {ContractPackage} contractPackage + * @param {Object} registryAbi + * @param {Object} resolverAbi + * @param {PromiEventPackage} promiEventPackage + * + * @returns {ENS} + */ +ENSPackageFactory.prototype.createENS = function ( + net, + accounts, + contractPackage, + registryAbi, + resolverAbi, + promiEventPackage +) { + var registry = this.createRegistry(net, accounts, contractPackage, registryAbi, resolverAbi); + + return new ENS(registry, this.createResolverMethodHandler(registry, promiEventPackage)); +}; + +/** + * Returns an object of type Registry + * + * @method createRegistry + * + * @param {Network} net + * @param {Accounts} accounts + * @param {ContractPackage} contractPackage + * @param {Object} registryAbi + * @param {Object} resolverAbi + * + * @returns {Registry} + */ +ENSPackageFactory.prototype.createRegistry = function (net, accounts, contractPackage, registryAbi, resolverAbi) { + return new Registry(net, accounts, contractPackage, registryAbi, resolverAbi); +}; + +/** + * Returns an object of type ResolverMethodHandler + * + * @method createResolverMethodHandler + * + * @param {Registry} registry + * @param {PromiEventPackage} promiEventPackage + * + * @returns {ResolverMethodHandler} + */ +ENSPackageFactory.prototype.createResolverMethodHandler = function (registry, promiEventPackage) { + return new ResolverMethodHandler(registry, promiEventPackage); +}; + +module.exports = ENSPackageFactory; diff --git a/packages/web3-eth-ens/src/lib/ResolverMethodHandler.js b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js similarity index 100% rename from packages/web3-eth-ens/src/lib/ResolverMethodHandler.js rename to packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index f550921f5e9..039534c0f48 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -21,13 +21,13 @@ "use strict"; var version = require('package.json').version; -var ENS = require('./ENS'); var ContractPackage = require('web3-eth-contract'); var PromiEventPackage = require('web3-core-promievent'); -var REGISTRY_ABI = require('./ressources/ABI/Registry'); -var RESOLVER_ABI = require('./ressources/ABI/Resolver'); +var REGISTRY_ABI = require('../ressources/ABI/Registry'); +var RESOLVER_ABI = require('../ressources/ABI/Resolver'); +var ENSPackageFactory = require('./factories/ENSPackageFactory'); -module.exports = { +module.exports = { // TODO: overthink the ens package architecture and refactor it. version: version, /** @@ -41,6 +41,13 @@ module.exports = { * @returns {ENS} */ createENS: function (net, accounts) { - return new ENS(net, accounts, ContractPackage, REGISTRY_ABI, RESOLVER_ABI, PromiEventPackage); + return new ENSPackageFactory().createENS( + net, + accounts, + ContractPackage, + REGISTRY_ABI, + RESOLVER_ABI, + PromiEventPackage + ); } }; From 3225c582738b24d2743859c719035bbe6496fc42 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 11:36:28 +0200 Subject: [PATCH 0194/1045] fileDoc in ENSPackageFactory updated --- packages/web3-eth-ens/src/factories/ENSPackageFactory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js index 001e9cf8fed..751e838c5f7 100644 --- a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js +++ b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js @@ -12,7 +12,7 @@ along with web3.js. If not, see . */ /** - * @file ENS.js + * @file ENSPackageFactory.js * @author Samuel Furter * @date 2018 */ From d4c2b145802f143576f326a3b7c506924a7dff01 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 12:01:02 +0200 Subject: [PATCH 0195/1045] FuncDocs updated in Bzz --- packages/web3-bzz/src/Bzz.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index f515f5700a8..e8a34a1da0b 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -26,11 +26,11 @@ var _ = require('underscore'); var swarm = require("swarm-js"); /** - * @param {Object} provider + * @param {Object|String} provider * * @constructor */ -function Bzz(provider) {// TODO: have a closer look on the provider detection for Bzz maybe this could be done with the AbstractWeb3Object too. +function Bzz(provider) { this.givenProvider = Bzz.givenProvider; this.currentProvider = null; this.setProvider(provider); @@ -106,7 +106,7 @@ Bzz.prototype.isAvailable = function () { * * @method hasProvider * - * @returns {boolean} + * @returns {Boolean} */ Bzz.prototype.hasProvider = function () { return !!this.currentProvider; @@ -127,9 +127,9 @@ Bzz.prototype.throwProviderError = function () { * * @method setProvider * - * @param {Object} provider + * @param {Object|String} provider * - * @returns {boolean} + * @returns {Boolean} */ Bzz.prototype.setProvider = function (provider) { // is ethereum provider From 8faa3f50eebaec68f88eca9683b0d8573f0ad813 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 12:16:39 +0200 Subject: [PATCH 0196/1045] ProviderAdapters improved --- packages/web3-core-batch/src/BatchRequest.js | 6 +++ .../lib/adapters/AbstractProviderAdapter.js | 41 ++++++++++++++- .../src/adapters/HttpProviderAdapter.js | 40 -------------- .../src/adapters/InpageProviderAdapter.js | 52 ------------------- .../src/adapters/SocketProviderAdapter.js | 11 ---- 5 files changed, 46 insertions(+), 104 deletions(-) diff --git a/packages/web3-core-batch/src/BatchRequest.js b/packages/web3-core-batch/src/BatchRequest.js index 7abb5ab5759..4c27185812a 100644 --- a/packages/web3-core-batch/src/BatchRequest.js +++ b/packages/web3-core-batch/src/BatchRequest.js @@ -61,6 +61,12 @@ BatchRequest.prototype.execute = function () { this.provider.sendBatch( this.jsonRpcMapper.toBatchPayload(this.requests), function (err, results) { + if (!_.isArray(results)) { + request.callback(errors.InvalidResponse(results)); + + return; + } + self.requests.forEach(function (request, index) { var result = results[index] || null; diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js index 483a2fde452..67d9dd0d523 100644 --- a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js @@ -68,7 +68,35 @@ AbstractProviderAdapter.prototype.send = function (method, parameters) { * @callback callback callback(error, result) */ AbstractProviderAdapter.prototype.sendBatch = function (payload, callback) { - self.provider.send(payload, callback); + this.provider.send(payload, callback); +}; + +/** + * Returns Promise with an error if the method is not overwritten + * + * @method subscribe + * + * @returns {Promise} + */ +AbstractProviderAdapter.prototype.subscribe = function () { + var self = this; + return new Promise(function(resolve, reject) { + reject(new Error('The current provider does not support subscriptions: ' + self.provider.constructor.name)); + }); +}; + +/** + * Returns Promise with an error if the method is not overwritten + * + * @method unsubscribe + * + * @returns {Promise} + */ +AbstractProviderAdapter.prototype.unsubscribe = function () { + var self = this; + return new Promise(function(resolve, reject) { + reject(new Error('The current provider does not support subscriptions: ' + self.provider.constructor.name)); + }); }; /** @@ -112,6 +140,17 @@ AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, er reject(error); }; +/** + * Checks if the provider is connected + * + * @method isConnected + * + * @returns {Boolean} + */ +AbstractProviderAdapter.prototype.isConnected = function () { + return this.provider.connected; +}; + AbstractProviderAdapter.prototype = Object.create(EventEmitter.prototype); AbstractProviderAdapter.prototype.constructor = AbstractProviderAdapter; diff --git a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js index 50ab5e35568..d6aa48c7f2f 100644 --- a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js @@ -33,46 +33,6 @@ function HttpProviderAdapter(httpProvider) { AbstractProviderAdapter.call(this, httpProvider); } - -/** - * Returns promise with an error because HTTP does not support subscriptions - * - * @method subscribe - * - * @returns {Promise} - */ -HttpProviderAdapter.prototype.subscribe = function () { - var self = this; - return new Promise(function(resolve, reject) { - reject(new Error('The current provider does not support subscriptions: ' + self.provider.constructor.name)); - }); -}; - -/** - * Returns promise with an error because HTTP does not support subscriptions - * - * @method unsubscribe - * - * @returns {Promise} - */ -HttpProviderAdapter.prototype.unsubscribe = function () { - var self = this; - return new Promise(function(resolve, reject) { - reject(new Error('The current provider does not support subscriptions: ' + self.provider.constructor.name)); - }); -}; - -/** - * Checks if the provider is connected - * - * @method isConnected - * - * @returns {Boolean} - */ -HttpProviderAdapter.prototype.isConnected = function () { - return this.provider.connected; -}; - HttpProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); HttpProviderAdapter.prototype.constructor = HttpProviderAdapter; diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js index d6158ba5896..f2a8e559771 100644 --- a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js @@ -23,8 +23,6 @@ "use strict"; var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapter'); -var JSONRpcMapper = require('./JSONRpcMapper.js'); -var errors = require('web3-core-helpers').errors; /** * @param {Object} inpageProvider @@ -37,56 +35,6 @@ function InpageProviderAdapter(inpageProvider) { delete this.provider.sendAsync; } -/** - * Sends batch request - * - * @param {Array} payloadBatch - * - * @returns {Promise} - */ -InpageProviderAdapter.prototype.sendBatch = function (payloadBatch) { - return new Promise(function (resolve, reject) { - this.provider.send(JSONRpcMapper.toBatchPayload(payloadBatch), function (error, response) { - if (!error) { - resolve(response); - return; - } - - if (!_.isArray(response)) { - reject(errors.InvalidResponse(response)); - } - - reject(error); - }); - }); -}; - -/** - * Returns promise with an error because the inpageProvider does not support subscriptions - * - * @method subscribe - * - * @returns {Promise} - */ -InpageProviderAdapter.prototype.subscribe = function () { - return new Promise(function (resolve, reject) { - reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); - }); -}; - -/** - * Returns promise with an error because the inpageProvider does not support subscriptions - * - * @method unsubscribe - * - * @returns {Promise} - */ -InpageProviderAdapter.prototype.unsubscribe = function () { - return new Promise(function (resolve, reject) { - reject(new Error('The current provider does not support subscriptions: ' + this.provider.constructor.name)); - }); -}; - /** * Checks if the provider is connected * diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index 700e5aaa17b..8db2e39622c 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -158,17 +158,6 @@ SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId, s }); }; -/** - * Checks if the provider is connected - * - * @method isConnected - * - * @returns {Boolean} - */ -SocketProviderAdapter.prototype.isConnected = function () { - return this.provider.connected; -}; - SocketProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); SocketProviderAdapter.prototype.constructor = SocketProviderAdapter; From 81c48462e99b2be92f3ab108f07c5ca886687201 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 12:25:31 +0200 Subject: [PATCH 0197/1045] codeStyle improvements --- packages/web3-core-providers/src/index.js | 4 ++-- packages/web3-core-providers/src/mappers/JSONRpcMapper.js | 1 - .../src/resolvers/ProviderAdapterResolver.js | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index 470d556a86c..cdeab827c21 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -46,10 +46,10 @@ module.exports = { * * @method resolve * - * @param {Object} provider + * @param {Object|String} provider * @param {Net} net * - * @returns {Object} + * @returns {AbstractProviderAdapter} */ resolve: function (provider, net) { return new ProvidersPackageFactory().createProviderAdapterResolver().resolve(provider, net); diff --git a/packages/web3-core-providers/src/mappers/JSONRpcMapper.js b/packages/web3-core-providers/src/mappers/JSONRpcMapper.js index 842c5199adf..996c035b467 100644 --- a/packages/web3-core-providers/src/mappers/JSONRpcMapper.js +++ b/packages/web3-core-providers/src/mappers/JSONRpcMapper.js @@ -44,7 +44,6 @@ JSONRpcMapper.toPayload = function (method, params) { throw new Error('JSONRPC method should be specified for params: "'+ JSON.stringify(params) +'"!'); } - // advance message ID JSONRpcMapper.messageId++; return { diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index 7ad4d7a1a53..a1d49f85b0c 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -38,7 +38,7 @@ function ProviderAdapterResolver(providersPackageFactory) { * * @method resolve * - * @param {any} provider + * @param {*} provider * @param {Net} net * * @returns {Object|Boolean} @@ -79,7 +79,6 @@ ProviderAdapterResolver.prototype.resolve = function (provider, net) { return this.providersPackageFactory.createSocketProviderAdapter(provider); case 'IpcProvider': return this.providersPackageFactory.createSocketProviderAdapter(provider); - } throw Error('Please provide an Web3 provider or the EthereumProvider'); From 8d87ab44dda57bc1b21365ce3e12ae9025fa07b7 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 12:28:10 +0200 Subject: [PATCH 0198/1045] web3-core-subscription renamed to web3-core-subscriptions --- gulpfile.js | 4 ++-- packages/web3-core-method/src/index.js | 2 +- .../README.md | 0 .../lib/models/AbstractSubscriptionModel.js | 0 .../package-lock.json | 0 .../package.json | 0 .../src/Subscription.js | 0 .../src/factories/SubscriptionsFactory.js | 0 .../src/index.js | 0 .../src/models/subscriptions/eth/LogSubscriptionModel.js | 0 .../src/models/subscriptions/eth/NewHeadsSubscriptionModel.js | 0 .../eth/NewPendingTransactionsSubscriptionModel.js | 0 .../src/models/subscriptions/eth/SyncingSubscriptionModel.js | 0 .../src/models/subscriptions/shh/MessagesSubscriptionModel.js | 0 .../src/factories/EventSubscriptionFactory.js | 2 +- .../src/models/subscriptions/AllEventsLogSubscription.js | 2 +- .../src/models/subscriptions/EventLogSubscription.js | 2 +- packages/web3-eth/src/index.js | 2 +- packages/web3-shh/src/index.js | 2 +- 19 files changed, 8 insertions(+), 8 deletions(-) rename packages/{web3-core-subscription => web3-core-subscriptions}/README.md (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/lib/models/AbstractSubscriptionModel.js (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/package-lock.json (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/package.json (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/src/Subscription.js (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/src/factories/SubscriptionsFactory.js (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/src/index.js (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/src/models/subscriptions/eth/LogSubscriptionModel.js (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/src/models/subscriptions/eth/SyncingSubscriptionModel.js (100%) rename packages/{web3-core-subscription => web3-core-subscriptions}/src/models/subscriptions/shh/MessagesSubscriptionModel.js (100%) diff --git a/gulpfile.js b/gulpfile.js index ac07fa0f077..62d2990c420 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -71,9 +71,9 @@ var packages = [{ expose: 'Web3Providers', src: './packages/web3-core-providers/src/index.js' }, { - fileName: 'web3-core-subscription', + fileName: 'web3-core-subscriptions', expose: 'Web3Subscription', - src: './packages/web3-core-subscription/src/index.js' + src: './packages/web3-core-subscriptions/src/index.js' }, { fileName: 'web3-core-promievent', expose: 'Web3PromiEvent', diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index cb5e812ce07..adab36cb50c 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -27,7 +27,7 @@ var version = require('./package.json'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); var PromiEventPackage = require('web3-core-promievent'); -var SubscriptionPackage = require('web3-core-subscription'); +var SubscriptionPackage = require('web3-core-subscriptions'); var formatters = require('web3-core-helpers').formatters; // Methods diff --git a/packages/web3-core-subscription/README.md b/packages/web3-core-subscriptions/README.md similarity index 100% rename from packages/web3-core-subscription/README.md rename to packages/web3-core-subscriptions/README.md diff --git a/packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/lib/models/AbstractSubscriptionModel.js rename to packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js diff --git a/packages/web3-core-subscription/package-lock.json b/packages/web3-core-subscriptions/package-lock.json similarity index 100% rename from packages/web3-core-subscription/package-lock.json rename to packages/web3-core-subscriptions/package-lock.json diff --git a/packages/web3-core-subscription/package.json b/packages/web3-core-subscriptions/package.json similarity index 100% rename from packages/web3-core-subscription/package.json rename to packages/web3-core-subscriptions/package.json diff --git a/packages/web3-core-subscription/src/Subscription.js b/packages/web3-core-subscriptions/src/Subscription.js similarity index 100% rename from packages/web3-core-subscription/src/Subscription.js rename to packages/web3-core-subscriptions/src/Subscription.js diff --git a/packages/web3-core-subscription/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js similarity index 100% rename from packages/web3-core-subscription/src/factories/SubscriptionsFactory.js rename to packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js diff --git a/packages/web3-core-subscription/src/index.js b/packages/web3-core-subscriptions/src/index.js similarity index 100% rename from packages/web3-core-subscription/src/index.js rename to packages/web3-core-subscriptions/src/index.js diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/src/models/subscriptions/eth/LogSubscriptionModel.js rename to packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js rename to packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js rename to packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js diff --git a/packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/src/models/subscriptions/eth/SyncingSubscriptionModel.js rename to packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js diff --git a/packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js similarity index 100% rename from packages/web3-core-subscription/src/models/subscriptions/shh/MessagesSubscriptionModel.js rename to packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js index 70fe83c6d3c..6f91b71159a 100644 --- a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js @@ -22,7 +22,7 @@ "use strict"; -var Subscription = require('web3-core-subscription').Subscription; +var Subscription = require('web3-core-subscriptions').Subscription; var GetPastLogsMethodModel = require('web3-core-method').GetPastLogsMethodModel; var EventLogSubscription = require('../models/subscriptions/EventLogSubscription'); var AllEventsLogSubscription = require('../models/subscriptions/AllEventsLogSubscription'); diff --git a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js index e86cc03ffb0..efcd60e3fa4 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js @@ -22,7 +22,7 @@ "use strict"; -var LogSubscriptionModel = require('web3-core-subscription').LogSubscriptionModel; +var LogSubscriptionModel = require('web3-core-subscriptions').LogSubscriptionModel; /** * @param {Object} options diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index 997124d07dc..fc5cd06d9dc 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -22,7 +22,7 @@ "use strict"; -var LogSubscriptionModel = require('web3-core-subscription').LogSubscriptionModel; +var LogSubscriptionModel = require('web3-core-subscriptions').LogSubscriptionModel; /** * @param {ABIItemModel} abiItemModel diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index b083382fe6e..5a8c0ad9575 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -31,7 +31,7 @@ var AccountsPackage = require('web3-eth-accounts'); var PersonalPackage = require('web3-eth-personal'); var ENSPackage = require('web3-eth-ens'); var AbiPackage = require('web3-eth-abi'); -var SubscriptionPackage = require('web3-core-subscription'); +var SubscriptionPackage = require('web3-core-subscriptions'); var ProvidersPackage = require('web3-core-providers'); var Iban = require('web3-eth-iban').Iban; var formatters = require('web3-core-helpers').formatters; diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index d4ded05d0f3..25e49ed34b8 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -25,7 +25,7 @@ var version = require('./package.json'); var ProvidersPackage = require('web3-core-providers'); var MethodPackage = require('web3-core-method'); -var SubscriptionPackage = require('web3-core-subscription'); +var SubscriptionPackage = require('web3-core-subscriptions'); var NetworkPackage = require('web3-net'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; From d21ee096d6fdba742b7b3527223f323bf0a902e7 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 12:41:38 +0200 Subject: [PATCH 0199/1045] BatchRequest moved to web3-core-providers package --- packages/web3-core-batch/package.json | 9 ---- packages/web3-core-batch/src/index.js | 43 ------------------- .../src/AbstractWeb3Object.js | 18 +++----- .../src/batch-request}/BatchRequest.js | 0 .../src/factories/ProvidersPackageFactory.js | 12 ++++++ packages/web3-core-providers/src/index.js | 18 ++++++++ .../src/mappers/JSONRpcMapper.js | 2 +- .../validators/JSONRpcResponseValidator.js | 2 +- packages/web3-eth-contract/src/Contract.js | 5 --- .../src/factories/ContractPackageFactory.js | 3 -- packages/web3-eth-contract/src/index.js | 2 - packages/web3-eth/src/Eth.js | 7 +-- packages/web3-eth/src/index.js | 4 +- 13 files changed, 42 insertions(+), 83 deletions(-) delete mode 100644 packages/web3-core-batch/package.json delete mode 100644 packages/web3-core-batch/src/index.js rename packages/{web3-core-batch/src => web3-core-providers/src/batch-request}/BatchRequest.js (100%) diff --git a/packages/web3-core-batch/package.json b/packages/web3-core-batch/package.json deleted file mode 100644 index dbf92c10571..00000000000 --- a/packages/web3-core-batch/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "web3-core-batch", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Web3 module to handle requests to external providers.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-requestmanager", - "license": "LGPL-3.0", - "main": "src/index.js" -} diff --git a/packages/web3-core-batch/src/index.js b/packages/web3-core-batch/src/index.js deleted file mode 100644 index e103ce4b276..00000000000 --- a/packages/web3-core-batch/src/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - 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 . -*/ -/** - * @file index.js - * - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var version = require('./package.json').version; -var BatchRequest = require('./BatchRequest'); -var JSONRpcMapper = require('web3-core-providers').JSONRpcMapper; -var JSONRpcResponseValidator = require('web3-core-providers').JSONRpcResponseValidator; - -module.exports = { - version: version, - - /** - * Returns the Batch object - * - * @method createBatchRequest - * - * @param {AbstractProviderAdapter} provider - * - * @returns {BatchRequest} - */ - createBatchRequest: function (provider) { - return new BatchRequest(provider, JSONRpcMapper, JSONRpcResponseValidator); - } -}; diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 21204b864df..75011562f88 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -23,12 +23,10 @@ "use strict"; /** - * TODO: Split this AbstractWeb3Object in smaller objects and find a better naming for the AbstractWeb3Object - * @param {any} provider + * @param {Object|String} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory - * @param {BatchRequestPackage} batchRequestPackage * * @constructor */ @@ -36,8 +34,7 @@ function AbstractWeb3Object( provider, providersPackage, methodController, - methodModelFactory, - batchRequestPackage + methodModelFactory ) { if (!this.isDependencyGiven(provider)) { throw Error('Provider not found!'); @@ -57,7 +54,8 @@ function AbstractWeb3Object( WebsocketProvider: this.providersPackage.WebsocketProvider, }; - var currentProvider = null; + var currentProvider = null, + self = this; /** * Defines the accessors of currentProvider @@ -78,11 +76,9 @@ function AbstractWeb3Object( this.currentProvider = provider; - if (this.isDependencyGiven(batchRequestPackage)) { - this.BatchRequest = function BatchRequest() { - return batchRequestPackage.createBatchRequest(self.currentProvider); - }; - } + this.BatchRequest = function BatchRequest() { + return self.providersPackage.createBatchRequest(self.currentProvider); + }; if (this.isDependencyGiven(methodModelFactory) && this.isDependencyGiven(methodController)) { this.methodModelFactory = methodModelFactory; diff --git a/packages/web3-core-batch/src/BatchRequest.js b/packages/web3-core-providers/src/batch-request/BatchRequest.js similarity index 100% rename from packages/web3-core-batch/src/BatchRequest.js rename to packages/web3-core-providers/src/batch-request/BatchRequest.js diff --git a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js index b858e125a80..e35b219d3f6 100644 --- a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js +++ b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js @@ -27,6 +27,7 @@ var HttpProviderAdapter = require('../adapters/HttpProviderAdapter'); var WebsocketProvider = require('../providers/WebsocketProvider'); var IpcProvider = require('../providers/IpcProvider'); var HttpProvider = require('../providers/HttpProvider'); +var JSONRpcResponseValidator = require('../validators/JSONRpcResponseValidator'); /** * @constructor @@ -134,4 +135,15 @@ ProvidersPackageFactory.prototype.createInpageProviderAdapter = function (provid return new InpageProviderAdapter(provider) }; +/** + * Returns an JSONRpcResponseValidator object + * + * @method createJSONRpcResponseValidator + * + * @returns {JSONRpcResponseValidator} + */ +ProvidersPackageFactory.prototype.createJSONRpcResponseValidator = function () { + return new JSONRpcResponseValidator(); +}; + module.exports = ProvidersPackageFactory; diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index cdeab827c21..42a4bc83cec 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -28,6 +28,7 @@ var IpcProvider = require('./providers/IpcProvider'); var WebsocketProvider = require('./providers/WebsocketProvider'); var JSONRpcMapper = require('./mappers/JSONRpcMapper'); var JSONRpcResponseValidator = require('./validators/JSONRpcResponseValidator'); +var BatchRequest = require('./batch-request/BatchRequest'); module.exports = { version: version, @@ -41,6 +42,23 @@ module.exports = { JSONRpcMapper: JSONRpcMapper, JSONRpcResponseValidator: JSONRpcResponseValidator, + /** + * Returns the Batch object + * + * @method createBatchRequest + * + * @param {AbstractProviderAdapter} provider + * + * @returns {BatchRequest} + */ + createBatchRequest: function (provider) { + return new BatchRequest( + provider, + JSONRpcMapper, + new ProvidersPackageFactory().createJSONRpcResponseValidator() + ); + }, + /** * Resolves the right provider adapter by the given parameters * diff --git a/packages/web3-core-providers/src/mappers/JSONRpcMapper.js b/packages/web3-core-providers/src/mappers/JSONRpcMapper.js index 996c035b467..1e8c9bfebdb 100644 --- a/packages/web3-core-providers/src/mappers/JSONRpcMapper.js +++ b/packages/web3-core-providers/src/mappers/JSONRpcMapper.js @@ -25,7 +25,7 @@ /** * @constructor */ -var JSONRpcMapper = { +var JSONRpcMapper = { //TODO: Find a better solution to handle this property as "singleton" globally over the web3 lib messageId: 0 }; diff --git a/packages/web3-core-providers/src/validators/JSONRpcResponseValidator.js b/packages/web3-core-providers/src/validators/JSONRpcResponseValidator.js index 2e6a1d73cad..197e58a57b8 100644 --- a/packages/web3-core-providers/src/validators/JSONRpcResponseValidator.js +++ b/packages/web3-core-providers/src/validators/JSONRpcResponseValidator.js @@ -22,7 +22,7 @@ "use strict"; -var JSONRpcResponseValidator = {}; +function JSONRpcResponseValidator() { } /** * Executes JSON-RPC response validation diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index eee507ef560..76a38fef8aa 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -28,7 +28,6 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {AbstractProviderAdapter} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController - * @param {BatchRequestPackage} batchRequestPackage * @param {ContractPackageFactory} contractPackageFactory * @param {PromiEventPackage} promiEventPackage * @param {ABICoder} abiCoder @@ -46,7 +45,6 @@ function Contract( provider, providersPackage, methodController, - batchRequestPackage, contractPackageFactory, promiEventPackage, abiCoder, @@ -69,7 +67,6 @@ function Contract( this.provider = provider; this.providersPackage = providersPackage; this.methodController = methodController; - this.batchRequestPackage = batchRequestPackage; this.contractPackageFactory = contractPackageFactory; this.abiCoder = abiCoder; this.utils = utils; @@ -86,7 +83,6 @@ function Contract( this.providersPackage, null, null, - this.batchRequestPackage ); this.defaultBlock = 'latest'; @@ -243,7 +239,6 @@ Contract.prototype.clone = function () { this.provider, this.providersPackage, this.methodController, - this.batchRequestPackage, this.contractPackageFactory, this.promiEventPackage, this.abiCoder, diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index f7062cd2564..4b8e2d83351 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -63,7 +63,6 @@ function ContractPackageFactory(utils, formatters, abiCoder, accounts) { * @param {*} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController - * @param {BatchRequestPackage} batchRequestPackage * @param {PromiEventPackage} promiEventPackage * @param {Object} abi * @param {String} address @@ -75,7 +74,6 @@ ContractPackageFactory.prototype.createContract = function ( provider, providersPackage, methodController, - batchRequestPackage, promiEventPackage, abi, address, @@ -85,7 +83,6 @@ ContractPackageFactory.prototype.createContract = function ( provider, providersPackage, new MethodController(), - batchRequestPackage, this, promiEventPackage, this.abiCoder, diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 0fe55bd837a..8b42e4e6f51 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -26,7 +26,6 @@ var version = require('./package.json').version; var PromiEventPackage = require('web3-core-promievent'); var MethodPackage = require('web3-core-method'); var ProvidersPackage = require('web3-core-providers'); -var BatchRequestPackage = require('web3-core-batch'); var ABIPackage = require('web3-eth-abi'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; @@ -61,7 +60,6 @@ module.exports = { provider, ProvidersPackage, MethodPackage.createMethodController(), - BatchRequestPackage, PromiEventPackage, abi, address, diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index beaa43a2214..2def78cfe40 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -40,7 +40,6 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {SubscriptionsFactory} subscriptionsFactory * @param {MethodModelFactory} methodModelFactory * @param {MethodController} methodController - * @param {BatchRequestPackage} batchRequestPackage * * @constructor */ @@ -58,16 +57,14 @@ var Eth = function Eth( providersPackage, subscriptionsFactory, methodController, - methodModelFactory, - batchRequestPackage + methodModelFactory ) { AbstractWeb3Object.call( this, provider, providersPackage, methodController, - methodModelFactory, - batchRequestPackage + methodModelFactory ); var self = this; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 5a8c0ad9575..9fc689ef799 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -37,7 +37,6 @@ var Iban = require('web3-eth-iban').Iban; var formatters = require('web3-core-helpers').formatters; var Utils = require('web3-utils'); var MethodPackage = require('web3-core-method'); -var BatchRequestPackage = require('web3-core-batch'); module.exports = { version: version, @@ -68,8 +67,7 @@ module.exports = { ProvidersPackage, SubscriptionPackage.createSubscriptionsFactory(), MethodPackage.createMethodController(), - new MethodModelFactory(Utils, formatters, accounts), - BatchRequestPackage + new MethodModelFactory(Utils, formatters, accounts) ); } }; From 92b44a3646ff461ce9b5e299425254d18147f59d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 12:44:57 +0200 Subject: [PATCH 0200/1045] constructor improved in AbstractWeb3Object --- .../web3-core-package/src/AbstractWeb3Object.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 75011562f88..d5fa0b185d0 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -44,6 +44,7 @@ function AbstractWeb3Object( throw Error('ProviderPackage not found!'); } + this.methodController = methodController; this.extendedPackages = []; this.providersPackage = providersPackage; this.givenProvider = this.providersPackage.detect(); @@ -80,9 +81,8 @@ function AbstractWeb3Object( return self.providersPackage.createBatchRequest(self.currentProvider); }; - if (this.isDependencyGiven(methodModelFactory) && this.isDependencyGiven(methodController)) { + if (methodModelFactory !== null || typeof methodModelFactory !== 'undefined') { this.methodModelFactory = methodModelFactory; - this.methodController = methodController; return new Proxy(this, { @@ -92,19 +92,6 @@ function AbstractWeb3Object( } } -/** - * Checks if the parameter is defined - * - * @method isDependencyGiven - * - * @param {Object} object - * - * @returns {boolean} - */ -AbstractWeb3Object.prototype.isDependencyGiven = function (object) { - return object !== null || typeof object !== 'undefined'; -}; - /** * Sets the currentProvider and provider property * From 0539bc256e0ed93b38317b941931cfa7b927750e Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 12:55:52 +0200 Subject: [PATCH 0201/1045] Eth.setProvider() updated --- packages/web3-eth/src/Eth.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 2def78cfe40..e16db49345e 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -183,7 +183,6 @@ Eth.prototype.setProvider = function (provider) { this.net.setProvider(provider); this.accounts.setProvider(provider); this.personal.setProvider(provider); - this.ens.setProvider(provider); this.initiatedContracts.forEach(function (contract) { contract.setProvider(provider); From f759fe2eb33581a45d06b775c85af5c51aae7233 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 13:54:28 +0200 Subject: [PATCH 0202/1045] unused requires removed --- .../src/models/methods/ContractDeployMethodModel.js | 2 +- .../src/validators/RpcMethodOptionsValidator.js | 2 -- packages/web3-eth/src/Eth.js | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js index 42d6937eec3..01464619e82 100644 --- a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js @@ -21,7 +21,7 @@ */ "use strict"; -var _ = require('underscore'); + var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; /** diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js index f1fbfafb734..a9dd69b69af 100644 --- a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -22,8 +22,6 @@ "use strict"; -var _ = require('underscore'); - /** * @param {Object} utils * diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index e16db49345e..28079f03e4f 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -22,7 +22,6 @@ "use strict"; -var _ = require('underscore'); var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** From 7f5c2c3d7fca29d0b515f3470eecaafca20769fb Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 5 Oct 2018 16:04:55 +0200 Subject: [PATCH 0203/1045] methods parameters length validation added to proxyHandler method in AbstractWeb3Object --- .../methods/transaction/SignTransactionMethodModel.js | 2 +- packages/web3-core-package/src/AbstractWeb3Object.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index 90f86c1285f..eafb9cb4cf0 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -39,7 +39,7 @@ function SignTransactionMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {Object} web3Package - The package where the method is called from. */ SignTransactionMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index d5fa0b185d0..9d721e174e8 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -208,6 +208,15 @@ AbstractWeb3Object.prototype.proxyHandler = function (target, name) { var anonymousFunction = function () { methodModel.methodArguments = arguments; + if (methodModel.parameters.length !== methodModel.parametersAmount) { + throw Error( + 'Invalid parameters length the expected length would be' + + methodModel.parametersAmount + + 'and not' + + methodModel.parameters.length + ); + } + return target.methodController.execute(methodModel, target.accounts, target); }; From de472c924cdc899c03ac0cc041e3494cc109df2d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 13:37:41 +0200 Subject: [PATCH 0204/1045] EthPackage, BzzPackage, Web3 and HelpersPackage Readme updated --- packages/web3-bzz/README.md | 9 ++-- packages/web3-core-helpers/README.md | 2 +- packages/web3-core-method/README.md | 69 ++++++++++++++++++++++++---- packages/web3/README.md | 4 +- 4 files changed, 66 insertions(+), 18 deletions(-) diff --git a/packages/web3-bzz/README.md b/packages/web3-bzz/README.md index b52b05fec61..ad455d66705 100644 --- a/packages/web3-bzz/README.md +++ b/packages/web3-bzz/README.md @@ -2,8 +2,7 @@ This is a sub package of [web3.js][repo] -This is the swarm package. -Please read the [documentation][docs] for more. +This is the swarm package of web3.js for further information please read the [documentation][docs]. ## Installation @@ -22,16 +21,16 @@ npm run-script build-all ``` Then include `dist/web3-bzz.js` in your html file. -This will expose the `Web3Personal` object on the window object. +This will expose the `Web3Bzz` object on the window object. ## Usage ```js // in node.js -var Web3Bzz = require('web3-bzz'); +var bzzPackage = require('web3-bzz'); -var bzz = new Web3Bzz('http://swarm-gateways.net'); +var bzz = bzzPackage.createBzz('http://swarm-gateways.net'); ``` diff --git a/packages/web3-core-helpers/README.md b/packages/web3-core-helpers/README.md index 0d973edff3d..113cb257e6e 100644 --- a/packages/web3-core-helpers/README.md +++ b/packages/web3-core-helpers/README.md @@ -2,7 +2,7 @@ This is a sub package of [web3.js][repo] -Helper functions used in [web3.js][repo] packages. +The Helper functions are used in all [web3.js][repo] packages. Please read the [documentation][docs] for more. ## Installation diff --git a/packages/web3-core-method/README.md b/packages/web3-core-method/README.md index 01c5dd4e761..df1644f533c 100644 --- a/packages/web3-core-method/README.md +++ b/packages/web3-core-method/README.md @@ -29,17 +29,66 @@ This will expose the `Web3Method` object on the window object. ```js // in node.js -var Web3Method = require('web3-core-method'); -var method = new Web3Method({ - name: 'sendTransaction', - call: 'eth_sendTransaction', - params: 1, - inputFormatter: [inputTransactionFormatter] -}); -method.attachToObject(myCoolLib); - -myCoolLib.sendTransaction({...}, function(){ ... }); +// Dependencies +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var Utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; +var MethodPackage = require('web3-core-method'); +var ProvidersPackage = require('web3-core-providers'); + +// Create an object/package like Eth + +function MyObject ( + provider, + providersPackage, + methodController, + methodModelFactory +) { + AbstractWeb3Object.call( + this, + provider, + providersPackage, + methodController, + methodModelFactory + ); +}; + +// Inherit from AbstractWeb3Object +MyObject.prototype = Object.create(AbstractWeb3Object.prototype); +MyObject.prototype.constructor = MyObject; + + + +// Create the MyMethoModelFactory object + +function MyMethodModelFactory(utils, formatters) { + MethodPackage.AbstractMethodModelFactory.call( + this, + { + sendTransaction: MethodPackage.SendTransactionMethodModel + }, + utils, + formatters + ); +} + +// Inherit from AbstractMethodModelFactory +MyMethodModelFactory.prototype = Object.create( + MethodPackage.AbstractMethodModelFactory.prototype +); +MyMethodModelFactory.prototype.constructor = MyMethodModelFactory; + + +// Initiate all objects +var myObject = new MyObject( + provider, + ProvidersPackage, + MethodPackage.createMethodController(), + new MyMethodModelFactory(Utils, formatters) +); + +myObject.sendTransaction({...}, function(){ ... }); ``` diff --git a/packages/web3/README.md b/packages/web3/README.md index 885d2679367..3cffc9dd177 100644 --- a/packages/web3/README.md +++ b/packages/web3/README.md @@ -1,8 +1,8 @@ # web3 -This is a main package of [web3.js](https://github.com/ethereum/web3.js) +This is the main package of [web3.js](https://github.com/ethereum/web3.js) -Please read the main [readme](https://github.com/ethereum/web3.js/blob/1.0/README.md) and [documentation](https://web3js.readthedocs.io/en/1.0/) for more. +Please read the [readme](https://github.com/ethereum/web3.js/blob/1.0/README.md) and [documentation](https://web3js.readthedocs.io/en/1.0/) for more. ## Installation From 331267e1c28ed80f35447ae0aacf2c134cfd7498 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 14:04:06 +0200 Subject: [PATCH 0205/1045] AbstractWeb3Object improved and detailed readme written for it --- packages/web3-core-package/README.md | 50 ++++++++++++------- .../src/AbstractWeb3Object.js | 5 +- packages/web3-core-promievent/README.md | 2 +- 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/packages/web3-core-package/README.md b/packages/web3-core-package/README.md index e559912882d..94ae1954f38 100644 --- a/packages/web3-core-package/README.md +++ b/packages/web3-core-package/README.md @@ -2,15 +2,27 @@ This is a sub package of [web3.js][repo] -The core package contains core functions for [web3.js][repo] packages. -Please read the [documentation][docs] for more. +The ```web3-core-package``` contains core functions for [web3.js][repo] packages. This package should be used +if someone wants to implement a new web3 package. + +Provided interface of AbstractWeb3Object: + +- ```extend(methods: Object):void ``` Extends the current Object with additional RPC methods. +- ```setProvider(provider: any):void ``` This method will set the current provider of this object. +- ```clearSubscriptions():void ``` This method will clear all subscriptions +- ```proxyHandler(target, name): any``` This method will be used for the RPC method handling in the Proxy object. This method can be overwritten if you want to change the default behaviour of the Proxy. +- ```BatchRequest``` With this property we provide the possibility to create batch requests. Please have a look on the official [documentation][docs] for further information. +- ```givenProvider``` This property contains the detected provider. +- ```currentProvider``` This property contains the current provider of this object. +- ```methodController``` This property is an instance of ```MethodController```. This will be used to execute an RPC request. For further information please have a look on the ```MethodController``` in the ```web3-core-method``` package. +- ```methodModelFactory``` This property is an instance of ```AbstractMethodModelFactory```. If this property is given than it will create an "MethodProxy". Please have an look on the ```web3-core-method```readme for further information. ## Installation ### Node.js ```bash -npm install web3-core +npm install web3-core-package ``` @@ -18,22 +30,26 @@ npm install web3-core ```js // in node.js -var core = require('web3-core'); - -var CoolLib = function CoolLib() { - - // sets _requestmanager and adds basic functions - core.packageInit(this, arguments); - +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; + +function MyObject ( + provider, + providersPackage, + methodController, + methodModelFactory // optional +) { + AbstractWeb3Object.call( + this, + provider, + providersPackage, + methodController, + methodModelFactory // optional + ); }; - -CoolLib.providers; -CoolLib.givenProvider; -CoolLib.setProvider(); -CoolLib.BatchRequest(); -CoolLib.extend(); -... +// Inherit from AbstractWeb3Object +MyObject.prototype = Object.create(AbstractWeb3Object.prototype); +MyObject.prototype.constructor = MyObject; ``` diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 9d721e174e8..a7a724dcf2b 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -66,10 +66,7 @@ function AbstractWeb3Object( return currentProvider; }, set: function (provider) { - if (typeof currentProvider.clearSubscriptions !== 'undefined' && currentProvider.subscriptions.length > 0) { - currentProvider.clearSubscriptions(); - } - + this.clearSubscriptions(); currentProvider = this.providersPackage.resolve(provider); }, enumerable: true diff --git a/packages/web3-core-promievent/README.md b/packages/web3-core-promievent/README.md index cfdf0b6e443..250b681a56e 100644 --- a/packages/web3-core-promievent/README.md +++ b/packages/web3-core-promievent/README.md @@ -32,7 +32,7 @@ This will expose the `Web3PromiEvent` object on the window object. var Web3PromiEvent = require('web3-core-promievent'); var myFunc = function(){ - var promiEvent = Web3PromiEvent(); + var promiEvent = Web3PromiEvent.createPromiEvent(); setTimeout(function() { promiEvent.eventEmitter.emit('done', 'Hello!'); From 027ef7ef0b886bbcf64699d8b25af0ac59745694 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 14:10:45 +0200 Subject: [PATCH 0206/1045] setProvider behaviour explanation added to the 'web2-core-package' readme --- packages/web3-core-package/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/web3-core-package/README.md b/packages/web3-core-package/README.md index 94ae1954f38..1533e4e06c3 100644 --- a/packages/web3-core-package/README.md +++ b/packages/web3-core-package/README.md @@ -5,9 +5,12 @@ This is a sub package of [web3.js][repo] The ```web3-core-package``` contains core functions for [web3.js][repo] packages. This package should be used if someone wants to implement a new web3 package. +If you implement your own web3 package then don't forget to add the ```setProvider()``` method to the parent object. +This because the default behaviour of ```setProvider()``` is that the parent object will also set the provider of the child packages if this method is called. + Provided interface of AbstractWeb3Object: -- ```extend(methods: Object):void ``` Extends the current Object with additional RPC methods. +- ```extend(methods: Object):void ``` Extends the current object with additional RPC methods. - ```setProvider(provider: any):void ``` This method will set the current provider of this object. - ```clearSubscriptions():void ``` This method will clear all subscriptions - ```proxyHandler(target, name): any``` This method will be used for the RPC method handling in the Proxy object. This method can be overwritten if you want to change the default behaviour of the Proxy. From 258b0ce03ffc0ba358d7d574f1aaa920d5fc3f89 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 14:15:12 +0200 Subject: [PATCH 0207/1045] breaks removed from readme --- packages/web3-core-package/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/web3-core-package/README.md b/packages/web3-core-package/README.md index 1533e4e06c3..c86e1ee553b 100644 --- a/packages/web3-core-package/README.md +++ b/packages/web3-core-package/README.md @@ -18,7 +18,7 @@ Provided interface of AbstractWeb3Object: - ```givenProvider``` This property contains the detected provider. - ```currentProvider``` This property contains the current provider of this object. - ```methodController``` This property is an instance of ```MethodController```. This will be used to execute an RPC request. For further information please have a look on the ```MethodController``` in the ```web3-core-method``` package. -- ```methodModelFactory``` This property is an instance of ```AbstractMethodModelFactory```. If this property is given than it will create an "MethodProxy". Please have an look on the ```web3-core-method```readme for further information. +- ```methodModelFactory``` This property is an instance of ```AbstractMethodModelFactory```. If this property is given then it will create an "MethodProxy". Please have a look on the ```web3-core-method```readme file for further information. ## Installation @@ -55,8 +55,5 @@ MyObject.prototype = Object.create(AbstractWeb3Object.prototype); MyObject.prototype.constructor = MyObject; ``` - [docs]: http://web3js.readthedocs.io/en/1.0/ [repo]: https://github.com/ethereum/web3.js - - From 6461e2c48f4b2951f48c250c1a4693bc29beebfd Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 14:35:39 +0200 Subject: [PATCH 0208/1045] web3-core-subscriptions readme updated --- packages/web3-core-method/README.md | 4 +- packages/web3-core-package/README.md | 5 +- packages/web3-core-subscriptions/README.md | 72 +++++++++++++++------- 3 files changed, 53 insertions(+), 28 deletions(-) diff --git a/packages/web3-core-method/README.md b/packages/web3-core-method/README.md index df1644f533c..7aeaa241df0 100644 --- a/packages/web3-core-method/README.md +++ b/packages/web3-core-method/README.md @@ -80,9 +80,9 @@ MyMethodModelFactory.prototype = Object.create( MyMethodModelFactory.prototype.constructor = MyMethodModelFactory; -// Initiate all objects +// Instantiate anything var myObject = new MyObject( - provider, + ProvidersPackage.detect(), ProvidersPackage, MethodPackage.createMethodController(), new MyMethodModelFactory(Utils, formatters) diff --git a/packages/web3-core-package/README.md b/packages/web3-core-package/README.md index c86e1ee553b..63707b484b7 100644 --- a/packages/web3-core-package/README.md +++ b/packages/web3-core-package/README.md @@ -28,7 +28,6 @@ Provided interface of AbstractWeb3Object: npm install web3-core-package ``` - ## Usage ```js @@ -38,14 +37,14 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; function MyObject ( provider, providersPackage, - methodController, + methodController, // optional methodModelFactory // optional ) { AbstractWeb3Object.call( this, provider, providersPackage, - methodController, + methodController, // optional methodModelFactory // optional ); }; diff --git a/packages/web3-core-subscriptions/README.md b/packages/web3-core-subscriptions/README.md index 98ae2f91ccc..93d93478cd2 100644 --- a/packages/web3-core-subscriptions/README.md +++ b/packages/web3-core-subscriptions/README.md @@ -1,9 +1,7 @@ # web3-core-subscriptions -This is a sub package of [web3.js][repo] - -The subscriptions package used within some [web3.js][repo] packages. -Please read the [documentation][docs] for more. +This is a sub package of [web3.js][repo]. +The subscriptions package is used within some [web3.js][repo] packages. ## Installation @@ -29,28 +27,56 @@ This will expose the `Web3Subscriptions` object on the window object. ```js // in node.js -var Web3Subscriptions = require('web3-core-subscriptions'); - -var sub = new Web3Subscriptions({ - name: 'subscribe', - type: 'eth', - subscriptions: { - 'newBlockHeaders': { - subscriptionName: 'newHeads', - params: 0, - outputFormatter: formatters.outputBlockFormatter - }, - 'pendingTransactions': { - params: 0, - outputFormatter: formatters.outputTransactionFormatter - } + +// Dependencies +var ProvidersPackage = require('web3-core-providers'); +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var SubscriptionsPackage = require('web3-core-subscriptions'); + +// Create an object of type AbstractWeb3Object +function MyObject ( + provider, + providersPackage, + subscriptionsFactory +) { + AbstractWeb3Object.call( + this, + provider, + providersPackage + ); + + this.subscriptionsFactory = subscriptionsFactory; +} + +MyObject.prototype.subscribe = function (subscriptionMethod, callback) { + switch (subscriptionMethod) { + case 'newBlockHeaders': + return this.subscriptionsFactory + .createNewHeadsSubscription(this) + .subscribe(callback); + case 'pendingTransactions': + return this.subscriptionsFactory + .createNewPendingTransactionsSubscription(this) + .subscribe(callback); + default: + throw Error('Unsupported subscription: ' + subscriptionMethod); } -}); -sub.attachToObject(myCoolLib); +}; -myCoolLib.subscribe('newBlockHeaders', function(){ ... }); -``` +// Inherit from AbstractWeb3Object +MyObject.prototype = Object.create(AbstractWeb3Object.prototype); +MyObject.prototype.constructor = MyObject; +// Instantiate anything +var myObject = new MyObject( + ProvidersPackage.detect(), + ProvidersPackage, + SubscriptionsPackage.createSubscriptionsFactory() +); + +// Subscribe +myObject.subscribe('newBlockHeaders', function(){ ... }); +``` [docs]: http://web3js.readthedocs.io/en/1.0/ [repo]: https://github.com/ethereum/web3.js From ceb5848ae4b07fcb64c2fc9056fb065b9557f077 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 14:43:28 +0200 Subject: [PATCH 0209/1045] FuncDocs added to readme files --- packages/web3-core-method/README.md | 17 ++++++++++++++--- packages/web3-core-package/README.md | 10 +++++++++- packages/web3-core-subscriptions/README.md | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/packages/web3-core-method/README.md b/packages/web3-core-method/README.md index 7aeaa241df0..5c89ee86786 100644 --- a/packages/web3-core-method/README.md +++ b/packages/web3-core-method/README.md @@ -38,7 +38,14 @@ var MethodPackage = require('web3-core-method'); var ProvidersPackage = require('web3-core-providers'); // Create an object/package like Eth - +/** + * @param {AbstractProviderAdapter} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {AbstractMethodModelFactory} methodModelFactory + * + * @constructor + */ function MyObject ( provider, providersPackage, @@ -59,9 +66,13 @@ MyObject.prototype = Object.create(AbstractWeb3Object.prototype); MyObject.prototype.constructor = MyObject; - // Create the MyMethoModelFactory object - +/** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ function MyMethodModelFactory(utils, formatters) { MethodPackage.AbstractMethodModelFactory.call( this, diff --git a/packages/web3-core-package/README.md b/packages/web3-core-package/README.md index 63707b484b7..d968127a2b0 100644 --- a/packages/web3-core-package/README.md +++ b/packages/web3-core-package/README.md @@ -34,6 +34,14 @@ npm install web3-core-package // in node.js var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +/** + * @param {AbstractProviderAdapter} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {AbstractMethodModelFactory} methodModelFactory + * + * @constructor + */ function MyObject ( provider, providersPackage, @@ -47,7 +55,7 @@ function MyObject ( methodController, // optional methodModelFactory // optional ); -}; +} // Inherit from AbstractWeb3Object MyObject.prototype = Object.create(AbstractWeb3Object.prototype); diff --git a/packages/web3-core-subscriptions/README.md b/packages/web3-core-subscriptions/README.md index 93d93478cd2..d309b89afce 100644 --- a/packages/web3-core-subscriptions/README.md +++ b/packages/web3-core-subscriptions/README.md @@ -34,6 +34,14 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var SubscriptionsPackage = require('web3-core-subscriptions'); // Create an object of type AbstractWeb3Object + +/** + * @param {AbstractProviderAdapter} provider + * @param {ProvidersPackage} providersPackage + * @param {SubscriptionsFactory} subscriptionsFactory + * + * @constructor + */ function MyObject ( provider, providersPackage, @@ -48,6 +56,17 @@ function MyObject ( this.subscriptionsFactory = subscriptionsFactory; } +/** + * Returns expected subscription + * + * @method subscribe + * + * @param {String} subscriptionMethod + * @param {Method} callback + * + * @callback callback callback(error, result) + * @returns {Subscription} + */ MyObject.prototype.subscribe = function (subscriptionMethod, callback) { switch (subscriptionMethod) { case 'newBlockHeaders': From 4f228f42c653df2d0a72cf404ef3c63e5b4efc15 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 15:07:41 +0200 Subject: [PATCH 0210/1045] readme files improved and provider handling fixed --- packages/web3-core-method/README.md | 2 +- packages/web3-core-package/README.md | 2 +- .../src/AbstractWeb3Object.js | 13 +++++++++++- packages/web3-core-subscriptions/README.md | 3 +-- packages/web3-eth/README.md | 4 ++-- packages/web3-eth/src/Eth.js | 2 +- packages/web3-eth/src/index.js | 2 +- packages/web3/src/index.js | 20 +++++-------------- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/web3-core-method/README.md b/packages/web3-core-method/README.md index 5c89ee86786..dc12346fca5 100644 --- a/packages/web3-core-method/README.md +++ b/packages/web3-core-method/README.md @@ -39,7 +39,7 @@ var ProvidersPackage = require('web3-core-providers'); // Create an object/package like Eth /** - * @param {AbstractProviderAdapter} provider + * @param {Object|String} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {AbstractMethodModelFactory} methodModelFactory diff --git a/packages/web3-core-package/README.md b/packages/web3-core-package/README.md index d968127a2b0..72e8c248018 100644 --- a/packages/web3-core-package/README.md +++ b/packages/web3-core-package/README.md @@ -35,7 +35,7 @@ npm install web3-core-package var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {AbstractProviderAdapter} provider + * @param {Object|String} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {AbstractMethodModelFactory} methodModelFactory diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index a7a724dcf2b..d97caf8acdf 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -78,7 +78,7 @@ function AbstractWeb3Object( return self.providersPackage.createBatchRequest(self.currentProvider); }; - if (methodModelFactory !== null || typeof methodModelFactory !== 'undefined') { + if (this.isDependencyGiven(methodModelFactory)) { this.methodModelFactory = methodModelFactory; return new Proxy(this, @@ -226,4 +226,15 @@ AbstractWeb3Object.prototype.proxyHandler = function (target, name) { return target[name]; }; +/** + * Checks if the given value is defined + * + * @param {*} object + * + * @returns {Boolean} + */ +AbstractWeb3Object.prototype.isDependencyGiven = function (object) { + return object !== null || typeof object !== 'undefined' +}; + module.exports = AbstractWeb3Object; diff --git a/packages/web3-core-subscriptions/README.md b/packages/web3-core-subscriptions/README.md index d309b89afce..4cb32187ce4 100644 --- a/packages/web3-core-subscriptions/README.md +++ b/packages/web3-core-subscriptions/README.md @@ -34,9 +34,8 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var SubscriptionsPackage = require('web3-core-subscriptions'); // Create an object of type AbstractWeb3Object - /** - * @param {AbstractProviderAdapter} provider + * @param {Object|String} provider * @param {ProvidersPackage} providersPackage * @param {SubscriptionsFactory} subscriptionsFactory * diff --git a/packages/web3-eth/README.md b/packages/web3-eth/README.md index ac3ec3ff0f6..55e02596711 100644 --- a/packages/web3-eth/README.md +++ b/packages/web3-eth/README.md @@ -29,9 +29,9 @@ This will expose the `Web3Eth` object on the window object. ```js // in node.js -var Web3Eth = require('web3-eth'); +var EthPackage = require('web3-eth'); -var eth = new Web3Eth('ws://localhost:8546'); +var eth = EthPackage.createEth('http://127.0.0.1:4546'); ``` diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 28079f03e4f..a8c9d6af733 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -25,7 +25,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {Object|String} provider * @param {Network} net * @param {ContractPackage} contractPackage * @param {Accounts} accounts diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 9fc689ef799..8061e907640 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -46,7 +46,7 @@ module.exports = { * * @method createEth * - * @param {AbstractProviderAdapter} provider + * @param {Object|String} provider * * @returns {Eth} */ diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 764f21790a7..9c7ad6bdef6 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -46,28 +46,18 @@ var Web3 = function Web3(provider, net) { var currentProvider = ProvidersPackage.resolve(provider, net); - if (!this._provider) { + if (!currentProvider) { throw new Error('Invalid provider given as constructor parameter!'); } this.utils = Utils; - this.eth = EthPackage.createEth(this.currentProvider); - this.shh = ShhPackage.createShh(this.currentProvider); - this.bzz = BzzPackage.createBzz(this.currentProvider); + this.eth = EthPackage.createEth(provider); + this.shh = ShhPackage.createShh(provider); + this.bzz = BzzPackage.createBzz(provider); /** - * Defines accessors for connectionModel + * Defines accessors for the currentProvider property */ - Object.defineProperty(this, 'givenProvider', { - get: function () { - return this.givenProvider; - }, - set: function (provider) { - this.givenProvider = provider; - }, - enumerable: true - }); - Object.defineProperty(this, 'currentProvider', { get: function () { return currentProvider; From ca36f31bcb73b031d2bdd050368db7bed5ce5d3c Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 15:20:22 +0200 Subject: [PATCH 0211/1045] Accounts- and ContractPackage readme updated. setProvider method overwritten in Contract.js --- .../src/AbstractWeb3Object.js | 2 +- packages/web3-eth-abi/README.md | 7 ++++--- packages/web3-eth-accounts/README.md | 6 +++--- packages/web3-eth-contract/README.md | 13 +++++++++---- packages/web3-eth-contract/src/Contract.js | 18 +++++++++++++++--- packages/web3-eth-contract/src/index.js | 2 +- packages/web3-eth/README.md | 1 - 7 files changed, 33 insertions(+), 16 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index d97caf8acdf..2cae27a62e2 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -94,7 +94,7 @@ function AbstractWeb3Object( * * @method setProvider * - * @param {any} provider + * @param {Object|String} provider */ AbstractWeb3Object.prototype.setProvider = function (provider) { var self = this; diff --git a/packages/web3-eth-abi/README.md b/packages/web3-eth-abi/README.md index 0cb883cffe5..8fea9733643 100644 --- a/packages/web3-eth-abi/README.md +++ b/packages/web3-eth-abi/README.md @@ -2,7 +2,7 @@ This is a sub package of [web3.js][repo] -This is the abi package to be used in the `web3-eth` package. +This is the abi package will be used in the `web3-eth` package. Please read the [documentation][docs] for more. ## Installation @@ -29,9 +29,10 @@ This will expose the `Web3EthAbi` object on the window object. ```js // in node.js -var Web3EthAbi = require('web3-eth-abi'); +var AbiPackage = require('web3-eth-abi'); +var abiCoder = AbiPackage.createAbiCoder(); -Web3EthAbi.encodeFunctionSignature('myMethod(uint256,string)'); +abiCoder.encodeFunctionSignature('myMethod(uint256,string)'); > '0x24ee0097' ``` diff --git a/packages/web3-eth-accounts/README.md b/packages/web3-eth-accounts/README.md index 94c31e8151a..dd188a92a88 100644 --- a/packages/web3-eth-accounts/README.md +++ b/packages/web3-eth-accounts/README.md @@ -29,10 +29,10 @@ This will expose the `Web3EthAccounts` object on the window object. ```js // in node.js -var Web3EthAccounts = require('web3-eth-accounts'); +var AccountsPackage = require('web3-eth-accounts'); +var accounts = AccountsPackage.createAccounts('ws://localhost:8546'); -var account = new Web3EthAccounts('ws://localhost:8546'); -account.create(); +accounts.create(); > { address: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', privateKey: '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318', diff --git a/packages/web3-eth-contract/README.md b/packages/web3-eth-contract/README.md index f32b9a1ae60..9e2f1b07f63 100644 --- a/packages/web3-eth-contract/README.md +++ b/packages/web3-eth-contract/README.md @@ -29,12 +29,17 @@ This will expose the `Web3EthContract` object on the window object. ```js // in node.js -var Web3EthContract = require('web3-eth-contract'); +var AccountsPackage = require('web3-eth-accounts'); +var ContractPackage = require('web3-eth-contract'); -// set provider for all later instances to use -Web3EthContract.setProvider('ws://localhost:8546'); +var contract = ContractPackage.createContract( + 'ws://localhost:8546', + AccountsPackage.createAccounts('ws://localhost:8546'), + jsonInterface, + address, + contractOptions +); -var contract = new Web3EthContract(jsonInterface, address); contract.methods.somFunc().send({from: ....}) .on('receipt', function(){ ... diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 76a38fef8aa..ca58b599bac 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -64,7 +64,6 @@ function Contract( throw new Error('You must provide the json interface of the contract when instantiating a contract object.'); } - this.provider = provider; this.providersPackage = providersPackage; this.methodController = methodController; this.contractPackageFactory = contractPackageFactory; @@ -79,7 +78,7 @@ function Contract( AbstractWeb3Object.call( this, - this.provider, + provider, this.providersPackage, null, null, @@ -236,7 +235,7 @@ Contract.prototype.deploy = function (options) { */ Contract.prototype.clone = function () { return new this.constructor( - this.provider, + this.currentProvider, this.providersPackage, this.methodController, this.contractPackageFactory, @@ -252,6 +251,19 @@ Contract.prototype.clone = function () { ); }; +/** + * Sets the currentProvider and provider property + * + * @method setProvider + * + * @param {Object|String} provider + */ +Contract.prototype.setProvider = function (provider) { + AbstractWeb3Object.prototype.setProvider.call(this, provider); + + this.accounts.setProvider(provider); +}; + Contract.prototype = Object.create(AbstractWeb3Object.prototype); Contract.prototype.constructor = Contract; diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 8b42e4e6f51..eb3dfe20bbf 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -42,7 +42,7 @@ module.exports = { /** * Returns an object of type Contract * - * @param {*} provider + * @param {Object|String} provider * @param {Accounts} accounts * @param {Object} abi * @param {String} address diff --git a/packages/web3-eth/README.md b/packages/web3-eth/README.md index 55e02596711..59fe8946894 100644 --- a/packages/web3-eth/README.md +++ b/packages/web3-eth/README.md @@ -30,7 +30,6 @@ This will expose the `Web3Eth` object on the window object. ```js // in node.js var EthPackage = require('web3-eth'); - var eth = EthPackage.createEth('http://127.0.0.1:4546'); ``` From 071526bf326d631f0fbba4f89af7be1fdf7a1fc8 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 15:26:30 +0200 Subject: [PATCH 0212/1045] funcDoc in NetworkPackage and ENSPackage readme updated --- packages/web3-eth-ens/README.md | 18 ++++++++++++------ packages/web3-net/src/Network.js | 2 +- packages/web3-net/src/index.js | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/web3-eth-ens/README.md b/packages/web3-eth-ens/README.md index cf4ab13fe75..0f0c3e17bac 100644 --- a/packages/web3-eth-ens/README.md +++ b/packages/web3-eth-ens/README.md @@ -2,7 +2,7 @@ This is a sub package of [web3.js][repo] -This is the contract package to be used in the `web3-eth` package. +This is the ENS package and it will be used in the `web3-eth` package. Please read the [documentation][docs] for more. ## Installation @@ -27,12 +27,18 @@ This will expose the `EthEns` object on the window object. ## Usage ```js - var eth = new Web3Eth(web3.currentProvider); - var ens = new EthEns(eth); +var NetPackage = require('web3-net'); +var AccountsPackage = require('web3-eth-accounts'); +var ENSPackage = require('web3-eth-ens'); + +var ens = ENSPackage.createENS( + NetPackage.createNetwork('ws://localhost:8546'), + AccountsPackage.createAccounts('ws://localhost:8546') +); - ens.getAddress('ethereum.eth').then(function (result) { - console.log(result); - }); +ens.getAddress('ethereum.eth').then(function (result) { + console.log(result); +}); ``` diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index e359957affe..a0cbc09c992 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -26,7 +26,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {Object|String} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index 2640f67cd25..39cc8a4cb85 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -40,7 +40,7 @@ module.exports = { * * @method createNetwork * - * @param {Object} provider + * @param {Object|String} provider * * @returns {Network} */ From 79b7d81e05cbb65d5bd19727e9f29d5c778d7b42 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 15:36:29 +0200 Subject: [PATCH 0213/1045] createIban method created in IbanPackage to be consistent. Eth.js updated because of the createIban method. The Iban example in the readme file updated --- packages/web3-eth-iban/README.md | 4 ++-- packages/web3-eth-iban/src/index.js | 14 +++++++++++++- packages/web3-eth/src/Eth.js | 30 ++++++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/packages/web3-eth-iban/README.md b/packages/web3-eth-iban/README.md index d287cfbf65c..8914da6a76c 100644 --- a/packages/web3-eth-iban/README.md +++ b/packages/web3-eth-iban/README.md @@ -29,9 +29,9 @@ This will expose the `Web3EthIban` object on the window object. ```js // in node.js -var Web3EthIban = require('web3-eth-iban'); +var IbanPackage = require('web3-eth-iban'); -var iban = new Web3EthIban('XE75JRZCTTLBSYEQBGAS7GID8DKR7QY0QA3'); +var iban = IbanPackage.createIban('XE75JRZCTTLBSYEQBGAS7GID8DKR7QY0QA3'); iban.toAddress() > '0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B' ``` diff --git a/packages/web3-eth-iban/src/index.js b/packages/web3-eth-iban/src/index.js index b1f897cffa5..c2ef61ae364 100644 --- a/packages/web3-eth-iban/src/index.js +++ b/packages/web3-eth-iban/src/index.js @@ -27,5 +27,17 @@ var Iban = require('./Iban.js'); module.exports = { version: version, - Iban: Iban + + /** + * Returns an object of type Iban + * + * @method createIban + * + * @param {String} iban + * + * @returns {Iban} + */ + createIban: function (iban) { + return new Iban(iban); + } }; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index a8c9d6af733..58c9a6eef1f 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -30,7 +30,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @param {ContractPackage} contractPackage * @param {Accounts} accounts * @param {Personal} personal - * @param {Iban} iban + * @param {IbanPackage} iban * @param {Abi} abi * @param {ENS} ens * @param {Object} utils @@ -48,7 +48,7 @@ var Eth = function Eth( contractPackage, accounts, personal, - iban, + IbanPackage, abi, ens, utils, @@ -71,7 +71,20 @@ var Eth = function Eth( this.net = net; this.accounts = accounts; this.personal = personal; - this.iban = iban; + + /** + * This wrapper function is required for the "new web3.eth.Iban(...)" call. + * + * @param {String} iban + * + * @returns {Iban} + * + * @constructor + */ + this.Iban = function Iban (iban) { + return IbanPackage.createIban(iban); + }; + this.abi = abi; this.ens = ens; this.utils = utils; @@ -79,6 +92,17 @@ var Eth = function Eth( this.subscriptionsFactory = subscriptionsFactory; this.initiatedContracts = []; + /** + * This wrapper function is required for the "new web3.eth.Contract(...)" call. + * + * @param {Object} abi + * @param {String} address + * @param {Object} options + * + * @returns {Contract} + * + * @constructor + */ this.Contract = function (abi, address, options) { var contract = contractPackage.createContract(self.currentProvider, self.accounts, abi, address, options); self.initiatedContracts.push(contract); From bbb7ba84df22e5ce13ef5495779e359b30c660a6 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 15:39:40 +0200 Subject: [PATCH 0214/1045] PersonalPackage, NetworkPackage, ShhPackage and Utils readme files updated --- packages/web3-eth-personal/README.md | 5 ++--- packages/web3-eth-personal/src/Personal.js | 2 +- packages/web3-net/README.md | 7 ++----- packages/web3-shh/README.md | 5 ++--- packages/web3-utils/README.md | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/web3-eth-personal/README.md b/packages/web3-eth-personal/README.md index f64f9688dbc..4ea3b1badec 100644 --- a/packages/web3-eth-personal/README.md +++ b/packages/web3-eth-personal/README.md @@ -29,9 +29,8 @@ This will expose the `Web3EthPersonal` object on the window object. ```js // in node.js -var Web3EthPersonal = require('web3-eth-personal'); - -var personal = new Web3EthPersonal('ws://localhost:8546'); +var PersonalPackage = require('web3-eth-personal'); +var personal = PersonalPackage.createPersonal('ws://localhost:8546'); ``` diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index dabe68e95f7..2258b8b6b99 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -27,7 +27,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * TODO: Add missing documentation for getAccounts, lockAccount, importRawKey and sendTransaction! * - * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {Object|String} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory diff --git a/packages/web3-net/README.md b/packages/web3-net/README.md index 5ce25be1e76..06ec4210029 100644 --- a/packages/web3-net/README.md +++ b/packages/web3-net/README.md @@ -28,12 +28,9 @@ This will expose the `Web3Net` object on the window object. ## Usage ```js -// TODO: update usage example - // in node.js -var Web3Net = require('web3-net'); - -var net = new Web3Net('ws://localhost:8546'); +var NetworkPackage = require('web3-net'); +var net = NetworkPackage.createNetwork('ws://localhost:8546'); ``` diff --git a/packages/web3-shh/README.md b/packages/web3-shh/README.md index 7b2bf688fc8..5716b5cbe70 100644 --- a/packages/web3-shh/README.md +++ b/packages/web3-shh/README.md @@ -29,9 +29,8 @@ This will expose the `Web3Personal` object on the window object. ```js // in node.js -var Web3Personal = require('web3-shh'); - -var shh = new Web3Personal('ws://localhost:8546'); +var ShhPackage = require('web3-shh'); +var shh = ShhPackage.createShh('ws://localhost:8546'); ``` diff --git a/packages/web3-utils/README.md b/packages/web3-utils/README.md index 11c1b8103df..149ad19de1b 100644 --- a/packages/web3-utils/README.md +++ b/packages/web3-utils/README.md @@ -31,7 +31,7 @@ This will expose the `Web3Utils` object on the window object. // in node.js var Web3Utils = require('web3-utils'); console.log(Web3Utils); -{ +> { sha3: function(){}, soliditySha3: function(){}, isAddress: function(){}, From cc2546250af09edb61584e91cff0c86cd94a3b34 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 15:56:32 +0200 Subject: [PATCH 0215/1045] ProviderAdapterResolver improved --- .../src/resolvers/ProviderAdapterResolver.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index a1d49f85b0c..c28651b7d84 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -41,7 +41,7 @@ function ProviderAdapterResolver(providersPackageFactory) { * @param {*} provider * @param {Net} net * - * @returns {Object|Boolean} + * @returns {AbstractProviderAdapter|Error} */ ProviderAdapterResolver.prototype.resolve = function (provider, net) { if (typeof provider === 'string') { @@ -71,14 +71,19 @@ ProviderAdapterResolver.prototype.resolve = function (provider, net) { } switch (provider.constructor.name) { - case 'EthereumProvider': - return provider; case 'HttpProvider': return this.providersPackageFactory.createHttpProviderAdapter(provider); case 'WebsocketProvider': - return this.providersPackageFactory.createSocketProviderAdapter(provider); case 'IpcProvider': return this.providersPackageFactory.createSocketProviderAdapter(provider); + case 'EthereumProvider': + provider.sendBatch = provider.send; + + return provider; + case 'HttpProviderAdapter': + case 'SocketProviderAdapter': + case 'InpageProviderAdapter': + return provider; } throw Error('Please provide an Web3 provider or the EthereumProvider'); From be3f4566e0d805c997f3a29431efb7a9fddecbda Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 18:14:53 +0200 Subject: [PATCH 0216/1045] Provider handling fixed. The property currentProvider is now a read-only property and the constructor parameter provider of the AbstractWeb3Object is now of type AbstractProviderAdapter or EthereumProvider. The method setProvider extended with parameter 'net' otherwise the user can't set a IPC provider over the setProvider method. The method setProvider does now check if the new provider is the same as the old one and will only updated it if the path/host/url has changed or if an other protocol is used --- packages/web3-bzz/src/index.js | 3 +- packages/web3-core-method/src/index.js | 1 - .../src/AbstractWeb3Object.js | 61 ++++++++++++------- .../src/adapters/HttpProviderAdapter.js | 1 + .../src/adapters/InpageProviderAdapter.js | 2 +- .../src/adapters/SocketProviderAdapter.js | 1 + packages/web3-core-providers/src/index.js | 2 +- .../src/providers/WebsocketProvider.js | 1 + .../src/resolvers/ProviderAdapterResolver.js | 3 - packages/web3-eth-accounts/README.md | 6 +- packages/web3-eth-accounts/src/Accounts.js | 2 +- packages/web3-eth-accounts/src/index.js | 2 +- packages/web3-eth-contract/README.md | 6 +- packages/web3-eth-contract/src/Contract.js | 10 +-- packages/web3-eth-contract/src/index.js | 2 +- packages/web3-eth-ens/README.md | 8 ++- packages/web3-eth-ens/src/ENS.js | 13 ++++ .../web3-eth-ens/src/contracts/Registry.js | 23 +++++-- .../src/factories/ENSPackageFactory.js | 9 ++- packages/web3-eth-ens/src/index.js | 4 +- packages/web3-eth-personal/README.md | 3 +- packages/web3-eth-personal/src/Personal.js | 14 +++-- packages/web3-eth-personal/src/index.js | 2 +- packages/web3-eth/README.md | 6 +- packages/web3-eth/src/Eth.js | 17 +++--- packages/web3-eth/src/index.js | 2 +- packages/web3-net/README.md | 3 +- packages/web3-net/src/Network.js | 2 +- packages/web3-net/src/index.js | 2 +- packages/web3-shh/README.md | 3 +- packages/web3-shh/src/Shh.js | 11 ++-- packages/web3-shh/src/index.js | 4 +- packages/web3/src/index.js | 57 +++++++++-------- 33 files changed, 183 insertions(+), 103 deletions(-) diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index fee5ac2ab9c..8dad872db3e 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -29,11 +29,12 @@ module.exports = { version: version, /** + * TODO: Check the provider handling in swarm.js * Returns the Bzz object * * @method createBzz * - * @param {Object} provider + * @param {Object|String} provider * * @returns {Bzz} */ diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index adab36cb50c..f341f773067 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -131,7 +131,6 @@ module.exports = { /** * Methods */ - // Network GetProtocolVersionMethodModel: GetProtocolVersionMethodModel, VersionMethodModel: VersionMethodModel, diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 2cae27a62e2..82ba12cdb33 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -22,8 +22,10 @@ "use strict"; +var _ = require('underscore'); + /** - * @param {Object|String} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory @@ -55,25 +57,18 @@ function AbstractWeb3Object( WebsocketProvider: this.providersPackage.WebsocketProvider, }; - var currentProvider = null, - self = this; + var self = this, + currentProvider = provider; - /** - * Defines the accessors of currentProvider - */ Object.defineProperty(this, 'currentProvider', { get: function () { return currentProvider; }, - set: function (provider) { - this.clearSubscriptions(); - currentProvider = this.providersPackage.resolve(provider); - }, - enumerable: true + set: function () { + throw Error('The property currentProvider is an read-only property!'); + } }); - this.currentProvider = provider; - this.BatchRequest = function BatchRequest() { return self.providersPackage.createBatchRequest(self.currentProvider); }; @@ -95,17 +90,37 @@ function AbstractWeb3Object( * @method setProvider * * @param {Object|String} provider + * @param {Net} net */ -AbstractWeb3Object.prototype.setProvider = function (provider) { - var self = this; - - this.currentProvider = provider; +AbstractWeb3Object.prototype.setProvider = function (provider, net) { + if (!this.isSameProvider(provider)) { + this.clearSubscriptions(); + this.currentProvider = this.providersPackage.resolve(provider, net); + + if (this.extendedPackages.length > 0) { + this.extendedPackages.forEach(function (extendedPackage) { + extendedPackage.setProvider(provider, net) + }); + } + } +}; - if (this.extendedPackages.length > 0) { - this.extendedPackages.forEach(function(extendedPackage) { - extendedPackage.setProvider(self.currentProvider) - }); +/** + * Checks if the given provider is the same as the currentProvider + * + * @method isSameProvider + * + * @param {Object|String} provider + * + * @returns {Boolean} + */ +AbstractWeb3Object.prototype.isSameProvider = function (provider) { + if (_.isObject(provider)) { + return this.currentProvider.provider.constructor.name === provider.constructor.name && + this.currentProvider.host !== provider.host; } + + return this.currentProvider.host === provider; }; /** @@ -114,7 +129,9 @@ AbstractWeb3Object.prototype.setProvider = function (provider) { * @method clearSubscriptions */ AbstractWeb3Object.prototype.clearSubscriptions = function () { - if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && this.currentProvider.hasSubscription()) { + if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && + this.currentProvider.subscriptions.length > 0 + ) { this.currentProvider.clearSubscriptions(); } }; diff --git a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js index d6aa48c7f2f..6b3e92c02c4 100644 --- a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js @@ -31,6 +31,7 @@ var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapte */ function HttpProviderAdapter(httpProvider) { AbstractProviderAdapter.call(this, httpProvider); + this.host = httpProvider.host; } HttpProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js index f2a8e559771..7c02a2a75d0 100644 --- a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js @@ -29,7 +29,7 @@ var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapte * * @constructor */ -function InpageProviderAdapter(inpageProvider) { +function InpageProviderAdapter(inpageProvider) {// TODO: Check if there is a way to set a host property (will be used on setProvider) AbstractProviderAdapter.call(this, inpageProvider); this.provider.send = this.provider.sendAsync; delete this.provider.sendAsync; diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index 8db2e39622c..a9238374af9 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -31,6 +31,7 @@ var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapte */ function SocketProviderAdapter(provider) { AbstractProviderAdapter.call(this, provider); + this.host = provider.path; this.subscriptions = []; this.registerSubscriptionListener(); } diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index 42a4bc83cec..50d52120862 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -47,7 +47,7 @@ module.exports = { * * @method createBatchRequest * - * @param {AbstractProviderAdapter} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * * @returns {BatchRequest} */ diff --git a/packages/web3-core-providers/src/providers/WebsocketProvider.js b/packages/web3-core-providers/src/providers/WebsocketProvider.js index 19ea4408301..2d30eb2f0b4 100644 --- a/packages/web3-core-providers/src/providers/WebsocketProvider.js +++ b/packages/web3-core-providers/src/providers/WebsocketProvider.js @@ -67,6 +67,7 @@ var WebsocketProvider = function WebsocketProvider(url, options) { var _this = this; this.responseCallbacks = {}; this.notificationCallbacks = []; + this.path = url; options = options || {}; this._customTimeout = options.timeout; diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index c28651b7d84..3b77ab5f75b 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -77,9 +77,6 @@ ProviderAdapterResolver.prototype.resolve = function (provider, net) { case 'IpcProvider': return this.providersPackageFactory.createSocketProviderAdapter(provider); case 'EthereumProvider': - provider.sendBatch = provider.send; - - return provider; case 'HttpProviderAdapter': case 'SocketProviderAdapter': case 'InpageProviderAdapter': diff --git a/packages/web3-eth-accounts/README.md b/packages/web3-eth-accounts/README.md index dd188a92a88..2552b9f99d6 100644 --- a/packages/web3-eth-accounts/README.md +++ b/packages/web3-eth-accounts/README.md @@ -29,8 +29,12 @@ This will expose the `Web3EthAccounts` object on the window object. ```js // in node.js +var ProvidersPackage = require('web3-core-providers'); var AccountsPackage = require('web3-eth-accounts'); -var accounts = AccountsPackage.createAccounts('ws://localhost:8546'); + +var accounts = AccountsPackage.createAccounts( + ProvidersPackage.resolve('ws://localhost:8546') +); accounts.create(); > { diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 1f1681ed9a6..ec896b76b61 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -54,7 +54,7 @@ var makeEven = function (hex) { /** - * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 2f044eeb393..31799dff1aa 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -38,7 +38,7 @@ module.exports = { * * @method createAccounts * - * @params {Object} provider + * @params {AbstractProviderAdapter|EthereumProvider} provider * * @returns {Accounts} */ diff --git a/packages/web3-eth-contract/README.md b/packages/web3-eth-contract/README.md index 9e2f1b07f63..fc70a19284a 100644 --- a/packages/web3-eth-contract/README.md +++ b/packages/web3-eth-contract/README.md @@ -29,12 +29,14 @@ This will expose the `Web3EthContract` object on the window object. ```js // in node.js +var ProvidersPackage = require('web3-core-providers'); var AccountsPackage = require('web3-eth-accounts'); var ContractPackage = require('web3-eth-contract'); +var provider = ProvidersPackage.resolve('ws://localhost:8546'); var contract = ContractPackage.createContract( - 'ws://localhost:8546', - AccountsPackage.createAccounts('ws://localhost:8546'), + provider, + AccountsPackage.createAccounts(provider), jsonInterface, address, contractOptions diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index ca58b599bac..e6f32272300 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -25,7 +25,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {AbstractProviderAdapter} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {ContractPackageFactory} contractPackageFactory @@ -257,11 +257,11 @@ Contract.prototype.clone = function () { * @method setProvider * * @param {Object|String} provider + * @param {Net} net */ -Contract.prototype.setProvider = function (provider) { - AbstractWeb3Object.prototype.setProvider.call(this, provider); - - this.accounts.setProvider(provider); +Contract.prototype.setProvider = function (provider, net) { + AbstractWeb3Object.prototype.setProvider.call(this, provider, net); + this.accounts.setProvider(provider, net); }; Contract.prototype = Object.create(AbstractWeb3Object.prototype); diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index eb3dfe20bbf..858ded53b48 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -42,7 +42,7 @@ module.exports = { /** * Returns an object of type Contract * - * @param {Object|String} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Accounts} accounts * @param {Object} abi * @param {String} address diff --git a/packages/web3-eth-ens/README.md b/packages/web3-eth-ens/README.md index 0f0c3e17bac..6a524642552 100644 --- a/packages/web3-eth-ens/README.md +++ b/packages/web3-eth-ens/README.md @@ -27,13 +27,17 @@ This will expose the `EthEns` object on the window object. ## Usage ```js +var ProvidersPackage = require('web3-core-providers'); var NetPackage = require('web3-net'); var AccountsPackage = require('web3-eth-accounts'); var ENSPackage = require('web3-eth-ens'); +var provider = ProvidersPackage.resolve('ws://localhost:8546'); + var ens = ENSPackage.createENS( - NetPackage.createNetwork('ws://localhost:8546'), - AccountsPackage.createAccounts('ws://localhost:8546') + provider, + NetPackage.createNetwork(provider), + AccountsPackage.createAccounts(provider) ); ens.getAddress('ethereum.eth').then(function (result) { diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index 41f6d9f28cd..b254c474361 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -31,6 +31,19 @@ function ENS(registry, resolverMethodHandler) { this.resolverMethodHandler = resolverMethodHandler; } +/** + * Sets the provider for the registry and resolver object. + * This method will also set the provider in the NetworkPackage and AccountsPackage because they are used here. + * + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net + */ +ENS.prototype.setProvider = function (provider, net) { + this.registry.setProvider(provider, net); +}; + /** * Returns an contract of type resolver * diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index c01d28b372b..c98b06cba24 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -23,7 +23,7 @@ var _ = require('underscore'); var namehash = require('eth-ens-namehash'); /** - * @param {Network} net + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Accounts} accounts * @param {ContractPackage} contractPackage * @param {Object} registryABI @@ -31,17 +31,18 @@ var namehash = require('eth-ens-namehash'); * * @constructor */ -function Registry(net, accounts, contractPackage, registryABI, resolverABI) { +function Registry(provider, accounts, contractPackage, registryABI, resolverABI) { var self = this; this.net = net; this.accounts = accounts; this.contractPackage = contractPackage; this.registryABI = registryABI; this.resolverABI = resolverABI; + this.provider = provider; this.contract = this.checkNetwork().then(function (address) { return self.contractPackage.createContract( - self.net.currentProvider, + self.provider, self.accounts, self.registryABI, address @@ -49,6 +50,20 @@ function Registry(net, accounts, contractPackage, registryABI, resolverABI) { }); } +/** + * Sets the provider in NetworkPackage, AccountsPackage and the current object. + * + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net + */ +Registry.prototype.setProvider = function (provider, net) { + this.provider = this.providersPackage.resolve(provider, net); + this.net.setProvider(provider, net); + this.accounts.setProvider(provider, net); +}; + /** * Returns the address of the owner of an ENS name. * @@ -101,7 +116,7 @@ Registry.prototype.resolver = function (name) { return contract.methods.resolver(namehash.hash(name)).call(); }).then(function (address) { return self.contractPackage.createContract( - self.net.currentProvider, + self.provider, self.accounts, self.resolverABI, address diff --git a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js index 751e838c5f7..147d3376a87 100644 --- a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js +++ b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js @@ -30,6 +30,7 @@ function ENSPackageFactory () { } * * @method createENS * + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Network} net * @param {Accounts} accounts * @param {ContractPackage} contractPackage @@ -40,6 +41,7 @@ function ENSPackageFactory () { } * @returns {ENS} */ ENSPackageFactory.prototype.createENS = function ( + provider, net, accounts, contractPackage, @@ -47,7 +49,7 @@ ENSPackageFactory.prototype.createENS = function ( resolverAbi, promiEventPackage ) { - var registry = this.createRegistry(net, accounts, contractPackage, registryAbi, resolverAbi); + var registry = this.createRegistry(provider, net, accounts, contractPackage, registryAbi, resolverAbi); return new ENS(registry, this.createResolverMethodHandler(registry, promiEventPackage)); }; @@ -57,6 +59,7 @@ ENSPackageFactory.prototype.createENS = function ( * * @method createRegistry * + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Network} net * @param {Accounts} accounts * @param {ContractPackage} contractPackage @@ -65,8 +68,8 @@ ENSPackageFactory.prototype.createENS = function ( * * @returns {Registry} */ -ENSPackageFactory.prototype.createRegistry = function (net, accounts, contractPackage, registryAbi, resolverAbi) { - return new Registry(net, accounts, contractPackage, registryAbi, resolverAbi); +ENSPackageFactory.prototype.createRegistry = function (provider, net, accounts, contractPackage, registryAbi, resolverAbi) { + return new Registry(provider, net, accounts, contractPackage, registryAbi, resolverAbi); }; /** diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index 039534c0f48..5d8da0edc70 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -35,13 +35,15 @@ module.exports = { // TODO: overthink the ens package architecture and refactor * * @method createENS * + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Network} net * @param {Accounts} accounts * * @returns {ENS} */ - createENS: function (net, accounts) { + createENS: function (provider, net, accounts) { return new ENSPackageFactory().createENS( + provider, net, accounts, ContractPackage, diff --git a/packages/web3-eth-personal/README.md b/packages/web3-eth-personal/README.md index 4ea3b1badec..302e02bef2a 100644 --- a/packages/web3-eth-personal/README.md +++ b/packages/web3-eth-personal/README.md @@ -29,8 +29,9 @@ This will expose the `Web3EthPersonal` object on the window object. ```js // in node.js +var ProvidersPackage = require('web3-core-providers'); var PersonalPackage = require('web3-eth-personal'); -var personal = PersonalPackage.createPersonal('ws://localhost:8546'); +var personal = PersonalPackage.createPersonal(ProvidersPackage.resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 2258b8b6b99..0737da1c0ce 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -27,7 +27,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** * TODO: Add missing documentation for getAccounts, lockAccount, importRawKey and sendTransaction! * - * @param {Object|String} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory @@ -72,13 +72,15 @@ function Personal(provider, providersPackage, methodController, methodModelFacto /** * Extends setProvider method from AbstractWeb3Object. - * This is required for updating the provider also in the sub package Net. * - * @param {any} provider + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net */ -Personal.prototype.setProvider = function (provider) { - AbstractWeb3Object.setProvider.call(provider); - this.net.setProvider(provider); +Personal.prototype.setProvider = function (provider, net) { + AbstractWeb3Object.setProvider.call(provider, net); + this.net.setProvider(provider, net); }; Personal.prototype = Object.create(AbstractWeb3Object); diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 28e38cc0b14..7a556b84aef 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -39,7 +39,7 @@ module.exports = { * * @method createPersonal * - * @param {any} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * * @returns {Personal} */ diff --git a/packages/web3-eth/README.md b/packages/web3-eth/README.md index 59fe8946894..2f0b5f04561 100644 --- a/packages/web3-eth/README.md +++ b/packages/web3-eth/README.md @@ -29,8 +29,12 @@ This will expose the `Web3Eth` object on the window object. ```js // in node.js +var ProvidersPackage = require('web3-core-providers'); var EthPackage = require('web3-eth'); -var eth = EthPackage.createEth('http://127.0.0.1:4546'); + +var eth = EthPackage.createEth( + ProvidersPackage.resolve('http://127.0.0.1:4546') +); ``` diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 58c9a6eef1f..0500c114b55 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -25,7 +25,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {Object|String} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Network} net * @param {ContractPackage} contractPackage * @param {Accounts} accounts @@ -199,16 +199,17 @@ Eth.prototype.subscribe = function (type, options, callback) { * Extends setProvider method from AbstractWeb3Object. * This is required for updating the provider also in the sub packages and objects related to Eth. * - * @param {any} provider + * @param {Object|String} provider + * @param {Net} net */ -Eth.prototype.setProvider = function (provider) { - AbstractWeb3Object.setProvider.call(provider); - this.net.setProvider(provider); - this.accounts.setProvider(provider); - this.personal.setProvider(provider); +Eth.prototype.setProvider = function (provider, net) { + AbstractWeb3Object.setProvider.call(provider, net); + this.net.setProvider(provider, net); + this.personal.setProvider(provider, net); + this.accounts.setProvider(provider, net); this.initiatedContracts.forEach(function (contract) { - contract.setProvider(provider); + contract.setProvider(provider, net); }); }; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 8061e907640..c954e93d71b 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -46,7 +46,7 @@ module.exports = { * * @method createEth * - * @param {Object|String} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * * @returns {Eth} */ diff --git a/packages/web3-net/README.md b/packages/web3-net/README.md index 06ec4210029..01a05e994a5 100644 --- a/packages/web3-net/README.md +++ b/packages/web3-net/README.md @@ -29,8 +29,9 @@ This will expose the `Web3Net` object on the window object. ```js // in node.js +var ProvidersPackage = require('web3-core-providers'); var NetworkPackage = require('web3-net'); -var net = NetworkPackage.createNetwork('ws://localhost:8546'); +var net = NetworkPackage.createNetwork(ProvidersPackage.resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index a0cbc09c992..fcd04e52297 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -26,7 +26,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {Object|String} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index 39cc8a4cb85..3d95854a7f7 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -40,7 +40,7 @@ module.exports = { * * @method createNetwork * - * @param {Object|String} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * * @returns {Network} */ diff --git a/packages/web3-shh/README.md b/packages/web3-shh/README.md index 5716b5cbe70..1391c5362d3 100644 --- a/packages/web3-shh/README.md +++ b/packages/web3-shh/README.md @@ -29,8 +29,9 @@ This will expose the `Web3Personal` object on the window object. ```js // in node.js +var ProvidersPackage = require('web3-core-providers'); var ShhPackage = require('web3-shh'); -var shh = ShhPackage.createShh('ws://localhost:8546'); +var shh = ShhPackage.createShh(ProvidersPackage.resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index 3b432196422..8afe7e93282 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -25,7 +25,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** - * @param {AbstractProviderAdapter | EthereumProvider} provider + * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory @@ -69,11 +69,12 @@ Shh.prototype.subscribe = function (method, options, callback) { * Extends setProvider method from AbstractWeb3Object. * This is required for updating the provider also in the sub package Net. * - * @param {any} provider + * @param {Object|String} provider + * @param {Net} net */ -Shh.prototype.setProvider = function (provider) { - AbstractWeb3Object.setProvider.call(provider); - this.net.setProvider(provider); +Shh.prototype.setProvider = function (provider, net) { + AbstractWeb3Object.setProvider.call(provider, net); + this.net.setProvider(provider, net); }; Shh.prototype = Object.create(AbstractWeb3Object.prototype); diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 25e49ed34b8..e113fcd9e50 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -38,10 +38,10 @@ module.exports = { /** * Returns the Shh object. * - * @param {Object} provider - * * @method createShh * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * * @returns {Shh} */ createShh: function (provider) { diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 9c7ad6bdef6..11de9d3a4c5 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -32,7 +32,7 @@ var NetworkPackage = require('web3-net'); var version = require('../package.json').version; /** - * @param {any} provider + * @param {Object|String} provider * @param {Net} net * * @constructor @@ -46,34 +46,43 @@ var Web3 = function Web3(provider, net) { var currentProvider = ProvidersPackage.resolve(provider, net); - if (!currentProvider) { - throw new Error('Invalid provider given as constructor parameter!'); - } - - this.utils = Utils; - this.eth = EthPackage.createEth(provider); - this.shh = ShhPackage.createShh(provider); - this.bzz = BzzPackage.createBzz(provider); - - /** - * Defines accessors for the currentProvider property - */ Object.defineProperty(this, 'currentProvider', { get: function () { return currentProvider; }, - set: function (provider) { - if (typeof currentProvider.clearSubscriptions !== 'undefined') { - currentProvider.clearSubscriptions(); - } - - currentProvider = ProvidersPackage.resolve(provider); - this.eth.setProvider(provider); - this.shh.setProvider(provider); - this.bzz.setProvider(provider); - }, - enumerable: true + set: function () { + throw Error('The property currentProvider is an read-only property!'); + } }); + + if (!this.currentProvider) { + throw new Error('Invalid provider given as constructor parameter!'); + } + + this.utils = Utils; + this.eth = EthPackage.createEth(this.currentProvider); + this.shh = ShhPackage.createShh(this.currentProvider); + this.bzz = BzzPackage.createBzz(this.currentProvider); + +}; + +/** + * Sets the provider for all packages + * + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net + */ +Web3.prototype.setProvider = function (provider, net) { + if (typeof this.currentProvider.clearSubscriptions !== 'undefined') { + this.currentProvider.clearSubscriptions(); + } + + this.currentProvider = ProvidersPackage.resolve(provider, net); + this.eth.setProvider(provider, net); + this.shh.setProvider(provider, net); + // this.bzz.setProvider(provider, net); TODO: check the provider handling in swarm.js }; Web3.givenProvider = ProvidersPackage.detect(); From 8845f207a2a1778e9c0d4aefca0e1cea4a1b11aa Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 18:15:11 +0200 Subject: [PATCH 0217/1045] isSameProvider updated --- packages/web3-core-package/src/AbstractWeb3Object.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 82ba12cdb33..ba1667a1f1e 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -116,8 +116,11 @@ AbstractWeb3Object.prototype.setProvider = function (provider, net) { */ AbstractWeb3Object.prototype.isSameProvider = function (provider) { if (_.isObject(provider)) { - return this.currentProvider.provider.constructor.name === provider.constructor.name && - this.currentProvider.host !== provider.host; + if (this.currentProvider.provider.constructor.name === provider.constructor.name) { + return this.currentProvider.host === provider.host; + } + + return false; } return this.currentProvider.host === provider; From 48ccfcb9d74397baa6d78c724777c4b2e6544d5d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 19:08:54 +0200 Subject: [PATCH 0218/1045] dependencies added to package.json --- packages/web3-core-method/package.json | 6 +++- packages/web3-core-method/src/index.js | 4 +-- packages/web3-core-package/package.json | 4 +-- packages/web3-core-promievent/package.json | 2 +- packages/web3-core-providers/package.json | 7 ++-- packages/web3-core-subscriptions/package.json | 6 ++-- packages/web3-eth-abi/package.json | 23 +++++++------ packages/web3-eth-abi/src/ABICoder.js | 16 ++++----- packages/web3-eth-abi/src/index.js | 5 ++- packages/web3-eth-accounts/package.json | 34 +++++++++++-------- packages/web3-eth-accounts/src/Accounts.js | 1 - packages/web3-eth-accounts/src/index.js | 2 ++ packages/web3-eth-contract/package.json | 9 ++++- packages/web3-eth-ens/package.json | 4 ++- .../src/handlers/ResolverMethodHandler.js | 2 +- packages/web3-eth-iban/package.json | 3 +- packages/web3-eth-personal/package.json | 10 +++++- packages/web3-eth/package.json | 24 +++++++------ packages/web3-eth/src/index.js | 4 +-- packages/web3-net/package.json | 10 +++--- packages/web3-shh/package.json | 10 +++++- packages/web3-shh/src/index.js | 4 +-- packages/web3/package.json | 10 +----- 23 files changed, 117 insertions(+), 83 deletions(-) diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index b3496e33a93..358776eb14d 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -7,6 +7,10 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "underscore": "1.8.3" + "underscore": "1.8.3", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-providers": "1.0.0-beta.36" } } diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index f341f773067..d7975e29a60 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -27,7 +27,7 @@ var version = require('./package.json'); var MethodPackageFactory = require('./factories/MethodPackageFactory'); var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); var PromiEventPackage = require('web3-core-promievent'); -var SubscriptionPackage = require('web3-core-subscriptions'); +var SubscriptionsPackage = require('web3-core-subscriptions'); var formatters = require('web3-core-helpers').formatters; // Methods @@ -123,7 +123,7 @@ module.exports = { createMethodController: function () { return new MethodPackageFactory().createMethodController( PromiEventPackage, - SubscriptionPackage.createSubscriptionsFactory(), + SubscriptionsPackage.createSubscriptionsFactory(), formatters ); }, diff --git a/packages/web3-core-package/package.json b/packages/web3-core-package/package.json index 05d5f053353..1f62d4ba4e6 100644 --- a/packages/web3-core-package/package.json +++ b/packages/web3-core-package/package.json @@ -7,8 +7,6 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" + "underscore": "1.9.1" } } diff --git a/packages/web3-core-promievent/package.json b/packages/web3-core-promievent/package.json index 014c44cb19a..8ad959a4edc 100644 --- a/packages/web3-core-promievent/package.json +++ b/packages/web3-core-promievent/package.json @@ -7,6 +7,6 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "eventemitter3": "1.1.1" + "eventemitter3": "3.1.0" } } diff --git a/packages/web3-core-providers/package.json b/packages/web3-core-providers/package.json index 3191294d162..690a9039600 100644 --- a/packages/web3-core-providers/package.json +++ b/packages/web3-core-providers/package.json @@ -8,8 +8,9 @@ "main": "src/index.js", "dependencies": { "xhr2-cookies": "1.1.0", - "oboe": "2.1.3", - "underscore": "1.8.3", - "websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible" + "oboe": "2.1.4", + "underscore": "1.9.1", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "web3-core-helpers": "1.0.0-beta.36" } } diff --git a/packages/web3-core-subscriptions/package.json b/packages/web3-core-subscriptions/package.json index 28317787e83..4208b7d2c88 100644 --- a/packages/web3-core-subscriptions/package.json +++ b/packages/web3-core-subscriptions/package.json @@ -7,7 +7,9 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "eventemitter3": "1.1.1", - "underscore": "1.8.3" + "eventemitter3": "3.1.0", + "underscore": "1.9.1", + "web3-core-helpers": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-abi/package.json b/packages/web3-eth-abi/package.json index 26771eac081..f1452370ad3 100644 --- a/packages/web3-eth-abi/package.json +++ b/packages/web3-eth-abi/package.json @@ -1,13 +1,14 @@ { - "name": "web3-eth-abi", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Web3 module encode and decode EVM in/output.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-abi", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "ethers": "4.0.0-beta.1", - "underscore": "1.8.3" - } + "name": "web3-eth-abi", + "namespace": "ethereum", + "version": "1.0.0-beta.35", + "description": "Web3 module encode and decode EVM in/output.", + "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-abi", + "license": "LGPL-3.0", + "main": "src/index.js", + "dependencies": { + "ethers": "4.0.0-beta.1", + "underscore": "1.9.1", + "web3-utils": "1.0.0-beta.36" + } } diff --git a/packages/web3-eth-abi/src/ABICoder.js b/packages/web3-eth-abi/src/ABICoder.js index 3e205f66237..72941cbd32f 100644 --- a/packages/web3-eth-abi/src/ABICoder.js +++ b/packages/web3-eth-abi/src/ABICoder.js @@ -22,8 +22,6 @@ */ var _ = require('underscore'); -var utils = require('web3-utils'); - var EthersAbi = require('ethers/utils/abi-coder').AbiCoder; var ethersAbiCoder = new EthersAbi(function (type, value) { if (type.match(/^u?int/) && !_.isArray(value) && (!_.isObject(value) || value.constructor.name !== 'BN')) { @@ -37,11 +35,13 @@ function Result() { } /** - * ABICoder prototype should be used to encode/decode solidity params of any type + * @param {Object} utils * * @constructor */ -function ABICoder () { } +function ABICoder (utils) { + this.utils = utils; +} /** * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. @@ -54,10 +54,10 @@ function ABICoder () { } */ ABICoder.prototype.encodeFunctionSignature = function (functionName) { if (_.isObject(functionName)) { - functionName = utils._jsonInterfaceMethodToString(functionName); + functionName = this.utils._jsonInterfaceMethodToString(functionName); } - return utils.sha3(functionName).slice(0, 10); + return this.utils.sha3(functionName).slice(0, 10); }; /** @@ -71,10 +71,10 @@ ABICoder.prototype.encodeFunctionSignature = function (functionName) { */ ABICoder.prototype.encodeEventSignature = function (functionName) { if (_.isObject(functionName)) { - functionName = utils._jsonInterfaceMethodToString(functionName); + functionName = this.utils._jsonInterfaceMethodToString(functionName); } - return utils.sha3(functionName); + return this.utils.sha3(functionName); }; /** diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index e0405ddef11..9214361a3a0 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -24,11 +24,14 @@ var version = require('./package.json').version; var ABICoder = require('./ABICoder'); +var Utils = require('web3-utils'); module.exports = { version: version, /** + * TODO: Improve dependency handling for ethersAbiCoder + * * Returns the ABICoder object * * @method createAbiCoder @@ -36,6 +39,6 @@ module.exports = { * @returns {ABICoder} */ createAbiCoder: function() { - return new ABICoder(); + return new ABICoder(Utils); } }; diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json index 4374b3ffa47..0ad8f6966e9 100644 --- a/packages/web3-eth-accounts/package.json +++ b/packages/web3-eth-accounts/package.json @@ -1,17 +1,21 @@ { - "name": "web3-eth-accounts", - "namespace": "ethereum", - "version": "1.0.0-beta.35", - "description": "Web3 module to generate Ethereum accounts and sign data and transactions.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-accounts", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "any-promise": "1.3.0", - "crypto-browserify": "3.12.0", - "eth-lib": "0.2.7", - "scrypt.js": "0.2.0", - "underscore": "1.8.3", - "uuid": "2.0.1", - } + "name": "web3-eth-accounts", + "namespace": "ethereum", + "version": "1.0.0-beta.35", + "description": "Web3 module to generate Ethereum accounts and sign data and transactions.", + "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-accounts", + "license": "LGPL-3.0", + "main": "src/index.js", + "dependencies": { + "crypto-browserify": "3.12.0", + "eth-lib": "0.2.8", + "scrypt.js": "0.2.0", + "underscore": "1.9.1", + "uuid": "3.3.2", + "web3-core-method": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36", + "web3-core-providers": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-package": "1.0.0-beta.36" + } } diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index ec896b76b61..13512dc231d 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -23,7 +23,6 @@ "use strict"; var _ = require("underscore"); -var Promise = require('any-promise'); var Account = require("eth-lib/lib/account"); var Hash = require("eth-lib/lib/hash"); var RLP = require("eth-lib/lib/rlp"); diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 31799dff1aa..88109cb37de 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -34,6 +34,8 @@ module.exports = { version: version, /** + * TODO: Improve dependency handling of Accounts + * * Returns the Accounts object * * @method createAccounts diff --git a/packages/web3-eth-contract/package.json b/packages/web3-eth-contract/package.json index 8bce6f4490f..9d454501254 100644 --- a/packages/web3-eth-contract/package.json +++ b/packages/web3-eth-contract/package.json @@ -7,6 +7,13 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "underscore": "1.8.3", + "underscore": "1.9.1", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-eth-abi": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-package": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-ens/package.json b/packages/web3-eth-ens/package.json index c9fa20adf14..52dd40e09c7 100644 --- a/packages/web3-eth-ens/package.json +++ b/packages/web3-eth-ens/package.json @@ -7,6 +7,8 @@ "main": "src/index.js", "dependencies": { "eth-ens-namehash": "2.0.8", - "underscore": "1.8.3", + "underscore": "1.9.1", + "web3-eth-contract": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js index 5d91411185a..048a0869ff9 100644 --- a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js +++ b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js @@ -20,8 +20,8 @@ "use strict"; -var namehash = require('eth-ens-namehash'); var _ = require('underscore'); +var namehash = require('eth-ens-namehash'); /** * @param {Registry} registry diff --git a/packages/web3-eth-iban/package.json b/packages/web3-eth-iban/package.json index f39fc7a0773..a0379208cec 100644 --- a/packages/web3-eth-iban/package.json +++ b/packages/web3-eth-iban/package.json @@ -7,6 +7,7 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "bn.js": "4.11.6", + "bn.js": "4.11.8", + "web3-utils": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-personal/package.json b/packages/web3-eth-personal/package.json index c3d09f83e25..88c103b2497 100644 --- a/packages/web3-eth-personal/package.json +++ b/packages/web3-eth-personal/package.json @@ -5,5 +5,13 @@ "description": "Web3 module to interact with the Ethereum blockchain accounts stored in the node.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-personal", "license": "LGPL-3.0", - "main": "src/index.js" + "main": "src/index.js", + "dependencies": { + "web3-core-method": "1.0.0-beta.36", + "web3-net": "1.0.0-beta.36", + "web3-core-providers": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-package": "1.0.0-beta.36" + } } diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index e4509f3c6b2..be44f439ca7 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -7,16 +7,18 @@ "license": "LGPL-3.0", "main": "src/index.js", "peerDependencies": { - "underscore": "1.8.3", - "web3-eth-contract": "1.0.0-beta.35", - "web3-eth-accounts": "1.0.0-beta.35", - "web3-eth-personal": "1.0.0-beta.35", - "web3-eth-iban": "1.0.0-beta.35", - "web3-eth-abi": "1.0.0-beta.35", - "web3-eth-ens": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-subscription": "1.0.0-beta.35", - "web3-core-promiEvent": "1.0.0-beta.35" + "web3-eth-contract": "1.0.0-beta.36", + "web3-eth-accounts": "1.0.0-beta.36", + "web3-eth-personal": "1.0.0-beta.36", + "web3-eth-iban": "1.0.0-beta.36", + "web3-eth-abi": "1.0.0-beta.36", + "web3-eth-ens": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-providers": "1.0.0-beta.36", + "web3-net": "1.0.0-beta.36", + "web3-core-package": "1.0.0-beta.36" } } diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index c954e93d71b..adad1c60b76 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -31,7 +31,7 @@ var AccountsPackage = require('web3-eth-accounts'); var PersonalPackage = require('web3-eth-personal'); var ENSPackage = require('web3-eth-ens'); var AbiPackage = require('web3-eth-abi'); -var SubscriptionPackage = require('web3-core-subscriptions'); +var SubscriptionsPackage = require('web3-core-subscriptions'); var ProvidersPackage = require('web3-core-providers'); var Iban = require('web3-eth-iban').Iban; var formatters = require('web3-core-helpers').formatters; @@ -65,7 +65,7 @@ module.exports = { Utils, formatters, ProvidersPackage, - SubscriptionPackage.createSubscriptionsFactory(), + SubscriptionsPackage.createSubscriptionsFactory(), MethodPackage.createMethodController(), new MethodModelFactory(Utils, formatters, accounts) ); diff --git a/packages/web3-net/package.json b/packages/web3-net/package.json index c747640f76d..ff15319d038 100644 --- a/packages/web3-net/package.json +++ b/packages/web3-net/package.json @@ -7,10 +7,10 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "web3-core-providers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-core-helpers": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35", - "web3-core-package": "1.0.0-beta.35" + "web3-core-providers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36", + "web3-core-package": "1.0.0-beta.36" } } diff --git a/packages/web3-shh/package.json b/packages/web3-shh/package.json index 32e134fcbaa..86e29d56a16 100644 --- a/packages/web3-shh/package.json +++ b/packages/web3-shh/package.json @@ -5,5 +5,13 @@ "description": "Web3 module to interact with the Whisper messaging protocol.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-shh", "license": "LGPL-3.0", - "main": "src/index.js" + "main": "src/index.js", + "dependencies": { + "web3-core-method": "1.0.0-beta.36", + "web3-core-providers": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-net": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36" + } } diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index e113fcd9e50..b466228ecc0 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -25,7 +25,7 @@ var version = require('./package.json'); var ProvidersPackage = require('web3-core-providers'); var MethodPackage = require('web3-core-method'); -var SubscriptionPackage = require('web3-core-subscriptions'); +var SubscriptionsPackage = require('web3-core-subscriptions'); var NetworkPackage = require('web3-net'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; @@ -50,7 +50,7 @@ module.exports = { ProvidersPackage, MethodPackage.createMethodController(), new MethodModelFactory(Utils, formatters), - SubscriptionPackage.createSubscriptionsFactory(), + SubscriptionsPackage.createSubscriptionsFactory(), NetworkPackage.createNetwork(provider) ); } diff --git a/packages/web3/package.json b/packages/web3/package.json index f02cdc9fc35..e002f4ca1bf 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -52,15 +52,7 @@ "web3-eth-personal": "1.0.0-beta.35", "web3-shh": "1.0.0-beta.35", "web3-utils": "1.0.0-beta.35", - "web3-core-subscription": "1.0.0-beta.35", - "web3-core-promievent": "1.0.0-beta.35", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-eth-ens": "1.0.0-beta.35", - "web3-eth-accounts": "1.0.0-beta.35", - "web3-eth-iban": "1.0.0-beta.35", - "web3-eth-contract": "1.0.0-beta.35", - "web3-eth-abi": "1.0.0-beta.35", + "web3-net": "1.0.0-beta.35", "web3-core-providers": "1.0.0-beta.35" } } From af9c12fb5c9439b42baf1a5dd7feb9897aed0747 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 19:14:08 +0200 Subject: [PATCH 0219/1045] gulpfile updated --- gulpfile.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 62d2990c420..7b1f67b93ad 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -82,6 +82,18 @@ var packages = [{ fileName: 'web3-core-method', expose: 'Web3Method', src: './packages/web3-core-method/src/index.js' +}, { + fileName: 'web3-core-package', + expose: 'Web3Package', + src: './packages/web3-core-package/src/index.js' +}, { + fileName: 'web3-net', + expose: 'Web3Net', + src: './packages/web3-net/src/index.js' +}, { + fileName: 'web3-core-helpers', + expose: 'Web3Helpers', + src: './packages/web3-core-helpers/src/index.js' }]; var browserifyOptions = { From fddb54dd4538f7608a63e8e6d49f4ce38acf5058 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 8 Oct 2018 19:18:18 +0200 Subject: [PATCH 0220/1045] readme files checked and corrected --- gulpfile.js | 4 ---- packages/web3-core-package/README.md | 11 +++++++++++ packages/web3-core-providers/README.md | 1 + packages/web3-shh/README.md | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 7b1f67b93ad..a5ac20b3b67 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -90,10 +90,6 @@ var packages = [{ fileName: 'web3-net', expose: 'Web3Net', src: './packages/web3-net/src/index.js' -}, { - fileName: 'web3-core-helpers', - expose: 'Web3Helpers', - src: './packages/web3-core-helpers/src/index.js' }]; var browserifyOptions = { diff --git a/packages/web3-core-package/README.md b/packages/web3-core-package/README.md index 72e8c248018..aeb404764a7 100644 --- a/packages/web3-core-package/README.md +++ b/packages/web3-core-package/README.md @@ -28,6 +28,17 @@ Provided interface of AbstractWeb3Object: npm install web3-core-package ``` +### In the Browser + +Build running the following in the [web3.js][repo] repository: + +```bash +npm run-script build-all +``` + +Then include `dist/web3-core-package.js` in your html file. +This will expose the `Web3Package` object on the window object. + ## Usage ```js diff --git a/packages/web3-core-providers/README.md b/packages/web3-core-providers/README.md index 31a87963c23..0e3d0580d15 100644 --- a/packages/web3-core-providers/README.md +++ b/packages/web3-core-providers/README.md @@ -19,6 +19,7 @@ npm run-script build-all ``` Then include `dist/web3-core-providers.js` in your html file. +This will expose the `Web3Providers` object on the window object. ## Usage diff --git a/packages/web3-shh/README.md b/packages/web3-shh/README.md index 1391c5362d3..d36df1021f5 100644 --- a/packages/web3-shh/README.md +++ b/packages/web3-shh/README.md @@ -22,7 +22,7 @@ npm run-script build-all ``` Then include `dist/web3-shh.js` in your html file. -This will expose the `Web3Personal` object on the window object. +This will expose the `Web3Shh` object on the window object. ## Usage From d4c164c37ba879a0e49ba70b6ceed5d9d81cfb7a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 9 Oct 2018 08:01:27 +0200 Subject: [PATCH 0221/1045] version in package.json set --- README.md | 4 ++-- packages/web3-bzz/package.json | 2 +- packages/web3-bzz/src/Bzz.js | 3 +-- packages/web3-core-helpers/package.json | 2 +- packages/web3-core-method/package.json | 2 +- packages/web3-core-package/package.json | 2 +- packages/web3-core-promievent/package.json | 2 +- packages/web3-core-providers/package.json | 2 +- packages/web3-core-subscriptions/package.json | 2 +- packages/web3-eth-abi/package.json | 2 +- packages/web3-eth-accounts/package.json | 2 +- packages/web3-eth-contract/package.json | 2 +- packages/web3-eth-ens/package.json | 2 +- packages/web3-eth-iban/package.json | 2 +- packages/web3-eth-personal/package.json | 2 +- packages/web3-eth/package.json | 2 +- packages/web3-net/package.json | 2 +- packages/web3-shh/package.json | 2 +- packages/web3-utils/package.json | 2 +- packages/web3/package.json | 16 ++++++++-------- 20 files changed, 28 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 3ecdcd7b6d4..e8ffdeca881 100644 --- a/README.md +++ b/README.md @@ -153,8 +153,8 @@ npm test ### Similar libraries in other languages - Python [Web3.py](https://github.com/pipermerriam/web3.py) - - Haskell [hs-web3](https://github.com/airalab/hs-web3) - Haskell [hs-web3](https://github.com/airalab/hs-web3) - - Java [web3j](https://github.com/web3j/web3j) - Java [web3j](https://github.com/web3j/web3j) + - Haskell [hs-web3](https://github.com/airalab/hs-web3) + - Java [web3j](https://github.com/web3j/web3j) - Scala [web3j-scala](https://github.com/mslinn/web3j-scala) - Purescript [purescript-web3](https://github.com/f-o-a-m/purescript-web3) - PHP [web3.php](https://github.com/sc0Vu/web3.php) diff --git a/packages/web3-bzz/package.json b/packages/web3-bzz/package.json index b03a4448674..62f2b703a1d 100644 --- a/packages/web3-bzz/package.json +++ b/packages/web3-bzz/package.json @@ -1,7 +1,7 @@ { "name": "web3-bzz", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 module to interact with the Swarm network.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-bzz", "license": "LGPL-3.0", diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index e8a34a1da0b..1e16ac90f7f 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -116,7 +116,6 @@ Bzz.prototype.hasProvider = function () { * Throws the provider error * * @method throwProviderError - * */ Bzz.prototype.throwProviderError = function () { throw new Error('No provider set, please set one using bzz.setProvider().'); @@ -153,7 +152,7 @@ Bzz.prototype.setProvider = function (provider) { // set default ethereum provider /* jshint ignore:start */ Bzz.givenProvider = null; -if(typeof ethereumProvider !== 'undefined' && ethereumProvider.bzz) { +if (typeof ethereumProvider !== 'undefined' && ethereumProvider.bzz) { Bzz.givenProvider = ethereumProvider.bzz; } /* jshint ignore:end */ diff --git a/packages/web3-core-helpers/package.json b/packages/web3-core-helpers/package.json index bc284f4cedb..fa906a2d85c 100644 --- a/packages/web3-core-helpers/package.json +++ b/packages/web3-core-helpers/package.json @@ -1,7 +1,7 @@ { "name": "web3-core-helpers", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 core tools helper for sub packages. This is an internal package.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-helpers", "license": "LGPL-3.0", diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 358776eb14d..7efe70065f9 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -1,7 +1,7 @@ { "name": "web3-core-method", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Creates the methods on the web3 modules. This is an internal package.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-method", "license": "LGPL-3.0", diff --git a/packages/web3-core-package/package.json b/packages/web3-core-package/package.json index 1f62d4ba4e6..5f712503501 100644 --- a/packages/web3-core-package/package.json +++ b/packages/web3-core-package/package.json @@ -1,7 +1,7 @@ { "name": "web3-core-package", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 core tools for sub packages. This is an internal package.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core", "license": "LGPL-3.0", diff --git a/packages/web3-core-promievent/package.json b/packages/web3-core-promievent/package.json index 8ad959a4edc..00026b89cc5 100644 --- a/packages/web3-core-promievent/package.json +++ b/packages/web3-core-promievent/package.json @@ -1,7 +1,7 @@ { "name": "web3-core-promievent", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "This package extends eventEmitters with promises to allow chaining as well as multiple final states of a function.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-promievent", "license": "LGPL-3.0", diff --git a/packages/web3-core-providers/package.json b/packages/web3-core-providers/package.json index 690a9039600..385b546a9b7 100644 --- a/packages/web3-core-providers/package.json +++ b/packages/web3-core-providers/package.json @@ -1,7 +1,7 @@ { "name": "web3-provider", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 module to handle requests to external providers.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-requestmanager", "license": "LGPL-3.0", diff --git a/packages/web3-core-subscriptions/package.json b/packages/web3-core-subscriptions/package.json index 4208b7d2c88..a3c2a836b9b 100644 --- a/packages/web3-core-subscriptions/package.json +++ b/packages/web3-core-subscriptions/package.json @@ -1,7 +1,7 @@ { "name": "web3-core-subscriptions", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Manages web3 subscriptions. This is an internal package.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-subscriptions", "license": "LGPL-3.0", diff --git a/packages/web3-eth-abi/package.json b/packages/web3-eth-abi/package.json index f1452370ad3..c08ae1bab1e 100644 --- a/packages/web3-eth-abi/package.json +++ b/packages/web3-eth-abi/package.json @@ -1,7 +1,7 @@ { "name": "web3-eth-abi", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 module encode and decode EVM in/output.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-abi", "license": "LGPL-3.0", diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json index 0ad8f6966e9..1c4482dd747 100644 --- a/packages/web3-eth-accounts/package.json +++ b/packages/web3-eth-accounts/package.json @@ -1,7 +1,7 @@ { "name": "web3-eth-accounts", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 module to generate Ethereum accounts and sign data and transactions.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-accounts", "license": "LGPL-3.0", diff --git a/packages/web3-eth-contract/package.json b/packages/web3-eth-contract/package.json index 9d454501254..a357fb363b3 100644 --- a/packages/web3-eth-contract/package.json +++ b/packages/web3-eth-contract/package.json @@ -1,7 +1,7 @@ { "name": "web3-eth-contract", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 module to interact with Ethereum smart contracts.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-contract", "license": "LGPL-3.0", diff --git a/packages/web3-eth-ens/package.json b/packages/web3-eth-ens/package.json index 52dd40e09c7..f7f4a04383c 100644 --- a/packages/web3-eth-ens/package.json +++ b/packages/web3-eth-ens/package.json @@ -1,6 +1,6 @@ { "name": "web3-eth-ens", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "ENS support for web3.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-ens", "license": "LGPL-3.0", diff --git a/packages/web3-eth-iban/package.json b/packages/web3-eth-iban/package.json index a0379208cec..af52bc0b5f0 100644 --- a/packages/web3-eth-iban/package.json +++ b/packages/web3-eth-iban/package.json @@ -1,7 +1,7 @@ { "name": "web3-eth-iban", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "This package converts Ethereum addresses to IBAN addresses a vice versa.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-iban", "license": "LGPL-3.0", diff --git a/packages/web3-eth-personal/package.json b/packages/web3-eth-personal/package.json index 88c103b2497..0bf3924c75b 100644 --- a/packages/web3-eth-personal/package.json +++ b/packages/web3-eth-personal/package.json @@ -1,7 +1,7 @@ { "name": "web3-eth-personal", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 module to interact with the Ethereum blockchain accounts stored in the node.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-personal", "license": "LGPL-3.0", diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index be44f439ca7..24aadd1093c 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -1,7 +1,7 @@ { "name": "web3-eth", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 module to interact with the Ethereum blockchain and smart contracts.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth", "license": "LGPL-3.0", diff --git a/packages/web3-net/package.json b/packages/web3-net/package.json index ff15319d038..74c76dcacd0 100644 --- a/packages/web3-net/package.json +++ b/packages/web3-net/package.json @@ -1,7 +1,7 @@ { "name": "web3-net", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 module to interact with the Ethereum nodes networking properties.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-net", "license": "LGPL-3.0", diff --git a/packages/web3-shh/package.json b/packages/web3-shh/package.json index 86e29d56a16..70453e297c3 100644 --- a/packages/web3-shh/package.json +++ b/packages/web3-shh/package.json @@ -1,7 +1,7 @@ { "name": "web3-shh", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Web3 module to interact with the Whisper messaging protocol.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-shh", "license": "LGPL-3.0", diff --git a/packages/web3-utils/package.json b/packages/web3-utils/package.json index 0406ad9b244..3066b06de9a 100644 --- a/packages/web3-utils/package.json +++ b/packages/web3-utils/package.json @@ -1,7 +1,7 @@ { "name": "web3-utils", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Collection of utility functions used in web3.js.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-utils", "license": "LGPL-3.0", diff --git a/packages/web3/package.json b/packages/web3/package.json index e002f4ca1bf..9b7e369dbd6 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -1,7 +1,7 @@ { "name": "web3", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Ethereum JavaScript API", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3", "license": "LGPL-3.0", @@ -47,12 +47,12 @@ } ], "dependencies": { - "web3-bzz": "1.0.0-beta.35", - "web3-eth": "1.0.0-beta.35", - "web3-eth-personal": "1.0.0-beta.35", - "web3-shh": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35", - "web3-net": "1.0.0-beta.35", - "web3-core-providers": "1.0.0-beta.35" + "web3-bzz": "1.0.0-beta.36", + "web3-eth": "1.0.0-beta.36", + "web3-eth-personal": "1.0.0-beta.36", + "web3-shh": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36", + "web3-net": "1.0.0-beta.36", + "web3-core-providers": "1.0.0-beta.36" } } From 5ab776b743bb1c88210499e63f59f714c62ce6ac Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 9 Oct 2018 08:28:32 +0200 Subject: [PATCH 0222/1045] web3 'umbrella package' does now inherit from AbstractWeb3Object. Extend method in AbstractWeb3Object extended with formatters property --- .../src/AbstractWeb3Object.js | 5 ++- .../src/resolvers/ProviderAdapterResolver.js | 2 +- packages/web3/package.json | 5 ++- packages/web3/src/index.js | 38 +++++++------------ 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index ba1667a1f1e..3c380961e8b 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -28,7 +28,7 @@ var _ = require('underscore'); * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController - * @param {MethodModelFactory} methodModelFactory + * @param {AbstractMethodModelFactory} methodModelFactory * * @constructor */ @@ -39,7 +39,7 @@ function AbstractWeb3Object( methodModelFactory ) { if (!this.isDependencyGiven(provider)) { - throw Error('Provider not found!'); + throw Error('No provider given as constructor parameter!'); } if (!this.isDependencyGiven(providersPackage)) { @@ -75,6 +75,7 @@ function AbstractWeb3Object( if (this.isDependencyGiven(methodModelFactory)) { this.methodModelFactory = methodModelFactory; + this.extend.formatters = this.methodModelFactory.formatters; return new Proxy(this, { diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js index 3b77ab5f75b..9b94c65ed92 100644 --- a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js @@ -83,7 +83,7 @@ ProviderAdapterResolver.prototype.resolve = function (provider, net) { return provider; } - throw Error('Please provide an Web3 provider or the EthereumProvider'); + throw Error('Please provide an valid Web3 provider or the EthereumProvider'); }; module.exports = ProviderAdapterResolver; diff --git a/packages/web3/package.json b/packages/web3/package.json index 9b7e369dbd6..fa667803d14 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -53,6 +53,9 @@ "web3-shh": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", "web3-net": "1.0.0-beta.36", - "web3-core-providers": "1.0.0-beta.36" + "web3-core-providers": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-package": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36" } } diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 11de9d3a4c5..78de3b50957 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -22,6 +22,9 @@ "use strict"; +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var formatters = require('web3-core-helpers').formatters; +var MethodPackage = require('web3-core-method'); var ProvidersPackage = require('web3-core-providers'); var EthPackage = require('web3-eth'); var PersonalPackage = require('web3-eth-personal'); @@ -40,30 +43,18 @@ var version = require('../package.json').version; var Web3 = function Web3(provider, net) { this.version = version; - if (typeof provider === 'undefined') { - throw new Error('No provider given as constructor parameter!'); - } - - var currentProvider = ProvidersPackage.resolve(provider, net); - - Object.defineProperty(this, 'currentProvider', { - get: function () { - return currentProvider; - }, - set: function () { - throw Error('The property currentProvider is an read-only property!'); - } - }); - - if (!this.currentProvider) { - throw new Error('Invalid provider given as constructor parameter!'); - } + AbstractWeb3Object.call( + this, + ProvidersPackage.resolve(provider, net), + ProvidersPackage, + MethodPackage.createMethodController(), + new MethodPackage.AbstractMethodModelFactory({}, utils, formatters) + ); this.utils = Utils; this.eth = EthPackage.createEth(this.currentProvider); this.shh = ShhPackage.createShh(this.currentProvider); this.bzz = BzzPackage.createBzz(this.currentProvider); - }; /** @@ -75,16 +66,15 @@ var Web3 = function Web3(provider, net) { * @param {Net} net */ Web3.prototype.setProvider = function (provider, net) { - if (typeof this.currentProvider.clearSubscriptions !== 'undefined') { - this.currentProvider.clearSubscriptions(); - } - - this.currentProvider = ProvidersPackage.resolve(provider, net); + AbstractWeb3Object.prototype.setProvider.call(this, provider, net); this.eth.setProvider(provider, net); this.shh.setProvider(provider, net); // this.bzz.setProvider(provider, net); TODO: check the provider handling in swarm.js }; +Web3.prototype = Object.create(AbstractWeb3Object.prototype); +Web3.prototype.constructor = Web3; + Web3.givenProvider = ProvidersPackage.detect(); Web3.version = version; From 34f583cc077bd4aa0b06728b9e237c2582e4ceca Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 9 Oct 2018 08:38:45 +0200 Subject: [PATCH 0223/1045] Bzz provider handling checked and fixed --- packages/web3-bzz/src/Bzz.js | 3 +-- packages/web3/src/index.js | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index 1e16ac90f7f..489135f8042 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -48,7 +48,7 @@ Bzz.prototype.pick = function () { return swarm.pick; } - return false; + throw Error('Pick is not supported for this environment.'); }; /** @@ -144,7 +144,6 @@ Bzz.prototype.setProvider = function (provider) { } this.currentProvider = null; - this.throwProviderError(); return false; }; diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 78de3b50957..e50d6ce055a 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -42,19 +42,20 @@ var version = require('../package.json').version; */ var Web3 = function Web3(provider, net) { this.version = version; + provider = ProvidersPackage.resolve(provider, net); AbstractWeb3Object.call( this, - ProvidersPackage.resolve(provider, net), + provider, ProvidersPackage, MethodPackage.createMethodController(), new MethodPackage.AbstractMethodModelFactory({}, utils, formatters) ); this.utils = Utils; - this.eth = EthPackage.createEth(this.currentProvider); - this.shh = ShhPackage.createShh(this.currentProvider); - this.bzz = BzzPackage.createBzz(this.currentProvider); + this.eth = EthPackage.createEth(provider); + this.shh = ShhPackage.createShh(provider); + this.bzz = BzzPackage.createBzz(provider); }; /** @@ -69,7 +70,7 @@ Web3.prototype.setProvider = function (provider, net) { AbstractWeb3Object.prototype.setProvider.call(this, provider, net); this.eth.setProvider(provider, net); this.shh.setProvider(provider, net); - // this.bzz.setProvider(provider, net); TODO: check the provider handling in swarm.js + this.bzz.setProvider(provider); }; Web3.prototype = Object.create(AbstractWeb3Object.prototype); @@ -106,4 +107,3 @@ Web3.providers = { }; module.exports = Web3; - From a0ca326209083b1dc24482aaeb3c9a5e61cfa60c Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 9 Oct 2018 08:39:30 +0200 Subject: [PATCH 0224/1045] todo removed in bzz.js --- packages/web3-bzz/src/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index 8dad872db3e..b280e4b70b6 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -29,7 +29,6 @@ module.exports = { version: version, /** - * TODO: Check the provider handling in swarm.js * Returns the Bzz object * * @method createBzz From c42cb3931bb43d83786a3c48e28f73ecbf9e5b95 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Tue, 9 Oct 2018 09:08:38 +0200 Subject: [PATCH 0225/1045] ENS documentation fixed, setProvider method added to ENS, setProvider return value fixed in all packages --- docs/include_package-core.rst | 3 +- docs/web3-eth-ens.rst | 77 +++++++++++++++---- .../src/AbstractWeb3Object.js | 10 ++- packages/web3-eth-contract/src/Contract.js | 8 +- packages/web3-eth-ens/src/ENS.js | 4 +- .../web3-eth-ens/src/contracts/Registry.js | 6 +- packages/web3-eth-personal/src/Personal.js | 5 +- packages/web3-eth/src/Eth.js | 19 +++-- packages/web3-shh/src/Shh.js | 8 +- packages/web3/src/index.js | 12 ++- 10 files changed, 115 insertions(+), 37 deletions(-) diff --git a/docs/include_package-core.rst b/docs/include_package-core.rst index 55477806d2d..2eb66ea8808 100644 --- a/docs/include_package-core.rst +++ b/docs/include_package-core.rst @@ -19,7 +19,8 @@ Will change the provider for its module. Parameters ---------- -1. ``Object`` - ``myProvider``: :ref:`a valid provider `. +1. ``Object|String`` - ``provider``: a valid provider +2. ``Net`` - ``net``: (optional) the node.js Net package. This is only required for the IPC provider. ------- Returns diff --git a/docs/web3-eth-ens.rst b/docs/web3-eth-ens.rst index 9018a0a0ed0..857b324f9c6 100644 --- a/docs/web3-eth-ens.rst +++ b/docs/web3-eth-ens.rst @@ -8,6 +8,55 @@ web3.eth.ens The ``web3.eth.ens`` functions let you interacting with ENS. +------------------------------------------------------------------------------ + +setProvider +===================== + +.. code-block:: javascript + + web3.eth.ens.setProvider(myProvider, net) + +Will change the provider for the ENS package. + +---------- +Parameters +---------- + +1. ``Object|String`` - ``provider``: a valid provider +2. ``Net`` - ``net``: (optional) the node.js Net package. This is only required for the IPC provider. + +------- +Returns +------- + +``Boolean`` + +------- +Example +------- + +.. code-block:: javascript + + var Web3 = require('web3'); + var web3 = new Web3('http://localhost:8545'); + // or + var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); + + // change provider + web3.setProvider('ws://localhost:8546'); + // or + web3.setProvider(new Web3.providers.WebsocketProvider('ws://localhost:8546')); + + // Using the IPC provider in node.js + var net = require('net'); + var web3 = new Web3('/Users/myuser/Library/Ethereum/geth.ipc', net); // mac os path + // or + var web3 = new Web3(new Web3.providers.IpcProvider('/Users/myuser/Library/Ethereum/geth.ipc', net)); // mac os path + // on windows the path is: "\\\\.\\pipe\\geth.ipc" + // on linux the path is: "/users/myuser/.ethereum/geth.ipc" + + ------------------------------------------------------------------------------ registry @@ -54,7 +103,7 @@ Returns the resolver contract to an Ethereum address. Returns ------- -``Reslver`` - The ENS resolver for this name. +``Resolver`` - The ENS resolver for this name. ------- Example @@ -178,7 +227,7 @@ Example }); - For further information on the handling of contract events please see here contract-events_. +For further information on the handling of contract events please see here contract-events_. ------------------------------------------------------------------------------ @@ -300,7 +349,7 @@ Example }); - For further information on the handling of contract events please see here contract-events_. +For further information on the handling of contract events please see here contract-events_. ------------------------------------------------------------------------------ @@ -414,7 +463,7 @@ Example }); - For further information on the handling of contract events please see here contract-events_. +For further information on the handling of contract events please see here contract-events_. ------------------------------------------------------------------------------ @@ -513,7 +562,7 @@ Example .on('error', console.error); - For further information on the handling of contract events please see here contract-events_. +For further information on the handling of contract events please see here contract-events_. ------------------------------------------------------------------------------ @@ -526,11 +575,11 @@ The ENS API provides the possibility for listening to all ENS related events. Known resolver events ------------ -1. AddrChanged(node bytes32, a address) -2. ContentChanged(node bytes32, hash bytes32) -4. NameChanged(node bytes32, name string) -5. ABIChanged(node bytes32, contentType uint256) -6. PubkeyChanged(node bytes32, x bytes32, y bytes32) +1. ``AddrChanged`` - AddrChanged(node bytes32, a address) +2. ``ContentChanged`` - ContentChanged(node bytes32, hash bytes32) +4. ``NameChanged`` - NameChanged(node bytes32, name string) +5. ``ABIChanged`` - ABIChanged(node bytes32, contentType uint256) +6. ``PubkeyChanged`` - PubkeyChanged(node bytes32, x bytes32, y bytes32) ------- Example @@ -576,10 +625,10 @@ Example Known registry events ------------ -1. Transfer(node bytes32, owner address) -2. NewOwner(node bytes32, label bytes32, owner address) -4. NewResolver(node bytes32, resolver address) -5. NewTTL(node bytes32, ttl uint64) +1. ``Transfer`` - Transfer(node bytes32, owner address) +2. ``NewOwner`` - NewOwner(node bytes32, label bytes32, owner address) +4. ``NewResolver`` - NewResolver(node bytes32, resolver address) +5. ``NewTTL`` - NewTTL(node bytes32, ttl uint64) ------- Example diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 3c380961e8b..41a6fdd4cea 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -92,6 +92,8 @@ function AbstractWeb3Object( * * @param {Object|String} provider * @param {Net} net + * + * @returns {Boolean} */ AbstractWeb3Object.prototype.setProvider = function (provider, net) { if (!this.isSameProvider(provider)) { @@ -99,11 +101,15 @@ AbstractWeb3Object.prototype.setProvider = function (provider, net) { this.currentProvider = this.providersPackage.resolve(provider, net); if (this.extendedPackages.length > 0) { - this.extendedPackages.forEach(function (extendedPackage) { - extendedPackage.setProvider(provider, net) + var setExtendedPackagesProvider = this.extendedPackages.every(function (extendedPackage) { + return !!extendedPackage.setProvider(provider, net); }); } + + return !!(setExtendedPackagesProvider && this.currentProvider); } + + return false; }; /** diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index e6f32272300..7e97ca96553 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -258,10 +258,14 @@ Contract.prototype.clone = function () { * * @param {Object|String} provider * @param {Net} net + * + * @returns {Boolean} */ Contract.prototype.setProvider = function (provider, net) { - AbstractWeb3Object.prototype.setProvider.call(this, provider, net); - this.accounts.setProvider(provider, net); + return !!( + AbstractWeb3Object.prototype.setProvider.call(this, provider, net) && + this.accounts.setProvider(provider, net) + ); }; Contract.prototype = Object.create(AbstractWeb3Object.prototype); diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index b254c474361..4d8605fbb2e 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -39,9 +39,11 @@ function ENS(registry, resolverMethodHandler) { * * @param {Object|String} provider * @param {Net} net + * + * @returns {Boolean} */ ENS.prototype.setProvider = function (provider, net) { - this.registry.setProvider(provider, net); + return this.registry.setProvider(provider, net); }; /** diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index c98b06cba24..8571a233441 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -57,11 +57,13 @@ function Registry(provider, accounts, contractPackage, registryABI, resolverABI) * * @param {Object|String} provider * @param {Net} net + * + * @returns {Boolean} */ Registry.prototype.setProvider = function (provider, net) { this.provider = this.providersPackage.resolve(provider, net); - this.net.setProvider(provider, net); - this.accounts.setProvider(provider, net); + + return !!(this.net.setProvider(provider, net) && this.accounts.setProvider(provider, net) && this.provider); }; /** diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 0737da1c0ce..68c832b96cc 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -77,10 +77,11 @@ function Personal(provider, providersPackage, methodController, methodModelFacto * * @param {Object|String} provider * @param {Net} net + * + * @returns {Boolean} */ Personal.prototype.setProvider = function (provider, net) { - AbstractWeb3Object.setProvider.call(provider, net); - this.net.setProvider(provider, net); + return !!(AbstractWeb3Object.setProvider.call(this, provider, net) && this.net.setProvider(provider, net)); }; Personal.prototype = Object.create(AbstractWeb3Object); diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 0500c114b55..6c5c1a55011 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -201,16 +201,21 @@ Eth.prototype.subscribe = function (type, options, callback) { * * @param {Object|String} provider * @param {Net} net + * + * @returns {Boolean} */ Eth.prototype.setProvider = function (provider, net) { - AbstractWeb3Object.setProvider.call(provider, net); - this.net.setProvider(provider, net); - this.personal.setProvider(provider, net); - this.accounts.setProvider(provider, net); - - this.initiatedContracts.forEach(function (contract) { - contract.setProvider(provider, net); + var setContractProviders = this.initiatedContracts.every(function (contract) { + return !!contract.setProvider(provider, net); }); + + return !!( + AbstractWeb3Object.setProvider.call(this, provider, net) && + this.net.setProvider(provider, net) && + this.personal.setProvider(provider, net) && + this.accounts.setProvider(provider, net) && + setContractProviders + ); }; Eth.prototype = Object.create(AbstractWeb3Object.prototype); diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index 8afe7e93282..209e02682ee 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -71,10 +71,14 @@ Shh.prototype.subscribe = function (method, options, callback) { * * @param {Object|String} provider * @param {Net} net + * + * @returns {Boolean} */ Shh.prototype.setProvider = function (provider, net) { - AbstractWeb3Object.setProvider.call(provider, net); - this.net.setProvider(provider, net); + return !!( + AbstractWeb3Object.setProvider.call(this, provider, net) && + this.net.setProvider(provider, net) + ); }; Shh.prototype = Object.create(AbstractWeb3Object.prototype); diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index e50d6ce055a..9567c9f0885 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -65,12 +65,16 @@ var Web3 = function Web3(provider, net) { * * @param {Object|String} provider * @param {Net} net + * + * @returns {Boolean} */ Web3.prototype.setProvider = function (provider, net) { - AbstractWeb3Object.prototype.setProvider.call(this, provider, net); - this.eth.setProvider(provider, net); - this.shh.setProvider(provider, net); - this.bzz.setProvider(provider); + return !!( + AbstractWeb3Object.prototype.setProvider.call(this, provider, net) && + this.eth.setProvider(provider, net) && + this.shh.setProvider(provider, net) && + this.bzz.setProvider(provider) + ); }; Web3.prototype = Object.create(AbstractWeb3Object.prototype); From e085283be6fd23185e8922f484e7e36c44c8d23a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 10 Oct 2018 11:47:41 +0200 Subject: [PATCH 0226/1045] funcDoc updated in Subscription.js and first test created in method package --- packages/web3-core-method/package-lock.json | 245 +++++++++++++++++- packages/web3-core-method/package.json | 7 + .../TransactionConfirmationModelTest.js | 104 ++++++++ .../src/Subscription.js | 2 +- 4 files changed, 356 insertions(+), 2 deletions(-) create mode 100644 packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js diff --git a/packages/web3-core-method/package-lock.json b/packages/web3-core-method/package-lock.json index 07f47fab5fe..03f1a044fc4 100644 --- a/packages/web3-core-method/package-lock.json +++ b/packages/web3-core-method/package-lock.json @@ -1,11 +1,254 @@ { - "requires": true, + "name": "web3-core-method", + "version": "1.0.0-beta.36", "lockfileVersion": 1, + "requires": true, "dependencies": { + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "commander": { + "version": "2.15.1", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dev": true, + "requires": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, "underscore": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true } } } diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 7efe70065f9..10d44394a6e 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -6,11 +6,18 @@ "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-method", "license": "LGPL-3.0", "main": "src/index.js", + "scripts": { + "test": "mocha './tests/**/*.js'" + }, "dependencies": { "underscore": "1.8.3", "web3-core-promievent": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", "web3-core-providers": "1.0.0-beta.36" + }, + "devDependencies": { + "chai": "^4.2.0", + "mocha": "^5.2.0" } } diff --git a/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js b/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js new file mode 100644 index 00000000000..c7de368bcf1 --- /dev/null +++ b/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js @@ -0,0 +1,104 @@ +var assert = require('chai').assert; +var TransactionConfirmationModel = require('../../src/models/TransactionConfirmationModel'); + + +/** + * TransactionConfirmationModel test + */ +describe('TransactionConfirmationModel', function() { + var model; + + beforeEach(function() { + model = new TransactionConfirmationModel(); + }); + + describe('POLLINGTIMEOUT', function() { + it('should return 15 * TIMEOUTBLOCK', function() { + assert.equal(model.POLLINGTIMEOUT, 15 * model.TIMEOUTBLOCK); + }); + }); + + describe('TIMOUTBLOCk', function () { + it('should return 50', function () { + assert.equal(model.TIMEOUTBLOCK, 50); + }); + }); + + describe('CONFIRMATIONBLOCKS', function () { + it('should return 24', function () { + assert.equal(model.TIMEOUTBLOCK, 50); + }); + }); + + describe('confirmationsCount', function () { + it('should return 0 as the initial value', function () { + assert.equal(model.confirmationsCount, 0); + }); + + it('should return one more after adding an confirmation', function () { + assert.equal(model.confirmationsCount, 0); + model.addConfirmation({}); + assert.equal(model.confirmationsCount, 1); + }); + }); + + describe('addConfirmation', function () { + it('should just add the confirmations without changing something', function () { + var confirmations = [ + {test: 'asdf'}, + {test: 'asdf'} + ]; + + model.addConfirmation(confirmations[0]); + model.addConfirmation(confirmations[1]); + + assert.deepEqual(model.confirmations, confirmations); + }); + }); + + describe('isConfirmed', function () { + it('should return true ', function () { + model.confirmations = [ + {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, + {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, + {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, + {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, + {test: 'asdf'} + ]; + + + assert.isTrue(model.isConfirmed()); + }); + + it('should return false ', function () { + model.confirmations = [{test: 'asdf'}]; + assert.isFalse(model.isConfirmed()); + }); + }); + + describe('isTimeoutTimeExceeded', function () { + describe('watcher is not polling', function() { + it('should return true ', function () { + model.timeoutCounter = 51; + assert.isTrue(model.isTimeoutTimeExceeded(false)); + }); + + it('should return false ', function () { + model.timeoutCounter = 40; + assert.isFalse(model.isTimeoutTimeExceeded(false)); + }); + }); + + describe('watcher is polling', function() { + it('should return true ', function () { + model.timeoutCounter = 1 + (15 * model.TIMEOUTBLOCK); + assert.isTrue(model.isTimeoutTimeExceeded(true)); + }); + + it('should return false ', function () { + model.timeoutCounter = 40; + assert.isFalse(model.isTimeoutTimeExceeded(true)); + }); + }); + }); +}); diff --git a/packages/web3-core-subscriptions/src/Subscription.js b/packages/web3-core-subscriptions/src/Subscription.js index 4bd583e36e5..2f0fadeac50 100644 --- a/packages/web3-core-subscriptions/src/Subscription.js +++ b/packages/web3-core-subscriptions/src/Subscription.js @@ -86,7 +86,7 @@ Subscription.prototype.subscribe = function (callback) { * * @method handleSubscriptionResponse * - * @param {any} response + * @param {*} response * @param {Function} callback * * @callback callback callback(error, result) From b85fed971f76236d329d8baf0d052aa425529234 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 10 Oct 2018 14:23:48 +0200 Subject: [PATCH 0227/1045] started with unit testing --- packages/web3-core-method/package-lock.json | 1166 ++++++++++++++++- packages/web3-core-method/package.json | 6 +- .../src/models/methods/CallMethodModel.js | 6 +- .../models/methods/EstimateGasMethodModel.js | 6 +- .../src/models/methods/GetCodeMethodModel.js | 6 +- .../models/methods/GetPastLogsMethodModel.js | 6 +- .../models/methods/GetStorageAtMethodModel.js | 6 +- .../src/models/methods/SignMethodModel.js | 6 +- .../TransactionConfirmationModelTest.js | 12 +- .../models/methods/CallMethodModelTest.js | 58 + .../methods/EstimateGasMethodModelTest.js | 60 + .../models/methods/GetCodeMethodModelTest.js | 58 + .../methods/GetPastLogsMethodModelTest.js | 58 + .../methods/GetStorageAtMethodModelTest.js | 69 + .../models/methods/SignMethodModelTest.js | 58 + 15 files changed, 1547 insertions(+), 34 deletions(-) create mode 100644 packages/web3-core-method/tests/models/methods/CallMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/SignMethodModelTest.js diff --git a/packages/web3-core-method/package-lock.json b/packages/web3-core-method/package-lock.json index 03f1a044fc4..81dec69e959 100644 --- a/packages/web3-core-method/package-lock.json +++ b/packages/web3-core-method/package-lock.json @@ -4,18 +4,117 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -26,12 +125,40 @@ "concat-map": "0.0.1" } }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, "chai": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", @@ -52,6 +179,19 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "2.15.1", "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", @@ -64,6 +204,48 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -73,6 +255,19 @@ "ms": "2.0.0" } }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -82,18 +277,310 @@ "type-detect": "^4.0.0" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "optional": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "express": { + "version": "4.16.3", + "resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz", + "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.2", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.3", + "qs": "6.5.1", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.1", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "body-parser": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.1", + "http-errors": "~1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "~2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "~1.6.15" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": ">= 1.3.1 < 2" + } + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" + } + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + } + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -106,6 +593,14 @@ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -120,24 +615,95 @@ "path-is-absolute": "^1.0.0" } }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -151,8 +717,139 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "minimatch": { "version": "3.0.4", @@ -200,30 +897,318 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, "pathval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -233,22 +1218,189 @@ "has-flag": "^3.0.0" } }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, "underscore": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" } } } diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 10d44394a6e..15fede2feac 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -11,10 +11,10 @@ }, "dependencies": { "underscore": "1.8.3", + "web3-core-helpers": "^1.0.0-beta.36", "web3-core-promievent": "1.0.0-beta.36", - "web3-core-subscriptions": "1.0.0-beta.36", - "web3-core-helpers": "1.0.0-beta.36", - "web3-core-providers": "1.0.0-beta.36" + "web3-core-providers": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36" }, "devDependencies": { "chai": "^4.2.0", diff --git a/packages/web3-core-method/src/models/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js index f2d4425b882..34ebd363f39 100644 --- a/packages/web3-core-method/src/models/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -34,6 +34,9 @@ function CallMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_call', 2, utils, formatters); } +CallMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +CallMethodModel.prototype.constructor = CallMethodModel; + /** * This method will be executed before the RPC request. * @@ -46,7 +49,4 @@ CallMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); }; -CallMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -CallMethodModel.prototype.constructor = CallMethodModel; - module.exports = CallMethodModel; diff --git a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index b7ddd8cfc31..4db3c072eb3 100644 --- a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -34,6 +34,9 @@ function EstimateGasMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_estimateGas', 1, utils, formatters); } +EstimateGasMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +EstimateGasMethodModel.prototype.constructor = EstimateGasMethodModel; + /** * This method will be executed before the RPC request. * @@ -58,7 +61,4 @@ EstimateGasMethodModel.prototype.afterExecution = function (response) { return this.utils.hexToNumber(response); }; -EstimateGasMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -EstimateGasMethodModel.prototype.constructor = EstimateGasMethodModel; - module.exports = EstimateGasMethodModel; diff --git a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index b7737ece91d..8f6e9bd8058 100644 --- a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -34,6 +34,9 @@ function GetCodeMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getCode', 2, utils, formatters); } +GetCodeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetCodeMethodModel.prototype.constructor = GetCodeMethodModel; + /** * This method will be executed before the RPC request. * @@ -46,7 +49,4 @@ GetCodeMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); }; -GetCodeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetCodeMethodModel.prototype.constructor = GetCodeMethodModel; - module.exports = GetCodeMethodModel; diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index 7857633b9c4..f84ee55fdb3 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -34,6 +34,9 @@ function GetPastLogsMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getLogs', 1, utils, formatters); } +GetPastLogsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetPastLogsMethodModel.prototype.constructor = GetPastLogsMethodModel; + /** * This method will be executed before the RPC request. * @@ -62,7 +65,4 @@ GetPastLogsMethodModel.prototype.afterExecution = function (response) { }); }; -GetPastLogsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetPastLogsMethodModel.prototype.constructor = GetPastLogsMethodModel; - module.exports = GetPastLogsMethodModel; diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index a93445d2a9f..5c785853fca 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -34,6 +34,9 @@ function GetStorageAtMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getStorageAt', 3, utils, formatters); } +GetStorageAtMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetStorageAtMethodModel.prototype.constructor = GetStorageAtMethodModel; + /** * This method will be executed before the RPC request. * @@ -47,7 +50,4 @@ GetStorageAtMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[2] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2], web3Package); }; -GetStorageAtMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetStorageAtMethodModel.prototype.constructor = GetStorageAtMethodModel; - module.exports = GetStorageAtMethodModel; diff --git a/packages/web3-core-method/src/models/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js index 8740eed0643..ed24694104b 100644 --- a/packages/web3-core-method/src/models/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -36,6 +36,9 @@ function SignMethodModel(utils, formatters, accounts) { this.accounts = accounts; } +SignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SignMethodModel.prototype.constructor = SignMethodModel; + /** * This method will be executed before the RPC request. * @@ -48,7 +51,4 @@ SignMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); }; -SignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SignMethodModel.prototype.constructor = SignMethodModel; - module.exports = SignMethodModel; diff --git a/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js b/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js index c7de368bcf1..2cc30f45649 100644 --- a/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js +++ b/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js @@ -5,15 +5,15 @@ var TransactionConfirmationModel = require('../../src/models/TransactionConfirma /** * TransactionConfirmationModel test */ -describe('TransactionConfirmationModel', function() { +describe('TransactionConfirmationModel', function () { var model; - beforeEach(function() { + beforeEach(function () { model = new TransactionConfirmationModel(); }); - describe('POLLINGTIMEOUT', function() { - it('should return 15 * TIMEOUTBLOCK', function() { + describe('POLLINGTIMEOUT', function () { + it('should return 15 * TIMEOUTBLOCK', function () { assert.equal(model.POLLINGTIMEOUT, 15 * model.TIMEOUTBLOCK); }); }); @@ -77,7 +77,7 @@ describe('TransactionConfirmationModel', function() { }); describe('isTimeoutTimeExceeded', function () { - describe('watcher is not polling', function() { + describe('watcher is not polling', function () { it('should return true ', function () { model.timeoutCounter = 51; assert.isTrue(model.isTimeoutTimeExceeded(false)); @@ -89,7 +89,7 @@ describe('TransactionConfirmationModel', function() { }); }); - describe('watcher is polling', function() { + describe('watcher is polling', function () { it('should return true ', function () { model.timeoutCounter = 1 + (15 * model.TIMEOUTBLOCK); assert.isTrue(model.isTimeoutTimeExceeded(true)); diff --git a/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js b/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js new file mode 100644 index 00000000000..8c3f4b13000 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js @@ -0,0 +1,58 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var CallMethodModel = require('../../../src/models/methods/CallMethodModel'); + +/** + * CallMethodModel test + */ +describe('CallMethodModelTest', function () { + var model; + var formattersMock = sinon.mock(formatters); + + beforeEach(function () { + model = new CallMethodModel({}, formatters); + }); + + describe('rpcMethod', function () { + it('should return eth_call', function () { + expect(model.rpcMethod).to.equal('eth_call'); + }); + }); + + describe('parametersAmount', function () { + it('should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + }); + + describe('beforeExecution', function () { + it('should call inputCallFormatter and inputDefaultBlockNumberFormatter', function () { + model.parameters = [{}, 100]; + + formattersMock + .expects('inputCallFormatter') + .withArgs(model.parameters[0], {}) + .once(); + + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[1], {}) + .once(); + + model.beforeExecution({}); + + formattersMock.verify(); + }); + }); + + describe('afterExecution', function () { + it('should just return the response', function () { + var object = {}; + + expect(model.afterExecution(object)).to.equal(object); + }); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js b/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js new file mode 100644 index 00000000000..90a1970531e --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js @@ -0,0 +1,60 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; +var utils = require('web3-utils'); + +var EstimateGasMethodModel = require('../../../src/models/methods/EstimateGasMethodModel'); + +/** + * EstimateGasMethodModel test + */ +describe('EstimateGasMethodModelTest', function () { + var model; + var formattersMock = sinon.mock(formatters); + var utilsMock = sinon.mock(utils); + + beforeEach(function () { + model = new EstimateGasMethodModel(utils, formatters); + }); + + describe('rpcMethod', function () { + it('should return eth_estimateGas', function () { + expect(model.rpcMethod).to.equal('eth_estimateGas'); + }); + }); + + describe('parametersAmount', function () { + it('should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + }); + + describe('beforeExecution', function () { + it('should call the inputCallFormatter', function () { + model.parameters = [{}]; + + formattersMock + .expects('inputCallFormatter') + .withArgs(model.parameters[0], {}) + .once(); + + model.beforeExecution({}); + + formattersMock.verify(); + }); + }); + + describe('afterExecution', function () { + it('should call hexToNumber and return the response', function () { + utilsMock + .expects('hexToNumber') + .withArgs({}) + .once(); + + model.afterExecution({}); + + utilsMock.verify(); + }); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js new file mode 100644 index 00000000000..7082885da20 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js @@ -0,0 +1,58 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var GetCodeMethodModel = require('../../../src/models/methods/GetCodeMethodModel'); + +/** + * GetCodeMethodModel test + */ +describe('GetCodeMethodModelTest', function () { + var model; + var formattersMock = sinon.mock(formatters); + + beforeEach(function () { + model = new GetCodeMethodModel({}, formatters); + }); + + describe('rpcMethod', function () { + it('should return eth_getCode', function () { + expect(model.rpcMethod).to.equal('eth_getCode'); + }); + }); + + describe('parametersAmount', function () { + it('should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + }); + + describe('beforeExecution', function () { + it('should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function () { + model.parameters = ['string', 100]; + + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[0]) + .once(); + + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[1], {}) + .once(); + + model.beforeExecution({}); + + formattersMock.verify(); + }); + }); + + describe('afterExecution', function () { + it('should just return the response', function () { + var object = {}; + + expect(model.afterExecution(object)).to.equal(object); + }); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js new file mode 100644 index 00000000000..4d026cf7c83 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js @@ -0,0 +1,58 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var GetPastLogsMethodModel = require('../../../src/models/methods/GetPastLogsMethodModel'); + +/** + * GetPastLogsMethodModel test + */ +describe('GetPastLogsMethodModelTest', function () { + var model; + var formattersMock = sinon.mock(formatters); + + beforeEach(function () { + model = new GetPastLogsMethodModel({}, formatters); + }); + + describe('rpcMethod', function () { + it('should return eth_getLogs', function () { + expect(model.rpcMethod).to.equal('eth_getLogs'); + }); + }); + + describe('parametersAmount', function () { + it('should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + }); + + describe('beforeExecution', function () { + it('should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function () { + model.parameters = [{}]; + + formattersMock + .expects('inputLogFormatter') + .withArgs(model.parameters[0]) + .once(); + + model.beforeExecution({}); + + formattersMock.verify(); + }); + }); + + describe('afterExecution', function () { + it('should just return the response', function () { + formattersMock + .expects('outputLogFormatter') + .withArgs({}) + .once(); + + expect(model.afterExecution([{}])).to.be.an.instanceof(Array); + + formattersMock.verify(); + }); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js new file mode 100644 index 00000000000..106a8fff510 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js @@ -0,0 +1,69 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; +var utils = require('web3-utils'); + +var GetStorageAtMethodModel = require('../../../src/models/methods/GetStorageAtMethodModel'); + +/** + * GetStorageAtMethodModel test + */ +describe('GetStorageAtMethodModelTest', function () { + var model; + var formattersMock = sinon.mock(formatters); + var utilsMock = sinon.mock(utils); + + beforeEach(function () { + model = new GetStorageAtMethodModel(utils, formatters); + }); + + describe('rpcMethod', function () { + it('should return eth_getStorageAt', function () { + expect(model.rpcMethod).to.equal('eth_getStorageAt'); + }); + }); + + describe('parametersAmount', function () { + it('should return 3', function () { + expect(model.parametersAmount).to.equal(3); + }); + }); + + describe('beforeExecution', function () { + it( + 'should call the formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter ' + + 'and utils.numberToHex method', + function () { + model.parameters = ['string', 100, 100]; + + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[0]) + .once(); + + utilsMock + .expects('numberToHex') + .withArgs(model.parameters[1]) + .once(); + + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[2]) + .once(); + + model.beforeExecution({}); + + formattersMock.verify(); + } + ); + }); + + describe('afterExecution', function () { + it('should just return the response', function () { + var object = {}; + + expect(model.afterExecution(object)).to.equal(object); + }); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js b/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js new file mode 100644 index 00000000000..1cbd82fa725 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js @@ -0,0 +1,58 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var SignMethodModel = require('../../../src/models/methods/SignMethodModel'); + +/** + * GetStorageAtMethodModel test + */ +describe('SignMethodModelTest', function () { + var model; + var formattersMock = sinon.mock(formatters); + + beforeEach(function () { + model = new SignMethodModel({}, formatters); + }); + + describe('rpcMethod', function () { + it('should return eth_sign', function () { + expect(model.rpcMethod).to.equal('eth_sign'); + }); + }); + + describe('parametersAmount', function () { + it('should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + }); + + describe('beforeExecution', function () { + it('should call the inputSignFormatter and inputAddressFormatter', function () { + model.parameters = ['string', 'string']; + + formattersMock + .expects('inputSignFormatter') + .withArgs(model.parameters[0]) + .once(); + + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[1]) + .once(); + + model.beforeExecution({}); + + formattersMock.verify(); + }); + }); + + describe('afterExecution', function () { + it('should just return the response', function () { + var object = {}; + + expect(model.afterExecution(object)).to.equal(object); + }); + }); +}); From 0116e2a3773b0f87627d1a548f8aa77ce5cfd94f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 10 Oct 2018 17:09:55 +0200 Subject: [PATCH 0228/1045] tests added and assertion improved --- package-lock.json | 137 +++++++++++++++++- package.json | 2 + .../lib/models/AbstractMethodModel.js | 2 + packages/web3-core-method/package.json | 2 +- .../methods/account/GetAccountsMethodModel.js | 6 +- .../methods/account/GetBalanceMethodModel.js | 6 +- .../account/GetTransactionCountMethodModel.js | 6 +- .../methods/block/GetBlockMethodModel.js | 8 +- .../block/GetBlockNumberMethodModel.js | 6 +- .../models/methods/CallMethodModelTest.js | 13 +- .../methods/EstimateGasMethodModelTest.js | 17 ++- .../models/methods/GetCodeMethodModelTest.js | 13 +- .../methods/GetPastLogsMethodModelTest.js | 14 +- .../methods/GetStorageAtMethodModelTest.js | 18 ++- .../models/methods/SignMethodModelTest.js | 43 ++++-- .../account/GetAccountsMethodModelTest.js | 59 ++++++++ .../account/GetBalanceMethodModelTest.js | 75 ++++++++++ .../GetTransactionCountMethodModelTest.js | 76 ++++++++++ .../methods/block/GetBlockMethodModelTest.js | 87 +++++++++++ .../block/GetBlockNumberMethodModelTest.js | 55 +++++++ 20 files changed, 599 insertions(+), 46 deletions(-) create mode 100644 packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js diff --git a/package-lock.json b/package-lock.json index bbb6e80d70c..ff648ea2853 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,41 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@sinonjs/commons": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.0.2.tgz", + "integrity": "sha512-WR3dlgqJP4QNrLC4iXN/5/2WaLQQ0VijOOkmflqFGVJ6wLEpbSjo7c0ZeGIdtY8Crk7xBBp87sM6+Mkerz7alw==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/formatio": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.0.0.tgz", + "integrity": "sha512-vdjoYLDptCgvtJs57ULshak3iJe4NW3sJ3g36xVDGff5AE8P30S6A093EIEPjdi2noGhfuNOEkbxt3J3awFW1w==", + "dev": true, + "requires": { + "@sinonjs/samsam": "2.1.0" + }, + "dependencies": { + "@sinonjs/samsam": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.0.tgz", + "integrity": "sha512-5x2kFgJYupaF1ns/RmharQ90lQkd2ELS8A9X0ymkAAdemYHGtI2KiUHG8nX2WU0T1qgnOU5YMqnBM2V7NUanNw==", + "dev": true, + "requires": { + "array-from": "^2.1.1" + } + } + } + }, + "@sinonjs/samsam": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.2.tgz", + "integrity": "sha512-ZwTHAlC9akprWDinwEPD4kOuwaYZlyMwVJIANsKNC3QVp0AHB04m7RnB4eqeWfgmxw8MGTzS9uMaw93Z3QcZbw==", + "dev": true + }, "@types/bignumber.js": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/bignumber.js/-/bignumber.js-4.0.3.tgz", @@ -272,6 +307,12 @@ "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "dev": true }, + "array-from": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", + "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", + "dev": true + }, "array-ify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", @@ -5084,7 +5125,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -5837,6 +5878,12 @@ "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=", "dev": true }, + "just-extend": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-3.0.0.tgz", + "integrity": "sha512-Fu3T6pKBuxjWT/p4DkqGHFRsysc8OauWr4ZRTY9dIx07Y9O0RkoR5jcv28aeD1vuAwhm3nLkDurwLXoALp4DpQ==", + "dev": true + }, "keccak": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", @@ -6240,6 +6287,12 @@ "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", "dev": true }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, "lodash.isobject": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", @@ -6264,6 +6317,12 @@ "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", "dev": true }, + "lolex": { + "version": "2.7.5", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", + "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", + "dev": true + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -6697,6 +6756,19 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, + "nise": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.4.5.tgz", + "integrity": "sha512-OHRVvdxKgwZELf2DTgsJEIA4MOq8XWvpSUzoOXyxJ2mY0mMENWC66+70AShLR2z05B1dzrzWlUQJmJERlOUpZw==", + "dev": true, + "requires": { + "@sinonjs/formatio": "3.0.0", + "just-extend": "^3.0.0", + "lolex": "^2.3.2", + "path-to-regexp": "^1.7.0", + "text-encoding": "^0.6.4" + } + }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -7182,6 +7254,23 @@ "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", "dev": true }, + "path-to-regexp": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "dev": true, + "requires": { + "isarray": "0.0.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } + } + }, "path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", @@ -8120,6 +8209,46 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, + "sinon": { + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-6.3.5.tgz", + "integrity": "sha512-xgoZ2gKjyVRcF08RrIQc+srnSyY1JDJtxu3Nsz07j1ffjgXoY6uPLf/qja6nDBZgzYYEovVkFryw2+KiZz11xQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.0.2", + "@sinonjs/formatio": "^3.0.0", + "@sinonjs/samsam": "^2.1.2", + "diff": "^3.5.0", + "lodash.get": "^4.4.2", + "lolex": "^2.7.5", + "nise": "^1.4.5", + "supports-color": "^5.5.0", + "type-detect": "^4.0.8" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "sinon-chai": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.2.0.tgz", + "integrity": "sha512-Z72B4a0l0IQe5uWi9yzcqX/Ml6K9e1Hp03NmkjJnRG3gDsKTX7KvLFZsVUmCaz0eqeXLLK089mwTsP1P1W+DUQ==", + "dev": true + }, "slash": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", @@ -8619,6 +8748,12 @@ } } }, + "text-encoding": { + "version": "0.6.4", + "resolved": "http://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", + "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", + "dev": true + }, "text-extensions": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.7.0.tgz", diff --git a/package.json b/package.json index 3e87665c585..05272ad940a 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,8 @@ "lerna": "^2.5.1", "mocha": ">=2.3.3", "sandboxed-module": "^2.0.2", + "sinon": "^6.3.5", + "sinon-chai": "^3.2.0", "underscore": "^1.8.3", "vinyl-source-stream": "^2.0.0" } diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 99e63a60ff6..20f49adcf46 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -22,6 +22,8 @@ "use strict"; +var _ = require('underscore'); + /** * @param {String|Function} rpcMethod * @param {Number} parametersAmount diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 15fede2feac..0699139a416 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -10,7 +10,7 @@ "test": "mocha './tests/**/*.js'" }, "dependencies": { - "underscore": "1.8.3", + "underscore": "^1.8.3", "web3-core-helpers": "^1.0.0-beta.36", "web3-core-promievent": "1.0.0-beta.36", "web3-core-providers": "1.0.0-beta.36", diff --git a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js index 0bcb703be84..f24a4c628e2 100644 --- a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js @@ -34,6 +34,9 @@ function GetAccountsMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_accounts', 0, utils, formatters); } +GetAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetAccountsMethodModel.prototype.constructor = GetAccountsMethodModel; + /** * This method will be executed after the RPC request. * @@ -51,7 +54,4 @@ GetAccountsMethodModel.prototype.afterExecution = function (response) { }); }; -GetAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetAccountsMethodModel.prototype.constructor = GetAccountsMethodModel; - module.exports = GetAccountsMethodModel; diff --git a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index 583e06c89b1..faf83b20350 100644 --- a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -34,6 +34,9 @@ function GetBalanceMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getBalance', 2, utils, formatters); } +GetBalanceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBalanceMethodModel.prototype.constructor = GetBalanceMethodModel; + /** * This method will be executed before the RPC request. * @@ -59,7 +62,4 @@ GetBalanceMethodModel.prototype.afterExecution = function(response) { return this.formatters.outputBigNumberFormatter(response); }; -GetBalanceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBalanceMethodModel.prototype.constructor = GetBalanceMethodModel; - module.exports = GetBalanceMethodModel; diff --git a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index edb6f0fccf0..6a11ce6bf8e 100644 --- a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -34,6 +34,9 @@ function GetTransactionCountMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getTransactionCount', 2, utils, formatters); } +GetTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetTransactionCountMethodModel.prototype.constructor = GetTransactionCountMethodModel; + /** * This method will be executed before the effective execution. * @@ -59,7 +62,4 @@ GetTransactionCountMethodModel.prototype.afterExecution = function (response) { return this.utils.hexToNumber(response); }; -GetTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetTransactionCountMethodModel.prototype.constructor = GetTransactionCountMethodModel; - module.exports = GetTransactionCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index be5a06ca483..a162ceb79eb 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -34,6 +34,9 @@ function GetBlockMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getBlockByNumber', 2, utils, formatters); } +GetBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBlockMethodModel.prototype.constructor = GetBlockMethodModel; + /** * This method will be executed before the RPC request. * @@ -42,7 +45,7 @@ function GetBlockMethodModel(utils, formatters) { * @param {Object} web3Package - The package where the method is called from for example Eth. */ GetBlockMethodModel.prototype.beforeExecution = function (web3Package) { - if (this.isHash(parameters[0])) { + if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getBlockByHash'; } @@ -63,7 +66,4 @@ GetBlockMethodModel.prototype.afterExecution = function(response) { return this.formatters.outputBlockFormatter(response); }; -GetBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBlockMethodModel.prototype.constructor = GetBlockMethodModel; - module.exports = GetBlockMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js index c6e364cd7ee..7d78cfc114b 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js @@ -34,6 +34,9 @@ function GetBlockNumberMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_blockNumber', 0, utils, formatters); } +GetBlockNumberMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBlockNumberMethodModel.prototype.constructor = GetBlockNumberMethodModel; + /** * This method will be executed after the RPC request. * @@ -47,7 +50,4 @@ GetBlockNumberMethodModel.prototype.afterExecution = function (response) { return this.utils.hexToNumber(response); }; -GetBlockNumberMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBlockNumberMethodModel.prototype.constructor = GetBlockNumberMethodModel; - module.exports = GetBlockNumberMethodModel; diff --git a/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js b/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js index 8c3f4b13000..9551d4e6283 100644 --- a/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js @@ -9,13 +9,17 @@ var CallMethodModel = require('../../../src/models/methods/CallMethodModel'); * CallMethodModel test */ describe('CallMethodModelTest', function () { - var model; - var formattersMock = sinon.mock(formatters); + var model, + formattersMock = sinon.mock(formatters); beforeEach(function () { model = new CallMethodModel({}, formatters); }); + after(function () { + formattersMock.restore(); + }); + describe('rpcMethod', function () { it('should return eth_call', function () { expect(model.rpcMethod).to.equal('eth_call'); @@ -35,15 +39,20 @@ describe('CallMethodModelTest', function () { formattersMock .expects('inputCallFormatter') .withArgs(model.parameters[0], {}) + .returns({empty: true}) .once(); formattersMock .expects('inputDefaultBlockNumberFormatter') .withArgs(model.parameters[1], {}) + .returns('0x0') .once(); model.beforeExecution({}); + expect(model.parameters[0]).to.have.property('empty', true); + expect(model.parameters[1]).equal('0x0'); + formattersMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js b/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js index 90a1970531e..df12216605c 100644 --- a/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js @@ -10,14 +10,19 @@ var EstimateGasMethodModel = require('../../../src/models/methods/EstimateGasMet * EstimateGasMethodModel test */ describe('EstimateGasMethodModelTest', function () { - var model; - var formattersMock = sinon.mock(formatters); - var utilsMock = sinon.mock(utils); + var model, + formattersMock = sinon.mock(formatters), + utilsMock = sinon.mock(utils); beforeEach(function () { model = new EstimateGasMethodModel(utils, formatters); }); + after(function () { + formattersMock.restore(); + utilsMock.restore(); + }); + describe('rpcMethod', function () { it('should return eth_estimateGas', function () { expect(model.rpcMethod).to.equal('eth_estimateGas'); @@ -37,10 +42,13 @@ describe('EstimateGasMethodModelTest', function () { formattersMock .expects('inputCallFormatter') .withArgs(model.parameters[0], {}) + .returns({empty: true}) .once(); model.beforeExecution({}); + expect(model.parameters[0]).to.have.property('empty', true); + formattersMock.verify(); }); }); @@ -50,9 +58,10 @@ describe('EstimateGasMethodModelTest', function () { utilsMock .expects('hexToNumber') .withArgs({}) + .returns(100) .once(); - model.afterExecution({}); + expect(model.afterExecution({})).equal(100); utilsMock.verify(); }); diff --git a/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js index 7082885da20..6d294f01a11 100644 --- a/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js @@ -9,13 +9,17 @@ var GetCodeMethodModel = require('../../../src/models/methods/GetCodeMethodModel * GetCodeMethodModel test */ describe('GetCodeMethodModelTest', function () { - var model; - var formattersMock = sinon.mock(formatters); + var model, + formattersMock = sinon.mock(formatters); beforeEach(function () { model = new GetCodeMethodModel({}, formatters); }); + after(function () { + formattersMock.restore(); + }); + describe('rpcMethod', function () { it('should return eth_getCode', function () { expect(model.rpcMethod).to.equal('eth_getCode'); @@ -35,15 +39,20 @@ describe('GetCodeMethodModelTest', function () { formattersMock .expects('inputAddressFormatter') .withArgs(model.parameters[0]) + .returns('0x0') .once(); formattersMock .expects('inputDefaultBlockNumberFormatter') .withArgs(model.parameters[1], {}) + .returns('0x0') .once(); model.beforeExecution({}); + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); + formattersMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js index 4d026cf7c83..da9537e7a42 100644 --- a/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js @@ -9,13 +9,17 @@ var GetPastLogsMethodModel = require('../../../src/models/methods/GetPastLogsMet * GetPastLogsMethodModel test */ describe('GetPastLogsMethodModelTest', function () { - var model; - var formattersMock = sinon.mock(formatters); + var model, + formattersMock = sinon.mock(formatters); beforeEach(function () { model = new GetPastLogsMethodModel({}, formatters); }); + after(function () { + formattersMock.restore(); + }); + describe('rpcMethod', function () { it('should return eth_getLogs', function () { expect(model.rpcMethod).to.equal('eth_getLogs'); @@ -35,10 +39,13 @@ describe('GetPastLogsMethodModelTest', function () { formattersMock .expects('inputLogFormatter') .withArgs(model.parameters[0]) + .returns({empty: true}) .once(); model.beforeExecution({}); + expect(model.parameters[0]).to.have.property('empty', true); + formattersMock.verify(); }); }); @@ -48,9 +55,10 @@ describe('GetPastLogsMethodModelTest', function () { formattersMock .expects('outputLogFormatter') .withArgs({}) + .returns({formatted: true}) .once(); - expect(model.afterExecution([{}])).to.be.an.instanceof(Array); + expect(model.afterExecution([{}])[0]).to.have.property('formatted', true); formattersMock.verify(); }); diff --git a/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js index 106a8fff510..f671866b390 100644 --- a/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js @@ -10,14 +10,19 @@ var GetStorageAtMethodModel = require('../../../src/models/methods/GetStorageAtM * GetStorageAtMethodModel test */ describe('GetStorageAtMethodModelTest', function () { - var model; - var formattersMock = sinon.mock(formatters); - var utilsMock = sinon.mock(utils); + var model, + formattersMock = sinon.mock(formatters), + utilsMock = sinon.mock(utils); beforeEach(function () { model = new GetStorageAtMethodModel(utils, formatters); }); + after(function () { + formattersMock.restore(); + utilsMock.restore(); + }); + describe('rpcMethod', function () { it('should return eth_getStorageAt', function () { expect(model.rpcMethod).to.equal('eth_getStorageAt'); @@ -40,20 +45,27 @@ describe('GetStorageAtMethodModelTest', function () { formattersMock .expects('inputAddressFormatter') .withArgs(model.parameters[0]) + .returns('0x0') .once(); utilsMock .expects('numberToHex') .withArgs(model.parameters[1]) + .returns('0x0') .once(); formattersMock .expects('inputDefaultBlockNumberFormatter') .withArgs(model.parameters[2]) + .returns('0x0') .once(); model.beforeExecution({}); + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); + expect(model.parameters[2]).equal('0x0'); + formattersMock.verify(); } ); diff --git a/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js b/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js index 1cbd82fa725..7b57d4622e8 100644 --- a/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js @@ -9,11 +9,21 @@ var SignMethodModel = require('../../../src/models/methods/SignMethodModel'); * GetStorageAtMethodModel test */ describe('SignMethodModelTest', function () { - var model; - var formattersMock = sinon.mock(formatters); + var model, + formattersMock = sinon.mock(formatters); beforeEach(function () { - model = new SignMethodModel({}, formatters); + model = new SignMethodModel({}, formatters, {test: true}); + }); + + after(function () { + formattersMock.restore(); + }); + + describe('accounts', function () { + it('should be defined', function () { + expect(model.accounts.test).to.be.true; + }); }); describe('rpcMethod', function () { @@ -30,21 +40,26 @@ describe('SignMethodModelTest', function () { describe('beforeExecution', function () { it('should call the inputSignFormatter and inputAddressFormatter', function () { - model.parameters = ['string', 'string']; + model.parameters = ['string', 'string']; + + formattersMock + .expects('inputSignFormatter') + .withArgs(model.parameters[0]) + .returns('string') + .once(); - formattersMock - .expects('inputSignFormatter') - .withArgs(model.parameters[0]) - .once(); + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[1]) + .returns('0x0') + .once(); - formattersMock - .expects('inputAddressFormatter') - .withArgs(model.parameters[1]) - .once(); + model.beforeExecution({}); - model.beforeExecution({}); + expect(model.parameters[0]).equal('string'); + expect(model.parameters[1]).equal('0x0'); - formattersMock.verify(); + formattersMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js b/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js new file mode 100644 index 00000000000..986d5619953 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js @@ -0,0 +1,59 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var utils = require('web3-utils'); + +var GetAccountsMethodModel = require('../../../../src/models/methods/account/GetAccountsMethodModel'); + +/** + * GetAccountsMethodModel test + */ +describe('GetAccountsMethodModelTest', function () { + var model, + utilsMock = sinon.mock(utils); + + beforeEach(function () { + model = new GetAccountsMethodModel(utils, {}); + }); + + after(function () { + utilsMock.restore(); + }); + + describe('rpcMethod', function () { + it('should return eth_accounts', function () { + expect(model.rpcMethod).to.equal('eth_accounts'); + }); + }); + + describe('parametersAmount', function () { + it('should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + }); + + describe('beforeExecution', function () { + it('should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + }); + + describe('afterExecution', function () { + it('should just return the response', function () { + var response = [{}]; + + utilsMock + .expects('toChecksumAddress') + .withArgs(response[0]) + .returns('0x0') + .once(); + + expect(model.afterExecution([{}])[0]).equal('0x0'); + + utilsMock.verify(); + }); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js b/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js new file mode 100644 index 00000000000..6ec71634514 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js @@ -0,0 +1,75 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var GetBalanceMethodModel = require('../../../../src/models/methods/account/GetBalanceMethodModel'); + +/** + * GetBalanceMethodModel test + */ +describe('GetBalanceMethodModelTest', function () { + var model, + formattersMock = sinon.mock(formatters); + + beforeEach(function () { + model = new GetBalanceMethodModel({}, formatters); + }); + + after(function () { + formattersMock.restore(); + }); + + describe('rpcMethod', function () { + it('should return eth_getBalance', function () { + expect(model.rpcMethod).to.equal('eth_getBalance'); + }); + }); + + describe('parametersAmount', function () { + it('should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + }); + + describe('beforeExecution', function () { + it('should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function () { + model.parameters = ['string', 100]; + + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[1], {}) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); + + formattersMock.verify(); + }); + }); + + describe('afterExecution', function () { + it('should call outputBigNumberFormatter on the response and return it', function () { + var response = {}; + + formattersMock + .expects('outputBigNumberFormatter') + .withArgs(response) + .returns({bigNumber: true}) + .once(); + + expect(model.afterExecution({})).to.have.property('bigNumber', true); + + formattersMock.verify(); + }); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js new file mode 100644 index 00000000000..c6bf8ee2517 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js @@ -0,0 +1,76 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; +var utils = require('web3-utils'); + +var GetTransactionCountMethodModel = require('../../../../src/models/methods/account/GetTransactionCountMethodModel'); + +/** + * GetTransactionCountMethodModel test + */ +describe('GetTransactionCountMethodModelTest', function () { + var model, + formattersMock = sinon.mock(formatters), + utilsMock = sinon.mock(utils); + + beforeEach(function () { + model = new GetTransactionCountMethodModel(utils, formatters); + }); + + after(function () { + formattersMock.restore(); + utilsMock.restore(); + }); + + describe('rpcMethod', function () { + it('should return eth_getTransactionCount', function () { + expect(model.rpcMethod).to.equal('eth_getTransactionCount'); + }); + }); + + describe('parametersAmount', function () { + it('should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + }); + + describe('beforeExecution', function () { + it('should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function () { + model.parameters = ['string', 100]; + + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[1], {}) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); + + formattersMock.verify(); + }); + }); + + describe('afterExecution', function () { + it('should call hexToNumber on the response and return it', function () { + utilsMock + .expects('hexToNumber') + .withArgs('0x0') + .returns(100) + .once(); + + expect(model.afterExecution('0x0')).equal(100); + + utilsMock.verify(); + }); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js new file mode 100644 index 00000000000..ee559575056 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js @@ -0,0 +1,87 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var GetBlockMethodModel = require('../../../../src/models/methods/block/GetBlockMethodModel'); + +/** + * GetBlockMethodModel test + */ +describe('GetBlockMethodModelTest', function () { + var model, + formattersMock = sinon.mock(formatters); + + beforeEach(function () { + model = new GetBlockMethodModel({}, formatters); + }); + + after(function () { + formattersMock.restore(); + }); + + describe('rpcMethod', function () { + it('should return eth_getBlockByNumber', function () { + expect(model.rpcMethod).to.equal('eth_getBlockByNumber'); + }); + }); + + describe('parametersAmount', function () { + it('should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + }); + + describe('beforeExecution', function () { + it('should call method with block hash as parameter and call inputBlockNumberFormatter', function () { + model.parameters = ['0x0', true]; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).to.be.true; + + formattersMock.verify(); + + expect(model.rpcMethod).equal('eth_getBlockByHash'); + }); + + it('should call method with block number as parameter and call inputBlockNumberFormatter', function () { + formattersMock = sinon.mock(formatters);// Because mock.restore() does not work as expected. + model.parameters = [100, true]; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).to.be.true; + + formattersMock.verify(); + + expect(model.rpcMethod).equal('eth_getBlockByNumber'); + }); + }); + + describe('afterExecution', function () { + it('should just return the response', function () { + formattersMock + .expects('outputBlockFormatter') + .withArgs({}) + .returns({empty: false}) + .once(); + + expect(model.afterExecution({})).to.have.property('empty', false); + }); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js new file mode 100644 index 00000000000..9c3e4d27fe4 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js @@ -0,0 +1,55 @@ +var chai = require('chai'); +var sinon = require('sinon'); +var expect = chai.expect; +var utils = require('web3-utils'); + +var GetBlockNumberMethodModel = require('../../../../src/models/methods/block/GetBlockNumberMethodModel'); + +/** + * GetBlockNumberMethodModel test + */ +describe('GetBlockNumberMethodModelTest', function () { + var model, + utilsMock = sinon.mock(utils); + + beforeEach(function () { + model = new GetBlockNumberMethodModel(utils, {}); + }); + + after(function () { + utilsMock.restore(); + }); + + describe('rpcMethod', function () { + it('should return eth_blockNumber', function () { + expect(model.rpcMethod).to.equal('eth_blockNumber'); + }); + }); + + describe('parametersAmount', function () { + it('should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + }); + + describe('beforeExecution', function () { + it('should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + }); + + describe('afterExecution', function () { + it('should just return the response', function () { + utilsMock + .expects('hexToNumber') + .withArgs('0x0') + .returns(100) + .once(); + + expect(model.afterExecution('0x0')).equal(100); + }); + }); +}); From 093b0c8a035bf8563a03f0f7f9af307747fe7fa9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 11 Oct 2018 12:23:16 +0200 Subject: [PATCH 0229/1045] tests fixed and sinon sandboxes introduced --- packages/web3-core-method/package-lock.json | 123 ++++++++++++++++++ packages/web3-core-method/package.json | 3 +- .../GetBlockTransactionCountMethodModel.js | 8 +- .../block/GetBlockUncleCountMethodModel.js | 8 +- .../methods/block/GetUncleMethodModel.js | 8 +- .../models/methods/CallMethodModelTest.js | 64 ++++----- .../methods/EstimateGasMethodModelTest.js | 65 ++++----- .../models/methods/GetCodeMethodModelTest.js | 64 ++++----- .../methods/GetPastLogsMethodModelTest.js | 62 ++++----- .../methods/GetStorageAtMethodModelTest.js | 89 ++++++------- .../models/methods/SignMethodModelTest.js | 70 +++++----- .../account/GetAccountsMethodModelTest.js | 52 +++----- .../account/GetBalanceMethodModelTest.js | 76 +++++------ .../GetTransactionCountMethodModelTest.js | 77 +++++------ .../methods/block/GetBlockMethodModelTest.js | 93 ++++++------- .../block/GetBlockNumberMethodModelTest.js | 50 ++++--- ...GetBlockTransactionCountMethodModelTest.js | 81 ++++++++++++ .../GetBlockUncleCountMethodModelTest.js | 81 ++++++++++++ .../methods/block/GetUncleMethodModelTest.js | 94 +++++++++++++ 19 files changed, 728 insertions(+), 440 deletions(-) create mode 100644 packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js diff --git a/packages/web3-core-method/package-lock.json b/packages/web3-core-method/package-lock.json index 81dec69e959..7caea375f96 100644 --- a/packages/web3-core-method/package-lock.json +++ b/packages/web3-core-method/package-lock.json @@ -4,6 +4,41 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@sinonjs/commons": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.0.2.tgz", + "integrity": "sha512-WR3dlgqJP4QNrLC4iXN/5/2WaLQQ0VijOOkmflqFGVJ6wLEpbSjo7c0ZeGIdtY8Crk7xBBp87sM6+Mkerz7alw==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/formatio": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.0.0.tgz", + "integrity": "sha512-vdjoYLDptCgvtJs57ULshak3iJe4NW3sJ3g36xVDGff5AE8P30S6A093EIEPjdi2noGhfuNOEkbxt3J3awFW1w==", + "dev": true, + "requires": { + "@sinonjs/samsam": "2.1.0" + }, + "dependencies": { + "@sinonjs/samsam": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.0.tgz", + "integrity": "sha512-5x2kFgJYupaF1ns/RmharQ90lQkd2ELS8A9X0ymkAAdemYHGtI2KiUHG8nX2WU0T1qgnOU5YMqnBM2V7NUanNw==", + "dev": true, + "requires": { + "array-from": "^2.1.1" + } + } + } + }, + "@sinonjs/samsam": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.2.tgz", + "integrity": "sha512-ZwTHAlC9akprWDinwEPD4kOuwaYZlyMwVJIANsKNC3QVp0AHB04m7RnB4eqeWfgmxw8MGTzS9uMaw93Z3QcZbw==", + "dev": true + }, "accepts": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", @@ -29,6 +64,12 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "array-from": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", + "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", + "dev": true + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -744,6 +785,12 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -786,6 +833,12 @@ "verror": "1.10.0" } }, + "just-extend": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-3.0.0.tgz", + "integrity": "sha512-Fu3T6pKBuxjWT/p4DkqGHFRsysc8OauWr4ZRTY9dIx07Y9O0RkoR5jcv28aeD1vuAwhm3nLkDurwLXoALp4DpQ==", + "dev": true + }, "keccakjs": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", @@ -795,6 +848,18 @@ "sha3": "^1.1.0" } }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, + "lolex": { + "version": "2.7.5", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", + "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", + "dev": true + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -914,6 +979,30 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" }, + "nise": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.4.5.tgz", + "integrity": "sha512-OHRVvdxKgwZELf2DTgsJEIA4MOq8XWvpSUzoOXyxJ2mY0mMENWC66+70AShLR2z05B1dzrzWlUQJmJERlOUpZw==", + "dev": true, + "requires": { + "@sinonjs/formatio": "3.0.0", + "just-extend": "^3.0.0", + "lolex": "^2.3.2", + "path-to-regexp": "^1.7.0", + "text-encoding": "^0.6.4" + }, + "dependencies": { + "path-to-regexp": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "dev": true, + "requires": { + "isarray": "0.0.1" + } + } + } + }, "number-to-bn": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", @@ -1175,6 +1264,34 @@ "simple-concat": "^1.0.0" } }, + "sinon": { + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-6.3.5.tgz", + "integrity": "sha512-xgoZ2gKjyVRcF08RrIQc+srnSyY1JDJtxu3Nsz07j1ffjgXoY6uPLf/qja6nDBZgzYYEovVkFryw2+KiZz11xQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.0.2", + "@sinonjs/formatio": "^3.0.0", + "@sinonjs/samsam": "^2.1.2", + "diff": "^3.5.0", + "lodash.get": "^4.4.2", + "lolex": "^2.7.5", + "nise": "^1.4.5", + "supports-color": "^5.5.0", + "type-detect": "^4.0.8" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "sshpk": { "version": "1.14.2", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", @@ -1218,6 +1335,12 @@ "has-flag": "^3.0.0" } }, + "text-encoding": { + "version": "0.6.4", + "resolved": "http://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", + "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", + "dev": true + }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 0699139a416..0efad645808 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -18,6 +18,7 @@ }, "devDependencies": { "chai": "^4.2.0", - "mocha": "^5.2.0" + "mocha": "^5.2.0", + "sinon": "^6.3.5" } } diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index 3bb47b3d341..01d0f19afe2 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -34,6 +34,9 @@ function GetBlockTransactionCountMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getTransactionByBlockNumberAndIndex', 1, utils, formatters); } +GetBlockTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBlockTransactionCountMethodModel.prototype.constructor = GetBlockTransactionCountMethodModel; + /** * This method will be executed before the RPC request. * @@ -42,7 +45,7 @@ function GetBlockTransactionCountMethodModel(utils, formatters) { * @param {AbstractWeb3Object} web3Package */ GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (web3Package) { - if (this.isHash(parameters[0])) { + if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } @@ -62,7 +65,4 @@ GetBlockTransactionCountMethodModel.prototype.afterExecution = function (respons return this.utils.hexToNumber(response); }; -GetBlockTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBlockTransactionCountMethodModel.prototype.constructor = GetBlockTransactionCountMethodModel; - module.exports = GetBlockTransactionCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index 6f926dc15fc..2d91d57a97c 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -34,6 +34,9 @@ function GetBlockUncleCountMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getUncleCountByBlockNumber', 1, utils, formatters); } +GetBlockUncleCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetBlockUncleCountMethodModel.prototype.constructor = GetBlockUncleCountMethodModel; + /** * This method will be executed before the RPC request. * @@ -42,7 +45,7 @@ function GetBlockUncleCountMethodModel(utils, formatters) { * @param {AbstractWeb3Object} web3Package */ GetBlockUncleCountMethodModel.prototype.beforeExecution = function (web3Package) { - if (this.isHash(parameters[0])) { + if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getUncleCountByBlockHash'; } @@ -62,7 +65,4 @@ GetBlockUncleCountMethodModel.prototype.afterExecution = function (response) { return this.utils.hexToNumber(response); }; -GetBlockUncleCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBlockUncleCountMethodModel.prototype.constructor = GetBlockUncleCountMethodModel; - module.exports = GetBlockUncleCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index bbab674188b..2fed42b5e42 100644 --- a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -34,6 +34,9 @@ function GetUncleMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getUncleByBlockNumberAndIndex', 2, utils, formatters); } +GetUncleMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetUncleMethodModel.prototype.constructor = GetUncleMethodModel; + /** * This method will be executed before the RPC request. * @@ -42,7 +45,7 @@ function GetUncleMethodModel(utils, formatters) { * @param {AbstractWeb3Object} web3Package */ GetUncleMethodModel.prototype.beforeExecution = function (web3Package) { - if (this.isHash(parameters[0])) { + if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getUncleByBlockHashAndIndex'; } @@ -63,7 +66,4 @@ GetUncleMethodModel.prototype.afterExecution = function (response) { return this.formatters.outputBlockFormatter(response); }; -GetUncleMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetUncleMethodModel.prototype.constructor = GetUncleMethodModel; - module.exports = GetUncleMethodModel; diff --git a/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js b/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js index 9551d4e6283..b8d838291af 100644 --- a/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var formatters = require('web3-core-helpers').formatters; @@ -9,59 +9,51 @@ var CallMethodModel = require('../../../src/models/methods/CallMethodModel'); * CallMethodModel test */ describe('CallMethodModelTest', function () { - var model, - formattersMock = sinon.mock(formatters); + var model, formattersMock; beforeEach(function () { + formattersMock = sinon.mock(formatters); model = new CallMethodModel({}, formatters); }); - after(function () { - formattersMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_call', function () { - expect(model.rpcMethod).to.equal('eth_call'); - }); + it('rpcMethod should return eth_call', function () { + expect(model.rpcMethod).to.equal('eth_call'); }); - describe('parametersAmount', function () { - it('should return 2', function () { - expect(model.parametersAmount).to.equal(2); - }); + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); }); - describe('beforeExecution', function () { - it('should call inputCallFormatter and inputDefaultBlockNumberFormatter', function () { - model.parameters = [{}, 100]; + it('beforeExecution should call inputCallFormatter and inputDefaultBlockNumberFormatter', function () { + model.parameters = [{}, 100]; - formattersMock - .expects('inputCallFormatter') - .withArgs(model.parameters[0], {}) - .returns({empty: true}) - .once(); + formattersMock + .expects('inputCallFormatter') + .withArgs(model.parameters[0], {}) + .returns({empty: true}) + .once(); - formattersMock - .expects('inputDefaultBlockNumberFormatter') - .withArgs(model.parameters[1], {}) - .returns('0x0') - .once(); + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[1], {}) + .returns('0x0') + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).to.have.property('empty', true); - expect(model.parameters[1]).equal('0x0'); + expect(model.parameters[0]).to.have.property('empty', true); + expect(model.parameters[1]).equal('0x0'); - formattersMock.verify(); - }); + formattersMock.verify(); }); - describe('afterExecution', function () { - it('should just return the response', function () { - var object = {}; + it('afterExecution should just return the response', function () { + var object = {}; - expect(model.afterExecution(object)).to.equal(object); - }); + expect(model.afterExecution(object)).to.equal(object); }); }); diff --git a/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js b/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js index df12216605c..db75ce48718 100644 --- a/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var formatters = require('web3-core-helpers').formatters; var utils = require('web3-utils'); @@ -10,60 +10,51 @@ var EstimateGasMethodModel = require('../../../src/models/methods/EstimateGasMet * EstimateGasMethodModel test */ describe('EstimateGasMethodModelTest', function () { - var model, - formattersMock = sinon.mock(formatters), - utilsMock = sinon.mock(utils); + var model, formattersMock, utilsMock; beforeEach(function () { + formattersMock = sinon.mock(formatters); + utilsMock = sinon.mock(utils); model = new EstimateGasMethodModel(utils, formatters); }); - after(function () { - formattersMock.restore(); - utilsMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_estimateGas', function () { - expect(model.rpcMethod).to.equal('eth_estimateGas'); - }); + it('rpcMethod should return eth_estimateGas', function () { + expect(model.rpcMethod).to.equal('eth_estimateGas'); }); - describe('parametersAmount', function () { - it('should return 1', function () { - expect(model.parametersAmount).to.equal(1); - }); + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); }); - describe('beforeExecution', function () { - it('should call the inputCallFormatter', function () { - model.parameters = [{}]; + it('beforeExecution should call the inputCallFormatter', function () { + model.parameters = [{}]; - formattersMock - .expects('inputCallFormatter') - .withArgs(model.parameters[0], {}) - .returns({empty: true}) - .once(); + formattersMock + .expects('inputCallFormatter') + .withArgs(model.parameters[0], {}) + .returns({empty: true}) + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).to.have.property('empty', true); + expect(model.parameters[0]).to.have.property('empty', true); - formattersMock.verify(); - }); + formattersMock.verify(); }); - describe('afterExecution', function () { - it('should call hexToNumber and return the response', function () { - utilsMock - .expects('hexToNumber') - .withArgs({}) - .returns(100) - .once(); + it('afterExecution should call hexToNumber and return the response', function () { + utilsMock + .expects('hexToNumber') + .withArgs({}) + .returns(100) + .once(); - expect(model.afterExecution({})).equal(100); + expect(model.afterExecution({})).equal(100); - utilsMock.verify(); - }); + utilsMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js index 6d294f01a11..8b5800e5ad3 100644 --- a/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var formatters = require('web3-core-helpers').formatters; @@ -9,59 +9,51 @@ var GetCodeMethodModel = require('../../../src/models/methods/GetCodeMethodModel * GetCodeMethodModel test */ describe('GetCodeMethodModelTest', function () { - var model, - formattersMock = sinon.mock(formatters); + var model, formattersMock; beforeEach(function () { + formattersMock = sinon.mock(formatters); model = new GetCodeMethodModel({}, formatters); }); - after(function () { - formattersMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_getCode', function () { - expect(model.rpcMethod).to.equal('eth_getCode'); - }); + it('rpcMethod should return eth_getCode', function () { + expect(model.rpcMethod).to.equal('eth_getCode'); }); - describe('parametersAmount', function () { - it('should return 2', function () { - expect(model.parametersAmount).to.equal(2); - }); + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); }); - describe('beforeExecution', function () { - it('should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function () { - model.parameters = ['string', 100]; + it('beforeExecution should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function () { + model.parameters = ['string', 100]; - formattersMock - .expects('inputAddressFormatter') - .withArgs(model.parameters[0]) - .returns('0x0') - .once(); + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); - formattersMock - .expects('inputDefaultBlockNumberFormatter') - .withArgs(model.parameters[1], {}) - .returns('0x0') - .once(); + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[1], {}) + .returns('0x0') + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).equal('0x0'); - expect(model.parameters[1]).equal('0x0'); + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); - formattersMock.verify(); - }); + formattersMock.verify(); }); - describe('afterExecution', function () { - it('should just return the response', function () { - var object = {}; + it('afterExecution should just return the response', function () { + var object = {}; - expect(model.afterExecution(object)).to.equal(object); - }); + expect(model.afterExecution(object)).to.equal(object); }); }); diff --git a/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js index da9537e7a42..f2a555e2c4d 100644 --- a/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var formatters = require('web3-core-helpers').formatters; @@ -9,58 +9,50 @@ var GetPastLogsMethodModel = require('../../../src/models/methods/GetPastLogsMet * GetPastLogsMethodModel test */ describe('GetPastLogsMethodModelTest', function () { - var model, - formattersMock = sinon.mock(formatters); + var model, formattersMock; beforeEach(function () { + formattersMock = sinon.mock(formatters); model = new GetPastLogsMethodModel({}, formatters); }); - after(function () { - formattersMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_getLogs', function () { - expect(model.rpcMethod).to.equal('eth_getLogs'); - }); + it('rpcMethod should return eth_getLogs', function () { + expect(model.rpcMethod).to.equal('eth_getLogs'); }); - describe('parametersAmount', function () { - it('should return 1', function () { - expect(model.parametersAmount).to.equal(1); - }); + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); }); - describe('beforeExecution', function () { - it('should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function () { - model.parameters = [{}]; + it('beforeExecution should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function () { + model.parameters = [{}]; - formattersMock - .expects('inputLogFormatter') - .withArgs(model.parameters[0]) - .returns({empty: true}) - .once(); + formattersMock + .expects('inputLogFormatter') + .withArgs(model.parameters[0]) + .returns({empty: true}) + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).to.have.property('empty', true); + expect(model.parameters[0]).to.have.property('empty', true); - formattersMock.verify(); - }); + formattersMock.verify(); }); - describe('afterExecution', function () { - it('should just return the response', function () { - formattersMock - .expects('outputLogFormatter') - .withArgs({}) - .returns({formatted: true}) - .once(); + it('afterExecution should just return the response', function () { + formattersMock + .expects('outputLogFormatter') + .withArgs({}) + .returns({formatted: true}) + .once(); - expect(model.afterExecution([{}])[0]).to.have.property('formatted', true); + expect(model.afterExecution([{}])[0]).to.have.property('formatted', true); - formattersMock.verify(); - }); + formattersMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js index f671866b390..f609bfedb81 100644 --- a/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var formatters = require('web3-core-helpers').formatters; var utils = require('web3-utils'); @@ -10,72 +10,63 @@ var GetStorageAtMethodModel = require('../../../src/models/methods/GetStorageAtM * GetStorageAtMethodModel test */ describe('GetStorageAtMethodModelTest', function () { - var model, - formattersMock = sinon.mock(formatters), - utilsMock = sinon.mock(utils); + var model, formattersMock, utilsMock; beforeEach(function () { + formattersMock = sinon.mock(formatters); + utilsMock = sinon.mock(utils); model = new GetStorageAtMethodModel(utils, formatters); }); - after(function () { - formattersMock.restore(); - utilsMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_getStorageAt', function () { - expect(model.rpcMethod).to.equal('eth_getStorageAt'); - }); + it('rpcMethod should return eth_getStorageAt', function () { + expect(model.rpcMethod).to.equal('eth_getStorageAt'); }); - describe('parametersAmount', function () { - it('should return 3', function () { - expect(model.parametersAmount).to.equal(3); - }); + it('parametersAmount should return 3', function () { + expect(model.parametersAmount).to.equal(3); }); - describe('beforeExecution', function () { - it( - 'should call the formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter ' + - 'and utils.numberToHex method', - function () { - model.parameters = ['string', 100, 100]; + it( + 'beforeExecution should call the formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter ' + + 'and utils.numberToHex method', + function () { + model.parameters = ['string', 100, 100]; - formattersMock - .expects('inputAddressFormatter') - .withArgs(model.parameters[0]) - .returns('0x0') - .once(); + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); - utilsMock - .expects('numberToHex') - .withArgs(model.parameters[1]) - .returns('0x0') - .once(); + utilsMock + .expects('numberToHex') + .withArgs(model.parameters[1]) + .returns('0x0') + .once(); - formattersMock - .expects('inputDefaultBlockNumberFormatter') - .withArgs(model.parameters[2]) - .returns('0x0') - .once(); + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[2]) + .returns('0x0') + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).equal('0x0'); - expect(model.parameters[1]).equal('0x0'); - expect(model.parameters[2]).equal('0x0'); + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); + expect(model.parameters[2]).equal('0x0'); - formattersMock.verify(); - } - ); - }); + formattersMock.verify(); + } + ); - describe('afterExecution', function () { - it('should just return the response', function () { - var object = {}; + it('afterExecution should just return the response', function () { + var object = {}; - expect(model.afterExecution(object)).to.equal(object); - }); + expect(model.afterExecution(object)).to.equal(object); }); }); diff --git a/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js b/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js index 7b57d4622e8..c0005906da6 100644 --- a/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var formatters = require('web3-core-helpers').formatters; @@ -9,65 +9,55 @@ var SignMethodModel = require('../../../src/models/methods/SignMethodModel'); * GetStorageAtMethodModel test */ describe('SignMethodModelTest', function () { - var model, - formattersMock = sinon.mock(formatters); + var model, formattersMock; beforeEach(function () { + formattersMock = sinon.mock(formatters); model = new SignMethodModel({}, formatters, {test: true}); }); - after(function () { - formattersMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('accounts', function () { - it('should be defined', function () { - expect(model.accounts.test).to.be.true; - }); + it('accounts should be defined', function () { + expect(model.accounts.test).to.be.true; }); - describe('rpcMethod', function () { - it('should return eth_sign', function () { - expect(model.rpcMethod).to.equal('eth_sign'); - }); + it('rpcMethod should return eth_sign', function () { + expect(model.rpcMethod).to.equal('eth_sign'); }); - describe('parametersAmount', function () { - it('should return 2', function () { - expect(model.parametersAmount).to.equal(2); - }); + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); }); - describe('beforeExecution', function () { - it('should call the inputSignFormatter and inputAddressFormatter', function () { - model.parameters = ['string', 'string']; + it('beforeExecution should call the inputSignFormatter and inputAddressFormatter', function () { + model.parameters = ['string', 'string']; - formattersMock - .expects('inputSignFormatter') - .withArgs(model.parameters[0]) - .returns('string') - .once(); + formattersMock + .expects('inputSignFormatter') + .withArgs(model.parameters[0]) + .returns('string') + .once(); - formattersMock - .expects('inputAddressFormatter') - .withArgs(model.parameters[1]) - .returns('0x0') - .once(); + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[1]) + .returns('0x0') + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).equal('string'); - expect(model.parameters[1]).equal('0x0'); + expect(model.parameters[0]).equal('string'); + expect(model.parameters[1]).equal('0x0'); - formattersMock.verify(); - }); + formattersMock.verify(); }); - describe('afterExecution', function () { - it('should just return the response', function () { - var object = {}; + it('afterExecution should just return the response', function () { + var object = {}; - expect(model.afterExecution(object)).to.equal(object); - }); + expect(model.afterExecution(object)).to.equal(object); }); }); diff --git a/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js b/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js index 986d5619953..f2b89bca4f9 100644 --- a/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var utils = require('web3-utils'); @@ -9,51 +9,41 @@ var GetAccountsMethodModel = require('../../../../src/models/methods/account/Get * GetAccountsMethodModel test */ describe('GetAccountsMethodModelTest', function () { - var model, - utilsMock = sinon.mock(utils); + var model, utilsMock; beforeEach(function () { + utilsMock = sinon.mock(utils); model = new GetAccountsMethodModel(utils, {}); }); - after(function () { - utilsMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_accounts', function () { - expect(model.rpcMethod).to.equal('eth_accounts'); - }); + it('rpcMethod should return eth_accounts', function () { + expect(model.rpcMethod).to.equal('eth_accounts'); }); - describe('parametersAmount', function () { - it('should return 0', function () { - expect(model.parametersAmount).to.equal(0); - }); + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); }); - describe('beforeExecution', function () { - it('should do nothing with the parameters', function () { - model.parameters = []; - model.beforeExecution(); + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); - expect(model.parameters[0]).equal(undefined); - }); + expect(model.parameters[0]).equal(undefined); }); - describe('afterExecution', function () { - it('should just return the response', function () { - var response = [{}]; - - utilsMock - .expects('toChecksumAddress') - .withArgs(response[0]) - .returns('0x0') - .once(); + it('afterExecution should just return the response', function () { + utilsMock + .expects('toChecksumAddress') + .withArgs({}) + .returns('0x0') + .once(); - expect(model.afterExecution([{}])[0]).equal('0x0'); + expect(model.afterExecution([{}])[0]).equal('0x0'); - utilsMock.verify(); - }); + utilsMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js b/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js index 6ec71634514..7558aea129a 100644 --- a/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var formatters = require('web3-core-helpers').formatters; @@ -9,67 +9,59 @@ var GetBalanceMethodModel = require('../../../../src/models/methods/account/GetB * GetBalanceMethodModel test */ describe('GetBalanceMethodModelTest', function () { - var model, - formattersMock = sinon.mock(formatters); + var model, formattersMock; beforeEach(function () { + formattersMock = sinon.mock(formatters); model = new GetBalanceMethodModel({}, formatters); }); - after(function () { - formattersMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_getBalance', function () { - expect(model.rpcMethod).to.equal('eth_getBalance'); - }); + it('rpcMethod should return eth_getBalance', function () { + expect(model.rpcMethod).to.equal('eth_getBalance'); }); - describe('parametersAmount', function () { - it('should return 2', function () { - expect(model.parametersAmount).to.equal(2); - }); + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); }); - describe('beforeExecution', function () { - it('should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function () { - model.parameters = ['string', 100]; + it('beforeExecution should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function () { + model.parameters = ['string', 100]; - formattersMock - .expects('inputAddressFormatter') - .withArgs(model.parameters[0]) - .returns('0x0') - .once(); + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); - formattersMock - .expects('inputDefaultBlockNumberFormatter') - .withArgs(model.parameters[1], {}) - .returns('0x0') - .once(); + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[1], {}) + .returns('0x0') + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).equal('0x0'); - expect(model.parameters[1]).equal('0x0'); + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); - formattersMock.verify(); - }); + formattersMock.verify(); }); - describe('afterExecution', function () { - it('should call outputBigNumberFormatter on the response and return it', function () { - var response = {}; + it('afterExecution should call outputBigNumberFormatter on the response and return it', function () { + var response = {}; - formattersMock - .expects('outputBigNumberFormatter') - .withArgs(response) - .returns({bigNumber: true}) - .once(); + formattersMock + .expects('outputBigNumberFormatter') + .withArgs(response) + .returns({bigNumber: true}) + .once(); - expect(model.afterExecution({})).to.have.property('bigNumber', true); + expect(model.afterExecution({})).to.have.property('bigNumber', true); - formattersMock.verify(); - }); + formattersMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js index c6bf8ee2517..42f284b6f06 100644 --- a/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var formatters = require('web3-core-helpers').formatters; var utils = require('web3-utils'); @@ -10,67 +10,58 @@ var GetTransactionCountMethodModel = require('../../../../src/models/methods/acc * GetTransactionCountMethodModel test */ describe('GetTransactionCountMethodModelTest', function () { - var model, - formattersMock = sinon.mock(formatters), - utilsMock = sinon.mock(utils); + var model, formattersMock, utilsMock; beforeEach(function () { + formattersMock = sinon.mock(formatters); + utilsMock = sinon.mock(utils); model = new GetTransactionCountMethodModel(utils, formatters); }); - after(function () { - formattersMock.restore(); - utilsMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_getTransactionCount', function () { - expect(model.rpcMethod).to.equal('eth_getTransactionCount'); - }); + it('rpcMethod should return eth_getTransactionCount', function () { + expect(model.rpcMethod).to.equal('eth_getTransactionCount'); }); - describe('parametersAmount', function () { - it('should return 2', function () { - expect(model.parametersAmount).to.equal(2); - }); + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); }); - describe('beforeExecution', function () { - it('should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function () { - model.parameters = ['string', 100]; + it('beforeExecution should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function () { + model.parameters = ['string', 100]; - formattersMock - .expects('inputAddressFormatter') - .withArgs(model.parameters[0]) - .returns('0x0') - .once(); + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); - formattersMock - .expects('inputDefaultBlockNumberFormatter') - .withArgs(model.parameters[1], {}) - .returns('0x0') - .once(); + formattersMock + .expects('inputDefaultBlockNumberFormatter') + .withArgs(model.parameters[1], {}) + .returns('0x0') + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).equal('0x0'); - expect(model.parameters[1]).equal('0x0'); + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); - formattersMock.verify(); - }); + formattersMock.verify(); }); - describe('afterExecution', function () { - it('should call hexToNumber on the response and return it', function () { - utilsMock - .expects('hexToNumber') - .withArgs('0x0') - .returns(100) - .once(); + it('afterExecution should call hexToNumber on the response and return it', function () { + utilsMock + .expects('hexToNumber') + .withArgs('0x0') + .returns(100) + .once(); - expect(model.afterExecution('0x0')).equal(100); + expect(model.afterExecution('0x0')).equal(100); - utilsMock.verify(); - }); + utilsMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js index ee559575056..f61ccde5d50 100644 --- a/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var formatters = require('web3-core-helpers').formatters; @@ -9,79 +9,72 @@ var GetBlockMethodModel = require('../../../../src/models/methods/block/GetBlock * GetBlockMethodModel test */ describe('GetBlockMethodModelTest', function () { - var model, - formattersMock = sinon.mock(formatters); + var model, formattersMock; beforeEach(function () { + formattersMock = sinon.mock(formatters); model = new GetBlockMethodModel({}, formatters); }); - after(function () { - formattersMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_getBlockByNumber', function () { - expect(model.rpcMethod).to.equal('eth_getBlockByNumber'); - }); + it('rpcMethod should return eth_getBlockByNumber', function () { + expect(model.rpcMethod).to.equal('eth_getBlockByNumber'); }); - describe('parametersAmount', function () { - it('should return 2', function () { - expect(model.parametersAmount).to.equal(2); - }); + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); }); - describe('beforeExecution', function () { - it('should call method with block hash as parameter and call inputBlockNumberFormatter', function () { - model.parameters = ['0x0', true]; + it('should call beforeExecution with block hash as parameter and call inputBlockNumberFormatter', function () { + model.parameters = ['0x0', true]; - formattersMock - .expects('inputBlockNumberFormatter') - .withArgs(model.parameters[0]) - .returns('0x0') - .once(); + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).equal('0x0'); - expect(model.parameters[1]).to.be.true; + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).to.be.true; - formattersMock.verify(); + formattersMock.verify(); - expect(model.rpcMethod).equal('eth_getBlockByHash'); - }); + expect(model.rpcMethod).equal('eth_getBlockByHash'); + }); - it('should call method with block number as parameter and call inputBlockNumberFormatter', function () { - formattersMock = sinon.mock(formatters);// Because mock.restore() does not work as expected. - model.parameters = [100, true]; + it('should call beforeExecution with block number as parameter and call inputBlockNumberFormatter', function () { + model.parameters = [100, true]; - formattersMock - .expects('inputBlockNumberFormatter') - .withArgs(model.parameters[0]) - .returns('0x0') - .once(); + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); - model.beforeExecution({}); + model.beforeExecution({}); - expect(model.parameters[0]).equal('0x0'); - expect(model.parameters[1]).to.be.true; + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).to.be.true; - formattersMock.verify(); + formattersMock.verify(); - expect(model.rpcMethod).equal('eth_getBlockByNumber'); - }); + expect(model.rpcMethod).equal('eth_getBlockByNumber'); }); - describe('afterExecution', function () { - it('should just return the response', function () { - formattersMock - .expects('outputBlockFormatter') - .withArgs({}) - .returns({empty: false}) - .once(); + it('afterExecution should map the response', function () { + formattersMock + .expects('outputBlockFormatter') + .withArgs({}) + .returns({empty: false}) + .once(); + + expect(model.afterExecution({})).to.have.property('empty', false); - expect(model.afterExecution({})).to.have.property('empty', false); - }); + formattersMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js index 9c3e4d27fe4..1b45c73be96 100644 --- a/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js @@ -1,5 +1,5 @@ var chai = require('chai'); -var sinon = require('sinon'); +var sinon = require('sinon').createSandbox(); var expect = chai.expect; var utils = require('web3-utils'); @@ -9,47 +9,41 @@ var GetBlockNumberMethodModel = require('../../../../src/models/methods/block/Ge * GetBlockNumberMethodModel test */ describe('GetBlockNumberMethodModelTest', function () { - var model, - utilsMock = sinon.mock(utils); + var model, utilsMock; beforeEach(function () { + utilsMock = sinon.mock(utils); model = new GetBlockNumberMethodModel(utils, {}); }); - after(function () { - utilsMock.restore(); + afterEach(function () { + sinon.restore(); }); - describe('rpcMethod', function () { - it('should return eth_blockNumber', function () { - expect(model.rpcMethod).to.equal('eth_blockNumber'); - }); + it('rpcMethod should return eth_blockNumber', function () { + expect(model.rpcMethod).to.equal('eth_blockNumber'); }); - describe('parametersAmount', function () { - it('should return 0', function () { - expect(model.parametersAmount).to.equal(0); - }); + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); }); - describe('beforeExecution', function () { - it('should do nothing with the parameters', function () { - model.parameters = []; - model.beforeExecution(); + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); - expect(model.parameters[0]).equal(undefined); - }); + expect(model.parameters[0]).equal(undefined); }); - describe('afterExecution', function () { - it('should just return the response', function () { - utilsMock - .expects('hexToNumber') - .withArgs('0x0') - .returns(100) - .once(); + it('afterExecution should map theresponse', function () { + utilsMock + .expects('hexToNumber') + .withArgs('0x0') + .returns(100) + .once(); + + expect(model.afterExecution('0x0')).equal(100); - expect(model.afterExecution('0x0')).equal(100); - }); + utilsMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js new file mode 100644 index 00000000000..abac97c4b4a --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js @@ -0,0 +1,81 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; +var utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; + +var GetBlockTransactionCountMethodModel = require('../../../../src/models/methods/block/GetBlockTransactionCountMethodModel'); + +/** + * GetBlockTransactionCountMethodModel test + */ +describe('GetBlockTransactionCountMethodModelTest', function () { + var model, utilsMock, formattersMock; + + beforeEach(function () { + utilsMock = sinon.mock(utils); + formattersMock = sinon.mock(formatters); + model = new GetBlockTransactionCountMethodModel(utils, formatters); + }); + + afterEach(function() { + sinon.restore(); + }); + + it('rpcMethod should return eth_getTransactionByBlockNumberAndIndex', function () { + expect(model.rpcMethod).to.equal('eth_getTransactionByBlockNumberAndIndex'); + }); + + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + + it('beforeExecution should call method with block hash as parameter and call inputBlockNumberFormatter', function () { + model.parameters = ['0x0']; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + + formattersMock.verify(); + + expect(model.rpcMethod).equal('eth_getTransactionByBlockHashAndIndex'); + }); + + it('beforeExecution should call method with block number as parameter and call inputBlockNumberFormatter', function () { + + model.parameters = [100]; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + + formattersMock.verify(); + + expect(model.rpcMethod).equal('eth_getTransactionByBlockNumberAndIndex'); + }); + + it('afterExecution should map the hex string to a number', function () { + utilsMock + .expects('hexToNumber') + .withArgs('0x0') + .returns(100) + .once(); + + expect(model.afterExecution('0x0')).equal(100); + + utilsMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js new file mode 100644 index 00000000000..7f89397cf31 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js @@ -0,0 +1,81 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; +var utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; + +var GetBlockUncleCountMethodModel = require('../../../../src/models/methods/block/GetBlockUncleCountMethodModel'); + +/** + * GetBlockUncleCountMethodModel test + */ +describe('GetBlockUncleCountMethodModelTest', function () { + var model, utilsMock, formattersMock; + + beforeEach(function () { + utilsMock = sinon.mock(utils); + formattersMock = sinon.mock(formatters); + + model = new GetBlockUncleCountMethodModel(utils, formatters); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_getUncleCountByBlockNumber', function () { + expect(model.rpcMethod).to.equal('eth_getUncleCountByBlockNumber'); + }); + + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + + it('should call beforeExecution with block hash as parameter and call inputBlockNumberFormatter', function () { + model.parameters = ['0x0']; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + + formattersMock.verify(); + + expect(model.rpcMethod).equal('eth_getUncleCountByBlockHash'); + }); + + it('should call beforeExecution with block number as parameter and call inputBlockNumberFormatter', function () { + model.parameters = [100]; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + + formattersMock.verify(); + + expect(model.rpcMethod).equal('eth_getUncleCountByBlockNumber'); + }); + + it('afterExecution should map the hex string to a number', function () { + utilsMock + .expects('hexToNumber') + .withArgs('0x0') + .returns(100) + .once(); + + expect(model.afterExecution('0x0')).equal(100); + + utilsMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js new file mode 100644 index 00000000000..50677a655ea --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js @@ -0,0 +1,94 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; +var utils = require('web3-utils'); +var formatters = require('web3-core-helpers').formatters; + +var GetUncleMethodModel = require('../../../../src/models/methods/block/GetUncleMethodModel'); + +/** + * GetUncleMethodModel test + */ +describe('GetUncleMethodModelTest', function () { + var model, utilsMock, formattersMock; + + beforeEach(function () { + utilsMock = sinon.mock(utils); + formattersMock = sinon.mock(formatters); + model = new GetUncleMethodModel(utils, formatters); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_getUncleByBlockNumberAndIndex', function () { + expect(model.rpcMethod).to.equal('eth_getUncleByBlockNumberAndIndex'); + }); + + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + + it('should call beforeExecution with block hash as parameter and call inputBlockNumberFormatter', function () { + model.parameters = ['0x0', 100]; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + utilsMock + .expects('numberToHex') + .withArgs(model.parameters[1]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); + + formattersMock.verify(); + + expect(model.rpcMethod).equal('eth_getUncleByBlockHashAndIndex'); + }); + + it('should call beforeExecution with block number as parameter and call inputBlockNumberFormatter', function () { + model.parameters = [100, 100]; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + utilsMock + .expects('numberToHex') + .withArgs(model.parameters[1]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); + + formattersMock.verify(); + + expect(model.rpcMethod).equal('eth_getUncleByBlockNumberAndIndex'); + }); + + it('afterExecution should map the response', function () { + formattersMock + .expects('outputBlockFormatter') + .withArgs({}) + .returns({block: true}) + .once(); + + expect(model.afterExecution({})).to.be.property('block', true); + + formattersMock.verify(); + }); +}); From 4765675310b0caff74237883b8fd0e054aa37b0a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 11 Oct 2018 12:51:28 +0200 Subject: [PATCH 0230/1045] node and network method model tests created --- .../methods/network/PeerCountMethodModel.js | 8 +-- .../methods/network/VersionMethodModel.js | 6 +-- .../methods/node/GetGasPriceMethodModel.js | 6 +-- .../methods/node/GetHashrateMethodModel.js | 6 +-- .../methods/node/IsSyncingMethodModel.js | 6 +-- .../GetProtocolVersionMethodModelTest.js | 34 +++++++++++++ .../network/ListeningMethodModelTest.js | 34 +++++++++++++ .../network/PeerCountMethodModelTest.js | 49 +++++++++++++++++++ .../methods/network/VersionMethodModelTest.js | 49 +++++++++++++++++++ .../node/GetCoinbaseMethodModelTest.js | 41 ++++++++++++++++ .../node/GetGasPriceMethodModelTest.js | 49 +++++++++++++++++++ .../node/GetHashrateMethodModelTest.js | 49 +++++++++++++++++++ .../node/GetNodeInfoMethodModelTest.js | 34 +++++++++++++ .../methods/node/GetWorkMethodModelTest.js | 34 +++++++++++++ .../methods/node/IsMiningMethodModelTest.js | 34 +++++++++++++ .../methods/node/IsSyncingMethodModelTest.js | 49 +++++++++++++++++++ .../methods/node/SubmitWorkMethodModelTest.js | 34 +++++++++++++ 17 files changed, 506 insertions(+), 16 deletions(-) create mode 100644 packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js diff --git a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js index bcb18b27e17..29371fb14b3 100644 --- a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js @@ -34,12 +34,15 @@ function PeerCountMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'net_peerCount', 0, utils, formatters); } +PeerCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +PeerCountMethodModel.prototype.constructor = PeerCountMethodModel; + /** * This method will be executed after the RPC request. * * @method afterExecution * - * @param {Object} response + * @param {String} response * * @returns {Number} */ @@ -47,7 +50,4 @@ PeerCountMethodModel.prototype.afterExecution = function (response) { return this.utils.hexToNumber(response); }; -PeerCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -PeerCountMethodModel.prototype.constructor = PeerCountMethodModel; - module.exports = PeerCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js index c315f8237d1..aed766aee72 100644 --- a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js @@ -34,6 +34,9 @@ function VersionMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_protocolVersion', 0, utils, formatters); } +VersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +VersionMethodModel.prototype.constructor = VersionMethodModel; + /** * This method will be executed after the RPC request. * @@ -47,7 +50,4 @@ VersionMethodModel.prototype.afterExecution = function (response) { return this.utils.hexToNumber(response); }; -VersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -VersionMethodModel.prototype.constructor = VersionMethodModel; - module.exports = VersionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js index 1a2b8f0197c..1a320b3b340 100644 --- a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js @@ -34,6 +34,9 @@ function GetGasPriceMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_gasPrice', 0, utils, formatters); } +GetGasPriceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetGasPriceMethodModel.prototype.constructor = GetGasPriceMethodModel; + /** * This method will be executed after the RPC request. * @@ -47,7 +50,4 @@ GetGasPriceMethodModel.prototype.afterExecution = function (response) { return this.formatters.outputBigNumberFormatter(response); }; -GetGasPriceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetGasPriceMethodModel.prototype.constructor = GetGasPriceMethodModel; - module.exports = GetGasPriceMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js index e0ee786ac45..4e8e7102a3f 100644 --- a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js @@ -34,6 +34,9 @@ function GetHashrateMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_hashrate', 0, utils, formatters); } +GetHashrateMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetHashrateMethodModel.prototype.constructor = GetHashrateMethodModel; + /** * This method will be executed after the RPC request. * @@ -47,7 +50,4 @@ GetHashrateMethodModel.prototype.afterExecution = function (response) { return this.utils.hexToNumber(response); }; -GetHashrateMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetHashrateMethodModel.prototype.constructor = GetHashrateMethodModel; - module.exports = GetHashrateMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js index f9009045338..e28425c0c98 100644 --- a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js @@ -34,6 +34,9 @@ function IsSyncingMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_syncing', 0, utils, formatters); } +IsSyncingMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +IsSyncingMethodModel.prototype.constructor = IsSyncingMethodModel; + /** * This method will be executed after the RPC request. * @@ -47,7 +50,4 @@ IsSyncingMethodModel.prototype.afterExecution = function (response) { return this.formatters.outputSyncingFormatter(response); }; -IsSyncingMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -IsSyncingMethodModel.prototype.constructor = IsSyncingMethodModel; - module.exports = IsSyncingMethodModel; diff --git a/packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js new file mode 100644 index 00000000000..b13ff5e5f24 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js @@ -0,0 +1,34 @@ +var chai = require('chai'); +var expect = chai.expect; + +var GetProtocolVersionMethodModel = require('../../../../src/models/methods/network/GetProtocolVersionMethodModel'); + +/** + * GetProtocolVersionMethodModel test + */ +describe('GetProtocolVersionMethodModelTest', function () { + var model; + + beforeEach(function () { + model = new GetProtocolVersionMethodModel({}, {}); + }); + + it('rpcMethod should return eth_protocolVersion', function () { + expect(model.rpcMethod).to.equal('eth_protocolVersion'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('version')).equal('version'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js b/packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js new file mode 100644 index 00000000000..44faa5d482c --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js @@ -0,0 +1,34 @@ +var chai = require('chai'); +var expect = chai.expect; + +var ListeningMethodModel = require('../../../../src/models/methods/network/ListeningMethodModel'); + +/** + * ListeningMethodModel test + */ +describe('ListeningMethodModelTest', function () { + var model; + + beforeEach(function () { + model = new ListeningMethodModel({}, {}); + }); + + it('rpcMethod should return net_listening', function () { + expect(model.rpcMethod).to.equal('net_listening'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('version')).equal('version'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js new file mode 100644 index 00000000000..49dcd48d923 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js @@ -0,0 +1,49 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var utils = require('web3-utils'); + +var PeerCountMethodModel = require('../../../../src/models/methods/network/PeerCountMethodModel'); + +/** + * PeerCountMethodModel test + */ +describe('PeerCountMethodModelTest', function () { + var model, utilsMock; + + beforeEach(function () { + utilsMock = sinon.mock(utils); + model = new PeerCountMethodModel(utils, {}); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return net_peerCount', function () { + expect(model.rpcMethod).to.equal('net_peerCount'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should map the response', function () { + utilsMock + .expects('hexToNumber') + .withArgs('0x0') + .returns(100) + .once(); + + expect(model.afterExecution('0x0')).equal(100); + + utilsMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js new file mode 100644 index 00000000000..e9dd231fc1a --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js @@ -0,0 +1,49 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var utils = require('web3-utils'); + +var VersionMethodModel = require('../../../../src/models/methods/network/VersionMethodModel'); + +/** + * VersionMethodModel test + */ +describe('VersionMethodModelTest', function () { + var model, utilsMock; + + beforeEach(function () { + utilsMock = sinon.mock(utils); + model = new VersionMethodModel(utils, {}); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_protocolVersion', function () { + expect(model.rpcMethod).to.equal('eth_protocolVersion'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should map the response', function () { + utilsMock + .expects('hexToNumber') + .withArgs('0x0') + .returns(100) + .once(); + + expect(model.afterExecution('0x0')).equal(100); + + utilsMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js new file mode 100644 index 00000000000..76ef06f0059 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js @@ -0,0 +1,41 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var utils = require('web3-utils'); + +var GetCoinbaseMethodModel = require('../../../../src/models/methods/node/GetCoinbaseMethodModel'); + +/** + * GetCoinbaseMethodModel test + */ +describe('GetCoinbaseMethodModelTest', function () { + var model, utilsMock; + + beforeEach(function () { + utilsMock = sinon.mock(utils); + model = new GetCoinbaseMethodModel(utils, {}); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_coinbase', function () { + expect(model.rpcMethod).to.equal('eth_coinbase'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('coinbase')).equal('coinbase'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js new file mode 100644 index 00000000000..bfafeed3abe --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js @@ -0,0 +1,49 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var formatters = require('web3-core-helpers').formatters; + +var GetGasPriceMethodModel = require('../../../../src/models/methods/node/GetGasPriceMethodModel'); + +/** + * GetGasPriceMethodModel test + */ +describe('GetGasPriceMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new GetGasPriceMethodModel({}, formatters); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_gasPrice', function () { + expect(model.rpcMethod).to.equal('eth_gasPrice'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should map the response', function () { + formattersMock + .expects('outputBigNumberFormatter') + .withArgs('1000') + .returns({bigNumber: true}) + .once(); + + expect(model.afterExecution('1000')).to.be.property('bigNumber', true); + + formattersMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js new file mode 100644 index 00000000000..b543ee9073e --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js @@ -0,0 +1,49 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var utils = require('web3-utils'); + +var GetHashrateMethodModel = require('../../../../src/models/methods/node/GetHashrateMethodModel'); + +/** + * GetHashrateMethodModel test + */ +describe('GetHashrateMethodModelTest', function () { + var model, utilsMock; + + beforeEach(function () { + utilsMock = sinon.mock(utils); + model = new GetHashrateMethodModel(utils, {}); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_hashrate', function () { + expect(model.rpcMethod).to.equal('eth_hashrate'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should map the response', function () { + utilsMock + .expects('hexToNumber') + .withArgs('0x0') + .returns(100) + .once(); + + expect(model.afterExecution('0x0')).equal(100); + + utilsMock.verify() + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js new file mode 100644 index 00000000000..da9a7b23768 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js @@ -0,0 +1,34 @@ +var chai = require('chai'); +var expect = chai.expect; + +var GetNodeInfoMethodModel = require('../../../../src/models/methods/node/GetNodeInfoMethodModel'); + +/** + * GetNodeInfoMethodModel test + */ +describe('GetNodeInfoMethodModelTest', function () { + var model; + + beforeEach(function () { + model = new GetNodeInfoMethodModel({}, {}); + }); + + it('rpcMethod should return web3_clientVersion', function () { + expect(model.rpcMethod).to.equal('web3_clientVersion'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('version')).equal('version'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js new file mode 100644 index 00000000000..b28df77195b --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js @@ -0,0 +1,34 @@ +var chai = require('chai'); +var expect = chai.expect; + +var GetWorkMethodModel = require('../../../../src/models/methods/node/GetWorkMethodModel'); + +/** + * GetWorkMethodModel test + */ +describe('GetWorkMethodModelTest', function () { + var model; + + beforeEach(function () { + model = new GetWorkMethodModel({}, {}); + }); + + it('rpcMethod should return eth_getWork', function () { + expect(model.rpcMethod).to.equal('eth_getWork'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('version')).equal('version'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js new file mode 100644 index 00000000000..0142400c602 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js @@ -0,0 +1,34 @@ +var chai = require('chai'); +var expect = chai.expect; + +var IsMiningMethodModel = require('../../../../src/models/methods/node/IsMiningMethodModel'); + +/** + * IsMiningMethodModel test + */ +describe('IsMiningMethodModelTest', function () { + var model; + + beforeEach(function () { + model = new IsMiningMethodModel({}, {}); + }); + + it('rpcMethod should return eth_mining', function () { + expect(model.rpcMethod).to.equal('eth_mining'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('version')).equal('version'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js new file mode 100644 index 00000000000..0d316ec3900 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js @@ -0,0 +1,49 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var formatters = require('web3-core-helpers').formatters; + +var IsSyncingMethodModel = require('../../../../src/models/methods/node/IsSyncingMethodModel'); + +/** + * IsSyncingMethodModel test + */ +describe('IsSyncingMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new IsSyncingMethodModel({}, formatters); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_syncing', function () { + expect(model.rpcMethod).to.equal('eth_syncing'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + formattersMock + .expects('outputSyncingFormatter') + .withArgs({}) + .returns({isSyncing: true}) + .once(); + + expect(model.afterExecution({})).to.be.property('isSyncing', true); + + formattersMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js new file mode 100644 index 00000000000..c7cfb7bf3a4 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js @@ -0,0 +1,34 @@ +var chai = require('chai'); +var expect = chai.expect; + +var SubmitWorkMethodModel = require('../../../../src/models/methods/node/SubmitWorkMethodModel'); + +/** + * SubmitWorkMethodModel test + */ +describe('SubmitWorkMethodModelTest', function () { + var model; + + beforeEach(function () { + model = new SubmitWorkMethodModel({}, {}); + }); + + it('rpcMethod should return eth_submitWork', function () { + expect(model.rpcMethod).to.equal('eth_submitWork'); + }); + + it('parametersAmount should return 3', function () { + expect(model.parametersAmount).to.equal(3); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('submitWork')).equal('submitWork'); + }); +}); From 1c132700fdb6746000ce3ba5f232f5d1185af6d2 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 11 Oct 2018 13:20:45 +0200 Subject: [PATCH 0231/1045] personal method model tests created and TransactionConfirmationModelTest refactored --- .../methods/personal/EcRecoverMethodModel.js | 6 +- .../personal/ListAccountsMethodModel.js | 6 +- .../personal/LockAccountMethodModel.js | 6 +- .../methods/personal/NewAccountMethodModel.js | 6 +- .../PersonalSendTransactionMethodModel.js | 6 +- .../personal/PersonalSignMethodModel.js | 6 +- .../personal/UnlockAccountMethodModel.js | 6 +- .../TransactionConfirmationModelTest.js | 122 ++++++++---------- .../methods/node/IsSyncingMethodModelTest.js | 2 +- .../personal/EcRecoverMethodModelTest.js | 58 +++++++++ .../personal/ImportRawKeyMethodModelTest.js | 34 +++++ .../personal/ListAccountsMethodModelTest.js | 49 +++++++ .../personal/LockAccountMethodModelTest.js | 50 +++++++ .../personal/NewAccountMethodModelTest.js | 49 +++++++ .../PersonalSendTransactionMethodModelTest.js | 50 +++++++ .../personal/PersonalSignMethodModelTest.js | 57 ++++++++ .../personal/UnlockAccountMethodModelTest.js | 50 +++++++ 17 files changed, 471 insertions(+), 92 deletions(-) create mode 100644 packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js diff --git a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index b6d64beefce..b6f238b6404 100644 --- a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -34,6 +34,9 @@ function EcRecoverMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'personal_ecRecover', 3, utils, formatters); } +EcRecoverMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +EcRecoverMethodModel.prototype.constructor = EcRecoverMethodModel; + /** * This method will be executed before the RPC request. * @@ -46,7 +49,4 @@ EcRecoverMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); }; -EcRecoverMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -EcRecoverMethodModel.prototype.constructor = EcRecoverMethodModel; - module.exports = EcRecoverMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js index 372fdeca01a..97cc4254053 100644 --- a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js @@ -34,6 +34,9 @@ function ListAccountsMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'personal_listAccounts', 0, utils, formatters); } +ListAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +ListAccountsMethodModel.prototype.constructor = ListAccountsMethodModel; + /** * This method will be executed after the RPC request. * @@ -51,7 +54,4 @@ ListAccountsMethodModel.prototype.afterExecution = function (response) { }); }; -ListAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -ListAccountsMethodModel.prototype.constructor = ListAccountsMethodModel; - module.exports = ListAccountsMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index 27c7e1257b9..dbe274c016a 100644 --- a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -34,6 +34,9 @@ function LockAccountMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'personal_lockAccount', 1, utils, formatters); } +LockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +LockAccountMethodModel.prototype.constructor = LockAccountMethodModel; + /** * This method will be executed before the RPC request. * @@ -45,7 +48,4 @@ LockAccountMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); }; -LockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -LockAccountMethodModel.prototype.constructor = LockAccountMethodModel; - module.exports = LockAccountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js index e1f31504b42..9620fed6f2b 100644 --- a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js @@ -34,6 +34,9 @@ function NewAccountMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'personal_newAccount', 0, utils, formatters); } +NewAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +NewAccountMethodModel.prototype.constructor = NewAccountMethodModel; + /** * This method will be executed after the RPC request. * @@ -47,7 +50,4 @@ NewAccountMethodModel.prototype.afterExecution = function (response) { return this.utils.toChecksumAddress(response); }; -NewAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -NewAccountMethodModel.prototype.constructor = NewAccountMethodModel; - module.exports = NewAccountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index 423ff074270..521ed2b97c1 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -34,6 +34,9 @@ function PersonalSendTransactionMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'personal_sendTransaction', 2, utils, formatters); } +PersonalSendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +PersonalSendTransactionMethodModel.prototype.constructor = PersonalSendTransactionMethodModel; + /** * This method will be executed before the RPC request. * @@ -45,7 +48,4 @@ PersonalSendTransactionMethodModel.prototype.beforeExecution = function (web3Pac this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); }; -PersonalSendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -PersonalSendTransactionMethodModel.prototype.constructor = PersonalSendTransactionMethodModel; - module.exports = PersonalSendTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index 54d43ba0d50..8d22d292309 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -34,6 +34,9 @@ function PersonalSignMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'personal_sign', 3, utils, formatters); } +PersonalSignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +PersonalSignMethodModel.prototype.constructor = PersonalSignMethodModel; + /** * This method will be executed before the RPC request. * @@ -46,7 +49,4 @@ PersonalSignMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); }; -PersonalSignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -PersonalSignMethodModel.prototype.constructor = PersonalSignMethodModel; - module.exports = PersonalSignMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index d7a1f45acaf..af07a390d7a 100644 --- a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -34,6 +34,9 @@ function UnlockAccountMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'personal_unlockAccount', 3, utils, formatters); } +UnlockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +UnlockAccountMethodModel.prototype.constructor = UnlockAccountMethodModel; + /** * This method will be executed before the RPC request. * @@ -45,7 +48,4 @@ UnlockAccountMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); }; -UnlockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -UnlockAccountMethodModel.prototype.constructor = UnlockAccountMethodModel; - module.exports = UnlockAccountMethodModel; diff --git a/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js b/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js index 2cc30f45649..cc3d1bf81de 100644 --- a/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js +++ b/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js @@ -12,93 +12,75 @@ describe('TransactionConfirmationModel', function () { model = new TransactionConfirmationModel(); }); - describe('POLLINGTIMEOUT', function () { - it('should return 15 * TIMEOUTBLOCK', function () { - assert.equal(model.POLLINGTIMEOUT, 15 * model.TIMEOUTBLOCK); - }); + it('POLLINGTIMEOUT should return 15 * TIMEOUTBLOCK', function () { + assert.equal(model.POLLINGTIMEOUT, 15 * model.TIMEOUTBLOCK); }); - describe('TIMOUTBLOCk', function () { - it('should return 50', function () { - assert.equal(model.TIMEOUTBLOCK, 50); - }); + it('TIMOUTBLOCK should return 50', function () { + assert.equal(model.TIMEOUTBLOCK, 50); }); - describe('CONFIRMATIONBLOCKS', function () { - it('should return 24', function () { - assert.equal(model.TIMEOUTBLOCK, 50); - }); + it('CONFIRMATIONBLOCKS should return 24', function () { + assert.equal(model.TIMEOUTBLOCK, 50); }); - describe('confirmationsCount', function () { - it('should return 0 as the initial value', function () { - assert.equal(model.confirmationsCount, 0); - }); + it('confirmationsCount should return 0 as the initial value', function () { + assert.equal(model.confirmationsCount, 0); + }); + + it('confirmationsCount should return one more after adding an confirmation', function () { + assert.equal(model.confirmationsCount, 0); + model.addConfirmation({}); + assert.equal(model.confirmationsCount, 1); + }); + + it('addConfirmation should just add the confirmations without changing something', function () { + var confirmations = [ + {test: 'asdf'}, + {test: 'asdf'} + ]; - it('should return one more after adding an confirmation', function () { - assert.equal(model.confirmationsCount, 0); - model.addConfirmation({}); - assert.equal(model.confirmationsCount, 1); - }); + model.addConfirmation(confirmations[0]); + model.addConfirmation(confirmations[1]); + + assert.deepEqual(model.confirmations, confirmations); }); - describe('addConfirmation', function () { - it('should just add the confirmations without changing something', function () { - var confirmations = [ - {test: 'asdf'}, - {test: 'asdf'} - ]; + it('isConfirmed should return true ', function () { + model.confirmations = [ + {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, + {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, + {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, + {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, + {test: 'asdf'} + ]; - model.addConfirmation(confirmations[0]); - model.addConfirmation(confirmations[1]); - assert.deepEqual(model.confirmations, confirmations); - }); + assert.isTrue(model.isConfirmed()); }); - describe('isConfirmed', function () { - it('should return true ', function () { - model.confirmations = [ - {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, - {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, - {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, - {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, - {test: 'asdf'} - ]; + it('isConfirmed should return false ', function () { + model.confirmations = [{test: 'asdf'}]; + assert.isFalse(model.isConfirmed()); + }); + it('isTimeoutTimeExceeded should return true and watcher should not polling', function () { + model.timeoutCounter = 51; + assert.isTrue(model.isTimeoutTimeExceeded(false)); + }); - assert.isTrue(model.isConfirmed()); - }); + it('should return false ', function () { + model.timeoutCounter = 40; + assert.isFalse(model.isTimeoutTimeExceeded(false)); + }); - it('should return false ', function () { - model.confirmations = [{test: 'asdf'}]; - assert.isFalse(model.isConfirmed()); - }); + it('isTimeoutTimeExceeded should return true with polling watcher', function () { + model.timeoutCounter = 1 + (15 * model.TIMEOUTBLOCK); + assert.isTrue(model.isTimeoutTimeExceeded(true)); }); - describe('isTimeoutTimeExceeded', function () { - describe('watcher is not polling', function () { - it('should return true ', function () { - model.timeoutCounter = 51; - assert.isTrue(model.isTimeoutTimeExceeded(false)); - }); - - it('should return false ', function () { - model.timeoutCounter = 40; - assert.isFalse(model.isTimeoutTimeExceeded(false)); - }); - }); - - describe('watcher is polling', function () { - it('should return true ', function () { - model.timeoutCounter = 1 + (15 * model.TIMEOUTBLOCK); - assert.isTrue(model.isTimeoutTimeExceeded(true)); - }); - - it('should return false ', function () { - model.timeoutCounter = 40; - assert.isFalse(model.isTimeoutTimeExceeded(true)); - }); - }); + it('should return false ', function () { + model.timeoutCounter = 40; + assert.isFalse(model.isTimeoutTimeExceeded(true)); }); }); diff --git a/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js index 0d316ec3900..e66c3c8cbff 100644 --- a/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js @@ -35,7 +35,7 @@ describe('IsSyncingMethodModelTest', function () { expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should map the response', function () { formattersMock .expects('outputSyncingFormatter') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js new file mode 100644 index 00000000000..307a0464057 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js @@ -0,0 +1,58 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var formatters = require('web3-core-helpers').formatters; + +var EcRecoverMethodModel = require('../../../../src/models/methods/personal/EcRecoverMethodModel'); + +/** + * EcRecoverMethodModel test + */ +describe('EcRecoverMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new EcRecoverMethodModel({}, formatters); + }); + + afterEach(function() { + sinon.restore(); + }); + + it('rpcMethod should return personal_ecRecover', function () { + expect(model.rpcMethod).to.equal('personal_ecRecover'); + }); + + it('parametersAmount should return 3', function () { + expect(model.parametersAmount).to.equal(3); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = [{}, '0x0']; + + formattersMock + .expects('inputSignFormatter') + .withArgs(model.parameters[0]) + .returns({sign: true}) + .once(); + + formattersMock + .expects('inputAddressFormatter') + .withArgs(model.parameters[1]) + .returns('0x0') + .once(); + + model.beforeExecution(); + + expect(model.parameters[0]).to.be.property('sign', true); + expect(model.parameters[1]).equal('0x0'); + + formattersMock.verify(); + + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('submitWork')).equal('submitWork'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js new file mode 100644 index 00000000000..8123e2eb498 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js @@ -0,0 +1,34 @@ +var chai = require('chai'); +var expect = chai.expect; + +var ImportRawKeyMethodModel = require('../../../../src/models/methods/personal/ImportRawKeyMethodModel'); + +/** + * ImportRawKeyMethodModel test + */ +describe('ImportRawKeyMethodModelTest', function () { + var model; + + beforeEach(function () { + model = new ImportRawKeyMethodModel({}, {}); + }); + + it('rpcMethod should return personal_importRawKey', function () { + expect(model.rpcMethod).to.equal('personal_importRawKey'); + }); + + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('version')).equal('version'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js new file mode 100644 index 00000000000..c8ce680f494 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js @@ -0,0 +1,49 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var utils = require('web3-utils'); + +var ListAccountsMethodModel = require('../../../../src/models/methods/personal/ListAccountsMethodModel'); + +/** + * ListAccountsMethodModel test + */ +describe('ListAccountsMethodModelTest', function () { + var model, utilsMock; + + beforeEach(function () { + utilsMock = sinon.mock(utils); + model = new ListAccountsMethodModel(utils, {}); + }); + + afterEach(function() { + sinon.restore(); + }); + + it('rpcMethod should return personal_listAccounts', function () { + expect(model.rpcMethod).to.equal('personal_listAccounts'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + utilsMock + .expects('toChecksumAddress') + .withArgs('0x0') + .returns('0x0') + .once(); + + expect(model.afterExecution(['0x0'])[0]).equal('0x0'); + + utilsMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js new file mode 100644 index 00000000000..b0f89e66c83 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js @@ -0,0 +1,50 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var formatters = require('web3-core-helpers').formatters; + +var LockAccountMethodModel = require('../../../../src/models/methods/personal/LockAccountMethodModel'); + +/** + * LockAccountMethodModel test + */ +describe('LockAccountMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new LockAccountMethodModel({}, formatters); + }); + + afterEach(function() { + sinon.restore(); + }); + + it('rpcMethod should return personal_lockAccount', function () { + expect(model.rpcMethod).to.equal('personal_lockAccount'); + }); + + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + + it('beforeExecution should call inputAddressFormatter', function () { + model.parameters = ['0x0']; + + formattersMock + .expects('inputAddressFormatter') + .withArgs('0x0') + .returns('0x0') + .once(); + + model.beforeExecution(); + + formattersMock.verify(); + + expect(model.parameters[0]).equal('0x0'); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('lockAccount')).equal('lockAccount'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js new file mode 100644 index 00000000000..c21f2f0ccb1 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js @@ -0,0 +1,49 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var utils = require('web3-utils'); + +var NewAccountMethodModel = require('../../../../src/models/methods/personal/NewAccountMethodModel'); + +/** + * NewAccountMethodModel test + */ +describe('NewAccountMethodModelTest', function () { + var model, utilsMock; + + beforeEach(function () { + utilsMock = sinon.mock(utils); + model = new NewAccountMethodModel(utils, {}); + }); + + afterEach(function() { + sinon.restore(); + }); + + it('rpcMethod should return personal_newAccount', function () { + expect(model.rpcMethod).to.equal('personal_newAccount'); + }); + + it('parametersAmount should return 0', function () { + expect(model.parametersAmount).to.equal(0); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + utilsMock + .expects('toChecksumAddress') + .withArgs('0x0') + .returns('0x0') + .once(); + + expect(model.afterExecution('0x0')).equal('0x0'); + + utilsMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js new file mode 100644 index 00000000000..03d67136139 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js @@ -0,0 +1,50 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var formatters = require('web3-core-helpers').formatters; + +var PersonalSendTransactionMethodModel = require('../../../../src/models/methods/personal/PersonalSendTransactionMethodModel'); + +/** + * PersonalSendTransactionMethodModel test + */ +describe('PersonalSendTransactionMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new PersonalSendTransactionMethodModel({}, formatters); + }); + + afterEach(function() { + sinon.restore(); + }); + + it('rpcMethod should return personal_sendTransaction', function () { + expect(model.rpcMethod).to.equal('personal_sendTransaction'); + }); + + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + + it('beforeExecution should call inputTransactionFormatter', function () { + model.parameters = [{}]; + + formattersMock + .expects('inputTransactionFormatter') + .withArgs({}, {}) + .returns({send: true}) + .once(); + + model.beforeExecution({}); + + formattersMock.verify(); + + expect(model.parameters[0]).to.be.property('send', true); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('personalSend')).equal('personalSend'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js new file mode 100644 index 00000000000..ae3090d95b2 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js @@ -0,0 +1,57 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var formatters = require('web3-core-helpers').formatters; + +var PersonalSignMethodModel = require('../../../../src/models/methods/personal/PersonalSignMethodModel'); + +/** + * PersonalSignMethodModel test + */ +describe('PersonalSignMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new PersonalSignMethodModel({}, formatters); + }); + + afterEach(function() { + sinon.restore(); + }); + + it('rpcMethod should return personal_sign', function () { + expect(model.rpcMethod).to.equal('personal_sign'); + }); + + it('parametersAmount should return 3', function () { + expect(model.parametersAmount).to.equal(3); + }); + + it('beforeExecution should call inputSignFormatter and inputAddressFormatter', function () { + model.parameters = ['sign', '0x0']; + + formattersMock + .expects('inputSignFormatter') + .withArgs('sign') + .returns('signed') + .once(); + + formattersMock + .expects('inputAddressFormatter') + .withArgs('0x0') + .returns('0x00') + .once(); + + model.beforeExecution(); + + formattersMock.verify(); + + expect(model.parameters[0]).equal('signed'); + expect(model.parameters[1]).equal('0x00'); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('personalSign')).equal('personalSign'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js new file mode 100644 index 00000000000..ce5b0b6e913 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js @@ -0,0 +1,50 @@ +var chai = require('chai'); +var expect = chai.expect; +var sinon = require('sinon').createSandbox(); +var formatters = require('web3-core-helpers').formatters; + +var UnlockAccountMethodModel = require('../../../../src/models/methods/personal/UnlockAccountMethodModel'); + +/** + * UnlockAccountMethodModel test + */ +describe('UnlockAccountMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new UnlockAccountMethodModel({}, formatters); + }); + + afterEach(function() { + sinon.restore(); + }); + + it('rpcMethod should return personal_unlockAccount', function () { + expect(model.rpcMethod).to.equal('personal_unlockAccount'); + }); + + it('parametersAmount should return 3', function () { + expect(model.parametersAmount).to.equal(3); + }); + + it('beforeExecution should call inputSignFormatter and inputAddressFormatter', function () { + model.parameters = ['0x0']; + + formattersMock + .expects('inputAddressFormatter') + .withArgs('0x0') + .returns('0x00') + .once(); + + model.beforeExecution(); + + formattersMock.verify(); + + expect(model.parameters[0]).equal('0x00'); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('unlockAccount')).equal('unlockAccount'); + }); +}); From c54108738696e443421a1600b63a03a846babf62 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 11 Oct 2018 13:35:27 +0200 Subject: [PATCH 0232/1045] Generic test created for all shh method models --- .../methods/shh/GenericShhMethodModelsTest.js | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js diff --git a/packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js b/packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js new file mode 100644 index 00000000000..2abc96e7f0d --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js @@ -0,0 +1,122 @@ +var chai = require('chai'); +var expect = chai.expect; + +var tests = [ + { + model: 'AddPrivateKeyMethodModel', + rpcMethod: 'shh_addPrivateKey', + parametersAmount: 1 + }, + { + model: 'AddSymKeyMethodModel', + rpcMethod: 'shh_addSymKey', + parametersAmount: 1 + }, + { + model: 'DeleteKeyPairMethodModel', + rpcMethod: 'shh_deleteKeyPair', + parametersAmount: 1 + }, + { + model: 'DeleteMessageFilterMethodModel', + rpcMethod: 'shh_deleteMessageFilter', + parametersAmount: 1 + }, + { + model: 'DeleteSymKeyMethodModel', + rpcMethod: 'shh_deleteSymKey', + parametersAmount: 1 + }, + { + model: 'GenerateSymKeyFromPasswordMethodModel', + rpcMethod: 'shh_generateSymKeyFromPassword', + parametersAmount: 1 + }, + { + model: 'GetFilterMessagesMethodModel', + rpcMethod: 'shh_getFilterMessages', + parametersAmount: 1 + }, + { + model: 'GetInfoMethodModel', + rpcMethod: 'shh_info', + parametersAmount: 0 + }, + { + model: 'GetPrivateKeyMethodModel', + rpcMethod: 'shh_getPrivateKey', + parametersAmount: 1 + }, + { + model: 'GetPublicKeyMethodModel', + rpcMethod: 'shh_getPublicKey', + parametersAmount: 1 + }, + { + model: 'GetSymKeyMethodModel', + rpcMethod: 'shh_getSymKey', + parametersAmount: 1 + }, + { + model: 'HasKeyPairMethodModel', + rpcMethod: 'shh_hasKeyPair', + parametersAmount: 1 + }, + { + model: 'HasSymKeyMethodModel', + rpcMethod: 'shh_hasSymKey', + parametersAmount: 1 + }, + { + model: 'MarkTrustedPeerMethodModel', + rpcMethod: 'shh_markTrustedPeer', + parametersAmount: 1 + }, + { + model: 'NewKeyPairMethodModel', + rpcMethod: 'shh_newKeyPair', + parametersAmount: 1 + }, + { + model: 'NewMessageFilterMethodModel', + rpcMethod: 'shh_newMessageFilter', + parametersAmount: 1 + }, + { + model: 'NewSymKeyMethodModel', + rpcMethod: 'shh_newSymKey', + parametersAmount: 0 + }, + { + model: 'PostMethodModel', + rpcMethod: 'shh_post', + parametersAmount: 1 + }, + { + model: 'SetMaxMessageSizeMethodModel', + rpcMethod: 'shh_setMaxMessageSize', + parametersAmount: 1 + }, + { + model: 'SetMinPoWMethodModel', + rpcMethod: 'shh_setMinPoW', + parametersAmount: 1 + }, + { + model: 'ShhVersionMethodModel', + rpcMethod: 'shh_version', + parametersAmount: 0 + } +]; + +describe('GenericShhMethodModelsTest', function () { + it('all models should have the correct properties set', function () { + var model, testModel; + tests.forEach(function(test) { + testModel = require('../../../../src/models/methods/shh/' + test.model); + model = new testModel({}, {}); + expect(model.rpcMethod).equal(test.rpcMethod); + expect(model.parametersAmount).equal(test.parametersAmount); + }); + }) +}); From a2632c5af4134ff550a25995f5d6c53dddba69fb Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 11 Oct 2018 14:05:07 +0200 Subject: [PATCH 0233/1045] transaction method model tests created --- .../GetTransactionFromBlockMethodModel.js | 8 +- .../transaction/GetTransactionMethodModel.js | 6 +- .../GetTransactionReceiptMethodModel.js | 6 +- .../transaction/SendTransactionMethodModel.js | 6 +- .../transaction/SignTransactionMethodModel.js | 6 +- .../GetTransactionFromBlockMethodModelTest.js | 102 ++++++++++++++++++ .../GetTransactionMethodModelTest.js | 51 +++++++++ .../GetTransactionReceiptMethodModelTest.js | 51 +++++++++ .../SendSignedTransactionMethodModelTest.js | 36 +++++++ .../SendTransactionMethodModelTest.js | 52 +++++++++ .../SignTransactionMethodModelTest.js | 48 +++++++++ 11 files changed, 356 insertions(+), 16 deletions(-) create mode 100644 packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js create mode 100644 packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index 316667001b9..abca5433998 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -34,6 +34,9 @@ function GetTransactionFromBlockMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getTransactionByBlockNumberAndIndex', 2, utils, formatters); } +GetTransactionFromBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetTransactionFromBlockMethodModel.prototype.constructor = GetTransactionFromBlockMethodModel; + /** * This method will be executed before the RPC request. * @@ -42,7 +45,7 @@ function GetTransactionFromBlockMethodModel(utils, formatters) { * @param {Object} web3Package - The package where the method is called from for example Eth. */ GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (web3Package) { - if (this.isHash(parameters[0])) { + if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } @@ -63,7 +66,4 @@ GetTransactionFromBlockMethodModel.prototype.afterExecution = function (response return this.formatters.outputTransactionFormatter(response); }; -GetTransactionFromBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetTransactionFromBlockMethodModel.prototype.constructor = GetTransactionFromBlockMethodModel; - module.exports = GetTransactionFromBlockMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js index 160775a586a..1add948f94a 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js @@ -34,6 +34,9 @@ function GetTransactionMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getTransactionByHash', 1, utils, formatters); } +GetTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetTransactionMethodModel.prototype.constructor = GetTransactionMethodModel; + /** * This method will be executed after the RPC request. * @@ -47,7 +50,4 @@ GetTransactionMethodModel.prototype.afterExecution = function (response) { return this.formatters.outputTransactionFormatter(response); }; -GetTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetTransactionMethodModel.prototype.constructor = GetTransactionMethodModel; - module.exports = GetTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js index 37dea0dca75..5c7b6e525a1 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js @@ -34,6 +34,9 @@ function GetTransactionReceiptMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_getTransactionReceipt', 1, utils, formatters); } +GetTransactionReceiptMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +GetTransactionReceiptMethodModel.prototype.constructor = GetTransactionReceiptMethodModel; + /** * This method will be executed after the RPC request. * @@ -47,7 +50,4 @@ GetTransactionReceiptMethodModel.prototype.afterExecution = function (response) return this.formatters.outputTransactionFormatter(response); }; -GetTransactionReceiptMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetTransactionReceiptMethodModel.prototype.constructor = GetTransactionReceiptMethodModel; - module.exports = GetTransactionReceiptMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index 81cde1dd899..cad7576af36 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -36,6 +36,9 @@ function SendTransactionMethodModel(utils, formatters, accounts) { this.accounts = accounts; } +SendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SendTransactionMethodModel.prototype.constructor = SendTransactionMethodModel; + /** * This method will be executed before the RPC request. * @@ -47,7 +50,4 @@ SendTransactionMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); }; -SendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SendTransactionMethodModel.prototype.constructor = SendTransactionMethodModel; - module.exports = SendTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index eafb9cb4cf0..baec6a43afa 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -34,6 +34,9 @@ function SignTransactionMethodModel(utils, formatters) { AbstractMethodModel.call(this, 'eth_signTransaction', 1, utils, formatters); } +SignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); +SignTransactionMethodModel.prototype.constructor = SignTransactionMethodModel; + /** * This method will be executed before the RPC request. * @@ -45,7 +48,4 @@ SignTransactionMethodModel.prototype.beforeExecution = function (web3Package) { this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); }; -SignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SignTransactionMethodModel.prototype.constructor = SignTransactionMethodModel; - module.exports = SignTransactionMethodModel; diff --git a/packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js new file mode 100644 index 00000000000..0d880abdf5c --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js @@ -0,0 +1,102 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; +var utils = require('web3-utils'); + +var GetTransactionFromBlockMethodModel = require('../../../../src/models/methods/transaction/GetTransactionFromBlockMethodModel'); + +/** + * GetStorageAtMethodModel test + */ +describe('GetStorageAtMethodModelTest', function () { + var model, formattersMock, utilsMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + utilsMock = sinon.mock(utils); + model = new GetTransactionFromBlockMethodModel(utils, formatters); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_getTransactionByBlockNumberAndIndex', function () { + expect(model.rpcMethod).to.equal('eth_getTransactionByBlockNumberAndIndex'); + }); + + it('parametersAmount should return 2', function () { + expect(model.parametersAmount).to.equal(2); + }); + + it('should call beforeExecution with block hash as parameter ' + + 'and should call formatters.inputBlockNumberFormatter and utils.numberToHex', + function () { + model.parameters = ['0x0', 100]; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + utilsMock + .expects('numberToHex') + .withArgs(model.parameters[1]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); + + formattersMock.verify(); + utilsMock.verify(); + + expect(model.rpcMethod).equal('eth_getTransactionByBlockHashAndIndex'); + } + ); + + it('should call beforeExecution with block number as parameter ' + + 'and should call formatters.inputBlockNumberFormatter and utils.numberToHex', + function () { + model.parameters = [100, 100]; + + formattersMock + .expects('inputBlockNumberFormatter') + .withArgs(model.parameters[0]) + .returns('0x0') + .once(); + + utilsMock + .expects('numberToHex') + .withArgs(model.parameters[1]) + .returns('0x0') + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).equal('0x0'); + expect(model.parameters[1]).equal('0x0'); + + formattersMock.verify(); + utilsMock.verify(); + + expect(model.rpcMethod).equal('eth_getTransactionByBlockNumberAndIndex'); + } + ); + + it('afterExecution should map the response', function () { + formattersMock + .expects('outputTransactionFormatter') + .withArgs({}) + .returns({empty: false}) + .once(); + + expect(model.afterExecution({})).to.have.property('empty', false); + + formattersMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js new file mode 100644 index 00000000000..ea73b5fa8e3 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js @@ -0,0 +1,51 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var GetTransactionMethodModel = require('../../../../src/models/methods/transaction/GetTransactionMethodModel'); + +/** + * GetTransactionMethodModel test + */ +describe('GetTransactionMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new GetTransactionMethodModel({}, formatters); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_getTransactionByHash', function () { + expect(model.rpcMethod).to.equal('eth_getTransactionByHash'); + }); + + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should map the response', function () { + formattersMock + .expects('outputTransactionFormatter') + .withArgs({}) + .returns({empty: false}) + .once(); + + expect(model.afterExecution({})).to.have.property('empty', false); + + formattersMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js new file mode 100644 index 00000000000..1b56f30d100 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js @@ -0,0 +1,51 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var GetTransactionReceiptMethodModel = require('../../../../src/models/methods/transaction/GetTransactionReceiptMethodModel'); + +/** + * GetTransactionReceiptMethodModel test + */ +describe('GetTransactionReceiptMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new GetTransactionReceiptMethodModel({}, formatters); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_getTransactionReceipt', function () { + expect(model.rpcMethod).to.equal('eth_getTransactionReceipt'); + }); + + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should map the response', function () { + formattersMock + .expects('outputTransactionFormatter') + .withArgs({}) + .returns({empty: false}) + .once(); + + expect(model.afterExecution({})).to.have.property('empty', false); + + formattersMock.verify(); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js new file mode 100644 index 00000000000..54ea3bbf640 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js @@ -0,0 +1,36 @@ +var chai = require('chai'); +var expect = chai.expect; + +var SendSignedTransactionMethodModel = require('../../../../src/models/methods/transaction/SendSignedTransactionMethodModel'); + +/** + * SendSignedTransactionMethodModel test + */ +describe('SendSignedTransactionMethodModelTest', function () { + var model; + + beforeEach(function () { + model = new SendSignedTransactionMethodModel({}, {}); + }); + + it('rpcMethod should return eth_sendRawTransaction', function () { + expect(model.rpcMethod).to.equal('eth_sendRawTransaction'); + }); + + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = []; + + model.beforeExecution(); + + expect(model.parameters[0]).equal(undefined); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('sendSignedTransaction')).equal('sendSignedTransaction'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js new file mode 100644 index 00000000000..b2fc85c96bc --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js @@ -0,0 +1,52 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var SendTransactionMethodModel = require('../../../../src/models/methods/transaction/SendTransactionMethodModel'); + +/** + * SendTransactionMethodModel test + */ +describe('SendTransactionMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new SendTransactionMethodModel({}, formatters, {accounts: true}); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('accounts is set', function () { + expect(model.accounts).to.be.property('accounts', true); + }); + + it('rpcMethod should return eth_sendTransaction', function () { + expect(model.rpcMethod).to.equal('eth_sendTransaction'); + }); + + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = [{}]; + + formattersMock + .expects('inputTransactionFormatter') + .withArgs({}, {}) + .returns({empty: false}) + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).to.be.property('empty', false); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('sendTransaction')).equal('sendTransaction'); + }); +}); diff --git a/packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js new file mode 100644 index 00000000000..1f5d1a66431 --- /dev/null +++ b/packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js @@ -0,0 +1,48 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; +var formatters = require('web3-core-helpers').formatters; + +var SignTransactionMethodModel = require('../../../../src/models/methods/transaction/SignTransactionMethodModel'); + +/** + * SendTransactionMethodModel test + */ +describe('SendTransactionMethodModelTest', function () { + var model, formattersMock; + + beforeEach(function () { + formattersMock = sinon.mock(formatters); + model = new SignTransactionMethodModel({}, formatters); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('rpcMethod should return eth_signTransaction', function () { + expect(model.rpcMethod).to.equal('eth_signTransaction'); + }); + + it('parametersAmount should return 1', function () { + expect(model.parametersAmount).to.equal(1); + }); + + it('beforeExecution should do nothing with the parameters', function () { + model.parameters = [{}]; + + formattersMock + .expects('inputTransactionFormatter') + .withArgs({}, {}) + .returns({empty: false}) + .once(); + + model.beforeExecution({}); + + expect(model.parameters[0]).to.be.property('empty', false); + }); + + it('afterExecution should just return the response', function () { + expect(model.afterExecution('sendTransaction')).equal('sendTransaction'); + }); +}); From 4fcb782a4f69c413539092cedcf7ad18a3a11e1b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 11 Oct 2018 14:37:43 +0200 Subject: [PATCH 0234/1045] MethodControllerTest created --- packages/web3-core-method/package-lock.json | 19 ++ packages/web3-core-method/package.json | 2 +- .../src/controllers/MethodController.js | 2 + .../tests/controllers/MethodControllerTest.js | 183 ++++++++++++++++++ 4 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 packages/web3-core-method/tests/controllers/MethodControllerTest.js diff --git a/packages/web3-core-method/package-lock.json b/packages/web3-core-method/package-lock.json index 7caea375f96..ab1aa1b5da2 100644 --- a/packages/web3-core-method/package-lock.json +++ b/packages/web3-core-method/package-lock.json @@ -59,6 +59,11 @@ "json-schema-traverse": "^0.3.0" } }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -417,6 +422,11 @@ "number-to-bn": "1.7.0" } }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, "express": { "version": "4.16.3", "resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz", @@ -1449,6 +1459,15 @@ "web3-utils": "1.0.0-beta.36" } }, + "web3-core-promievent": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.36.tgz", + "integrity": "sha512-RGIL6TjcOeJTullFLMurChPTsg94cPF6LI763y/sPYtXTDol1vVa+J5aGLp/4WW8v+s+1bSQO6zYq2ZtkbmtEQ==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "1.1.1" + } + }, "web3-eth-iban": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 0efad645808..f7cd27b6140 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -12,7 +12,7 @@ "dependencies": { "underscore": "^1.8.3", "web3-core-helpers": "^1.0.0-beta.36", - "web3-core-promievent": "1.0.0-beta.36", + "web3-core-promievent": "^1.0.0-beta.36", "web3-core-providers": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36" }, diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 43b302b06a4..a24818cb8d3 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -103,3 +103,5 @@ MethodController.prototype.execute = function (methodModel, accounts, web3Packag MethodController.prototype.hasWallets = function (accounts) { return (accounts && accounts.wallet.length > 0); }; + +module.exports = MethodController; diff --git a/packages/web3-core-method/tests/controllers/MethodControllerTest.js b/packages/web3-core-method/tests/controllers/MethodControllerTest.js new file mode 100644 index 00000000000..bf01538a4c7 --- /dev/null +++ b/packages/web3-core-method/tests/controllers/MethodControllerTest.js @@ -0,0 +1,183 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var CallMethodCommand = require('../../src/commands/CallMethodCommand'); +var SendMethodCommand = require('../../src/commands/SendMethodCommand'); +var SignAndSendMethodCommand = require('../../src/commands/SignAndSendMethodCommand'); +var SignMessageCommand = require('../../src/commands/SignMessageCommand'); +var PromiEventPackage = require('web3-core-promievent'); +var MethodController = require('../../src/controllers/MethodController'); + +/** + * SendTransactionMethodModel test + */ +describe('SendTransactionMethodModelTest', function () { + var methodController, + methodModel, + methodModelMock, + callMethodCommandMock, + sendMethodCommandMock, + signAndSendMethodCommandMock, + signMessageCommandMock, + promiEventPackageMock; + + beforeEach(function () { + callMethodCommandMock = sinon.mock(CallMethodCommand); + sendMethodCommandMock = sinon.mock(SendMethodCommand); + signAndSendMethodCommandMock = sinon.mock(SignAndSendMethodCommand); + signMessageCommandMock = sinon.mock(new SignMessageCommand({})); + promiEventPackageMock = sinon.mock(PromiEventPackage); + methodModelMock = sinon.mock(new AbstractMethodModel('', 0, {}, {})); + + methodModel = new AbstractMethodModel('', 0, {}, {}); + methodController = new MethodController( + new CallMethodCommand(), + new SendMethodCommand({}), + new SignAndSendMethodCommand({}, {}), + new SignMessageCommand({}), + PromiEventPackage + ); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('constructor is setting all the dependencies correctly', function () { + expect(methodController.callMethodCommand).to.be.an.instanceof(CallMethodCommand); + expect(methodController.sendMethodCommand).to.be.an.instanceof(SendMethodCommand); + expect(methodController.signAndSendMethodCommand).to.be.an.instanceof(SignAndSendMethodCommand); + expect(methodController.signMessageCommand).to.be.an.instanceof(SignMessageCommand); + expect(methodController.promiEventPackage).to.be.not.equal(undefined); + }); + + it('execute calls signMessageCommand', function () { + var accounts = {wallet: [0]}; + + promiEventPackageMock + .expects('createPromiEvent') + .once(); + + methodModelMock + .expects('isSign') + .returns(true) + .once(); + + signMessageCommandMock + .expects('execute') + .withArgs(methodModel, accounts) + .returns(true) + .once(); + + expect(methodController.execute(methodModel, accounts, {})).to.be.true; + + methodModelMock.verify(); + signMessageCommandMock.verify(); + }); + + it('execute calls signAndSendmethodCommand', function () { + var accounts = {wallet: [0]}; + + promiEventPackageMock + .expects('createPromiEvent') + .returns({}) + .once(); + + methodModelMock + .expects('isSendTransaction') + .returns(true) + .once(); + + signAndSendMethodCommandMock + .expects('execute') + .withArgs(methodModel, {}, accounts, {}) + .returns(true) + .once(); + + expect(methodController.execute(methodModel, accounts, {})).to.be.true; + + methodModelMock.verify(); + signAndSendMethodCommandMock.verify(); + }); + + it('execute calls sendMethodCommand with sendTransaction rpc method', function () { + promiEventPackageMock + .expects('createPromiEvent') + .returns({}) + .once(); + + methodModelMock + .expects('isSendTransaction') + .returns(true) + .once(); + + sendMethodCommandMock + .expects('execute') + .withArgs({}, methodModel, {}) + .returns(true) + .once(); + + expect(methodController.execute(methodModel, null, {})).to.be.true; + + methodModelMock.verify(); + signAndSendMethodCommandMock.verify(); + }); + + it('execute calls sendMethodCommand with sendRawTransaction rpc method', function () { + promiEventPackageMock + .expects('createPromiEvent') + .returns({}) + .once(); + + methodModelMock + .expects('isSendTransaction') + .returns(false) + .once(); + + methodModelMock + .expects('isSendRawTransaction') + .returns(true) + .once(); + + sendMethodCommandMock + .expects('execute') + .withArgs({}, methodModel, {}) + .returns(true) + .once(); + + expect(methodController.execute(methodModel, null, {})).to.be.true; + + methodModelMock.verify(); + signAndSendMethodCommandMock.verify(); + }); + + it('execute calls callMethodCommand', function () { + promiEventPackageMock + .expects('createPromiEvent') + .returns({}) + .once(); + + methodModelMock + .expects('isSendTransaction') + .returns(false) + .once(); + + methodModelMock + .expects('isSendRawTransaction') + .returns(false) + .once(); + + callMethodCommandMock + .expects('execute') + .withArgs({}, methodModel) + .returns(true) + .once(); + + expect(methodController.execute(methodModel, null, {})).to.be.true; + + methodModelMock.verify(); + signAndSendMethodCommandMock.verify(); + }); +}); From e8d6716ddac57ad49c3c6a524ecf50db4b68a792 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 11 Oct 2018 15:37:03 +0200 Subject: [PATCH 0235/1045] MethodControllerTest fixed --- packages/web3-core-method/package-lock.json | 23 +++++-------- packages/web3-core-method/package.json | 2 +- .../src/commands/SendMethodCommand.js | 6 ++-- .../src/commands/SignAndSendMethodCommand.js | 6 ++-- packages/web3-core-method/src/index.js | 2 +- .../tests/controllers/MethodControllerTest.js | 34 ++++++++++++------- .../web3-core-promievent/package-lock.json | 15 ++++---- packages/web3-core-promievent/src/index.js | 2 +- 8 files changed, 45 insertions(+), 45 deletions(-) diff --git a/packages/web3-core-method/package-lock.json b/packages/web3-core-method/package-lock.json index ab1aa1b5da2..d120cc8459d 100644 --- a/packages/web3-core-method/package-lock.json +++ b/packages/web3-core-method/package-lock.json @@ -59,11 +59,6 @@ "json-schema-traverse": "^0.3.0" } }, - "any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" - }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -422,11 +417,6 @@ "number-to-bn": "1.7.0" } }, - "eventemitter3": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", - "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" - }, "express": { "version": "4.16.3", "resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz", @@ -1460,12 +1450,15 @@ } }, "web3-core-promievent": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.36.tgz", - "integrity": "sha512-RGIL6TjcOeJTullFLMurChPTsg94cPF6LI763y/sPYtXTDol1vVa+J5aGLp/4WW8v+s+1bSQO6zYq2ZtkbmtEQ==", + "version": "file:../web3-core-promievent", "requires": { - "any-promise": "1.3.0", - "eventemitter3": "1.1.1" + "eventemitter3": "3.1.0" + }, + "dependencies": { + "eventemitter3": { + "version": "3.1.0", + "bundled": true + } } }, "web3-eth-iban": { diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index f7cd27b6140..c947b937781 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -12,7 +12,7 @@ "dependencies": { "underscore": "^1.8.3", "web3-core-helpers": "^1.0.0-beta.36", - "web3-core-promievent": "^1.0.0-beta.36", + "web3-core-promievent": "file:../web3-core-promievent", "web3-core-providers": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36" }, diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 12fa860b533..7fb2f0e63c5 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -33,6 +33,9 @@ function SendMethodCommand(transactionConfirmationWorkflow) { AbstractSendMethodCommand.call(this, transactionConfirmationWorkflow); } +SendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); +SendMethodCommand.prototype.constructor = SendMethodCommand; + /** * Determines if gasPrice is set, sends the request and returns a PromiEvent Object * @@ -51,7 +54,4 @@ SendMethodCommand.prototype.execute = function (web3Package, methodModel, promiE return this.send(methodModel, promiEvent, web3Package); }; -SendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); -SendMethodCommand.prototype.constructor = SendMethodCommand; - module.exports = SendMethodCommand; diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index a144642a19f..9648c92bd0b 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -35,6 +35,9 @@ function SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSi this.transactionSigner = transactionSigner; } +SignAndSendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); +SignAndSendMethodCommand.prototype.constructor = SignAndSendMethodCommand; + /** * Sends the JSON-RPC request and returns an PromiEvent object * @@ -73,7 +76,4 @@ SignAndSendMethodCommand.prototype.execute = function ( return promiEvent; }; -SignAndSendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); -SignAndSendMethodCommand.prototype.constructor = SignAndSendMethodCommand; - module.exports = SignAndSendMethodCommand; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index d7975e29a60..d523f7feeb3 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -23,7 +23,7 @@ "use strict"; -var version = require('./package.json'); +var version = require('../package.json').version; var MethodPackageFactory = require('./factories/MethodPackageFactory'); var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); var PromiEventPackage = require('web3-core-promievent'); diff --git a/packages/web3-core-method/tests/controllers/MethodControllerTest.js b/packages/web3-core-method/tests/controllers/MethodControllerTest.js index bf01538a4c7..12284a247af 100644 --- a/packages/web3-core-method/tests/controllers/MethodControllerTest.js +++ b/packages/web3-core-method/tests/controllers/MethodControllerTest.js @@ -21,22 +21,31 @@ describe('SendTransactionMethodModelTest', function () { sendMethodCommandMock, signAndSendMethodCommandMock, signMessageCommandMock, - promiEventPackageMock; + promiEventPackageMock, + callMethodCommand, + sendMethodCommand, + signAndSendMethodCommand, + signMessageCommand; beforeEach(function () { - callMethodCommandMock = sinon.mock(CallMethodCommand); - sendMethodCommandMock = sinon.mock(SendMethodCommand); - signAndSendMethodCommandMock = sinon.mock(SignAndSendMethodCommand); - signMessageCommandMock = sinon.mock(new SignMessageCommand({})); + callMethodCommand = new CallMethodCommand(); + sendMethodCommand = new SendMethodCommand({}); + signAndSendMethodCommand = new SignAndSendMethodCommand({}, {}); + signMessageCommand = new SignMessageCommand({}); + methodModel = new AbstractMethodModel('', 0, {}, {}); + + callMethodCommandMock = sinon.mock(callMethodCommand); + sendMethodCommandMock = sinon.mock(sendMethodCommand); + signAndSendMethodCommandMock = sinon.mock(signAndSendMethodCommand); + signMessageCommandMock = sinon.mock(signMessageCommand); promiEventPackageMock = sinon.mock(PromiEventPackage); - methodModelMock = sinon.mock(new AbstractMethodModel('', 0, {}, {})); + methodModelMock = sinon.mock(methodModel); - methodModel = new AbstractMethodModel('', 0, {}, {}); methodController = new MethodController( - new CallMethodCommand(), - new SendMethodCommand({}), - new SignAndSendMethodCommand({}, {}), - new SignMessageCommand({}), + callMethodCommand, + sendMethodCommand, + signAndSendMethodCommand, + signMessageCommand, PromiEventPackage ); }); @@ -58,6 +67,7 @@ describe('SendTransactionMethodModelTest', function () { promiEventPackageMock .expects('createPromiEvent') + .returns({}) .once(); methodModelMock @@ -77,7 +87,7 @@ describe('SendTransactionMethodModelTest', function () { signMessageCommandMock.verify(); }); - it('execute calls signAndSendmethodCommand', function () { + it('execute calls signAndSendMethodCommand', function () { var accounts = {wallet: [0]}; promiEventPackageMock diff --git a/packages/web3-core-promievent/package-lock.json b/packages/web3-core-promievent/package-lock.json index 0a44477c27f..a391c2f750f 100644 --- a/packages/web3-core-promievent/package-lock.json +++ b/packages/web3-core-promievent/package-lock.json @@ -1,16 +1,13 @@ { - "requires": true, + "name": "web3-core-promievent", + "version": "1.0.0-beta.36", "lockfileVersion": 1, + "requires": true, "dependencies": { - "any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" - }, "eventemitter3": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", - "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" } } } diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index 5230d659a83..8951d247230 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -22,7 +22,7 @@ "use strict"; -var version = require('./package.json').version; +var version = require('../package.json').version; var PromiEvent = require('./PromiEvent'); module.exports = { From 0530ed39ae8af15b7d7dfc0bf0a376ce9e4a7209 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 11 Oct 2018 16:15:35 +0200 Subject: [PATCH 0236/1045] severall fixes and CallMethodCommandTest created --- .../tests/commands/CallMethodCommandTest.js | 77 ++ .../tests/controllers/MethodControllerTest.js | 6 +- packages/web3-core-package/package-lock.json | 13 + .../src/AbstractWeb3Object.js | 2 +- .../lib/adapters/AbstractProviderAdapter.js | 7 +- .../web3-core-providers/package-lock.json | 1104 ++++++++++++++++- packages/web3-core-providers/package.json | 3 +- .../src/adapters/SocketProviderAdapter.js | 6 +- .../src/detectors/ProviderDetector.js | 2 + .../src/factories/ProvidersPackageFactory.js | 1 + packages/web3-core-providers/src/index.js | 2 +- 11 files changed, 1204 insertions(+), 19 deletions(-) create mode 100644 packages/web3-core-method/tests/commands/CallMethodCommandTest.js create mode 100644 packages/web3-core-package/package-lock.json diff --git a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js new file mode 100644 index 00000000000..90cdbfe1375 --- /dev/null +++ b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js @@ -0,0 +1,77 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var CallMethodCommand = require('../../src/commands/CallMethodCommand'); +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var ProvidersPackage = require('web3-core-providers'); +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; + +/** + * CallMethodCommand test + */ +describe('CallMethodCommandTest', function () { + var callMethodCommand, + provider, + providerMock, + providerAdapter, + providerAdapterMock, + web3Package, + web3PackageMock, + methodModel, + methodModelCallbackSpy, + methodModelMock; + + beforeEach(function () { + provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); + providerMock = sinon.mock(provider); + + providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); + providerAdapterMock = sinon.mock(providerAdapter); + + web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); + web3PackageMock = sinon.mock(web3Package); + + methodModel = new AbstractMethodModel('', 0, {}, {}); + methodModelCallbackSpy = sinon.spy(); + methodModel.callback = methodModelCallbackSpy; + methodModelMock = sinon.mock(methodModel); + + callMethodCommand = new CallMethodCommand(); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('execute calls beforeExecution/afterExecution of the methodModel, ' + + 'the send method of the provider and calls the callback', + async function () { + methodModelMock + .expects('beforeExecution') + .withArgs(web3Package) + .once(); + + methodModelMock + .expects('afterExecution') + .withArgs('response') + .returns('0x0') + .once(); + + providerAdapterMock + .expects('send') + .returns(new Promise( + function(resolve) { + resolve('response') + } + )) + .once(); + + var returnValue = await callMethodCommand.execute(web3Package, methodModel); + expect(returnValue).to.equal('0x0'); + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith('0x0')).to.be.true; + } + ); +}); diff --git a/packages/web3-core-method/tests/controllers/MethodControllerTest.js b/packages/web3-core-method/tests/controllers/MethodControllerTest.js index 12284a247af..1f3d31907f6 100644 --- a/packages/web3-core-method/tests/controllers/MethodControllerTest.js +++ b/packages/web3-core-method/tests/controllers/MethodControllerTest.js @@ -11,9 +11,9 @@ var PromiEventPackage = require('web3-core-promievent'); var MethodController = require('../../src/controllers/MethodController'); /** - * SendTransactionMethodModel test + * MethodController test */ -describe('SendTransactionMethodModelTest', function () { +describe('MethodControllerTest', function () { var methodController, methodModel, methodModelMock, @@ -59,7 +59,7 @@ describe('SendTransactionMethodModelTest', function () { expect(methodController.sendMethodCommand).to.be.an.instanceof(SendMethodCommand); expect(methodController.signAndSendMethodCommand).to.be.an.instanceof(SignAndSendMethodCommand); expect(methodController.signMessageCommand).to.be.an.instanceof(SignMessageCommand); - expect(methodController.promiEventPackage).to.be.not.equal(undefined); + expect(methodController.promiEventPackage.createPromiEvent).to.be.an.instanceof(Function); }); it('execute calls signMessageCommand', function () { diff --git a/packages/web3-core-package/package-lock.json b/packages/web3-core-package/package-lock.json new file mode 100644 index 00000000000..d57ac7a4214 --- /dev/null +++ b/packages/web3-core-package/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "web3-core-package", + "version": "1.0.0-beta.36", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + } + } +} diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core-package/src/AbstractWeb3Object.js index 41a6fdd4cea..42e023edb86 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core-package/src/AbstractWeb3Object.js @@ -261,7 +261,7 @@ AbstractWeb3Object.prototype.proxyHandler = function (target, name) { * @returns {Boolean} */ AbstractWeb3Object.prototype.isDependencyGiven = function (object) { - return object !== null || typeof object !== 'undefined' + return object !== null && typeof object !== 'undefined' }; module.exports = AbstractWeb3Object; diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js index 67d9dd0d523..624e33ece29 100644 --- a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js @@ -25,6 +25,7 @@ var JSONRpcMapper = require('../../src/mappers/JSONRpcMapper.js'); var JSONRpcResponseValidator = require('../../src/validators/JSONRpcResponseValidator.js'); var errors = require('web3-core-helpers').errors; +var EventEmitter = require('eventemitter3'); /** * @param {Object} provider @@ -35,6 +36,9 @@ function AbstractProviderAdapter(provider) { this.provider = provider; } +AbstractProviderAdapter.prototype = Object.create(EventEmitter.prototype); +AbstractProviderAdapter.prototype.constructor = AbstractProviderAdapter; + /** * Sends the JSON-RPC request * @@ -151,7 +155,4 @@ AbstractProviderAdapter.prototype.isConnected = function () { return this.provider.connected; }; -AbstractProviderAdapter.prototype = Object.create(EventEmitter.prototype); -AbstractProviderAdapter.prototype.constructor = AbstractProviderAdapter; - module.exports = AbstractProviderAdapter; diff --git a/packages/web3-core-providers/package-lock.json b/packages/web3-core-providers/package-lock.json index 0318cf45d71..8fbc25180e9 100644 --- a/packages/web3-core-providers/package-lock.json +++ b/packages/web3-core-providers/package-lock.json @@ -1,12 +1,186 @@ { - "requires": true, + "name": "web3-core-providers", + "version": "1.0.0-beta.36", "lockfileVersion": 1, + "requires": true, "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, "cookiejar": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -15,16 +189,460 @@ "ms": "2.0.0" } }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "optional": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + } + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, "http-https": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -35,14 +653,341 @@ "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==" }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, "oboe": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", - "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.4.tgz", + "integrity": "sha1-IMiM2wwVNxuwQRklfU/dNLCqSfY=", "requires": { "http-https": "^1.0.0" } }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + }, + "dependencies": { + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + } + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, "typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -51,10 +996,102 @@ "is-typedarray": "^1.0.0" } }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } }, "websocket": { "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", @@ -66,6 +1103,54 @@ "yaeti": "^0.0.6" } }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, "xhr2-cookies": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", @@ -74,6 +1159,11 @@ "cookiejar": "^2.1.1" } }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, "yaeti": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", diff --git a/packages/web3-core-providers/package.json b/packages/web3-core-providers/package.json index 385b546a9b7..08c3b0e8338 100644 --- a/packages/web3-core-providers/package.json +++ b/packages/web3-core-providers/package.json @@ -1,5 +1,5 @@ { - "name": "web3-provider", + "name": "web3-core-providers", "namespace": "ethereum", "version": "1.0.0-beta.36", "description": "Web3 module to handle requests to external providers.", @@ -7,6 +7,7 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { + "eventemitter3": "3.1.0", "xhr2-cookies": "1.1.0", "oboe": "2.1.4", "underscore": "1.9.1", diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js index a9238374af9..e24a8a5d406 100644 --- a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js @@ -36,6 +36,9 @@ function SocketProviderAdapter(provider) { this.registerSubscriptionListener(); } +SocketProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); +SocketProviderAdapter.prototype.constructor = SocketProviderAdapter; + /** * Subscribes to a given subscriptionType * @@ -159,7 +162,4 @@ SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId, s }); }; -SocketProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); -SocketProviderAdapter.prototype.constructor = SocketProviderAdapter; - module.exports = SocketProviderAdapter; diff --git a/packages/web3-core-providers/src/detectors/ProviderDetector.js b/packages/web3-core-providers/src/detectors/ProviderDetector.js index 30631dee478..ab416d000d5 100644 --- a/packages/web3-core-providers/src/detectors/ProviderDetector.js +++ b/packages/web3-core-providers/src/detectors/ProviderDetector.js @@ -112,3 +112,5 @@ ProviderDetector.prototype.addSubscriptionsToIpcProviderWrapper = function (prov return provider; }; + +module.exports = ProviderDetector; diff --git a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js index e35b219d3f6..7fea0048d74 100644 --- a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js +++ b/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js @@ -21,6 +21,7 @@ */ var ProviderAdapterResolver = require('../resolvers/ProviderAdapterResolver'); +var ProviderDetector = require('../detectors/ProviderDetector'); var SocketProviderAdapter = require('../adapters/SocketProviderAdapter'); var InpageProviderAdapter = require('../adapters/InpageProviderAdapter'); var HttpProviderAdapter = require('../adapters/HttpProviderAdapter'); diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index 50d52120862..a1f5444a695 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -20,7 +20,7 @@ "use strict"; -var version = require('./package.json').version; +var version = require('../package.json').version; var ProvidersPackageFactory = require('./factories/ProvidersPackageFactory'); var SocketProviderAdapter = require('./adapters/SocketProviderAdapter'); var HttpProvider = require('./providers/HttpProvider'); From 40f78d62299bbf0c935f8e4e661a3822430b1319 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 13:08:13 +0200 Subject: [PATCH 0237/1045] CallMethodCommandTest and SendMethodCommandTest created --- .../lib/commands/AbstractSendMethodCommand.js | 9 +- packages/web3-core-method/package-lock.json | 306 +++++++++++++++++- packages/web3-core-method/package.json | 5 +- .../src/commands/CallMethodCommand.js | 6 +- .../tests/commands/CallMethodCommandTest.js | 48 ++- .../tests/commands/SendMethodCommandTest.js | 155 +++++++++ 6 files changed, 514 insertions(+), 15 deletions(-) create mode 100644 packages/web3-core-method/tests/commands/SendMethodCommandTest.js diff --git a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js index 10d45964341..d12c6d09aeb 100644 --- a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js +++ b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js @@ -22,6 +22,8 @@ "use strict"; +var _ = require('underscore'); + /** * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow * @@ -44,8 +46,11 @@ function AbstractSendMethodCommand(transactionConfirmationWorkflow) { * @returns {PromiEvent} */ AbstractSendMethodCommand.prototype.send = function (methodModel, promiEvent, web3Package) { + var self = this; if (this.isGasPriceDefined(methodModel.parameters)) { this.sendMethod(methodModel, promiEvent, web3Package); + + return promiEvent; } this.getGasPrice(web3Package.currentProvider).then(function(gasPrice) { @@ -69,6 +74,8 @@ AbstractSendMethodCommand.prototype.send = function (methodModel, promiEvent, we * @param {PromiEvent} promiEvent */ AbstractSendMethodCommand.prototype.sendMethod = function (methodModel, promiEvent, web3Package) { + var self = this; + web3Package.currentProvider.send( methodModel.rpcMethod, methodModel.parameters @@ -104,7 +111,7 @@ AbstractSendMethodCommand.prototype.sendMethod = function (methodModel, promiEve * * @param {Array} parameters * - * @returns {boolean} + * @returns {Boolean} */ AbstractSendMethodCommand.prototype.isGasPriceDefined = function (parameters) { return _.isObject(parameters[0]) && typeof parameters[0].gasPrice !== 'undefined'; diff --git a/packages/web3-core-method/package-lock.json b/packages/web3-core-method/package-lock.json index d120cc8459d..8fdc4fd2b2e 100644 --- a/packages/web3-core-method/package-lock.json +++ b/packages/web3-core-method/package-lock.json @@ -39,6 +39,11 @@ "integrity": "sha512-ZwTHAlC9akprWDinwEPD4kOuwaYZlyMwVJIANsKNC3QVp0AHB04m7RnB4eqeWfgmxw8MGTzS9uMaw93Z3QcZbw==", "dev": true }, + "@types/node": { + "version": "10.11.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.7.tgz", + "integrity": "sha512-yOxFfkN9xUFLyvWaeYj90mlqTJ41CsQzWKS3gXdOMOyPVacUsymejKxJ4/pMW7exouubuEeZLJawGgcNGYlTeg==" + }, "accepts": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", @@ -48,6 +53,11 @@ "negotiator": "0.6.1" } }, + "aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" + }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -265,6 +275,11 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -408,6 +423,55 @@ "xhr-request-promise": "^0.1.2" } }, + "ethers": { + "version": "4.0.0-beta.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.1.tgz", + "integrity": "sha512-SoYhktEbLxf+fiux5SfCEwdzWENMvgIbMZD90I62s4GZD9nEjgEWy8ZboI3hck193Vs0bDoTohDISx84f2H2tw==", + "requires": { + "@types/node": "^10.3.2", + "aes-js": "3.0.0", + "bn.js": "^4.4.0", + "elliptic": "6.3.3", + "hash.js": "1.1.3", + "js-sha3": "0.5.7", + "scrypt-js": "2.0.3", + "setimmediate": "1.0.4", + "uuid": "2.0.1", + "xmlhttprequest": "1.8.0" + }, + "dependencies": { + "elliptic": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", + "integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "js-sha3": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" + }, + "uuid": { + "version": "2.0.1", + "resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", + "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" + } + } + }, "ethjs-unit": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", @@ -417,6 +481,11 @@ "number-to-bn": "1.7.0" } }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, "express": { "version": "4.16.3", "resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz", @@ -727,6 +796,11 @@ "statuses": ">= 1.4.0 < 2" } }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -1022,6 +1096,14 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -1178,6 +1260,11 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "scrypt-js": { + "version": "2.0.3", + "resolved": "http://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", + "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" + }, "send": { "version": "0.16.2", "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", @@ -1236,6 +1323,11 @@ "xhr": "^2.3.3" } }, + "setimmediate": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", + "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" + }, "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", @@ -1389,15 +1481,23 @@ "mime-types": "~2.1.18" } }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" }, "unpipe": { "version": "1.0.0", @@ -1439,6 +1539,17 @@ "extsprintf": "^1.2.0" } }, + "web3-core": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.36.tgz", + "integrity": "sha512-C2QW9CMMRZdYAiKiLkMrKRSp+gekSqTDgZTNvlxAdN1hXn4d9UmcmWSJXOmIHqr5N2ISbRod+bW+qChODxVE3Q==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-requestmanager": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, "web3-core-helpers": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", @@ -1447,6 +1558,32 @@ "underscore": "1.8.3", "web3-eth-iban": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-method": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.36.tgz", + "integrity": "sha512-dJsP3KkGaqBBSdxfzvLsYPOmVaSs1lR/3oKob/gtUYG7UyTnwquwliAc7OXj+gqRA2E/FHZcM83cWdl31ltdSA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } } }, "web3-core-promievent": { @@ -1461,6 +1598,81 @@ } } }, + "web3-core-requestmanager": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.36.tgz", + "integrity": "sha512-/CHuaMbiMDu1v8ANGYI7yFCnh1GaCWx5pKnUPJf+QTk2xAAw+Bvd97yZJIWPOK5AOPUIzxgwx9Ob/5ln6mTmYA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-providers-http": "1.0.0-beta.36", + "web3-providers-ipc": "1.0.0-beta.36", + "web3-providers-ws": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-subscriptions": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", + "integrity": "sha512-/evyLQ8CMEYXC5aUCodDpmEnmGVYQxaIjiEIfA/85f9ifHkfzP1aOwCAjcsLsJWnwrWDagxSpjCYrDtnNabdEw==", + "requires": { + "eventemitter3": "1.1.1", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-abi": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.36.tgz", + "integrity": "sha512-fBfW+7hvA0rxEMV45fO7JU+0R32ayT7aRwG9Cl6NW2/QvhFeME2qVbMIWw0q5MryPZGIN8A6366hKNuWvVidDg==", + "requires": { + "ethers": "4.0.0-beta.1", + "underscore": "1.8.3", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-contract": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.36.tgz", + "integrity": "sha512-cywqcIrUsCW4fyqsHdOb24OCC8AnBol8kNiptI+IHRylyCjTNgr53bUbjrXWjmEnear90rO0QhAVjLB1a4iEbQ==", + "requires": { + "underscore": "1.8.3", + "web3-core": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-eth-abi": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, "web3-eth-iban": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", @@ -1470,6 +1682,49 @@ "web3-utils": "1.0.0-beta.36" } }, + "web3-providers-http": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.36.tgz", + "integrity": "sha512-KLSqMS59nRdpet9B0B64MKgtM3n9wAHTcAHJ03hv79avQNTjHxtjZm0ttcjcFUPpWDgTCtcYCa7tqaYo9Pbeog==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.36.tgz", + "integrity": "sha512-iEUrmdd2CzoWgp+75/ydom/1IaoLw95qkAzsgwjjZp1waDncHP/cvVGX74+fbUx4hRaPdchyzxCQfNpgLDmNjQ==", + "requires": { + "oboe": "2.1.3", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-providers-ws": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.36.tgz", + "integrity": "sha512-wAnENuZx75T5ZSrT2De2LOaUuPf2yRjq1VfcbD7+Zd79F3DZZLBJcPyCNVQ1U0fAXt0wfgCKl7sVw5pffqR9Bw==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, "web3-utils": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", @@ -1482,6 +1737,33 @@ "randomhex": "0.1.5", "underscore": "1.8.3", "utf8": "2.1.1" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } } }, "wrappy": { @@ -1532,10 +1814,28 @@ "xhr-request": "^1.0.1" } }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" } } } diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index c947b937781..32fef64fb91 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -10,11 +10,12 @@ "test": "mocha './tests/**/*.js'" }, "dependencies": { - "underscore": "^1.8.3", + "underscore": "^1.9.1", "web3-core-helpers": "^1.0.0-beta.36", "web3-core-promievent": "file:../web3-core-promievent", "web3-core-providers": "1.0.0-beta.36", - "web3-core-subscriptions": "1.0.0-beta.36" + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-eth-contract": "1.0.0-beta.36" }, "devDependencies": { "chai": "^4.2.0", diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 05a340d7c06..089a808b3e6 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -48,10 +48,14 @@ CallMethodCommand.prototype.execute = function (web3Package, methodModel) { var mappedResponse = methodModel.afterExecution(response); if (methodModel.callback) { - methodModel.callback(mappedResponse); + methodModel.callback(false, mappedResponse); } return mappedResponse; + }).catch(function(error) { + if (methodModel.callback) { + methodModel.callback(error, null); + } }); }; diff --git a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js index 90cdbfe1375..f68a53e2633 100644 --- a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js @@ -17,7 +17,6 @@ describe('CallMethodCommandTest', function () { providerAdapter, providerAdapterMock, web3Package, - web3PackageMock, methodModel, methodModelCallbackSpy, methodModelMock; @@ -30,7 +29,6 @@ describe('CallMethodCommandTest', function () { providerAdapterMock = sinon.mock(providerAdapter); web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); - web3PackageMock = sinon.mock(web3Package); methodModel = new AbstractMethodModel('', 0, {}, {}); methodModelCallbackSpy = sinon.spy(); @@ -52,26 +50,60 @@ describe('CallMethodCommandTest', function () { .withArgs(web3Package) .once(); + providerAdapterMock + .expects('send') + .returns(new Promise( + function(resolve) { + resolve('response') + } + )) + .once(); + methodModelMock .expects('afterExecution') .withArgs('response') .returns('0x0') .once(); + var returnValue = await callMethodCommand.execute(web3Package, methodModel); + expect(returnValue).to.equal('0x0'); + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith(false, '0x0')).to.be.true; + + methodModelMock.verify(); + providerAdapterMock.verify(); + } + ); + + it('execute calls beforeExecution/afterExecution of the methodModel, ' + + 'the send method of the provider and throws an error', + async function () { + methodModelMock + .expects('beforeExecution') + .withArgs(web3Package) + .once(); + providerAdapterMock .expects('send') .returns(new Promise( - function(resolve) { - resolve('response') + function(resolve, reject) { + reject('error') } )) .once(); - - var returnValue = await callMethodCommand.execute(web3Package, methodModel); - expect(returnValue).to.equal('0x0'); + + try { + await callMethodCommand.execute(web3Package, methodModel); + } catch(error) { + expect(error).to.equal('error'); + } expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith('0x0')).to.be.true; + expect(methodModelCallbackSpy.calledWith('error', null)).to.be.true; + + methodModelMock.verify(); + providerAdapterMock.verify(); } ); }); diff --git a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js new file mode 100644 index 00000000000..cd5c976ba25 --- /dev/null +++ b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js @@ -0,0 +1,155 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var SendMethodCommand = require('../../src/commands/SendMethodCommand'); +var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionConfirmationWorkflow'); +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var ProvidersPackage = require('web3-core-providers'); +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var PromiEventPackage = require('web3-core-promievent'); + +/** + * SendMethodCommand test + */ +describe('SendMethodCommandTest', function () { + var sendMethodCommand, + provider, + providerMock, + providerAdapter, + providerAdapterMock, + web3Package, + web3PackageMock, + methodModel, + methodModelCallbackSpy, + methodModelMock, + promiEvent, + promiEventEmitSpy, + promiEventRemoveListenersSpy, + transactionConfirmationWorkflow, + transactionConfirmationWorkflowMock; + + beforeEach(function () { + provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); + providerMock = sinon.mock(provider); + + providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); + providerAdapterMock = sinon.mock(providerAdapter); + + web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); + web3PackageMock = sinon.mock(web3Package); + + methodModel = new AbstractMethodModel('', 0, {}, {}); + methodModelCallbackSpy = sinon.spy(); + methodModel.callback = methodModelCallbackSpy; + methodModelMock = sinon.mock(methodModel); + + promiEvent = PromiEventPackage.createPromiEvent(); + + promiEventEmitSpy = sinon.spy(); + promiEvent.eventEmitter.emit = promiEventEmitSpy; + + promiEventRemoveListenersSpy = sinon.spy(); + promiEvent.eventEmitter.removeAllListeners = promiEventRemoveListenersSpy; + + transactionConfirmationWorkflow = new TransactionConfirmationWorkflow({},{},{},{}); + transactionConfirmationWorkflowMock = sinon.mock(transactionConfirmationWorkflow); + + sendMethodCommand = new SendMethodCommand(transactionConfirmationWorkflow); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('calls execute with gasPrice defined', async function () { + methodModel.parameters = [{gasPrice: 100}]; + methodModel.rpcMethod = 'eth_sendRawTransaction'; + + methodModelMock + .expects('beforeExecution') + .withArgs(web3Package) + .once(); + + providerAdapterMock + .expects('send') + .withArgs(methodModel.rpcMethod, methodModel.parameters) + .returns(new Promise( + function (resolve) { + resolve('response'); + } + )) + .once(); + + transactionConfirmationWorkflowMock + .expects('execute') + .withArgs(methodModel, web3Package, 'response', promiEvent) + .once(); + + + var returnedPromiEvent = await sendMethodCommand.execute(web3Package, methodModel, promiEvent); + + expect(returnedPromiEvent).equal(promiEvent); + + expect(promiEventEmitSpy.calledOnce).to.be.true; + expect(promiEventEmitSpy.calledWith('transactionHash', 'response')).to.be.true; + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith(false, 'response')).to.be.true; + + transactionConfirmationWorkflowMock.verify(); + providerAdapterMock.verify(); + methodModelMock.verify(); + }); + + it('calls execute without gasPrice defined', async function () { + methodModel.parameters = [{}]; + methodModel.rpcMethod = 'eth_sendRawTransaction'; + + methodModelMock + .expects('beforeExecution') + .withArgs(web3Package) + .once(); + + providerAdapterMock + .expects('send') + .withArgs('eth_gasPrice', []) + .returns(new Promise( + function (resolve) { + resolve(100); + } + )).once(); + + providerAdapterMock + .expects('send') + .withArgs(methodModel.rpcMethod, methodModel.parameters) + .returns(new Promise( + function (resolve) { + resolve('response'); + } + )).once(); + + transactionConfirmationWorkflowMock + .expects('execute') + .withArgs(methodModel, web3Package, 'response', promiEvent) + .once(); + + var returnedPromiEvent = await sendMethodCommand.execute(web3Package, methodModel, promiEvent); + + expect(returnedPromiEvent).equal(promiEvent); + + promiEvent.eventEmitter.then(function () { + transactionConfirmationWorkflowMock.verify(); + providerAdapterMock.verify(); + methodModelMock.verify(); + + expect(promiEventEmitSpy.calledOnce).to.be.true; + expect(promiEventEmitSpy.calledWith('transactionHash', 'response')).to.be.true; + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith(false, 'response')).to.be.true; + }); + + expect(methodModel.parameters[0].gasPrice).equal(100); + }); +}); From 5c85e23e4999334552b66437939628e425c9847b Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 13:08:29 +0200 Subject: [PATCH 0238/1045] Smaller fixes in web3-eth-contract --- packages/web3-eth-contract/package-lock.json | 394 +++++++++++------- packages/web3-eth-contract/src/index.js | 2 +- .../methods/ContractDeployMethodModel.js | 6 +- 3 files changed, 252 insertions(+), 150 deletions(-) diff --git a/packages/web3-eth-contract/package-lock.json b/packages/web3-eth-contract/package-lock.json index 513b2575e21..3d48f1029a8 100644 --- a/packages/web3-eth-contract/package-lock.json +++ b/packages/web3-eth-contract/package-lock.json @@ -1,7 +1,14 @@ { - "requires": true, + "name": "web3-eth-contract", + "version": "1.0.0-beta.36", "lockfileVersion": 1, + "requires": true, "dependencies": { + "@types/node": { + "version": "10.11.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.7.tgz", + "integrity": "sha512-yOxFfkN9xUFLyvWaeYj90mlqTJ41CsQzWKS3gXdOMOyPVacUsymejKxJ4/pMW7exouubuEeZLJawGgcNGYlTeg==" + }, "accepts": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", @@ -11,6 +18,11 @@ "negotiator": "0.6.1" } }, + "aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" + }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -22,6 +34,11 @@ "json-schema-traverse": "^0.3.0" } }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -56,15 +73,14 @@ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "optional": true, "requires": { "tweetnacl": "^0.14.3" } @@ -125,9 +141,9 @@ "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" }, "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", "requires": { "delayed-stream": "~1.0.0" } @@ -219,7 +235,6 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "optional": true, "requires": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -231,9 +246,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "elliptic": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", "requires": { "bn.js": "^4.4.0", "brorand": "^1.0.1", @@ -273,6 +288,55 @@ "xhr-request-promise": "^0.1.2" } }, + "ethers": { + "version": "4.0.0-beta.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.1.tgz", + "integrity": "sha512-SoYhktEbLxf+fiux5SfCEwdzWENMvgIbMZD90I62s4GZD9nEjgEWy8ZboI3hck193Vs0bDoTohDISx84f2H2tw==", + "requires": { + "@types/node": "^10.3.2", + "aes-js": "3.0.0", + "bn.js": "^4.4.0", + "elliptic": "6.3.3", + "hash.js": "1.1.3", + "js-sha3": "0.5.7", + "scrypt-js": "2.0.3", + "setimmediate": "1.0.4", + "uuid": "2.0.1", + "xmlhttprequest": "1.8.0" + }, + "dependencies": { + "elliptic": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", + "integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "js-sha3": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" + }, + "uuid": { + "version": "2.0.1", + "resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", + "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" + } + } + }, "ethjs-unit": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", @@ -282,14 +346,19 @@ "number-to-bn": "1.7.0" } }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, "express": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", "requires": { "accepts": "~1.3.5", "array-flatten": "1.1.1", - "body-parser": "1.18.2", + "body-parser": "1.18.3", "content-disposition": "0.5.2", "content-type": "~1.0.4", "cookie": "0.3.1", @@ -306,10 +375,10 @@ "on-finished": "~2.3.0", "parseurl": "~1.3.2", "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", + "safe-buffer": "5.1.2", "send": "0.16.2", "serve-static": "1.13.2", "setprototypeof": "1.1.0", @@ -319,67 +388,6 @@ "vary": "~1.1.2" }, "dependencies": { - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - } - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" - } - } - }, "statuses": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", @@ -409,7 +417,7 @@ }, "finalhandler": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", "requires": { "debug": "2.6.9", @@ -449,6 +457,16 @@ "asynckit": "^0.4.0", "combined-stream": "1.0.6", "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + } } }, "forwarded": { @@ -484,11 +502,11 @@ "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" }, "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", "requires": { - "ajv": "^5.1.0", + "ajv": "^5.3.0", "har-schema": "^2.0.0" } }, @@ -513,7 +531,7 @@ }, "http-errors": { "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "requires": { "depd": "~1.1.2", @@ -583,8 +601,7 @@ "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, "json-schema": { "version": "0.2.3", @@ -642,16 +659,16 @@ "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" }, "mime-db": { - "version": "1.35.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" }, "mime-types": { - "version": "2.1.19", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", - "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", "requires": { - "mime-db": "~1.35.0" + "mime-db": "~1.36.0" } }, "mimic-response": { @@ -684,7 +701,7 @@ }, "nan": { "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" }, "nano-json-stream-parser": { @@ -707,9 +724,9 @@ } }, "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, "object-assign": { "version": "4.1.1", @@ -770,6 +787,11 @@ "ipaddr.js": "1.8.0" } }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -782,7 +804,7 @@ }, "query-string": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", "requires": { "decode-uri-component": "^0.2.0", @@ -812,42 +834,47 @@ } }, "request": { - "version": "2.87.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", - "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "requires": { "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", + "aws4": "^1.8.0", "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "tough-cookie": "~2.3.3", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" + "uuid": "^3.3.2" } }, "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "scrypt-js": { + "version": "2.0.3", + "resolved": "http://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", + "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" + }, "send": { "version": "0.16.2", "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", @@ -898,6 +925,11 @@ "xhr": "^2.3.3" } }, + "setimmediate": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", + "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" + }, "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", @@ -927,9 +959,9 @@ } }, "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", - "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -966,10 +998,11 @@ "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" }, "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "requires": { + "psl": "^1.1.24", "punycode": "^1.4.1" } }, @@ -989,8 +1022,7 @@ "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, "type-is": { "version": "1.6.16", @@ -1007,9 +1039,9 @@ "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" }, "unpipe": { "version": "1.0.0", @@ -1052,39 +1084,97 @@ } }, "web3-core-helpers": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.35.tgz", - "integrity": "sha512-APOu3sEsamyqWt//8o4yq9KF25/uqGm+pQShson/sC4gKzmfJB07fLo2ond0X30E8fIqAPeVCotPXQxGciGUmA==", + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", "requires": { "underscore": "1.8.3", - "web3-eth-iban": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-method": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.36.tgz", + "integrity": "sha512-dJsP3KkGaqBBSdxfzvLsYPOmVaSs1lR/3oKob/gtUYG7UyTnwquwliAc7OXj+gqRA2E/FHZcM83cWdl31ltdSA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-promievent": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.36.tgz", + "integrity": "sha512-RGIL6TjcOeJTullFLMurChPTsg94cPF6LI763y/sPYtXTDol1vVa+J5aGLp/4WW8v+s+1bSQO6zYq2ZtkbmtEQ==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "1.1.1" + } + }, + "web3-core-subscriptions": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", + "integrity": "sha512-/evyLQ8CMEYXC5aUCodDpmEnmGVYQxaIjiEIfA/85f9ifHkfzP1aOwCAjcsLsJWnwrWDagxSpjCYrDtnNabdEw==", + "requires": { + "eventemitter3": "1.1.1", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } } }, "web3-eth-abi": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.35.tgz", - "integrity": "sha512-KUDC+EtFFYG8z01ZleKrASdjj327/rtWHzEt6RWsEj7bBa0bGp9nEh+nqdZx/Sdgz1O8tnfFzJlrRcXpfr1vGg==", + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.36.tgz", + "integrity": "sha512-fBfW+7hvA0rxEMV45fO7JU+0R32ayT7aRwG9Cl6NW2/QvhFeME2qVbMIWw0q5MryPZGIN8A6366hKNuWvVidDg==", "requires": { - "bn.js": "4.11.6", + "ethers": "4.0.0-beta.1", "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } } }, "web3-eth-iban": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.35.tgz", - "integrity": "sha512-H5wkcNcAIc+h/WoDIKv7ZYmrM2Xqu3O7jBQl1IWo73EDVQji+AoB2i3J8tuwI1yZRInRwrfpI3Zuwuf54hXHmQ==", + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", "requires": { "bn.js": "4.11.6", - "web3-utils": "1.0.0-beta.35" + "web3-utils": "1.0.0-beta.36" } }, "web3-utils": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.35.tgz", - "integrity": "sha512-Dq6f0SOKj3BDFRgOPnE6ALbzBDCKVIW8mKWVf7tGVhTDHf+wQaWwQSC3aArFSqdExB75BPBPyDpuMTNszhljpA==", + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", "requires": { "bn.js": "4.11.6", "eth-lib": "0.1.27", @@ -1093,6 +1183,13 @@ "randomhex": "0.1.5", "underscore": "1.8.3", "utf8": "2.1.1" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } } }, "wrappy": { @@ -1143,6 +1240,11 @@ "xhr-request": "^1.0.1" } }, + "xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 858ded53b48..b7571caefce 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -22,7 +22,7 @@ "use strict"; -var version = require('./package.json').version; +var version = require('../package.json').version; var PromiEventPackage = require('web3-core-promievent'); var MethodPackage = require('web3-core-method'); var ProvidersPackage = require('web3-core-providers'); diff --git a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js index 01464619e82..d4387240a98 100644 --- a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js @@ -37,6 +37,9 @@ function ContractDeployMethodModel(contract, utils, formatters, accounts) { this.contract = contract; } +ContractDeployMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); +ContractDeployMethodModel.prototype.constructor = ContractDeployMethodModel; + /** * This method will be executed after the RPC request. * @@ -53,7 +56,4 @@ ContractDeployMethodModel.prototype.afterExecution = function (response) { return clonedContract; }; -ContractDeployMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); -ContractDeployMethodModel.prototype.constructor = ContractDeployMethodModel; - module.exports = ContractDeployMethodModel; From f98fdabd3d2d37d6f4bf4a2e183e75a83e0e58b1 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 13:20:35 +0200 Subject: [PATCH 0239/1045] error case added to command tests --- .../lib/commands/AbstractSendMethodCommand.js | 2 +- .../tests/commands/CallMethodCommandTest.js | 120 +++++++++--------- .../tests/commands/SendMethodCommandTest.js | 43 +++++++ .../tests/commands/SignMessageCommandTest.js | 0 4 files changed, 101 insertions(+), 64 deletions(-) create mode 100644 packages/web3-core-method/tests/commands/SignMessageCommandTest.js diff --git a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js index d12c6d09aeb..bba5ed183fa 100644 --- a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js +++ b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js @@ -94,7 +94,7 @@ AbstractSendMethodCommand.prototype.sendMethod = function (methodModel, promiEve } }).catch(function (error) { promiEvent.reject(error); - promiEvent.on('error', error); + promiEvent.eventEmitter.emit('error', error); promiEvent.eventEmitter.removeAllListeners(); if (methodModel.callback) { diff --git a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js index f68a53e2633..e810bb3badf 100644 --- a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js @@ -42,68 +42,62 @@ describe('CallMethodCommandTest', function () { sinon.restore(); }); - it('execute calls beforeExecution/afterExecution of the methodModel, ' + - 'the send method of the provider and calls the callback', - async function () { - methodModelMock - .expects('beforeExecution') - .withArgs(web3Package) - .once(); - - providerAdapterMock - .expects('send') - .returns(new Promise( - function(resolve) { - resolve('response') - } - )) - .once(); - - methodModelMock - .expects('afterExecution') - .withArgs('response') - .returns('0x0') - .once(); - - var returnValue = await callMethodCommand.execute(web3Package, methodModel); - expect(returnValue).to.equal('0x0'); - - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith(false, '0x0')).to.be.true; - - methodModelMock.verify(); - providerAdapterMock.verify(); - } - ); - - it('execute calls beforeExecution/afterExecution of the methodModel, ' + - 'the send method of the provider and throws an error', - async function () { - methodModelMock - .expects('beforeExecution') - .withArgs(web3Package) - .once(); - - providerAdapterMock - .expects('send') - .returns(new Promise( - function(resolve, reject) { - reject('error') - } - )) - .once(); - - try { - await callMethodCommand.execute(web3Package, methodModel); - } catch(error) { - expect(error).to.equal('error'); - } - - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith('error', null)).to.be.true; - - methodModelMock.verify(); - providerAdapterMock.verify(); + it('calls execute', async function () { + methodModelMock + .expects('beforeExecution') + .withArgs(web3Package) + .once(); + + providerAdapterMock + .expects('send') + .returns(new Promise( + function (resolve) { + resolve('response') + } + )) + .once(); + + methodModelMock + .expects('afterExecution') + .withArgs('response') + .returns('0x0') + .once(); + + var returnValue = await callMethodCommand.execute(web3Package, methodModel); + expect(returnValue).to.equal('0x0'); + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith(false, '0x0')).to.be.true; + + methodModelMock.verify(); + providerAdapterMock.verify(); + }); + + it('calls execute and throws error', async function () { + methodModelMock + .expects('beforeExecution') + .withArgs(web3Package) + .once(); + + providerAdapterMock + .expects('send') + .returns(new Promise( + function (resolve, reject) { + reject('error') + } + )) + .once(); + + try { + await callMethodCommand.execute(web3Package, methodModel); + } catch (error) { + expect(error).to.equal('error'); } - ); + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith('error', null)).to.be.true; + + methodModelMock.verify(); + providerAdapterMock.verify(); + }); }); diff --git a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js index cd5c976ba25..61f2f5ce3a3 100644 --- a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js @@ -24,6 +24,7 @@ describe('SendMethodCommandTest', function () { methodModelCallbackSpy, methodModelMock, promiEvent, + promiEventMock, promiEventEmitSpy, promiEventRemoveListenersSpy, transactionConfirmationWorkflow, @@ -45,6 +46,7 @@ describe('SendMethodCommandTest', function () { methodModelMock = sinon.mock(methodModel); promiEvent = PromiEventPackage.createPromiEvent(); + promiEventMock = sinon.mock(promiEvent); promiEventEmitSpy = sinon.spy(); promiEvent.eventEmitter.emit = promiEventEmitSpy; @@ -152,4 +154,45 @@ describe('SendMethodCommandTest', function () { expect(methodModel.parameters[0].gasPrice).equal(100); }); + + it('calls execute and throws error', async function () { + methodModel.parameters = [{gasPrice: 100}]; + methodModel.rpcMethod = 'eth_sendRawTransaction'; + + methodModelMock + .expects('beforeExecution') + .withArgs(web3Package) + .once(); + + providerAdapterMock + .expects('send') + .withArgs(methodModel.rpcMethod, methodModel.parameters) + .returns(new Promise( + function (resolve, reject) { + reject('error'); + } + )) + .once(); + + promiEventMock + .expects('reject') + .withArgs('error') + .once(); + + var returnedPromiEvent = await sendMethodCommand.execute(web3Package, methodModel, promiEvent); + + expect(returnedPromiEvent).equal(promiEvent); + + promiEvent.eventEmitter.then(function () { + expect(promiEventRemoveListenersSpy.calledOnce).to.be.true; + expect(promiEventEmitSpy.calledOnce).to.be.true; + expect(promiEventEmitSpy.calledWith('error', 'error')).to.be.true; + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith('error', null)).to.be.true; + + providerAdapterMock.verify(); + methodModelMock.verify(); + }); + }); }); diff --git a/packages/web3-core-method/tests/commands/SignMessageCommandTest.js b/packages/web3-core-method/tests/commands/SignMessageCommandTest.js new file mode 100644 index 00000000000..e69de29bb2d From 81fd600284693e20aa7546871f95ee6c919a956c Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 13:50:56 +0200 Subject: [PATCH 0240/1045] SignMessageCommandTest created --- .../src/commands/SignMessageCommand.js | 11 ++- .../src/controllers/MethodController.js | 1 + .../src/signers/MessageSigner.js | 6 +- .../tests/commands/SignMessageCommandTest.js | 94 +++++++++++++++++++ .../tests/controllers/MethodControllerTest.js | 2 +- 5 files changed, 107 insertions(+), 7 deletions(-) diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js index c072e057cea..36f9254f07e 100644 --- a/packages/web3-core-method/src/commands/SignMessageCommand.js +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -34,17 +34,22 @@ function SignMessageCommand(messageSigner) { /** * Executes the SignMessageCommand and returns the signed message * + * @param {AbstractWeb3Object} web3Package * @param {AbstractMethodModel} methodModel * @param {Accounts} accounts * * @callback callback callback(error, result) * @returns {String} */ -SignMessageCommand.prototype.execute = function (methodModel, accounts) { +SignMessageCommand.prototype.execute = function (web3Package, methodModel, accounts) { var signedMessage; + methodModel.beforeExecution(web3Package); + try { - signedMessage = this.messageSigner.sign(methodModel.parameters[0], methodModel.parameters[1], accounts); + signedMessage = methodModel.afterExecution( + this.messageSigner.sign(methodModel.parameters[0], methodModel.parameters[1], accounts) + ); } catch(error) { methodModel.callback(error, null); @@ -52,7 +57,7 @@ SignMessageCommand.prototype.execute = function (methodModel, accounts) { } if (methodModel.callback) { - methodModel.callback(null, signedMessage); + methodModel.callback(false, signedMessage); } return signedMessage; diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index a24818cb8d3..b7bbe4261b6 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -62,6 +62,7 @@ MethodController.prototype.execute = function (methodModel, accounts, web3Packag if (this.hasWallets(accounts)) { if (methodModel.isSign()) { return this.signMessageCommand.execute( + web3Package, methodModel, accounts, ); diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index c75562891cf..3530fb6a162 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -29,6 +29,9 @@ var AbstractSigner = require('../../lib/signers/AbstractSigner'); */ function MessageSigner() { } +MessageSigner.prototype = Object.create(AbstractSigner.prototype); +MessageSigner.prototype.constructor = MessageSigner; + /** * Signs a given message * @@ -49,7 +52,4 @@ MessageSigner.prototype.sign = function(data, address, accounts) { throw new Error('Wallet or privateKey in wallet is not set!'); }; -MessageSigner.prototype = Object.create(AbstractSigner.prototype); -MessageSigner.prototype.constructor = MessageSigner; - module.exports = MessageSigner; diff --git a/packages/web3-core-method/tests/commands/SignMessageCommandTest.js b/packages/web3-core-method/tests/commands/SignMessageCommandTest.js index e69de29bb2d..92cc112d254 100644 --- a/packages/web3-core-method/tests/commands/SignMessageCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignMessageCommandTest.js @@ -0,0 +1,94 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var MessageSigner = require('../../src/signers/MessageSigner'); +var SignMessageCommand = require('../../src/commands/SignMessageCommand'); +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); + +/** + * SignMessageCommand test + */ +describe('SignMessageCommandTest', function () { + var signMessageCommand, + methodModel, + methodModelCallbackSpy, + methodModelMock, + messageSigner, + messageSignerMock; + + beforeEach(function () { + methodModel = new AbstractMethodModel('', 0, {}, {}); + methodModelCallbackSpy = sinon.spy(); + methodModel.callback = methodModelCallbackSpy; + methodModelMock = sinon.mock(methodModel); + + messageSigner = new MessageSigner(); + messageSignerMock = sinon.mock(messageSigner); + + signMessageCommand = new SignMessageCommand(messageSigner); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('calls execute and returns signed message', function () { + methodModel.parameters = ['string', '0x0']; + + methodModelMock + .expects('beforeExecution') + .withArgs({}) + .once(); + + messageSignerMock + .expects('sign') + .withArgs(methodModel.parameters[0], methodModel.parameters[1], {}) + .returns('0x00') + .once(); + + methodModelMock + .expects('afterExecution') + .withArgs('0x00') + .returns('0x0') + .once(); + + var returnValue = signMessageCommand.execute({}, methodModel, {}); + expect(returnValue).to.equal('0x0'); + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith(false, '0x0')).to.be.true; + + methodModelMock.verify(); + messageSignerMock.verify(); + }); + + it('calls execute and throws error', function () { + methodModel.parameters = ['string', '0x0']; + var error = new Error('PANIC'); + + methodModelMock + .expects('beforeExecution') + .withArgs({}) + .once(); + + messageSignerMock + .expects('sign') + .withArgs(methodModel.parameters[0], methodModel.parameters[1], {}) + .throws(error) + .once(); + + try { + signMessageCommand.execute({}, methodModel, {}); + } catch(error) { + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith(error, null)).to.be.true; + expect(error).to.be.instanceof(Error); + expect(error.message).equal('PANIC'); + + methodModelMock.verify(); + messageSignerMock.verify(); + } + + }); +}); diff --git a/packages/web3-core-method/tests/controllers/MethodControllerTest.js b/packages/web3-core-method/tests/controllers/MethodControllerTest.js index 1f3d31907f6..7614d963426 100644 --- a/packages/web3-core-method/tests/controllers/MethodControllerTest.js +++ b/packages/web3-core-method/tests/controllers/MethodControllerTest.js @@ -77,7 +77,7 @@ describe('MethodControllerTest', function () { signMessageCommandMock .expects('execute') - .withArgs(methodModel, accounts) + .withArgs({}, methodModel, accounts) .returns(true) .once(); From 1e2370cc917d88671a41f132adde48db9fc1b0bf Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 14:25:43 +0200 Subject: [PATCH 0241/1045] SendMethodCommandTest extended and SignAndSendMethodCommandTest created --- .../src/signers/TransactionSigner.js | 6 +- .../tests/commands/SendMethodCommandTest.js | 14 +- .../commands/SignAndSendMethodCommandTest.js | 171 ++++++++++++++++++ 3 files changed, 182 insertions(+), 9 deletions(-) create mode 100644 packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index 1ae4b123f58..2f30102faf2 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -26,6 +26,9 @@ var AbstractSigner = require('../../lib/signers/AbstractSigner'); function TransactionSigner() { } +TransactionSigner.prototype = Object.create(AbstractSigner.prototype); +TransactionSigner.prototype.constructor = TransactionSigner; + /** * Signs the given transaction * @@ -54,7 +57,4 @@ TransactionSigner.prototype.sign = function (transaction, accounts) { }); }; -TransactionSigner.prototype = Object.create(AbstractSigner.prototype); -TransactionSigner.prototype.constructor = TransactionSigner; - module.exports = TransactionSigner; diff --git a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js index 61f2f5ce3a3..856ab3bfe4b 100644 --- a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js @@ -104,7 +104,7 @@ describe('SendMethodCommandTest', function () { methodModelMock.verify(); }); - it('calls execute without gasPrice defined', async function () { + it('calls execute without gasPrice defined', function () { methodModel.parameters = [{}]; methodModel.rpcMethod = 'eth_sendRawTransaction'; @@ -136,7 +136,7 @@ describe('SendMethodCommandTest', function () { .withArgs(methodModel, web3Package, 'response', promiEvent) .once(); - var returnedPromiEvent = await sendMethodCommand.execute(web3Package, methodModel, promiEvent); + var returnedPromiEvent = sendMethodCommand.execute(web3Package, methodModel, promiEvent); expect(returnedPromiEvent).equal(promiEvent); @@ -150,12 +150,12 @@ describe('SendMethodCommandTest', function () { expect(methodModelCallbackSpy.calledOnce).to.be.true; expect(methodModelCallbackSpy.calledWith(false, 'response')).to.be.true; + expect(methodModel.parameters[0].gasPrice).equal(100); }); - expect(methodModel.parameters[0].gasPrice).equal(100); }); - it('calls execute and throws error', async function () { + it('calls execute and throws error', function () { methodModel.parameters = [{gasPrice: 100}]; methodModel.rpcMethod = 'eth_sendRawTransaction'; @@ -179,11 +179,11 @@ describe('SendMethodCommandTest', function () { .withArgs('error') .once(); - var returnedPromiEvent = await sendMethodCommand.execute(web3Package, methodModel, promiEvent); + var returnedPromiEvent = sendMethodCommand.execute(web3Package, methodModel, promiEvent); expect(returnedPromiEvent).equal(promiEvent); - promiEvent.eventEmitter.then(function () { + promiEvent.eventEmitter.catch(function (error) { expect(promiEventRemoveListenersSpy.calledOnce).to.be.true; expect(promiEventEmitSpy.calledOnce).to.be.true; expect(promiEventEmitSpy.calledWith('error', 'error')).to.be.true; @@ -191,6 +191,8 @@ describe('SendMethodCommandTest', function () { expect(methodModelCallbackSpy.calledOnce).to.be.true; expect(methodModelCallbackSpy.calledWith('error', null)).to.be.true; + expect(error).equal('error'); + providerAdapterMock.verify(); methodModelMock.verify(); }); diff --git a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js new file mode 100644 index 00000000000..c17f3b3a00f --- /dev/null +++ b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js @@ -0,0 +1,171 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var SignAndSendMethodCommand = require('../../src/commands/SignAndSendMethodCommand'); +var TransactionSigner = require('../../src/signers/TransactionSigner'); +var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionConfirmationWorkflow'); +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var ProvidersPackage = require('web3-core-providers'); +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var PromiEventPackage = require('web3-core-promievent'); + +/** + * SendMethodCommand test + */ +describe('SendMethodCommandTest', function () { + var signAndSendMethodCommand, + provider, + providerMock, + providerAdapter, + providerAdapterMock, + web3Package, + web3PackageMock, + methodModel, + methodModelCallbackSpy, + methodModelMock, + promiEvent, + promiEventMock, + promiEventEmitSpy, + promiEventRemoveListenersSpy, + transactionSigner, + transactionSignerMock, + transactionConfirmationWorkflow, + transactionConfirmationWorkflowMock; + + beforeEach(function () { + provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); + providerMock = sinon.mock(provider); + + providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); + providerAdapterMock = sinon.mock(providerAdapter); + + web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); + web3PackageMock = sinon.mock(web3Package); + + methodModel = new AbstractMethodModel('', 0, {}, {}); + methodModelCallbackSpy = sinon.spy(); + methodModel.callback = methodModelCallbackSpy; + methodModelMock = sinon.mock(methodModel); + + promiEvent = PromiEventPackage.createPromiEvent(); + promiEventMock = sinon.mock(promiEvent); + + promiEventEmitSpy = sinon.spy(); + promiEvent.eventEmitter.emit = promiEventEmitSpy; + + promiEventRemoveListenersSpy = sinon.spy(); + promiEvent.eventEmitter.removeAllListeners = promiEventRemoveListenersSpy; + + transactionConfirmationWorkflow = new TransactionConfirmationWorkflow({}, {}, {}, {}); + transactionConfirmationWorkflowMock = sinon.mock(transactionConfirmationWorkflow); + + transactionSigner = new TransactionSigner(); + transactionSignerMock = sinon.mock(transactionSigner); + + signAndSendMethodCommand = new SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSigner); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('calls execute', function () { + methodModel.parameters = [{gasPrice: 100}]; + + methodModelMock + .expects('beforeExecution') + .withArgs(web3Package) + .once(); + + transactionSignerMock + .expects('sign') + .withArgs(methodModel.parameters[0], {}) + .returns(new Promise(function (resolve) { + resolve({ + rawTransaction: '' + }) + })) + .once(); + + providerAdapterMock + .expects('send') + .withArgs('eth_gasPrice', []) + .returns(new Promise( + function (resolve) { + resolve(100); + } + )).once(); + + providerAdapterMock + .expects('send') + .withArgs(methodModel.rpcMethod, methodModel.parameters) + .returns(new Promise( + function (resolve) { + resolve('response'); + } + )).once(); + + transactionConfirmationWorkflowMock + .expects('execute') + .withArgs(methodModel, web3Package, 'response', promiEvent) + .once(); + + + var returnedPromiEvent = signAndSendMethodCommand.execute(methodModel, web3Package, {}, promiEvent); + + expect(returnedPromiEvent).equal(promiEvent); + + promiEvent.eventEmitter.then(function () { + expect(promiEventEmitSpy.calledOnce).to.be.true; + expect(promiEventEmitSpy.calledWith('transactionHash', 'response')).to.be.true; + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith(false, 'response')).to.be.true; + + expect(methodModel.rpcMethod).equal('eth_sendRawTransaction'); + expect(methodModel.parameters[0]).equal({rawTransaction: ''}); + + transactionConfirmationWorkflowMock.verify(); + providerAdapterMock.verify(); + methodModelMock.verify(); + }); + }); + + it('calls execute and throws error', function () { + methodModel.parameters = [{gasPrice: 100}]; + + methodModelMock + .expects('beforeExecution') + .withArgs(web3Package) + .once(); + + transactionSignerMock + .expects('sign') + .withArgs(methodModel.parameters[0], {}) + .returns(new Promise(function (resolve, reject) { + reject('error') + })) + .once(); + + var returnedPromiEvent = signAndSendMethodCommand.execute(methodModel, web3Package, {}, promiEvent); + + expect(returnedPromiEvent).equal(promiEvent); + + promiEvent.eventEmitter.catch(function (error) { + expect(promiEventRemoveListenersSpy.calledOnce).to.be.true; + expect(promiEventEmitSpy.calledOnce).to.be.true; + expect(promiEventEmitSpy.calledWith('error', 'error')).to.be.true; + + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith('error', null)).to.be.true; + expect(error).equal('error'); + + expect(methodModel.rpcMethod).equal('eth_sendRawTransaction'); + + transactionConfirmationWorkflowMock.verify(); + providerAdapterMock.verify(); + methodModelMock.verify(); + }); + }); +}); From 5e76071c6e56ff0277a31b0b593e23c60b580ac6 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 14:39:11 +0200 Subject: [PATCH 0242/1045] MethodPackageFactoryTest created --- .../src/factories/MethodPackageFactory.js | 4 +- .../src/watchers/NewHeadsWatcher.js | 7 +- .../factories/MethodPackageFactoryTest.js | 100 ++++++++++++++++++ 3 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index c381e1d73dc..f7aaaa6cb63 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -132,7 +132,7 @@ MethodPackageFactory.prototype.createSignMessageCommand = function () { * @returns {TransactionConfirmationWorkflow} */ MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (subscriptionsFactory, formatters) { - new TransactionConfirmationWorkflow( + return new TransactionConfirmationWorkflow( this.createTransactionConfirmationModel(), this.createTransactionReceiptValidator(), this.createNewHeadsWatcher(subscriptionsFactory), @@ -196,3 +196,5 @@ MethodPackageFactory.prototype.createTransactionReceiptValidator = function () { MethodPackageFactory.prototype.createNewHeadsWatcher = function (subscriptionsFactory) { return new NewHeadsWatcher(subscriptionsFactory); }; + +module.exports = MethodPackageFactory; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 8d1aa5b07c9..be61f37da09 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -21,6 +21,7 @@ */ var SocketProviderAdapter = require('web3-core-providers').SocketProviderAdapter; +var EventEmitter = require('eventemitter3'); /** * @param {SubscriptionsFactory} subscriptionsFactory @@ -34,6 +35,9 @@ function NewHeadsWatcher(subscriptionsFactory) { this.isPolling = false; } +NewHeadsWatcher.prototype = Object.create(EventEmitter.prototype); +NewHeadsWatcher.prototype.constructor = NewHeadsWatcher; + /** * Starts subscription on newHeads if supported or creates an interval to get the newHeads * @@ -77,7 +81,4 @@ NewHeadsWatcher.prototype.stop = function () { } }; -NewHeadsWatcher.prototype = Object.create(EventEmitter.prototype); -NewHeadsWatcher.prototype.constructor = NewHeadsWatcher; - module.exports = NewHeadsWatcher; diff --git a/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js new file mode 100644 index 00000000000..29e877c9c8d --- /dev/null +++ b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js @@ -0,0 +1,100 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var MethodPackageFactory = require('../../src/factories/MethodPackageFactory'); +var MethodController = require('../../src/controllers/MethodController'); +var CallMethodCommand = require('../../src/commands/CallMethodCommand'); +var SignAndSendMethodCommand = require('../../src/commands/SignAndSendMethodCommand'); +var SendMethodCommand = require('../../src/commands/SendMethodCommand'); +var SignMessageCommand = require('../../src/commands/SignMessageCommand'); +var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionConfirmationWorkflow'); +var TransactionSigner = require('../../src/signers/TransactionSigner'); +var MessageSigner = require('../../src/signers/MessageSigner'); +var TransactionConfirmationModel = require('../../src/models/TransactionConfirmationModel'); +var TransactionReceiptValidator = require('../../src/validators/TransactionReceiptValidator'); +var NewHeadsWatcher = require('../../src/watchers/NewHeadsWatcher'); + +/** + * SendMethodCommand test + */ +describe('SendMethodCommandTest', function () { + var methodPackageFactory; + + beforeEach(function () { + methodPackageFactory = new MethodPackageFactory(); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('calls createMethodController and should return an instance of MethodController', function () { + expect(methodPackageFactory.createMethodController({}, {}, {})).to.be.an.instanceof(MethodController); + }); + + it('calls createCallMethodCommand and should return an instance of CallMethodCommand', function () { + expect(methodPackageFactory.createCallMethodCommand()).to.be.an.instanceof(CallMethodCommand); + }); + + it('calls createSendMethodCommand and should return an instance of SendMethodCommand', function () { + expect(methodPackageFactory.createSendMethodCommand({}, {})).to.be.an.instanceof(SendMethodCommand); + }); + + it('calls createSignAndSendMethodCommand and should return an instance of SignAndSendMethodCommand', function () { + expect( + methodPackageFactory.createSignAndSendMethodCommand({}, {}) + ).to.be.an.instanceof( + SignAndSendMethodCommand + ); + }); + + it('calls createSignMessageCommand and should return an instance of SignMessageCommand', function () { + expect(methodPackageFactory.createSignMessageCommand()).to.be.an.instanceof(SignMessageCommand); + }); + + it( + 'calls createTransactionConfirmationWorkflow and should return an instance of TransactionConfirmationWorkflow', + function () { + expect( + methodPackageFactory.createTransactionConfirmationWorkflow({}, {}) + ).to.be.an.instanceof( + TransactionConfirmationWorkflow + ); + } + ); + + it('calls createTransactionSigner and should return an instance of TransactionSigner', function () { + expect(methodPackageFactory.createTransactionSigner()).to.be.an.instanceof(TransactionSigner); + }); + + it('calls createMessageSigner and should return an instance of MessageSigner', function () { + expect(methodPackageFactory.createMessageSigner()).to.be.an.instanceof(MessageSigner); + }); + + it( + 'calls createTransactionConfirmationModel and should return an instance of TransactionConfirmationModel', + function () { + expect( + methodPackageFactory.createTransactionConfirmationModel() + ).to.be.an.instanceof( + TransactionConfirmationModel + ); + } + ); + + it( + 'calls createTransactionReceiptValidator and should return an instance of TransactionReceiptValidator', + function () { + expect( + methodPackageFactory.createTransactionReceiptValidator() + ).to.be.an.instanceof( + TransactionReceiptValidator + ); + } + ); + + it('calls createNewHeadsWatcher and should return an instance of NewHeadsWatcher', function () { + expect(methodPackageFactory.createNewHeadsWatcher({})).to.be.an.instanceof(NewHeadsWatcher); + }); +}); From 53e716cc30c68a0bfb5343d123bd08533273af20 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 15:13:32 +0200 Subject: [PATCH 0243/1045] MessageSignerTest created --- packages/web3-core-method/src/index.js | 6 +- .../src/signers/MessageSigner.js | 2 +- .../factories/MethodPackageFactoryTest.js | 4 +- .../tests/signers/MessageSignerTest.js | 59 + .../web3-core-subscriptions/package-lock.json | 1109 ++++++++++++++- packages/web3-core-subscriptions/src/index.js | 2 +- packages/web3-eth-accounts/package-lock.json | 1219 +++++++++++++++-- packages/web3-eth-accounts/src/Accounts.js | 7 +- packages/web3-eth-accounts/src/index.js | 4 +- 9 files changed, 2247 insertions(+), 165 deletions(-) create mode 100644 packages/web3-core-method/tests/signers/MessageSignerTest.js diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index d523f7feeb3..c47b4c346f8 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -62,7 +62,7 @@ var formatters = require('web3-core-helpers').formatters; // Transaction var GetTransactionMethodModel = require('./models/methods/transaction/GetTransactionMethodModel'); var GetTransactionFromBlockMethodModel = require('./models/methods/transaction/GetTransactionFromBlockMethodModel'); - var GetTransactionReceipt = require('./models/methods/transaction/GetTransactionReceipt'); + var GetTransactionReceipt = require('./models/methods/transaction/GetTransactionReceiptMethodModel'); var SendSignedTransactionMethodModel = require('./models/methods/transaction/SendSignedTransactionMethodModel'); var SignTransactionMethodModel = require('./models/methods/transaction/SignTransactionMethodModel'); var SendTransactionMethodModel = require('./models/methods/transaction/SendTransactionMethodModel'); @@ -71,7 +71,7 @@ var formatters = require('web3-core-helpers').formatters; var GetCodeMethodModel = require('./models/methods/GetCodeMethodModel'); var SignMethodModel = require('./models/methods/SignMethodModel'); var CallMethodModel = require('./models/methods/CallMethodModel'); - var GetStroageAtMethodModel = require('./models/methods/GetStroageAtMethodModel'); + var GetStorageAtMethodModel = require('./models/methods/GetStorageAtMethodModel'); var EstimateGasMethodModel = require('./models/methods/EstimateGasMethodModel'); var GetPastLogsMethodModel = require('./models/methods/GetPastLogsMethodModel'); @@ -168,7 +168,7 @@ module.exports = { GetTransactionReceipt: GetTransactionReceipt, // Global - GetStroageAtMethodModel: GetStroageAtMethodModel, + GetStorageAtMethodModel: GetStorageAtMethodModel, GetCodeMethodModel: GetCodeMethodModel, SignMethodModel: SignMethodModel, CallMethodModel: CallMethodModel, diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 3530fb6a162..8c780cc6d20 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -41,7 +41,7 @@ MessageSigner.prototype.constructor = MessageSigner; * @param {String} address * @param {Accounts} accounts * - * @returns {String | Error} + * @returns {String|Error} */ MessageSigner.prototype.sign = function(data, address, accounts) { var wallet = this.getWallet(address, accounts); diff --git a/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js index 29e877c9c8d..538dbe1db98 100644 --- a/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js +++ b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js @@ -16,9 +16,9 @@ var TransactionReceiptValidator = require('../../src/validators/TransactionRecei var NewHeadsWatcher = require('../../src/watchers/NewHeadsWatcher'); /** - * SendMethodCommand test + * MethodPackageFactory test */ -describe('SendMethodCommandTest', function () { +describe('MethodPackageFactoryTest', function () { var methodPackageFactory; beforeEach(function () { diff --git a/packages/web3-core-method/tests/signers/MessageSignerTest.js b/packages/web3-core-method/tests/signers/MessageSignerTest.js new file mode 100644 index 00000000000..ea841b2311a --- /dev/null +++ b/packages/web3-core-method/tests/signers/MessageSignerTest.js @@ -0,0 +1,59 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var ProvidersPackage = require('web3-core-providers'); +var AccountsPackage = require('web3-eth-accounts'); +var MessageSigner = require('../../src/signers/MessageSigner'); + +/** + * MessageSigner test + */ +describe('MessageSignerTest', function () { + var messageSigner, + provider, + providerMock, + providerAdapter, + providerAdapterMock, + accounts, + accountsMock; + + beforeEach(function () { + provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); + providerMock = sinon.mock(provider); + + providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); + providerAdapterMock = sinon.mock(providerAdapter); + + accounts = AccountsPackage.createAccounts(provider); + accountsMock = sinon.mock(accounts); + + messageSigner = new MessageSigner(); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('calls sign and throws error', function () { + try { + messageSigner.sign('string', 0, accounts) + } catch (error) { + expect(error.message).equal('Wallet or privateKey in wallet is not set!'); + } + }); + + it('calls sign and returns signed message', function () { + accounts.wallet[0] = {privateKey: '0x0'}; + + accountsMock + .expects('sign') + .withArgs('string', '0x0') + .returns({signature: '0x00'}) + .once(); + + expect(messageSigner.sign('string', 0, accounts)).equal('0x00'); + + accountsMock.verify(); + }); +}); diff --git a/packages/web3-core-subscriptions/package-lock.json b/packages/web3-core-subscriptions/package-lock.json index 25dd1e37f9c..7dfa94a0423 100644 --- a/packages/web3-core-subscriptions/package-lock.json +++ b/packages/web3-core-subscriptions/package-lock.json @@ -1,16 +1,1113 @@ { - "requires": true, + "name": "web3-core-subscriptions", + "version": "1.0.0-beta.36", "lockfileVersion": 1, + "requires": true, "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", - "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + } + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" } } } diff --git a/packages/web3-core-subscriptions/src/index.js b/packages/web3-core-subscriptions/src/index.js index 6104c0444de..14c9a2d0b2e 100644 --- a/packages/web3-core-subscriptions/src/index.js +++ b/packages/web3-core-subscriptions/src/index.js @@ -22,7 +22,7 @@ "use strict"; -var version = require('./package.json').version; +var version = require('../package.json').version; var SubscriptionsFactory = require('./factories/SubscriptionsFactory'); var LogSubscriptionModel = require('./models/subscriptions/eth/LogSubscriptionModel'); var Subscription = require('./Subscription'); diff --git a/packages/web3-eth-accounts/package-lock.json b/packages/web3-eth-accounts/package-lock.json index 4a9895b042b..07f601f059d 100644 --- a/packages/web3-eth-accounts/package-lock.json +++ b/packages/web3-eth-accounts/package-lock.json @@ -1,20 +1,88 @@ { - "requires": true, + "name": "web3-eth-accounts", + "version": "1.0.0-beta.36", "lockfileVersion": 1, + "requires": true, "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, "any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, "asn1.js": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", "requires": { - "bn.js": "4.11.8", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1" + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" } }, "bn.js": { @@ -22,6 +90,23 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -32,12 +117,12 @@ "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "requires": { - "buffer-xor": "1.0.3", - "cipher-base": "1.0.4", - "create-hash": "1.2.0", - "evp_bytestokey": "1.0.3", - "inherits": "2.0.3", - "safe-buffer": "5.1.2" + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "browserify-cipher": { @@ -45,9 +130,9 @@ "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", "requires": { - "browserify-aes": "1.2.0", - "browserify-des": "1.0.1", - "evp_bytestokey": "1.0.3" + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" } }, "browserify-des": { @@ -55,9 +140,9 @@ "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.1.tgz", "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", "requires": { - "cipher-base": "1.0.4", - "des.js": "1.0.0", - "inherits": "2.0.3" + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1" } }, "browserify-rsa": { @@ -65,8 +150,16 @@ "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "requires": { - "bn.js": "4.11.8", - "randombytes": "2.0.6" + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" } }, "browserify-sign": { @@ -74,13 +167,13 @@ "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", "requires": { - "bn.js": "4.11.8", - "browserify-rsa": "4.0.1", - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "elliptic": "6.4.0", - "inherits": "2.0.3", - "parse-asn1": "5.1.1" + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" } }, "buffer-to-arraybuffer": { @@ -93,13 +186,70 @@ "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.2" + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" } }, "create-ecdh": { @@ -107,8 +257,8 @@ "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", "requires": { - "bn.js": "4.11.8", - "elliptic": "6.4.0" + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" } }, "create-hash": { @@ -116,11 +266,11 @@ "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "requires": { - "cipher-base": "1.0.4", - "inherits": "2.0.3", - "md5.js": "1.3.4", - "ripemd160": "2.0.2", - "sha.js": "2.4.11" + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" } }, "create-hmac": { @@ -128,12 +278,12 @@ "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "requires": { - "cipher-base": "1.0.4", - "create-hash": "1.2.0", - "inherits": "2.0.3", - "ripemd160": "2.0.2", - "safe-buffer": "5.1.2", - "sha.js": "2.4.11" + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" } }, "crypto-browserify": { @@ -141,17 +291,33 @@ "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", "requires": { - "browserify-cipher": "1.0.1", - "browserify-sign": "4.0.4", - "create-ecdh": "4.0.3", - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "diffie-hellman": "5.0.3", - "inherits": "2.0.3", - "pbkdf2": "3.0.16", - "public-encrypt": "4.0.2", - "randombytes": "2.0.6", - "randomfill": "1.0.4" + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" } }, "decode-uri-component": { @@ -164,26 +330,41 @@ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", "requires": { - "mimic-response": "1.0.0" + "mimic-response": "^1.0.0" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, "des.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", "requires": { - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1" + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" } }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "requires": { - "bn.js": "4.11.8", - "miller-rabin": "4.0.1", - "randombytes": "2.0.6" + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" } }, "dom-walk": { @@ -191,45 +372,223 @@ "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, "elliptic": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "requires": { - "bn.js": "4.11.8", - "brorand": "1.1.0", - "hash.js": "1.1.3", - "hmac-drbg": "1.0.1", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1", - "minimalistic-crypto-utils": "1.0.1" + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" } }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, "eth-lib": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", - "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", "requires": { - "bn.js": "4.11.8", - "elliptic": "6.4.0", - "xhr-request-promise": "0.1.2" + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } } }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, "evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "requires": { - "md5.js": "1.3.4", - "safe-buffer": "5.1.2" + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } } }, "for-each": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.2.tgz", - "integrity": "sha1-LEBFC5NI6X8oEyJZO6lnBLmr1NQ=", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "requires": { - "is-function": "1.0.1" + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + } + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" } }, "global": { @@ -237,8 +596,22 @@ "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", "requires": { - "min-document": "2.19.0", - "process": "0.5.2" + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" } }, "hash-base": { @@ -246,8 +619,8 @@ "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.2" + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "hash.js": { @@ -255,8 +628,8 @@ "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", "requires": { - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1" + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" } }, "hmac-drbg": { @@ -264,9 +637,38 @@ "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "requires": { - "hash.js": "1.1.3", - "minimalistic-assert": "1.0.1", - "minimalistic-crypto-utils": "1.0.1" + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" } }, "inherits": { @@ -274,40 +676,143 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, "is-function": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, "md5.js": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", "requires": { - "hash-base": "3.0.4", - "inherits": "2.0.3" + "hash-base": "^3.0.0", + "inherits": "^2.0.1" } }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, "miller-rabin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", "requires": { - "bn.js": "4.11.8", - "brorand": "1.1.0" + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "requires": { + "mime-db": "~1.36.0" } }, "mimic-response": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.0.tgz", - "integrity": "sha1-3z02Uqc/3ta5sLJBRub9BSNTRY4=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" }, "min-document": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", "requires": { - "dom-walk": "0.1.1" + "dom-walk": "^0.1.0" } }, "minimalistic-assert": { @@ -320,22 +825,66 @@ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, "nan": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "parse-asn1": { @@ -343,11 +892,11 @@ "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", "requires": { - "asn1.js": "4.10.1", - "browserify-aes": "1.2.0", - "create-hash": "1.2.0", - "evp_bytestokey": "1.0.3", - "pbkdf2": "3.0.16" + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" } }, "parse-headers": { @@ -355,47 +904,86 @@ "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", "requires": { - "for-each": "0.3.2", + "for-each": "^0.3.2", "trim": "0.0.1" } }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, "pbkdf2": { "version": "3.0.16", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", "requires": { - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "ripemd160": "2.0.2", - "safe-buffer": "5.1.2", - "sha.js": "2.4.11" + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" } }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, "process": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, "public-encrypt": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", "requires": { - "bn.js": "4.11.8", - "browserify-rsa": "4.0.1", - "create-hash": "1.2.0", - "parse-asn1": "5.1.1", - "randombytes": "2.0.6" + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1" } }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, "query-string": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", "requires": { - "decode-uri-component": "0.2.0", - "object-assign": "4.1.1", - "strict-uri-encode": "1.1.0" + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" } }, "randombytes": { @@ -403,7 +991,7 @@ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "^5.1.0" } }, "randomfill": { @@ -411,8 +999,56 @@ "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", "requires": { - "randombytes": "2.0.6", - "safe-buffer": "5.1.2" + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" } }, "ripemd160": { @@ -420,8 +1056,8 @@ "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", "requires": { - "hash-base": "3.0.4", - "inherits": "2.0.3" + "hash-base": "^3.0.0", + "inherits": "^2.0.1" } }, "safe-buffer": { @@ -429,12 +1065,17 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "scrypt": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz", "integrity": "sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=", "requires": { - "nan": "2.10.0" + "nan": "^2.0.8" } }, "scrypt.js": { @@ -442,8 +1083,8 @@ "resolved": "https://registry.npmjs.org/scrypt.js/-/scrypt.js-0.2.0.tgz", "integrity": "sha1-r40UZbcemZARC+38WTuUeeA6ito=", "requires": { - "scrypt": "6.0.3", - "scryptsy": "1.2.1" + "scrypt": "^6.0.2", + "scryptsy": "^1.2.1" } }, "scryptsy": { @@ -451,16 +1092,79 @@ "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-1.2.1.tgz", "integrity": "sha1-oyJfpLJST4AnAHYeKFW987LZIWM=", "requires": { - "pbkdf2": "3.0.16" + "pbkdf2": "^3.0.3" } }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.2" + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" } }, "simple-concat": { @@ -473,55 +1177,278 @@ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", "requires": { - "decompress-response": "3.3.0", - "once": "1.4.0", - "simple-concat": "1.0.0" + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" } }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, "strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, "trim": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, "url-set-query": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, "uuid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", - "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-method": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.36.tgz", + "integrity": "sha512-dJsP3KkGaqBBSdxfzvLsYPOmVaSs1lR/3oKob/gtUYG7UyTnwquwliAc7OXj+gqRA2E/FHZcM83cWdl31ltdSA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-promievent": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.36.tgz", + "integrity": "sha512-RGIL6TjcOeJTullFLMurChPTsg94cPF6LI763y/sPYtXTDol1vVa+J5aGLp/4WW8v+s+1bSQO6zYq2ZtkbmtEQ==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "1.1.1" + } + }, + "web3-core-subscriptions": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", + "integrity": "sha512-/evyLQ8CMEYXC5aUCodDpmEnmGVYQxaIjiEIfA/85f9ifHkfzP1aOwCAjcsLsJWnwrWDagxSpjCYrDtnNabdEw==", + "requires": { + "eventemitter3": "1.1.1", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, "xhr": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", "requires": { - "global": "4.3.2", - "is-function": "1.0.1", - "parse-headers": "2.0.1", - "xtend": "4.0.1" + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" } }, "xhr-request": { @@ -529,13 +1456,13 @@ "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", "requires": { - "buffer-to-arraybuffer": "0.0.5", - "object-assign": "4.1.1", - "query-string": "5.1.1", - "simple-get": "2.8.1", - "timed-out": "4.0.1", - "url-set-query": "1.0.0", - "xhr": "2.5.0" + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" } }, "xhr-request-promise": { @@ -543,7 +1470,7 @@ "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", "requires": { - "xhr-request": "1.1.0" + "xhr-request": "^1.0.1" } }, "xtend": { diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 13512dc231d..4d42be5b305 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -69,6 +69,9 @@ var Accounts = function Accounts(provider, providersPackage, methodController, m this.wallet = new Wallet(this); }; +Accounts.prototype = Object.create(AbstractWeb3Object.prototype); +Accounts.prototype.constructor = Accounts; + /** * Adds the account functions to the given object * @@ -458,10 +461,6 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { }; }; -Accounts.prototype = Object.create(AbstractWeb3Object.prototype); -Accounts.prototype.constructor = Accounts; - - // Note: this is trying to follow closely the specs on // http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 88109cb37de..ede8a85af8d 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -22,12 +22,12 @@ "use strict"; -var version = require('./package.json').version; +var version = require('../package.json').version; var Accounts = require('./Accounts'); var MethodPackage = require('web3-core-method'); var ProvidersPackage = require('web3-core-providers'); var Utils = require('web3-utils'); -var formatters = require('web3-helpers').formatters; +var formatters = require('web3-core-helpers').formatters; var MethodModelFactory = require('./factories/MethodModelFactory'); module.exports = { From 294c48d7041065361175554ac5e8720e935cced3 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 15:50:39 +0200 Subject: [PATCH 0244/1045] TransactionSignerTest created --- .../src/signers/TransactionSigner.js | 8 ++- .../tests/signers/MessageSignerTest.js | 2 +- .../tests/signers/TransactionSignerTest.js | 67 +++++++++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 packages/web3-core-method/tests/signers/TransactionSignerTest.js diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index 2f30102faf2..27e66adfb39 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -40,9 +40,11 @@ TransactionSigner.prototype.constructor = TransactionSigner; * @returns {Promise} */ TransactionSigner.prototype.sign = function (transaction, accounts) { - var wallet = this.getWallet(transaction.from, accounts); + var self = this; return new Promise(function(resolve, reject) { + var wallet = self.getWallet(transaction.from, accounts); + if (wallet && wallet.privateKey) { delete transaction.from; @@ -51,9 +53,11 @@ TransactionSigner.prototype.sign = function (transaction, accounts) { }).catch(function(error) { reject(error); }); + + return; } - reject(new Error('Wallet or privateKey for wallet is not set!')); + reject(new Error('Wallet or privateKey in wallet is not set!')); }); }; diff --git a/packages/web3-core-method/tests/signers/MessageSignerTest.js b/packages/web3-core-method/tests/signers/MessageSignerTest.js index ea841b2311a..a2e8cffc823 100644 --- a/packages/web3-core-method/tests/signers/MessageSignerTest.js +++ b/packages/web3-core-method/tests/signers/MessageSignerTest.js @@ -45,7 +45,7 @@ describe('MessageSignerTest', function () { it('calls sign and returns signed message', function () { accounts.wallet[0] = {privateKey: '0x0'}; - + accountsMock .expects('sign') .withArgs('string', '0x0') diff --git a/packages/web3-core-method/tests/signers/TransactionSignerTest.js b/packages/web3-core-method/tests/signers/TransactionSignerTest.js new file mode 100644 index 00000000000..4e185a3ec71 --- /dev/null +++ b/packages/web3-core-method/tests/signers/TransactionSignerTest.js @@ -0,0 +1,67 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var ProvidersPackage = require('web3-core-providers'); +var AccountsPackage = require('web3-eth-accounts'); +var TransactionSigner = require('../../src/signers/TransactionSigner'); + +/** + * TransactionSigner test + */ +describe('TransactionSignerTest', function () { + var transactionSigner, + provider, + providerMock, + providerAdapter, + providerAdapterMock, + accounts, + accountsMock; + + beforeEach(function () { + provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); + providerMock = sinon.mock(provider); + + providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); + providerAdapterMock = sinon.mock(providerAdapter); + + accounts = AccountsPackage.createAccounts(provider); + accountsMock = sinon.mock(accounts); + + transactionSigner = new TransactionSigner(); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('calls sign and throws error', function () { + transactionSigner.sign({from: 0}, accounts).catch(function(error) { + expect(error.message).equal('Wallet or privateKey in wallet is not set!'); + }); + }); + + it('calls sign and returns signed transaction', async function () { + accounts.wallet[0] = {privateKey: '0x0'}; + var transaction = { + from: 0, + }; + + accountsMock + .expects('signTransaction') + .withArgs(transaction, '0x0') + .returns(new Promise( + function(resolve) { + resolve('0x0'); + } + )) + .once(); + + var returnValue = await transactionSigner.sign(transaction, accounts); + + expect(returnValue).equal('0x0'); + expect(transaction.from).equal(undefined); + + accountsMock.verify(); + }); +}); From 2a1058eeeee01ca28408e796e00df8b150d0cdaf Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 16:00:46 +0200 Subject: [PATCH 0245/1045] TransactionReceiptValidatorTest created --- .../validators/TransactionReceiptValidator.js | 6 +- .../tests/signers/TransactionSignerTest.js | 4 +- .../TransactionReceiptValidatorTest.js | 73 +++++++++++++++++++ 3 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index 51b5ab87283..17cacded62d 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -22,6 +22,8 @@ "use strict"; +var _ = require('underscore'); + /** * @constructor */ @@ -45,10 +47,10 @@ TransactionReceiptValidator.prototype.validate = function (receipt, methodParame var receiptJSON = JSON.stringify(receipt, null, 2); if (receipt.status === false || receipt.status === '0x0') { - return new Error("Transaction has been reverted by the EVM:\n" + receiptJSON); + return new Error('Transaction has been reverted by the EVM:\n' + receiptJSON); } - return new Error("Transaction ran out of gas. Please provide more gas:\n" + receiptJSON); + return new Error('Transaction ran out of gas. Please provide more gas:\n' + receiptJSON); }; /** diff --git a/packages/web3-core-method/tests/signers/TransactionSignerTest.js b/packages/web3-core-method/tests/signers/TransactionSignerTest.js index 4e185a3ec71..fc10a4069bf 100644 --- a/packages/web3-core-method/tests/signers/TransactionSignerTest.js +++ b/packages/web3-core-method/tests/signers/TransactionSignerTest.js @@ -36,7 +36,7 @@ describe('TransactionSignerTest', function () { }); it('calls sign and throws error', function () { - transactionSigner.sign({from: 0}, accounts).catch(function(error) { + transactionSigner.sign({from: 0}, accounts).catch(function (error) { expect(error.message).equal('Wallet or privateKey in wallet is not set!'); }); }); @@ -51,7 +51,7 @@ describe('TransactionSignerTest', function () { .expects('signTransaction') .withArgs(transaction, '0x0') .returns(new Promise( - function(resolve) { + function (resolve) { resolve('0x0'); } )) diff --git a/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js b/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js new file mode 100644 index 00000000000..7f46e38f7a1 --- /dev/null +++ b/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js @@ -0,0 +1,73 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var TransactionReceiptValidator = require('../../src/validators/TransactionReceiptValidator'); + +/** + * TransactionReceiptValidator test + */ +describe('TransactionReceiptValidatorTest', function () { + var transactionReceiptValidator; + + beforeEach(function () { + transactionReceiptValidator = new TransactionReceiptValidator(); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('calls validate and returns true', function () { + expect(transactionReceiptValidator.validate( + { + status: true, + outOfGas: false, + gasUsed: 90 + }, + [ + { + gas: 100 + } + ] + )).to.be.true; + }); + + it('calls validate and returns error because if invalid gasUsage', function () { + var error = transactionReceiptValidator.validate( + { + status: true, + outOfGas: false, + gasUsed: 100 + }, + [ + { + gas: 100 + } + ] + ); + + + expect(error).to.be.an.instanceof(Error); + expect(error.message).to.have.string('Transaction ran out of gas. Please provide more gas:'); + }); + + it('calls validate and returns error because the EVM has reverted it', function () { + var error = transactionReceiptValidator.validate( + { + status: false, + outOfGas: false, + gasUsed: 100 + }, + [ + { + gas: 100 + } + ] + ); + + + expect(error).to.be.an.instanceof(Error); + expect(error.message).to.have.string('Transaction has been reverted by the EVM:'); + }); +}); From 15ee869b2bccb4ff69aac6dbd243719114198e2d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 12 Oct 2018 16:01:28 +0200 Subject: [PATCH 0246/1045] sinon sandbox removed from TransactionReceiptValidatorTest --- .../tests/validators/TransactionReceiptValidatorTest.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js b/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js index 7f46e38f7a1..8a77b5def5f 100644 --- a/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js +++ b/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js @@ -1,5 +1,4 @@ var chai = require('chai'); -var sinon = require('sinon').createSandbox(); var expect = chai.expect; var TransactionReceiptValidator = require('../../src/validators/TransactionReceiptValidator'); @@ -14,10 +13,6 @@ describe('TransactionReceiptValidatorTest', function () { transactionReceiptValidator = new TransactionReceiptValidator(); }); - afterEach(function () { - sinon.restore(); - }); - it('calls validate and returns true', function () { expect(transactionReceiptValidator.validate( { From 7aac0aee4825769c5ca495921e100fa143b03056 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 15 Oct 2018 12:00:05 +0200 Subject: [PATCH 0247/1045] NewHeadsWatcher test created --- .../src/watchers/NewHeadsWatcher.js | 6 +- .../tests/watchers/NewHeadsWatcherTest.js | 100 ++++++++++++++++++ packages/web3-core-providers/src/index.js | 2 + .../src/Subscription.js | 6 +- 4 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index be61f37da09..d19545674e1 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -61,7 +61,9 @@ NewHeadsWatcher.prototype.watch = function (web3Package) { } this.isPolling = true; - this.confirmationInterval = setInterval(this.emit('newHead'), 1000); + this.confirmationInterval = setInterval(function() { + self.emit('newHead') + }, 1000); return this; }; @@ -79,6 +81,8 @@ NewHeadsWatcher.prototype.stop = function () { if (this.confirmationInterval) { clearInterval(this.confirmationInterval); } + + this.removeAllListeners('newHead'); }; module.exports = NewHeadsWatcher; diff --git a/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js b/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js new file mode 100644 index 00000000000..1b7dc57a897 --- /dev/null +++ b/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js @@ -0,0 +1,100 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var SubscriptionsPackage = require('web3-core-subscriptions'); +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var ProvidersPackage = require('web3-core-providers'); +var NewHeadsWatcher = require('../../src/watchers/NewHeadsWatcher'); + +/** + * NewHeadsWatcher test + */ +describe('NewHeadsWatcherTest', function () { + var newHeadsWatcher, + provider, + providerMock, + providerAdapter, + providerAdapterMock, + web3Package, + web3PackageMock, + subscriptionsFactory, + subscriptionsFactoryMock, + subscription, + subscriptionMock; + + beforeEach(function () { + subscriptionsFactory = new SubscriptionsPackage.createSubscriptionsFactory(); + subscriptionsFactoryMock = sinon.mock(subscriptionsFactory); + + newHeadsWatcher = new NewHeadsWatcher(subscriptionsFactory); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('constructor check', function() { + expect(newHeadsWatcher.subscriptionsFactory).to.be.an.instanceof(subscriptionsFactory.constructor); + expect(newHeadsWatcher.confirmationSubscription).to.be.null; + expect(newHeadsWatcher.isPolling).to.be.false; + expect(newHeadsWatcher.confirmationInterval).to.be.null; + }); + + it('calls watch and stop with HttpProviderAdapter', function () { + provider = new ProvidersPackage.HttpProvider('http://127.0.0.1', {}); + providerMock = sinon.mock(provider); + + providerAdapter = new ProvidersPackage.HttpProviderAdapter(provider); + providerAdapterMock = sinon.mock(providerAdapter); + + web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); + web3PackageMock = sinon.mock(web3Package); + + var newHeadsWatcherObject = newHeadsWatcher.watch(web3Package); + + expect(newHeadsWatcherObject.isPolling).to.be.true; + expect(newHeadsWatcherObject.confirmationInterval).to.be.instanceof(Object); + + newHeadsWatcher.stop(); + + expect(newHeadsWatcher.listeners('newHead').length).equal(0); + }); + + it('calls watch and stop with SocketProviderAdapter', function () { + provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); + providerMock = sinon.mock(provider); + + providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); + providerAdapterMock = sinon.mock(providerAdapter); + + web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); + web3PackageMock = sinon.mock(web3Package); + + subscription = new SubscriptionsPackage.Subscription({}, web3Package); + subscriptionMock = sinon.mock(subscription); + + subscriptionMock + .expects('subscribe') + .returns(subscription) + .once(); + + subscriptionMock + .expects('unsubscribe') + .once(); + + subscriptionsFactoryMock + .expects('createNewHeadsSubscription') + .withArgs(web3Package) + .returns(subscription) + .once(); + + newHeadsWatcher.watch(web3Package); + newHeadsWatcher.stop(); + + expect(newHeadsWatcher.listeners('newHead').length).equal(0); + + subscriptionMock.verify(); + subscriptionsFactoryMock.verify(); + }); +}); diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-core-providers/src/index.js index a1f5444a695..0396ed7d770 100644 --- a/packages/web3-core-providers/src/index.js +++ b/packages/web3-core-providers/src/index.js @@ -23,6 +23,7 @@ var version = require('../package.json').version; var ProvidersPackageFactory = require('./factories/ProvidersPackageFactory'); var SocketProviderAdapter = require('./adapters/SocketProviderAdapter'); +var HttpProviderAdapter = require('./adapters/HttpProviderAdapter'); var HttpProvider = require('./providers/HttpProvider'); var IpcProvider = require('./providers/IpcProvider'); var WebsocketProvider = require('./providers/WebsocketProvider'); @@ -34,6 +35,7 @@ module.exports = { version: version, SocketProviderAdapter: SocketProviderAdapter, + HttpProviderAdapter: HttpProviderAdapter, HttpProvider: HttpProvider, IpcProvider: IpcProvider, diff --git a/packages/web3-core-subscriptions/src/Subscription.js b/packages/web3-core-subscriptions/src/Subscription.js index 2f0fadeac50..0390380d27f 100644 --- a/packages/web3-core-subscriptions/src/Subscription.js +++ b/packages/web3-core-subscriptions/src/Subscription.js @@ -37,6 +37,9 @@ function Subscription(subscriptionModel, web3Package) { this.subscriptionId = null; } +Subscription.prototype = Object.create(EventEmitter.prototype); +Subscription.prototype.constructor = Subscription; + /** * Sends the JSON-RPC request, emits the required events and executes the callback method. * @@ -177,5 +180,4 @@ Subscription.prototype.unsubscribe = function (callback) { }); }; -Subscription.prototype = Object.create(EventEmitter.prototype); -Subscription.prototype.constructor = Subscription; +module.exports = Subscription; From 1c212623579af24bc73d892839c379bdc7eb4910 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 10:43:42 +0200 Subject: [PATCH 0248/1045] ongoing work of testing --- .../lib/commands/AbstractSendMethodCommand.js | 55 +--- packages/web3-core-method/package-lock.json | 299 +----------------- packages/web3-core-method/package.json | 5 +- .../src/commands/SendMethodCommand.js | 43 ++- .../src/commands/SignAndSendMethodCommand.js | 3 +- .../src/controllers/MethodController.js | 2 +- .../TransactionConfirmationWorkflow.js | 16 +- .../tests/commands/SendMethodCommandTest.js | 66 ++-- .../commands/SignAndSendMethodCommandTest.js | 18 +- .../factories/MethodPackageFactoryTest.js | 5 - .../TransactionConfirmationWorkflowTest.js | 134 ++++++++ packages/web3-core-subscriptions/package.json | 2 +- packages/web3-eth-accounts/package-lock.json | 2 +- packages/web3-eth-accounts/package.json | 8 +- .../src/factories/ContractPackageFactory.js | 2 +- 15 files changed, 229 insertions(+), 431 deletions(-) create mode 100644 packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js diff --git a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js index bba5ed183fa..ad8c33e2147 100644 --- a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js +++ b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js @@ -35,7 +35,7 @@ function AbstractSendMethodCommand(transactionConfirmationWorkflow) { /** - * Checks the gasPrice and sends the JSON-RPC request + * Sends the JSON-RPC request and executes the TransactionConfirmationWorkflow * * @method send * @@ -47,34 +47,6 @@ function AbstractSendMethodCommand(transactionConfirmationWorkflow) { */ AbstractSendMethodCommand.prototype.send = function (methodModel, promiEvent, web3Package) { var self = this; - if (this.isGasPriceDefined(methodModel.parameters)) { - this.sendMethod(methodModel, promiEvent, web3Package); - - return promiEvent; - } - - this.getGasPrice(web3Package.currentProvider).then(function(gasPrice) { - if (_.isObject(methodModel.parameters[0])) { - methodModel.parameters[0].gasPrice = gasPrice; - } - - self.sendMethod(methodModel, promiEvent, web3Package); - }); - - return promiEvent; -}; - -/** - * Sends the JSON-RPC request - * - * @method send - * - * @param {AbstractMethodModel} methodModel - * @param {AbstractWeb3Object} web3Package - * @param {PromiEvent} promiEvent - */ -AbstractSendMethodCommand.prototype.sendMethod = function (methodModel, promiEvent, web3Package) { - var self = this; web3Package.currentProvider.send( methodModel.rpcMethod, @@ -101,31 +73,8 @@ AbstractSendMethodCommand.prototype.sendMethod = function (methodModel, promiEve methodModel.callback(error, null); } }); -}; - - -/** - * Determines if gasPrice is defined in the method options - * - * @method isGasPriceDefined - * - * @param {Array} parameters - * - * @returns {Boolean} - */ -AbstractSendMethodCommand.prototype.isGasPriceDefined = function (parameters) { - return _.isObject(parameters[0]) && typeof parameters[0].gasPrice !== 'undefined'; -}; -/** - * Returns the current gasPrice of the connected node - * - * @param {AbstractProviderAdapter | EthereumProvider} provider - * - * @returns {Promise} - */ -AbstractSendMethodCommand.prototype.getGasPrice = function (provider) { - return provider.send('eth_gasPrice', []); + return promiEvent; }; module.exports = AbstractSendMethodCommand; diff --git a/packages/web3-core-method/package-lock.json b/packages/web3-core-method/package-lock.json index 8fdc4fd2b2e..0520e93e65c 100644 --- a/packages/web3-core-method/package-lock.json +++ b/packages/web3-core-method/package-lock.json @@ -39,11 +39,6 @@ "integrity": "sha512-ZwTHAlC9akprWDinwEPD4kOuwaYZlyMwVJIANsKNC3QVp0AHB04m7RnB4eqeWfgmxw8MGTzS9uMaw93Z3QcZbw==", "dev": true }, - "@types/node": { - "version": "10.11.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.7.tgz", - "integrity": "sha512-yOxFfkN9xUFLyvWaeYj90mlqTJ41CsQzWKS3gXdOMOyPVacUsymejKxJ4/pMW7exouubuEeZLJawGgcNGYlTeg==" - }, "accepts": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", @@ -53,11 +48,6 @@ "negotiator": "0.6.1" } }, - "aes-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" - }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -275,11 +265,6 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, - "cookiejar": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", - "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -423,55 +408,6 @@ "xhr-request-promise": "^0.1.2" } }, - "ethers": { - "version": "4.0.0-beta.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.1.tgz", - "integrity": "sha512-SoYhktEbLxf+fiux5SfCEwdzWENMvgIbMZD90I62s4GZD9nEjgEWy8ZboI3hck193Vs0bDoTohDISx84f2H2tw==", - "requires": { - "@types/node": "^10.3.2", - "aes-js": "3.0.0", - "bn.js": "^4.4.0", - "elliptic": "6.3.3", - "hash.js": "1.1.3", - "js-sha3": "0.5.7", - "scrypt-js": "2.0.3", - "setimmediate": "1.0.4", - "uuid": "2.0.1", - "xmlhttprequest": "1.8.0" - }, - "dependencies": { - "elliptic": { - "version": "6.3.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", - "integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "inherits": "^2.0.1" - } - }, - "hash.js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" - } - }, - "js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" - }, - "uuid": { - "version": "2.0.1", - "resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", - "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" - } - } - }, "ethjs-unit": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", @@ -482,9 +418,9 @@ } }, "eventemitter3": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", - "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" }, "express": { "version": "4.16.3", @@ -796,11 +732,6 @@ "statuses": ">= 1.4.0 < 2" } }, - "http-https": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", - "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" - }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -1096,14 +1027,6 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, - "oboe": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", - "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", - "requires": { - "http-https": "^1.0.0" - } - }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -1260,11 +1183,6 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "scrypt-js": { - "version": "2.0.3", - "resolved": "http://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", - "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" - }, "send": { "version": "0.16.2", "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", @@ -1323,11 +1241,6 @@ "xhr": "^2.3.3" } }, - "setimmediate": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", - "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" - }, "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", @@ -1481,14 +1394,6 @@ "mime-types": "~2.1.18" } }, - "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "requires": { - "is-typedarray": "^1.0.0" - } - }, "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", @@ -1539,17 +1444,6 @@ "extsprintf": "^1.2.0" } }, - "web3-core": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.36.tgz", - "integrity": "sha512-C2QW9CMMRZdYAiKiLkMrKRSp+gekSqTDgZTNvlxAdN1hXn4d9UmcmWSJXOmIHqr5N2ISbRod+bW+qChODxVE3Q==", - "requires": { - "web3-core-helpers": "1.0.0-beta.36", - "web3-core-method": "1.0.0-beta.36", - "web3-core-requestmanager": "1.0.0-beta.36", - "web3-utils": "1.0.0-beta.36" - } - }, "web3-core-helpers": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", @@ -1567,112 +1461,6 @@ } } }, - "web3-core-method": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.36.tgz", - "integrity": "sha512-dJsP3KkGaqBBSdxfzvLsYPOmVaSs1lR/3oKob/gtUYG7UyTnwquwliAc7OXj+gqRA2E/FHZcM83cWdl31ltdSA==", - "requires": { - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.36", - "web3-core-promievent": "1.0.0-beta.36", - "web3-core-subscriptions": "1.0.0-beta.36", - "web3-utils": "1.0.0-beta.36" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } - }, - "web3-core-promievent": { - "version": "file:../web3-core-promievent", - "requires": { - "eventemitter3": "3.1.0" - }, - "dependencies": { - "eventemitter3": { - "version": "3.1.0", - "bundled": true - } - } - }, - "web3-core-requestmanager": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.36.tgz", - "integrity": "sha512-/CHuaMbiMDu1v8ANGYI7yFCnh1GaCWx5pKnUPJf+QTk2xAAw+Bvd97yZJIWPOK5AOPUIzxgwx9Ob/5ln6mTmYA==", - "requires": { - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.36", - "web3-providers-http": "1.0.0-beta.36", - "web3-providers-ipc": "1.0.0-beta.36", - "web3-providers-ws": "1.0.0-beta.36" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } - }, - "web3-core-subscriptions": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", - "integrity": "sha512-/evyLQ8CMEYXC5aUCodDpmEnmGVYQxaIjiEIfA/85f9ifHkfzP1aOwCAjcsLsJWnwrWDagxSpjCYrDtnNabdEw==", - "requires": { - "eventemitter3": "1.1.1", - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.36" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } - }, - "web3-eth-abi": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.36.tgz", - "integrity": "sha512-fBfW+7hvA0rxEMV45fO7JU+0R32ayT7aRwG9Cl6NW2/QvhFeME2qVbMIWw0q5MryPZGIN8A6366hKNuWvVidDg==", - "requires": { - "ethers": "4.0.0-beta.1", - "underscore": "1.8.3", - "web3-utils": "1.0.0-beta.36" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } - }, - "web3-eth-contract": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.36.tgz", - "integrity": "sha512-cywqcIrUsCW4fyqsHdOb24OCC8AnBol8kNiptI+IHRylyCjTNgr53bUbjrXWjmEnear90rO0QhAVjLB1a4iEbQ==", - "requires": { - "underscore": "1.8.3", - "web3-core": "1.0.0-beta.36", - "web3-core-helpers": "1.0.0-beta.36", - "web3-core-method": "1.0.0-beta.36", - "web3-core-promievent": "1.0.0-beta.36", - "web3-core-subscriptions": "1.0.0-beta.36", - "web3-eth-abi": "1.0.0-beta.36", - "web3-utils": "1.0.0-beta.36" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } - }, "web3-eth-iban": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", @@ -1682,49 +1470,6 @@ "web3-utils": "1.0.0-beta.36" } }, - "web3-providers-http": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.36.tgz", - "integrity": "sha512-KLSqMS59nRdpet9B0B64MKgtM3n9wAHTcAHJ03hv79avQNTjHxtjZm0ttcjcFUPpWDgTCtcYCa7tqaYo9Pbeog==", - "requires": { - "web3-core-helpers": "1.0.0-beta.36", - "xhr2-cookies": "1.1.0" - } - }, - "web3-providers-ipc": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.36.tgz", - "integrity": "sha512-iEUrmdd2CzoWgp+75/ydom/1IaoLw95qkAzsgwjjZp1waDncHP/cvVGX74+fbUx4hRaPdchyzxCQfNpgLDmNjQ==", - "requires": { - "oboe": "2.1.3", - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.36" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } - }, - "web3-providers-ws": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.36.tgz", - "integrity": "sha512-wAnENuZx75T5ZSrT2De2LOaUuPf2yRjq1VfcbD7+Zd79F3DZZLBJcPyCNVQ1U0fAXt0wfgCKl7sVw5pffqR9Bw==", - "requires": { - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.36", - "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } - }, "web3-utils": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", @@ -1746,26 +1491,6 @@ } } }, - "websocket": { - "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", - "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", - "requires": { - "debug": "^2.2.0", - "nan": "^2.3.3", - "typedarray-to-buffer": "^3.1.2", - "yaeti": "^0.0.6" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - } - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -1814,28 +1539,10 @@ "xhr-request": "^1.0.1" } }, - "xhr2-cookies": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", - "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", - "requires": { - "cookiejar": "^2.1.1" - } - }, - "xmlhttprequest": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", - "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" - }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - }, - "yaeti": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", - "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" } } } diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 32fef64fb91..c80fd6ac670 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -10,11 +10,14 @@ "test": "mocha './tests/**/*.js'" }, "dependencies": { + "eventemitter3": "^3.1.0", "underscore": "^1.9.1", "web3-core-helpers": "^1.0.0-beta.36", - "web3-core-promievent": "file:../web3-core-promievent", + "web3-core-promievent": "1.0.0-beta.36", "web3-core-providers": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36", + "web3-core-package": "1.0.0-beta.36", + "web3-eth-accounts": "1.0.0-beta.36", "web3-eth-contract": "1.0.0-beta.36" }, "devDependencies": { diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 7fb2f0e63c5..81cbb19b6cb 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -22,6 +22,7 @@ "use strict"; +var _ = require('underscore'); var AbstractSendMethodCommand = require('../../lib/commands/AbstractSendMethodCommand'); /** @@ -49,9 +50,49 @@ SendMethodCommand.prototype.constructor = SendMethodCommand; * @returns {PromiEvent} */ SendMethodCommand.prototype.execute = function (web3Package, methodModel, promiEvent) { + var self = this; + methodModel.beforeExecution(web3Package); - return this.send(methodModel, promiEvent, web3Package); + if (this.isGasPriceDefined(methodModel.parameters)) { + this.send(methodModel, promiEvent, web3Package); + + return promiEvent; + } + + this.getGasPrice(web3Package.currentProvider).then(function(gasPrice) { + if (_.isObject(methodModel.parameters[0])) { + methodModel.parameters[0].gasPrice = gasPrice; + } + + self.send(methodModel, promiEvent, web3Package); + }); + + return promiEvent; +}; + +/** + * Determines if gasPrice is defined in the method options + * + * @method isGasPriceDefined + * + * @param {Array} parameters + * + * @returns {Boolean} + */ +SendMethodCommand.prototype.isGasPriceDefined = function (parameters) { + return _.isObject(parameters[0]) && typeof parameters[0].gasPrice !== 'undefined'; +}; + +/** + * Returns the current gasPrice of the connected node + * + * @param {AbstractProviderAdapter | EthereumProvider} provider + * + * @returns {Promise} + */ +SendMethodCommand.prototype.getGasPrice = function (provider) { + return provider.send('eth_gasPrice', []); }; module.exports = SendMethodCommand; diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index 9648c92bd0b..554182b442d 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -57,6 +57,7 @@ SignAndSendMethodCommand.prototype.execute = function ( accounts, promiEvent, ) { + var self = this; methodModel.beforeExecution(web3Package); methodModel.rpcMethod = 'eth_sendRawTransaction'; @@ -65,7 +66,7 @@ SignAndSendMethodCommand.prototype.execute = function ( self.send(methodModel, promiEvent, web3Package); }).catch(function(error) { promiEvent.reject(error); - promiEvent.on('error', error); + promiEvent.eventEmitter.emit('error', error); promiEvent.eventEmitter.removeAllListeners(); if (methodModel.callback) { diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index b7bbe4261b6..250316d20d7 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -54,7 +54,7 @@ function MethodController( * @param {Accounts} accounts * @param {AbstractWeb3Object} web3Package * - * @returns {Promise|PromiEvent|String|Boolean} + * @returns {Promise|PromiEvent} */ MethodController.prototype.execute = function (methodModel, accounts, web3Package) { var promiEvent = this.promiEventPackage.createPromiEvent(); diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 519f2c8666f..148bc05b53c 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -58,13 +58,12 @@ function TransactionConfirmationWorkflow( */ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3Package, transactionHash, promiEvent) { var self = this; - this.provider = web3Package.currentProvider; - this.getTransactionReceipt(transactionHash).then(function (receipt) { + this.getTransactionReceipt(web3Package, transactionHash).then(function (receipt) { if (receipt && receipt.blockHash) { - var validationResult = this.transactionReceiptValidator.validate(receipt); + var validationResult = self.transactionReceiptValidator.validate(receipt); if (validationResult === true) { - this.handleSuccessState(receipt, methodModel, promiEvent); + self.handleSuccessState(receipt, methodModel, promiEvent); return; } @@ -123,13 +122,16 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3P * * @method execute * + * @param {AbstractWeb3Object} web3Package * @param {String} transactionHash * * @returns {Promise} */ -TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (transactionHash) { - return this.provider.send('eth_getTransactionReceipt', [transactionHash]).then(function (receipt) { - return this.formatters.outputTransactionReceiptFormatter(receipt); +TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (web3Package, transactionHash) { + var self = this; + + return web3Package.currentProvider.send('eth_getTransactionReceipt', [transactionHash]).then(function (receipt) { + return self.formatters.outputTransactionReceiptFormatter(receipt); }) }; diff --git a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js index 856ab3bfe4b..1a6e71c8330 100644 --- a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js @@ -25,8 +25,6 @@ describe('SendMethodCommandTest', function () { methodModelMock, promiEvent, promiEventMock, - promiEventEmitSpy, - promiEventRemoveListenersSpy, transactionConfirmationWorkflow, transactionConfirmationWorkflowMock; @@ -41,20 +39,12 @@ describe('SendMethodCommandTest', function () { web3PackageMock = sinon.mock(web3Package); methodModel = new AbstractMethodModel('', 0, {}, {}); - methodModelCallbackSpy = sinon.spy(); - methodModel.callback = methodModelCallbackSpy; methodModelMock = sinon.mock(methodModel); promiEvent = PromiEventPackage.createPromiEvent(); promiEventMock = sinon.mock(promiEvent); - promiEventEmitSpy = sinon.spy(); - promiEvent.eventEmitter.emit = promiEventEmitSpy; - - promiEventRemoveListenersSpy = sinon.spy(); - promiEvent.eventEmitter.removeAllListeners = promiEventRemoveListenersSpy; - - transactionConfirmationWorkflow = new TransactionConfirmationWorkflow({},{},{},{}); + transactionConfirmationWorkflow = new TransactionConfirmationWorkflow({}, {}, {}, {}); transactionConfirmationWorkflowMock = sinon.mock(transactionConfirmationWorkflow); sendMethodCommand = new SendMethodCommand(transactionConfirmationWorkflow); @@ -64,9 +54,9 @@ describe('SendMethodCommandTest', function () { sinon.restore(); }); - it('calls execute with gasPrice defined', async function () { + it('calls execute with gasPrice defined', function () { methodModel.parameters = [{gasPrice: 100}]; - methodModel.rpcMethod = 'eth_sendRawTransaction'; + methodModel.rpcMethod = 'eth_sendTransaction'; methodModelMock .expects('beforeExecution') @@ -88,25 +78,20 @@ describe('SendMethodCommandTest', function () { .withArgs(methodModel, web3Package, 'response', promiEvent) .once(); - - var returnedPromiEvent = await sendMethodCommand.execute(web3Package, methodModel, promiEvent); + var returnedPromiEvent = sendMethodCommand.execute(web3Package, methodModel, promiEvent); expect(returnedPromiEvent).equal(promiEvent); - expect(promiEventEmitSpy.calledOnce).to.be.true; - expect(promiEventEmitSpy.calledWith('transactionHash', 'response')).to.be.true; - - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith(false, 'response')).to.be.true; - - transactionConfirmationWorkflowMock.verify(); - providerAdapterMock.verify(); - methodModelMock.verify(); + promiEvent.eventEmitter.on('transactionHash', function () { + transactionConfirmationWorkflowMock.verify(); + providerAdapterMock.verify(); + methodModelMock.verify(); + }); }); it('calls execute without gasPrice defined', function () { methodModel.parameters = [{}]; - methodModel.rpcMethod = 'eth_sendRawTransaction'; + methodModel.rpcMethod = 'eth_sendTransaction'; methodModelMock .expects('beforeExecution') @@ -120,7 +105,8 @@ describe('SendMethodCommandTest', function () { function (resolve) { resolve(100); } - )).once(); + )) + .once(); providerAdapterMock .expects('send') @@ -129,7 +115,8 @@ describe('SendMethodCommandTest', function () { function (resolve) { resolve('response'); } - )).once(); + )) + .once(); transactionConfirmationWorkflowMock .expects('execute') @@ -140,24 +127,19 @@ describe('SendMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.eventEmitter.then(function () { + promiEvent.eventEmitter.on('transactionHash', function (response) { + expect(response).equal('response'); + expect(methodModel.parameters[0].gasPrice).equal(100); + transactionConfirmationWorkflowMock.verify(); providerAdapterMock.verify(); methodModelMock.verify(); - - expect(promiEventEmitSpy.calledOnce).to.be.true; - expect(promiEventEmitSpy.calledWith('transactionHash', 'response')).to.be.true; - - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith(false, 'response')).to.be.true; - expect(methodModel.parameters[0].gasPrice).equal(100); }); - }); it('calls execute and throws error', function () { methodModel.parameters = [{gasPrice: 100}]; - methodModel.rpcMethod = 'eth_sendRawTransaction'; + methodModel.rpcMethod = 'eth_sendTransaction'; methodModelMock .expects('beforeExecution') @@ -183,18 +165,12 @@ describe('SendMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.eventEmitter.catch(function (error) { - expect(promiEventRemoveListenersSpy.calledOnce).to.be.true; - expect(promiEventEmitSpy.calledOnce).to.be.true; - expect(promiEventEmitSpy.calledWith('error', 'error')).to.be.true; - - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith('error', null)).to.be.true; - + promiEvent.eventEmitter.on('error', function (error) { expect(error).equal('error'); providerAdapterMock.verify(); methodModelMock.verify(); + promiEventMock.verify(); }); }); }); diff --git a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js index c17f3b3a00f..7e5ab22a948 100644 --- a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js @@ -11,9 +11,9 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var PromiEventPackage = require('web3-core-promievent'); /** - * SendMethodCommand test + * SendAndSignMethodCommand test */ -describe('SendMethodCommandTest', function () { +describe('SendAndSignMethodCommandTest', function () { var signAndSendMethodCommand, provider, providerMock, @@ -71,7 +71,7 @@ describe('SendMethodCommandTest', function () { }); it('calls execute', function () { - methodModel.parameters = [{gasPrice: 100}]; + methodModel.parameters = []; methodModelMock .expects('beforeExecution') @@ -90,16 +90,7 @@ describe('SendMethodCommandTest', function () { providerAdapterMock .expects('send') - .withArgs('eth_gasPrice', []) - .returns(new Promise( - function (resolve) { - resolve(100); - } - )).once(); - - providerAdapterMock - .expects('send') - .withArgs(methodModel.rpcMethod, methodModel.parameters) + .withArgs('eth_sendRawTransaction', ['']) .returns(new Promise( function (resolve) { resolve('response'); @@ -111,7 +102,6 @@ describe('SendMethodCommandTest', function () { .withArgs(methodModel, web3Package, 'response', promiEvent) .once(); - var returnedPromiEvent = signAndSendMethodCommand.execute(methodModel, web3Package, {}, promiEvent); expect(returnedPromiEvent).equal(promiEvent); diff --git a/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js index 538dbe1db98..7dd77eb5316 100644 --- a/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js +++ b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js @@ -1,5 +1,4 @@ var chai = require('chai'); -var sinon = require('sinon').createSandbox(); var expect = chai.expect; var MethodPackageFactory = require('../../src/factories/MethodPackageFactory'); @@ -25,10 +24,6 @@ describe('MethodPackageFactoryTest', function () { methodPackageFactory = new MethodPackageFactory(); }); - afterEach(function () { - sinon.restore(); - }); - it('calls createMethodController and should return an instance of MethodController', function () { expect(methodPackageFactory.createMethodController({}, {}, {})).to.be.an.instanceof(MethodController); }); diff --git a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js new file mode 100644 index 00000000000..d6757552c52 --- /dev/null +++ b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js @@ -0,0 +1,134 @@ +var chai = require('chai'); +var sinon = require('sinon').createSandbox(); +var expect = chai.expect; + +var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +var ProvidersPackage = require('web3-core-providers'); +var PromiEventPackage = require('web3-core-promievent'); +var formatters = require('web3-core-helpers').formatters; +var TransactionConfirmationModel = require('../../src/models/TransactionConfirmationModel'); +var TransactionReceiptValidator = require('../../src/validators/TransactionReceiptValidator'); +var NewHeadsWatcher = require('../../src/watchers/NewHeadsWatcher'); +var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionConfirmationWorkflow'); + +/** + * TransactionConfirmationWorkflow test + */ +describe('TransactionConfirmationWorkflowTest', function () { + var transactionConfirmationWorkflow, + transactionConfirmationModel, + transactionConfirmationModelMock, + transactionReceiptValidator, + transactionReceiptValidatorMock, + newHeadsWatcher, + newHeadsWatcherMock, + formattersMock, + methodModel, + methodModelMock, + methodModelCallbackSpy, + provider, + providerMock, + providerAdapter, + providerAdapterMock, + web3Package, + web3PackageMock, + promiEvent, + promiEventMock; + + beforeEach(function () { + transactionConfirmationModel = new TransactionConfirmationModel(); + transactionConfirmationModelMock = sinon.mock(transactionConfirmationModel); + + transactionReceiptValidator = new TransactionReceiptValidator(); + transactionReceiptValidatorMock = sinon.mock(transactionReceiptValidator); + + newHeadsWatcher = new NewHeadsWatcher(); + newHeadsWatcherMock = sinon.mock(newHeadsWatcher); + + formattersMock = sinon.mock(formatters); + + methodModel = new AbstractMethodModel(); + methodModelCallbackSpy = sinon.spy(); + methodModel.callback = methodModelCallbackSpy; + methodModelMock = sinon.mock(methodModel); + + provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); + providerMock = sinon.mock(provider); + + providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); + providerAdapterMock = sinon.mock(providerAdapter); + + web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); + web3PackageMock = sinon.mock(web3Package); + + promiEvent = PromiEventPackage.createPromiEvent(); + promiEventMock = sinon.mock(promiEvent); + + transactionConfirmationWorkflow = new TransactionConfirmationWorkflow( + transactionConfirmationModel, + transactionReceiptValidator, + newHeadsWatcher, + formatters + ); + }); + + afterEach(function () { + sinon.restore(); + }); + + it('calls executes and receipt does already exists', function () { + providerAdapterMock + .expects('send') + .withArgs('eth_getTransactionReceipt', ['0x0']) + .returns(new Promise( + function (resolve) { + resolve({}); + } + )) + .once(); + + formattersMock + .expects('outputTransactionReceiptFormatter') + .withArgs({}) + .returns({blockHash: '0x0'}) + .once(); + + transactionReceiptValidatorMock + .expects('validate') + .withArgs({blockHash: '0x0'}) + .returns(true) + .once(); + + newHeadsWatcherMock + .expects('stop') + .once(); + + methodModelMock + .expects('afterExecution') + .withArgs({blockHash: '0x0'}) + .returns({blockHash: '0x00'}) + .once(); + + transactionConfirmationWorkflow.execute( + methodModel, + web3Package, + '0x0', + promiEvent + ); + + promiEvent.eventEmitter.on('receipt', function (receipt) { + expect(receipt).to.has.an.property('blockHash', '0x00'); + }).then(function (response) { + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith(false, {blockHash: '0x00'})); + expect(response).to.has.an.property('blockHash', '0x00'); + + providerMock.verify(); + formattersMock.verify(); + transactionReceiptValidatorMock.verify(); + newHeadsWatcherMock.verify(); + methodModelMock.verify(); + }); + }); +}); diff --git a/packages/web3-core-subscriptions/package.json b/packages/web3-core-subscriptions/package.json index a3c2a836b9b..4f3d8dc0407 100644 --- a/packages/web3-core-subscriptions/package.json +++ b/packages/web3-core-subscriptions/package.json @@ -7,7 +7,7 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "eventemitter3": "3.1.0", + "eventemitter3": "^3.1.0", "underscore": "1.9.1", "web3-core-helpers": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36" diff --git a/packages/web3-eth-accounts/package-lock.json b/packages/web3-eth-accounts/package-lock.json index 07f601f059d..03b9e5b8413 100644 --- a/packages/web3-eth-accounts/package-lock.json +++ b/packages/web3-eth-accounts/package-lock.json @@ -978,7 +978,7 @@ }, "query-string": { "version": "5.1.1", - "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", "requires": { "decode-uri-component": "^0.2.0", diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json index 1c4482dd747..809d625551d 100644 --- a/packages/web3-eth-accounts/package.json +++ b/packages/web3-eth-accounts/package.json @@ -8,14 +8,14 @@ "main": "src/index.js", "dependencies": { "crypto-browserify": "3.12.0", - "eth-lib": "0.2.8", + "eth-lib": "^0.2.8", "scrypt.js": "0.2.0", "underscore": "1.9.1", "uuid": "3.3.2", + "web3-core-helpers": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", - "web3-utils": "1.0.0-beta.36", + "web3-core-package": "1.0.0-beta.36", "web3-core-providers": "1.0.0-beta.36", - "web3-core-helpers": "1.0.0-beta.36", - "web3-core-package": "1.0.0-beta.36" + "web3-utils": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index 4b8e2d83351..f34fa6d7049 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -37,7 +37,7 @@ var AllEventsOptionsMapper = require('../mappers/AllEventsOptionsMapper'); var MethodsProxy = require('../proxies/MethodsProxy'); var EventSubscriptionsProxy = require('../proxies/EventSubscriptionsProxy'); var RpcMethodOptionsValidator = require('../validators/RpcMethodOptionsValidator'); -var RpcMethodFactory = require('../factories/RpcMethodFactory'); +var RpcMethodFactory = require('../factories/RpcMethodModelFactory'); var EventSubscriptionFactory = require('../factories/EventSubscriptionFactory'); /** From 67ada6cb1421f29ccdf005cf5a6fdd860a62027d Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 10:46:16 +0200 Subject: [PATCH 0249/1045] AbstractSendMethodCommand is not used the SignAndSendMethodCommand can directly inherit from the SendMethodCommand --- .../lib/commands/AbstractSendMethodCommand.js | 80 ------------------- .../src/commands/SendMethodCommand.js | 32 ++++++++ .../src/commands/SignAndSendMethodCommand.js | 6 +- 3 files changed, 35 insertions(+), 83 deletions(-) delete mode 100644 packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js diff --git a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js b/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js deleted file mode 100644 index ad8c33e2147..00000000000 --- a/packages/web3-core-method/lib/commands/AbstractSendMethodCommand.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - 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 . - */ -/** - * @file AbstractSendMethodCommand.js - * @author Samuel Furter - * @date 2018 - */ - -"use strict"; - -var _ = require('underscore'); - -/** - * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow - * - * @constructor - */ -function AbstractSendMethodCommand(transactionConfirmationWorkflow) { - this.transactionConfirmationWorkflow = transactionConfirmationWorkflow; -} - - -/** - * Sends the JSON-RPC request and executes the TransactionConfirmationWorkflow - * - * @method send - * - * @param {AbstractMethodModel} methodModel - * @param {AbstractWeb3Object} web3Package - * @param {PromiEvent} promiEvent - * - * @returns {PromiEvent} - */ -AbstractSendMethodCommand.prototype.send = function (methodModel, promiEvent, web3Package) { - var self = this; - - web3Package.currentProvider.send( - methodModel.rpcMethod, - methodModel.parameters - ).then(function (response) { - self.transactionConfirmationWorkflow.execute( - methodModel, - web3Package, - response, - promiEvent - ); - - promiEvent.eventEmitter.emit('transactionHash', response); - - if (methodModel.callback) { - methodModel.callback(false, response); - } - }).catch(function (error) { - promiEvent.reject(error); - promiEvent.eventEmitter.emit('error', error); - promiEvent.eventEmitter.removeAllListeners(); - - if (methodModel.callback) { - methodModel.callback(error, null); - } - }); - - return promiEvent; -}; - -module.exports = AbstractSendMethodCommand; diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 81cbb19b6cb..6c3466b9fcd 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -71,6 +71,38 @@ SendMethodCommand.prototype.execute = function (web3Package, methodModel, promiE return promiEvent; }; +SendMethodCommand.prototype.send = function (methodModel, promiEvent, web3Package) { + var self = this; + + web3Package.currentProvider.send( + methodModel.rpcMethod, + methodModel.parameters + ).then(function (response) { + self.transactionConfirmationWorkflow.execute( + methodModel, + web3Package, + response, + promiEvent + ); + + promiEvent.eventEmitter.emit('transactionHash', response); + + if (methodModel.callback) { + methodModel.callback(false, response); + } + }).catch(function (error) { + promiEvent.reject(error); + promiEvent.eventEmitter.emit('error', error); + promiEvent.eventEmitter.removeAllListeners(); + + if (methodModel.callback) { + methodModel.callback(error, null); + } + }); + + return promiEvent; +}; + /** * Determines if gasPrice is defined in the method options * diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index 554182b442d..951f78ab536 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractSendMethodCommand = require('../../lib/commands/AbstractSendMethodCommand'); +var SendMethodCommand = require('./SendMethodCommand'); /** * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow @@ -31,11 +31,11 @@ var AbstractSendMethodCommand = require('../../lib/commands/AbstractSendMethodCo * @constructor */ function SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSigner) { - AbstractSendMethodCommand.call(this, transactionConfirmationWorkflow); + SendMethodCommand.call(this, transactionConfirmationWorkflow); this.transactionSigner = transactionSigner; } -SignAndSendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); +SignAndSendMethodCommand.prototype = Object.create(SendMethodCommand.prototype); SignAndSendMethodCommand.prototype.constructor = SignAndSendMethodCommand; /** From 8c9f50de0f1faa5be419afdd7c2ba1862025c1bb Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 10:51:25 +0200 Subject: [PATCH 0250/1045] CodeStyle improvementes --- packages/web3-core-method/lib/models/AbstractMethodModel.js | 6 +++--- packages/web3-core-method/src/commands/CallMethodCommand.js | 2 +- packages/web3-core-method/src/commands/SendMethodCommand.js | 4 ++-- .../src/commands/SignAndSendMethodCommand.js | 1 + .../web3-core-method/src/controllers/MethodController.js | 6 +++--- .../src/models/TransactionConfirmationModel.js | 6 ------ packages/web3-core-method/src/watchers/NewHeadsWatcher.js | 2 +- 7 files changed, 11 insertions(+), 16 deletions(-) diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 20f49adcf46..57861dd20ab 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -127,7 +127,7 @@ AbstractMethodModel.prototype.mapFunctionArguments = function (args) { }; /** - * Determines if the JSON-RPC method is sign. + * Checks if the JSON-RPC method is sign. * * @method isSign * @@ -138,7 +138,7 @@ AbstractMethodModel.prototype.isSign = function () { }; /** - * Determines if the JSON-RPC method is sendTransaction + * Checks if the JSON-RPC method is sendTransaction * * @method isSendTransaction * @@ -149,7 +149,7 @@ AbstractMethodModel.prototype.isSendTransaction = function () { }; /** - * Determines if the JSON-RPC method is sendRawTransaction + * Checks if the JSON-RPC method is sendRawTransaction * * @method isSendRawTransaction * diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 089a808b3e6..7d0a9e551d9 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -36,7 +36,7 @@ function CallMethodCommand() { } * @param {AbstractMethodModel} methodModel * * @callback callback callback(error, result) - * @returns {Promise} + * @returns {Promise<*>} */ CallMethodCommand.prototype.execute = function (web3Package, methodModel) { methodModel.beforeExecution(web3Package); diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 6c3466b9fcd..316b0735ab4 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -38,7 +38,7 @@ SendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype) SendMethodCommand.prototype.constructor = SendMethodCommand; /** - * Determines if gasPrice is set, sends the request and returns a PromiEvent Object + * Checks if gasPrice is set, sends the request and returns a PromiEvent Object * * @method execute * @@ -104,7 +104,7 @@ SendMethodCommand.prototype.send = function (methodModel, promiEvent, web3Packag }; /** - * Determines if gasPrice is defined in the method options + * Checks if gasPrice is defined in the method options * * @method isGasPriceDefined * diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index 951f78ab536..e2759ece093 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -58,6 +58,7 @@ SignAndSendMethodCommand.prototype.execute = function ( promiEvent, ) { var self = this; + methodModel.beforeExecution(web3Package); methodModel.rpcMethod = 'eth_sendRawTransaction'; diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 250316d20d7..fea844683c9 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -46,7 +46,7 @@ function MethodController( } /** - * Determines which command should be executed + * Checks which command should be executed * * @method execute * @@ -54,7 +54,7 @@ function MethodController( * @param {Accounts} accounts * @param {AbstractWeb3Object} web3Package * - * @returns {Promise|PromiEvent} + * @returns {Promise<*>|PromiEvent} */ MethodController.prototype.execute = function (methodModel, accounts, web3Package) { var promiEvent = this.promiEventPackage.createPromiEvent(); @@ -93,7 +93,7 @@ MethodController.prototype.execute = function (methodModel, accounts, web3Packag }; /** - * Determines if accounts is defined and if wallet is not empty + * Checks if accounts is defined and if wallet is not empty * * @method hasWallet * diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index 5de6bcae976..d933023e023 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -29,8 +29,6 @@ function TransactionConfirmationModel() { /** * Defines accessors for POLLINGTIMEOUT. This is the average block time (seconds) * TIMEOUTBLOCK - * - * Created empty setter that it acts like a constant. */ Object.defineProperty(this, 'POLLINGTIMEOUT', { get: function () { @@ -42,8 +40,6 @@ function TransactionConfirmationModel() { /** * Defines accessors for TIMEOUTBLOCK - * - * Created empty setter that it acts like a constant. */ Object.defineProperty(this, 'TIMEOUTBLOCK', { get: function () { @@ -55,8 +51,6 @@ function TransactionConfirmationModel() { /** * Defines accessors for CONFIRMATIONBLOCKS - * - * Created empty setter that it acts like a constant. */ Object.defineProperty(this, 'CONFIRMATIONBLOCKS', { get: function () { diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index d19545674e1..26e35476806 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -45,7 +45,7 @@ NewHeadsWatcher.prototype.constructor = NewHeadsWatcher; * * @param {AbstractWeb3Object} web3Package * - * @returns {this} + * @returns {NewHeadsWatcher} */ NewHeadsWatcher.prototype.watch = function (web3Package) { var self = this; From 00f48ccbd466f5f29a513ad4fb61b6d937db3896 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 11:01:24 +0200 Subject: [PATCH 0251/1045] web3-core-providers renamed to web3-providers --- packages/web3-core-method/README.md | 2 +- packages/web3-core-method/package.json | 2 +- packages/web3-core-method/src/watchers/NewHeadsWatcher.js | 4 ++-- .../tests/commands/CallMethodCommandTest.js | 2 +- .../tests/commands/SendMethodCommandTest.js | 2 +- .../tests/commands/SignAndSendMethodCommandTest.js | 2 +- .../web3-core-method/tests/signers/MessageSignerTest.js | 2 +- .../web3-core-method/tests/signers/TransactionSignerTest.js | 2 +- .../web3-core-method/tests/watchers/NewHeadsWatcherTest.js | 2 +- .../tests/workflows/TransactionConfirmationWorkflowTest.js | 2 +- packages/web3-core-subscriptions/README.md | 2 +- packages/web3-eth-accounts/README.md | 2 +- packages/web3-eth-accounts/package.json | 2 +- packages/web3-eth-accounts/src/index.js | 2 +- packages/web3-eth-contract/README.md | 2 +- packages/web3-eth-contract/src/index.js | 2 +- packages/web3-eth-ens/README.md | 2 +- packages/web3-eth-personal/README.md | 2 +- packages/web3-eth-personal/package.json | 2 +- packages/web3-eth-personal/src/index.js | 2 +- packages/web3-eth/README.md | 2 +- packages/web3-eth/package.json | 2 +- packages/web3-eth/src/index.js | 2 +- packages/web3-net/README.md | 2 +- packages/web3-net/package.json | 2 +- packages/web3-net/src/index.js | 2 +- packages/{web3-core-providers => web3-providers}/README.md | 6 +++--- .../lib/adapters/AbstractProviderAdapter.js | 0 .../package-lock.json | 2 +- .../{web3-core-providers => web3-providers}/package.json | 2 +- .../src/adapters/HttpProviderAdapter.js | 0 .../src/adapters/InpageProviderAdapter.js | 0 .../src/adapters/SocketProviderAdapter.js | 0 .../src/batch-request/BatchRequest.js | 0 .../src/detectors/ProviderDetector.js | 0 .../src/factories/ProvidersPackageFactory.js | 0 .../{web3-core-providers => web3-providers}/src/index.js | 0 .../src/mappers/JSONRpcMapper.js | 0 .../src/providers/HttpProvider.js | 0 .../src/providers/IpcProvider.js | 0 .../src/providers/WebsocketProvider.js | 0 .../src/resolvers/ProviderAdapterResolver.js | 0 .../src/validators/JSONRpcResponseValidator.js | 0 packages/web3-shh/README.md | 2 +- packages/web3-shh/package.json | 2 +- packages/web3-shh/src/index.js | 2 +- packages/web3/package.json | 2 +- packages/web3/src/index.js | 2 +- 48 files changed, 37 insertions(+), 37 deletions(-) rename packages/{web3-core-providers => web3-providers}/README.md (77%) rename packages/{web3-core-providers => web3-providers}/lib/adapters/AbstractProviderAdapter.js (100%) rename packages/{web3-core-providers => web3-providers}/package-lock.json (99%) rename packages/{web3-core-providers => web3-providers}/package.json (94%) rename packages/{web3-core-providers => web3-providers}/src/adapters/HttpProviderAdapter.js (100%) rename packages/{web3-core-providers => web3-providers}/src/adapters/InpageProviderAdapter.js (100%) rename packages/{web3-core-providers => web3-providers}/src/adapters/SocketProviderAdapter.js (100%) rename packages/{web3-core-providers => web3-providers}/src/batch-request/BatchRequest.js (100%) rename packages/{web3-core-providers => web3-providers}/src/detectors/ProviderDetector.js (100%) rename packages/{web3-core-providers => web3-providers}/src/factories/ProvidersPackageFactory.js (100%) rename packages/{web3-core-providers => web3-providers}/src/index.js (100%) rename packages/{web3-core-providers => web3-providers}/src/mappers/JSONRpcMapper.js (100%) rename packages/{web3-core-providers => web3-providers}/src/providers/HttpProvider.js (100%) rename packages/{web3-core-providers => web3-providers}/src/providers/IpcProvider.js (100%) rename packages/{web3-core-providers => web3-providers}/src/providers/WebsocketProvider.js (100%) rename packages/{web3-core-providers => web3-providers}/src/resolvers/ProviderAdapterResolver.js (100%) rename packages/{web3-core-providers => web3-providers}/src/validators/JSONRpcResponseValidator.js (100%) diff --git a/packages/web3-core-method/README.md b/packages/web3-core-method/README.md index dc12346fca5..4157e005a9d 100644 --- a/packages/web3-core-method/README.md +++ b/packages/web3-core-method/README.md @@ -35,7 +35,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; var MethodPackage = require('web3-core-method'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); // Create an object/package like Eth /** diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index c80fd6ac670..4b4cad93bc8 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -14,7 +14,7 @@ "underscore": "^1.9.1", "web3-core-helpers": "^1.0.0-beta.36", "web3-core-promievent": "1.0.0-beta.36", - "web3-core-providers": "1.0.0-beta.36", + "web3-providers": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36", "web3-core-package": "1.0.0-beta.36", "web3-eth-accounts": "1.0.0-beta.36", diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 26e35476806..a4dbe5a95a1 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -20,7 +20,7 @@ * @date 2018 */ -var SocketProviderAdapter = require('web3-core-providers').SocketProviderAdapter; +var SocketProviderAdapter = require('web3-providers').SocketProviderAdapter; var EventEmitter = require('eventemitter3'); /** @@ -45,7 +45,7 @@ NewHeadsWatcher.prototype.constructor = NewHeadsWatcher; * * @param {AbstractWeb3Object} web3Package * - * @returns {NewHeadsWatcher} + * @returns {this} */ NewHeadsWatcher.prototype.watch = function (web3Package) { var self = this; diff --git a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js index e810bb3badf..bd2a442410a 100644 --- a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js @@ -4,7 +4,7 @@ var expect = chai.expect; var CallMethodCommand = require('../../src/commands/CallMethodCommand'); var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; /** diff --git a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js index 1a6e71c8330..6007f328507 100644 --- a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js @@ -5,7 +5,7 @@ var expect = chai.expect; var SendMethodCommand = require('../../src/commands/SendMethodCommand'); var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionConfirmationWorkflow'); var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var PromiEventPackage = require('web3-core-promievent'); diff --git a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js index 7e5ab22a948..1df975c4da8 100644 --- a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js @@ -6,7 +6,7 @@ var SignAndSendMethodCommand = require('../../src/commands/SignAndSendMethodComm var TransactionSigner = require('../../src/signers/TransactionSigner'); var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionConfirmationWorkflow'); var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var PromiEventPackage = require('web3-core-promievent'); diff --git a/packages/web3-core-method/tests/signers/MessageSignerTest.js b/packages/web3-core-method/tests/signers/MessageSignerTest.js index a2e8cffc823..ce5a6ab2835 100644 --- a/packages/web3-core-method/tests/signers/MessageSignerTest.js +++ b/packages/web3-core-method/tests/signers/MessageSignerTest.js @@ -2,7 +2,7 @@ var chai = require('chai'); var sinon = require('sinon').createSandbox(); var expect = chai.expect; -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var AccountsPackage = require('web3-eth-accounts'); var MessageSigner = require('../../src/signers/MessageSigner'); diff --git a/packages/web3-core-method/tests/signers/TransactionSignerTest.js b/packages/web3-core-method/tests/signers/TransactionSignerTest.js index fc10a4069bf..fb14174c597 100644 --- a/packages/web3-core-method/tests/signers/TransactionSignerTest.js +++ b/packages/web3-core-method/tests/signers/TransactionSignerTest.js @@ -2,7 +2,7 @@ var chai = require('chai'); var sinon = require('sinon').createSandbox(); var expect = chai.expect; -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var AccountsPackage = require('web3-eth-accounts'); var TransactionSigner = require('../../src/signers/TransactionSigner'); diff --git a/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js b/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js index 1b7dc57a897..6ea2ef689b1 100644 --- a/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js +++ b/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js @@ -4,7 +4,7 @@ var expect = chai.expect; var SubscriptionsPackage = require('web3-core-subscriptions'); var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var NewHeadsWatcher = require('../../src/watchers/NewHeadsWatcher'); /** diff --git a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js index d6757552c52..af591b7b1fa 100644 --- a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js +++ b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js @@ -4,7 +4,7 @@ var expect = chai.expect; var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var PromiEventPackage = require('web3-core-promievent'); var formatters = require('web3-core-helpers').formatters; var TransactionConfirmationModel = require('../../src/models/TransactionConfirmationModel'); diff --git a/packages/web3-core-subscriptions/README.md b/packages/web3-core-subscriptions/README.md index 4cb32187ce4..406aca867a9 100644 --- a/packages/web3-core-subscriptions/README.md +++ b/packages/web3-core-subscriptions/README.md @@ -29,7 +29,7 @@ This will expose the `Web3Subscriptions` object on the window object. // in node.js // Dependencies -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var SubscriptionsPackage = require('web3-core-subscriptions'); diff --git a/packages/web3-eth-accounts/README.md b/packages/web3-eth-accounts/README.md index 2552b9f99d6..6db91219146 100644 --- a/packages/web3-eth-accounts/README.md +++ b/packages/web3-eth-accounts/README.md @@ -29,7 +29,7 @@ This will expose the `Web3EthAccounts` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var AccountsPackage = require('web3-eth-accounts'); var accounts = AccountsPackage.createAccounts( diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json index 809d625551d..241f36adc6a 100644 --- a/packages/web3-eth-accounts/package.json +++ b/packages/web3-eth-accounts/package.json @@ -15,7 +15,7 @@ "web3-core-helpers": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", "web3-core-package": "1.0.0-beta.36", - "web3-core-providers": "1.0.0-beta.36", + "web3-providers": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index ede8a85af8d..73b6433bfec 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -25,7 +25,7 @@ var version = require('../package.json').version; var Accounts = require('./Accounts'); var MethodPackage = require('web3-core-method'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; var MethodModelFactory = require('./factories/MethodModelFactory'); diff --git a/packages/web3-eth-contract/README.md b/packages/web3-eth-contract/README.md index fc70a19284a..8f49115666d 100644 --- a/packages/web3-eth-contract/README.md +++ b/packages/web3-eth-contract/README.md @@ -29,7 +29,7 @@ This will expose the `Web3EthContract` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var AccountsPackage = require('web3-eth-accounts'); var ContractPackage = require('web3-eth-contract'); diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index b7571caefce..0b02746d86e 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -25,7 +25,7 @@ var version = require('../package.json').version; var PromiEventPackage = require('web3-core-promievent'); var MethodPackage = require('web3-core-method'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var ABIPackage = require('web3-eth-abi'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; diff --git a/packages/web3-eth-ens/README.md b/packages/web3-eth-ens/README.md index 6a524642552..2808d9cac59 100644 --- a/packages/web3-eth-ens/README.md +++ b/packages/web3-eth-ens/README.md @@ -27,7 +27,7 @@ This will expose the `EthEns` object on the window object. ## Usage ```js -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var NetPackage = require('web3-net'); var AccountsPackage = require('web3-eth-accounts'); var ENSPackage = require('web3-eth-ens'); diff --git a/packages/web3-eth-personal/README.md b/packages/web3-eth-personal/README.md index 302e02bef2a..74cef82c386 100644 --- a/packages/web3-eth-personal/README.md +++ b/packages/web3-eth-personal/README.md @@ -29,7 +29,7 @@ This will expose the `Web3EthPersonal` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var PersonalPackage = require('web3-eth-personal'); var personal = PersonalPackage.createPersonal(ProvidersPackage.resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-eth-personal/package.json b/packages/web3-eth-personal/package.json index 0bf3924c75b..2a0657bf640 100644 --- a/packages/web3-eth-personal/package.json +++ b/packages/web3-eth-personal/package.json @@ -9,7 +9,7 @@ "dependencies": { "web3-core-method": "1.0.0-beta.36", "web3-net": "1.0.0-beta.36", - "web3-core-providers": "1.0.0-beta.36", + "web3-providers": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", "web3-core-package": "1.0.0-beta.36" diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 7a556b84aef..32387e53f4b 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -26,7 +26,7 @@ var version = require('./package.json').version; var Personal = require('./Personal'); var MethodPackage = require('web3-core-method'); var NetworkPackage = require('web3-net'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; var MethodModelFactory = require('./factories/MethodModelFactory'); diff --git a/packages/web3-eth/README.md b/packages/web3-eth/README.md index 2f0b5f04561..148df3aebba 100644 --- a/packages/web3-eth/README.md +++ b/packages/web3-eth/README.md @@ -29,7 +29,7 @@ This will expose the `Web3Eth` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var EthPackage = require('web3-eth'); var eth = EthPackage.createEth( diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index 24aadd1093c..05f0d40632c 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -17,7 +17,7 @@ "web3-core-helpers": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", - "web3-core-providers": "1.0.0-beta.36", + "web3-providers": "1.0.0-beta.36", "web3-net": "1.0.0-beta.36", "web3-core-package": "1.0.0-beta.36" } diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index adad1c60b76..d87ec56726a 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -32,7 +32,7 @@ var PersonalPackage = require('web3-eth-personal'); var ENSPackage = require('web3-eth-ens'); var AbiPackage = require('web3-eth-abi'); var SubscriptionsPackage = require('web3-core-subscriptions'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var Iban = require('web3-eth-iban').Iban; var formatters = require('web3-core-helpers').formatters; var Utils = require('web3-utils'); diff --git a/packages/web3-net/README.md b/packages/web3-net/README.md index 01a05e994a5..e6f8d3e9a2b 100644 --- a/packages/web3-net/README.md +++ b/packages/web3-net/README.md @@ -29,7 +29,7 @@ This will expose the `Web3Net` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var NetworkPackage = require('web3-net'); var net = NetworkPackage.createNetwork(ProvidersPackage.resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-net/package.json b/packages/web3-net/package.json index 74c76dcacd0..2b77665849e 100644 --- a/packages/web3-net/package.json +++ b/packages/web3-net/package.json @@ -7,7 +7,7 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "web3-core-providers": "1.0.0-beta.36", + "web3-providers": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index 3d95854a7f7..ab0363017d9 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -24,7 +24,7 @@ "use strict"; var version = require('../package.json').version; -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var MethodPackage = require('web3-core-method'); var formatters = require('web3-core-helpers').formatters; var utils = require('web3-utils'); diff --git a/packages/web3-core-providers/README.md b/packages/web3-providers/README.md similarity index 77% rename from packages/web3-core-providers/README.md rename to packages/web3-providers/README.md index 0e3d0580d15..dc3e0d6c0f1 100644 --- a/packages/web3-core-providers/README.md +++ b/packages/web3-providers/README.md @@ -1,4 +1,4 @@ -# web3-core-providers +# web3-providers This is a sub package of [web3.js][repo] @@ -7,7 +7,7 @@ This is a sub package of [web3.js][repo] ### Node.js ```bash -npm install web3-core-providers +npm install web3-providers ``` ### In the Browser @@ -18,7 +18,7 @@ Build running the following in the [web3.js][repo] repository: npm run-script build-all ``` -Then include `dist/web3-core-providers.js` in your html file. +Then include `dist/web3-providers.js` in your html file. This will expose the `Web3Providers` object on the window object. diff --git a/packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js similarity index 100% rename from packages/web3-core-providers/lib/adapters/AbstractProviderAdapter.js rename to packages/web3-providers/lib/adapters/AbstractProviderAdapter.js diff --git a/packages/web3-core-providers/package-lock.json b/packages/web3-providers/package-lock.json similarity index 99% rename from packages/web3-core-providers/package-lock.json rename to packages/web3-providers/package-lock.json index 8fbc25180e9..0df8c41683b 100644 --- a/packages/web3-core-providers/package-lock.json +++ b/packages/web3-providers/package-lock.json @@ -1,5 +1,5 @@ { - "name": "web3-core-providers", + "name": "web3-providers", "version": "1.0.0-beta.36", "lockfileVersion": 1, "requires": true, diff --git a/packages/web3-core-providers/package.json b/packages/web3-providers/package.json similarity index 94% rename from packages/web3-core-providers/package.json rename to packages/web3-providers/package.json index 08c3b0e8338..fcfea7ef11f 100644 --- a/packages/web3-core-providers/package.json +++ b/packages/web3-providers/package.json @@ -1,5 +1,5 @@ { - "name": "web3-core-providers", + "name": "web3-providers", "namespace": "ethereum", "version": "1.0.0-beta.36", "description": "Web3 module to handle requests to external providers.", diff --git a/packages/web3-core-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-providers/src/adapters/HttpProviderAdapter.js similarity index 100% rename from packages/web3-core-providers/src/adapters/HttpProviderAdapter.js rename to packages/web3-providers/src/adapters/HttpProviderAdapter.js diff --git a/packages/web3-core-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-providers/src/adapters/InpageProviderAdapter.js similarity index 100% rename from packages/web3-core-providers/src/adapters/InpageProviderAdapter.js rename to packages/web3-providers/src/adapters/InpageProviderAdapter.js diff --git a/packages/web3-core-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-providers/src/adapters/SocketProviderAdapter.js similarity index 100% rename from packages/web3-core-providers/src/adapters/SocketProviderAdapter.js rename to packages/web3-providers/src/adapters/SocketProviderAdapter.js diff --git a/packages/web3-core-providers/src/batch-request/BatchRequest.js b/packages/web3-providers/src/batch-request/BatchRequest.js similarity index 100% rename from packages/web3-core-providers/src/batch-request/BatchRequest.js rename to packages/web3-providers/src/batch-request/BatchRequest.js diff --git a/packages/web3-core-providers/src/detectors/ProviderDetector.js b/packages/web3-providers/src/detectors/ProviderDetector.js similarity index 100% rename from packages/web3-core-providers/src/detectors/ProviderDetector.js rename to packages/web3-providers/src/detectors/ProviderDetector.js diff --git a/packages/web3-core-providers/src/factories/ProvidersPackageFactory.js b/packages/web3-providers/src/factories/ProvidersPackageFactory.js similarity index 100% rename from packages/web3-core-providers/src/factories/ProvidersPackageFactory.js rename to packages/web3-providers/src/factories/ProvidersPackageFactory.js diff --git a/packages/web3-core-providers/src/index.js b/packages/web3-providers/src/index.js similarity index 100% rename from packages/web3-core-providers/src/index.js rename to packages/web3-providers/src/index.js diff --git a/packages/web3-core-providers/src/mappers/JSONRpcMapper.js b/packages/web3-providers/src/mappers/JSONRpcMapper.js similarity index 100% rename from packages/web3-core-providers/src/mappers/JSONRpcMapper.js rename to packages/web3-providers/src/mappers/JSONRpcMapper.js diff --git a/packages/web3-core-providers/src/providers/HttpProvider.js b/packages/web3-providers/src/providers/HttpProvider.js similarity index 100% rename from packages/web3-core-providers/src/providers/HttpProvider.js rename to packages/web3-providers/src/providers/HttpProvider.js diff --git a/packages/web3-core-providers/src/providers/IpcProvider.js b/packages/web3-providers/src/providers/IpcProvider.js similarity index 100% rename from packages/web3-core-providers/src/providers/IpcProvider.js rename to packages/web3-providers/src/providers/IpcProvider.js diff --git a/packages/web3-core-providers/src/providers/WebsocketProvider.js b/packages/web3-providers/src/providers/WebsocketProvider.js similarity index 100% rename from packages/web3-core-providers/src/providers/WebsocketProvider.js rename to packages/web3-providers/src/providers/WebsocketProvider.js diff --git a/packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js similarity index 100% rename from packages/web3-core-providers/src/resolvers/ProviderAdapterResolver.js rename to packages/web3-providers/src/resolvers/ProviderAdapterResolver.js diff --git a/packages/web3-core-providers/src/validators/JSONRpcResponseValidator.js b/packages/web3-providers/src/validators/JSONRpcResponseValidator.js similarity index 100% rename from packages/web3-core-providers/src/validators/JSONRpcResponseValidator.js rename to packages/web3-providers/src/validators/JSONRpcResponseValidator.js diff --git a/packages/web3-shh/README.md b/packages/web3-shh/README.md index d36df1021f5..ba8a90c3f89 100644 --- a/packages/web3-shh/README.md +++ b/packages/web3-shh/README.md @@ -29,7 +29,7 @@ This will expose the `Web3Shh` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var ShhPackage = require('web3-shh'); var shh = ShhPackage.createShh(ProvidersPackage.resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-shh/package.json b/packages/web3-shh/package.json index 70453e297c3..cfddc3a4e9b 100644 --- a/packages/web3-shh/package.json +++ b/packages/web3-shh/package.json @@ -8,7 +8,7 @@ "main": "src/index.js", "dependencies": { "web3-core-method": "1.0.0-beta.36", - "web3-core-providers": "1.0.0-beta.36", + "web3-providers": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36", "web3-net": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index b466228ecc0..6705b6650fb 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -23,7 +23,7 @@ "use strict"; var version = require('./package.json'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var MethodPackage = require('web3-core-method'); var SubscriptionsPackage = require('web3-core-subscriptions'); var NetworkPackage = require('web3-net'); diff --git a/packages/web3/package.json b/packages/web3/package.json index fa667803d14..794d93642ae 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -53,7 +53,7 @@ "web3-shh": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", "web3-net": "1.0.0-beta.36", - "web3-core-providers": "1.0.0-beta.36", + "web3-providers": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", "web3-core-package": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36" diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 9567c9f0885..9448a559289 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -25,7 +25,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; var formatters = require('web3-core-helpers').formatters; var MethodPackage = require('web3-core-method'); -var ProvidersPackage = require('web3-core-providers'); +var ProvidersPackage = require('web3-providers'); var EthPackage = require('web3-eth'); var PersonalPackage = require('web3-eth-personal'); var Utils = require('web3-utils'); From 841856cf4f8547098cc6e26dc812b870f659d0d2 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 11:22:45 +0200 Subject: [PATCH 0252/1045] web3-core-package renamed to web3-core, AbstractWeb3Object renamed to AbstractWeb3Module, web3Object parameter name changed to moduleInstance and funcDocs updated --- gulpfile.js | 8 ++--- packages/web3-core-helpers/src/formatters.js | 18 +++++------ packages/web3-core-method/README.md | 8 ++--- .../lib/models/AbstractMethodModel.js | 4 +-- packages/web3-core-method/package.json | 2 +- .../src/commands/CallMethodCommand.js | 8 ++--- .../src/commands/SendMethodCommand.js | 18 +++++------ .../src/commands/SignAndSendMethodCommand.js | 8 ++--- .../src/commands/SignMessageCommand.js | 6 ++-- .../src/controllers/MethodController.js | 12 ++++---- .../src/models/methods/CallMethodModel.js | 8 ++--- .../models/methods/EstimateGasMethodModel.js | 6 ++-- .../src/models/methods/GetCodeMethodModel.js | 6 ++-- .../models/methods/GetPastLogsMethodModel.js | 4 +-- .../models/methods/GetStorageAtMethodModel.js | 6 ++-- .../src/models/methods/SignMethodModel.js | 4 +-- .../methods/account/GetBalanceMethodModel.js | 6 ++-- .../account/GetTransactionCountMethodModel.js | 6 ++-- .../methods/block/GetBlockMethodModel.js | 4 +-- .../GetBlockTransactionCountMethodModel.js | 4 +-- .../block/GetBlockUncleCountMethodModel.js | 4 +-- .../methods/block/GetUncleMethodModel.js | 4 +-- .../methods/personal/EcRecoverMethodModel.js | 4 +-- .../personal/LockAccountMethodModel.js | 4 +-- .../PersonalSendTransactionMethodModel.js | 6 ++-- .../personal/PersonalSignMethodModel.js | 4 +-- .../PersonalSignTransactionMethodModel.js | 6 ++-- .../personal/UnlockAccountMethodModel.js | 4 +-- .../GetTransactionFromBlockMethodModel.js | 4 +-- .../transaction/SendTransactionMethodModel.js | 6 ++-- .../transaction/SignTransactionMethodModel.js | 6 ++-- .../src/watchers/NewHeadsWatcher.js | 8 ++--- .../TransactionConfirmationWorkflow.js | 14 ++++----- .../tests/commands/CallMethodCommandTest.js | 14 ++++----- .../tests/commands/SendMethodCommandTest.js | 26 ++++++++-------- .../commands/SignAndSendMethodCommandTest.js | 20 ++++++------- .../tests/watchers/NewHeadsWatcherTest.js | 22 +++++++------- .../TransactionConfirmationWorkflowTest.js | 12 ++++---- packages/web3-core-subscriptions/README.md | 10 +++---- .../lib/models/AbstractSubscriptionModel.js | 4 +-- .../src/Subscription.js | 22 +++++++------- .../src/factories/SubscriptionsFactory.js | 30 +++++++++---------- .../subscriptions/eth/LogSubscriptionModel.js | 8 ++--- .../README.md | 18 +++++------ .../package-lock.json | 2 +- .../package.json | 2 +- .../src/AbstractWeb3Module.js} | 22 +++++++------- .../src/index.js | 4 +-- packages/web3-eth-accounts/package.json | 2 +- packages/web3-eth-accounts/src/Accounts.js | 6 ++-- packages/web3-eth-contract/package.json | 2 +- packages/web3-eth-contract/src/Contract.js | 8 ++--- .../src/factories/EventSubscriptionFactory.js | 12 ++++---- packages/web3-eth-personal/package.json | 2 +- packages/web3-eth-personal/src/Personal.js | 10 +++---- packages/web3-eth/package.json | 2 +- packages/web3-eth/src/Eth.js | 10 +++---- packages/web3-net/package.json | 4 +-- packages/web3-net/src/Network.js | 6 ++-- packages/web3-shh/src/Shh.js | 10 +++---- packages/web3/package.json | 2 +- packages/web3/src/index.js | 8 ++--- 62 files changed, 260 insertions(+), 260 deletions(-) rename packages/{web3-core-package => web3-core}/README.md (83%) rename packages/{web3-core-package => web3-core}/package-lock.json (92%) rename packages/{web3-core-package => web3-core}/package.json (91%) rename packages/{web3-core-package/src/AbstractWeb3Object.js => web3-core/src/AbstractWeb3Module.js} (93%) rename packages/{web3-core-package => web3-core}/src/index.js (89%) diff --git a/gulpfile.js b/gulpfile.js index a5ac20b3b67..3823cf35bc8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -67,9 +67,9 @@ var packages = [{ expose: 'Web3Bzz', src: './packages/web3-bzz/src/index.js' }, { - fileName: 'web3-core-providers', + fileName: 'web3-providers', expose: 'Web3Providers', - src: './packages/web3-core-providers/src/index.js' + src: './packages/web3-providers/src/index.js' }, { fileName: 'web3-core-subscriptions', expose: 'Web3Subscription', @@ -83,9 +83,9 @@ var packages = [{ expose: 'Web3Method', src: './packages/web3-core-method/src/index.js' }, { - fileName: 'web3-core-package', + fileName: 'web3-core', expose: 'Web3Package', - src: './packages/web3-core-package/src/index.js' + src: './packages/web3-core/src/index.js' }, { fileName: 'web3-net', expose: 'Web3Net', diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index 08ec3199aa2..914a616cf9f 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -48,13 +48,13 @@ var isPredefinedBlockNumber = function (blockNumber) { * will map 'genesis' and 'earlist' to '0x0' and runs the inputBlockNumberFormatter. * * @param {String|Number} blockNumber - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * * @returns {String} */ -var inputDefaultBlockNumberFormatter = function (blockNumber, web3Package) { +var inputDefaultBlockNumberFormatter = function (blockNumber, moduleInstance) { if (blockNumber === undefined || blockNumber === null) { - return web3Package.defaultBlock; + return moduleInstance.defaultBlock; } if (blockNumber === 'genesis' || blockNumber === 'earliest') { @@ -119,13 +119,13 @@ var _txInputFormatter = function (options){ * @method inputCallFormatter * * @param {Object} options - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * * @returns object */ -var inputCallFormatter = function (options, web3Package){ +var inputCallFormatter = function (options, moduleInstance){ options = _txInputFormatter(options); - var from = web3Package.defaultAccount; + var from = moduleInstance.defaultAccount; if (options.from) { from = options.from @@ -144,16 +144,16 @@ var inputCallFormatter = function (options, web3Package){ * @method inputTransactionFormatter * * @param {Object} options - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * * @returns object */ -var inputTransactionFormatter = function (options, web3Package) { +var inputTransactionFormatter = function (options, moduleInstance) { options = _txInputFormatter(options); if (!_.isNumber(options.from) && !_.isObject(options.from)) { if (!options.from) { - options.from = web3Package.defaultAccount; + options.from = moduleInstance.defaultAccount; } if (!options.from && !_.isNumber(options.from)) { diff --git a/packages/web3-core-method/README.md b/packages/web3-core-method/README.md index 4157e005a9d..2fe4c29f093 100644 --- a/packages/web3-core-method/README.md +++ b/packages/web3-core-method/README.md @@ -31,7 +31,7 @@ This will expose the `Web3Method` object on the window object. // in node.js // Dependencies -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-package').AbstractWeb3Module; var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; var MethodPackage = require('web3-core-method'); @@ -52,7 +52,7 @@ function MyObject ( methodController, methodModelFactory ) { - AbstractWeb3Object.call( + AbstractWeb3Module.call( this, provider, providersPackage, @@ -61,8 +61,8 @@ function MyObject ( ); }; -// Inherit from AbstractWeb3Object -MyObject.prototype = Object.create(AbstractWeb3Object.prototype); +// Inherit from AbstractWeb3Module +MyObject.prototype = Object.create(AbstractWeb3Module.prototype); MyObject.prototype.constructor = MyObject; diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 57861dd20ab..53468d31c3e 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -61,9 +61,9 @@ function AbstractMethodModel(rpcMethod, parametersAmount, utils, formatters) { * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -AbstractMethodModel.prototype.beforeExecution = function(web3Package) { }; +AbstractMethodModel.prototype.beforeExecution = function(moduleInstance) { }; /** * This method will be executed after the RPC request. diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 4b4cad93bc8..cf6d94c688f 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -15,8 +15,8 @@ "web3-core-helpers": "^1.0.0-beta.36", "web3-core-promievent": "1.0.0-beta.36", "web3-providers": "1.0.0-beta.36", + "web3-core": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36", - "web3-core-package": "1.0.0-beta.36", "web3-eth-accounts": "1.0.0-beta.36", "web3-eth-contract": "1.0.0-beta.36" }, diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 7d0a9e551d9..94ec6d24203 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -32,16 +32,16 @@ function CallMethodCommand() { } * * @method execute * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {AbstractMethodModel} methodModel * * @callback callback callback(error, result) * @returns {Promise<*>} */ -CallMethodCommand.prototype.execute = function (web3Package, methodModel) { - methodModel.beforeExecution(web3Package); +CallMethodCommand.prototype.execute = function (moduleInstance, methodModel) { + methodModel.beforeExecution(moduleInstance); - return web3Package.currentProvider.send( + return moduleInstance.currentProvider.send( methodModel.rpcMethod, methodModel.parameters ).then(function (response) { diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 316b0735ab4..576c31448d3 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -42,45 +42,45 @@ SendMethodCommand.prototype.constructor = SendMethodCommand; * * @method execute * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {AbstractMethodModel} methodModel * @param {PromiEvent} promiEvent * * @callback callback callback(error, result) * @returns {PromiEvent} */ -SendMethodCommand.prototype.execute = function (web3Package, methodModel, promiEvent) { +SendMethodCommand.prototype.execute = function (moduleInstance, methodModel, promiEvent) { var self = this; - methodModel.beforeExecution(web3Package); + methodModel.beforeExecution(moduleInstance); if (this.isGasPriceDefined(methodModel.parameters)) { - this.send(methodModel, promiEvent, web3Package); + this.send(methodModel, promiEvent, moduleInstance); return promiEvent; } - this.getGasPrice(web3Package.currentProvider).then(function(gasPrice) { + this.getGasPrice(moduleInstance.currentProvider).then(function(gasPrice) { if (_.isObject(methodModel.parameters[0])) { methodModel.parameters[0].gasPrice = gasPrice; } - self.send(methodModel, promiEvent, web3Package); + self.send(methodModel, promiEvent, moduleInstance); }); return promiEvent; }; -SendMethodCommand.prototype.send = function (methodModel, promiEvent, web3Package) { +SendMethodCommand.prototype.send = function (methodModel, promiEvent, moduleInstance) { var self = this; - web3Package.currentProvider.send( + moduleInstance.currentProvider.send( methodModel.rpcMethod, methodModel.parameters ).then(function (response) { self.transactionConfirmationWorkflow.execute( methodModel, - web3Package, + moduleInstance, response, promiEvent ); diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index e2759ece093..fa73989b6c7 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -43,7 +43,7 @@ SignAndSendMethodCommand.prototype.constructor = SignAndSendMethodCommand; * * @method execute * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {AbstractMethodModel} methodModel * @param {Accounts} accounts * @param {PromiEvent} promiEvent @@ -53,18 +53,18 @@ SignAndSendMethodCommand.prototype.constructor = SignAndSendMethodCommand; */ SignAndSendMethodCommand.prototype.execute = function ( methodModel, - web3Package, + moduleInstance, accounts, promiEvent, ) { var self = this; - methodModel.beforeExecution(web3Package); + methodModel.beforeExecution(moduleInstance); methodModel.rpcMethod = 'eth_sendRawTransaction'; this.transactionSigner.sign(methodModel.parameters[0], accounts).then(function(response) { methodModel.parameters = [response.rawTransaction]; - self.send(methodModel, promiEvent, web3Package); + self.send(methodModel, promiEvent, moduleInstance); }).catch(function(error) { promiEvent.reject(error); promiEvent.eventEmitter.emit('error', error); diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js index 36f9254f07e..2caaca2bad0 100644 --- a/packages/web3-core-method/src/commands/SignMessageCommand.js +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -34,17 +34,17 @@ function SignMessageCommand(messageSigner) { /** * Executes the SignMessageCommand and returns the signed message * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {AbstractMethodModel} methodModel * @param {Accounts} accounts * * @callback callback callback(error, result) * @returns {String} */ -SignMessageCommand.prototype.execute = function (web3Package, methodModel, accounts) { +SignMessageCommand.prototype.execute = function (moduleInstance, methodModel, accounts) { var signedMessage; - methodModel.beforeExecution(web3Package); + methodModel.beforeExecution(moduleInstance); try { signedMessage = methodModel.afterExecution( diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index fea844683c9..686b4b688b6 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -52,17 +52,17 @@ function MethodController( * * @param {AbstractMethodModel} methodModel * @param {Accounts} accounts - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * * @returns {Promise<*>|PromiEvent} */ -MethodController.prototype.execute = function (methodModel, accounts, web3Package) { +MethodController.prototype.execute = function (methodModel, accounts, moduleInstance) { var promiEvent = this.promiEventPackage.createPromiEvent(); if (this.hasWallets(accounts)) { if (methodModel.isSign()) { return this.signMessageCommand.execute( - web3Package, + moduleInstance, methodModel, accounts, ); @@ -71,7 +71,7 @@ MethodController.prototype.execute = function (methodModel, accounts, web3Packag if (methodModel.isSendTransaction()) { return this.signAndSendMethodCommand.execute( methodModel, - web3Package, + moduleInstance, accounts, promiEvent, ); @@ -80,14 +80,14 @@ MethodController.prototype.execute = function (methodModel, accounts, web3Packag if (methodModel.isSendTransaction() || methodModel.isSendRawTransaction()) { return this.sendMethodCommand.execute( - web3Package, + moduleInstance, methodModel, promiEvent ); } return this.callMethodCommand.execute( - web3Package, + moduleInstance, methodModel, ); }; diff --git a/packages/web3-core-method/src/models/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js index 34ebd363f39..f5ed2641e92 100644 --- a/packages/web3-core-method/src/models/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -42,11 +42,11 @@ CallMethodModel.prototype.constructor = CallMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -CallMethodModel.prototype.beforeExecution = function (web3Package) { - this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], web3Package); - this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); +CallMethodModel.prototype.beforeExecution = function (moduleInstance) { + this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], moduleInstance); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); }; module.exports = CallMethodModel; diff --git a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index 4db3c072eb3..d82c518bca3 100644 --- a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -42,10 +42,10 @@ EstimateGasMethodModel.prototype.constructor = EstimateGasMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -EstimateGasMethodModel.prototype.beforeExecution = function (web3Package) { - this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], web3Package); +EstimateGasMethodModel.prototype.beforeExecution = function (moduleInstance) { + this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], moduleInstance); }; /** diff --git a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index 8f6e9bd8058..56381e73fef 100644 --- a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -42,11 +42,11 @@ GetCodeMethodModel.prototype.constructor = GetCodeMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -GetCodeMethodModel.prototype.beforeExecution = function (web3Package) { +GetCodeMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); - this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); }; module.exports = GetCodeMethodModel; diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index f84ee55fdb3..8e9cc601730 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -42,9 +42,9 @@ GetPastLogsMethodModel.prototype.constructor = GetPastLogsMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -GetPastLogsMethodModel.prototype.beforeExecution = function (web3Package) { +GetPastLogsMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputLogFormatter(this.parameters[0]); }; diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index 5c785853fca..c512033620d 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -42,12 +42,12 @@ GetStorageAtMethodModel.prototype.constructor = GetStorageAtMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -GetStorageAtMethodModel.prototype.beforeExecution = function (web3Package) { +GetStorageAtMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); this.parameters[1] = this.utils.numberToHex(this.parameters[1]); - this.parameters[2] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2], web3Package); + this.parameters[2] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2], moduleInstance); }; module.exports = GetStorageAtMethodModel; diff --git a/packages/web3-core-method/src/models/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js index ed24694104b..6defee31446 100644 --- a/packages/web3-core-method/src/models/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -44,9 +44,9 @@ SignMethodModel.prototype.constructor = SignMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -SignMethodModel.prototype.beforeExecution = function (web3Package) { +SignMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); }; diff --git a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index faf83b20350..63e0c4400d9 100644 --- a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -42,11 +42,11 @@ GetBalanceMethodModel.prototype.constructor = GetBalanceMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -GetBalanceMethodModel.prototype.beforeExecution = function (web3Package) { +GetBalanceMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); - this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); }; /** diff --git a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index 6a11ce6bf8e..be0e8aecd5e 100644 --- a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -42,11 +42,11 @@ GetTransactionCountMethodModel.prototype.constructor = GetTransactionCountMethod * * @method beforeExecution * - * @param {Object} web3Package + * @param {AbstractWeb3Module} moduleInstance */ -GetTransactionCountMethodModel.prototype.beforeExecution = function (web3Package) { +GetTransactionCountMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); - this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], web3Package); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); }; /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index a162ceb79eb..84598dcbf9b 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -42,9 +42,9 @@ GetBlockMethodModel.prototype.constructor = GetBlockMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -GetBlockMethodModel.prototype.beforeExecution = function (web3Package) { +GetBlockMethodModel.prototype.beforeExecution = function (moduleInstance) { if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getBlockByHash'; } diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index 01d0f19afe2..423289545f1 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -42,9 +42,9 @@ GetBlockTransactionCountMethodModel.prototype.constructor = GetBlockTransactionC * * @method beforeExecution * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance */ -GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (web3Package) { +GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (moduleInstance) { if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index 2d91d57a97c..591d6861291 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -42,9 +42,9 @@ GetBlockUncleCountMethodModel.prototype.constructor = GetBlockUncleCountMethodMo * * @method beforeExecution * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance */ -GetBlockUncleCountMethodModel.prototype.beforeExecution = function (web3Package) { +GetBlockUncleCountMethodModel.prototype.beforeExecution = function (moduleInstance) { if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getUncleCountByBlockHash'; } diff --git a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index 2fed42b5e42..255809fa4e9 100644 --- a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -42,9 +42,9 @@ GetUncleMethodModel.prototype.constructor = GetUncleMethodModel; * * @method beforeExecution * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance */ -GetUncleMethodModel.prototype.beforeExecution = function (web3Package) { +GetUncleMethodModel.prototype.beforeExecution = function (moduleInstance) { if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getUncleByBlockHashAndIndex'; } diff --git a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index b6f238b6404..37bcc194f39 100644 --- a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -42,9 +42,9 @@ EcRecoverMethodModel.prototype.constructor = EcRecoverMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -EcRecoverMethodModel.prototype.beforeExecution = function (web3Package) { +EcRecoverMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); }; diff --git a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index dbe274c016a..054585509e2 100644 --- a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -42,9 +42,9 @@ LockAccountMethodModel.prototype.constructor = LockAccountMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -LockAccountMethodModel.prototype.beforeExecution = function (web3Package) { +LockAccountMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); }; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index 521ed2b97c1..6399c03cf69 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -42,10 +42,10 @@ PersonalSendTransactionMethodModel.prototype.constructor = PersonalSendTransacti * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -PersonalSendTransactionMethodModel.prototype.beforeExecution = function (web3Package) { - this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); +PersonalSendTransactionMethodModel.prototype.beforeExecution = function (moduleInstance) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); }; module.exports = PersonalSendTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index 8d22d292309..93c2d047e7d 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -42,9 +42,9 @@ PersonalSignMethodModel.prototype.constructor = PersonalSignMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -PersonalSignMethodModel.prototype.beforeExecution = function (web3Package) { +PersonalSignMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); }; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js index 76d7c40c44b..d01719fa75d 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js @@ -39,10 +39,10 @@ function PersonalSignTransactionMethodModel(utils, formatters) { * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -PersonalSignTransactionMethodModel.prototype.beforeExecution = function (web3Package) { - this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); +PersonalSignTransactionMethodModel.prototype.beforeExecution = function (moduleInstance) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); }; PersonalSignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); diff --git a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index af07a390d7a..a51865f76ce 100644 --- a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -42,9 +42,9 @@ UnlockAccountMethodModel.prototype.constructor = UnlockAccountMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -UnlockAccountMethodModel.prototype.beforeExecution = function (web3Package) { +UnlockAccountMethodModel.prototype.beforeExecution = function (moduleInstance) { this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); }; diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index abca5433998..fdaa3bd1acf 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -42,9 +42,9 @@ GetTransactionFromBlockMethodModel.prototype.constructor = GetTransactionFromBlo * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (web3Package) { +GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (moduleInstance) { if (this.isHash(this.parameters[0])) { this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; } diff --git a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index cad7576af36..3bd62623b81 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -44,10 +44,10 @@ SendTransactionMethodModel.prototype.constructor = SendTransactionMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from for example Eth. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ -SendTransactionMethodModel.prototype.beforeExecution = function (web3Package) { - this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); +SendTransactionMethodModel.prototype.beforeExecution = function (moduleInstance) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); }; module.exports = SendTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index baec6a43afa..a583b01b7b1 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -42,10 +42,10 @@ SignTransactionMethodModel.prototype.constructor = SignTransactionMethodModel; * * @method beforeExecution * - * @param {Object} web3Package - The package where the method is called from. + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from. */ -SignTransactionMethodModel.prototype.beforeExecution = function (web3Package) { - this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], web3Package); +SignTransactionMethodModel.prototype.beforeExecution = function (moduleInstance) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); }; module.exports = SignTransactionMethodModel; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index a4dbe5a95a1..20700097c61 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -43,16 +43,16 @@ NewHeadsWatcher.prototype.constructor = NewHeadsWatcher; * * @method watch * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * * @returns {this} */ -NewHeadsWatcher.prototype.watch = function (web3Package) { +NewHeadsWatcher.prototype.watch = function (moduleInstance) { var self = this; - if (web3Package.currentProvider instanceof SocketProviderAdapter) { + if (moduleInstance.currentProvider instanceof SocketProviderAdapter) { this.confirmationSubscription = this.subscriptionsFactory - .createNewHeadsSubscription(web3Package) + .createNewHeadsSubscription(moduleInstance) .subscribe(function () { self.emit('newHead'); }); diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 148bc05b53c..4ff53a6edbc 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -50,16 +50,16 @@ function TransactionConfirmationWorkflow( * @method execute * * @param {AbstractMethodModel} methodModel - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {String} transactionHash * @param {Object} promiEvent * * @callback callback callback(error, result) */ -TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3Package, transactionHash, promiEvent) { +TransactionConfirmationWorkflow.prototype.execute = function (methodModel, moduleInstance, transactionHash, promiEvent) { var self = this; - this.getTransactionReceipt(web3Package, transactionHash).then(function (receipt) { + this.getTransactionReceipt(moduleInstance, transactionHash).then(function (receipt) { if (receipt && receipt.blockHash) { var validationResult = self.transactionReceiptValidator.validate(receipt); if (validationResult === true) { @@ -73,7 +73,7 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3P return; } - self.newHeadsWatcher.watch(web3Package).on('newHead', function () { + self.newHeadsWatcher.watch(moduleInstance).on('newHead', function () { self.transactionConfirmationModel.timeoutCounter++; if (!self.transactionConfirmationModel.isTimeoutTimeExceeded()) { self.getTransactionReceipt(transactionHash).then(function (receipt) { @@ -122,15 +122,15 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, web3P * * @method execute * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {String} transactionHash * * @returns {Promise} */ -TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (web3Package, transactionHash) { +TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (moduleInstance, transactionHash) { var self = this; - return web3Package.currentProvider.send('eth_getTransactionReceipt', [transactionHash]).then(function (receipt) { + return moduleInstance.currentProvider.send('eth_getTransactionReceipt', [transactionHash]).then(function (receipt) { return self.formatters.outputTransactionReceiptFormatter(receipt); }) }; diff --git a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js index bd2a442410a..2898bf8cbaf 100644 --- a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js @@ -5,7 +5,7 @@ var expect = chai.expect; var CallMethodCommand = require('../../src/commands/CallMethodCommand'); var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); var ProvidersPackage = require('web3-providers'); -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; /** * CallMethodCommand test @@ -16,7 +16,7 @@ describe('CallMethodCommandTest', function () { providerMock, providerAdapter, providerAdapterMock, - web3Package, + moduleInstance, methodModel, methodModelCallbackSpy, methodModelMock; @@ -28,7 +28,7 @@ describe('CallMethodCommandTest', function () { providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); providerAdapterMock = sinon.mock(providerAdapter); - web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); + moduleInstance = new AbstractWeb3Module(providerAdapter, ProvidersPackage, null, null); methodModel = new AbstractMethodModel('', 0, {}, {}); methodModelCallbackSpy = sinon.spy(); @@ -45,7 +45,7 @@ describe('CallMethodCommandTest', function () { it('calls execute', async function () { methodModelMock .expects('beforeExecution') - .withArgs(web3Package) + .withArgs(moduleInstance) .once(); providerAdapterMock @@ -63,7 +63,7 @@ describe('CallMethodCommandTest', function () { .returns('0x0') .once(); - var returnValue = await callMethodCommand.execute(web3Package, methodModel); + var returnValue = await callMethodCommand.execute(moduleInstance, methodModel); expect(returnValue).to.equal('0x0'); expect(methodModelCallbackSpy.calledOnce).to.be.true; @@ -76,7 +76,7 @@ describe('CallMethodCommandTest', function () { it('calls execute and throws error', async function () { methodModelMock .expects('beforeExecution') - .withArgs(web3Package) + .withArgs(moduleInstance) .once(); providerAdapterMock @@ -89,7 +89,7 @@ describe('CallMethodCommandTest', function () { .once(); try { - await callMethodCommand.execute(web3Package, methodModel); + await callMethodCommand.execute(moduleInstance, methodModel); } catch (error) { expect(error).to.equal('error'); } diff --git a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js index 6007f328507..c5630e4fcc2 100644 --- a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js @@ -6,7 +6,7 @@ var SendMethodCommand = require('../../src/commands/SendMethodCommand'); var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionConfirmationWorkflow'); var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); var ProvidersPackage = require('web3-providers'); -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-package').AbstractWeb3Module; var PromiEventPackage = require('web3-core-promievent'); /** @@ -18,8 +18,8 @@ describe('SendMethodCommandTest', function () { providerMock, providerAdapter, providerAdapterMock, - web3Package, - web3PackageMock, + moduleInstance, + moduleInstanceMock, methodModel, methodModelCallbackSpy, methodModelMock, @@ -35,8 +35,8 @@ describe('SendMethodCommandTest', function () { providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); providerAdapterMock = sinon.mock(providerAdapter); - web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); - web3PackageMock = sinon.mock(web3Package); + moduleInstance = new AbstractWeb3Module(providerAdapter, ProvidersPackage, null, null); + moduleInstanceMock = sinon.mock(moduleInstance); methodModel = new AbstractMethodModel('', 0, {}, {}); methodModelMock = sinon.mock(methodModel); @@ -60,7 +60,7 @@ describe('SendMethodCommandTest', function () { methodModelMock .expects('beforeExecution') - .withArgs(web3Package) + .withArgs(moduleInstance) .once(); providerAdapterMock @@ -75,10 +75,10 @@ describe('SendMethodCommandTest', function () { transactionConfirmationWorkflowMock .expects('execute') - .withArgs(methodModel, web3Package, 'response', promiEvent) + .withArgs(methodModel, moduleInstance, 'response', promiEvent) .once(); - var returnedPromiEvent = sendMethodCommand.execute(web3Package, methodModel, promiEvent); + var returnedPromiEvent = sendMethodCommand.execute(moduleInstance, methodModel, promiEvent); expect(returnedPromiEvent).equal(promiEvent); @@ -95,7 +95,7 @@ describe('SendMethodCommandTest', function () { methodModelMock .expects('beforeExecution') - .withArgs(web3Package) + .withArgs(moduleInstance) .once(); providerAdapterMock @@ -120,10 +120,10 @@ describe('SendMethodCommandTest', function () { transactionConfirmationWorkflowMock .expects('execute') - .withArgs(methodModel, web3Package, 'response', promiEvent) + .withArgs(methodModel, moduleInstance, 'response', promiEvent) .once(); - var returnedPromiEvent = sendMethodCommand.execute(web3Package, methodModel, promiEvent); + var returnedPromiEvent = sendMethodCommand.execute(moduleInstance, methodModel, promiEvent); expect(returnedPromiEvent).equal(promiEvent); @@ -143,7 +143,7 @@ describe('SendMethodCommandTest', function () { methodModelMock .expects('beforeExecution') - .withArgs(web3Package) + .withArgs(moduleInstance) .once(); providerAdapterMock @@ -161,7 +161,7 @@ describe('SendMethodCommandTest', function () { .withArgs('error') .once(); - var returnedPromiEvent = sendMethodCommand.execute(web3Package, methodModel, promiEvent); + var returnedPromiEvent = sendMethodCommand.execute(moduleInstance, methodModel, promiEvent); expect(returnedPromiEvent).equal(promiEvent); diff --git a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js index 1df975c4da8..990a70e269a 100644 --- a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js @@ -7,7 +7,7 @@ var TransactionSigner = require('../../src/signers/TransactionSigner'); var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionConfirmationWorkflow'); var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); var ProvidersPackage = require('web3-providers'); -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; var PromiEventPackage = require('web3-core-promievent'); /** @@ -19,8 +19,8 @@ describe('SendAndSignMethodCommandTest', function () { providerMock, providerAdapter, providerAdapterMock, - web3Package, - web3PackageMock, + moduleInstance, + moduleInstanceMock, methodModel, methodModelCallbackSpy, methodModelMock, @@ -40,8 +40,8 @@ describe('SendAndSignMethodCommandTest', function () { providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); providerAdapterMock = sinon.mock(providerAdapter); - web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); - web3PackageMock = sinon.mock(web3Package); + moduleInstance = new AbstractWeb3Module(providerAdapter, ProvidersPackage, null, null); + moduleInstanceMock = sinon.mock(moduleInstance); methodModel = new AbstractMethodModel('', 0, {}, {}); methodModelCallbackSpy = sinon.spy(); @@ -75,7 +75,7 @@ describe('SendAndSignMethodCommandTest', function () { methodModelMock .expects('beforeExecution') - .withArgs(web3Package) + .withArgs(moduleInstance) .once(); transactionSignerMock @@ -99,10 +99,10 @@ describe('SendAndSignMethodCommandTest', function () { transactionConfirmationWorkflowMock .expects('execute') - .withArgs(methodModel, web3Package, 'response', promiEvent) + .withArgs(methodModel, moduleInstance, 'response', promiEvent) .once(); - var returnedPromiEvent = signAndSendMethodCommand.execute(methodModel, web3Package, {}, promiEvent); + var returnedPromiEvent = signAndSendMethodCommand.execute(methodModel, moduleInstance, {}, promiEvent); expect(returnedPromiEvent).equal(promiEvent); @@ -127,7 +127,7 @@ describe('SendAndSignMethodCommandTest', function () { methodModelMock .expects('beforeExecution') - .withArgs(web3Package) + .withArgs(moduleInstance) .once(); transactionSignerMock @@ -138,7 +138,7 @@ describe('SendAndSignMethodCommandTest', function () { })) .once(); - var returnedPromiEvent = signAndSendMethodCommand.execute(methodModel, web3Package, {}, promiEvent); + var returnedPromiEvent = signAndSendMethodCommand.execute(methodModel, moduleInstance, {}, promiEvent); expect(returnedPromiEvent).equal(promiEvent); diff --git a/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js b/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js index 6ea2ef689b1..99cbe443f54 100644 --- a/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js +++ b/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js @@ -3,7 +3,7 @@ var sinon = require('sinon').createSandbox(); var expect = chai.expect; var SubscriptionsPackage = require('web3-core-subscriptions'); -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; var ProvidersPackage = require('web3-providers'); var NewHeadsWatcher = require('../../src/watchers/NewHeadsWatcher'); @@ -16,8 +16,8 @@ describe('NewHeadsWatcherTest', function () { providerMock, providerAdapter, providerAdapterMock, - web3Package, - web3PackageMock, + moduleInstance, + moduleInstanceMock, subscriptionsFactory, subscriptionsFactoryMock, subscription, @@ -48,10 +48,10 @@ describe('NewHeadsWatcherTest', function () { providerAdapter = new ProvidersPackage.HttpProviderAdapter(provider); providerAdapterMock = sinon.mock(providerAdapter); - web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); - web3PackageMock = sinon.mock(web3Package); + moduleInstance = new AbstractWeb3Module(providerAdapter, ProvidersPackage, null, null); + moduleInstanceMock = sinon.mock(moduleInstance); - var newHeadsWatcherObject = newHeadsWatcher.watch(web3Package); + var newHeadsWatcherObject = newHeadsWatcher.watch(moduleInstance); expect(newHeadsWatcherObject.isPolling).to.be.true; expect(newHeadsWatcherObject.confirmationInterval).to.be.instanceof(Object); @@ -68,10 +68,10 @@ describe('NewHeadsWatcherTest', function () { providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); providerAdapterMock = sinon.mock(providerAdapter); - web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); - web3PackageMock = sinon.mock(web3Package); + moduleInstance = new AbstractWeb3Module(providerAdapter, ProvidersPackage, null, null); + moduleInstanceMock = sinon.mock(moduleInstance); - subscription = new SubscriptionsPackage.Subscription({}, web3Package); + subscription = new SubscriptionsPackage.Subscription({}, moduleInstance); subscriptionMock = sinon.mock(subscription); subscriptionMock @@ -85,11 +85,11 @@ describe('NewHeadsWatcherTest', function () { subscriptionsFactoryMock .expects('createNewHeadsSubscription') - .withArgs(web3Package) + .withArgs(moduleInstance) .returns(subscription) .once(); - newHeadsWatcher.watch(web3Package); + newHeadsWatcher.watch(moduleInstance); newHeadsWatcher.stop(); expect(newHeadsWatcher.listeners('newHead').length).equal(0); diff --git a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js index af591b7b1fa..28818009d85 100644 --- a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js +++ b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js @@ -2,7 +2,7 @@ var chai = require('chai'); var sinon = require('sinon').createSandbox(); var expect = chai.expect; -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); var ProvidersPackage = require('web3-providers'); var PromiEventPackage = require('web3-core-promievent'); @@ -31,8 +31,8 @@ describe('TransactionConfirmationWorkflowTest', function () { providerMock, providerAdapter, providerAdapterMock, - web3Package, - web3PackageMock, + moduleInstance, + moduleInstanceMock, promiEvent, promiEventMock; @@ -59,8 +59,8 @@ describe('TransactionConfirmationWorkflowTest', function () { providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); providerAdapterMock = sinon.mock(providerAdapter); - web3Package = new AbstractWeb3Object(providerAdapter, ProvidersPackage, null, null); - web3PackageMock = sinon.mock(web3Package); + moduleInstance = new AbstractWeb3Module(providerAdapter, ProvidersPackage, null, null); + moduleInstanceMock = sinon.mock(moduleInstance); promiEvent = PromiEventPackage.createPromiEvent(); promiEventMock = sinon.mock(promiEvent); @@ -112,7 +112,7 @@ describe('TransactionConfirmationWorkflowTest', function () { transactionConfirmationWorkflow.execute( methodModel, - web3Package, + moduleInstance, '0x0', promiEvent ); diff --git a/packages/web3-core-subscriptions/README.md b/packages/web3-core-subscriptions/README.md index 406aca867a9..786b65fb965 100644 --- a/packages/web3-core-subscriptions/README.md +++ b/packages/web3-core-subscriptions/README.md @@ -30,10 +30,10 @@ This will expose the `Web3Subscriptions` object on the window object. // Dependencies var ProvidersPackage = require('web3-providers'); -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-package').AbstractWeb3Module; var SubscriptionsPackage = require('web3-core-subscriptions'); -// Create an object of type AbstractWeb3Object +// Create an object of type AbstractWeb3Module /** * @param {Object|String} provider * @param {ProvidersPackage} providersPackage @@ -46,7 +46,7 @@ function MyObject ( providersPackage, subscriptionsFactory ) { - AbstractWeb3Object.call( + AbstractWeb3Module.call( this, provider, providersPackage @@ -81,8 +81,8 @@ MyObject.prototype.subscribe = function (subscriptionMethod, callback) { } }; -// Inherit from AbstractWeb3Object -MyObject.prototype = Object.create(AbstractWeb3Object.prototype); +// Inherit from AbstractWeb3Module +MyObject.prototype = Object.create(AbstractWeb3Module.prototype); MyObject.prototype.constructor = MyObject; // Instantiate anything diff --git a/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js index 1a931967c03..944a96f2342 100644 --- a/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js +++ b/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js @@ -45,10 +45,10 @@ function AbstractSubscriptionModel(subscriptionType, subscriptionMethod, options * @method beforeSubscription * * @param {Subscription} subscription - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {Function} callback */ -AbstractSubscriptionModel.prototype.beforeSubscription = function (subscription, web3Package, callback) { }; +AbstractSubscriptionModel.prototype.beforeSubscription = function (subscription, moduleInstance, callback) { }; /** * This method will be executed on each new subscription item. diff --git a/packages/web3-core-subscriptions/src/Subscription.js b/packages/web3-core-subscriptions/src/Subscription.js index 0390380d27f..f1f14e9a1fa 100644 --- a/packages/web3-core-subscriptions/src/Subscription.js +++ b/packages/web3-core-subscriptions/src/Subscription.js @@ -27,13 +27,13 @@ var EventEmitter = require('eventemitter3'); /** * @param {AbstractSubscriptionModel} subscriptionModel - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * * @constructor */ -function Subscription(subscriptionModel, web3Package) { +function Subscription(subscriptionModel, moduleInstance) { this.subscriptionModel = subscriptionModel; - this.web3Package = web3Package; + this.moduleInstance = moduleInstance; this.subscriptionId = null; } @@ -53,23 +53,23 @@ Subscription.prototype.constructor = Subscription; Subscription.prototype.subscribe = function (callback) { var self = this; - this.subscriptionModel.beforeSubscription(this, this.web3Package, callback); + this.subscriptionModel.beforeSubscription(this, this.moduleInstance, callback); - this.web3Package.currentProvider.subscribe( + this.moduleInstance.currentProvider.subscribe( this.subscriptionModel.subscriptionType, this.subscriptionModel.subscriptionMethod, [this.subscriptionModel.options] ).then(function (subscriptionId) { self.subscriptionId = subscriptionId; - self.web3Package.currentProvider.on(self.subscriptionId, function (error, response) { + self.moduleInstance.currentProvider.on(self.subscriptionId, function (error, response) { if (!error) { self.handleSubscriptionResponse(response, callback); return; } - if (self.web3Package.currentProvider.once) { + if (self.moduleInstance.currentProvider.once) { self.reconnect(callback); } @@ -124,12 +124,12 @@ Subscription.prototype.reconnect = function (callback) { var self = this; var interval = setInterval(function () { - if (self.web3Package.currentProvider.reconnect) { - self.web3Package.currentProvider.reconnect(); + if (self.moduleInstance.currentProvider.reconnect) { + self.moduleInstance.currentProvider.reconnect(); } }, 500); - this.web3Package.currentProvider.once('connect', function () { + this.moduleInstance.currentProvider.once('connect', function () { clearInterval(interval); self.unsubscribe().then(function () { self.subscribe(callback); @@ -155,7 +155,7 @@ Subscription.prototype.reconnect = function (callback) { */ Subscription.prototype.unsubscribe = function (callback) { var self = this; - return this.web3Package.currentProvider.unsubscribe( + return this.moduleInstance.currentProvider.unsubscribe( this.subscriptionId, this.subscriptionModel.subscriptionType ).then(function (response) { diff --git a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js index 80463510849..3044ba0b307 100644 --- a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js +++ b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js @@ -45,7 +45,7 @@ function SubscriptionsFactory(utils, formatters) { * * @method createLogSubscription * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {Object} options * @param {GetPastLogsMethodModel} getPastLogsMethodModel * @param {MethodController} methodController @@ -53,12 +53,12 @@ function SubscriptionsFactory(utils, formatters) { * @returns {Subscription} */ SubscriptionsFactory.prototype.createLogSubscription = function ( - web3Package, + moduleInstance, options, getPastLogsMethodModel, methodController ) { - return new Subscription(web3Package, + return new Subscription(moduleInstance, new LogSubscriptionModel( options, this.utils, @@ -74,13 +74,13 @@ SubscriptionsFactory.prototype.createLogSubscription = function ( * * @method createNewHeadsSubscription * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * * @returns {Subscription} */ -SubscriptionsFactory.prototype.createNewHeadsSubscription = function (web3Package) { +SubscriptionsFactory.prototype.createNewHeadsSubscription = function (moduleInstance) { return new Subscription( - web3Package, + moduleInstance, new NewHeadsSubscriptionModel(this.utils, this.formatters) ); }; @@ -90,13 +90,13 @@ SubscriptionsFactory.prototype.createNewHeadsSubscription = function (web3Packag * * @method createNewPendingTransactionsSubscription * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * * @returns {Subscription} */ -SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = function (web3Package) { +SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = function (moduleInstance) { return new Subscription( - web3Package, + moduleInstance, new NewPendingTransactionsSubscriptionModel(this.utils, this.formatters) ); }; @@ -106,13 +106,13 @@ SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = functi * * @method createSyncingSubscriptionModel * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * * @returns {Subscription} */ -SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (web3Package) { +SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (moduleInstance) { return new Subscription( - web3Package, + moduleInstance, new SyncingSubscriptionModel(this.utils, this.formatters) ); }; @@ -122,14 +122,14 @@ SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (web3Pa * * @method createShhMessagesSubscription * - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {Object} options * * @returns {Subscription} */ -SubscriptionsFactory.prototype.createShhMessagesSubscription = function (web3Package, options) { +SubscriptionsFactory.prototype.createShhMessagesSubscription = function (moduleInstance, options) { return new Subscription( - web3Package, + moduleInstance, new MessagesSubscriptionModel(options, this.utils, this.formatters) ); }; diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js index 50ddc022905..08f70eb0b8c 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -45,19 +45,19 @@ function LogSubscriptionModel(options, utils, formatters, getPastLogsMethodModel * @method beforeSubscription * * @param {Subscription} subscription - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {Function} callback */ -LogSubscriptionModel.prototype.beforeSubscription = function (subscription, web3Package, callback) { +LogSubscriptionModel.prototype.beforeSubscription = function (subscription, moduleInstance, callback) { var self = this; this.options = this.formatters.inputLogFormatter(this.options); this.getPastLogsMethodModel.parameters = [options]; this.methodController.execute( this.getPastLogsMethodModel, - web3Package.currentProvider, + moduleInstance.currentProvider, null, - web3Package + moduleInstance ).then(function (logs) { logs.forEach(function (log) { callback(false, log); diff --git a/packages/web3-core-package/README.md b/packages/web3-core/README.md similarity index 83% rename from packages/web3-core-package/README.md rename to packages/web3-core/README.md index aeb404764a7..f15642b1c94 100644 --- a/packages/web3-core-package/README.md +++ b/packages/web3-core/README.md @@ -2,13 +2,13 @@ This is a sub package of [web3.js][repo] -The ```web3-core-package``` contains core functions for [web3.js][repo] packages. This package should be used +The ```web3-core``` contains core functions for [web3.js][repo] packages. This package should be used if someone wants to implement a new web3 package. If you implement your own web3 package then don't forget to add the ```setProvider()``` method to the parent object. This because the default behaviour of ```setProvider()``` is that the parent object will also set the provider of the child packages if this method is called. -Provided interface of AbstractWeb3Object: +Provided interface of AbstractWeb3Module: - ```extend(methods: Object):void ``` Extends the current object with additional RPC methods. - ```setProvider(provider: any):void ``` This method will set the current provider of this object. @@ -25,7 +25,7 @@ Provided interface of AbstractWeb3Object: ### Node.js ```bash -npm install web3-core-package +npm install web3-core ``` ### In the Browser @@ -36,14 +36,14 @@ Build running the following in the [web3.js][repo] repository: npm run-script build-all ``` -Then include `dist/web3-core-package.js` in your html file. -This will expose the `Web3Package` object on the window object. +Then include `dist/web3-core.js` in your html file. +This will expose the `moduleInstance` object on the window object. ## Usage ```js // in node.js -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; /** * @param {Object|String} provider @@ -59,7 +59,7 @@ function MyObject ( methodController, // optional methodModelFactory // optional ) { - AbstractWeb3Object.call( + AbstractWeb3Module.call( this, provider, providersPackage, @@ -68,8 +68,8 @@ function MyObject ( ); } -// Inherit from AbstractWeb3Object -MyObject.prototype = Object.create(AbstractWeb3Object.prototype); +// Inherit from AbstractWeb3Module +MyObject.prototype = Object.create(AbstractWeb3Module.prototype); MyObject.prototype.constructor = MyObject; ``` diff --git a/packages/web3-core-package/package-lock.json b/packages/web3-core/package-lock.json similarity index 92% rename from packages/web3-core-package/package-lock.json rename to packages/web3-core/package-lock.json index d57ac7a4214..2c32f69844f 100644 --- a/packages/web3-core-package/package-lock.json +++ b/packages/web3-core/package-lock.json @@ -1,5 +1,5 @@ { - "name": "web3-core-package", + "name": "web3-core", "version": "1.0.0-beta.36", "lockfileVersion": 1, "requires": true, diff --git a/packages/web3-core-package/package.json b/packages/web3-core/package.json similarity index 91% rename from packages/web3-core-package/package.json rename to packages/web3-core/package.json index 5f712503501..a3cee3b3378 100644 --- a/packages/web3-core-package/package.json +++ b/packages/web3-core/package.json @@ -1,5 +1,5 @@ { - "name": "web3-core-package", + "name": "web3-core", "namespace": "ethereum", "version": "1.0.0-beta.36", "description": "Web3 core tools for sub packages. This is an internal package.", diff --git a/packages/web3-core-package/src/AbstractWeb3Object.js b/packages/web3-core/src/AbstractWeb3Module.js similarity index 93% rename from packages/web3-core-package/src/AbstractWeb3Object.js rename to packages/web3-core/src/AbstractWeb3Module.js index 42e023edb86..acc69546ff9 100644 --- a/packages/web3-core-package/src/AbstractWeb3Object.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file AbstractWeb3Object.js + * @file AbstractWeb3Module.js * @author Samuel Furter * @date 2018 */ @@ -32,7 +32,7 @@ var _ = require('underscore'); * * @constructor */ -function AbstractWeb3Object( +function AbstractWeb3Module( provider, providersPackage, methodController, @@ -95,7 +95,7 @@ function AbstractWeb3Object( * * @returns {Boolean} */ -AbstractWeb3Object.prototype.setProvider = function (provider, net) { +AbstractWeb3Module.prototype.setProvider = function (provider, net) { if (!this.isSameProvider(provider)) { this.clearSubscriptions(); this.currentProvider = this.providersPackage.resolve(provider, net); @@ -121,7 +121,7 @@ AbstractWeb3Object.prototype.setProvider = function (provider, net) { * * @returns {Boolean} */ -AbstractWeb3Object.prototype.isSameProvider = function (provider) { +AbstractWeb3Module.prototype.isSameProvider = function (provider) { if (_.isObject(provider)) { if (this.currentProvider.provider.constructor.name === provider.constructor.name) { return this.currentProvider.host === provider.host; @@ -138,7 +138,7 @@ AbstractWeb3Object.prototype.isSameProvider = function (provider) { * * @method clearSubscriptions */ -AbstractWeb3Object.prototype.clearSubscriptions = function () { +AbstractWeb3Module.prototype.clearSubscriptions = function () { if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && this.currentProvider.subscriptions.length > 0 ) { @@ -153,7 +153,7 @@ AbstractWeb3Object.prototype.clearSubscriptions = function () { * * @param {Object} extension */ -AbstractWeb3Object.prototype.extend = function (extension) { +AbstractWeb3Module.prototype.extend = function (extension) { var namespace = extension.property || false, object; @@ -176,10 +176,10 @@ AbstractWeb3Object.prototype.extend = function (extension) { AbstractMethodModel.call(this, method.call, method.params, utils, formatters); } - ExtensionMethodModel.prototype.beforeExecution = function (parameters, web3Package) { + ExtensionMethodModel.prototype.beforeExecution = function (parameters, moduleInstance) { method.inputFormatters.forEach(function (formatter, key) { if (formatter) { - parameters[key] = formatter(parameters[key], web3Package); + parameters[key] = formatter(parameters[key], moduleInstance); } }); }; @@ -221,7 +221,7 @@ AbstractWeb3Object.prototype.extend = function (extension) { * * @returns {*} */ -AbstractWeb3Object.prototype.proxyHandler = function (target, name) { +AbstractWeb3Module.prototype.proxyHandler = function (target, name) { if (target.methodModelFactory.hasMethodModel(name)) { if (typeof target[name] !== 'undefined') { throw new Error('Duplicated method ' + name + '. This method is defined as RPC call and as Object method.'); @@ -260,8 +260,8 @@ AbstractWeb3Object.prototype.proxyHandler = function (target, name) { * * @returns {Boolean} */ -AbstractWeb3Object.prototype.isDependencyGiven = function (object) { +AbstractWeb3Module.prototype.isDependencyGiven = function (object) { return object !== null && typeof object !== 'undefined' }; -module.exports = AbstractWeb3Object; +module.exports = AbstractWeb3Module; diff --git a/packages/web3-core-package/src/index.js b/packages/web3-core/src/index.js similarity index 89% rename from packages/web3-core-package/src/index.js rename to packages/web3-core/src/index.js index 3301bd86e78..e8c87313f56 100644 --- a/packages/web3-core-package/src/index.js +++ b/packages/web3-core/src/index.js @@ -23,10 +23,10 @@ "use strict"; var version = require('../package.json').version; -var AbstractWeb3Object = require('./AbstractWeb3Object'); +var AbstractWeb3Module = require('./AbstractWeb3Module'); module.exports = { version: version, - AbstractWeb3Object: AbstractWeb3Object + AbstractWeb3Module: AbstractWeb3Module }; diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json index 241f36adc6a..e673b533bfc 100644 --- a/packages/web3-eth-accounts/package.json +++ b/packages/web3-eth-accounts/package.json @@ -12,9 +12,9 @@ "scrypt.js": "0.2.0", "underscore": "1.9.1", "uuid": "3.3.2", + "web3-core": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", - "web3-core-package": "1.0.0-beta.36", "web3-providers": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36" } diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 4d42be5b305..f5e67aedca9 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -31,7 +31,7 @@ var Bytes = require("eth-lib/lib/bytes"); var cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); var scryptsy = require('scrypt.js'); var uuid = require('uuid'); -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; var isNot = function(value) { return (_.isUndefined(value) || _.isNull(value)); @@ -63,13 +63,13 @@ var makeEven = function (hex) { * @constructor */ var Accounts = function Accounts(provider, providersPackage, methodController, methodModelFactory, utils, formatters) { - AbstractWeb3Object.call(this, provider, providersPackage, methodController, methodModelFactory); + AbstractWeb3Module.call(this, provider, providersPackage, methodController, methodModelFactory); this.utils = utils; this.formatters = formatters; this.wallet = new Wallet(this); }; -Accounts.prototype = Object.create(AbstractWeb3Object.prototype); +Accounts.prototype = Object.create(AbstractWeb3Module.prototype); Accounts.prototype.constructor = Accounts; /** diff --git a/packages/web3-eth-contract/package.json b/packages/web3-eth-contract/package.json index a357fb363b3..795f1fdd147 100644 --- a/packages/web3-eth-contract/package.json +++ b/packages/web3-eth-contract/package.json @@ -12,8 +12,8 @@ "web3-core-method": "1.0.0-beta.36", "web3-eth-abi": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", + "web3-core": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", - "web3-core-package": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 7e97ca96553..bf52eb67466 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; /** * @param {AbstractProviderAdapter|EthereumProvider} provider @@ -76,7 +76,7 @@ function Contract( this.promiEventPackage = promiEventPackage; this.rpcMethodModelFactory = contractPackageFactory.createRpcMethodModelFactory(); - AbstractWeb3Object.call( + AbstractWeb3Module.call( this, provider, this.providersPackage, @@ -263,12 +263,12 @@ Contract.prototype.clone = function () { */ Contract.prototype.setProvider = function (provider, net) { return !!( - AbstractWeb3Object.prototype.setProvider.call(this, provider, net) && + AbstractWeb3Module.prototype.setProvider.call(this, provider, net) && this.accounts.setProvider(provider, net) ); }; -Contract.prototype = Object.create(AbstractWeb3Object.prototype); +Contract.prototype = Object.create(AbstractWeb3Module.prototype); Contract.prototype.constructor = Contract; module.exports = Contract; diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js index 6f91b71159a..840a5f5b49d 100644 --- a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js @@ -43,13 +43,13 @@ function EventSubscriptionFactory(utils, formatters, methodController) { * * @param {EventLogDecoder} eventLogDecoder * @param {ABIItemModel} abiItemModel - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {Object} options * * @returns {Subscription} */ -EventSubscriptionFactory.prototype.createEventLogSubscription = function (eventLogDecoder, abiItemModel, web3Package, options) { - return new Subscription(web3Package, +EventSubscriptionFactory.prototype.createEventLogSubscription = function (eventLogDecoder, abiItemModel, moduleInstance, options) { + return new Subscription(moduleInstance, new EventLogSubscription( abiItemModel, options, @@ -66,13 +66,13 @@ EventSubscriptionFactory.prototype.createEventLogSubscription = function (eventL * Returns an log subscription for all events * * @param {AllEventsLogDecoder} allEventsLogDecoder - * @param {AbstractWeb3Object} web3Package + * @param {AbstractWeb3Module} moduleInstance * @param {Object} options * * @returns {Subscription} */ -EventSubscriptionFactory.prototype.createAllEventLogSubscription = function (allEventsLogDecoder, web3Package, options) { - return new Subscription(web3Package, +EventSubscriptionFactory.prototype.createAllEventLogSubscription = function (allEventsLogDecoder, moduleInstance, options) { + return new Subscription(moduleInstance, new AllEventsLogSubscription( options, this.utils, diff --git a/packages/web3-eth-personal/package.json b/packages/web3-eth-personal/package.json index 2a0657bf640..65d574bf7b7 100644 --- a/packages/web3-eth-personal/package.json +++ b/packages/web3-eth-personal/package.json @@ -11,7 +11,7 @@ "web3-net": "1.0.0-beta.36", "web3-providers": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", + "web3-core": "1.0.0-beta.36" "web3-core-helpers": "1.0.0-beta.36", - "web3-core-package": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 68c832b96cc..3f860362b0c 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; /** * TODO: Add missing documentation for getAccounts, lockAccount, importRawKey and sendTransaction! @@ -38,7 +38,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @constructor */ function Personal(provider, providersPackage, methodController, methodModelFactory, net, utils, formatters) { - AbstractWeb3Object.call(this, provider, providersPackage, methodController, methodModelFactory); + AbstractWeb3Module.call(this, provider, providersPackage, methodController, methodModelFactory); this.utils = utils; this.formatters = formatters; @@ -71,7 +71,7 @@ function Personal(provider, providersPackage, methodController, methodModelFacto } /** - * Extends setProvider method from AbstractWeb3Object. + * Extends setProvider method from AbstractWeb3Module. * * @method setProvider * @@ -81,10 +81,10 @@ function Personal(provider, providersPackage, methodController, methodModelFacto * @returns {Boolean} */ Personal.prototype.setProvider = function (provider, net) { - return !!(AbstractWeb3Object.setProvider.call(this, provider, net) && this.net.setProvider(provider, net)); + return !!(AbstractWeb3Module.setProvider.call(this, provider, net) && this.net.setProvider(provider, net)); }; -Personal.prototype = Object.create(AbstractWeb3Object); +Personal.prototype = Object.create(AbstractWeb3Module); Personal.prototype.constructor = Personal; module.exports = Personal; diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index 05f0d40632c..1d7c873cfda 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -14,11 +14,11 @@ "web3-eth-abi": "1.0.0-beta.36", "web3-eth-ens": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", + "web3-core": "1.0.0-beta.36" "web3-core-helpers": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", "web3-providers": "1.0.0-beta.36", "web3-net": "1.0.0-beta.36", - "web3-core-package": "1.0.0-beta.36" } } diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 6c5c1a55011..fd071ec7f89 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; /** * @param {AbstractProviderAdapter|EthereumProvider} provider @@ -58,7 +58,7 @@ var Eth = function Eth( methodController, methodModelFactory ) { - AbstractWeb3Object.call( + AbstractWeb3Module.call( this, provider, providersPackage, @@ -196,7 +196,7 @@ Eth.prototype.subscribe = function (type, options, callback) { }; /** - * Extends setProvider method from AbstractWeb3Object. + * Extends setProvider method from AbstractWeb3Module. * This is required for updating the provider also in the sub packages and objects related to Eth. * * @param {Object|String} provider @@ -210,7 +210,7 @@ Eth.prototype.setProvider = function (provider, net) { }); return !!( - AbstractWeb3Object.setProvider.call(this, provider, net) && + AbstractWeb3Module.setProvider.call(this, provider, net) && this.net.setProvider(provider, net) && this.personal.setProvider(provider, net) && this.accounts.setProvider(provider, net) && @@ -218,7 +218,7 @@ Eth.prototype.setProvider = function (provider, net) { ); }; -Eth.prototype = Object.create(AbstractWeb3Object.prototype); +Eth.prototype = Object.create(AbstractWeb3Module.prototype); Eth.prototype.constructor = Eth; module.exports = Eth; diff --git a/packages/web3-net/package.json b/packages/web3-net/package.json index 2b77665849e..b3b538702ac 100644 --- a/packages/web3-net/package.json +++ b/packages/web3-net/package.json @@ -7,10 +7,10 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "web3-providers": "1.0.0-beta.36", + "web3-core": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", + "web3-providers": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", - "web3-core-package": "1.0.0-beta.36" } } diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index fcd04e52297..da167c5b215 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -23,7 +23,7 @@ "use strict"; -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; /** * @param {AbstractProviderAdapter|EthereumProvider} provider @@ -36,7 +36,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @constructor */ function Network(provider, providersPackage, methodController, methodModelFactory, formatters, utils) { - AbstractWeb3Object.call(this, provider, providersPackage, methodController, methodModelFactory); + AbstractWeb3Module.call(this, provider, providersPackage, methodController, methodModelFactory); this.formatters = formatters; this.utils = utils; } @@ -94,7 +94,7 @@ Network.prototype.getNetworkType = function (callback) { }); }; -Network.prototype = Object.create(AbstractWeb3Object.prototype); +Network.prototype = Object.create(AbstractWeb3Module.prototype); Network.prototype.constructor = Network; module.exports = Network; diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index 209e02682ee..c52d445d73a 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; /** * @param {AbstractProviderAdapter|EthereumProvider} provider @@ -35,7 +35,7 @@ var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; * @constructor */ function Shh(provider, providersPackage, methodController, methodModelFactory, subscriptionsFactory, net) { - AbstractWeb3Object.call( + AbstractWeb3Module.call( this, provider, providersPackage, @@ -66,7 +66,7 @@ Shh.prototype.subscribe = function (method, options, callback) { }; /** - * Extends setProvider method from AbstractWeb3Object. + * Extends setProvider method from AbstractWeb3Module. * This is required for updating the provider also in the sub package Net. * * @param {Object|String} provider @@ -76,12 +76,12 @@ Shh.prototype.subscribe = function (method, options, callback) { */ Shh.prototype.setProvider = function (provider, net) { return !!( - AbstractWeb3Object.setProvider.call(this, provider, net) && + AbstractWeb3Module.setProvider.call(this, provider, net) && this.net.setProvider(provider, net) ); }; -Shh.prototype = Object.create(AbstractWeb3Object.prototype); +Shh.prototype = Object.create(AbstractWeb3Module.prototype); Shh.prototype.constructor = Shh; module.exports = Shh; diff --git a/packages/web3/package.json b/packages/web3/package.json index 794d93642ae..505bb912701 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -54,8 +54,8 @@ "web3-utils": "1.0.0-beta.36", "web3-net": "1.0.0-beta.36", "web3-providers": "1.0.0-beta.36", + "web3-core": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", - "web3-core-package": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36" } } diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 9448a559289..167d8eb70ed 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -22,7 +22,7 @@ "use strict"; -var AbstractWeb3Object = require('web3-core-package').AbstractWeb3Object; +var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; var formatters = require('web3-core-helpers').formatters; var MethodPackage = require('web3-core-method'); var ProvidersPackage = require('web3-providers'); @@ -44,7 +44,7 @@ var Web3 = function Web3(provider, net) { this.version = version; provider = ProvidersPackage.resolve(provider, net); - AbstractWeb3Object.call( + AbstractWeb3Module.call( this, provider, ProvidersPackage, @@ -70,14 +70,14 @@ var Web3 = function Web3(provider, net) { */ Web3.prototype.setProvider = function (provider, net) { return !!( - AbstractWeb3Object.prototype.setProvider.call(this, provider, net) && + AbstractWeb3Module.prototype.setProvider.call(this, provider, net) && this.eth.setProvider(provider, net) && this.shh.setProvider(provider, net) && this.bzz.setProvider(provider) ); }; -Web3.prototype = Object.create(AbstractWeb3Object.prototype); +Web3.prototype = Object.create(AbstractWeb3Module.prototype); Web3.prototype.constructor = Web3; Web3.givenProvider = ProvidersPackage.detect(); From e3d2cc72c86cb482354d310d74de6bc67a9fdb26 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 11:24:11 +0200 Subject: [PATCH 0253/1045] Web3Subscription renamend to Web3Subscriptions in gulpfile --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 3823cf35bc8..1d298e94e57 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -72,7 +72,7 @@ var packages = [{ src: './packages/web3-providers/src/index.js' }, { fileName: 'web3-core-subscriptions', - expose: 'Web3Subscription', + expose: 'Web3Subscriptions', src: './packages/web3-core-subscriptions/src/index.js' }, { fileName: 'web3-core-promievent', From 73db619952c0f72961823a25c00098a86c4b3de4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 11:27:25 +0200 Subject: [PATCH 0254/1045] If no account is unlocked than send the eth_sign request to the node --- packages/web3-core-method/src/controllers/MethodController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 686b4b688b6..4b8f740372e 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -78,7 +78,7 @@ MethodController.prototype.execute = function (methodModel, accounts, moduleInst } } - if (methodModel.isSendTransaction() || methodModel.isSendRawTransaction()) { + if (methodModel.isSendTransaction() || methodModel.isSendRawTransaction() || methodModel.isSign()) { return this.sendMethodCommand.execute( moduleInstance, methodModel, From fa1a1c3b1fd43f8d43a40eb1e4561b234c92f026 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 12:59:58 +0200 Subject: [PATCH 0255/1045] create methods removed from index files and changed to constructor, missing module.exports added and abstraction fixed --- packages/web3-bzz/src/index.js | 13 +------ .../src/controllers/MethodController.js | 2 +- packages/web3-core-method/src/index.js | 8 ++-- .../tests/commands/SendMethodCommandTest.js | 4 +- .../commands/SignAndSendMethodCommandTest.js | 4 +- .../tests/controllers/MethodControllerTest.js | 2 +- .../TransactionConfirmationWorkflowTest.js | 4 +- packages/web3-core-promievent/src/index.js | 9 +---- .../src/factories/SubscriptionsFactory.js | 21 +++++----- packages/web3-core-subscriptions/src/index.js | 4 +- .../subscriptions/eth/LogSubscriptionModel.js | 6 +-- .../eth/NewHeadsSubscriptionModel.js | 6 +-- .../eth/SyncingSubscriptionModel.js | 5 ++- packages/web3-core/src/AbstractWeb3Module.js | 4 +- packages/web3-eth-abi/src/index.js | 6 +-- packages/web3-eth-accounts/src/index.js | 10 ++--- packages/web3-eth-contract/src/Contract.js | 6 +-- .../src/decoders/AllEventsLogDecoder.js | 6 ++- .../src/decoders/CallMethodResponseDecoder.js | 2 + .../src/encoders/AllEventsFilterEncoder.js | 6 +-- packages/web3-eth-contract/src/index.js | 15 ++++---- .../src/models/abi/ABIItemModel.js | 2 +- .../models/methods/CallContractMethodModel.js | 6 +-- .../methods/PastEventLogsMethodModel.js | 6 +-- .../models/methods/SendContractMethodModel.js | 6 +-- .../subscriptions/AllEventsLogSubscription.js | 6 +-- .../subscriptions/EventLogSubscription.js | 6 +-- .../web3-eth-ens/src/contracts/Registry.js | 4 +- packages/web3-eth-ens/src/index.js | 4 +- packages/web3-eth-iban/src/index.js | 13 +------ packages/web3-eth-personal/src/Personal.js | 6 +-- packages/web3-eth-personal/src/index.js | 12 +++--- packages/web3-eth/src/Eth.js | 27 ++++--------- .../src/factories/MethodModelFactory.js | 6 +-- packages/web3-eth/src/index.js | 38 +++++++++---------- packages/web3-net/src/Network.js | 6 +-- packages/web3-net/src/index.js | 8 ++-- .../src/adapters/InpageProviderAdapter.js | 6 +-- packages/web3-providers/src/index.js | 4 +- packages/web3-shh/src/Shh.js | 6 +-- packages/web3-shh/src/index.js | 16 ++++---- packages/web3/src/index.js | 26 ++++++------- 42 files changed, 159 insertions(+), 198 deletions(-) diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index b280e4b70b6..63f7234c8b0 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -28,16 +28,5 @@ var Bzz = require('./Bzz'); module.exports = { version: version, - /** - * Returns the Bzz object - * - * @method createBzz - * - * @param {Object|String} provider - * - * @returns {Bzz} - */ - createBzz: function (provider) { - return new Bzz(provider); - } + Bzz: Bzz }; diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 4b8f740372e..8898fd1d153 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -57,7 +57,7 @@ function MethodController( * @returns {Promise<*>|PromiEvent} */ MethodController.prototype.execute = function (methodModel, accounts, moduleInstance) { - var promiEvent = this.promiEventPackage.createPromiEvent(); + var promiEvent = new this.promiEventPackage.PromiEvent(); if (this.hasWallets(accounts)) { if (methodModel.isSign()) { diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index c47b4c346f8..0ba9695dd6a 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -27,7 +27,7 @@ var version = require('../package.json').version; var MethodPackageFactory = require('./factories/MethodPackageFactory'); var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); var PromiEventPackage = require('web3-core-promievent'); -var SubscriptionsPackage = require('web3-core-subscriptions'); +var SubscriptionsFactory = require('web3-core-subscriptions').SubscriptionsFactory; var formatters = require('web3-core-helpers').formatters; // Methods @@ -116,14 +116,14 @@ module.exports = { /** * Returns the MethodController object * - * @method createMethodController + * @method MethodController * * @returns {MethodController} */ - createMethodController: function () { + MethodController: function () { return new MethodPackageFactory().createMethodController( PromiEventPackage, - SubscriptionsPackage.createSubscriptionsFactory(), + new SubscriptionsFactory(), formatters ); }, diff --git a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js index c5630e4fcc2..88f14c069eb 100644 --- a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js @@ -7,7 +7,7 @@ var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionCo var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); var ProvidersPackage = require('web3-providers'); var AbstractWeb3Module = require('web3-package').AbstractWeb3Module; -var PromiEventPackage = require('web3-core-promievent'); +var PromiEvent = require('web3-core-promievent').PromiEvent; /** * SendMethodCommand test @@ -41,7 +41,7 @@ describe('SendMethodCommandTest', function () { methodModel = new AbstractMethodModel('', 0, {}, {}); methodModelMock = sinon.mock(methodModel); - promiEvent = PromiEventPackage.createPromiEvent(); + promiEvent = new PromiEvent(); promiEventMock = sinon.mock(promiEvent); transactionConfirmationWorkflow = new TransactionConfirmationWorkflow({}, {}, {}, {}); diff --git a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js index 990a70e269a..7992da0baad 100644 --- a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js @@ -8,7 +8,7 @@ var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionCo var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); var ProvidersPackage = require('web3-providers'); var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; -var PromiEventPackage = require('web3-core-promievent'); +var PromiEvent = require('web3-core-promievent').PromiEvent; /** * SendAndSignMethodCommand test @@ -48,7 +48,7 @@ describe('SendAndSignMethodCommandTest', function () { methodModel.callback = methodModelCallbackSpy; methodModelMock = sinon.mock(methodModel); - promiEvent = PromiEventPackage.createPromiEvent(); + promiEvent = new PromiEvent(); promiEventMock = sinon.mock(promiEvent); promiEventEmitSpy = sinon.spy(); diff --git a/packages/web3-core-method/tests/controllers/MethodControllerTest.js b/packages/web3-core-method/tests/controllers/MethodControllerTest.js index 7614d963426..d16833cb5d5 100644 --- a/packages/web3-core-method/tests/controllers/MethodControllerTest.js +++ b/packages/web3-core-method/tests/controllers/MethodControllerTest.js @@ -59,7 +59,7 @@ describe('MethodControllerTest', function () { expect(methodController.sendMethodCommand).to.be.an.instanceof(SendMethodCommand); expect(methodController.signAndSendMethodCommand).to.be.an.instanceof(SignAndSendMethodCommand); expect(methodController.signMessageCommand).to.be.an.instanceof(SignMessageCommand); - expect(methodController.promiEventPackage.createPromiEvent).to.be.an.instanceof(Function); + expect(methodController.promiEventPackage).to.be.an.instanceof(Object); }); it('execute calls signMessageCommand', function () { diff --git a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js index 28818009d85..b0fae361dc6 100644 --- a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js +++ b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js @@ -5,7 +5,7 @@ var expect = chai.expect; var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); var ProvidersPackage = require('web3-providers'); -var PromiEventPackage = require('web3-core-promievent'); +var PromiEvent = require('web3-core-promievent').PromiEvent; var formatters = require('web3-core-helpers').formatters; var TransactionConfirmationModel = require('../../src/models/TransactionConfirmationModel'); var TransactionReceiptValidator = require('../../src/validators/TransactionReceiptValidator'); @@ -62,7 +62,7 @@ describe('TransactionConfirmationWorkflowTest', function () { moduleInstance = new AbstractWeb3Module(providerAdapter, ProvidersPackage, null, null); moduleInstanceMock = sinon.mock(moduleInstance); - promiEvent = PromiEventPackage.createPromiEvent(); + promiEvent = new PromiEvent(); promiEventMock = sinon.mock(promiEvent); transactionConfirmationWorkflow = new TransactionConfirmationWorkflow( diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index 8951d247230..d1cff600f4d 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -28,12 +28,5 @@ var PromiEvent = require('./PromiEvent'); module.exports = { version: version, - /** - * Returns PromiEvent object - * - * @method createPromiEvent - */ - createPromiEvent: function() { - return new PromiEvent(); - } + PromiEvent: PromiEvent }; diff --git a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js index 3044ba0b307..ef5a1ffa0af 100644 --- a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js +++ b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js @@ -58,14 +58,15 @@ SubscriptionsFactory.prototype.createLogSubscription = function ( getPastLogsMethodModel, methodController ) { - return new Subscription(moduleInstance, + return new Subscription( new LogSubscriptionModel( options, this.utils, this.formatters, getPastLogsMethodModel, methodController - ) + ), + moduleInstance ); }; @@ -80,8 +81,8 @@ SubscriptionsFactory.prototype.createLogSubscription = function ( */ SubscriptionsFactory.prototype.createNewHeadsSubscription = function (moduleInstance) { return new Subscription( - moduleInstance, - new NewHeadsSubscriptionModel(this.utils, this.formatters) + new NewHeadsSubscriptionModel(this.utils, this.formatters), + moduleInstance ); }; @@ -96,8 +97,8 @@ SubscriptionsFactory.prototype.createNewHeadsSubscription = function (moduleInst */ SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = function (moduleInstance) { return new Subscription( - moduleInstance, - new NewPendingTransactionsSubscriptionModel(this.utils, this.formatters) + new NewPendingTransactionsSubscriptionModel(this.utils, this.formatters), + moduleInstance ); }; @@ -112,8 +113,8 @@ SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = functi */ SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (moduleInstance) { return new Subscription( - moduleInstance, - new SyncingSubscriptionModel(this.utils, this.formatters) + new SyncingSubscriptionModel(this.utils, this.formatters), + moduleInstance ); }; @@ -129,8 +130,8 @@ SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (module */ SubscriptionsFactory.prototype.createShhMessagesSubscription = function (moduleInstance, options) { return new Subscription( - moduleInstance, - new MessagesSubscriptionModel(options, this.utils, this.formatters) + new MessagesSubscriptionModel(options, this.utils, this.formatters), + moduleInstance ); }; diff --git a/packages/web3-core-subscriptions/src/index.js b/packages/web3-core-subscriptions/src/index.js index 14c9a2d0b2e..5b215ad0434 100644 --- a/packages/web3-core-subscriptions/src/index.js +++ b/packages/web3-core-subscriptions/src/index.js @@ -38,11 +38,11 @@ module.exports = { /** * Returns an object of type SubscriptionsFactory * - * @method createSubscriptionsFactory + * @method SubscriptionsFactory * * @returns {SubscriptionsFactory} */ - createSubscriptionsFactory: function () { + SubscriptionsFactory: function () { return new SubscriptionsFactory(Utils, formatters); } }; diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js index 08f70eb0b8c..35eef5a244f 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -39,6 +39,9 @@ function LogSubscriptionModel(options, utils, formatters, getPastLogsMethodModel this.methodController = methodController; } +LogSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); +LogSubscriptionModel.prototype.constructor = LogSubscriptionModel; + /** * This method will be executed before the subscription starts. * @@ -85,7 +88,4 @@ LogSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, s return this.formatters.outputLogFormatter(subscriptionItem); }; -LogSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); -LogSubscriptionModel.prototype.constructor = LogSubscriptionModel; - module.exports = LogSubscriptionModel; diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js index 3458e3169fd..74e9b8a3962 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js @@ -34,6 +34,9 @@ function NewHeadsSubscriptionModel(utils, formatters) { NewHeadsSubscriptionModel.call(this, 'eth_subscribe', 'newHeads', null, utils, formatters); } +NewHeadsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); +NewHeadsSubscriptionModel.prototype.constructor = NewHeadsSubscriptionModel; + /** * This method will be executed on each new subscription item. * @@ -48,7 +51,4 @@ NewHeadsSubscriptionModel.prototype.onNewSubscriptionItem = function (subscripti return this.formatters.outputBlockFormatter(subscriptionItem); }; -NewHeadsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); -NewHeadsSubscriptionModel.prototype.constructor = NewHeadsSubscriptionModel; - module.expors = NewHeadsSubscriptionModel; diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js index 75aeeee1438..8974cc77a41 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -35,6 +35,9 @@ function SyncingSubscriptionModel(utils, formatters) { this.isSyncing = null; } +SyncingSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); +SyncingSubscriptionModel.prototype.constructor = SyncingSubscriptionModel; + /** * This method will be executed on each new subscription item. * @@ -66,7 +69,5 @@ SyncingSubscriptionModel.prototype.onNewSubscriptionItem = function (subscriptio return this.formatters.outputSyncingFormatter(subscriptionItem); }; -SyncingSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); -SyncingSubscriptionModel.prototype.constructor = SyncingSubscriptionModel; module.exports = SyncingSubscriptionModel; diff --git a/packages/web3-core/src/AbstractWeb3Module.js b/packages/web3-core/src/AbstractWeb3Module.js index acc69546ff9..517b34490fe 100644 --- a/packages/web3-core/src/AbstractWeb3Module.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -69,8 +69,8 @@ function AbstractWeb3Module( } }); - this.BatchRequest = function BatchRequest() { - return self.providersPackage.createBatchRequest(self.currentProvider); + this.BatchRequest = function () { + return new self.providersPackage.BatchRequest(self.currentProvider); }; if (this.isDependencyGiven(methodModelFactory)) { diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index 9214361a3a0..a5bc8b52b22 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -30,15 +30,13 @@ module.exports = { version: version, /** - * TODO: Improve dependency handling for ethersAbiCoder - * * Returns the ABICoder object * - * @method createAbiCoder + * @method AbiCoder * * @returns {ABICoder} */ - createAbiCoder: function() { + AbiCoder: function () { return new ABICoder(Utils); } }; diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 73b6433bfec..d1090b7fac7 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -24,7 +24,7 @@ var version = require('../package.json').version; var Accounts = require('./Accounts'); -var MethodPackage = require('web3-core-method'); +var MethodController = require('web3-core-method').MethodController; var ProvidersPackage = require('web3-providers'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; @@ -34,21 +34,19 @@ module.exports = { version: version, /** - * TODO: Improve dependency handling of Accounts - * * Returns the Accounts object * - * @method createAccounts + * @method Accounts * * @params {AbstractProviderAdapter|EthereumProvider} provider * * @returns {Accounts} */ - createAccounts: function(provider) { + Accounts: function (provider) { return new Accounts( provider, ProvidersPackage, - MethodPackage.createMethodController(), + new MethodController(), new MethodModelFactory(Utils, formatters), Utils, formatters diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index bf52eb67466..9f646b735e4 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -155,6 +155,9 @@ function Contract( ); } +Contract.prototype = Object.create(AbstractWeb3Module.prototype); +Contract.prototype.constructor = Contract; + /** * Adds event listeners and creates a subscription, and remove it once its fired. * @@ -268,7 +271,4 @@ Contract.prototype.setProvider = function (provider, net) { ); }; -Contract.prototype = Object.create(AbstractWeb3Module.prototype); -Contract.prototype.constructor = Contract; - module.exports = Contract; diff --git a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js index e099cb757a4..3b586ade64e 100644 --- a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js @@ -36,6 +36,9 @@ function AllEventsLogDecoder(abiModel, abiCoder, formatters) { this.abiModel = abiModel; } +AllEventsLogDecoder.prototype = Object.create(EventLogDecoder.prototype); +AllEventsLogDecoder.prototype.constructor = AllEventsLogDecoder; + /** * Decodes the event subscription response * @@ -54,5 +57,4 @@ AllEventsLogDecoder.prototype.decode = function (abiItemModel, response) { ); }; -AllEventsLogDecoder.prototype = Object.create(EventLogDecoder.prototype); -AllEventsLogDecoder.prototype.constructor = AllEventsLogDecoder; +module.exports = AllEventsLogDecoder; diff --git a/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js index 84df84f830f..c2ab998e608 100644 --- a/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js +++ b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js @@ -58,3 +58,5 @@ CallMethodResponseDecoder.prototype.decode = function (abiItemOutputTypes, respo return result; }; + +module.exports = CallMethodResponseDecoder; diff --git a/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js index 97e7ad7c0f5..084b1cf2407 100644 --- a/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js +++ b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js @@ -33,6 +33,9 @@ function AllEventsFilterEncoder(abiCoder) { EventFilterEncoder.call(this, abiCoder); } +AllEventsFilterEncoder.prototype = Object.create(EventFilterEncoder.prototype); +AllEventsFilterEncoder.prototype.constructor = AllEventsFilterEncoder; + /** * Creates encoded topics from filter option of an event. * @@ -53,7 +56,4 @@ AllEventsFilterEncoder.prototype.encode = function (abiModel, filter) { return topics; }; -AllEventsFilterEncoder.prototype = Object.create(EventFilterEncoder.prototype); -AllEventsFilterEncoder.prototype.constructor = AllEventsFilterEncoder; - module.exports = AllEventsFilterEncoder; diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 0b02746d86e..f48da9eed88 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -24,11 +24,11 @@ var version = require('../package.json').version; var PromiEventPackage = require('web3-core-promievent'); -var MethodPackage = require('web3-core-method'); +var MethodController = require('web3-core-method').MethodController; var ProvidersPackage = require('web3-providers'); -var ABIPackage = require('web3-eth-abi'); -var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; +var Utils = require('web3-utils'); +var AbiCoder = require('web3-eth-abi').AbiCoder; var Contract = require('./Contract'); var ContractDeployMethodModel = require('./models/methods/ContractDeployMethodModel'); var ContractPackageFactory = require('./factories/ContractPackageFactory'); @@ -36,12 +36,13 @@ var ContractPackageFactory = require('./factories/ContractPackageFactory'); module.exports = { version: version, - Contract: Contract, ContractDeployMethodModel: ContractDeployMethodModel, /** * Returns an object of type Contract * + * @method Contract + * * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Accounts} accounts * @param {Object} abi @@ -50,16 +51,16 @@ module.exports = { * * @returns {Contract} */ - createContract: function (provider, accounts, abi, address, options) { + Contract: function (provider, accounts, abi, address, options) { return new ContractPackageFactory( Utils, formatters, - ABIPackage.createAbiCoder(), + new AbiCoder(), accounts ).createContract( provider, ProvidersPackage, - MethodPackage.createMethodController(), + new MethodController(), PromiEventPackage, abi, address, diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index d64189e7d1e..44eb4858156 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -127,4 +127,4 @@ ABIItemModel.prototype.isOfType = function (type) { return this.abiItem.type === type; }; -module.export = ABIItemModel; +module.exports = ABIItemModel; diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js index b42f324d20c..36f58563cc0 100644 --- a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -39,6 +39,9 @@ function CallContractMethodModel(abiItemModel, callMethodResponseDecoder, utils, this.abiItemModel = abiItemModel; } +CallContractMethodModel.prototype = Object.create(CallMethodModel.prototype); +CallContractMethodModel.prototype.constructor = CallContractMethodModel; + /** * This method will be executed after the RPC request. * @@ -52,7 +55,4 @@ CallContractMethodModel.prototype.afterExecution = function (response) { return this.callMethodResponseDecoder.decode(this.abiItemModel, response); }; -CallContractMethodModel.prototype = Object.create(CallMethodModel.prototype); -CallContractMethodModel.prototype.constructor = CallContractMethodModel; - module.exports = CallContractMethodModel; diff --git a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js index b9a7222afd2..9542e5ed4f1 100644 --- a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js @@ -36,6 +36,9 @@ function PastEventLogsMethodModel(abiItemModel, utils, formatters) { this.abiItemModel = abiItemModel; } +PastEventLogsMethodModel.prototype = Object.create(GetPastLogsMethodModel.prototype); +PastEventLogsMethodModel.prototype.constructor = PastEventLogsMethodModel; + /** * This method will be executed after the RPC request. * @@ -56,7 +59,4 @@ PastEventLogsMethodModel.prototype.afterExecution = function (response) { return formattedLogs; }; -PastEventLogsMethodModel.prototype = Object.create(GetPastLogsMethodModel.prototype); -PastEventLogsMethodModel.prototype.constructor = PastEventLogsMethodModel; - module.exports = PastEventLogsMethodModel; diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js index cc64f1337ef..e7170bbc067 100644 --- a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -40,6 +40,9 @@ function SendContractMethodModel(abiItemModel, allEventsLogDecoder, utils, forma this.allEventsLogDecoder = allEventsLogDecoder; } +SendContractMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); +SendContractMethodModel.prototype.constructor = SendContractMethodModel; + /** * This method will be executed after the RPC request. * @@ -85,7 +88,4 @@ SendContractMethodModel.prototype.afterExecution = function (response) { return response; }; -SendContractMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); -SendContractMethodModel.prototype.constructor = SendContractMethodModel; - module.exports = SendContractMethodModel; diff --git a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js index efcd60e3fa4..533371dffe3 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js @@ -46,6 +46,9 @@ function AllEventsLogSubscription( this.allEventsLogDecoder = allEventsLogDecoder; } +AllEventsLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); +AllEventsLogSubscription.prototye.constructor = AllEventsLogSubscription; + /** * This method will be executed on each new subscription item. * @@ -60,7 +63,4 @@ AllEventsLogSubscription.prototype.onNewSubscriptionItem = function (subscriptio return this.allEventsLogDecoder.decode(null, this.formatters.outputLogFormatter(subscriptionItem)); }; -AllEventsLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); -AllEventsLogSubscription.prototye.constructor = AllEventsLogSubscription; - module.exports = AllEventsLogSubscription; diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index fc5cd06d9dc..620f81dd06f 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -49,6 +49,9 @@ function EventLogSubscription( this.abiItemModel = abiItemModel; } +EventLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); +EventLogSubscription.prototye.constructor = EventLogSubscription; + /** * This method will be executed on each new subscription item. * @@ -63,7 +66,4 @@ EventLogSubscription.prototype.onNewSubscriptionItem = function (subscription, s return this.eventLogDecoder.decode(this.abiItemModel, this.formatters.outputLogFormatter(subscriptionItem)); }; -EventLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); -EventLogSubscription.prototye.constructor = EventLogSubscription; - module.exports = EventLogSubscription; diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index 8571a233441..98ae888f32e 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -41,7 +41,7 @@ function Registry(provider, accounts, contractPackage, registryABI, resolverABI) this.provider = provider; this.contract = this.checkNetwork().then(function (address) { - return self.contractPackage.createContract( + return new self.contractPackage.Contract( self.provider, self.accounts, self.registryABI, @@ -117,7 +117,7 @@ Registry.prototype.resolver = function (name) { return this.contract.then(function (contract) { return contract.methods.resolver(namehash.hash(name)).call(); }).then(function (address) { - return self.contractPackage.createContract( + return new self.contractPackage.Contract( self.provider, self.accounts, self.resolverABI, diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index 5d8da0edc70..86980978c19 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -33,7 +33,7 @@ module.exports = { // TODO: overthink the ens package architecture and refactor /** * Returns the ENS object * - * @method createENS + * @method ENS * * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Network} net @@ -41,7 +41,7 @@ module.exports = { // TODO: overthink the ens package architecture and refactor * * @returns {ENS} */ - createENS: function (provider, net, accounts) { + ENS: function (provider, net, accounts) { return new ENSPackageFactory().createENS( provider, net, diff --git a/packages/web3-eth-iban/src/index.js b/packages/web3-eth-iban/src/index.js index c2ef61ae364..9c99136752c 100644 --- a/packages/web3-eth-iban/src/index.js +++ b/packages/web3-eth-iban/src/index.js @@ -28,16 +28,5 @@ var Iban = require('./Iban.js'); module.exports = { version: version, - /** - * Returns an object of type Iban - * - * @method createIban - * - * @param {String} iban - * - * @returns {Iban} - */ - createIban: function (iban) { - return new Iban(iban); - } + Iban: Iban }; diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 3f860362b0c..4e8506f6109 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -70,6 +70,9 @@ function Personal(provider, providersPackage, methodController, methodModelFacto }); } +Personal.prototype = Object.create(AbstractWeb3Module); +Personal.prototype.constructor = Personal; + /** * Extends setProvider method from AbstractWeb3Module. * @@ -84,9 +87,6 @@ Personal.prototype.setProvider = function (provider, net) { return !!(AbstractWeb3Module.setProvider.call(this, provider, net) && this.net.setProvider(provider, net)); }; -Personal.prototype = Object.create(AbstractWeb3Module); -Personal.prototype.constructor = Personal; - module.exports = Personal; diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 32387e53f4b..e9205f566b2 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -24,8 +24,8 @@ var version = require('./package.json').version; var Personal = require('./Personal'); -var MethodPackage = require('web3-core-method'); -var NetworkPackage = require('web3-net'); +var MethodController = require('web3-core-method').MethodController; +var Network = require('web3-net').Network; var ProvidersPackage = require('web3-providers'); var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; @@ -37,19 +37,19 @@ module.exports = { /** * Returns the Personal object * - * @method createPersonal + * @method Personal * * @param {AbstractProviderAdapter|EthereumProvider} provider * * @returns {Personal} */ - createPersonal: function (provider) { + Personal: function (provider) { return new Personal( provider, ProvidersPackage, - MethodPackage.createMethodController(), + new MethodController(), new MethodModelFactory(Utils, formatters), - NetworkPackage.createNetwork(provider), + new Network(provider), Utils, formatters ); diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index fd071ec7f89..5854a84eba7 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -30,7 +30,7 @@ var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; * @param {ContractPackage} contractPackage * @param {Accounts} accounts * @param {Personal} personal - * @param {IbanPackage} iban + * @param {Iban} iban * @param {Abi} abi * @param {ENS} ens * @param {Object} utils @@ -48,7 +48,7 @@ var Eth = function Eth( contractPackage, accounts, personal, - IbanPackage, + iban, abi, ens, utils, @@ -71,20 +71,7 @@ var Eth = function Eth( this.net = net; this.accounts = accounts; this.personal = personal; - - /** - * This wrapper function is required for the "new web3.eth.Iban(...)" call. - * - * @param {String} iban - * - * @returns {Iban} - * - * @constructor - */ - this.Iban = function Iban (iban) { - return IbanPackage.createIban(iban); - }; - + this.Iban = Iban; this.abi = abi; this.ens = ens; this.utils = utils; @@ -104,7 +91,7 @@ var Eth = function Eth( * @constructor */ this.Contract = function (abi, address, options) { - var contract = contractPackage.createContract(self.currentProvider, self.accounts, abi, address, options); + var contract = new contractPackage.Contract(self.currentProvider, self.accounts, abi, address, options); self.initiatedContracts.push(contract); return contract; @@ -153,6 +140,9 @@ var Eth = function Eth( }); }; +Eth.prototype = Object.create(AbstractWeb3Module.prototype); +Eth.prototype.constructor = Eth; + /** * Gets and executes subscription for an given type * @@ -218,7 +208,4 @@ Eth.prototype.setProvider = function (provider, net) { ); }; -Eth.prototype = Object.create(AbstractWeb3Module.prototype); -Eth.prototype.constructor = Eth; - module.exports = Eth; diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 70720e61e47..09e5c08dca9 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -72,6 +72,9 @@ function MethodModelFactory(utils, formatters, accounts) { ); } +MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); +MethodModelFactory.prototype.constructor = MethodModelFactory; + /** * Returns an MethodModel object * @@ -85,7 +88,4 @@ MethodModelFactory.prototype.createMethodModel = function (name) { return new this.methodModels[name](this.utils, this.formatters, this.accounts); }; -MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); -MethodModelFactory.prototype.constructor = MethodModelFactory; - module.exports = MethodModelFactory; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index d87ec56726a..7e9f75fc8f8 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -25,18 +25,18 @@ var version = require('./package.json').version; var MethodModelFactory = require('./factories/MethodModelFactory'); var Eth = require('./Eth'); -var NetPackage = require('web3-net'); -var ContractPackage = require('web3-eth-contract'); -var AccountsPackage = require('web3-eth-accounts'); -var PersonalPackage = require('web3-eth-personal'); -var ENSPackage = require('web3-eth-ens'); -var AbiPackage = require('web3-eth-abi'); -var SubscriptionsPackage = require('web3-core-subscriptions'); -var ProvidersPackage = require('web3-providers'); -var Iban = require('web3-eth-iban').Iban; +var MethodController = require('web3-core-method').MethodController; var formatters = require('web3-core-helpers').formatters; +var Network = require('web3-net').Network; +var ProvidersPackage = require('web3-providers'); var Utils = require('web3-utils'); -var MethodPackage = require('web3-core-method'); +var Accounts = require('web3-eth-accounts').Accounts; +var Personal = require('web3-eth-personal').Personal; +var ENS = require('web3-eth-ens').ENS; +var SubscriptionsFactory = require('web3-core-subscriptions').SubscriptionsFactory; +var AbiCoder = require('web3-eth-abi').AbiCoder; +var Iban = require('web3-eth-iban').Iban; +var ContractPackage = require('web3-eth-contract'); module.exports = { version: version, @@ -44,29 +44,29 @@ module.exports = { /** * Creates the Eth object * - * @method createEth + * @method Eth * * @param {AbstractProviderAdapter|EthereumProvider} provider * * @returns {Eth} */ - createEth: function (provider) { - var accounts = AccountsPackage.createAccounts(provider); + Eth: function (provider) { + var accounts = new Accounts(provider); return new Eth( provider, - NetPackage.createNetwork(provider), + new Network(provider), ContractPackage, accounts, - PersonalPackage.createPersonal(provider), + new Personal(provider), Iban, - AbiPackage.createAbiCoder(utils), - ENSPackage.createENS(provider), + new AbiCoder(utils), + new ENS(provider), Utils, formatters, ProvidersPackage, - SubscriptionsPackage.createSubscriptionsFactory(), - MethodPackage.createMethodController(), + new SubscriptionsFactory(), + new MethodController(), new MethodModelFactory(Utils, formatters, accounts) ); } diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index da167c5b215..0fafa95415d 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -41,6 +41,9 @@ function Network(provider, providersPackage, methodController, methodModelFactor this.utils = utils; } +Network.prototype = Object.create(AbstractWeb3Module.prototype); +Network.prototype.constructor = Network; + /** * Determines to which network web3 is currently connected * @@ -94,7 +97,4 @@ Network.prototype.getNetworkType = function (callback) { }); }; -Network.prototype = Object.create(AbstractWeb3Module.prototype); -Network.prototype.constructor = Network; - module.exports = Network; diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index ab0363017d9..5914271f060 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -25,7 +25,7 @@ var version = require('../package.json').version; var ProvidersPackage = require('web3-providers'); -var MethodPackage = require('web3-core-method'); +var MethodController = require('web3-core-method').MethodController; var formatters = require('web3-core-helpers').formatters; var utils = require('web3-utils'); var Network = require('./Network'); @@ -38,17 +38,17 @@ module.exports = { /** * Creates the Network Object * - * @method createNetwork + * @method Network * * @param {AbstractProviderAdapter|EthereumProvider} provider * * @returns {Network} */ - createNetwork: function (provider) { + Network: function (provider) { return new Network( provider, ProvidersPackage, - MethodPackage.createMethodController(), + new MethodController(), new MethodModelFactory(Utils, formatters), formatters, utils diff --git a/packages/web3-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-providers/src/adapters/InpageProviderAdapter.js index 7c02a2a75d0..75210c7ab55 100644 --- a/packages/web3-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-providers/src/adapters/InpageProviderAdapter.js @@ -35,6 +35,9 @@ function InpageProviderAdapter(inpageProvider) {// TODO: Check if there is a way delete this.provider.sendAsync; } +InpageProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); +InpageProviderAdapter.prototype.constructor = InpageProviderAdapter; + /** * Checks if the provider is connected * @@ -46,7 +49,4 @@ InpageProviderAdapter.prototype.isConnected = function () { return this.provider.isConnected; }; -InpageProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); -InpageProviderAdapter.prototype.constructor = InpageProviderAdapter; - module.exports = InpageProviderAdapter; diff --git a/packages/web3-providers/src/index.js b/packages/web3-providers/src/index.js index 0396ed7d770..75974530b2f 100644 --- a/packages/web3-providers/src/index.js +++ b/packages/web3-providers/src/index.js @@ -47,13 +47,13 @@ module.exports = { /** * Returns the Batch object * - * @method createBatchRequest + * @method BatchRequest * * @param {AbstractProviderAdapter|EthereumProvider} provider * * @returns {BatchRequest} */ - createBatchRequest: function (provider) { + BatchRequest: function (provider) { return new BatchRequest( provider, JSONRpcMapper, diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index c52d445d73a..d0c14abcac3 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -45,6 +45,9 @@ function Shh(provider, providersPackage, methodController, methodModelFactory, s this.net = net; } +Shh.prototype = Object.create(AbstractWeb3Module.prototype); +Shh.prototype.constructor = Shh; + /** * Subscribe to whisper streams * @@ -81,7 +84,4 @@ Shh.prototype.setProvider = function (provider, net) { ); }; -Shh.prototype = Object.create(AbstractWeb3Module.prototype); -Shh.prototype.constructor = Shh; - module.exports = Shh; diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 6705b6650fb..4ccdbf80ab5 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -24,9 +24,9 @@ var version = require('./package.json'); var ProvidersPackage = require('web3-providers'); -var MethodPackage = require('web3-core-method'); -var SubscriptionsPackage = require('web3-core-subscriptions'); -var NetworkPackage = require('web3-net'); +var MethodController = require('web3-core-method').MethodController; +var SubscriptionsFactory = require('web3-core-subscriptions').SubscriptionsFactory; +var Network = require('web3-net').Network; var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; var Shh = require('./Shh'); @@ -38,20 +38,20 @@ module.exports = { /** * Returns the Shh object. * - * @method createShh + * @method Shh * * @param {AbstractProviderAdapter|EthereumProvider} provider * * @returns {Shh} */ - createShh: function (provider) { + Shh: function (provider) { return new Shh( provider, ProvidersPackage, - MethodPackage.createMethodController(), + new MethodController(), new MethodModelFactory(Utils, formatters), - SubscriptionsPackage.createSubscriptionsFactory(), - NetworkPackage.createNetwork(provider) + new SubscriptionsFactory(), + new Network(provider) ); } }; diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 167d8eb70ed..20319f4df5b 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -26,12 +26,12 @@ var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; var formatters = require('web3-core-helpers').formatters; var MethodPackage = require('web3-core-method'); var ProvidersPackage = require('web3-providers'); -var EthPackage = require('web3-eth'); -var PersonalPackage = require('web3-eth-personal'); var Utils = require('web3-utils'); -var ShhPackage = require('web3-shh'); -var BzzPackage = require('web3-bzz'); -var NetworkPackage = require('web3-net'); +var Eth = require('web3-eth').Eth; +var Shh = require('web3-shh').Shh; +var Bzz = require('web3-bzz').Bzz; +var Network = require('web3-net').Network; +var Personal = require('web3-eth-personal').Personal; var version = require('../package.json').version; /** @@ -53,9 +53,9 @@ var Web3 = function Web3(provider, net) { ); this.utils = Utils; - this.eth = EthPackage.createEth(provider); - this.shh = ShhPackage.createShh(provider); - this.bzz = BzzPackage.createBzz(provider); + this.eth = new Eth(provider); + this.shh = new Shh(provider); + this.bzz = new Bzz(provider); }; /** @@ -88,19 +88,19 @@ Web3.utils = Utils; Web3.modules = { Eth: function (provider, net) { - return EthPackage.createEth(ProvidersPackage.resolve(provider, net)); + return new Eth(ProvidersPackage.resolve(provider, net)); }, Net: function (provider, net) { - return NetworkPackage.createNetwork(ProvidersPackage.resolve(provider, net)); + return new Network(ProvidersPackage.resolve(provider, net)); }, Personal: function (provider, net) { - return PersonalPackage.createPersonal(ProvidersPackage.resolve(provider, net)); + return new Personal(ProvidersPackage.resolve(provider, net)); }, Shh: function (provider, net) { - return ShhPackage.createShh(ProvidersPackage.resolve(provider, net)); + return new Shh(ProvidersPackage.resolve(provider, net)); }, Bzz: function (provider, net) { - return new BzzPackage.createBzz(ProvidersPackage.resolve(provider, net)); + return new Bzz(ProvidersPackage.resolve(provider, net)); } }; From 39343562ad464be5bad3d6b8baa62082aecc13c4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 13:20:04 +0200 Subject: [PATCH 0256/1045] CodeStyle improvements and web3-core-method readme updated --- packages/web3-core-helpers/src/formatters.js | 2 +- packages/web3-core-method/README.md | 22 +++++++++---------- .../lib/models/AbstractMethodModel.js | 10 ++++----- .../src/commands/SignMessageCommand.js | 2 ++ packages/web3/package.json | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index 914a616cf9f..e06ab1872b7 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -160,7 +160,7 @@ var inputTransactionFormatter = function (options, moduleInstance) { throw new Error('The send transactions "from" field must be defined!'); } - options.from = (options.from); + options.from = inputAddressFormatter(options.from); } return options; diff --git a/packages/web3-core-method/README.md b/packages/web3-core-method/README.md index 2fe4c29f093..53db6fa1c8a 100644 --- a/packages/web3-core-method/README.md +++ b/packages/web3-core-method/README.md @@ -34,7 +34,7 @@ This will expose the `Web3Method` object on the window object. var AbstractWeb3Module = require('web3-package').AbstractWeb3Module; var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; -var MethodPackage = require('web3-core-method'); +var MethodController = require('web3-core-method').MethodController; var ProvidersPackage = require('web3-providers'); // Create an object/package like Eth @@ -46,7 +46,7 @@ var ProvidersPackage = require('web3-providers'); * * @constructor */ -function MyObject ( +function Module ( provider, providersPackage, methodController, @@ -62,8 +62,8 @@ function MyObject ( }; // Inherit from AbstractWeb3Module -MyObject.prototype = Object.create(AbstractWeb3Module.prototype); -MyObject.prototype.constructor = MyObject; +Module.prototype = Object.create(AbstractWeb3Module.prototype); +Module.prototype.constructor = Module; // Create the MyMethoModelFactory object @@ -73,7 +73,7 @@ MyObject.prototype.constructor = MyObject; * * @constructor */ -function MyMethodModelFactory(utils, formatters) { +function MethodModelFactory(utils, formatters) { MethodPackage.AbstractMethodModelFactory.call( this, { @@ -85,21 +85,21 @@ function MyMethodModelFactory(utils, formatters) { } // Inherit from AbstractMethodModelFactory -MyMethodModelFactory.prototype = Object.create( +MethodModelFactory.prototype = Object.create( MethodPackage.AbstractMethodModelFactory.prototype ); -MyMethodModelFactory.prototype.constructor = MyMethodModelFactory; +MethodModelFactory.prototype.constructor = MethodModelFactory; // Instantiate anything -var myObject = new MyObject( +var module = new Module( ProvidersPackage.detect(), ProvidersPackage, - MethodPackage.createMethodController(), - new MyMethodModelFactory(Utils, formatters) + new MethodController(), + new MethodModelFactory(Utils, formatters) ); -myObject.sendTransaction({...}, function(){ ... }); +module.sendTransaction({...}, function(){ ... }); ``` diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 53468d31c3e..141b29e673d 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -131,7 +131,7 @@ AbstractMethodModel.prototype.mapFunctionArguments = function (args) { * * @method isSign * - * @returns {boolean} + * @returns {Boolean} */ AbstractMethodModel.prototype.isSign = function () { return this.rpcMethod === 'eth_sign'; @@ -142,7 +142,7 @@ AbstractMethodModel.prototype.isSign = function () { * * @method isSendTransaction * - * @returns {boolean} + * @returns {Boolean} */ AbstractMethodModel.prototype.isSendTransaction = function () { return this.rpcMethod === 'eth_sendTransaction'; @@ -153,7 +153,7 @@ AbstractMethodModel.prototype.isSendTransaction = function () { * * @method isSendRawTransaction * - * @returns {boolean} + * @returns {Boolean} */ AbstractMethodModel.prototype.isSendRawTransaction = function () { return this.rpcMethod === 'eth_sendRawTransaction'; @@ -164,9 +164,9 @@ AbstractMethodModel.prototype.isSendRawTransaction = function () { * * @method isHash * - * @param {any} parameter + * @param {*} parameter * - * @returns {boolean} + * @returns {Boolean} */ AbstractMethodModel.prototype.isHash = function (parameter) { return _.isString(parameter) && parameter.indexOf('0x') === 0; diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js index 2caaca2bad0..97eabe21e22 100644 --- a/packages/web3-core-method/src/commands/SignMessageCommand.js +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -34,6 +34,8 @@ function SignMessageCommand(messageSigner) { /** * Executes the SignMessageCommand and returns the signed message * + * @method execute + * * @param {AbstractWeb3Module} moduleInstance * @param {AbstractMethodModel} methodModel * @param {Accounts} accounts diff --git a/packages/web3/package.json b/packages/web3/package.json index 505bb912701..d24f1fa30f0 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -24,7 +24,7 @@ { "name": "Fabian Vogelsteller", "email": "fabian@ethereum.org", - "homepage": "http://frozeman.de" + "homepage": "https://github.com/frozeman" }, { "name": "Marek Kotewicz", From ae409f002ca53f52c930d2380951b580fa62d8da Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 13:20:55 +0200 Subject: [PATCH 0257/1045] readme changed --- packages/web3-core-method/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/web3-core-method/README.md b/packages/web3-core-method/README.md index 53db6fa1c8a..c0218113234 100644 --- a/packages/web3-core-method/README.md +++ b/packages/web3-core-method/README.md @@ -34,7 +34,7 @@ This will expose the `Web3Method` object on the window object. var AbstractWeb3Module = require('web3-package').AbstractWeb3Module; var Utils = require('web3-utils'); var formatters = require('web3-core-helpers').formatters; -var MethodController = require('web3-core-method').MethodController; +var MethodPackage = require('web3-core-method'); var ProvidersPackage = require('web3-providers'); // Create an object/package like Eth @@ -95,7 +95,7 @@ MethodModelFactory.prototype.constructor = MethodModelFactory; var module = new Module( ProvidersPackage.detect(), ProvidersPackage, - new MethodController(), + new MethodPackage.MethodController(), new MethodModelFactory(Utils, formatters) ); From 0891a62bc7917c73621f6a57b98705a141073035 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 13:27:42 +0200 Subject: [PATCH 0258/1045] readme's updated --- packages/web3-bzz/README.md | 4 ++-- packages/web3-core-promievent/README.md | 4 ++-- packages/web3-core-subscriptions/README.md | 16 ++++++++-------- packages/web3-core/README.md | 6 +++--- packages/web3-eth-abi/README.md | 4 ++-- packages/web3-eth-accounts/README.md | 4 ++-- packages/web3-eth-contract/README.md | 8 ++++---- packages/web3-eth-ens/README.md | 12 ++++++------ packages/web3-eth-iban/README.md | 4 ++-- packages/web3-eth-personal/README.md | 4 ++-- packages/web3-eth/README.md | 4 ++-- packages/web3-net/README.md | 4 ++-- packages/web3-shh/README.md | 4 ++-- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/packages/web3-bzz/README.md b/packages/web3-bzz/README.md index ad455d66705..11e70598332 100644 --- a/packages/web3-bzz/README.md +++ b/packages/web3-bzz/README.md @@ -28,9 +28,9 @@ This will expose the `Web3Bzz` object on the window object. ```js // in node.js -var bzzPackage = require('web3-bzz'); +var Bzz = require('web3-bzz').Bzz; -var bzz = bzzPackage.createBzz('http://swarm-gateways.net'); +var bzz = new Bzz('http://swarm-gateways.net'); ``` diff --git a/packages/web3-core-promievent/README.md b/packages/web3-core-promievent/README.md index 250b681a56e..bfcd7a5908b 100644 --- a/packages/web3-core-promievent/README.md +++ b/packages/web3-core-promievent/README.md @@ -29,10 +29,10 @@ This will expose the `Web3PromiEvent` object on the window object. ```js // in node.js -var Web3PromiEvent = require('web3-core-promievent'); +var PromiEvent = require('web3-core-promievent').PromiEvent; var myFunc = function(){ - var promiEvent = Web3PromiEvent.createPromiEvent(); + var promiEvent = new PromiEvent(); setTimeout(function() { promiEvent.eventEmitter.emit('done', 'Hello!'); diff --git a/packages/web3-core-subscriptions/README.md b/packages/web3-core-subscriptions/README.md index 786b65fb965..e397ab60099 100644 --- a/packages/web3-core-subscriptions/README.md +++ b/packages/web3-core-subscriptions/README.md @@ -31,7 +31,7 @@ This will expose the `Web3Subscriptions` object on the window object. // Dependencies var ProvidersPackage = require('web3-providers'); var AbstractWeb3Module = require('web3-package').AbstractWeb3Module; -var SubscriptionsPackage = require('web3-core-subscriptions'); +var SubscriptionsFactory = require('web3-core-subscriptions').SubscriptionsFactory; // Create an object of type AbstractWeb3Module /** @@ -41,7 +41,7 @@ var SubscriptionsPackage = require('web3-core-subscriptions'); * * @constructor */ -function MyObject ( +function Module ( provider, providersPackage, subscriptionsFactory @@ -66,7 +66,7 @@ function MyObject ( * @callback callback callback(error, result) * @returns {Subscription} */ -MyObject.prototype.subscribe = function (subscriptionMethod, callback) { +Module.prototype.subscribe = function (subscriptionMethod, callback) { switch (subscriptionMethod) { case 'newBlockHeaders': return this.subscriptionsFactory @@ -82,18 +82,18 @@ MyObject.prototype.subscribe = function (subscriptionMethod, callback) { }; // Inherit from AbstractWeb3Module -MyObject.prototype = Object.create(AbstractWeb3Module.prototype); -MyObject.prototype.constructor = MyObject; +Module.prototype = Object.create(AbstractWeb3Module.prototype); +Module.prototype.constructor = Module; // Instantiate anything -var myObject = new MyObject( +var module = new Module( ProvidersPackage.detect(), ProvidersPackage, - SubscriptionsPackage.createSubscriptionsFactory() + new SubscriptionsFactory() ); // Subscribe -myObject.subscribe('newBlockHeaders', function(){ ... }); +module.subscribe('newBlockHeaders', function(){ ... }); ``` [docs]: http://web3js.readthedocs.io/en/1.0/ diff --git a/packages/web3-core/README.md b/packages/web3-core/README.md index f15642b1c94..5af4936fcb4 100644 --- a/packages/web3-core/README.md +++ b/packages/web3-core/README.md @@ -53,7 +53,7 @@ var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; * * @constructor */ -function MyObject ( +function Module ( provider, providersPackage, methodController, // optional @@ -69,8 +69,8 @@ function MyObject ( } // Inherit from AbstractWeb3Module -MyObject.prototype = Object.create(AbstractWeb3Module.prototype); -MyObject.prototype.constructor = MyObject; +Module.prototype = Object.create(AbstractWeb3Module.prototype); +Module.prototype.constructor = Module; ``` [docs]: http://web3js.readthedocs.io/en/1.0/ diff --git a/packages/web3-eth-abi/README.md b/packages/web3-eth-abi/README.md index 8fea9733643..83ccbc69a94 100644 --- a/packages/web3-eth-abi/README.md +++ b/packages/web3-eth-abi/README.md @@ -29,8 +29,8 @@ This will expose the `Web3EthAbi` object on the window object. ```js // in node.js -var AbiPackage = require('web3-eth-abi'); -var abiCoder = AbiPackage.createAbiCoder(); +var AbiCoder = require('web3-eth-abi').AbiCoder; +var abiCoder = new AbiCoder(); abiCoder.encodeFunctionSignature('myMethod(uint256,string)'); > '0x24ee0097' diff --git a/packages/web3-eth-accounts/README.md b/packages/web3-eth-accounts/README.md index 6db91219146..034e9fc93b2 100644 --- a/packages/web3-eth-accounts/README.md +++ b/packages/web3-eth-accounts/README.md @@ -30,9 +30,9 @@ This will expose the `Web3EthAccounts` object on the window object. ```js // in node.js var ProvidersPackage = require('web3-providers'); -var AccountsPackage = require('web3-eth-accounts'); +var Accounts = require('web3-eth-accounts').Accounts; -var accounts = AccountsPackage.createAccounts( +var accounts = new Accounts( ProvidersPackage.resolve('ws://localhost:8546') ); diff --git a/packages/web3-eth-contract/README.md b/packages/web3-eth-contract/README.md index 8f49115666d..274f23cb3da 100644 --- a/packages/web3-eth-contract/README.md +++ b/packages/web3-eth-contract/README.md @@ -30,13 +30,13 @@ This will expose the `Web3EthContract` object on the window object. ```js // in node.js var ProvidersPackage = require('web3-providers'); -var AccountsPackage = require('web3-eth-accounts'); -var ContractPackage = require('web3-eth-contract'); +var Accounts = require('web3-eth-accounts').Accounts; +var Contract = require('web3-eth-contract').Contract; var provider = ProvidersPackage.resolve('ws://localhost:8546'); -var contract = ContractPackage.createContract( +var contract = new Contract( provider, - AccountsPackage.createAccounts(provider), + new Accounts(provider), jsonInterface, address, contractOptions diff --git a/packages/web3-eth-ens/README.md b/packages/web3-eth-ens/README.md index 2808d9cac59..b0ad2e17b49 100644 --- a/packages/web3-eth-ens/README.md +++ b/packages/web3-eth-ens/README.md @@ -28,16 +28,16 @@ This will expose the `EthEns` object on the window object. ```js var ProvidersPackage = require('web3-providers'); -var NetPackage = require('web3-net'); -var AccountsPackage = require('web3-eth-accounts'); -var ENSPackage = require('web3-eth-ens'); +var Network = require('web3-net').Network; +var Accounts = require('web3-eth-accounts').Accounts; +var ENS = require('web3-eth-ens').ENS; var provider = ProvidersPackage.resolve('ws://localhost:8546'); -var ens = ENSPackage.createENS( +var ens = new ENS( provider, - NetPackage.createNetwork(provider), - AccountsPackage.createAccounts(provider) + new Network(provider), + new Accounts(provider) ); ens.getAddress('ethereum.eth').then(function (result) { diff --git a/packages/web3-eth-iban/README.md b/packages/web3-eth-iban/README.md index 8914da6a76c..0dd45339381 100644 --- a/packages/web3-eth-iban/README.md +++ b/packages/web3-eth-iban/README.md @@ -29,9 +29,9 @@ This will expose the `Web3EthIban` object on the window object. ```js // in node.js -var IbanPackage = require('web3-eth-iban'); +var Iban = require('web3-eth-iban').Iban; -var iban = IbanPackage.createIban('XE75JRZCTTLBSYEQBGAS7GID8DKR7QY0QA3'); +var iban = new Iban('XE75JRZCTTLBSYEQBGAS7GID8DKR7QY0QA3'); iban.toAddress() > '0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B' ``` diff --git a/packages/web3-eth-personal/README.md b/packages/web3-eth-personal/README.md index 74cef82c386..62393bf41d9 100644 --- a/packages/web3-eth-personal/README.md +++ b/packages/web3-eth-personal/README.md @@ -30,8 +30,8 @@ This will expose the `Web3EthPersonal` object on the window object. ```js // in node.js var ProvidersPackage = require('web3-providers'); -var PersonalPackage = require('web3-eth-personal'); -var personal = PersonalPackage.createPersonal(ProvidersPackage.resolve('ws://localhost:8546')); +var Personal = require('web3-eth-personal').Personal; +var personal = new Personal(ProvidersPackage.resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-eth/README.md b/packages/web3-eth/README.md index 148df3aebba..23b79c545bb 100644 --- a/packages/web3-eth/README.md +++ b/packages/web3-eth/README.md @@ -30,9 +30,9 @@ This will expose the `Web3Eth` object on the window object. ```js // in node.js var ProvidersPackage = require('web3-providers'); -var EthPackage = require('web3-eth'); +var Eth = require('web3-eth').Eth; -var eth = EthPackage.createEth( +var eth = new Eth( ProvidersPackage.resolve('http://127.0.0.1:4546') ); ``` diff --git a/packages/web3-net/README.md b/packages/web3-net/README.md index e6f8d3e9a2b..3fdf2912e1f 100644 --- a/packages/web3-net/README.md +++ b/packages/web3-net/README.md @@ -30,8 +30,8 @@ This will expose the `Web3Net` object on the window object. ```js // in node.js var ProvidersPackage = require('web3-providers'); -var NetworkPackage = require('web3-net'); -var net = NetworkPackage.createNetwork(ProvidersPackage.resolve('ws://localhost:8546')); +var Network = require('web3-net').Network; +var net = new Network(ProvidersPackage.resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-shh/README.md b/packages/web3-shh/README.md index ba8a90c3f89..31c247aa77c 100644 --- a/packages/web3-shh/README.md +++ b/packages/web3-shh/README.md @@ -30,8 +30,8 @@ This will expose the `Web3Shh` object on the window object. ```js // in node.js var ProvidersPackage = require('web3-providers'); -var ShhPackage = require('web3-shh'); -var shh = ShhPackage.createShh(ProvidersPackage.resolve('ws://localhost:8546')); +var Shh = require('web3-shh').Shh; +var shh = new Shh(ProvidersPackage.resolve('ws://localhost:8546')); ``` From 7154bb2e45d8e60bfb22ab592df4245219ef5625 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 13:46:48 +0200 Subject: [PATCH 0259/1045] PromiEvent implemented in a better way --- .../web3-core-promievent/src/PromiEvent.js | 69 +++++++++++-------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/packages/web3-core-promievent/src/PromiEvent.js b/packages/web3-core-promievent/src/PromiEvent.js index 617da45b0ee..0ac6fa0b0dc 100644 --- a/packages/web3-core-promievent/src/PromiEvent.js +++ b/packages/web3-core-promievent/src/PromiEvent.js @@ -16,8 +16,8 @@ */ /** * @file index.js - * @author Fabian Vogelsteller - * @date 2016 + * @author Samuel Furter + * @date 2018 */ "use strict"; @@ -29,32 +29,45 @@ var EventEmitter = require('eventemitter3'); * * @method eventifiedPromise */ -var PromiEvent = function PromiEvent() { - var resolve, reject, - eventEmitter = new Promise(function() { - resolve = arguments[0]; - reject = arguments[1]; - }); - - // get eventEmitter - var emitter = new EventEmitter(); - - // add eventEmitter to the promise - eventEmitter._events = emitter._events; - eventEmitter.emit = emitter.emit; - eventEmitter.on = emitter.on; - eventEmitter.once = emitter.once; - eventEmitter.off = emitter.off; - eventEmitter.listeners = emitter.listeners; - eventEmitter.addListener = emitter.addListener; - eventEmitter.removeListener = emitter.removeListener; - eventEmitter.removeAllListeners = emitter.removeAllListeners; - - return { - resolve: resolve, - reject: reject, - eventEmitter: eventEmitter - }; +function PromiEvent() { + var self = this; + + this.promise = new Promise(function(resolve, reject) { + self.resolve = resolve; + self.reject = reject; + }); + + this.eventEmitter = new EventEmitter(); + + return new Proxy(this, { + get: this.proxyHandler + }); +} + +/** + * Proxy handler to call the promise or eventEmitter methods + * + * @method proxyHandler + * + * @param {PromiEvent} target + * @param {String} name + * + * @returns {Function} + */ +PromiEvent.prototype.proxyHandler = function (target, name) { + if (name === 'resolve' || name === 'reject') { + return target[name]; + } + + if (this.promise[name]) { + return target.promise[name]; + } + + if (this.eventEmitter[name]) { + return target.eventEmitter[name]; + } + + throw Error('Method with name ' + name + ' not found'); }; module.exports = PromiEvent; From cf1ba612d0f37470fb02bbc92955de0a1ac3a6b0 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 13:48:36 +0200 Subject: [PATCH 0260/1045] Constructor funcDoc updated of PromiEvent --- packages/web3-core-promievent/src/PromiEvent.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/web3-core-promievent/src/PromiEvent.js b/packages/web3-core-promievent/src/PromiEvent.js index 0ac6fa0b0dc..5ccc03103de 100644 --- a/packages/web3-core-promievent/src/PromiEvent.js +++ b/packages/web3-core-promievent/src/PromiEvent.js @@ -25,9 +25,7 @@ var EventEmitter = require('eventemitter3'); /** - * This function generates a defer promise and adds eventEmitter functionality to it - * - * @method eventifiedPromise + * @constructor */ function PromiEvent() { var self = this; From ae1ff107b12bc562a02448f8994a3d3575d52eaa Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 14:14:11 +0200 Subject: [PATCH 0261/1045] new PromiEvent implemented in all packages --- .../src/commands/SendMethodCommand.js | 6 ++--- .../src/commands/SignAndSendMethodCommand.js | 4 +-- .../TransactionConfirmationWorkflow.js | 20 +++++++-------- .../tests/commands/SendMethodCommandTest.js | 6 ++--- .../commands/SignAndSendMethodCommandTest.js | 8 +++--- .../tests/controllers/MethodControllerTest.js | 25 ------------------- .../TransactionConfirmationWorkflowTest.js | 2 +- packages/web3-core-promievent/README.md | 4 +-- .../web3-core-promievent/src/PromiEvent.js | 2 +- .../src/proxies/EventSubscriptionsProxy.js | 8 +++--- .../src/proxies/MethodsProxy.js | 4 +-- .../src/handlers/ResolverMethodHandler.js | 24 +++++++++--------- 12 files changed, 44 insertions(+), 69 deletions(-) diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 576c31448d3..59d7b36343f 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -85,15 +85,15 @@ SendMethodCommand.prototype.send = function (methodModel, promiEvent, moduleInst promiEvent ); - promiEvent.eventEmitter.emit('transactionHash', response); + promiEvent.emit('transactionHash', response); if (methodModel.callback) { methodModel.callback(false, response); } }).catch(function (error) { promiEvent.reject(error); - promiEvent.eventEmitter.emit('error', error); - promiEvent.eventEmitter.removeAllListeners(); + promiEvent.emit('error', error); + promiEvent.removeAllListeners(); if (methodModel.callback) { methodModel.callback(error, null); diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index fa73989b6c7..ad29561549f 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -67,8 +67,8 @@ SignAndSendMethodCommand.prototype.execute = function ( self.send(methodModel, promiEvent, moduleInstance); }).catch(function(error) { promiEvent.reject(error); - promiEvent.eventEmitter.emit('error', error); - promiEvent.eventEmitter.removeAllListeners(); + promiEvent.emit('error', error); + promiEvent.removeAllListeners(); if (methodModel.callback) { methodModel.callback(error, null); diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 4ff53a6edbc..d778e1a4f0d 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -81,7 +81,7 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, modul if (validationResult === true) { self.transactionConfirmationModel.addConfirmation(receipt); - promiEvent.eventEmitter.emit( + promiEvent.emit( 'confirmation', self.transactionConfirmationModel.confirmationsCount, receipt @@ -95,8 +95,8 @@ TransactionConfirmationWorkflow.prototype.execute = function (methodModel, modul } promiEvent.reject(validationResult); - promiEvent.eventEmitter.emit('error', validationResult, receipt); - promiEvent.eventEmitter.removeAllListeners(); + promiEvent.emit('error', validationResult, receipt); + promiEvent.removeAllListeners(); if (methodModel.callback) { methodModel.callback(validationResult, null); @@ -151,8 +151,8 @@ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt if (methodModel instanceof ContractDeployMethodModel) { promiEvent.resolve(methodModel.afterExecution(receipt)); - promiEvent.eventEmitter.emit('receipt', receipt); - promiEvent.eventEmitter.removeAllListeners(); + promiEvent.emit('receipt', receipt); + promiEvent.removeAllListeners(); if (methodModel.callback) { methodModel.callback(false, receipt); @@ -164,8 +164,8 @@ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt var mappedReceipt = methodModel.afterExecution(receipt); promiEvent.resolve(mappedReceipt); - promiEvent.eventEmitter.emit('receipt', mappedReceipt); - promiEvent.eventEmitter.removeAllListeners(); + promiEvent.emit('receipt', mappedReceipt); + promiEvent.removeAllListeners(); if (methodModel.callback) { methodModel.callback(false, mappedReceipt); @@ -186,9 +186,9 @@ TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, methodModel, promiEvent) { this.newHeadsWatcher.stop(); - promiEvent.reject(error).apply(error); - promiEvent.eventEmitter.emit('error', error); - promiEvent.eventEmitter.removeAllListeners(); + promiEvent.reject(error); + promiEvent.emit('error', error); + promiEvent.removeAllListeners(); if (methodModel.callback) { methodModel.callback(error, null); diff --git a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js index 88f14c069eb..8c1f03be28d 100644 --- a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js @@ -82,7 +82,7 @@ describe('SendMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.eventEmitter.on('transactionHash', function () { + promiEvent.on('transactionHash', function () { transactionConfirmationWorkflowMock.verify(); providerAdapterMock.verify(); methodModelMock.verify(); @@ -127,7 +127,7 @@ describe('SendMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.eventEmitter.on('transactionHash', function (response) { + promiEvent.on('transactionHash', function (response) { expect(response).equal('response'); expect(methodModel.parameters[0].gasPrice).equal(100); @@ -165,7 +165,7 @@ describe('SendMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.eventEmitter.on('error', function (error) { + promiEvent.on('error', function (error) { expect(error).equal('error'); providerAdapterMock.verify(); diff --git a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js index 7992da0baad..c62fbf1809d 100644 --- a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js @@ -52,10 +52,10 @@ describe('SendAndSignMethodCommandTest', function () { promiEventMock = sinon.mock(promiEvent); promiEventEmitSpy = sinon.spy(); - promiEvent.eventEmitter.emit = promiEventEmitSpy; + promiEvent.emit = promiEventEmitSpy; promiEventRemoveListenersSpy = sinon.spy(); - promiEvent.eventEmitter.removeAllListeners = promiEventRemoveListenersSpy; + promiEvent.removeAllListeners = promiEventRemoveListenersSpy; transactionConfirmationWorkflow = new TransactionConfirmationWorkflow({}, {}, {}, {}); transactionConfirmationWorkflowMock = sinon.mock(transactionConfirmationWorkflow); @@ -106,7 +106,7 @@ describe('SendAndSignMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.eventEmitter.then(function () { + promiEvent.then(function () { expect(promiEventEmitSpy.calledOnce).to.be.true; expect(promiEventEmitSpy.calledWith('transactionHash', 'response')).to.be.true; @@ -142,7 +142,7 @@ describe('SendAndSignMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.eventEmitter.catch(function (error) { + promiEvent.catch(function (error) { expect(promiEventRemoveListenersSpy.calledOnce).to.be.true; expect(promiEventEmitSpy.calledOnce).to.be.true; expect(promiEventEmitSpy.calledWith('error', 'error')).to.be.true; diff --git a/packages/web3-core-method/tests/controllers/MethodControllerTest.js b/packages/web3-core-method/tests/controllers/MethodControllerTest.js index d16833cb5d5..1d933c92211 100644 --- a/packages/web3-core-method/tests/controllers/MethodControllerTest.js +++ b/packages/web3-core-method/tests/controllers/MethodControllerTest.js @@ -65,11 +65,6 @@ describe('MethodControllerTest', function () { it('execute calls signMessageCommand', function () { var accounts = {wallet: [0]}; - promiEventPackageMock - .expects('createPromiEvent') - .returns({}) - .once(); - methodModelMock .expects('isSign') .returns(true) @@ -90,11 +85,6 @@ describe('MethodControllerTest', function () { it('execute calls signAndSendMethodCommand', function () { var accounts = {wallet: [0]}; - promiEventPackageMock - .expects('createPromiEvent') - .returns({}) - .once(); - methodModelMock .expects('isSendTransaction') .returns(true) @@ -113,11 +103,6 @@ describe('MethodControllerTest', function () { }); it('execute calls sendMethodCommand with sendTransaction rpc method', function () { - promiEventPackageMock - .expects('createPromiEvent') - .returns({}) - .once(); - methodModelMock .expects('isSendTransaction') .returns(true) @@ -136,11 +121,6 @@ describe('MethodControllerTest', function () { }); it('execute calls sendMethodCommand with sendRawTransaction rpc method', function () { - promiEventPackageMock - .expects('createPromiEvent') - .returns({}) - .once(); - methodModelMock .expects('isSendTransaction') .returns(false) @@ -164,11 +144,6 @@ describe('MethodControllerTest', function () { }); it('execute calls callMethodCommand', function () { - promiEventPackageMock - .expects('createPromiEvent') - .returns({}) - .once(); - methodModelMock .expects('isSendTransaction') .returns(false) diff --git a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js index b0fae361dc6..83244aa66e1 100644 --- a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js +++ b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js @@ -117,7 +117,7 @@ describe('TransactionConfirmationWorkflowTest', function () { promiEvent ); - promiEvent.eventEmitter.on('receipt', function (receipt) { + promiEvent.on('receipt', function (receipt) { expect(receipt).to.has.an.property('blockHash', '0x00'); }).then(function (response) { expect(methodModelCallbackSpy.calledOnce).to.be.true; diff --git a/packages/web3-core-promievent/README.md b/packages/web3-core-promievent/README.md index bfcd7a5908b..48a269d65db 100644 --- a/packages/web3-core-promievent/README.md +++ b/packages/web3-core-promievent/README.md @@ -35,11 +35,11 @@ var myFunc = function(){ var promiEvent = new PromiEvent(); setTimeout(function() { - promiEvent.eventEmitter.emit('done', 'Hello!'); + promiEvent.emit('done', 'Hello!'); promiEvent.resolve('Hello!'); }, 10); - return promiEvent.eventEmitter; + return promiEvent; }; diff --git a/packages/web3-core-promievent/src/PromiEvent.js b/packages/web3-core-promievent/src/PromiEvent.js index 5ccc03103de..1a6d4523176 100644 --- a/packages/web3-core-promievent/src/PromiEvent.js +++ b/packages/web3-core-promievent/src/PromiEvent.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file index.js + * @file PromiEvent.js * @author Samuel Furter * @date 2018 */ diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 7bea7f9a372..a4c2ed1d3de 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -144,17 +144,17 @@ EventSubscriptionsProxy.prototype.subscribeAll = function (options, callback) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {EventEmitter} + * @returns {PromiEvent} */ EventSubscriptionsProxy.prototype.handleValidationError = function (errorMessage, callback) { - var promiEvent = this.promiEventPackage.createPromiEvent(); - promiEvent.eventEmitter.emit('error', new Error(errorMessage)); + var promiEvent = new this.promiEventPackage.PromiEvent(); + promiEvent.emit('error', new Error(errorMessage)); if (_.isFunction(callback)) { callback(error, null); } - return promiEvent.eventEmitter; + return promiEvent; }; module.exports = EventSubscriptionsProxy; diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 81344216aa4..360bbea1ae5 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -233,11 +233,11 @@ MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, methodArgu * @returns {PromiEvent} */ MethodsProxy.prototype.handleValidationError = function (error, callback) { - var promiEvent = this.promiEventPackage.createPromiEvent(); + var promiEvent = new this.promiEventPackage.PromiEvent(); promiEvent.resolve(null); promiEvent.reject(error); - promiEvent.eventEmitter.emit('error', error); + promiEvent.emit('error', error); if (_.isFunction(callback)) { callback(error, null); diff --git a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js index 048a0869ff9..d0a66e478e3 100644 --- a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js +++ b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js @@ -69,11 +69,11 @@ ResolverMethodHandler.prototype.method = function (ensName, methodName, methodAr * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ResolverMethodHandler.prototype.call = function (callback) { var self = this, - promiEvent = this.promiEventPackage.createPromiEvent(), + promiEvent = new this.promiEventPackage.PromiEvent(), preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); this.parent.registry.resolver(this.ensName).then(function (resolver) { @@ -82,7 +82,7 @@ ResolverMethodHandler.prototype.call = function (callback) { promiEvent.reject(error); }); - return promiEvent.eventEmitter; + return promiEvent; }; @@ -99,7 +99,7 @@ ResolverMethodHandler.prototype.call = function (callback) { */ ResolverMethodHandler.prototype.send = function (sendOptions, callback) { var self = this, - promiEvent = this.promiEventPackage.createPromiEvent(), + promiEvent = new this.promiEventPackage.PromiEvent(), preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); this.parent.registry.resolver(this.ensName).then(function (resolver) { @@ -108,7 +108,7 @@ ResolverMethodHandler.prototype.send = function (sendOptions, callback) { promiEvent.reject(error); }); - return promiEvent.eventEmitter; + return promiEvent; }; /** @@ -116,13 +116,13 @@ ResolverMethodHandler.prototype.send = function (sendOptions, callback) { * * @method handleCall * - * @param {eventifiedPromise} promiEvent + * @param {PromiEvent} promiEvent * @param {function} method * @param {Array} preparedArguments * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, preparedArguments, callback) { method.apply(this, preparedArguments).call() @@ -148,7 +148,7 @@ ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, prepa * * @method handleSend * - * @param {eventifiedPromise} promiEvent + * @param {PromiEvent} promiEvent * @param {function} method * @param {Array} preparedArguments * @param {Object} sendOptions @@ -160,13 +160,13 @@ ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, prepa ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, preparedArguments, sendOptions, callback) { method.apply(this, preparedArguments).send(sendOptions) .on('transactionHash', function (hash) { - promiEvent.eventEmitter.emit('transactionHash', hash); + promiEvent.emit('transactionHash', hash); }) .on('confirmation', function (confirmationNumber, receipt) { - promiEvent.eventEmitter.emit('confirmation', confirmationNumber, receipt); + promiEvent.emit('confirmation', confirmationNumber, receipt); }) .on('receipt', function (receipt) { - promiEvent.eventEmitter.emit('receipt', receipt); + promiEvent.emit('receipt', receipt); promiEvent.resolve(receipt); if (_.isFunction(callback)) { @@ -174,7 +174,7 @@ ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, prepa } }) .on('error', function (error) { - promiEvent.eventEmitter.emit('error', error); + promiEvent.emit('error', error); promiEvent.reject(error); if (_.isFunction(callback)) { From 5ee5cf7cf0642878c43052308977bebd13a1ea67 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 14:55:12 +0200 Subject: [PATCH 0262/1045] package.json's checked and fixed if needed --- packages/web3-core-helpers/package.json | 4 +++- packages/web3-core-method/package.json | 6 +++--- packages/web3-core-subscriptions/package.json | 2 +- packages/web3-eth-accounts/package.json | 2 +- packages/web3-eth-personal/package.json | 6 +++--- packages/web3-eth/package.json | 2 +- packages/web3-net/package.json | 2 +- packages/web3-utils/package.json | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/web3-core-helpers/package.json b/packages/web3-core-helpers/package.json index fa906a2d85c..046e020ebe5 100644 --- a/packages/web3-core-helpers/package.json +++ b/packages/web3-core-helpers/package.json @@ -7,6 +7,8 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "underscore": "1.8.3" + "underscore": "1.8.3", + "web3-utils": "1.0.0-beta.36", + "web3-eth-iban": "1.0.0-beta.36" } } diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index cf6d94c688f..233a6fb42cb 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -10,9 +10,9 @@ "test": "mocha './tests/**/*.js'" }, "dependencies": { - "eventemitter3": "^3.1.0", - "underscore": "^1.9.1", - "web3-core-helpers": "^1.0.0-beta.36", + "eventemitter3": "3.1.0", + "underscore": "1.9.1", + "web3-core-helpers": "1.0.0-beta.36", "web3-core-promievent": "1.0.0-beta.36", "web3-providers": "1.0.0-beta.36", "web3-core": "1.0.0-beta.36", diff --git a/packages/web3-core-subscriptions/package.json b/packages/web3-core-subscriptions/package.json index 4f3d8dc0407..a3c2a836b9b 100644 --- a/packages/web3-core-subscriptions/package.json +++ b/packages/web3-core-subscriptions/package.json @@ -7,7 +7,7 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "eventemitter3": "^3.1.0", + "eventemitter3": "3.1.0", "underscore": "1.9.1", "web3-core-helpers": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36" diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json index e673b533bfc..bca99db81c6 100644 --- a/packages/web3-eth-accounts/package.json +++ b/packages/web3-eth-accounts/package.json @@ -8,7 +8,7 @@ "main": "src/index.js", "dependencies": { "crypto-browserify": "3.12.0", - "eth-lib": "^0.2.8", + "eth-lib": "0.2.8", "scrypt.js": "0.2.0", "underscore": "1.9.1", "uuid": "3.3.2", diff --git a/packages/web3-eth-personal/package.json b/packages/web3-eth-personal/package.json index 65d574bf7b7..7c2c2ecbd5d 100644 --- a/packages/web3-eth-personal/package.json +++ b/packages/web3-eth-personal/package.json @@ -7,11 +7,11 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { + "web3-core": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", "web3-net": "1.0.0-beta.36", "web3-providers": "1.0.0-beta.36", - "web3-utils": "1.0.0-beta.36", - "web3-core": "1.0.0-beta.36" - "web3-core-helpers": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" } } diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index 1d7c873cfda..e01ab5998c2 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -14,7 +14,7 @@ "web3-eth-abi": "1.0.0-beta.36", "web3-eth-ens": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36", - "web3-core": "1.0.0-beta.36" + "web3-core": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", diff --git a/packages/web3-net/package.json b/packages/web3-net/package.json index b3b538702ac..5ac39350e65 100644 --- a/packages/web3-net/package.json +++ b/packages/web3-net/package.json @@ -11,6 +11,6 @@ "web3-core-method": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", "web3-providers": "1.0.0-beta.36", - "web3-utils": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" } } diff --git a/packages/web3-utils/package.json b/packages/web3-utils/package.json index 3066b06de9a..507257ca331 100644 --- a/packages/web3-utils/package.json +++ b/packages/web3-utils/package.json @@ -12,7 +12,7 @@ "ethjs-unit": "0.1.6", "number-to-bn": "1.7.0", "randomhex": "0.1.5", - "underscore": "1.8.3", + "underscore": "1.9.1", "utf8": "2.1.1" } } From a4bbef92b21c8d227e697ac030c055820850fef3 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 14:58:10 +0200 Subject: [PATCH 0263/1045] funcDoc updated and codeStyle improved --- packages/web3-eth-ens/src/ENS.js | 16 ++++++++-------- packages/web3-eth-ens/src/contracts/Registry.js | 15 ++++++++------- .../src/handlers/ResolverMethodHandler.js | 4 ++-- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index 4d8605fbb2e..3391f5de920 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -69,7 +69,7 @@ ENS.prototype.resolver = function (name) { * @param {Function} callback * * @callback callback callback(error, result) - * @return {eventifiedPromise} + * @return {PromiEvent} */ ENS.prototype.getAddress = function (name, callback) { return this.resolverMethodHandler.method(name, 'addr', []).call(callback); @@ -86,7 +86,7 @@ ENS.prototype.getAddress = function (name, callback) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ENS.prototype.setAddress = function (name, address, sendOptions, callback) { return this.resolverMethodHandler.method(name, 'setAddr', [address]).send(sendOptions, callback); @@ -101,7 +101,7 @@ ENS.prototype.setAddress = function (name, address, sendOptions, callback) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ENS.prototype.getPubkey = function (name, callback) { return this.resolverMethodHandler.method(name, 'pubkey', []).call(callback); @@ -119,7 +119,7 @@ ENS.prototype.getPubkey = function (name, callback) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ENS.prototype.setPubkey = function (name, x, y, sendOptions, callback) { return this.resolverMethodHandler.method(name, 'setPubkey', [x, y]).send(sendOptions, callback); @@ -134,7 +134,7 @@ ENS.prototype.setPubkey = function (name, x, y, sendOptions, callback) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ENS.prototype.getContent = function (name, callback) { return this.resolverMethodHandler.method(name, 'content', []).call(callback); @@ -151,7 +151,7 @@ ENS.prototype.getContent = function (name, callback) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ENS.prototype.setContent = function (name, hash, sendOptions, callback) { return this.resolverMethodHandler.method(name, 'setContent', [hash]).send(sendOptions, callback); @@ -166,7 +166,7 @@ ENS.prototype.setContent = function (name, hash, sendOptions, callback) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ENS.prototype.getMultihash = function (name, callback) { return this.resolverMethodHandler.method(name, 'multihash', []).call(callback); @@ -183,7 +183,7 @@ ENS.prototype.getMultihash = function (name, callback) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ENS.prototype.setMultihash = function (name, hash, sendOptions, callback) { return this.resolverMethodHandler.method(name, 'multihash', [hash]).send(sendOptions, callback); diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index 98ae888f32e..205c24f252c 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -75,7 +75,7 @@ Registry.prototype.setProvider = function (provider, net) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {Promise} + * @returns {Promise<*>} */ Registry.prototype.owner = function (name, callback) { var self = this; @@ -132,14 +132,15 @@ Registry.prototype.resolver = function (name) { * * @method checkNetwork * - * @returns {Promise} + * @returns {Promise} */ Registry.prototype.checkNetwork = function () { - var self = this, ensAddresses = { - main: "0x314159265dD8dbb310642f98f50C066173C1259b", - ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", - rinkeby: "0xe7410170f87102df0055eb195163a03b7f2bff4a" - }; + var self = this, + ensAddresses = { + main: "0x314159265dD8dbb310642f98f50C066173C1259b", + ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", + rinkeby: "0xe7410170f87102df0055eb195163a03b7f2bff4a" + }; return this.net.getBlock('latest', false).then(function (block) { var headAge = new Date() / 1000 - block.timestamp; diff --git a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js index d0a66e478e3..9f119f9418d 100644 --- a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js +++ b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js @@ -95,7 +95,7 @@ ResolverMethodHandler.prototype.call = function (callback) { * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ResolverMethodHandler.prototype.send = function (sendOptions, callback) { var self = this, @@ -155,7 +155,7 @@ ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, prepa * @param {Function} callback * * @callback callback callback(error, result) - * @returns {eventifiedPromise} + * @returns {PromiEvent} */ ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, preparedArguments, sendOptions, callback) { method.apply(this, preparedArguments).send(sendOptions) From 5c638633bf53097687ea02bb0a4b652e7b6e6050 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 15:01:35 +0200 Subject: [PATCH 0264/1045] parameters order changed for SignAndSendMethodCommand --- .../src/commands/SignAndSendMethodCommand.js | 6 +++--- .../web3-core-method/src/controllers/MethodController.js | 4 ++-- .../tests/commands/SignAndSendMethodCommandTest.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index ad29561549f..6bc140d97db 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -45,17 +45,17 @@ SignAndSendMethodCommand.prototype.constructor = SignAndSendMethodCommand; * * @param {AbstractWeb3Module} moduleInstance * @param {AbstractMethodModel} methodModel - * @param {Accounts} accounts * @param {PromiEvent} promiEvent + * @param {Accounts} accounts * * @callback callback callback(error, result) * @returns {PromiEvent} */ SignAndSendMethodCommand.prototype.execute = function ( - methodModel, moduleInstance, - accounts, + methodModel, promiEvent, + accounts, ) { var self = this; diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 8898fd1d153..0dd2b24903a 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -70,10 +70,10 @@ MethodController.prototype.execute = function (methodModel, accounts, moduleInst if (methodModel.isSendTransaction()) { return this.signAndSendMethodCommand.execute( - methodModel, moduleInstance, - accounts, + methodModel, promiEvent, + accounts, ); } } diff --git a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js index c62fbf1809d..a8ac1b14c7c 100644 --- a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js @@ -102,7 +102,7 @@ describe('SendAndSignMethodCommandTest', function () { .withArgs(methodModel, moduleInstance, 'response', promiEvent) .once(); - var returnedPromiEvent = signAndSendMethodCommand.execute(methodModel, moduleInstance, {}, promiEvent); + var returnedPromiEvent = signAndSendMethodCommand.execute(moduleInstance, methodModel, promiEvent, {}); expect(returnedPromiEvent).equal(promiEvent); @@ -138,7 +138,7 @@ describe('SendAndSignMethodCommandTest', function () { })) .once(); - var returnedPromiEvent = signAndSendMethodCommand.execute(methodModel, moduleInstance, {}, promiEvent); + var returnedPromiEvent = signAndSendMethodCommand.execute(moduleInstance, methodModel, promiEvent, {}); expect(returnedPromiEvent).equal(promiEvent); From da5bbac5c46c0628b5506fdec730a34d00480be7 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 15:04:29 +0200 Subject: [PATCH 0265/1045] funcDocs updated in EventSubscriptionsProxy --- .../web3-eth-contract/src/proxies/EventSubscriptionsProxy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index a4c2ed1d3de..93f91950111 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -92,7 +92,7 @@ EventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { * @param {Object} options * @param {Function} callback * - * @returns {Subscription|EventEmitter} + * @returns {Subscription|PromiEvent} */ EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, options, callback) { if (typeof options.filters !== 'undefined' && typeof options.topics !== 'undefined') { @@ -118,7 +118,7 @@ EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, options, c * @param {Object} options * @param {Function} callback * - * @returns {Subscription|EventEmitter} + * @returns {Subscription|PromiEvent} */ EventSubscriptionsProxy.prototype.subscribeAll = function (options, callback) { if (typeof options.topics !== 'undefined') { From 00abdb5153ebabbda127179cb69fbf67b54f08a8 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 15:12:22 +0200 Subject: [PATCH 0266/1045] MethodController promiEvent var removed (now we have 100% coverage of it) --- .../web3-core-method/src/controllers/MethodController.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 0dd2b24903a..36437c398fb 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -54,11 +54,9 @@ function MethodController( * @param {Accounts} accounts * @param {AbstractWeb3Module} moduleInstance * - * @returns {Promise<*>|PromiEvent} + * @returns {Promise|PromiEvent|String} */ MethodController.prototype.execute = function (methodModel, accounts, moduleInstance) { - var promiEvent = new this.promiEventPackage.PromiEvent(); - if (this.hasWallets(accounts)) { if (methodModel.isSign()) { return this.signMessageCommand.execute( @@ -72,7 +70,7 @@ MethodController.prototype.execute = function (methodModel, accounts, moduleInst return this.signAndSendMethodCommand.execute( moduleInstance, methodModel, - promiEvent, + new this.promiEventPackage.PromiEvent(), accounts, ); } @@ -82,7 +80,7 @@ MethodController.prototype.execute = function (methodModel, accounts, moduleInst return this.sendMethodCommand.execute( moduleInstance, methodModel, - promiEvent + new this.promiEventPackage.PromiEvent() ); } From 7b81873847475669266830d36348d4d6efd5de08 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 15:15:40 +0200 Subject: [PATCH 0267/1045] authors of project package.json updated --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 05272ad940a..62fbc58e231 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "web3", "namespace": "ethereum", - "version": "1.0.0-beta.35", + "version": "1.0.0-beta.36", "description": "Ethereum JavaScript API wrapper repository", "license": "LGPL-3.0", "main": "./packages/web3/src/index.js", @@ -43,7 +43,7 @@ { "name": "Fabian Vogelsteller", "email": "fabian@ethereum.org", - "homepage": "http://frozeman.de" + "homepage": "https://github.com/frozeman" }, { "name": "Marek Kotewicz", From f9c18ec647e591d7ef658914a6c9179e21d4c084 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 15:59:43 +0200 Subject: [PATCH 0268/1045] web3-core-method ported to es6 --- .../src/commands/CallMethodCommand.js | 68 ++-- .../src/commands/SendMethodCommand.js | 177 +++++---- .../src/commands/SignAndSendMethodCommand.js | 93 +++-- .../src/commands/SignMessageCommand.js | 75 ++-- .../src/controllers/MethodController.js | 139 +++---- .../src/factories/MethodPackageFactory.js | 344 +++++++++--------- packages/web3-core-method/src/index.js | 332 ++++++++--------- .../models/TransactionConfirmationModel.js | 157 ++++---- .../src/models/methods/CallMethodModel.js | 52 ++- .../models/methods/EstimateGasMethodModel.js | 76 ++-- .../src/models/methods/GetCodeMethodModel.js | 51 ++- .../models/methods/GetPastLogsMethodModel.js | 76 ++-- .../models/methods/GetStorageAtMethodModel.js | 54 ++- .../src/models/methods/SignMethodModel.js | 56 ++- .../methods/account/GetAccountsMethodModel.js | 62 ++-- .../methods/account/GetBalanceMethodModel.js | 77 ++-- .../account/GetTransactionCountMethodModel.js | 78 ++-- .../methods/block/GetBlockMethodModel.js | 76 ++-- .../block/GetBlockNumberMethodModel.js | 53 ++- .../GetBlockTransactionCountMethodModel.js | 74 ++-- .../block/GetBlockUncleCountMethodModel.js | 74 ++-- .../methods/block/GetUncleMethodModel.js | 76 ++-- .../network/GetProtocolVersionMethodModel.js | 28 +- .../methods/network/ListeningMethodModel.js | 28 +- .../methods/network/PeerCountMethodModel.js | 54 ++- .../methods/network/VersionMethodModel.js | 54 ++- .../methods/node/GetCoinbaseMethodModel.js | 28 +- .../methods/node/GetGasPriceMethodModel.js | 53 ++- .../methods/node/GetHashrateMethodModel.js | 54 ++- .../methods/node/GetNodeInfoMethodModel.js | 28 +- .../models/methods/node/GetWorkMethodModel.js | 28 +- .../methods/node/IsMiningMethodModel.js | 28 +- .../methods/node/IsSyncingMethodModel.js | 54 ++- .../methods/node/SubmitWorkMethodModel.js | 28 +- .../methods/personal/EcRecoverMethodModel.js | 52 ++- .../personal/ImportRawKeyMethodModel.js | 28 +- .../personal/ListAccountsMethodModel.js | 62 ++-- .../personal/LockAccountMethodModel.js | 50 ++- .../methods/personal/NewAccountMethodModel.js | 54 ++- .../PersonalSendTransactionMethodModel.js | 50 ++- .../personal/PersonalSignMethodModel.js | 52 ++- .../PersonalSignTransactionMethodModel.js | 50 ++- .../personal/UnlockAccountMethodModel.js | 49 ++- .../methods/shh/AddPrivateKeyMethodModel.js | 28 +- .../methods/shh/AddSymKeyMethodModel.js | 28 +- .../methods/shh/DeleteKeyPairMethodModel.js | 28 +- .../shh/DeleteMessageFilterMethodModel.js | 28 +- .../methods/shh/DeleteSymKeyMethodModel.js | 28 +- .../GenerateSymKeyFromPasswordMethodModel.js | 28 +- .../shh/GetFilterMessagesMethodModel.js | 27 +- .../models/methods/shh/GetInfoMethodModel.js | 28 +- .../methods/shh/GetPrivateKeyMethodModel.js | 28 +- .../methods/shh/GetPublicKeyMethodModel.js | 28 +- .../methods/shh/GetSymKeyMethodModel.js | 28 +- .../methods/shh/HasKeyPairMethodModel.js | 28 +- .../methods/shh/HasSymKeyMethodModel.js | 28 +- .../methods/shh/MarkTrustedPeerMethodModel.js | 28 +- .../methods/shh/NewKeyPairMethodModel.js | 28 +- .../shh/NewMessageFilterMethodModel.js | 28 +- .../methods/shh/NewSymKeyMethodModel.js | 28 +- .../src/models/methods/shh/PostMethodModel.js | 28 +- .../shh/SetMaxMessageSizeMethodModel.js | 28 +- .../methods/shh/SetMinPoWMethodModel.js | 28 +- .../methods/shh/ShhVersionMethodModel.js | 28 +- .../GetTransactionFromBlockMethodModel.js | 76 ++-- .../transaction/GetTransactionMethodModel.js | 54 ++- .../GetTransactionReceiptMethodModel.js | 53 ++- .../SendSignedTransactionMethodModel.js | 28 +- .../transaction/SendTransactionMethodModel.js | 53 ++- .../transaction/SignTransactionMethodModel.js | 50 ++- .../src/signers/MessageSigner.js | 53 ++- .../src/signers/TransactionSigner.js | 76 ++-- .../validators/TransactionReceiptValidator.js | 106 +++--- .../src/watchers/NewHeadsWatcher.js | 109 +++--- .../TransactionConfirmationWorkflow.js | 297 +++++++-------- 75 files changed, 2307 insertions(+), 2467 deletions(-) diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 94ec6d24203..7a464ec42a7 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -25,38 +25,36 @@ /** * @constructor */ -function CallMethodCommand() { } - -/** - * Sends a JSON-RPC call request - * - * @method execute - * - * @param {AbstractWeb3Module} moduleInstance - * @param {AbstractMethodModel} methodModel - * - * @callback callback callback(error, result) - * @returns {Promise<*>} - */ -CallMethodCommand.prototype.execute = function (moduleInstance, methodModel) { - methodModel.beforeExecution(moduleInstance); - - return moduleInstance.currentProvider.send( - methodModel.rpcMethod, - methodModel.parameters - ).then(function (response) { - var mappedResponse = methodModel.afterExecution(response); - - if (methodModel.callback) { - methodModel.callback(false, mappedResponse); - } - - return mappedResponse; - }).catch(function(error) { - if (methodModel.callback) { - methodModel.callback(error, null); - } - }); -}; - -module.exports = CallMethodCommand; +export default class CallMethodCommand { + /** + * Sends a JSON-RPC call request + * + * @method execute + * + * @param {AbstractWeb3Module} moduleInstance + * @param {AbstractMethodModel} methodModel + * + * @callback callback callback(error, result) + * @returns {Promise<*>} + */ + execute(moduleInstance, methodModel) { + methodModel.beforeExecution(moduleInstance); + + return moduleInstance.currentProvider.send( + methodModel.rpcMethod, + methodModel.parameters + ).then(response => { + const mappedResponse = methodModel.afterExecution(response); + + if (methodModel.callback) { + methodModel.callback(false, mappedResponse); + } + + return mappedResponse; + }).catch(error => { + if (methodModel.callback) { + methodModel.callback(error, null); + } + }); + } +} diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 59d7b36343f..c4efba32067 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -22,109 +22,106 @@ "use strict"; -var _ = require('underscore'); -var AbstractSendMethodCommand = require('../../lib/commands/AbstractSendMethodCommand'); +import _ from 'underscore'; +import AbstractSendMethodCommand from '../../lib/commands/AbstractSendMethodCommand'; /** * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow * * @constructor */ -function SendMethodCommand(transactionConfirmationWorkflow) { - AbstractSendMethodCommand.call(this, transactionConfirmationWorkflow); -} - -SendMethodCommand.prototype = Object.create(AbstractSendMethodCommand.prototype); -SendMethodCommand.prototype.constructor = SendMethodCommand; - -/** - * Checks if gasPrice is set, sends the request and returns a PromiEvent Object - * - * @method execute - * - * @param {AbstractWeb3Module} moduleInstance - * @param {AbstractMethodModel} methodModel - * @param {PromiEvent} promiEvent - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -SendMethodCommand.prototype.execute = function (moduleInstance, methodModel, promiEvent) { - var self = this; - - methodModel.beforeExecution(moduleInstance); - - if (this.isGasPriceDefined(methodModel.parameters)) { - this.send(methodModel, promiEvent, moduleInstance); - - return promiEvent; +export default class SendMethodCommand extends AbstractSendMethodCommand { + constructor(transactionConfirmationWorkflow) { + super(transactionConfirmationWorkflow); } - this.getGasPrice(moduleInstance.currentProvider).then(function(gasPrice) { - if (_.isObject(methodModel.parameters[0])) { - methodModel.parameters[0].gasPrice = gasPrice; + /** + * Checks if gasPrice is set, sends the request and returns a PromiEvent Object + * + * @method execute + * + * @param {AbstractWeb3Module} moduleInstance + * @param {AbstractMethodModel} methodModel + * @param {PromiEvent} promiEvent + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + execute(moduleInstance, methodModel, promiEvent) { + const self = this; + + methodModel.beforeExecution(moduleInstance); + + if (this.isGasPriceDefined(methodModel.parameters)) { + this.send(methodModel, promiEvent, moduleInstance); + + return promiEvent; } - self.send(methodModel, promiEvent, moduleInstance); - }); - - return promiEvent; -}; + this.getGasPrice(moduleInstance.currentProvider).then(gasPrice => { + if (_.isObject(methodModel.parameters[0])) { + methodModel.parameters[0].gasPrice = gasPrice; + } -SendMethodCommand.prototype.send = function (methodModel, promiEvent, moduleInstance) { - var self = this; - - moduleInstance.currentProvider.send( - methodModel.rpcMethod, - methodModel.parameters - ).then(function (response) { - self.transactionConfirmationWorkflow.execute( - methodModel, - moduleInstance, - response, - promiEvent - ); - - promiEvent.emit('transactionHash', response); - - if (methodModel.callback) { - methodModel.callback(false, response); - } - }).catch(function (error) { - promiEvent.reject(error); - promiEvent.emit('error', error); - promiEvent.removeAllListeners(); + self.send(methodModel, promiEvent, moduleInstance); + }); - if (methodModel.callback) { - methodModel.callback(error, null); - } - }); + return promiEvent; + } - return promiEvent; -}; + send(methodModel, promiEvent, moduleInstance) { + const self = this; + + moduleInstance.currentProvider.send( + methodModel.rpcMethod, + methodModel.parameters + ).then(response => { + self.transactionConfirmationWorkflow.execute( + methodModel, + moduleInstance, + response, + promiEvent + ); + + promiEvent.emit('transactionHash', response); + + if (methodModel.callback) { + methodModel.callback(false, response); + } + }).catch(error => { + promiEvent.reject(error); + promiEvent.emit('error', error); + promiEvent.removeAllListeners(); + + if (methodModel.callback) { + methodModel.callback(error, null); + } + }); -/** - * Checks if gasPrice is defined in the method options - * - * @method isGasPriceDefined - * - * @param {Array} parameters - * - * @returns {Boolean} - */ -SendMethodCommand.prototype.isGasPriceDefined = function (parameters) { - return _.isObject(parameters[0]) && typeof parameters[0].gasPrice !== 'undefined'; -}; + return promiEvent; + } -/** - * Returns the current gasPrice of the connected node - * - * @param {AbstractProviderAdapter | EthereumProvider} provider - * - * @returns {Promise} - */ -SendMethodCommand.prototype.getGasPrice = function (provider) { - return provider.send('eth_gasPrice', []); -}; + /** + * Checks if gasPrice is defined in the method options + * + * @method isGasPriceDefined + * + * @param {Array} parameters + * + * @returns {Boolean} + */ + isGasPriceDefined(parameters) { + return _.isObject(parameters[0]) && typeof parameters[0].gasPrice !== 'undefined'; + } -module.exports = SendMethodCommand; + /** + * Returns the current gasPrice of the connected node + * + * @param {AbstractProviderAdapter | EthereumProvider} provider + * + * @returns {Promise} + */ + getGasPrice(provider) { + return provider.send('eth_gasPrice', []); + } +} diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index 6bc140d97db..a520e3a37fc 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -22,60 +22,53 @@ "use strict"; -var SendMethodCommand = require('./SendMethodCommand'); +import SendMethodCommand from './SendMethodCommand'; -/** - * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow - * @param {TransactionSigner} transactionSigner - * - * @constructor - */ -function SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSigner) { - SendMethodCommand.call(this, transactionConfirmationWorkflow); - this.transactionSigner = transactionSigner; -} +export default class SignAndSendMethodCommand extends SendMethodCommand { -SignAndSendMethodCommand.prototype = Object.create(SendMethodCommand.prototype); -SignAndSendMethodCommand.prototype.constructor = SignAndSendMethodCommand; + /** + * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow + * @param {TransactionSigner} transactionSigner + * + * @constructor + */ + constructor(transactionConfirmationWorkflow, transactionSigner) { + super(transactionConfirmationWorkflow); + this.transactionSigner = transactionSigner; + } -/** - * Sends the JSON-RPC request and returns an PromiEvent object - * - * @method execute - * - * @param {AbstractWeb3Module} moduleInstance - * @param {AbstractMethodModel} methodModel - * @param {PromiEvent} promiEvent - * @param {Accounts} accounts - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -SignAndSendMethodCommand.prototype.execute = function ( - moduleInstance, - methodModel, - promiEvent, - accounts, -) { - var self = this; - - methodModel.beforeExecution(moduleInstance); - methodModel.rpcMethod = 'eth_sendRawTransaction'; + /** + * Sends the JSON-RPC request and returns an PromiEvent object + * + * @method execute + * + * @param {AbstractWeb3Module} moduleInstance + * @param {AbstractMethodModel} methodModel + * @param {PromiEvent} promiEvent + * @param {Accounts} accounts + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + execute(moduleInstance, methodModel, promiEvent, accounts) { + const self = this; - this.transactionSigner.sign(methodModel.parameters[0], accounts).then(function(response) { - methodModel.parameters = [response.rawTransaction]; - self.send(methodModel, promiEvent, moduleInstance); - }).catch(function(error) { - promiEvent.reject(error); - promiEvent.emit('error', error); - promiEvent.removeAllListeners(); + methodModel.beforeExecution(moduleInstance); + methodModel.rpcMethod = 'eth_sendRawTransaction'; - if (methodModel.callback) { - methodModel.callback(error, null); - } - }); + this.transactionSigner.sign(methodModel.parameters[0], accounts).then(response => { + methodModel.parameters = [response.rawTransaction]; + self.send(methodModel, promiEvent, moduleInstance); + }).catch(error => { + promiEvent.reject(error); + promiEvent.emit('error', error); + promiEvent.removeAllListeners(); - return promiEvent; -}; + if (methodModel.callback) { + methodModel.callback(error, null); + } + }); -module.exports = SignAndSendMethodCommand; + return promiEvent; + } +} diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js index 97eabe21e22..82bc4bebac9 100644 --- a/packages/web3-core-method/src/commands/SignMessageCommand.js +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -22,47 +22,48 @@ "use strict"; -/** - * @param {MessageSigner} messageSigner - * - * @constructor - */ -function SignMessageCommand(messageSigner) { - this.messageSigner = messageSigner; -} +export default class SignMessageCommand { -/** - * Executes the SignMessageCommand and returns the signed message - * - * @method execute - * - * @param {AbstractWeb3Module} moduleInstance - * @param {AbstractMethodModel} methodModel - * @param {Accounts} accounts - * - * @callback callback callback(error, result) - * @returns {String} - */ -SignMessageCommand.prototype.execute = function (moduleInstance, methodModel, accounts) { - var signedMessage; + /** + * @param {MessageSigner} messageSigner + * + * @constructor + */ + constructor(messageSigner) { + this.messageSigner = messageSigner; + } - methodModel.beforeExecution(moduleInstance); + /** + * Executes the SignMessageCommand and returns the signed message + * + * @method execute + * + * @param {AbstractWeb3Module} moduleInstance + * @param {AbstractMethodModel} methodModel + * @param {Accounts} accounts + * + * @callback callback callback(error, result) + * @returns {String} + */ + execute(moduleInstance, methodModel, accounts) { + let signedMessage; - try { - signedMessage = methodModel.afterExecution( - this.messageSigner.sign(methodModel.parameters[0], methodModel.parameters[1], accounts) - ); - } catch(error) { - methodModel.callback(error, null); + methodModel.beforeExecution(moduleInstance); - throw error; - } + try { + signedMessage = methodModel.afterExecution( + this.messageSigner.sign(methodModel.parameters[0], methodModel.parameters[1], accounts) + ); + } catch(error) { + methodModel.callback(error, null); - if (methodModel.callback) { - methodModel.callback(false, signedMessage); - } + throw error; + } - return signedMessage; -}; + if (methodModel.callback) { + methodModel.callback(false, signedMessage); + } -module.exports = SignMessageCommand; + return signedMessage; + } +} diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 36437c398fb..cfc16d79e78 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -22,85 +22,86 @@ "use strict"; -/** - * @param {CallMethodCommand} callMethodCommand - * @param {SendMethodCommand} sendMethodCommand - * @param {SignAndSendMethodCommand} signAndSendMethodCommand - * @param {SignMessageCommand} signMessageCommand - * @param {PromiEventPackage} promiEventPackage - * - * @constructor - */ -function MethodController( - callMethodCommand, - sendMethodCommand, - signAndSendMethodCommand, - signMessageCommand, - promiEventPackage -) { - this.callMethodCommand = callMethodCommand; - this.sendMethodCommand = sendMethodCommand; - this.signAndSendMethodCommand = signAndSendMethodCommand; - this.signMessageCommand = signMessageCommand; - this.promiEventPackage = promiEventPackage; -} +export default class MethodController { -/** - * Checks which command should be executed - * - * @method execute - * - * @param {AbstractMethodModel} methodModel - * @param {Accounts} accounts - * @param {AbstractWeb3Module} moduleInstance - * - * @returns {Promise|PromiEvent|String} - */ -MethodController.prototype.execute = function (methodModel, accounts, moduleInstance) { - if (this.hasWallets(accounts)) { - if (methodModel.isSign()) { - return this.signMessageCommand.execute( - moduleInstance, - methodModel, - accounts, - ); + /** + * @param {CallMethodCommand} callMethodCommand + * @param {SendMethodCommand} sendMethodCommand + * @param {SignAndSendMethodCommand} signAndSendMethodCommand + * @param {SignMessageCommand} signMessageCommand + * @param {PromiEventPackage} promiEventPackage + * + * @constructor + */ + constructor( + callMethodCommand, + sendMethodCommand, + signAndSendMethodCommand, + signMessageCommand, + promiEventPackage + ) { + this.callMethodCommand = callMethodCommand; + this.sendMethodCommand = sendMethodCommand; + this.signAndSendMethodCommand = signAndSendMethodCommand; + this.signMessageCommand = signMessageCommand; + this.promiEventPackage = promiEventPackage; + } + + /** + * Checks which command should be executed + * + * @method execute + * + * @param {AbstractMethodModel} methodModel + * @param {Accounts} accounts + * @param {AbstractWeb3Module} moduleInstance + * + * @returns {Promise|PromiEvent|String} + */ + execute(methodModel, accounts, moduleInstance) { + if (this.hasWallets(accounts)) { + if (methodModel.isSign()) { + return this.signMessageCommand.execute( + moduleInstance, + methodModel, + accounts, + ); + } + + if (methodModel.isSendTransaction()) { + return this.signAndSendMethodCommand.execute( + moduleInstance, + methodModel, + new this.promiEventPackage.PromiEvent(), + accounts, + ); + } } - if (methodModel.isSendTransaction()) { - return this.signAndSendMethodCommand.execute( + if (methodModel.isSendTransaction() || methodModel.isSendRawTransaction() || methodModel.isSign()) { + return this.sendMethodCommand.execute( moduleInstance, methodModel, - new this.promiEventPackage.PromiEvent(), - accounts, + new this.promiEventPackage.PromiEvent() ); } - } - if (methodModel.isSendTransaction() || methodModel.isSendRawTransaction() || methodModel.isSign()) { - return this.sendMethodCommand.execute( + return this.callMethodCommand.execute( moduleInstance, methodModel, - new this.promiEventPackage.PromiEvent() ); } - return this.callMethodCommand.execute( - moduleInstance, - methodModel, - ); -}; - -/** - * Checks if accounts is defined and if wallet is not empty - * - * @method hasWallet - * - * @param {Accounts} accounts - * - * @returns {Boolean} - */ -MethodController.prototype.hasWallets = function (accounts) { - return (accounts && accounts.wallet.length > 0); -}; - -module.exports = MethodController; + /** + * Checks if accounts is defined and if wallet is not empty + * + * @method hasWallet + * + * @param {Accounts} accounts + * + * @returns {Boolean} + */ + hasWallets(accounts) { + return (accounts && accounts.wallet.length > 0); + } +} diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index f7aaaa6cb63..5d6839ca85f 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -22,179 +22,171 @@ "use strict"; -var TransactionConfirmationWorkflow = require('../workflows/TransactionConfirmationWorkflow'); -var TransactionSigner = require('../signers/TransactionSigner'); -var MessageSigner = require('../signers/MessageSigner'); -var TransactionConfirmationModel = require('../models/TransactionConfirmationModel'); -var TransactionReceiptValidator = require('../validators/TransactionReceiptValidator'); -var NewHeadsWatcher = require('../watchers/NewHeadsWatcher'); -var MethodController = require('../controllers/MethodController'); -var CallMethodCommand = require('../commands/CallMethodCommand'); -var SendMethodCommand = require('../commands/SendMethodCommand'); -var SignAndSendMethodCommand = require('../commands/SignAndSendMethodCommand'); -var SignMessageCommand = require('../commands/SignMessageCommand'); - -/** - * @constructor - */ -function MethodPackageFactory() { } - -/** - * Returns the MethodController object - * - * @method createMethodController - * - * @param {PromiEventPackage} promiEventPackage - * @param {SubscriptionsFactory} subscriptionsFactory - * @param {Object} formatters - * - * @returns {MethodController} - */ -MethodPackageFactory.prototype.createMethodController = function ( - promiEventPackage, - subscriptionsFactory, - formatters -) { - return new MethodController( - this.createCallMethodCommand(), - this.createSendMethodCommand(subscriptionsFactory, formatters), - this.createSignAndSendMethodCommand(subscriptionsFactory, formatters), - this.createSignMessageCommand(), - promiEventPackage - ); -}; - -/** - * Returns the CallMethodCommand object - * - * @method createCallMethodCommand - * - * @returns {CallMethodCommand} - */ -MethodPackageFactory.prototype.createCallMethodCommand = function () { - return new CallMethodCommand(); -}; - -/** - * Returns the SendMethodCommand object - * - * @method createSendMethodCommand - * - * @param {SubscriptionsFactory} subscriptionsFactory - * @param {Object} formatters - * - * @returns {SendMethodCommand} - */ -MethodPackageFactory.prototype.createSendMethodCommand = function (subscriptionsFactory, formatters) { - return new SendMethodCommand( - this.createTransactionConfirmationWorkflow(subscriptionsFactory, formatters) - ); -}; - -/** - * Returns the SignAndSendCommand object - * - * @method createSingAndSendMethodCommand - * - * @param {SubscriptionsFactory} subscriptionsFactory - * @param {Object} formatters - * - * @returns {SignAndSendMethodCommand} - */ -MethodPackageFactory.prototype.createSignAndSendMethodCommand = function (subscriptionsFactory, formatters) { - return new SignAndSendMethodCommand( - this.createTransactionConfirmationWorkflow(subscriptionsFactory, formatters), - this.createTransactionSigner() - ); -}; - -/** - * Returns the SignMessageCommand object - * - * @method createSignMessageCommand - * - * @returns {SignMessageCommand} - */ -MethodPackageFactory.prototype.createSignMessageCommand = function () { - return new SignMessageCommand( - this.createMessageSigner() - ); -}; - -/** - * Returns the TransactionConfirmationWorkflow object - * - * @method createTransactionConfirmationWorkflow - * - * @param {SubscriptionsFactory} subscriptionsFactory - * @param {Object} formatters - * - * @returns {TransactionConfirmationWorkflow} - */ -MethodPackageFactory.prototype.createTransactionConfirmationWorkflow = function (subscriptionsFactory, formatters) { - return new TransactionConfirmationWorkflow( - this.createTransactionConfirmationModel(), - this.createTransactionReceiptValidator(), - this.createNewHeadsWatcher(subscriptionsFactory), - formatters - ); -}; - -/** - * Returns the TransactionSigner object - * - * @method createTransactionSigner - * - * @returns {TransactionSigner} - */ -MethodPackageFactory.prototype.createTransactionSigner = function () { - return new TransactionSigner(); -}; - -/** - * Returns the MessageSigner object - * - * @method createMessageSigner - * - * @returns {MessageSigner} - */ -MethodPackageFactory.prototype.createMessageSigner = function () { - return new MessageSigner(); -}; - -/** - * Returns the TransactionConfirmationModel object - * - * @method createTransactionConfirmationModel - * - * @returns {TransactionConfirmationModel} - */ -MethodPackageFactory.prototype.createTransactionConfirmationModel = function () { - return new TransactionConfirmationModel() -}; - -/** - * Returns the TransactionReceiptValidator object - * - * @method createTransactionReceiptValidator - * - * @returns {TransactionReceiptValidator} - */ -MethodPackageFactory.prototype.createTransactionReceiptValidator = function () { - return new TransactionReceiptValidator(); -}; - -/** - * Returns the NewHeadsWatcher object - * - * @method createNewHeadsWatcher - * - * @param {SubscriptionsFactory} subscriptionsFactory - * - * @returns {NewHeadsWatcher} - */ -MethodPackageFactory.prototype.createNewHeadsWatcher = function (subscriptionsFactory) { - return new NewHeadsWatcher(subscriptionsFactory); -}; - -module.exports = MethodPackageFactory; +import TransactionConfirmationWorkflow from '../workflows/TransactionConfirmationWorkflow'; +import TransactionSigner from '../signers/TransactionSigner'; +import MessageSigner from '../signers/MessageSigner'; +import TransactionConfirmationModel from '../models/TransactionConfirmationModel'; +import TransactionReceiptValidator from '../validators/TransactionReceiptValidator'; +import NewHeadsWatcher from '../watchers/NewHeadsWatcher'; +import MethodController from '../controllers/MethodController'; +import CallMethodCommand from '../commands/CallMethodCommand'; +import SendMethodCommand from '../commands/SendMethodCommand'; +import SignAndSendMethodCommand from '../commands/SignAndSendMethodCommand'; +import SignMessageCommand from '../commands/SignMessageCommand'; + +export default class MethodPackageFactory { + + /** + * Returns the MethodController object + * + * @method createMethodController + * + * @param {PromiEventPackage} promiEventPackage + * @param {SubscriptionsFactory} subscriptionsFactory + * @param {Object} formatters + * + * @returns {MethodController} + */ + createMethodController(promiEventPackage, subscriptionsFactory, formatters) { + return new MethodController( + this.createCallMethodCommand(), + this.createSendMethodCommand(subscriptionsFactory, formatters), + this.createSignAndSendMethodCommand(subscriptionsFactory, formatters), + this.createSignMessageCommand(), + promiEventPackage + ); + } + + /** + * Returns the CallMethodCommand object + * + * @method createCallMethodCommand + * + * @returns {CallMethodCommand} + */ + createCallMethodCommand() { + return new CallMethodCommand(); + } + + /** + * Returns the SendMethodCommand object + * + * @method createSendMethodCommand + * + * @param {SubscriptionsFactory} subscriptionsFactory + * @param {Object} formatters + * + * @returns {SendMethodCommand} + */ + createSendMethodCommand(subscriptionsFactory, formatters) { + return new SendMethodCommand( + this.createTransactionConfirmationWorkflow(subscriptionsFactory, formatters) + ); + } + + /** + * Returns the SignAndSendCommand object + * + * @method createSingAndSendMethodCommand + * + * @param {SubscriptionsFactory} subscriptionsFactory + * @param {Object} formatters + * + * @returns {SignAndSendMethodCommand} + */ + createSignAndSendMethodCommand(subscriptionsFactory, formatters) { + return new SignAndSendMethodCommand( + this.createTransactionConfirmationWorkflow(subscriptionsFactory, formatters), + this.createTransactionSigner() + ); + } + + /** + * Returns the SignMessageCommand object + * + * @method createSignMessageCommand + * + * @returns {SignMessageCommand} + */ + createSignMessageCommand() { + return new SignMessageCommand( + this.createMessageSigner() + ); + } + + /** + * Returns the TransactionConfirmationWorkflow object + * + * @method createTransactionConfirmationWorkflow + * + * @param {SubscriptionsFactory} subscriptionsFactory + * @param {Object} formatters + * + * @returns {TransactionConfirmationWorkflow} + */ + createTransactionConfirmationWorkflow(subscriptionsFactory, formatters) { + return new TransactionConfirmationWorkflow( + this.createTransactionConfirmationModel(), + this.createTransactionReceiptValidator(), + this.createNewHeadsWatcher(subscriptionsFactory), + formatters + ); + } + + /** + * Returns the TransactionSigner object + * + * @method createTransactionSigner + * + * @returns {TransactionSigner} + */ + createTransactionSigner() { + return new TransactionSigner(); + } + + /** + * Returns the MessageSigner object + * + * @method createMessageSigner + * + * @returns {MessageSigner} + */ + createMessageSigner() { + return new MessageSigner(); + } + + /** + * Returns the TransactionConfirmationModel object + * + * @method createTransactionConfirmationModel + * + * @returns {TransactionConfirmationModel} + */ + createTransactionConfirmationModel() { + return new TransactionConfirmationModel() + } + + /** + * Returns the TransactionReceiptValidator object + * + * @method createTransactionReceiptValidator + * + * @returns {TransactionReceiptValidator} + */ + createTransactionReceiptValidator() { + return new TransactionReceiptValidator(); + } + + /** + * Returns the NewHeadsWatcher object + * + * @method createNewHeadsWatcher + * + * @param {SubscriptionsFactory} subscriptionsFactory + * + * @returns {NewHeadsWatcher} + */ + createNewHeadsWatcher(subscriptionsFactory) { + return new NewHeadsWatcher(subscriptionsFactory); + } +} diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 0ba9695dd6a..ba557cdbd47 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -23,95 +23,95 @@ "use strict"; -var version = require('../package.json').version; -var MethodPackageFactory = require('./factories/MethodPackageFactory'); -var AbstractMethodModelFactory = require('../lib/factories/AbstractMethodModelFactory'); -var PromiEventPackage = require('web3-core-promievent'); -var SubscriptionsFactory = require('web3-core-subscriptions').SubscriptionsFactory; -var formatters = require('web3-core-helpers').formatters; - +import {version} from '../package.json'; +import MethodPackageFactory from './factories/MethodPackageFactory'; +import AbstractMethodModelFactory from '../lib/factories/AbstractMethodModelFactory'; +import PromiEventPackage from 'web3-core-promievent'; +import {SubscriptionsFactory} from 'web3-core-subscriptions'; +import {formatters} from 'web3-core-helpers'; // Methods - // Network - var GetProtocolVersionMethodModel = require('./models/methods/network/GetProtocolVersionMethodModel'); - var VersionMethodModel = require('./models/methods/network/VersionMethodModel'); - var ListeningMethodModel = require('./models/methods/network/ListeningMethodModel'); - var PeerCountMethodModel = require('./models/methods/network/PeerCountMethodModel'); - - // Node - var GetNodeInfoMethodModel = require('./models/methods/node/GetNodeInfoMethodModel'); - var GetCoinbaseMethodModel = require('./models/methods/node/GetCoinbaseMethodModel'); - var IsMiningMethodModel = require('./models/methods/node/IsMiningMethodModel'); - var GetHashrateMethodModel = require('./models/methods/node/GetHashrateMethodModel'); - var IsSyncingMethodModel = require('./models/methods/node/IsSyncingMethodModel'); - var GetGasPriceMethodModel = require('./models/methods/node/GetGasPriceMethodModel'); - var SubmitWorkMethodModel = require('./models/methods/node/SubmitWorkMethodModel'); - var GetWorkMethodModel = require('./models/methods/node/GetWorkMethodModel'); - - // Account - var GetAccountsMethodModel = require('./models/methods/account/GetAccountsMethodModel'); - var GetBalanceMethodModel = require('./models/methods/account/GetBalanceMethodModel'); - var GetTransactionCountMethodModel = require('./models/methods/account/GetTransactionCountMethodModel'); - - // Block - var GetBlockNumberMethodModel = require('./models/methods/block/GetBlockNumberMethodModel'); - var GetBlockMethodModel = require('./models/methods/block/GetBlockMethodModel'); - var GetUncleMethodModel = require('./models/methods/block/GetUncleMethodModel'); - var GetBlockTransactionCountMethodModel = require('./models/methods/block/GetBlockTransactionCountMethodModel'); - var GetBlockUncleCountMethodModel = require('./models/methods/block/GetBlockUncleCountMethodModel'); - - // Transaction - var GetTransactionMethodModel = require('./models/methods/transaction/GetTransactionMethodModel'); - var GetTransactionFromBlockMethodModel = require('./models/methods/transaction/GetTransactionFromBlockMethodModel'); - var GetTransactionReceipt = require('./models/methods/transaction/GetTransactionReceiptMethodModel'); - var SendSignedTransactionMethodModel = require('./models/methods/transaction/SendSignedTransactionMethodModel'); - var SignTransactionMethodModel = require('./models/methods/transaction/SignTransactionMethodModel'); - var SendTransactionMethodModel = require('./models/methods/transaction/SendTransactionMethodModel'); - - // Global - var GetCodeMethodModel = require('./models/methods/GetCodeMethodModel'); - var SignMethodModel = require('./models/methods/SignMethodModel'); - var CallMethodModel = require('./models/methods/CallMethodModel'); - var GetStorageAtMethodModel = require('./models/methods/GetStorageAtMethodModel'); - var EstimateGasMethodModel = require('./models/methods/EstimateGasMethodModel'); - var GetPastLogsMethodModel = require('./models/methods/GetPastLogsMethodModel'); - - // Personal - var EcRecoverMethodModel = require('./models/methods/personal/EcRecoverMethodModel'); - var ImportRawKeyMethodModel = require('./models/methods/personal/ImportRawKeyMethodModel'); - var ListAccountsMethodModel = require('./models/methods/personal/ListAccountsMethodModel'); - var LockAccountMethodModel = require('./models/methods/personal/LockAccountMethodModel'); - var NewAccountMethodModel = require('./models/methods/personal/NewAccountMethodModel'); - var PersonalSendTransactionMethodModel = require('./models/methods/personal/PersonalSendTransactionMethodModel'); - var PersonalSignMethodModel = require('./models/methods/personal/PersonalSignMethodModel'); - var PersonalSignTransactionMethodModel = require('./models/methods/personal/PersonalSignTransactionMethodModel'); - var UnlockAccountMethodModel = require('./models/methods/personal/UnlockAccountMethodModel'); - - // SHH - var AddPrivateKeyMethodModel = require('./models/methods/shh/AddPrivateKeyMethodModel'); - var AddSymKeyMethodModel = require('./models/methods/shh/AddSymKeyMethodModel'); - var DeleteKeyPairMethodModel = require('./models/methods/shh/DeleteKeyPairMethodModel'); - var DeleteMessageFilterMethodModel = require('./models/methods/shh/DeleteMessageFilterMethodModel'); - var DeleteSymKeyMethodModel = require('./models/methods/shh/DeleteSymKeyMethodModel'); - var GenerateSymKeyFromPasswordMethodModel = require('./models/methods/shh/GenerateSymKeyFromPasswordMethodModel'); - var GetFilterMessagesMethodModel = require('./models/methods/shh/GetFilterMessagesMethodModel'); - var GetInfoMethodModel = require('./models/methods/shh/GetInfoMethodModel'); - var GetPrivateKeyMethodModel = require('./models/methods/shh/GetPrivateKeyMethodModel'); - var GetPublicKeyMethodModel = require('./models/methods/shh/GetPublicKeyMethodModel'); - var GetSymKeyMethodModel = require('./models/methods/shh/GetSymKeyMethodModel'); - var HasKeyPairMethodModel = require('./models/methods/shh/HasKeyPairMethodModel'); - var HasSymKeyMethodModel = require('./models/methods/shh/HasSymKeyMethodModel'); - var MarkTrustedPeerMethodModel = require('./models/methods/shh/MarkTrustedPeerMethodModel'); - var NewKeyPairMethodModel = require('./models/methods/shh/NewKeyPairMethodModel'); - var NewMessageFilterMethodModel = require('./models/methods/shh/NewMessageFilterMethodModel'); - var NewSymKeyMethodModel = require('./models/methods/shh/NewSymKeyMethodModel'); - var PostMethodModel = require('./models/methods/shh/PostMethodModel'); - var SetMaxMessageSizeMethodModel = require('./models/methods/shh/SetMaxMessageSizeMethodModel'); - var SetMinPoWMethodModel = require('./models/methods/shh/SetMinPoWMethodModel'); - var ShhVersionMethodModel = require('./models/methods/shh/ShhVersionMethodModel'); - -module.exports = { - version: version, - AbstractMethodModelFactory: AbstractMethodModelFactory, +// Network +import GetProtocolVersionMethodModel from './models/methods/network/GetProtocolVersionMethodModel'; + +import VersionMethodModel from './models/methods/network/VersionMethodModel'; +import ListeningMethodModel from './models/methods/network/ListeningMethodModel'; +import PeerCountMethodModel from './models/methods/network/PeerCountMethodModel'; +// Node +import GetNodeInfoMethodModel from './models/methods/node/GetNodeInfoMethodModel'; + +import GetCoinbaseMethodModel from './models/methods/node/GetCoinbaseMethodModel'; +import IsMiningMethodModel from './models/methods/node/IsMiningMethodModel'; +import GetHashrateMethodModel from './models/methods/node/GetHashrateMethodModel'; +import IsSyncingMethodModel from './models/methods/node/IsSyncingMethodModel'; +import GetGasPriceMethodModel from './models/methods/node/GetGasPriceMethodModel'; +import SubmitWorkMethodModel from './models/methods/node/SubmitWorkMethodModel'; +import GetWorkMethodModel from './models/methods/node/GetWorkMethodModel'; +// Account +import GetAccountsMethodModel from './models/methods/account/GetAccountsMethodModel'; + +import GetBalanceMethodModel from './models/methods/account/GetBalanceMethodModel'; +import GetTransactionCountMethodModel from './models/methods/account/GetTransactionCountMethodModel'; +// Block +import GetBlockNumberMethodModel from './models/methods/block/GetBlockNumberMethodModel'; + +import GetBlockMethodModel from './models/methods/block/GetBlockMethodModel'; +import GetUncleMethodModel from './models/methods/block/GetUncleMethodModel'; +import GetBlockTransactionCountMethodModel from './models/methods/block/GetBlockTransactionCountMethodModel'; +import GetBlockUncleCountMethodModel from './models/methods/block/GetBlockUncleCountMethodModel'; +// Transaction +import GetTransactionMethodModel from './models/methods/transaction/GetTransactionMethodModel'; + +import GetTransactionFromBlockMethodModel from './models/methods/transaction/GetTransactionFromBlockMethodModel'; +import GetTransactionReceipt from './models/methods/transaction/GetTransactionReceiptMethodModel'; +import SendSignedTransactionMethodModel from './models/methods/transaction/SendSignedTransactionMethodModel'; +import SignTransactionMethodModel from './models/methods/transaction/SignTransactionMethodModel'; +import SendTransactionMethodModel from './models/methods/transaction/SendTransactionMethodModel'; +// Global +import GetCodeMethodModel from './models/methods/GetCodeMethodModel'; + +import SignMethodModel from './models/methods/SignMethodModel'; +import CallMethodModel from './models/methods/CallMethodModel'; +import GetStorageAtMethodModel from './models/methods/GetStorageAtMethodModel'; +import EstimateGasMethodModel from './models/methods/EstimateGasMethodModel'; +import GetPastLogsMethodModel from './models/methods/GetPastLogsMethodModel'; +// Personal +import EcRecoverMethodModel from './models/methods/personal/EcRecoverMethodModel'; + +import ImportRawKeyMethodModel from './models/methods/personal/ImportRawKeyMethodModel'; +import ListAccountsMethodModel from './models/methods/personal/ListAccountsMethodModel'; +import LockAccountMethodModel from './models/methods/personal/LockAccountMethodModel'; +import NewAccountMethodModel from './models/methods/personal/NewAccountMethodModel'; +import PersonalSendTransactionMethodModel from './models/methods/personal/PersonalSendTransactionMethodModel'; +import PersonalSignMethodModel from './models/methods/personal/PersonalSignMethodModel'; +import PersonalSignTransactionMethodModel from './models/methods/personal/PersonalSignTransactionMethodModel'; +import UnlockAccountMethodModel from './models/methods/personal/UnlockAccountMethodModel'; +// SHH +import AddPrivateKeyMethodModel from './models/methods/shh/AddPrivateKeyMethodModel'; + +import AddSymKeyMethodModel from './models/methods/shh/AddSymKeyMethodModel'; +import DeleteKeyPairMethodModel from './models/methods/shh/DeleteKeyPairMethodModel'; +import DeleteMessageFilterMethodModel from './models/methods/shh/DeleteMessageFilterMethodModel'; +import DeleteSymKeyMethodModel from './models/methods/shh/DeleteSymKeyMethodModel'; +import GenerateSymKeyFromPasswordMethodModel from './models/methods/shh/GenerateSymKeyFromPasswordMethodModel'; +import GetFilterMessagesMethodModel from './models/methods/shh/GetFilterMessagesMethodModel'; +import GetInfoMethodModel from './models/methods/shh/GetInfoMethodModel'; +import GetPrivateKeyMethodModel from './models/methods/shh/GetPrivateKeyMethodModel'; +import GetPublicKeyMethodModel from './models/methods/shh/GetPublicKeyMethodModel'; +import GetSymKeyMethodModel from './models/methods/shh/GetSymKeyMethodModel'; +import HasKeyPairMethodModel from './models/methods/shh/HasKeyPairMethodModel'; +import HasSymKeyMethodModel from './models/methods/shh/HasSymKeyMethodModel'; +import MarkTrustedPeerMethodModel from './models/methods/shh/MarkTrustedPeerMethodModel'; +import NewKeyPairMethodModel from './models/methods/shh/NewKeyPairMethodModel'; +import NewMessageFilterMethodModel from './models/methods/shh/NewMessageFilterMethodModel'; +import NewSymKeyMethodModel from './models/methods/shh/NewSymKeyMethodModel'; +import PostMethodModel from './models/methods/shh/PostMethodModel'; +import SetMaxMessageSizeMethodModel from './models/methods/shh/SetMaxMessageSizeMethodModel'; +import SetMinPoWMethodModel from './models/methods/shh/SetMinPoWMethodModel'; +import ShhVersionMethodModel from './models/methods/shh/ShhVersionMethodModel'; + +export default { + version, + AbstractMethodModelFactory, /** * Returns the MethodController object @@ -120,7 +120,7 @@ module.exports = { * * @returns {MethodController} */ - MethodController: function () { + MethodController() { return new MethodPackageFactory().createMethodController( PromiEventPackage, new SubscriptionsFactory(), @@ -131,81 +131,81 @@ module.exports = { /** * Methods */ - // Network - GetProtocolVersionMethodModel: GetProtocolVersionMethodModel, - VersionMethodModel: VersionMethodModel, - ListeningMethodModel: ListeningMethodModel, - PeerCountMethodModel: PeerCountMethodModel, - - // Node - GetNodeInfoMethodModel: GetNodeInfoMethodModel, - GetCoinbaseMethodModel: GetCoinbaseMethodModel, - IsMiningMethodModel: IsMiningMethodModel, - GetHashrateMethodModel: GetHashrateMethodModel, - IsSyncingMethodModel: IsSyncingMethodModel, - GetWorkMethodModel: GetWorkMethodModel, - GetGasPriceMethodModel: GetGasPriceMethodModel, - SubmitWorkMethodModel: SubmitWorkMethodModel, - - // Account - GetAccountsMethodModel: GetAccountsMethodModel, - GetBalanceMethodModel: GetBalanceMethodModel, - GetTransactionCountMethodModel: GetTransactionCountMethodModel, - - // Block - GetBlockNumberMethodModel: GetBlockNumberMethodModel, - GetBlockMethodModel: GetBlockMethodModel, - GetUncleMethodModel: GetUncleMethodModel, - GetBlockTransactionCountMethodModel: GetBlockTransactionCountMethodModel, - GetBlockUncleCountMethodModel: GetBlockUncleCountMethodModel, - - // Transaction - GetTransactionMethodModel: GetTransactionMethodModel, - GetTransactionFromBlockMethodModel: GetTransactionFromBlockMethodModel, - SendSignedTransactionMethodModel: SendSignedTransactionMethodModel, - SignTransactionMethodModel: SignTransactionMethodModel, - SendTransactionMethodModel: SendTransactionMethodModel, - GetTransactionReceipt: GetTransactionReceipt, - - // Global - GetStorageAtMethodModel: GetStorageAtMethodModel, - GetCodeMethodModel: GetCodeMethodModel, - SignMethodModel: SignMethodModel, - CallMethodModel: CallMethodModel, - EstimateGasMethodModel: EstimateGasMethodModel, - GetPastLogsMethodModel: GetPastLogsMethodModel, - - // Personal - EcRecoverMethodModel: EcRecoverMethodModel, - ImportRawKeyMethodModel: ImportRawKeyMethodModel, - ListAccountsMethodModel: ListAccountsMethodModel, - LockAccountMethodModel: LockAccountMethodModel, - NewAccountMethodModel: NewAccountMethodModel, - PersonalSendTransactionMethodModel: PersonalSendTransactionMethodModel, - PersonalSignMethodModel: PersonalSignMethodModel, - PersonalSignTransactionMethodModel: PersonalSignTransactionMethodModel, - UnlockAccountMethodModel: UnlockAccountMethodModel, - - // SHH - AddPrivateKeyMethodModel: AddPrivateKeyMethodModel, - AddSymKeyMethodModel: AddSymKeyMethodModel, - DeleteKeyPairMethodModel: DeleteKeyPairMethodModel, - DeleteMessageFilterMethodModel: DeleteMessageFilterMethodModel, - DeleteSymKeyMethodModel: DeleteSymKeyMethodModel, - GenerateSymKeyFromPasswordMethodModel: GenerateSymKeyFromPasswordMethodModel, - GetFilterMessagesMethodModel: GetFilterMessagesMethodModel, - GetInfoMethodModel: GetInfoMethodModel, - GetPrivateKeyMethodModel: GetPrivateKeyMethodModel, - GetPublicKeyMethodModel: GetPublicKeyMethodModel, - GetSymKeyMethodModel: GetSymKeyMethodModel, - HasKeyPairMethodModel: HasKeyPairMethodModel, - HasSymKeyMethodModel: HasSymKeyMethodModel, - MarkTrustedPeerMethodModel: MarkTrustedPeerMethodModel, - NewKeyPairMethodModel: NewKeyPairMethodModel, - NewMessageFilterMethodModel: NewMessageFilterMethodModel, - NewSymKeyMethodModel: NewSymKeyMethodModel, - PostMethodModel: PostMethodModel, - SetMaxMessageSizeMethodModel: SetMaxMessageSizeMethodModel, - SetMinPoWMethodModel: SetMinPoWMethodModel, - ShhVersionMethodModel: ShhVersionMethodModel + // Network + GetProtocolVersionMethodModel, + VersionMethodModel, + ListeningMethodModel, + PeerCountMethodModel, + + // Node + GetNodeInfoMethodModel, + GetCoinbaseMethodModel, + IsMiningMethodModel, + GetHashrateMethodModel, + IsSyncingMethodModel, + GetWorkMethodModel, + GetGasPriceMethodModel, + SubmitWorkMethodModel, + + // Account + GetAccountsMethodModel, + GetBalanceMethodModel, + GetTransactionCountMethodModel, + + // Block + GetBlockNumberMethodModel, + GetBlockMethodModel, + GetUncleMethodModel, + GetBlockTransactionCountMethodModel, + GetBlockUncleCountMethodModel, + + // Transaction + GetTransactionMethodModel, + GetTransactionFromBlockMethodModel, + SendSignedTransactionMethodModel, + SignTransactionMethodModel, + SendTransactionMethodModel, + GetTransactionReceipt, + + // Global + GetStorageAtMethodModel, + GetCodeMethodModel, + SignMethodModel, + CallMethodModel, + EstimateGasMethodModel, + GetPastLogsMethodModel, + + // Personal + EcRecoverMethodModel, + ImportRawKeyMethodModel, + ListAccountsMethodModel, + LockAccountMethodModel, + NewAccountMethodModel, + PersonalSendTransactionMethodModel, + PersonalSignMethodModel, + PersonalSignTransactionMethodModel, + UnlockAccountMethodModel, + + // SHH + AddPrivateKeyMethodModel, + AddSymKeyMethodModel, + DeleteKeyPairMethodModel, + DeleteMessageFilterMethodModel, + DeleteSymKeyMethodModel, + GenerateSymKeyFromPasswordMethodModel, + GetFilterMessagesMethodModel, + GetInfoMethodModel, + GetPrivateKeyMethodModel, + GetPublicKeyMethodModel, + GetSymKeyMethodModel, + HasKeyPairMethodModel, + HasSymKeyMethodModel, + MarkTrustedPeerMethodModel, + NewKeyPairMethodModel, + NewMessageFilterMethodModel, + NewSymKeyMethodModel, + PostMethodModel, + SetMaxMessageSizeMethodModel, + SetMinPoWMethodModel, + ShhVersionMethodModel }; diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index d933023e023..62d268f4a70 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -20,93 +20,98 @@ * @date 2018 */ -/** - * @constructor - */ -function TransactionConfirmationModel() { - this.confirmations = []; - this.timeoutCounter = 0; +export default class TransactionConfirmationModel { /** - * Defines accessors for POLLINGTIMEOUT. This is the average block time (seconds) * TIMEOUTBLOCK + * @constructor */ - Object.defineProperty(this, 'POLLINGTIMEOUT', { - get: function () { - return 15 * this.TIMEOUTBLOCK; - }, - set: function () {}, - enumerable: true - }); + constructor() { + this.confirmations = []; + this.timeoutCounter = 0; + + /** + * Defines accessors for POLLINGTIMEOUT. This is the average block time (seconds) * TIMEOUTBLOCK + */ + Object.defineProperty(this, 'POLLINGTIMEOUT', { + get() { + return 15 * this.TIMEOUTBLOCK; + }, + set() { + }, + enumerable: true + }); + + /** + * Defines accessors for TIMEOUTBLOCK + */ + Object.defineProperty(this, 'TIMEOUTBLOCK', { + get() { + return 50; + }, + set() { + }, + enumerable: true + }); + + /** + * Defines accessors for CONFIRMATIONBLOCKS + */ + Object.defineProperty(this, 'CONFIRMATIONBLOCKS', { + get() { + return 24; + }, + set() { + }, + enumerable: true + }); + + /** + * Defines accessors for confirmationsCount + */ + Object.defineProperty(this, 'confirmationsCount', { + get() { + return this.confirmations.length; + }, + set() { + }, + enumerable: true + }); + } /** - * Defines accessors for TIMEOUTBLOCK + * Adds a receipt to the confirmation array + * + * @method addConfirmation + * + * @param {Object} receipt */ - Object.defineProperty(this, 'TIMEOUTBLOCK', { - get: function () { - return 50; - }, - set: function () {}, - enumerable: true - }); + addConfirmation(receipt) { + this.confirmations.push(receipt); + } /** - * Defines accessors for CONFIRMATIONBLOCKS + * Checks if enough confirmations are registered to set the transaction as approved + * + * @method isConfirmed + * + * @returns {Boolean} */ - Object.defineProperty(this, 'CONFIRMATIONBLOCKS', { - get: function () { - return 24; - }, - set: function () {}, - enumerable: true - }); + isConfirmed() { + return this.confirmationsCount === (this.CONFIRMATIONBLOCKS + 1); + } /** - * Defines accessors for confirmationsCount + * Checks if the timeout time is exceeded + * + * @method isTimeoutTimeExceeded + * + * @returns {Boolean} */ - Object.defineProperty(this, 'confirmationsCount', { - get: function () { - return this.confirmations.length; - }, - set: function () {}, - enumerable: true - }); -} + isTimeoutTimeExceeded(watcherIsPolling) { + if (watcherIsPolling) { + return (this.timeoutCounter - 1) >= this.POLLINGTIMEOUT; + } -/** - * Adds a receipt to the confirmation array - * - * @method addConfirmation - * - * @param {Object} receipt - */ -TransactionConfirmationModel.prototype.addConfirmation = function (receipt) { - this.confirmations.push(receipt); -}; - -/** - * Checks if enough confirmations are registered to set the transaction as approved - * - * @method isConfirmed - * - * @returns {Boolean} - */ -TransactionConfirmationModel.prototype.isConfirmed = function () { - return this.confirmationsCount === (this.CONFIRMATIONBLOCKS + 1); -}; - -/** - * Checks if the timeout time is exceeded - * - * @method isTimeoutTimeExceeded - * - * @returns {Boolean} - */ -TransactionConfirmationModel.prototype.isTimeoutTimeExceeded = function (watcherIsPolling) { - if (watcherIsPolling) { - return (this.timeoutCounter - 1) >= this.POLLINGTIMEOUT; + return (this.timeoutCounter - 1) >= this.TIMEOUTBLOCK; } - - return (this.timeoutCounter - 1) >= this.TIMEOUTBLOCK; -}; - -module.exports = TransactionConfirmationModel; +} diff --git a/packages/web3-core-method/src/models/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js index f5ed2641e92..7068597d65f 100644 --- a/packages/web3-core-method/src/models/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -22,31 +22,29 @@ "use strict"; -var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function CallMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_call', 2, utils, formatters); +import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; + +export default class CallMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_call', 2, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], moduleInstance); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); + } } - -CallMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -CallMethodModel.prototype.constructor = CallMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -CallMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], moduleInstance); - this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); -}; - -module.exports = CallMethodModel; diff --git a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index d82c518bca3..e95273463ef 100644 --- a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -22,43 +22,41 @@ "use strict"; -var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function EstimateGasMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_estimateGas', 1, utils, formatters); +import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; + +export default class EstimateGasMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_estimateGas', 1, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], moduleInstance); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ + afterExecution(response) { + return this.utils.hexToNumber(response); + } } - -EstimateGasMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -EstimateGasMethodModel.prototype.constructor = EstimateGasMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -EstimateGasMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], moduleInstance); -}; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Number} - */ -EstimateGasMethodModel.prototype.afterExecution = function (response) { - return this.utils.hexToNumber(response); -}; - -module.exports = EstimateGasMethodModel; diff --git a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index 56381e73fef..c028dc9d2f1 100644 --- a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -22,31 +22,28 @@ "use strict"; -var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetCodeMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getCode', 2, utils, formatters); +import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; + +export default class GetCodeMethodModel extends AbstractMethodModel { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getCode', 2, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); + } } - -GetCodeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetCodeMethodModel.prototype.constructor = GetCodeMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -GetCodeMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); - this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); -}; - -module.exports = GetCodeMethodModel; diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index 8e9cc601730..c3799325d6d 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -22,47 +22,45 @@ "use strict"; -var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); +import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetPastLogsMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getLogs', 1, utils, formatters); -} +export default class GetPastLogsMethodModel extends AbstractMethodModel { -GetPastLogsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetPastLogsMethodModel.prototype.constructor = GetPastLogsMethodModel; + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getLogs', 1, utils, formatters); + } -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -GetPastLogsMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputLogFormatter(this.parameters[0]); -}; + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputLogFormatter(this.parameters[0]); + } -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Array} response - * - * @returns {Array} - */ -GetPastLogsMethodModel.prototype.afterExecution = function (response) { - var self = this; + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Array} response + * + * @returns {Array} + */ + afterExecution(response) { + const self = this; - return response.map(function(responseItem) { - return self.formatters.outputLogFormatter(responseItem); - }); -}; - -module.exports = GetPastLogsMethodModel; + return response.map(responseItem => { + return self.formatters.outputLogFormatter(responseItem); + }); + } +} diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index c512033620d..137142e4742 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -22,32 +22,30 @@ "use strict"; -var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetStorageAtMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getStorageAt', 3, utils, formatters); +import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; + +export default class GetStorageAtMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getStorageAt', 3, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + this.parameters[1] = this.utils.numberToHex(this.parameters[1]); + this.parameters[2] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2], moduleInstance); + } } - -GetStorageAtMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetStorageAtMethodModel.prototype.constructor = GetStorageAtMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -GetStorageAtMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); - this.parameters[1] = this.utils.numberToHex(this.parameters[1]); - this.parameters[2] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2], moduleInstance); -}; - -module.exports = GetStorageAtMethodModel; diff --git a/packages/web3-core-method/src/models/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js index 6defee31446..c4531308df2 100644 --- a/packages/web3-core-method/src/models/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -22,33 +22,31 @@ "use strict"; -var AbstractMethodModel = require('../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * @param {Accounts} accounts - * - * @constructor - */ -function SignMethodModel(utils, formatters, accounts) { - AbstractMethodModel.call(this, 'eth_sign', 2, utils, formatters); - this.accounts = accounts; +import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; + +export default class SignMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ + constructor(utils, formatters, accounts) { + super('eth_sign', 2, utils, formatters); + this.accounts = accounts; + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); + } } - -SignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SignMethodModel.prototype.constructor = SignMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -SignMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); - this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); -}; - -module.exports = SignMethodModel; diff --git a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js index f24a4c628e2..58e1ed395c7 100644 --- a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js @@ -22,36 +22,34 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetAccountsMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_accounts', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetAccountsMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_accounts', 0, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Array} + */ + afterExecution(response) { + const self = this; + + return response.map(responseItem => { + return self.utils.toChecksumAddress(responseItem); + }); + } } - -GetAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetAccountsMethodModel.prototype.constructor = GetAccountsMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Array} - */ -GetAccountsMethodModel.prototype.afterExecution = function (response) { - var self = this; - - return response.map(function(responseItem) { - return self.utils.toChecksumAddress(responseItem); - }); -}; - -module.exports = GetAccountsMethodModel; diff --git a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index 63e0c4400d9..e3fdecb122a 100644 --- a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -22,44 +22,41 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetBalanceMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getBalance', 2, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetBalanceMethodModel extends AbstractMethodModel { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getBalance', 2, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {BigNumber} + */ + afterExecution(response) { + return this.formatters.outputBigNumberFormatter(response); + } } - -GetBalanceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBalanceMethodModel.prototype.constructor = GetBalanceMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -GetBalanceMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); - this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); -}; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {BigNumber} - */ -GetBalanceMethodModel.prototype.afterExecution = function(response) { - return this.formatters.outputBigNumberFormatter(response); -}; - -module.exports = GetBalanceMethodModel; diff --git a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index be0e8aecd5e..62d128e4121 100644 --- a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -22,44 +22,42 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetTransactionCountMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getTransactionCount', 2, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetTransactionCountMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getTransactionCount', 2, utils, formatters); + } + + /** + * This method will be executed before the effective execution. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ + afterExecution(response) { + return this.utils.hexToNumber(response); + } } - -GetTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetTransactionCountMethodModel.prototype.constructor = GetTransactionCountMethodModel; - -/** - * This method will be executed before the effective execution. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - */ -GetTransactionCountMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); - this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance); -}; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Number} - */ -GetTransactionCountMethodModel.prototype.afterExecution = function (response) { - return this.utils.hexToNumber(response); -}; - -module.exports = GetTransactionCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index 84598dcbf9b..483141e7e14 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -22,48 +22,46 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetBlockMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getBlockByNumber', 2, utils, formatters); -} +export default class GetBlockMethodModel extends AbstractMethodModel { -GetBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBlockMethodModel.prototype.constructor = GetBlockMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -GetBlockMethodModel.prototype.beforeExecution = function (moduleInstance) { - if (this.isHash(this.parameters[0])) { - this.rpcMethod = 'eth_getBlockByHash'; + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getBlockByNumber', 2, utils, formatters); } - this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); - this.parameters[1] = !!this.parameters[1]; -}; + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + if (this.isHash(this.parameters[0])) { + this.rpcMethod = 'eth_getBlockByHash'; + } -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Object} - */ -GetBlockMethodModel.prototype.afterExecution = function(response) { - return this.formatters.outputBlockFormatter(response); -}; + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); + this.parameters[1] = !!this.parameters[1]; + } -module.exports = GetBlockMethodModel; + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ + afterExecution(response) { + return this.formatters.outputBlockFormatter(response); + } +} diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js index 7d78cfc114b..82a2ebb3772 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js @@ -22,32 +22,29 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetBlockNumberMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_blockNumber', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetBlockNumberMethodModel extends AbstractMethodModel { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_blockNumber', 0, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ + afterExecution(response) { + return this.utils.hexToNumber(response); + } } - -GetBlockNumberMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBlockNumberMethodModel.prototype.constructor = GetBlockNumberMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Number} - */ -GetBlockNumberMethodModel.prototype.afterExecution = function (response) { - return this.utils.hexToNumber(response); -}; - -module.exports = GetBlockNumberMethodModel; diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index 423289545f1..aeec8a96a51 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -22,47 +22,45 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetBlockTransactionCountMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getTransactionByBlockNumberAndIndex', 1, utils, formatters); -} +export default class GetBlockTransactionCountMethodModel extends AbstractMethodModel { -GetBlockTransactionCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBlockTransactionCountMethodModel.prototype.constructor = GetBlockTransactionCountMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - */ -GetBlockTransactionCountMethodModel.prototype.beforeExecution = function (moduleInstance) { - if (this.isHash(this.parameters[0])) { - this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getTransactionByBlockNumberAndIndex', 1, utils, formatters); } - this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); -}; + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance + */ + beforeExecution(moduleInstance) { + if (this.isHash(this.parameters[0])) { + this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; + } -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Number} - */ -GetBlockTransactionCountMethodModel.prototype.afterExecution = function (response) { - return this.utils.hexToNumber(response); -}; + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); + } -module.exports = GetBlockTransactionCountMethodModel; + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ + afterExecution(response) { + return this.utils.hexToNumber(response); + } +} diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index 591d6861291..5597c9b9d4f 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -22,47 +22,45 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetBlockUncleCountMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getUncleCountByBlockNumber', 1, utils, formatters); -} +export default class GetBlockUncleCountMethodModel extends AbstractMethodModel { -GetBlockUncleCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetBlockUncleCountMethodModel.prototype.constructor = GetBlockUncleCountMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - */ -GetBlockUncleCountMethodModel.prototype.beforeExecution = function (moduleInstance) { - if (this.isHash(this.parameters[0])) { - this.rpcMethod = 'eth_getUncleCountByBlockHash'; + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getUncleCountByBlockNumber', 1, utils, formatters); } - this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); -}; + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance + */ + beforeExecution(moduleInstance) { + if (this.isHash(this.parameters[0])) { + this.rpcMethod = 'eth_getUncleCountByBlockHash'; + } -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Number} - */ -GetBlockUncleCountMethodModel.prototype.afterExecution = function (response) { - return this.utils.hexToNumber(response); -}; + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); + } -module.exports = GetBlockUncleCountMethodModel; + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ + afterExecution(response) { + return this.utils.hexToNumber(response); + } +} diff --git a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index 255809fa4e9..ba7c1a29636 100644 --- a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -22,48 +22,46 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetUncleMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getUncleByBlockNumberAndIndex', 2, utils, formatters); -} +export default class GetUncleMethodModel extends AbstractMethodModel { -GetUncleMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetUncleMethodModel.prototype.constructor = GetUncleMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - */ -GetUncleMethodModel.prototype.beforeExecution = function (moduleInstance) { - if (this.isHash(this.parameters[0])) { - this.rpcMethod = 'eth_getUncleByBlockHashAndIndex'; + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getUncleByBlockNumberAndIndex', 2, utils, formatters); } - this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); - this.parameters[1] = this.utils.numberToHex(this.parameters[1]); -}; + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance + */ + beforeExecution(moduleInstance) { + if (this.isHash(this.parameters[0])) { + this.rpcMethod = 'eth_getUncleByBlockHashAndIndex'; + } -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Object} - */ -GetUncleMethodModel.prototype.afterExecution = function (response) { - return this.formatters.outputBlockFormatter(response); -}; + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); + this.parameters[1] = this.utils.numberToHex(this.parameters[1]); + } -module.exports = GetUncleMethodModel; + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ + afterExecution(response) { + return this.formatters.outputBlockFormatter(response); + } +} diff --git a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js index 247f6a93c76..e80db337afe 100644 --- a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetProtocolVersionMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_protocolVersion', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetProtocolVersionMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_protocolVersion', 0, utils, formatters); + } } - -GetProtocolVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetProtocolVersionMethodModel.prototype.constructor = GetProtocolVersionMethodModel; - -module.exports = GetProtocolVersionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js index fa2d1ed2be2..f61707ed2a1 100644 --- a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function ListeningMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'net_listening', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class ListeningMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('net_listening', 0, utils, formatters); + } } - -ListeningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -ListeningMethodModel.prototype.constructor = ListeningMethodModel; - -module.exports = ListeningMethodModel; diff --git a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js index 29371fb14b3..f7d83f3a614 100644 --- a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js @@ -22,32 +22,30 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function PeerCountMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'net_peerCount', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class PeerCountMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('net_peerCount', 0, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {String} response + * + * @returns {Number} + */ + afterExecution(response) { + return this.utils.hexToNumber(response); + } } - -PeerCountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -PeerCountMethodModel.prototype.constructor = PeerCountMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {String} response - * - * @returns {Number} - */ -PeerCountMethodModel.prototype.afterExecution = function (response) { - return this.utils.hexToNumber(response); -}; - -module.exports = PeerCountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js index aed766aee72..27ab9bd08b7 100644 --- a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js @@ -22,32 +22,30 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function VersionMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_protocolVersion', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class VersionMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_protocolVersion', 0, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ + afterExecution(response) { + return this.utils.hexToNumber(response); + } } - -VersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -VersionMethodModel.prototype.constructor = VersionMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Number} - */ -VersionMethodModel.prototype.afterExecution = function (response) { - return this.utils.hexToNumber(response); -}; - -module.exports = VersionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js index fd5af51d026..dc181007e0b 100644 --- a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetCoinbaseMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_coinbase', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetCoinbaseMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_coinbase', 0, utils, formatters); + } } - -GetCoinbaseMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetCoinbaseMethodModel.prototype.constructor = GetCoinbaseMethodModel; - -module.exports = GetCoinbaseMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js index 1a320b3b340..42c59eccdd2 100644 --- a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js @@ -22,32 +22,29 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetGasPriceMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_gasPrice', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetGasPriceMethodModel extends AbstractMethodModel { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_gasPrice', 0, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {BigNumber} + */ + afterExecution(response) { + return this.formatters.outputBigNumberFormatter(response); + } } - -GetGasPriceMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetGasPriceMethodModel.prototype.constructor = GetGasPriceMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {BigNumber} - */ -GetGasPriceMethodModel.prototype.afterExecution = function (response) { - return this.formatters.outputBigNumberFormatter(response); -}; - -module.exports = GetGasPriceMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js index 4e8e7102a3f..b75219a79f0 100644 --- a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js @@ -22,32 +22,30 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetHashrateMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_hashrate', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetHashrateMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_hashrate', 0, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Number} + */ + afterExecution(response) { + return this.utils.hexToNumber(response); + } } - -GetHashrateMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetHashrateMethodModel.prototype.constructor = GetHashrateMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Number} - */ -GetHashrateMethodModel.prototype.afterExecution = function (response) { - return this.utils.hexToNumber(response); -}; - -module.exports = GetHashrateMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js index fdb451d87cb..b84c257c030 100644 --- a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetNodeInfoMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'web3_clientVersion', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetNodeInfoMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('web3_clientVersion', 0, utils, formatters); + } } - -GetNodeInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetNodeInfoMethodModel.prototype.constructor = GetNodeInfoMethodModel; - -module.exports = GetNodeInfoMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js index b7b44133c5e..25e379b64d1 100644 --- a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetWorkMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getWork', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetWorkMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getWork', 0, utils, formatters); + } } - -GetWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetWorkMethodModel.prototype.constructor = GetWorkMethodModel; - -module.exports = GetWorkMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js index 1c40464d48f..3396a1f9d6c 100644 --- a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function IsMiningMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_mining', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class IsMiningMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_mining', 0, utils, formatters); + } } - -IsMiningMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -IsMiningMethodModel.prototype.constructor = IsMiningMethodModel; - -module.exports = IsMiningMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js index e28425c0c98..36eef20310d 100644 --- a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js @@ -22,32 +22,30 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function IsSyncingMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_syncing', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class IsSyncingMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_syncing', 0, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ + afterExecution(response) { + return this.formatters.outputSyncingFormatter(response); + } } - -IsSyncingMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -IsSyncingMethodModel.prototype.constructor = IsSyncingMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Object} - */ -IsSyncingMethodModel.prototype.afterExecution = function (response) { - return this.formatters.outputSyncingFormatter(response); -}; - -module.exports = IsSyncingMethodModel; diff --git a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js index a124062b6e0..e593a8086c7 100644 --- a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function SubmitWorkMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_submitWork', 3, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class SubmitWorkMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_submitWork', 3, utils, formatters); + } } - -SubmitWorkMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SubmitWorkMethodModel.prototype.constructor = SubmitWorkMethodModel; - -module.exports = SubmitWorkMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index 37bcc194f39..e6d5e05ebf6 100644 --- a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -22,31 +22,29 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function EcRecoverMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'personal_ecRecover', 3, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class EcRecoverMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('personal_ecRecover', 3, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); + } } - -EcRecoverMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -EcRecoverMethodModel.prototype.constructor = EcRecoverMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -EcRecoverMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); - this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); -}; - -module.exports = EcRecoverMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js index 57366ad247b..e60056a64c8 100644 --- a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function ImportRawKeyMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'personal_importRawKey', 2, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class ImportRawKeyMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('personal_importRawKey', 2, utils, formatters); + } } - -ImportRawKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -ImportRawKeyMethodModel.prototype.constructor = ImportRawKeyMethodModel; - -module.exports = ImportRawKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js index 97cc4254053..07842b89bfb 100644 --- a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js @@ -22,36 +22,34 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function ListAccountsMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'personal_listAccounts', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class ListAccountsMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('personal_listAccounts', 0, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Array} + */ + afterExecution(response) { + const self = this; + + return response.map(responseItem => { + return self.utils.toChecksumAddress(responseItem); + }); + } } - -ListAccountsMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -ListAccountsMethodModel.prototype.constructor = ListAccountsMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Array} - */ -ListAccountsMethodModel.prototype.afterExecution = function (response) { - var self = this; - - return response.map(function(responseItem) { - return self.utils.toChecksumAddress(responseItem); - }); -}; - -module.exports = ListAccountsMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index 054585509e2..a8e63addf86 100644 --- a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -22,30 +22,28 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function LockAccountMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'personal_lockAccount', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class LockAccountMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('personal_lockAccount', 1, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + } } - -LockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -LockAccountMethodModel.prototype.constructor = LockAccountMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -LockAccountMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); -}; - -module.exports = LockAccountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js index 9620fed6f2b..33a0e06fe36 100644 --- a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js @@ -22,32 +22,30 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function NewAccountMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'personal_newAccount', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class NewAccountMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('personal_newAccount', 0, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {String} + */ + afterExecution(response) { + return this.utils.toChecksumAddress(response); + } } - -NewAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -NewAccountMethodModel.prototype.constructor = NewAccountMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {String} - */ -NewAccountMethodModel.prototype.afterExecution = function (response) { - return this.utils.toChecksumAddress(response); -}; - -module.exports = NewAccountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index 6399c03cf69..359674d5cea 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -22,30 +22,28 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function PersonalSendTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'personal_sendTransaction', 2, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class PersonalSendTransactionMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('personal_sendTransaction', 2, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); + } } - -PersonalSendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -PersonalSendTransactionMethodModel.prototype.constructor = PersonalSendTransactionMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -PersonalSendTransactionMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); -}; - -module.exports = PersonalSendTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index 93c2d047e7d..1589f563d97 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -22,31 +22,29 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function PersonalSignMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'personal_sign', 3, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class PersonalSignMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('personal_sign', 3, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); + this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); + } } - -PersonalSignMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -PersonalSignMethodModel.prototype.constructor = PersonalSignMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -PersonalSignMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); - this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); -}; - -module.exports = PersonalSignMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js index d01719fa75d..d399e17b77f 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js @@ -22,30 +22,28 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function PersonalSignTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'personal_signTransaction', 2, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class PersonalSignTransactionMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('personal_signTransaction', 2, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); + } } - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -PersonalSignTransactionMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); -}; - -PersonalSignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -PersonalSignTransactionMethodModel.prototype.constructor = PersonalSignTransactionMethodModel; - -module.exports = PersonalSignTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index a51865f76ce..24072b7d991 100644 --- a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -22,30 +22,27 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function UnlockAccountMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'personal_unlockAccount', 3, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class UnlockAccountMethodModel extends AbstractMethodModel { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('personal_unlockAccount', 3, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); + } } - -UnlockAccountMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -UnlockAccountMethodModel.prototype.constructor = UnlockAccountMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -UnlockAccountMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputAddressFormatter(this.parameters[0]); -}; - -module.exports = UnlockAccountMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js index 5637f30de11..b4e0da819c5 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function AddPrivateKeyMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_addPrivateKey', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class AddPrivateKeyMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_addPrivateKey', 1, utils, formatters); + } } - -AddPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -AddPrivateKeyMethodModel.prototype.constructor = AddPrivateKeyMethodModel; - -module.exports = AddPrivateKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js index 4ddab44dca0..af50d0e8c9b 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function AddSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_addSymKey', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class AddSymKeyMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_addSymKey', 1, utils, formatters); + } } - -AddSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -AddSymKeyMethodModel.prototype.constructor = AddSymKeyMethodModel; - -module.exports = AddSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js index 328afec0ee4..1c60ecb206e 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function DeleteKeyPairMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_deleteKeyPair', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class DeleteKeyPairMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_deleteKeyPair', 1, utils, formatters); + } } - -DeleteKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -DeleteKeyPairMethodModel.prototype.constructor = DeleteKeyPairMethodModel; - -module.exports = DeleteKeyPairMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js index 61483b91391..d1f930ac436 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function DeleteMessageFilterMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_deleteMessageFilter', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class DeleteMessageFilterMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_deleteMessageFilter', 1, utils, formatters); + } } - -DeleteMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -DeleteMessageFilterMethodModel.prototype.constructor = DeleteMessageFilterMethodModel; - -module.exports = DeleteMessageFilterMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js index af6977c9202..cbe4e97998e 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function DeleteSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_deleteSymKey', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class DeleteSymKeyMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_deleteSymKey', 1, utils, formatters); + } } - -DeleteSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -DeleteSymKeyMethodModel.prototype.constructor = DeleteSymKeyMethodModel; - -module.exports = DeleteSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js index baa7921d4f1..d427d9b8f30 100644 --- a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GenerateSymKeyFromPasswordMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_generateSymKeyFromPassword', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GenerateSymKeyFromPasswordMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_generateSymKeyFromPassword', 1, utils, formatters); + } } - -GenerateSymKeyFromPasswordMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GenerateSymKeyFromPasswordMethodModel.prototype.constructor = GenerateSymKeyFromPasswordMethodModel; - -module.exports = GenerateSymKeyFromPasswordMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js index 7adcc574c97..16cfe860ad0 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js @@ -22,19 +22,16 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetFilterMessagesMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_getFilterMessages', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetFilterMessagesMethodModel extends AbstractMethodModel { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_getFilterMessages', 1, utils, formatters); + } } - -GetFilterMessagesMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetFilterMessagesMethodModel.prototype.constructor = GetFilterMessagesMethodModel; - -module.exports = GetFilterMessagesMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js index 27f80118fab..b7cca48c1a7 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetInfoMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_info', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetInfoMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_info', 0, utils, formatters); + } } - -GetInfoMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetInfoMethodModel.prototype.constructor = GetInfoMethodModel; - -module.exports = GetInfoMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js index 99b6753b491..83f7e0a9229 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetPrivateKeyMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_getPrivateKey', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetPrivateKeyMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_getPrivateKey', 1, utils, formatters); + } } - -GetPrivateKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetPrivateKeyMethodModel.prototype.constructor = GetPrivateKeyMethodModel; - -module.exports = GetPrivateKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js index 06c6438e62c..5b44d13c2b7 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetPublicKeyMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_getPublicKey', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetPublicKeyMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_getPublicKey', 1, utils, formatters); + } } - -GetPublicKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetPublicKeyMethodModel.prototype.constructor = GetPublicKeyMethodModel; - -module.exports = GetPublicKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js index 42f7ff0f0d3..838d27855a5 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_getSymKey', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetSymKeyMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_getSymKey', 1, utils, formatters); + } } - -GetSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetSymKeyMethodModel.prototype.constructor = GetSymKeyMethodModel; - -module.exports = GetSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js index 1e72e2e6095..5cd4f96eb91 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function HasKeyPairMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_hasKeyPair', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class HasKeyPairMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_hasKeyPair', 1, utils, formatters); + } } - -HasKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -HasKeyPairMethodModel.prototype.constructor = HasKeyPairMethodModel; - -module.exports = HasKeyPairMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js index 18298df976b..94c574013d0 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function HasSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_hasSymKey', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class HasSymKeyMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_hasSymKey', 1, utils, formatters); + } } - -HasSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -HasSymKeyMethodModel.prototype.constructor = HasSymKeyMethodModel; - -module.exports = HasSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js index 3a9dcdb362a..f9a921ec75d 100644 --- a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function MarkTrustedPeerMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_markTrustedPeer', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class MarkTrustedPeerMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_markTrustedPeer', 1, utils, formatters); + } } - -MarkTrustedPeerMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -MarkTrustedPeerMethodModel.prototype.constructor = MarkTrustedPeerMethodModel; - -module.exports = MarkTrustedPeerMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js index f1fb1279a99..c363b291480 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function NewKeyPairMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_newKeyPair', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class NewKeyPairMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_newKeyPair', 1, utils, formatters); + } } - -NewKeyPairMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -NewKeyPairMethodModel.prototype.constructor = NewKeyPairMethodModel; - -module.exports = NewKeyPairMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js index d977904bd81..f94b6f1d478 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function NewMessageFilterMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_newMessageFilter', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class NewMessageFilterMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_newMessageFilter', 1, utils, formatters); + } } - -NewMessageFilterMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -NewMessageFilterMethodModel.prototype.constructor = NewMessageFilterMethodModel; - -module.exports = NewMessageFilterMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js index 5710b97ed3d..2a0f9015710 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function NewSymKeyMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_newSymKey', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class NewSymKeyMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_newSymKey', 0, utils, formatters); + } } - -NewSymKeyMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -NewSymKeyMethodModel.prototype.constructor = NewSymKeyMethodModel; - -module.exports = NewSymKeyMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js index 44bea28aa9d..5e84101a746 100644 --- a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function PostMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_post', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class PostMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_post', 1, utils, formatters); + } } - -PostMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -PostMethodModel.prototype.constructor = PostMethodModel; - -module.exports = PostMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js index 309d9681d5b..0a274b3de54 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function SetMaxMessageSizeMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_setMaxMessageSize', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class SetMaxMessageSizeMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_setMaxMessageSize', 1, utils, formatters); + } } - -SetMaxMessageSizeMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SetMaxMessageSizeMethodModel.prototype.constructor = SetMaxMessageSizeMethodModel; - -module.exports = SetMaxMessageSizeMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js index b6d8e58fad2..a58648373aa 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function SetMinPoWMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_setMinPoW', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class SetMinPoWMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_setMinPoW', 1, utils, formatters); + } } - -SetMinPoWMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SetMinPoWMethodModel.prototype.constructor = SetMinPoWMethodModel; - -module.exports = SetMinPoWMethodModel; diff --git a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js index 5b2f5600af3..9e42ee9c365 100644 --- a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function ShhVersionMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'shh_version', 0, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class ShhVersionMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('shh_version', 0, utils, formatters); + } } - -ShhVersionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -ShhVersionMethodModel.prototype.constructor = ShhVersionMethodModel; - -module.exports = ShhVersionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index fdaa3bd1acf..2b9e9083f8b 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -22,48 +22,46 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetTransactionFromBlockMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getTransactionByBlockNumberAndIndex', 2, utils, formatters); -} +export default class GetTransactionFromBlockMethodModel extends AbstractMethodModel { -GetTransactionFromBlockMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetTransactionFromBlockMethodModel.prototype.constructor = GetTransactionFromBlockMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -GetTransactionFromBlockMethodModel.prototype.beforeExecution = function (moduleInstance) { - if (this.isHash(this.parameters[0])) { - this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getTransactionByBlockNumberAndIndex', 2, utils, formatters); } - this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); - this.parameters[1] = this.utils.numberToHex(this.parameters[1]); -}; + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + if (this.isHash(this.parameters[0])) { + this.rpcMethod = 'eth_getTransactionByBlockHashAndIndex'; + } -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Object} - */ -GetTransactionFromBlockMethodModel.prototype.afterExecution = function (response) { - return this.formatters.outputTransactionFormatter(response); -}; + this.parameters[0] = this.formatters.inputBlockNumberFormatter(this.parameters[0]); + this.parameters[1] = this.utils.numberToHex(this.parameters[1]); + } -module.exports = GetTransactionFromBlockMethodModel; + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ + afterExecution(response) { + return this.formatters.outputTransactionFormatter(response); + } +} diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js index 1add948f94a..6033668cd97 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js @@ -22,32 +22,30 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getTransactionByHash', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetTransactionMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getTransactionByHash', 1, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ + afterExecution(response) { + return this.formatters.outputTransactionFormatter(response); + } } - -GetTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetTransactionMethodModel.prototype.constructor = GetTransactionMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Object} - */ -GetTransactionMethodModel.prototype.afterExecution = function (response) { - return this.formatters.outputTransactionFormatter(response); -}; - -module.exports = GetTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js index 5c7b6e525a1..37283d65e2a 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js @@ -22,32 +22,29 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function GetTransactionReceiptMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_getTransactionReceipt', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class GetTransactionReceiptMethodModel extends AbstractMethodModel { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_getTransactionReceipt', 1, utils, formatters); + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {Object} + */ + afterExecution(response) { + return this.formatters.outputTransactionFormatter(response); + } } - -GetTransactionReceiptMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -GetTransactionReceiptMethodModel.prototype.constructor = GetTransactionReceiptMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {Object} - */ -GetTransactionReceiptMethodModel.prototype.afterExecution = function (response) { - return this.formatters.outputTransactionFormatter(response); -}; - -module.exports = GetTransactionReceiptMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js index e0073d47fbd..d11b7f8de8e 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function SendSignedTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_sendRawTransaction', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class SendSignedTransactionMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_sendRawTransaction', 1, utils, formatters); + } } - -SendSignedTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SendSignedTransactionMethodModel.prototype.constructor = SendSignedTransactionMethodModel; - -module.exports = SendSignedTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index 3bd62623b81..611eafadbdf 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -22,32 +22,29 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * @param {Accounts} accounts - * - * @constructor - */ -function SendTransactionMethodModel(utils, formatters, accounts) { - AbstractMethodModel.call(this, 'eth_sendTransaction', 1, utils, formatters); - this.accounts = accounts; +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class SendTransactionMethodModel extends AbstractMethodModel { + /** + * @param {Object} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ + constructor(utils, formatters, accounts) { + super('eth_sendTransaction', 1, utils, formatters); + this.accounts = accounts; + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); + } } - -SendTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SendTransactionMethodModel.prototype.constructor = SendTransactionMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -SendTransactionMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); -}; - -module.exports = SendTransactionMethodModel; diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index a583b01b7b1..409b402bbef 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -22,30 +22,28 @@ "use strict"; -var AbstractMethodModel = require('../../../../lib/models/AbstractMethodModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function SignTransactionMethodModel(utils, formatters) { - AbstractMethodModel.call(this, 'eth_signTransaction', 1, utils, formatters); +import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; + +export default class SignTransactionMethodModel extends AbstractMethodModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_signTransaction', 1, utils, formatters); + } + + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from. + */ + beforeExecution(moduleInstance) { + this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); + } } - -SignTransactionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); -SignTransactionMethodModel.prototype.constructor = SignTransactionMethodModel; - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from. - */ -SignTransactionMethodModel.prototype.beforeExecution = function (moduleInstance) { - this.parameters[0] = this.formatters.inputTransactionFormatter(this.parameters[0], moduleInstance); -}; - -module.exports = SignTransactionMethodModel; diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 8c780cc6d20..0004c5b64b3 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -22,34 +22,27 @@ "use strict"; -var AbstractSigner = require('../../lib/signers/AbstractSigner'); - -/** - * @constructor - */ -function MessageSigner() { } - -MessageSigner.prototype = Object.create(AbstractSigner.prototype); -MessageSigner.prototype.constructor = MessageSigner; - -/** - * Signs a given message - * - * @method sign - * - * @param {String} data - * @param {String} address - * @param {Accounts} accounts - * - * @returns {String|Error} - */ -MessageSigner.prototype.sign = function(data, address, accounts) { - var wallet = this.getWallet(address, accounts); - if (wallet && wallet.privateKey) { - return accounts.sign(data, wallet.privateKey).signature; +import AbstractSigner from '../../lib/signers/AbstractSigner'; + +export default class MessageSigner extends AbstractSigner { + + /** + * Signs a given message + * + * @method sign + * + * @param {String} data + * @param {String} address + * @param {Accounts} accounts + * + * @returns {String|Error} + */ + sign(data, address, accounts) { + const wallet = this.getWallet(address, accounts); + if (wallet && wallet.privateKey) { + return accounts.sign(data, wallet.privateKey).signature; + } + + throw new Error('Wallet or privateKey in wallet is not set!'); } - - throw new Error('Wallet or privateKey in wallet is not set!'); -}; - -module.exports = MessageSigner; +} diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index 27e66adfb39..99841ca7663 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -22,43 +22,39 @@ "use strict"; -var AbstractSigner = require('../../lib/signers/AbstractSigner'); - -function TransactionSigner() { } - -TransactionSigner.prototype = Object.create(AbstractSigner.prototype); -TransactionSigner.prototype.constructor = TransactionSigner; - -/** - * Signs the given transaction - * - * @method sign - * - * @param {Object} transaction - * @param {Accounts} accounts - * - * @returns {Promise} - */ -TransactionSigner.prototype.sign = function (transaction, accounts) { - var self = this; - - return new Promise(function(resolve, reject) { - var wallet = self.getWallet(transaction.from, accounts); - - if (wallet && wallet.privateKey) { - delete transaction.from; - - accounts.signTransaction(transaction, wallet.privateKey).then(function(response) { - resolve(response); - }).catch(function(error) { - reject(error); - }); - - return; - } - - reject(new Error('Wallet or privateKey in wallet is not set!')); - }); -}; - -module.exports = TransactionSigner; +import AbstractSigner from '../../lib/signers/AbstractSigner'; + +export default class TransactionSigner extends AbstractSigner { + + /** + * Signs the given transaction + * + * @method sign + * + * @param {Object} transaction + * @param {Accounts} accounts + * + * @returns {Promise} + */ + sign(transaction, accounts) { + const self = this; + + return new Promise((resolve, reject) => { + const wallet = self.getWallet(transaction.from, accounts); + + if (wallet && wallet.privateKey) { + delete transaction.from; + + accounts.signTransaction(transaction, wallet.privateKey).then(response => { + resolve(response); + }).catch(error => { + reject(error); + }); + + return; + } + + reject(new Error('Wallet or privateKey in wallet is not set!')); + }); + } +} diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index 17cacded62d..690aecafabb 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -22,68 +22,64 @@ "use strict"; -var _ = require('underscore'); +import _ from 'underscore'; -/** - * @constructor - */ -function TransactionReceiptValidator() { } +export default class TransactionReceiptValidator { -/** - * Validates the receipt - * - * @method validate - * - * @param {Object} receipt - * @param {Array} methodParameters - * - * @returns {Error|Boolean} - */ -TransactionReceiptValidator.prototype.validate = function (receipt, methodParameters) { - if (this.isValidGasUsage(receipt, methodParameters) && this.isValidReceiptStatus(receipt)) { - return true; - } + /** + * Validates the receipt + * + * @method validate + * + * @param {Object} receipt + * @param {Array} methodParameters + * + * @returns {Error|Boolean} + */ + validate(receipt, methodParameters) { + if (this.isValidGasUsage(receipt, methodParameters) && this.isValidReceiptStatus(receipt)) { + return true; + } + + const receiptJSON = JSON.stringify(receipt, null, 2); - var receiptJSON = JSON.stringify(receipt, null, 2); + if (receipt.status === false || receipt.status === '0x0') { + return new Error(`Transaction has been reverted by the EVM:\n${receiptJSON}`); + } - if (receipt.status === false || receipt.status === '0x0') { - return new Error('Transaction has been reverted by the EVM:\n' + receiptJSON); + return new Error(`Transaction ran out of gas. Please provide more gas:\n${receiptJSON}`); } - return new Error('Transaction ran out of gas. Please provide more gas:\n' + receiptJSON); -}; + /** + * Checks if receipt status is valid + * + * @method isValidReceiptStatus + * + * @param {Object} receipt + * + * @returns {Boolean} + */ + isValidReceiptStatus(receipt) { + return receipt.status === true || receipt.status === '0x1' || typeof receipt.status === 'undefined' + } -/** - * Checks if receipt status is valid - * - * @method isValidReceiptStatus - * - * @param {Object} receipt - * - * @returns {Boolean} - */ -TransactionReceiptValidator.prototype.isValidReceiptStatus = function (receipt) { - return receipt.status === true || receipt.status === '0x1' || typeof receipt.status === 'undefined' -}; + /** + * Checks it is a valid gas usage + * + * @method isValidGasUsage + * + * @param {Object} receipt + * @param {Array} methodParameters + * + * @returns {Boolean} + */ + isValidGasUsage(receipt, methodParameters) { + let gasProvided = null; -/** - * Checks it is a valid gas usage - * - * @method isValidGasUsage - * - * @param {Object} receipt - * @param {Array} methodParameters - * - * @returns {Boolean} - */ -TransactionReceiptValidator.prototype.isValidGasUsage = function (receipt, methodParameters) { - var gasProvided = null; + if (_.isObject(methodParameters[0]) && methodParameters[0].gas) { + gasProvided = methodParameters[0].gas; + } - if(_.isObject(methodParameters[0]) && methodParameters[0].gas) { - gasProvided = methodParameters[0].gas; + return !receipt.outOfGas && (!gasProvided || gasProvided !== receipt.gasUsed); } - - return !receipt.outOfGas && (!gasProvided || gasProvided !== receipt.gasUsed); -}; - -module.exports = TransactionReceiptValidator; +} diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 20700097c61..de0e3c1e67a 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -20,69 +20,68 @@ * @date 2018 */ -var SocketProviderAdapter = require('web3-providers').SocketProviderAdapter; -var EventEmitter = require('eventemitter3'); +import {SocketProviderAdapter} from 'web3-providers'; +import EventEmitter from 'eventemitter3'; -/** - * @param {SubscriptionsFactory} subscriptionsFactory - * - * @constructor - */ -function NewHeadsWatcher(subscriptionsFactory) { - this.subscriptionsFactory = subscriptionsFactory; - this.confirmationInterval = null; - this.confirmationSubscription = null; - this.isPolling = false; -} +export default class NewHeadsWatcher extends EventEmitter { -NewHeadsWatcher.prototype = Object.create(EventEmitter.prototype); -NewHeadsWatcher.prototype.constructor = NewHeadsWatcher; + /** + * @param {SubscriptionsFactory} subscriptionsFactory + * + * @constructor + */ + constructor(subscriptionsFactory) { + super(); + this.subscriptionsFactory = subscriptionsFactory; + this.confirmationInterval = null; + this.confirmationSubscription = null; + this.isPolling = false; + } -/** - * Starts subscription on newHeads if supported or creates an interval to get the newHeads - * - * @method watch - * - * @param {AbstractWeb3Module} moduleInstance - * - * @returns {this} - */ -NewHeadsWatcher.prototype.watch = function (moduleInstance) { - var self = this; + /** + * Starts subscription on newHeads if supported or creates an interval to get the newHeads + * + * @method watch + * + * @param {AbstractWeb3Module} moduleInstance + * + * @returns {this} + */ + watch(moduleInstance) { + const self = this; - if (moduleInstance.currentProvider instanceof SocketProviderAdapter) { - this.confirmationSubscription = this.subscriptionsFactory - .createNewHeadsSubscription(moduleInstance) - .subscribe(function () { - self.emit('newHead'); - }); + if (moduleInstance.currentProvider instanceof SocketProviderAdapter) { + this.confirmationSubscription = this.subscriptionsFactory + .createNewHeadsSubscription(moduleInstance) + .subscribe(() => { + self.emit('newHead'); + }); - return this; - } + return this; + } - this.isPolling = true; - this.confirmationInterval = setInterval(function() { - self.emit('newHead') - }, 1000); + this.isPolling = true; + this.confirmationInterval = setInterval(() => { + self.emit('newHead') + }, 1000); - return this; -}; - -/** - * Clears the interval and unsubscribes the subscription - * - * @method stop - */ -NewHeadsWatcher.prototype.stop = function () { - if (this.confirmationSubscription) { - this.confirmationSubscription.unsubscribe(); + return this; } - if (this.confirmationInterval) { - clearInterval(this.confirmationInterval); - } + /** + * Clears the interval and unsubscribes the subscription + * + * @method stop + */ + stop() { + if (this.confirmationSubscription) { + this.confirmationSubscription.unsubscribe(); + } - this.removeAllListeners('newHead'); -}; + if (this.confirmationInterval) { + clearInterval(this.confirmationInterval); + } -module.exports = NewHeadsWatcher; + this.removeAllListeners('newHead'); + } +} diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index d778e1a4f0d..28a0b5d1564 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -22,177 +22,178 @@ "use strict"; -var ContractDeployMethodModel = require('web3-eth-contract').ContractDeployMethodModel; - -/** - * @param {TransactionConfirmationModel} transactionConfirmationModel - * @param {TransactionReceiptValidator} transactionReceiptValidator - * @param {NewHeadsWatcher} newHeadsWatcher - * @param {Object} formatters - * - * @constructor - */ -function TransactionConfirmationWorkflow( - transactionConfirmationModel, - transactionReceiptValidator, - newHeadsWatcher, - formatters -) { - this.transactionConfirmationModel = transactionConfirmationModel; - this.transactionReceiptValidator = transactionReceiptValidator; - this.newHeadsWatcher = newHeadsWatcher; - this.formatters = formatters; -} - -/** - * Executes the transaction confirmation workflow - * - * @method execute - * - * @param {AbstractMethodModel} methodModel - * @param {AbstractWeb3Module} moduleInstance - * @param {String} transactionHash - * @param {Object} promiEvent - * - * @callback callback callback(error, result) - */ -TransactionConfirmationWorkflow.prototype.execute = function (methodModel, moduleInstance, transactionHash, promiEvent) { - var self = this; +import {ContractDeployMethodModel} from 'web3-eth-contract'; + +export default class TransactionConfirmationWorkflow { + + /** + * @param {TransactionConfirmationModel} transactionConfirmationModel + * @param {TransactionReceiptValidator} transactionReceiptValidator + * @param {NewHeadsWatcher} newHeadsWatcher + * @param {Object} formatters + * + * @constructor + */ + constructor( + transactionConfirmationModel, + transactionReceiptValidator, + newHeadsWatcher, + formatters + ) { + this.transactionConfirmationModel = transactionConfirmationModel; + this.transactionReceiptValidator = transactionReceiptValidator; + this.newHeadsWatcher = newHeadsWatcher; + this.formatters = formatters; + } - this.getTransactionReceipt(moduleInstance, transactionHash).then(function (receipt) { - if (receipt && receipt.blockHash) { - var validationResult = self.transactionReceiptValidator.validate(receipt); - if (validationResult === true) { - self.handleSuccessState(receipt, methodModel, promiEvent); + /** + * Executes the transaction confirmation workflow + * + * @method execute + * + * @param {AbstractMethodModel} methodModel + * @param {AbstractWeb3Module} moduleInstance + * @param {String} transactionHash + * @param {Object} promiEvent + * + * @callback callback callback(error, result) + */ + execute(methodModel, moduleInstance, transactionHash, promiEvent) { + const self = this; + + this.getTransactionReceipt(moduleInstance, transactionHash).then(receipt => { + if (receipt && receipt.blockHash) { + const validationResult = self.transactionReceiptValidator.validate(receipt); + if (validationResult === true) { + self.handleSuccessState(receipt, methodModel, promiEvent); + + return; + } + + self.handleErrorState(validationResult, methodModel, promiEvent); return; } - self.handleErrorState(validationResult, methodModel, promiEvent); - - return; - } - - self.newHeadsWatcher.watch(moduleInstance).on('newHead', function () { - self.transactionConfirmationModel.timeoutCounter++; - if (!self.transactionConfirmationModel.isTimeoutTimeExceeded()) { - self.getTransactionReceipt(transactionHash).then(function (receipt) { - var validationResult = self.transactionReceiptValidator.validate(receipt, methodModel.parameters); - - if (validationResult === true) { - self.transactionConfirmationModel.addConfirmation(receipt); - promiEvent.emit( - 'confirmation', - self.transactionConfirmationModel.confirmationsCount, - receipt - ); - - if (self.transactionConfirmationModel.isConfirmed()) { - self.handleSuccessState(receipt, methodModel, promiEvent); + self.newHeadsWatcher.watch(moduleInstance).on('newHead', () => { + self.transactionConfirmationModel.timeoutCounter++; + if (!self.transactionConfirmationModel.isTimeoutTimeExceeded()) { + self.getTransactionReceipt(transactionHash).then(receipt => { + const validationResult = self.transactionReceiptValidator.validate(receipt, methodModel.parameters); + + if (validationResult === true) { + self.transactionConfirmationModel.addConfirmation(receipt); + promiEvent.emit( + 'confirmation', + self.transactionConfirmationModel.confirmationsCount, + receipt + ); + + if (self.transactionConfirmationModel.isConfirmed()) { + self.handleSuccessState(receipt, methodModel, promiEvent); + } + + return; } - return; - } + promiEvent.reject(validationResult); + promiEvent.emit('error', validationResult, receipt); + promiEvent.removeAllListeners(); - promiEvent.reject(validationResult); - promiEvent.emit('error', validationResult, receipt); - promiEvent.removeAllListeners(); + if (methodModel.callback) { + methodModel.callback(validationResult, null); + } + }); - if (methodModel.callback) { - methodModel.callback(validationResult, null); - } - }); + return; + } - return; - } + let error = new Error(`Transaction was not mined within ${self.transactionConfirmationModel.TIMEOUTBLOCK} blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!`); - var error = new Error('Transaction was not mined within '+ self.transactionConfirmationModel.TIMEOUTBLOCK +' blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!'); + if (self.newHeadsWatcher.isPolling) { + error = new Error(`Transaction was not mined within${self.transactionConfirmationModel.POLLINGTIMEOUT} seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!`) + } - if (self.newHeadsWatcher.isPolling) { - error = new Error('Transaction was not mined within' + self.transactionConfirmationModel.POLLINGTIMEOUT + ' seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!') - } + self.handleErrorState(error, methodModel, promiEvent); + }); + }); + } - self.handleErrorState(error, methodModel, promiEvent); + /** + * Get receipt by transaction hash + * + * @method execute + * + * @param {AbstractWeb3Module} moduleInstance + * @param {String} transactionHash + * + * @returns {Promise} + */ + getTransactionReceipt(moduleInstance, transactionHash) { + const self = this; + + return moduleInstance.currentProvider.send('eth_getTransactionReceipt', [transactionHash]).then(receipt => { + return self.formatters.outputTransactionReceiptFormatter(receipt); }); - }); -}; + } -/** - * Get receipt by transaction hash - * - * @method execute - * - * @param {AbstractWeb3Module} moduleInstance - * @param {String} transactionHash - * - * @returns {Promise} - */ -TransactionConfirmationWorkflow.prototype.getTransactionReceipt = function (moduleInstance, transactionHash) { - var self = this; + /** + * Resolves promise, emits receipt event, calls callback and removes all the listeners. + * + * @method handleSuccessState + * + * @param {Object} receipt + * @param {AbstractMethodModel} methodModel + * @param {PromiEvent} promiEvent + * + * @callback callback callback(error, result) + */ + handleSuccessState(receipt, methodModel, promiEvent) { + this.newHeadsWatcher.stop(); + + if (methodModel instanceof ContractDeployMethodModel) { + promiEvent.resolve(methodModel.afterExecution(receipt)); + promiEvent.emit('receipt', receipt); + promiEvent.removeAllListeners(); + + if (methodModel.callback) { + methodModel.callback(false, receipt); + } - return moduleInstance.currentProvider.send('eth_getTransactionReceipt', [transactionHash]).then(function (receipt) { - return self.formatters.outputTransactionReceiptFormatter(receipt); - }) -}; + return; + } -/** - * Resolves promise, emits receipt event, calls callback and removes all the listeners. - * - * @method handleSuccessState - * - * @param {Object} receipt - * @param {AbstractMethodModel} methodModel - * @param {PromiEvent} promiEvent - * - * @callback callback callback(error, result) - */ -TransactionConfirmationWorkflow.prototype.handleSuccessState = function (receipt, methodModel, promiEvent) { - this.newHeadsWatcher.stop(); + const mappedReceipt = methodModel.afterExecution(receipt); - if (methodModel instanceof ContractDeployMethodModel) { - promiEvent.resolve(methodModel.afterExecution(receipt)); - promiEvent.emit('receipt', receipt); + promiEvent.resolve(mappedReceipt); + promiEvent.emit('receipt', mappedReceipt); promiEvent.removeAllListeners(); if (methodModel.callback) { - methodModel.callback(false, receipt); + methodModel.callback(false, mappedReceipt); } - - return; } - var mappedReceipt = methodModel.afterExecution(receipt); - - promiEvent.resolve(mappedReceipt); - promiEvent.emit('receipt', mappedReceipt); - promiEvent.removeAllListeners(); - - if (methodModel.callback) { - methodModel.callback(false, mappedReceipt); - } -}; - -/** - * Rejects promise, emits error event, calls callback and removes all the listeners. - * - * @method handleErrorState - * - * @param {Error} error - * @param {AbstractMethodModel} methodModel - * @param {PromiEvent} promiEvent - * - * @callback callback callback(error, result) - */ -TransactionConfirmationWorkflow.prototype.handleErrorState = function (error, methodModel, promiEvent) { - this.newHeadsWatcher.stop(); - - promiEvent.reject(error); - promiEvent.emit('error', error); - promiEvent.removeAllListeners(); + /** + * Rejects promise, emits error event, calls callback and removes all the listeners. + * + * @method handleErrorState + * + * @param {Error} error + * @param {AbstractMethodModel} methodModel + * @param {PromiEvent} promiEvent + * + * @callback callback callback(error, result) + */ + handleErrorState(error, methodModel, promiEvent) { + this.newHeadsWatcher.stop(); + + promiEvent.reject(error); + promiEvent.emit('error', error); + promiEvent.removeAllListeners(); - if (methodModel.callback) { - methodModel.callback(error, null); + if (methodModel.callback) { + methodModel.callback(error, null); + } } -}; - -module.exports = TransactionConfirmationWorkflow; +} From b8b0f0b4fd313d394fe2cb8a3bd0538ec6dd50fa Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 16:17:51 +0200 Subject: [PATCH 0269/1045] removed var self because of the arrow functions --- .../factories/AbstractMethodModelFactory.js | 74 ++--- .../lib/models/AbstractMethodModel.js | 264 +++++++++--------- .../lib/signers/AbstractSigner.js | 66 ++--- .../src/commands/SendMethodCommand.js | 8 +- .../src/commands/SignAndSendMethodCommand.js | 4 +- .../models/methods/GetPastLogsMethodModel.js | 4 +- .../methods/account/GetAccountsMethodModel.js | 4 +- .../personal/ListAccountsMethodModel.js | 4 +- .../src/signers/TransactionSigner.js | 4 +- .../src/watchers/NewHeadsWatcher.js | 6 +- .../TransactionConfirmationWorkflow.js | 44 ++- 11 files changed, 230 insertions(+), 252 deletions(-) diff --git a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js index b700a711814..da50f40faea 100644 --- a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js +++ b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js @@ -22,41 +22,41 @@ "use strict"; -/** - * @param {Object} methodModels - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function AbstractMethodModelFactory(methodModels, utils, formatters) { - this.utils = utils; - this.formatters = formatters; - this.methodModels = methodModels; +export default class AbstractMethodModelFactory { + /** + * @param {Object} methodModels + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(methodModels, utils, formatters) { + this.utils = utils; + this.formatters = formatters; + this.methodModels = methodModels; + } + + /** + * Checks if the method exists + * + * @method hasMethodModel + * + * @param {String} name + * + * @returns {Boolean} + */ + hasMethodModel(name) { + return typeof this.methodModels[name] !== 'undefined'; + } + + /** + * Returns an MethodModel + * + * @param {String} name + * + * @returns {AbstractMethodModel} + */ + createMethodModel(name) { + return new this.methodModels[name](this.utils, this.formatters); + } } - -/** - * Checks if the method exists - * - * @method hasMethodModel - * - * @param {String} name - * - * @returns {Boolean} - */ -AbstractMethodModelFactory.prototype.hasMethodModel = function (name) { - return typeof this.methodModels[name] !== 'undefined'; -}; - -/** - * Returns an MethodModel - * - * @param {String} name - * - * @returns {AbstractMethodModel} - */ -AbstractMethodModelFactory.prototype.createMethodModel = function (name) { - return new this.methodModels[name](this.utils, this.formatters); -}; - -module.exports = AbstractMethodModelFactory; diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 141b29e673d..cf2ffbe8883 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -22,154 +22,154 @@ "use strict"; -var _ = require('underscore'); +import _ from 'underscore'; -/** - * @param {String|Function} rpcMethod - * @param {Number} parametersAmount - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function AbstractMethodModel(rpcMethod, parametersAmount, utils, formatters) { - this.rpcMethod = rpcMethod; - this.parametersAmount = parametersAmount; - this.utils = utils; - this.formatters = formatters; - var methodArguments = {}; +export default class AbstractMethodModel { /** - * Defines accessors for defaultAccount + * @param {String|Function} rpcMethod + * @param {Number} parametersAmount + * @param {Object} utils + * @param {Object} formatters + * + * @constructor */ - Object.defineProperty(this, 'methodArguments', { - get: function () { - return methodArguments; - }, - set: function (methodArguments) { - methodArguments = this.mapFunctionArguments(methodArguments); - }, - enumerable: true - }); - - this.parameters = this.methodArguments.parameters; - this.callback = this.methodArguments.callback; -} - -/** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ -AbstractMethodModel.prototype.beforeExecution = function(moduleInstance) { }; + constructor(rpcMethod, parametersAmount, utils, formatters) { + this.rpcMethod = rpcMethod; + this.parametersAmount = parametersAmount; + this.utils = utils; + this.formatters = formatters; + const methodArguments = {}; + + /** + * Defines accessors for defaultAccount + */ + Object.defineProperty(this, 'methodArguments', { + get() { + return methodArguments; + }, + set(methodArguments) { + methodArguments = this.mapFunctionArguments(methodArguments); + }, + enumerable: true + }); + + this.parameters = this.methodArguments.parameters; + this.callback = this.methodArguments.callback; + } -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {*} response - * - * @returns {*} - */ -AbstractMethodModel.prototype.afterExecution = function(response) { - return response; -}; + /** + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ + beforeExecution(moduleInstance) { } -/** - * Returns the given function arguments and the current model - * - * @method request - * - * @returns {AbstractMethodModel} - */ -AbstractMethodModel.prototype.request = function () { - this.methodArguments = arguments; + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {*} response + * + * @returns {*} + */ + afterExecution(response) { + return response; + } - return this; -}; + /** + * Returns the given function arguments and the current model + * + * @method request + * + * @returns {AbstractMethodModel} + */ + request() { + this.methodArguments = arguments; -/** - * Splits the parameters and the callback function and returns it as object - * - * @method mapFunctionArguments - * - * @param {Array} args - * - * @returns {Object} - */ -AbstractMethodModel.prototype.mapFunctionArguments = function (args) { - var parameters = args, - callback = false; - - if (args.length < this.parametersAmount) { - throw new Error( - 'Arguments length is not correct: expected: ' + this.parametersAmount + ', given: ' + args.length - ); + return this; } - if (args.length > this.parametersAmount) { - callback = args.slice(-1); - if(!_.isFunction(callback)) { + /** + * Splits the parameters and the callback function and returns it as object + * + * @method mapFunctionArguments + * + * @param {Array} args + * + * @returns {Object} + */ + mapFunctionArguments(args) { + let parameters = args, callback = false; + + if (args.length < this.parametersAmount) { throw new Error( - 'The latest parameter should be a function otherwise it can not be used as callback' + `Arguments length is not correct: expected: ${this.parametersAmount}, given: ${args.length}` ); } - parameters = args.slice(0, -1); - } - return { - callback: callback, - parameters: parameters - } -}; + if (args.length > this.parametersAmount) { + callback = args.slice(-1); + if (!_.isFunction(callback)) { + throw new Error( + 'The latest parameter should be a function otherwise it can not be used as callback' + ); + } + parameters = args.slice(0, -1); + } -/** - * Checks if the JSON-RPC method is sign. - * - * @method isSign - * - * @returns {Boolean} - */ -AbstractMethodModel.prototype.isSign = function () { - return this.rpcMethod === 'eth_sign'; -}; + return { + callback, + parameters + }; + } -/** - * Checks if the JSON-RPC method is sendTransaction - * - * @method isSendTransaction - * - * @returns {Boolean} - */ -AbstractMethodModel.prototype.isSendTransaction = function () { - return this.rpcMethod === 'eth_sendTransaction'; -}; + /** + * Checks if the JSON-RPC method is sign. + * + * @method isSign + * + * @returns {Boolean} + */ + isSign() { + return this.rpcMethod === 'eth_sign'; + } -/** - * Checks if the JSON-RPC method is sendRawTransaction - * - * @method isSendRawTransaction - * - * @returns {Boolean} - */ -AbstractMethodModel.prototype.isSendRawTransaction = function () { - return this.rpcMethod === 'eth_sendRawTransaction'; -}; + /** + * Checks if the JSON-RPC method is sendTransaction + * + * @method isSendTransaction + * + * @returns {Boolean} + */ + isSendTransaction() { + return this.rpcMethod === 'eth_sendTransaction'; + } -/** - * Checks if the given parameter is of type hash - * - * @method isHash - * - * @param {*} parameter - * - * @returns {Boolean} - */ -AbstractMethodModel.prototype.isHash = function (parameter) { - return _.isString(parameter) && parameter.indexOf('0x') === 0; -}; + /** + * Checks if the JSON-RPC method is sendRawTransaction + * + * @method isSendRawTransaction + * + * @returns {Boolean} + */ + isSendRawTransaction() { + return this.rpcMethod === 'eth_sendRawTransaction'; + } -module.exports = AbstractMethodModel; + /** + * Checks if the given parameter is of type hash + * + * @method isHash + * + * @param {*} parameter + * + * @returns {Boolean} + */ + isHash(parameter) { + return _.isString(parameter) && parameter.indexOf('0x') === 0; + } +} diff --git a/packages/web3-core-method/lib/signers/AbstractSigner.js b/packages/web3-core-method/lib/signers/AbstractSigner.js index ed1182cc3f9..dba26dcefb2 100644 --- a/packages/web3-core-method/lib/signers/AbstractSigner.js +++ b/packages/web3-core-method/lib/signers/AbstractSigner.js @@ -22,39 +22,35 @@ "use strict"; -var _ = require('underscore'); - -/** - * @constructor - */ -function AbstractSigner() { } - -/** - * Get wallet for address with accounts package - * - * @param {*} from - * @param {Accounts} accounts - * - * @returns {*} - */ -AbstractSigner.prototype.getWallet = function (from, accounts) { - // is index given - if (_.isNumber(from)) { - return accounts.wallet[from]; - +import _ from 'underscore'; + +export default class AbstractSigner { + + /** + * Get wallet for address with accounts package + * + * @param {*} from + * @param {Accounts} accounts + * + * @returns {*} + */ + getWallet(from, accounts) { + // is index given + if (_.isNumber(from)) { + return accounts.wallet[from]; + + } + + // is account given + if (_.isObject(from) && from.address && from.privateKey) { + return from; + } + + const searchedWalletForAddress = accounts.wallet[from.toLowerCase()]; + if (searchedWalletForAddress) { + return searchedWalletForAddress; + } + + return null; } - - // is account given - if (_.isObject(from) && from.address && from.privateKey) { - return from; - } - - var searchedWalletForAddress = accounts.wallet[from.toLowerCase()]; - if (searchedWalletForAddress) { - return searchedWalletForAddress; - } - - return null; -}; - -module.exports = AbstractSigner; +} diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index c4efba32067..afc3b0fb524 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -48,8 +48,6 @@ export default class SendMethodCommand extends AbstractSendMethodCommand { * @returns {PromiEvent} */ execute(moduleInstance, methodModel, promiEvent) { - const self = this; - methodModel.beforeExecution(moduleInstance); if (this.isGasPriceDefined(methodModel.parameters)) { @@ -63,20 +61,18 @@ export default class SendMethodCommand extends AbstractSendMethodCommand { methodModel.parameters[0].gasPrice = gasPrice; } - self.send(methodModel, promiEvent, moduleInstance); + this.send(methodModel, promiEvent, moduleInstance); }); return promiEvent; } send(methodModel, promiEvent, moduleInstance) { - const self = this; - moduleInstance.currentProvider.send( methodModel.rpcMethod, methodModel.parameters ).then(response => { - self.transactionConfirmationWorkflow.execute( + this.transactionConfirmationWorkflow.execute( methodModel, moduleInstance, response, diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index a520e3a37fc..98263f565c8 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -51,14 +51,12 @@ export default class SignAndSendMethodCommand extends SendMethodCommand { * @returns {PromiEvent} */ execute(moduleInstance, methodModel, promiEvent, accounts) { - const self = this; - methodModel.beforeExecution(moduleInstance); methodModel.rpcMethod = 'eth_sendRawTransaction'; this.transactionSigner.sign(methodModel.parameters[0], accounts).then(response => { methodModel.parameters = [response.rawTransaction]; - self.send(methodModel, promiEvent, moduleInstance); + this.send(methodModel, promiEvent, moduleInstance); }).catch(error => { promiEvent.reject(error); promiEvent.emit('error', error); diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index c3799325d6d..0267e08ce15 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -57,10 +57,8 @@ export default class GetPastLogsMethodModel extends AbstractMethodModel { * @returns {Array} */ afterExecution(response) { - const self = this; - return response.map(responseItem => { - return self.formatters.outputLogFormatter(responseItem); + return this.formatters.outputLogFormatter(responseItem); }); } } diff --git a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js index 58e1ed395c7..55498abc4d7 100644 --- a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js @@ -46,10 +46,8 @@ export default class GetAccountsMethodModel extends AbstractMethodModel { * @returns {Array} */ afterExecution(response) { - const self = this; - return response.map(responseItem => { - return self.utils.toChecksumAddress(responseItem); + return this.utils.toChecksumAddress(responseItem); }); } } diff --git a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js index 07842b89bfb..309eee64cfb 100644 --- a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js @@ -46,10 +46,8 @@ export default class ListAccountsMethodModel extends AbstractMethodModel { * @returns {Array} */ afterExecution(response) { - const self = this; - return response.map(responseItem => { - return self.utils.toChecksumAddress(responseItem); + return this.utils.toChecksumAddress(responseItem); }); } } diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index 99841ca7663..2880604ee3a 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -37,10 +37,8 @@ export default class TransactionSigner extends AbstractSigner { * @returns {Promise} */ sign(transaction, accounts) { - const self = this; - return new Promise((resolve, reject) => { - const wallet = self.getWallet(transaction.from, accounts); + const wallet = this.getWallet(transaction.from, accounts); if (wallet && wallet.privateKey) { delete transaction.from; diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index de0e3c1e67a..8365ed1aaa5 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -48,13 +48,11 @@ export default class NewHeadsWatcher extends EventEmitter { * @returns {this} */ watch(moduleInstance) { - const self = this; - if (moduleInstance.currentProvider instanceof SocketProviderAdapter) { this.confirmationSubscription = this.subscriptionsFactory .createNewHeadsSubscription(moduleInstance) .subscribe(() => { - self.emit('newHead'); + this.emit('newHead'); }); return this; @@ -62,7 +60,7 @@ export default class NewHeadsWatcher extends EventEmitter { this.isPolling = true; this.confirmationInterval = setInterval(() => { - self.emit('newHead') + this.emit('newHead') }, 1000); return this; diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 28a0b5d1564..e41efc56f4c 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -59,38 +59,36 @@ export default class TransactionConfirmationWorkflow { * @callback callback callback(error, result) */ execute(methodModel, moduleInstance, transactionHash, promiEvent) { - const self = this; - this.getTransactionReceipt(moduleInstance, transactionHash).then(receipt => { if (receipt && receipt.blockHash) { - const validationResult = self.transactionReceiptValidator.validate(receipt); + const validationResult = this.transactionReceiptValidator.validate(receipt); if (validationResult === true) { - self.handleSuccessState(receipt, methodModel, promiEvent); + this.handleSuccessState(receipt, methodModel, promiEvent); return; } - self.handleErrorState(validationResult, methodModel, promiEvent); + this.handleErrorState(validationResult, methodModel, promiEvent); return; } - self.newHeadsWatcher.watch(moduleInstance).on('newHead', () => { - self.transactionConfirmationModel.timeoutCounter++; - if (!self.transactionConfirmationModel.isTimeoutTimeExceeded()) { - self.getTransactionReceipt(transactionHash).then(receipt => { - const validationResult = self.transactionReceiptValidator.validate(receipt, methodModel.parameters); + this.newHeadsWatcher.watch(moduleInstance).on('newHead', () => { + this.transactionConfirmationModel.timeoutCounter++; + if (!this.transactionConfirmationModel.isTimeoutTimeExceeded()) { + this.getTransactionReceipt(transactionHash).then(receipt => { + const validationResult = this.transactionReceiptValidator.validate(receipt, methodModel.parameters); if (validationResult === true) { - self.transactionConfirmationModel.addConfirmation(receipt); + this.transactionConfirmationModel.addConfirmation(receipt); promiEvent.emit( 'confirmation', - self.transactionConfirmationModel.confirmationsCount, + this.transactionConfirmationModel.confirmationsCount, receipt ); - if (self.transactionConfirmationModel.isConfirmed()) { - self.handleSuccessState(receipt, methodModel, promiEvent); + if (this.transactionConfirmationModel.isConfirmed()) { + this.handleSuccessState(receipt, methodModel, promiEvent); } return; @@ -108,13 +106,13 @@ export default class TransactionConfirmationWorkflow { return; } - let error = new Error(`Transaction was not mined within ${self.transactionConfirmationModel.TIMEOUTBLOCK} blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!`); + let error = new Error(`Transaction was not mined within ${this.transactionConfirmationModel.TIMEOUTBLOCK} blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!`); - if (self.newHeadsWatcher.isPolling) { - error = new Error(`Transaction was not mined within${self.transactionConfirmationModel.POLLINGTIMEOUT} seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!`) + if (this.newHeadsWatcher.isPolling) { + error = new Error(`Transaction was not mined within${this.transactionConfirmationModel.POLLINGTIMEOUT} seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!`) } - self.handleErrorState(error, methodModel, promiEvent); + this.handleErrorState(error, methodModel, promiEvent); }); }); } @@ -130,11 +128,11 @@ export default class TransactionConfirmationWorkflow { * @returns {Promise} */ getTransactionReceipt(moduleInstance, transactionHash) { - const self = this; - - return moduleInstance.currentProvider.send('eth_getTransactionReceipt', [transactionHash]).then(receipt => { - return self.formatters.outputTransactionReceiptFormatter(receipt); - }); + return moduleInstance.currentProvider + .send('eth_getTransactionReceipt', [transactionHash]) + .then(receipt => { + return this.formatters.outputTransactionReceiptFormatter(receipt); + }); } /** From 96dbe9caee87f55dbda48d92f5121129b068d678 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 16:19:42 +0200 Subject: [PATCH 0270/1045] web3-core-promievent ported to es6 --- .../web3-core-promievent/src/PromiEvent.js | 75 +++++++++---------- packages/web3-core-promievent/src/index.js | 10 +-- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/packages/web3-core-promievent/src/PromiEvent.js b/packages/web3-core-promievent/src/PromiEvent.js index 1a6d4523176..79eed5a2ac6 100644 --- a/packages/web3-core-promievent/src/PromiEvent.js +++ b/packages/web3-core-promievent/src/PromiEvent.js @@ -22,50 +22,49 @@ "use strict"; -var EventEmitter = require('eventemitter3'); +import EventEmitter from 'eventemitter3'; -/** - * @constructor - */ -function PromiEvent() { - var self = this; +export default class PromiEvent { - this.promise = new Promise(function(resolve, reject) { - self.resolve = resolve; - self.reject = reject; - }); + /** + * @constructor + */ + constructor() { + this.promise = new Promise((resolve, reject) => { + this.resolve = resolve; + this.reject = reject; + }); - this.eventEmitter = new EventEmitter(); + this.eventEmitter = new EventEmitter(); - return new Proxy(this, { - get: this.proxyHandler - }); -} - -/** - * Proxy handler to call the promise or eventEmitter methods - * - * @method proxyHandler - * - * @param {PromiEvent} target - * @param {String} name - * - * @returns {Function} - */ -PromiEvent.prototype.proxyHandler = function (target, name) { - if (name === 'resolve' || name === 'reject') { - return target[name]; + return new Proxy(this, { + get: this.proxyHandler + }); } - if (this.promise[name]) { - return target.promise[name]; - } + /** + * Proxy handler to call the promise or eventEmitter methods + * + * @method proxyHandler + * + * @param {PromiEvent} target + * @param {String} name + * + * @returns {Function} + */ + proxyHandler(target, name) { + if (name === 'resolve' || name === 'reject') { + return target[name]; + } - if (this.eventEmitter[name]) { - return target.eventEmitter[name]; - } + if (this.promise[name]) { + return target.promise[name]; + } - throw Error('Method with name ' + name + ' not found'); -}; + if (this.eventEmitter[name]) { + return target.eventEmitter[name]; + } -module.exports = PromiEvent; + throw Error(`Method with name ${name} not found`); + } +} diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index d1cff600f4d..766c8ffb7cd 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -22,11 +22,11 @@ "use strict"; -var version = require('../package.json').version; -var PromiEvent = require('./PromiEvent'); +import {version} from '../package.json'; +import PromiEvent from './PromiEvent'; -module.exports = { - version: version, +export default { + version, - PromiEvent: PromiEvent + PromiEvent }; From 4fa9b4d760e8d96859438f6e6c310054529ffbb6 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 16:26:13 +0200 Subject: [PATCH 0271/1045] web3-core-subscriptions ported to es6 --- .../lib/models/AbstractSubscriptionModel.js | 81 ++--- .../src/Subscription.js | 278 +++++++++--------- .../src/factories/SubscriptionsFactory.js | 210 +++++++------ packages/web3-core-subscriptions/src/index.js | 22 +- .../subscriptions/eth/LogSubscriptionModel.js | 120 ++++---- .../eth/NewHeadsSubscriptionModel.js | 56 ++-- ...NewPendingTransactionsSubscriptionModel.js | 35 +-- .../eth/SyncingSubscriptionModel.js | 79 +++-- .../shh/MessagesSubscriptionModel.js | 31 +- 9 files changed, 442 insertions(+), 470 deletions(-) diff --git a/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js index 944a96f2342..636582c0835 100644 --- a/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js +++ b/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js @@ -22,46 +22,47 @@ "use strict"; -/** - * @param {String} subscriptionType - * @param {String} subscriptionMethod - * @param {Object} options - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function AbstractSubscriptionModel(subscriptionType, subscriptionMethod, options, utils, formatters) { - this.subscriptionType = subscriptionType; - this.subscriptionMethod = subscriptionMethod; - this.options = options; - this.util = utils; - this.formatters = formatters; -} +export default class AbstractSubscriptionModel { -/** - * This method will be executed before the subscription starts. - * - * @method beforeSubscription - * - * @param {Subscription} subscription - * @param {AbstractWeb3Module} moduleInstance - * @param {Function} callback - */ -AbstractSubscriptionModel.prototype.beforeSubscription = function (subscription, moduleInstance, callback) { }; + /** + * @param {String} subscriptionType + * @param {String} subscriptionMethod + * @param {Object} options + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(subscriptionType, subscriptionMethod, options, utils, formatters) { + this.subscriptionType = subscriptionType; + this.subscriptionMethod = subscriptionMethod; + this.options = options; + this.util = utils; + this.formatters = formatters; + } -/** - * This method will be executed on each new subscription item. - * - * @method onNewSubscriptionItem - * - * @param {Subscription} subscription - * @param {*} subscriptionItem - * - * @returns {*} - */ -AbstractSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { - return this.formatters.outputLogFormatter(subscriptionItem); -}; + /** + * This method will be executed before the subscription starts. + * + * @method beforeSubscription + * + * @param {Subscription} subscription + * @param {AbstractWeb3Module} moduleInstance + * @param {Function} callback + */ + beforeSubscription(subscription, moduleInstance, callback) { } -module.exports = AbstractSubscriptionModel; + /** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {*} + */ + onNewSubscriptionItem(subscription, subscriptionItem) { + return this.formatters.outputLogFormatter(subscriptionItem); + } +} diff --git a/packages/web3-core-subscriptions/src/Subscription.js b/packages/web3-core-subscriptions/src/Subscription.js index f1f14e9a1fa..38553cd67c2 100644 --- a/packages/web3-core-subscriptions/src/Subscription.js +++ b/packages/web3-core-subscriptions/src/Subscription.js @@ -22,162 +22,156 @@ "use strict"; -var _ = require('underscore'); -var EventEmitter = require('eventemitter3'); - -/** - * @param {AbstractSubscriptionModel} subscriptionModel - * @param {AbstractWeb3Module} moduleInstance - * - * @constructor - */ -function Subscription(subscriptionModel, moduleInstance) { - this.subscriptionModel = subscriptionModel; - this.moduleInstance = moduleInstance; - this.subscriptionId = null; -} - -Subscription.prototype = Object.create(EventEmitter.prototype); -Subscription.prototype.constructor = Subscription; - -/** - * Sends the JSON-RPC request, emits the required events and executes the callback method. - * - * @method subscribe - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Subscription} Subscription - */ -Subscription.prototype.subscribe = function (callback) { - var self = this; +import _ from 'underscore'; +import EventEmitter from 'eventemitter3'; + +export default class Subscription extends EventEmitter { + + /** + * @param {AbstractSubscriptionModel} subscriptionModel + * @param {AbstractWeb3Module} moduleInstance + * + * @constructor + */ + constructor(subscriptionModel, moduleInstance) { + super(); + this.subscriptionModel = subscriptionModel; + this.moduleInstance = moduleInstance; + this.subscriptionId = null; + } - this.subscriptionModel.beforeSubscription(this, this.moduleInstance, callback); + /** + * Sends the JSON-RPC request, emits the required events and executes the callback method. + * + * @method subscribe + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Subscription} Subscription + */ + subscribe(callback) { + this.subscriptionModel.beforeSubscription(this, this.moduleInstance, callback); + + this.moduleInstance.currentProvider.subscribe( + this.subscriptionModel.subscriptionType, + this.subscriptionModel.subscriptionMethod, + [this.subscriptionModel.options] + ).then(subscriptionId => { + this.subscriptionId = subscriptionId; + + this.moduleInstance.currentProvider.on(this.subscriptionId, (error, response) => { + if (!error) { + this.handleSubscriptionResponse(response, callback); + + return; + } + + if (self.moduleInstance.currentProvider.once) { + this.reconnect(callback); + } + + if (_.isFunction(callback)) { + callback(error, null); + } + + this.emit('error', error); + }); + }); - this.moduleInstance.currentProvider.subscribe( - this.subscriptionModel.subscriptionType, - this.subscriptionModel.subscriptionMethod, - [this.subscriptionModel.options] - ).then(function (subscriptionId) { - self.subscriptionId = subscriptionId; + return this; + } - self.moduleInstance.currentProvider.on(self.subscriptionId, function (error, response) { - if (!error) { - self.handleSubscriptionResponse(response, callback); + /** + * Iterates over each item in the response, formats the output, emits required events and executes the callback method. + * + * @method handleSubscriptionResponse + * + * @param {*} response + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + handleSubscriptionResponse(response, callback) { + if (!_.isArray(response)) { + response = [response]; + } - return; - } + response.forEach(function (item) { + const formattedOutput = this.subscriptionModel.onNewSubscriptionItem(this, item); - if (self.moduleInstance.currentProvider.once) { - self.reconnect(callback); - } + this.emit('data', formattedOutput); if (_.isFunction(callback)) { - callback(error, null); + callback(false, formattedOutput); } - - self.emit('error', error); }); - }); - - return this; -}; - -/** - * Iterates over each item in the response, formats the output, emits required events and executes the callback method. - * - * @method handleSubscriptionResponse - * - * @param {*} response - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -Subscription.prototype.handleSubscriptionResponse = function (response, callback) { - if (!_.isArray(response)) { - response = [response]; } - response.forEach(function (item) { - var formattedOutput = this.subscriptionModel.onNewSubscriptionItem(this, item); - - this.emit('data', formattedOutput); - - if (_.isFunction(callback)) { - callback(false, formattedOutput); - } - }); -}; - -/** - * TODO: The reconnecting handling should only be in the provider the subscription should not care about it. - * Reconnects provider and restarts subscription - * - * @method reconnect - * - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -Subscription.prototype.reconnect = function (callback) { - var self = this; - - var interval = setInterval(function () { - if (self.moduleInstance.currentProvider.reconnect) { - self.moduleInstance.currentProvider.reconnect(); - } - }, 500); - - this.moduleInstance.currentProvider.once('connect', function () { - clearInterval(interval); - self.unsubscribe().then(function () { - self.subscribe(callback); - }).catch(function (error) { - self.emit('error', error); - - if(_.isFunction(callback)) { - callback(error, null); + /** + * TODO: The reconnecting handling should only be in the provider the subscription should not care about it. + * Reconnects provider and restarts subscription + * + * @method reconnect + * + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + reconnect(callback) { + const interval = setInterval(() => { + if (this.moduleInstance.currentProvider.reconnect) { + this.moduleInstance.currentProvider.reconnect(); } + }, 500); + + this.moduleInstance.currentProvider.once('connect', () => { + clearInterval(interval); + this.unsubscribe().then(() => { + this.subscribe(callback); + }).catch(error => { + this.emit('error', error); + + if (_.isFunction(callback)) { + callback(error, null); + } + }); }); - }); -}; + } -/** - * Unsubscribes subscription - * - * @method unsubscribe - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Subscription.prototype.unsubscribe = function (callback) { - var self = this; - return this.moduleInstance.currentProvider.unsubscribe( - this.subscriptionId, - this.subscriptionModel.subscriptionType - ).then(function (response) { - self.removeAllListeners('data'); - self.removeAllListeners('error'); - - if (!response) { - self.subscriptionId = null; - - if(_.isFunction(callback)) { - callback(true, false); + /** + * Unsubscribes subscription + * + * @method unsubscribe + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ + unsubscribe(callback) { + return this.moduleInstance.currentProvider.unsubscribe( + this.subscriptionId, + this.subscriptionModel.subscriptionType + ).then(response => { + this.removeAllListeners('data'); + this.removeAllListeners('error'); + + if (!response) { + this.subscriptionId = null; + + if (_.isFunction(callback)) { + callback(true, false); + } + + return true; } - return true; - } - - if (_.isFunction(callback)) { - callback(false, true); - } - - return false; - }); -}; + if (_.isFunction(callback)) { + callback(false, true); + } -module.exports = Subscription; + return false; + }); + } +} diff --git a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js index ef5a1ffa0af..77ba6ab14a4 100644 --- a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js +++ b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js @@ -22,117 +22,113 @@ "use strict"; -var Subscription = require('../Subscription'); -var LogSubscriptionModel = require('../models/subscriptions/eth/LogSubscriptionModel'); -var NewHeadsSubscriptionModel = require('../models/subscriptions/eth/NewHeadsSubscriptionModel'); -var NewPendingTransactionsSubscriptionModel = require('../models/subscriptions/eth/NewPendingTransactionsSubscriptionModel'); -var SyncingSubscriptionModel = require('../models/subscriptions/eth/SyncingSubscriptionModel'); -var MessagesSubscriptionModel = require('../models/subscriptions/shh/MessagesSubscriptionModel'); +import Subscription from '../Subscription'; +import LogSubscriptionModel from '../models/subscriptions/eth/LogSubscriptionModel'; +import NewHeadsSubscriptionModel from '../models/subscriptions/eth/NewHeadsSubscriptionModel'; +import NewPendingTransactionsSubscriptionModel from '../models/subscriptions/eth/NewPendingTransactionsSubscriptionModel'; +import SyncingSubscriptionModel from '../models/subscriptions/eth/SyncingSubscriptionModel'; +import MessagesSubscriptionModel from '../models/subscriptions/shh/MessagesSubscriptionModel'; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function SubscriptionsFactory(utils, formatters) { - this.utils = utils; - this.formatters = formatters; -} +export default class SubscriptionsFactory { -/** - * Returns an eth log subscription - * - * @method createLogSubscription - * - * @param {AbstractWeb3Module} moduleInstance - * @param {Object} options - * @param {GetPastLogsMethodModel} getPastLogsMethodModel - * @param {MethodController} methodController - * - * @returns {Subscription} - */ -SubscriptionsFactory.prototype.createLogSubscription = function ( - moduleInstance, - options, - getPastLogsMethodModel, - methodController -) { - return new Subscription( - new LogSubscriptionModel( - options, - this.utils, - this.formatters, - getPastLogsMethodModel, - methodController - ), - moduleInstance - ); -}; + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + this.utils = utils; + this.formatters = formatters; + } -/** - * Returns an eth newHeads subscription - * - * @method createNewHeadsSubscription - * - * @param {AbstractWeb3Module} moduleInstance - * - * @returns {Subscription} - */ -SubscriptionsFactory.prototype.createNewHeadsSubscription = function (moduleInstance) { - return new Subscription( - new NewHeadsSubscriptionModel(this.utils, this.formatters), - moduleInstance - ); -}; + /** + * Returns an eth log subscription + * + * @method createLogSubscription + * + * @param {AbstractWeb3Module} moduleInstance + * @param {Object} options + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * + * @returns {Subscription} + */ + createLogSubscription(moduleInstance, options, getPastLogsMethodModel, methodController) { + return new Subscription( + new LogSubscriptionModel( + options, + this.utils, + this.formatters, + getPastLogsMethodModel, + methodController + ), + moduleInstance + ); + } -/** - * Returns an eth newPendingTransactions subscription - * - * @method createNewPendingTransactionsSubscription - * - * @param {AbstractWeb3Module} moduleInstance - * - * @returns {Subscription} - */ -SubscriptionsFactory.prototype.createNewPendingTransactionsSubscription = function (moduleInstance) { - return new Subscription( - new NewPendingTransactionsSubscriptionModel(this.utils, this.formatters), - moduleInstance - ); -}; + /** + * Returns an eth newHeads subscription + * + * @method createNewHeadsSubscription + * + * @param {AbstractWeb3Module} moduleInstance + * + * @returns {Subscription} + */ + createNewHeadsSubscription(moduleInstance) { + return new Subscription( + new NewHeadsSubscriptionModel(this.utils, this.formatters), + moduleInstance + ); + } -/** - * Returns an eth syncing subscription - * - * @method createSyncingSubscriptionModel - * - * @param {AbstractWeb3Module} moduleInstance - * - * @returns {Subscription} - */ -SubscriptionsFactory.prototype.createSyncingSubscriptionModel = function (moduleInstance) { - return new Subscription( - new SyncingSubscriptionModel(this.utils, this.formatters), - moduleInstance - ); -}; + /** + * Returns an eth newPendingTransactions subscription + * + * @method createNewPendingTransactionsSubscription + * + * @param {AbstractWeb3Module} moduleInstance + * + * @returns {Subscription} + */ + createNewPendingTransactionsSubscription(moduleInstance) { + return new Subscription( + new NewPendingTransactionsSubscriptionModel(this.utils, this.formatters), + moduleInstance + ); + } -/** - * Returns an shh messages subscription - * - * @method createShhMessagesSubscription - * - * @param {AbstractWeb3Module} moduleInstance - * @param {Object} options - * - * @returns {Subscription} - */ -SubscriptionsFactory.prototype.createShhMessagesSubscription = function (moduleInstance, options) { - return new Subscription( - new MessagesSubscriptionModel(options, this.utils, this.formatters), - moduleInstance - ); -}; + /** + * Returns an eth syncing subscription + * + * @method createSyncingSubscriptionModel + * + * @param {AbstractWeb3Module} moduleInstance + * + * @returns {Subscription} + */ + createSyncingSubscriptionModel(moduleInstance) { + return new Subscription( + new SyncingSubscriptionModel(this.utils, this.formatters), + moduleInstance + ); + } -module.exports = SubscriptionsFactory; + /** + * Returns an shh messages subscription + * + * @method createShhMessagesSubscription + * + * @param {AbstractWeb3Module} moduleInstance + * @param {Object} options + * + * @returns {Subscription} + */ + createShhMessagesSubscription(moduleInstance, options) { + return new Subscription( + new MessagesSubscriptionModel(options, this.utils, this.formatters), + moduleInstance + ); + } +} diff --git a/packages/web3-core-subscriptions/src/index.js b/packages/web3-core-subscriptions/src/index.js index 5b215ad0434..65d5d73bf62 100644 --- a/packages/web3-core-subscriptions/src/index.js +++ b/packages/web3-core-subscriptions/src/index.js @@ -22,18 +22,18 @@ "use strict"; -var version = require('../package.json').version; -var SubscriptionsFactory = require('./factories/SubscriptionsFactory'); -var LogSubscriptionModel = require('./models/subscriptions/eth/LogSubscriptionModel'); -var Subscription = require('./Subscription'); -var Utils = require('web3-utils'); -var formatters = require('web3-core-helpers').formatters; +import {version} from '../package.json'; +import SubscriptionsFactory from './factories/SubscriptionsFactory'; +import LogSubscriptionModel from './models/subscriptions/eth/LogSubscriptionModel'; +import Subscription from './Subscription'; +import Utils from 'web3-utils'; +import {formatters} from 'web3-core-helpers'; -module.exports = { - version: version, +export default { + version, - Subscription: Subscription, - LogSubscriptionModel: LogSubscriptionModel, + Subscription, + LogSubscriptionModel, /** * Returns an object of type SubscriptionsFactory @@ -42,7 +42,7 @@ module.exports = { * * @returns {SubscriptionsFactory} */ - SubscriptionsFactory: function () { + SubscriptionsFactory() { return new SubscriptionsFactory(Utils, formatters); } }; diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js index 35eef5a244f..33f74161f68 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -22,70 +22,68 @@ "use strict"; -var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); +import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; -/** - * @param {Object} options - * @param {Object} utils - * @param {Object} formatters - * @param {GetPastLogsMethodModel} getPastLogsMethodModel - * @param {MethodController} methodController - * - * @constructor - */ -function LogSubscriptionModel(options, utils, formatters, getPastLogsMethodModel, methodController) { - AbstractSubscriptionModel.call(this, 'eth_subscribe', 'logs', options, utils, formatters); - this.getPastLogsMethodModel = getPastLogsMethodModel; - this.methodController = methodController; -} +export default class LogSubscriptionModel extends AbstractSubscriptionModel { -LogSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); -LogSubscriptionModel.prototype.constructor = LogSubscriptionModel; + /** + * @param {Object} options + * @param {Object} utils + * @param {Object} formatters + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * + * @constructor + */ + constructor(options, utils, formatters, getPastLogsMethodModel, methodController) { + super('eth_subscribe', 'logs', options, utils, formatters); + this.getPastLogsMethodModel = getPastLogsMethodModel; + this.methodController = methodController; + } -/** - * This method will be executed before the subscription starts. - * - * @method beforeSubscription - * - * @param {Subscription} subscription - * @param {AbstractWeb3Module} moduleInstance - * @param {Function} callback - */ -LogSubscriptionModel.prototype.beforeSubscription = function (subscription, moduleInstance, callback) { - var self = this; - this.options = this.formatters.inputLogFormatter(this.options); - this.getPastLogsMethodModel.parameters = [options]; + /** + * This method will be executed before the subscription starts. + * + * @method beforeSubscription + * + * @param {Subscription} subscription + * @param {AbstractWeb3Module} moduleInstance + * @param {Function} callback + */ + beforeSubscription(subscription, moduleInstance, callback) { + const self = this; + this.options = this.formatters.inputLogFormatter(this.options); + this.getPastLogsMethodModel.parameters = [options]; - this.methodController.execute( - this.getPastLogsMethodModel, - moduleInstance.currentProvider, - null, - moduleInstance - ).then(function (logs) { - logs.forEach(function (log) { - callback(false, log); - subscription.emit('data', log); - }); + this.methodController.execute( + this.getPastLogsMethodModel, + moduleInstance.currentProvider, + null, + moduleInstance + ).then(logs => { + logs.forEach(log => { + callback(false, log); + subscription.emit('data', log); + }); - delete self.options.fromBlock; - }).catch(function (error) { - subscription.emit('error', error); - callback(error, null); - }); -}; - -/** - * This method will be executed on each new subscription item. - * - * @method onNewSubscriptionItem - * - * @param {Subscription} subscription - * @param {*} subscriptionItem - * - * @returns {Object} - */ -LogSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { - return this.formatters.outputLogFormatter(subscriptionItem); -}; + delete self.options.fromBlock; + }).catch(error => { + subscription.emit('error', error); + callback(error, null); + }); + } -module.exports = LogSubscriptionModel; + /** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {Object} + */ + onNewSubscriptionItem(subscription, subscriptionItem) { + return this.formatters.outputLogFormatter(subscriptionItem); + } +} diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js index 74e9b8a3962..e1a17b11cca 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js @@ -22,33 +22,31 @@ "use strict"; -var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function NewHeadsSubscriptionModel(utils, formatters) { - NewHeadsSubscriptionModel.call(this, 'eth_subscribe', 'newHeads', null, utils, formatters); +import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; + +export default class NewHeadsSubscriptionModel extends AbstractSubscriptionModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_subscribe', 'newHeads', null, utils, formatters); + } + + /** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {Object} + */ + onNewSubscriptionItem(subscription, subscriptionItem) { + return this.formatters.outputBlockFormatter(subscriptionItem); + } } - -NewHeadsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); -NewHeadsSubscriptionModel.prototype.constructor = NewHeadsSubscriptionModel; - -/** - * This method will be executed on each new subscription item. - * - * @method onNewSubscriptionItem - * - * @param {Subscription} subscription - * @param {*} subscriptionItem - * - * @returns {Object} - */ -NewHeadsSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { - return this.formatters.outputBlockFormatter(subscriptionItem); -}; - -module.expors = NewHeadsSubscriptionModel; diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js index 4490ea35348..a582dbb547a 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js @@ -22,26 +22,17 @@ "use strict"; -var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function NewPendingTransactionsSubscriptionModel(utils, formatters) { - NewPendingTransactionsSubscriptionModel.call( - this, - 'eth_subscribe', - 'newPendingTransactions', - null, - utils, - formatters - ); +import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; + +export default class NewPendingTransactionsSubscriptionModel extends AbstractSubscriptionModel { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_subscribe', 'newPendingTransactions', null, utils, formatters); + } } - -NewPendingTransactionsSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); -NewPendingTransactionsSubscriptionModel.prototype.constructor = NewPendingTransactionsSubscriptionModel; - -module.exports = NewPendingTransactionsSubscriptionModel; diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js index 8974cc77a41..e5f7c6c2f84 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -22,52 +22,49 @@ "use strict"; -var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); +import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function SyncingSubscriptionModel(utils, formatters) { - AbstractSubscriptionModel.call(this, 'eth_subscribe', 'syncing', null, utils, formatters); - this.isSyncing = null; -} +export default class SyncingSubscriptionModel extends AbstractSubscriptionModel { -SyncingSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel.prototype); -SyncingSubscriptionModel.prototype.constructor = SyncingSubscriptionModel; - -/** - * This method will be executed on each new subscription item. - * - * @method onNewSubscriptionItem - * - * @param {Subscription} subscription - * @param {*} subscriptionItem - * - * @returns {Object} - */ -SyncingSubscriptionModel.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { - var isSyncing = subscriptionItem.result.syncing; - - if (this.isSyncing === null) { - this.isSyncing = isSyncing; - subscription.emit('changed', this.isSyncing); + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super('eth_subscribe', 'syncing', null, utils, formatters); + this.isSyncing = null; } - if (this.isSyncing === true && isSyncing === false) { - this.isSyncing = isSyncing; - subscription.emit('changed', this.isSyncing); - } + /** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {Object} + */ + onNewSubscriptionItem(subscription, subscriptionItem) { + const isSyncing = subscriptionItem.result.syncing; - if (this.isSyncing === false && isSyncing === true) { - this.isSyncing = isSyncing; - subscription.emit('changed', this.isSyncing); - } + if (this.isSyncing === null) { + this.isSyncing = isSyncing; + subscription.emit('changed', this.isSyncing); + } - return this.formatters.outputSyncingFormatter(subscriptionItem); -}; + if (this.isSyncing === true && isSyncing === false) { + this.isSyncing = isSyncing; + subscription.emit('changed', this.isSyncing); + } + if (this.isSyncing === false && isSyncing === true) { + this.isSyncing = isSyncing; + subscription.emit('changed', this.isSyncing); + } -module.exports = SyncingSubscriptionModel; + return this.formatters.outputSyncingFormatter(subscriptionItem); + } +} diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js index 1788d02705f..356e74dd666 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js @@ -22,21 +22,18 @@ "use strict"; -var AbstractSubscriptionModel = require('../../../../lib/models/AbstractSubscriptionModel'); - -/** - * @param {Object} options - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function MessagesSubscriptionModel(options, utils, formatters) { - AbstractSubscriptionModel.call(this, 'shh_subscribe', 'messages', options, utils, formatters); +import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; + +export default class MessagesSubscriptionModel extends AbstractSubscriptionModel { + + /** + * @param {Object} options + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(options, utils, formatters) { + super('shh_subscribe', 'messages', options, utils, formatters); + } } - -MessagesSubscriptionModel.prototype = Object.create(AbstractSubscriptionModel); -MessagesSubscriptionModel.prototype.constructor = MessagesSubscriptionModel; - -module.exports = MessagesSubscriptionModel; - From e8c3dd9f5c69086afdbe988a48b936a5f1860b17 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 16:33:06 +0200 Subject: [PATCH 0272/1045] web3-eth ported to es6 --- packages/web3-core-method/src/index.js | 159 ++++----- packages/web3-core-promievent/src/index.js | 1 - packages/web3-core-subscriptions/src/index.js | 3 +- packages/web3-eth/src/Eth.js | 330 +++++++++--------- .../src/factories/MethodModelFactory.js | 61 ++-- packages/web3-eth/src/index.js | 38 +- 6 files changed, 286 insertions(+), 306 deletions(-) diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index ba557cdbd47..3fde468a78a 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -29,85 +29,86 @@ import AbstractMethodModelFactory from '../lib/factories/AbstractMethodModelFact import PromiEventPackage from 'web3-core-promievent'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {formatters} from 'web3-core-helpers'; + // Methods -// Network -import GetProtocolVersionMethodModel from './models/methods/network/GetProtocolVersionMethodModel'; - -import VersionMethodModel from './models/methods/network/VersionMethodModel'; -import ListeningMethodModel from './models/methods/network/ListeningMethodModel'; -import PeerCountMethodModel from './models/methods/network/PeerCountMethodModel'; -// Node -import GetNodeInfoMethodModel from './models/methods/node/GetNodeInfoMethodModel'; - -import GetCoinbaseMethodModel from './models/methods/node/GetCoinbaseMethodModel'; -import IsMiningMethodModel from './models/methods/node/IsMiningMethodModel'; -import GetHashrateMethodModel from './models/methods/node/GetHashrateMethodModel'; -import IsSyncingMethodModel from './models/methods/node/IsSyncingMethodModel'; -import GetGasPriceMethodModel from './models/methods/node/GetGasPriceMethodModel'; -import SubmitWorkMethodModel from './models/methods/node/SubmitWorkMethodModel'; -import GetWorkMethodModel from './models/methods/node/GetWorkMethodModel'; -// Account -import GetAccountsMethodModel from './models/methods/account/GetAccountsMethodModel'; - -import GetBalanceMethodModel from './models/methods/account/GetBalanceMethodModel'; -import GetTransactionCountMethodModel from './models/methods/account/GetTransactionCountMethodModel'; -// Block -import GetBlockNumberMethodModel from './models/methods/block/GetBlockNumberMethodModel'; - -import GetBlockMethodModel from './models/methods/block/GetBlockMethodModel'; -import GetUncleMethodModel from './models/methods/block/GetUncleMethodModel'; -import GetBlockTransactionCountMethodModel from './models/methods/block/GetBlockTransactionCountMethodModel'; -import GetBlockUncleCountMethodModel from './models/methods/block/GetBlockUncleCountMethodModel'; -// Transaction -import GetTransactionMethodModel from './models/methods/transaction/GetTransactionMethodModel'; - -import GetTransactionFromBlockMethodModel from './models/methods/transaction/GetTransactionFromBlockMethodModel'; -import GetTransactionReceipt from './models/methods/transaction/GetTransactionReceiptMethodModel'; -import SendSignedTransactionMethodModel from './models/methods/transaction/SendSignedTransactionMethodModel'; -import SignTransactionMethodModel from './models/methods/transaction/SignTransactionMethodModel'; -import SendTransactionMethodModel from './models/methods/transaction/SendTransactionMethodModel'; -// Global -import GetCodeMethodModel from './models/methods/GetCodeMethodModel'; - -import SignMethodModel from './models/methods/SignMethodModel'; -import CallMethodModel from './models/methods/CallMethodModel'; -import GetStorageAtMethodModel from './models/methods/GetStorageAtMethodModel'; -import EstimateGasMethodModel from './models/methods/EstimateGasMethodModel'; -import GetPastLogsMethodModel from './models/methods/GetPastLogsMethodModel'; -// Personal -import EcRecoverMethodModel from './models/methods/personal/EcRecoverMethodModel'; - -import ImportRawKeyMethodModel from './models/methods/personal/ImportRawKeyMethodModel'; -import ListAccountsMethodModel from './models/methods/personal/ListAccountsMethodModel'; -import LockAccountMethodModel from './models/methods/personal/LockAccountMethodModel'; -import NewAccountMethodModel from './models/methods/personal/NewAccountMethodModel'; -import PersonalSendTransactionMethodModel from './models/methods/personal/PersonalSendTransactionMethodModel'; -import PersonalSignMethodModel from './models/methods/personal/PersonalSignMethodModel'; -import PersonalSignTransactionMethodModel from './models/methods/personal/PersonalSignTransactionMethodModel'; -import UnlockAccountMethodModel from './models/methods/personal/UnlockAccountMethodModel'; -// SHH -import AddPrivateKeyMethodModel from './models/methods/shh/AddPrivateKeyMethodModel'; - -import AddSymKeyMethodModel from './models/methods/shh/AddSymKeyMethodModel'; -import DeleteKeyPairMethodModel from './models/methods/shh/DeleteKeyPairMethodModel'; -import DeleteMessageFilterMethodModel from './models/methods/shh/DeleteMessageFilterMethodModel'; -import DeleteSymKeyMethodModel from './models/methods/shh/DeleteSymKeyMethodModel'; -import GenerateSymKeyFromPasswordMethodModel from './models/methods/shh/GenerateSymKeyFromPasswordMethodModel'; -import GetFilterMessagesMethodModel from './models/methods/shh/GetFilterMessagesMethodModel'; -import GetInfoMethodModel from './models/methods/shh/GetInfoMethodModel'; -import GetPrivateKeyMethodModel from './models/methods/shh/GetPrivateKeyMethodModel'; -import GetPublicKeyMethodModel from './models/methods/shh/GetPublicKeyMethodModel'; -import GetSymKeyMethodModel from './models/methods/shh/GetSymKeyMethodModel'; -import HasKeyPairMethodModel from './models/methods/shh/HasKeyPairMethodModel'; -import HasSymKeyMethodModel from './models/methods/shh/HasSymKeyMethodModel'; -import MarkTrustedPeerMethodModel from './models/methods/shh/MarkTrustedPeerMethodModel'; -import NewKeyPairMethodModel from './models/methods/shh/NewKeyPairMethodModel'; -import NewMessageFilterMethodModel from './models/methods/shh/NewMessageFilterMethodModel'; -import NewSymKeyMethodModel from './models/methods/shh/NewSymKeyMethodModel'; -import PostMethodModel from './models/methods/shh/PostMethodModel'; -import SetMaxMessageSizeMethodModel from './models/methods/shh/SetMaxMessageSizeMethodModel'; -import SetMinPoWMethodModel from './models/methods/shh/SetMinPoWMethodModel'; -import ShhVersionMethodModel from './models/methods/shh/ShhVersionMethodModel'; + // Network + import GetProtocolVersionMethodModel from './models/methods/network/GetProtocolVersionMethodModel'; + + import VersionMethodModel from './models/methods/network/VersionMethodModel'; + import ListeningMethodModel from './models/methods/network/ListeningMethodModel'; + import PeerCountMethodModel from './models/methods/network/PeerCountMethodModel'; + // Node + import GetNodeInfoMethodModel from './models/methods/node/GetNodeInfoMethodModel'; + + import GetCoinbaseMethodModel from './models/methods/node/GetCoinbaseMethodModel'; + import IsMiningMethodModel from './models/methods/node/IsMiningMethodModel'; + import GetHashrateMethodModel from './models/methods/node/GetHashrateMethodModel'; + import IsSyncingMethodModel from './models/methods/node/IsSyncingMethodModel'; + import GetGasPriceMethodModel from './models/methods/node/GetGasPriceMethodModel'; + import SubmitWorkMethodModel from './models/methods/node/SubmitWorkMethodModel'; + import GetWorkMethodModel from './models/methods/node/GetWorkMethodModel'; + // Account + import GetAccountsMethodModel from './models/methods/account/GetAccountsMethodModel'; + + import GetBalanceMethodModel from './models/methods/account/GetBalanceMethodModel'; + import GetTransactionCountMethodModel from './models/methods/account/GetTransactionCountMethodModel'; + // Block + import GetBlockNumberMethodModel from './models/methods/block/GetBlockNumberMethodModel'; + + import GetBlockMethodModel from './models/methods/block/GetBlockMethodModel'; + import GetUncleMethodModel from './models/methods/block/GetUncleMethodModel'; + import GetBlockTransactionCountMethodModel from './models/methods/block/GetBlockTransactionCountMethodModel'; + import GetBlockUncleCountMethodModel from './models/methods/block/GetBlockUncleCountMethodModel'; + // Transaction + import GetTransactionMethodModel from './models/methods/transaction/GetTransactionMethodModel'; + + import GetTransactionFromBlockMethodModel from './models/methods/transaction/GetTransactionFromBlockMethodModel'; + import GetTransactionReceipt from './models/methods/transaction/GetTransactionReceiptMethodModel'; + import SendSignedTransactionMethodModel from './models/methods/transaction/SendSignedTransactionMethodModel'; + import SignTransactionMethodModel from './models/methods/transaction/SignTransactionMethodModel'; + import SendTransactionMethodModel from './models/methods/transaction/SendTransactionMethodModel'; + // Global + import GetCodeMethodModel from './models/methods/GetCodeMethodModel'; + + import SignMethodModel from './models/methods/SignMethodModel'; + import CallMethodModel from './models/methods/CallMethodModel'; + import GetStorageAtMethodModel from './models/methods/GetStorageAtMethodModel'; + import EstimateGasMethodModel from './models/methods/EstimateGasMethodModel'; + import GetPastLogsMethodModel from './models/methods/GetPastLogsMethodModel'; + // Personal + import EcRecoverMethodModel from './models/methods/personal/EcRecoverMethodModel'; + + import ImportRawKeyMethodModel from './models/methods/personal/ImportRawKeyMethodModel'; + import ListAccountsMethodModel from './models/methods/personal/ListAccountsMethodModel'; + import LockAccountMethodModel from './models/methods/personal/LockAccountMethodModel'; + import NewAccountMethodModel from './models/methods/personal/NewAccountMethodModel'; + import PersonalSendTransactionMethodModel from './models/methods/personal/PersonalSendTransactionMethodModel'; + import PersonalSignMethodModel from './models/methods/personal/PersonalSignMethodModel'; + import PersonalSignTransactionMethodModel from './models/methods/personal/PersonalSignTransactionMethodModel'; + import UnlockAccountMethodModel from './models/methods/personal/UnlockAccountMethodModel'; + // SHH + import AddPrivateKeyMethodModel from './models/methods/shh/AddPrivateKeyMethodModel'; + + import AddSymKeyMethodModel from './models/methods/shh/AddSymKeyMethodModel'; + import DeleteKeyPairMethodModel from './models/methods/shh/DeleteKeyPairMethodModel'; + import DeleteMessageFilterMethodModel from './models/methods/shh/DeleteMessageFilterMethodModel'; + import DeleteSymKeyMethodModel from './models/methods/shh/DeleteSymKeyMethodModel'; + import GenerateSymKeyFromPasswordMethodModel from './models/methods/shh/GenerateSymKeyFromPasswordMethodModel'; + import GetFilterMessagesMethodModel from './models/methods/shh/GetFilterMessagesMethodModel'; + import GetInfoMethodModel from './models/methods/shh/GetInfoMethodModel'; + import GetPrivateKeyMethodModel from './models/methods/shh/GetPrivateKeyMethodModel'; + import GetPublicKeyMethodModel from './models/methods/shh/GetPublicKeyMethodModel'; + import GetSymKeyMethodModel from './models/methods/shh/GetSymKeyMethodModel'; + import HasKeyPairMethodModel from './models/methods/shh/HasKeyPairMethodModel'; + import HasSymKeyMethodModel from './models/methods/shh/HasSymKeyMethodModel'; + import MarkTrustedPeerMethodModel from './models/methods/shh/MarkTrustedPeerMethodModel'; + import NewKeyPairMethodModel from './models/methods/shh/NewKeyPairMethodModel'; + import NewMessageFilterMethodModel from './models/methods/shh/NewMessageFilterMethodModel'; + import NewSymKeyMethodModel from './models/methods/shh/NewSymKeyMethodModel'; + import PostMethodModel from './models/methods/shh/PostMethodModel'; + import SetMaxMessageSizeMethodModel from './models/methods/shh/SetMaxMessageSizeMethodModel'; + import SetMinPoWMethodModel from './models/methods/shh/SetMinPoWMethodModel'; + import ShhVersionMethodModel from './models/methods/shh/ShhVersionMethodModel'; export default { version, @@ -120,7 +121,7 @@ export default { * * @returns {MethodController} */ - MethodController() { + MethodController: () => { return new MethodPackageFactory().createMethodController( PromiEventPackage, new SubscriptionsFactory(), diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index 766c8ffb7cd..f14d61583a3 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -27,6 +27,5 @@ import PromiEvent from './PromiEvent'; export default { version, - PromiEvent }; diff --git a/packages/web3-core-subscriptions/src/index.js b/packages/web3-core-subscriptions/src/index.js index 65d5d73bf62..b1bd0b7ba66 100644 --- a/packages/web3-core-subscriptions/src/index.js +++ b/packages/web3-core-subscriptions/src/index.js @@ -31,7 +31,6 @@ import {formatters} from 'web3-core-helpers'; export default { version, - Subscription, LogSubscriptionModel, @@ -42,7 +41,7 @@ export default { * * @returns {SubscriptionsFactory} */ - SubscriptionsFactory() { + SubscriptionsFactory: () => { return new SubscriptionsFactory(Utils, formatters); } }; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 5854a84eba7..7c7c04490fe 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -22,190 +22,178 @@ "use strict"; -var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; +import {AbstractWeb3Module} from 'web3-core'; -/** - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {Network} net - * @param {ContractPackage} contractPackage - * @param {Accounts} accounts - * @param {Personal} personal - * @param {Iban} iban - * @param {Abi} abi - * @param {ENS} ens - * @param {Object} utils - * @param {Object} formatters - * @param {ProvidersPackage} providersPackage - * @param {SubscriptionsFactory} subscriptionsFactory - * @param {MethodModelFactory} methodModelFactory - * @param {MethodController} methodController - * - * @constructor - */ -var Eth = function Eth( - provider, - net, - contractPackage, - accounts, - personal, - iban, - abi, - ens, - utils, - formatters, - providersPackage, - subscriptionsFactory, - methodController, - methodModelFactory -) { - AbstractWeb3Module.call( - this, +export default class Eth extends AbstractWeb3Module { + + /** + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {Network} net + * @param {ContractPackage} contractPackage + * @param {Accounts} accounts + * @param {Personal} personal + * @param {Iban} iban + * @param {Abi} abi + * @param {ENS} ens + * @param {Object} utils + * @param {Object} formatters + * @param {ProvidersPackage} providersPackage + * @param {SubscriptionsFactory} subscriptionsFactory + * @param {MethodModelFactory} methodModelFactory + * @param {MethodController} methodController + * + * @constructor + */ + constructor( provider, + net, + contractPackage, + accounts, + personal, + iban, + abi, + ens, + utils, + formatters, providersPackage, + subscriptionsFactory, methodController, methodModelFactory - ); - - var self = this; + ) { + super(provider, providersPackage, methodController, methodModelFactory); + this.net = net; + this.accounts = accounts; + this.personal = personal; + this.Iban = Iban; + this.abi = abi; + this.ens = ens; + this.utils = utils; + this.formatters = formatters; + this.subscriptionsFactory = subscriptionsFactory; + this.initiatedContracts = []; + + /** + * This wrapper function is required for the "new web3.eth.Contract(...)" call. + * + * @param {Object} abi + * @param {String} address + * @param {Object} options + * + * @returns {Contract} + * + * @constructor + */ + this.Contract = (abi, address, options) => { + const contract = new contractPackage.Contract(this.currentProvider, this.accounts, abi, address, options); + this.initiatedContracts.push(contract); + + return contract; + }; + + let defaultAccount = null, defaultBlock = 'latest'; + + /** + * Defines accessors for defaultAccount + */ + Object.defineProperty(this, 'defaultAccount', { + get: () => { + return defaultAccount; + }, + set: (val) => { + if (val) { + this.initiatedContracts.forEach(contract => { + contract.defaultAccount = val; + }); + + this.personal.defaultAccount = val; + defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); + } + + }, + enumerable: true + }); + + /** + * Defines accessors for defaultBlock + */ + Object.defineProperty(this, 'defaultBlock', { + get: () => { + return defaultBlock; + }, + set: (val) => { + defaultBlock = val; + this.initiatedContracts.forEach(contract => { + contract.defaultAccount = val; + }); - this.net = net; - this.accounts = accounts; - this.personal = personal; - this.Iban = Iban; - this.abi = abi; - this.ens = ens; - this.utils = utils; - this.formatters = formatters; - this.subscriptionsFactory = subscriptionsFactory; - this.initiatedContracts = []; + this.personal.defaultBlock = defaultBlock; + }, + enumerable: true + }); + } /** - * This wrapper function is required for the "new web3.eth.Contract(...)" call. + * Gets and executes subscription for an given type * - * @param {Object} abi - * @param {String} address - * @param {Object} options + * @method subscribe * - * @returns {Contract} + * @param {String} type + * @param {Object} options + * @param {Function} callback * - * @constructor - */ - this.Contract = function (abi, address, options) { - var contract = new contractPackage.Contract(self.currentProvider, self.accounts, abi, address, options); - self.initiatedContracts.push(contract); - - return contract; - }; - - var defaultAccount = null, - defaultBlock = 'latest'; - - /** - * Defines accessors for defaultAccount + * @callback callback callback(error, result) + * @returns {eventifiedPromise | Subscription} */ - Object.defineProperty(this, 'defaultAccount', { - get: function () { - return defaultAccount; - }, - set: function (val) { - if (val) { - self.initiatedContracts.forEach(function (contract) { - contract.defaultAccount = val; - }); - - self.personal.defaultAccount = val; - defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); - } - - }, - enumerable: true - }); + subscribe(type, options, callback) { + switch (type) { + case 'logs': + return this.subscriptionsFactory.createLogSubscription( + this, + options, + this.methodModelFactory.createMethodModel('getPastLogs'), + this.methodController + ).subscribe(callback); + + case 'newBlockHeaders': + return this.subscriptionsFactory.createNewHeadsSubscription( + this + ).subscribe(callback); + + case 'pendingTransactions': + return this.subscriptionsFactory.createNewPendingTransactionsSubscription( + this + ).subscribe(callback); + + case 'syncing': + return this.subscriptionsFactory.createSyncingSubscriptionModel( + this + ).subscribe(callback); + + default: + throw Error(`Unknown subscription: ${type}`); + } + } /** - * Defines accessors for defaultBlock + * Extends setProvider method from AbstractWeb3Module. + * This is required for updating the provider also in the sub packages and objects related to Eth. + * + * @param {Object|String} provider + * @param {Net} net + * + * @returns {Boolean} */ - Object.defineProperty(this, 'defaultBlock', { - get: function () { - return defaultBlock; - }, - set: function (val) { - defaultBlock = val; - self.initiatedContracts.forEach(function (contract) { - contract.defaultAccount = val; - }); - - self.personal.defaultBlock = defaultBlock; - }, - enumerable: true - }); -}; - -Eth.prototype = Object.create(AbstractWeb3Module.prototype); -Eth.prototype.constructor = Eth; - -/** - * Gets and executes subscription for an given type - * - * @method subscribe - * - * @param {String} type - * @param {Object} options - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {eventifiedPromise | Subscription} - */ -Eth.prototype.subscribe = function (type, options, callback) { - switch (type) { - case 'logs': - return this.subscriptionsFactory.createLogSubscription( - this, - options, - this.methodModelFactory.createMethodModel('getPastLogs'), - this.methodController - ).subscribe(callback); - - case 'newBlockHeaders': - return this.subscriptionsFactory.createNewHeadsSubscription( - this - ).subscribe(callback); - - case 'pendingTransactions': - return this.subscriptionsFactory.createNewPendingTransactionsSubscription( - this - ).subscribe(callback); - - case 'syncing': - return this.subscriptionsFactory.createSyncingSubscriptionModel( - this - ).subscribe(callback); - - default: - throw Error('Unknown subscription: ' + type); + setProvider(provider, net) { + const setContractProviders = this.initiatedContracts.every(contract => { + return !!contract.setProvider(provider, net); + }); + + return !!( + AbstractWeb3Module.setProvider.call(this, provider, net) && + this.net.setProvider(provider, net) && + this.personal.setProvider(provider, net) && + this.accounts.setProvider(provider, net) && + setContractProviders + ); } -}; - -/** - * Extends setProvider method from AbstractWeb3Module. - * This is required for updating the provider also in the sub packages and objects related to Eth. - * - * @param {Object|String} provider - * @param {Net} net - * - * @returns {Boolean} - */ -Eth.prototype.setProvider = function (provider, net) { - var setContractProviders = this.initiatedContracts.every(function (contract) { - return !!contract.setProvider(provider, net); - }); - - return !!( - AbstractWeb3Module.setProvider.call(this, provider, net) && - this.net.setProvider(provider, net) && - this.personal.setProvider(provider, net) && - this.accounts.setProvider(provider, net) && - setContractProviders - ); -}; - -module.exports = Eth; +} diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 09e5c08dca9..deb47fef82a 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -22,21 +22,19 @@ "use strict"; -var web3CoreMethod = require('web3-core-method'); +import web3CoreMethod from 'web3-core-method'; -/** - * @param {Object} utils - * @param {Object} formatters - * @param {Accounts} accounts - * - * @constructor - */ -function MethodModelFactory(utils, formatters, accounts) { - this.accounts = accounts; +export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { - web3CoreMethod.AbstractMethodModelFactory.call( - this, - { + /** + * @param {Object} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ + constructor(utils, formatters, accounts) { + super({ getNodeInfo: web3CoreMethod.GetNodeInfoMethodModel, getProtocolVersion: web3CoreMethod.GetProtocolVersionMethodModel, getCoinbase: web3CoreMethod.GetCoinbaseMethodModel, @@ -66,26 +64,21 @@ function MethodModelFactory(utils, formatters, accounts) { submitWork: web3CoreMethod.SubmitWorkMethodModel, getWork: web3CoreMethod.GetWorkMethodModel, getPastLogs: web3CoreMethod.GetPastLogsMethodModel - }, - utils, - formatters - ); -} + }, utils, formatters); -MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); -MethodModelFactory.prototype.constructor = MethodModelFactory; + this.accounts = accounts; + } -/** - * Returns an MethodModel object - * - * @method createMethodModel - * - * @param {String} name - * - * @returns {AbstractMethodModel} - */ -MethodModelFactory.prototype.createMethodModel = function (name) { - return new this.methodModels[name](this.utils, this.formatters, this.accounts); -}; - -module.exports = MethodModelFactory; + /** + * Returns an MethodModel object + * + * @method createMethodModel + * + * @param {String} name + * + * @returns {AbstractMethodModel} + */ + createMethodModel(name) { + return new this.methodModels[name](this.utils, this.formatters, this.accounts); + } +} diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 7e9f75fc8f8..7c7b0d96975 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -22,24 +22,24 @@ "use strict"; -var version = require('./package.json').version; -var MethodModelFactory = require('./factories/MethodModelFactory'); -var Eth = require('./Eth'); -var MethodController = require('web3-core-method').MethodController; -var formatters = require('web3-core-helpers').formatters; -var Network = require('web3-net').Network; -var ProvidersPackage = require('web3-providers'); -var Utils = require('web3-utils'); -var Accounts = require('web3-eth-accounts').Accounts; -var Personal = require('web3-eth-personal').Personal; -var ENS = require('web3-eth-ens').ENS; -var SubscriptionsFactory = require('web3-core-subscriptions').SubscriptionsFactory; -var AbiCoder = require('web3-eth-abi').AbiCoder; -var Iban = require('web3-eth-iban').Iban; -var ContractPackage = require('web3-eth-contract'); +import {version} from '../package.json'; +import MethodModelFactory from './factories/MethodModelFactory'; +import Eth from './Eth'; +import {MethodController} from 'web3-core-method'; +import {formatters} from 'web3-core-helpers'; +import {Network} from 'web3-net'; +import ProvidersPackage from 'web3-providers'; +import Utils from 'web3-utils'; +import {Accounts} from 'web3-eth-accounts'; +import {Personal} from 'web3-eth-personal'; +import {ENS} from 'web3-eth-ens'; +import {SubscriptionsFactory} from 'web3-core-subscriptions'; +import {AbiCoder} from 'web3-eth-abi'; +import {Iban} from 'web3-eth-iban'; +import ContractPackage from 'web3-eth-contract'; -module.exports = { - version: version, +export default { + version, /** * Creates the Eth object @@ -50,8 +50,8 @@ module.exports = { * * @returns {Eth} */ - Eth: function (provider) { - var accounts = new Accounts(provider); + Eth: (provider) => { + const accounts = new Accounts(provider); return new Eth( provider, From 7e2fd2035dbd85214945492e451f947cff3d6ab3 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 16:35:07 +0200 Subject: [PATCH 0273/1045] web3-eth-abi ported to es6 --- packages/web3-eth-abi/src/ABICoder.js | 524 +++++++++++++------------- packages/web3-eth-abi/src/index.js | 12 +- 2 files changed, 268 insertions(+), 268 deletions(-) diff --git a/packages/web3-eth-abi/src/ABICoder.js b/packages/web3-eth-abi/src/ABICoder.js index 72941cbd32f..60eeaf4f3c4 100644 --- a/packages/web3-eth-abi/src/ABICoder.js +++ b/packages/web3-eth-abi/src/ABICoder.js @@ -21,9 +21,10 @@ * @date 2018 */ -var _ = require('underscore'); -var EthersAbi = require('ethers/utils/abi-coder').AbiCoder; -var ethersAbiCoder = new EthersAbi(function (type, value) { +import _ from 'underscore'; +import {AbiCoder as EthersAbi} from 'ethers/utils/abi-coder'; + +const ethersAbiCoder = new EthersAbi((type, value) => { if (type.match(/^u?int/) && !_.isArray(value) && (!_.isObject(value) || value.constructor.name !== 'BN')) { return value.toString(); } @@ -34,301 +35,300 @@ var ethersAbiCoder = new EthersAbi(function (type, value) { function Result() { } -/** - * @param {Object} utils - * - * @constructor - */ -function ABICoder (utils) { - this.utils = utils; -} +export default class ABICoder { -/** - * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. - * - * @method encodeFunctionSignature - * - * @param {String|Object} functionName - * - * @returns {String} encoded function name - */ -ABICoder.prototype.encodeFunctionSignature = function (functionName) { - if (_.isObject(functionName)) { - functionName = this.utils._jsonInterfaceMethodToString(functionName); + /** + * @param {Object} utils + * + * @constructor + */ + constructor(utils) { + this.utils = utils; } - return this.utils.sha3(functionName).slice(0, 10); -}; + /** + * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. + * + * @method encodeFunctionSignature + * + * @param {String|Object} functionName + * + * @returns {String} encoded function name + */ + encodeFunctionSignature(functionName) { + if (_.isObject(functionName)) { + functionName = this.utils._jsonInterfaceMethodToString(functionName); + } -/** - * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. - * - * @method encodeEventSignature - * - * @param {String|Object} functionName - * - * @returns {String} encoded function name - */ -ABICoder.prototype.encodeEventSignature = function (functionName) { - if (_.isObject(functionName)) { - functionName = this.utils._jsonInterfaceMethodToString(functionName); + return this.utils.sha3(functionName).slice(0, 10); } - return this.utils.sha3(functionName); -}; - -/** - * Should be used to encode plain param - * - * @method encodeParameter - * - * @param {String} type - * @param {Object} param - * - * @returns {String} encoded plain param - */ -ABICoder.prototype.encodeParameter = function (type, param) { - return this.encodeParameters([type], [param]); -}; - -/** - * Should be used to encode list of params - * - * @method encodeParameters - * - * @param {Array} types - * @param {Array} params - * - * @returns {String} encoded list of params - */ -ABICoder.prototype.encodeParameters = function (types, params) { - return ethersAbiCoder.encode(this.mapTypes(types), params); -}; - -/** - * Map types if simplified format is used - * - * @method mapTypes - * - * @param {Array} types - * - * @returns {Array} - */ -ABICoder.prototype.mapTypes = function (types) { - var self = this; - var mappedTypes = []; - types.forEach(function (type) { - if (self.isSimplifiedStructFormat(type)) { - var structName = Object.keys(type)[0]; - mappedTypes.push( - Object.assign( - self.mapStructNameAndType(structName), - { - components: self.mapStructToCoderFormat(type[structName]) - } - ) - ); - - return; + /** + * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. + * + * @method encodeEventSignature + * + * @param {String|Object} functionName + * + * @returns {String} encoded function name + */ + encodeEventSignature(functionName) { + if (_.isObject(functionName)) { + functionName = this.utils._jsonInterfaceMethodToString(functionName); } - mappedTypes.push(type); - }); + return this.utils.sha3(functionName); + } - return mappedTypes; -}; + /** + * Should be used to encode plain param + * + * @method encodeParameter + * + * @param {String} type + * @param {Object} param + * + * @returns {String} encoded plain param + */ + encodeParameter(type, param) { + return this.encodeParameters([type], [param]); + } -/** - * Check if type is simplified struct format - * - * @method isSimplifiedStructFormat - * - * @param {String | Object} type - * - * @returns {Boolean} - */ -ABICoder.prototype.isSimplifiedStructFormat = function (type) { - return typeof type === 'object' && typeof type.components === 'undefined' && typeof type.name === 'undefined'; -}; + /** + * Should be used to encode list of params + * + * @method encodeParameters + * + * @param {Array} types + * @param {Array} params + * + * @returns {String} encoded list of params + */ + encodeParameters(types, params) { + return ethersAbiCoder.encode(this.mapTypes(types), params); + } -/** - * Maps the correct tuple type and name when the simplified format in encode/decodeParameter is used - * - * @method mapStructNameAndType - * - * @param {String} structName - * - * @returns {{type: string, name: *}} - */ -ABICoder.prototype.mapStructNameAndType = function (structName) { - var type = 'tuple'; + /** + * Map types if simplified format is used + * + * @method mapTypes + * + * @param {Array} types + * + * @returns {Array} + */ + mapTypes(types) { + const mappedTypes = []; + types.forEach(type => { + if (this.isSimplifiedStructFormat(type)) { + const structName = Object.keys(type)[0]; + mappedTypes.push( + Object.assign( + this.mapStructNameAndType(structName), + { + components: this.mapStructToCoderFormat(type[structName]) + } + ) + ); + + return; + } + + mappedTypes.push(type); + }); - if (structName.indexOf('[]') > -1) { - type = 'tuple[]'; - structName = structName.slice(0, -2); + return mappedTypes; } - return {type: type, name: structName}; -}; + /** + * Check if type is simplified struct format + * + * @method isSimplifiedStructFormat + * + * @param {String | Object} type + * + * @returns {Boolean} + */ + isSimplifiedStructFormat(type) { + return typeof type === 'object' && typeof type.components === 'undefined' && typeof type.name === 'undefined'; + } -/** - * Maps the simplified format in to the expected format of the ABICoder - * - * @method mapStructToCoderFormat - * - * @param {Object} struct - * - * @returns {Array} - */ -ABICoder.prototype.mapStructToCoderFormat = function (struct) { - var self = this; - var components = []; - Object.keys(struct).forEach(function (key) { - if (typeof struct[key] === 'object') { - components.push( - Object.assign( - self.mapStructNameAndType(key), - { - components: self.mapStructToCoderFormat(struct[key]) - } - ) - ); - - return; + /** + * Maps the correct tuple type and name when the simplified format in encode/decodeParameter is used + * + * @method mapStructNameAndType + * + * @param {String} structName + * + * @returns {{type: string, name: *}} + */ + mapStructNameAndType(structName) { + let type = 'tuple'; + + if (structName.indexOf('[]') > -1) { + type = 'tuple[]'; + structName = structName.slice(0, -2); } - components.push({ - name: key, - type: struct[key] - }); - }); + return {type, name: structName}; + } - return components; -}; + /** + * Maps the simplified format in to the expected format of the ABICoder + * + * @method mapStructToCoderFormat + * + * @param {Object} struct + * + * @returns {Array} + */ + mapStructToCoderFormat(struct) { + const components = []; + Object.keys(struct).forEach(key => { + if (typeof struct[key] === 'object') { + components.push( + Object.assign( + this.mapStructNameAndType(key), + { + components: this.mapStructToCoderFormat(struct[key]) + } + ) + ); + + return; + } + + components.push({ + name: key, + type: struct[key] + }); + }); -/** - * Encodes a function call from its json interface and parameters. - * - * @method encodeFunctionCall - * - * @param {Array} jsonInterface - * @param {Array} params - * - * @returns {String} The encoded ABI for this function call - */ -ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { - return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface.inputs, params).replace('0x', ''); -}; + return components; + } -/** - * Should be used to decode bytes to plain param - * - * @method decodeParameter - * - * @param {String} type - * @param {String} bytes - * - * @returns {Object} plain param - */ -ABICoder.prototype.decodeParameter = function (type, bytes) { - return this.decodeParameters([type], bytes)[0]; -}; + /** + * Encodes a function call from its json interface and parameters. + * + * @method encodeFunctionCall + * + * @param {Array} jsonInterface + * @param {Array} params + * + * @returns {String} The encoded ABI for this function call + */ + encodeFunctionCall(jsonInterface, params) { + return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface.inputs, params).replace('0x', ''); + } -/** - * Should be used to decode list of params - * - * @method decodeParameter - * - * @param {Array} outputs - * @param {String} bytes - * - * @returns {Array} array of plain params - */ -ABICoder.prototype.decodeParameters = function (outputs, bytes) { - if (!bytes || bytes === '0x' || bytes === '0X') { - throw new Error('Returned values aren\'t valid, did it run Out of Gas?'); + /** + * Should be used to decode bytes to plain param + * + * @method decodeParameter + * + * @param {String} type + * @param {String} bytes + * + * @returns {Object} plain param + */ + decodeParameter(type, bytes) { + return this.decodeParameters([type], bytes)[0]; } - var res = ethersAbiCoder.decode(this.mapTypes(outputs), '0x' + bytes.replace(/0x/i, '')); - var returnValue = new Result(); - returnValue.__length__ = 0; + /** + * Should be used to decode list of params + * + * @method decodeParameter + * + * @param {Array} outputs + * @param {String} bytes + * + * @returns {Array} array of plain params + */ + decodeParameters(outputs, bytes) { + if (!bytes || bytes === '0x' || bytes === '0X') { + throw new Error('Returned values aren\'t valid, did it run Out of Gas?'); + } - outputs.forEach(function (output, i) { - var decodedValue = res[returnValue.__length__]; - decodedValue = (decodedValue === '0x') ? null : decodedValue; + const res = ethersAbiCoder.decode(this.mapTypes(outputs), `0x${bytes.replace(/0x/i, '')}`); + const returnValue = new Result(); + returnValue.__length__ = 0; - returnValue[i] = decodedValue; + outputs.forEach((output, i) => { + let decodedValue = res[returnValue.__length__]; + decodedValue = (decodedValue === '0x') ? null : decodedValue; - if (_.isObject(output) && output.name) { - returnValue[output.name] = decodedValue; - } + returnValue[i] = decodedValue; - returnValue.__length__++; - }); + if (_.isObject(output) && output.name) { + returnValue[output.name] = decodedValue; + } - return returnValue; -}; + returnValue.__length__++; + }); -/** - * Decodes events non- and indexed parameters. - * - * @method decodeLog - * - * @param {Object} inputs - * @param {String} data - * @param {Array} topics - * - * @returns {Array} array of plain params - */ -ABICoder.prototype.decodeLog = function (inputs, data, topics) { - var _this = this; - topics = _.isArray(topics) ? topics : [topics]; - - data = data || ''; - - var notIndexedInputs = []; - var indexedParams = []; - var topicCount = 0; - - // TODO check for anonymous logs? - - inputs.forEach(function (input, i) { - if (input.indexed) { - indexedParams[i] = (['bool', 'int', 'uint', 'address', 'fixed', 'ufixed'].find(function (staticType) { - return input.type.indexOf(staticType) !== -1; - })) ? _this.decodeParameter(input.type, topics[topicCount]) : topics[topicCount]; - topicCount++; - } else { - notIndexedInputs[i] = input; - } - }); + return returnValue; + } + /** + * Decodes events non- and indexed parameters. + * + * @method decodeLog + * + * @param {Object} inputs + * @param {String} data + * @param {Array} topics + * + * @returns {Array} array of plain params + */ + decodeLog(inputs, data, topics) { + const _this = this; + topics = _.isArray(topics) ? topics : [topics]; + + data = data || ''; + + const notIndexedInputs = []; + const indexedParams = []; + let topicCount = 0; + + // TODO check for anonymous logs? + + inputs.forEach((input, i) => { + if (input.indexed) { + indexedParams[i] = (['bool', 'int', 'uint', 'address', 'fixed', 'ufixed'].find(staticType => { + return input.type.indexOf(staticType) !== -1; + })) ? _this.decodeParameter(input.type, topics[topicCount]) : topics[topicCount]; + topicCount++; + } else { + notIndexedInputs[i] = input; + } + }); - var nonIndexedData = data; - var notIndexedParams = (nonIndexedData) ? this.decodeParameters(notIndexedInputs, nonIndexedData) : []; - var returnValue = new Result(); - returnValue.__length__ = 0; + const nonIndexedData = data; + const notIndexedParams = (nonIndexedData) ? this.decodeParameters(notIndexedInputs, nonIndexedData) : []; + const returnValue = new Result(); + returnValue.__length__ = 0; - inputs.forEach(function (res, i) { - returnValue[i] = (res.type === 'string') ? '' : null; - if (typeof notIndexedParams[i] !== 'undefined') { - returnValue[i] = notIndexedParams[i]; - } - if (typeof indexedParams[i] !== 'undefined') { - returnValue[i] = indexedParams[i]; - } + inputs.forEach((res, i) => { + returnValue[i] = (res.type === 'string') ? '' : null; - if (res.name) { - returnValue[res.name] = returnValue[i]; - } + if (typeof notIndexedParams[i] !== 'undefined') { + returnValue[i] = notIndexedParams[i]; + } + if (typeof indexedParams[i] !== 'undefined') { + returnValue[i] = indexedParams[i]; + } - returnValue.__length__++; - }); + if (res.name) { + returnValue[res.name] = returnValue[i]; + } - return returnValue; -}; + returnValue.__length__++; + }); -module.exports = ABICoder; + return returnValue; + } +} diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index a5bc8b52b22..55d9f6b99f1 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -22,12 +22,12 @@ 'use strict'; -var version = require('./package.json').version; -var ABICoder = require('./ABICoder'); -var Utils = require('web3-utils'); +import {version} from '../package.json'; +import ABICoder from './ABICoder'; +import Utils from 'web3-utils'; -module.exports = { - version: version, +export default { + version, /** * Returns the ABICoder object @@ -36,7 +36,7 @@ module.exports = { * * @returns {ABICoder} */ - AbiCoder: function () { + AbiCoder() { return new ABICoder(Utils); } }; From ce2a9cba3b4aa3cf175105ad29e4a13d62df84a9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 16:37:15 +0200 Subject: [PATCH 0274/1045] web3-eth-accounts ported to es6 --- packages/web3-eth-accounts/src/Accounts.js | 1184 +++++++++-------- .../src/factories/MethodModelFactory.js | 45 +- packages/web3-eth-accounts/src/index.js | 20 +- 3 files changed, 629 insertions(+), 620 deletions(-) diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index f5e67aedca9..7f12dfdcd93 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -22,444 +22,454 @@ "use strict"; -var _ = require("underscore"); -var Account = require("eth-lib/lib/account"); -var Hash = require("eth-lib/lib/hash"); -var RLP = require("eth-lib/lib/rlp"); -var Nat = require("eth-lib/lib/nat"); -var Bytes = require("eth-lib/lib/bytes"); -var cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); -var scryptsy = require('scrypt.js'); -var uuid = require('uuid'); -var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; - -var isNot = function(value) { +import _ from "underscore"; +import Account from "eth-lib/lib/account"; +import Hash from "eth-lib/lib/hash"; +import RLP from "eth-lib/lib/rlp"; +import Nat from "eth-lib/lib/nat"; +import Bytes from "eth-lib/lib/bytes"; +import scryptsy from 'scrypt.js'; +import uuid from 'uuid'; +import {AbstractWeb3Module} from 'web3-core'; + +const cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); + +const isNot = value => { return (_.isUndefined(value) || _.isNull(value)); }; -var trimLeadingZero = function (hex) { +const trimLeadingZero = hex => { while (hex && hex.startsWith('0x0')) { - hex = '0x' + hex.slice(3); + hex = `0x${hex.slice(3)}`; } return hex; }; -var makeEven = function (hex) { - if(hex.length % 2 === 1) { +const makeEven = hex => { + if (hex.length % 2 === 1) { hex = hex.replace('0x', '0x0'); } return hex; }; -/** - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {MethodModelFactory} methodModelFactory - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -var Accounts = function Accounts(provider, providersPackage, methodController, methodModelFactory, utils, formatters) { - AbstractWeb3Module.call(this, provider, providersPackage, methodController, methodModelFactory); - this.utils = utils; - this.formatters = formatters; - this.wallet = new Wallet(this); -}; - -Accounts.prototype = Object.create(AbstractWeb3Module.prototype); -Accounts.prototype.constructor = Accounts; - -/** - * Adds the account functions to the given object - * - * @method _addAccountFunctions - * - * @param {Object} account - * - * @returns {Object} - */ -Accounts.prototype._addAccountFunctions = function (account) { - var _this = this; - - // add sign functions - account.signTransaction = function signTransaction(tx, callback) { - return _this.signTransaction(tx, account.privateKey, callback); - }; - account.sign = function sign(data) { - return _this.sign(data, account.privateKey); - }; - - account.encrypt = function encrypt(password, options) { - return _this.encrypt(account.privateKey, password, options); - }; - - - return account; -}; - -/** - * Creates an account with a given entropy - * - * @method create - * - * @param {String} entropy - * - * @returns {Object} - */ -Accounts.prototype.create = function create(entropy) { - return this._addAccountFunctions(Account.create(entropy || this.utils.randomHex(32))); -}; - -/** - * Creates an Account object from a privateKey - * - * @method privateKeyToAccount - * - * @param {String} privateKey - * - * @returns {Object} - */ -Accounts.prototype.privateKeyToAccount = function privateKeyToAccount(privateKey) { - return this._addAccountFunctions(Account.fromPrivate(privateKey)); -}; - -/** - * Signs a transaction object with the given privateKey - * - * @method signTransaction - * - * @param {Object} tx - * @param {String} privateKey - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, callback) { - var _this = this, - error = false, - result; +export default class Accounts extends AbstractWeb3Module { + + /** + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {MethodModelFactory} methodModelFactory + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor( + provider, + providersPackage, + methodController, + methodModelFactory, + utils, + formatters + ) { + super(provider, providersPackage, methodController, methodModelFactory); + this.utils = utils; + this.formatters = formatters; + this.wallet = new Wallet(this); + } - callback = callback || function () {}; + /** + * Adds the account functions to the given object + * + * @method _addAccountFunctions + * + * @param {Object} account + * + * @returns {Object} + */ + _addAccountFunctions(account) { + const _this = this; + + // add sign functions + account.signTransaction = function signTransaction(tx, callback) { + return _this.signTransaction(tx, account.privateKey, callback); + }; + account.sign = function sign(data) { + return _this.sign(data, account.privateKey); + }; + + account.encrypt = function encrypt(password, options) { + return _this.encrypt(account.privateKey, password, options); + }; - if (!tx) { - error = new Error('No transaction object given!'); - callback(error); - return Promise.reject(error); + return account; } - function signed (tx) { + /** + * Creates an account with a given entropy + * + * @method create + * + * @param {String} entropy + * + * @returns {Object} + */ + create(entropy) { + return this._addAccountFunctions(Account.create(entropy || this.utils.randomHex(32))); + } - if (!tx.gas && !tx.gasLimit) { - error = new Error('"gas" is missing'); - } + /** + * Creates an Account object from a privateKey + * + * @method privateKeyToAccount + * + * @param {String} privateKey + * + * @returns {Object} + */ + privateKeyToAccount(privateKey) { + return this._addAccountFunctions(Account.fromPrivate(privateKey)); + } - if (tx.nonce < 0 || - tx.gas < 0 || - tx.gasPrice < 0 || - tx.chainId < 0) { - error = new Error('Gas, gasPrice, nonce or chainId is lower than 0'); - } + /** + * Signs a transaction object with the given privateKey + * + * @method signTransaction + * + * @param {Object} tx + * @param {String} privateKey + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ + signTransaction(tx, privateKey, callback) { + const _this = this; + let error = false; + let result; + + callback = callback || (() => { + }); + + if (!tx) { + error = new Error('No transaction object given!'); - if (error) { callback(error); return Promise.reject(error); } - try { - tx = _this.formatters.inputCallFormatter(tx); - - var transaction = tx; - transaction.to = tx.to || '0x'; - transaction.data = tx.data || '0x'; - transaction.value = tx.value || '0x'; - transaction.chainId = _this.utils.numberToHex(tx.chainId); - - var rlpEncoded = RLP.encode([ - Bytes.fromNat(transaction.nonce), - Bytes.fromNat(transaction.gasPrice), - Bytes.fromNat(transaction.gas), - transaction.to.toLowerCase(), - Bytes.fromNat(transaction.value), - transaction.data, - Bytes.fromNat(transaction.chainId || "0x1"), - "0x", - "0x"]); - - - var hash = Hash.keccak256(rlpEncoded); - - var signature = Account.makeSigner(Nat.toNumber(transaction.chainId || "0x1") * 2 + 35)(Hash.keccak256(rlpEncoded), privateKey); - - var rawTx = RLP.decode(rlpEncoded).slice(0, 6).concat(Account.decodeSignature(signature)); - - rawTx[6] = makeEven(trimLeadingZero(rawTx[6])); - rawTx[7] = makeEven(trimLeadingZero(rawTx[7])); - rawTx[8] = makeEven(trimLeadingZero(rawTx[8])); + function signed(tx) { + + if (!tx.gas && !tx.gasLimit) { + error = new Error('"gas" is missing'); + } + + if (tx.nonce < 0 || + tx.gas < 0 || + tx.gasPrice < 0 || + tx.chainId < 0) { + error = new Error('Gas, gasPrice, nonce or chainId is lower than 0'); + } + + if (error) { + callback(error); + return Promise.reject(error); + } + + try { + tx = _this.formatters.inputCallFormatter(tx); + + const transaction = tx; + transaction.to = tx.to || '0x'; + transaction.data = tx.data || '0x'; + transaction.value = tx.value || '0x'; + transaction.chainId = _this.utils.numberToHex(tx.chainId); + + const rlpEncoded = RLP.encode([ + Bytes.fromNat(transaction.nonce), + Bytes.fromNat(transaction.gasPrice), + Bytes.fromNat(transaction.gas), + transaction.to.toLowerCase(), + Bytes.fromNat(transaction.value), + transaction.data, + Bytes.fromNat(transaction.chainId || "0x1"), + "0x", + "0x"]); + + + const hash = Hash.keccak256(rlpEncoded); + + const signature = Account.makeSigner(Nat.toNumber(transaction.chainId || "0x1") * 2 + 35)(Hash.keccak256(rlpEncoded), privateKey); + + const rawTx = RLP.decode(rlpEncoded).slice(0, 6).concat(Account.decodeSignature(signature)); + + rawTx[6] = makeEven(trimLeadingZero(rawTx[6])); + rawTx[7] = makeEven(trimLeadingZero(rawTx[7])); + rawTx[8] = makeEven(trimLeadingZero(rawTx[8])); + + const rawTransaction = RLP.encode(rawTx); + + const values = RLP.decode(rawTransaction); + result = { + messageHash: hash, + v: trimLeadingZero(values[6]), + r: trimLeadingZero(values[7]), + s: trimLeadingZero(values[8]), + rawTransaction + }; + + } catch (e) { + callback(e); + return Promise.reject(e); + } + + callback(null, result); + return result; + } - var rawTransaction = RLP.encode(rawTx); + // Resolve immediately if nonce, chainId and price are provided + if (tx.nonce !== undefined && tx.chainId !== undefined && tx.gasPrice !== undefined) { + return Promise.resolve(signed(tx)); + } - var values = RLP.decode(rawTransaction); - result = { - messageHash: hash, - v: trimLeadingZero(values[6]), - r: trimLeadingZero(values[7]), - s: trimLeadingZero(values[8]), - rawTransaction: rawTransaction - }; - } catch(e) { - callback(e); - return Promise.reject(e); - } + // Otherwise, get the missing info from the Ethereum Node + return Promise.all([ + isNot(tx.chainId) ? _this.getId() : tx.chainId, + isNot(tx.gasPrice) ? _this.getGasPrice() : tx.gasPrice, + isNot(tx.nonce) ? _this.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce + ]).then(args => { + if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) { + throw new Error(`One of the values "chainId", "gasPrice", or "nonce" couldn't be fetched: ${JSON.stringify(args)}`); + } + return signed(_.extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2]})); + }); + } - callback(null, result); - return result; + /* jshint ignore:start */ + /** + * Recovers transaction + * + * @method recoverTransaction + * + * @param {String} rawTx + * + * @returns {String} + */ + recoverTransaction(rawTx) { + const values = RLP.decode(rawTx); + const signature = Account.encodeSignature(values.slice(6, 9)); + const recovery = Bytes.toNumber(values[6]); + const extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), "0x", "0x"]; + const signingData = values.slice(0, 6).concat(extraData); + const signingDataHex = RLP.encode(signingData); + + return Account.recover(Hash.keccak256(signingDataHex), signature); } - // Resolve immediately if nonce, chainId and price are provided - if (tx.nonce !== undefined && tx.chainId !== undefined && tx.gasPrice !== undefined) { - return Promise.resolve(signed(tx)); + /* jshint ignore:end */ + + /** + * Hashes a given message + * + * @method hashMessage + * + * @param {String} data + * + * @returns {String} + */ + hashMessage(data) { + const message = this.utils.isHexStrict(data) ? this.utils.hexToBytes(data) : data; + const messageBuffer = Buffer.from(message); + const preamble = `\x19Ethereum Signed Message:\n${message.length}`; + const preambleBuffer = Buffer.from(preamble); + const ethMessage = Buffer.concat([preambleBuffer, messageBuffer]); + return Hash.keccak256s(ethMessage); } + /** + * Signs a string with the given privateKey + * + * @method sign + * + * @param {String} data + * @param {String} privateKey + * + * @returns {Object} + */ + sign(data, privateKey) { + const hash = this.hashMessage(data); + const signature = Account.sign(hash, privateKey); + const vrs = Account.decodeSignature(signature); + + return { + message: data, + messageHash: hash, + v: vrs[0], + r: vrs[1], + s: vrs[2], + signature + }; + } - // Otherwise, get the missing info from the Ethereum Node - return Promise.all([ - isNot(tx.chainId) ? _this.getId() : tx.chainId, - isNot(tx.gasPrice) ? _this.getGasPrice() : tx.gasPrice, - isNot(tx.nonce) ? _this.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce - ]).then(function (args) { - if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) { - throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: '+ JSON.stringify(args)); + /** + * Recovers + * + * @method recover + * + * @param {String|Object} message + * @param {String} signature + * @param {Boolean} preFixed + * + * @returns {*} + */ + recover(message, signature, preFixed) { + const args = [].slice.apply(arguments); + + + if (_.isObject(message)) { + return this.recover(message.messageHash, Account.encodeSignature([message.v, message.r, message.s]), true); } - return signed(_.extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2]})); - }); -}; - -/* jshint ignore:start */ -/** - * Recovers transaction - * - * @method recoverTransaction - * - * @param {String} rawTx - * - * @returns {String} - */ -Accounts.prototype.recoverTransaction = function recoverTransaction(rawTx) { - var values = RLP.decode(rawTx); - var signature = Account.encodeSignature(values.slice(6,9)); - var recovery = Bytes.toNumber(values[6]); - var extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), "0x", "0x"]; - var signingData = values.slice(0,6).concat(extraData); - var signingDataHex = RLP.encode(signingData); - - return Account.recover(Hash.keccak256(signingDataHex), signature); -}; -/* jshint ignore:end */ - -/** - * Hashes a given message - * - * @method hashMessage - * - * @param {String} data - * - * @returns {String} - */ -Accounts.prototype.hashMessage = function hashMessage(data) { - var message = this.utils.isHexStrict(data) ? this.utils.hexToBytes(data) : data; - var messageBuffer = Buffer.from(message); - var preamble = "\x19Ethereum Signed Message:\n" + message.length; - var preambleBuffer = Buffer.from(preamble); - var ethMessage = Buffer.concat([preambleBuffer, messageBuffer]); - return Hash.keccak256s(ethMessage); -}; - -/** - * Signs a string with the given privateKey - * - * @method sign - * - * @param {String} data - * @param {String} privateKey - * - * @returns {Object} - */ -Accounts.prototype.sign = function sign(data, privateKey) { - var hash = this.hashMessage(data); - var signature = Account.sign(hash, privateKey); - var vrs = Account.decodeSignature(signature); - - return { - message: data, - messageHash: hash, - v: vrs[0], - r: vrs[1], - s: vrs[2], - signature: signature - }; -}; - -/** - * Recovers - * - * @method recover - * - * @param {String|Object} message - * @param {String} signature - * @param {Boolean} preFixed - * - * @returns {*} - */ -Accounts.prototype.recover = function recover(message, signature, preFixed) { - var args = [].slice.apply(arguments); + if (!preFixed) { + message = this.hashMessage(message); + } - if (_.isObject(message)) { - return this.recover(message.messageHash, Account.encodeSignature([message.v, message.r, message.s]), true); - } + if (args.length >= 4) { + preFixed = args.slice(-1)[0]; + preFixed = _.isBoolean(preFixed) ? !!preFixed : false; - if (!preFixed) { - message = this.hashMessage(message); + return this.recover(message, Account.encodeSignature(args.slice(1, 4)), preFixed); // v, r, s + } + return Account.recover(message, signature); } - if (args.length >= 4) { - preFixed = args.slice(-1)[0]; - preFixed = _.isBoolean(preFixed) ? !!preFixed : false; + /** + * Decrypts account + * + * Note: Taken from https://github.com/ethereumjs/ethereumjs-wallet + * + * @method decrypt + * + * @param {Object|String} v3Keystore + * @param {String} password + * @param {Boolean} nonStrict + * + * @returns {Object} + */ + decrypt(v3Keystore, password, nonStrict) { + /* jshint maxcomplexity: 10 */ + + if (!_.isString(password)) { + throw new Error('No password given.'); + } - return this.recover(message, Account.encodeSignature(args.slice(1, 4)), preFixed); // v, r, s - } - return Account.recover(message, signature); -}; + const json = (_.isObject(v3Keystore)) ? v3Keystore : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore); -/** - * Decrypts account - * - * Note: Taken from https://github.com/ethereumjs/ethereumjs-wallet - * - * @method decrypt - * - * @param {Object|String} v3Keystore - * @param {String} password - * @param {Boolean} nonStrict - * - * @returns {Object} - */ -Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) { - /* jshint maxcomplexity: 10 */ + if (json.version !== 3) { + throw new Error('Not a valid V3 wallet'); + } - if(!_.isString(password)) { - throw new Error('No password given.'); - } + let derivedKey; + let kdfparams; + if (json.crypto.kdf === 'scrypt') { + kdfparams = json.crypto.kdfparams; - var json = (_.isObject(v3Keystore)) ? v3Keystore : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore); + // FIXME: support progress reporting callback + derivedKey = scryptsy(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen); + } else if (json.crypto.kdf === 'pbkdf2') { + kdfparams = json.crypto.kdfparams; - if (json.version !== 3) { - throw new Error('Not a valid V3 wallet'); - } + if (kdfparams.prf !== 'hmac-sha256') { + throw new Error('Unsupported parameters to PBKDF2'); + } - var derivedKey; - var kdfparams; - if (json.crypto.kdf === 'scrypt') { - kdfparams = json.crypto.kdfparams; + derivedKey = cryp.pbkdf2Sync(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256'); + } else { + throw new Error('Unsupported key derivation scheme'); + } - // FIXME: support progress reporting callback - derivedKey = scryptsy(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen); - } else if (json.crypto.kdf === 'pbkdf2') { - kdfparams = json.crypto.kdfparams; + const ciphertext = new Buffer(json.crypto.ciphertext, 'hex'); - if (kdfparams.prf !== 'hmac-sha256') { - throw new Error('Unsupported parameters to PBKDF2'); + const mac = utils.sha3(Buffer.concat([derivedKey.slice(16, 32), ciphertext])).replace('0x', ''); + if (mac !== json.crypto.mac) { + throw new Error('Key derivation failed - possibly wrong password'); } - derivedKey = cryp.pbkdf2Sync(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256'); - } else { - throw new Error('Unsupported key derivation scheme'); - } - - var ciphertext = new Buffer(json.crypto.ciphertext, 'hex'); + const decipher = cryp.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), new Buffer(json.crypto.cipherparams.iv, 'hex')); + const seed = `0x${Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('hex')}`; - var mac = utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ])).replace('0x',''); - if (mac !== json.crypto.mac) { - throw new Error('Key derivation failed - possibly wrong password'); + return this.privateKeyToAccount(seed); } - var decipher = cryp.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), new Buffer(json.crypto.cipherparams.iv, 'hex')); - var seed = '0x'+ Buffer.concat([ decipher.update(ciphertext), decipher.final() ]).toString('hex'); - - return this.privateKeyToAccount(seed); -}; + /** + * Encrypts the account + * + * @method encrypt + * + * @param {String} privateKey + * @param {String} password + * @param {Object} options + * + * @returns {Object} + */ + encrypt(privateKey, password, options) { + /* jshint maxcomplexity: 20 */ + const account = this.privateKeyToAccount(privateKey); + + options = options || {}; + const salt = options.salt || cryp.randomBytes(32); + const iv = options.iv || cryp.randomBytes(16); + + let derivedKey; + const kdf = options.kdf || 'scrypt'; + const kdfparams = { + dklen: options.dklen || 32, + salt: salt.toString('hex') + }; + + if (kdf === 'pbkdf2') { + kdfparams.c = options.c || 262144; + kdfparams.prf = 'hmac-sha256'; + derivedKey = cryp.pbkdf2Sync(new Buffer(password), salt, kdfparams.c, kdfparams.dklen, 'sha256'); + } else if (kdf === 'scrypt') { + // FIXME: support progress reporting callback + kdfparams.n = options.n || 8192; // 2048 4096 8192 16384 + kdfparams.r = options.r || 8; + kdfparams.p = options.p || 1; + derivedKey = scryptsy(new Buffer(password), salt, kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen); + } else { + throw new Error('Unsupported kdf'); + } -/** - * Encrypts the account - * - * @method encrypt - * - * @param {String} privateKey - * @param {String} password - * @param {Object} options - * - * @returns {Object} - */ -Accounts.prototype.encrypt = function (privateKey, password, options) { - /* jshint maxcomplexity: 20 */ - var account = this.privateKeyToAccount(privateKey); - - options = options || {}; - var salt = options.salt || cryp.randomBytes(32); - var iv = options.iv || cryp.randomBytes(16); - - var derivedKey; - var kdf = options.kdf || 'scrypt'; - var kdfparams = { - dklen: options.dklen || 32, - salt: salt.toString('hex') - }; - - if (kdf === 'pbkdf2') { - kdfparams.c = options.c || 262144; - kdfparams.prf = 'hmac-sha256'; - derivedKey = cryp.pbkdf2Sync(new Buffer(password), salt, kdfparams.c, kdfparams.dklen, 'sha256'); - } else if (kdf === 'scrypt') { - // FIXME: support progress reporting callback - kdfparams.n = options.n || 8192; // 2048 4096 8192 16384 - kdfparams.r = options.r || 8; - kdfparams.p = options.p || 1; - derivedKey = scryptsy(new Buffer(password), salt, kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen); - } else { - throw new Error('Unsupported kdf'); - } + const cipher = cryp.createCipheriv(options.cipher || 'aes-128-ctr', derivedKey.slice(0, 16), iv); + if (!cipher) { + throw new Error('Unsupported cipher'); + } - var cipher = cryp.createCipheriv(options.cipher || 'aes-128-ctr', derivedKey.slice(0, 16), iv); - if (!cipher) { - throw new Error('Unsupported cipher'); + const ciphertext = Buffer.concat([cipher.update(new Buffer(account.privateKey.replace('0x', ''), 'hex')), cipher.final()]); + + const mac = this.utils.sha3(Buffer.concat([derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex')])).replace('0x', ''); + + return { + version: 3, + id: uuid.v4({random: options.uuid || cryp.randomBytes(16)}), + address: account.address.toLowerCase().replace('0x', ''), + crypto: { + ciphertext: ciphertext.toString('hex'), + cipherparams: { + iv: iv.toString('hex') + }, + cipher: options.cipher || 'aes-128-ctr', + kdf, + kdfparams, + mac: mac.toString('hex') + } + }; } - - var ciphertext = Buffer.concat([ cipher.update(new Buffer(account.privateKey.replace('0x',''), 'hex')), cipher.final() ]); - - var mac = this.utils.sha3(Buffer.concat([ derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex') ])).replace('0x',''); - - return { - version: 3, - id: uuid.v4({ random: options.uuid || cryp.randomBytes(16) }), - address: account.address.toLowerCase().replace('0x',''), - crypto: { - ciphertext: ciphertext.toString('hex'), - cipherparams: { - iv: iv.toString('hex') - }, - cipher: options.cipher || 'aes-128-ctr', - kdf: kdf, - kdfparams: kdfparams, - mac: mac.toString('hex') - } - }; -}; +} // Note: this is trying to follow closely the specs on // http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html @@ -469,235 +479,237 @@ Accounts.prototype.encrypt = function (privateKey, password, options) { * * @constructor */ -function Wallet(accounts) { - this._accounts = accounts; - this.length = 0; - this.defaultKeyName = "web3js_wallet"; -} - -/** - * Finds the safe index - * - * @method _findSafeIndex - * @private - * - * @param {Number} pointer - * - * @returns {*} - */ -Wallet.prototype._findSafeIndex = function (pointer) { - pointer = pointer || 0; - if (_.has(this, pointer)) { - return this._findSafeIndex(pointer + 1); - } else { - return pointer; - } -}; - -/** - * Gets the correntIndexes array - * - * @method _currentIndexes - * @private - * - * @returns {Number[]} - */ -Wallet.prototype._currentIndexes = function () { - var keys = Object.keys(this); - var indexes = keys - .map(function(key) { return parseInt(key); }) - .filter(function(n) { return (n < 9e20); }); - - return indexes; -}; - -/** - * Creates new accounts with a given entropy - * - * @method create - * - * @param {Number} numberOfAccounts - * @param {String} entropy - * - * @returns {Wallet} - */ -Wallet.prototype.create = function (numberOfAccounts, entropy) { - for (var i = 0; i < numberOfAccounts; ++i) { - this.add(this._accounts.create(entropy).privateKey); +class Wallet { + constructor(accounts) { + this._accounts = accounts; + this.length = 0; + this.defaultKeyName = "web3js_wallet"; } - return this; -}; - -/** - * Adds a account to the wallet - * - * @method add - * - * @param {Object} account - * - * @returns {Object} - */ -Wallet.prototype.add = function (account) { - if (_.isString(account)) { - account = this._accounts.privateKeyToAccount(account); + /** + * Finds the safe index + * + * @method _findSafeIndex + * @private + * + * @param {Number} pointer + * + * @returns {*} + */ + _findSafeIndex(pointer = 0) { + if (_.has(this, pointer)) { + return this._findSafeIndex(pointer + 1); + } else { + return pointer; + } } - if (!this[account.address]) { - account = this._accounts.privateKeyToAccount(account.privateKey); - account.index = this._findSafeIndex(); - this[account.index] = account; - this[account.address] = account; - this[account.address.toLowerCase()] = account; - - this.length++; - - return account; - } else { - return this[account.address]; + /** + * Gets the correntIndexes array + * + * @method _currentIndexes + * @private + * + * @returns {Number[]} + */ + _currentIndexes() { + const keys = Object.keys(this); + const indexes = keys + .map(key => { + return parseInt(key); + }) + .filter(n => { + return (n < 9e20); + }); + + return indexes; } -}; - -/** - * Removes a account from the number by his address or index - * - * @method remove - * - * @param {String|Number} addressOrIndex - * - * @returns {boolean} - */ -Wallet.prototype.remove = function (addressOrIndex) { - var account = this[addressOrIndex]; - - if (account && account.address) { - // address - this[account.address].privateKey = null; - delete this[account.address]; - // address lowercase - this[account.address.toLowerCase()].privateKey = null; - delete this[account.address.toLowerCase()]; - // index - this[account.index].privateKey = null; - delete this[account.index]; - - this.length--; - return true; - } else { - return false; + /** + * Creates new accounts with a given entropy + * + * @method create + * + * @param {Number} numberOfAccounts + * @param {String} entropy + * + * @returns {Wallet} + */ + create(numberOfAccounts, entropy) { + for (let i = 0; i < numberOfAccounts; ++i) { + this.add(this._accounts.create(entropy).privateKey); + } + return this; } -}; - -/** - * Clears the wallet - * - * @method clear - * - * @returns {Wallet} - */ -Wallet.prototype.clear = function () { - var _this = this; - var indexes = this._currentIndexes(); - - indexes.forEach(function(index) { - _this.remove(index); - }); - - return this; -}; - -/** - * Encrypts all accounts - * - * @method encrypt - * - * @param {String} password - * @param {Object} options - * - * @returns {any[]} - */ -Wallet.prototype.encrypt = function (password, options) { - var _this = this; - var indexes = this._currentIndexes(); - var accounts = indexes.map(function(index) { - return _this[index].encrypt(password, options); - }); + /** + * Adds a account to the wallet + * + * @method add + * + * @param {Object} account + * + * @returns {Object} + */ + add(account) { + + if (_.isString(account)) { + account = this._accounts.privateKeyToAccount(account); + } + if (!this[account.address]) { + account = this._accounts.privateKeyToAccount(account.privateKey); + account.index = this._findSafeIndex(); - return accounts; -}; + this[account.index] = account; + this[account.address] = account; + this[account.address.toLowerCase()] = account; -/** - * Decrypts all accounts - * - * @method decrypt - * - * @param {Wallet} encryptedWallet - * @param {String} password - * - * @returns {Wallet} - */ -Wallet.prototype.decrypt = function (encryptedWallet, password) { - var _this = this; + this.length++; - encryptedWallet.forEach(function (keystore) { - var account = _this._accounts.decrypt(keystore, password); + return account; + } else { + return this[account.address]; + } + } - if (account) { - _this.add(account); + /** + * Removes a account from the number by his address or index + * + * @method remove + * + * @param {String|Number} addressOrIndex + * + * @returns {boolean} + */ + remove(addressOrIndex) { + const account = this[addressOrIndex]; + + if (account && account.address) { + // address + this[account.address].privateKey = null; + delete this[account.address]; + // address lowercase + this[account.address.toLowerCase()].privateKey = null; + delete this[account.address.toLowerCase()]; + // index + this[account.index].privateKey = null; + delete this[account.index]; + + this.length--; + + return true; } else { - throw new Error('Couldn\'t decrypt accounts. Password wrong?'); + return false; } - }); + } - return this; -}; + /** + * Clears the wallet + * + * @method clear + * + * @returns {Wallet} + */ + clear() { + const _this = this; + const indexes = this._currentIndexes(); + + indexes.forEach(index => { + _this.remove(index); + }); + + return this; + } -/** - * Saves the current wallet in the localStorage of the browser - * - * @method save - * - * @param {String} password - * @param {String} keyName - * - * @returns {boolean} - */ -Wallet.prototype.save = function (password, keyName) { - localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password))); + /** + * Encrypts all accounts + * + * @method encrypt + * + * @param {String} password + * @param {Object} options + * + * @returns {any[]} + */ + encrypt(password, options) { + const _this = this; + const indexes = this._currentIndexes(); + + const accounts = indexes.map(index => { + return _this[index].encrypt(password, options); + }); + + return accounts; + } - return true; -}; + /** + * Decrypts all accounts + * + * @method decrypt + * + * @param {Wallet} encryptedWallet + * @param {String} password + * + * @returns {Wallet} + */ + decrypt(encryptedWallet, password) { + const _this = this; + + encryptedWallet.forEach(keystore => { + const account = _this._accounts.decrypt(keystore, password); + + if (account) { + _this.add(account); + } else { + throw new Error('Couldn\'t decrypt accounts. Password wrong?'); + } + }); + + return this; + } -/** - * Loads the stored wallet by his keyName from the localStorage of the browser - * - * @method load - * - * @param {String} password - * @param {String} keyName - * - * @returns {Wallet} - */ -Wallet.prototype.load = function (password, keyName) { - var keystore = localStorage.getItem(keyName || this.defaultKeyName); + /** + * Saves the current wallet in the localStorage of the browser + * + * @method save + * + * @param {String} password + * @param {String} keyName + * + * @returns {boolean} + */ + save(password, keyName) { + localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password))); - if (keystore) { - try { - keystore = JSON.parse(keystore); - } catch(e) { + return true; + } + /** + * Loads the stored wallet by his keyName from the localStorage of the browser + * + * @method load + * + * @param {String} password + * @param {String} keyName + * + * @returns {Wallet} + */ + load(password, keyName) { + let keystore = localStorage.getItem(keyName || this.defaultKeyName); + + if (keystore) { + try { + keystore = JSON.parse(keystore); + } catch (e) { + + } } - } - return this.decrypt(keystore || [], password); -}; + return this.decrypt(keystore || [], password); + } +} if (typeof localStorage === 'undefined') { delete Wallet.prototype.save; delete Wallet.prototype.load; } - - -module.exports = Accounts; diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js index 29caae4996d..d1c08585fa9 100644 --- a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -22,28 +22,25 @@ "use strict"; -var web3CoreMethod = require('web3-core-method'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call( - this, - { - getGasPrice: web3CoreMethod.GetGasPriceMethodModel, - getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, - getId: web3CoreMethod.VersionMethodModel - }, - utils, - formatters - ); +import web3CoreMethod from 'web3-core-method'; + +export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super( + { + getGasPrice: web3CoreMethod.GetGasPriceMethodModel, + getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, + getId: web3CoreMethod.VersionMethodModel + }, + utils, + formatters + ); + } } - -MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); -MethodModelFactory.prototype.constructor = MethodModelFactory; - -module.exports = MethodModelFactory; diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index d1090b7fac7..dae34d75bc1 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -22,16 +22,16 @@ "use strict"; -var version = require('../package.json').version; -var Accounts = require('./Accounts'); -var MethodController = require('web3-core-method').MethodController; -var ProvidersPackage = require('web3-providers'); -var Utils = require('web3-utils'); -var formatters = require('web3-core-helpers').formatters; -var MethodModelFactory = require('./factories/MethodModelFactory'); +import {version} from '../package.json'; +import Accounts from './Accounts'; +import {MethodController} from 'web3-core-method'; +import ProvidersPackage from 'web3-providers'; +import Utils from 'web3-utils'; +import {formatters} from 'web3-core-helpers'; +import MethodModelFactory from './factories/MethodModelFactory'; -module.exports = { - version: version, +export default { + version, /** * Returns the Accounts object @@ -42,7 +42,7 @@ module.exports = { * * @returns {Accounts} */ - Accounts: function (provider) { + Accounts: (provider) => { return new Accounts( provider, ProvidersPackage, From b27ff64c0756fee05b4f5b0beb29e745e9675fd9 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 16:57:09 +0200 Subject: [PATCH 0275/1045] web3-eth-contract proted to es6 --- packages/web3-eth-contract/src/Contract.js | 439 +++++++------- .../src/decoders/AllEventsLogDecoder.js | 64 +- .../src/decoders/CallMethodResponseDecoder.js | 71 +-- .../src/decoders/EventLogDecoder.js | 81 +-- .../src/encoders/AllEventsFilterEncoder.js | 65 +- .../src/encoders/EventFilterEncoder.js | 72 +-- .../src/encoders/MethodEncoder.js | 81 +-- .../src/factories/ContractPackageFactory.js | 567 +++++++++--------- .../src/factories/EventSubscriptionFactory.js | 119 ++-- .../src/factories/RpcMethodModelFactory.js | 247 ++++---- packages/web3-eth-contract/src/index.js | 29 +- .../src/mappers/ABIMapper.js | 201 ++++--- .../src/mappers/AllEventsOptionsMapper.js | 69 +-- .../src/mappers/EventOptionsMapper.js | 77 +-- .../src/mappers/RpcMethodOptionsMapper.js | 70 +-- .../src/models/abi/ABIItemModel.js | 182 +++--- .../src/models/abi/ABIModel.js | 173 +++--- .../models/methods/CallContractMethodModel.js | 64 +- .../methods/ContractDeployMethodModel.js | 66 +- .../methods/PastEventLogsMethodModel.js | 71 ++- .../models/methods/SendContractMethodModel.js | 109 ++-- .../subscriptions/AllEventsLogSubscription.js | 76 ++- .../subscriptions/EventLogSubscription.js | 82 ++- .../src/proxies/EventSubscriptionsProxy.js | 243 ++++---- .../src/proxies/MethodsProxy.js | 381 ++++++------ .../validators/RpcMethodOptionsValidator.js | 139 ++--- 26 files changed, 1906 insertions(+), 1932 deletions(-) diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 9f646b735e4..30406d8d779 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -22,253 +22,246 @@ "use strict"; -var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; +import {AbstractWeb3Module} from 'web3-core'; -/** - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {ContractPackageFactory} contractPackageFactory - * @param {PromiEventPackage} promiEventPackage - * @param {ABICoder} abiCoder - * @param {Object} utils - * @param {Object} formatters - * @param {Accounts} accounts - * @param {ABIMapper} abiMapper - * @param {Object} abi - * @param {String} address - * @param {Object} options - * - * @constructor - */ -function Contract( - provider, - providersPackage, - methodController, - contractPackageFactory, - promiEventPackage, - abiCoder, - utils, - formatters, - accounts, - abiMapper, - abi, - address, - options, -) { - if (!(this instanceof Contract)) { - throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!'); - } +export default class Contract extends AbstractWeb3Module { - if (!abi || !(Array.isArray(abi))) { - throw new Error('You must provide the json interface of the contract when instantiating a contract object.'); - } + /** + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {ContractPackageFactory} contractPackageFactory + * @param {PromiEventPackage} promiEventPackage + * @param {ABICoder} abiCoder + * @param {Object} utils + * @param {Object} formatters + * @param {Accounts} accounts + * @param {ABIMapper} abiMapper + * @param {Object} abi + * @param {String} address + * @param {Object} options + * + * @constructor + */ + constructor( + provider, + providersPackage, + methodController, + contractPackageFactory, + promiEventPackage, + abiCoder, + utils, + formatters, + accounts, + abiMapper, + abi, + address, + options + ) { + super(provider, providersPackage, null, null); - this.providersPackage = providersPackage; - this.methodController = methodController; - this.contractPackageFactory = contractPackageFactory; - this.abiCoder = abiCoder; - this.utils = utils; - this.formatters = formatters; - this.accounts = accounts; - this.abiMapper = abiMapper; - this.options = options; - this.promiEventPackage = promiEventPackage; - this.rpcMethodModelFactory = contractPackageFactory.createRpcMethodModelFactory(); + if (!(this instanceof Contract)) { + throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!'); + } - AbstractWeb3Module.call( - this, - provider, - this.providersPackage, - null, - null, - ); + if (!abi || !(Array.isArray(abi))) { + throw new Error('You must provide the json interface of the contract when instantiating a contract object.'); + } - this.defaultBlock = 'latest'; - address = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(address)); + this.providersPackage = providersPackage; + this.methodController = methodController; + this.contractPackageFactory = contractPackageFactory; + this.abiCoder = abiCoder; + this.utils = utils; + this.formatters = formatters; + this.accounts = accounts; + this.abiMapper = abiMapper; + this.options = options; + this.promiEventPackage = promiEventPackage; + this.rpcMethodModelFactory = contractPackageFactory.createRpcMethodModelFactory(); - var self = this, - abiModel = abiMapper.map(abi), - defaultAccount = null; - /** - * Defines accessors for contract address - */ - Object.defineProperty(this.options, 'address', { - set: function (value) { - if (value) { - address = self.utils.toChecksumAddress(self.formatters.inputAddressFormatter(value)); - } - }, - get: function () { - return address; - }, - enumerable: true - }); + this.defaultBlock = 'latest'; + address = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(address)); - /** - * Defines accessors for jsonInterface - */ - Object.defineProperty(this.options, 'jsonInterface', { - set: function (value) { - abiModel = self.abiMapper.map(value); - self.methods.abiModel = abiModel; - self.events.abiModel = abiModel; - }, - get: function () { - return abiModel; - }, - enumerable: true - }); + let abiModel = abiMapper.map(abi); + let defaultAccount = null; - /** - * Defines accessors for defaultAccount - */ - Object.defineProperty(this, 'defaultAccount', { - get: function () { - if (!defaultAccount) { - return this.options.from; - } + /** + * Defines accessors for contract address + */ + Object.defineProperty(this.options, 'address', { + set: (value) => { + if (value) { + address = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(value)); + } + }, + get: () => { + return address; + }, + enumerable: true + }); - return defaultAccount; - }, - set: function (val) { - if (val) { - defaultAccount = self.utils.toChecksumAddress(self.formatters.inputAddressFormatter(val)); - } + /** + * Defines accessors for jsonInterface + */ + Object.defineProperty(this.options, 'jsonInterface', { + set: (value) => { + abiModel = this.abiMapper.map(value); + this.methods.abiModel = abiModel; + this.events.abiModel = abiModel; + }, + get: () => { + return abiModel; + }, + enumerable: true + }); - }, - enumerable: true - }); + /** + * Defines accessors for defaultAccount + */ + Object.defineProperty(this, 'defaultAccount', { + get: () => { + if (!defaultAccount) { + return this.options.from; + } - this.methods = contractPackageFactory.createMethodsProxy( - this, - abiModel, - this.methodController, - this.promiEventPackage - ); + return defaultAccount; + }, + set: (val) => { + if (val) { + defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); + } - this.events = contractPackageFactory.createEventSubscriptionsProxy( - this, - abiModel, - this.methodController - ); -} + }, + enumerable: true + }); -Contract.prototype = Object.create(AbstractWeb3Module.prototype); -Contract.prototype.constructor = Contract; + this.methods = contractPackageFactory.createMethodsProxy( + this, + abiModel, + this.methodController, + this.promiEventPackage + ); -/** - * Adds event listeners and creates a subscription, and remove it once its fired. - * - * @method once - * - * @param {String} eventName - * @param {Object} options - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {undefined} - */ -Contract.prototype.once = function (eventName, options, callback) { - if (!callback) { - throw new Error('Once requires a callback function.'); + this.events = contractPackageFactory.createEventSubscriptionsProxy( + this, + abiModel, + this.methodController + ); } - if (options) { - delete options.fromBlock; - } + /** + * Adds event listeners and creates a subscription, and remove it once its fired. + * + * @method once + * + * @param {String} eventName + * @param {Object} options + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {undefined} + */ + once(eventName, options, callback) { + if (!callback) { + throw new Error('Once requires a callback function.'); + } - var eventSubscription = this.events[event](options, callback); + if (options) { + delete options.fromBlock; + } - eventSubscription.on('data', function() { - eventSubscription.unsubscribe(); - }); -}; + const eventSubscription = this.events[event](options, callback); -/** - * Returns the past event logs by his name - * - * @method getPastEvents - * - * @param {String} eventName - * @param {Object} options - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise} - */ -Contract.prototype.getPastEvents = function (eventName, options, callback) { - if (!this.options.jsonInterface.hasEvent(eventName)) { - throw Error('Event with name "' + eventName + 'does not exists.'); + eventSubscription.on('data', () => { + eventSubscription.unsubscribe(); + }); } - var pastEventLogsMethodModel = this.rpcMethodModelFactory.createPastEventLogsMethodModel( - this.options.jsonInterface.getEvent(eventName) - ); - pastEventLogsMethodModel.parameters = [options]; - pastEventLogsMethodModel.callback = callback; + /** + * Returns the past event logs by his name + * + * @method getPastEvents + * + * @param {String} eventName + * @param {Object} options + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise} + */ + getPastEvents(eventName, options, callback) { + if (!this.options.jsonInterface.hasEvent(eventName)) { + throw Error(`Event with name "${eventName}does not exists.`); + } - return this.methodController.execute( - pastEventLogsMethodModel, - this.accounts, - this - ); -}; + const pastEventLogsMethodModel = this.rpcMethodModelFactory.createPastEventLogsMethodModel( + this.options.jsonInterface.getEvent(eventName) + ); -/** - * Deploy an contract and returns an new Contract instance with the correct address set - * - * @method deploy - * - * @param {Object} options - * - * @returns {Promise|EventEmitter} - */ -Contract.prototype.deploy = function (options) { - return this.methods.contractConstructor(options); -}; + pastEventLogsMethodModel.parameters = [options]; + pastEventLogsMethodModel.callback = callback; -/** - * Return an new instance of the Contract object - * - * @method clone - * - * @returns {Contract} - */ -Contract.prototype.clone = function () { - return new this.constructor( - this.currentProvider, - this.providersPackage, - this.methodController, - this.contractPackageFactory, - this.promiEventPackage, - this.abiCoder, - this.utils, - this.formatters, - this.accounts, - this.abiMapper, - this.options.jsonInterface, - this.options.address, - this.options - ); -}; + return this.methodController.execute( + pastEventLogsMethodModel, + this.accounts, + this + ); + } -/** - * Sets the currentProvider and provider property - * - * @method setProvider - * - * @param {Object|String} provider - * @param {Net} net - * - * @returns {Boolean} - */ -Contract.prototype.setProvider = function (provider, net) { - return !!( - AbstractWeb3Module.prototype.setProvider.call(this, provider, net) && - this.accounts.setProvider(provider, net) - ); -}; + /** + * Deploy an contract and returns an new Contract instance with the correct address set + * + * @method deploy + * + * @param {Object} options + * + * @returns {Promise|EventEmitter} + */ + deploy(options) { + return this.methods.contractConstructor(options); + } + + /** + * Return an new instance of the Contract object + * + * @method clone + * + * @returns {Contract} + */ + clone() { + return new this.constructor( + this.currentProvider, + this.providersPackage, + this.methodController, + this.contractPackageFactory, + this.promiEventPackage, + this.abiCoder, + this.utils, + this.formatters, + this.accounts, + this.abiMapper, + this.options.jsonInterface, + this.options.address, + this.options + ); + } -module.exports = Contract; + /** + * Sets the currentProvider and provider property + * + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net + * + * @returns {Boolean} + */ + setProvider(provider, net) { + return !!( + AbstractWeb3Module.prototype.setProvider.call(this, provider, net) && + this.accounts.setProvider(provider, net) + ); + } +} diff --git a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js index 3b586ade64e..a74ea82c600 100644 --- a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js @@ -22,39 +22,33 @@ "use strict"; -var EventLogDecoder = require('./EventLogDecoder'); - -/** - * @param {ABIModel} abiModel - * @param {ABICoder} abiCoder - * @param {Object} formatters - * - * @constructor - */ -function AllEventsLogDecoder(abiModel, abiCoder, formatters) { - EventLogDecoder.call(this, abiCoder, formatters); - this.abiModel = abiModel; +import EventLogDecoder from './EventLogDecoder'; + +export default class AllEventsLogDecoder extends EventLogDecoder { + + /** + * @param {ABIModel} abiModel + * @param {ABICoder} abiCoder + * @param {Object} formatters + * + * @constructor + */ + constructor(abiModel, abiCoder, formatters) { + super(abiCoder, formatters); + this.abiModel = abiModel; + } + + /** + * Decodes the event subscription response + * + * @method decoder + * + * @param {ABIItemModel} abiItemModel + * @param {Object} response + * + * @returns {Object} + */ + decode(abiItemModel, response) { + return super.decode(this.abiModel.getEventBySignature(response.topics[0]), response); + } } - -AllEventsLogDecoder.prototype = Object.create(EventLogDecoder.prototype); -AllEventsLogDecoder.prototype.constructor = AllEventsLogDecoder; - -/** - * Decodes the event subscription response - * - * @method decoder - * - * @param {ABIItemModel} abiItemModel - * @param {Object} response - * - * @returns {Object} - */ -AllEventsLogDecoder.prototype.decode = function (abiItemModel, response) { - return EventLogDecoder.prototype.decode.call( - this, - this.abiModel.getEventBySignature(response.topics[0]), - response - ); -}; - -module.exports = AllEventsLogDecoder; diff --git a/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js index c2ab998e608..95109d4160b 100644 --- a/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js +++ b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js @@ -22,41 +22,42 @@ "use strict"; -/** - * @param {ABICoder} abiCoder - * - * @constructor - */ -function CallMethodResponseDecoder(abiCoder) { - this.abiCoder = abiCoder; -} - -/** - * Decodes the method response - * - * @method decode - * - * @param {Array} abiItemOutputTypes - * @param {Object} response - * - * @returns {*} - */ -CallMethodResponseDecoder.prototype.decode = function (abiItemOutputTypes, response) { - if (!response) { - return null; +export default class CallMethodResponseDecoder { + + /** + * @param {ABICoder} abiCoder + * + * @constructor + */ + constructor(abiCoder) { + this.abiCoder = abiCoder; } - if (response.length >= 2) { - response = response.slice(2); + /** + * Decodes the method response + * + * @method decode + * + * @param {Array} abiItemOutputTypes + * @param {Object} response + * + * @returns {*} + */ + decode(abiItemOutputTypes, response) { + if (!response) { + return null; + } + + if (response.length >= 2) { + response = response.slice(2); + } + + const result = this.abiCoder.decodeParameters(abiItemOutputTypes, response); + + if (result.__length__ === 1) { + return result[0]; + } + + return result; } - - var result = this.abiCoder.decodeParameters(abiItemOutputTypes, response); - - if (result.__length__ === 1) { - return result[0]; - } - - return result; -}; - -module.exports = CallMethodResponseDecoder; +} diff --git a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js index 32a92da3e57..e49c8c2ad91 100644 --- a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js @@ -22,50 +22,51 @@ "use strict"; -/** - * @param {ABICoder} abiCoder - * @param {Object} formatters - * - * @constructor - */ -function EventLogDecoder(abiCoder, formatters) { - this.abiCoder = abiCoder; - this.formatters = formatters; -} +class EventLogDecoder { -/** - * Decodes the event subscription response - * - * @method decoder - * - * @param {ABIItemModel} abiItemModel - * @param {Object} response - * - * @returns {Object} - */ -EventLogDecoder.prototype.decode = function(abiItemModel, response) { - var argTopics = response.topics; - if (abiItemModel.anonymous) { - argTopics = response.topics.slice(1); + /** + * @param {ABICoder} abiCoder + * @param {Object} formatters + * + * @constructor + */ + constructor(abiCoder, formatters) { + this.abiCoder = abiCoder; + this.formatters = formatters; } - response.returnValues = this.abiCoder.decodeLog(abiItemModel.getInputs(), response.data, argTopics); - response.event = abiItemModel.name; - response.signature = abiItemModel.signature; - response.raw = { - data: response.data, - topics: response.topics - }; + /** + * Decodes the event subscription response + * + * @method decoder + * + * @param {ABIItemModel} abiItemModel + * @param {Object} response + * + * @returns {Object} + */ + decode(abiItemModel, response) { + let argTopics = response.topics; + if (abiItemModel.anonymous) { + argTopics = response.topics.slice(1); + } - if (abiItemModel.anonymous || !response.topics[0]) { - response.signature = null; - } + response.returnValues = this.abiCoder.decodeLog(abiItemModel.getInputs(), response.data, argTopics); + response.event = abiItemModel.name; + response.signature = abiItemModel.signature; + response.raw = { + data: response.data, + topics: response.topics + }; - delete response.returnValues.__length__; - delete response.data; - delete response.topics; + if (abiItemModel.anonymous || !response.topics[0]) { + response.signature = null; + } - return response; -}; + delete response.returnValues.__length__; + delete response.data; + delete response.topics; -module.exports = EventLogDecoder; + return response; + } +} diff --git a/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js index 084b1cf2407..5c6307ce57d 100644 --- a/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js +++ b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js @@ -22,38 +22,35 @@ "use strict"; -var EventFilterEncoder = require('./EventFilterEncoder'); - -/** - * @param {ABICoder} abiCoder - * - * @constructor - */ -function AllEventsFilterEncoder(abiCoder) { - EventFilterEncoder.call(this, abiCoder); +import EventFilterEncoder from './EventFilterEncoder'; + +export default class AllEventsFilterEncoder extends EventFilterEncoder { + + /** + * @param {ABICoder} abiCoder + * + * @constructor + */ + constructor(abiCoder) { + super(abiCoder); + } + + /** + * Creates encoded topics from filter option of an event. + * + * @param {ABIModel} abiModel + * @param {*} filter + * + * @returns {Array} + */ + encode(abiModel, filter) { + const events = abiModel.getEvents(); + let topics = []; + + Object.keys(events).forEach(key => { + topics.push(super.encode(events[key], filter)); + }); + + return topics; + } } - -AllEventsFilterEncoder.prototype = Object.create(EventFilterEncoder.prototype); -AllEventsFilterEncoder.prototype.constructor = AllEventsFilterEncoder; - -/** - * Creates encoded topics from filter option of an event. - * - * @param {ABIModel} abiModel - * @param {*} filter - * - * @returns {Array} - */ -AllEventsFilterEncoder.prototype.encode = function (abiModel, filter) { - var self = this, - events = abiModel.getEvents(), - topics = []; - - Object.keys(events).forEach(function (key) { - topics.push(EventFilterEncoder.prototype.encode.call(self, events[key], filter)); - }); - - return topics; -}; - -module.exports = AllEventsFilterEncoder; diff --git a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js index 6e5557761b8..8d8a5d3c0c5 100644 --- a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js +++ b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js @@ -22,47 +22,47 @@ "use strict"; -/** - * @param {ABICoder} abiCoder - * - * @constructor - */ -function EventFilterEncoder(abiCoder) { - this.abiCoder = abiCoder; -} +export default class EventFilterEncoder { -/** - * Creates encoded topics from filter option of an event. - * - * @param {ABIItemModel} abiItemModel - * @param {*} filter - * - * @returns {Array} - */ -EventFilterEncoder.prototype.encode = function (abiItemModel, filter) { - var indexedInputs = abiItemModel.getIndexedInputs(), - topics = [], - self = this; + /** + * @param {ABICoder} abiCoder + * + * @constructor + */ + constructor(abiCoder) { + this.abiCoder = abiCoder; + } - indexedInputs.forEach(function(indexedInput) { - if (typeof filter[indexedInput.name] !== 'undefined') { - var filterItem = filter[indexedInput.name]; + /** + * Creates encoded topics from filter option of an event. + * + * @param {ABIItemModel} abiItemModel + * @param {*} filter + * + * @returns {Array} + */ + encode(abiItemModel, filter) { + const indexedInputs = abiItemModel.getIndexedInputs(); + let topics = []; - if (_.isArray(filterItem)) { - filterItem.map(function(item) { - return self.abiCoder.encodeParameter(indexedInput.type, item); - }); + indexedInputs.forEach(indexedInput => { + if (typeof filter[indexedInput.name] !== 'undefined') { + const filterItem = filter[indexedInput.name]; - topics.push(filterItem); + if (_.isArray(filterItem)) { + filterItem.map(item => { + return this.abiCoder.encodeParameter(indexedInput.type, item); + }); - return; - } + topics.push(filterItem); - topics.push(self.abiCoder.encodeParameter(indexedInput.type, filterItem)); - } - }); + return; + } - return topics; -}; + topics.push(this.abiCoder.encodeParameter(indexedInput.type, filterItem)); + } + }); -module.exports = EventFilterEncoder; + return topics; + } +} diff --git a/packages/web3-eth-contract/src/encoders/MethodEncoder.js b/packages/web3-eth-contract/src/encoders/MethodEncoder.js index fbd29e43023..1e593ecf187 100644 --- a/packages/web3-eth-contract/src/encoders/MethodEncoder.js +++ b/packages/web3-eth-contract/src/encoders/MethodEncoder.js @@ -22,50 +22,53 @@ "use strict"; -/** - * @param {ABICoder} abiCoder - * - * @constructor - */ -function MethodEncoder(abiCoder) { - this.abiCoder = abiCoder; -} +export default class MethodEncoder { -/** - * Encodes the method with the given parameters - * - * @method encode - * - * @param {ABIItemModel} abiItemModel - * @param {String} deployData - * - * @returns {String|Error} - */ -MethodEncoder.prototype.encode = function (abiItemModel, deployData) { - try { - var encodedParameters = this.abiCoder.encodeParameters( - abiItemModel.getInputs(), - abiItemModel.contractMethodParameters - ).replace('0x', ''); - } catch (error) { - return error; + /** + * @param {ABICoder} abiCoder + * + * @constructor + */ + constructor(abiCoder) { + this.abiCoder = abiCoder; } - if (abiItemModel.signature === 'constructor') { - if (!deployData) { - return new Error( - 'The contract has no contract data option set. This is necessary to append the constructor parameters.' - ); + /** + * Encodes the method with the given parameters + * + * @method encode + * + * @param {ABIItemModel} abiItemModel + * @param {String} deployData + * + * @returns {String|Error} + */ + encode(abiItemModel, deployData) { + let encodedParameters; + + try { + encodedParameters = this.abiCoder.encodeParameters( + abiItemModel.getInputs(), + abiItemModel.contractMethodParameters + ).replace('0x', ''); + } catch (error) { + return error; } - return deployData + encodedParameters; - } + if (abiItemModel.signature === 'constructor') { + if (!deployData) { + return new Error( + 'The contract has no contract data option set. This is necessary to append the constructor parameters.' + ); + } - if (abiItemModel.isOfType('function')) { - return abiItemModel.signature + encodedParameters; - } + return deployData + encodedParameters; + } - return encodedParameters; -}; + if (abiItemModel.isOfType('function')) { + return abiItemModel.signature + encodedParameters; + } -module.exports = MethodEncoder; + return encodedParameters; + } +} diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index f34fa6d7049..2df4cbff403 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -22,316 +22,307 @@ "use strict"; -var ABIModel = require('../models/abi/ABIModel'); -var ABIItemModel = require('../models/abi/ABIItemModel'); -var MethodEncoder = require('../encoders/MethodEncoder'); -var EventFilterEncoder = require('../encoders/EventFilterEncoder'); -var AllEventsFilterEncoder = require('../encoders/AllEventsFilterEncoder'); -var CallMethodResponseDecoder = require('../decoders/CallMethodResponseDecoder'); -var EventLogDecoder = require('../decoders/EventLogDecoder'); -var AllEventsLogDecoder = require('../decoders/AllEventsLogDecoder'); -var ABIMapper = require('../mappers/ABIMapper'); -var RpcMethodOptionsMapper = require('../mappers/RpcMethodOptionsMapper'); -var EventOptionsMapper = require('../mappers/EventOptionsMapper'); -var AllEventsOptionsMapper = require('../mappers/AllEventsOptionsMapper'); -var MethodsProxy = require('../proxies/MethodsProxy'); -var EventSubscriptionsProxy = require('../proxies/EventSubscriptionsProxy'); -var RpcMethodOptionsValidator = require('../validators/RpcMethodOptionsValidator'); -var RpcMethodFactory = require('../factories/RpcMethodModelFactory'); -var EventSubscriptionFactory = require('../factories/EventSubscriptionFactory'); +import ABIModel from '../models/abi/ABIModel'; +import ABIItemModel from '../models/abi/ABIItemModel'; +import MethodEncoder from '../encoders/MethodEncoder'; +import EventFilterEncoder from '../encoders/EventFilterEncoder'; +import AllEventsFilterEncoder from '../encoders/AllEventsFilterEncoder'; +import CallMethodResponseDecoder from '../decoders/CallMethodResponseDecoder'; +import EventLogDecoder from '../decoders/EventLogDecoder'; +import AllEventsLogDecoder from '../decoders/AllEventsLogDecoder'; +import ABIMapper from '../mappers/ABIMapper'; +import RpcMethodOptionsMapper from '../mappers/RpcMethodOptionsMapper'; +import EventOptionsMapper from '../mappers/EventOptionsMapper'; +import AllEventsOptionsMapper from '../mappers/AllEventsOptionsMapper'; +import MethodsProxy from '../proxies/MethodsProxy'; +import EventSubscriptionsProxy from '../proxies/EventSubscriptionsProxy'; +import RpcMethodOptionsValidator from '../validators/RpcMethodOptionsValidator'; +import RpcMethodFactory from '../factories/RpcMethodModelFactory'; +import EventSubscriptionFactory from '../factories/EventSubscriptionFactory'; -/** - * @param {Object} utils - * @param {Object} formatters - * @param {ABICoder} abiCoder - * @param {Accounts} accounts - * - * @constructor - */ -function ContractPackageFactory(utils, formatters, abiCoder, accounts) { - this.utils = utils; - this.formatters = formatters; - this.abiCoder = abiCoder; - this.accounts = accounts; -} +export default class ContractPackageFactory { -/** - * Returns an object of type Contract - * - * @method createContract - * - * @param {*} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {PromiEventPackage} promiEventPackage - * @param {Object} abi - * @param {String} address - * @param {Object} options - * - * @returns {Contract} - */ -ContractPackageFactory.prototype.createContract = function ( - provider, - providersPackage, - methodController, - promiEventPackage, - abi, - address, - options -) { - return new Contract( + /** + * @param {Object} utils + * @param {Object} formatters + * @param {ABICoder} abiCoder + * @param {Accounts} accounts + * + * @constructor + */ + constructor(utils, formatters, abiCoder, accounts) { + this.utils = utils; + this.formatters = formatters; + this.abiCoder = abiCoder; + this.accounts = accounts; + } + + /** + * Returns an object of type Contract + * + * @method createContract + * + * @param {*} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {PromiEventPackage} promiEventPackage + * @param {Object} abi + * @param {String} address + * @param {Object} options + * + * @returns {Contract} + */ + createContract( provider, providersPackage, - new MethodController(), - this, + methodController, promiEventPackage, - this.abiCoder, - this.utils, - this.formatters, - this.accounts, - this.createABIMapper(), abi, address, options - ); -}; + ) { + return new Contract( + provider, + providersPackage, + new MethodController(), + this, + promiEventPackage, + this.abiCoder, + this.utils, + this.formatters, + this.accounts, + this.createABIMapper(), + abi, + address, + options + ); + } -/** - * Returns an object of type ABIModel - * - * @method createABIModel - * - * @param {Object} mappedAbi - * - * @returns {ABIModel} - */ -ContractPackageFactory.prototype.createABIModel = function (mappedAbi) { - return new ABIModel(mappedAbi); -}; + /** + * Returns an object of type ABIModel + * + * @method createABIModel + * + * @param {Object} mappedAbi + * + * @returns {ABIModel} + */ + createABIModel(mappedAbi) { + return new ABIModel(mappedAbi); + } -/** - * Returns an object of type ABIItemModel - * - * @method createABIItemModel - * - * @param {Object} abiItem - * - * @returns {ABIItemModel} - */ -ContractPackageFactory.prototype.createABIItemModel = function (abiItem) { - return new ABIItemModel(abiItem); -}; + /** + * Returns an object of type ABIItemModel + * + * @method createABIItemModel + * + * @param {Object} abiItem + * + * @returns {ABIItemModel} + */ + createABIItemModel(abiItem) { + return new ABIItemModel(abiItem); + } -/** - * Returns an object of type MethodEncoder - * - * @method createMethodEncoder - * - * @returns {MethodEncoder} - */ -ContractPackageFactory.prototype.createMethodEncoder = function () { - return new MethodEncoder(this.abiCoder); -}; + /** + * Returns an object of type MethodEncoder + * + * @method createMethodEncoder + * + * @returns {MethodEncoder} + */ + createMethodEncoder() { + return new MethodEncoder(this.abiCoder); + } -/** - * Returns an object of type EventFilterEncoder - * - * @method createEventFilterEncoder - * - * @returns {EventFilterEncoder} - */ -ContractPackageFactory.prototype.createEventFilterEncoder = function () { - return new EventFilterEncoder(this.abiCoder) -}; + /** + * Returns an object of type EventFilterEncoder + * + * @method createEventFilterEncoder + * + * @returns {EventFilterEncoder} + */ + createEventFilterEncoder() { + return new EventFilterEncoder(this.abiCoder) + } -/** - * Returns an object of type AllEventsFilterEncoder - * - * @method createAllEventsFilterEncoder - * - * @returns {AllEventsFilterEncoder} - */ -ContractPackageFactory.prototype.createAllEventsFilterEncoder = function () { - return new AllEventsFilterEncoder(this.abiCoder) -}; + /** + * Returns an object of type AllEventsFilterEncoder + * + * @method createAllEventsFilterEncoder + * + * @returns {AllEventsFilterEncoder} + */ + createAllEventsFilterEncoder() { + return new AllEventsFilterEncoder(this.abiCoder) + } -/** - * Returns an object oftype ABIMapper - * - * @method createABIMapper - * - * @returns {ABIMapper} - */ -ContractPackageFactory.prototype.createABIMapper = function () { - return new ABIMapper(this, this.abiCoder, this.utils); -}; + /** + * Returns an object oftype ABIMapper + * + * @method createABIMapper + * + * @returns {ABIMapper} + */ + createABIMapper() { + return new ABIMapper(this, this.abiCoder, this.utils); + } -/** - * Returns an object of type CallMethodResponseDecoder - * - * @method createCallMethodResponseDecoder - * - * @returns {CallMethodResponseDecoder} - */ -ContractPackageFactory.prototype.createCallMethodResponseDecoder = function () { - return new CallMethodResponseDecoder(this.abiCoder); -}; + /** + * Returns an object of type CallMethodResponseDecoder + * + * @method createCallMethodResponseDecoder + * + * @returns {CallMethodResponseDecoder} + */ + createCallMethodResponseDecoder() { + return new CallMethodResponseDecoder(this.abiCoder); + } -/** - * Returns an object of type EventLogDecoder - * - * @method createEventLogDecoder - * - * @returns {EventLogDecoder} - */ -ContractPackageFactory.prototype.createEventLogDecoder = function () { - return new EventLogDecoder(this.abiCoder, this.formatters); -}; + /** + * Returns an object of type EventLogDecoder + * + * @method createEventLogDecoder + * + * @returns {EventLogDecoder} + */ + createEventLogDecoder() { + return new EventLogDecoder(this.abiCoder, this.formatters); + } + /** + * Returns an object of type AllEventsLogDecoder + * + * @method createAllEventsLogDecoder + * + * @returns {AllEventsLogDecoder} + */ + createAllEventsLogDecoder() { + return new AllEventsLogDecoder(this.abiCoder, this.formatters); + } -/** - * Returns an object of type AllEventsLogDecoder - * - * @method createAllEventsLogDecoder - * - * @returns {AllEventsLogDecoder} - */ -ContractPackageFactory.prototype.createAllEventsLogDecoder = function () { - return new AllEventsLogDecoder(this.abiCoder, this.formatters); -}; + /** + * Returns an object of type RpcMethodOptionsValidator + * + * @method createRpcMethodOptionsValidator + * + * @returns {RpcMethodOptionsValidator} + */ + createRpcMethodOptionsValidator() { + return new RpcMethodOptionsValidator(this.utils); + } -/** - * Returns an object of type RpcMethodOptionsValidator - * - * @method createRpcMethodOptionsValidator - * - * @returns {RpcMethodOptionsValidator} - */ -ContractPackageFactory.prototype.createRpcMethodOptionsValidator = function () { - return new RpcMethodOptionsValidator(this.utils); -}; + /** + * Returns an object of type RpcMethodOptionsMapper + * + * @method createRpcMethodOptionsMapper + * + * @returns {RpcMethodOptionsMapper} + */ + createRpcMethodOptionsMapper() { + return new RpcMethodOptionsMapper(this.utils, this.formatters); + } -/** - * Returns an object of type RpcMethodOptionsMapper - * - * @method createRpcMethodOptionsMapper - * - * @returns {RpcMethodOptionsMapper} - */ -ContractPackageFactory.prototype.createRpcMethodOptionsMapper = function () { - return new RpcMethodOptionsMapper(this.utils, this.formatters); -}; - -/** - * Returns an object of type EventOptionsMapper - * - * @method createEventOptionsMapper - * - * @returns {EventOptionsMapper} - */ -ContractPackageFactory.prototype.createEventOptionsMapper = function () { - return new EventOptionsMapper(this.formatters, this.createEventFilterEncoder()); -}; - -/** - * Returns an object of type AllEventsOptionsMapper - * - * @method createAllEventsOptionsMapper - * - * @returns {AllEventsOptionsMapper} - */ -ContractPackageFactory.prototype.createAllEventsOptionsMapper = function () { - return new AllEventsOptionsMapper(this.formatters, this.createAllEventsFilterEncoder()); -}; + /** + * Returns an object of type EventOptionsMapper + * + * @method createEventOptionsMapper + * + * @returns {EventOptionsMapper} + */ + createEventOptionsMapper() { + return new EventOptionsMapper(this.formatters, this.createEventFilterEncoder()); + } -/** - * Returns an object of type RpcMethodModelFactory - * - * @method createRpcMethodModelFactory - * - * @returns {RpcMethodModelFactory} - */ -ContractPackageFactory.prototype.createRpcMethodModelFactory = function () { - return new RpcMethodFactory( - this.createCallMethodResponseDecoder(), - this.accounts, - this.utils, - this.formatters - ); -}; + /** + * Returns an object of type AllEventsOptionsMapper + * + * @method createAllEventsOptionsMapper + * + * @returns {AllEventsOptionsMapper} + */ + createAllEventsOptionsMapper() { + return new AllEventsOptionsMapper(this.formatters, this.createAllEventsFilterEncoder()); + } -/** - * Returns an object of type MethodsProxy - * - * @method createMethodsProxy - * - * @param {Contract} contract - * @param {ABIModel} abiModel - * @param {MethodController} methodController - * @param {PromiEventPackage} promiEventPackage - * - * @returns {MethodsProxy} - */ -ContractPackageFactory.prototype.createMethodsProxy = function ( - contract, - abiModel, - methodController, - promiEventPackage -) { - return new MethodsProxy( - contract, - abiModel, - this.createRpcMethodModelFactory(), - methodController, - this.createMethodEncoder(), - this.createRpcMethodOptionsValidator(), - this.createRpcMethodOptionsMapper(), - promiEventPackage - ); -}; + /** + * Returns an object of type RpcMethodModelFactory + * + * @method createRpcMethodModelFactory + * + * @returns {RpcMethodModelFactory} + */ + createRpcMethodModelFactory() { + return new RpcMethodFactory( + this.createCallMethodResponseDecoder(), + this.accounts, + this.utils, + this.formatters + ); + } -/** - * Returns an object of type EventSubscriptionsProxy - * - * @method createEventSubscriptionsProxy - * - * @param {Contract} contract - * @param {ABIModel} abiModel - * @param {MethodController} methodController - * - * @returns {EventSubscriptionsProxy} - */ -ContractPackageFactory.prototype.createEventSubscriptionsProxy = function ( - contract, - abiModel, - methodController -) { - new EventSubscriptionsProxy( - contract, - abiModel, - this.createEventSubscriptionFactory(methodController), - this.createEventOptionsMapper(), - this.createEventLogDecoder(), - this.createAllEventsLogDecoder(), - this.createAllEventsOptionsMapper() - ); -}; + /** + * Returns an object of type MethodsProxy + * + * @method createMethodsProxy + * + * @param {Contract} contract + * @param {ABIModel} abiModel + * @param {MethodController} methodController + * @param {PromiEventPackage} promiEventPackage + * + * @returns {MethodsProxy} + */ + createMethodsProxy(contract, abiModel, methodController, promiEventPackage) { + return new MethodsProxy( + contract, + abiModel, + this.createRpcMethodModelFactory(), + methodController, + this.createMethodEncoder(), + this.createRpcMethodOptionsValidator(), + this.createRpcMethodOptionsMapper(), + promiEventPackage + ); + } -/** - * Returns an object of type EventSubscriptionFactory - * - * @method createEventSubscriptionFactory - * - * @param {MethodController} methodController - * - * @returns {EventSubscriptionFactory} - */ -ContractPackageFactory.prototype.createEventSubscriptionFactory = function (methodController) { - new EventSubscriptionFactory( - this.utils, - this.formatters, - methodController - ); -}; + /** + * Returns an object of type EventSubscriptionsProxy + * + * @method createEventSubscriptionsProxy + * + * @param {Contract} contract + * @param {ABIModel} abiModel + * @param {MethodController} methodController + * + * @returns {EventSubscriptionsProxy} + */ + createEventSubscriptionsProxy(contract, abiModel, methodController) { + new EventSubscriptionsProxy( + contract, + abiModel, + this.createEventSubscriptionFactory(methodController), + this.createEventOptionsMapper(), + this.createEventLogDecoder(), + this.createAllEventsLogDecoder(), + this.createAllEventsOptionsMapper() + ); + } -module.exports = ContractPackageFactory; + /** + * Returns an object of type EventSubscriptionFactory + * + * @method createEventSubscriptionFactory + * + * @param {MethodController} methodController + * + * @returns {EventSubscriptionFactory} + */ + createEventSubscriptionFactory(methodController) { + new EventSubscriptionFactory( + this.utils, + this.formatters, + methodController + ); + } +} diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js index 840a5f5b49d..161c3c981d1 100644 --- a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js @@ -22,66 +22,67 @@ "use strict"; -var Subscription = require('web3-core-subscriptions').Subscription; -var GetPastLogsMethodModel = require('web3-core-method').GetPastLogsMethodModel; -var EventLogSubscription = require('../models/subscriptions/EventLogSubscription'); -var AllEventsLogSubscription = require('../models/subscriptions/AllEventsLogSubscription'); +import {Subscription} from 'web3-core-subscriptions'; +import {GetPastLogsMethodModel} from 'web3-core-method'; +import EventLogSubscription from '../models/subscriptions/EventLogSubscription'; +import AllEventsLogSubscription from '../models/subscriptions/AllEventsLogSubscription'; -/** - * @param {Object} utils - * @param {Object} formatters - * @param {MethodController} methodController - * - * @constructor - */ -function EventSubscriptionFactory(utils, formatters, methodController) { - this.methodController = methodController; -} +export default class EventSubscriptionFactory { -/** - * Returns an event log subscription - * - * @param {EventLogDecoder} eventLogDecoder - * @param {ABIItemModel} abiItemModel - * @param {AbstractWeb3Module} moduleInstance - * @param {Object} options - * - * @returns {Subscription} - */ -EventSubscriptionFactory.prototype.createEventLogSubscription = function (eventLogDecoder, abiItemModel, moduleInstance, options) { - return new Subscription(moduleInstance, - new EventLogSubscription( - abiItemModel, - options, - this.utils, - this.formatters, - new GetPastLogsMethodModel(this.utils, this.formatters), - this.methodController, - eventLogDecoder - ) - ); -}; + /** + * @param {Object} utils + * @param {Object} formatters + * @param {MethodController} methodController + * + * @constructor + */ + constructor(utils, formatters, methodController) { + this.methodController = methodController; + } -/** - * Returns an log subscription for all events - * - * @param {AllEventsLogDecoder} allEventsLogDecoder - * @param {AbstractWeb3Module} moduleInstance - * @param {Object} options - * - * @returns {Subscription} - */ -EventSubscriptionFactory.prototype.createAllEventLogSubscription = function (allEventsLogDecoder, moduleInstance, options) { - return new Subscription(moduleInstance, - new AllEventsLogSubscription( - options, - this.utils, - this.formatters, - new GetPastLogsMethodModel(this.utils, this.formatters), - this.methodController, - allEventsLogDecoder - ) - ); -}; + /** + * Returns an event log subscription + * + * @param {EventLogDecoder} eventLogDecoder + * @param {ABIItemModel} abiItemModel + * @param {AbstractWeb3Module} moduleInstance + * @param {Object} options + * + * @returns {Subscription} + */ + createEventLogSubscription(eventLogDecoder, abiItemModel, moduleInstance, options) { + return new Subscription(moduleInstance, + new EventLogSubscription( + abiItemModel, + options, + this.utils, + this.formatters, + new GetPastLogsMethodModel(this.utils, this.formatters), + this.methodController, + eventLogDecoder + ) + ); + } -module.exports = EventSubscriptionFactory; + /** + * Returns an log subscription for all events + * + * @param {AllEventsLogDecoder} allEventsLogDecoder + * @param {AbstractWeb3Module} moduleInstance + * @param {Object} options + * + * @returns {Subscription} + */ + createAllEventLogSubscription(allEventsLogDecoder, moduleInstance, options) { + return new Subscription(moduleInstance, + new AllEventsLogSubscription( + options, + this.utils, + this.formatters, + new GetPastLogsMethodModel(this.utils, this.formatters), + this.methodController, + allEventsLogDecoder + ) + ); + } +} diff --git a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js index ffbd835996e..47768dd43c1 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js @@ -22,134 +22,135 @@ "use strict"; -var CallContractMethodModel = require('../models/methods/CallContractMethodModel'); -var ContractDeployMethodModel = require('../models/methods/ContractDeployMethodModel'); -var PastEventLogsMethodModel = require('../models/methods/PastEventLogsMethodModel'); -var SendContractMethodModel = require('../models/methods/SendContractMethodModel'); -var EstimateGasMethodModel = require('web3-core-method').EstimateGasMethodModel; - -/** - * @param {CallMethodResponseDecoder} callMethodResponseDecoder - * @param {Accounts} accounts - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function RpcMethodModelFactory(callMethodResponseDecoder, accounts, utils, formatters) { - this.utils = utils; - this.formatters = formatters; - this.callMethodResponseDecoder = callMethodResponseDecoder; - this.accounts = accounts; -} - -/** - * Returns the correct JSON-RPC MethodModel - * - * @method createRpcMethod - * - * @param {ABIItemModel} abiItemModel - * @param {Contract} contract - * - * @returns {AbstractMethodModel} - */ -RpcMethodModelFactory.prototype.createRpcMethodByRequestType = function (abiItemModel, contract) { - var rpcMethod; - - switch (abiItemModel.requestType) { - case 'call': - rpcMethod = this.createCallContractMethodModel(abiItemModel); - break; - case 'send' : - rpcMethod = this.createSendContractMethodModel(abiItemModel); - break; - case 'estimate': - rpcMethod = this.createEstimateGasMethodModel(); - break; - case 'contract-deployment': - rpcMethod = this.createContractDeployMethodModel(contract); - break; +import CallContractMethodModel from '../models/methods/CallContractMethodModel'; +import ContractDeployMethodModel from '../models/methods/ContractDeployMethodModel'; +import PastEventLogsMethodModel from '../models/methods/PastEventLogsMethodModel'; +import SendContractMethodModel from '../models/methods/SendContractMethodModel'; +import {EstimateGasMethodModel} from 'web3-core-method'; + +export default class RpcMethodModelFactory { + + /** + * @param {CallMethodResponseDecoder} callMethodResponseDecoder + * @param {Accounts} accounts + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(callMethodResponseDecoder, accounts, utils, formatters) { + this.utils = utils; + this.formatters = formatters; + this.callMethodResponseDecoder = callMethodResponseDecoder; + this.accounts = accounts; } - if (typeof rpcMethod === 'undefined') { - throw Error('Unknown RPC call with requestType "' + abiItemModel.requestType + '"'); + /** + * Returns the correct JSON-RPC MethodModel + * + * @method createRpcMethod + * + * @param {ABIItemModel} abiItemModel + * @param {Contract} contract + * + * @returns {AbstractMethodModel} + */ + createRpcMethodByRequestType(abiItemModel, contract) { + let rpcMethod; + + switch (abiItemModel.requestType) { + case 'call': + rpcMethod = this.createCallContractMethodModel(abiItemModel); + break; + case 'send' : + rpcMethod = this.createSendContractMethodModel(abiItemModel); + break; + case 'estimate': + rpcMethod = this.createEstimateGasMethodModel(); + break; + case 'contract-deployment': + rpcMethod = this.createContractDeployMethodModel(contract); + break; + } + + if (typeof rpcMethod === 'undefined') { + throw Error(`Unknown RPC call with requestType "${abiItemModel.requestType}"`); + } + + return rpcMethod; } - return rpcMethod; -}; - -/** - * Returns an object of type PastEventLogsMethodModel - * - * @method createPastEventLogsMethodModel - * - * @param {ABIItemModel} abiItemModel - * - * @returns {PastEventLogsMethodModel} - */ -RpcMethodModelFactory.prototype.createPastEventLogsMethodModel = function (abiItemModel) { - return new PastEventLogsMethodModel(abiItemModel, this.utils, this.formatters); -}; - -/** - * Returns an object of type CallContractMethodModel - * - * @method createCallContractMethodModel - * - * @param {ABIItemModel} abiItemModel - * - * @returns {CallContractMethodModel} - */ -RpcMethodModelFactory.prototype.createCallContractMethodModel = function (abiItemModel) { - return new CallContractMethodModel( - abiItemModel, - this.callMethodResponseDecoder, - this.utils, - this.formatters - ); -}; + /** + * Returns an object of type PastEventLogsMethodModel + * + * @method createPastEventLogsMethodModel + * + * @param {ABIItemModel} abiItemModel + * + * @returns {PastEventLogsMethodModel} + */ + createPastEventLogsMethodModel(abiItemModel) { + return new PastEventLogsMethodModel(abiItemModel, this.utils, this.formatters); + } -/** - * Returns an object of type SendContractMethodModel - * - * @method createSendContractMethodModel - * - * @param {ABIItemModel} abiItemModel - * - * @returns {SendContractMethodModel} - */ -RpcMethodModelFactory.prototype.createSendContractMethodModel = function (abiItemModel) { - return new SendContractMethodModel( - abiItemModel, - this.allEventsLogDecoder, - this.utils, - this.formatters, - this.accounts - ); -}; + /** + * Returns an object of type CallContractMethodModel + * + * @method createCallContractMethodModel + * + * @param {ABIItemModel} abiItemModel + * + * @returns {CallContractMethodModel} + */ + createCallContractMethodModel(abiItemModel) { + return new CallContractMethodModel( + abiItemModel, + this.callMethodResponseDecoder, + this.utils, + this.formatters + ); + } -/** - * Returns an object of type ContractDeployMethodModel - * - * @method createContractDeployMethodModel - * - * @param {Contract} contract - * - * @returns {ContractDeployMethodModel} - */ -RpcMethodModelFactory.prototype.createContractDeployMethodModel = function (contract) { - return new ContractDeployMethodModel(contract, this.utils, this.formatters, this.accounts); -}; + /** + * Returns an object of type SendContractMethodModel + * + * @method createSendContractMethodModel + * + * @param {ABIItemModel} abiItemModel + * + * @returns {SendContractMethodModel} + */ + createSendContractMethodModel(abiItemModel) { + return new SendContractMethodModel( + abiItemModel, + this.allEventsLogDecoder, + this.utils, + this.formatters, + this.accounts + ); + } -/** - * Returns an object of type EstimateGasMethodModel - * - * @method createEstimateGasMethodModel - * - * @returns {EstimateGasMethodModel} - */ -RpcMethodModelFactory.prototype.createEstimateGasMethodModel = function () { - return new EstimateGasMethodModel(this.utils, this.formatters) -}; + /** + * Returns an object of type ContractDeployMethodModel + * + * @method createContractDeployMethodModel + * + * @param {Contract} contract + * + * @returns {ContractDeployMethodModel} + */ + createContractDeployMethodModel(contract) { + return new ContractDeployMethodModel(contract, this.utils, this.formatters, this.accounts); + } -module.exports = RpcMethodModelFactory; + /** + * Returns an object of type EstimateGasMethodModel + * + * @method createEstimateGasMethodModel + * + * @returns {EstimateGasMethodModel} + */ + createEstimateGasMethodModel() { + return new EstimateGasMethodModel(this.utils, this.formatters) + } +} diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index f48da9eed88..b90158b299d 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -22,21 +22,20 @@ "use strict"; -var version = require('../package.json').version; -var PromiEventPackage = require('web3-core-promievent'); -var MethodController = require('web3-core-method').MethodController; -var ProvidersPackage = require('web3-providers'); -var formatters = require('web3-core-helpers').formatters; -var Utils = require('web3-utils'); -var AbiCoder = require('web3-eth-abi').AbiCoder; -var Contract = require('./Contract'); -var ContractDeployMethodModel = require('./models/methods/ContractDeployMethodModel'); -var ContractPackageFactory = require('./factories/ContractPackageFactory'); +import {version} from '../package.json'; +import PromiEventPackage from 'web3-core-promievent'; +import {MethodController} from 'web3-core-method'; +import ProvidersPackage from 'web3-providers'; +import {formatters} from 'web3-core-helpers'; +import Utils from 'web3-utils'; +import {AbiCoder} from 'web3-eth-abi'; +import Contract from './Contract'; +import ContractDeployMethodModel from './models/methods/ContractDeployMethodModel'; +import ContractPackageFactory from './factories/ContractPackageFactory'; -module.exports = { - version: version, - - ContractDeployMethodModel: ContractDeployMethodModel, +export default { + version, + ContractDeployMethodModel, /** * Returns an object of type Contract @@ -51,7 +50,7 @@ module.exports = { * * @returns {Contract} */ - Contract: function (provider, accounts, abi, address, options) { + Contract: (provider, accounts, abi, address, options) => { return new ContractPackageFactory( Utils, formatters, diff --git a/packages/web3-eth-contract/src/mappers/ABIMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js index 019a8941689..e43c3c8d171 100644 --- a/packages/web3-eth-contract/src/mappers/ABIMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -22,115 +22,116 @@ "use strict"; -/** - * @param {ContractPackageFactory} contractPackageFactory - * @param {ABICoder} abiCoder - * @param {Object} utils - * - * @constructor - */ -function ABIMapper(contractPackageFactory, abiCoder, utils) { - this.utils = utils; - this.abiCoder = abiCoder; - this.contractPackageFactory = contractPackageFactory; -} - -/** - * Maps the abi to an object of methods and events as AbiItemModel - * - * @param {Array} abi - * - * @returns {ABIModel} - */ -ABIMapper.prototype.map = function (abi) { - var self = this; - var mappedAbiItems = { - methods: {}, - events: {} - }; - - abi.forEach(function (abiItem) { - abiItem.constant = self.isConstant(abiItem); - abiItem.payable = self.isPayable(abiItem); - - if (abiItem.name) { - abiItem.funcName = self.utils._jsonInterfaceMethodToString(abiItem); - } - - var abiItemModel; - - if (abiItem.type === 'function') { - abiItem.signature = self.abiCoder.encodeFunctionSignature(abiItem.funcName); - - abiItemModel = self.contractPackageFactory.createABIItemModel(abiItem); - - // Check if an method already exists with this name and if it exists than create an array and push this abiItem - // into it. This will be used if there are methods with the same name but with different arguments. - if (!mappedAbiItems.methods[abiItem.name]) { - mappedAbiItems.methods[abiItem.name] = abiItemModel; - } else { - if (_.isArray(mappedAbiItems.methods[abiItem.name])) { - mappedAbiItems.methods[abiItem.name].push(abiItemModel); - } else { - mappedAbiItems.methods[abiItem.name] = [ - mappedAbiItems.methods[abiItem.name], - abiItemModel - ]; - } +export default class ABIMapper { + + /** + * @param {ContractPackageFactory} contractPackageFactory + * @param {ABICoder} abiCoder + * @param {Object} utils + * + * @constructor + */ + constructor(contractPackageFactory, abiCoder, utils) { + this.utils = utils; + this.abiCoder = abiCoder; + this.contractPackageFactory = contractPackageFactory; + } + + /** + * Maps the abi to an object of methods and events as AbiItemModel + * + * @param {Array} abi + * + * @returns {ABIModel} + */ + map(abi) { + const self = this; + const mappedAbiItems = { + methods: {}, + events: {} + }; + + abi.forEach(abiItem => { + abiItem.constant = self.isConstant(abiItem); + abiItem.payable = self.isPayable(abiItem); + + if (abiItem.name) { + abiItem.funcName = self.utils._jsonInterfaceMethodToString(abiItem); } - mappedAbiItems.methods[abiItem.signature] = abiItemModel; - mappedAbiItems.methods[abiItem.funcName] = abiItemModel; + let abiItemModel; - return; - } + if (abiItem.type === 'function') { + abiItem.signature = self.abiCoder.encodeFunctionSignature(abiItem.funcName); - if (abiItem.type === 'event') { - abiItem.signature = self.abiCoder.encodeEventSignature(abiItem.funcName); + abiItemModel = self.contractPackageFactory.createABIItemModel(abiItem); + + // Check if an method already exists with this name and if it exists than create an array and push this abiItem + // into it. This will be used if there are methods with the same name but with different arguments. + if (!mappedAbiItems.methods[abiItem.name]) { + mappedAbiItems.methods[abiItem.name] = abiItemModel; + } else { + if (_.isArray(mappedAbiItems.methods[abiItem.name])) { + mappedAbiItems.methods[abiItem.name].push(abiItemModel); + } else { + mappedAbiItems.methods[abiItem.name] = [ + mappedAbiItems.methods[abiItem.name], + abiItemModel + ]; + } + } - abiItem = self.contractPackageFactory.createABIItemModel(event); + mappedAbiItems.methods[abiItem.signature] = abiItemModel; + mappedAbiItems.methods[abiItem.funcName] = abiItemModel; - if (!mappedAbiItems.events[abiItem.name] || mappedAbiItems.events[abiItem.name].name === 'bound ') { - mappedAbiItems.events[abiItem.name] = abiItemModel; + return; } - mappedAbiItems.events[abiItem.signature] = abiItemModel; - mappedAbiItems.events[abiItem.funcName] = abiItemModel; - } - - if (abiItem.type === 'constructor') { - abiItem.signature = abiItem.type; - mappedAbiItems.methods['contractConstructor'] = self.contractPackageFactory.createABIItemModel(abiItem); - } - }); + if (abiItem.type === 'event') { + abiItem.signature = self.abiCoder.encodeEventSignature(abiItem.funcName); - return this.contractPackageFactory.createABIModel(mappedAbiItems); -}; + abiItem = self.contractPackageFactory.createABIItemModel(event); -/** - * Checks if the given abiItem is a constant - * - * @method isConstant - * - * @param {Object} abiItem - * - * @returns {Boolean} - */ -ABIMapper.prototype.isConstant = function (abiItem) { - return (abiItem.stateMutability === "view" || abiItem.stateMutability === "pure" || abiItem.constant); -}; + if (!mappedAbiItems.events[abiItem.name] || mappedAbiItems.events[abiItem.name].name === 'bound ') { + mappedAbiItems.events[abiItem.name] = abiItemModel; + } -/** - * Checks if the given abiItem is payable - * - * @method isPayable - * - * @param {Object} abiItem - * - * @returns {Boolean} - */ -ABIMapper.prototype.isPayable = function (abiItem) { - return (abiItem.stateMutability === "payable" || abiItem.payable); -}; + mappedAbiItems.events[abiItem.signature] = abiItemModel; + mappedAbiItems.events[abiItem.funcName] = abiItemModel; + } -module.exports = ABIMapper; + if (abiItem.type === 'constructor') { + abiItem.signature = abiItem.type; + mappedAbiItems.methods['contractConstructor'] = self.contractPackageFactory.createABIItemModel(abiItem); + } + }); + + return this.contractPackageFactory.createABIModel(mappedAbiItems); + } + + /** + * Checks if the given abiItem is a constant + * + * @method isConstant + * + * @param {Object} abiItem + * + * @returns {Boolean} + */ + isConstant(abiItem) { + return (abiItem.stateMutability === "view" || abiItem.stateMutability === "pure" || abiItem.constant); + } + + /** + * Checks if the given abiItem is payable + * + * @method isPayable + * + * @param {Object} abiItem + * + * @returns {Boolean} + */ + isPayable(abiItem) { + return (abiItem.stateMutability === "payable" || abiItem.payable); + } +} diff --git a/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js b/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js index bd0e7c7dd8b..8ccd9332558 100644 --- a/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js @@ -22,44 +22,45 @@ "use strict"; -/** - * @param {Object} formatters - * @param {AllEventsFilterEncoder} allEventsFilterEncoder - * - * @constructor - */ -function AllEventsOptionsMapper(formatters, allEventsFilterEncoder) { - this.formatters = formatters; - this.allEventsFilterEncoder = allEventsFilterEncoder; -} - -/** - * @param {ABIModel} abiModel - * @param {Contract} contract - * @param {Object} options - * - * @returns {Object} - */ -AllEventsOptionsMapper.prototype.map = function (abiModel, contract, options) { - options.topics = []; +export default class AllEventsOptionsMapper { - if (typeof options.fromBlock !== 'undefined') { - options.fromBlock = this.formatters.inputBlockNumberFormatter(options.fromBlock); + /** + * @param {Object} formatters + * @param {AllEventsFilterEncoder} allEventsFilterEncoder + * + * @constructor + */ + constructor(formatters, allEventsFilterEncoder) { + this.formatters = formatters; + this.allEventsFilterEncoder = allEventsFilterEncoder; } - if (typeof options.toBlock !== 'undefined') { - options.toBlock = this.formatters.inputBlockNumberFormatter(options.toBlock); - } + /** + * @param {ABIModel} abiModel + * @param {Contract} contract + * @param {Object} options + * + * @returns {Object} + */ + map(abiModel, contract, options) { + options.topics = []; - if (typeof options.filters !== 'undefined') { - options.topics.concat(this.allEventsFilterEncoder.encode(abiModel, options.filter)); - } + if (typeof options.fromBlock !== 'undefined') { + options.fromBlock = this.formatters.inputBlockNumberFormatter(options.fromBlock); + } - if (!options.address) { - options.address = contract.options.address; - } + if (typeof options.toBlock !== 'undefined') { + options.toBlock = this.formatters.inputBlockNumberFormatter(options.toBlock); + } - return options; -}; + if (typeof options.filters !== 'undefined') { + options.topics.concat(this.allEventsFilterEncoder.encode(abiModel, options.filter)); + } -module.exports = AllEventsOptionsMapper; + if (!options.address) { + options.address = contract.options.address; + } + + return options; + } +} diff --git a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js index 7ae894e407a..f19d51f6413 100644 --- a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js @@ -22,50 +22,51 @@ "use strict"; -/** - * @param {Object} formatters - * @param {EventFilterEncoder} eventFilterEncoder - * - * @constructor - */ -function EventOptionsMapper(formatters, eventFilterEncoder) { - this.formatters = formatters; - this.eventFilterEncoder = eventFilterEncoder; -} +export default class EventOptionsMapper { -/** - * @param {ABIItemModel} abiItemModel - * @param {Contract} contract - * @param {Object} options - * - * @returns {Object} - */ -EventOptionsMapper.prototype.map = function (abiItemModel, contract, options) { - if (typeof options.topics === 'undefined') { - options.topics = []; + /** + * @param {Object} formatters + * @param {EventFilterEncoder} eventFilterEncoder + * + * @constructor + */ + constructor(formatters, eventFilterEncoder) { + this.formatters = formatters; + this.eventFilterEncoder = eventFilterEncoder; } - if (typeof options.fromBlock !== 'undefined') { - options.fromBlock = this.formatters.inputBlockNumberFormatter(options.fromBlock); - } + /** + * @param {ABIItemModel} abiItemModel + * @param {Contract} contract + * @param {Object} options + * + * @returns {Object} + */ + map(abiItemModel, contract, options) { + if (typeof options.topics === 'undefined') { + options.topics = []; + } - if (typeof options.toBlock !== 'undefined') { - options.toBlock = this.formatters.inputBlockNumberFormatter(options.toBlock); - } + if (typeof options.fromBlock !== 'undefined') { + options.fromBlock = this.formatters.inputBlockNumberFormatter(options.fromBlock); + } - if (!abiItemModel.anonymous) { - options.topics.unshift(abiItemModel.signature); - } + if (typeof options.toBlock !== 'undefined') { + options.toBlock = this.formatters.inputBlockNumberFormatter(options.toBlock); + } - if (typeof options.filters !== 'undefined') { - options.topics.concat(this.eventFilterEncoder.encode(abiItemModel, options.filter)); - } + if (!abiItemModel.anonymous) { + options.topics.unshift(abiItemModel.signature); + } - if (!options.address) { - options.address = contract.options.address; - } + if (typeof options.filters !== 'undefined') { + options.topics.concat(this.eventFilterEncoder.encode(abiItemModel, options.filter)); + } - return options; -}; + if (!options.address) { + options.address = contract.options.address; + } -module.exports = EventOptionsMapper; + return options; + } +} diff --git a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js index 3bb78a835f6..dccc41c3158 100644 --- a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js @@ -22,45 +22,45 @@ "use strict"; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function RpcMethodOptionsMapper(utils, formatters) { - this.utils = utils; - this.formatters = formatters; -} - -/** - * Sets the default options where it is required - * - * @param {Contract} contract - * @param {Object} options - * - * @returns {Object} - */ -RpcMethodOptionsMapper.prototype.map = function (contract, options) { - var gasPrice = null; - if (options.gasPrice) { - gasPrice = String(options.gasPrice); +export default class RpcMethodOptionsMapper { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + this.utils = utils; + this.formatters = formatters; } - var from = null; - if (options.from) { - from = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(options.from)) - } + /** + * Sets the default options where it is required + * + * @param {Contract} contract + * @param {Object} options + * + * @returns {Object} + */ + map(contract, options) { + let gasPrice = null; + if (options.gasPrice) { + gasPrice = String(options.gasPrice); + } - options.data = options.data || contract.options.data; + let from = null; + if (options.from) { + from = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(options.from)) + } - options.from = from || contract.defaultAccount; - options.gasPrice = gasPrice || contract.options.gasPrice; - options.gas = options.gas || options.gasLimit || contract.options.gas; + options.data = options.data || contract.options.data; - delete options.gasLimit; + options.from = from || contract.defaultAccount; + options.gasPrice = gasPrice || contract.options.gasPrice; + options.gas = options.gas || options.gasLimit || contract.options.gas; - return options; -}; + delete options.gasLimit; -module.exports = RpcMethodOptionsMapper; + return options; + } +} diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index 44eb4858156..c3b64fa3819 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -22,109 +22,109 @@ "use strict"; -var _ = require('underscore'); - -/** - * @param {Object} abiItem - * - * @constructor - */ -function ABIItemModel(abiItem) { - this.abiItem = abiItem; - this.signature = this.abiItem.signature; - this.name = this.abiItem.name; - this.anonymous = this.abiItem.anonymous; - this.contractMethodParameters = []; - - Object.defineProperty(this, 'requestType', { - get: function () { - if (abiItem.type === 'function') { - if (abiItem.constant === true) { - return 'call'; +import _ from 'underscore'; + +export default class ABIItemModel { + + /** + * @param {Object} abiItem + * + * @constructor + */ + constructor(abiItem) { + this.abiItem = abiItem; + this.signature = this.abiItem.signature; + this.name = this.abiItem.name; + this.anonymous = this.abiItem.anonymous; + this.contractMethodParameters = []; + + Object.defineProperty(this, 'requestType', { + get() { + if (abiItem.type === 'function') { + if (abiItem.constant === true) { + return 'call'; + } + + return 'send'; } - return 'send'; + if (abiItem.type === 'constructor') { + return 'contract-deployment'; + } } + }) + } - if (abiItem.type === 'constructor') { - return 'contract-deployment'; - } + /** + * Returns the input length of the abiItem + * + * @method getInputLength + * + * @returns {Number} + */ + getInputLength() { + if (_.isArray(this.abiItem.inputs)) { + return this.abiItem.inputs.length; } - }) -} -/** - * Returns the input length of the abiItem - * - * @method getInputLength - * - * @returns {Number} - */ -ABIItemModel.prototype.getInputLength = function () { - if (_.isArray(this.abiItem.inputs)) { - return this.abiItem.inputs.length; + return 0; } - return 0; -}; - -/** - * Returns all inputs of the abi item - * - * @method getInputs - * - * @returns {Array} - */ -ABIItemModel.prototype.getInputs = function () { - var inputs = []; + /** + * Returns all inputs of the abi item + * + * @method getInputs + * + * @returns {Array} + */ + getInputs() { + let inputs = []; + + if (_.isArray(this.abiItem.inputs)) { + inputs = this.abiItem.inputs; + } - if (_.isArray(this.abiItem.inputs)) { - inputs = this.abiItem.inputs; + return inputs; } - return inputs; -}; - -/** - * Checks if the given parameter array length matches the abiItem inputs length - * - * @method givenParametersLengthIsValid - * - * @returns {Error|Boolean} - */ -ABIItemModel.prototype.givenParametersLengthIsValid = function () { - var inputLength = this.getInputLength(); + /** + * Checks if the given parameter array length matches the abiItem inputs length + * + * @method givenParametersLengthIsValid + * + * @returns {Error|Boolean} + */ + givenParametersLengthIsValid() { + const inputLength = this.getInputLength(); + + if (this.contractMethodParameters.length === inputLength) { + return true; + } - if (this.contractMethodParameters.length === inputLength) { - return true; + return new Error( + `The number of arguments is not matching the methods required number. You need to pass ${inputLength} arguments.` + ); } - return new Error( - 'The number of arguments is not matching the methods required number. You need to pass ' - + inputLength + ' arguments.' - ); -}; - -/** - * Returns the indexed input of this abiItem - * - * @returns {Array} - */ -ABIItemModel.prototype.getIndexedInputs = function () { - return this.getInputs().filter(function (input) { - return input.indexed === true; - }); -}; - -/** - * Checks the type of this abiItem - * - * @method isOfType - * - * @returns {Boolean} - */ -ABIItemModel.prototype.isOfType = function (type) { - return this.abiItem.type === type; -}; + /** + * Returns the indexed input of this abiItem + * + * @returns {Array} + */ + getIndexedInputs() { + return this.getInputs().filter(input => { + return input.indexed === true; + }); + } -module.exports = ABIItemModel; + /** + * Checks the type of this abiItem + * + * @method isOfType + * + * @returns {Boolean} + */ + isOfType(type) { + return this.abiItem.type === type; + } +} diff --git a/packages/web3-eth-contract/src/models/abi/ABIModel.js b/packages/web3-eth-contract/src/models/abi/ABIModel.js index b5f5d273a45..0f41e0e0ac2 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIModel.js @@ -22,101 +22,100 @@ "use strict"; -var _ = require('underscore'); +export default class ABIModel { -/** - * @param {Object} mappedAbi - * - * @constructor - */ -function ABIModel(mappedAbi) { - this.abi = mappedAbi; -} - -/** - * Checks if the method exists and returns it otherwise it will return false - * - * @method getMethod - * - * @param {String} name - * - * @returns {ABIItemModel|Boolean} - */ -ABIModel.prototype.getMethod = function (name) { - if (this.hasMethod(name)) { - return this.abi.methods[name]; + /** + * @param {Object} mappedAbi + * + * @constructor + */ + constructor(mappedAbi) { + this.abi = mappedAbi; } - return false; -}; + /** + * Checks if the method exists and returns it otherwise it will return false + * + * @method getMethod + * + * @param {String} name + * + * @returns {ABIItemModel|Boolean} + */ + getMethod(name) { + if (this.hasMethod(name)) { + return this.abi.methods[name]; + } -/** - * Checks if the event exists and returns it otherwise it will return false - * - * @method getEvent - * - * @param {String} name - * - * @returns {ABIItemModel|Boolean} - */ -ABIModel.prototype.getEvent = function (name) { - if (this.hasEvent(name)) { - return this.abi.events[name]; + return false; } - return false; -}; + /** + * Checks if the event exists and returns it otherwise it will return false + * + * @method getEvent + * + * @param {String} name + * + * @returns {ABIItemModel|Boolean} + */ + getEvent(name) { + if (this.hasEvent(name)) { + return this.abi.events[name]; + } -/** - * Returns all events from this ABIModel - * - * @method getEvents - * - * @returns {Object} - */ -ABIModel.prototype.getEvents = function () { - return this.abi.events; -}; + return false; + } -/** - * Returns an event by his signature - * - * @method getEventBySignature - * - * @param {String} signature - * - * @returns {ABIItemModel} - */ -ABIModel.prototype.getEventBySignature = function (signature) { - return this.abi.events.find(function (event) { - return event.signature === signature; - }); -}; + /** + * Returns all events from this ABIModel + * + * @method getEvents + * + * @returns {Object} + */ + getEvents() { + return this.abi.events; + } -/** - * Checks if the method exists - * - * @method hasMethod - * - * @param name - * - * @returns {Boolean} - */ -ABIModel.prototype.hasMethod = function (name) { - return typeof this.abi.methods[name] !== 'undefined'; -}; + /** + * Returns an event by his signature + * + * @method getEventBySignature + * + * @param {String} signature + * + * @returns {ABIItemModel} + */ + getEventBySignature(signature) { + return this.abi.events.find(event => { + return event.signature === signature; + }); + } -/** - * Checks if the event exists - * - * @method hasEvent - * - * @param name - * - * @returns {Boolean} - */ -ABIModel.prototype.hasEvent = function (name) { - return typeof this.abi.events[name] !== 'undefined'; -}; + /** + * Checks if the method exists + * + * @method hasMethod + * + * @param name + * + * @returns {Boolean} + */ + hasMethod(name) { + return typeof this.abi.methods[name] !== 'undefined'; + } -module.exports = ABIModel; + /** + * Checks if the event exists + * + * @method hasEvent + * + * @param name + * + * @returns {Boolean} + */ + hasEvent(name) { + return typeof this.abi.events[name] !== 'undefined'; + } +} diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js index 36f58563cc0..cf53dace5ec 100644 --- a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -22,37 +22,35 @@ "use strict"; -var CallMethodModel = require('web3-core-method').CallMethodModel; - -/** - * @param {ABIItemModel} abiItemModel - * @param {CallMethodResponseDecoder} callMethodResponseDecoder - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function CallContractMethodModel(abiItemModel, callMethodResponseDecoder, utils, formatters) { - CallMethodModel.call(this, utils, formatters); - - this.callMethodResponseDecoder = callMethodResponseDecoder; - this.abiItemModel = abiItemModel; +import {CallMethodModel} from 'web3-core-method'; + +export default class CallContractMethodModel extends CallMethodModel { + + /** + * @param {ABIItemModel} abiItemModel + * @param {CallMethodResponseDecoder} callMethodResponseDecoder + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(abiItemModel, callMethodResponseDecoder, utils, formatters) { + super(utils, formatters); + + this.callMethodResponseDecoder = callMethodResponseDecoder; + this.abiItemModel = abiItemModel; + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Array} response + * + * @returns {*} + */ + afterExecution(response) { + return this.callMethodResponseDecoder.decode(this.abiItemModel, response); + } } - -CallContractMethodModel.prototype = Object.create(CallMethodModel.prototype); -CallContractMethodModel.prototype.constructor = CallContractMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Array} response - * - * @returns {*} - */ -CallContractMethodModel.prototype.afterExecution = function (response) { - return this.callMethodResponseDecoder.decode(this.abiItemModel, response); -}; - -module.exports = CallContractMethodModel; diff --git a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js index d4387240a98..6b62ecce31d 100644 --- a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js @@ -22,38 +22,36 @@ "use strict"; -var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; - -/** - * @param {Contract} contract - * @param {Object} utils - * @param {Object} formatters - * @param {Accounts} accounts - * - * @constructor - */ -function ContractDeployMethodModel(contract, utils, formatters, accounts) { - SendTransactionMethodModel.call(this, utils, formatters, accounts); - this.contract = contract; +import {SendTransactionMethodModel} from 'web3-core-method'; + +export default class ContractDeployMethodModel extends SendTransactionMethodModel { + + /** + * @param {Contract} contract + * @param {Object} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ + constructor(contract, utils, formatters, accounts) { + super(utils, formatters, accounts); + this.contract = contract; + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {*} + */ + afterExecution(response) { + const clonedContract = this.contract.clone(); + clonedContract.options.address = response.contractAddress; + + return clonedContract; + } } - -ContractDeployMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); -ContractDeployMethodModel.prototype.constructor = ContractDeployMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {*} - */ -ContractDeployMethodModel.prototype.afterExecution = function (response) { - var clonedContract = this.contract.clone(); - clonedContract.options.address = response.contractAddress; - - return clonedContract; -}; - -module.exports = ContractDeployMethodModel; diff --git a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js index 9542e5ed4f1..5549d0fff64 100644 --- a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js @@ -22,41 +22,38 @@ "use strict"; -var GetPastLogsMethodModel = require('web3-core-method').GetPastLogsMethodModel; - -/** - * @param {ABIItemModel} abiItemModel - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function PastEventLogsMethodModel(abiItemModel, utils, formatters) { - GetPastLogsMethodModel.call(this, utils, formatters); - this.abiItemModel = abiItemModel; +import {GetPastLogsMethodModel} from 'web3-core-method'; + +export default class PastEventLogsMethodModel extends GetPastLogsMethodModel { + + /** + * @param {ABIItemModel} abiItemModel + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(abiItemModel, utils, formatters) { + super(utils, formatters); + this.abiItemModel = abiItemModel; + } + + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Array} response + * + * @returns {Array} + */ + afterExecution(response) { + const formattedLogs = GetPastLogsMethodModel.prototype.afterExecution.call(response), self = this; + + formattedLogs.map(logItem => { + return self.eventLogDecoder.decode(self.abiItemModel, logItem); + }); + + return formattedLogs; + } } - -PastEventLogsMethodModel.prototype = Object.create(GetPastLogsMethodModel.prototype); -PastEventLogsMethodModel.prototype.constructor = PastEventLogsMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Array} response - * - * @returns {Array} - */ -PastEventLogsMethodModel.prototype.afterExecution = function (response) { - var formattedLogs = GetPastLogsMethodModel.prototype.afterExecution.call(response), - self = this; - - formattedLogs.map(function(logItem) { - return self.eventLogDecoder.decode(self.abiItemModel, logItem); - }); - - return formattedLogs; -}; - -module.exports = PastEventLogsMethodModel; diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js index e7170bbc067..c153452fbf2 100644 --- a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -21,71 +21,70 @@ */ "use strict"; -var _ = require('underscore'); -var SendTransactionMethodModel = require('web3-core-method').SendTransactionMethodModel; -/** - * @param {ABIItemModel} abiItemModel - * @param {AllEventsLogDecoder} allEventsLogDecoder - * @param {Object} utils - * @param {Object} formatters - * @param {Accounts} accounts - * - * @constructor - */ -function SendContractMethodModel(abiItemModel, allEventsLogDecoder, utils, formatters, accounts) { - SendTransactionMethodModel.call(this, utils, formatters, accounts); - - this.abiItemModel = abiItemModel; - this.allEventsLogDecoder = allEventsLogDecoder; -} - -SendContractMethodModel.prototype = Object.create(SendTransactionMethodModel.prototype); -SendContractMethodModel.prototype.constructor = SendContractMethodModel; - -/** - * This method will be executed after the RPC request. - * - * @method afterExecution - * - * @param {Object} response - * - * @returns {*} - */ -SendContractMethodModel.prototype.afterExecution = function (response) { - if (_.isArray(response.logs)) { - response.events = {}; - - response.logs.map(function (log) { - return this.allEventsLogDecoder.decode(null, log); - }); +import _ from 'underscore'; +import {SendTransactionMethodModel} from 'web3-core-method'; + +export default class SendContractMethodModel extends SendTransactionMethodModel { + + /** + * @param {ABIItemModel} abiItemModel + * @param {AllEventsLogDecoder} allEventsLogDecoder + * @param {Object} utils + * @param {Object} formatters + * @param {Accounts} accounts + * + * @constructor + */ + constructor(abiItemModel, allEventsLogDecoder, utils, formatters, accounts) { + super(utils, formatters, accounts); + + this.abiItemModel = abiItemModel; + this.allEventsLogDecoder = allEventsLogDecoder; + } - response.logs.forEach(function (log, index) { - if(log.event) { - if (response.events[log.event]) { - if (_.isArray(response.events[log.event])) { - response.events[log.event].push(log); + /** + * This method will be executed after the RPC request. + * + * @method afterExecution + * + * @param {Object} response + * + * @returns {*} + */ + afterExecution(response) { + if (_.isArray(response.logs)) { + response.events = {}; + + response.logs.map(function (log) { + return this.allEventsLogDecoder.decode(null, log); + }); + + response.logs.forEach((log, index) => { + if (log.event) { + if (response.events[log.event]) { + if (_.isArray(response.events[log.event])) { + response.events[log.event].push(log); + + return; + } + + response.events[log.event] = [response.events[log.event], log]; return; } - response.events[log.event] = [response.events[log.event], log]; + response.events[log.event] = log; return; } - response.events[log.event] = log; - - return; - } + response.events[index] = log; + }); - response.events[index] = log; - }); + delete response.logs; + } - delete response.logs; + return response; } - - return response; -}; - -module.exports = SendContractMethodModel; +} diff --git a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js index 533371dffe3..088283c537e 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js @@ -22,45 +22,43 @@ "use strict"; -var LogSubscriptionModel = require('web3-core-subscriptions').LogSubscriptionModel; +import {LogSubscriptionModel} from 'web3-core-subscriptions'; -/** - * @param {Object} options - * @param {Object} utils - * @param {Object} formatters - * @param {GetPastLogsMethodModel} getPastLogsMethodModel - * @param {MethodController} methodController - * @param {EventLogDecoder} allEventsLogDecoder - * - * @constructor - */ -function AllEventsLogSubscription( - options, - utils, - formatters, - getPastLogsMethodModel, - methodController, - allEventsLogDecoder -) { - LogSubscriptionModel.call(this, options, utils, formatters, getPastLogsMethodModel, methodController); - this.allEventsLogDecoder = allEventsLogDecoder; -} +export default class AllEventsLogSubscription extends LogSubscriptionModel { -AllEventsLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); -AllEventsLogSubscription.prototye.constructor = AllEventsLogSubscription; + /** + * @param {Object} options + * @param {Object} utils + * @param {Object} formatters + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * @param {EventLogDecoder} allEventsLogDecoder + * + * @constructor + */ + constructor( + options, + utils, + formatters, + getPastLogsMethodModel, + methodController, + allEventsLogDecoder + ) { + super(options, utils, formatters, getPastLogsMethodModel, methodController); + this.allEventsLogDecoder = allEventsLogDecoder; + } -/** - * This method will be executed on each new subscription item. - * - * @method onNewSubscriptionItem - * - * @param {Subscription} subscription - * @param {*} subscriptionItem - * - * @returns {Object} - */ -AllEventsLogSubscription.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { - return this.allEventsLogDecoder.decode(null, this.formatters.outputLogFormatter(subscriptionItem)); -}; - -module.exports = AllEventsLogSubscription; + /** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {Object} + */ + onNewSubscriptionItem(subscription, subscriptionItem) { + return this.allEventsLogDecoder.decode(null, this.formatters.outputLogFormatter(subscriptionItem)); + } +} diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index 620f81dd06f..e1d1258375f 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -22,48 +22,46 @@ "use strict"; -var LogSubscriptionModel = require('web3-core-subscriptions').LogSubscriptionModel; +import {LogSubscriptionModel} from 'web3-core-subscriptions'; -/** - * @param {ABIItemModel} abiItemModel - * @param {Object} options - * @param {Object} utils - * @param {Object} formatters - * @param {GetPastLogsMethodModel} getPastLogsMethodModel - * @param {MethodController} methodController - * @param {EventLogDecoder} eventLogDecoder - * - * @constructor - */ -function EventLogSubscription( - abiItemModel, - options, - utils, - formatters, - getPastLogsMethodModel, - methodController, - eventLogDecoder -) { - LogSubscriptionModel.call(this, options, utils, formatters, getPastLogsMethodModel, methodController); - this.eventLogDecoder = eventLogDecoder; - this.abiItemModel = abiItemModel; -} +export default class EventLogSubscription extends LogSubscriptionModel { -EventLogSubscription.prototye = Object.create(LogSubscriptionModel.prototype); -EventLogSubscription.prototye.constructor = EventLogSubscription; + /** + * @param {ABIItemModel} abiItemModel + * @param {Object} options + * @param {Object} utils + * @param {Object} formatters + * @param {GetPastLogsMethodModel} getPastLogsMethodModel + * @param {MethodController} methodController + * @param {EventLogDecoder} eventLogDecoder + * + * @constructor + */ + constructor( + abiItemModel, + options, + utils, + formatters, + getPastLogsMethodModel, + methodController, + eventLogDecoder + ) { + super(options, utils, formatters, getPastLogsMethodModel, methodController); + this.eventLogDecoder = eventLogDecoder; + this.abiItemModel = abiItemModel; + } -/** - * This method will be executed on each new subscription item. - * - * @method onNewSubscriptionItem - * - * @param {Subscription} subscription - * @param {*} subscriptionItem - * - * @returns {Object} - */ -EventLogSubscription.prototype.onNewSubscriptionItem = function (subscription, subscriptionItem) { - return this.eventLogDecoder.decode(this.abiItemModel, this.formatters.outputLogFormatter(subscriptionItem)); -}; - -module.exports = EventLogSubscription; + /** + * This method will be executed on each new subscription item. + * + * @method onNewSubscriptionItem + * + * @param {Subscription} subscription + * @param {*} subscriptionItem + * + * @returns {Object} + */ + onNewSubscriptionItem(subscription, subscriptionItem) { + return this.eventLogDecoder.decode(this.abiItemModel, this.formatters.outputLogFormatter(subscriptionItem)); + } +} diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 93f91950111..aa227073ce3 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -22,139 +22,140 @@ "use strict"; -/** - * @param {Contract} contract - * @param {ABIModel} abiModel - * @param {EventSubscriptionFactory} eventSubscriptionFactory - * @param {EventOptionsMapper} eventOptionsMapper - * @param {EventLogDecoder} eventLogDecoder - * @param {AllEventsLogDecoder} allEventsLogDecoder - * @param {AllEventsOptionsMapper} allEventsOptionsMapper - * - * @constructor - */ -function EventSubscriptionsProxy( - contract, - abiModel, - eventSubscriptionFactory, - eventOptionsMapper, - eventLogDecoder, - allEventsLogDecoder, - allEventsOptionsMapper, -) { - this.contract = contract; - this.eventSubscriptionFactory = eventSubscriptionFactory; - this.abiModel = abiModel; - this.eventOptionsMapper = eventOptionsMapper; - this.eventLogDecoder = eventLogDecoder; - this.allEventsLogDecoder = allEventsLogDecoder; - this.allEventsOptionsMapper = allEventsOptionsMapper; - - return new Proxy(this, { - get: this.proxyHandler - }); -} - -/** - * Checks if a contract event exists by the given name and returns the subscription otherwise it throws an error - * - * @method proxyHandler - * - * @param {EventSubscriptionsProxy} target - * @param {String} name - * - * @returns {Function|Error} - */ -EventSubscriptionsProxy.prototype.proxyHandler = function (target, name) { - if (this.abiModel.hasEvent(name)) { - return function (options, callback) { - return target.subscribe(target.abiModel.getEvent(name), options, callback); - } +export default class EventSubscriptionsProxy { + + /** + * @param {Contract} contract + * @param {ABIModel} abiModel + * @param {EventSubscriptionFactory} eventSubscriptionFactory + * @param {EventOptionsMapper} eventOptionsMapper + * @param {EventLogDecoder} eventLogDecoder + * @param {AllEventsLogDecoder} allEventsLogDecoder + * @param {AllEventsOptionsMapper} allEventsOptionsMapper + * + * @constructor + */ + constructor( + contract, + abiModel, + eventSubscriptionFactory, + eventOptionsMapper, + eventLogDecoder, + allEventsLogDecoder, + allEventsOptionsMapper + ) { + this.contract = contract; + this.eventSubscriptionFactory = eventSubscriptionFactory; + this.abiModel = abiModel; + this.eventOptionsMapper = eventOptionsMapper; + this.eventLogDecoder = eventLogDecoder; + this.allEventsLogDecoder = allEventsLogDecoder; + this.allEventsOptionsMapper = allEventsOptionsMapper; + + return new Proxy(this, { + get: this.proxyHandler + }); } - if (name === 'allEvents') { - return function (options, callback) { - return target.subscribeAll(options, callback); + /** + * Checks if a contract event exists by the given name and returns the subscription otherwise it throws an error + * + * @method proxyHandler + * + * @param {EventSubscriptionsProxy} target + * @param {String} name + * + * @returns {Function|Error} + */ + proxyHandler(target, name) { + if (this.abiModel.hasEvent(name)) { + return (options, callback) => { + return target.subscribe(target.abiModel.getEvent(name), options, callback); + }; } - } - if (target[name]) { - return target[name]; - } + if (name === 'allEvents') { + return (options, callback) => { + return target.subscribeAll(options, callback); + }; + } - throw Error('Event with name "' + name + '" not found'); -}; + if (target[name]) { + return target[name]; + } -/** - * Returns an subscription on the given event - * - * @param {ABIItemModel} abiItemModel - * @param {Object} options - * @param {Function} callback - * - * @returns {Subscription|PromiEvent} - */ -EventSubscriptionsProxy.prototype.subscribe = function (abiItemModel, options, callback) { - if (typeof options.filters !== 'undefined' && typeof options.topics !== 'undefined') { - return this.handleValidationError( - 'Invalid subscription options: Only filter or topics are allowed and not both', - callback - ); + throw Error(`Event with name "${name}" not found`); } - return this.eventSubscriptionFactory.createEventLogSubscription( - this.eventLogDecoder, - abiItemModel, - this.contract, - this.eventOptionsMapper.map(abiItemModel, this.contract, options) - ).subscribe(callback); -}; + /** + * Returns an subscription on the given event + * + * @param {ABIItemModel} abiItemModel + * @param {Object} options + * @param {Function} callback + * + * @returns {Subscription|PromiEvent} + */ + subscribe(abiItemModel, options, callback) { + if (typeof options.filters !== 'undefined' && typeof options.topics !== 'undefined') { + return this.handleValidationError( + 'Invalid subscription options: Only filter or topics are allowed and not both', + callback + ); + } -/** - * Returns an subscription for all contract events - * - * @method subscribeAll - * - * @param {Object} options - * @param {Function} callback - * - * @returns {Subscription|PromiEvent} - */ -EventSubscriptionsProxy.prototype.subscribeAll = function (options, callback) { - if (typeof options.topics !== 'undefined') { - return this.handleValidationError( - 'Invalid subscription options: Topics are not allowed for the "allEvents" subscription', - callback - ); + return this.eventSubscriptionFactory.createEventLogSubscription( + this.eventLogDecoder, + abiItemModel, + this.contract, + this.eventOptionsMapper.map(abiItemModel, this.contract, options) + ).subscribe(callback); } - return this.eventSubscriptionFactory.createAllEventLogSubscription( - this.allEventsLogDecoder, - this.contract, - this.allEventsOptionsMapper.map(this.abiModel, this.contract, options) - ).subscribe(callback); -}; - -/** - * Creates an promiEvent and rejects it with an error - * - * @method handleValidationError - * - * @param {String} errorMessage - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -EventSubscriptionsProxy.prototype.handleValidationError = function (errorMessage, callback) { - var promiEvent = new this.promiEventPackage.PromiEvent(); - promiEvent.emit('error', new Error(errorMessage)); + /** + * Returns an subscription for all contract events + * + * @method subscribeAll + * + * @param {Object} options + * @param {Function} callback + * + * @returns {Subscription|PromiEvent} + */ + subscribeAll(options, callback) { + if (typeof options.topics !== 'undefined') { + return this.handleValidationError( + 'Invalid subscription options: Topics are not allowed for the "allEvents" subscription', + callback + ); + } - if (_.isFunction(callback)) { - callback(error, null); + return this.eventSubscriptionFactory.createAllEventLogSubscription( + this.allEventsLogDecoder, + this.contract, + this.allEventsOptionsMapper.map(this.abiModel, this.contract, options) + ).subscribe(callback); } - return promiEvent; -}; + /** + * Creates an promiEvent and rejects it with an error + * + * @method handleValidationError + * + * @param {String} errorMessage + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + handleValidationError(errorMessage, callback) { + const promiEvent = new this.promiEventPackage.PromiEvent(); + promiEvent.emit('error', new Error(errorMessage)); + + if (_.isFunction(callback)) { + callback(error, null); + } -module.exports = EventSubscriptionsProxy; + return promiEvent; + } +} diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 360bbea1ae5..362db19669a 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -22,228 +22,229 @@ "use strict"; -/** - * @param {Contract} contract - * @param {ABIModel} abiModel - * @param {RpcMethodModelFactory} rpcMethodModelFactory - * @param {MethodController} methodController - * @param {MethodEncoder} methodEncoder - * @param {RpcMethodOptionsValidator} rpcMethodOptionsValidator - * @param {RpcMethodOptionsMapper} rpcMethodOptionsMapper - * @param {PromiEventPackage} promiEventPackage - * - * @constructor - */ -function MethodsProxy( - contract, - abiModel, - rpcMethodModelFactory, - methodController, - methodEncoder, - rpcMethodOptionsValidator, - rpcMethodOptionsMapper, - promiEventPackage -) { - this.contract = contract; - this.abiModel = abiModel; - this.rpcMethodModelFactory = rpcMethodModelFactory; - this.methodController = methodController; - this.methodEncoder = methodEncoder; - this.rpcMethodOptionsValidator = rpcMethodOptionsValidator; - this.rpcMethodOptionsMapper = rpcMethodOptionsMapper; - this.promiEventPackage = promiEventPackage; - - return new Proxy(this, { - get: this.proxyHandler - }); -} - -/** - * Checks if a contract event exists by the given name and returns the subscription otherwise it throws an error - * - * @method proxyHandler - * - * @param {MethodsProxy} target - * @param {String} name - * - * @returns {Function|Error} - */ -MethodsProxy.prototype.proxyHandler = function (target, name) { - var abiItemModel = this.abiModel.getMethod(name); - - if (abiItemModel) { - var requestType = abiItemModel.requestType; - if (requestType === 'contract-deployment') { - requestType = 'send'; - } +export default class MethodsProxy { + + /** + * @param {Contract} contract + * @param {ABIModel} abiModel + * @param {RpcMethodModelFactory} rpcMethodModelFactory + * @param {MethodController} methodController + * @param {MethodEncoder} methodEncoder + * @param {RpcMethodOptionsValidator} rpcMethodOptionsValidator + * @param {RpcMethodOptionsMapper} rpcMethodOptionsMapper + * @param {PromiEventPackage} promiEventPackage + * + * @constructor + */ + constructor( + contract, + abiModel, + rpcMethodModelFactory, + methodController, + methodEncoder, + rpcMethodOptionsValidator, + rpcMethodOptionsMapper, + promiEventPackage + ) { + this.contract = contract; + this.abiModel = abiModel; + this.rpcMethodModelFactory = rpcMethodModelFactory; + this.methodController = methodController; + this.methodEncoder = methodEncoder; + this.rpcMethodOptionsValidator = rpcMethodOptionsValidator; + this.rpcMethodOptionsMapper = rpcMethodOptionsMapper; + this.promiEventPackage = promiEventPackage; + + return new Proxy(this, { + get: this.proxyHandler + }); + } - var anonymousFunction = function () { - var methodArguments = arguments; + /** + * Checks if a contract event exists by the given name and returns the subscription otherwise it throws an error + * + * @method proxyHandler + * + * @param {MethodsProxy} target + * @param {String} name + * + * @returns {Function|Error} + */ + proxyHandler(target, name) { + const abiItemModel = this.abiModel.getMethod(name); + + if (abiItemModel) { + let requestType = abiItemModel.requestType; - // Because of the possibility to overwrite the contract data if I call contract.deploy() have I to check - // here if it is a contract deployment. If this call is a contract deployment then I have to set the right - // contract data and to map the arguments. TODO: Change API or improve this if (requestType === 'contract-deployment') { - if (arguments[0]['data']) { - target.contract.options.data = target.contract.options.data || arguments[0]['data']; - } - - if (arguments[0]['arguments']) { - methodArguments = arguments[0]['arguments']; - } + requestType = 'send'; } - abiItemModel.contractMethodParameters = methodArguments; - }; + const anonymousFunction = () => { + let methodArguments = arguments; - anonymousFunction[requestType] = function () { - return target.executeMethod(abiItemModel, arguments); - }; + // Because of the possibility to overwrite the contract data if I call contract.deploy() have I to check + // here if it is a contract deployment. If this call is a contract deployment then I have to set the right + // contract data and to map the arguments. TODO: Change API or improve this + if (requestType === 'contract-deployment') { + if (arguments[0]['data']) { + target.contract.options.data = target.contract.options.data || arguments[0]['data']; + } - anonymousFunction[requestType].request = function () { - return target.createRpcMethodModel(abiItemModel, arguments); - }; + if (arguments[0]['arguments']) { + methodArguments = arguments[0]['arguments']; + } + } - anonymousFunction.estimateGas = function () { - abiItemModel.requestType = 'estimate'; + abiItemModel.contractMethodParameters = methodArguments; + }; - return target.executeMethod(abiItemModel, arguments); - }; + anonymousFunction[requestType] = () => { + return target.executeMethod(abiItemModel, arguments); + }; - anonymousFunction.encodeAbi = function () { - return target.methodEncoder.encode(abiItemModel, target.contract.options.data); - }; - } + anonymousFunction[requestType].request = () => { + return target.createRpcMethodModel(abiItemModel, arguments); + }; - if (target[name]) { - return this[name]; - } + anonymousFunction.estimateGas = () => { + abiItemModel.requestType = 'estimate'; - throw Error('Method with name "' + name + '" not found'); -}; + return target.executeMethod(abiItemModel, arguments); + }; -/** - * Executes the RPC method with the methodController - * - * @param {ABIItemModel} abiItemModel - * @param {IArguments} methodArguments - * - * @returns {Promise|PromiEvent|String|Boolean} - */ -MethodsProxy.prototype.executeMethod = function (abiItemModel, methodArguments) { - var rpcMethodModel = this.createRpcMethodModel(abiItemModel, methodArguments); + anonymousFunction.encodeAbi = () => { + return target.methodEncoder.encode(abiItemModel, target.contract.options.data); + }; + } - if (typeof rpcMethodModel.error !== 'undefined') { - return this.handleValidationError(rpcMethodModel.error, rpcMethodModel.callback); - } + if (target[name]) { + return this[name]; + } - return this.methodController.execute( - rpcMethodModel, - this.contract.accounts, - this.contract - ); -}; + throw Error(`Method with name "${name}" not found`); + } -/** - * Creates the rpc method, encodes the contract method and validate the objects. - * - * @param {ABIItemModel|Array} abiItemModel - * @param {IArguments} methodArguments - * - * @returns {AbstractMethodModel|Object} - */ -MethodsProxy.prototype.createRpcMethodModel = function (abiItemModel, methodArguments) { - var rpcMethodModel, - self = this; + /** + * Executes the RPC method with the methodController + * + * @param {ABIItemModel} abiItemModel + * @param {IArguments} methodArguments + * + * @returns {Promise|PromiEvent|String|Boolean} + */ + executeMethod(abiItemModel, methodArguments) { + const rpcMethodModel = this.createRpcMethodModel(abiItemModel, methodArguments); + + if (typeof rpcMethodModel.error !== 'undefined') { + return this.handleValidationError(rpcMethodModel.error, rpcMethodModel.callback); + } - // If it is an array than check which AbiItemModel should be used. - // This will be used if two methods with the same name exists but with different arguments. - if (_.isArray(abiItemModel)) { - var isContractMethodParametersLengthValid = false; + return this.methodController.execute( + rpcMethodModel, + this.contract.accounts, + this.contract + ); + } - // Check if one of the AbiItemModel in this array does match the arguments length - abiItemModel.some(function(method) { + /** + * Creates the rpc method, encodes the contract method and validate the objects. + * + * @param {ABIItemModel|Array} abiItemModel + * @param {IArguments} methodArguments + * + * @returns {AbstractMethodModel|Object} + */ + createRpcMethodModel(abiItemModel, methodArguments) { + let rpcMethodModel; + + // If it is an array than check which AbiItemModel should be used. + // This will be used if two methods with the same name exists but with different arguments. + if (_.isArray(abiItemModel)) { + let isContractMethodParametersLengthValid = false; + + // Check if one of the AbiItemModel in this array does match the arguments length + abiItemModel.some(method => { + // Get correct rpc method model + rpcMethodModel = this.rpcMethodModelFactory.createRpcMethodByRequestType(method, this.contract); + rpcMethodModel.methodArguments = methodArguments; + isContractMethodParametersLengthValid = abiItemModel.givenParametersLengthIsValid(); + + return isContractMethodParametersLengthValid === true; + }); + + // Return error if no AbiItemModel found with the correct arguments length + if (isContractMethodParametersLengthValid !== true) { + return { + error: isContractMethodParametersLengthValid, + callback: rpcMethodModel.callback + }; + } + } else { // Get correct rpc method model - rpcMethodModel = self.rpcMethodModelFactory.createRpcMethodByRequestType(method, self.contract); + rpcMethodModel = this.rpcMethodModelFactory.createRpcMethodByRequestType(abiItemModel, this.contract); rpcMethodModel.methodArguments = methodArguments; - isContractMethodParametersLengthValid = abiItemModel.givenParametersLengthIsValid(); + } - return isContractMethodParametersLengthValid === true; - }); - // Return error if no AbiItemModel found with the correct arguments length - if (isContractMethodParametersLengthValid !== true) { + // Validate contract method parameters length + const contractMethodParametersLengthIsValid = abiItemModel.givenParametersLengthIsValid(); + if (contractMethodParametersLengthIsValid instanceof Error) { return { - error: isContractMethodParametersLengthValid, + error: contractMethodParametersLengthIsValid, callback: rpcMethodModel.callback }; } - } else { - // Get correct rpc method model - rpcMethodModel = this.rpcMethodModelFactory.createRpcMethodByRequestType(abiItemModel, this.contract); - rpcMethodModel.methodArguments = methodArguments; - } + // Encode contract method and check if there was an error + const encodedContractMethod = this.methodEncoder.encode(abiItemModel, this.contract.options.data); + if (encodedContractMethod instanceof Error) { + return { + error: encodedContractMethod, + callback: rpcMethodModel.callback + }; + } - // Validate contract method parameters length - var contractMethodParametersLengthIsValid = abiItemModel.givenParametersLengthIsValid(); - if (contractMethodParametersLengthIsValid instanceof Error) { - return { - error: contractMethodParametersLengthIsValid, - callback: rpcMethodModel.callback - }; - } + // Set encoded contractMethod as data property of the transaction or call + rpcMethodModel.parameters[0]['data'] = encodedContractMethod; - // Encode contract method and check if there was an error - var encodedContractMethod = this.methodEncoder.encode(abiItemModel, this.contract.options.data); - if (encodedContractMethod instanceof Error) { - return { - error: encodedContractMethod, - callback: rpcMethodModel.callback - }; - } + // Set default options in the TxObject if required + rpcMethodModel.parameters = this.rpcMethodOptionsMapper.map(this.contract, rpcMethodModel.parameters[0]); - // Set encoded contractMethod as data property of the transaction or call - rpcMethodModel.parameters[0]['data'] = encodedContractMethod; - - // Set default options in the TxObject if required - rpcMethodModel.parameters = this.rpcMethodOptionsMapper.map(this.contract, rpcMethodModel.parameters[0]); + // Validate TxObject + const rpcMethodOptionsValidationResult = this.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethodModel); + if (rpcMethodOptionsValidationResult instanceof Error) { + return { + error: rpcMethodOptionsValidationResult, + callback: rpcMethodModel.callback + }; + } - // Validate TxObject - var rpcMethodOptionsValidationResult = this.rpcMethodOptionsValidator.validate(abiItemModel, rpcMethodModel); - if (rpcMethodOptionsValidationResult instanceof Error) { - return { - error: rpcMethodOptionsValidationResult, - callback: rpcMethodModel.callback - }; + return rpcMethodModel; } - return rpcMethodModel; -}; - -/** - * Creates an promiEvent and rejects it with an error - * - * @method handleValidationError - * - * @param {Error} error - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -MethodsProxy.prototype.handleValidationError = function (error, callback) { - var promiEvent = new this.promiEventPackage.PromiEvent(); - - promiEvent.resolve(null); - promiEvent.reject(error); - promiEvent.emit('error', error); + /** + * Creates an promiEvent and rejects it with an error + * + * @method handleValidationError + * + * @param {Error} error + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + handleValidationError(error, callback) { + const promiEvent = new this.promiEventPackage.PromiEvent(); + + promiEvent.resolve(null); + promiEvent.reject(error); + promiEvent.emit('error', error); + + if (_.isFunction(callback)) { + callback(error, null); + } - if (_.isFunction(callback)) { - callback(error, null); + return promiEvent; } - - return promiEvent; -}; - -module.exports = MethodsProxy; +} diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js index a9dd69b69af..d670ba3cd57 100644 --- a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -22,84 +22,85 @@ "use strict"; -/** - * @param {Object} utils - * - * @constructor - */ -function RpcMethodOptionsValidator(utils) { - this.utils = utils; -} +export default class RpcMethodOptionsValidator { -/** - * Validates the options object for the RPC-Method call - * - * @method validate - * - * @param {ABIItemModel} abiItemModel - * @param {AbstractMethodModel} rpcMethodModel - * - * @returns {Error|Boolean} - */ -RpcMethodOptionsValidator.prototype.validate = function (abiItemModel, rpcMethodModel) { - if (this.isToSet(abiItemModel, rpcMethodModel)) { - return new Error('This contract object doesn\'t have address set yet, please set an address first.'); + /** + * @param {Object} utils + * + * @constructor + */ + constructor(utils) { + this.utils = utils; } - if (this.isFromSet(rpcMethodModel)) { - return new Error('No "from" address specified in neither the given options, nor the default options.'); - } + /** + * Validates the options object for the RPC-Method call + * + * @method validate + * + * @param {ABIItemModel} abiItemModel + * @param {AbstractMethodModel} rpcMethodModel + * + * @returns {Error|Boolean} + */ + validate(abiItemModel, rpcMethodModel) { + if (this.isToSet(abiItemModel, rpcMethodModel)) { + return new Error('This contract object doesn\'t have address set yet, please set an address first.'); + } - if (this.isValueValid(abiItemModel, rpcMethodModel)) { - return new Error('Can not send value to non-payable contract method or constructor') - } + if (this.isFromSet(rpcMethodModel)) { + return new Error('No "from" address specified in neither the given options, nor the default options.'); + } - return true; -}; + if (this.isValueValid(abiItemModel, rpcMethodModel)) { + return new Error('Can not send value to non-payable contract method or constructor') + } -/** - * Checks if the property to is set in the options object - * - * @method isToSet - * - * @param {ABIItemModel} abiItemModel - * @param {AbstractMethodModel} rpcMethodModel - * - * @returns {Boolean} - */ -RpcMethodOptionsValidator.prototype.isToSet = function (abiItemModel, rpcMethodModel) { - if (abiItemModel.signature === 'constructor') { return true; } - return !!rpcMethodModel.parameters[0].to; -}; + /** + * Checks if the property to is set in the options object + * + * @method isToSet + * + * @param {ABIItemModel} abiItemModel + * @param {AbstractMethodModel} rpcMethodModel + * + * @returns {Boolean} + */ + isToSet(abiItemModel, rpcMethodModel) { + if (abiItemModel.signature === 'constructor') { + return true; + } -/** - * Checks if the property from of the options object is set and a valid address - * - * @method isFromSet - * - * @param {AbstractMethodModel} rpcMethodModel - * - * @returns {Boolean} - */ -RpcMethodOptionsValidator.prototype.isFromSet = function (rpcMethodModel) { - return this.utils.isAddress(rpcMethodModel.parameters[0].from); -}; + return !!rpcMethodModel.parameters[0].to; + } -/** - * Checks if no value is set for an non-payable method - * - * @method isValueValid - * - * @param {ABIItemModel} abiItemModel - * @param {AbstractMethodModel} rpcMethodModel - * - * @returns {Boolean} - */ -RpcMethodOptionsValidator.prototype.isValueValid = function (abiItemModel, rpcMethodModel) { - return !(!abiItemModel.payable && rpcMethodModel.parameters[0].value && rpcMethodModel.parameters[0].value > 0); -}; + /** + * Checks if the property from of the options object is set and a valid address + * + * @method isFromSet + * + * @param {AbstractMethodModel} rpcMethodModel + * + * @returns {Boolean} + */ + isFromSet(rpcMethodModel) { + return this.utils.isAddress(rpcMethodModel.parameters[0].from); + } -module.exports = RpcMethodOptionsValidator; + /** + * Checks if no value is set for an non-payable method + * + * @method isValueValid + * + * @param {ABIItemModel} abiItemModel + * @param {AbstractMethodModel} rpcMethodModel + * + * @returns {Boolean} + */ + isValueValid(abiItemModel, rpcMethodModel) { + return !(!abiItemModel.payable && rpcMethodModel.parameters[0].value && rpcMethodModel.parameters[0].value > 0); + } +} From cae6dc600a3769be14d74ccbaf30d65c4a5bdf16 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:01:48 +0200 Subject: [PATCH 0276/1045] web3-eth-ens ported to es6 --- packages/web3-eth-ens/src/ENS.js | 319 +++++++++-------- .../web3-eth-ens/src/contracts/Registry.js | 261 +++++++------- .../src/factories/ENSPackageFactory.js | 126 ++++--- .../src/handlers/ResolverMethodHandler.js | 338 +++++++++--------- packages/web3-eth-ens/src/index.js | 18 +- 5 files changed, 527 insertions(+), 535 deletions(-) diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index 3391f5de920..743c52004b1 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -20,173 +20,174 @@ "use strict"; -/** - * @param {Registry} registry - * @param {ResolverMethodHandler} resolverMethodHandler - * - * @constructor - */ -function ENS(registry, resolverMethodHandler) { - this.registry = registry; - this.resolverMethodHandler = resolverMethodHandler; -} +export default class ENS { -/** - * Sets the provider for the registry and resolver object. - * This method will also set the provider in the NetworkPackage and AccountsPackage because they are used here. - * - * @method setProvider - * - * @param {Object|String} provider - * @param {Net} net - * - * @returns {Boolean} - */ -ENS.prototype.setProvider = function (provider, net) { - return this.registry.setProvider(provider, net); -}; + /** + * @param {Registry} registry + * @param {ResolverMethodHandler} resolverMethodHandler + * + * @constructor + */ + constructor(registry, resolverMethodHandler) { + this.registry = registry; + this.resolverMethodHandler = resolverMethodHandler; + } -/** - * Returns an contract of type resolver - * - * @method resolver - * - * @param {String} name - * - * @returns {Promise} - */ -ENS.prototype.resolver = function (name) { - return this.registry.resolver(name); -}; + /** + * Sets the provider for the registry and resolver object. + * This method will also set the provider in the NetworkPackage and AccountsPackage because they are used here. + * + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net + * + * @returns {Boolean} + */ + setProvider(provider, net) { + return this.registry.setProvider(provider, net); + } -/** - * Returns the address record associated with a name. - * - * @method getAddress - * - * @method getAddress - * @param {String} name - * @param {Function} callback - * - * @callback callback callback(error, result) - * @return {PromiEvent} - */ -ENS.prototype.getAddress = function (name, callback) { - return this.resolverMethodHandler.method(name, 'addr', []).call(callback); -}; + /** + * Returns an contract of type resolver + * + * @method resolver + * + * @param {String} name + * + * @returns {Promise} + */ + resolver(name) { + return this.registry.resolver(name); + } -/** - * Sets a new address - * - * @method setAddress - * - * @param {String} name - * @param {String} address - * @param {Object} sendOptions - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ENS.prototype.setAddress = function (name, address, sendOptions, callback) { - return this.resolverMethodHandler.method(name, 'setAddr', [address]).send(sendOptions, callback); -}; + /** + * Returns the address record associated with a name. + * + * @method getAddress + * + * @method getAddress + * @param {String} name + * @param {Function} callback + * + * @callback callback callback(error, result) + * @return {PromiEvent} + */ + getAddress(name, callback) { + return this.resolverMethodHandler.method(name, 'addr', []).call(callback); + } -/** - * Returns the public key - * - * @method getPubkey - * - * @param {String} name - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ENS.prototype.getPubkey = function (name, callback) { - return this.resolverMethodHandler.method(name, 'pubkey', []).call(callback); -}; + /** + * Sets a new address + * + * @method setAddress + * + * @param {String} name + * @param {String} address + * @param {Object} sendOptions + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + setAddress(name, address, sendOptions, callback) { + return this.resolverMethodHandler.method(name, 'setAddr', [address]).send(sendOptions, callback); + } -/** - * Set the new public key - * - * @method setPubkey - * - * @param {String} name - * @param {String} x - * @param {String} y - * @param {Object} sendOptions - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ENS.prototype.setPubkey = function (name, x, y, sendOptions, callback) { - return this.resolverMethodHandler.method(name, 'setPubkey', [x, y]).send(sendOptions, callback); -}; + /** + * Returns the public key + * + * @method getPubkey + * + * @param {String} name + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + getPubkey(name, callback) { + return this.resolverMethodHandler.method(name, 'pubkey', []).call(callback); + } -/** - * Returns the content - * - * @method getContent - * - * @param {String} name - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ENS.prototype.getContent = function (name, callback) { - return this.resolverMethodHandler.method(name, 'content', []).call(callback); -}; + /** + * Set the new public key + * + * @method setPubkey + * + * @param {String} name + * @param {String} x + * @param {String} y + * @param {Object} sendOptions + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + setPubkey(name, x, y, sendOptions, callback) { + return this.resolverMethodHandler.method(name, 'setPubkey', [x, y]).send(sendOptions, callback); + } -/** - * Set the content - * - * @method setContent - * - * @param {String} name - * @param {String} hash - * @param {Object} sendOptions - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ENS.prototype.setContent = function (name, hash, sendOptions, callback) { - return this.resolverMethodHandler.method(name, 'setContent', [hash]).send(sendOptions, callback); -}; + /** + * Returns the content + * + * @method getContent + * + * @param {String} name + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + getContent(name, callback) { + return this.resolverMethodHandler.method(name, 'content', []).call(callback); + } -/** - * Get the multihash - * - * @method getMultihash - * - * @param {String} name - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ENS.prototype.getMultihash = function (name, callback) { - return this.resolverMethodHandler.method(name, 'multihash', []).call(callback); -}; + /** + * Set the content + * + * @method setContent + * + * @param {String} name + * @param {String} hash + * @param {Object} sendOptions + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + setContent(name, hash, sendOptions, callback) { + return this.resolverMethodHandler.method(name, 'setContent', [hash]).send(sendOptions, callback); + } -/** - * Set the multihash - * - * @method setMultihash - * - * @param {String} name - * @param {String} hash - * @param {Object} sendOptions - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ENS.prototype.setMultihash = function (name, hash, sendOptions, callback) { - return this.resolverMethodHandler.method(name, 'multihash', [hash]).send(sendOptions, callback); -}; + /** + * Get the multihash + * + * @method getMultihash + * + * @param {String} name + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + getMultihash(name, callback) { + return this.resolverMethodHandler.method(name, 'multihash', []).call(callback); + } -module.exports = ENS; + /** + * Set the multihash + * + * @method setMultihash + * + * @param {String} name + * @param {String} hash + * @param {Object} sendOptions + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + setMultihash(name, hash, sendOptions, callback) { + return this.resolverMethodHandler.method(name, 'multihash', [hash]).send(sendOptions, callback); + } +} diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index 205c24f252c..bd22ebfe7f7 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -19,144 +19,139 @@ "use strict"; -var _ = require('underscore'); -var namehash = require('eth-ens-namehash'); - -/** - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {Accounts} accounts - * @param {ContractPackage} contractPackage - * @param {Object} registryABI - * @param {Object} resolverABI - * - * @constructor - */ -function Registry(provider, accounts, contractPackage, registryABI, resolverABI) { - var self = this; - this.net = net; - this.accounts = accounts; - this.contractPackage = contractPackage; - this.registryABI = registryABI; - this.resolverABI = resolverABI; - this.provider = provider; - - this.contract = this.checkNetwork().then(function (address) { - return new self.contractPackage.Contract( - self.provider, - self.accounts, - self.registryABI, - address - ); - }); -} - -/** - * Sets the provider in NetworkPackage, AccountsPackage and the current object. - * - * @method setProvider - * - * @param {Object|String} provider - * @param {Net} net - * - * @returns {Boolean} - */ -Registry.prototype.setProvider = function (provider, net) { - this.provider = this.providersPackage.resolve(provider, net); - - return !!(this.net.setProvider(provider, net) && this.accounts.setProvider(provider, net) && this.provider); -}; - -/** - * Returns the address of the owner of an ENS name. - * - * @method owner - * - * @param {String} name - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Promise<*>} - */ -Registry.prototype.owner = function (name, callback) { - var self = this; - - return new Promise(function (resolve, reject) { - self.contract.then(function (contract) { - contract.methods.owner(namehash.hash(name)) - .call() - .then(function (receipt) { - resolve(receipt); - - if (_.isFunction(callback)) { - callback(false, receipt); - } - }) - .catch(function (error) { - reject(error); - - if (_.isFunction(callback)) { - callback(error, null); - } - }); +import _ from 'underscore'; +import namehash from 'eth-ens-namehash'; + +export default class Registry { + + /** + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {Accounts} accounts + * @param {ContractPackage} contractPackage + * @param {Object} registryABI + * @param {Object} resolverABI + * + * @constructor + */ + constructor(provider, accounts, contractPackage, registryABI, resolverABI) { + this.net = net; + this.accounts = accounts; + this.contractPackage = contractPackage; + this.registryABI = registryABI; + this.resolverABI = resolverABI; + this.provider = provider; + + this.contract = this.checkNetwork().then(address => { + return new this.contractPackage.Contract( + this.provider, + this.accounts, + this.registryABI, + address + ); }); - }); -}; - -/** - * Returns the resolver contract associated with a name. - * - * @method resolver - * - * @param {String} name - * - * @returns {Promise} - */ -Registry.prototype.resolver = function (name) { - var self = this; - - return this.contract.then(function (contract) { - return contract.methods.resolver(namehash.hash(name)).call(); - }).then(function (address) { - return new self.contractPackage.Contract( - self.provider, - self.accounts, - self.resolverABI, - address - ); - }); -}; - -/** - * Checks if the current used network is synced and looks for ENS support there. - * Throws an error if not. - * - * @method checkNetwork - * - * @returns {Promise} - */ -Registry.prototype.checkNetwork = function () { - var self = this, - ensAddresses = { + } + + /** + * Sets the provider in NetworkPackage, AccountsPackage and the current object. + * + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net + * + * @returns {Boolean} + */ + setProvider(provider, net) { + this.provider = this.providersPackage.resolve(provider, net); + + return !!(this.net.setProvider(provider, net) && this.accounts.setProvider(provider, net) && this.provider); + } + + /** + * Returns the address of the owner of an ENS name. + * + * @method owner + * + * @param {String} name + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Promise<*>} + */ + owner(name, callback) { + return new Promise((resolve, reject) => { + this.contract.then(contract => { + contract.methods.owner(namehash.hash(name)) + .call() + .then(receipt => { + resolve(receipt); + + if (_.isFunction(callback)) { + callback(false, receipt); + } + }) + .catch(error => { + reject(error); + + if (_.isFunction(callback)) { + callback(error, null); + } + }); + }); + }); + } + + /** + * Returns the resolver contract associated with a name. + * + * @method resolver + * + * @param {String} name + * + * @returns {Promise} + */ + resolver(name) { + return this.contract.then(contract => { + return contract.methods.resolver(namehash.hash(name)).call(); + }).then(address => { + return new this.contractPackage.Contract( + this.provider, + this.accounts, + this.resolverABI, + address + ); + }); + } + + /** + * Checks if the current used network is synced and looks for ENS support there. + * Throws an error if not. + * + * @method checkNetwork + * + * @returns {Promise} + */ + checkNetwork() { + const ensAddresses = { main: "0x314159265dD8dbb310642f98f50C066173C1259b", ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", rinkeby: "0xe7410170f87102df0055eb195163a03b7f2bff4a" }; - return this.net.getBlock('latest', false).then(function (block) { - var headAge = new Date() / 1000 - block.timestamp; - if (headAge > 3600) { - throw new Error("Network not synced; last block was " + headAge + " seconds ago"); - } + return this.net.getBlock('latest', false).then(block => { + const headAge = new Date() / 1000 - block.timestamp; + if (headAge > 3600) { + throw new Error(`Network not synced; last block was ${headAge} seconds ago`); + } - return self.net.getNetworkType(); - }).then(function (networkType) { - var addr = ensAddresses[networkType]; - if (typeof addr === 'undefined') { - throw new Error("ENS is not supported on network " + networkType); - } + return this.net.getNetworkType(); + }).then(networkType => { + const addr = ensAddresses[networkType]; + if (typeof addr === 'undefined') { + throw new Error(`ENS is not supported on network ${networkType}`); + } - return addr; - }); -}; - -module.exports = Registry; + return addr; + }); + } +} diff --git a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js index 147d3376a87..f715fc1eda3 100644 --- a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js +++ b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js @@ -19,71 +19,69 @@ "use strict"; -var ENS = require('./ENS'); -var Registry = require('./contracts/Registry'); -var ResolverMethodHandler = require('../handlers/ResolverMethodHandler'); +import ENS from './ENS'; +import Registry from './contracts/Registry'; +import ResolverMethodHandler from '../handlers/ResolverMethodHandler'; -function ENSPackageFactory () { } +export default class ENSPackageFactory { + /** + * Returns an object of type ENS + * + * @method createENS + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {Network} net + * @param {Accounts} accounts + * @param {ContractPackage} contractPackage + * @param {Object} registryAbi + * @param {Object} resolverAbi + * @param {PromiEventPackage} promiEventPackage + * + * @returns {ENS} + */ + createENS( + provider, + net, + accounts, + contractPackage, + registryAbi, + resolverAbi, + promiEventPackage + ) { + const registry = this.createRegistry(provider, net, accounts, contractPackage, registryAbi, resolverAbi); -/** - * Returns an object of type ENS - * - * @method createENS - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {Network} net - * @param {Accounts} accounts - * @param {ContractPackage} contractPackage - * @param {Object} registryAbi - * @param {Object} resolverAbi - * @param {PromiEventPackage} promiEventPackage - * - * @returns {ENS} - */ -ENSPackageFactory.prototype.createENS = function ( - provider, - net, - accounts, - contractPackage, - registryAbi, - resolverAbi, - promiEventPackage -) { - var registry = this.createRegistry(provider, net, accounts, contractPackage, registryAbi, resolverAbi); - - return new ENS(registry, this.createResolverMethodHandler(registry, promiEventPackage)); -}; - -/** - * Returns an object of type Registry - * - * @method createRegistry - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {Network} net - * @param {Accounts} accounts - * @param {ContractPackage} contractPackage - * @param {Object} registryAbi - * @param {Object} resolverAbi - * - * @returns {Registry} - */ -ENSPackageFactory.prototype.createRegistry = function (provider, net, accounts, contractPackage, registryAbi, resolverAbi) { - return new Registry(provider, net, accounts, contractPackage, registryAbi, resolverAbi); -}; + return new ENS(registry, this.createResolverMethodHandler(registry, promiEventPackage)); + } -/** - * Returns an object of type ResolverMethodHandler - * - * @method createResolverMethodHandler - * - * @param {Registry} registry - * @param {PromiEventPackage} promiEventPackage - * - * @returns {ResolverMethodHandler} - */ -ENSPackageFactory.prototype.createResolverMethodHandler = function (registry, promiEventPackage) { - return new ResolverMethodHandler(registry, promiEventPackage); -}; + /** + * Returns an object of type Registry + * + * @method createRegistry + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {Network} net + * @param {Accounts} accounts + * @param {ContractPackage} contractPackage + * @param {Object} registryAbi + * @param {Object} resolverAbi + * + * @returns {Registry} + */ + createRegistry(provider, net, accounts, contractPackage, registryAbi, resolverAbi) { + return new Registry(provider, net, accounts, contractPackage, registryAbi, resolverAbi); + } -module.exports = ENSPackageFactory; + /** + * Returns an object of type ResolverMethodHandler + * + * @method createResolverMethodHandler + * + * @param {Registry} registry + * @param {PromiEventPackage} promiEventPackage + * + * @returns {ResolverMethodHandler} + */ + createResolverMethodHandler(registry, promiEventPackage) { + return new ResolverMethodHandler(registry, promiEventPackage); + } +} diff --git a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js index 9f119f9418d..7e7069c7159 100644 --- a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js +++ b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js @@ -20,161 +20,118 @@ "use strict"; -var _ = require('underscore'); -var namehash = require('eth-ens-namehash'); - -/** - * @param {Registry} registry - * @param {PromiEventPackage} promiEventPackage - * - * @constructor - */ -function ResolverMethodHandler(registry, promiEventPackage) { - this.registry = registry; - this.promiEventPackage = promiEventPackage; -} - -/** - * Executes an resolver method and returns an eventifiedPromise - * - * @param {String} ensName - * @param {String} methodName - * @param {Array} methodArguments - * @param {Function} callback - * - * @returns {Object} - */ -ResolverMethodHandler.prototype.method = function (ensName, methodName, methodArguments) { - return { - call: this.call.bind({ - ensName: ensName, - methodName: methodName, - methodArguments: methodArguments, - parent: this - }), - send: this.send.bind({ - ensName: ensName, - methodName: methodName, - methodArguments: methodArguments, - parent: this - }) - }; -}; - -/** - * Executes call - * - * @method call - * - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ResolverMethodHandler.prototype.call = function (callback) { - var self = this, - promiEvent = new this.promiEventPackage.PromiEvent(), - preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); - - this.parent.registry.resolver(this.ensName).then(function (resolver) { - self.parent.handleCall(promiEvent, resolver.methods[self.methodName], preparedArguments, callback); - }).catch(function (error) { - promiEvent.reject(error); - }); - - return promiEvent; -}; - - -/** - * Executes send - * - * @method send - * - * @param {Object} sendOptions - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ResolverMethodHandler.prototype.send = function (sendOptions, callback) { - var self = this, - promiEvent = new this.promiEventPackage.PromiEvent(), - preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); +import _ from 'underscore'; +import namehash from 'eth-ens-namehash'; + +export default class ResolverMethodHandler { + + /** + * @param {Registry} registry + * @param {PromiEventPackage} promiEventPackage + * + * @constructor + */ + constructor(registry, promiEventPackage) { + this.registry = registry; + this.promiEventPackage = promiEventPackage; + } - this.parent.registry.resolver(this.ensName).then(function (resolver) { - self.parent.handleSend(promiEvent, resolver.methods[self.methodName], preparedArguments, sendOptions, callback); - }).catch(function (error) { - promiEvent.reject(error); - }); + /** + * Executes an resolver method and returns an eventifiedPromise + * + * @param {String} ensName + * @param {String} methodName + * @param {Array} methodArguments + * @param {Function} callback + * + * @returns {Object} + */ + method(ensName, methodName, methodArguments) { + return { + call: this.call.bind({ + ensName, + methodName, + methodArguments, + parent: this + }), + send: this.send.bind({ + ensName, + methodName, + methodArguments, + parent: this + }) + }; + } - return promiEvent; -}; + /** + * Executes call + * + * @method call + * + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + call(callback) { + const promiEvent = new this.promiEventPackage.PromiEvent(), + preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); + + this.parent.registry.resolver(this.ensName).then(resolver => { + this.parent.handleCall(promiEvent, resolver.methods[this.methodName], preparedArguments, callback); + }).catch(error => { + promiEvent.reject(error); + }); -/** - * Handles a call method - * - * @method handleCall - * - * @param {PromiEvent} promiEvent - * @param {function} method - * @param {Array} preparedArguments - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ResolverMethodHandler.prototype.handleCall = function (promiEvent, method, preparedArguments, callback) { - method.apply(this, preparedArguments).call() - .then(function (receipt) { - promiEvent.resolve(receipt); + return promiEvent; + } - if (_.isFunction(callback)) { - callback(receipt); - } - }).catch(function (error) { + /** + * Executes send + * + * @method send + * + * @param {Object} sendOptions + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + send(sendOptions, callback) { + const promiEvent = new this.promiEventPackage.PromiEvent(), + preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); + + this.parent.registry.resolver(this.ensName).then(resolver => { + this.parent.handleSend(promiEvent, resolver.methods[this.methodName], preparedArguments, sendOptions, callback); + }).catch(error => { promiEvent.reject(error); - - if (_.isFunction(callback)) { - callback(error); - } }); - return promiEvent; -}; - -/** - * Handles a send method - * - * @method handleSend - * - * @param {PromiEvent} promiEvent - * @param {function} method - * @param {Array} preparedArguments - * @param {Object} sendOptions - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {PromiEvent} - */ -ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, preparedArguments, sendOptions, callback) { - method.apply(this, preparedArguments).send(sendOptions) - .on('transactionHash', function (hash) { - promiEvent.emit('transactionHash', hash); - }) - .on('confirmation', function (confirmationNumber, receipt) { - promiEvent.emit('confirmation', confirmationNumber, receipt); - }) - .on('receipt', function (receipt) { - promiEvent.emit('receipt', receipt); - promiEvent.resolve(receipt); + return promiEvent; + } - if (_.isFunction(callback)) { - callback(receipt); - } - }) - .on('error', function (error) { - promiEvent.emit('error', error); + /** + * Handles a call method + * + * @method handleCall + * + * @param {PromiEvent} promiEvent + * @param {function} method + * @param {Array} preparedArguments + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + handleCall(promiEvent, method, preparedArguments, callback) { + method.apply(this, preparedArguments).call() + .then(receipt => { + promiEvent.resolve(receipt); + + if (_.isFunction(callback)) { + callback(receipt); + } + }).catch(error => { promiEvent.reject(error); if (_.isFunction(callback)) { @@ -182,29 +139,70 @@ ResolverMethodHandler.prototype.handleSend = function (promiEvent, method, prepa } }); - return promiEvent; -}; - -/** - * Adds the ENS node to the arguments - * - * @method prepareArguments - * - * @param {String} name - * @param {Array} methodArguments - * - * @returns {Array} - */ -ResolverMethodHandler.prototype.prepareArguments = function (name, methodArguments) { - var node = namehash.hash(name); - - if (methodArguments.length > 0) { - methodArguments.unshift(node); - - return methodArguments; + return promiEvent; } - return [node]; -}; + /** + * Handles a send method + * + * @method handleSend + * + * @param {PromiEvent} promiEvent + * @param {function} method + * @param {Array} preparedArguments + * @param {Object} sendOptions + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {PromiEvent} + */ + handleSend(promiEvent, method, preparedArguments, sendOptions, callback) { + method.apply(this, preparedArguments).send(sendOptions) + .on('transactionHash', hash => { + promiEvent.emit('transactionHash', hash); + }) + .on('confirmation', (confirmationNumber, receipt) => { + promiEvent.emit('confirmation', confirmationNumber, receipt); + }) + .on('receipt', receipt => { + promiEvent.emit('receipt', receipt); + promiEvent.resolve(receipt); + + if (_.isFunction(callback)) { + callback(receipt); + } + }) + .on('error', error => { + promiEvent.emit('error', error); + promiEvent.reject(error); + + if (_.isFunction(callback)) { + callback(error); + } + }); + + return promiEvent; + } -module.exports = ResolverMethodHandler; + /** + * Adds the ENS node to the arguments + * + * @method prepareArguments + * + * @param {String} name + * @param {Array} methodArguments + * + * @returns {Array} + */ + prepareArguments(name, methodArguments) { + const node = namehash.hash(name); + + if (methodArguments.length > 0) { + methodArguments.unshift(node); + + return methodArguments; + } + + return [node]; + } +} diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index 86980978c19..6f49e1c80f1 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -20,15 +20,15 @@ "use strict"; -var version = require('package.json').version; -var ContractPackage = require('web3-eth-contract'); -var PromiEventPackage = require('web3-core-promievent'); -var REGISTRY_ABI = require('../ressources/ABI/Registry'); -var RESOLVER_ABI = require('../ressources/ABI/Resolver'); -var ENSPackageFactory = require('./factories/ENSPackageFactory'); +import {version} from '../package.json'; +import ContractPackage from 'web3-eth-contract'; +import PromiEventPackage from 'web3-core-promievent'; +import REGISTRY_ABI from '../ressources/ABI/Registry'; +import RESOLVER_ABI from '../ressources/ABI/Resolver'; +import ENSPackageFactory from './factories/ENSPackageFactory'; -module.exports = { // TODO: overthink the ens package architecture and refactor it. - version: version, +export default { // TODO: overthink the ens package architecture and refactor it. + version, /** * Returns the ENS object @@ -41,7 +41,7 @@ module.exports = { // TODO: overthink the ens package architecture and refactor * * @returns {ENS} */ - ENS: function (provider, net, accounts) { + ENS(provider, net, accounts) { return new ENSPackageFactory().createENS( provider, net, From 95a757e48ad1b70b27f64c358124c21ac0ae41cc Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:03:07 +0200 Subject: [PATCH 0277/1045] web3-eth-iban ported to es6 --- packages/web3-eth-iban/src/Iban.js | 392 ++++++++++++++-------------- packages/web3-eth-iban/src/index.js | 11 +- 2 files changed, 201 insertions(+), 202 deletions(-) diff --git a/packages/web3-eth-iban/src/Iban.js b/packages/web3-eth-iban/src/Iban.js index 747122a31c0..5bf5751b268 100644 --- a/packages/web3-eth-iban/src/Iban.js +++ b/packages/web3-eth-iban/src/Iban.js @@ -25,14 +25,14 @@ "use strict"; -var utils = require('web3-utils'); -var BigNumber = require('bn.js'); +import utils from 'web3-utils'; +import BigNumber from 'bn.js'; -var leftPad = function (string, bytes) { - var result = string; +const leftPad = (string, bytes) => { + let result = string; while (result.length < bytes * 2) { - result = '0' + result; + result = `0${result}`; } return result; }; @@ -45,16 +45,16 @@ var leftPad = function (string, bytes) { * @param {String} iban the IBAN * @returns {String} the prepared IBAN */ -var iso13616Prepare = function (iban) { - var A = 'A'.charCodeAt(0); - var Z = 'Z'.charCodeAt(0); +const iso13616Prepare = iban => { + const A = 'A'.charCodeAt(0); + const Z = 'Z'.charCodeAt(0); iban = iban.toUpperCase(); - iban = iban.substr(4) + iban.substr(0,4); + iban = iban.substr(4) + iban.substr(0, 4); - return iban.split('').map(function(n){ - var code = n.charCodeAt(0); - if (code >= A && code <= Z){ + return iban.split('').map(n => { + const code = n.charCodeAt(0); + if (code >= A && code <= Z) { // A = 10, B = 11, ... Z = 35 return code - A + 10; } else { @@ -70,11 +70,10 @@ var iso13616Prepare = function (iban) { * @param {String} iban * @returns {Number} */ -var mod9710 = function (iban) { - var remainder = iban, - block; +const mod9710 = iban => { + let remainder = iban, block; - while (remainder.length > 2){ + while (remainder.length > 2) { block = remainder.slice(0, 9); remainder = parseInt(block, 10) % 97 + remainder.slice(block.length); } @@ -82,205 +81,206 @@ var mod9710 = function (iban) { return parseInt(remainder, 10) % 97; }; -/** - * This prototype should be used to create iban object from iban correct string - * - * @param {String} iban - */ -var Iban = function Iban(iban) { - this._iban = iban; -}; - -/** - * This method should be used to create an ethereum address from a direct iban address - * - * @method toAddress - * - * @param {String} ib - * - * @returns {String} - */ -Iban.toAddress = function (ib) { - ib = new Iban(ib); +export default class Iban { - if(!ib.isDirect()) { - throw new Error('IBAN is indirect and can\'t be converted'); + /** + * @param {String} iban + * + * @constructor + */ + constructor(iban) { + this._iban = iban; } - return ib.toAddress(); -}; - -/** - * This method should be used to create iban address from an ethereum address - * - * @method toIban - * - * @param {String} address - * - * @returns {String} the IBAN address - */ -Iban.toIban = function (address) { - return Iban.fromAddress(address).toString(); -}; + /** + * This method should be used to create an ethereum address from a direct iban address + * + * @method toAddress + * + * @param {String} ib + * + * @returns {String} + */ + static toAddress(ib) { + ib = new Iban(ib); + + if (!ib.isDirect()) { + throw new Error('IBAN is indirect and can\'t be converted'); + } -/** - * This method should be used to create iban object from an ethereum address - * - * @method fromAddress - * - * @param {String} address - * - * @returns {Iban} the IBAN object - */ -Iban.fromAddress = function (address) { - if(!utils.isAddress(address)){ - throw new Error('Provided address is not a valid address: '+ address); + return ib.toAddress(); } - address = address.replace('0x','').replace('0X',''); - - var asBn = new BigNumber(address, 16); - var base36 = asBn.toString(36); - var padded = leftPad(base36, 15); - return Iban.fromBban(padded.toUpperCase()); -}; + /** + * This method should be used to create iban address from an ethereum address + * + * @method toIban + * + * @param {String} address + * + * @returns {String} the IBAN address + */ + static toIban(address) { + return Iban.fromAddress(address).toString(); + } -/** - * Convert the passed BBAN to an IBAN for this country specification. - * Please note that "generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account". - * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits - * - * @method fromBban - * - * @param {String} bban the BBAN to convert to IBAN - * - * @returns {Iban} the IBAN object - */ -Iban.fromBban = function (bban) { - var countryCode = 'XE'; + /** + * This method should be used to create iban object from an ethereum address + * + * @method fromAddress + * + * @param {String} address + * + * @returns {Iban} the IBAN object + */ + static fromAddress(address) { + if (!utils.isAddress(address)) { + throw new Error(`Provided address is not a valid address: ${address}`); + } - var remainder = mod9710(iso13616Prepare(countryCode + '00' + bban)); - var checkDigit = ('0' + (98 - remainder)).slice(-2); + address = address.replace('0x', '').replace('0X', ''); - return new Iban(countryCode + checkDigit + bban); -}; + const asBn = new BigNumber(address, 16); + const base36 = asBn.toString(36); + const padded = leftPad(base36, 15); + return Iban.fromBban(padded.toUpperCase()); + } -/** - * Should be used to create IBAN object for given institution and identifier - * - * @method createIndirect - * - * @param {Object} options, required options are "institution" and "identifier" - * - * @returns {Iban} the IBAN object - */ -Iban.createIndirect = function (options) { - return Iban.fromBban('ETH' + options.institution + options.identifier); -}; + /** + * Convert the passed BBAN to an IBAN for this country specification. + * Please note that "generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account". + * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits + * + * @method fromBban + * + * @param {String} bban the BBAN to convert to IBAN + * + * @returns {Iban} the IBAN object + */ + static fromBban(bban) { + const countryCode = 'XE'; + + const remainder = mod9710(iso13616Prepare(`${countryCode}00${bban}`)); + const checkDigit = (`0${98 - remainder}`).slice(-2); + + return new Iban(countryCode + checkDigit + bban); + } -/** - * This method should be used to check if given string is valid iban object - * - * @method isValid - * - * @param {String} iban string - * - * @returns {Boolean} true if it is valid IBAN - */ -Iban.isValid = function (iban) { - var i = new Iban(iban); - return i.isValid(); -}; + /** + * Should be used to create IBAN object for given institution and identifier + * + * @method createIndirect + * + * @param {Object} options, required options are "institution" and "identifier" + * + * @returns {Iban} the IBAN object + */ + static createIndirect(options) { + return Iban.fromBban(`ETH${options.institution}${options.identifier}`); + } -/** - * Should be called to check if iban is correct - * - * @method isValid - * - * @returns {Boolean} true if it is, otherwise false - */ -Iban.prototype.isValid = function () { - return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) && - mod9710(iso13616Prepare(this._iban)) === 1; -}; + /** + * This method should be used to check if given string is valid iban object + * + * @method isValid + * + * @param {String} iban string + * + * @returns {Boolean} true if it is valid IBAN + */ + static isValid(iban) { + const i = new Iban(iban); + return i.isValid(); + } -/** - * Should be called to check if iban number is direct - * - * @method isDirect - * - * @returns {Boolean} true if it is, otherwise false - */ -Iban.prototype.isDirect = function () { - return this._iban.length === 34 || this._iban.length === 35; -}; + /** + * Should be called to check if iban is correct + * + * @method isValid + * + * @returns {Boolean} true if it is, otherwise false + */ + isValid() { + return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) && + mod9710(iso13616Prepare(this._iban)) === 1; + } -/** - * Should be called to check if iban number if indirect - * - * @method isIndirect - * - * @returns {Boolean} true if it is, otherwise false - */ -Iban.prototype.isIndirect = function () { - return this._iban.length === 20; -}; + /** + * Should be called to check if iban number is direct + * + * @method isDirect + * + * @returns {Boolean} true if it is, otherwise false + */ + isDirect() { + return this._iban.length === 34 || this._iban.length === 35; + } -/** - * Should be called to get iban checksum - * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003) - * - * @method checksum - * - * @returns {String} checksum - */ -Iban.prototype.checksum = function () { - return this._iban.substr(2, 2); -}; + /** + * Should be called to check if iban number if indirect + * + * @method isIndirect + * + * @returns {Boolean} true if it is, otherwise false + */ + isIndirect() { + return this._iban.length === 20; + } -/** - * Should be called to get institution identifier - * eg. XREG - * - * @method institution - * - * @returns {String} institution identifier - */ -Iban.prototype.institution = function () { - return this.isIndirect() ? this._iban.substr(7, 4) : ''; -}; + /** + * Should be called to get iban checksum + * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003) + * + * @method checksum + * + * @returns {String} checksum + */ + checksum() { + return this._iban.substr(2, 2); + } -/** - * Should be called to get client identifier within institution - * eg. GAVOFYORK - * - * @method client - * - * @returns {String} client identifier - */ -Iban.prototype.client = function () { - return this.isIndirect() ? this._iban.substr(11) : ''; -}; + /** + * Should be called to get institution identifier + * eg. XREG + * + * @method institution + * + * @returns {String} institution identifier + */ + institution() { + return this.isIndirect() ? this._iban.substr(7, 4) : ''; + } -/** - * Should be called to get client direct address - * - * @method toAddress - * - * @returns {String} ethereum address - */ -Iban.prototype.toAddress = function () { - if (this.isDirect()) { - var base36 = this._iban.substr(4); - var asBn = new BigNumber(base36, 36); - return utils.toChecksumAddress(asBn.toString(16, 20)); + /** + * Should be called to get client identifier within institution + * eg. GAVOFYORK + * + * @method client + * + * @returns {String} client identifier + */ + client() { + return this.isIndirect() ? this._iban.substr(11) : ''; } - return ''; -}; + /** + * Should be called to get client direct address + * + * @method toAddress + * + * @returns {String} ethereum address + */ + toAddress() { + if (this.isDirect()) { + const base36 = this._iban.substr(4); + const asBn = new BigNumber(base36, 36); + return utils.toChecksumAddress(asBn.toString(16, 20)); + } -Iban.prototype.toString = function () { - return this._iban; -}; + return ''; + } -module.exports = Iban; + toString() { + return this._iban; + } +} diff --git a/packages/web3-eth-iban/src/index.js b/packages/web3-eth-iban/src/index.js index 9c99136752c..fd52b78df4b 100644 --- a/packages/web3-eth-iban/src/index.js +++ b/packages/web3-eth-iban/src/index.js @@ -22,11 +22,10 @@ "use strict"; -var version = require('./package.json').version; -var Iban = require('./Iban.js'); +import {version} from './package.json'; +import Iban from './Iban.js'; -module.exports = { - version: version, - - Iban: Iban +export default { + version, + Iban }; From e4af60a6eed6dad2028612d682509eb5901f4b2e Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:05:28 +0200 Subject: [PATCH 0278/1045] web3-eth-personal ported to es6 --- packages/web3-eth-personal/src/Personal.js | 126 +++++++++--------- .../src/factories/MethodModelFactory.js | 35 ++--- packages/web3-eth-personal/src/index.js | 26 ++-- 3 files changed, 91 insertions(+), 96 deletions(-) diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 4e8506f6109..4bf088d78ef 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -22,71 +22,75 @@ "use strict"; -var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; +import {AbstractWeb3Module} from 'web3-core'; -/** - * TODO: Add missing documentation for getAccounts, lockAccount, importRawKey and sendTransaction! - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {MethodModelFactory} methodModelFactory - * @param {Network} net - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function Personal(provider, providersPackage, methodController, methodModelFactory, net, utils, formatters) { - AbstractWeb3Module.call(this, provider, providersPackage, methodController, methodModelFactory); +export default class Personal extends AbstractWeb3Module { - this.utils = utils; - this.formatters = formatters; - this.net = net; + /** + * TODO: Add missing documentation for getAccounts, lockAccount, importRawKey and sendTransaction! + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {MethodModelFactory} methodModelFactory + * @param {Network} net + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor( + provider, + providersPackage, + methodController, + methodModelFactory, + net, + utils, + formatters + ) { + super(provider, providersPackage, methodController, methodModelFactory); - var defaultAccount = null; - var defaultBlock = 'latest'; + this.utils = utils; + this.formatters = formatters; + this.net = net; - Object.defineProperty(this, 'defaultAccount', { - get: function () { - return defaultAccount; - }, - set: function (val) { - if(val) { - defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); - } - }, - enumerable: true - }); + let defaultAccount = null; + let defaultBlock = 'latest'; - Object.defineProperty(this, 'defaultBlock', { - get: function () { - return defaultBlock; - }, - set: function (val) { - defaultBlock = val; - }, - enumerable: true - }); -} - -Personal.prototype = Object.create(AbstractWeb3Module); -Personal.prototype.constructor = Personal; - -/** - * Extends setProvider method from AbstractWeb3Module. - * - * @method setProvider - * - * @param {Object|String} provider - * @param {Net} net - * - * @returns {Boolean} - */ -Personal.prototype.setProvider = function (provider, net) { - return !!(AbstractWeb3Module.setProvider.call(this, provider, net) && this.net.setProvider(provider, net)); -}; - -module.exports = Personal; + Object.defineProperty(this, 'defaultAccount', { + get: () => { + return defaultAccount; + }, + set: (val) => { + if (val) { + defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); + } + }, + enumerable: true + }); + Object.defineProperty(this, 'defaultBlock', { + get: () => { + return defaultBlock; + }, + set: (val) => { + defaultBlock = val; + }, + enumerable: true + }); + } + /** + * Extends setProvider method from AbstractWeb3Module. + * + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net + * + * @returns {Boolean} + */ + setProvider(provider, net) { + return !!(super.setProvider(provider, net) && this.net.setProvider(provider, net)); + } +} diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index e1e3aa8d95c..3614404e64a 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -22,18 +22,18 @@ "use strict"; -var web3CoreMethod = require('web3-core-method'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call( - this, - { +import web3CoreMethod from 'web3-core-method'; + +export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super({ getAccounts: web3CoreMethod.GetAccountsMethodModel, newAccount: web3CoreMethod.NewAccountMethodModel, unlockAccount: web3CoreMethod.UnlockAccountMethodModel, @@ -43,13 +43,6 @@ function MethodModelFactory(utils, formatters) { signTransaction: web3CoreMethod.PersonalSignTransactionMethodModel, sign: web3CoreMethod.PersonalSignMethodModel, ecRecover: web3CoreMethod.EcRecoverMethodModel - }, - utils, - formatters - ); + }, utils, formatters); + } } - -MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); -MethodModelFactory.prototype.constructor = MethodModelFactory; - -module.exports = MethodModelFactory; diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index e9205f566b2..075ddb82987 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -22,17 +22,17 @@ "use strict"; -var version = require('./package.json').version; -var Personal = require('./Personal'); -var MethodController = require('web3-core-method').MethodController; -var Network = require('web3-net').Network; -var ProvidersPackage = require('web3-providers'); -var Utils = require('web3-utils'); -var formatters = require('web3-core-helpers').formatters; -var MethodModelFactory = require('./factories/MethodModelFactory'); - -module.exports = { - version: version, +import {version} from './package.json'; +import Personal from './Personal'; +import {MethodController} from 'web3-core-method'; +import {Network} from 'web3-net'; +import ProvidersPackage from 'web3-providers'; +import Utils from 'web3-utils'; +import {formatters} from 'web3-core-helpers'; +import MethodModelFactory from './factories/MethodModelFactory'; + +export default { + version, /** * Returns the Personal object @@ -43,7 +43,7 @@ module.exports = { * * @returns {Personal} */ - Personal: function (provider) { + Personal: (provider) => { return new Personal( provider, ProvidersPackage, @@ -55,5 +55,3 @@ module.exports = { ); } }; - - From 0cd2dc6d678d3592132a52a934320cde23610efd Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:07:35 +0200 Subject: [PATCH 0279/1045] web3-net ported to es6 --- packages/web3-net/src/Network.js | 153 +++++++++--------- .../src/factories/MethodModelFactory.js | 35 ++-- packages/web3-net/src/index.js | 24 ++- 3 files changed, 104 insertions(+), 108 deletions(-) diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index 0fafa95415d..b9c60989663 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -23,78 +23,83 @@ "use strict"; -var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; - -/** - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {MethodModelFactory} methodModelFactory - * @param {Object} formatters - * @param {Object} utils - * - * @constructor - */ -function Network(provider, providersPackage, methodController, methodModelFactory, formatters, utils) { - AbstractWeb3Module.call(this, provider, providersPackage, methodController, methodModelFactory); - this.formatters = formatters; - this.utils = utils; +import {AbstractWeb3Module} from 'web3-core'; + +export default class Network extends AbstractWeb3Module { + + /** + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {MethodModelFactory} methodModelFactory + * @param {Object} formatters + * @param {Object} utils + * + * @constructor + */ + constructor( + provider, + providersPackage, + methodController, + methodModelFactory, + formatters, + utils + ) { + super(provider, providersPackage, methodController, methodModelFactory); + this.formatters = formatters; + this.utils = utils; + } + + /** + * Determines to which network web3 is currently connected + * + * @method getNetworkType + * + * @param {Function} callback + * + * @callback callback(error, result) + * @returns {Promise} + */ + getNetworkType(callback) { + let id; + + return this.getId().then(givenId => { + id = givenId; + + return this.getBlock(0, false); + }).then(genesis => { + let returnValue = 'private'; + switch (genesis) { + case genesis.hash === '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' && id === 1: + returnValue = 'main'; + break; + case genesis.hash === '0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303' && id === 2: + returnValue = 'morden'; + break; + case genesis.hash === '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d' && id === 3: + returnValue = 'ropsten'; + break; + case genesis.hash === '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177' && id === 4: + returnValue = 'rinkeby'; + break; + case genesis.hash === '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9' && id === 42: + returnValue = 'kovan'; + break; + } + + if (_.isFunction(callback)) { + callback(null, returnValue); + } + + return returnValue; + }).catch(err => { + if (_.isFunction(callback)) { + callback(err); + + return; + } + + throw err; + }); + } } - -Network.prototype = Object.create(AbstractWeb3Module.prototype); -Network.prototype.constructor = Network; - -/** - * Determines to which network web3 is currently connected - * - * @method getNetworkType - * - * @param {Function} callback - * - * @callback callback(error, result) - * @returns {Promise} - */ -Network.prototype.getNetworkType = function (callback) { - var self = this, id; - - return this.getId().then(function (givenId) { - id = givenId; - - return self.getBlock(0, false); - }).then(function (genesis) { - var returnValue = 'private'; - switch (genesis) { - case genesis.hash === '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' && id === 1: - returnValue = 'main'; - break; - case genesis.hash === '0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303' && id === 2: - returnValue = 'morden'; - break; - case genesis.hash === '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d' && id === 3: - returnValue = 'ropsten'; - break; - case genesis.hash === '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177' && id === 4: - returnValue = 'rinkeby'; - break; - case genesis.hash === '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9' && id === 42: - returnValue = 'kovan'; - break; - } - - if (_.isFunction(callback)) { - callback(null, returnValue); - } - - return returnValue; - }).catch(function (err) { - if (_.isFunction(callback)) { - callback(err); - - return; - } - - throw err; - }); -}; - -module.exports = Network; diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index 0210c49e6c6..b3192c19227 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -22,30 +22,23 @@ "use strict"; -var web3CoreMethod = require('web3-core-method'); - -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call( - this, - { +import web3CoreMethod from 'web3-core-method'; + +export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super({ getId: web3CoreMethod.VersionMethodModel, getBlock: web3CoreMethod.GetBlockMethodModel, isListening: web3CoreMethod.ListeningMethodModel, getPeerCount: web3CoreMethod.PeerCountMethodModel, - }, - utils, - formatters - ); + }, utils, formatters); + } } - -MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); -MethodModelFactory.prototype.constructor = MethodModelFactory; - -module.exports = MethodModelFactory; diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index 5914271f060..af6a73b5bfc 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -23,18 +23,16 @@ "use strict"; -var version = require('../package.json').version; -var ProvidersPackage = require('web3-providers'); -var MethodController = require('web3-core-method').MethodController; -var formatters = require('web3-core-helpers').formatters; -var utils = require('web3-utils'); -var Network = require('./Network'); -var MethodModelFactory = require('./factories/MethodModelFactory'); - - -module.exports = { - version: version, - +import {version} from '../package.json'; +import ProvidersPackage from 'web3-providers'; +import {MethodController} from 'web3-core-method'; +import {formatters} from 'web3-core-helpers'; +import utils from 'web3-utils'; +import Network from './Network'; +import MethodModelFactory from './factories/MethodModelFactory'; + +export default { + version, /** * Creates the Network Object * @@ -44,7 +42,7 @@ module.exports = { * * @returns {Network} */ - Network: function (provider) { + Network: (provider) => { return new Network( provider, ProvidersPackage, From 8c669304e5dcd941538862765aaf435b8b17a698 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:18:17 +0200 Subject: [PATCH 0280/1045] web3-providers ported to es6 --- .../lib/adapters/AbstractProviderAdapter.js | 226 +++--- .../src/adapters/HttpProviderAdapter.js | 28 +- .../src/adapters/InpageProviderAdapter.js | 52 +- .../src/adapters/SocketProviderAdapter.js | 272 ++++--- .../src/batch-request/BatchRequest.js | 145 ++-- .../src/detectors/ProviderDetector.js | 158 ++-- .../src/factories/ProvidersPackageFactory.js | 231 +++--- packages/web3-providers/src/index.js | 44 +- .../src/mappers/JSONRpcMapper.js | 14 +- .../src/providers/HttpProvider.js | 189 ++--- .../src/providers/IpcProvider.js | 569 +++++++------- .../src/providers/WebsocketProvider.js | 692 +++++++++--------- .../src/resolvers/ProviderAdapterResolver.js | 115 +-- .../validators/JSONRpcResponseValidator.js | 69 +- 14 files changed, 1381 insertions(+), 1423 deletions(-) diff --git a/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js index 624e33ece29..95ab5890b53 100644 --- a/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js @@ -22,137 +22,133 @@ "use strict"; -var JSONRpcMapper = require('../../src/mappers/JSONRpcMapper.js'); -var JSONRpcResponseValidator = require('../../src/validators/JSONRpcResponseValidator.js'); -var errors = require('web3-core-helpers').errors; -var EventEmitter = require('eventemitter3'); +import JSONRpcMapper from '../../src/mappers/JSONRpcMapper.js'; +import JSONRpcResponseValidator from '../../src/validators/JSONRpcResponseValidator.js'; +import {errors} from 'web3-core-helpers'; +import EventEmitter from 'eventemitter3'; + +export default class AbstractProviderAdapter extends EventEmitter { + + /** + * @param {Object} provider + * + * @constructor + */ + constructor(provider) { + super(); + this.provider = provider; + } -/** - * @param {Object} provider - * - * @constructor - */ -function AbstractProviderAdapter(provider) { - this.provider = provider; -} + /** + * Sends the JSON-RPC request + * + * @method send + * + * @param {String} method + * @param {Array} parameters + * + * @returns {Promise} + */ + send(method, parameters) { + const payload = JSONRpcMapper.toPayload(method, parameters); + + return new Promise((resolve, reject) => { + this.provider.send(payload, (error, response) => { + this.handleResponse(reject, resolve, error, response) + }); -AbstractProviderAdapter.prototype = Object.create(EventEmitter.prototype); -AbstractProviderAdapter.prototype.constructor = AbstractProviderAdapter; + }); + } -/** - * Sends the JSON-RPC request - * - * @method send - * - * @param {String} method - * @param {Array} parameters - * - * @returns {Promise} - */ -AbstractProviderAdapter.prototype.send = function (method, parameters) { - var self = this; - var payload = JSONRpcMapper.toPayload(method, parameters); + /** + * Sends batch payload + * + * @method sendBatch + * + * @param {Array} payload + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + sendBatch(payload, callback) { + this.provider.send(payload, callback); + } - return new Promise(function (resolve, reject) { - self.provider.send(payload, function (error, response) { - self.handleResponse(reject, resolve, error, response) + /** + * Returns Promise with an error if the method is not overwritten + * + * @method subscribe + * + * @returns {Promise} + */ + subscribe() { + return new Promise((resolve, reject) => { + reject(new Error(`The current provider does not support subscriptions: ${this.provider.constructor.name}`)); }); + } - }); -}; + /** + * Returns Promise with an error if the method is not overwritten + * + * @method unsubscribe + * + * @returns {Promise} + */ + unsubscribe() { + return new Promise((resolve, reject) => { + reject(new Error(`The current provider does not support subscriptions: ${this.provider.constructor.name}`)); + }); + } -/** - * Sends batch payload - * - * @method sendBatch - * - * @param {Array} payload - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -AbstractProviderAdapter.prototype.sendBatch = function (payload, callback) { - this.provider.send(payload, callback); -}; + /** + * Handles the JSON-RPC response + * + * @method handleResponse + * + * @param {Function} reject + * @param {Function} resolve + * @param {Object} error + * @param {Object} response + */ + handleResponse(reject, resolve, error, response) { + if (response && response.id && payload.id !== response.id) { + reject( + new Error(`Wrong response id "${response.id}" (expected: "${payload.id}") in ${JSON.stringify(payload)}`) + ); -/** - * Returns Promise with an error if the method is not overwritten - * - * @method subscribe - * - * @returns {Promise} - */ -AbstractProviderAdapter.prototype.subscribe = function () { - var self = this; - return new Promise(function(resolve, reject) { - reject(new Error('The current provider does not support subscriptions: ' + self.provider.constructor.name)); - }); -}; + return; + } -/** - * Returns Promise with an error if the method is not overwritten - * - * @method unsubscribe - * - * @returns {Promise} - */ -AbstractProviderAdapter.prototype.unsubscribe = function () { - var self = this; - return new Promise(function(resolve, reject) { - reject(new Error('The current provider does not support subscriptions: ' + self.provider.constructor.name)); - }); -}; + if (response && response.error) { + reject(errors.ErrorResponse(response)); -/** - * Handles the JSON-RPC response - * - * @method handleResponse - * - * @param {Function} reject - * @param {Function} resolve - * @param {Object} error - * @param {Object} response - */ -AbstractProviderAdapter.prototype.handleResponse = function (reject, resolve, error, response) { - if (response && response.id && payload.id !== response.id) { - reject( - new Error('Wrong response id "' + response.id + '" (expected: "' + payload.id + '") in ' + JSON.stringify(payload)) - ); + return; + } - return; - } - if (response && response.error) { - reject(errors.ErrorResponse(response)); + if (!JSONRpcResponseValidator.isValid(response.result)) { + reject(errors.InvalidResponse(response)); - return; - } + return; + } + if (!error) { + resolve(response.result); - if (!JSONRpcResponseValidator.isValid(response.result)) { - reject(errors.InvalidResponse(response)); + return; + } - return; + reject(error); } - if (!error) { - resolve(response.result); - - return; + /** + * Checks if the provider is connected + * + * @method isConnected + * + * @returns {Boolean} + */ + isConnected() { + return this.provider.connected; } - - reject(error); -}; - -/** - * Checks if the provider is connected - * - * @method isConnected - * - * @returns {Boolean} - */ -AbstractProviderAdapter.prototype.isConnected = function () { - return this.provider.connected; -}; - -module.exports = AbstractProviderAdapter; +} diff --git a/packages/web3-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-providers/src/adapters/HttpProviderAdapter.js index 6b3e92c02c4..8b0a5529583 100644 --- a/packages/web3-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-providers/src/adapters/HttpProviderAdapter.js @@ -22,19 +22,17 @@ "use strict"; -var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapter'); - -/** - * @param {HttpProvider} httpProvider - * - * @constructor - */ -function HttpProviderAdapter(httpProvider) { - AbstractProviderAdapter.call(this, httpProvider); - this.host = httpProvider.host; +import AbstractProviderAdapter from '../../lib/adapters/AbstractProviderAdapter'; + +export default class HttpProviderAdapter extends AbstractProviderAdapter { + + /** + * @param {HttpProvider} httpProvider + * + * @constructor + */ + constructor(httpProvider) { + super(httpProvider); + this.host = httpProvider.host; + } } - -HttpProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); -HttpProviderAdapter.prototype.constructor = HttpProviderAdapter; - -module.exports = HttpProviderAdapter; diff --git a/packages/web3-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-providers/src/adapters/InpageProviderAdapter.js index 75210c7ab55..de68a476035 100644 --- a/packages/web3-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-providers/src/adapters/InpageProviderAdapter.js @@ -22,31 +22,29 @@ "use strict"; -var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapter'); - -/** - * @param {Object} inpageProvider - * - * @constructor - */ -function InpageProviderAdapter(inpageProvider) {// TODO: Check if there is a way to set a host property (will be used on setProvider) - AbstractProviderAdapter.call(this, inpageProvider); - this.provider.send = this.provider.sendAsync; - delete this.provider.sendAsync; +import AbstractProviderAdapter from '../../lib/adapters/AbstractProviderAdapter'; + +export default class InpageProviderAdapter extends AbstractProviderAdapter { + + /** + * @param {Object} inpageProvider + * + * @constructor + */ + constructor(inpageProvider) {// TODO: Check if there is a way to set a host property (will be used on setProvider) + super(inpageProvider); + this.provider.send = this.provider.sendAsync; + delete this.provider.sendAsync; + } + + /** + * Checks if the provider is connected + * + * @method isConnected + * + * @returns {Boolean} + */ + isConnected() { + return this.provider.isConnected; + } } - -InpageProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); -InpageProviderAdapter.prototype.constructor = InpageProviderAdapter; - -/** - * Checks if the provider is connected - * - * @method isConnected - * - * @returns {Boolean} - */ -InpageProviderAdapter.prototype.isConnected = function () { - return this.provider.isConnected; -}; - -module.exports = InpageProviderAdapter; diff --git a/packages/web3-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-providers/src/adapters/SocketProviderAdapter.js index e24a8a5d406..3125ccab8f6 100644 --- a/packages/web3-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-providers/src/adapters/SocketProviderAdapter.js @@ -22,144 +22,136 @@ "use strict"; -var AbstractProviderAdapter = require('../../lib/adapters/AbstractProviderAdapter'); - -/** - * @param {Object} provider - * - * @constructor - */ -function SocketProviderAdapter(provider) { - AbstractProviderAdapter.call(this, provider); - this.host = provider.path; - this.subscriptions = []; - this.registerSubscriptionListener(); +import AbstractProviderAdapter from '../../lib/adapters/AbstractProviderAdapter'; + +export default class SocketProviderAdapter extends AbstractProviderAdapter { + + /** + * @param {Object} provider + * + * @constructor + */ + constructor(provider) { + super(provider); + this.host = provider.path; + this.subscriptions = []; + this.registerSubscriptionListener(); + } + + /** + * Subscribes to a given subscriptionType + * + * @method subscribe + * + * @param {String} subscriptionMethod + * @param {String} subscriptionType + * @param {Array} parameters + * + * @returns {Promise} + */ + subscribe(subscriptionType, subscriptionMethod, parameters) { + return this.send(subscriptionType, parameters.unshift(subscriptionMethod)).then((error, subscriptionId) => { + if (!error) { + this.subscriptions.push(subscriptionId); + + return subscriptionId; + } + + throw new Error(`Provider error: ${error}`); + }); + } + + /** + * Unsubscribes the subscription by his id + * + * @method unsubscribe + * + * @param {String} subscriptionId + * @param {String} subscriptionType + * + * @returns {Promise} + */ + unsubscribe(subscriptionId, subscriptionType) { + return this.send(subscriptionType, [subscriptionId]).then(function (result) { + if (result) { + this.subscriptions = this.subscriptions.filter(subscription => { + return subscription !== subscriptionId; + }); + + return true; + } + + return false; + }); + } + + /** + * Emits an event with the subscription id + * + * @method registerSubscriptionListener + */ + registerSubscriptionListener() { + this.provider.on('data', (response, deprecatedResponse) => { + // this is for possible old providers, which may had the error first handler + response = response || deprecatedResponse; + + // check for result.method, to prevent old providers errors to pass as result + if (response.method && this.hasSubscription(response.params.subscription)) { + this.emit(response.params.subscription, response.params.result); + } + }); + } + + /** + * Checks if the given subscription id exists + * + * @method hasSubscription + * + * @param {String} subscriptionId + * + * @returns {Boolean} + */ + hasSubscription(subscriptionId) { + return this.subscriptions.indexOf(subscriptionId) > -1; + } + + /** + * Clears all subscriptions and listeners + * + * @method clearSubscriptions + */ + clearSubscriptions() { + const unsubscribePromises = []; + + this.subscriptions.forEach(subscriptionId => { + unsubscribePromises.push(this.unsubscribe(subscriptionId)); + }); + + Promise.all(unsubscribePromises).then(() => { + this.provider.reset(); + this.subscriptions = []; + }); + } + + /** + * Removes subscription from subscriptions list and unsubscribes it. + * + * @method removeSubscription + * + * @param {String} subscriptionId + * @param {String} subscriptionType + * + * @returns {Promise} + */ + removeSubscription(subscriptionId, subscriptionType) { + return this.unsubscribe(subscriptionId, subscriptionType).then((result) => { + if (result) { + delete this.subscriptions[this.subscriptions.indexOf(subscriptionId)]; + + return true; + } + + return false; + }); + } } - -SocketProviderAdapter.prototype = Object.create(AbstractProviderAdapter.prototype); -SocketProviderAdapter.prototype.constructor = SocketProviderAdapter; - -/** - * Subscribes to a given subscriptionType - * - * @method subscribe - * - * @param {String} subscriptionMethod - * @param {String} subscriptionType - * @param {Array} parameters - * - * @returns {Promise} - */ -SocketProviderAdapter.prototype.subscribe = function (subscriptionType, subscriptionMethod, parameters) { - var self = this; - - return this.send(subscriptionType, parameters.unshift(subscriptionMethod)).then(function (error, subscriptionId) { - if (!error) { - self.subscriptions.push(subscriptionId); - - return subscriptionId; - } - - throw new Error('Provider error: ' + error); - }); -}; - -/** - * Unsubscribes the subscription by his id - * - * @method unsubscribe - * - * @param {String} subscriptionId - * @param {String} subscriptionType - * - * @returns {Promise} - */ -SocketProviderAdapter.prototype.unsubscribe = function (subscriptionId, subscriptionType) { - return this.send(subscriptionType, [subscriptionId]).then(function (result) { - if (result) { - this.subscriptions = this.subscriptions.filter(function (subscription) { - return subscription !== subscriptionId; - }); - - return true; - } - - return false; - }); -}; - -/** - * Emits an event with the subscription id - * - * @method registerSubscriptionListener - */ -SocketProviderAdapter.prototype.registerSubscriptionListener = function () { - var self = this; - this.provider.on('data', function (response, deprecatedResponse) { - // this is for possible old providers, which may had the error first handler - response = response || deprecatedResponse; - - // check for result.method, to prevent old providers errors to pass as result - if (response.method && self.hasSubscription(response.params.subscription)) { - self.emit(response.params.subscription, response.params.result); - } - }); -}; - -/** - * Checks if the given subscription id exists - * - * @method hasSubscription - * - * @param {String} subscriptionId - * - * @returns {Boolean} - */ -SocketProviderAdapter.prototype.hasSubscription = function (subscriptionId) { - return this.subscriptions.indexOf(subscriptionId) > -1; -}; - -/** - * Clears all subscriptions and listeners - * - * @method clearSubscriptions - */ -SocketProviderAdapter.prototype.clearSubscriptions = function () { - var self = this, - unsubscribePromises = []; - - this.subscriptions.forEach(function (subscriptionId) { - unsubscribePromises.push(self.unsubscribe(subscriptionId)); - }); - - Promise.all(unsubscribePromises).then(function () { - this.provider.reset(); - self.subscriptions = []; - }); -}; - -/** - * Removes subscription from subscriptions list and unsubscribes it. - * - * @method removeSubscription - * - * @param {String} subscriptionId - * @param {String} subscriptionType - * - * @returns {Promise} - */ -SocketProviderAdapter.prototype.removeSubscription = function (subscriptionId, subscriptionType) { - var self = this; - - return this.unsubscribe(subscriptionId, subscriptionType).then(function (result) { - if (result) { - delete self.subscriptions[this.subscriptions.indexOf(subscriptionId)]; - - return true; - } - - return false; - }); -}; - -module.exports = SocketProviderAdapter; diff --git a/packages/web3-providers/src/batch-request/BatchRequest.js b/packages/web3-providers/src/batch-request/BatchRequest.js index 4c27185812a..3dd1fc0aa06 100644 --- a/packages/web3-providers/src/batch-request/BatchRequest.js +++ b/packages/web3-providers/src/batch-request/BatchRequest.js @@ -22,86 +22,85 @@ "use strict"; -var errors = require('web3-core-helpers').errors; -var _ = require('underscore'); +import {errors} from 'web3-core-helpers'; +import _ from 'underscore'; -/** - * - * @param {AbstractProviderAdapter} provider - * @param {JSONRpcMapper} jsonRpcMapper - * @param {JSONRpcResponseValidator} jsonRpcResponseValidator - * - * @constructor - */ -function BatchRequest(provider, jsonRpcMapper, jsonRpcResponseValidator) { - this.provider = provider; - this.jsonRpcMapper = jsonRpcMapper; - this.jsonRpcResponseValidator = jsonRpcResponseValidator; - this.requests = []; -} +export default class BatchRequest { -/** - * Should be called to add create new request to batch request - * - * @method add - * - * @param {Object} request - */ -BatchRequest.prototype.add = function (request) { - this.requests.push(request); -}; + /** + * @param {AbstractProviderAdapter} provider + * @param {JSONRpcMapper} jsonRpcMapper + * @param {JSONRpcResponseValidator} jsonRpcResponseValidator + * + * @constructor + */ + constructor(provider, jsonRpcMapper, jsonRpcResponseValidator) { + this.provider = provider; + this.jsonRpcMapper = jsonRpcMapper; + this.jsonRpcResponseValidator = jsonRpcResponseValidator; + this.requests = []; + } -/** - * Should be called to execute batch request - * - * @method execute - */ -BatchRequest.prototype.execute = function () { - var self = this; - this.provider.sendBatch( - this.jsonRpcMapper.toBatchPayload(this.requests), - function (err, results) { - if (!_.isArray(results)) { - request.callback(errors.InvalidResponse(results)); + /** + * Should be called to add create new request to batch request + * + * @method add + * + * @param {Object} request + */ + add(request) { + this.requests.push(request); + } - return; - } + /** + * Should be called to execute batch request + * + * @method execute + */ + execute() { + this.provider.sendBatch( + this.jsonRpcMapper.toBatchPayload(this.requests), + (err, results) => { + if (!_.isArray(results)) { + request.callback(errors.InvalidResponse(results)); + + return; + } - self.requests.forEach(function (request, index) { - var result = results[index] || null; + this.requests.forEach(function (request, index) { + const result = results[index] || null; - if (_.isFunction(request.callback)) { - if (_.isObject(result) && result.error) { - request.callback(errors.ErrorResponse(result)); - } + if (_.isFunction(request.callback)) { + if (_.isObject(result) && result.error) { + request.callback(errors.ErrorResponse(result)); + } - if (!this.jsonRpcResponseValidator.isValid(result)) { - request.callback(errors.InvalidResponse(result)); - } + if (!this.jsonRpcResponseValidator.isValid(result)) { + request.callback(errors.InvalidResponse(result)); + } - try { - var mappedResult = request.afterExecution(result.result); - request.callback(null, mappedResult); - } catch (err) { - request.callback(err, null); + try { + const mappedResult = request.afterExecution(result.result); + request.callback(null, mappedResult); + } catch (err) { + request.callback(err, null); + } } - } - }); - } - ); -}; - -/** - * Checks if the method has an outputFormatter defined - * - * @method hasOutputFormatter - * - * @param {Object} request - * - * @returns {Boolean} - */ -BatchRequest.prototype.hasOutputFormatter = function (request) { - return _.isFunction(request.methodModel.outputFormatter); -}; + }); + } + ); + } -module.exports = BatchRequest; + /** + * Checks if the method has an outputFormatter defined + * + * @method hasOutputFormatter + * + * @param {Object} request + * + * @returns {Boolean} + */ + hasOutputFormatter(request) { + return _.isFunction(request.methodModel.outputFormatter); + } +} diff --git a/packages/web3-providers/src/detectors/ProviderDetector.js b/packages/web3-providers/src/detectors/ProviderDetector.js index ab416d000d5..76959210ece 100644 --- a/packages/web3-providers/src/detectors/ProviderDetector.js +++ b/packages/web3-providers/src/detectors/ProviderDetector.js @@ -20,97 +20,93 @@ * @date 2018 */ -var global; +let global; try { global = Function('return this')(); } catch (e) { global = window; } -/** - * @constructor - */ -function ProviderDetector() { } - -/** - * Detects which provider is given with web3.currentProvider - * - * @method detect - * - * @returns {Object} provider - */ -ProviderDetector.prototype.detect = function () { - if (typeof global.ethereumProvider !== 'undefined') { - return global.ethereumProvider; - } - - if (typeof global.web3 !== 'undefined' && global.web3.currentProvider) { - - if (this.isIpcProviderWrapper(global.web3.currentProvider)) { - global.web3.currentProvider = this.addSubscriptionsToIpcProviderWrapper(global.web3.currentProvider); +export default class ProviderDetector { + + /** + * Detects which provider is given with web3.currentProvider + * + * @method detect + * + * @returns {Object} provider + */ + detect() { + if (typeof global.ethereumProvider !== 'undefined') { + return global.ethereumProvider; } - return global.web3.currentProvider; - } -}; + if (typeof global.web3 !== 'undefined' && global.web3.currentProvider) { -/** - * Checks if the given provider it is of type ipcProviderWrapper - * - * @method isIpcProviderWrapper - * - * @param {Object} currentProvider - * - * @returns {Boolean} - */ -ProviderDetector.prototype.isIpcProviderWrapper = function (currentProvider) { - return !currentProvider.on && - currentProvider.connection && - currentProvider.connection.constructor.name === 'ipcProviderWrapper'; -}; - -/** - * Adds the on method for the subscriptions to the ipcProviderWrapper - * - * @method addSubscriptionsToIpcProviderWrapper - * - * @param {Object} provider - * - * @returns {Object} - */ -ProviderDetector.prototype.addSubscriptionsToIpcProviderWrapper = function (provider) { - provider.on = function (type, callback) { - if (typeof callback !== 'function') { - throw new Error('The second parameter callback must be a function.'); - } + if (this.isIpcProviderWrapper(global.web3.currentProvider)) { + global.web3.currentProvider = this.addSubscriptionsToIpcProviderWrapper(global.web3.currentProvider); + } - switch (type) { - case 'data': - this.connection.on('data', function (data) { - var result = ''; - - data = data.toString(); - - try { - result = JSON.parse(data); - } catch (e) { - return callback(new Error('Couldn\'t parse response data' + data)); - } - - // notification - if (!result.id && result.method.indexOf('_subscription') !== -1) { - callback(null, result); - } - - }); - break; - default: - this.connection.on(type, callback); - break; + return global.web3.currentProvider; } - }; + } - return provider; -}; + /** + * Checks if the given provider it is of type ipcProviderWrapper + * + * @method isIpcProviderWrapper + * + * @param {Object} currentProvider + * + * @returns {Boolean} + */ + isIpcProviderWrapper(currentProvider) { + return !currentProvider.on && + currentProvider.connection && + currentProvider.connection.constructor.name === 'ipcProviderWrapper'; + } -module.exports = ProviderDetector; + /** + * Adds the on method for the subscriptions to the ipcProviderWrapper + * + * @method addSubscriptionsToIpcProviderWrapper + * + * @param {Object} provider + * + * @returns {Object} + */ + addSubscriptionsToIpcProviderWrapper(provider) { + provider.on = (type, callback) => { + if (typeof callback !== 'function') { + throw new Error('The second parameter callback must be a function.'); + } + + switch (type) { + case 'data': + this.connection.on('data', data => { + let result = ''; + + data = data.toString(); + + try { + result = JSON.parse(data); + } catch (e) { + return callback(new Error(`Couldn't parse response data${data}`)); + } + + // notification + if (!result.id && result.method.indexOf('_subscription') !== -1) { + callback(null, result); + } + + }); + break; + default: + this.connection.on(type, callback); + break; + } + }; + + return provider; + } +} diff --git a/packages/web3-providers/src/factories/ProvidersPackageFactory.js b/packages/web3-providers/src/factories/ProvidersPackageFactory.js index 7fea0048d74..c7de3843f81 100644 --- a/packages/web3-providers/src/factories/ProvidersPackageFactory.js +++ b/packages/web3-providers/src/factories/ProvidersPackageFactory.js @@ -20,131 +20,128 @@ * @date 2018 */ -var ProviderAdapterResolver = require('../resolvers/ProviderAdapterResolver'); -var ProviderDetector = require('../detectors/ProviderDetector'); -var SocketProviderAdapter = require('../adapters/SocketProviderAdapter'); -var InpageProviderAdapter = require('../adapters/InpageProviderAdapter'); -var HttpProviderAdapter = require('../adapters/HttpProviderAdapter'); -var WebsocketProvider = require('../providers/WebsocketProvider'); -var IpcProvider = require('../providers/IpcProvider'); -var HttpProvider = require('../providers/HttpProvider'); -var JSONRpcResponseValidator = require('../validators/JSONRpcResponseValidator'); +import ProviderAdapterResolver from '../resolvers/ProviderAdapterResolver'; -/** - * @constructor - */ -function ProvidersPackageFactory() { } +import ProviderDetector from '../detectors/ProviderDetector'; +import SocketProviderAdapter from '../adapters/SocketProviderAdapter'; +import InpageProviderAdapter from '../adapters/InpageProviderAdapter'; +import HttpProviderAdapter from '../adapters/HttpProviderAdapter'; +import WebsocketProvider from '../providers/WebsocketProvider'; +import IpcProvider from '../providers/IpcProvider'; +import HttpProvider from '../providers/HttpProvider'; +import JSONRpcResponseValidator from '../validators/JSONRpcResponseValidator'; -/** - * Returns an ProviderAdapterResolver object - * - * @method createProviderAdapterResolver - * - * @returns {ProviderAdapterResolver} - */ -ProvidersPackageFactory.prototype.createProviderAdapterResolver = function () { - return new ProviderAdapterResolver(this); -}; +export default class ProvidersPackageFactory { -/** - * Returns an ProviderDetector object - * - * @method createProviderDetector - * - * @returns {ProviderDetector} - */ -ProvidersPackageFactory.prototype.createProviderDetector = function () { - return new ProviderDetector(); -}; + /** + * Returns an ProviderAdapterResolver object + * + * @method createProviderAdapterResolver + * + * @returns {ProviderAdapterResolver} + */ + createProviderAdapterResolver() { + return new ProviderAdapterResolver(this); + } -/** - * Returns an HttpProvider object - * - * @method createHttpProvider - * - * @param {String} url - * - * @returns {HttpProvider} - */ -ProvidersPackageFactory.prototype.createHttpProvider = function (url) { - return new HttpProvider(url); -}; + /** + * Returns an ProviderDetector object + * + * @method createProviderDetector + * + * @returns {ProviderDetector} + */ + createProviderDetector() { + return new ProviderDetector(); + } -/** - * Return an WebsocketProvider object - * - * @method createWebsocketProvider - * - * @param {String} url - * - * @returns {WebsocketProvider} - */ -ProvidersPackageFactory.prototype.createWebsocketProvider = function (url) { - return new WebsocketProvider(url); -}; + /** + * Returns an HttpProvider object + * + * @method createHttpProvider + * + * @param {String} url + * + * @returns {HttpProvider} + */ + createHttpProvider(url) { + return new HttpProvider(url); + } -/** - * Returns an IpcProvider object - * - * @method createIpcProvider - * - * @param {String} path - * @param {Net} net - * - * @returns {IpcProvider} - */ -ProvidersPackageFactory.prototype.createIpcProvider = function (path, net) { - return new IpcProvider(path, net); -}; + /** + * Return an WebsocketProvider object + * + * @method createWebsocketProvider + * + * @param {String} url + * + * @returns {WebsocketProvider} + */ + createWebsocketProvider(url) { + return new WebsocketProvider(url); + } -/** - * Returns an HttpProviderAdapter object - * - * @method createHttpProviderAdapter - * - * @param {HttpProvider} provider - * - * @returns {HttpProviderAdapter} - */ -ProvidersPackageFactory.prototype.createHttpProviderAdapter = function (provider) { - return new HttpProviderAdapter(provider); -}; + /** + * Returns an IpcProvider object + * + * @method createIpcProvider + * + * @param {String} path + * @param {Net} net + * + * @returns {IpcProvider} + */ + createIpcProvider(path, net) { + return new IpcProvider(path, net); + } -/** - * Returns an SocketProviderAdapter object - * - * @method createSocketProviderAdapter - * - * @param {WebsocketProvider|IpcProvider} provider - * - * @returns {SocketProviderAdapter} - */ -ProvidersPackageFactory.prototype.createSocketProviderAdapter = function (provider) { - return new SocketProviderAdapter(provider) -}; + /** + * Returns an HttpProviderAdapter object + * + * @method createHttpProviderAdapter + * + * @param {HttpProvider} provider + * + * @returns {HttpProviderAdapter} + */ + createHttpProviderAdapter(provider) { + return new HttpProviderAdapter(provider); + } -/** - * Returns an InpageProviderAdapter object - * - * @method createInpageProviderAdapter - * - * @param {Object} provider - * - * @returns {InpageProviderAdapter} - */ -ProvidersPackageFactory.prototype.createInpageProviderAdapter = function (provider) { - return new InpageProviderAdapter(provider) -}; + /** + * Returns an SocketProviderAdapter object + * + * @method createSocketProviderAdapter + * + * @param {WebsocketProvider|IpcProvider} provider + * + * @returns {SocketProviderAdapter} + */ + createSocketProviderAdapter(provider) { + return new SocketProviderAdapter(provider) + } -/** - * Returns an JSONRpcResponseValidator object - * - * @method createJSONRpcResponseValidator - * - * @returns {JSONRpcResponseValidator} - */ -ProvidersPackageFactory.prototype.createJSONRpcResponseValidator = function () { - return new JSONRpcResponseValidator(); -}; + /** + * Returns an InpageProviderAdapter object + * + * @method createInpageProviderAdapter + * + * @param {Object} provider + * + * @returns {InpageProviderAdapter} + */ + createInpageProviderAdapter(provider) { + return new InpageProviderAdapter(provider) + } -module.exports = ProvidersPackageFactory; + /** + * Returns an JSONRpcResponseValidator object + * + * @method createJSONRpcResponseValidator + * + * @returns {JSONRpcResponseValidator} + */ + createJSONRpcResponseValidator() { + return new JSONRpcResponseValidator(); + } +} diff --git a/packages/web3-providers/src/index.js b/packages/web3-providers/src/index.js index 75974530b2f..20c86d63011 100644 --- a/packages/web3-providers/src/index.js +++ b/packages/web3-providers/src/index.js @@ -20,29 +20,29 @@ "use strict"; -var version = require('../package.json').version; -var ProvidersPackageFactory = require('./factories/ProvidersPackageFactory'); -var SocketProviderAdapter = require('./adapters/SocketProviderAdapter'); -var HttpProviderAdapter = require('./adapters/HttpProviderAdapter'); -var HttpProvider = require('./providers/HttpProvider'); -var IpcProvider = require('./providers/IpcProvider'); -var WebsocketProvider = require('./providers/WebsocketProvider'); -var JSONRpcMapper = require('./mappers/JSONRpcMapper'); -var JSONRpcResponseValidator = require('./validators/JSONRpcResponseValidator'); -var BatchRequest = require('./batch-request/BatchRequest'); +import {version} from '../package.json'; +import ProvidersPackageFactory from './factories/ProvidersPackageFactory'; +import SocketProviderAdapter from './adapters/SocketProviderAdapter'; +import HttpProviderAdapter from './adapters/HttpProviderAdapter'; +import HttpProvider from './providers/HttpProvider'; +import IpcProvider from './providers/IpcProvider'; +import WebsocketProvider from './providers/WebsocketProvider'; +import JSONRpcMapper from './mappers/JSONRpcMapper'; +import JSONRpcResponseValidator from './validators/JSONRpcResponseValidator'; +import BatchRequest from './batch-request/BatchRequest'; -module.exports = { - version: version, +export default { + version, - SocketProviderAdapter: SocketProviderAdapter, - HttpProviderAdapter: HttpProviderAdapter, + SocketProviderAdapter, + HttpProviderAdapter, - HttpProvider: HttpProvider, - IpcProvider: IpcProvider, - WebsocketProvider: WebsocketProvider, + HttpProvider, + IpcProvider, + WebsocketProvider, - JSONRpcMapper: JSONRpcMapper, - JSONRpcResponseValidator: JSONRpcResponseValidator, + JSONRpcMapper, + JSONRpcResponseValidator, /** * Returns the Batch object @@ -53,7 +53,7 @@ module.exports = { * * @returns {BatchRequest} */ - BatchRequest: function (provider) { + BatchRequest: (provider) => { return new BatchRequest( provider, JSONRpcMapper, @@ -71,7 +71,7 @@ module.exports = { * * @returns {AbstractProviderAdapter} */ - resolve: function (provider, net) { + resolve: (provider, net) => { return new ProvidersPackageFactory().createProviderAdapterResolver().resolve(provider, net); }, @@ -82,7 +82,7 @@ module.exports = { * * @returns {Object} */ - detect: function () { + detect: () => { return new ProvidersPackageFactory().createProviderDetector().detect(); } }; diff --git a/packages/web3-providers/src/mappers/JSONRpcMapper.js b/packages/web3-providers/src/mappers/JSONRpcMapper.js index 1e8c9bfebdb..3b657218e61 100644 --- a/packages/web3-providers/src/mappers/JSONRpcMapper.js +++ b/packages/web3-providers/src/mappers/JSONRpcMapper.js @@ -25,7 +25,7 @@ /** * @constructor */ -var JSONRpcMapper = { //TODO: Find a better solution to handle this property as "singleton" globally over the web3 lib +const JSONRpcMapper = { //TODO: Find a better solution to handle this property as "singleton" globally over the web3 lib messageId: 0 }; @@ -39,9 +39,9 @@ var JSONRpcMapper = { //TODO: Find a better solution to handle this property as * * @returns {Object} valid jsonrpc payload object */ -JSONRpcMapper.toPayload = function (method, params) { +JSONRpcMapper.toPayload = (method, params) => { if (!method) { - throw new Error('JSONRPC method should be specified for params: "'+ JSON.stringify(params) +'"!'); + throw new Error(`JSONRPC method should be specified for params: "${JSON.stringify(params)}"!`); } JSONRpcMapper.messageId++; @@ -49,7 +49,7 @@ JSONRpcMapper.toPayload = function (method, params) { return { jsonrpc: '2.0', id: JSONRpcMapper.messageId, - method: method, + method, params: params || [] }; }; @@ -63,12 +63,12 @@ JSONRpcMapper.toPayload = function (method, params) { * * @returns {Array} batch payload */ -JSONRpcMapper.toBatchPayload = function (requests) { - return requests.map(function (request) { +JSONRpcMapper.toBatchPayload = requests => { + return requests.map(request => { request.beforeExecution(); return JSONRpcMapper.toPayload(request.rpcMethod, request.parameters); }); }; -module.exports = JSONRpcMapper; +export default JSONRpcMapper; diff --git a/packages/web3-providers/src/providers/HttpProvider.js b/packages/web3-providers/src/providers/HttpProvider.js index 0321264aa15..f0ec89acfee 100644 --- a/packages/web3-providers/src/providers/HttpProvider.js +++ b/packages/web3-providers/src/providers/HttpProvider.js @@ -22,106 +22,107 @@ * @date 2015 */ -var errors = require('web3-core-helpers').errors; -var XHR2 = require('xhr2-cookies').XMLHttpRequest; // jshint ignore: line -var http = require('http'); -var https = require('https'); - -/** - * @param {String} host - * @param {Object} options - * - * @constructor - */ -var HttpProvider = function HttpProvider(host, options) { - options = options || {}; - this.host = host || 'http://localhost:8545'; - if (this.host.substring(0,5) === "https"){ - this.httpsAgent = new https.Agent({ keepAlive: true }); - }else{ - this.httpAgent = new http.Agent({ keepAlive: true }); +import {errors} from 'web3-core-helpers'; + +import {XMLHttpRequest as XHR2} from 'xhr2-cookies'; // jshint ignore: line +import http from 'http'; +import https from 'https'; + +export default class HttpProvider { + + /** + * @param {String} host + * @param {Object} options + * + * @constructor + */ + constructor(host, options = {}) { + this.host = host || 'http://localhost:8545'; + + if (this.host.substring(0,5) === "https"){ + this.httpsAgent = new https.Agent({ keepAlive: true }); + } else { + this.httpAgent = new http.Agent({ keepAlive: true }); + } + + this.timeout = options.timeout || 0; + this.headers = options.headers; + this.connected = false; } - this.timeout = options.timeout || 0; - this.headers = options.headers; - this.connected = false; -}; - -/** - * Prepares the HTTP request - * - * @private - * @method _prepareRequest - * - * @returns {FakeXHR2} - */ -HttpProvider.prototype._prepareRequest = function () { - var request = new XHR2(); - request.nodejsSet({ - httpsAgent:this.httpsAgent, - httpAgent:this.httpAgent - }); - - request.open('POST', this.host, true); - request.setRequestHeader('Content-Type','application/json'); - request.timeout = this.timeout && this.timeout !== 1 ? this.timeout : 0; - request.withCredentials = true; - - if(this.headers) { - this.headers.forEach(function(header) { - request.setRequestHeader(header.name, header.value); + + /** + * Prepares the HTTP request + * + * @private + * @method _prepareRequest + * + * @returns {FakeXHR2} + */ + _prepareRequest() { + const request = new XHR2(); + request.nodejsSet({ + httpsAgent:this.httpsAgent, + httpAgent:this.httpAgent }); - } - return request; -}; - -/** - * Should be used to make async request - * - * @method send - * - * @param {Object} payload - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -HttpProvider.prototype.send = function (payload, callback) { - var _this = this; - var request = this._prepareRequest(); - - request.onreadystatechange = function() { - if (request.readyState === 4 && request.timeout !== 1) { - var result = request.responseText; - var error = null; - - try { - result = JSON.parse(result); - } catch(e) { - error = errors.InvalidResponse(request.responseText); - } + request.open('POST', this.host, true); + request.setRequestHeader('Content-Type','application/json'); + request.timeout = this.timeout && this.timeout !== 1 ? this.timeout : 0; + request.withCredentials = true; - _this.connected = true; - callback(error, result); + if(this.headers) { + this.headers.forEach(header => { + request.setRequestHeader(header.name, header.value); + }); } - }; - - request.ontimeout = function() { - _this.connected = false; - callback(errors.ConnectionTimeout(this.timeout)); - }; - try { - request.send(JSON.stringify(payload)); - } catch(error) { - this.connected = false; - callback(errors.InvalidConnection(this.host)); + return request; } -}; - -/** - * If this method does not exist it will throw en error. - */ -HttpProvider.prototype.disconnect = function () { }; + /** + * Should be used to make async request + * + * @method send + * + * @param {Object} payload + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + send(payload, callback) { + const request = this._prepareRequest(); + + request.onreadystatechange = () => { + if (request.readyState === 4 && request.timeout !== 1) { + let result = request.responseText; + let error = null; + + try { + result = JSON.parse(result); + } catch(e) { + error = errors.InvalidResponse(request.responseText); + } + + this.connected = true; + callback(error, result); + } + }; + + request.ontimeout = function() { + this.connected = false; + callback(errors.ConnectionTimeout(this.timeout)); + }; + + try { + request.send(JSON.stringify(payload)); + } catch(error) { + this.connected = false; + callback(errors.InvalidConnection(this.host)); + } + } -module.exports = HttpProvider; + /** + * If this method does not exist it will throw en error. + */ + disconnect() { } +} diff --git a/packages/web3-providers/src/providers/IpcProvider.js b/packages/web3-providers/src/providers/IpcProvider.js index 38326627be0..9301c740267 100644 --- a/packages/web3-providers/src/providers/IpcProvider.js +++ b/packages/web3-providers/src/providers/IpcProvider.js @@ -22,326 +22,317 @@ "use strict"; -var _ = require('underscore'); -var errors = require('web3-core-helpers').errors; -var oboe = require('oboe'); - - -/** - * @param {String} path - * @param {Net} net - * - * @constructor - */ -var IpcProvider = function IpcProvider(path, net) { - var _this = this; - this.responseCallbacks = {}; - this.notificationCallbacks = []; - this.path = path; - this.connected = false; - - this.connection = net.connect({path: this.path}); - - this.addDefaultEvents(); - - // LISTEN FOR CONNECTION RESPONSES - var callback = function (result) { - /*jshint maxcomplexity: 6 */ - - var id = null; - - // get the id which matches the returned id - if (_.isArray(result)) { - result.forEach(function (load) { - if (_this.responseCallbacks[load.id]) - id = load.id; - }); +import _ from 'underscore'; +import {errors} from 'web3-core-helpers'; +import oboe from 'oboe'; + +export default class IpcProvider { + + /** + * @param {String} path + * @param {Net} net + * + * @constructor + */ + constructor(path, net) { + this.responseCallbacks = {}; + this.notificationCallbacks = []; + this.path = path; + this.connected = false; + + this.connection = net.connect({path: this.path}); + + this.addDefaultEvents(); + + // LISTEN FOR CONNECTION RESPONSES + const callback = result => { + /*jshint maxcomplexity: 6 */ + + let id = null; + + // get the id which matches the returned id + if (_.isArray(result)) { + result.forEach(load => { + if (this.responseCallbacks[load.id]) + id = load.id; + }); + } else { + id = result.id; + } + + // notification + if (!id && result.method.indexOf('_subscription') !== -1) { + this.notificationCallbacks.forEach(callback => { + if (_.isFunction(callback)) + callback(result); + }); + + // fire the callback + } else if (this.responseCallbacks[id]) { + this.responseCallbacks[id](null, result); + delete this.responseCallbacks[id]; + } + }; + + // use oboe.js for Sockets + if (net.constructor.name === 'Socket') { + oboe(this.connection) + .done(callback); } else { - id = result.id; - } - - // notification - if (!id && result.method.indexOf('_subscription') !== -1) { - _this.notificationCallbacks.forEach(function (callback) { - if (_.isFunction(callback)) - callback(result); + this.connection.on('data', data => { + this._parseResponse(data.toString()).forEach(callback); }); - - // fire the callback - } else if (_this.responseCallbacks[id]) { - _this.responseCallbacks[id](null, result); - delete _this.responseCallbacks[id]; } - }; - - // use oboe.js for Sockets - if (net.constructor.name === 'Socket') { - oboe(this.connection) - .done(callback); - } else { - this.connection.on('data', function (data) { - _this._parseResponse(data.toString()).forEach(callback); - }); } -}; - -/** - * Will add the error and end event to timeout existing calls - * - * @method addDefaultEvents - */ -IpcProvider.prototype.addDefaultEvents = function () { - var _this = this; - - this.connection.on('connect', function () { - _this.connected = true; - }); - this.connection.on('close', function () { - _this.connected = false; - }); - - this.connection.on('error', function () { - _this._timeout(); - }); - - this.connection.on('end', function () { - _this._timeout(); - }); - - this.connection.on('timeout', function () { - _this._timeout(); - }); -}; - - -/** - * Will parse the response and make an array out of it. - * NOTE, this exists for backwards compatibility reasons. - * - * @method _parseResponse - * - * @param {String} data - * - * @returns {Array} - */ -IpcProvider.prototype._parseResponse = function (data) { - var _this = this, - returnValues = []; - - // DE-CHUNKER - var dechunkedData = data - .replace(/\}[\n\r]?\{/g, '}|--|{') // }{ - .replace(/\}\][\n\r]?\[\{/g, '}]|--|[{') // }][{ - .replace(/\}[\n\r]?\[\{/g, '}|--|[{') // }[{ - .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ - .split('|--|'); - - dechunkedData.forEach(function (data) { - var result = null; - - // prepend the last chunk - if (_this.lastChunk) { - data = _this.lastChunk + data; - } - - - try { - result = JSON.parse(data); - } catch (e) { - _this.lastChunk = data; - - // start timeout to cancel all requests - clearTimeout(_this.lastChunkTimeout); - - _this.lastChunkTimeout = setTimeout(function () { - _this._timeout(); - throw errors.InvalidResponse(data); - }, 1000 * 15); + /** + * Will add the error and end event to timeout existing calls + * + * @method addDefaultEvents + */ + addDefaultEvents() { + this.connection.on('connect', () => { + this.connected = true; + }); - return; - } + this.connection.on('close', () => { + this.connected = false; + }); - // cancel timeout and set chunk to null - clearTimeout(_this.lastChunkTimeout); - _this.lastChunk = null; + this.connection.on('error', () => { + this._timeout(); + }); - if (result) { - returnValues.push(result); - } - }); + this.connection.on('end', () => { + this._timeout(); + }); - return returnValues; -}; + this.connection.on('timeout', () => { + this._timeout(); + }); + } + /** + * Will parse the response and make an array out of it. + * NOTE, this exists for backwards compatibility reasons. + * + * @method _parseResponse + * + * @param {String} data + * + * @returns {Array} + */ + _parseResponse(data) { + const returnValues = []; + + // DE-CHUNKER + const dechunkedData = data + .replace(/\}[\n\r]?\{/g, '}|--|{') // }{ + .replace(/\}\][\n\r]?\[\{/g, '}]|--|[{') // }][{ + .replace(/\}[\n\r]?\[\{/g, '}|--|[{') // }[{ + .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ + .split('|--|'); + + dechunkedData.forEach(data => { + let result = null; + + // prepend the last chunk + if (this.lastChunk) { + data = this.lastChunk + data; + } + + + try { + result = JSON.parse(data); + } catch (e) { + this.lastChunk = data; + + // start timeout to cancel all requests + clearTimeout(this.lastChunkTimeout); + + this.lastChunkTimeout = setTimeout(() => { + this._timeout(); + throw errors.InvalidResponse(data); + }, 1000 * 15); + + return; + } + + // cancel timeout and set chunk to null + clearTimeout(this.lastChunkTimeout); + this.lastChunk = null; + + if (result) { + returnValues.push(result); + } + }); -/** - * Get the adds a callback to the responseCallbacks object, - * which will be called if a response matching the response Id will arrive. - * - * @method _addResponseCallback - * - * @callback callback callback(error, result) - */ -IpcProvider.prototype._addResponseCallback = function (payload, callback) { - var id = payload.id || payload[0].id; - var method = payload.method || payload[0].method; + return returnValues; + } - this.responseCallbacks[id] = callback; - this.responseCallbacks[id].method = method; -}; + /** + * Get the adds a callback to the responseCallbacks object, + * which will be called if a response matching the response Id will arrive. + * + * @method _addResponseCallback + * + * @callback callback callback(error, result) + */ + _addResponseCallback(payload, callback) { + const id = payload.id || payload[0].id; + const method = payload.method || payload[0].method; + + this.responseCallbacks[id] = callback; + this.responseCallbacks[id].method = method; + } -/** - * Timeout all requests when the end/error event is fired - * - * @method _timeout - */ -IpcProvider.prototype._timeout = function () { - for (var key in this.responseCallbacks) { - if (this.responseCallbacks.hasOwnProperty(key)) { - this.responseCallbacks[key](errors.InvalidConnection('on IPC')); - delete this.responseCallbacks[key]; + /** + * Timeout all requests when the end/error event is fired + * + * @method _timeout + */ + _timeout() { + for (const key in this.responseCallbacks) { + if (this.responseCallbacks.hasOwnProperty(key)) { + this.responseCallbacks[key](errors.InvalidConnection('on IPC')); + delete this.responseCallbacks[key]; + } } } -}; -/** - * Try to reconnect - * - * @method reconnect - */ -IpcProvider.prototype.reconnect = function () { - this.connection.connect({path: this.path}); -}; - - -/** - * Sends the JSON-RPC the request - * - * @method send - * - * @param {Object} payload - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -IpcProvider.prototype.send = function (payload, callback) { - // try reconnect, when connection is gone - if (!this.connection.writable) { + /** + * Try to reconnect + * + * @method reconnect + */ + reconnect() { this.connection.connect({path: this.path}); } - this.connection.write(JSON.stringify(payload)); - this._addResponseCallback(payload, callback); -}; + /** + * Sends the JSON-RPC the request + * + * @method send + * + * @param {Object} payload + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + send(payload, callback) { + // try reconnect, when connection is gone + if (!this.connection.writable) { + this.connection.connect({path: this.path}); + } -/** - * Subscribes to provider events.provider - * - * @method on - * - * @param {String} type 'notification', 'connect', 'error', 'end' or 'data' - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -IpcProvider.prototype.on = function (type, callback) { - if (typeof callback !== 'function') { - throw new Error('The second parameter callback must be a function.'); + this.connection.write(JSON.stringify(payload)); + this._addResponseCallback(payload, callback); } - switch (type) { - case 'data': - this.notificationCallbacks.push(callback); - break; + /** + * Subscribes to provider events.provider + * + * @method on + * + * @param {String} type 'notification', 'connect', 'error', 'end' or 'data' + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + on(type, callback) { + if (typeof callback !== 'function') { + throw new Error('The second parameter callback must be a function.'); + } - // adds error, end, timeout, connect - default: - this.connection.on(type, callback); - break; - } -}; + switch (type) { + case 'data': + this.notificationCallbacks.push(callback); + break; -/** - * Subscribes to provider events.provider - * - * @method on - * - * @param {String} type 'connect', 'error', 'end' or 'data' - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -IpcProvider.prototype.once = function (type, callback) { - if (typeof callback !== 'function') { - throw new Error('The second parameter callback must be a function.'); + // adds error, end, timeout, connect + default: + this.connection.on(type, callback); + break; + } } - this.connection.once(type, callback); -}; - -/** - * Removes event listener - * - * @method removeListener - * - * @param {String} type 'data', 'connect', 'error', 'end' or 'data' - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -IpcProvider.prototype.removeListener = function (type, callback) { - var _this = this; - - switch (type) { - case 'data': - this.notificationCallbacks.forEach(function (cb, index) { - if (cb === callback) - _this.notificationCallbacks.splice(index, 1); - }); - break; + /** + * Subscribes to provider events.provider + * + * @method on + * + * @param {String} type 'connect', 'error', 'end' or 'data' + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + once(type, callback) { + if (typeof callback !== 'function') { + throw new Error('The second parameter callback must be a function.'); + } - default: - this.connection.removeListener(type, callback); - break; + this.connection.once(type, callback); } -}; -/** - * Removes all event listeners - * - * @method removeAllListeners - * - * @param {String} type 'data', 'connect', 'error', 'end' or 'data' - * - * @callback callback callback(error, result) - */ -IpcProvider.prototype.removeAllListeners = function (type) { - switch (type) { - case 'data': - this.notificationCallbacks = []; - break; - - default: - this.connection.removeAllListeners(type); - break; + /** + * Removes event listener + * + * @method removeListener + * + * @param {String} type 'data', 'connect', 'error', 'end' or 'data' + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + removeListener(type, callback) { + switch (type) { + case 'data': + this.notificationCallbacks.forEach((cb, index) => { + if (cb === callback) + this.notificationCallbacks.splice(index, 1); + }); + break; + + default: + this.connection.removeListener(type, callback); + break; + } } -}; -/** - * Resets the providers, clears all callbacks - * - * @method reset - */ -IpcProvider.prototype.reset = function () { - this._timeout(); - this.notificationCallbacks = []; + /** + * Removes all event listeners + * + * @method removeAllListeners + * + * @param {String} type 'data', 'connect', 'error', 'end' or 'data' + * + * @callback callback callback(error, result) + */ + removeAllListeners(type) { + switch (type) { + case 'data': + this.notificationCallbacks = []; + break; + + default: + this.connection.removeAllListeners(type); + break; + } + } - this.connection.removeAllListeners('error'); - this.connection.removeAllListeners('end'); - this.connection.removeAllListeners('timeout'); + /** + * Resets the providers, clears all callbacks + * + * @method reset + */ + reset() { + this._timeout(); + this.notificationCallbacks = []; - this.addDefaultEvents(); -}; + this.connection.removeAllListeners('error'); + this.connection.removeAllListeners('end'); + this.connection.removeAllListeners('timeout'); -module.exports = IpcProvider; + this.addDefaultEvents(); + } +} diff --git a/packages/web3-providers/src/providers/WebsocketProvider.js b/packages/web3-providers/src/providers/WebsocketProvider.js index 2d30eb2f0b4..1fb82c04403 100644 --- a/packages/web3-providers/src/providers/WebsocketProvider.js +++ b/packages/web3-providers/src/providers/WebsocketProvider.js @@ -22,30 +22,30 @@ "use strict"; -var _ = require('underscore'); -var errors = require('web3-core-helpers').errors; +import _ from 'underscore'; +import {errors} from 'web3-core-helpers'; -var Ws = null; -var _btoa = null; -var parseURL = null; +let Ws = null; +let _btoa = null; +let parseURL = null; if (typeof window !== 'undefined' && typeof window.WebSocket !== 'undefined') { - Ws = function(url, protocols) { - return new window.WebSocket(url, protocols); + Ws = (url, protocols) => { + return new window.WebSocket(url, protocols); }; _btoa = btoa; - parseURL = function(url) { + parseURL = url => { return new URL(url); }; } else { Ws = require('websocket').w3cwebsocket; - _btoa = function(str) { - return Buffer(str).toString('base64'); + _btoa = str => { + return Buffer(str).toString('base64'); }; - var url = require('url'); + const url = require('url'); if (url.URL) { // Use the new Node 6+ API for parsing URLs that supports username/password - var newURL = url.URL; - parseURL = function(url) { + const newURL = url.URL; + parseURL = url => { return new newURL(url); }; } @@ -55,383 +55,373 @@ if (typeof window !== 'undefined' && typeof window.WebSocket !== 'undefined') { } } -/** - * Default connection ws://localhost:8546 - * - * @param {String} url - * @param {Object} options - * - * @constructor - */ -var WebsocketProvider = function WebsocketProvider(url, options) { - var _this = this; - this.responseCallbacks = {}; - this.notificationCallbacks = []; - this.path = url; - - options = options || {}; - this._customTimeout = options.timeout; - - // The w3cwebsocket implementation does not support Basic Auth - // username/password in the URL. So generate the basic auth header, and - // pass through with any additional headers supplied in constructor - var parsedURL = parseURL(url); - var headers = options.headers || {}; - var protocol = options.protocol || undefined; - if (parsedURL.username && parsedURL.password) { - headers.authorization = 'Basic ' + _btoa(parsedURL.username + ':' + parsedURL.password); - } - - // Allow a custom client configuration - var clientConfig = options.clientConfig || undefined; - - // When all node core implementations that do not have the - // WHATWG compatible URL parser go out of service this line can be removed. - if (parsedURL.auth) { - headers.authorization = 'Basic ' + _btoa(parsedURL.auth); - } - this.connection = new Ws(url, protocol, undefined, headers, undefined, clientConfig); - - this.addDefaultEvents(); - - - // LISTEN FOR CONNECTION RESPONSES - this.connection.onmessage = function(e) { - /*jshint maxcomplexity: 6 */ - var data = (typeof e.data === 'string') ? e.data : ''; - - _this._parseResponse(data).forEach(function(result){ - - var id = null; +export default class WebsocketProvider { + + /** + * Default connection ws://localhost:8546 + * + * @param {String} url + * @param {Object} options + * + * @constructor + */ + constructor(url, options) { + this.responseCallbacks = {}; + this.notificationCallbacks = []; + this.path = url; + + options = options || {}; + this._customTimeout = options.timeout; + + // The w3cwebsocket implementation does not support Basic Auth + // username/password in the URL. So generate the basic auth header, and + // pass through with any additional headers supplied in constructor + const parsedURL = parseURL(url); + const headers = options.headers || {}; + const protocol = options.protocol || undefined; + if (parsedURL.username && parsedURL.password) { + headers.authorization = `Basic ${_btoa(`${parsedURL.username}:${parsedURL.password}`)}`; + } - // get the id which matches the returned id - if(_.isArray(result)) { - result.forEach(function(load){ - if(_this.responseCallbacks[load.id]) - id = load.id; - }); - } else { - id = result.id; - } + // Allow a custom client configuration + const clientConfig = options.clientConfig || undefined; - // notification - if(!id && result && result.method && result.method.indexOf('_subscription') !== -1) { - _this.notificationCallbacks.forEach(function(callback){ - if(_.isFunction(callback)) - callback(result); - }); + // When all node core implementations that do not have the + // WHATWG compatible URL parser go out of service this line can be removed. + if (parsedURL.auth) { + headers.authorization = `Basic ${_btoa(parsedURL.auth)}`; + } + this.connection = new Ws(url, protocol, undefined, headers, undefined, clientConfig); + + this.addDefaultEvents(); + + + // LISTEN FOR CONNECTION RESPONSES + this.connection.onmessage = e => { + /*jshint maxcomplexity: 6 */ + const data = (typeof e.data === 'string') ? e.data : ''; + + this._parseResponse(data).forEach(result => { + + let id = null; + + // get the id which matches the returned id + if (_.isArray(result)) { + result.forEach(load => { + if (this.responseCallbacks[load.id]) + id = load.id; + }); + } else { + id = result.id; + } + + // notification + if (!id && result && result.method && result.method.indexOf('_subscription') !== -1) { + this.notificationCallbacks.forEach(callback => { + if (_.isFunction(callback)) + callback(result); + }); + + // fire the callback + } else if (this.responseCallbacks[id]) { + this.responseCallbacks[id](null, result); + delete this.responseCallbacks[id]; + } + }); + }; - // fire the callback - } else if(_this.responseCallbacks[id]) { - _this.responseCallbacks[id](null, result); - delete _this.responseCallbacks[id]; - } + // make property `connected` which will return the current connection status + Object.defineProperty(this, 'connected', { + get() { + return this.connection && this.connection.readyState === this.connection.OPEN; + }, + enumerable: true, }); - }; - - // make property `connected` which will return the current connection status - Object.defineProperty(this, 'connected', { - get: function () { - return this.connection && this.connection.readyState === this.connection.OPEN; - }, - enumerable: true, - }); -}; - -/** - * Will add the error and end event to timeout existing calls - * - * @method addDefaultEvents - */ -WebsocketProvider.prototype.addDefaultEvents = function () { - var _this = this; - - this.connection.onerror = function(){ - _this._timeout(); - }; - - this.connection.onclose = function(){ - _this._timeout(); - - // reset all requests and callbacks - _this.reset(); - }; - - // this.connection.on('timeout', function(){ - // _this._timeout(); - // }); -}; - -/** - * Will parse the response and make an array out of it. - * - * @method _parseResponse - * - * @param {String} data - */ -WebsocketProvider.prototype._parseResponse = function (data) { - var _this = this, - returnValues = []; + } - // DE-CHUNKER - var dechunkedData = data - .replace(/\}[\n\r]?\{/g,'}|--|{') // }{ - .replace(/\}\][\n\r]?\[\{/g,'}]|--|[{') // }][{ - .replace(/\}[\n\r]?\[\{/g,'}|--|[{') // }[{ - .replace(/\}\][\n\r]?\{/g,'}]|--|{') // }]{ - .split('|--|'); + /** + * Will add the error and end event to timeout existing calls + * + * @method addDefaultEvents + */ + addDefaultEvents() { + this.connection.onerror = () => { + this._timeout(); + }; - dechunkedData.forEach(function(data){ + this.connection.onclose = () => { + this._timeout(); - // prepend the last chunk - if(_this.lastChunk) - data = _this.lastChunk + data; + // reset all requests and callbacks + this.reset(); + }; - var result = null; + // this.connection.on('timeout', function(){ + // this._timeout(); + // }); + } - try { - result = JSON.parse(data); + /** + * Will parse the response and make an array out of it. + * + * @method _parseResponse + * + * @param {String} data + */ + _parseResponse(data) { + const returnValues = []; - } catch(e) { + // DE-CHUNKER + const dechunkedData = data + .replace(/\}[\n\r]?\{/g, '}|--|{') // }{ + .replace(/\}\][\n\r]?\[\{/g, '}]|--|[{') // }][{ + .replace(/\}[\n\r]?\[\{/g, '}|--|[{') // }[{ + .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ + .split('|--|'); - _this.lastChunk = data; + dechunkedData.forEach(data => { - // start timeout to cancel all requests - clearTimeout(_this.lastChunkTimeout); - _this.lastChunkTimeout = setTimeout(function(){ - _this._timeout(); - throw errors.InvalidResponse(data); - }, 1000 * 15); + // prepend the last chunk + if (this.lastChunk) + data = this.lastChunk + data; - return; - } + let result = null; - // cancel timeout and set chunk to null - clearTimeout(_this.lastChunkTimeout); - _this.lastChunk = null; + try { + result = JSON.parse(data); - if(result) - returnValues.push(result); - }); + } catch (e) { - return returnValues; -}; + this.lastChunk = data; + // start timeout to cancel all requests + clearTimeout(this.lastChunkTimeout); + this.lastChunkTimeout = setTimeout(() => { + this._timeout(); + throw errors.InvalidResponse(data); + }, 1000 * 15); -/** - * Adds a callback to the responseCallbacks object, - * which will be called if a response matching the response Id will arrive. - * - * @method _addResponseCallback - * - * @param {Object} payload - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -WebsocketProvider.prototype._addResponseCallback = function(payload, callback) { - var id = payload.id || payload[0].id; - var method = payload.method || payload[0].method; + return; + } - this.responseCallbacks[id] = callback; - this.responseCallbacks[id].method = method; + // cancel timeout and set chunk to null + clearTimeout(this.lastChunkTimeout); + this.lastChunk = null; - var _this = this; + if (result) + returnValues.push(result); + }); - // schedule triggering the error response if a custom timeout is set - if (this._customTimeout) { - setTimeout(function () { - if (_this.responseCallbacks[id]) { - _this.responseCallbacks[id](errors.ConnectionTimeout(_this._customTimeout)); - delete _this.responseCallbacks[id]; - } - }, this._customTimeout); + return returnValues; } -}; -/** - * Timeout all requests when the end/error event is fired - * - * @method _timeout - */ -WebsocketProvider.prototype._timeout = function() { - for(var key in this.responseCallbacks) { - if(this.responseCallbacks.hasOwnProperty(key)){ - this.responseCallbacks[key](errors.InvalidConnection('on WS')); - delete this.responseCallbacks[key]; + /** + * Adds a callback to the responseCallbacks object, + * which will be called if a response matching the response Id will arrive. + * + * @method _addResponseCallback + * + * @param {Object} payload + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + _addResponseCallback(payload, callback) { + const id = payload.id || payload[0].id; + const method = payload.method || payload[0].method; + + this.responseCallbacks[id] = callback; + this.responseCallbacks[id].method = method; + + // schedule triggering the error response if a custom timeout is set + if (this._customTimeout) { + setTimeout(() => { + if (this.responseCallbacks[id]) { + this.responseCallbacks[id](errors.ConnectionTimeout(this._customTimeout)); + delete this.responseCallbacks[id]; + } + }, this._customTimeout); } } -}; - -/** - * Sends the JSON-RPC request - * - * @method send - * - * @param {Object} payload - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -WebsocketProvider.prototype.send = function (payload, callback) { - var _this = this; - - if (this.connection.readyState === this.connection.CONNECTING) { - setTimeout(function () { - _this.send(payload, callback); - }, 10); - return; - } - // try reconnect, when connection is gone - // if(!this.connection.writable) - // this.connection.connect({url: this.url}); - if (this.connection.readyState !== this.connection.OPEN) { - console.error('connection not open on send()'); - if (typeof this.connection.onerror === 'function') { - this.connection.onerror(new Error('connection not open')); - } else { - console.error('no error callback'); + /** + * Timeout all requests when the end/error event is fired + * + * @method _timeout + */ + _timeout() { + for (const key in this.responseCallbacks) { + if (this.responseCallbacks.hasOwnProperty(key)) { + this.responseCallbacks[key](errors.InvalidConnection('on WS')); + delete this.responseCallbacks[key]; + } } - callback(new Error('connection not open')); - return; } - this.connection.send(JSON.stringify(payload)); - this._addResponseCallback(payload, callback); -}; - -/** - * Subscribes to provider events.provider - * - * @method on - * - * @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -WebsocketProvider.prototype.on = function (type, callback) { - - if(typeof callback !== 'function') - throw new Error('The second parameter callback must be a function.'); - - switch(type){ - case 'data': - this.notificationCallbacks.push(callback); - break; - - case 'connect': - this.connection.onopen = callback; - break; - - case 'end': - this.connection.onclose = callback; - break; + /** + * Sends the JSON-RPC request + * + * @method send + * + * @param {Object} payload + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + send(payload, callback) { + if (this.connection.readyState === this.connection.CONNECTING) { + setTimeout(() => { + this.send(payload, callback); + }, 10); + return; + } - case 'error': - this.connection.onerror = callback; - break; + // try reconnect, when connection is gone + // if(!this.connection.writable) + // this.connection.connect({url: this.url}); + if (this.connection.readyState !== this.connection.OPEN) { + console.error('connection not open on send()'); + if (typeof this.connection.onerror === 'function') { + this.connection.onerror(new Error('connection not open')); + } else { + console.error('no error callback'); + } + callback(new Error('connection not open')); + return; + } - // default: - // this.connection.on(type, callback); - // break; + this.connection.send(JSON.stringify(payload)); + this._addResponseCallback(payload, callback); } -}; - -// TODO: add once - -/** - * Removes event listener - * - * @method removeListener - * - * @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' - * @param {Function} callback - * - * @callback callback callback(error, result) - */ -WebsocketProvider.prototype.removeListener = function (type, callback) { - var _this = this; - - switch(type){ - case 'data': - this.notificationCallbacks.forEach(function(cb, index){ - if(cb === callback) - _this.notificationCallbacks.splice(index, 1); - }); - break; - - // TODO remvoving connect missing - // default: - // this.connection.removeListener(type, callback); - // break; + /** + * Subscribes to provider events.provider + * + * @method on + * + * @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + on(type, callback) { + + if (typeof callback !== 'function') + throw new Error('The second parameter callback must be a function.'); + + switch (type) { + case 'data': + this.notificationCallbacks.push(callback); + break; + + case 'connect': + this.connection.onopen = callback; + break; + + case 'end': + this.connection.onclose = callback; + break; + + case 'error': + this.connection.onerror = callback; + break; + + // default: + // this.connection.on(type, callback); + // break; + } } -}; - -/** - * Removes all event listeners - * - * @method removeAllListeners - * - * @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' - * - * @callback callback callback(error, result) - */ -WebsocketProvider.prototype.removeAllListeners = function (type) { - switch(type){ - case 'data': - this.notificationCallbacks = []; - break; - // TODO remvoving connect properly missing - - case 'connect': - this.connection.onopen = null; - break; - - case 'end': - this.connection.onclose = null; - break; + // TODO: add once + + /** + * Removes event listener + * + * @method removeListener + * + * @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + * @param {Function} callback + * + * @callback callback callback(error, result) + */ + removeListener(type, callback) { + switch (type) { + case 'data': + this.notificationCallbacks.forEach((cb, index) => { + if (cb === callback) + this.notificationCallbacks.splice(index, 1); + }); + break; - case 'error': - this.connection.onerror = null; - break; + // TODO remvoving connect missing - default: - // this.connection.removeAllListeners(type); - break; + // default: + // this.connection.removeListener(type, callback); + // break; + } } -}; - -/** - * Resets the providers, clears all callbacks - * - * @method reset - * - * @callback callback callback(error, result) - */ -WebsocketProvider.prototype.reset = function () { - this._timeout(); - this.notificationCallbacks = []; - - // this.connection.removeAllListeners('error'); - // this.connection.removeAllListeners('end'); - // this.connection.removeAllListeners('timeout'); - this.addDefaultEvents(); -}; + /** + * Removes all event listeners + * + * @method removeAllListeners + * + * @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + * + * @callback callback callback(error, result) + */ + removeAllListeners(type) { + switch (type) { + case 'data': + this.notificationCallbacks = []; + break; + + // TODO remvoving connect properly missing + + case 'connect': + this.connection.onopen = null; + break; + + case 'end': + this.connection.onclose = null; + break; + + case 'error': + this.connection.onerror = null; + break; + + default: + // this.connection.removeAllListeners(type); + break; + } + } -/** - * Will close the socket connection - * - * @method disconnect - */ -WebsocketProvider.prototype.disconnect = function () { - if (this.connection) { - this.connection.close(); + /** + * Resets the providers, clears all callbacks + * + * @method reset + * + * @callback callback callback(error, result) + */ + reset() { + this._timeout(); + this.notificationCallbacks = []; + + // this.connection.removeAllListeners('error'); + // this.connection.removeAllListeners('end'); + // this.connection.removeAllListeners('timeout'); + + this.addDefaultEvents(); } -}; -module.exports = WebsocketProvider; + /** + * Will close the socket connection + * + * @method disconnect + */ + disconnect() { + if (this.connection) { + this.connection.close(); + } + } +} diff --git a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js index 9b94c65ed92..3444014852f 100644 --- a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js @@ -22,68 +22,69 @@ "use strict"; -var _ = require('underscore'); +import _ from 'underscore'; -/** - * @param {ProvidersPackageFactory} providersPackageFactory - * - * @constructor - */ -function ProviderAdapterResolver(providersPackageFactory) { - this.providersPackageFactory = providersPackageFactory; -} +export default class ProviderAdapterResolver { -/** - * Resolves the correct provider with his adapter - * - * @method resolve - * - * @param {*} provider - * @param {Net} net - * - * @returns {AbstractProviderAdapter|Error} - */ -ProviderAdapterResolver.prototype.resolve = function (provider, net) { - if (typeof provider === 'string') { - // HTTP - if (/^http(s)?:\/\//i.test(provider)) { - return this.providersPackageFactory.createHttpProviderAdapter( - this.providersPackageFactory.createHttpProvider(provider) - ); - } - // WS - if (/^ws(s)?:\/\//i.test(provider)) { - return this.providersPackageFactory.createSocketProviderAdapter( - this.providersPackageFactory.createWebsocketProvider(provider) - ); + /** + * @param {ProvidersPackageFactory} providersPackageFactory + * + * @constructor + */ + constructor(providersPackageFactory) { + this.providersPackageFactory = providersPackageFactory; + } + + /** + * Resolves the correct provider with his adapter + * + * @method resolve + * + * @param {*} provider + * @param {Net} net + * + * @returns {AbstractProviderAdapter|Error} + */ + resolve(provider, net) { + if (typeof provider === 'string') { + // HTTP + if (/^http(s)?:\/\//i.test(provider)) { + return this.providersPackageFactory.createHttpProviderAdapter( + this.providersPackageFactory.createHttpProvider(provider) + ); + } + // WS + if (/^ws(s)?:\/\//i.test(provider)) { + return this.providersPackageFactory.createSocketProviderAdapter( + this.providersPackageFactory.createWebsocketProvider(provider) + ); + } + + // IPC + if (provider && _.isObject(net) && _.isFunction(net.connect)) { + return this.providersPackageFactory.createSocketProviderAdapter( + this.providersPackageFactory.createIpcProvider(provider, net) + ); + } } - // IPC - if (provider && _.isObject(net) && _.isFunction(net.connect)) { - return this.providersPackageFactory.createSocketProviderAdapter( - this.providersPackageFactory.createIpcProvider(provider, net) - ); + if (_.isFunction(provider.sendAsync)) { + return this.providersPackageFactory.createInpageProviderAdapter(provider); } - } - if (_.isFunction(provider.sendAsync)) { - return this.providersPackageFactory.createInpageProviderAdapter(provider); - } + switch (provider.constructor.name) { + case 'HttpProvider': + return this.providersPackageFactory.createHttpProviderAdapter(provider); + case 'WebsocketProvider': + case 'IpcProvider': + return this.providersPackageFactory.createSocketProviderAdapter(provider); + case 'EthereumProvider': + case 'HttpProviderAdapter': + case 'SocketProviderAdapter': + case 'InpageProviderAdapter': + return provider; + } - switch (provider.constructor.name) { - case 'HttpProvider': - return this.providersPackageFactory.createHttpProviderAdapter(provider); - case 'WebsocketProvider': - case 'IpcProvider': - return this.providersPackageFactory.createSocketProviderAdapter(provider); - case 'EthereumProvider': - case 'HttpProviderAdapter': - case 'SocketProviderAdapter': - case 'InpageProviderAdapter': - return provider; + throw Error('Please provide an valid Web3 provider or the EthereumProvider'); } - - throw Error('Please provide an valid Web3 provider or the EthereumProvider'); -}; - -module.exports = ProviderAdapterResolver; +} diff --git a/packages/web3-providers/src/validators/JSONRpcResponseValidator.js b/packages/web3-providers/src/validators/JSONRpcResponseValidator.js index 197e58a57b8..642e725dd05 100644 --- a/packages/web3-providers/src/validators/JSONRpcResponseValidator.js +++ b/packages/web3-providers/src/validators/JSONRpcResponseValidator.js @@ -22,40 +22,39 @@ "use strict"; -function JSONRpcResponseValidator() { } - -/** - * Executes JSON-RPC response validation - * - * @method isValid - * - * @param {Object} response - * - * @returns {Boolean} - */ -JSONRpcResponseValidator.isValid = function (response) { - if (Array.isArray(response)) { - return response.every(this.isResponseItemValid) +export default class JSONRpcResponseValidator { + + /** + * Executes JSON-RPC response validation + * + * @method isValid + * + * @param {Object} response + * + * @returns {Boolean} + */ + static isValid(response) { + if (Array.isArray(response)) { + return response.every(this.isResponseItemValid) + } + + return this.isResponseItemValid(response); } - return this.isResponseItemValid(response); -}; - -/** - * Validates response item from a JSON-RPC response - * - * @method isResponseItemValid - * - * @param {Object} response - * - * @returns {Boolean} - */ -JSONRpcResponseValidator.isResponseItemValid = function (response) { - return !!response && - !response.error && - response.jsonrpc === '2.0' && - (typeof response.id === 'number' || typeof response.id === 'string') && - response.result !== undefined; -}; - -module.exports = JSONRpcResponseValidator; + /** + * Validates response item from a JSON-RPC response + * + * @method isResponseItemValid + * + * @param {Object} response + * + * @returns {Boolean} + */ + static isResponseItemValid(response) { + return !!response && + !response.error && + response.jsonrpc === '2.0' && + (typeof response.id === 'number' || typeof response.id === 'string') && + response.result !== undefined; + } +} From 5d7e546232c4e4d82342e0ed12a8b7486d8b4122 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:20:32 +0200 Subject: [PATCH 0281/1045] web3-shh ported to es6 --- packages/web3-shh/src/Shh.js | 109 +++++++++--------- .../src/factories/MethodModelFactory.js | 79 ++++++------- packages/web3-shh/src/index.js | 24 ++-- 3 files changed, 104 insertions(+), 108 deletions(-) diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index d0c14abcac3..77bf3cd0e89 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -22,66 +22,65 @@ "use strict"; -var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; +import {AbstractWeb3Module} from 'web3-core'; -/** - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {MethodModelFactory} methodModelFactory - * @param {SubscriptionsFactory} subscriptionsFactory - * @param {Network} net - * - * @constructor - */ -function Shh(provider, providersPackage, methodController, methodModelFactory, subscriptionsFactory, net) { - AbstractWeb3Module.call( - this, +export default class Shh extends AbstractWeb3Module { + + /** + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {MethodModelFactory} methodModelFactory + * @param {SubscriptionsFactory} subscriptionsFactory + * @param {Network} net + * + * @constructor + */ + constructor( provider, providersPackage, methodController, - methodModelFactory - ); - this.net = net; -} - -Shh.prototype = Object.create(AbstractWeb3Module.prototype); -Shh.prototype.constructor = Shh; - -/** - * Subscribe to whisper streams - * - * @method subscribe - * - * @param {string} method - * @param {Object} options - * @param {Function} callback - * - * @callback callback callback(error, result) - * @returns {Subscription} - */ -Shh.prototype.subscribe = function (method, options, callback) { - if (method === 'messages') { - return this.subscriptionsFactory.createShhMessagesSubscription(this, options).subscribe(callback); + methodModelFactory, + subscriptionsFactory, + net + ) { + super(provider, providersPackage, methodController, methodModelFactory); + this.net = net; } - throw Error('Unknown subscription: ' + method); -}; + /** + * Subscribe to whisper streams + * + * @method subscribe + * + * @param {string} method + * @param {Object} options + * @param {Function} callback + * + * @callback callback callback(error, result) + * @returns {Subscription} + */ + subscribe(method, options, callback) { + if (method === 'messages') { + return this.subscriptionsFactory.createShhMessagesSubscription(this, options).subscribe(callback); + } -/** - * Extends setProvider method from AbstractWeb3Module. - * This is required for updating the provider also in the sub package Net. - * - * @param {Object|String} provider - * @param {Net} net - * - * @returns {Boolean} - */ -Shh.prototype.setProvider = function (provider, net) { - return !!( - AbstractWeb3Module.setProvider.call(this, provider, net) && - this.net.setProvider(provider, net) - ); -}; + throw Error(`Unknown subscription: ${method}`); + } -module.exports = Shh; + /** + * Extends setProvider method from AbstractWeb3Module. + * This is required for updating the provider also in the sub package Net. + * + * @param {Object|String} provider + * @param {Net} net + * + * @returns {Boolean} + */ + setProvider(provider, net) { + return !!( + super.setProvider(provider, net) && + this.net.setProvider(provider, net) + ); + } +} diff --git a/packages/web3-shh/src/factories/MethodModelFactory.js b/packages/web3-shh/src/factories/MethodModelFactory.js index d67b2ecf080..e0335caeacc 100644 --- a/packages/web3-shh/src/factories/MethodModelFactory.js +++ b/packages/web3-shh/src/factories/MethodModelFactory.js @@ -22,46 +22,43 @@ "use strict"; -var web3CoreMethod = require('web3-core-method'); +import web3CoreMethod from 'web3-core-method'; -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function MethodModelFactory(utils, formatters) { - web3CoreMethod.AbstractMethodModelFactory.call( - this, - { - getVersion: web3CoreMethod.ShhVersionMethodModel, - getInfo: web3CoreMethod.GetInfoMethodModel, - setMaxMessageSize: web3CoreMethod.SetMaxMessageSizeMethodModel, - setMinPoW: web3CoreMethod.SetMinPoWMethodModel, - markTrustedPeer: web3CoreMethod.MarkTrustedPeerMethodModel, - newKeyPair: web3CoreMethod.NewKeyPairMethodModel, - addPrivateKey: web3CoreMethod.AddPrivateKeyMethodModel, - deleteKeyPair: web3CoreMethod.DeleteKeyPairMethodModel, - hasKeyPair: web3CoreMethod.HasKeyPairMethodModel, - getPublicKey: web3CoreMethod.GetPublicKeyMethodModel, - getPrivateKey: web3CoreMethod.GetPrivateKeyMethodModel, - newSymKey: web3CoreMethod.NewSymKeyMethodModel, - addSymKey: web3CoreMethod.AddSymKeyMethodModel, - generateSymKeyFromPassword: web3CoreMethod.GenerateSymKeyFromPasswordMethodModel, - hasSymKey: web3CoreMethod.HasSymKeyMethodModel, - getSymKey: web3CoreMethod.GetSymKeyMethodModel, - deleteSymKey: web3CoreMethod.DeleteSymKeyMethodModel, - newMessageFilter: web3CoreMethod.NewMessageFilterMethodModel, - getFilterMessages: web3CoreMethod.GetFilterMessagesMethodModel, - deleteMessageFilter: web3CoreMethod.DeleteMessageFilterMethodModel, - post: web3CoreMethod.PostMethodModel, - }, - utils, - formatters - ); -} +export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { -MethodModelFactory.prototype = Object.create(web3CoreMethod.AbstractMethodModelFactory.prototype); -MethodModelFactory.prototype.constructor = MethodModelFactory; - -module.exports = MethodModelFactory; + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + super( + { + getVersion: web3CoreMethod.ShhVersionMethodModel, + getInfo: web3CoreMethod.GetInfoMethodModel, + setMaxMessageSize: web3CoreMethod.SetMaxMessageSizeMethodModel, + setMinPoW: web3CoreMethod.SetMinPoWMethodModel, + markTrustedPeer: web3CoreMethod.MarkTrustedPeerMethodModel, + newKeyPair: web3CoreMethod.NewKeyPairMethodModel, + addPrivateKey: web3CoreMethod.AddPrivateKeyMethodModel, + deleteKeyPair: web3CoreMethod.DeleteKeyPairMethodModel, + hasKeyPair: web3CoreMethod.HasKeyPairMethodModel, + getPublicKey: web3CoreMethod.GetPublicKeyMethodModel, + getPrivateKey: web3CoreMethod.GetPrivateKeyMethodModel, + newSymKey: web3CoreMethod.NewSymKeyMethodModel, + addSymKey: web3CoreMethod.AddSymKeyMethodModel, + generateSymKeyFromPassword: web3CoreMethod.GenerateSymKeyFromPasswordMethodModel, + hasSymKey: web3CoreMethod.HasSymKeyMethodModel, + getSymKey: web3CoreMethod.GetSymKeyMethodModel, + deleteSymKey: web3CoreMethod.DeleteSymKeyMethodModel, + newMessageFilter: web3CoreMethod.NewMessageFilterMethodModel, + getFilterMessages: web3CoreMethod.GetFilterMessagesMethodModel, + deleteMessageFilter: web3CoreMethod.DeleteMessageFilterMethodModel, + post: web3CoreMethod.PostMethodModel, + }, + utils, + formatters + ); + } +} diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 4ccdbf80ab5..59b6bab2392 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -22,18 +22,18 @@ "use strict"; -var version = require('./package.json'); -var ProvidersPackage = require('web3-providers'); -var MethodController = require('web3-core-method').MethodController; -var SubscriptionsFactory = require('web3-core-subscriptions').SubscriptionsFactory; -var Network = require('web3-net').Network; -var Utils = require('web3-utils'); -var formatters = require('web3-core-helpers').formatters; -var Shh = require('./Shh'); -var MethodModelFactory = require('./factories/MethodModelFactory'); +import {version} from '../package.json'; +import ProvidersPackage from 'web3-providers'; +import {MethodController} from 'web3-core-method'; +import {SubscriptionsFactory} from 'web3-core-subscriptions'; +import {Network} from 'web3-net'; +import Utils from 'web3-utils'; +import {formatters} from 'web3-core-helpers'; +import Shh from './Shh'; +import MethodModelFactory from './factories/MethodModelFactory'; -module.exports = { - version: version, +export default { + version, /** * Returns the Shh object. @@ -44,7 +44,7 @@ module.exports = { * * @returns {Shh} */ - Shh: function (provider) { + Shh: (provider) => { return new Shh( provider, ProvidersPackage, From e0c842c9f1738a16ed136a84b737d56e192da4df Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:25:06 +0200 Subject: [PATCH 0282/1045] web3-utils ported to es6 --- packages/web3-utils/src/bloomFilter.js | 35 +++-- packages/web3-utils/src/index.js | 144 +++++++++---------- packages/web3-utils/src/soliditySha3.js | 108 +++++++------- packages/web3-utils/src/utils.js | 184 ++++++++++++------------ 4 files changed, 233 insertions(+), 238 deletions(-) diff --git a/packages/web3-utils/src/bloomFilter.js b/packages/web3-utils/src/bloomFilter.js index 0aa855ab902..de54ffd4bb3 100644 --- a/packages/web3-utils/src/bloomFilter.js +++ b/packages/web3-utils/src/bloomFilter.js @@ -27,41 +27,38 @@ * Ethereum bloom filter support. * * TODO UNDOCUMENTED - * - * @module bloom - * @class [bloom] bloom */ -var utils = require("./utils.js"); +import utils from "./utils.js"; function codePointToInt(codePoint) { if (codePoint >= 48 && codePoint <= 57) { /*['0'..'9'] -> [0..9]*/ - return codePoint-48; + return codePoint - 48; } if (codePoint >= 65 && codePoint <= 70) { /*['A'..'F'] -> [10..15]*/ - return codePoint-55; + return codePoint - 55; } if (codePoint >= 97 && codePoint <= 102) { /*['a'..'f'] -> [10..15]*/ - return codePoint-87; + return codePoint - 87; } throw "invalid bloom"; } function testBytes(bloom, bytes) { - var hash = utils.sha3(bytes).replace('0x',''); + const hash = utils.sha3(bytes).replace('0x', ''); - for (var i = 0; i < 12; i += 4) { + for (let i = 0; i < 12; i += 4) { // calculate bit position in bloom filter that must be active - var bitpos = ((parseInt(hash.substr(i, 2), 16) << 8) + parseInt(hash.substr((i+2), 2), 16)) & 2047; + const bitpos = ((parseInt(hash.substr(i, 2), 16) << 8) + parseInt(hash.substr((i + 2), 2), 16)) & 2047; // test if bitpos in bloom is active - var code = codePointToInt(bloom.charCodeAt(bloom.length - 1 - Math.floor(bitpos/4))); - var offset = 1 << (bitpos % 4); + const code = codePointToInt(bloom.charCodeAt(bloom.length - 1 - Math.floor(bitpos / 4))); + const offset = 1 << (bitpos % 4); - if ((code&offset) !== offset) { + if ((code & offset) !== offset) { return false; } } @@ -78,12 +75,12 @@ function testBytes(bloom, bytes) { * @param {String} address in hex notation * @returns {Boolean} topic is (probably) part of the block */ -var testAddress = function(bloom, address) { +const testAddress = (bloom, address) => { if (!utils.isBloom(bloom)) { throw 'Invalid bloom given'; } if (!utils.isAddress(address)) { - throw 'Invalid address given: "'+ address +'\"'; + throw `Invalid address given: "${address}"`; } return testBytes(bloom, address); @@ -98,14 +95,14 @@ var testAddress = function(bloom, address) { * @param {String} address in hex notation * @returns {Boolean} topic is (probably) part of the block */ -var testTopic = function(bloom, topic) { +const testTopic = (bloom, topic) => { if (!utils.isBloom(bloom)) throw "invalid bloom"; if (!utils.isTopic(topic)) throw "invalid topic"; return testBytes(bloom, topic); }; -module.exports = { - testAddress: testAddress, - testTopic: testTopic +export default { + testAddress, + testTopic }; diff --git a/packages/web3-utils/src/index.js b/packages/web3-utils/src/index.js index d2a066110fa..6ec99c31e72 100644 --- a/packages/web3-utils/src/index.js +++ b/packages/web3-utils/src/index.js @@ -22,12 +22,12 @@ */ -var _ = require('underscore'); -var ethjsUnit = require('ethjs-unit'); -var utils = require('./utils.js'); -var soliditySha3 = require('./soliditySha3.js'); -var randomHex = require('randomhex'); +import _ from 'underscore'; +import ethjsUnit from 'ethjs-unit'; +import utils from './utils.js'; +import soliditySha3 from './soliditySha3.js'; +import randomHex from 'randomhex'; /** @@ -40,19 +40,19 @@ var randomHex = require('randomhex'); * @param {Function} callback * @return {Object} the emitter */ -var _fireError = function (error, emitter, reject, callback) { +const _fireError = (error, emitter, reject, callback) => { /*jshint maxcomplexity: 10 */ // add data if given - if(_.isObject(error) && !(error instanceof Error) && error.data) { - if(_.isObject(error.data) || _.isArray(error.data)) { + if (_.isObject(error) && !(error instanceof Error) && error.data) { + if (_.isObject(error.data) || _.isArray(error.data)) { error.data = JSON.stringify(error.data, null, 2); } - error = error.message +"\n"+ error.data; + error = `${error.message}\n${error.data}`; } - if(_.isString(error)) { + if (_.isString(error)) { error = new Error(error); } @@ -64,18 +64,19 @@ var _fireError = function (error, emitter, reject, callback) { // OR suppress uncatched error if an callback listener is present if (emitter && (_.isFunction(emitter.listeners) && - emitter.listeners('error').length) || _.isFunction(callback)) { - emitter.catch(function(){}); + emitter.listeners('error').length) || _.isFunction(callback)) { + emitter.catch(() => { + }); } // reject later, to be able to return emitter - setTimeout(function () { + setTimeout(() => { reject(error); }, 1); } - if(emitter && _.isFunction(emitter.emit)) { + if (emitter && _.isFunction(emitter.emit)) { // emit later, to be able to return emitter - setTimeout(function () { + setTimeout(() => { emitter.emit('error', error); emitter.removeAllListeners(); }, 1); @@ -91,12 +92,12 @@ var _fireError = function (error, emitter, reject, callback) { * @param {Object} json * @return {String} full function/event name */ -var _jsonInterfaceMethodToString = function (json) { +const _jsonInterfaceMethodToString = json => { if (_.isObject(json) && json.name && json.name.indexOf('(') !== -1) { return json.name; } - return json.name + '(' + _flattenTypes(false, json.inputs).join(',') + ')'; + return `${json.name}(${_flattenTypes(false, json.inputs).join(',')})`; }; @@ -108,32 +109,33 @@ var _jsonInterfaceMethodToString = function (json) { * @param {Object} puts * @return {Array} parameters as strings */ -var _flattenTypes = function(includeTuple, puts) -{ +const _flattenTypes = (includeTuple, puts) => { // console.log("entered _flattenTypes. inputs/outputs: " + puts) - var types = []; + const types = []; - puts.forEach(function(param) { + puts.forEach(param => { if (typeof param.components === 'object') { if (param.type.substring(0, 5) !== 'tuple') { throw new Error('components found but type is not tuple; report on GitHub'); } - var suffix = ''; - var arrayBracket = param.type.indexOf('['); - if (arrayBracket >= 0) { suffix = param.type.substring(arrayBracket); } - var result = _flattenTypes(includeTuple, param.components); + let suffix = ''; + const arrayBracket = param.type.indexOf('['); + if (arrayBracket >= 0) { + suffix = param.type.substring(arrayBracket); + } + const result = _flattenTypes(includeTuple, param.components); // console.log("result should have things: " + result) - if(_.isArray(result) && includeTuple) { + if (_.isArray(result) && includeTuple) { // console.log("include tuple word, and its an array. joining...: " + result.types) - types.push('tuple(' + result.join(',') + ')' + suffix); + types.push(`tuple(${result.join(',')})${suffix}`); } - else if(!includeTuple) { + else if (!includeTuple) { // console.log("don't include tuple, but its an array. joining...: " + result) - types.push('(' + result.join(',') + ')' + suffix); + types.push(`(${result.join(',')})${suffix}`); } else { // console.log("its a single type within a tuple: " + result.types) - types.push('(' + result + ')'); + types.push(`(${result})`); } } else { // console.log("its a type and not directly in a tuple: " + param.type) @@ -152,17 +154,18 @@ var _flattenTypes = function(includeTuple, puts) * @param {String} hex * @returns {String} ascii string representation of hex value */ -var hexToAscii = function(hex) { +const hexToAscii = hex => { if (!utils.isHexStrict(hex)) throw new Error('The parameter must be a valid HEX string.'); - var str = ""; - var i = 0, l = hex.length; + let str = "", i = 0; + const l = hex.length; + if (hex.substring(0, 2) === '0x') { i = 2; } - for (; i < l; i+=2) { - var code = parseInt(hex.substr(i, 2), 16); + for (; i < l; i += 2) { + const code = parseInt(hex.substr(i, 2), 16); str += String.fromCharCode(code); } @@ -176,21 +179,20 @@ var hexToAscii = function(hex) { * @param {String} str * @returns {String} hex representation of input string */ -var asciiToHex = function(str) { - if(!str) +const asciiToHex = str => { + if (!str) return "0x00"; - var hex = ""; - for(var i = 0; i < str.length; i++) { - var code = str.charCodeAt(i); - var n = code.toString(16); - hex += n.length < 2 ? '0' + n : n; + let hex = ""; + for (let i = 0; i < str.length; i++) { + const code = str.charCodeAt(i); + const n = code.toString(16); + hex += n.length < 2 ? `0${n}` : n; } - return "0x" + hex; + return `0x${hex}`; }; - /** * Returns value of unit in Wei * @@ -199,10 +201,10 @@ var asciiToHex = function(str) { * @returns {BN} value of the unit (in Wei) * @throws error if the unit is not correct:w */ -var getUnitValue = function (unit) { +const getUnitValue = unit => { unit = unit ? unit.toLowerCase() : 'ether'; if (!ethjsUnit.unitMap[unit]) { - throw new Error('This unit "'+ unit +'" doesn\'t exist, please use the one of the following units' + JSON.stringify(ethjsUnit.unitMap, null, 2)); + throw new Error(`This unit "${unit}" doesn't exist, please use the one of the following units${JSON.stringify(ethjsUnit.unitMap, null, 2)}`); } return unit; }; @@ -228,10 +230,10 @@ var getUnitValue = function (unit) { * @param {String} unit the unit to convert to, default ether * @return {String|Object} When given a BN object it returns one as well, otherwise a number */ -var fromWei = function(number, unit) { +const fromWei = (number, unit) => { unit = getUnitValue(unit); - if(!utils.isBN(number) && !_.isString(number)) { + if (!utils.isBN(number) && !_.isString(number)) { throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); } @@ -260,10 +262,10 @@ var fromWei = function(number, unit) { * @param {String} unit the unit to convert from, default ether * @return {String|Object} When given a BN object it returns one as well, otherwise a number */ -var toWei = function(number, unit) { +const toWei = (number, unit) => { unit = getUnitValue(unit); - if(!utils.isBN(number) && !_.isString(number)) { + if (!utils.isBN(number) && !_.isString(number)) { throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); } @@ -271,8 +273,6 @@ var toWei = function(number, unit) { }; - - /** * Converts to a checksum address * @@ -280,19 +280,18 @@ var toWei = function(number, unit) { * @param {String} address the given HEX address * @return {String} */ -var toChecksumAddress = function (address) { +const toChecksumAddress = address => { if (typeof address === 'undefined') return ''; - if(!/^(0x)?[0-9a-f]{40}$/i.test(address)) - throw new Error('Given address "'+ address +'" is not a valid Ethereum address.'); - + if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) + throw new Error(`Given address "${address}" is not a valid Ethereum address.`); - address = address.toLowerCase().replace(/^0x/i,''); - var addressHash = utils.sha3(address).replace(/^0x/i,''); - var checksumAddress = '0x'; + address = address.toLowerCase().replace(/^0x/i, ''); + const addressHash = utils.sha3(address).replace(/^0x/i, ''); + let checksumAddress = '0x'; - for (var i = 0; i < address.length; i++ ) { + for (let i = 0; i < address.length; i++) { // If ith character is 9 to f then make it uppercase if (parseInt(addressHash[i], 16) > 7) { checksumAddress += address[i].toUpperCase(); @@ -304,15 +303,14 @@ var toChecksumAddress = function (address) { }; - -module.exports = { - _fireError: _fireError, - _jsonInterfaceMethodToString: _jsonInterfaceMethodToString, - _flattenTypes: _flattenTypes, +export default { + _fireError, + _jsonInterfaceMethodToString, + _flattenTypes, // extractDisplayName: extractDisplayName, // extractTypeName: extractTypeName, - randomHex: randomHex, - _: _, + randomHex, + _, BN: utils.BN, isBN: utils.isBN, isBigNumber: utils.isBigNumber, @@ -320,10 +318,10 @@ module.exports = { isHexStrict: utils.isHexStrict, sha3: utils.sha3, keccak256: utils.sha3, - soliditySha3: soliditySha3, + soliditySha3, isAddress: utils.isAddress, checkAddressChecksum: utils.checkAddressChecksum, - toChecksumAddress: toChecksumAddress, + toChecksumAddress, toHex: utils.toHex, toBN: utils.toBN, @@ -346,14 +344,14 @@ module.exports = { stringToHex: utils.utf8ToHex, fromUtf8: utils.utf8ToHex, - hexToAscii: hexToAscii, + hexToAscii, toAscii: hexToAscii, - asciiToHex: asciiToHex, + asciiToHex, fromAscii: asciiToHex, unitMap: ethjsUnit.unitMap, - toWei: toWei, - fromWei: fromWei, + toWei, + fromWei, padLeft: utils.leftPad, leftPad: utils.leftPad, diff --git a/packages/web3-utils/src/soliditySha3.js b/packages/web3-utils/src/soliditySha3.js index b1767abd5c2..ab182aefba8 100644 --- a/packages/web3-utils/src/soliditySha3.js +++ b/packages/web3-utils/src/soliditySha3.js @@ -20,28 +20,28 @@ * @date 2017 */ -var _ = require('underscore'); -var BN = require('bn.js'); -var utils = require('./utils.js'); +import _ from 'underscore'; +import BN from 'bn.js'; +import utils from './utils.js'; -var _elementaryName = function (name) { +const _elementaryName = name => { /*jshint maxcomplexity:false */ if (name.startsWith('int[')) { - return 'int256' + name.slice(3); + return `int256${name.slice(3)}`; } else if (name === 'int') { return 'int256'; } else if (name.startsWith('uint[')) { - return 'uint256' + name.slice(4); + return `uint256${name.slice(4)}`; } else if (name === 'uint') { return 'uint256'; } else if (name.startsWith('fixed[')) { - return 'fixed128x128' + name.slice(5); + return `fixed128x128${name.slice(5)}`; } else if (name === 'fixed') { return 'fixed128x128'; } else if (name.startsWith('ufixed[')) { - return 'ufixed128x128' + name.slice(6); + return `ufixed128x128${name.slice(6)}`; } else if (name === 'ufixed') { return 'ufixed128x128'; } @@ -49,22 +49,22 @@ var _elementaryName = function (name) { }; // Parse N from type -var _parseTypeN = function (type) { - var typesize = /^\D+(\d+).*$/.exec(type); +const _parseTypeN = type => { + const typesize = /^\D+(\d+).*$/.exec(type); return typesize ? parseInt(typesize[1], 10) : null; }; // Parse N from type[] -var _parseTypeNArray = function (type) { - var arraySize = /^\D+\d*\[(\d+)\]$/.exec(type); +const _parseTypeNArray = type => { + const arraySize = /^\D+\d*\[(\d+)\]$/.exec(type); return arraySize ? parseInt(arraySize[1], 10) : null; }; -var _parseNumber = function (arg) { - var type = typeof arg; +const _parseNumber = arg => { + const type = typeof arg; if (type === 'string') { if (utils.isHexStrict(arg)) { - return new BN(arg.replace(/0x/i,''), 16); + return new BN(arg.replace(/0x/i, ''), 16); } else { return new BN(arg, 10); } @@ -75,21 +75,21 @@ var _parseNumber = function (arg) { } else if (utils.isBN(arg)) { return arg; } else { - throw new Error(arg +' is not a number'); + throw new Error(`${arg} is not a number`); } }; -var _solidityPack = function (type, value, arraySize) { +const _solidityPack = (type, value, arraySize) => { /*jshint maxcomplexity:false */ - var size, num; + let size, num; type = _elementaryName(type); if (type === 'bytes') { - if (value.replace(/^0x/i,'').length % 2 !== 0) { - throw new Error('Invalid bytes characters '+ value.length); + if (value.replace(/^0x/i, '').length % 2 !== 0) { + throw new Error(`Invalid bytes characters ${value.length}`); } return value; @@ -98,14 +98,14 @@ var _solidityPack = function (type, value, arraySize) { } else if (type === 'bool') { return value ? '01' : '00'; } else if (type.startsWith('address')) { - if(arraySize) { + if (arraySize) { size = 64; } else { size = 40; } - if(!utils.isAddress(value)) { - throw new Error(value +' is not a valid address, or the checksum is invalid.'); + if (!utils.isAddress(value)) { + throw new Error(`${value} is not a valid address, or the checksum is invalid.`); } return utils.leftPad(value.toLowerCase(), size); @@ -115,76 +115,76 @@ var _solidityPack = function (type, value, arraySize) { if (type.startsWith('bytes')) { - if(!size) { + if (!size) { throw new Error('bytes[] not yet supported in solidity'); } // must be 32 byte slices when in an array - if(arraySize) { + if (arraySize) { size = 32; } - if (size < 1 || size > 32 || size < value.replace(/^0x/i,'').length / 2 ) { - throw new Error('Invalid bytes' + size +' for '+ value); + if (size < 1 || size > 32 || size < value.replace(/^0x/i, '').length / 2) { + throw new Error(`Invalid bytes${size} for ${value}`); } return utils.rightPad(value, size * 2); } else if (type.startsWith('uint')) { if ((size % 8) || (size < 8) || (size > 256)) { - throw new Error('Invalid uint'+size+' size'); + throw new Error(`Invalid uint${size} size`); } num = _parseNumber(value); if (num.bitLength() > size) { - throw new Error('Supplied uint exceeds width: ' + size + ' vs ' + num.bitLength()); + throw new Error(`Supplied uint exceeds width: ${size} vs ${num.bitLength()}`); } - if(num.lt(new BN(0))) { - throw new Error('Supplied uint '+ num.toString() +' is negative'); + if (num.lt(new BN(0))) { + throw new Error(`Supplied uint ${num.toString()} is negative`); } - return size ? utils.leftPad(num.toString('hex'), size/8 * 2) : num; + return size ? utils.leftPad(num.toString('hex'), size / 8 * 2) : num; } else if (type.startsWith('int')) { if ((size % 8) || (size < 8) || (size > 256)) { - throw new Error('Invalid int'+size+' size'); + throw new Error(`Invalid int${size} size`); } num = _parseNumber(value); if (num.bitLength() > size) { - throw new Error('Supplied int exceeds width: ' + size + ' vs ' + num.bitLength()); + throw new Error(`Supplied int exceeds width: ${size} vs ${num.bitLength()}`); } - if(num.lt(new BN(0))) { + if (num.lt(new BN(0))) { return num.toTwos(size).toString('hex'); } else { - return size ? utils.leftPad(num.toString('hex'), size/8 * 2) : num; + return size ? utils.leftPad(num.toString('hex'), size / 8 * 2) : num; } } else { // FIXME: support all other types - throw new Error('Unsupported or invalid type: ' + type); + throw new Error(`Unsupported or invalid type: ${type}`); } }; -var _processSoliditySha3Args = function (arg) { +const _processSoliditySha3Args = arg => { /*jshint maxcomplexity:false */ - if(_.isArray(arg)) { + if (_.isArray(arg)) { throw new Error('Autodetection of array types is not supported.'); } - var type, value = ''; - var hexArg, arraySize; + let type, value = ''; + let hexArg, arraySize; // if type is given if (_.isObject(arg) && (arg.hasOwnProperty('v') || arg.hasOwnProperty('t') || arg.hasOwnProperty('value') || arg.hasOwnProperty('type'))) { type = arg.hasOwnProperty('t') ? arg.t : arg.type; value = arg.hasOwnProperty('v') ? arg.v : arg.value; - // otherwise try to guess the type + // otherwise try to guess the type } else { type = utils.toHex(arg, true); @@ -195,15 +195,15 @@ var _processSoliditySha3Args = function (arg) { } } - if ((type.startsWith('int') || type.startsWith('uint')) && typeof value === 'string' && !/^(-)?0x/i.test(value)) { + if ((type.startsWith('int') || type.startsWith('uint')) && typeof value === 'string' && !/^(-)?0x/i.test(value)) { value = new BN(value); } // get the array size - if(_.isArray(value)) { + if (_.isArray(value)) { arraySize = _parseTypeNArray(type); - if(arraySize && value.length !== arraySize) { - throw new Error(type +' is not matching the given array '+ JSON.stringify(value)); + if (arraySize && value.length !== arraySize) { + throw new Error(`${type} is not matching the given array ${JSON.stringify(value)}`); } else { arraySize = value.length; } @@ -211,13 +211,13 @@ var _processSoliditySha3Args = function (arg) { if (_.isArray(value)) { - hexArg = value.map(function (val) { - return _solidityPack(type, val, arraySize).toString('hex').replace('0x',''); + hexArg = value.map(val => { + return _solidityPack(type, val, arraySize).toString('hex').replace('0x', ''); }); return hexArg.join(''); } else { hexArg = _solidityPack(type, value, arraySize); - return hexArg.toString('hex').replace('0x',''); + return hexArg.toString('hex').replace('0x', ''); } }; @@ -228,18 +228,18 @@ var _processSoliditySha3Args = function (arg) { * @method soliditySha3 * @return {Object} the sha3 */ -var soliditySha3 = function () { +const soliditySha3 = () => { /*jshint maxcomplexity:false */ - var args = Array.prototype.slice.call(arguments); + const args = Array.prototype.slice.call(arguments); - var hexArgs = _.map(args, _processSoliditySha3Args); + const hexArgs = _.map(args, _processSoliditySha3Args); // console.log(args, hexArgs); // console.log('0x'+ hexArgs.join('')); - return utils.sha3('0x'+ hexArgs.join('')); + return utils.sha3(`0x${hexArgs.join('')}`); }; -module.exports = soliditySha3; +export default soliditySha3; diff --git a/packages/web3-utils/src/utils.js b/packages/web3-utils/src/utils.js index 496c6279db7..38c59c2d5be 100644 --- a/packages/web3-utils/src/utils.js +++ b/packages/web3-utils/src/utils.js @@ -20,11 +20,12 @@ * @date 2017 */ -var _ = require('underscore'); -var BN = require('bn.js'); -var numberToBN = require('number-to-bn'); -var utf8 = require('utf8'); -var Hash = require("eth-lib/lib/hash"); +import _ from 'underscore'; + +import BN from 'bn.js'; +import numberToBN from 'number-to-bn'; +import utf8 from 'utf8'; +import Hash from "eth-lib/lib/hash"; /** @@ -34,7 +35,7 @@ var Hash = require("eth-lib/lib/hash"); * @param {Object} object * @return {Boolean} */ -var isBN = function (object) { +const isBN = object => { return object instanceof BN || (object && object.constructor && object.constructor.name === 'BN'); }; @@ -46,7 +47,7 @@ var isBN = function (object) { * @param {Object} object * @return {Boolean} */ -var isBigNumber = function (object) { +const isBigNumber = object => { return object && object.constructor && object.constructor.name === 'BigNumber'; }; @@ -57,11 +58,11 @@ var isBigNumber = function (object) { * @param {Number|String|BN} number, string, HEX string or BN * @return {BN} BN */ -var toBN = function(number){ +const toBN = number => { try { return numberToBN.apply(null, arguments); - } catch(e) { - throw new Error(e + ' Given value: "'+ number +'"'); + } catch (e) { + throw new Error(`${e} Given value: "${number}"`); } }; @@ -73,8 +74,8 @@ var toBN = function(number){ * @param {Number|String|BN} number * @return {String} */ -var toTwosComplement = function (number) { - return '0x'+ toBN(number).toTwos(256).toString(16, 64); +const toTwosComplement = number => { + return `0x${toBN(number).toTwos(256).toString(16, 64)}`; }; /** @@ -84,7 +85,7 @@ var toTwosComplement = function (number) { * @param {String} address the given HEX address * @return {Boolean} */ -var isAddress = function (address) { +const isAddress = address => { // check if it has the basic requirements of an address if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { return false; @@ -98,7 +99,6 @@ var isAddress = function (address) { }; - /** * Checks if the given string is a checksummed address * @@ -106,12 +106,12 @@ var isAddress = function (address) { * @param {String} address the given HEX address * @return {Boolean} */ -var checkAddressChecksum = function (address) { +const checkAddressChecksum = address => { // Check each case - address = address.replace(/^0x/i,''); - var addressHash = sha3(address.toLowerCase()).replace(/^0x/i,''); + address = address.replace(/^0x/i, ''); + const addressHash = sha3(address.toLowerCase()).replace(/^0x/i, ''); - for (var i = 0; i < 40; i++ ) { + for (let i = 0; i < 40; i++) { // the nth letter should be uppercase if the nth digit of casemap is 1 if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i])) { return false; @@ -129,11 +129,11 @@ var checkAddressChecksum = function (address) { * @param {String} sign, by default 0 * @returns {String} right aligned string */ -var leftPad = function (string, chars, sign) { - var hasPrefix = /^0x/i.test(string) || typeof string === 'number'; - string = string.toString(16).replace(/^0x/i,''); +const leftPad = (string, chars, sign) => { + const hasPrefix = /^0x/i.test(string) || typeof string === 'number'; + string = string.toString(16).replace(/^0x/i, ''); - var padding = (chars - string.length + 1 >= 0) ? chars - string.length + 1 : 0; + const padding = (chars - string.length + 1 >= 0) ? chars - string.length + 1 : 0; return (hasPrefix ? '0x' : '') + new Array(padding).join(sign ? sign : "0") + string; }; @@ -147,11 +147,11 @@ var leftPad = function (string, chars, sign) { * @param {String} sign, by default 0 * @returns {String} right aligned string */ -var rightPad = function (string, chars, sign) { - var hasPrefix = /^0x/i.test(string) || typeof string === 'number'; - string = string.toString(16).replace(/^0x/i,''); +const rightPad = (string, chars, sign) => { + const hasPrefix = /^0x/i.test(string) || typeof string === 'number'; + string = string.toString(16).replace(/^0x/i, ''); - var padding = (chars - string.length + 1 >= 0) ? chars - string.length + 1 : 0; + const padding = (chars - string.length + 1 >= 0) ? chars - string.length + 1 : 0; return (hasPrefix ? '0x' : '') + string + (new Array(padding).join(sign ? sign : "0")); }; @@ -164,25 +164,25 @@ var rightPad = function (string, chars, sign) { * @param {String} str * @returns {String} hex representation of input string */ -var utf8ToHex = function(str) { +const utf8ToHex = str => { str = utf8.encode(str); - var hex = ""; + let hex = ""; // remove \u0000 padding from either side - str = str.replace(/^(?:\u0000)*/,''); + str = str.replace(/^(?:\u0000)*/, ''); str = str.split("").reverse().join(""); - str = str.replace(/^(?:\u0000)*/,''); + str = str.replace(/^(?:\u0000)*/, ''); str = str.split("").reverse().join(""); - for(var i = 0; i < str.length; i++) { - var code = str.charCodeAt(i); + for (let i = 0; i < str.length; i++) { + const code = str.charCodeAt(i); // if (code !== 0) { - var n = code.toString(16); - hex += n.length < 2 ? '0' + n : n; + const n = code.toString(16); + hex += n.length < 2 ? `0${n}` : n; // } } - return "0x" + hex; + return `0x${hex}`; }; /** @@ -192,23 +192,23 @@ var utf8ToHex = function(str) { * @param {String} hex * @returns {String} ascii string representation of hex value */ -var hexToUtf8 = function(hex) { +const hexToUtf8 = hex => { if (!isHexStrict(hex)) - throw new Error('The parameter "'+ hex +'" must be a valid HEX string.'); + throw new Error(`The parameter "${hex}" must be a valid HEX string.`); - var str = ""; - var code = 0; - hex = hex.replace(/^0x/i,''); + let str = ""; + let code = 0; + hex = hex.replace(/^0x/i, ''); // remove 00 padding from either side - hex = hex.replace(/^(?:00)*/,''); + hex = hex.replace(/^(?:00)*/, ''); hex = hex.split("").reverse().join(""); - hex = hex.replace(/^(?:00)*/,''); + hex = hex.replace(/^(?:00)*/, ''); hex = hex.split("").reverse().join(""); - var l = hex.length; + const l = hex.length; - for (var i=0; i < l; i+=2) { + for (let i = 0; i < l; i += 2) { code = parseInt(hex.substr(i, 2), 16); // if (code !== 0) { str += String.fromCharCode(code); @@ -226,7 +226,7 @@ var hexToUtf8 = function(hex) { * @param {String|Number|BN} value * @return {String} */ -var hexToNumber = function (value) { +const hexToNumber = value => { if (!value) { return value; } @@ -241,7 +241,7 @@ var hexToNumber = function (value) { * @param {String|Number|BN} value * @return {String} */ -var hexToNumberString = function (value) { +const hexToNumberString = value => { if (!value) return value; return toBN(value).toString(10); @@ -255,19 +255,19 @@ var hexToNumberString = function (value) { * @param {String|Number|BN} value * @return {String} */ -var numberToHex = function (value) { +const numberToHex = value => { if (_.isNull(value) || _.isUndefined(value)) { return value; } if (!isFinite(value) && !isHexStrict(value)) { - throw new Error('Given input "'+value+'" is not a number.'); + throw new Error(`Given input "${value}" is not a number.`); } - var number = toBN(value); - var result = number.toString(16); + const number = toBN(value); + const result = number.toString(16); - return number.lt(new BN(0)) ? '-0x' + result.substr(1) : '0x' + result; + return number.lt(new BN(0)) ? `-0x${result.substr(1)}` : `0x${result}`; }; @@ -280,14 +280,14 @@ var numberToHex = function (value) { * @param {Array} bytes * @return {String} the hex string */ -var bytesToHex = function(bytes) { - for (var hex = [], i = 0; i < bytes.length; i++) { +const bytesToHex = bytes => { + for (let hex = [], i = 0; i < bytes.length; i++) { /* jshint ignore:start */ hex.push((bytes[i] >>> 4).toString(16)); hex.push((bytes[i] & 0xF).toString(16)); /* jshint ignore:end */ } - return '0x'+ hex.join(""); + return `0x${hex.join("")}`; }; /** @@ -299,16 +299,16 @@ var bytesToHex = function(bytes) { * @param {String} hex * @return {Array} the byte array */ -var hexToBytes = function(hex) { +const hexToBytes = hex => { hex = hex.toString(16); if (!isHexStrict(hex)) { - throw new Error('Given value "'+ hex +'" is not a valid hex string.'); + throw new Error(`Given value "${hex}" is not a valid hex string.`); } - hex = hex.replace(/^0x/i,''); + hex = hex.replace(/^0x/i, ''); - for (var bytes = [], c = 0; c < hex.length; c += 2) + for (let bytes = [], c = 0; c < hex.length; c += 2) bytes.push(parseInt(hex.substr(c, 2), 16)); return bytes; }; @@ -323,11 +323,11 @@ var hexToBytes = function(hex) { * @param {Boolean} returnType * @return {String} */ -var toHex = function (value, returnType) { +const toHex = (value, returnType) => { /*jshint maxcomplexity: false */ if (isAddress(value)) { - return returnType ? 'address' : '0x'+ value.toLowerCase().replace(/^0x/i,''); + return returnType ? 'address' : `0x${value.toLowerCase().replace(/^0x/i, '')}`; } if (_.isBoolean(value)) { @@ -343,7 +343,7 @@ var toHex = function (value, returnType) { if (_.isString(value)) { if (value.indexOf('-0x') === 0 || value.indexOf('-0X') === 0) { return returnType ? 'int256' : numberToHex(value); - } else if(value.indexOf('0x') === 0 || value.indexOf('0X') === 0) { + } else if (value.indexOf('0x') === 0 || value.indexOf('0X') === 0) { return returnType ? 'bytes' : value; } else if (!isFinite(value)) { return returnType ? 'string' : utf8ToHex(value); @@ -361,7 +361,7 @@ var toHex = function (value, returnType) { * @param {String} hex to be checked * @returns {Boolean} */ -var isHexStrict = function (hex) { +const isHexStrict = hex => { return ((_.isString(hex) || _.isNumber(hex)) && /^(-)?0x[0-9a-f]*$/i.test(hex)); }; @@ -372,7 +372,7 @@ var isHexStrict = function (hex) { * @param {String} hex to be checked * @returns {Boolean} */ -var isHex = function (hex) { +const isHex = hex => { return ((_.isString(hex) || _.isNumber(hex)) && /^(-0x|0x)?[0-9a-f]*$/i.test(hex)); }; @@ -386,7 +386,7 @@ var isHex = function (hex) { * @param {String} hex encoded bloom filter * @return {Boolean} */ -var isBloom = function (bloom) { +const isBloom = bloom => { if (!/^(0x)?[0-9a-f]{512}$/i.test(bloom)) { return false; } else if (/^(0x)?[0-9a-f]{512}$/.test(bloom) || /^(0x)?[0-9A-F]{512}$/.test(bloom)) { @@ -404,7 +404,7 @@ var isBloom = function (bloom) { * @param {String} hex encoded topic * @return {Boolean} */ -var isTopic = function (topic) { +const isTopic = topic => { if (!/^(0x)?[0-9a-f]{64}$/i.test(topic)) { return false; } else if (/^(0x)?[0-9a-f]{64}$/.test(topic) || /^(0x)?[0-9A-F]{64}$/.test(topic)) { @@ -422,16 +422,16 @@ var isTopic = function (topic) { * @method sha3 * @return {String} the sha3 string */ -var SHA3_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; +const SHA3_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; -var sha3 = function (value) { +const sha3 = value => { if (isHexStrict(value) && /^0x/i.test((value).toString())) { value = hexToBytes(value); } - var returnValue = Hash.keccak256(value); // jshint ignore:line + const returnValue = Hash.keccak256(value); // jshint ignore:line - if(returnValue === SHA3_NULL_S) { + if (returnValue === SHA3_NULL_S) { return null; } else { return returnValue; @@ -441,27 +441,27 @@ var sha3 = function (value) { sha3._Hash = Hash; -module.exports = { - BN: BN, - isBN: isBN, - isBigNumber: isBigNumber, - toBN: toBN, - isAddress: isAddress, - isBloom: isBloom, // TODO UNDOCUMENTED - isTopic: isTopic, // TODO UNDOCUMENTED - checkAddressChecksum: checkAddressChecksum, - utf8ToHex: utf8ToHex, - hexToUtf8: hexToUtf8, - hexToNumber: hexToNumber, - hexToNumberString: hexToNumberString, - numberToHex: numberToHex, - toHex: toHex, - hexToBytes: hexToBytes, - bytesToHex: bytesToHex, - isHex: isHex, - isHexStrict: isHexStrict, - leftPad: leftPad, - rightPad: rightPad, - toTwosComplement: toTwosComplement, - sha3: sha3 +export default { + BN, + isBN, + isBigNumber, + toBN, + isAddress, + isBloom, // TODO UNDOCUMENTED + isTopic, // TODO UNDOCUMENTED + checkAddressChecksum, + utf8ToHex, + hexToUtf8, + hexToNumber, + hexToNumberString, + numberToHex, + toHex, + hexToBytes, + bytesToHex, + isHex, + isHexStrict, + leftPad, + rightPad, + toTwosComplement, + sha3 }; From b96066cfd39dde79aab9901568f59d54e2644d10 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:29:33 +0200 Subject: [PATCH 0283/1045] web3-core ported to es6 --- packages/web3-core/src/AbstractWeb3Module.js | 402 +++++++++---------- packages/web3-core/src/index.js | 11 +- 2 files changed, 204 insertions(+), 209 deletions(-) diff --git a/packages/web3-core/src/AbstractWeb3Module.js b/packages/web3-core/src/AbstractWeb3Module.js index 517b34490fe..b32ecaeb9b2 100644 --- a/packages/web3-core/src/AbstractWeb3Module.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -22,246 +22,242 @@ "use strict"; -var _ = require('underscore'); - -/** - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {AbstractMethodModelFactory} methodModelFactory - * - * @constructor - */ -function AbstractWeb3Module( - provider, - providersPackage, - methodController, - methodModelFactory -) { - if (!this.isDependencyGiven(provider)) { - throw Error('No provider given as constructor parameter!'); - } - - if (!this.isDependencyGiven(providersPackage)) { - throw Error('ProviderPackage not found!'); - } +import _ from 'underscore'; + +export default class AbstractWeb3Module { + + /** + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {AbstractMethodModelFactory} methodModelFactory + * + * @constructor + */ + constructor(provider, providersPackage, methodController, methodModelFactory) { + if (!this.isDependencyGiven(provider)) { + throw Error('No provider given as constructor parameter!'); + } - this.methodController = methodController; - this.extendedPackages = []; - this.providersPackage = providersPackage; - this.givenProvider = this.providersPackage.detect(); - - this.providers = { - HttpProvider: this.providersPackage.HttpProvider, - IpcProvider: this.providersPackage.IpcProvider, - WebsocketProvider: this.providersPackage.WebsocketProvider, - }; - - var self = this, - currentProvider = provider; - - Object.defineProperty(this, 'currentProvider', { - get: function () { - return currentProvider; - }, - set: function () { - throw Error('The property currentProvider is an read-only property!'); + if (!this.isDependencyGiven(providersPackage)) { + throw Error('ProviderPackage not found!'); } - }); - this.BatchRequest = function () { - return new self.providersPackage.BatchRequest(self.currentProvider); - }; + this.methodController = methodController; + this.extendedPackages = []; + this.providersPackage = providersPackage; + this.givenProvider = this.providersPackage.detect(); + + this.providers = { + HttpProvider: this.providersPackage.HttpProvider, + IpcProvider: this.providersPackage.IpcProvider, + WebsocketProvider: this.providersPackage.WebsocketProvider, + }; - if (this.isDependencyGiven(methodModelFactory)) { - this.methodModelFactory = methodModelFactory; - this.extend.formatters = this.methodModelFactory.formatters; + let currentProvider = provider; - return new Proxy(this, - { - get: this.proxyHandler + Object.defineProperty(this, 'currentProvider', { + get() { + return currentProvider; + }, + set() { + throw Error('The property currentProvider is an read-only property!'); } - ) - } -} + }); -/** - * Sets the currentProvider and provider property - * - * @method setProvider - * - * @param {Object|String} provider - * @param {Net} net - * - * @returns {Boolean} - */ -AbstractWeb3Module.prototype.setProvider = function (provider, net) { - if (!this.isSameProvider(provider)) { - this.clearSubscriptions(); - this.currentProvider = this.providersPackage.resolve(provider, net); - - if (this.extendedPackages.length > 0) { - var setExtendedPackagesProvider = this.extendedPackages.every(function (extendedPackage) { - return !!extendedPackage.setProvider(provider, net); - }); - } + this.BatchRequest = () => { + return new this.providersPackage.BatchRequest(this.currentProvider); + }; + + if (this.isDependencyGiven(methodModelFactory)) { + this.methodModelFactory = methodModelFactory; + this.extend.formatters = this.methodModelFactory.formatters; - return !!(setExtendedPackagesProvider && this.currentProvider); + return new Proxy(this, + { + get: this.proxyHandler + } + ) + } } - return false; -}; + /** + * Sets the currentProvider and provider property + * + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net + * + * @returns {Boolean} + */ + setProvider(provider, net) { + if (!this.isSameProvider(provider)) { + this.clearSubscriptions(); + this.currentProvider = this.providersPackage.resolve(provider, net); + + if (this.extendedPackages.length > 0) { + var setExtendedPackagesProvider = this.extendedPackages.every(extendedPackage => { + return !!extendedPackage.setProvider(provider, net); + }); + } -/** - * Checks if the given provider is the same as the currentProvider - * - * @method isSameProvider - * - * @param {Object|String} provider - * - * @returns {Boolean} - */ -AbstractWeb3Module.prototype.isSameProvider = function (provider) { - if (_.isObject(provider)) { - if (this.currentProvider.provider.constructor.name === provider.constructor.name) { - return this.currentProvider.host === provider.host; + return !!(setExtendedPackagesProvider && this.currentProvider); } return false; } - return this.currentProvider.host === provider; -}; + /** + * Checks if the given provider is the same as the currentProvider + * + * @method isSameProvider + * + * @param {Object|String} provider + * + * @returns {Boolean} + */ + isSameProvider(provider) { + if (_.isObject(provider)) { + if (this.currentProvider.provider.constructor.name === provider.constructor.name) { + return this.currentProvider.host === provider.host; + } -/** - * Clears all subscriptions and listeners of the provider if it has any subscriptions - * - * @method clearSubscriptions - */ -AbstractWeb3Module.prototype.clearSubscriptions = function () { - if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && - this.currentProvider.subscriptions.length > 0 - ) { - this.currentProvider.clearSubscriptions(); + return false; + } + + return this.currentProvider.host === provider; } -}; -/** - * Extends the current object with JSON-RPC methods - * - * @method extend - * - * @param {Object} extension - */ -AbstractWeb3Module.prototype.extend = function (extension) { - var namespace = extension.property || false, - object; - - if (namespace) { - object = this[namespace] = new this.constructor( - this.provider, - this.providersPackage, - this.methodController, - new this.methodModelFactory.constructor(this.methodModelFactory.utils, this.methodModelFactory.formatters) - ); - - this.extendedPackages.push(object); - } else { - object = this; + /** + * Clears all subscriptions and listeners of the provider if it has any subscriptions + * + * @method clearSubscriptions + */ + clearSubscriptions() { + if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && + this.currentProvider.subscriptions.length > 0 + ) { + this.currentProvider.clearSubscriptions(); + } } - if (extension.methods) { - extension.methods.forEach(function (method) { - function ExtensionMethodModel(utils, formatters) { - AbstractMethodModel.call(this, method.call, method.params, utils, formatters); - } + /** + * Extends the current object with JSON-RPC methods + * + * @method extend + * + * @param {Object} extension + */ + extend(extension) { + const namespace = extension.property || false; + let object; + + if (namespace) { + object = this[namespace] = new this.constructor( + this.currentProvider, + this.providersPackage, + this.methodController, + new this.methodModelFactory.constructor( + {}, + this.methodModelFactory.utils, + this.methodModelFactory.formatters + ) + ); + + this.extendedPackages.push(object); + } else { + object = this; + } - ExtensionMethodModel.prototype.beforeExecution = function (parameters, moduleInstance) { - method.inputFormatters.forEach(function (formatter, key) { - if (formatter) { - parameters[key] = formatter(parameters[key], moduleInstance); + if (extension.methods) { + extension.methods.forEach(method => { + class ExtensionMethodModel extends AbstractMethodModel { + constructor(utils, formatters) { + super(method.call, method.params, utils, formatters); } - }); - }; - ExtensionMethodModel.prototype.afterExecution = function (response) { - if (_.isArray(response)) { - response = response.map(function (responseItem) { - if (method.outputFormatter && responseItem) { - return method.outputFormatter(responseItem); - } - - return responseItem; - }); + beforeExecution(parameters, moduleInstance) { + method.inputFormatters.forEach((formatter, key) => { + if (formatter) { + parameters[key] = formatter(parameters[key], moduleInstance); + } + }); + } - return response; - } + afterExecution(response) { + if (_.isArray(response)) { + response = response.map(responseItem => { + if (method.outputFormatter && responseItem) { + return method.outputFormatter(responseItem); + } - if (method.outputFormatter && result) { - response = method.outputFormatter(response); - } + return responseItem; + }); - return response; - }; + return response; + } - ExtensionMethodModel.prototype = Object.create(AbstractMethodModel.prototype); + if (method.outputFormatter && result) { + response = method.outputFormatter(response); + } - object.methodModelFactory.methodModels[method.name] = ExtensionMethodModel; - }); - } -}; + return response; + } + } -/** - * Handles method execution - * - * @method proxyHandler - * - * @param {Object} target - * @param {String} name - * - * @returns {*} - */ -AbstractWeb3Module.prototype.proxyHandler = function (target, name) { - if (target.methodModelFactory.hasMethodModel(name)) { - if (typeof target[name] !== 'undefined') { - throw new Error('Duplicated method ' + name + '. This method is defined as RPC call and as Object method.'); + object.methodModelFactory.methodModels[method.name] = ExtensionMethodModel; + }); } + } - var methodModel = target.methodModelFactory.createMethodModel(name); + /** + * Handles method execution + * + * @method proxyHandler + * + * @param {Object} target + * @param {String} name + * + * @returns {*} + */ + proxyHandler(target, name) { + if (target.methodModelFactory.hasMethodModel(name)) { + if (typeof target[name] !== 'undefined') { + throw new Error(`Duplicated method ${name}. This method is defined as RPC call and as Object method.`); + } - var anonymousFunction = function () { - methodModel.methodArguments = arguments; + const methodModel = target.methodModelFactory.createMethodModel(name); - if (methodModel.parameters.length !== methodModel.parametersAmount) { - throw Error( - 'Invalid parameters length the expected length would be' - + methodModel.parametersAmount + - 'and not' - + methodModel.parameters.length - ); - } + const anonymousFunction = () => { + methodModel.methodArguments = arguments; - return target.methodController.execute(methodModel, target.accounts, target); - }; + if (methodModel.parameters.length !== methodModel.parametersAmount) { + throw Error( + `Invalid parameters length the expected length would be${methodModel.parametersAmount}and not${methodModel.parameters.length}` + ); + } - anonymousFunction.methodModel = methodModel; - anonymousFunction.request = methodModel.request; + return target.methodController.execute(methodModel, target.accounts, target); + }; - return anonymousFunction; - } + anonymousFunction.methodModel = methodModel; + anonymousFunction.request = methodModel.request; - return target[name]; -}; + return anonymousFunction; + } -/** - * Checks if the given value is defined - * - * @param {*} object - * - * @returns {Boolean} - */ -AbstractWeb3Module.prototype.isDependencyGiven = function (object) { - return object !== null && typeof object !== 'undefined' -}; + return target[name]; + } -module.exports = AbstractWeb3Module; + /** + * Checks if the given value is defined + * + * @param {*} object + * + * @returns {Boolean} + */ + isDependencyGiven(object) { + return object !== null && typeof object !== 'undefined' + } +} diff --git a/packages/web3-core/src/index.js b/packages/web3-core/src/index.js index e8c87313f56..0b76915ece5 100644 --- a/packages/web3-core/src/index.js +++ b/packages/web3-core/src/index.js @@ -22,11 +22,10 @@ "use strict"; -var version = require('../package.json').version; -var AbstractWeb3Module = require('./AbstractWeb3Module'); +import {version} from '../package.json'; +import AbstractWeb3Module from './AbstractWeb3Module'; -module.exports = { - version: version, - - AbstractWeb3Module: AbstractWeb3Module +export default { + version, + AbstractWeb3Module }; From b0d0404ae5dc6ac236824a293e19e31b7cc57c4f Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:30:49 +0200 Subject: [PATCH 0284/1045] web3-bzz ported to es6 --- packages/web3-bzz/src/Bzz.js | 231 ++++++++++++++++----------------- packages/web3-bzz/src/index.js | 11 +- 2 files changed, 120 insertions(+), 122 deletions(-) diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index 489135f8042..41b45245e45 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -22,139 +22,138 @@ "use strict"; -var _ = require('underscore'); -var swarm = require("swarm-js"); - -/** - * @param {Object|String} provider - * - * @constructor - */ -function Bzz(provider) { - this.givenProvider = Bzz.givenProvider; - this.currentProvider = null; - this.setProvider(provider); -} - -/** - * Gets the pick methods from swarm if it is executed in the browser - * - * @method pick - * - * @returns {Object|Boolean} - */ -Bzz.prototype.pick = function () { - if (typeof document !== 'undefined') { - return swarm.pick; +import _ from 'underscore'; +import swarm from "swarm-js"; + +export default class Bzz { + + /** + * @param {Object|String} provider + * + * @constructor + */ + constructor(provider) { + this.givenProvider = Bzz.givenProvider; + this.currentProvider = null; + this.setProvider(provider); } - throw Error('Pick is not supported for this environment.'); -}; - -/** - * Downloads a file from the swarm network - * - * @method download - * - * @param {String} bzzHash - * @param {String} localPath - * - * @returns {Promise} - */ -Bzz.prototype.download = function (bzzHash, localPath) { - if (this.hasProvider()) { - return this.swarm.download(bzzHash, localPath); + /** + * Gets the pick methods from swarm if it is executed in the browser + * + * @method pick + * + * @returns {Object|Boolean} + */ + pick() { + if (typeof document !== 'undefined') { + return swarm.pick; + } + + throw Error('Pick is not supported for this environment.'); } - this.throwProviderError(); -}; - -/** - * Uploads the given data to swarm - * - * @method upload - * - * @param {String|Buffer|Uint8Array|Object} data - * - * @returns {Promise} - */ -Bzz.prototype.upload = function (data) { - if (this.hasProvider()) { - return this.swarm.upload(data); + /** + * Downloads a file from the swarm network + * + * @method download + * + * @param {String} bzzHash + * @param {String} localPath + * + * @returns {Promise} + */ + download(bzzHash, localPath) { + if (this.hasProvider()) { + return this.swarm.download(bzzHash, localPath); + } + + this.throwProviderError(); } - this.throwProviderError(); -}; - -/** - * Checks if swarm is available - * - * @method isAvailable - * - * @returns {Promise} - */ -Bzz.prototype.isAvailable = function () { - if (this.hasProvider()) { - return this.swarm.isAvailable(); + /** + * Uploads the given data to swarm + * + * @method upload + * + * @param {String|Buffer|Uint8Array|Object} data + * + * @returns {Promise} + */ + upload(data) { + if (this.hasProvider()) { + return this.swarm.upload(data); + } + + this.throwProviderError(); } - this.throwProviderError(); -}; - -/** - * Checks if currentProvider is set - * - * @method hasProvider - * - * @returns {Boolean} - */ -Bzz.prototype.hasProvider = function () { - return !!this.currentProvider; -}; - -/** - * Throws the provider error - * - * @method throwProviderError - */ -Bzz.prototype.throwProviderError = function () { - throw new Error('No provider set, please set one using bzz.setProvider().'); -}; - -/** - * Sets the provider for swarm - * - * @method setProvider - * - * @param {Object|String} provider - * - * @returns {Boolean} - */ -Bzz.prototype.setProvider = function (provider) { - // is ethereum provider - if (_.isObject(provider) && _.isString(provider.bzz)) { - provider = provider.bzz; + /** + * Checks if swarm is available + * + * @method isAvailable + * + * @returns {Promise} + */ + isAvailable() { + if (this.hasProvider()) { + return this.swarm.isAvailable(); + } + + this.throwProviderError(); } - if (_.isString(provider)) { - this.currentProvider = provider; - this.swarm = swarm.at(provider); - - return true; + /** + * Checks if currentProvider is set + * + * @method hasProvider + * + * @returns {Boolean} + */ + hasProvider() { + return !!this.currentProvider; } - this.currentProvider = null; + /** + * Throws the provider error + * + * @method throwProviderError + */ + throwProviderError() { + throw new Error('No provider set, please set one using bzz.setProvider().'); + } - return false; -}; + /** + * Sets the provider for swarm + * + * @method setProvider + * + * @param {Object|String} provider + * + * @returns {Boolean} + */ + setProvider(provider) { + // is ethereum provider + if (_.isObject(provider) && _.isString(provider.bzz)) { + provider = provider.bzz; + } + + if (_.isString(provider)) { + this.currentProvider = provider; + this.swarm = swarm.at(provider); + + return true; + } + + this.currentProvider = null; + + return false; + } +} -// set default ethereum provider /* jshint ignore:start */ Bzz.givenProvider = null; if (typeof ethereumProvider !== 'undefined' && ethereumProvider.bzz) { Bzz.givenProvider = ethereumProvider.bzz; } /* jshint ignore:end */ - - -module.exports = Bzz; diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index 63f7234c8b0..229aac2d302 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -22,11 +22,10 @@ "use strict"; -var version = require('./package.json').version; -var Bzz = require('./Bzz'); +import {version} from '../package.json'; +import Bzz from './Bzz'; -module.exports = { - version: version, - - Bzz: Bzz +export default { + version, + Bzz }; From 28d889b285622a05ac4908a9f31fe287106da4d8 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:32:26 +0200 Subject: [PATCH 0285/1045] web3-core-helpers ported to es6 --- packages/web3-core-helpers/src/errors.js | 26 ++--- packages/web3-core-helpers/src/formatters.js | 108 ++++++++++--------- packages/web3-core-helpers/src/index.js | 10 +- 3 files changed, 73 insertions(+), 71 deletions(-) diff --git a/packages/web3-core-helpers/src/errors.js b/packages/web3-core-helpers/src/errors.js index 820b30384b2..ef6779d5e64 100644 --- a/packages/web3-core-helpers/src/errors.js +++ b/packages/web3-core-helpers/src/errors.js @@ -23,25 +23,25 @@ "use strict"; -module.exports = { - ErrorResponse: function (result) { - var message = !!result && !!result.error && !!result.error.message ? result.error.message : JSON.stringify(result); - return new Error('Returned error: ' + message); +export default { + ErrorResponse(result) { + const message = !!result && !!result.error && !!result.error.message ? result.error.message : JSON.stringify(result); + return new Error(`Returned error: ${message}`); }, - InvalidNumberOfParams: function (got, expected, method) { - return new Error('Invalid number of parameters for "'+ method +'". Got '+ got +' expected '+ expected +'!'); + InvalidNumberOfParams(got, expected, method) { + return new Error(`Invalid number of parameters for "${method}". Got ${got} expected ${expected}!`); }, - InvalidConnection: function (host){ - return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +'.'); + InvalidConnection(host) { + return new Error(`CONNECTION ERROR: Couldn't connect to node ${host}.`); }, - InvalidProvider: function () { + InvalidProvider() { return new Error('Provider not set or invalid'); }, - InvalidResponse: function (result){ - var message = !!result && !!result.error && !!result.error.message ? result.error.message : 'Invalid JSON RPC response: ' + JSON.stringify(result); + InvalidResponse(result) { + const message = !!result && !!result.error && !!result.error.message ? result.error.message : `Invalid JSON RPC response: ${JSON.stringify(result)}`; return new Error(message); }, - ConnectionTimeout: function (ms){ - return new Error('CONNECTION TIMEOUT: timeout of ' + ms + ' ms achived'); + ConnectionTimeout(ms) { + return new Error(`CONNECTION TIMEOUT: timeout of ${ms} ms achived`); } }; diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index e06ab1872b7..de12ef0d677 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -24,9 +24,9 @@ "use strict"; -var _ = require('underscore'); -var utils = require('web3-utils'); -var Iban = require('web3-eth-iban'); +import _ from 'underscore'; +import utils from 'web3-utils'; +import Iban from 'web3-eth-iban'; /** * Should the format output to a big number @@ -35,11 +35,11 @@ var Iban = require('web3-eth-iban'); * @param {String|Number|BigNumber} number * @returns {BigNumber} object */ -var outputBigNumberFormatter = function (number) { +const outputBigNumberFormatter = number => { return utils.toBN(number).toString(10); }; -var isPredefinedBlockNumber = function (blockNumber) { +const isPredefinedBlockNumber = blockNumber => { return blockNumber === 'latest' || blockNumber === 'pending' || blockNumber === 'earliest'; }; @@ -52,7 +52,7 @@ var isPredefinedBlockNumber = function (blockNumber) { * * @returns {String} */ -var inputDefaultBlockNumberFormatter = function (blockNumber, moduleInstance) { +const inputDefaultBlockNumberFormatter = (blockNumber, moduleInstance) => { if (blockNumber === undefined || blockNumber === null) { return moduleInstance.defaultBlock; } @@ -64,12 +64,15 @@ var inputDefaultBlockNumberFormatter = function (blockNumber, moduleInstance) { return inputBlockNumberFormatter(blockNumber); }; -var inputBlockNumberFormatter = function (blockNumber) { +const inputBlockNumberFormatter = blockNumber => { if (blockNumber === undefined) { return undefined; - } else if (isPredefinedBlockNumber(blockNumber)) { + } + + if (isPredefinedBlockNumber(blockNumber)) { return blockNumber; } + return (utils.isHexStrict(blockNumber)) ? ((_.isString(blockNumber)) ? blockNumber.toLowerCase() : blockNumber) : utils.numberToHex(blockNumber); }; @@ -80,7 +83,7 @@ var inputBlockNumberFormatter = function (blockNumber) { * @param {Object} transaction options * @returns object */ -var _txInputFormatter = function (options){ +const _txInputFormatter = options => { if (options.to) { // it might be contract creation options.to = inputAddressFormatter(options.to); @@ -104,9 +107,9 @@ var _txInputFormatter = function (options){ options.gas = options.gas || options.gasLimit; } - ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) { + ['gasPrice', 'gas', 'value', 'nonce'].filter(key => { return options[key] !== undefined; - }).forEach(function(key){ + }).forEach(key => { options[key] = utils.numberToHex(options[key]); }); @@ -123,9 +126,9 @@ var _txInputFormatter = function (options){ * * @returns object */ -var inputCallFormatter = function (options, moduleInstance){ +const inputCallFormatter = (options, moduleInstance) => { options = _txInputFormatter(options); - var from = moduleInstance.defaultAccount; + let from = moduleInstance.defaultAccount; if (options.from) { from = options.from @@ -148,7 +151,7 @@ var inputCallFormatter = function (options, moduleInstance){ * * @returns object */ -var inputTransactionFormatter = function (options, moduleInstance) { +const inputTransactionFormatter = (options, moduleInstance) => { options = _txInputFormatter(options); if (!_.isNumber(options.from) && !_.isObject(options.from)) { @@ -173,7 +176,7 @@ var inputTransactionFormatter = function (options, moduleInstance) { * @param {String} data * @returns {String} */ -var inputSignFormatter = function (data) { +const inputSignFormatter = data => { return (utils.isHexStrict(data)) ? data : utils.utf8ToHex(data); }; @@ -184,7 +187,7 @@ var inputSignFormatter = function (data) { * @param {Object} tx * @returns {Object} */ -var outputTransactionFormatter = function (tx){ +const outputTransactionFormatter = tx => { if(tx.blockNumber !== null) tx.blockNumber = utils.hexToNumber(tx.blockNumber); if(tx.transactionIndex !== null) @@ -214,9 +217,9 @@ var outputTransactionFormatter = function (tx){ * @param {Object} receipt * @returns {Object} */ -var outputTransactionReceiptFormatter = function (receipt){ +const outputTransactionReceiptFormatter = receipt => { if(typeof receipt !== 'object') { - throw new Error('Received receipt is invalid: '+ receipt); + throw new Error(`Received receipt is invalid: ${receipt}`); } if(receipt.blockNumber !== null) @@ -248,7 +251,7 @@ var outputTransactionReceiptFormatter = function (receipt){ * @param {Object} block * @returns {Object} */ -var outputBlockFormatter = function(block) { +const outputBlockFormatter = block => { // transform to number block.gasLimit = utils.hexToNumber(block.gasLimit); @@ -264,7 +267,7 @@ var outputBlockFormatter = function(block) { block.totalDifficulty = outputBigNumberFormatter(block.totalDifficulty); if (_.isArray(block.transactions)) { - block.transactions.forEach(function(item){ + block.transactions.forEach(item => { if(!_.isString(item)) return outputTransactionFormatter(item); }); @@ -283,8 +286,8 @@ var outputBlockFormatter = function(block) { * @param {Object} log object * @returns {Object} log */ -var inputLogFormatter = function(options) { - var toTopic = function(value){ +const inputLogFormatter = options => { + let toTopic = value => { if(value === null || typeof value === 'undefined') return null; @@ -306,14 +309,14 @@ var inputLogFormatter = function(options) { // make sure topics, get converted to hex options.topics = options.topics || []; - options.topics = options.topics.map(function(topic){ + options.topics = options.topics.map(topic => { return (_.isArray(topic)) ? topic.map(toTopic) : toTopic(topic); }); toTopic = null; if (options.address) { - options.address = (_.isArray(options.address)) ? options.address.map(function (addr) { + options.address = (_.isArray(options.address)) ? options.address.map(addr => { return inputAddressFormatter(addr); }) : inputAddressFormatter(options.address); } @@ -328,14 +331,14 @@ var inputLogFormatter = function(options) { * @param {Object} log object * @returns {Object} log */ -var outputLogFormatter = function(log) { +const outputLogFormatter = log => { // generate a custom log id if(typeof log.blockHash === 'string' && typeof log.transactionHash === 'string' && typeof log.logIndex === 'string') { - var shaId = utils.sha3(log.blockHash.replace('0x','') + log.transactionHash.replace('0x','') + log.logIndex.replace('0x','')); - log.id = 'log_'+ shaId.replace('0x','').substr(0,8); + const shaId = utils.sha3(log.blockHash.replace('0x','') + log.transactionHash.replace('0x','') + log.logIndex.replace('0x','')); + log.id = `log_${shaId.replace('0x','').substr(0,8)}`; } else if(!log.id) { log.id = null; } @@ -361,7 +364,7 @@ var outputLogFormatter = function(log) { * @param {Object} transaction object * @returns {Object} */ -var inputPostFormatter = function(post) { +const inputPostFormatter = post => { // post.payload = utils.toHex(post.payload); @@ -378,7 +381,7 @@ var inputPostFormatter = function(post) { } // format the following options - post.topics = post.topics.map(function(topic){ + post.topics = post.topics.map(topic => { // convert only if not hex return (topic.indexOf('0x') === 0) ? topic : utils.fromUtf8(topic); }); @@ -393,8 +396,7 @@ var inputPostFormatter = function(post) { * @param {Object} * @returns {Object} */ -var outputPostFormatter = function(post){ - +const outputPostFormatter = post => { post.expiry = utils.hexToNumber(post.expiry); post.sent = utils.hexToNumber(post.sent); post.ttl = utils.hexToNumber(post.ttl); @@ -410,27 +412,27 @@ var outputPostFormatter = function(post){ if (!post.topics) { post.topics = []; } - post.topics = post.topics.map(function(topic){ + post.topics = post.topics.map(topic => { return utils.toUtf8(topic); }); return post; }; -var inputAddressFormatter = function (address) { - var iban = new Iban(address); +var inputAddressFormatter = address => { + const iban = new Iban(address); if (iban.isValid() && iban.isDirect()) { return iban.toAddress().toLowerCase(); } else if (utils.isAddress(address)) { - return '0x' + address.toLowerCase().replace('0x',''); + return `0x${address.toLowerCase().replace('0x','')}`; } - throw new Error('Provided address "'+ address +'" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can\'t be converted.'); + throw new Error(`Provided address "${address}" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.`); }; -var outputSyncingFormatter = function(result) { +const outputSyncingFormatter = result => { result.startingBlock = utils.hexToNumber(result.startingBlock); result.currentBlock = utils.hexToNumber(result.currentBlock); @@ -443,21 +445,21 @@ var outputSyncingFormatter = function(result) { return result; }; -module.exports = { - inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter, - inputBlockNumberFormatter: inputBlockNumberFormatter, - inputCallFormatter: inputCallFormatter, - inputTransactionFormatter: inputTransactionFormatter, - inputAddressFormatter: inputAddressFormatter, - inputPostFormatter: inputPostFormatter, - inputLogFormatter: inputLogFormatter, - inputSignFormatter: inputSignFormatter, - outputBigNumberFormatter: outputBigNumberFormatter, - outputTransactionFormatter: outputTransactionFormatter, - outputTransactionReceiptFormatter: outputTransactionReceiptFormatter, - outputBlockFormatter: outputBlockFormatter, - outputLogFormatter: outputLogFormatter, - outputPostFormatter: outputPostFormatter, - outputSyncingFormatter: outputSyncingFormatter +export default { + inputDefaultBlockNumberFormatter, + inputBlockNumberFormatter, + inputCallFormatter, + inputTransactionFormatter, + inputAddressFormatter, + inputPostFormatter, + inputLogFormatter, + inputSignFormatter, + outputBigNumberFormatter, + outputTransactionFormatter, + outputTransactionReceiptFormatter, + outputBlockFormatter, + outputLogFormatter, + outputPostFormatter, + outputSyncingFormatter }; diff --git a/packages/web3-core-helpers/src/index.js b/packages/web3-core-helpers/src/index.js index b0f9a4db528..7c597380003 100644 --- a/packages/web3-core-helpers/src/index.js +++ b/packages/web3-core-helpers/src/index.js @@ -22,11 +22,11 @@ "use strict"; -var errors = require('./errors'); -var formatters = require('./formatters'); +import errors from './errors'; +import formatters from './formatters'; -module.exports = { - errors: errors, - formatters: formatters +export default { + errors, + formatters }; From ced2a16f1f239ce8640a3a675dec90811c948f04 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 17:34:23 +0200 Subject: [PATCH 0286/1045] web3 ported to es6 --- packages/web3/src/index.js | 123 ++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 63 deletions(-) diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 20319f4df5b..f2133a6597b 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -22,63 +22,62 @@ "use strict"; -var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; -var formatters = require('web3-core-helpers').formatters; -var MethodPackage = require('web3-core-method'); -var ProvidersPackage = require('web3-providers'); -var Utils = require('web3-utils'); -var Eth = require('web3-eth').Eth; -var Shh = require('web3-shh').Shh; -var Bzz = require('web3-bzz').Bzz; -var Network = require('web3-net').Network; -var Personal = require('web3-eth-personal').Personal; -var version = require('../package.json').version; - -/** - * @param {Object|String} provider - * @param {Net} net - * - * @constructor - */ -var Web3 = function Web3(provider, net) { - this.version = version; - provider = ProvidersPackage.resolve(provider, net); - - AbstractWeb3Module.call( - this, - provider, - ProvidersPackage, - MethodPackage.createMethodController(), - new MethodPackage.AbstractMethodModelFactory({}, utils, formatters) - ); - - this.utils = Utils; - this.eth = new Eth(provider); - this.shh = new Shh(provider); - this.bzz = new Bzz(provider); -}; - -/** - * Sets the provider for all packages - * - * @method setProvider - * - * @param {Object|String} provider - * @param {Net} net - * - * @returns {Boolean} - */ -Web3.prototype.setProvider = function (provider, net) { - return !!( - AbstractWeb3Module.prototype.setProvider.call(this, provider, net) && - this.eth.setProvider(provider, net) && - this.shh.setProvider(provider, net) && - this.bzz.setProvider(provider) - ); -}; +import {AbstractWeb3Module} from 'web3-core'; +import {formatters} from 'web3-core-helpers'; +import MethodPackage from 'web3-core-method'; +import ProvidersPackage from 'web3-providers'; +import Utils from 'web3-utils'; +import {Eth} from 'web3-eth'; +import {Shh} from 'web3-shh'; +import {Bzz} from 'web3-bzz'; +import {Network} from 'web3-net'; +import {Personal} from 'web3-eth-personal'; +import {version} from '../package.json'; + +export default class Web3 extends AbstractWeb3Module { + + /** + * @param {Object|String} provider + * @param {Net} net + * + * @constructor + */ + constructor(provider, net) { + provider = ProvidersPackage.resolve(provider, net); + + super( + provider, + ProvidersPackage, + MethodPackage.createMethodController(), + new MethodPackage.AbstractMethodModelFactory({}, utils, formatters) + ); + + this.version = version; + this.utils = Utils; + this.eth = new Eth(provider); + this.shh = new Shh(provider); + this.bzz = new Bzz(provider); + } -Web3.prototype = Object.create(AbstractWeb3Module.prototype); -Web3.prototype.constructor = Web3; + /** + * Sets the provider for all packages + * + * @method setProvider + * + * @param {Object|String} provider + * @param {Net} net + * + * @returns {Boolean} + */ + setProvider(provider, net) { + return !!( + super.setProvider(provider, net) && + this.eth.setProvider(provider, net) && + this.shh.setProvider(provider, net) && + this.bzz.setProvider(provider) + ); + } +} Web3.givenProvider = ProvidersPackage.detect(); @@ -87,19 +86,19 @@ Web3.version = version; Web3.utils = Utils; Web3.modules = { - Eth: function (provider, net) { + Eth(provider, net) { return new Eth(ProvidersPackage.resolve(provider, net)); }, - Net: function (provider, net) { + Net(provider, net) { return new Network(ProvidersPackage.resolve(provider, net)); }, - Personal: function (provider, net) { + Personal(provider, net) { return new Personal(ProvidersPackage.resolve(provider, net)); }, - Shh: function (provider, net) { + Shh(provider, net) { return new Shh(ProvidersPackage.resolve(provider, net)); }, - Bzz: function (provider, net) { + Bzz(provider, net) { return new Bzz(ProvidersPackage.resolve(provider, net)); } }; @@ -109,5 +108,3 @@ Web3.providers = { WebsocketProvider: ProvidersPackage.WebsocketProvider, IpcProvider: ProvidersPackage.IpcProvider }; - -module.exports = Web3; From 14ebcfc97ca0361571e81ec95e054368a15aa3f1 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 18:01:10 +0200 Subject: [PATCH 0287/1045] All index files updated --- packages/web3-bzz/src/index.js | 10 +- packages/web3-core-helpers/src/index.js | 10 +- packages/web3-core-method/src/index.js | 273 ++++++------------ packages/web3-core-promievent/src/index.js | 8 +- packages/web3-core-subscriptions/src/index.js | 32 +- packages/web3-core/src/index.js | 9 +- packages/web3-eth-abi/src/index.js | 25 +- packages/web3-eth-accounts/src/index.js | 43 ++- packages/web3-eth-contract/src/Contract.js | 2 +- packages/web3-eth-contract/src/index.js | 66 ++--- .../methods/PastEventLogsMethodModel.js | 4 +- packages/web3-eth-ens/src/index.js | 47 ++- packages/web3-eth/src/Eth.js | 2 +- packages/web3-eth/src/index.js | 60 ++-- packages/web3-net/src/index.js | 42 ++- packages/web3-providers/src/index.js | 107 +++---- packages/web3-shh/src/index.js | 43 ++- 17 files changed, 310 insertions(+), 473 deletions(-) diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index 229aac2d302..25fde578d6a 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -21,11 +21,5 @@ */ "use strict"; - -import {version} from '../package.json'; -import Bzz from './Bzz'; - -export default { - version, - Bzz -}; +export Bzz from './Bzz'; +export version from '../package.json'; diff --git a/packages/web3-core-helpers/src/index.js b/packages/web3-core-helpers/src/index.js index 7c597380003..64efadc2e8c 100644 --- a/packages/web3-core-helpers/src/index.js +++ b/packages/web3-core-helpers/src/index.js @@ -22,11 +22,5 @@ "use strict"; -import errors from './errors'; -import formatters from './formatters'; - -export default { - errors, - formatters -}; - +export errors from './errors'; +export formatters from './formatters'; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 3fde468a78a..6041e9bd79e 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -25,188 +25,101 @@ import {version} from '../package.json'; import MethodPackageFactory from './factories/MethodPackageFactory'; -import AbstractMethodModelFactory from '../lib/factories/AbstractMethodModelFactory'; import PromiEventPackage from 'web3-core-promievent'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {formatters} from 'web3-core-helpers'; -// Methods - // Network - import GetProtocolVersionMethodModel from './models/methods/network/GetProtocolVersionMethodModel'; - - import VersionMethodModel from './models/methods/network/VersionMethodModel'; - import ListeningMethodModel from './models/methods/network/ListeningMethodModel'; - import PeerCountMethodModel from './models/methods/network/PeerCountMethodModel'; - // Node - import GetNodeInfoMethodModel from './models/methods/node/GetNodeInfoMethodModel'; - - import GetCoinbaseMethodModel from './models/methods/node/GetCoinbaseMethodModel'; - import IsMiningMethodModel from './models/methods/node/IsMiningMethodModel'; - import GetHashrateMethodModel from './models/methods/node/GetHashrateMethodModel'; - import IsSyncingMethodModel from './models/methods/node/IsSyncingMethodModel'; - import GetGasPriceMethodModel from './models/methods/node/GetGasPriceMethodModel'; - import SubmitWorkMethodModel from './models/methods/node/SubmitWorkMethodModel'; - import GetWorkMethodModel from './models/methods/node/GetWorkMethodModel'; - // Account - import GetAccountsMethodModel from './models/methods/account/GetAccountsMethodModel'; - - import GetBalanceMethodModel from './models/methods/account/GetBalanceMethodModel'; - import GetTransactionCountMethodModel from './models/methods/account/GetTransactionCountMethodModel'; - // Block - import GetBlockNumberMethodModel from './models/methods/block/GetBlockNumberMethodModel'; - - import GetBlockMethodModel from './models/methods/block/GetBlockMethodModel'; - import GetUncleMethodModel from './models/methods/block/GetUncleMethodModel'; - import GetBlockTransactionCountMethodModel from './models/methods/block/GetBlockTransactionCountMethodModel'; - import GetBlockUncleCountMethodModel from './models/methods/block/GetBlockUncleCountMethodModel'; - // Transaction - import GetTransactionMethodModel from './models/methods/transaction/GetTransactionMethodModel'; - - import GetTransactionFromBlockMethodModel from './models/methods/transaction/GetTransactionFromBlockMethodModel'; - import GetTransactionReceipt from './models/methods/transaction/GetTransactionReceiptMethodModel'; - import SendSignedTransactionMethodModel from './models/methods/transaction/SendSignedTransactionMethodModel'; - import SignTransactionMethodModel from './models/methods/transaction/SignTransactionMethodModel'; - import SendTransactionMethodModel from './models/methods/transaction/SendTransactionMethodModel'; - // Global - import GetCodeMethodModel from './models/methods/GetCodeMethodModel'; - - import SignMethodModel from './models/methods/SignMethodModel'; - import CallMethodModel from './models/methods/CallMethodModel'; - import GetStorageAtMethodModel from './models/methods/GetStorageAtMethodModel'; - import EstimateGasMethodModel from './models/methods/EstimateGasMethodModel'; - import GetPastLogsMethodModel from './models/methods/GetPastLogsMethodModel'; - // Personal - import EcRecoverMethodModel from './models/methods/personal/EcRecoverMethodModel'; - - import ImportRawKeyMethodModel from './models/methods/personal/ImportRawKeyMethodModel'; - import ListAccountsMethodModel from './models/methods/personal/ListAccountsMethodModel'; - import LockAccountMethodModel from './models/methods/personal/LockAccountMethodModel'; - import NewAccountMethodModel from './models/methods/personal/NewAccountMethodModel'; - import PersonalSendTransactionMethodModel from './models/methods/personal/PersonalSendTransactionMethodModel'; - import PersonalSignMethodModel from './models/methods/personal/PersonalSignMethodModel'; - import PersonalSignTransactionMethodModel from './models/methods/personal/PersonalSignTransactionMethodModel'; - import UnlockAccountMethodModel from './models/methods/personal/UnlockAccountMethodModel'; - // SHH - import AddPrivateKeyMethodModel from './models/methods/shh/AddPrivateKeyMethodModel'; - - import AddSymKeyMethodModel from './models/methods/shh/AddSymKeyMethodModel'; - import DeleteKeyPairMethodModel from './models/methods/shh/DeleteKeyPairMethodModel'; - import DeleteMessageFilterMethodModel from './models/methods/shh/DeleteMessageFilterMethodModel'; - import DeleteSymKeyMethodModel from './models/methods/shh/DeleteSymKeyMethodModel'; - import GenerateSymKeyFromPasswordMethodModel from './models/methods/shh/GenerateSymKeyFromPasswordMethodModel'; - import GetFilterMessagesMethodModel from './models/methods/shh/GetFilterMessagesMethodModel'; - import GetInfoMethodModel from './models/methods/shh/GetInfoMethodModel'; - import GetPrivateKeyMethodModel from './models/methods/shh/GetPrivateKeyMethodModel'; - import GetPublicKeyMethodModel from './models/methods/shh/GetPublicKeyMethodModel'; - import GetSymKeyMethodModel from './models/methods/shh/GetSymKeyMethodModel'; - import HasKeyPairMethodModel from './models/methods/shh/HasKeyPairMethodModel'; - import HasSymKeyMethodModel from './models/methods/shh/HasSymKeyMethodModel'; - import MarkTrustedPeerMethodModel from './models/methods/shh/MarkTrustedPeerMethodModel'; - import NewKeyPairMethodModel from './models/methods/shh/NewKeyPairMethodModel'; - import NewMessageFilterMethodModel from './models/methods/shh/NewMessageFilterMethodModel'; - import NewSymKeyMethodModel from './models/methods/shh/NewSymKeyMethodModel'; - import PostMethodModel from './models/methods/shh/PostMethodModel'; - import SetMaxMessageSizeMethodModel from './models/methods/shh/SetMaxMessageSizeMethodModel'; - import SetMinPoWMethodModel from './models/methods/shh/SetMinPoWMethodModel'; - import ShhVersionMethodModel from './models/methods/shh/ShhVersionMethodModel'; - -export default { - version, - AbstractMethodModelFactory, - - /** - * Returns the MethodController object - * - * @method MethodController - * - * @returns {MethodController} - */ - MethodController: () => { - return new MethodPackageFactory().createMethodController( - PromiEventPackage, - new SubscriptionsFactory(), - formatters - ); - }, - - /** - * Methods - */ - // Network - GetProtocolVersionMethodModel, - VersionMethodModel, - ListeningMethodModel, - PeerCountMethodModel, - - // Node - GetNodeInfoMethodModel, - GetCoinbaseMethodModel, - IsMiningMethodModel, - GetHashrateMethodModel, - IsSyncingMethodModel, - GetWorkMethodModel, - GetGasPriceMethodModel, - SubmitWorkMethodModel, - - // Account - GetAccountsMethodModel, - GetBalanceMethodModel, - GetTransactionCountMethodModel, - - // Block - GetBlockNumberMethodModel, - GetBlockMethodModel, - GetUncleMethodModel, - GetBlockTransactionCountMethodModel, - GetBlockUncleCountMethodModel, - - // Transaction - GetTransactionMethodModel, - GetTransactionFromBlockMethodModel, - SendSignedTransactionMethodModel, - SignTransactionMethodModel, - SendTransactionMethodModel, - GetTransactionReceipt, - - // Global - GetStorageAtMethodModel, - GetCodeMethodModel, - SignMethodModel, - CallMethodModel, - EstimateGasMethodModel, - GetPastLogsMethodModel, - - // Personal - EcRecoverMethodModel, - ImportRawKeyMethodModel, - ListAccountsMethodModel, - LockAccountMethodModel, - NewAccountMethodModel, - PersonalSendTransactionMethodModel, - PersonalSignMethodModel, - PersonalSignTransactionMethodModel, - UnlockAccountMethodModel, - - // SHH - AddPrivateKeyMethodModel, - AddSymKeyMethodModel, - DeleteKeyPairMethodModel, - DeleteMessageFilterMethodModel, - DeleteSymKeyMethodModel, - GenerateSymKeyFromPasswordMethodModel, - GetFilterMessagesMethodModel, - GetInfoMethodModel, - GetPrivateKeyMethodModel, - GetPublicKeyMethodModel, - GetSymKeyMethodModel, - HasKeyPairMethodModel, - HasSymKeyMethodModel, - MarkTrustedPeerMethodModel, - NewKeyPairMethodModel, - NewMessageFilterMethodModel, - NewSymKeyMethodModel, - PostMethodModel, - SetMaxMessageSizeMethodModel, - SetMinPoWMethodModel, - ShhVersionMethodModel +/** + * Returns the MethodController object + * + * @method MethodController + * + * @returns {MethodController} + */ +export const MethodController = () => { + return new MethodPackageFactory().createMethodController( + PromiEventPackage, + new SubscriptionsFactory(), + formatters + ); }; + +export AbstractMethodModelFactory from '../lib/factories/AbstractMethodModelFactory'; + +// Network +export GetProtocolVersionMethodModel from './models/methods/network/GetProtocolVersionMethodModel'; +export VersionMethodModel from './models/methods/network/VersionMethodModel'; +export ListeningMethodModel from './models/methods/network/ListeningMethodModel'; +export PeerCountMethodModel from './models/methods/network/PeerCountMethodModel'; + +// Node +export GetNodeInfoMethodModel from './models/methods/node/GetNodeInfoMethodModel'; +export GetCoinbaseMethodModel from './models/methods/node/GetCoinbaseMethodModel'; +export IsMiningMethodModel from './models/methods/node/IsMiningMethodModel'; +export GetHashrateMethodModel from './models/methods/node/GetHashrateMethodModel'; +export IsSyncingMethodModel from './models/methods/node/IsSyncingMethodModel'; +export GetGasPriceMethodModel from './models/methods/node/GetGasPriceMethodModel'; +export SubmitWorkMethodModel from './models/methods/node/SubmitWorkMethodModel'; +export GetWorkMethodModel from './models/methods/node/GetWorkMethodModel'; + +// Account +export GetAccountsMethodModel from './models/methods/account/GetAccountsMethodModel'; +export GetBalanceMethodModel from './models/methods/account/GetBalanceMethodModel'; +export GetTransactionCountMethodModel from './models/methods/account/GetTransactionCountMethodModel'; + +// Block +export GetBlockNumberMethodModel from './models/methods/block/GetBlockNumberMethodModel'; +export GetBlockMethodModel from './models/methods/block/GetBlockMethodModel'; +export GetUncleMethodModel from './models/methods/block/GetUncleMethodModel'; +export GetBlockTransactionCountMethodModel from './models/methods/block/GetBlockTransactionCountMethodModel'; +export GetBlockUncleCountMethodModel from './models/methods/block/GetBlockUncleCountMethodModel'; + +// Transaction +export GetTransactionMethodModel from './models/methods/transaction/GetTransactionMethodModel'; +export GetTransactionFromBlockMethodModel from './models/methods/transaction/GetTransactionFromBlockMethodModel'; +export GetTransactionReceipt from './models/methods/transaction/GetTransactionReceiptMethodModel'; +export SendSignedTransactionMethodModel from './models/methods/transaction/SendSignedTransactionMethodModel'; +export SignTransactionMethodModel from './models/methods/transaction/SignTransactionMethodModel'; +export SendTransactionMethodModel from './models/methods/transaction/SendTransactionMethodModel'; + +// Global +export GetCodeMethodModel from './models/methods/GetCodeMethodModel'; +export SignMethodModel from './models/methods/SignMethodModel'; +export CallMethodModel from './models/methods/CallMethodModel'; +export GetStorageAtMethodModel from './models/methods/GetStorageAtMethodModel'; +export EstimateGasMethodModel from './models/methods/EstimateGasMethodModel'; +export GetPastLogsMethodModel from './models/methods/GetPastLogsMethodModel'; + +// Personal +export EcRecoverMethodModel from './models/methods/personal/EcRecoverMethodModel'; +export ImportRawKeyMethodModel from './models/methods/personal/ImportRawKeyMethodModel'; +export ListAccountsMethodModel from './models/methods/personal/ListAccountsMethodModel'; +export LockAccountMethodModel from './models/methods/personal/LockAccountMethodModel'; +export NewAccountMethodModel from './models/methods/personal/NewAccountMethodModel'; +export PersonalSendTransactionMethodModel from './models/methods/personal/PersonalSendTransactionMethodModel'; +export PersonalSignMethodModel from './models/methods/personal/PersonalSignMethodModel'; +export PersonalSignTransactionMethodModel from './models/methods/personal/PersonalSignTransactionMethodModel'; +export UnlockAccountMethodModel from './models/methods/personal/UnlockAccountMethodModel'; + +// SHH +export AddPrivateKeyMethodModel from './models/methods/shh/AddPrivateKeyMethodModel'; +export AddSymKeyMethodModel from './models/methods/shh/AddSymKeyMethodModel'; +export DeleteKeyPairMethodModel from './models/methods/shh/DeleteKeyPairMethodModel'; +export DeleteMessageFilterMethodModel from './models/methods/shh/DeleteMessageFilterMethodModel'; +export DeleteSymKeyMethodModel from './models/methods/shh/DeleteSymKeyMethodModel'; +export GenerateSymKeyFromPasswordMethodModel from './models/methods/shh/GenerateSymKeyFromPasswordMethodModel'; +export GetFilterMessagesMethodModel from './models/methods/shh/GetFilterMessagesMethodModel'; +export GetInfoMethodModel from './models/methods/shh/GetInfoMethodModel'; +export GetPrivateKeyMethodModel from './models/methods/shh/GetPrivateKeyMethodModel'; +export GetPublicKeyMethodModel from './models/methods/shh/GetPublicKeyMethodModel'; +export GetSymKeyMethodModel from './models/methods/shh/GetSymKeyMethodModel'; +export HasKeyPairMethodModel from './models/methods/shh/HasKeyPairMethodModel'; +export HasSymKeyMethodModel from './models/methods/shh/HasSymKeyMethodModel'; +export MarkTrustedPeerMethodModel from './models/methods/shh/MarkTrustedPeerMethodModel'; +export NewKeyPairMethodModel from './models/methods/shh/NewKeyPairMethodModel'; +export NewMessageFilterMethodModel from './models/methods/shh/NewMessageFilterMethodModel'; +export NewSymKeyMethodModel from './models/methods/shh/NewSymKeyMethodModel'; +export PostMethodModel from './models/methods/shh/PostMethodModel'; +export SetMaxMessageSizeMethodModel from './models/methods/shh/SetMaxMessageSizeMethodModel'; +export SetMinPoWMethodModel from './models/methods/shh/SetMinPoWMethodModel'; +export ShhVersionMethodModel from './models/methods/shh/ShhVersionMethodModel'; diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index f14d61583a3..d6b7d032ec3 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -22,10 +22,4 @@ "use strict"; -import {version} from '../package.json'; -import PromiEvent from './PromiEvent'; - -export default { - version, - PromiEvent -}; +export PromiEvent from './PromiEvent'; diff --git a/packages/web3-core-subscriptions/src/index.js b/packages/web3-core-subscriptions/src/index.js index b1bd0b7ba66..31fe03cf010 100644 --- a/packages/web3-core-subscriptions/src/index.js +++ b/packages/web3-core-subscriptions/src/index.js @@ -22,26 +22,20 @@ "use strict"; -import {version} from '../package.json'; -import SubscriptionsFactory from './factories/SubscriptionsFactory'; -import LogSubscriptionModel from './models/subscriptions/eth/LogSubscriptionModel'; -import Subscription from './Subscription'; +import SubscriptionsFactoryObject from './factories/SubscriptionsFactory'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; -export default { - version, - Subscription, - LogSubscriptionModel, - - /** - * Returns an object of type SubscriptionsFactory - * - * @method SubscriptionsFactory - * - * @returns {SubscriptionsFactory} - */ - SubscriptionsFactory: () => { - return new SubscriptionsFactory(Utils, formatters); - } +/** + * Returns an object of type SubscriptionsFactory + * + * @method SubscriptionsFactory + * + * @returns {SubscriptionsFactory} + */ +export const SubscriptionsFactory = () => { + return new SubscriptionsFactoryObject(Utils, formatters); }; + +export LogSubscriptionModel from './models/subscriptions/eth/LogSubscriptionModel'; +export Subscription from './Subscription'; diff --git a/packages/web3-core/src/index.js b/packages/web3-core/src/index.js index 0b76915ece5..d7676e36bc7 100644 --- a/packages/web3-core/src/index.js +++ b/packages/web3-core/src/index.js @@ -22,10 +22,5 @@ "use strict"; -import {version} from '../package.json'; -import AbstractWeb3Module from './AbstractWeb3Module'; - -export default { - version, - AbstractWeb3Module -}; +export version from '../package.json'; +export AbstractWeb3Module from './AbstractWeb3Module'; diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index 55d9f6b99f1..258addd927b 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -22,21 +22,16 @@ 'use strict'; -import {version} from '../package.json'; -import ABICoder from './ABICoder'; import Utils from 'web3-utils'; +export ABICoderObject from './ABICoder'; -export default { - version, - - /** - * Returns the ABICoder object - * - * @method AbiCoder - * - * @returns {ABICoder} - */ - AbiCoder() { - return new ABICoder(Utils); - } +/** + * Returns an object of AbiCoder + * + * @returns {AbiCoder} + * + * @constructor + */ +export const AbiCoder = () => { + return new ABICoderObject(Utils); }; diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index dae34d75bc1..321f08a2fdb 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -22,34 +22,29 @@ "use strict"; -import {version} from '../package.json'; -import Accounts from './Accounts'; +import AccountsModule from './Accounts'; import {MethodController} from 'web3-core-method'; import ProvidersPackage from 'web3-providers'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; import MethodModelFactory from './factories/MethodModelFactory'; -export default { - version, - - /** - * Returns the Accounts object - * - * @method Accounts - * - * @params {AbstractProviderAdapter|EthereumProvider} provider - * - * @returns {Accounts} - */ - Accounts: (provider) => { - return new Accounts( - provider, - ProvidersPackage, - new MethodController(), - new MethodModelFactory(Utils, formatters), - Utils, - formatters - ); - } +/** + * Returns the Accounts object + * + * @method Accounts + * + * @params {AbstractProviderAdapter|EthereumProvider} provider + * + * @returns {Accounts} + */ +export const Accounts = (provider) => { + return new AccountsModule( + provider, + ProvidersPackage, + new MethodController(), + new MethodModelFactory(Utils, formatters), + Utils, + formatters + ); }; diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 30406d8d779..a0a35010879 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -260,7 +260,7 @@ export default class Contract extends AbstractWeb3Module { */ setProvider(provider, net) { return !!( - AbstractWeb3Module.prototype.setProvider.call(this, provider, net) && + super.setProvider(provider, net) && this.accounts.setProvider(provider, net) ); } diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index b90158b299d..a587155feae 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -22,48 +22,42 @@ "use strict"; -import {version} from '../package.json'; import PromiEventPackage from 'web3-core-promievent'; import {MethodController} from 'web3-core-method'; import ProvidersPackage from 'web3-providers'; import {formatters} from 'web3-core-helpers'; import Utils from 'web3-utils'; import {AbiCoder} from 'web3-eth-abi'; -import Contract from './Contract'; -import ContractDeployMethodModel from './models/methods/ContractDeployMethodModel'; import ContractPackageFactory from './factories/ContractPackageFactory'; -export default { - version, - ContractDeployMethodModel, - - /** - * Returns an object of type Contract - * - * @method Contract - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {Accounts} accounts - * @param {Object} abi - * @param {String} address - * @param {Object} options - * - * @returns {Contract} - */ - Contract: (provider, accounts, abi, address, options) => { - return new ContractPackageFactory( - Utils, - formatters, - new AbiCoder(), - accounts - ).createContract( - provider, - ProvidersPackage, - new MethodController(), - PromiEventPackage, - abi, - address, - options - ); - } +/** + * Returns an object of type Contract + * + * @method Contract + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {Accounts} accounts + * @param {Object} abi + * @param {String} address + * @param {Object} options + * + * @returns {Contract} + */ +export const Contract = (provider, accounts, abi, address, options) => { + return new ContractPackageFactory( + Utils, + formatters, + new AbiCoder(), + accounts + ).createContract( + provider, + ProvidersPackage, + new MethodController(), + PromiEventPackage, + abi, + address, + options + ); }; + +export ContractDeployMethodModel from './models/methods/ContractDeployMethodModel'; diff --git a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js index 5549d0fff64..e1135be0a72 100644 --- a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js @@ -48,10 +48,10 @@ export default class PastEventLogsMethodModel extends GetPastLogsMethodModel { * @returns {Array} */ afterExecution(response) { - const formattedLogs = GetPastLogsMethodModel.prototype.afterExecution.call(response), self = this; + const formattedLogs = super.afterExecution(response); formattedLogs.map(logItem => { - return self.eventLogDecoder.decode(self.abiItemModel, logItem); + return this.eventLogDecoder.decode(self.abiItemModel, logItem); }); return formattedLogs; diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index 6f49e1c80f1..66932d696ff 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -27,29 +27,26 @@ import REGISTRY_ABI from '../ressources/ABI/Registry'; import RESOLVER_ABI from '../ressources/ABI/Resolver'; import ENSPackageFactory from './factories/ENSPackageFactory'; -export default { // TODO: overthink the ens package architecture and refactor it. - version, - - /** - * Returns the ENS object - * - * @method ENS - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {Network} net - * @param {Accounts} accounts - * - * @returns {ENS} - */ - ENS(provider, net, accounts) { - return new ENSPackageFactory().createENS( - provider, - net, - accounts, - ContractPackage, - REGISTRY_ABI, - RESOLVER_ABI, - PromiEventPackage - ); - } +/** + * TODO: Overthink the module structure + * Returns the ENS object + * + * @method ENS + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {Network} net + * @param {Accounts} accounts + * + * @returns {ENS} + */ +export const ENS = (provider, net, accounts) => { + return new ENSPackageFactory().createENS( + provider, + net, + accounts, + ContractPackage, + REGISTRY_ABI, + RESOLVER_ABI, + PromiEventPackage + ); }; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 7c7c04490fe..d91a396f662 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -189,7 +189,7 @@ export default class Eth extends AbstractWeb3Module { }); return !!( - AbstractWeb3Module.setProvider.call(this, provider, net) && + super.setProvider(provider, net) && this.net.setProvider(provider, net) && this.personal.setProvider(provider, net) && this.accounts.setProvider(provider, net) && diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 7c7b0d96975..cb43f239f5f 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -22,9 +22,7 @@ "use strict"; -import {version} from '../package.json'; import MethodModelFactory from './factories/MethodModelFactory'; -import Eth from './Eth'; import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; import {Network} from 'web3-net'; @@ -38,36 +36,32 @@ import {AbiCoder} from 'web3-eth-abi'; import {Iban} from 'web3-eth-iban'; import ContractPackage from 'web3-eth-contract'; -export default { - version, - - /** - * Creates the Eth object - * - * @method Eth - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * - * @returns {Eth} - */ - Eth: (provider) => { - const accounts = new Accounts(provider); +/** + * Creates the Eth object + * + * @method Eth + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * + * @returns {Eth} + */ +export const Eth = (provider) => { + const accounts = new Accounts(provider); - return new Eth( - provider, - new Network(provider), - ContractPackage, - accounts, - new Personal(provider), - Iban, - new AbiCoder(utils), - new ENS(provider), - Utils, - formatters, - ProvidersPackage, - new SubscriptionsFactory(), - new MethodController(), - new MethodModelFactory(Utils, formatters, accounts) - ); - } + return new Eth( + provider, + new Network(provider), + ContractPackage, + accounts, + new Personal(provider), + Iban, + new AbiCoder(utils), + new ENS(provider), + Utils, + formatters, + ProvidersPackage, + new SubscriptionsFactory(), + new MethodController(), + new MethodModelFactory(Utils, formatters, accounts) + ); }; diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index af6a73b5bfc..45ee3a8356e 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -23,33 +23,29 @@ "use strict"; -import {version} from '../package.json'; import ProvidersPackage from 'web3-providers'; import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; import utils from 'web3-utils'; -import Network from './Network'; +import NetworkModule from './Network'; import MethodModelFactory from './factories/MethodModelFactory'; -export default { - version, - /** - * Creates the Network Object - * - * @method Network - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * - * @returns {Network} - */ - Network: (provider) => { - return new Network( - provider, - ProvidersPackage, - new MethodController(), - new MethodModelFactory(Utils, formatters), - formatters, - utils - ) - } +/** + * Creates the Network Object + * + * @method Network + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * + * @returns {Network} + */ +export const Network = (provider) => { + return new NetworkModule( + provider, + ProvidersPackage, + new MethodController(), + new MethodModelFactory(Utils, formatters), + formatters, + utils + ) }; diff --git a/packages/web3-providers/src/index.js b/packages/web3-providers/src/index.js index 20c86d63011..f2852e38c20 100644 --- a/packages/web3-providers/src/index.js +++ b/packages/web3-providers/src/index.js @@ -20,69 +20,56 @@ "use strict"; -import {version} from '../package.json'; import ProvidersPackageFactory from './factories/ProvidersPackageFactory'; -import SocketProviderAdapter from './adapters/SocketProviderAdapter'; -import HttpProviderAdapter from './adapters/HttpProviderAdapter'; -import HttpProvider from './providers/HttpProvider'; -import IpcProvider from './providers/IpcProvider'; -import WebsocketProvider from './providers/WebsocketProvider'; -import JSONRpcMapper from './mappers/JSONRpcMapper'; -import JSONRpcResponseValidator from './validators/JSONRpcResponseValidator'; -import BatchRequest from './batch-request/BatchRequest'; +import BatchRequestObject from './batch-request/BatchRequest'; +import JSONRpcMapper from './validators/JSONRpcResponseValidator'; -export default { - version, +export SocketProviderAdapter from './adapters/SocketProviderAdapter'; +export HttpProviderAdapter from './adapters/HttpProviderAdapter'; +export HttpProvider from './providers/HttpProvider'; +export IpcProvider from './providers/IpcProvider'; +export WebsocketProvider from './providers/WebsocketProvider'; +export JSONRpcMapper from './mappers/JSONRpcMapper'; +export JSONRpcResponseValidator from './validators/JSONRpcResponseValidator'; - SocketProviderAdapter, - HttpProviderAdapter, - - HttpProvider, - IpcProvider, - WebsocketProvider, - - JSONRpcMapper, - JSONRpcResponseValidator, - - /** - * Returns the Batch object - * - * @method BatchRequest - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * - * @returns {BatchRequest} - */ - BatchRequest: (provider) => { - return new BatchRequest( - provider, - JSONRpcMapper, - new ProvidersPackageFactory().createJSONRpcResponseValidator() - ); - }, +/** + * Returns the Batch object + * + * @method BatchRequest + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * + * @returns {BatchRequest} + */ +export const BatchRequest = (provider) => { + return new BatchRequestObject( + provider, + JSONRpcMapper, + new ProvidersPackageFactory().createJSONRpcResponseValidator() + ); +}; - /** - * Resolves the right provider adapter by the given parameters - * - * @method resolve - * - * @param {Object|String} provider - * @param {Net} net - * - * @returns {AbstractProviderAdapter} - */ - resolve: (provider, net) => { - return new ProvidersPackageFactory().createProviderAdapterResolver().resolve(provider, net); - }, +/** + * Resolves the right provider adapter by the given parameters + * + * @method resolve + * + * @param {Object|String} provider + * @param {Net} net + * + * @returns {AbstractProviderAdapter} + */ +export const resolve = (provider, net) => { + return new ProvidersPackageFactory().createProviderAdapterResolver().resolve(provider, net); +}; - /** - * Detects the given provider in the global scope - * - * @method detect - * - * @returns {Object} - */ - detect: () => { - return new ProvidersPackageFactory().createProviderDetector().detect(); - } +/** + * Detects the given provider in the global scope + * + * @method detect + * + * @returns {Object} + */ +export const detect = () => { + return new ProvidersPackageFactory().createProviderDetector().detect(); }; diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 59b6bab2392..2a3f02a8fbd 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -22,36 +22,31 @@ "use strict"; -import {version} from '../package.json'; import ProvidersPackage from 'web3-providers'; import {MethodController} from 'web3-core-method'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {Network} from 'web3-net'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; -import Shh from './Shh'; +import ShhModule from './Shh'; import MethodModelFactory from './factories/MethodModelFactory'; -export default { - version, - - /** - * Returns the Shh object. - * - * @method Shh - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * - * @returns {Shh} - */ - Shh: (provider) => { - return new Shh( - provider, - ProvidersPackage, - new MethodController(), - new MethodModelFactory(Utils, formatters), - new SubscriptionsFactory(), - new Network(provider) - ); - } +/** + * Returns the Shh object. + * + * @method Shh + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * + * @returns {Shh} + */ +export const Shh = (provider) => { + return new ShhModule( + provider, + ProvidersPackage, + new MethodController(), + new MethodModelFactory(Utils, formatters), + new SubscriptionsFactory(), + new Network(provider) + ); }; From 86d881a51cc9687dfadf6663214cad5d1c1910e0 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Wed, 17 Oct 2018 19:03:10 +0200 Subject: [PATCH 0288/1045] JSONRpcMapper ported to es6 --- .../src/mappers/JSONRpcMapper.js | 82 +++++++++---------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/packages/web3-providers/src/mappers/JSONRpcMapper.js b/packages/web3-providers/src/mappers/JSONRpcMapper.js index 3b657218e61..cefe652b05f 100644 --- a/packages/web3-providers/src/mappers/JSONRpcMapper.js +++ b/packages/web3-providers/src/mappers/JSONRpcMapper.js @@ -22,53 +22,51 @@ "use strict"; -/** - * @constructor - */ -const JSONRpcMapper = { //TODO: Find a better solution to handle this property as "singleton" globally over the web3 lib +const JSONRpcMapper = { messageId: 0 }; -/** - * Creates a valid json payload object - * - * @method toPayload - * - * @param {String} method of jsonrpc call, required - * @param {Array} params, an Array of method params, optional - * - * @returns {Object} valid jsonrpc payload object - */ -JSONRpcMapper.toPayload = (method, params) => { - if (!method) { - throw new Error(`JSONRPC method should be specified for params: "${JSON.stringify(params)}"!`); - } +export default class JSONRpcMapper { - JSONRpcMapper.messageId++; + /** + * Creates a valid json payload object + * + * @method toPayload + * + * @param {String} method of jsonrpc call, required + * @param {Array} params, an Array of method params, optional + * + * @returns {Object} valid jsonrpc payload object + */ + static toPayload(method, params) { + if (!method) { + throw new Error(`JSONRPC method should be specified for params: "${JSON.stringify(params)}"!`); + } - return { - jsonrpc: '2.0', - id: JSONRpcMapper.messageId, - method, - params: params || [] - }; -}; + JSONRpcMapper.messageId++; -/** - * Creates a batch payload object - * - * @method toBatchPayload - * - * @param {Array} requests, an array of objects with method (required) and params (optional) fields - * - * @returns {Array} batch payload - */ -JSONRpcMapper.toBatchPayload = requests => { - return requests.map(request => { - request.beforeExecution(); + return { + jsonrpc: '2.0', + id: JSONRpcMapper.messageId, + method, + params: params || [] + }; + }; - return JSONRpcMapper.toPayload(request.rpcMethod, request.parameters); - }); -}; + /** + * Creates a batch payload object + * + * @method toBatchPayload + * + * @param {Array} requests, an array of objects with method (required) and params (optional) fields + * + * @returns {Array} batch payload + */ + static toBatchPayload(requests) { + return requests.map(request => { + request.beforeExecution(); -export default JSONRpcMapper; + return JSONRpcMapper.toPayload(request.rpcMethod, request.parameters); + }); + }; +} From cc04cb4b9f40db60209685c7a51b2c37ffc63e70 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 18 Oct 2018 12:26:16 +0200 Subject: [PATCH 0289/1045] readme's updated, Object.defineProperty ported to es6 accessors, imports and exports checked, codestyle improvements --- packages/web3-bzz/src/Bzz.js | 2 - packages/web3-bzz/src/index.js | 1 - packages/web3-core-helpers/src/errors.js | 2 - packages/web3-core-helpers/src/formatters.js | 5 +- packages/web3-core-helpers/src/index.js | 2 - packages/web3-core-method/README.md | 109 ++++++++-------- .../factories/AbstractMethodModelFactory.js | 2 - .../lib/models/AbstractMethodModel.js | 2 - .../lib/signers/AbstractSigner.js | 2 - .../src/commands/CallMethodCommand.js | 6 +- .../src/commands/SendMethodCommand.js | 13 +- .../src/commands/SignAndSendMethodCommand.js | 2 - .../src/commands/SignMessageCommand.js | 2 - .../src/controllers/MethodController.js | 2 - .../src/factories/MethodPackageFactory.js | 2 - packages/web3-core-method/src/index.js | 5 +- .../models/TransactionConfirmationModel.js | 76 ++++-------- .../src/models/methods/CallMethodModel.js | 2 - .../models/methods/EstimateGasMethodModel.js | 2 - .../src/models/methods/GetCodeMethodModel.js | 2 - .../models/methods/GetPastLogsMethodModel.js | 2 - .../models/methods/GetStorageAtMethodModel.js | 2 - .../src/models/methods/SignMethodModel.js | 2 - .../methods/account/GetAccountsMethodModel.js | 2 - .../methods/account/GetBalanceMethodModel.js | 2 - .../account/GetTransactionCountMethodModel.js | 2 - .../methods/block/GetBlockMethodModel.js | 2 - .../block/GetBlockNumberMethodModel.js | 2 - .../GetBlockTransactionCountMethodModel.js | 2 - .../block/GetBlockUncleCountMethodModel.js | 2 - .../methods/block/GetUncleMethodModel.js | 2 - .../network/GetProtocolVersionMethodModel.js | 2 - .../methods/network/ListeningMethodModel.js | 2 - .../methods/network/PeerCountMethodModel.js | 2 - .../methods/network/VersionMethodModel.js | 2 - .../methods/node/GetCoinbaseMethodModel.js | 2 - .../methods/node/GetGasPriceMethodModel.js | 2 - .../methods/node/GetHashrateMethodModel.js | 2 - .../methods/node/GetNodeInfoMethodModel.js | 2 - .../models/methods/node/GetWorkMethodModel.js | 2 - .../methods/node/IsMiningMethodModel.js | 2 - .../methods/node/IsSyncingMethodModel.js | 2 - .../methods/node/SubmitWorkMethodModel.js | 2 - .../methods/personal/EcRecoverMethodModel.js | 2 - .../personal/ImportRawKeyMethodModel.js | 2 - .../personal/ListAccountsMethodModel.js | 2 - .../personal/LockAccountMethodModel.js | 2 - .../methods/personal/NewAccountMethodModel.js | 2 - .../PersonalSendTransactionMethodModel.js | 2 - .../personal/PersonalSignMethodModel.js | 2 - .../PersonalSignTransactionMethodModel.js | 2 - .../personal/UnlockAccountMethodModel.js | 2 - .../methods/shh/AddPrivateKeyMethodModel.js | 2 - .../methods/shh/AddSymKeyMethodModel.js | 2 - .../methods/shh/DeleteKeyPairMethodModel.js | 2 - .../shh/DeleteMessageFilterMethodModel.js | 2 - .../methods/shh/DeleteSymKeyMethodModel.js | 2 - .../GenerateSymKeyFromPasswordMethodModel.js | 2 - .../shh/GetFilterMessagesMethodModel.js | 2 - .../models/methods/shh/GetInfoMethodModel.js | 2 - .../methods/shh/GetPrivateKeyMethodModel.js | 2 - .../methods/shh/GetPublicKeyMethodModel.js | 2 - .../methods/shh/GetSymKeyMethodModel.js | 2 - .../methods/shh/HasKeyPairMethodModel.js | 2 - .../methods/shh/HasSymKeyMethodModel.js | 2 - .../methods/shh/MarkTrustedPeerMethodModel.js | 2 - .../methods/shh/NewKeyPairMethodModel.js | 2 - .../shh/NewMessageFilterMethodModel.js | 2 - .../methods/shh/NewSymKeyMethodModel.js | 2 - .../src/models/methods/shh/PostMethodModel.js | 2 - .../shh/SetMaxMessageSizeMethodModel.js | 2 - .../methods/shh/SetMinPoWMethodModel.js | 2 - .../methods/shh/ShhVersionMethodModel.js | 2 - .../GetTransactionFromBlockMethodModel.js | 2 - .../transaction/GetTransactionMethodModel.js | 2 - .../GetTransactionReceiptMethodModel.js | 2 - .../SendSignedTransactionMethodModel.js | 2 - .../transaction/SendTransactionMethodModel.js | 2 - .../transaction/SignTransactionMethodModel.js | 2 - .../src/signers/MessageSigner.js | 2 - .../src/signers/TransactionSigner.js | 2 - .../validators/TransactionReceiptValidator.js | 2 - .../TransactionConfirmationWorkflow.js | 2 - packages/web3-core-promievent/README.md | 5 +- .../web3-core-promievent/src/PromiEvent.js | 2 - packages/web3-core-promievent/src/index.js | 24 ++-- packages/web3-core-subscriptions/README.md | 96 +++++++------- .../lib/models/AbstractSubscriptionModel.js | 2 - .../src/Subscription.js | 2 - .../src/factories/SubscriptionsFactory.js | 2 - packages/web3-core-subscriptions/src/index.js | 2 - .../subscriptions/eth/LogSubscriptionModel.js | 2 - .../eth/NewHeadsSubscriptionModel.js | 2 - ...NewPendingTransactionsSubscriptionModel.js | 2 - .../eth/SyncingSubscriptionModel.js | 2 - .../shh/MessagesSubscriptionModel.js | 2 - packages/web3-core/README.md | 75 ++++++----- packages/web3-core/src/AbstractWeb3Module.js | 24 ++-- packages/web3-core/src/index.js | 25 ++-- packages/web3-eth-abi/README.md | 4 +- packages/web3-eth-abi/src/index.js | 6 +- packages/web3-eth-accounts/README.md | 9 +- packages/web3-eth-accounts/src/Accounts.js | 2 - .../src/factories/MethodModelFactory.js | 4 +- packages/web3-eth-accounts/src/index.js | 4 +- packages/web3-eth-contract/README.md | 11 +- packages/web3-eth-contract/src/Contract.js | 117 ++++++++++-------- .../src/decoders/AllEventsLogDecoder.js | 2 - .../src/decoders/CallMethodResponseDecoder.js | 2 - .../src/decoders/EventLogDecoder.js | 2 - .../src/encoders/AllEventsFilterEncoder.js | 2 - .../src/encoders/EventFilterEncoder.js | 2 - .../src/encoders/MethodEncoder.js | 2 - .../src/factories/ContractPackageFactory.js | 2 - .../src/factories/EventSubscriptionFactory.js | 2 - .../src/factories/RpcMethodModelFactory.js | 2 - packages/web3-eth-contract/src/index.js | 16 ++- .../src/mappers/ABIMapper.js | 2 - .../src/mappers/AllEventsOptionsMapper.js | 2 - .../src/mappers/EventOptionsMapper.js | 2 - .../src/mappers/RpcMethodOptionsMapper.js | 2 - .../src/models/abi/ABIItemModel.js | 2 - .../src/models/abi/ABIModel.js | 2 - .../models/methods/CallContractMethodModel.js | 2 - .../methods/ContractDeployMethodModel.js | 2 - .../methods/PastEventLogsMethodModel.js | 2 - .../models/methods/SendContractMethodModel.js | 2 - .../subscriptions/AllEventsLogSubscription.js | 2 - .../subscriptions/EventLogSubscription.js | 2 - .../src/proxies/EventSubscriptionsProxy.js | 2 - .../src/proxies/MethodsProxy.js | 2 - .../validators/RpcMethodOptionsValidator.js | 2 - packages/web3-eth-ens/src/ENS.js | 3 - .../web3-eth-ens/src/contracts/Registry.js | 2 - .../src/factories/ENSPackageFactory.js | 3 +- .../src/handlers/ResolverMethodHandler.js | 3 - packages/web3-eth-ens/src/index.js | 8 +- packages/web3-eth-iban/README.md | 4 +- packages/web3-eth-iban/src/index.js | 10 +- packages/web3-eth-personal/README.md | 7 +- packages/web3-eth-personal/src/Personal.js | 65 ++++++---- .../src/factories/MethodModelFactory.js | 4 +- packages/web3-eth-personal/src/index.js | 49 ++++---- packages/web3-eth/README.md | 9 +- packages/web3-eth/src/Eth.js | 89 +++++++------ .../src/factories/MethodModelFactory.js | 2 - packages/web3-eth/src/index.js | 9 +- packages/web3-net/README.md | 7 +- packages/web3-net/src/Network.js | 2 - .../src/factories/MethodModelFactory.js | 4 +- packages/web3-net/src/index.js | 4 +- .../lib/adapters/AbstractProviderAdapter.js | 2 - .../src/adapters/HttpProviderAdapter.js | 2 - .../src/adapters/InpageProviderAdapter.js | 2 - .../src/adapters/SocketProviderAdapter.js | 2 - .../src/batch-request/BatchRequest.js | 2 - .../src/factories/ProvidersPackageFactory.js | 1 - packages/web3-providers/src/index.js | 2 - .../src/mappers/JSONRpcMapper.js | 2 - .../src/providers/HttpProvider.js | 1 - .../src/providers/IpcProvider.js | 2 - .../src/providers/WebsocketProvider.js | 8 +- .../src/resolvers/ProviderAdapterResolver.js | 2 - .../validators/JSONRpcResponseValidator.js | 2 - packages/web3-shh/README.md | 7 +- packages/web3-shh/src/Shh.js | 2 - .../src/factories/MethodModelFactory.js | 4 +- packages/web3-shh/src/index.js | 4 +- packages/web3-utils/README.md | 6 +- packages/web3-utils/src/index.js | 6 - packages/web3/src/index.js | 6 +- 171 files changed, 445 insertions(+), 761 deletions(-) diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index 41b45245e45..88c2c548ecf 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -20,8 +20,6 @@ * @date 2017 */ -"use strict"; - import _ from 'underscore'; import swarm from "swarm-js"; diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index 25fde578d6a..255c5163d16 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -20,6 +20,5 @@ * @date 2018 */ -"use strict"; export Bzz from './Bzz'; export version from '../package.json'; diff --git a/packages/web3-core-helpers/src/errors.js b/packages/web3-core-helpers/src/errors.js index ef6779d5e64..81614b383e3 100644 --- a/packages/web3-core-helpers/src/errors.js +++ b/packages/web3-core-helpers/src/errors.js @@ -21,8 +21,6 @@ * @date 2017 */ -"use strict"; - export default { ErrorResponse(result) { const message = !!result && !!result.error && !!result.error.message ? result.error.message : JSON.stringify(result); diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index de12ef0d677..bf08788af93 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -21,12 +21,9 @@ * @date 2017 */ -"use strict"; - - import _ from 'underscore'; import utils from 'web3-utils'; -import Iban from 'web3-eth-iban'; +import {Iban} from 'web3-eth-iban'; /** * Should the format output to a big number diff --git a/packages/web3-core-helpers/src/index.js b/packages/web3-core-helpers/src/index.js index 64efadc2e8c..95a3a82a63e 100644 --- a/packages/web3-core-helpers/src/index.js +++ b/packages/web3-core-helpers/src/index.js @@ -20,7 +20,5 @@ * @date 2017 */ -"use strict"; - export errors from './errors'; export formatters from './formatters'; diff --git a/packages/web3-core-method/README.md b/packages/web3-core-method/README.md index c0218113234..96170d17191 100644 --- a/packages/web3-core-method/README.md +++ b/packages/web3-core-method/README.md @@ -2,8 +2,20 @@ This is a sub package of [web3.js][repo] -The Method package used within most [web3.js][repo] packages. -Please read the [documentation][docs] for more. +The Method module abstracts the JSON-RPC method and is used within most [web3.js][repo] packages. + + +##### MethodController +> Excecutes the JSON-RPC method with an ```MethodModel``` + +##### execute + ```js + execute( + methodModel: AbstractMethodModel, + accounts: Accounts, + moduleInstance: AbstractWeb3Module + ): {Promise|PromiEvent|String} + ``` ## Installation @@ -31,71 +43,60 @@ This will expose the `Web3Method` object on the window object. // in node.js // Dependencies -var AbstractWeb3Module = require('web3-package').AbstractWeb3Module; -var Utils = require('web3-utils'); -var formatters = require('web3-core-helpers').formatters; -var MethodPackage = require('web3-core-method'); -var ProvidersPackage = require('web3-providers'); +import {AbstractWeb3Module} from 'web3-package'; +import Utils from 'web3-utils'; +import {formatters} from 'web3-core-helpers'; +import {MethodController} from 'web3-core-method'; +import * as ProvidersPackage from 'web3-providers'; // Create an object/package like Eth -/** - * @param {Object|String} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {AbstractMethodModelFactory} methodModelFactory - * - * @constructor - */ -function Module ( - provider, - providersPackage, - methodController, - methodModelFactory -) { - AbstractWeb3Module.call( - this, +class Module extends AbstractWeb3Module { + + /** + * @param {Object|String} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {AbstractMethodModelFactory} methodModelFactory + * + * @constructor + */ + constructor ( provider, providersPackage, methodController, methodModelFactory - ); -}; - -// Inherit from AbstractWeb3Module -Module.prototype = Object.create(AbstractWeb3Module.prototype); -Module.prototype.constructor = Module; - + ) { + super( + provider, + providersPackage, + methodController, + methodModelFactory + ); + } +} // Create the MyMethoModelFactory object -/** - * @param {Object} utils - * @param {Object} formatters - * - * @constructor - */ -function MethodModelFactory(utils, formatters) { - MethodPackage.AbstractMethodModelFactory.call( - this, - { - sendTransaction: MethodPackage.SendTransactionMethodModel - }, - utils, - formatters - ); +class MethodModelFactory extends AbstractMethodModelFactory { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor (utils, formatters) { + super({sendTransaction: MethodPackage.SendTransactionMethodModel}, + utils, + formatters + ); + } } -// Inherit from AbstractMethodModelFactory -MethodModelFactory.prototype = Object.create( - MethodPackage.AbstractMethodModelFactory.prototype -); -MethodModelFactory.prototype.constructor = MethodModelFactory; - - // Instantiate anything -var module = new Module( +const module = new Module( ProvidersPackage.detect(), ProvidersPackage, - new MethodPackage.MethodController(), + new MethodController(), new MethodModelFactory(Utils, formatters) ); diff --git a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js index da50f40faea..d606f7a0481 100644 --- a/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js +++ b/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class AbstractMethodModelFactory { /** * @param {Object} methodModels diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index cf2ffbe8883..88ee85d3809 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; export default class AbstractMethodModel { diff --git a/packages/web3-core-method/lib/signers/AbstractSigner.js b/packages/web3-core-method/lib/signers/AbstractSigner.js index dba26dcefb2..a70d2c13d91 100644 --- a/packages/web3-core-method/lib/signers/AbstractSigner.js +++ b/packages/web3-core-method/lib/signers/AbstractSigner.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; export default class AbstractSigner { diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 7a464ec42a7..11bbf3b785e 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -20,12 +20,8 @@ * @date 2018 */ -"use strict"; - -/** - * @constructor - */ export default class CallMethodCommand { + /** * Sends a JSON-RPC call request * diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index afc3b0fb524..5836dd6a25e 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -20,17 +20,16 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; import AbstractSendMethodCommand from '../../lib/commands/AbstractSendMethodCommand'; -/** - * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow - * - * @constructor - */ export default class SendMethodCommand extends AbstractSendMethodCommand { + + /** + * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow + * + * @constructor + */ constructor(transactionConfirmationWorkflow) { super(transactionConfirmationWorkflow); } diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index 98263f565c8..0499758b506 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import SendMethodCommand from './SendMethodCommand'; export default class SignAndSendMethodCommand extends SendMethodCommand { diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js index 82bc4bebac9..37038e5dc19 100644 --- a/packages/web3-core-method/src/commands/SignMessageCommand.js +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class SignMessageCommand { /** diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index cfc16d79e78..abbe77ccf00 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class MethodController { /** diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodPackageFactory.js index 5d6839ca85f..3657a2ba557 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodPackageFactory.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import TransactionConfirmationWorkflow from '../workflows/TransactionConfirmationWorkflow'; import TransactionSigner from '../signers/TransactionSigner'; import MessageSigner from '../signers/MessageSigner'; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 6041e9bd79e..ab5ebd25240 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -21,11 +21,8 @@ * @date 2018 */ -"use strict"; - -import {version} from '../package.json'; import MethodPackageFactory from './factories/MethodPackageFactory'; -import PromiEventPackage from 'web3-core-promievent'; +import * as PromiEventPackage from 'web3-core-promievent'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {formatters} from 'web3-core-helpers'; diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index 62d268f4a70..6a2682186d0 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -28,56 +28,34 @@ export default class TransactionConfirmationModel { constructor() { this.confirmations = []; this.timeoutCounter = 0; + this._pollingTimeout = 15; + this.timeoutBlock = 50; + this.confirmationBlocks = 24; + } - /** - * Defines accessors for POLLINGTIMEOUT. This is the average block time (seconds) * TIMEOUTBLOCK - */ - Object.defineProperty(this, 'POLLINGTIMEOUT', { - get() { - return 15 * this.TIMEOUTBLOCK; - }, - set() { - }, - enumerable: true - }); - - /** - * Defines accessors for TIMEOUTBLOCK - */ - Object.defineProperty(this, 'TIMEOUTBLOCK', { - get() { - return 50; - }, - set() { - }, - enumerable: true - }); - - /** - * Defines accessors for CONFIRMATIONBLOCKS - */ - Object.defineProperty(this, 'CONFIRMATIONBLOCKS', { - get() { - return 24; - }, - set() { - }, - enumerable: true - }); + /** + * Getter for pollingTimeout + * + * @property pollingTimeout + * + * @returns {Number} + */ + get pollingTimeout() { + return this._pollingTimeout * this.timeoutBlock; + } - /** - * Defines accessors for confirmationsCount - */ - Object.defineProperty(this, 'confirmationsCount', { - get() { - return this.confirmations.length; - }, - set() { - }, - enumerable: true - }); + /** + * Setter for pollingTimeout + * + * @property pollingTimeout + * + * @param {Number} value + */ + set pollingTimeout(value) { + this._pollingTimeout = value; } + /** * Adds a receipt to the confirmation array * @@ -97,7 +75,7 @@ export default class TransactionConfirmationModel { * @returns {Boolean} */ isConfirmed() { - return this.confirmationsCount === (this.CONFIRMATIONBLOCKS + 1); + return this.confirmations.length === (this.confirmationBlocks + 1); } /** @@ -109,9 +87,9 @@ export default class TransactionConfirmationModel { */ isTimeoutTimeExceeded(watcherIsPolling) { if (watcherIsPolling) { - return (this.timeoutCounter - 1) >= this.POLLINGTIMEOUT; + return (this.timeoutCounter - 1) >= this.pollingTimeout; } - return (this.timeoutCounter - 1) >= this.TIMEOUTBLOCK; + return (this.timeoutCounter - 1) >= this.timeoutBlock; } } diff --git a/packages/web3-core-method/src/models/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js index 7068597d65f..866bf4f1361 100644 --- a/packages/web3-core-method/src/models/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class CallMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index e95273463ef..46e8ae52bb6 100644 --- a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class EstimateGasMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index c028dc9d2f1..baa838cc547 100644 --- a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class GetCodeMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index 0267e08ce15..755d6ad02d8 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class GetPastLogsMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index 137142e4742..a912a9aa6ce 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class GetStorageAtMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js index c4531308df2..3720b8502bf 100644 --- a/packages/web3-core-method/src/models/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class SignMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js index 55498abc4d7..c3722ec0766 100644 --- a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetAccountsMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index e3fdecb122a..7cfa8d9872c 100644 --- a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetBalanceMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index 62d128e4121..e5e8fa9b635 100644 --- a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetTransactionCountMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index 483141e7e14..0aa46099900 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetBlockMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js index 82a2ebb3772..b7c5be11189 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetBlockNumberMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index aeec8a96a51..2b70888cc6a 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetBlockTransactionCountMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index 5597c9b9d4f..d7afa3bc831 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetBlockUncleCountMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index ba7c1a29636..138614e3bcd 100644 --- a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetUncleMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js index e80db337afe..afeba51818d 100644 --- a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetProtocolVersionMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js index f61707ed2a1..c915e19012a 100644 --- a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class ListeningMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js index f7d83f3a614..3ddec653a58 100644 --- a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PeerCountMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js index 27ab9bd08b7..569dae85d6a 100644 --- a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class VersionMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js index dc181007e0b..cdaa133a824 100644 --- a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetCoinbaseMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js index 42c59eccdd2..1d2a0170fc8 100644 --- a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetGasPriceMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js index b75219a79f0..fcea838d0df 100644 --- a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetHashrateMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js index b84c257c030..16fd0c25698 100644 --- a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetNodeInfoMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js index 25e379b64d1..396062efe4c 100644 --- a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetWorkMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js index 3396a1f9d6c..6cfe417b675 100644 --- a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class IsMiningMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js index 36eef20310d..287e2426f2d 100644 --- a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class IsSyncingMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js index e593a8086c7..3d293bb53dd 100644 --- a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SubmitWorkMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index e6d5e05ebf6..eac83bf549f 100644 --- a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class EcRecoverMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js index e60056a64c8..40c8d3f83a3 100644 --- a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class ImportRawKeyMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js index 309eee64cfb..3f98cec853e 100644 --- a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class ListAccountsMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index a8e63addf86..40e26c83256 100644 --- a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class LockAccountMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js index 33a0e06fe36..64a31f5485b 100644 --- a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class NewAccountMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index 359674d5cea..c711afec5cf 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PersonalSendTransactionMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index 1589f563d97..79ace524d96 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PersonalSignMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js index d399e17b77f..2701ae55f11 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PersonalSignTransactionMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index 24072b7d991..52f4296971e 100644 --- a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class UnlockAccountMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js index b4e0da819c5..ac267d69edd 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class AddPrivateKeyMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js index af50d0e8c9b..f7ff8a93f06 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class AddSymKeyMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js index 1c60ecb206e..b6ff9ff954d 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class DeleteKeyPairMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js index d1f930ac436..da1fa98369f 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class DeleteMessageFilterMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js index cbe4e97998e..dca2a1be879 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class DeleteSymKeyMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js index d427d9b8f30..ec442ea9517 100644 --- a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GenerateSymKeyFromPasswordMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js index 16cfe860ad0..14158cc8ace 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetFilterMessagesMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js index b7cca48c1a7..eab65d12638 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetInfoMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js index 83f7e0a9229..7eac0ba6eb0 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetPrivateKeyMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js index 5b44d13c2b7..7f764c70eec 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetPublicKeyMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js index 838d27855a5..3a468c05347 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetSymKeyMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js index 5cd4f96eb91..e687d950c16 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class HasKeyPairMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js index 94c574013d0..b3da87ae507 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class HasSymKeyMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js index f9a921ec75d..9628ef41915 100644 --- a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class MarkTrustedPeerMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js index c363b291480..440b593872c 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class NewKeyPairMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js index f94b6f1d478..7071ec91bb1 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class NewMessageFilterMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js index 2a0f9015710..29dca9202d7 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class NewSymKeyMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js index 5e84101a746..67664c7c5d6 100644 --- a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PostMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js index 0a274b3de54..d53c9d26216 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SetMaxMessageSizeMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js index a58648373aa..3be3f811259 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SetMinPoWMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js index 9e42ee9c365..992549fcde0 100644 --- a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class ShhVersionMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index 2b9e9083f8b..3ae6755d439 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetTransactionFromBlockMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js index 6033668cd97..84015afc28e 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetTransactionMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js index 37283d65e2a..64a41499440 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetTransactionReceiptMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js index d11b7f8de8e..b0be10cc4d6 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SendSignedTransactionMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index 611eafadbdf..eccac3ba05e 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SendTransactionMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index 409b402bbef..e5741858467 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SignTransactionMethodModel extends AbstractMethodModel { diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index 0004c5b64b3..ab797573520 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractSigner from '../../lib/signers/AbstractSigner'; export default class MessageSigner extends AbstractSigner { diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index 2880604ee3a..be7505e2886 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractSigner from '../../lib/signers/AbstractSigner'; export default class TransactionSigner extends AbstractSigner { diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index 690aecafabb..901c96eb9af 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; export default class TransactionReceiptValidator { diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index e41efc56f4c..9332618a234 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {ContractDeployMethodModel} from 'web3-eth-contract'; export default class TransactionConfirmationWorkflow { diff --git a/packages/web3-core-promievent/README.md b/packages/web3-core-promievent/README.md index 48a269d65db..992b8f41b03 100644 --- a/packages/web3-core-promievent/README.md +++ b/packages/web3-core-promievent/README.md @@ -28,10 +28,9 @@ This will expose the `Web3PromiEvent` object on the window object. ## Usage ```js -// in node.js -var PromiEvent = require('web3-core-promievent').PromiEvent; +import PromiEvent from 'web3-core-promievent'; -var myFunc = function(){ +const myFunc = function(){ var promiEvent = new PromiEvent(); setTimeout(function() { diff --git a/packages/web3-core-promievent/src/PromiEvent.js b/packages/web3-core-promievent/src/PromiEvent.js index 79eed5a2ac6..c3e804b7569 100644 --- a/packages/web3-core-promievent/src/PromiEvent.js +++ b/packages/web3-core-promievent/src/PromiEvent.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import EventEmitter from 'eventemitter3'; export default class PromiEvent { diff --git a/packages/web3-core-promievent/src/index.js b/packages/web3-core-promievent/src/index.js index d6b7d032ec3..5ad6d4e11b1 100644 --- a/packages/web3-core-promievent/src/index.js +++ b/packages/web3-core-promievent/src/index.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file index.js @@ -20,6 +20,4 @@ * @date 2018 */ -"use strict"; - export PromiEvent from './PromiEvent'; diff --git a/packages/web3-core-subscriptions/README.md b/packages/web3-core-subscriptions/README.md index e397ab60099..5ed3278cbd6 100644 --- a/packages/web3-core-subscriptions/README.md +++ b/packages/web3-core-subscriptions/README.md @@ -29,64 +29,58 @@ This will expose the `Web3Subscriptions` object on the window object. // in node.js // Dependencies -var ProvidersPackage = require('web3-providers'); -var AbstractWeb3Module = require('web3-package').AbstractWeb3Module; -var SubscriptionsFactory = require('web3-core-subscriptions').SubscriptionsFactory; +import * as ProvidersPackage from 'web3-providers'; +import AbstractWeb3Module from 'web3-package'; +import SubscriptionsFactory from 'web3-core-subscriptions'; // Create an object of type AbstractWeb3Module -/** - * @param {Object|String} provider - * @param {ProvidersPackage} providersPackage - * @param {SubscriptionsFactory} subscriptionsFactory - * - * @constructor - */ -function Module ( - provider, - providersPackage, - subscriptionsFactory -) { - AbstractWeb3Module.call( - this, +class Module extends AbstractWeb3Module{ + + /** + * @param {Object|String} provider + * @param {ProvidersPackage} providersPackage + * @param {SubscriptionsFactory} subscriptionsFactory + * + * @constructor + */ + constructor ( provider, - providersPackage - ); + providersPackage, + subscriptionsFactory + ) { + super(provider, providersPackage); + this.subscriptionsFactory = subscriptionsFactory; + } - this.subscriptionsFactory = subscriptionsFactory; + /** + * Returns expected subscription + * + * @method subscribe + * + * @param {String} subscriptionMethod + * @param {Method} callback + * + * @callback callback callback(error, result) + * @returns {Subscription} + */ + subscribe (subscriptionMethod, callback) { + switch (subscriptionMethod) { + case 'newBlockHeaders': + return this.subscriptionsFactory + .createNewHeadsSubscription(this) + .subscribe(callback); + case 'pendingTransactions': + return this.subscriptionsFactory + .createNewPendingTransactionsSubscription(this) + .subscribe(callback); + default: + throw Error('Unsupported subscription: ' + subscriptionMethod); + } + }; } -/** - * Returns expected subscription - * - * @method subscribe - * - * @param {String} subscriptionMethod - * @param {Method} callback - * - * @callback callback callback(error, result) - * @returns {Subscription} - */ -Module.prototype.subscribe = function (subscriptionMethod, callback) { - switch (subscriptionMethod) { - case 'newBlockHeaders': - return this.subscriptionsFactory - .createNewHeadsSubscription(this) - .subscribe(callback); - case 'pendingTransactions': - return this.subscriptionsFactory - .createNewPendingTransactionsSubscription(this) - .subscribe(callback); - default: - throw Error('Unsupported subscription: ' + subscriptionMethod); - } -}; - -// Inherit from AbstractWeb3Module -Module.prototype = Object.create(AbstractWeb3Module.prototype); -Module.prototype.constructor = Module; - // Instantiate anything -var module = new Module( +const module = new Module( ProvidersPackage.detect(), ProvidersPackage, new SubscriptionsFactory() diff --git a/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js index 636582c0835..ae62c7f03d5 100644 --- a/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js +++ b/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class AbstractSubscriptionModel { /** diff --git a/packages/web3-core-subscriptions/src/Subscription.js b/packages/web3-core-subscriptions/src/Subscription.js index 38553cd67c2..42593b2fc69 100644 --- a/packages/web3-core-subscriptions/src/Subscription.js +++ b/packages/web3-core-subscriptions/src/Subscription.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; import EventEmitter from 'eventemitter3'; diff --git a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js index 77ba6ab14a4..e4a0914a87c 100644 --- a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js +++ b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import Subscription from '../Subscription'; import LogSubscriptionModel from '../models/subscriptions/eth/LogSubscriptionModel'; import NewHeadsSubscriptionModel from '../models/subscriptions/eth/NewHeadsSubscriptionModel'; diff --git a/packages/web3-core-subscriptions/src/index.js b/packages/web3-core-subscriptions/src/index.js index 31fe03cf010..796c753f747 100644 --- a/packages/web3-core-subscriptions/src/index.js +++ b/packages/web3-core-subscriptions/src/index.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import SubscriptionsFactoryObject from './factories/SubscriptionsFactory'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js index 33f74161f68..dc19a75d76c 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class LogSubscriptionModel extends AbstractSubscriptionModel { diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js index e1a17b11cca..b191b422e68 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class NewHeadsSubscriptionModel extends AbstractSubscriptionModel { diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js index a582dbb547a..bbccf8b3e6d 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class NewPendingTransactionsSubscriptionModel extends AbstractSubscriptionModel { diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js index e5f7c6c2f84..7eb1dbb24d7 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class SyncingSubscriptionModel extends AbstractSubscriptionModel { diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js index 356e74dd666..7102cb56bf7 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class MessagesSubscriptionModel extends AbstractSubscriptionModel { diff --git a/packages/web3-core/README.md b/packages/web3-core/README.md index 5af4936fcb4..a44180eb8e6 100644 --- a/packages/web3-core/README.md +++ b/packages/web3-core/README.md @@ -1,24 +1,26 @@ # web3-core -This is a sub package of [web3.js][repo] +This is a sub module of [web3.js][repo] -The ```web3-core``` contains core functions for [web3.js][repo] packages. This package should be used -if someone wants to implement a new web3 package. +The ```web3-core``` contains core functions for [web3.js][repo] modules. This module should be used +if someone wants to implement a new web3 module. -If you implement your own web3 package then don't forget to add the ```setProvider()``` method to the parent object. -This because the default behaviour of ```setProvider()``` is that the parent object will also set the provider of the child packages if this method is called. +Don't forget to overwrite the ```setProvider()``` method in the parent object and be sure it +will set the provider on his child modules too. This is the default behaviour of web3. -Provided interface of AbstractWeb3Module: +##### AbstractWeb3Module: + +> This class provides the default dependencies and behaviours of an web3 JSON-RPC module. - ```extend(methods: Object):void ``` Extends the current object with additional RPC methods. -- ```setProvider(provider: any):void ``` This method will set the current provider of this object. -- ```clearSubscriptions():void ``` This method will clear all subscriptions -- ```proxyHandler(target, name): any``` This method will be used for the RPC method handling in the Proxy object. This method can be overwritten if you want to change the default behaviour of the Proxy. -- ```BatchRequest``` With this property we provide the possibility to create batch requests. Please have a look on the official [documentation][docs] for further information. -- ```givenProvider``` This property contains the detected provider. -- ```currentProvider``` This property contains the current provider of this object. -- ```methodController``` This property is an instance of ```MethodController```. This will be used to execute an RPC request. For further information please have a look on the ```MethodController``` in the ```web3-core-method``` package. -- ```methodModelFactory``` This property is an instance of ```AbstractMethodModelFactory```. If this property is given then it will create an "MethodProxy". Please have a look on the ```web3-core-method```readme file for further information. +- ```setProvider(provider: any):void ``` Sets the current provider of it. +- ```clearSubscriptions():void ``` Clears all subscriptions +- ```proxyHandler(target, name): any``` This will be used for the RPC method handling in the Proxy object. +- ```BatchRequest``` This provides the possibility to create a batch requests. Please have a look on the official [documentation][docs] for further information. +- ```givenProvider``` This contains the detected provider. +- ```currentProvider``` This contains the current provider of this object. +- ```methodController``` This is an instance of ```MethodController```. It will be used to execute an RPC request. For further information please have a look on the ```MethodController``` in the ```web3-core-method``` package. +- ```methodModelFactory``` This is an instance of ```AbstractMethodModelFactory```. If this property is given then it will create an "MethodProxy". Please have a look on the ```web3-core-method```readme file for further information. ## Installation @@ -42,35 +44,32 @@ This will expose the `moduleInstance` object on the window object. ## Usage ```js -// in node.js -var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; - -/** - * @param {Object|String} provider - * @param {ProvidersPackage} providersPackage - * @param {MethodController} methodController - * @param {AbstractMethodModelFactory} methodModelFactory - * - * @constructor - */ -function Module ( - provider, - providersPackage, - methodController, // optional - methodModelFactory // optional -) { - AbstractWeb3Module.call( - this, +import AbstractWeb3Module from 'web3-core'; + +class Module extends AbstractWeb3Module { + + /** + * @param {Object|String} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {AbstractMethodModelFactory} methodModelFactory + * + * @constructor + */ + constructor( provider, providersPackage, methodController, // optional methodModelFactory // optional - ); + ) { + super( + provider, + providersPackage, + methodController, // optional + methodModelFactory // optional + ); + } } - -// Inherit from AbstractWeb3Module -Module.prototype = Object.create(AbstractWeb3Module.prototype); -Module.prototype.constructor = Module; ``` [docs]: http://web3js.readthedocs.io/en/1.0/ diff --git a/packages/web3-core/src/AbstractWeb3Module.js b/packages/web3-core/src/AbstractWeb3Module.js index b32ecaeb9b2..ed310e2087a 100644 --- a/packages/web3-core/src/AbstractWeb3Module.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file AbstractWeb3Module.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; export default class AbstractWeb3Module { diff --git a/packages/web3-core/src/index.js b/packages/web3-core/src/index.js index d7676e36bc7..138f3a91cdd 100644 --- a/packages/web3-core/src/index.js +++ b/packages/web3-core/src/index.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file index.js @@ -20,7 +20,4 @@ * @date 2018 */ -"use strict"; - -export version from '../package.json'; export AbstractWeb3Module from './AbstractWeb3Module'; diff --git a/packages/web3-eth-abi/README.md b/packages/web3-eth-abi/README.md index 83ccbc69a94..0d82fc26280 100644 --- a/packages/web3-eth-abi/README.md +++ b/packages/web3-eth-abi/README.md @@ -29,9 +29,9 @@ This will expose the `Web3EthAbi` object on the window object. ```js // in node.js -var AbiCoder = require('web3-eth-abi').AbiCoder; -var abiCoder = new AbiCoder(); +import {AbiCoder} from 'web3-eth-abi'; +const abiCoder = new AbiCoder(); abiCoder.encodeFunctionSignature('myMethod(uint256,string)'); > '0x24ee0097' ``` diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index 258addd927b..58d7c325d05 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -20,15 +20,13 @@ * @date 2018 */ -'use strict'; - import Utils from 'web3-utils'; -export ABICoderObject from './ABICoder'; +import ABICoderObject from './ABICoder'; /** * Returns an object of AbiCoder * - * @returns {AbiCoder} + * @returns {ABICoder} * * @constructor */ diff --git a/packages/web3-eth-accounts/README.md b/packages/web3-eth-accounts/README.md index 034e9fc93b2..d244bfafbdb 100644 --- a/packages/web3-eth-accounts/README.md +++ b/packages/web3-eth-accounts/README.md @@ -29,13 +29,10 @@ This will expose the `Web3EthAccounts` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-providers'); -var Accounts = require('web3-eth-accounts').Accounts; - -var accounts = new Accounts( - ProvidersPackage.resolve('ws://localhost:8546') -); +import {resolve} from 'web3-providers'; +import {Accounts} from 'web3-eth-accounts'; +const accounts = new Accounts(resolve('ws://localhost:8546')); accounts.create(); > { address: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 7f12dfdcd93..e67152e9623 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -20,8 +20,6 @@ * @date 2017 */ -"use strict"; - import _ from "underscore"; import Account from "eth-lib/lib/account"; import Hash from "eth-lib/lib/hash"; diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js index d1c08585fa9..141545c989e 100644 --- a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -20,9 +20,7 @@ * @date 2018 */ -"use strict"; - -import web3CoreMethod from 'web3-core-method'; +import * as web3CoreMethod from 'web3-core-method'; export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 321f08a2fdb..d9309bb3439 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -20,11 +20,9 @@ * @date 2018 */ -"use strict"; - import AccountsModule from './Accounts'; import {MethodController} from 'web3-core-method'; -import ProvidersPackage from 'web3-providers'; +import * as ProvidersPackage from 'web3-providers'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; import MethodModelFactory from './factories/MethodModelFactory'; diff --git a/packages/web3-eth-contract/README.md b/packages/web3-eth-contract/README.md index 274f23cb3da..6c4c1220d59 100644 --- a/packages/web3-eth-contract/README.md +++ b/packages/web3-eth-contract/README.md @@ -28,13 +28,12 @@ This will expose the `Web3EthContract` object on the window object. ## Usage ```js -// in node.js -var ProvidersPackage = require('web3-providers'); -var Accounts = require('web3-eth-accounts').Accounts; -var Contract = require('web3-eth-contract').Contract; +import {resolve} from 'web3-providers'; +import {Accounts} from 'web3-eth-accounts'; +import {Contract} from 'web3-eth-contract'; -var provider = ProvidersPackage.resolve('ws://localhost:8546'); -var contract = new Contract( +const provider = resolve('ws://localhost:8546'); +const contract = new Contract( provider, new Accounts(provider), jsonInterface, diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index a0a35010879..cedbe66c2c4 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {AbstractWeb3Module} from 'web3-core'; export default class Contract extends AbstractWeb3Module { @@ -79,78 +77,89 @@ export default class Contract extends AbstractWeb3Module { this.options = options; this.promiEventPackage = promiEventPackage; this.rpcMethodModelFactory = contractPackageFactory.createRpcMethodModelFactory(); + this._defaultAccount = null; + this._defaultBlock = 'latest'; + this.abiModel = abiMapper.map(abi); + this.options.address = address; - - this.defaultBlock = 'latest'; - address = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(address)); - - let abiModel = abiMapper.map(abi); - let defaultAccount = null; - - /** - * Defines accessors for contract address - */ - Object.defineProperty(this.options, 'address', { - set: (value) => { - if (value) { - address = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(value)); - } - }, - get: () => { - return address; - }, - enumerable: true - }); - - /** - * Defines accessors for jsonInterface - */ Object.defineProperty(this.options, 'jsonInterface', { - set: (value) => { - abiModel = this.abiMapper.map(value); - this.methods.abiModel = abiModel; - this.events.abiModel = abiModel; - }, get: () => { - return abiModel; + return this.abiModel; }, - enumerable: true + set: (value) => { + this.abiModel = this.abiMapper.map(value); + this.methods.abiModel = this.abiModel; + this.events.abiModel = this.abiModel; + }, + enumerable: true }); - /** - * Defines accessors for defaultAccount - */ - Object.defineProperty(this, 'defaultAccount', { + Object.defineProperty(this.options, 'address', { get: () => { - if (!defaultAccount) { - return this.options.from; - } - - return defaultAccount; + return this._address; }, - set: (val) => { - if (val) { - defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); - } - + set: (value) => { + this._address = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(value)); }, enumerable: true }); this.methods = contractPackageFactory.createMethodsProxy( this, - abiModel, + this.abiModel, this.methodController, this.promiEventPackage ); this.events = contractPackageFactory.createEventSubscriptionsProxy( this, - abiModel, + this.abiModel, this.methodController ); } + /** + * Getter for the defaultAccount property + * + * @property defaultAccount + * + * @returns {null|String} + */ + get defaultAccount() { + return this._defaultAccount; + } + + /** + * Setter for the defaultAccount property + * + * @property defaultAccount + */ + set defaultAccount(value) { + this._defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(value)); + } + + /** + * Getter for the defaultBlock property + * + * @property defaultBlock + * + * @returns {String} + */ + get defaultBlock() { + return this._defaultBlock; + } + + /** + * Setter for the defaultBlock property + * + * @property defaultBlock + * + * @param value + */ + set defaultBlock(value) { + this._defaultBlock = value; + } + /** * Adds event listeners and creates a subscription, and remove it once its fired. * @@ -231,7 +240,7 @@ export default class Contract extends AbstractWeb3Module { * @returns {Contract} */ clone() { - return new this.constructor( + const contract = new this.constructor( this.currentProvider, this.providersPackage, this.methodController, @@ -242,10 +251,14 @@ export default class Contract extends AbstractWeb3Module { this.formatters, this.accounts, this.abiMapper, - this.options.jsonInterface, + {}, this.options.address, this.options ); + + contract.abiModel = this.abiModel; + + return contract; } /** diff --git a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js index a74ea82c600..c146230afde 100644 --- a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import EventLogDecoder from './EventLogDecoder'; export default class AllEventsLogDecoder extends EventLogDecoder { diff --git a/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js index 95109d4160b..20f98018294 100644 --- a/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js +++ b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class CallMethodResponseDecoder { /** diff --git a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js index e49c8c2ad91..662b83d890e 100644 --- a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - class EventLogDecoder { /** diff --git a/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js index 5c6307ce57d..e9bad4d7c5f 100644 --- a/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js +++ b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import EventFilterEncoder from './EventFilterEncoder'; export default class AllEventsFilterEncoder extends EventFilterEncoder { diff --git a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js index 8d8a5d3c0c5..965b547454f 100644 --- a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js +++ b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class EventFilterEncoder { /** diff --git a/packages/web3-eth-contract/src/encoders/MethodEncoder.js b/packages/web3-eth-contract/src/encoders/MethodEncoder.js index 1e593ecf187..654a25fcfee 100644 --- a/packages/web3-eth-contract/src/encoders/MethodEncoder.js +++ b/packages/web3-eth-contract/src/encoders/MethodEncoder.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class MethodEncoder { /** diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js index 2df4cbff403..9f814920884 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractPackageFactory.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import ABIModel from '../models/abi/ABIModel'; import ABIItemModel from '../models/abi/ABIItemModel'; import MethodEncoder from '../encoders/MethodEncoder'; diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js index 161c3c981d1..52afb800e95 100644 --- a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {Subscription} from 'web3-core-subscriptions'; import {GetPastLogsMethodModel} from 'web3-core-method'; import EventLogSubscription from '../models/subscriptions/EventLogSubscription'; diff --git a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js index 47768dd43c1..83693acc062 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import CallContractMethodModel from '../models/methods/CallContractMethodModel'; import ContractDeployMethodModel from '../models/methods/ContractDeployMethodModel'; import PastEventLogsMethodModel from '../models/methods/PastEventLogsMethodModel'; diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index a587155feae..beb6fee9126 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -20,11 +20,9 @@ * @date 2018 */ -"use strict"; - -import PromiEventPackage from 'web3-core-promievent'; +import * as PromiEventPackage from 'web3-core-promievent'; import {MethodController} from 'web3-core-method'; -import ProvidersPackage from 'web3-providers'; +import * as ProvidersPackage from 'web3-providers'; import {formatters} from 'web3-core-helpers'; import Utils from 'web3-utils'; import {AbiCoder} from 'web3-eth-abi'; @@ -48,15 +46,15 @@ export const Contract = (provider, accounts, abi, address, options) => { Utils, formatters, new AbiCoder(), - accounts + accounts ).createContract( provider, ProvidersPackage, new MethodController(), - PromiEventPackage, - abi, - address, - options + PromiEventPackage, + abi, + address, + options ); }; diff --git a/packages/web3-eth-contract/src/mappers/ABIMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js index e43c3c8d171..024d39613bd 100644 --- a/packages/web3-eth-contract/src/mappers/ABIMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class ABIMapper { /** diff --git a/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js b/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js index 8ccd9332558..30d95fcf3fe 100644 --- a/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class AllEventsOptionsMapper { /** diff --git a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js index f19d51f6413..ef460ed7580 100644 --- a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class EventOptionsMapper { /** diff --git a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js index dccc41c3158..8caa9bacf45 100644 --- a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class RpcMethodOptionsMapper { /** * @param {Object} utils diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index c3b64fa3819..2eb0cb6c648 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; export default class ABIItemModel { diff --git a/packages/web3-eth-contract/src/models/abi/ABIModel.js b/packages/web3-eth-contract/src/models/abi/ABIModel.js index 0f41e0e0ac2..5a695d8906d 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class ABIModel { /** diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js index cf53dace5ec..4238faedb8c 100644 --- a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {CallMethodModel} from 'web3-core-method'; export default class CallContractMethodModel extends CallMethodModel { diff --git a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js index 6b62ecce31d..68cea5d4c5e 100644 --- a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {SendTransactionMethodModel} from 'web3-core-method'; export default class ContractDeployMethodModel extends SendTransactionMethodModel { diff --git a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js index e1135be0a72..693f68bd887 100644 --- a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {GetPastLogsMethodModel} from 'web3-core-method'; export default class PastEventLogsMethodModel extends GetPastLogsMethodModel { diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js index c153452fbf2..a1ac01481b8 100644 --- a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; import {SendTransactionMethodModel} from 'web3-core-method'; diff --git a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js index 088283c537e..c1bd7344f19 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {LogSubscriptionModel} from 'web3-core-subscriptions'; export default class AllEventsLogSubscription extends LogSubscriptionModel { diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index e1d1258375f..b9a2111ca00 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {LogSubscriptionModel} from 'web3-core-subscriptions'; export default class EventLogSubscription extends LogSubscriptionModel { diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index aa227073ce3..930866b65d8 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class EventSubscriptionsProxy { /** diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 362db19669a..6dc469a689b 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class MethodsProxy { /** diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js index d670ba3cd57..c914cc18a54 100644 --- a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class RpcMethodOptionsValidator { /** diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index 743c52004b1..69673baa9e0 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -13,13 +13,10 @@ */ /** * @file ENS.js - * * @author Samuel Furter * @date 2018 */ -"use strict"; - export default class ENS { /** diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index bd22ebfe7f7..c7cae2ed301 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -17,8 +17,6 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; import namehash from 'eth-ens-namehash'; diff --git a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js index f715fc1eda3..8dbb3d77b0a 100644 --- a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js +++ b/packages/web3-eth-ens/src/factories/ENSPackageFactory.js @@ -17,13 +17,12 @@ * @date 2018 */ -"use strict"; - import ENS from './ENS'; import Registry from './contracts/Registry'; import ResolverMethodHandler from '../handlers/ResolverMethodHandler'; export default class ENSPackageFactory { + /** * Returns an object of type ENS * diff --git a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js index 7e7069c7159..217236a35f8 100644 --- a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js +++ b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js @@ -13,13 +13,10 @@ */ /** * @file ResolverMethodHandler.js - * * @author Samuel Furter * @date 2018 */ -"use strict"; - import _ from 'underscore'; import namehash from 'eth-ens-namehash'; diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index 66932d696ff..99b5da6f895 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -13,16 +13,12 @@ */ /** * @file index.js - * * @author Samuel Furter * @date 2018 */ -"use strict"; - -import {version} from '../package.json'; -import ContractPackage from 'web3-eth-contract'; -import PromiEventPackage from 'web3-core-promievent'; +import * as ContractPackage from 'web3-eth-contract'; +import * as PromiEventPackage from 'web3-core-promievent'; import REGISTRY_ABI from '../ressources/ABI/Registry'; import RESOLVER_ABI from '../ressources/ABI/Resolver'; import ENSPackageFactory from './factories/ENSPackageFactory'; diff --git a/packages/web3-eth-iban/README.md b/packages/web3-eth-iban/README.md index 0dd45339381..1cce4e60e28 100644 --- a/packages/web3-eth-iban/README.md +++ b/packages/web3-eth-iban/README.md @@ -29,9 +29,9 @@ This will expose the `Web3EthIban` object on the window object. ```js // in node.js -var Iban = require('web3-eth-iban').Iban; +import {Iban} from 'web3-eth-iban'; -var iban = new Iban('XE75JRZCTTLBSYEQBGAS7GID8DKR7QY0QA3'); +const iban = new Iban('XE75JRZCTTLBSYEQBGAS7GID8DKR7QY0QA3'); iban.toAddress() > '0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B' ``` diff --git a/packages/web3-eth-iban/src/index.js b/packages/web3-eth-iban/src/index.js index fd52b78df4b..7f6ad2c6e84 100644 --- a/packages/web3-eth-iban/src/index.js +++ b/packages/web3-eth-iban/src/index.js @@ -20,12 +20,4 @@ * @date 2018 */ -"use strict"; - -import {version} from './package.json'; -import Iban from './Iban.js'; - -export default { - version, - Iban -}; +export Iban from './Iban.js'; diff --git a/packages/web3-eth-personal/README.md b/packages/web3-eth-personal/README.md index 62393bf41d9..30964b3ac98 100644 --- a/packages/web3-eth-personal/README.md +++ b/packages/web3-eth-personal/README.md @@ -29,9 +29,10 @@ This will expose the `Web3EthPersonal` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-providers'); -var Personal = require('web3-eth-personal').Personal; -var personal = new Personal(ProvidersPackage.resolve('ws://localhost:8546')); +import {resolve} from 'web3-providers'; +import {Personal} from 'web3-eth-personal'; + +const personal = new Personal(resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 4bf088d78ef..5b3616f8014 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -20,8 +20,6 @@ * @date 2017 */ -"use strict"; - import {AbstractWeb3Module} from 'web3-core'; export default class Personal extends AbstractWeb3Module { @@ -53,31 +51,50 @@ export default class Personal extends AbstractWeb3Module { this.utils = utils; this.formatters = formatters; this.net = net; + this._defaultAccount = null; + this._defaultBlock = 'latest'; + } - let defaultAccount = null; - let defaultBlock = 'latest'; + /** + * Getter for the defaultAccount property + * + * @property defaultAccount + * + * @returns {null|String} + */ + get defaultAccount() { + return this._defaultAccount; + } - Object.defineProperty(this, 'defaultAccount', { - get: () => { - return defaultAccount; - }, - set: (val) => { - if (val) { - defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); - } - }, - enumerable: true - }); + /** + * Setter for the defaultAccount property + * + * @property defaultAccount + */ + set defaultAccount(value) { + this._defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(value)); + } - Object.defineProperty(this, 'defaultBlock', { - get: () => { - return defaultBlock; - }, - set: (val) => { - defaultBlock = val; - }, - enumerable: true - }); + /** + * Getter for the defaultBlock property + * + * @property defaultBlock + * + * @returns {String} + */ + get defaultBlock() { + return this._defaultBlock; + } + + /** + * Setter for the defaultBlock property + * + * @property defaultBlock + * + * @param value + */ + set defaultBlock(value) { + this._defaultBlock = value; } /** diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index 3614404e64a..b1e0de1550d 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -20,9 +20,7 @@ * @date 2018 */ -"use strict"; - -import web3CoreMethod from 'web3-core-method'; +import * as web3CoreMethod from 'web3-core-method'; export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 075ddb82987..6c34a05cdd3 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -20,38 +20,31 @@ * @date 2018 */ -"use strict"; - -import {version} from './package.json'; -import Personal from './Personal'; import {MethodController} from 'web3-core-method'; import {Network} from 'web3-net'; -import ProvidersPackage from 'web3-providers'; +import * as ProvidersPackage from 'web3-providers'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; import MethodModelFactory from './factories/MethodModelFactory'; +import PersonalModule from './Personal'; -export default { - version, - - /** - * Returns the Personal object - * - * @method Personal - * - * @param {AbstractProviderAdapter|EthereumProvider} provider - * - * @returns {Personal} - */ - Personal: (provider) => { - return new Personal( - provider, - ProvidersPackage, - new MethodController(), - new MethodModelFactory(Utils, formatters), - new Network(provider), - Utils, - formatters - ); - } +/** + * Returns the Personal object + * + * @method Personal + * + * @param {AbstractProviderAdapter|EthereumProvider} provider + * + * @returns {Personal} + */ +export const Personal = (provider) => { + return new PersonalModule( + provider, + ProvidersPackage, + new MethodController(), + new MethodModelFactory(Utils, formatters), + new Network(provider), + Utils, + formatters + ); }; diff --git a/packages/web3-eth/README.md b/packages/web3-eth/README.md index 23b79c545bb..c343638ab42 100644 --- a/packages/web3-eth/README.md +++ b/packages/web3-eth/README.md @@ -28,13 +28,10 @@ This will expose the `Web3Eth` object on the window object. ## Usage ```js -// in node.js -var ProvidersPackage = require('web3-providers'); -var Eth = require('web3-eth').Eth; +import {resolve} from 'web3-providers'; +import {Eth} from 'web3-eth'; -var eth = new Eth( - ProvidersPackage.resolve('http://127.0.0.1:4546') -); +const eth = new Eth(resolve('http://127.0.0.1:4546')); ``` diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index d91a396f662..5160e06fa04 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {AbstractWeb3Module} from 'web3-core'; export default class Eth extends AbstractWeb3Module { @@ -61,6 +59,7 @@ export default class Eth extends AbstractWeb3Module { methodModelFactory ) { super(provider, providersPackage, methodController, methodModelFactory); + this.net = net; this.accounts = accounts; this.personal = personal; @@ -71,6 +70,8 @@ export default class Eth extends AbstractWeb3Module { this.formatters = formatters; this.subscriptionsFactory = subscriptionsFactory; this.initiatedContracts = []; + this._defaultAccount = null ; + this._defaultBlock = 'latest'; /** * This wrapper function is required for the "new web3.eth.Contract(...)" call. @@ -89,47 +90,59 @@ export default class Eth extends AbstractWeb3Module { return contract; }; + } - let defaultAccount = null, defaultBlock = 'latest'; + /** + * Getter for the defaultAccount property + * + * @property defaultAccount + * + * @returns {null|String} + */ + get defaultAccount() { + return this._defaultAccount; + } - /** - * Defines accessors for defaultAccount - */ - Object.defineProperty(this, 'defaultAccount', { - get: () => { - return defaultAccount; - }, - set: (val) => { - if (val) { - this.initiatedContracts.forEach(contract => { - contract.defaultAccount = val; - }); - - this.personal.defaultAccount = val; - defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(val)); - } - - }, - enumerable: true + /** + * Setter for the defaultAccount property + * + * @property defaultAccount + */ + set defaultAccount(value) { + this.initiatedContracts.forEach(contract => { + contract.defaultAccount = value; }); - /** - * Defines accessors for defaultBlock - */ - Object.defineProperty(this, 'defaultBlock', { - get: () => { - return defaultBlock; - }, - set: (val) => { - defaultBlock = val; - this.initiatedContracts.forEach(contract => { - contract.defaultAccount = val; - }); - - this.personal.defaultBlock = defaultBlock; - }, - enumerable: true + this.personal.defaultAccount = value; + this._defaultAccount = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(value)); + } + + /** + * Getter for the defaultBlock property + * + * @property defaultBlock + * + * @returns {String} + */ + get defaultBlock() { + return this._defaultBlock; + } + + /** + * Setter for the defaultBlock property + * + * @property defaultBlock + * + * @param value + */ + set defaultBlock(value) { + this._defaultBlock = value; + + this.initiatedContracts.forEach(contract => { + contract.defaultBlock = value; }); + + this.personal.defaultBlock = this._defaultBlock; } /** diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index deb47fef82a..a245a19aa62 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import web3CoreMethod from 'web3-core-method'; export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index cb43f239f5f..505c926a238 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -20,13 +20,11 @@ * @date 2018 */ -"use strict"; - import MethodModelFactory from './factories/MethodModelFactory'; import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; import {Network} from 'web3-net'; -import ProvidersPackage from 'web3-providers'; +import * as ProvidersPackage from 'web3-providers'; import Utils from 'web3-utils'; import {Accounts} from 'web3-eth-accounts'; import {Personal} from 'web3-eth-personal'; @@ -34,7 +32,8 @@ import {ENS} from 'web3-eth-ens'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {AbiCoder} from 'web3-eth-abi'; import {Iban} from 'web3-eth-iban'; -import ContractPackage from 'web3-eth-contract'; +import * as ContractPackage from 'web3-eth-contract'; +import EthModule from './Eth'; /** * Creates the Eth object @@ -48,7 +47,7 @@ import ContractPackage from 'web3-eth-contract'; export const Eth = (provider) => { const accounts = new Accounts(provider); - return new Eth( + return new EthModule( provider, new Network(provider), ContractPackage, diff --git a/packages/web3-net/README.md b/packages/web3-net/README.md index 3fdf2912e1f..f86a0ba987d 100644 --- a/packages/web3-net/README.md +++ b/packages/web3-net/README.md @@ -29,9 +29,10 @@ This will expose the `Web3Net` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-providers'); -var Network = require('web3-net').Network; -var net = new Network(ProvidersPackage.resolve('ws://localhost:8546')); +import {resolve} from 'web3-providers'; +import {Network} from 'web3-net'; + +const net = new Network(resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index b9c60989663..05b7d7c0cb2 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -21,8 +21,6 @@ * @date 2018 */ -"use strict"; - import {AbstractWeb3Module} from 'web3-core'; export default class Network extends AbstractWeb3Module { diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index b3192c19227..452872d9c5d 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -20,9 +20,7 @@ * @date 2018 */ -"use strict"; - -import web3CoreMethod from 'web3-core-method'; +import * as web3CoreMethod from 'web3-core-method'; export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index 45ee3a8356e..30cf2edc90c 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -21,9 +21,7 @@ * @date 2018 */ -"use strict"; - -import ProvidersPackage from 'web3-providers'; +import * as ProvidersPackage from 'web3-providers'; import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; import utils from 'web3-utils'; diff --git a/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js index 95ab5890b53..6816936af91 100644 --- a/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import JSONRpcMapper from '../../src/mappers/JSONRpcMapper.js'; import JSONRpcResponseValidator from '../../src/validators/JSONRpcResponseValidator.js'; import {errors} from 'web3-core-helpers'; diff --git a/packages/web3-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-providers/src/adapters/HttpProviderAdapter.js index 8b0a5529583..fde3c449892 100644 --- a/packages/web3-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-providers/src/adapters/HttpProviderAdapter.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractProviderAdapter from '../../lib/adapters/AbstractProviderAdapter'; export default class HttpProviderAdapter extends AbstractProviderAdapter { diff --git a/packages/web3-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-providers/src/adapters/InpageProviderAdapter.js index de68a476035..d996d105bba 100644 --- a/packages/web3-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-providers/src/adapters/InpageProviderAdapter.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractProviderAdapter from '../../lib/adapters/AbstractProviderAdapter'; export default class InpageProviderAdapter extends AbstractProviderAdapter { diff --git a/packages/web3-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-providers/src/adapters/SocketProviderAdapter.js index 3125ccab8f6..1a96744744c 100644 --- a/packages/web3-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-providers/src/adapters/SocketProviderAdapter.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import AbstractProviderAdapter from '../../lib/adapters/AbstractProviderAdapter'; export default class SocketProviderAdapter extends AbstractProviderAdapter { diff --git a/packages/web3-providers/src/batch-request/BatchRequest.js b/packages/web3-providers/src/batch-request/BatchRequest.js index 3dd1fc0aa06..d4c90329e18 100644 --- a/packages/web3-providers/src/batch-request/BatchRequest.js +++ b/packages/web3-providers/src/batch-request/BatchRequest.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import {errors} from 'web3-core-helpers'; import _ from 'underscore'; diff --git a/packages/web3-providers/src/factories/ProvidersPackageFactory.js b/packages/web3-providers/src/factories/ProvidersPackageFactory.js index c7de3843f81..fef63df5c24 100644 --- a/packages/web3-providers/src/factories/ProvidersPackageFactory.js +++ b/packages/web3-providers/src/factories/ProvidersPackageFactory.js @@ -21,7 +21,6 @@ */ import ProviderAdapterResolver from '../resolvers/ProviderAdapterResolver'; - import ProviderDetector from '../detectors/ProviderDetector'; import SocketProviderAdapter from '../adapters/SocketProviderAdapter'; import InpageProviderAdapter from '../adapters/InpageProviderAdapter'; diff --git a/packages/web3-providers/src/index.js b/packages/web3-providers/src/index.js index f2852e38c20..79c8f7c9798 100644 --- a/packages/web3-providers/src/index.js +++ b/packages/web3-providers/src/index.js @@ -18,8 +18,6 @@ * @date 2018 */ -"use strict"; - import ProvidersPackageFactory from './factories/ProvidersPackageFactory'; import BatchRequestObject from './batch-request/BatchRequest'; import JSONRpcMapper from './validators/JSONRpcResponseValidator'; diff --git a/packages/web3-providers/src/mappers/JSONRpcMapper.js b/packages/web3-providers/src/mappers/JSONRpcMapper.js index cefe652b05f..fe9d2a46195 100644 --- a/packages/web3-providers/src/mappers/JSONRpcMapper.js +++ b/packages/web3-providers/src/mappers/JSONRpcMapper.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - const JSONRpcMapper = { messageId: 0 }; diff --git a/packages/web3-providers/src/providers/HttpProvider.js b/packages/web3-providers/src/providers/HttpProvider.js index f0ec89acfee..71cd1c861b6 100644 --- a/packages/web3-providers/src/providers/HttpProvider.js +++ b/packages/web3-providers/src/providers/HttpProvider.js @@ -23,7 +23,6 @@ */ import {errors} from 'web3-core-helpers'; - import {XMLHttpRequest as XHR2} from 'xhr2-cookies'; // jshint ignore: line import http from 'http'; import https from 'https'; diff --git a/packages/web3-providers/src/providers/IpcProvider.js b/packages/web3-providers/src/providers/IpcProvider.js index 9301c740267..12ccb97cbcd 100644 --- a/packages/web3-providers/src/providers/IpcProvider.js +++ b/packages/web3-providers/src/providers/IpcProvider.js @@ -20,8 +20,6 @@ * @date 2017 */ -"use strict"; - import _ from 'underscore'; import {errors} from 'web3-core-helpers'; import oboe from 'oboe'; diff --git a/packages/web3-providers/src/providers/WebsocketProvider.js b/packages/web3-providers/src/providers/WebsocketProvider.js index 1fb82c04403..dedb83ba18f 100644 --- a/packages/web3-providers/src/providers/WebsocketProvider.js +++ b/packages/web3-providers/src/providers/WebsocketProvider.js @@ -14,14 +14,12 @@ You should have received a copy of the GNU Lesser General Public License along with web3.js. If not, see . */ -/** @file WebsocketProvider.js - * @authors: - * Fabian Vogelsteller +/** + * @file WebsocketProvider.js + * @authors: Fabian Vogelsteller * @date 2017 */ -"use strict"; - import _ from 'underscore'; import {errors} from 'web3-core-helpers'; diff --git a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js index 3444014852f..6c0d13b7854 100644 --- a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - import _ from 'underscore'; export default class ProviderAdapterResolver { diff --git a/packages/web3-providers/src/validators/JSONRpcResponseValidator.js b/packages/web3-providers/src/validators/JSONRpcResponseValidator.js index 642e725dd05..5bb1db21f3a 100644 --- a/packages/web3-providers/src/validators/JSONRpcResponseValidator.js +++ b/packages/web3-providers/src/validators/JSONRpcResponseValidator.js @@ -20,8 +20,6 @@ * @date 2018 */ -"use strict"; - export default class JSONRpcResponseValidator { /** diff --git a/packages/web3-shh/README.md b/packages/web3-shh/README.md index 31c247aa77c..7736306dac9 100644 --- a/packages/web3-shh/README.md +++ b/packages/web3-shh/README.md @@ -29,9 +29,10 @@ This will expose the `Web3Shh` object on the window object. ```js // in node.js -var ProvidersPackage = require('web3-providers'); -var Shh = require('web3-shh').Shh; -var shh = new Shh(ProvidersPackage.resolve('ws://localhost:8546')); +import {resolve} from 'web3-providers'; +import {Shh} from 'web3-shh'; + +const shh = new Shh(resolve('ws://localhost:8546')); ``` diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index 77bf3cd0e89..340305e92ba 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -20,8 +20,6 @@ * @date 2017 */ -"use strict"; - import {AbstractWeb3Module} from 'web3-core'; export default class Shh extends AbstractWeb3Module { diff --git a/packages/web3-shh/src/factories/MethodModelFactory.js b/packages/web3-shh/src/factories/MethodModelFactory.js index e0335caeacc..5be38fd6958 100644 --- a/packages/web3-shh/src/factories/MethodModelFactory.js +++ b/packages/web3-shh/src/factories/MethodModelFactory.js @@ -20,9 +20,7 @@ * @date 2018 */ -"use strict"; - -import web3CoreMethod from 'web3-core-method'; +import * as web3CoreMethod from 'web3-core-method'; export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index 2a3f02a8fbd..dca89e49a15 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -20,9 +20,7 @@ * @date 2018 */ -"use strict"; - -import ProvidersPackage from 'web3-providers'; +import * as ProvidersPackage from 'web3-providers'; import {MethodController} from 'web3-core-method'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {Network} from 'web3-net'; diff --git a/packages/web3-utils/README.md b/packages/web3-utils/README.md index 149ad19de1b..987f92ecefc 100644 --- a/packages/web3-utils/README.md +++ b/packages/web3-utils/README.md @@ -28,9 +28,9 @@ This will expose the `Web3Utils` object on the window object. ## Usage ```js -// in node.js -var Web3Utils = require('web3-utils'); -console.log(Web3Utils); +import Utils from 'web3-utils'; + +console.log(Utils); > { sha3: function(){}, soliditySha3: function(){}, diff --git a/packages/web3-utils/src/index.js b/packages/web3-utils/src/index.js index 6ec99c31e72..9bbefa30ce4 100644 --- a/packages/web3-utils/src/index.js +++ b/packages/web3-utils/src/index.js @@ -21,15 +21,12 @@ * @date 2017 */ - import _ from 'underscore'; - import ethjsUnit from 'ethjs-unit'; import utils from './utils.js'; import soliditySha3 from './soliditySha3.js'; import randomHex from 'randomhex'; - /** * Fires an error in an event emitter and callback and returns the eventemitter * @@ -100,7 +97,6 @@ const _jsonInterfaceMethodToString = json => { return `${json.name}(${_flattenTypes(false, json.inputs).join(',')})`; }; - /** * Should be used to flatten json abi inputs/outputs into an array of type-representing-strings * @@ -146,7 +142,6 @@ const _flattenTypes = (includeTuple, puts) => { return types; }; - /** * Should be called to get ascii from it's hex representation * @@ -192,7 +187,6 @@ const asciiToHex = str => { return `0x${hex}`; }; - /** * Returns value of unit in Wei * diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index f2133a6597b..752ca26aecb 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -20,12 +20,10 @@ * @date 2018 */ -"use strict"; - import {AbstractWeb3Module} from 'web3-core'; import {formatters} from 'web3-core-helpers'; -import MethodPackage from 'web3-core-method'; -import ProvidersPackage from 'web3-providers'; +import * as MethodPackage from 'web3-core-method'; +import * as ProvidersPackage from 'web3-providers'; import Utils from 'web3-utils'; import {Eth} from 'web3-eth'; import {Shh} from 'web3-shh'; From 781b7900114694bdd2fc8e1a9301e4e8f7ab5b53 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 18 Oct 2018 12:46:45 +0200 Subject: [PATCH 0290/1045] call of the super method refactored in subscription and method models --- .../src/models/methods/CallMethodModel.js | 7 ++++++- .../src/models/methods/EstimateGasMethodModel.js | 7 ++++++- .../src/models/methods/GetCodeMethodModel.js | 7 ++++++- .../src/models/methods/GetPastLogsMethodModel.js | 7 ++++++- .../src/models/methods/GetStorageAtMethodModel.js | 7 ++++++- .../src/models/methods/SignMethodModel.js | 7 ++++++- .../src/models/methods/account/GetAccountsMethodModel.js | 7 ++++++- .../src/models/methods/account/GetBalanceMethodModel.js | 7 ++++++- .../methods/account/GetTransactionCountMethodModel.js | 7 ++++++- .../src/models/methods/block/GetBlockMethodModel.js | 7 ++++++- .../src/models/methods/block/GetBlockNumberMethodModel.js | 7 ++++++- .../methods/block/GetBlockTransactionCountMethodModel.js | 7 ++++++- .../models/methods/block/GetBlockUncleCountMethodModel.js | 7 ++++++- .../src/models/methods/block/GetUncleMethodModel.js | 7 ++++++- .../methods/network/GetProtocolVersionMethodModel.js | 7 ++++++- .../src/models/methods/network/ListeningMethodModel.js | 7 ++++++- .../src/models/methods/network/PeerCountMethodModel.js | 7 ++++++- .../src/models/methods/network/VersionMethodModel.js | 7 ++++++- .../src/models/methods/node/GetCoinbaseMethodModel.js | 7 ++++++- .../src/models/methods/node/GetGasPriceMethodModel.js | 7 ++++++- .../src/models/methods/node/GetHashrateMethodModel.js | 7 ++++++- .../src/models/methods/node/GetNodeInfoMethodModel.js | 7 ++++++- .../src/models/methods/node/GetWorkMethodModel.js | 7 ++++++- .../src/models/methods/node/IsMiningMethodModel.js | 7 ++++++- .../src/models/methods/node/IsSyncingMethodModel.js | 7 ++++++- .../src/models/methods/node/SubmitWorkMethodModel.js | 7 ++++++- .../src/models/methods/personal/EcRecoverMethodModel.js | 7 ++++++- .../models/methods/personal/ImportRawKeyMethodModel.js | 7 ++++++- .../models/methods/personal/ListAccountsMethodModel.js | 7 ++++++- .../src/models/methods/personal/LockAccountMethodModel.js | 7 ++++++- .../src/models/methods/personal/NewAccountMethodModel.js | 7 ++++++- .../personal/PersonalSendTransactionMethodModel.js | 7 ++++++- .../models/methods/personal/PersonalSignMethodModel.js | 7 ++++++- .../personal/PersonalSignTransactionMethodModel.js | 7 ++++++- .../models/methods/personal/UnlockAccountMethodModel.js | 7 ++++++- .../src/models/methods/shh/AddPrivateKeyMethodModel.js | 7 ++++++- .../src/models/methods/shh/AddSymKeyMethodModel.js | 7 ++++++- .../src/models/methods/shh/DeleteKeyPairMethodModel.js | 7 ++++++- .../models/methods/shh/DeleteMessageFilterMethodModel.js | 7 ++++++- .../src/models/methods/shh/DeleteSymKeyMethodModel.js | 7 ++++++- .../methods/shh/GenerateSymKeyFromPasswordMethodModel.js | 7 ++++++- .../models/methods/shh/GetFilterMessagesMethodModel.js | 7 ++++++- .../src/models/methods/shh/GetInfoMethodModel.js | 7 ++++++- .../src/models/methods/shh/GetPrivateKeyMethodModel.js | 7 ++++++- .../src/models/methods/shh/GetPublicKeyMethodModel.js | 7 ++++++- .../src/models/methods/shh/GetSymKeyMethodModel.js | 7 ++++++- .../src/models/methods/shh/HasKeyPairMethodModel.js | 7 ++++++- .../src/models/methods/shh/HasSymKeyMethodModel.js | 7 ++++++- .../src/models/methods/shh/MarkTrustedPeerMethodModel.js | 7 ++++++- .../src/models/methods/shh/NewKeyPairMethodModel.js | 7 ++++++- .../src/models/methods/shh/NewMessageFilterMethodModel.js | 7 ++++++- .../src/models/methods/shh/NewSymKeyMethodModel.js | 7 ++++++- .../src/models/methods/shh/PostMethodModel.js | 7 ++++++- .../models/methods/shh/SetMaxMessageSizeMethodModel.js | 7 ++++++- .../src/models/methods/shh/SetMinPoWMethodModel.js | 7 ++++++- .../src/models/methods/shh/ShhVersionMethodModel.js | 7 ++++++- .../transaction/GetTransactionFromBlockMethodModel.js | 7 ++++++- .../methods/transaction/GetTransactionMethodModel.js | 7 ++++++- .../transaction/GetTransactionReceiptMethodModel.js | 7 ++++++- .../transaction/SendSignedTransactionMethodModel.js | 7 ++++++- .../methods/transaction/SendTransactionMethodModel.js | 7 ++++++- .../methods/transaction/SignTransactionMethodModel.js | 7 ++++++- .../src/models/subscriptions/eth/LogSubscriptionModel.js | 8 +++++++- .../models/subscriptions/eth/NewHeadsSubscriptionModel.js | 8 +++++++- .../eth/NewPendingTransactionsSubscriptionModel.js | 8 +++++++- .../models/subscriptions/eth/SyncingSubscriptionModel.js | 8 +++++++- .../models/subscriptions/shh/MessagesSubscriptionModel.js | 8 +++++++- 67 files changed, 407 insertions(+), 67 deletions(-) diff --git a/packages/web3-core-method/src/models/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js index 866bf4f1361..c62675e3570 100644 --- a/packages/web3-core-method/src/models/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -31,7 +31,12 @@ export default class CallMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_call', 2, utils, formatters); + super( + 'eth_call', + 2, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index 46e8ae52bb6..5164a6caba3 100644 --- a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -31,7 +31,12 @@ export default class EstimateGasMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_estimateGas', 1, utils, formatters); + super( + 'eth_estimateGas', + 1, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index baa838cc547..98291a861af 100644 --- a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -30,7 +30,12 @@ export default class GetCodeMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_getCode', 2, utils, formatters); + super( + 'eth_getCode', + 2, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index 755d6ad02d8..a9d55024ae8 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -31,7 +31,12 @@ export default class GetPastLogsMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_getLogs', 1, utils, formatters); + super( + 'eth_getLogs', + 1, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index a912a9aa6ce..3ab01d869ac 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -31,7 +31,12 @@ export default class GetStorageAtMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_getStorageAt', 3, utils, formatters); + super( + 'eth_getStorageAt', + 3, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js index 3720b8502bf..0abb0c1787d 100644 --- a/packages/web3-core-method/src/models/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -32,7 +32,12 @@ export default class SignMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters, accounts) { - super('eth_sign', 2, utils, formatters); + super( + 'eth_sign', + 2, + utils, + formatters + ); this.accounts = accounts; } diff --git a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js index c3722ec0766..5d2d59c15bf 100644 --- a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js @@ -31,7 +31,12 @@ export default class GetAccountsMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_accounts', 0, utils, formatters); + super( + 'eth_accounts', + 0, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index 7cfa8d9872c..06b3eb8afd9 100644 --- a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -30,7 +30,12 @@ export default class GetBalanceMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_getBalance', 2, utils, formatters); + super( + 'eth_getBalance', + 2, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index e5e8fa9b635..2f6e6f2b700 100644 --- a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -31,7 +31,12 @@ export default class GetTransactionCountMethodModel extends AbstractMethodModel * @constructor */ constructor(utils, formatters) { - super('eth_getTransactionCount', 2, utils, formatters); + super( + 'eth_getTransactionCount', + 2, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index 0aa46099900..747096488ee 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -31,7 +31,12 @@ export default class GetBlockMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_getBlockByNumber', 2, utils, formatters); + super( + 'eth_getBlockByNumber', + 2, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js index b7c5be11189..7b2c19e908e 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js @@ -30,7 +30,12 @@ export default class GetBlockNumberMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_blockNumber', 0, utils, formatters); + super( + 'eth_blockNumber', + 0, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index 2b70888cc6a..4c33ed2822d 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -31,7 +31,12 @@ export default class GetBlockTransactionCountMethodModel extends AbstractMethodM * @constructor */ constructor(utils, formatters) { - super('eth_getTransactionByBlockNumberAndIndex', 1, utils, formatters); + super( + 'eth_getTransactionByBlockNumberAndIndex', + 1, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index d7afa3bc831..eeae51679d3 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -31,7 +31,12 @@ export default class GetBlockUncleCountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_getUncleCountByBlockNumber', 1, utils, formatters); + super( + 'eth_getUncleCountByBlockNumber', + 1, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index 138614e3bcd..beb1867310d 100644 --- a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -31,7 +31,12 @@ export default class GetUncleMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_getUncleByBlockNumberAndIndex', 2, utils, formatters); + super( + 'eth_getUncleByBlockNumberAndIndex', + 2, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js index afeba51818d..7cc37dc0cd8 100644 --- a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js @@ -31,6 +31,11 @@ export default class GetProtocolVersionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_protocolVersion', 0, utils, formatters); + super( + 'eth_protocolVersion', + 0, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js index c915e19012a..93e4ccea1ca 100644 --- a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js @@ -31,6 +31,11 @@ export default class ListeningMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('net_listening', 0, utils, formatters); + super( + 'net_listening', + 0, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js index 3ddec653a58..e0c5944acb5 100644 --- a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js @@ -31,7 +31,12 @@ export default class PeerCountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('net_peerCount', 0, utils, formatters); + super( + 'net_peerCount', + 0, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js index 569dae85d6a..5c0a489dc43 100644 --- a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js @@ -31,7 +31,12 @@ export default class VersionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_protocolVersion', 0, utils, formatters); + super( + 'eth_protocolVersion', + 0, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js index cdaa133a824..9efd47b39d1 100644 --- a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js @@ -31,6 +31,11 @@ export default class GetCoinbaseMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_coinbase', 0, utils, formatters); + super( + 'eth_coinbase', + 0, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js index 1d2a0170fc8..309123ca568 100644 --- a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js @@ -30,7 +30,12 @@ export default class GetGasPriceMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_gasPrice', 0, utils, formatters); + super( + 'eth_gasPrice', + 0, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js index fcea838d0df..ad1f4e40063 100644 --- a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js @@ -31,7 +31,12 @@ export default class GetHashrateMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_hashrate', 0, utils, formatters); + super( + 'eth_hashrate', + 0, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js index 16fd0c25698..a7f6d4e700b 100644 --- a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js @@ -31,6 +31,11 @@ export default class GetNodeInfoMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('web3_clientVersion', 0, utils, formatters); + super( + 'web3_clientVersion', + 0, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js index 396062efe4c..bb7a0e3b2d5 100644 --- a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js @@ -31,6 +31,11 @@ export default class GetWorkMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_getWork', 0, utils, formatters); + super( + 'eth_getWork', + 0, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js index 6cfe417b675..bb0f9fbf1c5 100644 --- a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js @@ -31,6 +31,11 @@ export default class IsMiningMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_mining', 0, utils, formatters); + super( + 'eth_mining', + 0, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js index 287e2426f2d..e6d3be234da 100644 --- a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js @@ -31,7 +31,12 @@ export default class IsSyncingMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_syncing', 0, utils, formatters); + super( + 'eth_syncing', + 0, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js index 3d293bb53dd..3b7989b83cb 100644 --- a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js @@ -31,6 +31,11 @@ export default class SubmitWorkMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_submitWork', 3, utils, formatters); + super( + 'eth_submitWork', + 3, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index eac83bf549f..c1bc27ab1fc 100644 --- a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -31,7 +31,12 @@ export default class EcRecoverMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('personal_ecRecover', 3, utils, formatters); + super( + 'personal_ecRecover', + 3, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js index 40c8d3f83a3..5e34c85872e 100644 --- a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js @@ -31,6 +31,11 @@ export default class ImportRawKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('personal_importRawKey', 2, utils, formatters); + super( + 'personal_importRawKey', + 2, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js index 3f98cec853e..604a55781d3 100644 --- a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js @@ -31,7 +31,12 @@ export default class ListAccountsMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('personal_listAccounts', 0, utils, formatters); + super( + 'personal_listAccounts', + 0, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index 40e26c83256..b81bd8a1166 100644 --- a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -31,7 +31,12 @@ export default class LockAccountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('personal_lockAccount', 1, utils, formatters); + super( + 'personal_lockAccount', + 1, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js index 64a31f5485b..dc2dffc281d 100644 --- a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js @@ -31,7 +31,12 @@ export default class NewAccountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('personal_newAccount', 0, utils, formatters); + super( + 'personal_newAccount', + 0, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index c711afec5cf..0b37d8fbdb6 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -31,7 +31,12 @@ export default class PersonalSendTransactionMethodModel extends AbstractMethodMo * @constructor */ constructor(utils, formatters) { - super('personal_sendTransaction', 2, utils, formatters); + super( + 'personal_sendTransaction', + 2, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index 79ace524d96..b9668daf6c3 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -31,7 +31,12 @@ export default class PersonalSignMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('personal_sign', 3, utils, formatters); + super( + 'personal_sign', + 3, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js index 2701ae55f11..fa5bf5c947a 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js @@ -31,7 +31,12 @@ export default class PersonalSignTransactionMethodModel extends AbstractMethodMo * @constructor */ constructor(utils, formatters) { - super('personal_signTransaction', 2, utils, formatters); + super( + 'personal_signTransaction', + 2, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index 52f4296971e..796fdf39931 100644 --- a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -30,7 +30,12 @@ export default class UnlockAccountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('personal_unlockAccount', 3, utils, formatters); + super( + 'personal_unlockAccount', + 3, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js index ac267d69edd..92f9dd58b40 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js @@ -31,6 +31,11 @@ export default class AddPrivateKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_addPrivateKey', 1, utils, formatters); + super( + 'shh_addPrivateKey', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js index f7ff8a93f06..846bd20dbd1 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js @@ -31,6 +31,11 @@ export default class AddSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_addSymKey', 1, utils, formatters); + super( + 'shh_addSymKey', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js index b6ff9ff954d..6d092701e72 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js @@ -31,6 +31,11 @@ export default class DeleteKeyPairMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_deleteKeyPair', 1, utils, formatters); + super( + 'shh_deleteKeyPair', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js index da1fa98369f..c4262b4f7ea 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js @@ -31,6 +31,11 @@ export default class DeleteMessageFilterMethodModel extends AbstractMethodModel * @constructor */ constructor(utils, formatters) { - super('shh_deleteMessageFilter', 1, utils, formatters); + super( + 'shh_deleteMessageFilter', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js index dca2a1be879..3554a5b661e 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js @@ -31,6 +31,11 @@ export default class DeleteSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_deleteSymKey', 1, utils, formatters); + super( + 'shh_deleteSymKey', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js index ec442ea9517..76d63915d2e 100644 --- a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -31,6 +31,11 @@ export default class GenerateSymKeyFromPasswordMethodModel extends AbstractMetho * @constructor */ constructor(utils, formatters) { - super('shh_generateSymKeyFromPassword', 1, utils, formatters); + super( + 'shh_generateSymKeyFromPassword', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js index 14158cc8ace..edc7d355122 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js @@ -30,6 +30,11 @@ export default class GetFilterMessagesMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_getFilterMessages', 1, utils, formatters); + super( + 'shh_getFilterMessages', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js index eab65d12638..26489784488 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js @@ -31,6 +31,11 @@ export default class GetInfoMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_info', 0, utils, formatters); + super( + 'shh_info', + 0, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js index 7eac0ba6eb0..dc80269059a 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js @@ -31,6 +31,11 @@ export default class GetPrivateKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_getPrivateKey', 1, utils, formatters); + super( + 'shh_getPrivateKey', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js index 7f764c70eec..fbadfca255e 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js @@ -31,6 +31,11 @@ export default class GetPublicKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_getPublicKey', 1, utils, formatters); + super( + 'shh_getPublicKey', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js index 3a468c05347..916586a701b 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js @@ -31,6 +31,11 @@ export default class GetSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_getSymKey', 1, utils, formatters); + super( + 'shh_getSymKey', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js index e687d950c16..e702440f865 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js @@ -31,6 +31,11 @@ export default class HasKeyPairMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_hasKeyPair', 1, utils, formatters); + super( + 'shh_hasKeyPair', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js index b3da87ae507..31160b4f0a5 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js @@ -31,6 +31,11 @@ export default class HasSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_hasSymKey', 1, utils, formatters); + super( + 'shh_hasSymKey', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js index 9628ef41915..c52dccb4b2e 100644 --- a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js @@ -31,6 +31,11 @@ export default class MarkTrustedPeerMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_markTrustedPeer', 1, utils, formatters); + super( + 'shh_markTrustedPeer', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js index 440b593872c..3d845ca235e 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js @@ -31,6 +31,11 @@ export default class NewKeyPairMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_newKeyPair', 1, utils, formatters); + super( + 'shh_newKeyPair', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js index 7071ec91bb1..9b6258a7ffd 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js @@ -31,6 +31,11 @@ export default class NewMessageFilterMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_newMessageFilter', 1, utils, formatters); + super( + 'shh_newMessageFilter', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js index 29dca9202d7..af132d72a96 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js @@ -31,6 +31,11 @@ export default class NewSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_newSymKey', 0, utils, formatters); + super( + 'shh_newSymKey', + 0, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js index 67664c7c5d6..34d28681551 100644 --- a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js @@ -31,6 +31,11 @@ export default class PostMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_post', 1, utils, formatters); + super( + 'shh_post', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js index d53c9d26216..3550f1d26b5 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js @@ -31,6 +31,11 @@ export default class SetMaxMessageSizeMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_setMaxMessageSize', 1, utils, formatters); + super( + 'shh_setMaxMessageSize', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js index 3be3f811259..c8777dff05f 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js @@ -31,6 +31,11 @@ export default class SetMinPoWMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_setMinPoW', 1, utils, formatters); + super( + 'shh_setMinPoW', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js index 992549fcde0..ba2df7342e9 100644 --- a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js @@ -31,6 +31,11 @@ export default class ShhVersionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('shh_version', 0, utils, formatters); + super( + 'shh_version', + 0, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index 3ae6755d439..9b0cb44ff54 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -31,7 +31,12 @@ export default class GetTransactionFromBlockMethodModel extends AbstractMethodMo * @constructor */ constructor(utils, formatters) { - super('eth_getTransactionByBlockNumberAndIndex', 2, utils, formatters); + super( + 'eth_getTransactionByBlockNumberAndIndex', + 2, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js index 84015afc28e..cd25da8fcc0 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js @@ -31,7 +31,12 @@ export default class GetTransactionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_getTransactionByHash', 1, utils, formatters); + super( + 'eth_getTransactionByHash', + 1, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js index 64a41499440..c2889a901ad 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js @@ -30,7 +30,12 @@ export default class GetTransactionReceiptMethodModel extends AbstractMethodMode * @constructor */ constructor(utils, formatters) { - super('eth_getTransactionReceipt', 1, utils, formatters); + super( + 'eth_getTransactionReceipt', + 1, + utils, + formatters + ); } /** diff --git a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js index b0be10cc4d6..e057b2a3a7c 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js @@ -31,6 +31,11 @@ export default class SendSignedTransactionMethodModel extends AbstractMethodMode * @constructor */ constructor(utils, formatters) { - super('eth_sendRawTransaction', 1, utils, formatters); + super( + 'eth_sendRawTransaction', + 1, + utils, + formatters + ); } } diff --git a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index eccac3ba05e..9ccc564f3c9 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -31,7 +31,12 @@ export default class SendTransactionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters, accounts) { - super('eth_sendTransaction', 1, utils, formatters); + super( + 'eth_sendTransaction', + 1, + utils, + formatters + ); this.accounts = accounts; } diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index e5741858467..05db25853bc 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -31,7 +31,12 @@ export default class SignTransactionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super('eth_signTransaction', 1, utils, formatters); + super( + 'eth_signTransaction', + 1, + utils, + formatters + ); } /** diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js index dc19a75d76c..ee07d2380f9 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -34,7 +34,13 @@ export default class LogSubscriptionModel extends AbstractSubscriptionModel { * @constructor */ constructor(options, utils, formatters, getPastLogsMethodModel, methodController) { - super('eth_subscribe', 'logs', options, utils, formatters); + super( + 'eth_subscribe', + 'logs', + options, + utils, + formatters + ); this.getPastLogsMethodModel = getPastLogsMethodModel; this.methodController = methodController; } diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js index b191b422e68..08e71ad95fe 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js @@ -31,7 +31,13 @@ export default class NewHeadsSubscriptionModel extends AbstractSubscriptionModel * @constructor */ constructor(utils, formatters) { - super('eth_subscribe', 'newHeads', null, utils, formatters); + super( + 'eth_subscribe', + 'newHeads', + null, + utils, + formatters + ); } /** diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js index bbccf8b3e6d..66b24c40ff8 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js @@ -31,6 +31,12 @@ export default class NewPendingTransactionsSubscriptionModel extends AbstractSub * @constructor */ constructor(utils, formatters) { - super('eth_subscribe', 'newPendingTransactions', null, utils, formatters); + super( + 'eth_subscribe', + 'newPendingTransactions', + null, + utils, + formatters + ); } } diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js index 7eb1dbb24d7..3e0dc41f201 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -31,7 +31,13 @@ export default class SyncingSubscriptionModel extends AbstractSubscriptionModel * @constructor */ constructor(utils, formatters) { - super('eth_subscribe', 'syncing', null, utils, formatters); + super( + 'eth_subscribe', + 'syncing', + null, + utils, + formatters + ); this.isSyncing = null; } diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js index 7102cb56bf7..21efc4fd8fb 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js @@ -32,6 +32,12 @@ export default class MessagesSubscriptionModel extends AbstractSubscriptionModel * @constructor */ constructor(options, utils, formatters) { - super('shh_subscribe', 'messages', options, utils, formatters); + super( + 'shh_subscribe', + 'messages', + options, + utils, + formatters + ); } } From 6a99467735e8996f9cb49dfe0bf291e7d98b7a05 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 18 Oct 2018 13:06:55 +0200 Subject: [PATCH 0291/1045] static properties in web3 module ported to es6 --- packages/web3-eth/package.json | 2 +- packages/web3/src/index.js | 85 ++++++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 26 deletions(-) diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index e01ab5998c2..ce531a9ca42 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -6,7 +6,7 @@ "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth", "license": "LGPL-3.0", "main": "src/index.js", - "peerDependencies": { + "dependencies": { "web3-eth-contract": "1.0.0-beta.36", "web3-eth-accounts": "1.0.0-beta.36", "web3-eth-personal": "1.0.0-beta.36", diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 752ca26aecb..2082e11c653 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -75,34 +75,69 @@ export default class Web3 extends AbstractWeb3Module { this.bzz.setProvider(provider) ); } -} -Web3.givenProvider = ProvidersPackage.detect(); + /** + * Returns the detected provider + * + * @returns {Object} + */ + static get givenProvider() { + return ProvidersPackage.detect(); + } -Web3.version = version; + /** + * Returns the web3 version + * + * @returns {String} + */ + static get version() { + return version; + } -Web3.utils = Utils; + /** + * Returns the utils + * + * @returns {Utils} + */ + static get utils() { + return Utils; + } -Web3.modules = { - Eth(provider, net) { - return new Eth(ProvidersPackage.resolve(provider, net)); - }, - Net(provider, net) { - return new Network(ProvidersPackage.resolve(provider, net)); - }, - Personal(provider, net) { - return new Personal(ProvidersPackage.resolve(provider, net)); - }, - Shh(provider, net) { - return new Shh(ProvidersPackage.resolve(provider, net)); - }, - Bzz(provider, net) { - return new Bzz(ProvidersPackage.resolve(provider, net)); + /** + * Returns an object with all public web3 modules + * + * @returns {Object} + */ + static get modules() { + return { + Eth: (provider, net) => { + return new Eth(ProvidersPackage.resolve(provider, net)); + }, + Net: (provider, net) => { + return new Network(ProvidersPackage.resolve(provider, net)); + }, + Personal: (provider, net) => { + return new Personal(ProvidersPackage.resolve(provider, net)); + }, + Shh: (provider, net) => { + return new Shh(ProvidersPackage.resolve(provider, net)); + }, + Bzz: (provider, net) => { + return new Bzz(ProvidersPackage.resolve(provider, net)); + } + } } -}; -Web3.providers = { - HttpProvider: ProvidersPackage.HttpProvider, - WebsocketProvider: ProvidersPackage.WebsocketProvider, - IpcProvider: ProvidersPackage.IpcProvider -}; + /** + * Returns an object with all providers of web3 + * + * @returns {Object} + */ + static get providers() { + return { + HttpProvider: ProvidersPackage.HttpProvider, + WebsocketProvider: ProvidersPackage.WebsocketProvider, + IpcProvider: ProvidersPackage.IpcProvider + } + } +} From 9e374e725d9e73eb7f710392a3d0446190a652e0 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 18 Oct 2018 13:17:15 +0200 Subject: [PATCH 0292/1045] async/await added to CallMethodCommand and TransactionSigner --- .../src/commands/CallMethodCommand.js | 17 ++++++------- .../src/signers/TransactionSigner.js | 24 +++++++------------ 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 11bbf3b785e..5c94c89e4c7 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -31,15 +31,12 @@ export default class CallMethodCommand { * @param {AbstractMethodModel} methodModel * * @callback callback callback(error, result) - * @returns {Promise<*>} + * @returns {Promise} */ - execute(moduleInstance, methodModel) { - methodModel.beforeExecution(moduleInstance); - - return moduleInstance.currentProvider.send( - methodModel.rpcMethod, - methodModel.parameters - ).then(response => { + async execute(moduleInstance, methodModel) { + try { + methodModel.beforeExecution(moduleInstance); + const response = await moduleInstance.currentProvider.send(methodModel.rpcMethod, methodModel.parameters); const mappedResponse = methodModel.afterExecution(response); if (methodModel.callback) { @@ -47,10 +44,10 @@ export default class CallMethodCommand { } return mappedResponse; - }).catch(error => { + } catch (error) { if (methodModel.callback) { methodModel.callback(error, null); } - }); + } } } diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index be7505e2886..5d1b9541d40 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -32,25 +32,17 @@ export default class TransactionSigner extends AbstractSigner { * @param {Object} transaction * @param {Accounts} accounts * - * @returns {Promise} + * @returns {Promise} */ - sign(transaction, accounts) { - return new Promise((resolve, reject) => { - const wallet = this.getWallet(transaction.from, accounts); + async sign(transaction, accounts) { + const wallet = this.getWallet(transaction.from, accounts); - if (wallet && wallet.privateKey) { - delete transaction.from; + if (wallet && wallet.privateKey) { + delete transaction.from; - accounts.signTransaction(transaction, wallet.privateKey).then(response => { - resolve(response); - }).catch(error => { - reject(error); - }); + return await accounts.signTransaction(transaction, wallet.privateKey); + } - return; - } - - reject(new Error('Wallet or privateKey in wallet is not set!')); - }); + throw new Error('Wallet or privateKey in wallet is not set!'); } } From 904a55bf4918ef705a54dd89c72521897e206fad Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 18 Oct 2018 13:27:01 +0200 Subject: [PATCH 0293/1045] currentProvider property accessors ported to es6 accessors --- packages/web3-core/src/AbstractWeb3Module.js | 40 +++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/packages/web3-core/src/AbstractWeb3Module.js b/packages/web3-core/src/AbstractWeb3Module.js index ed310e2087a..a5bb1c9bc2a 100644 --- a/packages/web3-core/src/AbstractWeb3Module.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -32,7 +32,7 @@ export default class AbstractWeb3Module { * * @constructor */ - constructor(provider, providersPackage, methodController, methodModelFactory) { + constructor(provider, providersPackage, methodController, methodModelFactory = null) { if (!this.isDependencyGiven(provider)) { throw Error('No provider given as constructor parameter!'); } @@ -45,6 +45,7 @@ export default class AbstractWeb3Module { this.extendedPackages = []; this.providersPackage = providersPackage; this.givenProvider = this.providersPackage.detect(); + this._currentProvider = provider; this.providers = { HttpProvider: this.providersPackage.HttpProvider, @@ -52,17 +53,6 @@ export default class AbstractWeb3Module { WebsocketProvider: this.providersPackage.WebsocketProvider, }; - let currentProvider = provider; - - Object.defineProperty(this, 'currentProvider', { - get() { - return currentProvider; - }, - set() { - throw Error('The property currentProvider is an read-only property!'); - } - }); - this.BatchRequest = () => { return new this.providersPackage.BatchRequest(this.currentProvider); }; @@ -79,6 +69,28 @@ export default class AbstractWeb3Module { } } + /** + * Returns the currentProvider + * + * @property currentProvider + * + * @returns {*} + */ + get currentProvider() { + return this._currentProvider; + } + + /** + * Throws an error because currentProvider is read-only + * + * @property currentProvider + * + * @param value + */ + set currentProvider(value) { + throw Error('The property currentProvider is an read-only property!'); + } + /** * Sets the currentProvider and provider property * @@ -92,7 +104,7 @@ export default class AbstractWeb3Module { setProvider(provider, net) { if (!this.isSameProvider(provider)) { this.clearSubscriptions(); - this.currentProvider = this.providersPackage.resolve(provider, net); + this._currentProvider = this.providersPackage.resolve(provider, net); if (this.extendedPackages.length > 0) { var setExtendedPackagesProvider = this.extendedPackages.every(extendedPackage => { @@ -100,7 +112,7 @@ export default class AbstractWeb3Module { }); } - return !!(setExtendedPackagesProvider && this.currentProvider); + return !!(setExtendedPackagesProvider && this._currentProvider); } return false; From c1dfbb2cd7ffa1ead5d4e8f65c6ce7e2bcf52d6a Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 18 Oct 2018 13:51:35 +0200 Subject: [PATCH 0294/1045] basic jest setup --- packages/web3-core-method/.babelrc | 3 + packages/web3-core-method/package-lock.json | 6626 ++++++++++++++++-- packages/web3-core-method/package.json | 8 +- packages/web3-core/src/AbstractWeb3Module.js | 6 +- 4 files changed, 6054 insertions(+), 589 deletions(-) create mode 100644 packages/web3-core-method/.babelrc diff --git a/packages/web3-core-method/.babelrc b/packages/web3-core-method/.babelrc new file mode 100644 index 00000000000..0f4b58f6843 --- /dev/null +++ b/packages/web3-core-method/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["env"] +} diff --git a/packages/web3-core-method/package-lock.json b/packages/web3-core-method/package-lock.json index 0520e93e65c..0413b70bd3a 100644 --- a/packages/web3-core-method/package-lock.json +++ b/packages/web3-core-method/package-lock.json @@ -4,6 +4,34 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + } + } + }, "@sinonjs/commons": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.0.2.tgz", @@ -39,6 +67,12 @@ "integrity": "sha512-ZwTHAlC9akprWDinwEPD4kOuwaYZlyMwVJIANsKNC3QVp0AHB04m7RnB4eqeWfgmxw8MGTzS9uMaw93Z3QcZbw==", "dev": true }, + "abab": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz", + "integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==", + "dev": true + }, "accepts": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", @@ -48,6 +82,36 @@ "negotiator": "0.6.1" } }, + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + }, + "acorn-globals": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.0.tgz", + "integrity": "sha512-hMtHj3s5RnuhvHPowpBYvJVj3rAar82JiDQHvGs1zO0l10ocX/xEdBShNHTJaboucJUsScghp74pH3s7EnHHQw==", + "dev": true, + "requires": { + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" + }, + "dependencies": { + "acorn": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.2.tgz", + "integrity": "sha512-GXmKIvbrN3TV7aVqAzVFaMW8F8wzVX7voEBRO3bDA64+EX37YSayggRJP5Xig6HYHBkWKpFg9W5gg6orklubhg==", + "dev": true + } + } + }, + "acorn-walk": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.1.0.tgz", + "integrity": "sha512-ugTb7Lq7u4GfWSqqpwE0bGyoBZNMTok/zDBXxfEG0QM50jNlGhIWjRC1pPN7bvV1anhF+bs+/gNcRw+o55Evbg==", + "dev": true + }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -59,6 +123,367 @@ "json-schema-traverse": "^0.3.0" } }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "append-transform": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", + "integrity": "sha1-126/jKlNJ24keja61EpLdKthGZE=", + "dev": true, + "requires": { + "default-require-extensions": "^1.0.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -70,6 +495,18 @@ "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", "dev": true }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -89,6 +526,27 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, + "async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, "async-limiter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", @@ -99,6 +557,12 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -109,709 +573,3649 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "optional": true, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, "requires": { - "tweetnacl": "^0.14.3" + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } } }, - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" - }, - "body-parser": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "babel-core": { + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "dev": true, "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "~1.6.3", - "iconv-lite": "0.4.23", - "on-finished": "~2.3.0", - "qs": "6.5.2", - "raw-body": "2.3.3", - "type-is": "~1.6.16" + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.8", + "slash": "^1.0.0", + "source-map": "^0.5.7" }, "dependencies": { "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } } } }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "babel-generator": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", "dev": true, "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" } }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", + "dev": true, + "requires": { + "babel-helper-explode-assignable-expression": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } }, - "browserify-sha3": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", - "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "babel-helper-define-map": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", + "dev": true, "requires": { - "js-sha3": "^0.3.1" + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" } }, - "buffer-to-arraybuffer": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", - "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "dev": true, + "requires": { + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } }, - "chai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", - "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", "dev": true, "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.1.0", - "type-detect": "^4.0.5" + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + "babel-helper-regex": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } }, - "combined-stream": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", - "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "dev": true, "requires": { - "delayed-stream": "~1.0.0" + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "dev": true, + "requires": { + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-jest": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-23.6.0.tgz", + "integrity": "sha512-lqKGG6LYXYu+DQh/slrQ8nxXQkEkhugdXsU6St7GmhVS7Ilc/22ArwqXNJrf0QaOBjZB0360qZMwXqDYQHXaew==", + "dev": true, + "requires": { + "babel-plugin-istanbul": "^4.1.6", + "babel-preset-jest": "^23.2.0" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-istanbul": { + "version": "4.1.6", + "resolved": "http://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz", + "integrity": "sha512-PWP9FQ1AhZhS01T/4qLSKoHGY/xvkZdVBGlKM/HuxxS3+sC66HhTNR7+MpbO/so/cz/wY94MeSWJuP1hXIPfwQ==", + "dev": true, + "requires": { + "babel-plugin-syntax-object-rest-spread": "^6.13.0", + "find-up": "^2.1.0", + "istanbul-lib-instrument": "^1.10.1", + "test-exclude": "^4.2.1" } }, - "commander": { - "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "babel-plugin-jest-hoist": { + "version": "23.2.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-23.2.0.tgz", + "integrity": "sha1-5h+uBaHKiAGq3uV6bWa4zvr0QWc=", "dev": true }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", "dev": true }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", + "dev": true }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", + "dev": true }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", + "dev": true }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "dev": true, + "requires": { + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-functions": "^6.8.0", + "babel-runtime": "^6.22.0" + } }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } }, - "cors": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", - "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true, "requires": { - "object-assign": "^4", - "vary": "^1" + "babel-runtime": "^6.22.0" } }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", + "dev": true, "requires": { - "assert-plus": "^1.0.0" + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" } }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", "dev": true, "requires": { - "ms": "2.0.0" + "babel-helper-define-map": "^6.24.1", + "babel-helper-function-name": "^6.24.1", + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-helper-replace-supers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" } }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", + "dev": true, "requires": { - "mimic-response": "^1.0.0" + "babel-runtime": "^6.22.0" } }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", "dev": true, "requires": { - "type-detect": "^4.0.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } }, - "dom-walk": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", - "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.26.2", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz", + "integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==", + "dev": true, + "requires": { + "babel-plugin-transform-strict-mode": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-types": "^6.26.0" + } }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "optional": true, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", + "dev": true, "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" } }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-amd": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } }, - "elliptic": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", - "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", + "dev": true, "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "babel-helper-replace-supers": "^6.24.1", + "babel-runtime": "^6.22.0" } }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", + "dev": true, + "requires": { + "babel-helper-call-delegate": "^6.24.1", + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", + "dev": true, + "requires": { + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } }, - "eth-lib": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", - "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "dev": true, "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "keccakjs": "^0.2.1", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", - "xhr-request-promise": "^0.1.2" + "babel-runtime": "^6.22.0" } }, - "ethjs-unit": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", - "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", + "dev": true, "requires": { - "bn.js": "4.11.6", - "number-to-bn": "1.7.0" + "babel-runtime": "^6.22.0" } }, - "eventemitter3": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", - "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", + "dev": true, + "requires": { + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "regexpu-core": "^2.0.0" + } }, - "express": { - "version": "4.16.3", - "resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", + "babel-plugin-transform-exponentiation-operator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", + "dev": true, "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" + "babel-helper-builder-binary-assignment-operator-visitor": "^6.24.1", + "babel-plugin-syntax-exponentiation-operator": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-regenerator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", + "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", + "dev": true, + "requires": { + "regenerator-transform": "^0.10.0" + } + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-preset-env": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz", + "integrity": "sha512-9OR2afuKDneX2/q2EurSftUYM0xGu4O2D9adAhVfADDhrYDaxXV0rBbevVYoY9n6nyX1PmQW/0jtpJvUNr9CHg==", + "dev": true, + "requires": { + "babel-plugin-check-es2015-constants": "^6.22.0", + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-async-to-generator": "^6.22.0", + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoping": "^6.23.0", + "babel-plugin-transform-es2015-classes": "^6.23.0", + "babel-plugin-transform-es2015-computed-properties": "^6.22.0", + "babel-plugin-transform-es2015-destructuring": "^6.23.0", + "babel-plugin-transform-es2015-duplicate-keys": "^6.22.0", + "babel-plugin-transform-es2015-for-of": "^6.23.0", + "babel-plugin-transform-es2015-function-name": "^6.22.0", + "babel-plugin-transform-es2015-literals": "^6.22.0", + "babel-plugin-transform-es2015-modules-amd": "^6.22.0", + "babel-plugin-transform-es2015-modules-commonjs": "^6.23.0", + "babel-plugin-transform-es2015-modules-systemjs": "^6.23.0", + "babel-plugin-transform-es2015-modules-umd": "^6.23.0", + "babel-plugin-transform-es2015-object-super": "^6.22.0", + "babel-plugin-transform-es2015-parameters": "^6.23.0", + "babel-plugin-transform-es2015-shorthand-properties": "^6.22.0", + "babel-plugin-transform-es2015-spread": "^6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "^6.22.0", + "babel-plugin-transform-es2015-template-literals": "^6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "^6.23.0", + "babel-plugin-transform-es2015-unicode-regex": "^6.22.0", + "babel-plugin-transform-exponentiation-operator": "^6.22.0", + "babel-plugin-transform-regenerator": "^6.22.0", + "browserslist": "^3.2.6", + "invariant": "^2.2.2", + "semver": "^5.3.0" + } + }, + "babel-preset-jest": { + "version": "23.2.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-23.2.0.tgz", + "integrity": "sha1-jsegOhOPABoaj7HoETZSvxpV2kY=", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^23.2.0", + "babel-plugin-syntax-object-rest-spread": "^6.13.0" + } + }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true, + "requires": { + "babel-core": "^6.26.0", + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "home-or-tmp": "^2.0.0", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "source-map-support": "^0.4.15" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" }, "dependencies": { - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" - } - }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } + } + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - } - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" - } + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" } }, - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } } } }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browser-process-hrtime": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", + "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==", + "dev": true + }, + "browser-resolve": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", + "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", + "dev": true, + "requires": { + "resolve": "1.1.7" + } + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "browserslist": { + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz", + "integrity": "sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000844", + "electron-to-chromium": "^1.3.47" + } + }, + "bser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz", + "integrity": "sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk=", + "dev": true, + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30000893", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000893.tgz", + "integrity": "sha512-kOddHcTEef+NgN/fs0zmX2brHTNATVOWMEIhlZHCuwQRtXobjSw9pAECc44Op4bTBcavRjkLaPrGomknH7+Jvg==", + "dev": true + }, + "capture-exit": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-1.2.0.tgz", + "integrity": "sha1-HF/MSJ/QqwDU8ax64QcuMXP7q28=", + "dev": true, + "requires": { + "rsvp": "^3.3.3" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "ci-info": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", + "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", + "dev": true + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "convert-source-map": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", + "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "cssom": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", + "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==", + "dev": true + }, + "cssstyle": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.1.1.tgz", + "integrity": "sha512-364AI1l/M5TYcFH83JnOH/pSqgaNnKmYgKrm0didZMGKWjQB60dymwWy1rKUgL3J1ffdq9xVi2yGLHdSjjSNog==", + "dev": true, + "requires": { + "cssom": "0.3.x" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "data-urls": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.0.1.tgz", + "integrity": "sha512-0HdcMZzK6ubMUnsMmQmG0AcLQPvbvb47R0+7CCZQCYgcd8OUWG91CG7sM6GoXgjz+WLl4ArFzHtBMy/QqSF4eg==", + "dev": true, + "requires": { + "abab": "^2.0.0", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^7.0.0" + }, + "dependencies": { + "whatwg-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz", + "integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==", + "dev": true, + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + } + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "default-require-extensions": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz", + "integrity": "sha1-836hXT4T/9m0N9M+GnW1+5eHTLg=", + "dev": true, + "requires": { + "strip-bom": "^2.0.0" + } + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "detect-newline": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", + "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "dev": true, + "requires": { + "webidl-conversions": "^4.0.2" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "optional": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "electron-to-chromium": { + "version": "1.3.79", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.79.tgz", + "integrity": "sha512-LQdY3j4PxuUl6xfxiFruTSlCniTrTrzAd8/HfsLEMi0PUpaQ0Iy+Pr4N4VllDYjs0Hyu2lkTbvzqlG+PX9NsNw==", + "dev": true + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", + "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escodegen": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz", + "integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==", + "dev": true, + "requires": { + "esprima": "^3.1.3", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" + }, + "exec-sh": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.2.tgz", + "integrity": "sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw==", + "dev": true, + "requires": { + "merge": "^1.2.0" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "^2.1.0" + } + }, + "expect": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-23.6.0.tgz", + "integrity": "sha512-dgSoOHgmtn/aDGRVFWclQyPDKl2CQRq0hmIEoUAuQs/2rn2NcvCWcSCovm6BLeuB/7EZuLGu2QfnR+qRt5OM4w==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "jest-diff": "^23.6.0", + "jest-get-type": "^22.1.0", + "jest-matcher-utils": "^23.6.0", + "jest-message-util": "^23.4.0", + "jest-regex-util": "^23.3.0" + } + }, + "express": { + "version": "4.16.3", + "resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz", + "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.2", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.3", + "qs": "6.5.1", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.1", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "body-parser": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.1", + "http-errors": "~1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "~2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "~1.6.15" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": ">= 1.3.1 < 2" + } + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" + } + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fb-watchman": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", + "integrity": "sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg=", + "dev": true, + "requires": { + "bser": "^2.0.0" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fileset": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", + "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", + "dev": true, + "requires": { + "glob": "^7.0.3", + "minimatch": "^3.0.3" + } + }, + "fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "dev": true, + "requires": { + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" + } + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + } + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.21", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": "^2.1.0" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "minipass": { + "version": "2.2.4", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-buffer": { + "version": "5.1.1", + "bundled": true, + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.5.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true, + "dev": true + } + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", + "dev": true + }, + "handlebars": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz", + "integrity": "sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==", + "dev": true, + "requires": { + "async": "^2.5.0", + "optimist": "^0.6.1", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.1" + } + }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "dev": true, + "requires": { + "whatwg-encoding": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "import-local": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-1.0.0.tgz", + "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", + "dev": true, + "requires": { + "pkg-dir": "^2.0.0", + "resolve-cwd": "^2.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-ci": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", + "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", + "dev": true, + "requires": { + "ci-info": "^1.5.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "^2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-generator-fn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-1.0.0.tgz", + "integrity": "sha1-lp1J4bszKfa7fwkIm+JleLLd1Go=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + } + } + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "istanbul-api": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.3.7.tgz", + "integrity": "sha512-4/ApBnMVeEPG3EkSzcw25wDe4N66wxwn+KKn6b47vyek8Xb3NBAcg4xfuQbS7BqcZuTX4wxfD5lVagdggR3gyA==", + "dev": true, + "requires": { + "async": "^2.1.4", + "fileset": "^2.0.2", + "istanbul-lib-coverage": "^1.2.1", + "istanbul-lib-hook": "^1.2.2", + "istanbul-lib-instrument": "^1.10.2", + "istanbul-lib-report": "^1.1.5", + "istanbul-lib-source-maps": "^1.2.6", + "istanbul-reports": "^1.5.1", + "js-yaml": "^3.7.0", + "mkdirp": "^0.5.1", + "once": "^1.4.0" + } }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + "istanbul-lib-coverage": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.1.tgz", + "integrity": "sha512-PzITeunAgyGbtY1ibVIUiV679EFChHjoMNRibEIobvmrCRaIgwLxNucOSimtNWUhEib/oO7QY2imD75JVgCJWQ==", + "dev": true }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + "istanbul-lib-hook": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.2.2.tgz", + "integrity": "sha512-/Jmq7Y1VeHnZEQ3TL10VHyb564mn6VrQXHchON9Jf/AEcmQ3ZIiyD1BVzNOKTZf/G3gE+kiGK6SmpF9y3qGPLw==", + "dev": true, + "requires": { + "append-transform": "^0.4.0" + } }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "istanbul-lib-instrument": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.2.tgz", + "integrity": "sha512-aWHxfxDqvh/ZlxR8BBaEPVSWDPUkGD63VjGQn3jcw8jCp7sHEMKcrj4xfJn/ABzdMEHiQNyvDQhqm5o8+SQg7A==", + "dev": true, + "requires": { + "babel-generator": "^6.18.0", + "babel-template": "^6.16.0", + "babel-traverse": "^6.18.0", + "babel-types": "^6.18.0", + "babylon": "^6.18.0", + "istanbul-lib-coverage": "^1.2.1", + "semver": "^5.3.0" + } }, - "finalhandler": { - "version": "1.1.1", - "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "istanbul-lib-report": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.5.tgz", + "integrity": "sha512-UsYfRMoi6QO/doUshYNqcKJqVmFe9w51GZz8BS3WB0lYxAllQYklka2wP9+dGZeHYaWIdcXUx8JGdbqaoXRXzw==", + "dev": true, "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" + "istanbul-lib-coverage": "^1.2.1", + "mkdirp": "^0.5.1", + "path-parse": "^1.0.5", + "supports-color": "^3.1.2" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, "requires": { - "ms": "2.0.0" + "has-flag": "^1.0.0" } - }, - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" } } }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "istanbul-lib-source-maps": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.6.tgz", + "integrity": "sha512-TtbsY5GIHgbMsMiRw35YBHGpZ1DVFEO19vxxeiDMYaeOFOCzfnYVxvl6pOUIZR4dtPhAGpSMup8OyF8ubsaqEg==", + "dev": true, "requires": { - "is-callable": "^1.1.3" + "debug": "^3.1.0", + "istanbul-lib-coverage": "^1.2.1", + "mkdirp": "^0.5.1", + "rimraf": "^2.6.1", + "source-map": "^0.5.3" } }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + "istanbul-reports": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.5.1.tgz", + "integrity": "sha512-+cfoZ0UXzWjhAdzosCPP3AN8vvef8XDkWtTfgaN+7L3YTpNYITnCaEkceo5SEYy644VkHka/P1FvkWvrG/rrJw==", + "dev": true, + "requires": { + "handlebars": "^4.0.3" + } }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "jest": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-23.6.0.tgz", + "integrity": "sha512-lWzcd+HSiqeuxyhG+EnZds6iO3Y3ZEnMrfZq/OTGvF/C+Z4fPMCdhWTGSAiO2Oym9rbEXfwddHhh6jqrTF3+Lw==", + "dev": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" + "import-local": "^1.0.0", + "jest-cli": "^23.6.0" }, "dependencies": { - "combined-stream": { - "version": "1.0.6", - "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "jest-cli": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-23.6.0.tgz", + "integrity": "sha512-hgeD1zRUp1E1zsiyOXjEn4LzRLWdJBV//ukAHGlx6s5mfCNJTbhbHjgxnDUXA8fsKWN/HqFFF6X5XcCwC/IvYQ==", + "dev": true, "requires": { - "delayed-stream": "~1.0.0" + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "glob": "^7.1.2", + "graceful-fs": "^4.1.11", + "import-local": "^1.0.0", + "is-ci": "^1.0.10", + "istanbul-api": "^1.3.1", + "istanbul-lib-coverage": "^1.2.0", + "istanbul-lib-instrument": "^1.10.1", + "istanbul-lib-source-maps": "^1.2.4", + "jest-changed-files": "^23.4.2", + "jest-config": "^23.6.0", + "jest-environment-jsdom": "^23.4.0", + "jest-get-type": "^22.1.0", + "jest-haste-map": "^23.6.0", + "jest-message-util": "^23.4.0", + "jest-regex-util": "^23.3.0", + "jest-resolve-dependencies": "^23.6.0", + "jest-runner": "^23.6.0", + "jest-runtime": "^23.6.0", + "jest-snapshot": "^23.6.0", + "jest-util": "^23.4.0", + "jest-validate": "^23.6.0", + "jest-watcher": "^23.4.0", + "jest-worker": "^23.2.0", + "micromatch": "^2.3.11", + "node-notifier": "^5.2.1", + "prompts": "^0.1.9", + "realpath-native": "^1.0.0", + "rimraf": "^2.5.4", + "slash": "^1.0.0", + "string-length": "^2.0.0", + "strip-ansi": "^4.0.0", + "which": "^1.2.12", + "yargs": "^11.0.0" } } } }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true + "jest-changed-files": { + "version": "23.4.2", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-23.4.2.tgz", + "integrity": "sha512-EyNhTAUWEfwnK0Is/09LxoqNDOn7mU7S3EHskG52djOFS/z+IT0jT3h3Ql61+dklcG7bJJitIWEMB4Sp1piHmA==", + "dev": true, + "requires": { + "throat": "^4.0.0" + } }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "jest-config": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-23.6.0.tgz", + "integrity": "sha512-i8V7z9BeDXab1+VNo78WM0AtWpBRXJLnkT+lyT+Slx/cbP5sZJ0+NDuLcmBE5hXAoK0aUp7vI+MOxR+R4d8SRQ==", + "dev": true, "requires": { - "assert-plus": "^1.0.0" + "babel-core": "^6.0.0", + "babel-jest": "^23.6.0", + "chalk": "^2.0.1", + "glob": "^7.1.1", + "jest-environment-jsdom": "^23.4.0", + "jest-environment-node": "^23.4.0", + "jest-get-type": "^22.1.0", + "jest-jasmine2": "^23.6.0", + "jest-regex-util": "^23.3.0", + "jest-resolve": "^23.6.0", + "jest-util": "^23.4.0", + "jest-validate": "^23.6.0", + "micromatch": "^2.3.11", + "pretty-format": "^23.6.0" } }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "jest-diff": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-23.6.0.tgz", + "integrity": "sha512-Gz9l5Ov+X3aL5L37IT+8hoCUsof1CVYBb2QEkOupK64XyRR3h+uRpYIm97K7sY8diFxowR8pIGEdyfMKTixo3g==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "chalk": "^2.0.1", + "diff": "^3.2.0", + "jest-get-type": "^22.1.0", + "pretty-format": "^23.6.0" } }, - "global": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", - "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "jest-docblock": { + "version": "23.2.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-23.2.0.tgz", + "integrity": "sha1-8IXh8YVI2Z/dabICB+b9VdkTg6c=", + "dev": true, "requires": { - "min-document": "^2.19.0", - "process": "~0.5.1" + "detect-newline": "^2.1.0" } }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true + "jest-each": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-23.6.0.tgz", + "integrity": "sha512-x7V6M/WGJo6/kLoissORuvLIeAoyo2YqLOoCDkohgJ4XOXSqOtyvr8FbInlAWS77ojBsZrafbozWoKVRdtxFCg==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "pretty-format": "^23.6.0" + } }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + "jest-environment-jsdom": { + "version": "23.4.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-23.4.0.tgz", + "integrity": "sha1-BWp5UrP+pROsYqFAosNox52eYCM=", + "dev": true, + "requires": { + "jest-mock": "^23.2.0", + "jest-util": "^23.4.0", + "jsdom": "^11.5.1" + } }, - "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "jest-environment-node": { + "version": "23.4.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-23.4.0.tgz", + "integrity": "sha1-V+gO0IQd6jAxZ8zozXlSHeuv3hA=", + "dev": true, "requires": { - "ajv": "^5.3.0", - "har-schema": "^2.0.0" + "jest-mock": "^23.2.0", + "jest-util": "^23.4.0" } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "jest-get-type": { + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", + "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", "dev": true }, - "hash.js": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", - "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "jest-haste-map": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-23.6.0.tgz", + "integrity": "sha512-uyNhMyl6dr6HaXGHp8VF7cK6KpC6G9z9LiMNsst+rJIZ8l7wY0tk8qwjPmEghczojZ2/ZhtEdIabZ0OQRJSGGg==", + "dev": true, "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.1.11", + "invariant": "^2.2.4", + "jest-docblock": "^23.2.0", + "jest-serializer": "^23.0.1", + "jest-worker": "^23.2.0", + "micromatch": "^2.3.11", + "sane": "^2.0.0" } }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "jest-jasmine2": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-23.6.0.tgz", + "integrity": "sha512-pe2Ytgs1nyCs8IvsEJRiRTPC0eVYd8L/dXJGU08GFuBwZ4sYH/lmFDdOL3ZmvJR8QKqV9MFuwlsAi/EWkFUbsQ==", + "dev": true, "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" + "babel-traverse": "^6.0.0", + "chalk": "^2.0.1", + "co": "^4.6.0", + "expect": "^23.6.0", + "is-generator-fn": "^1.0.0", + "jest-diff": "^23.6.0", + "jest-each": "^23.6.0", + "jest-matcher-utils": "^23.6.0", + "jest-message-util": "^23.4.0", + "jest-snapshot": "^23.6.0", + "jest-util": "^23.4.0", + "pretty-format": "^23.6.0" } }, - "http-errors": { - "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "jest-leak-detector": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-23.6.0.tgz", + "integrity": "sha512-f/8zA04rsl1Nzj10HIyEsXvYlMpMPcy0QkQilVZDFOaPbv2ur71X5u2+C4ZQJGyV/xvVXtCCZ3wQ99IgQxftCg==", + "dev": true, "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" + "pretty-format": "^23.6.0" } }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "jest-matcher-utils": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-23.6.0.tgz", + "integrity": "sha512-rosyCHQfBcol4NsckTn01cdelzWLU9Cq7aaigDf8VwwpIRvWE/9zLgX2bON+FkEW69/0UuYslUe22SOdEf2nog==", + "dev": true, "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "chalk": "^2.0.1", + "jest-get-type": "^22.1.0", + "pretty-format": "^23.6.0" } }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "jest-message-util": { + "version": "23.4.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-23.4.0.tgz", + "integrity": "sha1-F2EMUJQjSVCNAaPR4L2iwHkIap8=", + "dev": true, "requires": { - "safer-buffer": ">= 2.1.2 < 3" + "@babel/code-frame": "^7.0.0-beta.35", + "chalk": "^2.0.1", + "micromatch": "^2.3.11", + "slash": "^1.0.0", + "stack-utils": "^1.0.1" } }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "jest-mock": { + "version": "23.2.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-23.2.0.tgz", + "integrity": "sha1-rRxg8p6HGdR8JuETgJi20YsmETQ=", + "dev": true + }, + "jest-regex-util": { + "version": "23.3.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-23.3.0.tgz", + "integrity": "sha1-X4ZylUfCeFxAAs6qj4Sf6MpHG8U=", + "dev": true + }, + "jest-resolve": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-23.6.0.tgz", + "integrity": "sha512-XyoRxNtO7YGpQDmtQCmZjum1MljDqUCob7XlZ6jy9gsMugHdN2hY4+Acz9Qvjz2mSsOnPSH7skBmDYCHXVZqkA==", "dev": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "browser-resolve": "^1.11.3", + "chalk": "^2.0.1", + "realpath-native": "^1.0.0" } }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "jest-resolve-dependencies": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-23.6.0.tgz", + "integrity": "sha512-EkQWkFWjGKwRtRyIwRwI6rtPAEyPWlUC2MpzHissYnzJeHcyCn1Hc8j7Nn1xUVrS5C6W5+ZL37XTem4D4pLZdA==", + "dev": true, + "requires": { + "jest-regex-util": "^23.3.0", + "jest-snapshot": "^23.6.0" + } }, - "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + "jest-runner": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-23.6.0.tgz", + "integrity": "sha512-kw0+uj710dzSJKU6ygri851CObtCD9cN8aNkg8jWJf4ewFyEa6kwmiH/r/M1Ec5IL/6VFa0wnAk6w+gzUtjJzA==", + "dev": true, + "requires": { + "exit": "^0.1.2", + "graceful-fs": "^4.1.11", + "jest-config": "^23.6.0", + "jest-docblock": "^23.2.0", + "jest-haste-map": "^23.6.0", + "jest-jasmine2": "^23.6.0", + "jest-leak-detector": "^23.6.0", + "jest-message-util": "^23.4.0", + "jest-runtime": "^23.6.0", + "jest-util": "^23.4.0", + "jest-worker": "^23.2.0", + "source-map-support": "^0.5.6", + "throat": "^4.0.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz", + "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + } + } }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + "jest-runtime": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-23.6.0.tgz", + "integrity": "sha512-ycnLTNPT2Gv+TRhnAYAQ0B3SryEXhhRj1kA6hBPSeZaNQkJ7GbZsxOLUkwg6YmvWGdX3BB3PYKFLDQCAE1zNOw==", + "dev": true, + "requires": { + "babel-core": "^6.0.0", + "babel-plugin-istanbul": "^4.1.6", + "chalk": "^2.0.1", + "convert-source-map": "^1.4.0", + "exit": "^0.1.2", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.1.11", + "jest-config": "^23.6.0", + "jest-haste-map": "^23.6.0", + "jest-message-util": "^23.4.0", + "jest-regex-util": "^23.3.0", + "jest-resolve": "^23.6.0", + "jest-snapshot": "^23.6.0", + "jest-util": "^23.4.0", + "jest-validate": "^23.6.0", + "micromatch": "^2.3.11", + "realpath-native": "^1.0.0", + "slash": "^1.0.0", + "strip-bom": "3.0.0", + "write-file-atomic": "^2.1.0", + "yargs": "^11.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } }, - "is-function": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", - "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + "jest-serializer": { + "version": "23.0.1", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-23.0.1.tgz", + "integrity": "sha1-o3dq6zEekP6D+rnlM+hRAr0WQWU=", + "dev": true }, - "is-hex-prefixed": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + "jest-snapshot": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-23.6.0.tgz", + "integrity": "sha512-tM7/Bprftun6Cvj2Awh/ikS7zV3pVwjRYU2qNYS51VZHgaAMBs5l4o/69AiDHhQrj5+LA2Lq4VIvK7zYk/bswg==", + "dev": true, + "requires": { + "babel-types": "^6.0.0", + "chalk": "^2.0.1", + "jest-diff": "^23.6.0", + "jest-matcher-utils": "^23.6.0", + "jest-message-util": "^23.4.0", + "jest-resolve": "^23.6.0", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "pretty-format": "^23.6.0", + "semver": "^5.5.0" + } }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + "jest-util": { + "version": "23.4.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-23.4.0.tgz", + "integrity": "sha1-TQY8uSe68KI4Mf9hvsLLv0l5NWE=", + "dev": true, + "requires": { + "callsites": "^2.0.0", + "chalk": "^2.0.1", + "graceful-fs": "^4.1.11", + "is-ci": "^1.0.10", + "jest-message-util": "^23.4.0", + "mkdirp": "^0.5.1", + "slash": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true + "jest-validate": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-23.6.0.tgz", + "integrity": "sha512-OFKapYxe72yz7agrDAWi8v2WL8GIfVqcbKRCLbRG9PAxtzF9b1SEDdTpytNDN12z2fJynoBwpMpvj2R39plI2A==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "jest-get-type": "^22.1.0", + "leven": "^2.1.0", + "pretty-format": "^23.6.0" + } }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + "jest-watcher": { + "version": "23.4.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-23.4.0.tgz", + "integrity": "sha1-0uKM50+NrWxq/JIrksq+9u0FyRw=", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "string-length": "^2.0.0" + } + }, + "jest-worker": { + "version": "23.2.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-23.2.0.tgz", + "integrity": "sha1-+vcGqNo2+uYOsmlXJX+ntdjqArk=", + "dev": true, + "requires": { + "merge-stream": "^1.0.1" + } }, "js-sha3": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "optional": true }, + "jsdom": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", + "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", + "dev": true, + "requires": { + "abab": "^2.0.0", + "acorn": "^5.5.3", + "acorn-globals": "^4.1.0", + "array-equal": "^1.0.0", + "cssom": ">= 0.3.2 < 0.4.0", + "cssstyle": "^1.0.0", + "data-urls": "^1.0.0", + "domexception": "^1.0.1", + "escodegen": "^1.9.1", + "html-encoding-sniffer": "^1.0.2", + "left-pad": "^1.3.0", + "nwsapi": "^2.0.7", + "parse5": "4.0.0", + "pn": "^1.1.0", + "request": "^2.87.0", + "request-promise-native": "^1.0.5", + "sax": "^1.2.4", + "symbol-tree": "^3.2.2", + "tough-cookie": "^2.3.4", + "w3c-hr-time": "^1.0.1", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.3", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^6.4.1", + "ws": "^5.2.0", + "xml-name-validator": "^3.0.0" + }, + "dependencies": { + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + } + } + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -827,6 +4231,12 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json5": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -853,33 +4263,208 @@ "sha3": "^1.1.0" } }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "kleur": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-2.0.2.tgz", + "integrity": "sha512-77XF9iTllATmG9lSlIv0qdQ2BQ/h9t0bJllHlbvsQ0zUWfU7Yi0S8L5JXzPZgkefIiajLmBJJ4BsMJmqcf7oxQ==", + "dev": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "left-pad": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==", + "dev": true + }, + "leven": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", + "dev": true + }, "lolex": { "version": "2.7.5", "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", "dev": true }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "lru-cache": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "makeerror": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", + "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "dev": true, + "requires": { + "tmpl": "1.0.x" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "math-random": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", + "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", + "dev": true + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "merge": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz", + "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=", + "dev": true + }, "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" }, + "merge-stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", + "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", + "dev": true, + "requires": { + "readable-stream": "^2.0.1" + } + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + }, "mime": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", @@ -898,6 +4483,12 @@ "mime-db": "~1.36.0" } }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, "mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", @@ -936,6 +4527,27 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, "mkdirp": { "version": "0.5.1", "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -945,25 +4557,6 @@ "minimist": "0.0.8" } }, - "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", - "dev": true, - "requires": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -979,6 +4572,51 @@ "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "negotiator": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", @@ -1008,39 +4646,278 @@ } } }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", + "dev": true + }, + "node-notifier": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.2.1.tgz", + "integrity": "sha512-MIBs+AAd6dJ2SklbbE8RUDRlIVhU8MaNLh1A9SUZDUHPiZkWLFde6UNwG41yQHZEToHgJMXqyVZ9UcS/ReOVTg==", + "dev": true, + "requires": { + "growly": "^1.3.0", + "semver": "^5.4.1", + "shellwords": "^0.1.1", + "which": "^1.3.0" + } + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, "number-to-bn": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", "requires": { - "bn.js": "4.11.6", - "strip-hex-prefix": "1.0.0" + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "nwsapi": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.9.tgz", + "integrity": "sha512-nlWFSCTYQcHk/6A9FFnfhKc14c3aFhfdNBXgo8Qgi9QTBu/qg3Ww+Uiz9wMzXd1T8GFxPc2QIHB6Qtf2XFryFQ==", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "object-keys": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + }, + "dependencies": { + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + } + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" } }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, "requires": { - "ee-first": "1.1.1" + "p-try": "^1.0.0" } }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, "requires": { - "wrappy": "1" + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" } }, "parse-headers": { @@ -1052,22 +4929,72 @@ "trim": "0.0.1" } }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "parse5": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", + "dev": true + }, "parseurl": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, "pathval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", @@ -1079,11 +5006,105 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, + "pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "pretty-format": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-23.6.0.tgz", + "integrity": "sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw==", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0", + "ansi-styles": "^3.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + } + } + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, "process": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "prompts": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-0.1.14.tgz", + "integrity": "sha512-rxkyiE9YH6zAz/rZpywySLKkpaj0NMVyNw1qhsubdbjjSgcayjTShDreZGlFMcGSu5sab3bAKPfFk78PB90+8w==", + "dev": true, + "requires": { + "kleur": "^2.0.1", + "sisteransi": "^0.1.1" + } + }, "proxy-addr": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", @@ -1093,6 +5114,12 @@ "ipaddr.js": "1.8.0" } }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, "psl": { "version": "1.1.29", "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", @@ -1118,6 +5145,31 @@ "strict-uri-encode": "^1.0.0" } }, + "randomatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.0.tgz", + "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", + "dev": true, + "requires": { + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, "randomhex": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", @@ -1139,50 +5191,636 @@ "unpipe": "1.0.0" } }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + } + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + } + } + }, + "realpath-native": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.0.2.tgz", + "integrity": "sha512-+S3zTvVt9yTntFrBpm7TQmQ3tzpCrnA1a/y+3cUHAc9ZR6aIjG0WNLR+Rj79QpJktY+VeW/TQtFlQ1bzsehI8g==", + "dev": true, + "requires": { + "util.promisify": "^1.0.0" + } + }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + }, + "regenerator-transform": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", + "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", + "dev": true, + "requires": { + "babel-runtime": "^6.18.0", + "babel-types": "^6.19.0", + "private": "^0.1.6" + } + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "^0.1.3" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true, + "requires": { + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, "request": { "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "request-promise-core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", + "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", + "dev": true, + "requires": { + "lodash": "^4.13.1" + } + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "dev": true, + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "^1.1.0", + "tough-cookie": ">=2.3.3" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" } }, + "rsvp": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.6.2.tgz", + "integrity": "sha512-OfWGQTb9vnwRjwtA2QwpG2ICclHC3pgXZO5xt8H2EfgDquO0qVdSb5T88L4qJVAEugbS56pAuV4XZM58UX8ulw==", + "dev": true + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "sane": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/sane/-/sane-2.5.2.tgz", + "integrity": "sha1-tNwYYcIbQn6SlQej51HiosuKs/o=", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "capture-exit": "^1.2.0", + "exec-sh": "^0.2.0", + "fb-watchman": "^2.0.0", + "fsevents": "^1.2.3", + "micromatch": "^3.1.4", + "minimist": "^1.1.1", + "walker": "~1.0.5", + "watch": "~0.18.0" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, "send": { "version": "0.16.2", "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", @@ -1241,6 +5879,35 @@ "xhr": "^2.3.3" } }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", @@ -1254,6 +5921,33 @@ "nan": "2.10.0" } }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, "simple-concat": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", @@ -1297,6 +5991,216 @@ } } }, + "sisteransi": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-0.1.1.tgz", + "integrity": "sha512-PmGOd02bM9YO5ifxpw36nrNMBTptEtfRl4qUYl9SndkolplkrZZOW7PGHjrZL53QvMVj9nQ+TKqUnRsw4tJa4g==", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "^0.5.6" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "spdx-correct": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz", + "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", + "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, "sshpk": { "version": "1.14.2", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", @@ -1313,16 +6217,110 @@ "tweetnacl": "~0.14.0" } }, + "stack-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.1.tgz", + "integrity": "sha1-1PM6tU6OOHeLDKXP07OvsS22hiA=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, "statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true + }, "strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" }, + "string-length": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", + "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", + "dev": true, + "requires": { + "astral-regex": "^1.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + } + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, "strip-hex-prefix": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", @@ -1340,17 +6338,96 @@ "has-flag": "^3.0.0" } }, + "symbol-tree": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", + "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=", + "dev": true + }, + "test-exclude": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.2.3.tgz", + "integrity": "sha512-SYbXgY64PT+4GAL2ocI3HwPa4Q4TBKm0cwAVeKOt/Aoc0gSpNRjJX8w0pA1LMKZ3LBmd8pYBqApFNQLII9kavA==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "micromatch": "^2.3.11", + "object-assign": "^4.1.0", + "read-pkg-up": "^1.0.1", + "require-main-filename": "^1.0.1" + } + }, "text-encoding": { "version": "0.6.4", "resolved": "http://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", "dev": true }, + "throat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", + "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", + "dev": true + }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" }, + "tmpl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", + "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + } + } + }, "tough-cookie": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", @@ -1360,11 +6437,34 @@ "punycode": "^1.4.1" } }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "dev": true, + "requires": { + "punycode": "^2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + } + } + }, "trim": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -1379,6 +6479,15 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "optional": true }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -1394,6 +6503,33 @@ "mime-types": "~2.1.18" } }, + "uglify-js": { + "version": "3.4.9", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", + "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", + "dev": true, + "optional": true, + "requires": { + "commander": "~2.17.1", + "source-map": "~0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "dev": true, + "optional": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true + } + } + }, "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", @@ -1404,21 +6540,136 @@ "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, "url-set-query": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, "utf8": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -1429,6 +6680,16 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -1444,6 +6705,42 @@ "extsprintf": "^1.2.0" } }, + "w3c-hr-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", + "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "dev": true, + "requires": { + "browser-process-hrtime": "^0.1.2" + } + }, + "walker": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", + "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "dev": true, + "requires": { + "makeerror": "1.0.x" + } + }, + "watch": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/watch/-/watch-0.18.0.tgz", + "integrity": "sha1-KAlUdsbffJDJYxOJkMClQj60uYY=", + "dev": true, + "requires": { + "exec-sh": "^0.2.0", + "minimist": "^1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, "web3-core-helpers": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", @@ -1491,11 +6788,127 @@ } } }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true + }, + "whatwg-encoding": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", + "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", + "dev": true, + "requires": { + "iconv-lite": "0.4.24" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } + } + }, + "whatwg-mimetype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.2.0.tgz", + "integrity": "sha512-5YSO1nMd5D1hY3WzAQV3PzZL83W3YeyR1yW9PcH26Weh1t+Vzh9B6XkDh7aXm83HBZ4nSMvkjvN2H2ySWIvBgw==", + "dev": true + }, + "whatwg-url": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", + "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", + "dev": true, + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, "ws": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", @@ -1539,10 +6952,57 @@ "xhr-request": "^1.0.1" } }, + "xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", + "dev": true + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "11.1.0", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", + "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^9.0.2" + } + }, + "yargs-parser": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", + "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } } } } diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 233a6fb42cb..13d67c23bde 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -7,7 +7,7 @@ "license": "LGPL-3.0", "main": "src/index.js", "scripts": { - "test": "mocha './tests/**/*.js'" + "test": "jest" }, "dependencies": { "eventemitter3": "3.1.0", @@ -21,8 +21,12 @@ "web3-eth-contract": "1.0.0-beta.36" }, "devDependencies": { + "babel-preset-env": "^1.7.0", "chai": "^4.2.0", - "mocha": "^5.2.0", + "jest": "^23.6.0", "sinon": "^6.3.5" + }, + "jest": { + "testMatch": ["**/**.js"] } } diff --git a/packages/web3-core/src/AbstractWeb3Module.js b/packages/web3-core/src/AbstractWeb3Module.js index a5bb1c9bc2a..43d791fed58 100644 --- a/packages/web3-core/src/AbstractWeb3Module.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -74,7 +74,7 @@ export default class AbstractWeb3Module { * * @property currentProvider * - * @returns {*} + * @returns {AbstractProviderAdapter|EthereumProvider} */ get currentProvider() { return this._currentProvider; @@ -84,11 +84,9 @@ export default class AbstractWeb3Module { * Throws an error because currentProvider is read-only * * @property currentProvider - * - * @param value */ set currentProvider(value) { - throw Error('The property currentProvider is an read-only property!'); + throw Error('The property currentProvider read-only!'); } /** From 4cb4032b72c8ee3fdf7b8b9d72ed1c613a08f9ab Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 18 Oct 2018 14:06:28 +0200 Subject: [PATCH 0295/1045] jest configured --- packages/web3-core-method/package.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 13d67c23bde..fafe07a7722 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -24,9 +24,15 @@ "babel-preset-env": "^1.7.0", "chai": "^4.2.0", "jest": "^23.6.0", - "sinon": "^6.3.5" }, "jest": { - "testMatch": ["**/**.js"] + "notifyMode": "success-change", + "notify": true, + "coverageDirectory": "./coverage", + "collectCoverage": true, + "collectCoverageFrom": ["**/**.js"], + "clearMocks": true, + "bail": true, + "testMatch": ["tests/**/**.js"] } } From b70bf7ee027786a30fc4d8ad9bead6dceab5cad4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 18 Oct 2018 14:16:01 +0200 Subject: [PATCH 0296/1045] coverage folder added to gitignore, jest testMatch pattern fixed --- .gitignore | 1 + packages/web3-core-method/package.json | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 899cf946489..5efe423f5a5 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ bower_components .idea/ .npm/ .vscode/ +coverage/ lerna-debug.log dist/ !./dist/web3.min.js diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index fafe07a7722..30f70e7730f 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -23,7 +23,7 @@ "devDependencies": { "babel-preset-env": "^1.7.0", "chai": "^4.2.0", - "jest": "^23.6.0", + "jest": "^23.6.0" }, "jest": { "notifyMode": "success-change", @@ -32,7 +32,8 @@ "collectCoverage": true, "collectCoverageFrom": ["**/**.js"], "clearMocks": true, + "testMatch": ["/**/**Test.js"], "bail": true, - "testMatch": ["tests/**/**.js"] + "testPathIgnorePatterns": [] } } From 7d62c3aa79823f0e04cf31a3e49cf5f6031c6c82 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Thu, 18 Oct 2018 14:28:41 +0200 Subject: [PATCH 0297/1045] removed undefined config property from package.json --- packages/web3-core-method/package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 30f70e7730f..57dc79cd8d6 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -2,7 +2,7 @@ "name": "web3-core-method", "namespace": "ethereum", "version": "1.0.0-beta.36", - "description": "Creates the methods on the web3 modules. This is an internal package.", + "description": "Handles the JSON-RPC methods. This package is internally used by web3.", "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-method", "license": "LGPL-3.0", "main": "src/index.js", @@ -33,7 +33,6 @@ "collectCoverageFrom": ["**/**.js"], "clearMocks": true, "testMatch": ["/**/**Test.js"], - "bail": true, - "testPathIgnorePatterns": [] + "bail": true } } From 9dca9faaf9be11f6a25d0efd9aca619eef0226a4 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 19 Oct 2018 14:44:10 +0200 Subject: [PATCH 0298/1045] testing of jest, *PackageFactory renamed to *ModuleFactory, module factories added in some modules, index.js of all modules refactored to a more OOP way --- package.json | 79 -- packages/web3-core-method/package.json | 4 - .../src/commands/SendMethodCommand.js | 11 + ...ckageFactory.js => MethodModuleFactory.js} | 4 +- packages/web3-core-method/src/index.js | 4 +- .../models/TransactionConfirmationModel.js | 1 - .../tests/commands/CallMethodCommandTest.js | 30 +- .../tests/commands/SignMessageCommandTest.js | 26 +- .../factories/MethodPackageFactoryTest.js | 4 +- .../src/Subscription.js | 3 +- .../factories/SubscriptionsModuleFactory.js | 40 + packages/web3-core-subscriptions/src/index.js | 4 +- packages/web3-core/.babelrc | 3 + packages/web3-core/src/index.js | 2 +- .../src/factories/ABIModuleFactory.js | 39 + packages/web3-eth-abi/src/index.js | 6 +- packages/web3-eth-accounts/src/Accounts.js | 8 +- .../src/factories/AccountsModuleFactory.js | 49 + packages/web3-eth-accounts/src/index.js | 6 +- packages/web3-eth-contract/src/Contract.js | 9 +- .../src/decoders/AllEventsLogDecoder.js | 6 +- ...ageFactory.js => ContractModuleFactory.js} | 4 +- packages/web3-eth-contract/src/index.js | 4 +- .../src/mappers/ABIMapper.js | 2 +- .../models/methods/CallContractMethodModel.js | 5 +- .../methods/ContractDeployMethodModel.js | 7 +- .../methods/PastEventLogsMethodModel.js | 6 +- .../models/methods/SendContractMethodModel.js | 6 +- .../subscriptions/AllEventsLogSubscription.js | 9 +- .../subscriptions/EventLogSubscription.js | 9 +- packages/web3-eth-personal/src/Personal.js | 7 +- .../src/factories/MethodModelFactory.js | 26 +- .../src/factories/PersonalModuleFactory.js | 78 ++ packages/web3-eth-personal/src/index.js | 8 +- packages/web3-eth/src/Eth.js | 7 +- .../src/factories/EthModuleFactory.js | 101 ++ .../src/factories/MethodModelFactory.js | 66 +- packages/web3-eth/src/index.js | 16 +- packages/web3-net/src/Network.js | 8 +- .../src/factories/MethodModelFactory.js | 17 +- .../src/factories/NetworkModuleFactory.js | 71 + packages/web3-net/src/index.js | 10 +- packages/web3-providers/.babelrc | 3 + packages/web3-providers/package-lock.json | 1152 +++++++++++++++++ ...geFactory.js => ProvidersModuleFactory.js} | 17 +- packages/web3-providers/src/index.js | 45 +- .../src/mappers/JSONRpcMapper.js | 8 +- .../src/providers/HttpProvider.js | 3 +- .../src/resolvers/ProviderAdapterResolver.js | 2 +- .../src/factories/ShhModuleFactory.js | 67 + 50 files changed, 1844 insertions(+), 258 deletions(-) rename packages/web3-core-method/src/factories/{MethodPackageFactory.js => MethodModuleFactory.js} (98%) create mode 100644 packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js create mode 100644 packages/web3-core/.babelrc create mode 100644 packages/web3-eth-abi/src/factories/ABIModuleFactory.js create mode 100644 packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js rename packages/web3-eth-contract/src/factories/{ContractPackageFactory.js => ContractModuleFactory.js} (99%) create mode 100644 packages/web3-eth-personal/src/factories/PersonalModuleFactory.js create mode 100644 packages/web3-eth/src/factories/EthModuleFactory.js create mode 100644 packages/web3-net/src/factories/NetworkModuleFactory.js create mode 100644 packages/web3-providers/.babelrc create mode 100644 packages/web3-providers/package-lock.json rename packages/web3-providers/src/factories/{ProvidersPackageFactory.js => ProvidersModuleFactory.js} (89%) create mode 100644 packages/web3-shh/src/factories/ShhModuleFactory.js diff --git a/package.json b/package.json index ea98224c0e9..62fbc58e231 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,4 @@ { -<<<<<<< HEAD "name": "web3", "namespace": "ethereum", "version": "1.0.0-beta.36", @@ -9,49 +8,6 @@ "directories": { "doc": "./doc", "test": "./test" -======= - "name": "web3", - "private": true, - "namespace": "ethereum", - "version": "1.0.0-beta.36", - "description": "Ethereum JavaScript API wrapper repository", - "license": "LGPL-3.0", - "main": "./packages/web3/src/index.js", - "directories": { - "doc": "./doc", - "test": "./test" - }, - "scripts": { - "postinstall": "lerna bootstrap", - "build": "gulp", - "build-all": "gulp all", - "release": "lerna bootstrap; lerna publish; gulp version; gulp; gulp publishTag; git push --tags", - "watch": "gulp watch", - "docs": "cd docs; make html;", - "lint": "jshint *.js packages", - "test": "mocha; jshint *.js packages", - "test-coveralls": "istanbul cover _mocha -- -R spec && cat coverage/lcov.info | coveralls --verbose" - }, - "repository": { - "type": "git", - "url": "https://github.com/ethereum/web3.js.git" - }, - "homepage": "https://github.com/ethereum/web3.js", - "bugs": { - "url ": "https://github.com/ethereum/web3.js/issues" - }, - "keywords": [ - "Ethereum", - "JavaScript", - "API" - ], - "author": "ethereum.org", - "authors": [ - { - "name": "Fabian Vogelsteller", - "email": "fabian@ethereum.org", - "homepage": "http://frozeman.de" ->>>>>>> 1.0 }, "scripts": { "postinstall": "lerna bootstrap", @@ -142,39 +98,4 @@ "underscore": "^1.8.3", "vinyl-source-stream": "^2.0.0" } -<<<<<<< HEAD -======= - ], - "devDependencies": { - "@types/bignumber.js": "^4.0.2", - "@types/underscore": "^1.8.0", - "babel-preset-env": "^1.6.0", - "bignumber.js": "^4.0.0", - "bluebird": "3.3.1", - "bn.js": "^4.11.8", - "bower": ">=1.4.1", - "browserify": "^14.4.0", - "chai": "^4.0.0", - "coveralls": "^3.0.2", - "crypto-js": "^3.1.4", - "del": ">=2.0.2", - "ethereumjs-wallet": "^0.6.2", - "ethjs-signer": "^0.1.1", - "exorcist": "^0.4.0", - "gulp": "^4.0.0", - "gulp-babel": "^6.1.2", - "gulp-jshint": "^2.0.4", - "gulp-rename": "^1.2.2", - "gulp-replace": "^0.6.1", - "gulp-streamify": "^1.0.2", - "gulp-uglify": "^3.0.0", - "istanbul": "^0.4.4", - "jshint": "^2.9.6", - "lerna": "^2.5.1", - "mocha": ">=2.3.3", - "sandboxed-module": "^2.0.2", - "underscore": "^1.8.3", - "vinyl-source-stream": "^2.0.0" - } ->>>>>>> 1.0 } diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index 57dc79cd8d6..da0078c5b27 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -22,15 +22,11 @@ }, "devDependencies": { "babel-preset-env": "^1.7.0", - "chai": "^4.2.0", "jest": "^23.6.0" }, "jest": { "notifyMode": "success-change", "notify": true, - "coverageDirectory": "./coverage", - "collectCoverage": true, - "collectCoverageFrom": ["**/**.js"], "clearMocks": true, "testMatch": ["/**/**Test.js"], "bail": true diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 5836dd6a25e..6d8319b7286 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -66,6 +66,17 @@ export default class SendMethodCommand extends AbstractSendMethodCommand { return promiEvent; } + /** + * Sends the JSON-RPC method + * + * @method send + * + * @param {AbstractMethodModel} methodModel + * @param {PromiEvent} promiEvent + * @param {AbstractWeb3Module} moduleInstance + * + * @returns {PromiEvent} + */ send(methodModel, promiEvent, moduleInstance) { moduleInstance.currentProvider.send( methodModel.rpcMethod, diff --git a/packages/web3-core-method/src/factories/MethodPackageFactory.js b/packages/web3-core-method/src/factories/MethodModuleFactory.js similarity index 98% rename from packages/web3-core-method/src/factories/MethodPackageFactory.js rename to packages/web3-core-method/src/factories/MethodModuleFactory.js index 3657a2ba557..c51e416c131 100644 --- a/packages/web3-core-method/src/factories/MethodPackageFactory.js +++ b/packages/web3-core-method/src/factories/MethodModuleFactory.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file MethodPackageFactory.js + * @file MethodModuleFactory.js * @author Samuel Furter * @date 2018 */ @@ -32,7 +32,7 @@ import SendMethodCommand from '../commands/SendMethodCommand'; import SignAndSendMethodCommand from '../commands/SignAndSendMethodCommand'; import SignMessageCommand from '../commands/SignMessageCommand'; -export default class MethodPackageFactory { +export default class MethodModuleFactory { /** * Returns the MethodController object diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index ab5ebd25240..61eda07ed6f 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -21,7 +21,7 @@ * @date 2018 */ -import MethodPackageFactory from './factories/MethodPackageFactory'; +import MethodModuleFactory from './factories/MethodModuleFactory'; import * as PromiEventPackage from 'web3-core-promievent'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {formatters} from 'web3-core-helpers'; @@ -34,7 +34,7 @@ import {formatters} from 'web3-core-helpers'; * @returns {MethodController} */ export const MethodController = () => { - return new MethodPackageFactory().createMethodController( + return new MethodModuleFactory().createMethodController( PromiEventPackage, new SubscriptionsFactory(), formatters diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index 6a2682186d0..e8eeee97858 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -55,7 +55,6 @@ export default class TransactionConfirmationModel { this._pollingTimeout = value; } - /** * Adds a receipt to the confirmation array * diff --git a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js index 2898bf8cbaf..c8c4a165774 100644 --- a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js @@ -1,11 +1,9 @@ -var chai = require('chai'); -var sinon = require('sinon').createSandbox(); -var expect = chai.expect; - -var CallMethodCommand = require('../../src/commands/CallMethodCommand'); -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); -var ProvidersPackage = require('web3-providers'); -var AbstractWeb3Module = require('web3-core').AbstractWeb3Module; +import * as sinonLib from 'sinon'; +const sinon = sinonLib.createSandbox(); +import CallMethodCommand from '../../src/commands/CallMethodCommand'; +import AbstractMethodModel from '../../lib/models/AbstractMethodModel'; +import {WebsocketProvider, SocketProviderAdapter} from 'web3-providers'; +import AbstractWeb3Module from 'web3-core'; /** * CallMethodCommand test @@ -22,10 +20,10 @@ describe('CallMethodCommandTest', function () { methodModelMock; beforeEach(function () { - provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); + provider = new WebsocketProvider('ws://127.0.0.1', {}); providerMock = sinon.mock(provider); - providerAdapter = new ProvidersPackage.SocketProviderAdapter(provider); + providerAdapter = new SocketProviderAdapter(provider); providerAdapterMock = sinon.mock(providerAdapter); moduleInstance = new AbstractWeb3Module(providerAdapter, ProvidersPackage, null, null); @@ -64,10 +62,10 @@ describe('CallMethodCommandTest', function () { .once(); var returnValue = await callMethodCommand.execute(moduleInstance, methodModel); - expect(returnValue).to.equal('0x0'); + expect(returnValue).toBe('0x0'); - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith(false, '0x0')).to.be.true; + expect(methodModelCallbackSpy.calledOnce).toBeTruthy(); + expect(methodModelCallbackSpy.calledWith(false, '0x0')).toBeTruthy(); methodModelMock.verify(); providerAdapterMock.verify(); @@ -91,11 +89,11 @@ describe('CallMethodCommandTest', function () { try { await callMethodCommand.execute(moduleInstance, methodModel); } catch (error) { - expect(error).to.equal('error'); + expect(error).toBe('error'); } - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith('error', null)).to.be.true; + expect(methodModelCallbackSpy.calledOnce).toBeTruthy(); + expect(methodModelCallbackSpy.calledWith('error', null)).toBeTruthy(); methodModelMock.verify(); providerAdapterMock.verify(); diff --git a/packages/web3-core-method/tests/commands/SignMessageCommandTest.js b/packages/web3-core-method/tests/commands/SignMessageCommandTest.js index 92cc112d254..85166617cb2 100644 --- a/packages/web3-core-method/tests/commands/SignMessageCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignMessageCommandTest.js @@ -1,10 +1,8 @@ -var chai = require('chai'); -var sinon = require('sinon').createSandbox(); -var expect = chai.expect; - -var MessageSigner = require('../../src/signers/MessageSigner'); -var SignMessageCommand = require('../../src/commands/SignMessageCommand'); -var AbstractMethodModel = require('../../lib/models/AbstractMethodModel'); +import * as sinonLib from 'sinon'; +const sinon = sinonLib.createSandbox(); +import MessageSigner from '../../src/signers/MessageSigner'; +import SignMessageCommand from '../../src/commands/SignMessageCommand'; +import AbstractMethodModel from '../../lib/models/AbstractMethodModel'; /** * SignMessageCommand test @@ -54,10 +52,10 @@ describe('SignMessageCommandTest', function () { .once(); var returnValue = signMessageCommand.execute({}, methodModel, {}); - expect(returnValue).to.equal('0x0'); + expect(returnValue).toBe('0x0'); - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith(false, '0x0')).to.be.true; + expect(methodModelCallbackSpy.calledOnce).toBeTruthy(); + expect(methodModelCallbackSpy.calledWith(false, '0x0')).toBeTruthy(); methodModelMock.verify(); messageSignerMock.verify(); @@ -81,10 +79,10 @@ describe('SignMessageCommandTest', function () { try { signMessageCommand.execute({}, methodModel, {}); } catch(error) { - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith(error, null)).to.be.true; - expect(error).to.be.instanceof(Error); - expect(error.message).equal('PANIC'); + expect(methodModelCallbackSpy.calledOnce).toBeTruthy(); + expect(methodModelCallbackSpy.calledWith(error, null)).toBeTruthy(); + expect(error).toBeInstanceOf(Error); + expect(error.message).toBe('PANIC'); methodModelMock.verify(); messageSignerMock.verify(); diff --git a/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js index 7dd77eb5316..4e482ea5b97 100644 --- a/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js +++ b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js @@ -1,7 +1,7 @@ var chai = require('chai'); var expect = chai.expect; -var MethodPackageFactory = require('../../src/factories/MethodPackageFactory'); +var MethodPackageFactory = require('../../src/factories/MethodModuleFactory'); var MethodController = require('../../src/controllers/MethodController'); var CallMethodCommand = require('../../src/commands/CallMethodCommand'); var SignAndSendMethodCommand = require('../../src/commands/SignAndSendMethodCommand'); @@ -15,7 +15,7 @@ var TransactionReceiptValidator = require('../../src/validators/TransactionRecei var NewHeadsWatcher = require('../../src/watchers/NewHeadsWatcher'); /** - * MethodPackageFactory test + * MethodModuleFactory test */ describe('MethodPackageFactoryTest', function () { var methodPackageFactory; diff --git a/packages/web3-core-subscriptions/src/Subscription.js b/packages/web3-core-subscriptions/src/Subscription.js index 42593b2fc69..076cd582518 100644 --- a/packages/web3-core-subscriptions/src/Subscription.js +++ b/packages/web3-core-subscriptions/src/Subscription.js @@ -81,7 +81,8 @@ export default class Subscription extends EventEmitter { } /** - * Iterates over each item in the response, formats the output, emits required events and executes the callback method. + * Iterates over each item in the response, formats the output, emits required events and + * executes the callback method. * * @method handleSubscriptionResponse * diff --git a/packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js b/packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js new file mode 100644 index 00000000000..a51fb67829c --- /dev/null +++ b/packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js @@ -0,0 +1,40 @@ +/* + 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 . +*/ +/** + * @file SubscriptionsFactory.js + * @authors: Samuel Furter + * @date 2018 + */ + +import SubscriptionsFactory from './SubscriptionsFactory'; + +export default class SubscriptionsModuleFactory { + + /** + * Returns an object of type SubscriptionsFactory + * + * @method createSubscriptionsFactory + * + * @param {Object} utils + * @param {Object} formatters + * + * @returns {SubscriptionsFactory} + */ + createSubscriptionsFactory(utils, formatters) { + return new SubscriptionsFactory(utils, formatters); + } +} diff --git a/packages/web3-core-subscriptions/src/index.js b/packages/web3-core-subscriptions/src/index.js index 796c753f747..5fae900ece6 100644 --- a/packages/web3-core-subscriptions/src/index.js +++ b/packages/web3-core-subscriptions/src/index.js @@ -20,9 +20,9 @@ * @date 2018 */ -import SubscriptionsFactoryObject from './factories/SubscriptionsFactory'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; +import SubscriptionsModuleFactory from './factories/SubscriptionsModuleFactory'; /** * Returns an object of type SubscriptionsFactory @@ -32,7 +32,7 @@ import {formatters} from 'web3-core-helpers'; * @returns {SubscriptionsFactory} */ export const SubscriptionsFactory = () => { - return new SubscriptionsFactoryObject(Utils, formatters); + return new SubscriptionsModuleFactory().createSubscriptionsFactory(Utils, formatters); }; export LogSubscriptionModel from './models/subscriptions/eth/LogSubscriptionModel'; diff --git a/packages/web3-core/.babelrc b/packages/web3-core/.babelrc new file mode 100644 index 00000000000..0f4b58f6843 --- /dev/null +++ b/packages/web3-core/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["env"] +} diff --git a/packages/web3-core/src/index.js b/packages/web3-core/src/index.js index 138f3a91cdd..c2955593986 100644 --- a/packages/web3-core/src/index.js +++ b/packages/web3-core/src/index.js @@ -20,4 +20,4 @@ * @date 2018 */ -export AbstractWeb3Module from './AbstractWeb3Module'; +export {AbstractWeb3Module} from './AbstractWeb3Module'; diff --git a/packages/web3-eth-abi/src/factories/ABIModuleFactory.js b/packages/web3-eth-abi/src/factories/ABIModuleFactory.js new file mode 100644 index 00000000000..5c0d486109a --- /dev/null +++ b/packages/web3-eth-abi/src/factories/ABIModuleFactory.js @@ -0,0 +1,39 @@ +/* + 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 . + */ +/** + * @file ABIModuleFactory.js + * @author Samuel Furter + * @date 2018 + */ + +import {ABICoder} from '../ABICoder'; + +export default class ABIModuleFactory { + + /** + * Returns an object of type ABICoder + * + * @method createABICoder + * + * @param {Object} utils + * + * @returns {ABICoder} + */ + createABICoder(utils) { + return new ABICoder(utils); + } +} diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index 58d7c325d05..1062343ba05 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -21,7 +21,7 @@ */ import Utils from 'web3-utils'; -import ABICoderObject from './ABICoder'; +import {ABIModuleFactory} from './factories/ABIModuleFactory'; /** * Returns an object of AbiCoder @@ -30,6 +30,6 @@ import ABICoderObject from './ABICoder'; * * @constructor */ -export const AbiCoder = () => { - return new ABICoderObject(Utils); +export const ABICoder = () => { + return new ABIModuleFactory().createABICoder(Utils); }; diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index e67152e9623..61bcc73b73f 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -71,7 +71,13 @@ export default class Accounts extends AbstractWeb3Module { utils, formatters ) { - super(provider, providersPackage, methodController, methodModelFactory); + super( + provider, + providersPackage, + methodController, + methodModelFactory + ); + this.utils = utils; this.formatters = formatters; this.wallet = new Wallet(this); diff --git a/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js b/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js new file mode 100644 index 00000000000..70a98cca57f --- /dev/null +++ b/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js @@ -0,0 +1,49 @@ +/* + 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 . + */ +/** + * @file AccountsModuleFactory.js + * @author Samuel Furter + * @date 2018 + */ + +import {MethodModelFactory} from './MethodModelFactory'; +import {Accounts} from '../Accounts'; + +export default class AccountsModuleFactory { + + /** + * Returns an object of type Accounts + * + * @param {AbstractProviderAdapter} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {Object} utils + * @param {Object} formatters + * + * @returns {Accounts} + */ + createAccounts(provider, providersPackage, methodController, utils, formatters) { + return new Accounts( + provider, + providersPackage, + methodController, + new MethodModelFactory(utils, formatters), + utils, + formatters + ); + } +} diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index d9309bb3439..b04b0b00a03 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -20,12 +20,11 @@ * @date 2018 */ -import AccountsModule from './Accounts'; import {MethodController} from 'web3-core-method'; import * as ProvidersPackage from 'web3-providers'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; -import MethodModelFactory from './factories/MethodModelFactory'; +import {AccountsModuleFactory} from './factories/AccountsModuleFactory' /** * Returns the Accounts object @@ -37,11 +36,10 @@ import MethodModelFactory from './factories/MethodModelFactory'; * @returns {Accounts} */ export const Accounts = (provider) => { - return new AccountsModule( + return new AccountsModuleFactory().createAccounts( provider, ProvidersPackage, new MethodController(), - new MethodModelFactory(Utils, formatters), Utils, formatters ); diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index cedbe66c2c4..974bfbeb92b 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -28,7 +28,7 @@ export default class Contract extends AbstractWeb3Module { * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProvidersPackage} providersPackage * @param {MethodController} methodController - * @param {ContractPackageFactory} contractPackageFactory + * @param {ContractModuleFactory} contractPackageFactory * @param {PromiEventPackage} promiEventPackage * @param {ABICoder} abiCoder * @param {Object} utils @@ -56,7 +56,12 @@ export default class Contract extends AbstractWeb3Module { address, options ) { - super(provider, providersPackage, null, null); + super( + provider, + providersPackage, + null, + null + ); if (!(this instanceof Contract)) { throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!'); diff --git a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js index c146230afde..a08cdb8edcf 100644 --- a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js @@ -32,7 +32,11 @@ export default class AllEventsLogDecoder extends EventLogDecoder { * @constructor */ constructor(abiModel, abiCoder, formatters) { - super(abiCoder, formatters); + super( + abiCoder, + formatters + ); + this.abiModel = abiModel; } diff --git a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js b/packages/web3-eth-contract/src/factories/ContractModuleFactory.js similarity index 99% rename from packages/web3-eth-contract/src/factories/ContractPackageFactory.js rename to packages/web3-eth-contract/src/factories/ContractModuleFactory.js index 9f814920884..308865905c1 100644 --- a/packages/web3-eth-contract/src/factories/ContractPackageFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractModuleFactory.js @@ -15,7 +15,7 @@ along with web3.js. If not, see . */ /** - * @file ContractPackageFactory.js + * @file ContractModuleFactory.js * @author Samuel Furter * @date 2018 */ @@ -38,7 +38,7 @@ import RpcMethodOptionsValidator from '../validators/RpcMethodOptionsValidator'; import RpcMethodFactory from '../factories/RpcMethodModelFactory'; import EventSubscriptionFactory from '../factories/EventSubscriptionFactory'; -export default class ContractPackageFactory { +export default class ContractModuleFactory { /** * @param {Object} utils diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index beb6fee9126..ce79ffc9c10 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -26,7 +26,7 @@ import * as ProvidersPackage from 'web3-providers'; import {formatters} from 'web3-core-helpers'; import Utils from 'web3-utils'; import {AbiCoder} from 'web3-eth-abi'; -import ContractPackageFactory from './factories/ContractPackageFactory'; +import ContractModuleFactory from './factories/ContractModuleFactory'; /** * Returns an object of type Contract @@ -42,7 +42,7 @@ import ContractPackageFactory from './factories/ContractPackageFactory'; * @returns {Contract} */ export const Contract = (provider, accounts, abi, address, options) => { - return new ContractPackageFactory( + return new ContractModuleFactory( Utils, formatters, new AbiCoder(), diff --git a/packages/web3-eth-contract/src/mappers/ABIMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js index 024d39613bd..8cc88db01f6 100644 --- a/packages/web3-eth-contract/src/mappers/ABIMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -23,7 +23,7 @@ export default class ABIMapper { /** - * @param {ContractPackageFactory} contractPackageFactory + * @param {ContractModuleFactory} contractPackageFactory * @param {ABICoder} abiCoder * @param {Object} utils * diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js index 4238faedb8c..2dcdcd9d078 100644 --- a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -33,7 +33,10 @@ export default class CallContractMethodModel extends CallMethodModel { * @constructor */ constructor(abiItemModel, callMethodResponseDecoder, utils, formatters) { - super(utils, formatters); + super( + utils, + formatters + ); this.callMethodResponseDecoder = callMethodResponseDecoder; this.abiItemModel = abiItemModel; diff --git a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js index 68cea5d4c5e..d1331470003 100644 --- a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js @@ -33,7 +33,12 @@ export default class ContractDeployMethodModel extends SendTransactionMethodMode * @constructor */ constructor(contract, utils, formatters, accounts) { - super(utils, formatters, accounts); + super( + utils, + formatters, + accounts + ); + this.contract = contract; } diff --git a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js index 693f68bd887..f8d912f691c 100644 --- a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js @@ -32,7 +32,11 @@ export default class PastEventLogsMethodModel extends GetPastLogsMethodModel { * @constructor */ constructor(abiItemModel, utils, formatters) { - super(utils, formatters); + super( + utils, + formatters + ); + this.abiItemModel = abiItemModel; } diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js index a1ac01481b8..3cd54f0907b 100644 --- a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -35,7 +35,11 @@ export default class SendContractMethodModel extends SendTransactionMethodModel * @constructor */ constructor(abiItemModel, allEventsLogDecoder, utils, formatters, accounts) { - super(utils, formatters, accounts); + super( + utils, + formatters, + accounts + ); this.abiItemModel = abiItemModel; this.allEventsLogDecoder = allEventsLogDecoder; diff --git a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js index c1bd7344f19..a51a1c1c644 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js @@ -42,7 +42,14 @@ export default class AllEventsLogSubscription extends LogSubscriptionModel { methodController, allEventsLogDecoder ) { - super(options, utils, formatters, getPastLogsMethodModel, methodController); + super( + options, + utils, + formatters, + getPastLogsMethodModel, + methodController + ); + this.allEventsLogDecoder = allEventsLogDecoder; } diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index b9a2111ca00..5c7e55cfb6b 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -44,7 +44,14 @@ export default class EventLogSubscription extends LogSubscriptionModel { methodController, eventLogDecoder ) { - super(options, utils, formatters, getPastLogsMethodModel, methodController); + super( + options, + utils, + formatters, + getPastLogsMethodModel, + methodController + ); + this.eventLogDecoder = eventLogDecoder; this.abiItemModel = abiItemModel; } diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 5b3616f8014..06a44cd263e 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -46,7 +46,12 @@ export default class Personal extends AbstractWeb3Module { utils, formatters ) { - super(provider, providersPackage, methodController, methodModelFactory); + super( + provider, + providersPackage, + methodController, + methodModelFactory + ); this.utils = utils; this.formatters = formatters; diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index b1e0de1550d..9124f66d96e 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -31,16 +31,20 @@ export default class MethodModelFactory extends web3CoreMethod.AbstractMethodMod * @constructor */ constructor(utils, formatters) { - super({ - getAccounts: web3CoreMethod.GetAccountsMethodModel, - newAccount: web3CoreMethod.NewAccountMethodModel, - unlockAccount: web3CoreMethod.UnlockAccountMethodModel, - lockAccount: web3CoreMethod.LockAccountMethodModel, - importRawKey: web3CoreMethod.ImportRawKeyMethodModel, - sendTransaction: web3CoreMethod.PersonalSendTransactionMethodModel, - signTransaction: web3CoreMethod.PersonalSignTransactionMethodModel, - sign: web3CoreMethod.PersonalSignMethodModel, - ecRecover: web3CoreMethod.EcRecoverMethodModel - }, utils, formatters); + super( + { + getAccounts: web3CoreMethod.GetAccountsMethodModel, + newAccount: web3CoreMethod.NewAccountMethodModel, + unlockAccount: web3CoreMethod.UnlockAccountMethodModel, + lockAccount: web3CoreMethod.LockAccountMethodModel, + importRawKey: web3CoreMethod.ImportRawKeyMethodModel, + sendTransaction: web3CoreMethod.PersonalSendTransactionMethodModel, + signTransaction: web3CoreMethod.PersonalSignTransactionMethodModel, + sign: web3CoreMethod.PersonalSignMethodModel, + ecRecover: web3CoreMethod.EcRecoverMethodModel + }, + utils, + formatters + ); } } diff --git a/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js b/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js new file mode 100644 index 00000000000..830d3b5dc71 --- /dev/null +++ b/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js @@ -0,0 +1,78 @@ +/* + 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 . + */ +/** + * @file PersonalModuleFactory.js + * @author Samuel Furter + * @date 2018 + */ + +import {Personal} from "../Personal"; +import MethodModelFactory from "./MethodModelFactory"; + +export default class PersonalModuleFactory { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + this.utils = utils; + this.formatters = formatters; + } + + /** + * Returns an object of type Personal + * + * @method createPersonal + * + * @param {AbstractProviderAdapter} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {Network} net + * + * @returns {Personal} + */ + createPersonal( + provider, + providersPackage, + methodController, + net, + ) { + return new Personal( + provider, + providersPackage, + methodController, + this.createMethodModelFactory(), + net, + utils, + formatters + ); + } + + /** + * Returns an object of type MethodModelFactory + * + * @method createMethodModelFactory + * + * @returns {MethodModelFactory} + */ + createMethodModelFactory() { + return new MethodModelFactory(this.utils, this.formatters); + } +} diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 6c34a05cdd3..44b276dbd16 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -25,8 +25,7 @@ import {Network} from 'web3-net'; import * as ProvidersPackage from 'web3-providers'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; -import MethodModelFactory from './factories/MethodModelFactory'; -import PersonalModule from './Personal'; +import {PersonalModuleFactory} from './factories/PersonalModuleFactory'; /** * Returns the Personal object @@ -38,13 +37,10 @@ import PersonalModule from './Personal'; * @returns {Personal} */ export const Personal = (provider) => { - return new PersonalModule( + return new PersonalModuleFactory(Utils, formatters).createPersonalModule( provider, ProvidersPackage, new MethodController(), - new MethodModelFactory(Utils, formatters), new Network(provider), - Utils, - formatters ); }; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 5160e06fa04..0681c1cfd11 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -58,7 +58,12 @@ export default class Eth extends AbstractWeb3Module { methodController, methodModelFactory ) { - super(provider, providersPackage, methodController, methodModelFactory); + super( + provider, + providersPackage, + methodController, + methodModelFactory + ); this.net = net; this.accounts = accounts; diff --git a/packages/web3-eth/src/factories/EthModuleFactory.js b/packages/web3-eth/src/factories/EthModuleFactory.js new file mode 100644 index 00000000000..8f547fbe663 --- /dev/null +++ b/packages/web3-eth/src/factories/EthModuleFactory.js @@ -0,0 +1,101 @@ +/* + 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 . + */ +/** + * @file EthModuleFactory.js + * @author Samuel Furter + * @date 2018 + */ + +import {MethodModelFactory} from './MethodModelFactory'; +import {Eth} from '../Eth'; + +export default class EthModuleFactory { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + this.utils = utils; + this.formatters = formatters; + } + + /** + * Returns an object of type Eth + * + * @method createEthModule + * + * @param {AbstractProviderAdapter} provider + * @param {Network} net + * @param {ContractPackage} contractPackage + * @param {Accounts} accounts + * @param {Personal} personal + * @param {Iban} iban + * @param {Abi} abi + * @param {ENS} ens + * @param {ProvidersPackage} providersPackage + * @param {SubscriptionsFactory} subscriptionsFactory + * @param {MethodController} methodController + * + * @returns {Eth} + */ + createEthModule( + provider, + net, + contractPackage, + accounts, + personal, + iban, + abi, + ens, + providersPackage, + subscriptionsFactory, + methodController + ) { + return new Eth( + provider, + net, + contractPackage, + accounts, + personal, + iban, + abi, + ens, + this.utils, + this.formatters, + providersPackage, + subscriptionsFactory, + methodController, + this.createMethodModelFactory(accounts) + ); + } + + /** + * Returns an object of type MethodModelFactory + * + * @method createMethodModelFactory + * + * @param {Accounts} accounts + * + * @returns {MethodModelFactory} + */ + createMethodModelFactory(accounts) { + return new MethodModelFactory(this.utils, this.formatters, accounts); + } +} diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index a245a19aa62..00a239c0d29 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -32,37 +32,41 @@ export default class MethodModelFactory extends web3CoreMethod.AbstractMethodMod * @constructor */ constructor(utils, formatters, accounts) { - super({ - getNodeInfo: web3CoreMethod.GetNodeInfoMethodModel, - getProtocolVersion: web3CoreMethod.GetProtocolVersionMethodModel, - getCoinbase: web3CoreMethod.GetCoinbaseMethodModel, - isMining: web3CoreMethod.IsMiningMethodModel, - getHashrate: web3CoreMethod.GetHashrateMethodModel, - isSyncing: web3CoreMethod.IsSyncingMethodModel, - getGasPrice: web3CoreMethod.GetGasPriceMethodModel, - getAccounts: web3CoreMethod.GetAccountsMethodModel, - getBlockNumber: web3CoreMethod.GetBlockNumberMethodModel, - getBalance: web3CoreMethod.GetBalanceMethodModel, - getStorageAt: web3CoreMethod.GetStroageAtMethodModel, - getCode: web3CoreMethod.GetCodeMethodModel, - getBlock: web3CoreMethod.GetBlockMethodModel, - getUncle: web3CoreMethod.GetUncleMethodModel, - getBlockTransactionCount: web3CoreMethod.GetBlockTransactionCountMethodModel, - getBlockUncleCount: web3CoreMethod.GetBlockUncleCountMethodModel, - getTransaction: web3CoreMethod.GetTransactionMethodModel, - getTransactionFromBlock: web3CoreMethod.GetTransactionFromBlockMethodModel, - getTransactionReceipt: web3CoreMethod.GetTransactionReceipt, - getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, - sendSignedTransaction: web3CoreMethod.SendSignedTransactionMethodModel, - signTransaction: web3CoreMethod.SignTransactionMethodModel, - sendTransaction: web3CoreMethod.SendTransactionMethodModel, - sign: web3CoreMethod.SignMethodModel, - call: web3CoreMethod.CallMethodModel, - estimateGas: web3CoreMethod.EstimateGasMethodModel, - submitWork: web3CoreMethod.SubmitWorkMethodModel, - getWork: web3CoreMethod.GetWorkMethodModel, - getPastLogs: web3CoreMethod.GetPastLogsMethodModel - }, utils, formatters); + super( + { + getNodeInfo: web3CoreMethod.GetNodeInfoMethodModel, + getProtocolVersion: web3CoreMethod.GetProtocolVersionMethodModel, + getCoinbase: web3CoreMethod.GetCoinbaseMethodModel, + isMining: web3CoreMethod.IsMiningMethodModel, + getHashrate: web3CoreMethod.GetHashrateMethodModel, + isSyncing: web3CoreMethod.IsSyncingMethodModel, + getGasPrice: web3CoreMethod.GetGasPriceMethodModel, + getAccounts: web3CoreMethod.GetAccountsMethodModel, + getBlockNumber: web3CoreMethod.GetBlockNumberMethodModel, + getBalance: web3CoreMethod.GetBalanceMethodModel, + getStorageAt: web3CoreMethod.GetStroageAtMethodModel, + getCode: web3CoreMethod.GetCodeMethodModel, + getBlock: web3CoreMethod.GetBlockMethodModel, + getUncle: web3CoreMethod.GetUncleMethodModel, + getBlockTransactionCount: web3CoreMethod.GetBlockTransactionCountMethodModel, + getBlockUncleCount: web3CoreMethod.GetBlockUncleCountMethodModel, + getTransaction: web3CoreMethod.GetTransactionMethodModel, + getTransactionFromBlock: web3CoreMethod.GetTransactionFromBlockMethodModel, + getTransactionReceipt: web3CoreMethod.GetTransactionReceipt, + getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, + sendSignedTransaction: web3CoreMethod.SendSignedTransactionMethodModel, + signTransaction: web3CoreMethod.SignTransactionMethodModel, + sendTransaction: web3CoreMethod.SendTransactionMethodModel, + sign: web3CoreMethod.SignMethodModel, + call: web3CoreMethod.CallMethodModel, + estimateGas: web3CoreMethod.EstimateGasMethodModel, + submitWork: web3CoreMethod.SubmitWorkMethodModel, + getWork: web3CoreMethod.GetWorkMethodModel, + getPastLogs: web3CoreMethod.GetPastLogsMethodModel + }, + utils, + formatters + ); this.accounts = accounts; } diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 505c926a238..327f5389edd 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -20,7 +20,6 @@ * @date 2018 */ -import MethodModelFactory from './factories/MethodModelFactory'; import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; import {Network} from 'web3-net'; @@ -33,7 +32,7 @@ import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {AbiCoder} from 'web3-eth-abi'; import {Iban} from 'web3-eth-iban'; import * as ContractPackage from 'web3-eth-contract'; -import EthModule from './Eth'; +import {EthModuleFactory} from './factories/EthModuleFactory'; /** * Creates the Eth object @@ -45,22 +44,17 @@ import EthModule from './Eth'; * @returns {Eth} */ export const Eth = (provider) => { - const accounts = new Accounts(provider); - - return new EthModule( + return new EthModuleFactory(Utils, formatters).createEthModule( provider, new Network(provider), ContractPackage, - accounts, + new Accounts(provider), new Personal(provider), Iban, - new AbiCoder(utils), + new AbiCoder(Utils), new ENS(provider), - Utils, - formatters, ProvidersPackage, new SubscriptionsFactory(), - new MethodController(), - new MethodModelFactory(Utils, formatters, accounts) + new MethodController() ); }; diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index 05b7d7c0cb2..84d5f1dd3e4 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -43,7 +43,13 @@ export default class Network extends AbstractWeb3Module { formatters, utils ) { - super(provider, providersPackage, methodController, methodModelFactory); + super( + provider, + providersPackage, + methodController, + methodModelFactory + ); + this.formatters = formatters; this.utils = utils; } diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index 452872d9c5d..1c975c66206 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -31,12 +31,15 @@ export default class MethodModelFactory extends web3CoreMethod.AbstractMethodMod * @constructor */ constructor(utils, formatters) { - super({ - getId: web3CoreMethod.VersionMethodModel, - getBlock: web3CoreMethod.GetBlockMethodModel, - isListening: web3CoreMethod.ListeningMethodModel, - getPeerCount: web3CoreMethod.PeerCountMethodModel, - }, utils, formatters); - + super( + { + getId: web3CoreMethod.VersionMethodModel, + getBlock: web3CoreMethod.GetBlockMethodModel, + isListening: web3CoreMethod.ListeningMethodModel, + getPeerCount: web3CoreMethod.PeerCountMethodModel, + }, + utils, + formatters + ); } } diff --git a/packages/web3-net/src/factories/NetworkModuleFactory.js b/packages/web3-net/src/factories/NetworkModuleFactory.js new file mode 100644 index 00000000000..6e2582943e3 --- /dev/null +++ b/packages/web3-net/src/factories/NetworkModuleFactory.js @@ -0,0 +1,71 @@ +/* + 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 . + */ +/** + * @file NetworkModuleFactory.js + * @author Samuel Furter + * @date 2018 + */ + +import {Network} from "../Network"; +import MethodModelFactory from "./MethodModelFactory"; + +export default class NetworkModuleFactory { + + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + this.utils = utils; + this.formatters = formatters; + } + + /** + * Returns an object of type Network + * + * @method createNetworkModule + * + * @param {AbstractProviderAdapter} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * + * @returns {Network} + */ + createNetworkModule(provider, providersPackage, methodController) { + return new Network( + provider, + providersPackage, + methodController, + this.createMethodModelFactory(), + this.formatters, + this.utils + ); + } + + /** + * Returns an object of MethodModelFactory + * + * @method createMethodModelFactory + * + * @returns {MethodModelFactory} + */ + createMethodModelFactory() { + return new MethodModelFactory(this.utils, this.formatters); + } +} diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index 30cf2edc90c..daeeb65e974 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -24,9 +24,8 @@ import * as ProvidersPackage from 'web3-providers'; import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; -import utils from 'web3-utils'; -import NetworkModule from './Network'; -import MethodModelFactory from './factories/MethodModelFactory'; +import Utils from 'web3-utils'; +import NetworkModuleFactory from "./factories/NetworkModuleFactory"; /** * Creates the Network Object @@ -38,12 +37,9 @@ import MethodModelFactory from './factories/MethodModelFactory'; * @returns {Network} */ export const Network = (provider) => { - return new NetworkModule( + return new NetworkModuleFactory(Utils, formatters).createNetworkModule( provider, ProvidersPackage, new MethodController(), - new MethodModelFactory(Utils, formatters), - formatters, - utils ) }; diff --git a/packages/web3-providers/.babelrc b/packages/web3-providers/.babelrc new file mode 100644 index 00000000000..0f4b58f6843 --- /dev/null +++ b/packages/web3-providers/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["env"] +} diff --git a/packages/web3-providers/package-lock.json b/packages/web3-providers/package-lock.json new file mode 100644 index 00000000000..1158e22b290 --- /dev/null +++ b/packages/web3-providers/package-lock.json @@ -0,0 +1,1152 @@ +{ + "name": "web3-providers", + "version": "1.0.0-beta.36", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "oboe": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.4.tgz", + "integrity": "sha1-IMiM2wwVNxuwQRklfU/dNLCqSfY=", + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + } + } +} diff --git a/packages/web3-providers/src/factories/ProvidersPackageFactory.js b/packages/web3-providers/src/factories/ProvidersModuleFactory.js similarity index 89% rename from packages/web3-providers/src/factories/ProvidersPackageFactory.js rename to packages/web3-providers/src/factories/ProvidersModuleFactory.js index fef63df5c24..3f7165847b1 100644 --- a/packages/web3-providers/src/factories/ProvidersPackageFactory.js +++ b/packages/web3-providers/src/factories/ProvidersModuleFactory.js @@ -29,8 +29,23 @@ import WebsocketProvider from '../providers/WebsocketProvider'; import IpcProvider from '../providers/IpcProvider'; import HttpProvider from '../providers/HttpProvider'; import JSONRpcResponseValidator from '../validators/JSONRpcResponseValidator'; +import JSONRpcMapper from '../mappers/JSONRpcMapper'; +import {BatchRequest} from '../batch-request/BatchRequest'; -export default class ProvidersPackageFactory { +export default class ProvidersModuleFactory { + + /** + * Returns an BatchRequest object + * + * @method createBatchRequest + * + * @param {AbstractProviderAdapter} provider + * + * @returns {BatchRequest} + */ + createBatchRequest(provider) { + return new BatchRequest(provider, JSONRpcMapper, JSONRpcResponseValidator); + } /** * Returns an ProviderAdapterResolver object diff --git a/packages/web3-providers/src/index.js b/packages/web3-providers/src/index.js index 79c8f7c9798..9d87f7381dc 100644 --- a/packages/web3-providers/src/index.js +++ b/packages/web3-providers/src/index.js @@ -13,25 +13,21 @@ */ /** * @file index.js - * * @author Samuel Furter * @date 2018 */ -import ProvidersPackageFactory from './factories/ProvidersPackageFactory'; -import BatchRequestObject from './batch-request/BatchRequest'; -import JSONRpcMapper from './validators/JSONRpcResponseValidator'; +import ProvidersModuleFactory from './factories/ProvidersModuleFactory'; -export SocketProviderAdapter from './adapters/SocketProviderAdapter'; -export HttpProviderAdapter from './adapters/HttpProviderAdapter'; -export HttpProvider from './providers/HttpProvider'; -export IpcProvider from './providers/IpcProvider'; -export WebsocketProvider from './providers/WebsocketProvider'; -export JSONRpcMapper from './mappers/JSONRpcMapper'; -export JSONRpcResponseValidator from './validators/JSONRpcResponseValidator'; +export {SocketProviderAdapter} from './adapters/SocketProviderAdapter'; +export {HttpProviderAdapter} from './adapters/HttpProviderAdapter'; +export {HttpProvider} from './providers/HttpProvider'; +export {IpcProvider} from './providers/IpcProvider'; +export {WebsocketProvider} from './providers/WebsocketProvider'; +export {JSONRpcResponseValidator} from './validators/JSONRpcResponseValidator'; /** - * Returns the Batch object + * Creates the BatchRequest object * * @method BatchRequest * @@ -40,34 +36,27 @@ export JSONRpcResponseValidator from './validators/JSONRpcResponseValidator'; * @returns {BatchRequest} */ export const BatchRequest = (provider) => { - return new BatchRequestObject( - provider, - JSONRpcMapper, - new ProvidersPackageFactory().createJSONRpcResponseValidator() - ); + return new ProvidersModuleFactory().createBatchRequest(provider); }; /** - * Resolves the right provider adapter by the given parameters - * - * @method resolve + * Creates the ProviderAdapterResolver object * - * @param {Object|String} provider - * @param {Net} net + * @method ProviderAdapterResolver * - * @returns {AbstractProviderAdapter} + * @returns {ProviderAdapterResolver} */ -export const resolve = (provider, net) => { - return new ProvidersPackageFactory().createProviderAdapterResolver().resolve(provider, net); +export const ProviderAdapterResolver = () => { + return new ProvidersModuleFactory().createProviderAdapterResolver(); }; /** - * Detects the given provider in the global scope + * Creates the ProviderDetector object * * @method detect * * @returns {Object} */ -export const detect = () => { - return new ProvidersPackageFactory().createProviderDetector().detect(); +export const ProviderDetector = () => { + return new ProvidersModuleFactory().createProviderDetector().detect(); }; diff --git a/packages/web3-providers/src/mappers/JSONRpcMapper.js b/packages/web3-providers/src/mappers/JSONRpcMapper.js index fe9d2a46195..f9b7fe826b3 100644 --- a/packages/web3-providers/src/mappers/JSONRpcMapper.js +++ b/packages/web3-providers/src/mappers/JSONRpcMapper.js @@ -20,9 +20,7 @@ * @date 2018 */ -const JSONRpcMapper = { - messageId: 0 -}; +let messageId = 0; export default class JSONRpcMapper { @@ -41,11 +39,11 @@ export default class JSONRpcMapper { throw new Error(`JSONRPC method should be specified for params: "${JSON.stringify(params)}"!`); } - JSONRpcMapper.messageId++; + messageId++; return { jsonrpc: '2.0', - id: JSONRpcMapper.messageId, + id: messageId, method, params: params || [] }; diff --git a/packages/web3-providers/src/providers/HttpProvider.js b/packages/web3-providers/src/providers/HttpProvider.js index 71cd1c861b6..51d7be3bfc5 100644 --- a/packages/web3-providers/src/providers/HttpProvider.js +++ b/packages/web3-providers/src/providers/HttpProvider.js @@ -14,7 +14,8 @@ You should have received a copy of the GNU Lesser General Public License along with web3.js. If not, see . */ -/** @file httpprovider.js +/** + * @file httpprovider.js * @authors: * Marek Kotewicz * Marian Oancea diff --git a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js index 6c0d13b7854..2b487450422 100644 --- a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js @@ -25,7 +25,7 @@ import _ from 'underscore'; export default class ProviderAdapterResolver { /** - * @param {ProvidersPackageFactory} providersPackageFactory + * @param {ProvidersModuleFactory} providersPackageFactory * * @constructor */ diff --git a/packages/web3-shh/src/factories/ShhModuleFactory.js b/packages/web3-shh/src/factories/ShhModuleFactory.js new file mode 100644 index 00000000000..834c6615b3e --- /dev/null +++ b/packages/web3-shh/src/factories/ShhModuleFactory.js @@ -0,0 +1,67 @@ +/* + 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 . + */ +/** + * @file MethodModelFactory.js + * @author Samuel Furter + * @date 2018 + */ + +import {Shh} from '../Shh'; +import MethodModelFactory from "./MethodModelFactory"; + +export default class ShhModuleFactory { + + /** + * Returns an object of type Shh + * + * @method createShhModule + * + * @param {AbstractProviderAdapter} provider + * @param {ProvidersPackage} providersPackage + * @param {MethodController} methodController + * @param {SubscriptionsFacotry} subscriptionsFactory + * @param {Network} net + * @param {Object} utils + * @param {Object} formatters + * + * @returns {Shh} + */ + createShhModule(provider, providersPackage, methodController, subscriptionsFactory, net, utils, formatters) { + return new Shh( + provider, + providersPackage, + methodController, + this.createMethodModelFactory(utils, formatters), + subscriptionsFactory, + net + ); + } + + /** + * Returns an object of type MethodModelFactory + * + * @method createMethodModelFactory + * + * @param {Object} utils + * @param {Object} formatters + * + * @returns {MethodModelFactory} + */ + createMethodModelFactory(utils, formatters) { + return new MethodModelFactory(utils, formatters) + } +} From cd5a4ad13e80d5c540d9c576f1e0ee91826c4c35 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Fri, 19 Oct 2018 17:23:31 +0200 Subject: [PATCH 0299/1045] Dependency handling improved, import/export checked and fixed --- packages/web3-bzz/src/Bzz.js | 4 +- packages/web3-bzz/src/index.js | 1 - packages/web3-core-helpers/src/formatters.js | 96 +++++++++---------- .../src/commands/SendMethodCommand.js | 5 +- .../src/controllers/MethodController.js | 10 +- .../src/factories/MethodModuleFactory.js | 6 +- packages/web3-core-method/src/index.js | 5 +- packages/web3-core/src/AbstractWeb3Module.js | 55 +++++------ packages/web3-core/src/index.js | 2 +- .../src/factories/ABIModuleFactory.js | 2 +- packages/web3-eth-abi/src/index.js | 2 +- packages/web3-eth-accounts/src/Accounts.js | 15 ++- .../src/factories/AccountsModuleFactory.js | 53 ++++++++-- .../src/factories/MethodModelFactory.js | 15 ++- packages/web3-eth-accounts/src/index.js | 17 ++-- packages/web3-eth-contract/src/Contract.js | 49 ++++++---- .../src/factories/ContractModuleFactory.js | 26 +++-- packages/web3-eth-contract/src/index.js | 17 ++-- .../src/mappers/ABIMapper.js | 22 ++--- .../src/mappers/RpcMethodOptionsMapper.js | 1 + .../src/models/abi/ABIItemModel.js | 22 ++--- .../src/models/abi/ABIModel.js | 22 ++--- .../models/methods/CallContractMethodModel.js | 22 ++--- .../methods/ContractDeployMethodModel.js | 22 ++--- .../methods/PastEventLogsMethodModel.js | 22 ++--- .../models/methods/SendContractMethodModel.js | 22 ++--- .../src/proxies/EventSubscriptionsProxy.js | 22 ++--- .../src/proxies/MethodsProxy.js | 32 +++---- .../web3-eth-ens/src/contracts/Registry.js | 11 ++- ...SPackageFactory.js => ENSModuleFactory.js} | 32 +++---- packages/web3-eth-ens/src/index.js | 15 +-- packages/web3-eth-iban/src/Iban.js | 7 +- packages/web3-eth-personal/src/Personal.js | 15 ++- .../src/factories/MethodModelFactory.js | 33 ++++--- .../src/factories/PersonalModuleFactory.js | 25 +++-- packages/web3-eth-personal/src/index.js | 13 ++- packages/web3-eth/src/Eth.js | 37 ++++--- .../src/factories/EthModuleFactory.js | 27 ++++-- packages/web3-eth/src/index.js | 19 ++-- packages/web3-net/src/Network.js | 15 ++- .../src/factories/MethodModelFactory.js | 18 ++-- .../src/factories/NetworkModuleFactory.js | 21 +++- packages/web3-net/src/index.js | 9 +- .../src/factories/ProvidersModuleFactory.js | 2 +- packages/web3-providers/src/index.js | 21 ++-- packages/web3-shh/src/Shh.js | 22 ++++- .../src/factories/MethodModelFactory.js | 69 ++++++++----- .../src/factories/ShhModuleFactory.js | 47 ++++++--- packages/web3-shh/src/index.js | 15 +-- packages/web3/src/index.js | 43 +++++---- 50 files changed, 671 insertions(+), 434 deletions(-) rename packages/web3-eth-ens/src/factories/{ENSPackageFactory.js => ENSModuleFactory.js} (71%) diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index 88c2c548ecf..539cb0defb7 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -21,7 +21,7 @@ */ import _ from 'underscore'; -import swarm from "swarm-js"; +import swarm from 'swarm-js'; export default class Bzz { @@ -45,7 +45,7 @@ export default class Bzz { */ pick() { if (typeof document !== 'undefined') { - return swarm.pick; + return this.swarm.pick; } throw Error('Pick is not supported for this environment.'); diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index 255c5163d16..439787072ec 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -21,4 +21,3 @@ */ export Bzz from './Bzz'; -export version from '../package.json'; diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index bf08788af93..303b5e602ff 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -22,7 +22,7 @@ */ import _ from 'underscore'; -import utils from 'web3-utils'; +import Utils from 'web3-utils'; import {Iban} from 'web3-eth-iban'; /** @@ -33,7 +33,7 @@ import {Iban} from 'web3-eth-iban'; * @returns {BigNumber} object */ const outputBigNumberFormatter = number => { - return utils.toBN(number).toString(10); + return Utils.toBN(number).toString(10); }; const isPredefinedBlockNumber = blockNumber => { @@ -70,7 +70,7 @@ const inputBlockNumberFormatter = blockNumber => { return blockNumber; } - return (utils.isHexStrict(blockNumber)) ? ((_.isString(blockNumber)) ? blockNumber.toLowerCase() : blockNumber) : utils.numberToHex(blockNumber); + return (Utils.isHexStrict(blockNumber)) ? ((_.isString(blockNumber)) ? blockNumber.toLowerCase() : blockNumber) : Utils.numberToHex(blockNumber); }; /** @@ -95,7 +95,7 @@ const _txInputFormatter = options => { delete options.input; } - if(options.data && !utils.isHex(options.data)) { + if(options.data && !Utils.isHex(options.data)) { throw new Error('The data field must be HEX encoded data.'); } @@ -107,7 +107,7 @@ const _txInputFormatter = options => { ['gasPrice', 'gas', 'value', 'nonce'].filter(key => { return options[key] !== undefined; }).forEach(key => { - options[key] = utils.numberToHex(options[key]); + options[key] = Utils.numberToHex(options[key]); }); return options; @@ -174,7 +174,7 @@ const inputTransactionFormatter = (options, moduleInstance) => { * @returns {String} */ const inputSignFormatter = data => { - return (utils.isHexStrict(data)) ? data : utils.utf8ToHex(data); + return (Utils.isHexStrict(data)) ? data : Utils.utf8ToHex(data); }; /** @@ -186,22 +186,22 @@ const inputSignFormatter = data => { */ const outputTransactionFormatter = tx => { if(tx.blockNumber !== null) - tx.blockNumber = utils.hexToNumber(tx.blockNumber); + tx.blockNumber = Utils.hexToNumber(tx.blockNumber); if(tx.transactionIndex !== null) - tx.transactionIndex = utils.hexToNumber(tx.transactionIndex); - tx.nonce = utils.hexToNumber(tx.nonce); - tx.gas = utils.hexToNumber(tx.gas); + tx.transactionIndex = Utils.hexToNumber(tx.transactionIndex); + tx.nonce = Utils.hexToNumber(tx.nonce); + tx.gas = Utils.hexToNumber(tx.gas); tx.gasPrice = outputBigNumberFormatter(tx.gasPrice); tx.value = outputBigNumberFormatter(tx.value); - if(tx.to && utils.isAddress(tx.to)) { // tx.to could be `0x0` or `null` while contract creation - tx.to = utils.toChecksumAddress(tx.to); + if(tx.to && Utils.isAddress(tx.to)) { // tx.to could be `0x0` or `null` while contract creation + tx.to = Utils.toChecksumAddress(tx.to); } else { tx.to = null; // set to `null` if invalid address } if(tx.from) { - tx.from = utils.toChecksumAddress(tx.from); + tx.from = Utils.toChecksumAddress(tx.from); } return tx; @@ -220,18 +220,18 @@ const outputTransactionReceiptFormatter = receipt => { } if(receipt.blockNumber !== null) - receipt.blockNumber = utils.hexToNumber(receipt.blockNumber); + receipt.blockNumber = Utils.hexToNumber(receipt.blockNumber); if(receipt.transactionIndex !== null) - receipt.transactionIndex = utils.hexToNumber(receipt.transactionIndex); - receipt.cumulativeGasUsed = utils.hexToNumber(receipt.cumulativeGasUsed); - receipt.gasUsed = utils.hexToNumber(receipt.gasUsed); + receipt.transactionIndex = Utils.hexToNumber(receipt.transactionIndex); + receipt.cumulativeGasUsed = Utils.hexToNumber(receipt.cumulativeGasUsed); + receipt.gasUsed = Utils.hexToNumber(receipt.gasUsed); if(_.isArray(receipt.logs)) { receipt.logs = receipt.logs.map(outputLogFormatter); } if(receipt.contractAddress) { - receipt.contractAddress = utils.toChecksumAddress(receipt.contractAddress); + receipt.contractAddress = Utils.toChecksumAddress(receipt.contractAddress); } if(typeof receipt.status !== 'undefined') { @@ -251,12 +251,12 @@ const outputTransactionReceiptFormatter = receipt => { const outputBlockFormatter = block => { // transform to number - block.gasLimit = utils.hexToNumber(block.gasLimit); - block.gasUsed = utils.hexToNumber(block.gasUsed); - block.size = utils.hexToNumber(block.size); - block.timestamp = utils.hexToNumber(block.timestamp); + block.gasLimit = Utils.hexToNumber(block.gasLimit); + block.gasUsed = Utils.hexToNumber(block.gasUsed); + block.size = Utils.hexToNumber(block.size); + block.timestamp = Utils.hexToNumber(block.timestamp); if (block.number !== null) - block.number = utils.hexToNumber(block.number); + block.number = Utils.hexToNumber(block.number); if(block.difficulty) block.difficulty = outputBigNumberFormatter(block.difficulty); @@ -271,7 +271,7 @@ const outputBlockFormatter = block => { } if (block.miner) - block.miner = utils.toChecksumAddress(block.miner); + block.miner = Utils.toChecksumAddress(block.miner); return block; }; @@ -294,7 +294,7 @@ const inputLogFormatter = options => { if(value.indexOf('0x') === 0) return value; else - return utils.fromUtf8(value); + return Utils.fromUtf8(value); }; if (options.fromBlock) @@ -334,21 +334,21 @@ const outputLogFormatter = log => { if(typeof log.blockHash === 'string' && typeof log.transactionHash === 'string' && typeof log.logIndex === 'string') { - const shaId = utils.sha3(log.blockHash.replace('0x','') + log.transactionHash.replace('0x','') + log.logIndex.replace('0x','')); + const shaId = Utils.sha3(log.blockHash.replace('0x','') + log.transactionHash.replace('0x','') + log.logIndex.replace('0x','')); log.id = `log_${shaId.replace('0x','').substr(0,8)}`; } else if(!log.id) { log.id = null; } if (log.blockNumber !== null) - log.blockNumber = utils.hexToNumber(log.blockNumber); + log.blockNumber = Utils.hexToNumber(log.blockNumber); if (log.transactionIndex !== null) - log.transactionIndex = utils.hexToNumber(log.transactionIndex); + log.transactionIndex = Utils.hexToNumber(log.transactionIndex); if (log.logIndex !== null) - log.logIndex = utils.hexToNumber(log.logIndex); + log.logIndex = Utils.hexToNumber(log.logIndex); if (log.address) { - log.address = utils.toChecksumAddress(log.address); + log.address = Utils.toChecksumAddress(log.address); } return log; @@ -363,14 +363,14 @@ const outputLogFormatter = log => { */ const inputPostFormatter = post => { - // post.payload = utils.toHex(post.payload); + // post.payload = Utils.toHex(post.payload); if (post.ttl) - post.ttl = utils.numberToHex(post.ttl); + post.ttl = Utils.numberToHex(post.ttl); if (post.workToProve) - post.workToProve = utils.numberToHex(post.workToProve); + post.workToProve = Utils.numberToHex(post.workToProve); if (post.priority) - post.priority = utils.numberToHex(post.priority); + post.priority = Utils.numberToHex(post.priority); // fallback if (!_.isArray(post.topics)) { @@ -380,7 +380,7 @@ const inputPostFormatter = post => { // format the following options post.topics = post.topics.map(topic => { // convert only if not hex - return (topic.indexOf('0x') === 0) ? topic : utils.fromUtf8(topic); + return (topic.indexOf('0x') === 0) ? topic : Utils.fromUtf8(topic); }); return post; @@ -394,14 +394,14 @@ const inputPostFormatter = post => { * @returns {Object} */ const outputPostFormatter = post => { - post.expiry = utils.hexToNumber(post.expiry); - post.sent = utils.hexToNumber(post.sent); - post.ttl = utils.hexToNumber(post.ttl); - post.workProved = utils.hexToNumber(post.workProved); + post.expiry = Utils.hexToNumber(post.expiry); + post.sent = Utils.hexToNumber(post.sent); + post.ttl = Utils.hexToNumber(post.ttl); + post.workProved = Utils.hexToNumber(post.workProved); // post.payloadRaw = post.payload; - // post.payload = utils.hexToAscii(post.payload); + // post.payload = Utils.hexToAscii(post.payload); - // if (utils.isJson(post.payload)) { + // if (Utils.isJson(post.payload)) { // post.payload = JSON.parse(post.payload); // } @@ -410,7 +410,7 @@ const outputPostFormatter = post => { post.topics = []; } post.topics = post.topics.map(topic => { - return utils.toUtf8(topic); + return Utils.toUtf8(topic); }); return post; @@ -421,7 +421,7 @@ var inputAddressFormatter = address => { if (iban.isValid() && iban.isDirect()) { return iban.toAddress().toLowerCase(); - } else if (utils.isAddress(address)) { + } else if (Utils.isAddress(address)) { return `0x${address.toLowerCase().replace('0x','')}`; } @@ -431,12 +431,12 @@ var inputAddressFormatter = address => { const outputSyncingFormatter = result => { - result.startingBlock = utils.hexToNumber(result.startingBlock); - result.currentBlock = utils.hexToNumber(result.currentBlock); - result.highestBlock = utils.hexToNumber(result.highestBlock); + result.startingBlock = Utils.hexToNumber(result.startingBlock); + result.currentBlock = Utils.hexToNumber(result.currentBlock); + result.highestBlock = Utils.hexToNumber(result.highestBlock); if (result.knownStates) { - result.knownStates = utils.hexToNumber(result.knownStates); - result.pulledStates = utils.hexToNumber(result.pulledStates); + result.knownStates = Utils.hexToNumber(result.knownStates); + result.pulledStates = Utils.hexToNumber(result.pulledStates); } return result; diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 6d8319b7286..825c351a8f8 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -21,9 +21,8 @@ */ import _ from 'underscore'; -import AbstractSendMethodCommand from '../../lib/commands/AbstractSendMethodCommand'; -export default class SendMethodCommand extends AbstractSendMethodCommand { +export default class SendMethodCommand { /** * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow @@ -31,7 +30,7 @@ export default class SendMethodCommand extends AbstractSendMethodCommand { * @constructor */ constructor(transactionConfirmationWorkflow) { - super(transactionConfirmationWorkflow); + this.transactionConfirmationWorkflow = transactionConfirmationWorkflow; } /** diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index abbe77ccf00..92893a8c1ed 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -27,7 +27,7 @@ export default class MethodController { * @param {SendMethodCommand} sendMethodCommand * @param {SignAndSendMethodCommand} signAndSendMethodCommand * @param {SignMessageCommand} signMessageCommand - * @param {PromiEventPackage} promiEventPackage + * @param {PromiEvent} promiEventObject * * @constructor */ @@ -36,13 +36,13 @@ export default class MethodController { sendMethodCommand, signAndSendMethodCommand, signMessageCommand, - promiEventPackage + promiEventObject ) { this.callMethodCommand = callMethodCommand; this.sendMethodCommand = sendMethodCommand; this.signAndSendMethodCommand = signAndSendMethodCommand; this.signMessageCommand = signMessageCommand; - this.promiEventPackage = promiEventPackage; + this.promiEventObject = promiEventObject; } /** @@ -70,7 +70,7 @@ export default class MethodController { return this.signAndSendMethodCommand.execute( moduleInstance, methodModel, - new this.promiEventPackage.PromiEvent(), + new this.promiEventObject(), accounts, ); } @@ -80,7 +80,7 @@ export default class MethodController { return this.sendMethodCommand.execute( moduleInstance, methodModel, - new this.promiEventPackage.PromiEvent() + new this.promiEventObject() ); } diff --git a/packages/web3-core-method/src/factories/MethodModuleFactory.js b/packages/web3-core-method/src/factories/MethodModuleFactory.js index c51e416c131..8f474491578 100644 --- a/packages/web3-core-method/src/factories/MethodModuleFactory.js +++ b/packages/web3-core-method/src/factories/MethodModuleFactory.js @@ -39,19 +39,19 @@ export default class MethodModuleFactory { * * @method createMethodController * - * @param {PromiEventPackage} promiEventPackage + * @param {PromiEvent} promiEventObject * @param {SubscriptionsFactory} subscriptionsFactory * @param {Object} formatters * * @returns {MethodController} */ - createMethodController(promiEventPackage, subscriptionsFactory, formatters) { + createMethodController(promiEventObject, subscriptionsFactory, formatters) { return new MethodController( this.createCallMethodCommand(), this.createSendMethodCommand(subscriptionsFactory, formatters), this.createSignAndSendMethodCommand(subscriptionsFactory, formatters), this.createSignMessageCommand(), - promiEventPackage + promiEventObject ); } diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 61eda07ed6f..85ad644b389 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -16,13 +16,14 @@ */ /** + * TODO: Overthink the handling of PromiEvent its just wrong to do it over injection * @file index.js * @author Samuel Furter * @date 2018 */ import MethodModuleFactory from './factories/MethodModuleFactory'; -import * as PromiEventPackage from 'web3-core-promievent'; +import {PromiEvent} from 'web3-core-promievent'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {formatters} from 'web3-core-helpers'; @@ -35,7 +36,7 @@ import {formatters} from 'web3-core-helpers'; */ export const MethodController = () => { return new MethodModuleFactory().createMethodController( - PromiEventPackage, + PromiEvent, new SubscriptionsFactory(), formatters ); diff --git a/packages/web3-core/src/AbstractWeb3Module.js b/packages/web3-core/src/AbstractWeb3Module.js index 43d791fed58..be87e28618d 100644 --- a/packages/web3-core/src/AbstractWeb3Module.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -26,38 +26,37 @@ export default class AbstractWeb3Module { /** * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController * @param {AbstractMethodModelFactory} methodModelFactory * * @constructor */ - constructor(provider, providersPackage, methodController, methodModelFactory = null) { - if (!this.isDependencyGiven(provider)) { - throw Error('No provider given as constructor parameter!'); - } - - if (!this.isDependencyGiven(providersPackage)) { - throw Error('ProviderPackage not found!'); - } - + constructor( + provider = this.throwIfMissing('provider'), + providerDetector = this.throwIfMissing('providerDetector'), + providerAdapterResolver = this.throwIfMissing('providerAdapterResolver'), + providersModuleFactory = this.throwIfMissing('providersModuleFactory'), + providers = this.throwIfMissing('providers'), + methodController = this.throwIfMissing('methodController'), + methodModelFactory = null + ) { this.methodController = methodController; this.extendedPackages = []; - this.providersPackage = providersPackage; - this.givenProvider = this.providersPackage.detect(); + this.providerDetector = providerDetector; + this.providerAdapterResolver = providerAdapterResolver; + this.providersModuleFactory = providersModuleFactory; + this.givenProvider = this.providerDetector.detect(); this._currentProvider = provider; - - this.providers = { - HttpProvider: this.providersPackage.HttpProvider, - IpcProvider: this.providersPackage.IpcProvider, - WebsocketProvider: this.providersPackage.WebsocketProvider, - }; - + this.providers = providers; this.BatchRequest = () => { - return new this.providersPackage.BatchRequest(this.currentProvider); + return this.providersModuleFactory.createBatchRequest(this.currentProvider); }; - if (this.isDependencyGiven(methodModelFactory)) { + if (methodModelFactory !== null && typeof methodModelFactory !== 'undefined') { this.methodModelFactory = methodModelFactory; this.extend.formatters = this.methodModelFactory.formatters; @@ -102,7 +101,7 @@ export default class AbstractWeb3Module { setProvider(provider, net) { if (!this.isSameProvider(provider)) { this.clearSubscriptions(); - this._currentProvider = this.providersPackage.resolve(provider, net); + this._currentProvider = this.providerAdapterResolver.resolve(provider, net); if (this.extendedPackages.length > 0) { var setExtendedPackagesProvider = this.extendedPackages.every(extendedPackage => { @@ -242,7 +241,7 @@ export default class AbstractWeb3Module { if (methodModel.parameters.length !== methodModel.parametersAmount) { throw Error( - `Invalid parameters length the expected length would be${methodModel.parametersAmount}and not${methodModel.parameters.length}` + `Invalid parameters length the expected length would be ${methodModel.parametersAmount} and not ${methodModel.parameters.length}` ); } @@ -259,13 +258,11 @@ export default class AbstractWeb3Module { } /** - * Checks if the given value is defined - * - * @param {*} object + * Throws an error if the parameter is missing * - * @returns {Boolean} + * @param {String} name */ - isDependencyGiven(object) { - return object !== null && typeof object !== 'undefined' + throwIfMissing(name) { + throw Error('Parameter with name ${name} is missing'); } } diff --git a/packages/web3-core/src/index.js b/packages/web3-core/src/index.js index c2955593986..138f3a91cdd 100644 --- a/packages/web3-core/src/index.js +++ b/packages/web3-core/src/index.js @@ -20,4 +20,4 @@ * @date 2018 */ -export {AbstractWeb3Module} from './AbstractWeb3Module'; +export AbstractWeb3Module from './AbstractWeb3Module'; diff --git a/packages/web3-eth-abi/src/factories/ABIModuleFactory.js b/packages/web3-eth-abi/src/factories/ABIModuleFactory.js index 5c0d486109a..77f4b57353c 100644 --- a/packages/web3-eth-abi/src/factories/ABIModuleFactory.js +++ b/packages/web3-eth-abi/src/factories/ABIModuleFactory.js @@ -20,7 +20,7 @@ * @date 2018 */ -import {ABICoder} from '../ABICoder'; +import ABICoder from '../ABICoder'; export default class ABIModuleFactory { diff --git a/packages/web3-eth-abi/src/index.js b/packages/web3-eth-abi/src/index.js index 1062343ba05..fd101a5579a 100644 --- a/packages/web3-eth-abi/src/index.js +++ b/packages/web3-eth-abi/src/index.js @@ -21,7 +21,7 @@ */ import Utils from 'web3-utils'; -import {ABIModuleFactory} from './factories/ABIModuleFactory'; +import ABIModuleFactory from './factories/ABIModuleFactory'; /** * Returns an object of AbiCoder diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 61bcc73b73f..1ea677a9137 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -55,7 +55,10 @@ export default class Accounts extends AbstractWeb3Module { /** * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {Object} utils @@ -65,7 +68,10 @@ export default class Accounts extends AbstractWeb3Module { */ constructor( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, methodModelFactory, utils, @@ -73,7 +79,10 @@ export default class Accounts extends AbstractWeb3Module { ) { super( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, methodModelFactory ); diff --git a/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js b/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js index 70a98cca57f..8d5b122c71e 100644 --- a/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js +++ b/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js @@ -20,30 +20,63 @@ * @date 2018 */ -import {MethodModelFactory} from './MethodModelFactory'; -import {Accounts} from '../Accounts'; +import MethodModelFactory from './MethodModelFactory'; +import Accounts from '../Accounts'; export default class AccountsModuleFactory { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + this.utils = utils; + this.formatters = formatters; + } + /** * Returns an object of type Accounts * * @param {AbstractProviderAdapter} provider - * @param {ProvidersPackage} providersPackage + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController - * @param {Object} utils - * @param {Object} formatters * * @returns {Accounts} */ - createAccounts(provider, providersPackage, methodController, utils, formatters) { + createAccounts( + provider, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + methodController + ) { return new Accounts( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, - new MethodModelFactory(utils, formatters), - utils, - formatters + this.createMethodModelFactory(), + this.utils, + this.formatters ); } + + /** + * Returns an object of type MethodModelFactory + * + * @method createMethodModelFactory + * + * @returns {MethodModelFactory} + */ + createMethodModelFactory() { + return new MethodModelFactory(this.utils, this.formatters); + } } diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js index 141545c989e..1d535aa38fa 100644 --- a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -20,9 +20,14 @@ * @date 2018 */ -import * as web3CoreMethod from 'web3-core-method'; +import { + AbstractMethodModelFactory, + GetGasPriceMethodModel, + GetTransactionCountMethodModel, + VersionMethodModel +} from 'web3-core-method'; -export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { +export default class MethodModelFactory extends AbstractMethodModelFactory { /** * @param {Object} utils @@ -33,9 +38,9 @@ export default class MethodModelFactory extends web3CoreMethod.AbstractMethodMod constructor(utils, formatters) { super( { - getGasPrice: web3CoreMethod.GetGasPriceMethodModel, - getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, - getId: web3CoreMethod.VersionMethodModel + getGasPrice: GetGasPriceMethodModel, + getTransactionCount: GetTransactionCountMethodModel, + getId: VersionMethodModel }, utils, formatters diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index b04b0b00a03..4e7aa4280eb 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -21,10 +21,10 @@ */ import {MethodController} from 'web3-core-method'; -import * as ProvidersPackage from 'web3-providers'; +import {ProvidersModuleFactory, providers} from 'web3-providers'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; -import {AccountsModuleFactory} from './factories/AccountsModuleFactory' +import AccountsModuleFactory from './factories/AccountsModuleFactory' /** * Returns the Accounts object @@ -36,11 +36,14 @@ import {AccountsModuleFactory} from './factories/AccountsModuleFactory' * @returns {Accounts} */ export const Accounts = (provider) => { - return new AccountsModuleFactory().createAccounts( + const providersModuleFactory = new ProvidersModuleFactory(); + + return new AccountsModuleFactory(Utils, formatters).createAccounts( provider, - ProvidersPackage, - new MethodController(), - Utils, - formatters + providersModuleFactory.createProviderDetector(), + providersModuleFactory.createProviderAdapterResolver(), + providersModuleFactory, + providers, + new MethodController() ); }; diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 974bfbeb92b..0afdf7da59b 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -26,10 +26,13 @@ export default class Contract extends AbstractWeb3Module { /** * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController - * @param {ContractModuleFactory} contractPackageFactory - * @param {PromiEventPackage} promiEventPackage + * @param {ContractModuleFactory} contractModuleFactory + * @param {PromiEvent} promiEvent * @param {ABICoder} abiCoder * @param {Object} utils * @param {Object} formatters @@ -43,10 +46,13 @@ export default class Contract extends AbstractWeb3Module { */ constructor( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, - contractPackageFactory, - promiEventPackage, + contractModuleFactory, + promiEvent, abiCoder, utils, formatters, @@ -56,10 +62,14 @@ export default class Contract extends AbstractWeb3Module { address, options ) { + super( provider, - providersPackage, - null, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + methodController, null ); @@ -71,17 +81,15 @@ export default class Contract extends AbstractWeb3Module { throw new Error('You must provide the json interface of the contract when instantiating a contract object.'); } - this.providersPackage = providersPackage; - this.methodController = methodController; - this.contractPackageFactory = contractPackageFactory; + this.contractModuleFactory = contractModuleFactory; this.abiCoder = abiCoder; this.utils = utils; this.formatters = formatters; this.accounts = accounts; this.abiMapper = abiMapper; this.options = options; - this.promiEventPackage = promiEventPackage; - this.rpcMethodModelFactory = contractPackageFactory.createRpcMethodModelFactory(); + this.promiEvent = promiEvent; + this.rpcMethodModelFactory = contractModuleFactory.createRpcMethodModelFactory(); this._defaultAccount = null; this._defaultBlock = 'latest'; this.abiModel = abiMapper.map(abi); @@ -109,14 +117,14 @@ export default class Contract extends AbstractWeb3Module { enumerable: true }); - this.methods = contractPackageFactory.createMethodsProxy( + this.methods = contractModuleFactory.createMethodsProxy( this, this.abiModel, this.methodController, - this.promiEventPackage + this.promiEvent ); - this.events = contractPackageFactory.createEventSubscriptionsProxy( + this.events = contractModuleFactory.createEventSubscriptionsProxy( this, this.abiModel, this.methodController @@ -247,10 +255,13 @@ export default class Contract extends AbstractWeb3Module { clone() { const contract = new this.constructor( this.currentProvider, - this.providersPackage, + this.providerDetector, + this.providerAdapterResolver, + this.providersModuleFactory, + this.providers, this.methodController, - this.contractPackageFactory, - this.promiEventPackage, + this.contractModuleFactory, + this.promiEvent, this.abiCoder, this.utils, this.formatters, diff --git a/packages/web3-eth-contract/src/factories/ContractModuleFactory.js b/packages/web3-eth-contract/src/factories/ContractModuleFactory.js index 308865905c1..e06f4dced9a 100644 --- a/packages/web3-eth-contract/src/factories/ContractModuleFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractModuleFactory.js @@ -37,6 +37,7 @@ import EventSubscriptionsProxy from '../proxies/EventSubscriptionsProxy'; import RpcMethodOptionsValidator from '../validators/RpcMethodOptionsValidator'; import RpcMethodFactory from '../factories/RpcMethodModelFactory'; import EventSubscriptionFactory from '../factories/EventSubscriptionFactory'; +import Contract from '../Contract'; export default class ContractModuleFactory { @@ -60,8 +61,11 @@ export default class ContractModuleFactory { * * @method createContract * - * @param {*} provider - * @param {ProvidersPackage} providersPackage + * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController * @param {PromiEventPackage} promiEventPackage * @param {Object} abi @@ -72,7 +76,10 @@ export default class ContractModuleFactory { */ createContract( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, promiEventPackage, abi, @@ -81,8 +88,11 @@ export default class ContractModuleFactory { ) { return new Contract( provider, - providersPackage, - new MethodController(), + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + methodController, this, promiEventPackage, this.abiCoder, @@ -267,11 +277,11 @@ export default class ContractModuleFactory { * @param {Contract} contract * @param {ABIModel} abiModel * @param {MethodController} methodController - * @param {PromiEventPackage} promiEventPackage + * @param {PromiEvent} promiEvent * * @returns {MethodsProxy} */ - createMethodsProxy(contract, abiModel, methodController, promiEventPackage) { + createMethodsProxy(contract, abiModel, methodController, promiEvent) { return new MethodsProxy( contract, abiModel, @@ -280,7 +290,7 @@ export default class ContractModuleFactory { this.createMethodEncoder(), this.createRpcMethodOptionsValidator(), this.createRpcMethodOptionsMapper(), - promiEventPackage + promiEvent ); } diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index ce79ffc9c10..431f8892eef 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -20,12 +20,12 @@ * @date 2018 */ -import * as PromiEventPackage from 'web3-core-promievent'; +import PromiEvent from 'web3-core-promievent'; import {MethodController} from 'web3-core-method'; -import * as ProvidersPackage from 'web3-providers'; import {formatters} from 'web3-core-helpers'; import Utils from 'web3-utils'; -import {AbiCoder} from 'web3-eth-abi'; +import {ABICoder} from 'web3-eth-abi'; +import {providers, ProvidersModuleFactory} from 'web3-providers'; import ContractModuleFactory from './factories/ContractModuleFactory'; /** @@ -42,16 +42,21 @@ import ContractModuleFactory from './factories/ContractModuleFactory'; * @returns {Contract} */ export const Contract = (provider, accounts, abi, address, options) => { + const providersModuleFactory = new ProvidersModuleFactory(); + return new ContractModuleFactory( Utils, formatters, - new AbiCoder(), + new ABICoder(), accounts ).createContract( provider, - ProvidersPackage, + providersModuleFactory.createProviderDetector(), + providersModuleFactory.createProviderAdapterResolver(), + providersModuleFactory, + providers, new MethodController(), - PromiEventPackage, + PromiEvent, abi, address, options diff --git a/packages/web3-eth-contract/src/mappers/ABIMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js index 8cc88db01f6..175f96645ca 100644 --- a/packages/web3-eth-contract/src/mappers/ABIMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file ABIMapper.js diff --git a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js index 8caa9bacf45..86729403cbd 100644 --- a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js @@ -21,6 +21,7 @@ */ export default class RpcMethodOptionsMapper { + /** * @param {Object} utils * @param {Object} formatters diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index 2eb0cb6c648..64e77ea7259 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file ABIItemModel.js diff --git a/packages/web3-eth-contract/src/models/abi/ABIModel.js b/packages/web3-eth-contract/src/models/abi/ABIModel.js index 5a695d8906d..939d7a7a663 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIModel.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file ABIModel.js diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js index 2dcdcd9d078..cc6b069584c 100644 --- a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file CallContractMethodModel.js diff --git a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js index d1331470003..c97e983ddbb 100644 --- a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file ContractDeployMethodModel.js diff --git a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js index f8d912f691c..599e9141f7d 100644 --- a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file PastEventLogsMethodModel.js diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js index 3cd54f0907b..7d58fac102e 100644 --- a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file SendContractMethodModel.js diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 930866b65d8..88b23c4ee88 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file EventSubscriptionsProxy.js diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index 6dc469a689b..c580d967db6 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -1,18 +1,18 @@ /* - This file is part of web3.js. + 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 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. + 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 . + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ /** * @file MethodsProxy.js @@ -30,7 +30,7 @@ export default class MethodsProxy { * @param {MethodEncoder} methodEncoder * @param {RpcMethodOptionsValidator} rpcMethodOptionsValidator * @param {RpcMethodOptionsMapper} rpcMethodOptionsMapper - * @param {PromiEventPackage} promiEventPackage + * @param {PromiEvent} promiEvent * * @constructor */ @@ -42,7 +42,7 @@ export default class MethodsProxy { methodEncoder, rpcMethodOptionsValidator, rpcMethodOptionsMapper, - promiEventPackage + promiEvent ) { this.contract = contract; this.abiModel = abiModel; @@ -51,7 +51,7 @@ export default class MethodsProxy { this.methodEncoder = methodEncoder; this.rpcMethodOptionsValidator = rpcMethodOptionsValidator; this.rpcMethodOptionsMapper = rpcMethodOptionsMapper; - this.promiEventPackage = promiEventPackage; + this.promiEvent = promiEvent; return new Proxy(this, { get: this.proxyHandler @@ -222,7 +222,7 @@ export default class MethodsProxy { } /** - * Creates an promiEvent and rejects it with an error + * Creates an PromiEvent object and rejects it with an error * * @method handleValidationError * @@ -233,7 +233,7 @@ export default class MethodsProxy { * @returns {PromiEvent} */ handleValidationError(error, callback) { - const promiEvent = new this.promiEventPackage.PromiEvent(); + const promiEvent = new this.promiEvent(); promiEvent.resolve(null); promiEvent.reject(error); diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index c7cae2ed301..7d31aed7259 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -23,24 +23,25 @@ import namehash from 'eth-ens-namehash'; export default class Registry { /** + * // TODO: Contract should be implemented over dependency inversion and not dependency injection * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Accounts} accounts - * @param {ContractPackage} contractPackage + * @param {Contract} contractObject * @param {Object} registryABI * @param {Object} resolverABI * * @constructor */ - constructor(provider, accounts, contractPackage, registryABI, resolverABI) { + constructor(provider, accounts, contractObject, registryABI, resolverABI) { this.net = net; this.accounts = accounts; - this.contractPackage = contractPackage; + this.contractObject = contractObject; this.registryABI = registryABI; this.resolverABI = resolverABI; this.provider = provider; this.contract = this.checkNetwork().then(address => { - return new this.contractPackage.Contract( + return new this.contractObject( this.provider, this.accounts, this.registryABI, @@ -112,7 +113,7 @@ export default class Registry { return this.contract.then(contract => { return contract.methods.resolver(namehash.hash(name)).call(); }).then(address => { - return new this.contractPackage.Contract( + return new this.Contract.Contract( this.provider, this.accounts, this.resolverABI, diff --git a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js b/packages/web3-eth-ens/src/factories/ENSModuleFactory.js similarity index 71% rename from packages/web3-eth-ens/src/factories/ENSPackageFactory.js rename to packages/web3-eth-ens/src/factories/ENSModuleFactory.js index 8dbb3d77b0a..011723d8e3c 100644 --- a/packages/web3-eth-ens/src/factories/ENSPackageFactory.js +++ b/packages/web3-eth-ens/src/factories/ENSModuleFactory.js @@ -12,16 +12,16 @@ along with web3.js. If not, see . */ /** - * @file ENSPackageFactory.js + * @file ENSModuleFactory.js * @author Samuel Furter * @date 2018 */ -import ENS from './ENS'; -import Registry from './contracts/Registry'; +import ENS from '../ENS'; +import Registry from '../contracts/Registry'; import ResolverMethodHandler from '../handlers/ResolverMethodHandler'; -export default class ENSPackageFactory { +export default class ENSModuleFactory { /** * Returns an object of type ENS @@ -31,10 +31,10 @@ export default class ENSPackageFactory { * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Network} net * @param {Accounts} accounts - * @param {ContractPackage} contractPackage + * @param {Contract} Contract * @param {Object} registryAbi * @param {Object} resolverAbi - * @param {PromiEventPackage} promiEventPackage + * @param {PromiEvent} PromiEvent * * @returns {ENS} */ @@ -42,14 +42,14 @@ export default class ENSPackageFactory { provider, net, accounts, - contractPackage, + Contract, registryAbi, resolverAbi, - promiEventPackage + PromiEvent ) { - const registry = this.createRegistry(provider, net, accounts, contractPackage, registryAbi, resolverAbi); + const registry = this.createRegistry(provider, net, accounts, Contract, registryAbi, resolverAbi); - return new ENS(registry, this.createResolverMethodHandler(registry, promiEventPackage)); + return new ENS(registry, this.createResolverMethodHandler(registry, PromiEvent)); } /** @@ -60,14 +60,14 @@ export default class ENSPackageFactory { * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {Network} net * @param {Accounts} accounts - * @param {ContractPackage} contractPackage + * @param {Contract} Contract * @param {Object} registryAbi * @param {Object} resolverAbi * * @returns {Registry} */ - createRegistry(provider, net, accounts, contractPackage, registryAbi, resolverAbi) { - return new Registry(provider, net, accounts, contractPackage, registryAbi, resolverAbi); + createRegistry(provider, net, accounts, Contract, registryAbi, resolverAbi) { + return new Registry(provider, net, accounts, Contract, registryAbi, resolverAbi); } /** @@ -76,11 +76,11 @@ export default class ENSPackageFactory { * @method createResolverMethodHandler * * @param {Registry} registry - * @param {PromiEventPackage} promiEventPackage + * @param {PromiEvent} PromiEvent * * @returns {ResolverMethodHandler} */ - createResolverMethodHandler(registry, promiEventPackage) { - return new ResolverMethodHandler(registry, promiEventPackage); + createResolverMethodHandler(registry, PromiEvent) { + return new ResolverMethodHandler(registry, PromiEvent); } } diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index 99b5da6f895..ecb55601533 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -17,14 +17,15 @@ * @date 2018 */ -import * as ContractPackage from 'web3-eth-contract'; -import * as PromiEventPackage from 'web3-core-promievent'; +import {Contract} from 'web3-eth-contract'; +import {PromiEvent} from 'web3-core-promievent'; import REGISTRY_ABI from '../ressources/ABI/Registry'; import RESOLVER_ABI from '../ressources/ABI/Resolver'; -import ENSPackageFactory from './factories/ENSPackageFactory'; +import ENSModuleFactory from './factories/ENSModuleFactory'; /** - * TODO: Overthink the module structure + * TODO: Contracts should be implemented over dependency inversion not injection. + * TODO: Refactor ENS * Returns the ENS object * * @method ENS @@ -36,13 +37,13 @@ import ENSPackageFactory from './factories/ENSPackageFactory'; * @returns {ENS} */ export const ENS = (provider, net, accounts) => { - return new ENSPackageFactory().createENS( + return new ENSModuleFactory().createENS( provider, net, accounts, - ContractPackage, + Contract, REGISTRY_ABI, RESOLVER_ABI, - PromiEventPackage + PromiEvent ); }; diff --git a/packages/web3-eth-iban/src/Iban.js b/packages/web3-eth-iban/src/Iban.js index 5bf5751b268..d33cbe1a5fa 100644 --- a/packages/web3-eth-iban/src/Iban.js +++ b/packages/web3-eth-iban/src/Iban.js @@ -25,10 +25,9 @@ "use strict"; -import utils from 'web3-utils'; +import Utils from 'web3-utils'; import BigNumber from 'bn.js'; - const leftPad = (string, bytes) => { let result = string; while (result.length < bytes * 2) { @@ -134,7 +133,7 @@ export default class Iban { * @returns {Iban} the IBAN object */ static fromAddress(address) { - if (!utils.isAddress(address)) { + if (!Utils.isAddress(address)) { throw new Error(`Provided address is not a valid address: ${address}`); } @@ -274,7 +273,7 @@ export default class Iban { if (this.isDirect()) { const base36 = this._iban.substr(4); const asBn = new BigNumber(base36, 36); - return utils.toChecksumAddress(asBn.toString(16, 20)); + return Utils.toChecksumAddress(asBn.toString(16, 20)); } return ''; diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 06a44cd263e..7a11a941ea6 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -28,7 +28,10 @@ export default class Personal extends AbstractWeb3Module { * TODO: Add missing documentation for getAccounts, lockAccount, importRawKey and sendTransaction! * * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {Network} net @@ -39,7 +42,10 @@ export default class Personal extends AbstractWeb3Module { */ constructor( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, methodModelFactory, net, @@ -48,7 +54,10 @@ export default class Personal extends AbstractWeb3Module { ) { super( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, methodModelFactory ); diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index 9124f66d96e..56c85395857 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -20,9 +20,20 @@ * @date 2018 */ -import * as web3CoreMethod from 'web3-core-method'; +import { + AbstractMethodModelFactory, + GetAccountsMethodModel, + NewAccountMethodModel, + UnlockAccountMethodModel, + LockAccountMethodModel, + ImportRawKeyMethodModel, + PersonalSendTransactionMethodModel, + PersonalSignTransactionMethodModel, + PersonalSignMethodModel, + EcRecoverMethodModel +} from 'web3-core-method'; -export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { +export default class MethodModelFactory extends AbstractMethodModelFactory { /** * @param {Object} utils @@ -33,15 +44,15 @@ export default class MethodModelFactory extends web3CoreMethod.AbstractMethodMod constructor(utils, formatters) { super( { - getAccounts: web3CoreMethod.GetAccountsMethodModel, - newAccount: web3CoreMethod.NewAccountMethodModel, - unlockAccount: web3CoreMethod.UnlockAccountMethodModel, - lockAccount: web3CoreMethod.LockAccountMethodModel, - importRawKey: web3CoreMethod.ImportRawKeyMethodModel, - sendTransaction: web3CoreMethod.PersonalSendTransactionMethodModel, - signTransaction: web3CoreMethod.PersonalSignTransactionMethodModel, - sign: web3CoreMethod.PersonalSignMethodModel, - ecRecover: web3CoreMethod.EcRecoverMethodModel + getAccounts: GetAccountsMethodModel, + newAccount: NewAccountMethodModel, + unlockAccount: UnlockAccountMethodModel, + lockAccount: LockAccountMethodModel, + importRawKey: ImportRawKeyMethodModel, + sendTransaction: PersonalSendTransactionMethodModel, + signTransaction: PersonalSignTransactionMethodModel, + sign: PersonalSignMethodModel, + ecRecover: EcRecoverMethodModel }, utils, formatters diff --git a/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js b/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js index 830d3b5dc71..d5b0e6491ed 100644 --- a/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js +++ b/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js @@ -20,8 +20,8 @@ * @date 2018 */ -import {Personal} from "../Personal"; -import MethodModelFactory from "./MethodModelFactory"; +import Personal from '../Personal'; +import MethodModelFactory from './MethodModelFactory'; export default class PersonalModuleFactory { @@ -42,7 +42,10 @@ export default class PersonalModuleFactory { * @method createPersonal * * @param {AbstractProviderAdapter} provider - * @param {ProvidersPackage} providersPackage + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController * @param {Network} net * @@ -50,18 +53,24 @@ export default class PersonalModuleFactory { */ createPersonal( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, - net, + net ) { return new Personal( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, this.createMethodModelFactory(), net, - utils, - formatters + this.utils, + this.formatters ); } diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 44b276dbd16..8609e347211 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -22,10 +22,10 @@ import {MethodController} from 'web3-core-method'; import {Network} from 'web3-net'; -import * as ProvidersPackage from 'web3-providers'; +import {ProvidersModuleFactory, providers} from 'web3-providers'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; -import {PersonalModuleFactory} from './factories/PersonalModuleFactory'; +import PersonalModuleFactory from './factories/PersonalModuleFactory'; /** * Returns the Personal object @@ -37,10 +37,15 @@ import {PersonalModuleFactory} from './factories/PersonalModuleFactory'; * @returns {Personal} */ export const Personal = (provider) => { + const providersModuleFactory = new ProvidersModuleFactory(); + return new PersonalModuleFactory(Utils, formatters).createPersonalModule( provider, - ProvidersPackage, + providersModuleFactory.createProviderDetector(), + providersModuleFactory.createProviderAdapterResolver(), + providersModuleFactory, + providers, new MethodController(), - new Network(provider), + new Network(provider) ); }; diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 0681c1cfd11..7bad9164bb8 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -26,16 +26,19 @@ export default class Eth extends AbstractWeb3Module { /** * @param {AbstractProviderAdapter|EthereumProvider} provider + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {Network} net - * @param {ContractPackage} contractPackage + * @param {Contract} contract * @param {Accounts} accounts * @param {Personal} personal * @param {Iban} iban - * @param {Abi} abi + * @param {ABICoder} abiCoder * @param {ENS} ens * @param {Object} utils * @param {Object} formatters - * @param {ProvidersPackage} providersPackage * @param {SubscriptionsFactory} subscriptionsFactory * @param {MethodModelFactory} methodModelFactory * @param {MethodController} methodController @@ -44,23 +47,29 @@ export default class Eth extends AbstractWeb3Module { */ constructor( provider, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + methodController, + methodModelFactory, net, - contractPackage, + contract, accounts, personal, iban, - abi, + abiCoder, ens, utils, formatters, - providersPackage, - subscriptionsFactory, - methodController, - methodModelFactory + subscriptionsFactory ) { super( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, methodModelFactory ); @@ -69,7 +78,7 @@ export default class Eth extends AbstractWeb3Module { this.accounts = accounts; this.personal = personal; this.Iban = Iban; - this.abi = abi; + this.abi = abiCoder; this.ens = ens; this.utils = utils; this.formatters = formatters; @@ -90,10 +99,10 @@ export default class Eth extends AbstractWeb3Module { * @constructor */ this.Contract = (abi, address, options) => { - const contract = new contractPackage.Contract(this.currentProvider, this.accounts, abi, address, options); - this.initiatedContracts.push(contract); + const contractObject = new contract(this.currentProvider, this.accounts, abi, address, options); + this.initiatedContracts.push(contractObject); - return contract; + return contractObject; }; } diff --git a/packages/web3-eth/src/factories/EthModuleFactory.js b/packages/web3-eth/src/factories/EthModuleFactory.js index 8f547fbe663..bb5b91e71fe 100644 --- a/packages/web3-eth/src/factories/EthModuleFactory.js +++ b/packages/web3-eth/src/factories/EthModuleFactory.js @@ -20,8 +20,8 @@ * @date 2018 */ -import {MethodModelFactory} from './MethodModelFactory'; -import {Eth} from '../Eth'; +import MethodModelFactory from './MethodModelFactory'; +import Eth from '../Eth'; export default class EthModuleFactory { @@ -42,6 +42,10 @@ export default class EthModuleFactory { * @method createEthModule * * @param {AbstractProviderAdapter} provider + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {Network} net * @param {ContractPackage} contractPackage * @param {Accounts} accounts @@ -49,7 +53,6 @@ export default class EthModuleFactory { * @param {Iban} iban * @param {Abi} abi * @param {ENS} ens - * @param {ProvidersPackage} providersPackage * @param {SubscriptionsFactory} subscriptionsFactory * @param {MethodController} methodController * @@ -57,6 +60,11 @@ export default class EthModuleFactory { */ createEthModule( provider, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + methodController, net, contractPackage, accounts, @@ -64,12 +72,16 @@ export default class EthModuleFactory { iban, abi, ens, - providersPackage, subscriptionsFactory, - methodController ) { return new Eth( provider, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + methodController, + this.createMethodModelFactory(accounts), net, contractPackage, accounts, @@ -79,10 +91,7 @@ export default class EthModuleFactory { ens, this.utils, this.formatters, - providersPackage, - subscriptionsFactory, - methodController, - this.createMethodModelFactory(accounts) + subscriptionsFactory ); } diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 327f5389edd..b0dac782829 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -23,7 +23,7 @@ import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; import {Network} from 'web3-net'; -import * as ProvidersPackage from 'web3-providers'; +import {ProvidersModuleFactory, providers} from 'web3-providers'; import Utils from 'web3-utils'; import {Accounts} from 'web3-eth-accounts'; import {Personal} from 'web3-eth-personal'; @@ -31,8 +31,8 @@ import {ENS} from 'web3-eth-ens'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {AbiCoder} from 'web3-eth-abi'; import {Iban} from 'web3-eth-iban'; -import * as ContractPackage from 'web3-eth-contract'; -import {EthModuleFactory} from './factories/EthModuleFactory'; +import {Contract} from 'web3-eth-contract'; +import EthModuleFactory from './factories/EthModuleFactory'; /** * Creates the Eth object @@ -44,17 +44,22 @@ import {EthModuleFactory} from './factories/EthModuleFactory'; * @returns {Eth} */ export const Eth = (provider) => { + const providersModuleFactory = new ProvidersModuleFactory(); + return new EthModuleFactory(Utils, formatters).createEthModule( provider, - new Network(provider), - ContractPackage, + providersModuleFactory.createProviderDetector(), + providersModuleFactory.createProviderAdapterResolver(), + providersModuleFactory, + providers, + new MethodController(), + new Network(), + Contract, new Accounts(provider), new Personal(provider), Iban, new AbiCoder(Utils), new ENS(provider), - ProvidersPackage, new SubscriptionsFactory(), - new MethodController() ); }; diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index 84d5f1dd3e4..4b27d4161e8 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -27,7 +27,10 @@ export default class Network extends AbstractWeb3Module { /** * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {Object} formatters @@ -37,7 +40,10 @@ export default class Network extends AbstractWeb3Module { */ constructor( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, methodModelFactory, formatters, @@ -45,7 +51,10 @@ export default class Network extends AbstractWeb3Module { ) { super( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, methodModelFactory ); diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index 1c975c66206..3eab0b20d47 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -20,9 +20,15 @@ * @date 2018 */ -import * as web3CoreMethod from 'web3-core-method'; +import { + AbstractMethodModelFactory, + VersionMethodModel, + GetBlockMethodModel, + ListeningMethodModel, + PeerCountMethodModel +} from 'web3-core-method'; -export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { +export default class MethodModelFactory extends AbstractMethodModelFactory { /** * @param {Object} utils @@ -33,10 +39,10 @@ export default class MethodModelFactory extends web3CoreMethod.AbstractMethodMod constructor(utils, formatters) { super( { - getId: web3CoreMethod.VersionMethodModel, - getBlock: web3CoreMethod.GetBlockMethodModel, - isListening: web3CoreMethod.ListeningMethodModel, - getPeerCount: web3CoreMethod.PeerCountMethodModel, + getId: VersionMethodModel, + getBlock: GetBlockMethodModel, + isListening: ListeningMethodModel, + getPeerCount: PeerCountMethodModel, }, utils, formatters diff --git a/packages/web3-net/src/factories/NetworkModuleFactory.js b/packages/web3-net/src/factories/NetworkModuleFactory.js index 6e2582943e3..5b728dbb274 100644 --- a/packages/web3-net/src/factories/NetworkModuleFactory.js +++ b/packages/web3-net/src/factories/NetworkModuleFactory.js @@ -20,7 +20,7 @@ * @date 2018 */ -import {Network} from "../Network"; +import Network from "../Network"; import MethodModelFactory from "./MethodModelFactory"; export default class NetworkModuleFactory { @@ -42,15 +42,28 @@ export default class NetworkModuleFactory { * @method createNetworkModule * * @param {AbstractProviderAdapter} provider - * @param {ProvidersPackage} providersPackage + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController * * @returns {Network} */ - createNetworkModule(provider, providersPackage, methodController) { + createNetworkModule( + provider, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + methodController + ) { return new Network( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, this.createMethodModelFactory(), this.formatters, diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index daeeb65e974..cec58d1475e 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -21,7 +21,7 @@ * @date 2018 */ -import * as ProvidersPackage from 'web3-providers'; +import {ProvidersModuleFactory, providers} from 'web3-providers'; import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; import Utils from 'web3-utils'; @@ -37,9 +37,14 @@ import NetworkModuleFactory from "./factories/NetworkModuleFactory"; * @returns {Network} */ export const Network = (provider) => { + const providersModuleFactory = new ProvidersModuleFactory(); + return new NetworkModuleFactory(Utils, formatters).createNetworkModule( provider, - ProvidersPackage, + providersModuleFactory.createProviderDetector(), + providersModuleFactory.createProviderAdapterResolver(), + providersModuleFactory, + providers, new MethodController(), ) }; diff --git a/packages/web3-providers/src/factories/ProvidersModuleFactory.js b/packages/web3-providers/src/factories/ProvidersModuleFactory.js index 3f7165847b1..f55a84b3de0 100644 --- a/packages/web3-providers/src/factories/ProvidersModuleFactory.js +++ b/packages/web3-providers/src/factories/ProvidersModuleFactory.js @@ -30,7 +30,7 @@ import IpcProvider from '../providers/IpcProvider'; import HttpProvider from '../providers/HttpProvider'; import JSONRpcResponseValidator from '../validators/JSONRpcResponseValidator'; import JSONRpcMapper from '../mappers/JSONRpcMapper'; -import {BatchRequest} from '../batch-request/BatchRequest'; +import BatchRequest from '../batch-request/BatchRequest'; export default class ProvidersModuleFactory { diff --git a/packages/web3-providers/src/index.js b/packages/web3-providers/src/index.js index 9d87f7381dc..74aa54369f0 100644 --- a/packages/web3-providers/src/index.js +++ b/packages/web3-providers/src/index.js @@ -19,12 +19,19 @@ import ProvidersModuleFactory from './factories/ProvidersModuleFactory'; -export {SocketProviderAdapter} from './adapters/SocketProviderAdapter'; -export {HttpProviderAdapter} from './adapters/HttpProviderAdapter'; -export {HttpProvider} from './providers/HttpProvider'; -export {IpcProvider} from './providers/IpcProvider'; -export {WebsocketProvider} from './providers/WebsocketProvider'; -export {JSONRpcResponseValidator} from './validators/JSONRpcResponseValidator'; +export SocketProviderAdapter from './adapters/SocketProviderAdapter'; +export HttpProviderAdapter from './adapters/HttpProviderAdapter'; +export HttpProvider from './providers/HttpProvider'; +export IpcProvider from './providers/IpcProvider'; +export WebsocketProvider from './providers/WebsocketProvider'; +export JSONRpcResponseValidator from './validators/JSONRpcResponseValidator'; +export ProvidersModuleFactory from './factories/ProvidersModuleFactory'; + +export const providers = { + HttpProvider, + WebsocketProvider, + IpcProvider +}; /** * Creates the BatchRequest object @@ -58,5 +65,5 @@ export const ProviderAdapterResolver = () => { * @returns {Object} */ export const ProviderDetector = () => { - return new ProvidersModuleFactory().createProviderDetector().detect(); + return new ProvidersModuleFactory().createProviderDetector(); }; diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index 340305e92ba..e975b148d60 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -26,7 +26,10 @@ export default class Shh extends AbstractWeb3Module { /** * @param {AbstractProviderAdapter|EthereumProvider} provider - * @param {ProvidersPackage} providersPackage + * @param {ProviderDetector} providerDetector + * @param {ProviderAdapterResolver} providerAdapterResolver + * @param {ProvidersModuleFactory} providersModuleFactory + * @param {Object} providers * @param {MethodController} methodController * @param {MethodModelFactory} methodModelFactory * @param {SubscriptionsFactory} subscriptionsFactory @@ -36,13 +39,26 @@ export default class Shh extends AbstractWeb3Module { */ constructor( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, methodModelFactory, subscriptionsFactory, net ) { - super(provider, providersPackage, methodController, methodModelFactory); + super( + provider, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + methodController, + methodModelFactory + ); + + this.subscriptionsFactory = subscriptionsFactory; this.net = net; } diff --git a/packages/web3-shh/src/factories/MethodModelFactory.js b/packages/web3-shh/src/factories/MethodModelFactory.js index 5be38fd6958..d8acc535bef 100644 --- a/packages/web3-shh/src/factories/MethodModelFactory.js +++ b/packages/web3-shh/src/factories/MethodModelFactory.js @@ -20,9 +20,32 @@ * @date 2018 */ -import * as web3CoreMethod from 'web3-core-method'; +import { + AbstractMethodModelFactory, + ShhVersionMethodModel, + GetInfoMethodModel, + SetMaxMessageSizeMethodModel, + SetMinPoWMethodModel, + MarkTrustedPeerMethodModel, + NewKeyPairMethodModel, + AddPrivateKeyMethodModel, + DeleteKeyPairMethodModel, + HasKeyPairMethodModel, + GetPublicKeyMethodModel, + GetPrivateKeyMethodModel, + NewSymKeyMethodModel, + AddSymKeyMethodModel, + GenerateSymKeyFromPasswordMethodModel, + HasSymKeyMethodModel, + GetSymKeyMethodModel, + DeleteSymKeyMethodModel, + NewMessageFilterMethodModel, + GetFilterMessagesMethodModel, + DeleteMessageFilterMethodModel, + PostMethodModel +} from 'web3-core-method'; -export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { +export default class MethodModelFactory extends AbstractMethodModelFactory { /** * @param {Object} utils @@ -33,27 +56,27 @@ export default class MethodModelFactory extends web3CoreMethod.AbstractMethodMod constructor(utils, formatters) { super( { - getVersion: web3CoreMethod.ShhVersionMethodModel, - getInfo: web3CoreMethod.GetInfoMethodModel, - setMaxMessageSize: web3CoreMethod.SetMaxMessageSizeMethodModel, - setMinPoW: web3CoreMethod.SetMinPoWMethodModel, - markTrustedPeer: web3CoreMethod.MarkTrustedPeerMethodModel, - newKeyPair: web3CoreMethod.NewKeyPairMethodModel, - addPrivateKey: web3CoreMethod.AddPrivateKeyMethodModel, - deleteKeyPair: web3CoreMethod.DeleteKeyPairMethodModel, - hasKeyPair: web3CoreMethod.HasKeyPairMethodModel, - getPublicKey: web3CoreMethod.GetPublicKeyMethodModel, - getPrivateKey: web3CoreMethod.GetPrivateKeyMethodModel, - newSymKey: web3CoreMethod.NewSymKeyMethodModel, - addSymKey: web3CoreMethod.AddSymKeyMethodModel, - generateSymKeyFromPassword: web3CoreMethod.GenerateSymKeyFromPasswordMethodModel, - hasSymKey: web3CoreMethod.HasSymKeyMethodModel, - getSymKey: web3CoreMethod.GetSymKeyMethodModel, - deleteSymKey: web3CoreMethod.DeleteSymKeyMethodModel, - newMessageFilter: web3CoreMethod.NewMessageFilterMethodModel, - getFilterMessages: web3CoreMethod.GetFilterMessagesMethodModel, - deleteMessageFilter: web3CoreMethod.DeleteMessageFilterMethodModel, - post: web3CoreMethod.PostMethodModel, + getVersion: ShhVersionMethodModel, + getInfo: GetInfoMethodModel, + setMaxMessageSize: SetMaxMessageSizeMethodModel, + setMinPoW: SetMinPoWMethodModel, + markTrustedPeer: MarkTrustedPeerMethodModel, + newKeyPair: NewKeyPairMethodModel, + addPrivateKey: AddPrivateKeyMethodModel, + deleteKeyPair: DeleteKeyPairMethodModel, + hasKeyPair: HasKeyPairMethodModel, + getPublicKey: GetPublicKeyMethodModel, + getPrivateKey: GetPrivateKeyMethodModel, + newSymKey: NewSymKeyMethodModel, + addSymKey: AddSymKeyMethodModel, + generateSymKeyFromPassword: GenerateSymKeyFromPasswordMethodModel, + hasSymKey: HasSymKeyMethodModel, + getSymKey: GetSymKeyMethodModel, + deleteSymKey: DeleteSymKeyMethodModel, + newMessageFilter: NewMessageFilterMethodModel, + getFilterMessages: GetFilterMessagesMethodModel, + deleteMessageFilter: DeleteMessageFilterMethodModel, + post: PostMethodModel, }, utils, formatters diff --git a/packages/web3-shh/src/factories/ShhModuleFactory.js b/packages/web3-shh/src/factories/ShhModuleFactory.js index 834c6615b3e..0c620f388b2 100644 --- a/packages/web3-shh/src/factories/ShhModuleFactory.js +++ b/packages/web3-shh/src/factories/ShhModuleFactory.js @@ -20,32 +20,56 @@ * @date 2018 */ -import {Shh} from '../Shh'; +import Shh from '../Shh'; import MethodModelFactory from "./MethodModelFactory"; export default class ShhModuleFactory { + /** + * @param {Object} utils + * @param {Object} formatters + * + * @constructor + */ + constructor(utils, formatters) { + this.utils = utils; + this.formatters = formatters; + } + /** * Returns an object of type Shh * * @method createShhModule * * @param {AbstractProviderAdapter} provider - * @param {ProvidersPackage} providersPackage + * @param providerDetector + * @param providerAdapterResolver + * @param providersModuleFactory + * @param providers * @param {MethodController} methodController - * @param {SubscriptionsFacotry} subscriptionsFactory + * @param {SubscriptionsFactory} subscriptionsFactory * @param {Network} net - * @param {Object} utils - * @param {Object} formatters * * @returns {Shh} */ - createShhModule(provider, providersPackage, methodController, subscriptionsFactory, net, utils, formatters) { + createShhModule( + provider, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + methodController, + subscriptionsFactory, + net, + ) { return new Shh( provider, - providersPackage, + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, methodController, - this.createMethodModelFactory(utils, formatters), + this.createMethodModelFactory(), subscriptionsFactory, net ); @@ -56,12 +80,9 @@ export default class ShhModuleFactory { * * @method createMethodModelFactory * - * @param {Object} utils - * @param {Object} formatters - * * @returns {MethodModelFactory} */ - createMethodModelFactory(utils, formatters) { - return new MethodModelFactory(utils, formatters) + createMethodModelFactory() { + return new MethodModelFactory(this.utils, this.formatters) } } diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index dca89e49a15..6eb220286d5 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -20,14 +20,13 @@ * @date 2018 */ -import * as ProvidersPackage from 'web3-providers'; +import {ProvidersModuleFactory, providers} from 'web3-providers'; import {MethodController} from 'web3-core-method'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; import {Network} from 'web3-net'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; -import ShhModule from './Shh'; -import MethodModelFactory from './factories/MethodModelFactory'; +import ShhModuleFactory from './factories/ShhModuleFactory'; /** * Returns the Shh object. @@ -39,11 +38,15 @@ import MethodModelFactory from './factories/MethodModelFactory'; * @returns {Shh} */ export const Shh = (provider) => { - return new ShhModule( + const providersModuleFactory = new ProvidersModuleFactory(); + + return new ShhModuleFactory(Utils, formatters).createShhModule( provider, - ProvidersPackage, + providersModuleFactory.createProviderDetector(), + providersModuleFactory.createProviderAdapterResolver(), + providersModuleFactory, + providers, new MethodController(), - new MethodModelFactory(Utils, formatters), new SubscriptionsFactory(), new Network(provider) ); diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 2082e11c653..ebf784cda11 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -22,9 +22,9 @@ import {AbstractWeb3Module} from 'web3-core'; import {formatters} from 'web3-core-helpers'; -import * as MethodPackage from 'web3-core-method'; -import * as ProvidersPackage from 'web3-providers'; -import Utils from 'web3-utils'; +import {AbstractMethodModelFactory, MethodController} from 'web3-core-method'; +import {ProvidersModuleFactory, providers} from 'web3-providers'; +import {Utils} from 'web3-utils'; import {Eth} from 'web3-eth'; import {Shh} from 'web3-shh'; import {Bzz} from 'web3-bzz'; @@ -41,17 +41,22 @@ export default class Web3 extends AbstractWeb3Module { * @constructor */ constructor(provider, net) { - provider = ProvidersPackage.resolve(provider, net); + var providersModuleFactory = new ProvidersModuleFactory(); + var providerAdapterResolver = providersModuleFactory.createProviderAdapterResolver(); + var providerDetector = providersModuleFactory.createProviderDetector(); + + provider = providerAdapterResolver.resolve(provider, net); super( provider, - ProvidersPackage, - MethodPackage.createMethodController(), - new MethodPackage.AbstractMethodModelFactory({}, utils, formatters) + providerDetector, + providerAdapterResolver, + providersModuleFactory, + providers, + new MethodController(), + new AbstractMethodModelFactory({}, utils, formatters) ); - this.version = version; - this.utils = Utils; this.eth = new Eth(provider); this.shh = new Shh(provider); this.bzz = new Bzz(provider); @@ -82,7 +87,7 @@ export default class Web3 extends AbstractWeb3Module { * @returns {Object} */ static get givenProvider() { - return ProvidersPackage.detect(); + return new ProvidersModuleFactory().createProviderDetector().detect(); } /** @@ -109,21 +114,23 @@ export default class Web3 extends AbstractWeb3Module { * @returns {Object} */ static get modules() { + const providerAdapterResolver = new ProvidersModuleFactory().createProviderAdapterResolver(); + return { Eth: (provider, net) => { - return new Eth(ProvidersPackage.resolve(provider, net)); + return new Eth(providerAdapterResolver.resolve(provider, net)); }, Net: (provider, net) => { - return new Network(ProvidersPackage.resolve(provider, net)); + return new Network(providerAdapterResolver.resolve(provider, net)); }, Personal: (provider, net) => { - return new Personal(ProvidersPackage.resolve(provider, net)); + return new Personal(providerAdapterResolver.resolve(provider, net)); }, Shh: (provider, net) => { - return new Shh(ProvidersPackage.resolve(provider, net)); + return new Shh(providerAdapterResolver.resolve(provider, net)); }, Bzz: (provider, net) => { - return new Bzz(ProvidersPackage.resolve(provider, net)); + return new Bzz(providerAdapterResolver.resolve(provider, net)); } } } @@ -134,10 +141,6 @@ export default class Web3 extends AbstractWeb3Module { * @returns {Object} */ static get providers() { - return { - HttpProvider: ProvidersPackage.HttpProvider, - WebsocketProvider: ProvidersPackage.WebsocketProvider, - IpcProvider: ProvidersPackage.IpcProvider - } + return providers; } } From bf011a792a3bfc2f6e4b15e7dd9dbf6bd26f8024 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Sat, 20 Oct 2018 19:36:36 +0200 Subject: [PATCH 0300/1045] gulp removed and webpack with babel-loader added --- .bowerrc | 5 - bower.json | 75 - dist/web3.min.js | 18 +- gulpfile.js | 199 - package-lock.json | 7646 +++++++++++------ package.js | 2 +- package.json | 42 +- packages/web3-bzz/package-lock.json | 6 +- packages/web3-bzz/package.json | 2 +- packages/web3-bzz/src/Bzz.js | 6 +- packages/web3-core-helpers/package-lock.json | 6 +- packages/web3-core-helpers/package.json | 2 +- packages/web3-core-helpers/src/formatters.js | 20 +- packages/web3-core-method/package-lock.json | 825 +- packages/web3-core-method/package.json | 5 +- .../src/commands/SendMethodCommand.js | 6 +- .../validators/TransactionReceiptValidator.js | 4 +- .../web3-core-subscriptions/package-lock.json | 1943 ++--- .../src/Subscription.js | 14 +- packages/web3-core/src/AbstractWeb3Module.js | 6 +- packages/web3-eth-abi/package-lock.json | 1065 ++- packages/web3-eth-abi/src/ABICoder.js | 12 +- packages/web3-eth-accounts/package-lock.json | 122 + packages/web3-eth-accounts/package.json | 1 - packages/web3-eth-accounts/src/Accounts.js | 44 +- packages/web3-eth-contract/package-lock.json | 1224 ++- packages/web3-eth-contract/package.json | 10 +- packages/web3-eth-contract/src/index.js | 2 +- packages/web3-eth-ens/package-lock.json | 1384 ++- .../web3-eth-ens/src/contracts/Registry.js | 6 +- packages/web3-eth-iban/package-lock.json | 1083 ++- packages/web3-eth-personal/package-lock.json | 2237 +++++ packages/web3-eth/package.json | 2 +- packages/web3-eth/src/Eth.js | 2 +- .../src/factories/MethodModelFactory.js | 93 +- packages/web3-eth/src/index.js | 4 +- packages/web3-net/package-lock.json | 2227 +++++ packages/web3-providers/package-lock.json | 1066 +-- .../src/batch-request/BatchRequest.js | 10 +- .../src/providers/IpcProvider.js | 6 +- .../src/providers/WebsocketProvider.js | 2 +- .../src/resolvers/ProviderAdapterResolver.js | 2 +- packages/web3-shh/package-lock.json | 2237 +++++ packages/web3-utils/package-lock.json | 864 +- packages/web3-utils/package.json | 4 +- packages/web3-utils/src/index.js | 26 +- packages/web3-utils/src/soliditySha3.js | 12 +- packages/web3-utils/src/utils.js | 14 +- packages/web3/src/index.js | 2 +- webpack.config.js | 86 + 50 files changed, 18389 insertions(+), 6292 deletions(-) delete mode 100644 .bowerrc delete mode 100644 bower.json delete mode 100644 gulpfile.js create mode 100644 packages/web3-eth-personal/package-lock.json create mode 100644 packages/web3-net/package-lock.json create mode 100644 packages/web3-shh/package-lock.json create mode 100644 webpack.config.js diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 707e36bd665..00000000000 --- a/.bowerrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "directory": "bower", - "cwd": "./", - "analytics": false -} diff --git a/bower.json b/bower.json deleted file mode 100644 index d4280c051e4..00000000000 --- a/bower.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "namespace": "ethereum", - "name": "web3", - "version": "1.0.0-beta.36", - "description": "Ethereum JavaScript API", - "license": "LGPL-3.0", - "main": [ - "./dist/web3.min.js" - ], - "moduleType": "global", - "dependencies": { - "bn.js": ">=4.11.6" - }, - "repository": { - "type": "git", - "url": "git://github.com/ethereum/web3.js.git" - }, - "homepage": "https://github.com/ethereum/web3.js", - "bugs": { - "url": "https://github.com/ethereum/web3.js/issues" - }, - "keywords": [ - "Ethereum", - "JavaScript", - "RPC", - "Swarm", - "Whisper", - "Smart Contracts", - "API" - ], - "authors": [ - { - "name": "Fabian Vogelsteller", - "email": "fabian@ethereum.org", - "homepage": "http://frozeman.de" - }, - { - "name": "Marek Kotewicz", - "email": "marek@parity.io", - "url": "https://github.com/debris" - }, - { - "name": "Marian Oancea", - "url": "https://github.com/cubedro" - }, - { - "name": "Gav Wood", - "email": "g@parity.io", - "homepage": "http://gavwood.com" - }, - { - "name": "Jeffery Wilcke", - "email": "jeffrey.wilcke@ethereum.org", - "url": "https://github.com/obscuren" - } - ], - "ignore": [ - "test", - "packages", - "src", - "node_modules", - "package.json", - "package.js", - ".versions", - ".bowerrc", - ".editorconfig", - ".gitignore", - ".jshintrc", - ".npmignore", - ".travis.yml", - "gulpfile.js", - "index.js", - "**/*.txt" - ] -} diff --git a/dist/web3.min.js b/dist/web3.min.js index 7c15a5af91c..9f49d75bf3b 100644 --- a/dist/web3.min.js +++ b/dist/web3.min.js @@ -1 +1,17 @@ -"use strict";var _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(e){return void 0===e?"undefined":_typeof2(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":_typeof2(e)};!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Web3=e()}}(function(){var define,module,exports;return function o(a,s,u){function c(t,e){if(!s[t]){if(!a[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(f)return f(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[t]={exports:{}};a[t][0].call(i.exports,function(e){return c(a[t][1][e]||e)},i,i.exports,o,a,s,u)}return s[t].exports}for(var f="function"==typeof require&&require,e=0;e>6],i=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function h(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(4>=8)a++;(i=new c(2+a))[0]=o,i[1]=128|a;s=1+a;for(var u=n.length;0>=8)i[s]=255&u;return this._createEncoderBuffer([i,n])},s.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new c(2*e.length),n=0;n>=7)i++}var a=new c(i),s=a.length-1;for(n=e.length-1;0<=n;n--){o=e[n];for(a[s--]=127&o;0<(o>>=7);)a[s--]=128|127&o}return this._createEncoderBuffer(a)},s.prototype._encodeTime=function(e,t){var r,n=new Date(e);return"gentime"===t?r=[u(n.getFullYear()),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[u(n.getFullYear()%100),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!c.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new c(r)}if(c.isBuffer(e)){var n=e.length;0===e.length&&n++;var i=new c(n);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var o=e;256<=o;o>>=8)n++;for(o=(i=new Array(n)).length-1;0<=o;o--)i[o]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new c(i))},s.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},s.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},s.prototype._skipDefault=function(e,t,r){var n,i=this._baseState;if(null===i.default)return!1;var o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n>16&255,o[a++]=t>>8&255,o[a++]=255&t;var c,f;2===i&&(t=h[e.charCodeAt(u)]<<2|h[e.charCodeAt(u+1)]>>4,o[a++]=255&t);1===i&&(t=h[e.charCodeAt(u)]<<10|h[e.charCodeAt(u+1)]<<4|h[e.charCodeAt(u+2)]>>2,o[a++]=t>>8&255,o[a++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,a=r-n;o>2]+s[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"="));return i.join("")};for(var s=[],h=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},{}],16:[function(e,t,r){var n;function i(e){this.rand=e}if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},(t.exports.Rand=i).prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^f[p>>>16&255]^h[b>>>8&255]^d[255&y]^t[m++],a=c[p>>>24]^f[b>>>16&255]^h[y>>>8&255]^d[255&l]^t[m++],s=c[b>>>24]^f[y>>>16&255]^h[l>>>8&255]^d[255&p]^t[m++],u=c[y>>>24]^f[l>>>16&255]^h[p>>>8&255]^d[255&b]^t[m++],l=o,p=a,b=s,y=u;return o=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&y])^t[m++],a=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[y>>>8&255]<<8|n[255&l])^t[m++],s=(n[b>>>24]<<24|n[y>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^t[m++],u=(n[y>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^t[m++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var h=[0,1,2,4,8,16,32,64,128,27,54],d=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99;var f=e[n[r[a]=c]=a],h=e[f],d=e[h],l=257*e[c]^16843008*c;i[0][a]=l<<24|l>>>8,i[1][a]=l<<16|l>>>16,i[2][a]=l<<8|l>>>24,i[3][a]=l,l=16843009*d^65537*h^257*f^16843008*a,o[0][c]=l<<24|l>>>8,o[1][c]=l<<16|l>>>16,o[2][c]=l<<8|l>>>24,o[3][c]=l,0===a?a=s=1:(a=f^e[e[e[d^f]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function s(e){this._key=o(e),this._reset()}s.blockSize=16,s.keySize=32,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],o=0;o>>24,a=d.SBOX[a>>>24]<<24|d.SBOX[a>>>16&255]<<16|d.SBOX[a>>>8&255]<<8|d.SBOX[255&a],a^=h[o/t|0]<<24):6>>24]<<24|d.SBOX[a>>>16&255]<<16|d.SBOX[a>>>8&255]<<8|d.SBOX[255&a]),i[o]=i[o-t]^a}for(var s=[],u=0;u>>24]]^d.INV_SUB_MIX[1][d.SBOX[f>>>16&255]]^d.INV_SUB_MIX[2][d.SBOX[f>>>8&255]]^d.INV_SUB_MIX[3][d.SBOX[255&f]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=s},s.prototype.encryptBlockRaw=function(e){return a(e=o(e),this._keySchedule,d.SUB_MIX,d.SBOX,this._nRounds)},s.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},s.prototype.decryptBlock=function(e){var t=(e=o(e))[1];e[1]=e[3],e[3]=t;var r=a(e,this._invKeySchedule,d.INV_SUB_MIX,d.INV_SBOX,this._nRounds),n=i.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},s.prototype.scrub=function(){n(this._keySchedule),n(this._invKeySchedule),n(this._key)},t.exports.AES=s},{"safe-buffer":149}],19:[function(e,t,r){var a=e("./aes"),c=e("safe-buffer").Buffer,s=e("cipher-base"),n=e("inherits"),f=e("./ghash"),i=e("buffer-xor"),h=e("./incr32");function o(e,t,r,n){s.call(this);var i=c.alloc(4,0);this._cipher=new a.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new f(o),r=function(e,t,r){if(12===t.length)return e._finID=c.concat([t,c.from([0,0,0,1])]),c.concat([t,c.from([0,0,0,2])]);var n=new f(r),i=t.length,o=i%16;n.update(t),o&&(o=16-o,n.update(c.alloc(o,0))),n.update(c.alloc(8,0));var a=8*i,s=c.alloc(8);s.writeUIntBE(a,0,8),n.update(s),e._finID=n.state;var u=c.from(e._finID);return h(u),u}(this,r,o),this._prev=c.from(r),this._cache=c.allocUnsafe(0),this._secCache=c.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}n(o,s),o.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=c.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=i(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}o.prototype.ghash=function(e){for(var t=-1;++t>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=a(i)},o.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(a([0,e,0,t])),this.state},t.exports=o},{"safe-buffer":149}],24:[function(e,t,r){t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],25:[function(e,t,r){var i=e("buffer-xor");r.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},{"buffer-xor":46}],26:[function(e,t,r){var o=e("safe-buffer").Buffer,a=e("buffer-xor");function s(e,t,r){var n=t.length,i=a(t,e._cache);return e._cache=e._cache.slice(n),e._prev=o.concat([e._prev,r?t:i]),i}r.encrypt=function(e,t,r){for(var n,i=o.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=o.allocUnsafe(0)),!(e._cache.length<=t.length)){i=o.concat([i,s(e,t,r)]);break}n=e._cache.length,i=o.concat([i,s(e,t.slice(0,n),r)]),t=t.slice(n)}return i}},{"buffer-xor":46,"safe-buffer":149}],27:[function(e,t,r){var a=e("safe-buffer").Buffer;function s(e,t,r){for(var n,i,o=-1,a=0;++o<8;)n=t&1<<7-o?128:0,a+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>o%8,e._prev=u(e._prev,r?n:i);return a}function u(e,t){var r=e.length,n=-1,i=a.allocUnsafe(e.length);for(e=a.concat([e,a.from([t])]);++n>7;return i}r.encrypt=function(e,t,r){for(var n=t.length,i=a.allocUnsafe(n),o=-1;++o=t)throw new Error("invalid sig")}t.exports=function(e,t,r,n,i){var o=b(r);if("ec"===o.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=y[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new p(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,i=r.data.q,o=r.data.g,a=r.data.pub_key,s=b.signature.decode(e,"der"),u=s.s,c=s.r;m(u,i),m(c,i);var f=l.mont(n),h=u.invm(i);return 0===o.toRed(f).redPow(new l(t).mul(h).mod(i)).fromRed().mul(a.toRed(f).redPow(c.mul(h).mod(i)).fromRed()).mod(n).mod(i).cmp(c)}(e,t,o)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");t=d.concat([i,t]);for(var a=o.modulus.byteLength(),s=[1],u=0;t.length+s.length+2>>1;case"base64":return N(e).length;default:if(n)return B(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=h.from(t,n)),h.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=a=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var f=-1;for(o=r;o>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return function(e){var t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return g(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},h.prototype.equals=function(e){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===h.compare(this,e)},h.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return 0t&&(e+=" ... ")),""},h.prototype.compare=function(e,t,r,n,i){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,a,s,u,c,f,h,d,l,p=!1;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return d=t,l=r,P(B(e,(h=this).length-d),h,d,l);case"ascii":return v(this,e,t,r);case"latin1":case"binary":return v(this,e,t,r);case"base64":return u=this,c=t,f=r,P(N(e),u,c,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=t,s=r,P(function(e,t){for(var r,n,i,o=[],a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,(o=this).length-a),o,a,s);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function A(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;ie.length)throw new RangeError("Index out of range")}function U(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,i){return t=+t,r>>>=0,i||U(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function I(e,t,r,n,i){return t=+t,r>>>=0,i||U(e,0,r,8),o.write(e,t,r,n,52,8),r+8}h.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||E(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||E(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||E(e,1,this.length),this[e]},h.prototype.readUInt16LE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]|this[e+1]<<8},h.prototype.readUInt16BE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]<<8|this[e+1]},h.prototype.readUInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},h.prototype.readUInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},h.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||E(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||E(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){e>>>=0,t||E(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(e,t){e>>>=0,t||E(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},h.prototype.readInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},h.prototype.readFloatLE=function(e,t){return e>>>=0,t||E(e,4,this.length),o.read(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return e>>>=0,t||E(e,4,this.length),o.read(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return e>>>=0,t||E(e,8,this.length),o.read(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return e>>>=0,t||E(e,8,this.length),o.read(this,e,!1,52,8)},h.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||S(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||S(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},h.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,1,255,0),this[t]=255&e,t+1},h.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},h.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},h.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},h.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},h.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},h.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;0<=--o&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},h.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},h.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},h.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},h.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},h.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},h.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},h.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},h.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},h.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},h.prototype.copy=function(e,t,r,n){if(!h.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function N(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(T,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function P(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function O(e){return e!=e}},{"base64-js":15,ieee754:100}],48:[function(e,t,r){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],49:[function(e,t,r){var i=e("safe-buffer").Buffer,n=e("stream").Transform,o=e("string_decoder").StringDecoder;function a(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}e("inherits")(a,n),a.prototype.update=function(e,t,r){"string"==typeof e&&(e=i.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},t.exports=a},{inherits:102,"safe-buffer":149,stream:158,string_decoder:163}],50:[function(e,t,r){(function(e){function t(e){return Object.prototype.toString.call(e)}r.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},r.isBoolean=function(e){return"boolean"==typeof e},r.isNull=function(e){return null===e},r.isNullOrUndefined=function(e){return null==e},r.isNumber=function(e){return"number"==typeof e},r.isString=function(e){return"string"==typeof e},r.isSymbol=function(e){return"symbol"===(void 0===e?"undefined":_typeof(e))},r.isUndefined=function(e){return void 0===e},r.isRegExp=function(e){return"[object RegExp]"===t(e)},r.isObject=function(e){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e},r.isDate=function(e){return"[object Date]"===t(e)},r.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},r.isFunction=function(e){return"function"==typeof e},r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"===(void 0===e?"undefined":_typeof(e))||void 0===e},r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":103}],51:[function(e,s,t){(function(o){var t=e("elliptic"),n=e("bn.js");s.exports=function(e){return new i(e)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function i(e){this.curveType=r[e],this.curveType||(this.curveType={name:e}),this.curve=new t.ec(this.curveType.name),this.keys=void 0}function a(e,t,r){Array.isArray(e)||(e=e.toArray());var n=new o(e);if(r&&n.lengthr)?t=("rmd160"===e?new u:c(e)).update(t).digest():t.length>>1];r=d.r28shl(r,o),n=d.r28shl(n,o),d.pc2(r,n,e.keys,i)}},u.prototype._update=function(e,t,r,n){var i=this._desState,o=d.readUInt32BE(e,t),a=d.readUInt32BE(e,t+4);d.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],d.writeUInt32BE(r,o,n),d.writeUInt32BE(r,a,n+4)},u.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,o=h}d.rip(a,o,n,i)},u.prototype._decrypt=function(e,t,r,n,i){for(var o=r,a=t,s=e.keys.length-2;0<=s;s-=2){var u=e.keys[s],c=e.keys[s+1];d.expand(o,e.tmp,0),u^=e.tmp[0],c^=e.tmp[1];var f=d.substitute(u,c),h=o;o=(a^d.permute(f))>>>0,a=h}d.rip(o,a,n,i)}},{"../des":57,inherits:102,"minimalistic-assert":107}],61:[function(e,t,r){var o=e("minimalistic-assert"),n=e("inherits"),i=e("../des"),a=i.Cipher,s=i.DES;function u(e,t){o.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:n}),s.create({type:"encrypt",key:i})]:[s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:r})]}function c(e){a.call(this,e);var t=new u(this.type,this.options.key);this._edeState=t}n(c,a),(t.exports=c).create=function(e){return new c(e)},c.prototype._update=function(e,t,r,n){var i=this._edeState;i.ciphers[0]._update(e,t,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},c.prototype._pad=s.prototype._pad,c.prototype._unpad=s.prototype._unpad},{"../des":57,inherits:102,"minimalistic-assert":107}],62:[function(e,t,r){r.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},r.ip=function(e,t,r,n){for(var i=0,o=0,a=6;0<=a;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1}for(a=6;0<=a;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},r.rip=function(e,t,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;0<=s;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;0<=s;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.pc1=function(e,t,r,n){for(var i=0,o=0,a=7;5<=a;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.r28shl=function(e,t){return e<>>28-t};var u=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,n){for(var i=0,o=0,a=u.length>>>1,s=0;s>>u[s]&1;for(s=a;s>>u[s]&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.expand=function(e,t,r){var n=0,i=0;n=(1&e)<<5|e>>>27;for(var o=23;15<=o;o-=4)n<<=6,n|=e>>>o&63;for(o=11;3<=o;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(t>>>18-6*n&63)]}return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r>>n[r]&1;return t>>>0},r.padSplit=function(e,t,r){for(var n=e.toString(2);n.lengthe;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(c),t.cmp(c)){if(!t.cmp(f))for(;r.mod(h).cmp(d);)r.iadd(p)}else for(;r.mod(a).cmp(l);)r.iadd(p);if(y(n=r.shrn(1))&&y(r)&&m(n)&&m(r)&&s.test(n)&&s.test(r))return r}}},{"bn.js":"BN","miller-rabin":106,randombytes:132}],66:[function(e,t,r){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],67:[function(e,t,r){var n=r;n.version=e("../package.json").version,n.utils=e("./elliptic/utils"),n.rand=e("brorand"),n.curve=e("./elliptic/curve"),n.curves=e("./elliptic/curves"),n.ec=e("./elliptic/ec"),n.eddsa=e("./elliptic/eddsa")},{"../package.json":82,"./elliptic/curve":70,"./elliptic/curves":73,"./elliptic/ec":74,"./elliptic/eddsa":77,"./elliptic/utils":81,brorand:16}],68:[function(e,t,r){var n=e("bn.js"),i=e("../../elliptic").utils,k=i.getNAF,E=i.getJSF,h=i.assert;function o(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||0>1]):a.mixedAdd(i[-u-1>>1].neg()):0>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},o.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,a=this._wnafT2,s=this._wnafT3,u=0,c=0;c>1]:M<0&&(x=a[y][-M-1>>1].neg()),g="affine"===x.type?g.mixedAdd(x):g.add(x))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},f.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},f.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),u=i.redMul(a),c=o.redMul(s),f=i.redMul(s),h=a.redMul(o);return this.curve.point(u,c,h,f)},f.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(c=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),t=a.redMul(c.redSub(o)),r=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);e=n.redSub(i).redISub(o).redMul(u),t=a.redMul(c.redSub(o)),r=a.redMul(u)}}else{var c=i.redAdd(o);s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=c.redSub(s).redSub(s);e=this.curve._mulC(n.redISub(c)).redMul(u),t=this.curve._mulC(c).redMul(i.redISub(o)),r=c.redMul(u)}return this.curve.point(e,t,r)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(t),c=o.redMul(a),f=s.redMul(u),h=o.redMul(u),d=a.redMul(s);return this.curve.point(c,f,d,h)},f.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),h=n.redMul(u).redMul(f);return this.curve.twisted?(t=n.redMul(c).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(c)):(t=n.redMul(c).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(h,t,r)},f.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},f.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},f.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},f.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},f.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),0<=r.cmp(this.curve.p))return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}return!1},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},{"../../elliptic":67,"../curve":70,"bn.js":"BN",inherits:102}],70:[function(e,t,r){var n=r;n.base=e("./base"),n.short=e("./short"),n.mont=e("./mont"),n.edwards=e("./edwards")},{"./base":68,"./edwards":69,"./mont":71,"./short":72}],71:[function(e,t,r){var n=e("../curve"),i=e("bn.js"),o=e("inherits"),a=n.base,s=e("../../elliptic").utils;function u(e){a.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(u,a),(t.exports=u).prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},o(c,a.BasePoint),u.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},u.prototype.point=function(e,t){return new c(this,e,t)},u.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;0<=o;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":67,"../curve":70,"bn.js":"BN",inherits:102}],72:[function(e,t,r){var n=e("../curve"),i=e("../../elliptic"),_=e("bn.js"),o=e("inherits"),a=n.base,s=i.utils.assert;function u(e){a.call(this,"short",e),this.a=new _(e.a,16).toRed(this.red),this.b=new _(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(e,t,r,n){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new _(t,16),this.y=new _(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(e,t,r,n){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new _(0)):(this.x=new _(t,16),this.y=new _(r,16),this.z=new _(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),(t.exports=u).prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new _(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new _(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new _(e.a,16),b:new _(e.b,16)}}):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:_.mont(e),r=new _(2).toRed(t).redInvm(),n=r.redNeg(),i=new _(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,a,s,u,c,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,d=this.n.clone(),l=new _(1),p=new _(0),b=new _(0),y=new _(1),m=0;0!==h.cmpn(0);){var v=d.div(h);u=d.sub(v.mul(h)),c=b.sub(v.mul(l));var g=y.sub(v.mul(p));if(!n&&u.cmp(f)<0)t=s.neg(),r=l,n=u.neg(),i=c;else if(n&&2==++m)break;d=h,h=s=u,b=l,l=c,y=p,p=g}o=u.neg(),a=c;var w=n.sqr().add(i.sqr());return 0<=o.sqr().add(a.sqr()).cmp(w)&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(e,t){(e=new _(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new _(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},c.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,a.BasePoint),u.prototype.jpoint=function(e,t,r){return new f(this,e,t,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),f=c.redMul(s),h=n.redMul(c),d=u.redSqr().redIAdd(f).redISub(h).redISub(h),l=u.redMul(h.redISub(d)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,l,p)},f.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),f=r.redMul(u),h=s.redSqr().redIAdd(c).redISub(f).redISub(f),d=s.redMul(f.redISub(h)).redISub(i.redMul(c)),l=this.z.redMul(a);return this.curve.jpoint(h,d,l)},f.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":67,"../curve":70,"bn.js":"BN",inherits:102}],73:[function(e,t,r){var n,i=r,o=e("hash.js"),a=e("../elliptic"),s=a.utils.assert;function u(e){"short"===e.type?this.curve=new a.curve.short(e):"edwards"===e.type?this.curve=new a.curve.edwards(e):this.curve=new a.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,r){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var e=new u(r);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:e}),e}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"../elliptic":67,"./precomputed/secp256k1":80,"hash.js":86}],74:[function(e,t,r){var y=e("bn.js"),m=e("hmac-drbg"),o=e("../../elliptic"),l=o.utils.assert,n=e("./key"),v=e("./signature");function i(e){if(!(this instanceof i))return new i(e);"string"==typeof e&&(l(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}(t.exports=i).prototype.keyPair=function(e){return new n(this,e)},i.prototype.keyFromPrivate=function(e,t){return n.fromPrivate(this,e,t)},i.prototype.keyFromPublic=function(e,t){return n.fromPublic(this,e,t)},i.prototype.genKeyPair=function(e){e||(e={});for(var t=new m({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new y(2));;){var i=new y(t.generate(r));if(!(0>1;if(0<=a.cmp(this.curve.p.umod(this.curve.n))&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var f=t.r.invm(i),h=i.sub(o).mul(f).umod(i),d=s.mul(f).umod(i);return this.g.mulAdd(h,a,d)},i.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new v(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":67,"./key":75,"./signature":76,"bn.js":"BN","hmac-drbg":98}],75:[function(e,t,r){var n=e("bn.js"),i=e("../../elliptic").utils.assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}(t.exports=o).fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},{"../../elliptic":67,"bn.js":"BN"}],76:[function(e,t,r){var s=e("bn.js"),u=e("../../elliptic").utils,n=u.assert;function i(e,t){if(e instanceof i)return e;this._importDER(e,t)||(n(e.r&&e.s,"Signature without r or s"),this.r=new s(e.r,16),this.s=new s(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function c(){this.place=0}function f(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,a=t.place;o>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}(t.exports=i).prototype._importDER=function(e,t){e=u.toArray(e,t);var r=new c;if(48!==e[r.place++])return!1;if(f(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=f(e,r),i=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var o=f(e,r);if(e.length!==o+r.place)return!1;var a=e.slice(r.place,o+r.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===a[0]&&128&a[1]&&(a=a.slice(1)),this.r=new s(i),this.s=new s(a),!(this.recoveryParam=null)},i.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=a(t),r=a(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];h(n,t.length),(n=n.concat(t)).push(2),h(n,r.length);var i=n.concat(r),o=[48];return h(o,i.length),o=o.concat(i),u.encode(o,e)}},{"../../elliptic":67,"bn.js":"BN"}],77:[function(e,t,r){var n=e("hash.js"),i=e("../../elliptic"),o=i.utils,a=o.assert,u=o.parseBytes,s=e("./key"),c=e("./signature");function f(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);e=i.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}(t.exports=f).prototype.sign=function(e,t){e=u(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},f.prototype.verify=function(e,t,r){e=u(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var e=this.hash(),t=0;t>1)-1>1)-a:a,i.isubn(o)}else o=0;r.push(o);for(var s=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;ur&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.once=function(e,t){if(!u(t))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var r,n,i,o;if(!u(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=(r=this._events[e]).length,n=-1,r===t||u(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(c(r)){for(o=i;0=this._blockSize;){for(var i=this._blockOffset;i=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":97}],97:[function(e,t,r){var c=e("minimalistic-assert"),n=e("inherits");function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function a(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}r.inherits=n,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}else for(n=0;n>>0}return o},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},r.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,o,a,s){var u=0,c=t;return u+=(c=c+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},r.sum64_5_hi=function(e,t,r,n,i,o,a,s,u,c){var f=0,h=t;return f+=(h=h+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(e,t,r,n,i,o,a,s,u,c){return t+n+o+s+c>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:102,"minimalistic-assert":107}],98:[function(e,t,r){var n=e("hash.js"),a=e("minimalistic-crypto-utils"),i=e("minimalistic-assert");function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=a.toArray(e.entropy,e.entropyEnc||"hex"),r=a.toArray(e.nonce,e.nonceEnc||"hex"),n=a.toArray(e.pers,e.persEnc||"hex");i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}(t.exports=o).prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=a.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length>1,f=-7,h=r?i-1:0,d=r?-1:1,l=e[t+h];for(h+=d,o=l&(1<<-f)-1,l>>=-f,f+=s;0>=-f,f+=n;0>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),2<=(t+=1<=a+h?d/u:d*Math.pow(2,1-h))*u&&(a++,u/=2),f<=a+h?(s=0,a=f):1<=a+h?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));8<=i;e[r+l]=255&s,l+=p,s/=256,i-=8);for(a=a<>>32-t}function u(e,t,r,n,i,o,a){return s(e+(t&r|~t&n)+i+o|0,a)+t|0}function c(e,t,r,n,i,o,a){return s(e+(t&n|r&~n)+i+o|0,a)+t|0}function f(e,t,r,n,i,o,a){return s(e+(t^r^n)+i+o|0,a)+t|0}function h(e,t,r,n,i,o,a){return s(e+(r^(t|~n))+i+o|0,a)+t|0}e(n,r),n.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;n=h(n=h(n=h(n=h(n=f(n=f(n=f(n=f(n=c(n=c(n=c(n=c(n=u(n=u(n=u(n=u(n,i=u(i,o=u(o,r=u(r,n,i,o,e[0],3614090360,7),n,i,e[1],3905402710,12),r,n,e[2],606105819,17),o,r,e[3],3250441966,22),i=u(i,o=u(o,r=u(r,n,i,o,e[4],4118548399,7),n,i,e[5],1200080426,12),r,n,e[6],2821735955,17),o,r,e[7],4249261313,22),i=u(i,o=u(o,r=u(r,n,i,o,e[8],1770035416,7),n,i,e[9],2336552879,12),r,n,e[10],4294925233,17),o,r,e[11],2304563134,22),i=u(i,o=u(o,r=u(r,n,i,o,e[12],1804603682,7),n,i,e[13],4254626195,12),r,n,e[14],2792965006,17),o,r,e[15],1236535329,22),i=c(i,o=c(o,r=c(r,n,i,o,e[1],4129170786,5),n,i,e[6],3225465664,9),r,n,e[11],643717713,14),o,r,e[0],3921069994,20),i=c(i,o=c(o,r=c(r,n,i,o,e[5],3593408605,5),n,i,e[10],38016083,9),r,n,e[15],3634488961,14),o,r,e[4],3889429448,20),i=c(i,o=c(o,r=c(r,n,i,o,e[9],568446438,5),n,i,e[14],3275163606,9),r,n,e[3],4107603335,14),o,r,e[8],1163531501,20),i=c(i,o=c(o,r=c(r,n,i,o,e[13],2850285829,5),n,i,e[2],4243563512,9),r,n,e[7],1735328473,14),o,r,e[12],2368359562,20),i=f(i,o=f(o,r=f(r,n,i,o,e[5],4294588738,4),n,i,e[8],2272392833,11),r,n,e[11],1839030562,16),o,r,e[14],4259657740,23),i=f(i,o=f(o,r=f(r,n,i,o,e[1],2763975236,4),n,i,e[4],1272893353,11),r,n,e[7],4139469664,16),o,r,e[10],3200236656,23),i=f(i,o=f(o,r=f(r,n,i,o,e[13],681279174,4),n,i,e[0],3936430074,11),r,n,e[3],3572445317,16),o,r,e[6],76029189,23),i=f(i,o=f(o,r=f(r,n,i,o,e[9],3654602809,4),n,i,e[12],3873151461,11),r,n,e[15],530742520,16),o,r,e[2],3299628645,23),i=h(i,o=h(o,r=h(r,n,i,o,e[0],4096336452,6),n,i,e[7],1126891415,10),r,n,e[14],2878612391,15),o,r,e[5],4237533241,21),i=h(i,o=h(o,r=h(r,n,i,o,e[12],1700485571,6),n,i,e[3],2399980690,10),r,n,e[10],4293915773,15),o,r,e[1],2240044497,21),i=h(i,o=h(o,r=h(r,n,i,o,e[8],1873313359,6),n,i,e[15],4264355552,10),r,n,e[6],2734768916,15),o,r,e[13],1309151649,21),i=h(i,o=h(o,r=h(r,n,i,o,e[4],4149444226,6),n,i,e[11],3174756917,10),r,n,e[2],718787259,15),o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e}},{}],109:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n",r.homedir=function(){return"/"}},{}],110:[function(e,t,r){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],111:[function(e,t,r){var n=e("asn1.js");r.certificate=e("./certificate");var i=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});r.RSAPrivateKey=i;var o=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});r.RSAPublicKey=o;var a=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});r.PublicKey=a;var s=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),u=n.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});r.PrivateKey=u;var c=n.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=c;var f=n.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});r.DSAPrivateKey=f,r.DSAparam=n.define("DSAparam",function(){this.int()});var h=n.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(d),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=h;var d=n.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});r.signature=n.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":112,"asn1.js":1}],112:[function(e,t,r){var n=e("asn1.js"),i=n.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),o=n.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),a=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),s=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}),u=n.define("RelativeDistinguishedName",function(){this.setof(o)}),c=n.define("RDNSequence",function(){this.seqof(u)}),f=n.define("Name",function(){this.choice({rdnSequence:this.use(c)})}),h=n.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),d=n.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),l=n.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(f),this.key("validity").use(h),this.key("subject").use(f),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(d).optional())}),p=n.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(l),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())});t.exports=p},{"asn1.js":1}],113:[function(e,t,r){(function(d){var l=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,p=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m,b=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,y=e("evp_bytestokey"),m=e("browserify-aes");t.exports=function(e,t){var r,n=e.toString(),i=n.match(l);if(i){var o="aes"+i[1],a=new d(i[2],"hex"),s=new d(i[3].replace(/[\r\n]/g,""),"base64"),u=y(t,a.slice(0,8),parseInt(i[1],10)).key,c=[],f=m.createDecipheriv(o,u,a);c.push(f.update(s)),c.push(f.final()),r=d.concat(c)}else{var h=n.match(b);r=new d(h[2].replace(/[\r\n]/g,""),"base64")}return{tag:n.match(p)[1],data:r}}}).call(this,e("buffer").Buffer)},{"browserify-aes":20,buffer:47,evp_bytestokey:84}],114:[function(t,r,e){(function(v){var g=t("./asn1"),w=t("./aesid.json"),_=t("./fixProc"),A=t("browserify-aes"),x=t("pbkdf2");function e(e){var t;"object"!==(void 0===e?"undefined":_typeof(e))||v.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=new v(e));var r,n,i,o,a,s,u,c,f,h,d,l,p,b=_(e,t),y=b.tag,m=b.data;switch(y){case"CERTIFICATE":n=g.certificate.decode(m,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(n||(n=g.PublicKey.decode(m,"der")),r=n.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return g.RSAPublicKey.decode(n.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return n.subjectPrivateKey=n.subjectPublicKey,{type:"ec",data:n};case"1.2.840.10040.4.1":return n.algorithm.params.pub_key=g.DSAparam.decode(n.subjectPublicKey.data,"der"),{type:"dsa",data:n.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+y);case"ENCRYPTED PRIVATE KEY":m=g.EncryptedPrivateKey.decode(m,"der"),o=t,a=(i=m).algorithm.decrypt.kde.kdeparams.salt,s=parseInt(i.algorithm.decrypt.kde.kdeparams.iters.toString(),10),u=w[i.algorithm.decrypt.cipher.algo.join(".")],c=i.algorithm.decrypt.cipher.iv,f=i.subjectPrivateKey,h=parseInt(u.split("-")[1],10)/8,d=x.pbkdf2Sync(o,a,s,h),l=A.createDecipheriv(u,d,c),(p=[]).push(l.update(f)),p.push(l.final()),m=v.concat(p);case"PRIVATE KEY":switch(r=(n=g.PrivateKey.decode(m,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return g.RSAPrivateKey.decode(n.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:n.algorithm.curve,privateKey:g.ECPrivateKey.decode(n.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return n.algorithm.params.priv_key=g.DSAparam.decode(n.subjectPrivateKey,"der"),{type:"dsa",params:n.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+y);case"RSA PUBLIC KEY":return g.RSAPublicKey.decode(m,"der");case"RSA PRIVATE KEY":return g.RSAPrivateKey.decode(m,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:g.DSAPrivateKey.decode(m,"der")};case"EC PRIVATE KEY":return{curve:(m=g.ECPrivateKey.decode(m,"der")).parameters.value,privateKey:m.privateKey};default:throw new Error("unknown key type "+y)}}(r.exports=e).signature=g.signature}).call(this,t("buffer").Buffer)},{"./aesid.json":110,"./asn1":111,"./fixProc":113,"browserify-aes":20,buffer:47,pbkdf2:115}],115:[function(e,t,r){r.pbkdf2=e("./lib/async"),r.pbkdf2Sync=e("./lib/sync")},{"./lib/async":116,"./lib/sync":119}],116:[function(e,t,r){(function(c,f){var h,d=e("./precondition"),l=e("./default-encoding"),p=e("./sync"),b=e("safe-buffer").Buffer,y=f.crypto&&f.crypto.subtle,m={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},v=[];function g(e,t,r,n,i){return y.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(e){return y.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:i}},e,n<<3)}).then(function(e){return b.from(e)})}t.exports=function(t,r,n,i,o,a){"function"==typeof o&&(a=o,o=void 0);var e,s,u=m[(o=o||"sha1").toLowerCase()];if(!u||"function"!=typeof f.Promise)return c.nextTick(function(){var e;try{e=p(t,r,n,i,o)}catch(e){return a(e)}a(null,e)});if(d(t,r,n,i),"function"!=typeof a)throw new Error("No callback provided to pbkdf2");b.isBuffer(t)||(t=b.from(t,l)),b.isBuffer(r)||(r=b.from(r,l)),e=function(e){if(f.process&&!f.process.browser)return Promise.resolve(!1);if(!y||!y.importKey||!y.deriveBits)return Promise.resolve(!1);if(void 0!==v[e])return v[e];var t=g(h=h||b.alloc(8),h,10,128,e).then(function(){return!0}).catch(function(){return!1});return v[e]=t}(u).then(function(e){return e?g(t,r,n,i,u):p(t,r,n,i,o)}),s=a,e.then(function(e){c.nextTick(function(){s(null,e)})},function(e){c.nextTick(function(){s(e)})})}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-encoding":117,"./precondition":118,"./sync":119,_process:121,"safe-buffer":149}],117:[function(e,r,t){(function(e){var t;e.browser?t="utf-8":t=6<=parseInt(e.version.split(".")[0].slice(1),10)?"utf-8":"binary";r.exports=t}).call(this,e("_process"))},{_process:121}],118:[function(e,t,r){(function(r){var i=Math.pow(2,30)-1;function o(e,t){if("string"!=typeof e&&!r.isBuffer(e))throw new TypeError(t+" must be a buffer or string")}t.exports=function(e,t,r,n){if(o(e,"Password"),o(t,"Salt"),"number"!=typeof r)throw new TypeError("Iterations not a number");if(r<0)throw new TypeError("Bad iterations");if("number"!=typeof n)throw new TypeError("Key length not a number");if(n<0||io?t=i(t):t.lengtha||0<=new c(t).cmp(o.modulus))throw new Error("decryption error");i=r?b(new c(t),o):l(t,o);var s=new f(a-i.length);if(s.fill(0),i=f.concat([s,i],a),4===n)return function(e,t){e.modulus;var r=e.modulus.byteLength(),n=(t.length,p("sha1").update(new f("")).digest()),i=n.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),a=t.slice(i+1),s=d(o,h(a,i)),u=d(a,h(s,r-i-1));if(function(e,t){e=new f(e),t=new f(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));var i=-1;for(;++i=t.length){o++;break}var a=t.slice(2,i-1);t.slice(i-1,i);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,i,r);if(3===n)return i;throw new Error("unknown padding")}}).call(this,e("buffer").Buffer)},{"./mgf":123,"./withPublic":126,"./xor":127,"bn.js":"BN","browserify-rsa":38,buffer:47,"create-hash":52,"parse-asn1":114}],125:[function(e,t,r){(function(d){var a=e("parse-asn1"),l=e("randombytes"),p=e("create-hash"),b=e("./mgf"),y=e("./xor"),m=e("bn.js"),s=e("./withPublic"),u=e("browserify-rsa");t.exports=function(e,t,r){var n;n=e.padding?e.padding:r?1:4;var i,o=a(e);if(4===n)i=function(e,t){var r=e.modulus.byteLength(),n=t.length,i=p("sha1").update(new d("")).digest(),o=i.length,a=2*o;if(r-a-2= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=v-g,M=Math.floor,k=String.fromCharCode;function E(e){throw new RangeError(h[e])}function l(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function p(e,t){var r=e.split("@"),n="";return 1>>10&1023|55296),e=56320|1023&e),t+=k(e)}).join("")}function j(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,r){var n=0;for(e=r?M(e/s):e>>1,e+=M(e/t);d*w>>1M((m-p)/a))&&E("overflow"),p+=u*a,!(u<(c=s<=y?g:y+w<=s?w:s-y));s+=v)a>M(m/(f=v-c))&&E("overflow"),a*=f;y=I(p-o,t=d.length+1,0==o),M(p/t)>m-b&&E("overflow"),b+=M(p/t),p%=t,d.splice(p++,0,b)}return U(d)}function y(e){var t,r,n,i,o,a,s,u,c,f,h,d,l,p,b,y=[];for(d=(e=S(e)).length,t=A,o=_,a=r=0;aM((m-r)/(l=n+1))&&E("overflow"),r+=(s-t)*l,t=s,a=0;am&&E("overflow"),h==t){for(u=r,c=v;!(u<(f=c<=o?g:o+w<=c?w:c-o));c+=v)b=u-f,p=v-f,y.push(k(j(f+b%p,0))),u=M(b/p);y.push(k(j(u,0))),o=I(r,l,n==i),r=0,++n}++r,++t}return y.join("")}if(i={version:"1.4.1",ucs2:{decode:S,encode:U},decode:b,encode:y,toASCII:function(e){return p(e,function(e){return c.test(e)?"xn--"+y(e):e})},toUnicode:function(e){return p(e,function(e){return u.test(e)?b(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define("punycode",function(){return i});else if(t&&r)if(C.exports==t)r.exports=i;else for(o in i)i.hasOwnProperty(o)&&(t[o]=i[o]);else e.punycode=i}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],129:[function(e,t,r){t.exports=function(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s,u,c=e.length;0t.highWaterMark&&(t.highWaterMark=(b<=(r=e)?r=b:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(w("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?m.nextTick(x,e):x(e))}function x(e){w("emit readable"),e.emit("readable"),U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,m.nextTick(k,e,t))}function k(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r).data=o.slice(a);break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n).data=o.slice(a);break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function I(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return w("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?I(this):A(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&I(this),null;var n,i=t.needReadable;return w("need readable",i),(0===t.length||t.length-e>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,t.copy(r,n),a+=o.data.length,o=o.next;return i},e}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":149,util:17}],141:[function(e,t,r){var o=e("process-nextick-args");function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):!e||this._writableState&&this._writableState.errorEmitted||o.nextTick(a,this,e):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(o.nextTick(a,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":120}],142:[function(e,t,r){t.exports=e("events").EventEmitter},{events:83}],143:[function(e,t,r){var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=f,this.end=h,t=3;break;default:return this.write=d,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(1>>32-t}function M(e,t,r,n,i,o,a,s){return x(e+(t^r^n)+o+a|0,s)+i|0}function k(e,t,r,n,i,o,a,s){return x(e+(t&r|~t&n)+o+a|0,s)+i|0}function E(e,t,r,n,i,o,a,s){return x(e+((t|~r)^n)+o+a|0,s)+i|0}function S(e,t,r,n,i,o,a,s){return x(e+(t&n|r&~n)+o+a|0,s)+i|0}function U(e,t,r,n,i,o,a,s){return x(e+(t^(r|~n))+o+a|0,s)+i|0}i(a,o),a.prototype._update=function(){for(var e=y,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,c=0|this._c,f=0|this._d,h=0|this._e,d=0;d<80;d+=1){var l,p;d<16?(l=M(r,n,i,o,a,e[m[d]],_[0],g[d]),p=U(s,u,c,f,h,e[v[d]],A[0],w[d])):d<32?(l=k(r,n,i,o,a,e[m[d]],_[1],g[d]),p=S(s,u,c,f,h,e[v[d]],A[1],w[d])):d<48?(l=E(r,n,i,o,a,e[m[d]],_[2],g[d]),p=E(s,u,c,f,h,e[v[d]],A[2],w[d])):d<64?(l=S(r,n,i,o,a,e[m[d]],_[3],g[d]),p=k(s,u,c,f,h,e[v[d]],A[3],w[d])):(l=U(r,n,i,o,a,e[m[d]],_[4],g[d]),p=M(s,u,c,f,h,e[v[d]],A[4],w[d])),r=a,a=o,o=x(i,10),i=n,n=l,s=h,h=f,f=x(c,10),c=u,u=p}var b=this._b+i+f|0;this._b=this._c+o+h|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+n+c|0,this._a=b},a.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},{"safe-buffer":149}],151:[function(e,t,r){(r=t.exports=function(e){e=e.toLowerCase();var t=r[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t}).sha=e("./sha"),r.sha1=e("./sha1"),r.sha224=e("./sha224"),r.sha256=e("./sha256"),r.sha384=e("./sha384"),r.sha512=e("./sha512")},{"./sha":152,"./sha1":153,"./sha224":154,"./sha256":155,"./sha384":156,"./sha512":157}],152:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,m=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s=this._w,u=0|this._a,c=0|this._b,f=0|this._c,h=0|this._d,d=0|this._e,l=0;l<16;++l)s[l]=e.readInt32BE(4*l);for(;l<80;++l)s[l]=s[l-3]^s[l-8]^s[l-14]^s[l-16];for(var p=0;p<80;++p){var b=~~(p/20),y=0|((a=u)<<5|a>>>27)+(n=c,i=f,o=h,0===(r=b)?n&i|~n&o:2===r?n&i|n&o|i&o:n^i^o)+d+s[p]+m[b];d=h,h=f,f=(t=c)<<30|t>>>2,c=u,u=y}this._a=u+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0},s.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=s},{"./hash":150,inherits:102,"safe-buffer":149}],153:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,v=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u=this._w,c=0|this._a,f=0|this._b,h=0|this._c,d=0|this._d,l=0|this._e,p=0;p<16;++p)u[p]=e.readInt32BE(4*p);for(;p<80;++p)u[p]=(t=u[p-3]^u[p-8]^u[p-14]^u[p-16])<<1|t>>>31;for(var b=0;b<80;++b){var y=~~(b/20),m=0|((s=c)<<5|s>>>27)+(i=f,o=h,a=d,0===(n=y)?i&o|~i&a:2===n?i&o|i&a|o&a:i^o^a)+l+u[b]+v[y];l=d,d=h,h=(r=f)<<30|r>>>2,f=c,c=m}this._a=c+this._a|0,this._b=f+this._b|0,this._c=h+this._c|0,this._d=d+this._d|0,this._e=l+this._e|0},s.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=s},{"./hash":150,inherits:102,"safe-buffer":149}],154:[function(e,t,r){var n=e("inherits"),i=e("./sha256"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=u},{"./hash":150,"./sha256":155,inherits:102,"safe-buffer":149}],155:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u=this._w,c=0|this._a,f=0|this._b,h=0|this._c,d=0|this._d,l=0|this._e,p=0|this._f,b=0|this._g,y=0|this._h,m=0;m<16;++m)u[m]=e.readInt32BE(4*m);for(;m<64;++m)u[m]=0|(((r=u[m-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)+u[m-7]+(((t=u[m-15])>>>7|t<<25)^(t>>>18|t<<14)^t>>>3)+u[m-16];for(var v=0;v<64;++v){var g=y+(((s=l)>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+((a=b)^l&(p^a))+_[v]+u[v]|0,w=0|(((o=c)>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+((n=c)&(i=f)|h&(n|i));y=b,b=p,p=l,l=d+g|0,d=h,h=f,f=c,c=g+w|0}this._a=c+this._a|0,this._b=f+this._b|0,this._c=h+this._c|0,this._d=d+this._d|0,this._e=l+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=y+this._h|0},s.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=s},{"./hash":150,inherits:102,"safe-buffer":149}],156:[function(e,t,r){var n=e("inherits"),i=e("./sha512"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var n=a.allocUnsafe(48);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),n},t.exports=u},{"./hash":150,"./sha512":157,inherits:102,"safe-buffer":149}],157:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,ee=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function s(){this.init(),this._w=a,i.call(this,128,112)}function te(e,t,r){return r^e&(t^r)}function re(e,t,r){return e&t|r&(e|t)}function ne(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function ie(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function oe(e,t){return e>>>0>>0?1:0}n(s,i),s.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u,c=this._w,f=0|this._ah,h=0|this._bh,d=0|this._ch,l=0|this._dh,p=0|this._eh,b=0|this._fh,y=0|this._gh,m=0|this._hh,v=0|this._al,g=0|this._bl,w=0|this._cl,_=0|this._dl,A=0|this._el,x=0|this._fl,M=0|this._gl,k=0|this._hl,E=0;E<32;E+=2)c[E]=e.readInt32BE(4*E),c[E+1]=e.readInt32BE(4*E+4);for(;E<160;E+=2){var S=c[E-30],U=c[E-30+1],j=((s=S)>>>1|(u=U)<<31)^(s>>>8|u<<24)^s>>>7,I=((o=U)>>>1|(a=S)<<31)^(o>>>8|a<<24)^(o>>>7|a<<25);S=c[E-4],U=c[E-4+1];var T=((n=S)>>>19|(i=U)<<13)^(i>>>29|n<<3)^n>>>6,C=((t=U)>>>19|(r=S)<<13)^(r>>>29|t<<3)^(t>>>6|r<<26),B=c[E-14],N=c[E-14+1],P=c[E-32],R=c[E-32+1],O=I+N|0,L=j+B+oe(O,I)|0;L=(L=L+T+oe(O=O+C|0,C)|0)+P+oe(O=O+R|0,R)|0,c[E]=L,c[E+1]=O}for(var q=0;q<160;q+=2){L=c[q],O=c[q+1];var D=re(f,h,d),F=re(v,g,w),H=ne(f,v),z=ne(v,f),K=ie(p,A),V=ie(A,p),G=ee[q],W=ee[q+1],X=te(p,b,y),J=te(A,x,M),Z=k+V|0,$=m+K+oe(Z,k)|0;$=($=($=$+X+oe(Z=Z+J|0,J)|0)+G+oe(Z=Z+W|0,W)|0)+L+oe(Z=Z+O|0,O)|0;var Y=z+F|0,Q=H+D+oe(Y,z)|0;m=y,k=M,y=b,M=x,b=p,x=A,p=l+$+oe(A=_+Z|0,_)|0,l=d,_=w,d=h,w=g,h=f,g=v,f=$+Q+oe(v=Z+Y|0,Z)|0}this._al=this._al+v|0,this._bl=this._bl+g|0,this._cl=this._cl+w|0,this._dl=this._dl+_|0,this._el=this._el+A|0,this._fl=this._fl+x|0,this._gl=this._gl+M|0,this._hl=this._hl+k|0,this._ah=this._ah+f+oe(this._al,v)|0,this._bh=this._bh+h+oe(this._bl,g)|0,this._ch=this._ch+d+oe(this._cl,w)|0,this._dh=this._dh+l+oe(this._dl,_)|0,this._eh=this._eh+p+oe(this._el,A)|0,this._fh=this._fh+b+oe(this._fl,x)|0,this._gh=this._gh+y+oe(this._gl,M)|0,this._hh=this._hh+m+oe(this._hl,k)|0},s.prototype._hash=function(){var n=o.allocUnsafe(64);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),n},t.exports=s},{"./hash":150,inherits:102,"safe-buffer":149}],158:[function(e,t,r){t.exports=n;var f=e("events").EventEmitter;function n(){f.call(this)}e("inherits")(n,f),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),(n.Stream=n).prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",i),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",s));var o=!1;function a(){o||(o=!0,t.end())}function s(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function u(e){if(c(),0===f.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",u),t.on("error",u),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},{events:83,inherits:102,"readable-stream/duplex.js":134,"readable-stream/passthrough.js":144,"readable-stream/readable.js":145,"readable-stream/transform.js":146,"readable-stream/writable.js":147}],159:[function(r,e,i){(function(u){var c=r("./lib/request"),e=r("./lib/response"),f=r("xtend"),t=r("builtin-status-codes"),h=r("url"),n=i;n.request=function(e,t){e="string"==typeof e?h.parse(e):f(e);var r=-1===u.location.protocol.search(/^https?:$/)?"http:":"",n=e.protocol||r,i=e.hostname||e.host,o=e.port,a=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(o?":"+o:"")+a,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new c(e);return t&&s.on("response",t),s},n.get=function(e,t){var r=n.request(e,t);return r.end(),r},n.ClientRequest=c,n.IncomingMessage=e.IncomingMessage,n.Agent=function(){},n.Agent.defaultMaxSockets=4,n.globalAgent=new n.Agent,n.STATUS_CODES=t,n.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":161,"./lib/response":162,"builtin-status-codes":48,url:166,xtend:170}],160:[function(e,t,s){(function(e){s.fetch=a(e.fetch)&&a(e.ReadableStream),s.writableStream=a(e.WritableStream),s.abortController=a(e.AbortController),s.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),s.blobConstructor=!0}catch(e){}var t;function r(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function n(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}var i=void 0!==e.ArrayBuffer,o=i&&a(e.ArrayBuffer.prototype.slice);function a(e){return"function"==typeof e}s.arraybuffer=s.fetch||i&&n("arraybuffer"),s.msstream=!s.fetch&&o&&n("ms-stream"),s.mozchunkedarraybuffer=!s.fetch&&i&&n("moz-chunked-arraybuffer"),s.overrideMimeType=s.fetch||!!r()&&a(r().overrideMimeType),s.vbArray=a(e.VBArray),t=null}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],161:[function(o,s,e){(function(u,c,f){var h=o("./capability"),e=o("inherits"),t=o("./response"),a=o("readable-stream"),d=o("to-arraybuffer"),r=t.IncomingMessage,l=t.readyStates;var n=s.exports=function(t){var e,r=this;a.Writable.call(r),r._opts=t,r._body=[],r._headers={},t.auth&&r.setHeader("Authorization","Basic "+new f(t.auth).toString("base64")),Object.keys(t.headers).forEach(function(e){r.setHeader(e,t.headers[e])});var n,i,o=!0;if("disable-fetch"===t.mode||"requestTimeout"in t&&!h.abortController)e=!(o=!1);else if("prefer-streaming"===t.mode)e=!1;else if("allow-wrong-content-type"===t.mode)e=!h.overrideMimeType;else{if(t.mode&&"default"!==t.mode&&"prefer-fast"!==t.mode)throw new Error("Invalid value for opts.mode");e=!0}r._mode=(n=e,i=o,h.fetch&&i?"fetch":h.mozchunkedarraybuffer?"moz-chunked-arraybuffer":h.msstream?"ms-stream":h.arraybuffer&&n?"arraybuffer":h.vbArray&&n?"text:vbarray":"text"),r._fetchTimer=null,r.on("finish",function(){r._onFinish()})};e(n,a.Writable),n.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===i.indexOf(r)&&(this._headers[r]={name:e,value:t})},n.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},n.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},n.prototype._onFinish=function(){var t=this;if(!t._destroyed){var e=t._opts,n=t._headers,r=null;"GET"!==e.method&&"HEAD"!==e.method&&(r=h.arraybuffer?d(f.concat(t._body)):h.blobConstructor?new c.Blob(t._body.map(function(e){return d(e)}),{type:(n["content-type"]||{}).value||""}):f.concat(t._body).toString());var i=[];if(Object.keys(n).forEach(function(e){var t=n[e].name,r=n[e].value;Array.isArray(r)?r.forEach(function(e){i.push([t,e])}):i.push([t,r])}),"fetch"===t._mode){var o=null;if(h.abortController){var a=new AbortController;o=a.signal,t._fetchAbortController=a,"requestTimeout"in e&&0!==e.requestTimeout&&(t._fetchTimer=c.setTimeout(function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()},e.requestTimeout))}c.fetch(t._opts.url,{method:t._opts.method,headers:i,body:r||void 0,mode:"cors",credentials:e.withCredentials?"include":"same-origin",signal:o}).then(function(e){t._fetchResponse=e,t._connect()},function(e){c.clearTimeout(t._fetchTimer),t._destroyed||t.emit("error",e)})}else{var s=t._xhr=new c.XMLHttpRequest;try{s.open(t._opts.method,t._opts.url,!0)}catch(e){return void u.nextTick(function(){t.emit("error",e)})}"responseType"in s&&(s.responseType=t._mode.split(":")[0]),"withCredentials"in s&&(s.withCredentials=!!e.withCredentials),"text"===t._mode&&"overrideMimeType"in s&&s.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in e&&(s.timeout=e.requestTimeout,s.ontimeout=function(){t.emit("requestTimeout")}),i.forEach(function(e){s.setRequestHeader(e[0],e[1])}),t._response=null,s.onreadystatechange=function(){switch(s.readyState){case l.LOADING:case l.DONE:t._onXHRProgress()}},"moz-chunked-arraybuffer"===t._mode&&(s.onprogress=function(){t._onXHRProgress()}),s.onerror=function(){t._destroyed||t.emit("error",new Error("XHR error"))};try{s.send(r)}catch(e){return void u.nextTick(function(){t.emit("error",e)})}}}},n.prototype._onXHRProgress=function(){(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},n.prototype._connect=function(){var t=this;t._destroyed||(t._response=new r(t._xhr,t._fetchResponse,t._mode,t._fetchTimer),t._response.on("error",function(e){t.emit("error",e)}),t.emit("response",t._response))},n.prototype._write=function(e,t,r){this._body.push(e),r()},n.prototype.abort=n.prototype.destroy=function(){this._destroyed=!0,c.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},n.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),a.Writable.prototype.end.call(this,e,t,r)},n.prototype.flushHeaders=function(){},n.prototype.setTimeout=function(){},n.prototype.setNoDelay=function(){},n.prototype.setSocketKeepAlive=function(){};var i=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"]}).call(this,o("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},o("buffer").Buffer)},{"./capability":160,"./response":162,_process:121,buffer:47,inherits:102,"readable-stream":145,"to-arraybuffer":165}],162:[function(r,e,n){(function(c,f,h){var d=r("./capability"),e=r("inherits"),l=r("readable-stream"),s=n.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},t=n.IncomingMessage=function(e,t,r,n){var i=this;if(l.Readable.call(i),i._mode=r,i.headers={},i.rawHeaders=[],i.trailers={},i.rawTrailers=[],i.on("end",function(){c.nextTick(function(){i.emit("close")})}),"fetch"===r){if(i._fetchResponse=t,i.url=t.url,i.statusCode=t.status,i.statusMessage=t.statusText,t.headers.forEach(function(e,t){i.headers[t.toLowerCase()]=e,i.rawHeaders.push(t,e)}),d.writableStream){var o=new WritableStream({write:function(r){return new Promise(function(e,t){i._destroyed?t():i.push(new h(r))?e():i._resumeFetch=e})},close:function(){f.clearTimeout(n),i._destroyed||i.push(null)},abort:function(e){i._destroyed||i.emit("error",e)}});try{return void t.body.pipeTo(o).catch(function(e){f.clearTimeout(n),i._destroyed||i.emit("error",e)})}catch(e){}}var a=t.body.getReader();!function t(){a.read().then(function(e){if(!i._destroyed){if(e.done)return f.clearTimeout(n),void i.push(null);i.push(new h(e.value)),t()}}).catch(function(e){f.clearTimeout(n),i._destroyed||i.emit("error",e)})}()}else{if(i._xhr=e,i._pos=0,i.url=e.responseURL,i.statusCode=e.status,i.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===i.headers[r]&&(i.headers[r]=[]),i.headers[r].push(t[2])):void 0!==i.headers[r]?i.headers[r]+=", "+t[2]:i.headers[r]=t[2],i.rawHeaders.push(t[1],t[2])}}),i._charset="x-user-defined",!d.overrideMimeType){var s=i.rawHeaders["mime-type"];if(s){var u=s.match(/;\s*charset=([^;])(;|$)/);u&&(i._charset=u[1].toLowerCase())}i._charset||(i._charset="utf-8")}}};e(t,l.Readable),t.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},t.prototype._onXHRProgress=function(){var t=this,e=t._xhr,r=null;switch(t._mode){case"text:vbarray":if(e.readyState!==s.DONE)break;try{r=new f.VBArray(e.responseBody).toArray()}catch(e){}if(null!==r){t.push(new h(r));break}case"text":try{r=e.responseText}catch(e){t._mode="text:vbarray";break}if(r.length>t._pos){var n=r.substr(t._pos);if("x-user-defined"===t._charset){for(var i=new h(n.length),o=0;ot._pos&&(t.push(new h(new Uint8Array(a.result.slice(t._pos)))),t._pos=a.result.byteLength)},a.onload=function(){t.push(null)},a.readAsArrayBuffer(r)}t._xhr.readyState===s.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,r("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r("buffer").Buffer)},{"./capability":160,_process:121,buffer:47,inherits:102,"readable-stream":145}],163:[function(e,t,r){var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=f,this.end=h,t=3;break;default:return this.write=d,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:-1}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�".repeat(r);if(1",'"',"`"," ","\r","\n","\t"]),O=["'"].concat(i),L=["%","/","?",";","#"].concat(O),q=["/","?","#"],D=/^[+a-z0-9A-Z_-]{0,63}$/,F=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,H={javascript:!0,"javascript:":!0},z={javascript:!0,"javascript:":!0},K={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},V=e("querystring");function o(e,t,r){if(e&&N.isObject(e)&&e instanceof S)return e;var n=new S;return n.parse(e,t,r),n}S.prototype.parse=function(e,t,r){if(!N.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+(void 0===e?"undefined":_typeof(e)));var n=e.indexOf("?"),i=-1!==n&&n>6|192);else{if(55295>18|240),r+=t(i>>12&63|128)}else r+=t(i>>12|224);r+=t(i>>6&63|128)}r+=t(63&i|128)}}return r},toString:function(e){for(var t="",r=0,n=a(e);r>10|55296),t+=String.fromCharCode(1023&i|56320)}}return t},fromNumber:function(e){var t=e.toString(16);return t.length%2==0?"0x"+t:"0x0"+t},toNumber:function(e){return parseInt(e.slice(2),16)},fromNat:function(e){return"0x0"===e?"0x":e.length%2==0?e:"0x0"+e.slice(2)},toNat:function(e){return"0"===e[2]?"0x"+e.slice(3):e},fromArray:n,toArray:r,fromUint8Array:function(e){return n([].slice.call(e,0))},toUint8Array:function(e){return new Uint8Array(r(e))}}},{"./array.js":172}],174:[function(e,t,r){var p="0123456789abcdef".split(""),b=[1,256,65536,16777216],y=[0,8,16,24],fe=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=function(e){var t,r,n,i,o,a,s,u,c,f,h,d,l,p,b,y,m,v,g,w,_,A,x,M,k,E,S,U,j,I,T,C,B,N,P,R,O,L,q,D,F,H,z,K,V,G,W,X,J,Z,$,Y,Q,ee,te,re,ne,ie,oe,ae,se,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(l=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|h>>>31),r=s^(h<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(d<<1|l>>>31),r=c^(l<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],G=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,U=e[20]<<3|e[21]>>>29,j=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,z=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,P=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,X=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,I=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,R=e[14]<<6|e[15]>>>26,O=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,$=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,B=e[44]<<29|e[45]>>>3,M=e[6]<<28|e[7]>>>4,k=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,q=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,Y=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,E=e[18]<<20|e[19]>>>12,S=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,F=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,x=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=b^~m&g,e[10]=M^~E&U,e[11]=k^~S&j,e[20]=N^~R&L,e[21]=P^~O&q,e[30]=K^~G&X,e[31]=V^~W&J,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=y^~v&w,e[3]=m^~g&_,e[12]=E^~U&I,e[13]=S^~j&T,e[22]=R^~L&D,e[23]=O^~q&F,e[32]=G^~X&Z,e[33]=W^~J&$,e[42]=re^~ie&ae,e[43]=ne^~oe&se,e[4]=v^~w&A,e[5]=g^~_&x,e[14]=U^~I&C,e[15]=j^~T&B,e[24]=L^~D&H,e[25]=q^~F&z,e[34]=X^~Z&Y,e[35]=J^~$&Q,e[44]=ie^~ae&ue,e[45]=oe^~se&ce,e[6]=w^~A&p,e[7]=_^~x&b,e[16]=I^~C&M,e[17]=T^~B&k,e[26]=D^~H&N,e[27]=F^~z&P,e[36]=Z^~Y&K,e[37]=$^~Q&V,e[46]=ae^~ue&ee,e[47]=se^~ce&te,e[8]=A^~p&y,e[9]=x^~b&m,e[18]=C^~M&E,e[19]=B^~k&S,e[28]=H^~N&R,e[29]=z^~P&O,e[38]=Y^~K&G,e[39]=Q^~V&W,e[48]=ue^~ee&re,e[49]=ce^~te&ne,e[0]^=fe[n],e[1]^=fe[n+1]},n=function(a){return function(e){var t,r,n;if("0x"===e.slice(0,2)){t=[];for(var i=2,o=e.length;i>2]|=t[c]<>2]|=r<>2]|=(192|r>>6)<>2]|=(224|r>>12)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<>2]|=b[3&d],e.lastByteIndex===o)for(i[0]=i[a],d=1;d>4&15]+p[15&f]+p[f>>12&15]+p[f>>8&15]+p[f>>20&15]+p[f>>16&15]+p[f>>28&15]+p[f>>24&15];l%a==0&&(m(u),d=0)}return"0x"+h}({blocks:[],reset:!0,block:0,start:0,blockCount:1600-((r=a)<<1)>>5,outputBlocks:r>>5,s:(n=[0,0,0,0,0,0,0,0,0,0],[].concat(n,n,n,n,n))},t)}};t.exports={keccak256:n(256),keccak512:n(512),keccak256s:n(256),keccak512s:n(512)}},{}],175:[function(e,t,r){var n=e("is-function");t.exports=function(e,t,r){if(!n(t))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this);"[object Array]"===i.call(e)?function(e,t,r){for(var n=0,i=e.length;n":">",'"':""","'":"'","`":"`"},B=p.invert(C),N=function(t){var r=function(e){return t[e]},e="(?:"+p.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};p.escape=N(C),p.unescape=N(B),p.result=function(e,t,r){var n=null==e?void 0:e[t];return void 0===n&&(n=r),p.isFunction(n)?n.call(e):n};var P=0;p.uniqueId=function(e){var t=++P+"";return e?e+t:t},p.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var R=/(.)^/,O={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\u2028|\u2029/g,q=function(e){return"\\"+O[e]};p.template=function(o,e,t){!e&&t&&(e=t),e=p.defaults({},e,p.templateSettings);var r=RegExp([(e.escape||R).source,(e.interpolate||R).source,(e.evaluate||R).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(r,function(e,t,r,n,i){return s+=o.slice(a,i).replace(L,q),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var n=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return n.call(this,e,p)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},p.chain=function(e){var t=p(e);return t._chain=!0,t};var D=function(e,t){return e._chain?p(t).chain():t};p.mixin=function(r){p.each(p.functions(r),function(e){var t=p[e]=r[e];p.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),D(this,t.apply(p,e))}})},p.mixin(p),p.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];p.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],D(this,e)}}),p.each(["concat","join","slice"],function(e){var t=n[e];p.prototype[e]=function(){return D(this,t.apply(this._wrapped,arguments))}}),p.prototype.value=function(){return this._wrapped},p.prototype.valueOf=p.prototype.toJSON=p.prototype.value,p.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return p})}).call(this)},{}],188:[function(e,t,r){t.exports=function(e,t){if(t){t=(t=t.trim().replace(/^(\?|#|&)/,""))?"?"+t:t;var r=e.split(/[\?\#]/),n=r[0];t&&/\:\/\/[^\/]*$/.test(n)&&(n+="/");var i=e.match(/(\#.*)$/);e=n+t,i&&(e+=i[0])}return e}},{}],189:[function(e,t,r){var i=e("xhr-request");t.exports=function(e,t){return new Promise(function(r,n){i(e,t,function(e,t){e?n(e):r(t)})})}},{"xhr-request":190}],190:[function(e,t,r){var s=e("query-string"),u=e("url-set-query"),c=e("object-assign"),f=e("./lib/ensure-header.js"),h=e("./lib/request.js"),d="application/json",l=function(){};t.exports=function(e,t,r){if(!e||"string"!=typeof e)throw new TypeError("must specify a URL");"function"==typeof t&&(r=t,t={});if(r&&"function"!=typeof r)throw new TypeError("expected cb to be undefined or a function");r=r||l;var n=(t=t||{}).json?"json":"text",i=(t=c({responseType:n},t)).headers||{},o=(t.method||"GET").toUpperCase(),a=t.query;a&&("string"!=typeof a&&(a=s.stringify(a)),e=u(e,a));"json"===t.responseType&&f(i,"Accept",d);t.json&&"GET"!==o&&"HEAD"!==o&&(f(i,"Content-Type",d),t.body=JSON.stringify(t.body));return t.method=o,t.url=e,t.headers=i,delete t.query,delete t.json,h(t,r)}},{"./lib/ensure-header.js":191,"./lib/request.js":193,"object-assign":178,"query-string":180,"url-set-query":188}],191:[function(e,t,r){t.exports=function(e,t,r){var n=t.toLowerCase();e[t]||e[n]||(e[t]=r)}},{}],192:[function(e,t,r){t.exports=function(e,t){return t?{statusCode:t.statusCode,headers:t.headers,method:e.method,url:e.url,rawRequest:t.rawRequest?t.rawRequest:t}:null}},{}],193:[function(e,t,r){var n=e("xhr"),s=e("./normalize-response"),u=function(){};t.exports=function(i,o){delete i.uri;var a=!1;"json"===i.responseType&&(i.responseType="text",a=!0);var t=n(i,function(t,e,r){if(a&&!t)try{var n=e.rawRequest.responseText;r=JSON.parse(n)}catch(e){t=e}e=s(i,e),o(t,t?null:r,e),o=u}),r=t.onabort;return t.onabort=function(){var e=r.apply(t,Array.prototype.slice.call(arguments));return o(new Error("XHR Aborted")),o=u,e},t}},{"./normalize-response":192,xhr:194}],194:[function(e,t,r){var n=e("global/window"),i=e("is-function"),y=e("parse-headers"),o=e("xtend");function a(e,t,r){var n=e;return i(t)?(r=t,"string"==typeof e&&(n={uri:e})):n=o(t,{uri:e}),n.callback=r,n}function m(e,t,r){return s(t=a(e,t,r))}function s(n){if(void 0===n.callback)throw new Error("callback argument missing");var i=!1,o=function(e,t,r){i||(i=!0,n.callback(e,t,r))};function t(e){return clearTimeout(u),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,o(e,b)}function e(){if(!a){var e;clearTimeout(u),e=n.useXDR&&void 0===s.status?200:1223===s.status?204:s.status;var t=b,r=null;return 0!==e?(t={body:function(){var e=void 0;if(e=s.response?s.response:s.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(s),p)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:e,method:f,headers:{},url:c,rawRequest:s},s.getAllResponseHeaders&&(t.headers=y(s.getAllResponseHeaders()))):r=new Error("Internal XMLHttpRequest Error"),o(r,t,t.body)}}var r,a,s=n.xhr||null;s||(s=n.cors||n.useXDR?new m.XDomainRequest:new m.XMLHttpRequest);var u,c=s.url=n.uri||n.url,f=s.method=n.method||"GET",h=n.body||n.data,d=s.headers=n.headers||{},l=!!n.sync,p=!1,b={body:void 0,headers:{},statusCode:0,method:f,url:c,rawRequest:s};if("json"in n&&!1!==n.json&&(p=!0,d.accept||d.Accept||(d.Accept="application/json"),"GET"!==f&&"HEAD"!==f&&(d["content-type"]||d["Content-Type"]||(d["Content-Type"]="application/json"),h=JSON.stringify(!0===n.json?h:n.json))),s.onreadystatechange=function(){4===s.readyState&&setTimeout(e,0)},s.onload=e,s.onerror=t,s.onprogress=function(){},s.onabort=function(){a=!0},s.ontimeout=t,s.open(f,c,!l,n.username,n.password),l||(s.withCredentials=!!n.withCredentials),!l&&0>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);else if("le"===r)for(i=n=0;n>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);return this.strip()},m.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==t&&(i=a(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},m.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,c=r;c"};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function i(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;n=(r.length=n)-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,t.length-1),l=Math.max(0,c-e.length+1);l<=d;l++){var p=c-l|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[l])+h)/67108864|0,h=67108863&a}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}m.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?d[6-s.length]+s+r:s+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&2<=e&&e<=36){var u=l[e],c=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var h=f.modn(c).toString(e);r=(f=f.idivn(c)).isZero()?h+r:d[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}y(!1,"Base should be between 2 and 36")},m.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=t&&(r+=7,t>>>=7),8<=t&&(r+=4,t>>>=4),2<=t&&(r+=2,t>>>=2),r+t},m.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},m.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},m.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},m.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},m.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},m.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},m.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},m.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},m.prototype.inotn=function(e){y("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},m.prototype.notn=function(e){return this.clone().inotn(e)},m.prototype.setn=function(e,t){y("number"==typeof e&&0<=e);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},m.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,l=0|a[1],p=8191&l,b=l>>>13,y=0|a[2],m=8191&y,v=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,A=0|a[4],x=8191&A,M=A>>>13,k=0|a[5],E=8191&k,S=k>>>13,U=0|a[6],j=8191&U,I=U>>>13,T=0|a[7],C=8191&T,B=T>>>13,N=0|a[8],P=8191&N,R=N>>>13,O=0|a[9],L=8191&O,q=O>>>13,D=0|s[0],F=8191&D,H=D>>>13,z=0|s[1],K=8191&z,V=z>>>13,G=0|s[2],W=8191&G,X=G>>>13,J=0|s[3],Z=8191&J,$=J>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,fe=0|s[8],he=8191&fe,de=fe>>>13,le=0|s[9],pe=8191&le,be=le>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(c+(n=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,H))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,H))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,H))+Math.imul(b,F)|0,o=Math.imul(b,H);var me=(c+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,F),i=(i=Math.imul(m,H))+Math.imul(v,F)|0,o=Math.imul(v,H),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0;var ve=(c+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,W)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),n=n+Math.imul(m,K)|0,i=(i=i+Math.imul(m,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,X)|0;var ge=(c+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(x,F),i=(i=Math.imul(x,H))+Math.imul(M,F)|0,o=Math.imul(M,H),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,X)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,X)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,$)|0;var we=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(E,F),i=(i=Math.imul(E,H))+Math.imul(S,F)|0,o=Math.imul(S,H),n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(m,Z)|0,i=(i=i+Math.imul(m,$)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var _e=(c+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(j,F),i=(i=Math.imul(j,H))+Math.imul(I,F)|0,o=Math.imul(I,H),n=n+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,V)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var Ae=(c+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,F),i=(i=Math.imul(C,H))+Math.imul(B,F)|0,o=Math.imul(B,H),n=n+Math.imul(j,K)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,V)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,X)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,ae)|0;var xe=(c+(n=n+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(P,F),i=(i=Math.imul(P,H))+Math.imul(R,F)|0,o=Math.imul(R,H),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(j,W)|0,i=(i=i+Math.imul(j,X)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,$)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(m,oe)|0,i=(i=i+Math.imul(m,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0;var Me=(c+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,F),i=(i=Math.imul(L,H))+Math.imul(q,F)|0,o=Math.imul(q,H),n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,V)|0,n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,$)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,he)|0,o=o+Math.imul(b,de)|0;var ke=(c+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,be)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,K),i=(i=Math.imul(L,V))+Math.imul(q,K)|0,o=Math.imul(q,V),n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,X)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,$)|0,n=n+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(m,he)|0,i=(i=i+Math.imul(m,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,W),i=(i=Math.imul(L,X))+Math.imul(q,W)|0,o=Math.imul(q,X),n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,$)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(j,re)|0,i=(i=i+Math.imul(j,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(_,he)|0,o=o+Math.imul(_,de)|0;var Se=(c+(n=n+Math.imul(m,pe)|0)|0)+((8191&(i=(i=i+Math.imul(m,be)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,be)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,$))+Math.imul(q,Z)|0,o=Math.imul(q,$),n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(j,oe)|0,i=(i=i+Math.imul(j,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,n=n+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,n=n+Math.imul(x,he)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ue=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,be)|0)+(i>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,ee))+Math.imul(q,Q)|0,o=Math.imul(q,ee),n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(R,re)|0,o=o+Math.imul(R,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(j,ue)|0,i=(i=i+Math.imul(j,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,n=n+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var je=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,be)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,be)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(q,re)|0,o=Math.imul(q,ne),n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,n=n+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,n=n+Math.imul(j,he)|0,i=(i=i+Math.imul(j,de)|0)+Math.imul(I,he)|0,o=o+Math.imul(I,de)|0;var Ie=(c+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,be)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,oe),i=(i=Math.imul(L,ae))+Math.imul(q,oe)|0,o=Math.imul(q,ae),n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(R,ue)|0,o=o+Math.imul(R,ce)|0,n=n+Math.imul(C,he)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Te=(c+(n=n+Math.imul(j,pe)|0)|0)+((8191&(i=(i=i+Math.imul(j,be)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,ue),i=(i=Math.imul(L,ce))+Math.imul(q,ue)|0,o=Math.imul(q,ce),n=n+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(R,he)|0,o=o+Math.imul(R,de)|0;var Ce=(c+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,be)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,he),i=(i=Math.imul(L,de))+Math.imul(q,he)|0,o=Math.imul(q,de);var Be=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,be)|0)+Math.imul(R,pe)|0))<<13)|0;c=((o=o+Math.imul(R,be)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(c+(n=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,be))+Math.imul(q,pe)|0))<<13)|0;return c=((o=Math.imul(q,be))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ye,u[1]=me,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=Ae,u[7]=xe,u[8]=Me,u[9]=ke,u[10]=Ee,u[11]=Se,u[12]=Ue,u[13]=je,u[14]=Ie,u[15]=Te,u[16]=Ce,u[17]=Be,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function s(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}Math.imul||(o=i),m.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?o(this,e,t):r<63?i(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):s(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),r=m.prototype._countBits(e)-1,n=0;n>=1;return n},u.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},m.prototype.muln=function(e){return this.clone().imuln(e)},m.prototype.sqr=function(){return this.mul(this)},m.prototype.isqr=function(){return this.imul(this.clone())},m.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new m(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;0<=t;t--)this.words[t+n]=this.words[t];for(t=0;t>>i<o)for(this.length-=o,u=0;u>>i,c=f&a}return s&&0!==c&&(s.words[s.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},m.prototype.ishrn=function(e,t,r){return y(0===this.negative),this.iushrn(e,t,r)},m.prototype.shln=function(e){return this.clone().ishln(e)},m.prototype.ushln=function(e){return this.clone().iushln(e)},m.prototype.shrn=function(e){return this.clone().ishrn(e)},m.prototype.ushrn=function(e){return this.clone().iushrn(e)},m.prototype.testn=function(e){y("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,n=1<>>t<>26)-(s/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===a)return this.strip();for(y(-1===a),n=a=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},m.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,s=n.length-i.length;if("mod"!==t){(a=new m(null)).length=s+1,a.words=new Array(a.length);for(var u=0;uthis.length||this.cmp(e)<0?{div:new m(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new m(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new m(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,o},m.prototype.div=function(e){return this.divmod(e,"div",!1).div},m.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},m.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},m.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},m.prototype.modn=function(e){y(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;0<=n;n--)r=(t*r+(0|this.words[n]))%e;return r},m.prototype.idivn=function(e){y(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},m.prototype.divn=function(e){return this.clone().idivn(e)},m.prototype.egcd=function(e){y(0===e.negative),y(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new m(1),i=new m(0),o=new m(0),a=new m(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var u=r.clone(),c=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(0>>26,a&=67108863,this.words[o]=a}return 0!==i&&(this.words[o]=i,this.length++),this},m.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},m.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1e.length)return 1;if(this.lengththis.n;);var n=t>>22,i=o}i>>>=22,0===(e.words[n-10]=i)&&10>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},m._prime=function(e){if(c[e])return c[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new g;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return c[e]=t},_.prototype._verify1=function(e){y(0===e.negative,"red works only with positives"),y(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){y(0==(e.negative|t.negative),"red works only with positives"),y(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(y(t%2==1),3===t){var r=this.m.add(new m(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);y(!n.isZero());var o=new m(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new m(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var c=this.pow(u,n),f=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),d=i;0!==h.cmp(o);){for(var l=h,p=0;0!==l.cmp(o);p++)l=l.redSqr();y(p>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[o]),o=a=0)):a=0}s=26}return i},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},m.mont=function(e){return new A(e)},r(A,_),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new m(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:17}],220:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a=e("./address"),s=e("./bignumber"),u=e("./bytes"),c=e("./utf8"),f=e("./properties"),h=o(e("./errors")),d=new RegExp(/^bytes([0-9]*)$/),l=new RegExp(/^(u?int)([0-9]*)$/),p=new RegExp(/^(.*)\[([0-9]*)\]$/);r.defaultCoerceFunc=function(e,t){var r=e.match(l);return r&&parseInt(r[2])<=48?t.toNumber():t};var b=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),y=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function m(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}function v(t,e){function r(e){throw new Error('unexpected character "'+t[e]+'" at position '+e+' in "'+t+'"')}for(var n={type:"",name:"",state:{allowType:!0}},i=n,o=0;oe.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},e}(w),x=function(a){function e(e,t,r,n){var i=this,o=(r?"int":"uint")+8*t;return(i=a.call(this,e,o,o,n,!1)||this).size=t,i.signed=r,i}return i(e,a),e.prototype.encode=function(t){try{var e=s.bigNumberify(t);return e=e.toTwos(8*this.size).maskn(8*this.size),this.signed&&(e=e.fromTwos(8*this.size).toTwos(256)),u.padZeros(u.arrayify(e),32)}catch(e){h.throwError("invalid number value",h.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:t})}return null},e.prototype.decode=function(e,t){e.length>1]>>4&&(t[i]=t[i].toUpperCase()),8<=(15&r[i>>1])&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}for(var f={},h=0;h<10;h++)f[String(h)]=String(h);for(h=0;h<26;h++)f[String.fromCharCode(65+h)]=String(10+h);var d,l=Math.floor((d=9007199254740991,Math.log10?Math.log10(d):Math.log(d)/Math.LN10));function p(e){e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00";var t="";for(e.split("").forEach(function(e){t+=f[e]});t.length>=l;){var r=t.substring(0,l);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=String(98-parseInt(t,10)%97);n.length<2;)n="0"+n;return n}function b(e){var t=null;if("string"!=typeof e&&u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:e}),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=c(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&u.throwError("bad address checksum",u.INVALID_ARGUMENT,{arg:"address",value:e});else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==p(e)&&u.throwError("bad icap checksum",u.INVALID_ARGUMENT,{arg:"address",value:e}),t=new i.default.BN(e.substring(4),36).toString(16);t.length<40;)t="0"+t;t=c("0x"+t)}else u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:e});return t}r.getAddress=b,r.getIcapAddress=function(e){for(var t=new i.default.BN(b(e).substring(2),16).toString(36).toUpperCase();t.length<30;)t="0"+t;return"XE"+p("XE00"+t)+t},r.getContractAddress=function(e){if(!e.from)throw new Error("missing from address");var t=e.nonce;return b("0x"+a.keccak256(s.encode([b(e.from),o.stripZeros(o.hexlify(t))])).substring(26))}},{"./bytes":223,"./errors":224,"./keccak256":225,"./rlp":227,"bn.js":219}],222:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var s=o(e("bn.js")),u=e("./bytes"),c=e("./properties"),f=e("./types"),h=a(e("./errors")),d=new s.default.BN(-1);function l(e){var t=e.toString(16);return"-"===t[0]?t.length%2==0?"-0x0"+t.substring(1):"-0x"+t.substring(1):t.length%2==1?"0x0"+t:"0x"+t}function p(e){return m(e)._bn}function b(e){return new y(l(e))}var y=function(r){function n(e){var t=r.call(this)||this;if(h.checkNew(t,n),"string"==typeof e)u.isHexString(e)?("0x"==e&&(e="0x0"),c.defineReadOnly(t,"_hex",e)):"-"===e[0]&&u.isHexString(e.substring(1))?c.defineReadOnly(t,"_hex",e):e.match(/^-?[0-9]*$/)?(""==e&&(e="0"),c.defineReadOnly(t,"_hex",l(new s.default.BN(e)))):h.throwError("invalid BigNumber string value",h.INVALID_ARGUMENT,{arg:"value",value:e});else if("number"==typeof e){parseInt(String(e))!==e&&h.throwError("underflow",h.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:e,outputValue:parseInt(String(e))});try{c.defineReadOnly(t,"_hex",l(new s.default.BN(e)))}catch(e){h.throwError("overflow",h.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}}else e instanceof n?c.defineReadOnly(t,"_hex",e._hex):e.toHexString?c.defineReadOnly(t,"_hex",l(p(e.toHexString()))):u.isArrayish(e)?c.defineReadOnly(t,"_hex",l(new s.default.BN(u.hexlify(e).substring(2),16))):h.throwError("invalid BigNumber value",h.INVALID_ARGUMENT,{arg:"value",value:e});return t}return i(n,r),Object.defineProperty(n.prototype,"_bn",{get:function(){return"-"===this._hex[0]?new s.default.BN(this._hex.substring(3),16).mul(d):new s.default.BN(this._hex.substring(2),16)},enumerable:!0,configurable:!0}),n.prototype.fromTwos=function(e){return b(this._bn.fromTwos(e))},n.prototype.toTwos=function(e){return b(this._bn.toTwos(e))},n.prototype.add=function(e){return b(this._bn.add(p(e)))},n.prototype.sub=function(e){return b(this._bn.sub(p(e)))},n.prototype.div=function(e){return m(e).isZero()&&h.throwError("division by zero",h.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),b(this._bn.div(p(e)))},n.prototype.mul=function(e){return b(this._bn.mul(p(e)))},n.prototype.mod=function(e){return b(this._bn.mod(p(e)))},n.prototype.pow=function(e){return b(this._bn.pow(p(e)))},n.prototype.maskn=function(e){return b(this._bn.maskn(e))},n.prototype.eq=function(e){return this._bn.eq(p(e))},n.prototype.lt=function(e){return this._bn.lt(p(e))},n.prototype.lte=function(e){return this._bn.lte(p(e))},n.prototype.gt=function(e){return this._bn.gt(p(e))},n.prototype.gte=function(e){return this._bn.gte(p(e))},n.prototype.isZero=function(){return this._bn.isZero()},n.prototype.toNumber=function(){try{return this._bn.toNumber()}catch(e){h.throwError("overflow",h.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}return null},n.prototype.toString=function(){return this._bn.toString(10)},n.prototype.toHexString=function(){return this._hex},n}(f.BigNumber);function m(e){return e instanceof y?e:new y(e)}r.bigNumberify=m,r.ConstantNegativeOne=m(-1),r.ConstantZero=m(0),r.ConstantOne=m(1),r.ConstantTwo=m(2),r.ConstantWeiPerEther=m("1000000000000000000")},{"./bytes":223,"./errors":224,"./properties":226,"./types":228,"bn.js":219}],223:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var s=e("./errors");function a(e){return!!e._bn}function u(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return new Uint8Array(Array.prototype.slice.apply(t,e))}),t}function c(e){if(!e||parseInt(String(e.length))!=e.length||"string"==typeof e)return!1;for(var t=0;t>4]+h[15&o])}return"0x"+n.join("")}return s.throwError("invalid hexlify value",null,{arg:"value",value:e}),"never"}function l(e,t){for(i(e)||s.throwError("invalid hex string",s.INVALID_ARGUMENT,{arg:"value",value:e});e.length<2*t+2;)e="0x0"+e.substring(2);return e}function o(e){var t,r=0,n="0x",i="0x";if((t=e)&&null!=t.r&&null!=t.s){null==e.v&&null==e.recoveryParam&&s.throwError("at least on of recoveryParam or v must be specified",s.INVALID_ARGUMENT,{argument:"signature",value:e}),n=l(e.r,32),i=l(e.s,32),"string"==typeof(r=e.v)&&(r=parseInt(r,16));var o=e.recoveryParam;null==o&&null!=e.v&&(o=1-r%2),r=27+o}else{var a=f(e);if(65!==a.length)throw new Error("invalid signature");n=d(a.slice(0,32)),i=d(a.slice(32,64)),27!==(r=a[64])&&28!==r&&(r=27+r%2)}return{r:n,s:i,recoveryParam:r-27,v:r}}r.hexlify=d,r.hexDataLength=function(e){return i(e)&&e.length%2==0?(e.length-2)/2:null},r.hexDataSlice=function(e,t,r){return i(e)||s.throwError("invalid hex data",s.INVALID_ARGUMENT,{arg:"value",value:e}),e.length%2!=0&&s.throwError("hex data length must be even",s.INVALID_ARGUMENT,{arg:"value",value:e}),t=2+2*t,null!=r?"0x"+e.substring(t,t+2*r):"0x"+e.substring(t)},r.hexStripZeros=function(e){for(i(e)||s.throwError("invalid hex string",s.INVALID_ARGUMENT,{arg:"value",value:e});3>=8;return t}function i(e,t,r){for(var n=0,i=0;ie.length)throw new Error("too short");if(t+1+r+(n=i(e,t+1,r))>e.length)throw new Error("to short");return s(e,t,t+1+r,r+n)}if(192<=e[t]){if(t+1+(n=e[t]-192)>e.length)throw new Error("invalid rlp data");return s(e,t,t+1,n)}if(184<=e[t]){var r;if(t+1+(r=e[t]-183)>e.length)throw new Error("invalid rlp data");if(t+1+r+(n=i(e,t+1,r))>e.length)throw new Error("invalid rlp data");return{consumed:1+r+n,result:o.hexlify(e.slice(t+1+r,t+1+r+n))}}if(128<=e[t]){var n;if(t+1+(n=e[t]-128)>e.length)throw new Error("invlaid rlp data");return{consumed:1+n,result:o.hexlify(e.slice(t+1,t+1+n))}}return{consumed:1,result:o.hexlify(e[t])}}r.encode=function(e){return o.hexlify(function t(e){if(Array.isArray(e)){var r=[];return e.forEach(function(e){r=r.concat(t(e))}),r.length<=55?(r.unshift(192+r.length),r):((n=a(r.length)).unshift(247+n.length),n.concat(r))}var n,i=Array.prototype.slice.call(o.arrayify(e));return 1===i.length&&i[0]<=127?i:i.length<=55?(i.unshift(128+i.length),i):((n=a(i.length)).unshift(183+n.length),n.concat(i))}(e))},r.decode=function(e){var t=o.arrayify(e),r=u(t,0);if(r.consumed!==t.length)throw new Error("invalid rlp data");return r.result}},{"./bytes":223}],228:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=function(){};r.BigNumber=n;var i=function(){};r.Indexed=i;var o=function(){};r.MinimalProvider=o;var a=function(){};r.Signer=a;var s=function(){};r.HDNode=s},{}],229:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var a,n,u=e("./bytes");(n=a=r.UnicodeNormalizationForm||(r.UnicodeNormalizationForm={})).current="",n.NFC="NFC",n.NFD="NFD",n.NFKC="NFKC",n.NFKD="NFKD",r.toUtf8Bytes=function(e,t){void 0===t&&(t=a.current),t!=a.current&&(e=e.normalize(t));for(var r=[],n=0,i=0;i>6|192:(55296==(64512&o)&&i+1>18|240,r[n++]=o>>12&63|128):r[n++]=o>>12|224,r[n++]=o>>6&63|128),r[n++]=63&o|128)}return u.arrayify(r)},r.toUtf8String=function(e){e=u.arrayify(e);for(var t="",r=0;r>7!=0){if(n>>6!=2){var i=null;if(n>>5==6)i=1;else if(n>>4==14)i=2;else if(n>>3==30)i=3;else if(n>>2==62)i=4;else{if(n>>1!=126)continue;i=5}if(r+i>e.length){for(;r>6==2;r++);if(r!=e.length)continue;return t}var o,a=n&(1<<8-i-1)-1;for(o=0;o>6!=2)break;a=a<<6|63&s}o==i?a<=65535?t+=String.fromCharCode(a):(a-=65536,t+=String.fromCharCode(55296+(a>>10&1023),56320+(1023&a))):r--}}else t+=String.fromCharCode(n)}return t}},{"./bytes":223}],230:[function(e,_,t){(function(g,w){!function(){var e="object"===("undefined"==typeof window?"undefined":_typeof(window))?window:{};!e.JS_SHA3_NO_NODE_JS&&"object"===(void 0===g?"undefined":_typeof(g))&&g.versions&&g.versions.node&&(e=w);for(var t=!e.JS_SHA3_NO_COMMON_JS&&"object"===(void 0===_?"undefined":_typeof(_))&&_.exports,u="0123456789abcdef".split(""),f=[0,8,16,24],fe=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],r=[224,256,384,512],o=["hex","buffer","arrayBuffer","array"],a=function(t,r,n){return function(e){return new m(t,r,t).update(e)[n]()}},s=function(r,n,i){return function(e,t){return new m(r,n,t).update(e)[i]()}},n=function(e,t){var r=a(e,t,"hex");r.create=function(){return new m(e,t,e)},r.update=function(e){return r.create().update(e)};for(var n=0;n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}m.prototype.update=function(e){var t="string"!=typeof e;t&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e));for(var r,n,i=e.length,o=this.blocks,a=this.byteCount,s=this.blockCount,u=0,c=this.s;u>2]|=e[u]<>2]|=n<>2]|=(192|n>>6)<>2]|=(224|n>>12)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];a%t==0&&(v(r),o=0)}return i&&(e=r[o],0>4&15]+u[15&e]),1>12&15]+u[e>>8&15]),2>20&15]+u[e>>16&15])),s},m.prototype.buffer=m.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%r==0&&v(n)}return o&&(e=s<<2,t=n[a],0>8&255),2>16&255)),u};var v=function(e){var t,r,n,i,o,a,s,u,c,f,h,d,l,p,b,y,m,v,g,w,_,A,x,M,k,E,S,U,j,I,T,C,B,N,P,R,O,L,q,D,F,H,z,K,V,G,W,X,J,Z,$,Y,Q,ee,te,re,ne,ie,oe,ae,se,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(l=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|h>>>31),r=s^(h<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(d<<1|l>>>31),r=c^(l<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],G=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,U=e[20]<<3|e[21]>>>29,j=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,z=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,P=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,X=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,I=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,R=e[14]<<6|e[15]>>>26,O=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,$=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,B=e[44]<<29|e[45]>>>3,M=e[6]<<28|e[7]>>>4,k=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,q=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,Y=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,E=e[18]<<20|e[19]>>>12,S=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,F=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,x=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=b^~m&g,e[10]=M^~E&U,e[11]=k^~S&j,e[20]=N^~R&L,e[21]=P^~O&q,e[30]=K^~G&X,e[31]=V^~W&J,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=y^~v&w,e[3]=m^~g&_,e[12]=E^~U&I,e[13]=S^~j&T,e[22]=R^~L&D,e[23]=O^~q&F,e[32]=G^~X&Z,e[33]=W^~J&$,e[42]=re^~ie&ae,e[43]=ne^~oe&se,e[4]=v^~w&A,e[5]=g^~_&x,e[14]=U^~I&C,e[15]=j^~T&B,e[24]=L^~D&H,e[25]=q^~F&z,e[34]=X^~Z&Y,e[35]=J^~$&Q,e[44]=ie^~ae&ue,e[45]=oe^~se&ce,e[6]=w^~A&p,e[7]=_^~x&b,e[16]=I^~C&M,e[17]=T^~B&k,e[26]=D^~H&N,e[27]=F^~z&P,e[36]=Z^~Y&K,e[37]=$^~Q&V,e[46]=ae^~ue&ee,e[47]=se^~ce&te,e[8]=A^~p&y,e[9]=x^~b&m,e[18]=C^~M&E,e[19]=B^~k&S,e[28]=H^~N&R,e[29]=z^~P&O,e[38]=Y^~K&G,e[39]=Q^~V&W,e[48]=ue^~ee&re,e[49]=ce^~te&ne,e[0]^=fe[n],e[1]^=fe[n+1]};if(t)_.exports=c;else for(d=0;d=t)throw new Error("invalid sig")}t.exports=function(e,t,r,n,i){var o=b(r);if("ec"===o.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=y[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new p(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,i=r.data.q,o=r.data.g,a=r.data.pub_key,s=b.signature.decode(e,"der"),u=s.s,c=s.r;m(u,i),m(c,i);var f=l.mont(n),h=u.invm(i);return 0===o.toRed(f).redPow(new l(t).mul(h).mod(i)).fromRed().mul(a.toRed(f).redPow(c.mul(h).mod(i)).fromRed()).mod(n).mod(i).cmp(c)}(e,t,o)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");t=d.concat([i,t]);for(var a=o.modulus.byteLength(),s=[1],u=0;t.length+s.length+2=t.length)throw"";var e=t.slice(r,r+2);return e<"80"?(r+=2,"0x"+e):e<"c0"?o():a()},i=function(){var e=parseInt(t.slice(r,r+=2),16)%64;return e<56?e:parseInt(t.slice(r,r+=2*(e-55)),16)},o=function(){var e=i();return"0x"+t.slice(r,r+=2*e)},a=function(){for(var e=2*i()+r,t=[];r>>32-t}function u(e,t,r,n,i,o,a){return s(e+(t&r|~t&n)+i+o|0,a)+t|0}function c(e,t,r,n,i,o,a){return s(e+(t&n|r&~n)+i+o|0,a)+t|0}function f(e,t,r,n,i,o,a){return s(e+(t^r^n)+i+o|0,a)+t|0}function h(e,t,r,n,i,o,a){return s(e+(r^(t|~n))+i+o|0,a)+t|0}e(n,r),n.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;n=h(n=h(n=h(n=h(n=f(n=f(n=f(n=f(n=c(n=c(n=c(n=c(n=u(n=u(n=u(n=u(n,i=u(i,o=u(o,r=u(r,n,i,o,e[0],3614090360,7),n,i,e[1],3905402710,12),r,n,e[2],606105819,17),o,r,e[3],3250441966,22),i=u(i,o=u(o,r=u(r,n,i,o,e[4],4118548399,7),n,i,e[5],1200080426,12),r,n,e[6],2821735955,17),o,r,e[7],4249261313,22),i=u(i,o=u(o,r=u(r,n,i,o,e[8],1770035416,7),n,i,e[9],2336552879,12),r,n,e[10],4294925233,17),o,r,e[11],2304563134,22),i=u(i,o=u(o,r=u(r,n,i,o,e[12],1804603682,7),n,i,e[13],4254626195,12),r,n,e[14],2792965006,17),o,r,e[15],1236535329,22),i=c(i,o=c(o,r=c(r,n,i,o,e[1],4129170786,5),n,i,e[6],3225465664,9),r,n,e[11],643717713,14),o,r,e[0],3921069994,20),i=c(i,o=c(o,r=c(r,n,i,o,e[5],3593408605,5),n,i,e[10],38016083,9),r,n,e[15],3634488961,14),o,r,e[4],3889429448,20),i=c(i,o=c(o,r=c(r,n,i,o,e[9],568446438,5),n,i,e[14],3275163606,9),r,n,e[3],4107603335,14),o,r,e[8],1163531501,20),i=c(i,o=c(o,r=c(r,n,i,o,e[13],2850285829,5),n,i,e[2],4243563512,9),r,n,e[7],1735328473,14),o,r,e[12],2368359562,20),i=f(i,o=f(o,r=f(r,n,i,o,e[5],4294588738,4),n,i,e[8],2272392833,11),r,n,e[11],1839030562,16),o,r,e[14],4259657740,23),i=f(i,o=f(o,r=f(r,n,i,o,e[1],2763975236,4),n,i,e[4],1272893353,11),r,n,e[7],4139469664,16),o,r,e[10],3200236656,23),i=f(i,o=f(o,r=f(r,n,i,o,e[13],681279174,4),n,i,e[0],3936430074,11),r,n,e[3],3572445317,16),o,r,e[6],76029189,23),i=f(i,o=f(o,r=f(r,n,i,o,e[9],3654602809,4),n,i,e[12],3873151461,11),r,n,e[15],530742520,16),o,r,e[2],3299628645,23),i=h(i,o=h(o,r=h(r,n,i,o,e[0],4096336452,6),n,i,e[7],1126891415,10),r,n,e[14],2878612391,15),o,r,e[5],4237533241,21),i=h(i,o=h(o,r=h(r,n,i,o,e[12],1700485571,6),n,i,e[3],2399980690,10),r,n,e[10],4293915773,15),o,r,e[1],2240044497,21),i=h(i,o=h(o,r=h(r,n,i,o,e[8],1873313359,6),n,i,e[15],4264355552,10),r,n,e[6],2734768916,15),o,r,e[13],1309151649,21),i=h(i,o=h(o,r=h(r,n,i,o,e[4],4149444226,6),n,i,e[11],3174756917,10),r,n,e[2],718787259,15),o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56a||0<=new c(t).cmp(o.modulus))throw new Error("decryption error");i=r?b(new c(t),o):l(t,o);var s=new f(a-i.length);if(s.fill(0),i=f.concat([s,i],a),4===n)return function(e,t){e.modulus;var r=e.modulus.byteLength(),n=(t.length,p("sha1").update(new f("")).digest()),i=n.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),a=t.slice(i+1),s=d(o,h(a,i)),u=d(a,h(s,r-i-1));if(function(e,t){e=new f(e),t=new f(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));var i=-1;for(;++i=t.length){o++;break}var a=t.slice(2,i-1);t.slice(i-1,i);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,i,r);if(3===n)return i;throw new Error("unknown padding")}}).call(this,e("buffer").Buffer)},{"./mgf":350,"./withPublic":353,"./xor":354,"bn.js":250,"browserify-rsa":272,buffer:47,"create-hash":282,"parse-asn1":343}],352:[function(e,t,r){(function(d){var a=e("parse-asn1"),l=e("randombytes"),p=e("create-hash"),b=e("./mgf"),y=e("./xor"),m=e("bn.js"),s=e("./withPublic"),u=e("browserify-rsa");t.exports=function(e,t,r){var n;n=e.padding?e.padding:r?1:4;var i,o=a(e);if(4===n)i=function(e,t){var r=e.modulus.byteLength(),n=t.length,i=p("sha1").update(new d("")).digest(),o=i.length,a=2*o;if(r-a-2 0 and a power of 2");if(2147483647/128/n>>32-t}function w(e){var t;for(t=0;t<16;t++)f[t]=(255&e[4*t+0])<<0,f[t]|=(255&e[4*t+1])<<8,f[t]|=(255&e[4*t+2])<<16,f[t]|=(255&e[4*t+3])<<24;for(M(f,0,h,0,16),t=8;0>0&255,e[r+1]=f[t]>>8&255,e[r+2]=f[t]>>16&255,e[r+3]=f[t]>>24&255}}function _(e,t,r,n,i){for(var o=0;o>>((3&t)<<3)&255;return n}}i.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],371:[function(e,t,r){for(var a=e("./rng"),i=[],o={},n=0;n<256;n++)i[n]=(n+256).toString(16).substr(1),o[i[n]]=n;function l(e,t){var r=t||0,n=i;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}var s=a(),p=[1|s[0],s[1],s[2],s[3],s[4],s[5]],b=16383&(s[6]<<8|s[7]),y=0,m=0;function u(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||a)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var o=0;o<16;o++)t[n+o]=i[o];return t||l(i)}var c=u;c.v1=function(e,t,r){var n=t&&r||0,i=t||[],o=void 0!==(e=e||{}).clockseq?e.clockseq:b,a=void 0!==e.msecs?e.msecs:(new Date).getTime(),s=void 0!==e.nsecs?e.nsecs:m+1,u=a-y+(s-m)/1e4;if(u<0&&void 0===e.clockseq&&(o=o+1&16383),(u<0||y>>24&255,i[n++]=c>>>16&255,i[n++]=c>>>8&255,i[n++]=255&c;var f=a/4294967296*1e4&268435455;i[n++]=f>>>8&255,i[n++]=255&f,i[n++]=f>>>24&15|16,i[n++]=f>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var h=e.node||p,d=0;d<6;d++)i[n+d]=h[d];return t||l(i)},c.v4=u,c.parse=function(e,t,r){var n=t&&r||0,i=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){i<16&&(t[n+i++]=o[e])});i<16;)t[n+i++]=0;return t},c.unparse=l,t.exports=c},{"./rng":370}],372:[function(a,s,e){(function(e,d){var l=a("underscore"),r=a("web3-core"),n=a("web3-core-method"),p=a("any-promise"),b=a("eth-lib/lib/account"),y=a("eth-lib/lib/hash"),m=a("eth-lib/lib/rlp"),v=a("eth-lib/lib/nat"),g=a("eth-lib/lib/bytes"),w=a(void 0===e?"crypto-browserify":"crypto"),_=a("scrypt.js"),A=a("uuid"),x=a("web3-utils"),M=a("web3-core-helpers"),i=function(e){return l.isUndefined(e)||l.isNull(e)},k=function(e){for(;e&&e.startsWith("0x0");)e="0x"+e.slice(3);return e},E=function(e){return e.length%2==1&&(e=e.replace("0x","0x0")),e},t=function(){var t=this;r.packageInit(this,arguments),delete this.BatchRequest,delete this.extend;var e=[new n({name:"getId",call:"net_version",params:0,outputFormatter:x.hexToNumber}),new n({name:"getGasPrice",call:"eth_gasPrice",params:0}),new n({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[function(e){if(x.isAddress(e))return e;throw new Error("Address "+e+' is not a valid address to get the "transactionCount".')},function(){return"latest"}]})];this._ethereumCall={},l.each(e,function(e){e.attachToObject(t._ethereumCall),e.setRequestManager(t._requestManager)}),this.wallet=new o(this)};function o(e){this._accounts=e,this.length=0,this.defaultKeyName="web3js_wallet"}t.prototype._addAccountFunctions=function(r){var n=this;return r.signTransaction=function(e,t){return n.signTransaction(e,r.privateKey,t)},r.sign=function(e){return n.sign(e,r.privateKey)},r.encrypt=function(e,t){return n.encrypt(r.privateKey,e,t)},r},t.prototype.create=function(e){return this._addAccountFunctions(b.create(e||x.randomHex(32)))},t.prototype.privateKeyToAccount=function(e){return this._addAccountFunctions(b.fromPrivate(e))},t.prototype.signTransaction=function(t,u,c){var f,h=!1;if(c=c||function(){},!t)return h=new Error("No transaction object given!"),c(h),p.reject(h);function r(e){if(e.gas||e.gasLimit||(h=new Error('"gas" is missing')),(e.nonce<0||e.gas<0||e.gasPrice<0||e.chainId<0)&&(h=new Error("Gas, gasPrice, nonce or chainId is lower than 0")),h)return c(h),p.reject(h);try{var t=e=M.formatters.inputCallFormatter(e);t.to=e.to||"0x",t.data=e.data||"0x",t.value=e.value||"0x",t.chainId=x.numberToHex(e.chainId);var r=m.encode([g.fromNat(t.nonce),g.fromNat(t.gasPrice),g.fromNat(t.gas),t.to.toLowerCase(),g.fromNat(t.value),t.data,g.fromNat(t.chainId||"0x1"),"0x","0x"]),n=y.keccak256(r),i=b.makeSigner(2*v.toNumber(t.chainId||"0x1")+35)(y.keccak256(r),u),o=m.decode(r).slice(0,6).concat(b.decodeSignature(i));o[6]=E(k(o[6])),o[7]=E(k(o[7])),o[8]=E(k(o[8]));var a=m.encode(o),s=m.decode(a);f={messageHash:n,v:k(s[6]),r:k(s[7]),s:k(s[8]),rawTransaction:a}}catch(e){return c(e),p.reject(e)}return c(null,f),f}return void 0!==t.nonce&&void 0!==t.chainId&&void 0!==t.gasPrice?p.resolve(r(t)):p.all([i(t.chainId)?this._ethereumCall.getId():t.chainId,i(t.gasPrice)?this._ethereumCall.getGasPrice():t.gasPrice,i(t.nonce)?this._ethereumCall.getTransactionCount(this.privateKeyToAccount(u).address):t.nonce]).then(function(e){if(i(e[0])||i(e[1])||i(e[2]))throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: '+JSON.stringify(e));return r(l.extend(t,{chainId:e[0],gasPrice:e[1],nonce:e[2]}))})},t.prototype.recoverTransaction=function(e){var t=m.decode(e),r=b.encodeSignature(t.slice(6,9)),n=g.toNumber(t[6]),i=n<35?[]:[g.fromNumber(n-35>>1),"0x","0x"],o=t.slice(0,6).concat(i),a=m.encode(o);return b.recover(y.keccak256(a),r)},t.prototype.hashMessage=function(e){var t=x.isHexStrict(e)?x.hexToBytes(e):e,r=d.from(t),n="Ethereum Signed Message:\n"+t.length,i=d.from(n),o=d.concat([i,r]);return y.keccak256s(o)},t.prototype.sign=function(e,t){var r=this.hashMessage(e),n=b.sign(r,t),i=b.decodeSignature(n);return{message:e,messageHash:r,v:i[0],r:i[1],s:i[2],signature:n}},t.prototype.recover=function(e,t,r){var n=[].slice.apply(arguments);return l.isObject(e)?this.recover(e.messageHash,b.encodeSignature([e.v,e.r,e.s]),!0):(r||(e=this.hashMessage(e)),4<=n.length?(r=n.slice(-1)[0],r=!!l.isBoolean(r)&&!!r,this.recover(e,b.encodeSignature(n.slice(1,4)),r)):b.recover(e,t))},t.prototype.decrypt=function(e,t,r){if(!l.isString(t))throw new Error("No password given.");var n,i,o=l.isObject(e)?e:JSON.parse(r?e.toLowerCase():e);if(3!==o.version)throw new Error("Not a valid V3 wallet");if("scrypt"===o.crypto.kdf)i=o.crypto.kdfparams,n=_(new d(t),new d(i.salt,"hex"),i.n,i.r,i.p,i.dklen);else{if("pbkdf2"!==o.crypto.kdf)throw new Error("Unsupported key derivation scheme");if("hmac-sha256"!==(i=o.crypto.kdfparams).prf)throw new Error("Unsupported parameters to PBKDF2");n=w.pbkdf2Sync(new d(t),new d(i.salt,"hex"),i.c,i.dklen,"sha256")}var a=new d(o.crypto.ciphertext,"hex");if(x.sha3(d.concat([n.slice(16,32),a])).replace("0x","")!==o.crypto.mac)throw new Error("Key derivation failed - possibly wrong password");var s=w.createDecipheriv(o.crypto.cipher,n.slice(0,16),new d(o.crypto.cipherparams.iv,"hex")),u="0x"+d.concat([s.update(a),s.final()]).toString("hex");return this.privateKeyToAccount(u)},t.prototype.encrypt=function(e,t,r){var n,i=this.privateKeyToAccount(e),o=(r=r||{}).salt||w.randomBytes(32),a=r.iv||w.randomBytes(16),s=r.kdf||"scrypt",u={dklen:r.dklen||32,salt:o.toString("hex")};if("pbkdf2"===s)u.c=r.c||262144,u.prf="hmac-sha256",n=w.pbkdf2Sync(new d(t),o,u.c,u.dklen,"sha256");else{if("scrypt"!==s)throw new Error("Unsupported kdf");u.n=r.n||8192,u.r=r.r||8,u.p=r.p||1,n=_(new d(t),o,u.n,u.r,u.p,u.dklen)}var c=w.createCipheriv(r.cipher||"aes-128-ctr",n.slice(0,16),a);if(!c)throw new Error("Unsupported cipher");var f=d.concat([c.update(new d(i.privateKey.replace("0x",""),"hex")),c.final()]),h=x.sha3(d.concat([n.slice(16,32),new d(f,"hex")])).replace("0x","");return{version:3,id:A.v4({random:r.uuid||w.randomBytes(16)}),address:i.address.toLowerCase().replace("0x",""),crypto:{ciphertext:f.toString("hex"),cipherparams:{iv:a.toString("hex")},cipher:r.cipher||"aes-128-ctr",kdf:s,kdfparams:u,mac:h.toString("hex")}}},o.prototype._findSafeIndex=function(e){return e=e||0,l.has(this,e)?this._findSafeIndex(e+1):e},o.prototype._currentIndexes=function(){return Object.keys(this).map(function(e){return parseInt(e)}).filter(function(e){return e<9e20})},o.prototype.create=function(e,t){for(var r=0;r\\$%@ءؤة\"'^|~⦅⦆・ゥャ¢£¬¦¥₩│←↑→↓■○𐐨𐐩𐐪𐐫𐐬𐐭𐐮𐐯𐐰𐐱𐐲𐐳𐐴𐐵𐐶𐐷𐐸𐐹𐐺𐐻𐐼𐐽𐐾𐐿𐑀𐑁𐑂𐑃𐑄𐑅𐑆𐑇𐑈𐑉𐑊𐑋𐑌𐑍𐑎𐑏𐓘𐓙𐓚𐓛𐓜𐓝𐓞𐓟𐓠𐓡𐓢𐓣𐓤𐓥𐓦𐓧𐓨𐓩𐓪𐓫𐓬𐓭𐓮𐓯𐓰𐓱𐓲𐓳𐓴𐓵𐓶𐓷𐓸𐓹𐓺𐓻𐳀𐳁𐳂𐳃𐳄𐳅𐳆𐳇𐳈𐳉𐳊𐳋𐳌𐳍𐳎𐳏𐳐𐳑𐳒𐳓𐳔𐳕𐳖𐳗𐳘𐳙𐳚𐳛𐳜𐳝𐳞𐳟𐳠𐳡𐳢𐳣𐳤𐳥𐳦𐳧𐳨𐳩𐳪𐳫𐳬𐳭𐳮𐳯𐳰𐳱𐳲𑣀𑣁𑣂𑣃𑣄𑣅𑣆𑣇𑣈𑣉𑣊𑣋𑣌𑣍𑣎𑣏𑣐𑣑𑣒𑣓𑣔𑣕𑣖𑣗𑣘𑣙𑣚𑣛𑣜𑣝𑣞𑣟ıȷ∇∂𞤢𞤣𞤤𞤥𞤦𞤧𞤨𞤩𞤪𞤫𞤬𞤭𞤮𞤯𞤰𞤱𞤲𞤳𞤴𞤵𞤶𞤷𞤸𞤹𞤺𞤻𞤼𞤽𞤾𞤿𞥀𞥁𞥂𞥃ٮڡٯ字双多解交映無前後再新初終販声吹演投捕遊指禁空合満申割営配得可丽丸乁𠄢你侻倂偺備像㒞𠘺兔兤具𠔜㒹內𠕋冗冤仌冬𩇟刃㓟刻剆剷㔕包匆卉博即卽卿𠨬灰及叟𠭣叫叱吆咞吸呈周咢哶唐啓啣善喫喳嗂圖圗噑噴壮城埴堍型堲報墬𡓤売壷夆夢奢𡚨𡛪姬娛娧姘婦㛮嬈嬾𡧈寃寘寳𡬘寿将㞁屠峀岍𡷤嵃𡷦嵮嵫嵼巡巢㠯巽帨帽幩㡢𢆃㡼庰庳庶𪎒𢌱舁弢㣇𣊸𦇚形彫㣣徚忍志忹悁㤺㤜𢛔惇慈慌慺憲憤憯懞戛扝抱拔捐𢬌挽拼捨掃揤𢯱搢揅掩㨮摩摾撝摷㩬敬𣀊旣書晉㬙㬈㫤冒冕最暜肭䏙朡杞杓𣏃㭉柺枅桒𣑭梎栟椔楂榣槪檨𣚣櫛㰘次𣢧歔㱎歲殟殻𣪍𡴋𣫺汎𣲼沿泍汧洖派浩浸涅𣴞洴港湮㴳滇𣻑淹潮𣽞𣾎濆瀹瀛㶖灊災灷炭𠔥煅𤉣熜爨牐𤘈犀犕𤜵𤠔獺王㺬玥㺸瑇瑜璅瓊㼛甤𤰶甾𤲒𢆟瘐𤾡𤾸𥁄㿼䀈𥃳𥃲𥄙𥄳眞真瞋䁆䂖𥐝硎䃣𥘦𥚚𥛅秫䄯穊穏𥥼𥪧䈂𥮫篆築䈧𥲀糒䊠糨糣紀𥾆絣䌁緇縂繅䌴𦈨𦉇䍙𦋙罺𦌾羕翺𦓚𦔣聠𦖨聰𣍟䏕育脃䐋脾媵𦞧𦞵𣎓𣎜舄辞䑫芑芋芝劳花芳芽苦𦬼茝荣莭茣莽菧荓菊菌菜𦰶𦵫𦳕䔫蓱蓳蔖𧏊蕤𦼬䕝䕡𦾱𧃒䕫虐虧虩蚩蚈蜎蛢蜨蝫螆蟡蠁䗹衠𧙧裗裞䘵裺㒻𧢮𧥦䚾䛇誠𧲨貫賁贛起𧼯𠠄跋趼跰𠣞軔𨗒𨗭邔郱鄑𨜮鄛鈸鋗鋘鉼鏹鐕𨯺開䦕閷𨵷䧦雃嶲霣𩅅𩈚䩮䩶韠𩐊䪲𩒖頩𩖶飢䬳餩馧駂駾䯎𩬰鱀鳽䳎䳭鵧𪃎䳸𪄅𪈎𪊑䵖黾鼅鼏鼖𪘀",mapChar:function(e){return 196608<=e?917760<=e&&e<=917999?18874368:0:t[r[e>>4]][15&e]}}},"function"==typeof define&&define.amd?define([],function(){return i()}):"object"===(void 0===r?"undefined":_typeof(r))?t.exports=i():n.uts46_map=i()},{}],377:[function(e,t,r){var n,i;n=this,i=function(p,b){function i(e,t,r){for(var n=[],i=p.ucs2.decode(e),o=0;o>23,f=u>>21&3,h=u>>5&65535,d=31&u,l=b.mapStr.substr(h,d);if(0===f||t&&1&c)throw new Error("Illegal char "+s);1===f?n.push(l):2===f?n.push(r?l:s):3===f&&n.push(s)}return n.join("").normalize("NFC")}function c(e,t,r){void 0===r&&(r=!1);var n=i(e,r,t).split(".");return(n=n.map(function(e){return e.startsWith("xn--")?o(e=p.decode(e.substring(4)),r,!1):o(e,r,t),e})).join(".")}function o(e,t,r){if("-"===e[2]&&"-"===e[3])throw new Error("Failed to validate "+e);if(e.startsWith("-")||e.endsWith("-"))throw new Error("Failed to validate "+e);if(e.includes("."))throw new Error("Failed to validate "+e);if(i(e,t,r)!==e)throw new Error("Failed to validate "+e);var n=e.codePointAt(0);if(b.mapChar(n)&2<<23)throw new Error("Label contains illegal character: "+n)}return{toUnicode:function(e,t){return void 0===t&&(t={}),c(e,!1,"useStd3ASCII"in t&&t.useStd3ASCII)},toAscii:function(e,t){void 0===t&&(t={});var r,n=!("transitional"in t)||t.transitional,i="useStd3ASCII"in t&&t.useStd3ASCII,o="verifyDnsLength"in t&&t.verifyDnsLength,a=c(e,n,i).split(".").map(p.toASCII),s=a.join(".");if(o){if(s.length<1||253>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}m.prototype.update=function(e){var t="string"!=typeof e;t&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e));for(var r,n,i=e.length,o=this.blocks,a=this.byteCount,s=this.blockCount,u=0,c=this.s;u>2]|=e[u]<>2]|=n<>2]|=(192|n>>6)<>2]|=(224|n>>12)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];a%t==0&&(v(r),o=0)}return i&&(e=r[o],0>4&15]+u[15&e]),1>12&15]+u[e>>8&15]),2>20&15]+u[e>>16&15])),s},m.prototype.buffer=m.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%r==0&&v(n)}return o&&(e=s<<2,t=n[a],0>8&255),2>16&255)),u};var v=function(e){var t,r,n,i,o,a,s,u,c,f,h,d,l,p,b,y,m,v,g,w,_,A,x,M,k,E,S,U,j,I,T,C,B,N,P,R,O,L,q,D,F,H,z,K,V,G,W,X,J,Z,$,Y,Q,ee,te,re,ne,ie,oe,ae,se,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(l=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|h>>>31),r=s^(h<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(d<<1|l>>>31),r=c^(l<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],G=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,U=e[20]<<3|e[21]>>>29,j=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,z=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,P=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,X=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,I=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,R=e[14]<<6|e[15]>>>26,O=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,$=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,B=e[44]<<29|e[45]>>>3,M=e[6]<<28|e[7]>>>4,k=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,q=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,Y=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,E=e[18]<<20|e[19]>>>12,S=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,F=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,x=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=b^~m&g,e[10]=M^~E&U,e[11]=k^~S&j,e[20]=N^~R&L,e[21]=P^~O&q,e[30]=K^~G&X,e[31]=V^~W&J,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=y^~v&w,e[3]=m^~g&_,e[12]=E^~U&I,e[13]=S^~j&T,e[22]=R^~L&D,e[23]=O^~q&F,e[32]=G^~X&Z,e[33]=W^~J&$,e[42]=re^~ie&ae,e[43]=ne^~oe&se,e[4]=v^~w&A,e[5]=g^~_&x,e[14]=U^~I&C,e[15]=j^~T&B,e[24]=L^~D&H,e[25]=q^~F&z,e[34]=X^~Z&Y,e[35]=J^~$&Q,e[44]=ie^~ae&ue,e[45]=oe^~se&ce,e[6]=w^~A&p,e[7]=_^~x&b,e[16]=I^~C&M,e[17]=T^~B&k,e[26]=D^~H&N,e[27]=F^~z&P,e[36]=Z^~Y&K,e[37]=$^~Q&V,e[46]=ae^~ue&ee,e[47]=se^~ce&te,e[8]=A^~p&y,e[9]=x^~b&m,e[18]=C^~M&E,e[19]=B^~k&S,e[28]=H^~N&R,e[29]=z^~P&O,e[38]=Y^~K&G,e[39]=Q^~V&W,e[48]=ue^~ee&re,e[49]=ce^~te&ne,e[0]^=fe[n],e[1]^=fe[n+1]};if(t)_.exports=c;else for(d=0;d>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);else if("le"===r)for(i=n=0;n>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);return this.strip()},m.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==t&&(i=a(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},m.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,c=r;c"};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function i(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;n=(r.length=n)-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,t.length-1),l=Math.max(0,c-e.length+1);l<=d;l++){var p=c-l|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[l])+h)/67108864|0,h=67108863&a}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}m.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?d[6-s.length]+s+r:s+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&2<=e&&e<=36){var u=l[e],c=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var h=f.modn(c).toString(e);r=(f=f.idivn(c)).isZero()?h+r:d[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}y(!1,"Base should be between 2 and 36")},m.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=t&&(r+=7,t>>>=7),8<=t&&(r+=4,t>>>=4),2<=t&&(r+=2,t>>>=2),r+t},m.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},m.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},m.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},m.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},m.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},m.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},m.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},m.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},m.prototype.inotn=function(e){y("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},m.prototype.notn=function(e){return this.clone().inotn(e)},m.prototype.setn=function(e,t){y("number"==typeof e&&0<=e);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},m.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,l=0|a[1],p=8191&l,b=l>>>13,y=0|a[2],m=8191&y,v=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,A=0|a[4],x=8191&A,M=A>>>13,k=0|a[5],E=8191&k,S=k>>>13,U=0|a[6],j=8191&U,I=U>>>13,T=0|a[7],C=8191&T,B=T>>>13,N=0|a[8],P=8191&N,R=N>>>13,O=0|a[9],L=8191&O,q=O>>>13,D=0|s[0],F=8191&D,H=D>>>13,z=0|s[1],K=8191&z,V=z>>>13,G=0|s[2],W=8191&G,X=G>>>13,J=0|s[3],Z=8191&J,$=J>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,fe=0|s[8],he=8191&fe,de=fe>>>13,le=0|s[9],pe=8191&le,be=le>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(c+(n=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,H))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,H))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,H))+Math.imul(b,F)|0,o=Math.imul(b,H);var me=(c+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,F),i=(i=Math.imul(m,H))+Math.imul(v,F)|0,o=Math.imul(v,H),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0;var ve=(c+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,W)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),n=n+Math.imul(m,K)|0,i=(i=i+Math.imul(m,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,X)|0;var ge=(c+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(x,F),i=(i=Math.imul(x,H))+Math.imul(M,F)|0,o=Math.imul(M,H),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,X)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,X)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,$)|0;var we=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(E,F),i=(i=Math.imul(E,H))+Math.imul(S,F)|0,o=Math.imul(S,H),n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(m,Z)|0,i=(i=i+Math.imul(m,$)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var _e=(c+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(j,F),i=(i=Math.imul(j,H))+Math.imul(I,F)|0,o=Math.imul(I,H),n=n+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,V)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var Ae=(c+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,F),i=(i=Math.imul(C,H))+Math.imul(B,F)|0,o=Math.imul(B,H),n=n+Math.imul(j,K)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,V)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,X)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,ae)|0;var xe=(c+(n=n+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(P,F),i=(i=Math.imul(P,H))+Math.imul(R,F)|0,o=Math.imul(R,H),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(j,W)|0,i=(i=i+Math.imul(j,X)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,$)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(m,oe)|0,i=(i=i+Math.imul(m,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0;var Me=(c+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,F),i=(i=Math.imul(L,H))+Math.imul(q,F)|0,o=Math.imul(q,H),n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,V)|0,n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,$)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,he)|0,o=o+Math.imul(b,de)|0;var ke=(c+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,be)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,K),i=(i=Math.imul(L,V))+Math.imul(q,K)|0,o=Math.imul(q,V),n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,X)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,$)|0,n=n+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(m,he)|0,i=(i=i+Math.imul(m,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,W),i=(i=Math.imul(L,X))+Math.imul(q,W)|0,o=Math.imul(q,X),n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,$)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(j,re)|0,i=(i=i+Math.imul(j,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(_,he)|0,o=o+Math.imul(_,de)|0;var Se=(c+(n=n+Math.imul(m,pe)|0)|0)+((8191&(i=(i=i+Math.imul(m,be)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,be)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,$))+Math.imul(q,Z)|0,o=Math.imul(q,$),n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(j,oe)|0,i=(i=i+Math.imul(j,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,n=n+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,n=n+Math.imul(x,he)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var Ue=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,be)|0)+(i>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,ee))+Math.imul(q,Q)|0,o=Math.imul(q,ee),n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(R,re)|0,o=o+Math.imul(R,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(j,ue)|0,i=(i=i+Math.imul(j,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,n=n+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var je=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,be)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,be)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(q,re)|0,o=Math.imul(q,ne),n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,n=n+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,n=n+Math.imul(j,he)|0,i=(i=i+Math.imul(j,de)|0)+Math.imul(I,he)|0,o=o+Math.imul(I,de)|0;var Ie=(c+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,be)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,oe),i=(i=Math.imul(L,ae))+Math.imul(q,oe)|0,o=Math.imul(q,ae),n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(R,ue)|0,o=o+Math.imul(R,ce)|0,n=n+Math.imul(C,he)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,de)|0;var Te=(c+(n=n+Math.imul(j,pe)|0)|0)+((8191&(i=(i=i+Math.imul(j,be)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,ue),i=(i=Math.imul(L,ce))+Math.imul(q,ue)|0,o=Math.imul(q,ce),n=n+Math.imul(P,he)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(R,he)|0,o=o+Math.imul(R,de)|0;var Ce=(c+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,be)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,he),i=(i=Math.imul(L,de))+Math.imul(q,he)|0,o=Math.imul(q,de);var Be=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,be)|0)+Math.imul(R,pe)|0))<<13)|0;c=((o=o+Math.imul(R,be)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(c+(n=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,be))+Math.imul(q,pe)|0))<<13)|0;return c=((o=Math.imul(q,be))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ye,u[1]=me,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=Ae,u[7]=xe,u[8]=Me,u[9]=ke,u[10]=Ee,u[11]=Se,u[12]=Ue,u[13]=je,u[14]=Ie,u[15]=Te,u[16]=Ce,u[17]=Be,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function s(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}Math.imul||(o=i),m.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?o(this,e,t):r<63?i(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):s(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),r=m.prototype._countBits(e)-1,n=0;n>=1;return n},u.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},m.prototype.muln=function(e){return this.clone().imuln(e)},m.prototype.sqr=function(){return this.mul(this)},m.prototype.isqr=function(){return this.imul(this.clone())},m.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new m(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;0<=t;t--)this.words[t+n]=this.words[t];for(t=0;t>>i<o)for(this.length-=o,u=0;u>>i,c=f&a}return s&&0!==c&&(s.words[s.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},m.prototype.ishrn=function(e,t,r){return y(0===this.negative),this.iushrn(e,t,r)},m.prototype.shln=function(e){return this.clone().ishln(e)},m.prototype.ushln=function(e){return this.clone().iushln(e)},m.prototype.shrn=function(e){return this.clone().ishrn(e)},m.prototype.ushrn=function(e){return this.clone().iushrn(e)},m.prototype.testn=function(e){y("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,n=1<>>t<>26)-(s/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===a)return this.strip();for(y(-1===a),n=a=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},m.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,s=n.length-i.length;if("mod"!==t){(a=new m(null)).length=s+1,a.words=new Array(a.length);for(var u=0;uthis.length||this.cmp(e)<0?{div:new m(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new m(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new m(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,o},m.prototype.div=function(e){return this.divmod(e,"div",!1).div},m.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},m.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},m.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},m.prototype.modn=function(e){y(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;0<=n;n--)r=(t*r+(0|this.words[n]))%e;return r},m.prototype.idivn=function(e){y(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},m.prototype.divn=function(e){return this.clone().idivn(e)},m.prototype.egcd=function(e){y(0===e.negative),y(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new m(1),i=new m(0),o=new m(0),a=new m(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var u=r.clone(),c=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(0>>26,a&=67108863,this.words[o]=a}return 0!==i&&(this.words[o]=i,this.length++),this},m.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},m.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1e.length)return 1;if(this.lengththis.n;);var n=t>>22,i=o}i>>>=22,0===(e.words[n-10]=i)&&10>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},m._prime=function(e){if(c[e])return c[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new g;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return c[e]=t},_.prototype._verify1=function(e){y(0===e.negative,"red works only with positives"),y(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){y(0==(e.negative|t.negative),"red works only with positives"),y(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(y(t%2==1),3===t){var r=this.m.add(new m(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);y(!n.isZero());var o=new m(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new m(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var c=this.pow(u,n),f=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),d=i;0!==h.cmp(o);){for(var l=h,p=0;0!==l.cmp(o);p++)l=l.redSqr();y(p>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[o]),o=a=0)):a=0}s=26}return i},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},m.mont=function(e){return new A(e)},r(A,_),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new m(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],388:[function(e,t,r){var n=e("web3-utils"),i=e("bn.js"),o=function(e){var r="A".charCodeAt(0),n="Z".charCodeAt(0);return(e=(e=e.toUpperCase()).substr(4)+e.substr(0,4)).split("").map(function(e){var t=e.charCodeAt(0);return r<=t&&t<=n?t-r+10:e}).join("")},a=function(e){for(var t,r=e;2e.highestBlock-200&&(t._isSyncing=!1,t.emit("changed",t._isSyncing),s.isFunction(t.callback)&&t.callback(null,t._isSyncing,t))},500))}}}})];a.forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager,t.accounts),e.defaultBlock=t.defaultBlock,e.defaultAccount=t.defaultAccount})};u.addProviders(i),t.exports=i},{"./getNetworkType.js":391,underscore:390,"web3-core":218,"web3-core-helpers":200,"web3-core-method":202,"web3-core-subscriptions":215,"web3-eth-abi":232,"web3-eth-accounts":372,"web3-eth-contract":374,"web3-eth-ens":383,"web3-eth-iban":388,"web3-eth-personal":389,"web3-net":393,"web3-utils":419}],393:[function(e,t,r){var n=e("web3-core"),i=e("web3-core-method"),o=e("web3-utils"),a=function(){var t=this;n.packageInit(this,arguments),[new i({name:"getId",call:"net_version",params:0,outputFormatter:o.hexToNumber}),new i({name:"isListening",call:"net_listening",params:0}),new i({name:"getPeerCount",call:"net_peerCount",params:0,outputFormatter:o.hexToNumber})].forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager)})};n.addProviders(a),t.exports=a},{"web3-core":218,"web3-core-method":202,"web3-utils":419}],394:[function(e,t,r){!function(){function i(e,t,r,n){return this instanceof i?(this.domain=e||void 0,this.path=t||"/",this.secure=!!r,this.script=!!n,this):new i(e,t,r,n)}function u(e,t,r){return e instanceof u?e:this instanceof u?(this.name=null,this.value=null,this.expiration_date=1/0,this.path=String(r||"/"),this.explicit_path=!1,this.domain=t||null,this.explicit_domain=!1,this.secure=!1,this.noscript=!1,e&&this.parse(e,t,r),this):new u(e,t,r)}i.All=Object.freeze(Object.create(null)),r.CookieAccessInfo=i,(r.Cookie=u).prototype.toString=function(){var e=[this.name+"="+this.value];return this.expiration_date!==1/0&&e.push("expires="+new Date(this.expiration_date).toGMTString()),this.domain&&e.push("domain="+this.domain),this.path&&e.push("path="+this.path),this.secure&&e.push("secure"),this.noscript&&e.push("httponly"),e.join("; ")},u.prototype.toValueString=function(){return this.name+"="+this.value};var a=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;function e(){var o,a;return this instanceof e?(o=Object.create(null),this.setCookie=function(e,t,r){var n,i;if(n=(e=new u(e,t,r)).expiration_date<=Date.now(),void 0!==o[e.name]){for(a=o[e.name],i=0;ih&&(G("Max buffer length exceeded: textNode"),i=Math.max(i,N.length)),P.length>h&&(G("Max buffer length exceeded: numberNode"),i=Math.max(i,P.length)),B=h-i+z);var i}),e(se).on(function(){if(L==l)return c({}),f(),void(O=!0);L===p&&0===H||G("Unexpected end");N!==J&&(c(N),f(),N=J);O=!0})}var e,t,o,B,N,P,R,O,L,q,D,F=(e=l(function(e){return e.unshift(/^/),(t=RegExp(e.map(n("source")).join(""))).exec.bind(t);var t}),B=e(t=/(\$?)/,/([\w-_]+|\*)/,o=/(?:{([\w ]*?)})?/),N=e(t,/\["([^"]+)"\]/,o),P=e(t,/\[(\d+|\*)\]/,o),R=e(t,/()/,/{([\w ]*?)}/),O=e(/\.\./),L=e(/\./),q=e(t,/!/),D=e(/$/),function(e){return e(m(B,N,P,R),O,L,q,D)});function H(e,t){return{key:e,node:t}}var z=n("key"),K=n("node"),V={};function G(e){var i=e(Y).emit,t=e(Q).emit,u=e(ie).emit,r=e(ne).emit;function c(e,t,r){K(S(e))[t]=r}function f(e,t,r){e&&c(e,t,r);var n=E(H(t,r),e);return i(n),n}var n={};return n[fe]=function(e,t){if(!e)return u(t),f(e,V,t);var r,n,i,o=(n=t,i=K(S(r=e)),_(h,i)?f(r,A(i),n):r),a=U(o),s=z(S(o));return c(a,s,t),E(H(s,t),a)},n[he]=function(e){return t(e),U(e)||r(K(S(e)))},n[ce]=f,n}var W=F(function(e,t,r,n,i){var o=y(z,S),a=y(K,S);function s(e,t){return!!t[1]?v(e,S):e}function u(e){if(e==w)return w;return v(function(e){return o(e)!=V},y(e,U))}function c(){return function(e){return o(e)==V}}function f(e,t,r,n,i){var o,a=e(r);if(a){var s=(o=a,T(function(e,t){return t(e,o)},n,t));return i(r.substr(A(a[0])),s)}}function h(e,t){return b(f,e,t)}var d=m(h(e,I(s,function(e,t){var r=t[3];return r?v(y(b(k,j(r.split(/\W+/))),a),e):e},function(e,t){var r=t[2];return v(r&&"*"!=r?function(e){return o(e)==r}:w,e)},u)),h(t,I(function(e){if(e==w)return w;var t=c(),r=e,n=u(function(e){return i(e)}),i=m(t,r,n);return i})),h(r,I()),h(n,I(s,c)),h(i,I(function(r){return function(e){var t=r(e);return!0===t?S(e):t}})),function(e){throw X('"'+e+'" could not be tokenised')});function l(e,t){return t}function p(e,t){return d(e,t,e?p:l)}return function(t){try{return p(t,w)}catch(e){throw X('Could not compile "'+t+'" because '+e.message)}}});function Z(n,i,r){var o,a;function s(t){return function(e){return e.id==t}}return{on:function(e,t){var r={listener:e,id:t||e};return i&&i.emit(n,e,r.id),o=E(r,o),a=E(e,a),this},emit:function(){!function e(t,r){t&&(S(t).apply(null,r),e(U(t),r))}(a,arguments)},un:function(e){var t;o=f(o,s(e),function(e){t=e}),t&&(a=f(a,function(e){return e==t.listener}),r&&r.emit(n,t.listener,t.id))},listeners:function(){return a},hasListener:function(e){return M(function e(t,r){return r&&(t(S(r))?S(r):e(t,U(r)))}(e?s(e):w,o))}}}var $=1,Y=$++,Q=$++,ee=$++,te=$++,re="fail",ne=$++,ie=$++,oe="start",ae="data",se="end",ue=$++,ce=$++,fe=$++,he=$++;function de(e,t,r){try{var n=u.parse(t)}catch(e){}return{statusCode:e,body:t,jsonBody:n,thrown:r}}function le(n,i){var o={node:n(Q),path:n(Y)};function a(t,r,o){var a=n(t).emit;r.on(function(e){var t,r,n,i=o(e);!1!==i&&(t=a,r=K(i),n=C(e),t(r,s(U(c(z,n))),s(c(K,n))))},t),n("removeListener").on(function(e){e==t&&(n(e).listeners()||r.un(t))})}n("newListener").on(function(e){var t=/(node|path):(.*)/.exec(e);if(t){var r=o[t[1]];r.hasListener(e)||a(e,r,i(t[2]))}})}function pe(o,e){var i,a=/^(node|path):./,s=o(ne),u=o(te).emit,c=o(ee).emit,t=l(function(e,t){if(i[e])d(t,i[e]);else{var r=o(e),n=t[0];a.test(e)?f(r,n):r.on(n)}return i});function f(t,e,r){r=r||e;var n=h(e);return t.on(function(){var e=!1;i.forget=function(){e=!0},d(arguments,n),delete i.forget,e&&t.un(r)},r),i}function h(e){return function(){try{return e.apply(i,arguments)}catch(e){setTimeout(function(){throw e})}}}function n(e,t,r){var n,i;"node"==e?(i=r,n=function(){var e=i.apply(this,arguments);M(e)&&(e==me.drop?u():c(e))}):n=r,f(o(e+":"+t),n,r)}function r(e,t,r){return x(t)?n(e,t,r):function(e,t){for(var r in t)n(e,r,t[r])}(e,t),i}return o(ie).on(function(e){var t;i.root=(t=e,function(){return t})}),o(oe).on(function(e,t){i.header=function(e){return e?t[e]:t}}),i={on:t,addListener:t,removeListener:function(e,t,r){if("done"==e)s.un(t);else if("node"==e||"path"==e)o.un(e+":"+t,r);else{var n=t;o(e).un(n)}return i},emit:o.emit,node:b(r,"node"),path:b(r,"path"),done:b(f,s),start:b(function(e,t){return o(e).on(h(t),t),i},oe),fail:o(re).on,abort:o(ue).emit,header:g,root:g,source:e}}function be(e,t,r,n,i){var o=function(){var t={},r=i("newListener"),n=i("removeListener");function i(e){return t[e]=Z(e,r,n)}function o(e){return t[e]||i(e)}return["emit","on","un"].forEach(function(r){o[r]=l(function(e,t){d(t,o(e)[r])})}),o}();return t&&function(t,n,e,r,i,o,a){var s,u=t(ae).emit,c=t(re).emit,f=0,h=!0;function d(){var e=n.responseText,t=e.substr(f);t&&u(t),f=A(e)}t(ue).on(function(){n.onreadystatechange=null,n.abort()}),"onprogress"in n&&(n.onprogress=d),n.onreadystatechange=function(){function e(){try{h&&t(oe).emit(n.status,(e=n.getAllResponseHeaders(),r={},e&&e.split("\r\n").forEach(function(e){var t=e.indexOf(": ");r[e.substring(0,t)]=e.substring(t+2)}),r)),h=!1}catch(e){}var e,r}switch(n.readyState){case 2:case 3:return e();case 4:e(),2==String(n.status)[0]?(d(),t(se).emit()):c(de(n.status,n.responseText))}};try{for(var l in n.open(e,r,!0),o)n.setRequestHeader(l,o[l]);(function(t,e){function r(e){return e.port||{"http:":80,"https:":443}[e.protocol||t.protocol]}return!!(e.protocol&&e.protocol!=t.protocol||e.host&&e.host!=t.host||e.host&&r(e)!=r(t))})(p.location,{protocol:(s=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(r)||[])[1]||"",host:s[2]||"",port:s[3]||""})||n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.withCredentials=a,n.send(i)}catch(e){p.setTimeout(b(c,de(J,J,e)),0)}}(o,new XMLHttpRequest,e,t,r,n,i),a(o),function(t,r){var i,n={};function e(t){return function(e){i=t(i,e)}}for(var o in r)t(o).on(e(r[o]),n);t(ee).on(function(e){var t=S(i),r=z(t),n=U(i);n&&(K(S(n))[r]=e)}),t(te).on(function(){var e=S(i),t=z(e),r=U(i);r&&delete K(S(r))[t]}),t(ue).on(function(){for(var e in r)t(e).un(n)})}(o,G(o)),le(o,W),pe(o,t)}function ye(e,t,r,n,i,o,a){return i=i?u.parse(u.stringify(i)):{},n?x(n)||(n=u.stringify(n),i["Content-Type"]=i["Content-Type"]||"application/json"):n=null,e(r||"GET",(s=t,!1===a&&(-1==s.indexOf("?")?s+="?":s+="&",s+="_="+(new Date).getTime()),s),n,i,o||!1);var s}function me(e){var t=I("resume","pause","pipe"),r=b(k,t);return e?r(e)||x(e)?ye(be,e):ye(be,e.url,e.method,e.body,e.headers,e.withCredentials,e.cached):be()}me.drop=function(){return me.drop},"function"==typeof define&&define.amd?define("oboe",[],function(){return me}):"object"===(void 0===ge?"undefined":_typeof(ge))?ve.exports=me:p.oboe=me}(function(){try{return window}catch(e){return self}}(),Object,Array,Error,JSON)},{}],403:[function(e,t,r){arguments[4][187][0].apply(r,arguments)},{dup:187}],404:[function(e,t,r){var i=e("underscore"),o=e("web3-core-helpers").errors,a=e("oboe"),n=function(e,t){var n=this;this.responseCallbacks={},this.notificationCallbacks=[],this.path=e,this.connected=!1,this.connection=t.connect({path:this.path}),this.addDefaultEvents();var r=function(t){var r=null;i.isArray(t)?t.forEach(function(e){n.responseCallbacks[e.id]&&(r=e.id)}):r=t.id,r||-1===t.method.indexOf("_subscription")?n.responseCallbacks[r]&&(n.responseCallbacks[r](null,t),delete n.responseCallbacks[r]):n.notificationCallbacks.forEach(function(e){i.isFunction(e)&&e(t)})};"Socket"===t.constructor.name?a(this.connection).done(r):this.connection.on("data",function(e){n._parseResponse(e.toString()).forEach(r)})};n.prototype.addDefaultEvents=function(){var e=this;this.connection.on("connect",function(){e.connected=!0}),this.connection.on("close",function(){e.connected=!1}),this.connection.on("error",function(){e._timeout()}),this.connection.on("end",function(){e._timeout()}),this.connection.on("timeout",function(){e._timeout()})},n.prototype._parseResponse=function(e){var r=this,n=[];return e.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(function(t){r.lastChunk&&(t=r.lastChunk+t);var e=null;try{e=JSON.parse(t)}catch(e){return r.lastChunk=t,clearTimeout(r.lastChunkTimeout),void(r.lastChunkTimeout=setTimeout(function(){throw r._timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(r.lastChunkTimeout),r.lastChunk=null,e&&n.push(e)}),n},n.prototype._addResponseCallback=function(e,t){var r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n},n.prototype._timeout=function(){for(var e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](o.InvalidConnection("on IPC")),delete this.responseCallbacks[e])},n.prototype.reconnect=function(){this.connection.connect({path:this.path})},n.prototype.send=function(e,t){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(e)),this._addResponseCallback(e,t)},n.prototype.on=function(e,t){if("function"!=typeof t)throw new Error("The second parameter callback must be a function.");switch(e){case"data":this.notificationCallbacks.push(t);break;default:this.connection.on(e,t)}},n.prototype.once=function(e,t){if("function"!=typeof t)throw new Error("The second parameter callback must be a function.");this.connection.once(e,t)},n.prototype.removeListener=function(e,r){var n=this;switch(e){case"data":this.notificationCallbacks.forEach(function(e,t){e===r&&n.notificationCallbacks.splice(t,1)});break;default:this.connection.removeListener(e,r)}},n.prototype.removeAllListeners=function(e){switch(e){case"data":this.notificationCallbacks=[];break;default:this.connection.removeAllListeners(e)}},n.prototype.reset=function(){this._timeout(),this.notificationCallbacks=[],this.connection.removeAllListeners("error"),this.connection.removeAllListeners("end"),this.connection.removeAllListeners("timeout"),this.addDefaultEvents()},t.exports=n},{oboe:402,underscore:403,"web3-core-helpers":200}],405:[function(e,t,r){arguments[4][187][0].apply(r,arguments)},{dup:187}],406:[function(i,a,e){(function(t){var s=i("underscore"),o=i("web3-core-helpers").errors,u=null,c=null,f=null;if("undefined"!=typeof window&&void 0!==window.WebSocket)u=function(e,t){return new window.WebSocket(e,t)},c=btoa,f=function(e){return new URL(e)};else{u=i("websocket").w3cwebsocket,c=function(e){return t(e).toString("base64")};var e=i("url");if(e.URL){var r=e.URL;f=function(e){return new r(e)}}else f=i("url").parse}var n=function(e,t){var n=this;this.responseCallbacks={},this.notificationCallbacks=[],t=t||{},this._customTimeout=t.timeout;var r=f(e),i=t.headers||{},o=t.protocol||void 0;r.username&&r.password&&(i.authorization="Basic "+c(r.username+":"+r.password));var a=t.clientConfig||void 0;r.auth&&(i.authorization="Basic "+c(r.auth)),this.connection=new u(e,o,void 0,i,void 0,a),this.addDefaultEvents(),this.connection.onmessage=function(e){var t="string"==typeof e.data?e.data:"";n._parseResponse(t).forEach(function(t){var r=null;s.isArray(t)?t.forEach(function(e){n.responseCallbacks[e.id]&&(r=e.id)}):r=t.id,!r&&t&&t.method&&-1!==t.method.indexOf("_subscription")?n.notificationCallbacks.forEach(function(e){s.isFunction(e)&&e(t)}):n.responseCallbacks[r]&&(n.responseCallbacks[r](null,t),delete n.responseCallbacks[r])})},Object.defineProperty(this,"connected",{get:function(){return this.connection&&this.connection.readyState===this.connection.OPEN},enumerable:!0})};n.prototype.addDefaultEvents=function(){var e=this;this.connection.onerror=function(){e._timeout()},this.connection.onclose=function(){e._timeout(),e.reset()}},n.prototype._parseResponse=function(e){var r=this,n=[];return e.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(function(t){r.lastChunk&&(t=r.lastChunk+t);var e=null;try{e=JSON.parse(t)}catch(e){return r.lastChunk=t,clearTimeout(r.lastChunkTimeout),void(r.lastChunkTimeout=setTimeout(function(){throw r._timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(r.lastChunkTimeout),r.lastChunk=null,e&&n.push(e)}),n},n.prototype._addResponseCallback=function(e,t){var r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n;var i=this;this._customTimeout&&setTimeout(function(){i.responseCallbacks[r]&&(i.responseCallbacks[r](o.ConnectionTimeout(i._customTimeout)),delete i.responseCallbacks[r])},this._customTimeout)},n.prototype._timeout=function(){for(var e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](o.InvalidConnection("on WS")),delete this.responseCallbacks[e])},n.prototype.send=function(e,t){var r=this;if(this.connection.readyState!==this.connection.CONNECTING){if(this.connection.readyState!==this.connection.OPEN)return console.error("connection not open on send()"),"function"==typeof this.connection.onerror?this.connection.onerror(new Error("connection not open")):console.error("no error callback"),void t(new Error("connection not open"));this.connection.send(JSON.stringify(e)),this._addResponseCallback(e,t)}else setTimeout(function(){r.send(e,t)},10)},n.prototype.on=function(e,t){if("function"!=typeof t)throw new Error("The second parameter callback must be a function.");switch(e){case"data":this.notificationCallbacks.push(t);break;case"connect":this.connection.onopen=t;break;case"end":this.connection.onclose=t;break;case"error":this.connection.onerror=t}},n.prototype.removeListener=function(e,r){var n=this;switch(e){case"data":this.notificationCallbacks.forEach(function(e,t){e===r&&n.notificationCallbacks.splice(t,1)})}},n.prototype.removeAllListeners=function(e){switch(e){case"data":this.notificationCallbacks=[];break;case"connect":this.connection.onopen=null;break;case"end":this.connection.onclose=null;break;case"error":this.connection.onerror=null}},n.prototype.reset=function(){this._timeout(),this.notificationCallbacks=[],this.addDefaultEvents()},n.prototype.disconnect=function(){this.connection&&this.connection.close()},a.exports=n}).call(this,i("buffer").Buffer)},{buffer:47,underscore:405,url:166,"web3-core-helpers":200,websocket:45}],407:[function(e,t,r){var n=e("web3-core"),i=e("web3-core-subscriptions").subscriptions,o=e("web3-core-method"),a=e("web3-net"),s=function(){var t=this;n.packageInit(this,arguments);var e=this.setProvider;this.setProvider=function(){e.apply(t,arguments),t.net.setProvider.apply(t,arguments)},this.clearSubscriptions=t._requestManager.clearSubscriptions,this.net=new a(this.currentProvider),[new i({name:"subscribe",type:"shh",subscriptions:{messages:{params:1}}}),new o({name:"getVersion",call:"shh_version",params:0}),new o({name:"getInfo",call:"shh_info",params:0}),new o({name:"setMaxMessageSize",call:"shh_setMaxMessageSize",params:1}),new o({name:"setMinPoW",call:"shh_setMinPoW",params:1}),new o({name:"markTrustedPeer",call:"shh_markTrustedPeer",params:1}),new o({name:"newKeyPair",call:"shh_newKeyPair",params:0}),new o({name:"addPrivateKey",call:"shh_addPrivateKey",params:1}),new o({name:"deleteKeyPair",call:"shh_deleteKeyPair",params:1}),new o({name:"hasKeyPair",call:"shh_hasKeyPair",params:1}),new o({name:"getPublicKey",call:"shh_getPublicKey",params:1}),new o({name:"getPrivateKey",call:"shh_getPrivateKey",params:1}),new o({name:"newSymKey",call:"shh_newSymKey",params:0}),new o({name:"addSymKey",call:"shh_addSymKey",params:1}),new o({name:"generateSymKeyFromPassword",call:"shh_generateSymKeyFromPassword",params:1}),new o({name:"hasSymKey",call:"shh_hasSymKey",params:1}),new o({name:"getSymKey",call:"shh_getSymKey",params:1}),new o({name:"deleteSymKey",call:"shh_deleteSymKey",params:1}),new o({name:"newMessageFilter",call:"shh_newMessageFilter",params:1}),new o({name:"getFilterMessages",call:"shh_getFilterMessages",params:1}),new o({name:"deleteMessageFilter",call:"shh_deleteMessageFilter",params:1}),new o({name:"post",call:"shh_post",params:1,inputFormatter:[null]}),new o({name:"unsubscribe",call:"shh_unsubscribe",params:1})].forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager)})};n.addProviders(s),t.exports=s},{"web3-core":218,"web3-core-method":202,"web3-core-subscriptions":215,"web3-net":393}],408:[function(e,t,r){arguments[4][387][0].apply(r,arguments)},{dup:387}],409:[function(e,t,r){arguments[4][174][0].apply(r,arguments)},{dup:174}],410:[function(e,t,r){var f=e("bn.js"),h=e("number-to-bn"),d=new f(0),l=new f(-1),p={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"};function b(e){var t=e?e.toLowerCase():"ether",r=p[t];if("string"!=typeof r)throw new Error("[ethjs-unit] the unit provided "+e+" doesn't exists, please use the one of the following units "+JSON.stringify(p,null,2));return new f(r,10)}function y(e){if("string"==typeof e){if(!e.match(/^-?[0-9.]+$/))throw new Error("while converting number to string, invalid number value '"+e+"', should be a number matching (^-?[0-9.]+).");return e}if("number"==typeof e)return String(e);if("object"===(void 0===e?"undefined":_typeof(e))&&e.toString&&(e.toTwos||e.dividedToIntegerBy))return e.toPrecision?String(e.toPrecision()):e.toString(10);throw new Error("while converting number to string, invalid number value '"+e+"' type "+(void 0===e?"undefined":_typeof(e))+".")}t.exports={unitMap:p,numberToString:y,getValueOfUnit:b,fromWei:function(e,t,r){var n=h(e),i=n.lt(d),o=b(t),a=p[t].length-1||1,s=r||{};i&&(n=n.mul(l));for(var u=n.mod(o).toString(10);u.lengthi)throw new Error("[ethjs-unit] while converting number "+e+" to wei, too many decimal places");for(;u.length>t&63|128)}function h(e){if(0==(4294967168&e))return s(e);var t="";return 0==(4294965248&e)?t=s(e>>6&31|192):0==(4294901760&e)?(c(e),t=s(e>>12&15|224),t+=f(e,6)):0==(4292870144&e)&&(t=s(e>>18&7|240),t+=f(e,12),t+=f(e,6)),t+=s(63&e|128)}function d(){if(o<=a)throw Error("Invalid byte index");var e=255&i[a];if(a++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function l(){var e,t;if(o>>10&1023|55296),t=56320|1023&t),i+=s(t);return i}(r)}};if("function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define(function(){return p});else if(t&&!t.nodeType)if(r)r.exports=p;else{var b={}.hasOwnProperty;for(var y in p)b.call(p,y)&&(t[y]=p[y])}else e.utf8=p}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],419:[function(e,t,r){var s=e("underscore"),n=e("ethjs-unit"),o=e("./utils.js"),i=e("./soliditySha3.js"),a=e("randomhex"),u=function i(o,e){var a=[];return e.forEach(function(e){if("object"===_typeof(e.components)){if("tuple"!==e.type.substring(0,5))throw new Error("components found but type is not tuple; report on GitHub");var t="",r=e.type.indexOf("[");0<=r&&(t=e.type.substring(r));var n=i(o,e.components);s.isArray(n)&&o?a.push("tuple("+n.join(",")+")"+t):o?a.push("("+n+")"):a.push("("+n.join(",")+")"+t)}else a.push(e.type)}),a},c=function(e){if(!o.isHexStrict(e))throw new Error("The parameter must be a valid HEX string.");var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);rn)throw new Error("Supplied uint exceeds width: "+n+" vs "+i.bitLength());if(i.lt(new s(0)))throw new Error("Supplied uint "+i.toString()+" is negative");return n?u.leftPad(i.toString("hex"),n/8*2):i}if(e.startsWith("int")){if(n%8||n<8||256n)throw new Error("Supplied int exceeds width: "+n+" vs "+i.bitLength());return i.lt(new s(0))?i.toTwos(n).toString("hex"):n?u.leftPad(i.toString("hex"),n/8*2):i}throw new Error("Unsupported or invalid type: "+e)},n=function(e){if(o.isArray(e))throw new Error("Autodetection of array types is not supported.");var t,r,n,i="";if(o.isObject(e)&&(e.hasOwnProperty("v")||e.hasOwnProperty("t")||e.hasOwnProperty("value")||e.hasOwnProperty("type"))?(t=e.hasOwnProperty("t")?e.t:e.type,i=e.hasOwnProperty("v")?e.v:e.value):(t=u.toHex(e,!0),i=u.toHex(e),t.startsWith("int")||t.startsWith("uint")||(t="bytes")),!t.startsWith("int")&&!t.startsWith("uint")||"string"!=typeof i||/^(-)?0x/i.test(i)||(i=new s(i)),o.isArray(i)){if(n=/^\D+\d*\[(\d+)\]$/.exec(t),(r=n?parseInt(n[1],10):null)&&i.length!==r)throw new Error(t+" is not matching the given array "+JSON.stringify(i));r=i.length}return o.isArray(i)?i.map(function(e){return a(t,e,r).toString("hex").replace("0x","")}).join(""):a(t,i,r).toString("hex").replace("0x","")};t.exports=function(){var e=Array.prototype.slice.call(arguments),t=o.map(e,n);return u.sha3("0x"+t.join(""))}},{"./utils.js":421,"bn.js":408,underscore:417}],421:[function(e,t,r){var n=e("underscore"),i=e("bn.js"),o=e("number-to-bn"),a=e("utf8"),s=e("eth-lib/lib/hash"),u=function(e){return e instanceof i||e&&e.constructor&&"BN"===e.constructor.name},c=function(e){return e&&e.constructor&&"BigNumber"===e.constructor.name},f=function(t){try{return o.apply(null,arguments)}catch(e){throw new Error(e+' Given value: "'+t+'"')}},h=function(e){return!!/^(0x)?[0-9a-f]{40}$/i.test(e)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(e)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(e))||d(e))},d=function(e){e=e.replace(/^0x/i,"");for(var t=m(e.toLowerCase()).replace(/^0x/i,""),r=0;r<40;r++)if(7>>4).toString(16)),t.push((15&e[r]).toString(16));return"0x"+t.join("")},isHex:function(e){return(n.isString(e)||n.isNumber(e))&&/^(-0x|0x)?[0-9a-f]*$/i.test(e)},isHexStrict:y,leftPad:function(e,t,r){var n=/^0x/i.test(e)||"number"==typeof e,i=0<=t-(e=e.toString(16).replace(/^0x/i,"")).length+1?t-e.length+1:0;return(n?"0x":"")+new Array(i).join(r||"0")+e},rightPad:function(e,t,r){var n=/^0x/i.test(e)||"number"==typeof e,i=0<=t-(e=e.toString(16).replace(/^0x/i,"")).length+1?t-e.length+1:0;return(n?"0x":"")+e+new Array(i).join(r||"0")},toTwosComplement:function(e){return"0x"+f(e).toTwos(256).toString(16,64)},sha3:m}},{"bn.js":408,"eth-lib/lib/hash":409,"number-to-bn":412,underscore:417,utf8:418}],422:[function(e,t,r){t.exports={name:"web3",namespace:"ethereum",version:"1.0.0-beta.36",description:"Ethereum JavaScript API",repository:"https://github.com/ethereum/web3.js/tree/master/packages/web3",license:"LGPL-3.0",main:"src/index.js",bugs:{url:"https://github.com/ethereum/web3.js/issues"},keywords:["Ethereum","JavaScript","API"],author:"ethereum.org",authors:[{name:"Fabian Vogelsteller",email:"fabian@ethereum.org",homepage:"http://frozeman.de"},{name:"Marek Kotewicz",email:"marek@parity.io",url:"https://github.com/debris"},{name:"Marian Oancea",url:"https://github.com/cubedro"},{name:"Gav Wood",email:"g@parity.io",homepage:"http://gavwood.com"},{name:"Jeffery Wilcke",email:"jeffrey.wilcke@ethereum.org",url:"https://github.com/obscuren"}],dependencies:{"web3-bzz":"1.0.0-beta.36","web3-core":"1.0.0-beta.36","web3-eth":"1.0.0-beta.36","web3-eth-personal":"1.0.0-beta.36","web3-net":"1.0.0-beta.36","web3-shh":"1.0.0-beta.36","web3-utils":"1.0.0-beta.36"}}},{}],BN:[function(e,t,r){arguments[4][219][0].apply(r,arguments)},{buffer:17,dup:219}],Web3:[function(e,t,r){var i=e("../package.json").version,o=e("web3-core"),a=e("web3-eth"),n=e("web3-net"),s=e("web3-eth-personal"),u=e("web3-shh"),c=e("web3-bzz"),f=e("web3-utils"),h=function(){var r=this;o.packageInit(this,arguments),this.version=i,this.utils=f,this.eth=new a(this),this.shh=new u(this),this.bzz=new c(this);var n=this.setProvider;this.setProvider=function(e,t){return n.apply(r,arguments),this.eth.setProvider(e,t),this.shh.setProvider(e,t),this.bzz.setProvider(e),!0}};h.version=i,h.utils=f,h.modules={Eth:a,Net:n,Personal:s,Shh:u,Bzz:c},o.addProviders(h),t.exports=h},{"../package.json":422,"web3-bzz":196,"web3-core":218,"web3-eth":392,"web3-eth-personal":389,"web3-net":393,"web3-shh":407,"web3-utils":419}]},{},["Web3"])("Web3")}); \ No newline at end of file +(function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&'object'==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,'default',{enumerable:!0,value:e}),2&r&&'string'!=typeof e)for(var a in e)t.d(n,a,function(t){return e[t]}.bind(null,a));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e['default']}:function(){return e};return t.d(r,'a',r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p='',t(t.s=340)})([function(e,t,r){var n=Math.floor,a=Math.min,o=Math.max;(function(e,r){var d,i;(function(){var s='object'==typeof self&&self.self===self&&self||'object'==typeof e&&e.global===e&&e||this||{},c=s._,f=Array.prototype,p=Object.prototype,l='undefined'==typeof Symbol?null:Symbol.prototype,u=f.push,b=f.slice,h=p.toString,m=p.hasOwnProperty,y=Array.isArray,g=Object.keys,v=Object.create,k=function(){},x=function(e){return e instanceof x?e:this instanceof x?void(this._wrapped=e):new x(e)};'undefined'==typeof t||t.nodeType?s._=x:('undefined'!=typeof r&&!r.nodeType&&r.exports&&(t=r.exports=x),t._=x),x.VERSION='1.9.0';var S=function(e,t,r){if(void 0===t)return e;switch(null==r?3:r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,n,a){return e.call(t,r,n,a)};case 4:return function(r,n,a,o){return e.call(t,r,n,a,o)};}return function(){return e.apply(t,arguments)}},w=function(e,t,r){return x.iteratee===A?null==e?x.identity:x.isFunction(e)?S(e,t,r):x.isObject(e)&&!x.isArray(e)?x.matcher(e):x.property(e):x.iteratee(e,t)},A;x.iteratee=A=function(e,t){return w(e,t,Infinity)};var E=function(e,t){return t=null==t?e.length-1:+t,function(){for(var r=o(arguments.length-t,0),n=Array(r),a=0;an&&(n=o)}else t=w(t,r),x.each(e,function(e,r,o){d=t(e,r,o),(d>a||d===-Infinity&&n===-Infinity)&&(n=e,a=d)});return n},x.min=function(e,t,r){var n=Infinity,a=Infinity,o,d;if(null==t||'number'==typeof t&&'object'!=typeof e[0]&&null!=e){e=B(e)?e:x.values(e);for(var s=0,i=e.length;sn||void 0===r)return 1;if(re.length?void 0:null==t||r?e[0]:x.initial(e,e.length-t)},x.initial=function(e,t,r){return b.call(e,0,o(0,e.length-(null==t||r?1:t)))},x.last=function(e,t,r){return null==e||1>e.length?void 0:null==t||r?e[e.length-1]:x.rest(e,o(0,e.length-t))},x.rest=x.tail=x.drop=function(e,t,r){return b.call(e,null==t||r?1:t)},x.compact=function(e){return x.filter(e,Boolean)};var L=function(e,t,r,n){n=n||[];for(var a=n.length,o=0,d=T(e),i;ot)return[];for(var r=[],n=0,a=e.length;nr)throw new Error('bindAll must be passed function names');for(;r--;){var n=t[r];e[n]=x.bind(e[n],e)}}),x.memoize=function(e,t){var r=function(n){var a=r.cache,o=''+(t?t.apply(this,arguments):n);return x.has(a,o)||(a[o]=e.apply(this,arguments)),a[o]};return r.cache={},r},x.delay=E(function(e,t,r){return setTimeout(function(){return e.apply(null,r)},t)}),x.defer=x.partial(x.delay,x,1),x.throttle=function(e,t,r){var n=0,a,o,d,i;r||(r={});var s=function(){n=!1===r.leading?0:x.now(),a=null,i=e.apply(o,d),a||(o=d=null)},c=function(){var c=x.now();n||!1!==r.leading||(n=c);var f=t-(c-n);return o=this,d=arguments,0>=f||f>t?(a&&(clearTimeout(a),a=null),n=c,i=e.apply(o,d),!a&&(o=d=null)):!a&&!1!==r.trailing&&(a=setTimeout(s,f)),i};return c.cancel=function(){clearTimeout(a),n=0,a=o=d=null},c},x.debounce=function(e,t,r){var n=function(t,r){o=null,r&&(d=e.apply(t,r))},a=E(function(a){if(o&&clearTimeout(o),r){var i=!o;o=setTimeout(n,t),i&&(d=e.apply(this,a))}else o=x.delay(n,t,this,a);return d}),o,d;return a.cancel=function(){clearTimeout(o),o=null},a},x.wrap=function(e,t){return x.partial(t,e)},x.negate=function(e){return function(){return!e.apply(this,arguments)}},x.compose=function(){var e=arguments,t=e.length-1;return function(){for(var r=t,n=e[t].apply(this,arguments);r--;)n=e[r].call(this,n);return n}},x.after=function(e,t){return function(){if(1>--e)return t.apply(this,arguments)}},x.before=function(e,t){var r;return function(){return 0<--e&&(r=t.apply(this,arguments)),1>=e&&(t=null),r}},x.once=x.partial(x.before,2),x.restArguments=E;var U=!{toString:null}.propertyIsEnumerable('toString'),H=['valueOf','isPrototypeOf','toString','propertyIsEnumerable','hasOwnProperty','toLocaleString'],F=function(e,t){var r=H.length,n=e.constructor,a=x.isFunction(n)&&n.prototype||p,o='constructor';for(x.has(e,o)&&!x.contains(t,o)&&t.push(o);r--;)o=H[r],o in e&&e[o]!==a[o]&&!x.contains(t,o)&&t.push(o)};x.keys=function(e){if(!x.isObject(e))return[];if(g)return g(e);var t=[];for(var r in e)x.has(e,r)&&t.push(r);return U&&F(e,t),t},x.allKeys=function(e){if(!x.isObject(e))return[];var t=[];for(var r in e)t.push(r);return U&&F(e,t),t},x.values=function(e){for(var t=x.keys(e),r=t.length,n=Array(r),a=0;an||null==r)return r;for(var a=1;a":'>','"':'"',"'":''',"`":'`'},X=x.invert(W),Y=function(e){var t=function(t){return e[t]},r='(?:'+x.keys(e).join('|')+')',n=RegExp(r),a=RegExp(r,'g');return function(e){return e=null==e?'':''+e,n.test(e)?e.replace(a,t):e}};x.escape=Y(W),x.unescape=Y(X),x.result=function(e,t,r){x.isArray(t)||(t=[t]);var n=t.length;if(!n)return x.isFunction(r)?r.call(e):r;for(var a=0,o;a/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,$={"'":'\'',"\\":'\\',"\r":'r',"\n":'n',"\u2028":'u2028',"\u2029":'u2029'},Q=/\\|'|\r|\n|\u2028|\u2029/g,ee=function(e){return'\\'+$[e]};x.template=function(e,t,r){!t&&r&&(t=r),t=x.defaults({},t,x.templateSettings);var n=RegExp([(t.escape||J).source,(t.interpolate||J).source,(t.evaluate||J).source].join('|')+'|$','g'),a=0,o='__p+=\'';e.replace(n,function(t,r,n,d,i){return o+=e.slice(a,i).replace(Q,ee),a=i+t.length,r?o+='\'+\n((__t=('+r+'))==null?\'\':_.escape(__t))+\n\'':n?o+='\'+\n((__t=('+n+'))==null?\'\':__t)+\n\'':d&&(o+='\';\n'+d+'\n__p+=\''),t}),o+='\';\n',t.variable||(o='with(obj||{}){\n'+o+'}\n'),o='var __t,__p=\'\',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,\'\');};\n'+o+'return __p;\n';var d;try{d=new Function(t.variable||'obj','_',o)}catch(t){throw t.source=o,t}var i=function(e){return d.call(this,e,x)},s=t.variable||'obj';return i.source='function('+s+'){\n'+o+'}',i},x.chain=function(e){var t=x(e);return t._chain=!0,t};var te=function(e,t){return e._chain?x(t).chain():t};x.mixin=function(e){return x.each(x.functions(e),function(t){var r=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return u.apply(e,arguments),te(this,r.apply(x,e))}}),x},x.mixin(x),x.each(['pop','push','reverse','shift','sort','splice','unshift'],function(e){var t=f[e];x.prototype[e]=function(){var r=this._wrapped;return t.apply(r,arguments),('shift'===e||'splice'===e)&&0===r.length&&delete r[0],te(this,r)}}),x.each(['concat','join','slice'],function(e){var t=f[e];x.prototype[e]=function(){return te(this,t.apply(this._wrapped,arguments))}}),x.prototype.value=function(){return this._wrapped},x.prototype.valueOf=x.prototype.toJSON=x.prototype.value,x.prototype.toString=function(){return this._wrapped+''},d=[],i=function(){return x}.apply(t,d),!(i!==void 0&&(r.exports=i))})()}).call(this,r(7),r(51)(e))},function(e,t,r){'use strict';var n=String.fromCharCode,a=r(15),o=r(16),d=r(8),i=r(0),s=r(22),c=r.n(s),f=r(52),p=r(2),l=r.n(p),u=r(83),b=r.n(u),h=r(86),m=r.n(h),y=r(18),g=r.n(y);const v=(e)=>e instanceof l.a||e&&e.constructor&&'BN'===e.constructor.name,k=(e)=>e&&e.constructor&&'BigNumber'===e.constructor.name,x=(t)=>{try{return b.a.apply(null,arguments)}catch(r){throw new Error(`${r} Given value: "${t}"`)}},S=(e)=>!!/^(0x)?[0-9a-f]{40}$/i.test(e)&&(!!(/^(0x|0X)?[0-9a-f]{40}$/.test(e)||/^(0x|0X)?[0-9A-F]{40}$/.test(e))||w(e)),w=(e)=>{e=e.replace(/^0x/i,'');const t=P(e.toLowerCase()).replace(/^0x/i,'');for(let r=0;40>r;r++)if(7=parseInt(t[r],16)&&e[r].toLowerCase()!==e[r])return!1;return!0},A=(e)=>{e=m.a.encode(e);let t='';e=e.replace(/^(?:\u0000)*/,''),e=e.split('').reverse().join(''),e=e.replace(/^(?:\u0000)*/,''),e=e.split('').reverse().join('');for(let r=0;ro.length?`0${o}`:o}return`0x${t}`},E=(e)=>{if(Object(i.isNull)(e)||Object(i.isUndefined)(e))return e;if(!isFinite(e)&&!C(e))throw new Error(`Given input "${e}" is not a number.`);const t=x(e),r=t.toString(16);return t.lt(new l.a(0))?`-0x${r.substr(1)}`:`0x${r}`},I=(e)=>{if(e=e.toString(16),!C(e))throw new Error(`Given value "${e}" is not a valid hex string.`);e=e.replace(/^0x/i,'');for(let t=[],r=0;r(Object(i.isString)(e)||Object(i.isNumber)(e))&&/^(-)?0x[0-9a-f]*$/i.test(e),P=(e)=>{C(e)&&/^0x/i.test(e.toString())&&(e=I(e));const t=g.a.keccak256(e);return t==='0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'?null:t};P._Hash=g.a;var T={BN:l.a,isBN:v,isBigNumber:k,toBN:x,isAddress:S,isBloom:(e)=>{if(!/^(0x)?[0-9a-f]{512}$/i.test(e))return!1;return!!(/^(0x)?[0-9a-f]{512}$/.test(e)||/^(0x)?[0-9A-F]{512}$/.test(e))},isTopic:(e)=>{if(!/^(0x)?[0-9a-f]{64}$/i.test(e))return!1;return!!(/^(0x)?[0-9a-f]{64}$/.test(e)||/^(0x)?[0-9A-F]{64}$/.test(e))},checkAddressChecksum:w,utf8ToHex:A,hexToUtf8:(e)=>{if(!C(e))throw new Error(`The parameter "${e}" must be a valid HEX string.`);let t='',r=0;e=e.replace(/^0x/i,''),e=e.replace(/^(?:00)*/,''),e=e.split('').reverse().join(''),e=e.replace(/^(?:00)*/,''),e=e.split('').reverse().join('');const a=e.length;for(let o=0;oe?x(e).toNumber():e,hexToNumberString:(e)=>e?x(e).toString(10):e,numberToHex:E,toHex:(e,t)=>{if(S(e))return t?'address':`0x${e.toLowerCase().replace(/^0x/i,'')}`;if(Object(i.isBoolean)(e))return t?'bool':e?'0x01':'0x00';if(Object(i.isObject)(e)&&!k(e)&&!v(e))return t?'string':A(JSON.stringify(e));if(Object(i.isString)(e)){if(0===e.indexOf('-0x')||0===e.indexOf('-0X'))return t?'int256':E(e);if(0===e.indexOf('0x')||0===e.indexOf('0X'))return t?'bytes':e;if(!isFinite(e))return t?'string':A(e)}return t?0>e?'int256':'uint256':E(e)},hexToBytes:I,bytesToHex:(e)=>{for(let t=[],r=0;r>>4).toString(16)),t.push((15&e[r]).toString(16));return`0x${hex.join('')}`},isHex:(e)=>(Object(i.isString)(e)||Object(i.isNumber)(e))&&/^(-0x|0x)?[0-9a-f]*$/i.test(e),isHexStrict:C,leftPad:(e,t,r)=>{const n=/^0x/i.test(e)||'number'==typeof e;e=e.toString(16).replace(/^0x/i,'');const a=0<=t-e.length+1?t-e.length+1:0;return(n?'0x':'')+Array(a).join(r?r:'0')+e},rightPad:(e,t,r)=>{const n=/^0x/i.test(e)||'number'==typeof e;e=e.toString(16).replace(/^0x/i,'');const a=0<=t-e.length+1?t-e.length+1:0;return(n?'0x':'')+e+Array(a).join(r?r:'0')},toTwosComplement:(e)=>`0x${x(e).toTwos(256).toString(16,64)}`,sha3:P};const B=(e)=>{if(e.startsWith('int['))return`int256${e.slice(3)}`;return'int'===e?'int256':e.startsWith('uint[')?`uint256${e.slice(4)}`:'uint'===e?'uint256':e.startsWith('fixed[')?`fixed128x128${e.slice(5)}`:'fixed'===e?'fixed128x128':e.startsWith('ufixed[')?`ufixed128x128${e.slice(6)}`:'ufixed'===e?'ufixed128x128':e},N=(e)=>{const t=/^\D+(\d+).*$/.exec(e);return t?parseInt(t[1],10):null},R=(e)=>{const t=/^\D+\d*\[(\d+)\]$/.exec(e);return t?parseInt(t[1],10):null},M=(e)=>{const t=typeof e;if('string'==t)return T.isHexStrict(e)?new l.a(e.replace(/0x/i,''),16):new l.a(e,10);if('number'==t)return new l.a(e);if(T.isBigNumber(e))return new l.a(e.toString(10));if(T.isBN(e))return e;throw new Error(`${e} is not a number`)},L=(e,t,r)=>{let n,a;if(e=B(e),'bytes'===e){if(0!=t.replace(/^0x/i,'').length%2)throw new Error(`Invalid bytes characters ${t.length}`);return t}if('string'===e)return T.utf8ToHex(t);if('bool'===e)return t?'01':'00';if(e.startsWith('address')){if(n=r?64:40,!T.isAddress(t))throw new Error(`${t} is not a valid address, or the checksum is invalid.`);return T.leftPad(t.toLowerCase(),n)}if(n=N(e),e.startsWith('bytes')){if(!n)throw new Error('bytes[] not yet supported in solidity');if(r&&(n=32),1>n||32n||256n)throw new Error(`Supplied uint exceeds width: ${n} vs ${a.bitLength()}`);if(a.lt(new l.a(0)))throw new Error(`Supplied uint ${a.toString()} is negative`);return n?T.leftPad(a.toString('hex'),2*(n/8)):a}if(e.startsWith('int')){if(n%8||8>n||256n)throw new Error(`Supplied int exceeds width: ${n} vs ${a.bitLength()}`);return a.lt(new l.a(0))?a.toTwos(n).toString('hex'):n?T.leftPad(a.toString('hex'),2*(n/8)):a}throw new Error(`Unsupported or invalid type: ${e}`)},j=(e)=>{if(Object(i.isArray)(e))throw new Error('Autodetection of array types is not supported.');let t='',r,n,a;if(Object(i.isObject)(e)&&(e.hasOwnProperty('v')||e.hasOwnProperty('t')||e.hasOwnProperty('value')||e.hasOwnProperty('type'))?(r=e.hasOwnProperty('t')?e.t:e.type,t=e.hasOwnProperty('v')?e.v:e.value):(r=T.toHex(e,!0),t=T.toHex(e),!r.startsWith('int')&&!r.startsWith('uint')&&(r='bytes')),(r.startsWith('int')||r.startsWith('uint'))&&'string'==typeof t&&!/^(-)?0x/i.test(t)&&(t=new l.a(t)),Object(i.isArray)(t))if(a=R(r),a&&t.length!==a)throw new Error(`${r} is not matching the given array ${JSON.stringify(t)}`);else a=t.length;return Object(i.isArray)(t)?(n=t.map((e)=>L(r,e,a).toString('hex').replace('0x','')),n.join('')):(n=L(r,t,a),n.toString('hex').replace('0x',''))};var O=r(155),D=r.n(O);const U=(e,t)=>{const r=[];return t.forEach((t)=>{if('object'==typeof t.components){if('tuple'!==t.type.substring(0,5))throw new Error('components found but type is not tuple; report on GitHub');let n='';const a=t.type.indexOf('[');0<=a&&(n=t.type.substring(a));const o=U(e,t.components);Object(i.isArray)(o)&&e?r.push(`tuple(${o.join(',')})${n}`):e?r.push(`(${o})`):r.push(`(${o.join(',')})${n}`)}else r.push(t.type)}),r},H=(e)=>{if(!T.isHexStrict(e))throw new Error('The parameter must be a valid HEX string.');let t='',r=0;const a=e.length;for('0x'===e.substring(0,2)&&(r=2);r{if(!e)return'0x00';let t='';for(let r=0;ro.length?`0${o}`:o}return`0x${t}`},q=(e)=>{if(e=e?e.toLowerCase():'ether',!c.a.unitMap[e])throw new Error(`This unit "${e}" doesn't exist, please use the one of the following units${JSON.stringify(c.a.unitMap,null,2)}`);return e};t.a={_fireError:(e,t,r,n)=>(Object(i.isObject)(e)&&!(e instanceof Error)&&e.data&&((Object(i.isObject)(e.data)||Object(i.isArray)(e.data))&&(e.data=JSON.stringify(e.data,null,2)),e=`${e.message}\n${e.data}`),Object(i.isString)(e)&&(e=new Error(e)),Object(i.isFunction)(n)&&n(e),Object(i.isFunction)(r)&&((t&&Object(i.isFunction)(t.listeners)&&t.listeners('error').length||Object(i.isFunction)(n))&&t.catch(()=>{}),setTimeout(()=>{r(e)},1)),t&&Object(i.isFunction)(t.emit)&&setTimeout(()=>{t.emit('error',e),t.removeAllListeners()},1),t),_jsonInterfaceMethodToString:(e)=>Object(i.isObject)(e)&&e.name&&-1!==e.name.indexOf('(')?e.name:`${e.name}(${U(!1,e.inputs).join(',')})`,_flattenTypes:U,randomHex:D.a,_,BN:T.BN,isBN:T.isBN,isBigNumber:T.isBigNumber,isHex:T.isHex,isHexStrict:T.isHexStrict,sha3:T.sha3,keccak256:T.sha3,soliditySha3:()=>{const e=Array.prototype.slice.call(arguments),t=Object(i.map)(e,j);return T.sha3(`0x${t.join('')}`)},isAddress:T.isAddress,checkAddressChecksum:T.checkAddressChecksum,toChecksumAddress:(e)=>{if('undefined'==typeof e)return'';if(!/^(0x)?[0-9a-f]{40}$/i.test(e))throw new Error(`Given address "${e}" is not a valid Ethereum address.`);e=e.toLowerCase().replace(/^0x/i,'');const t=T.sha3(e).replace(/^0x/i,'');let r='0x';for(let n=0;n{if(t=q(t),!T.isBN(e)&&!Object(i.isString)(e))throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.');return T.isBN(e)?c.a.toWei(e,t):c.a.toWei(e,t).toString(10)},fromWei:(e,t)=>{if(t=q(t),!T.isBN(e)&&!Object(i.isString)(e))throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.');return T.isBN(e)?c.a.fromWei(e,t):c.a.fromWei(e,t).toString(10)},padLeft:T.leftPad,leftPad:T.leftPad,padRight:T.rightPad,rightPad:T.rightPad,toTwosComplement:T.toTwosComplement}},function(e,t,r){var n=Math.ceil,o=Math.min,d=Math.max;(function(e){(function(e,t){'use strict';function f(e,t){if(!e)throw new Error(t||'Assertion failed')}function a(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function h(e,t,r){return h.isBN(e)?e:void(this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(('le'===t||'be'===t)&&(r=t,t=10),this._init(e||0,t||10,r||'be')))}function s(e,t,n){for(var a=0,r=o(e.length,n),d=t,i;d=i?i-49+10:17<=i&&22>=i?i-17+10:15&i;return a}function c(e,t,n,a){for(var d=0,r=o(e.length,n),s=t,i;s>>a}return t}function i(e,t,n){n.negative=t.negative^e.negative;var s=0|e.length+t.length;n.length=s,s=0|s-1;var c=0|e.words[0],a=0|t.words[0],f=c*a,r=67108863&f,p=0|f/67108864;n.words[0]=r;for(var l=1;l>>26,b=67108863&p,h=o(l,t.length-1),m=d(0,l-e.length+1),y;m<=h;m++)y=0|l-m,c=0|e.words[y],a=0|t.words[m],f=c*a+b,u+=0|f/67108864,b=67108863&f;n.words[l]=0|b,p=0|u}return 0==p?n.length--:n.words[l]=0|p,n.strip()}function l(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var s=0,c=0,f=0,p;f>>26),c+=p>>>26,p&=67108863}n.words[f]=l,s=p,p=c}return 0==s?n.length--:n.words[f]=s,n.strip()}function u(e,t,r){var n=new b;return n.mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}function m(e,t){this.name=e,this.p=new h(t,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,'k256','ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f')}function g(){m.call(this,'p224','ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001')}function v(){m.call(this,'p192','ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff')}function k(){m.call(this,'25519','7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed')}function x(e){if('string'==typeof e){var t=h._prime(e);this.m=t.p,this.prime=t}else f(e.gtn(1),'modulus must be greater than 1'),this.m=e,this.prime=null}function S(e){x.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var w=Math.imul,A=Math.clz32;'object'==typeof e?e.exports=h:t.BN=h,h.BN=h,h.wordSize=26;var E;try{E=r(190).Buffer}catch(t){}h.isBN=function(e){return!!(e instanceof h)||null!==e&&'object'==typeof e&&e.constructor.wordSize===h.wordSize&&Array.isArray(e.words)},h.max=function(e,t){return 0e.cmp(t)?e:t},h.prototype._init=function(e,t,r){if('number'==typeof e)return this._initNumber(e,t,r);if('object'==typeof e)return this._initArray(e,t,r);'hex'===t&&(t=16),f(t===(0|t)&&2<=t&&36>=t),e=e.toString().replace(/\s+/g,'');var n=0;'-'===e[0]&&n++,16===t?this._parseHex(e,n):this._parseBase(e,t,n),'-'===e[0]&&(this.negative=1),this.strip();'le'!==r||this._initArray(this.toArray(),t,r)},h.prototype._initNumber=function(e,t,r){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(f(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3);'le'!==r||this._initArray(this.toArray(),t,r)},h.prototype._initArray=function(e,t,r){if(f('number'==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=n(e.length/3),this.words=Array(this.length);for(var a=0;a>>26-o,o+=24,26<=o&&(o-=26,d++);else if('le'===r)for(a=0,d=0;a>>26-o,o+=24,26<=o&&(o-=26,d++);return this.strip()},h.prototype._parseHex=function(e,t){this.length=n((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=6)d=s(e,r,r+6),this.words[o]|=67108863&d<>>26-a,a+=24,26<=a&&(a-=26,o++);r+6!==t&&(d=s(e,t,r+6),this.words[o]|=67108863&d<>>26-a),this.strip()},h.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;67108863>=a;a*=t)n++;n--,a=0|a/t;for(var d=e.length-r,s=d%n,f=o(d,d-s)+r,p=0,l=r;lthis.words[0]+p?this.words[0]+=p:this._iaddn(p);if(0!=s){var i=1;for(p=c(e,l,e.length,t),l=0;lthis.words[0]+p?this.words[0]+=p:this._iaddn(p)}},h.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t'};var I=['','0','00','000','0000','00000','000000','0000000','00000000','000000000','0000000000','00000000000','000000000000','0000000000000','00000000000000','000000000000000','0000000000000000','00000000000000000','000000000000000000','0000000000000000000','00000000000000000000','000000000000000000000','0000000000000000000000','00000000000000000000000','000000000000000000000000','0000000000000000000000000'],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],P=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(e,t){e=e||10,t=0|t||1;var n;if(16===e||'hex'===e){n='';for(var a=0,o=0,d=0;d>>24-a,n=0!=o||d!==this.length-1?I[6-s.length]+s+n:s+n,a+=2,26<=a&&(a-=26,d--)}for(0!=o&&(n=o.toString(16)+n);0!=n.length%t;)n='0'+n;return 0!==this.negative&&(n='-'+n),n}if(e===(0|e)&&2<=e&&36>=e){var p=C[e],l=P[e];n='';var u=this.clone();for(u.negative=0;!u.isZero();){var c=u.modn(l).toString(e);u=u.idivn(l),n=u.isZero()?c+n:I[p-c.length]+c+n}for(this.isZero()&&(n='0'+n);0!=n.length%t;)n='0'+n;return 0!==this.negative&&(n='-'+n),n}f(!1,'Base should be between 2 and 36')},h.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=n&&(t+=7,n>>>=7),8<=n&&(t+=4,n>>>=4),2<=n&&(t+=2,n>>>=2),t+n},h.prototype._zeroBits=function(e){if(0===e)return 26;var n=e,t=0;return 0==(8191&n)&&(t+=13,n>>>=13),0==(127&n)&&(t+=7,n>>>=7),0==(15&n)&&(t+=4,n>>>=4),0==(3&n)&&(t+=2,n>>>=2),0==(1&n)&&t++,t},h.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0,r;te.length?this.clone().ior(e):e.clone().ior(this)},h.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},h.prototype.iuand=function(e){var t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},h.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},h.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},h.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},h.prototype.inotn=function(e){f('number'==typeof e&&0<=e);var t=0|n(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},h.prototype.notn=function(e){return this.clone().inotn(e)},h.prototype.setn=function(e,t){f('number'==typeof e&&0<=e);var r=0|e/26,n=e%26;return this._expand(r+1),t?this.words[r]|=1<e.length?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o>>26;for(;0!=a&&o>>26;if(this.length=r.length,0!=a)this.words[this.length]=a,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},h.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,a;0>26,this.words[s]=67108863&t;for(;0!=o&&s>26,this.words[s]=67108863&t;if(0==o&&s>>13,f=0|n[1],p=8191&f,l=f>>>13,u=0|n[2],b=8191&u,h=u>>>13,m=0|n[3],y=8191&m,g=m>>>13,v=0|n[4],k=8191&v,x=v>>>13,S=0|n[5],A=8191&S,E=S>>>13,I=0|n[6],C=8191&I,P=I>>>13,T=0|n[7],B=8191&T,N=T>>>13,R=0|n[8],M=8191&R,L=R>>>13,j=0|n[9],O=8191&j,D=j>>>13,U=0|a[0],H=8191&U,F=U>>>13,q=0|a[1],z=8191&q,K=q>>>13,V=0|a[2],G=8191&V,W=V>>>13,X=0|a[3],Y=8191&X,Z=X>>>13,J=0|a[4],$=8191&J,Q=J>>>13,ee=0|a[5],te=8191&ee,re=ee>>>13,ne=0|a[6],ae=8191&ne,oe=ne>>>13,de=0|a[7],ie=8191&de,se=de>>>13,ce=0|a[8],fe=8191&ce,pe=ce>>>13,le=0|a[9],ue=8191&le,be=le>>>13,he,me,ye;r.negative=e.negative^t.negative,r.length=19,he=w(s,H),me=w(s,F),me=0|me+w(c,H),ye=w(c,F);var ge=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(ge>>>26),ge&=67108863,he=w(p,H),me=w(p,F),me=0|me+w(l,H),ye=w(l,F),he=0|he+w(s,z),me=0|me+w(s,K),me=0|me+w(c,z),ye=0|ye+w(c,K);var _e=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(_e>>>26),_e&=67108863,he=w(b,H),me=w(b,F),me=0|me+w(h,H),ye=w(h,F),he=0|he+w(p,z),me=0|me+w(p,K),me=0|me+w(l,z),ye=0|ye+w(l,K),he=0|he+w(s,G),me=0|me+w(s,W),me=0|me+w(c,G),ye=0|ye+w(c,W);var ve=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(ve>>>26),ve&=67108863,he=w(y,H),me=w(y,F),me=0|me+w(g,H),ye=w(g,F),he=0|he+w(b,z),me=0|me+w(b,K),me=0|me+w(h,z),ye=0|ye+w(h,K),he=0|he+w(p,G),me=0|me+w(p,W),me=0|me+w(l,G),ye=0|ye+w(l,W),he=0|he+w(s,Y),me=0|me+w(s,Z),me=0|me+w(c,Y),ye=0|ye+w(c,Z);var ke=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(ke>>>26),ke&=67108863,he=w(k,H),me=w(k,F),me=0|me+w(x,H),ye=w(x,F),he=0|he+w(y,z),me=0|me+w(y,K),me=0|me+w(g,z),ye=0|ye+w(g,K),he=0|he+w(b,G),me=0|me+w(b,W),me=0|me+w(h,G),ye=0|ye+w(h,W),he=0|he+w(p,Y),me=0|me+w(p,Z),me=0|me+w(l,Y),ye=0|ye+w(l,Z),he=0|he+w(s,$),me=0|me+w(s,Q),me=0|me+w(c,$),ye=0|ye+w(c,Q);var xe=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(xe>>>26),xe&=67108863,he=w(A,H),me=w(A,F),me=0|me+w(E,H),ye=w(E,F),he=0|he+w(k,z),me=0|me+w(k,K),me=0|me+w(x,z),ye=0|ye+w(x,K),he=0|he+w(y,G),me=0|me+w(y,W),me=0|me+w(g,G),ye=0|ye+w(g,W),he=0|he+w(b,Y),me=0|me+w(b,Z),me=0|me+w(h,Y),ye=0|ye+w(h,Z),he=0|he+w(p,$),me=0|me+w(p,Q),me=0|me+w(l,$),ye=0|ye+w(l,Q),he=0|he+w(s,te),me=0|me+w(s,re),me=0|me+w(c,te),ye=0|ye+w(c,re);var Se=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Se>>>26),Se&=67108863,he=w(C,H),me=w(C,F),me=0|me+w(P,H),ye=w(P,F),he=0|he+w(A,z),me=0|me+w(A,K),me=0|me+w(E,z),ye=0|ye+w(E,K),he=0|he+w(k,G),me=0|me+w(k,W),me=0|me+w(x,G),ye=0|ye+w(x,W),he=0|he+w(y,Y),me=0|me+w(y,Z),me=0|me+w(g,Y),ye=0|ye+w(g,Z),he=0|he+w(b,$),me=0|me+w(b,Q),me=0|me+w(h,$),ye=0|ye+w(h,Q),he=0|he+w(p,te),me=0|me+w(p,re),me=0|me+w(l,te),ye=0|ye+w(l,re),he=0|he+w(s,ae),me=0|me+w(s,oe),me=0|me+w(c,ae),ye=0|ye+w(c,oe);var we=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(we>>>26),we&=67108863,he=w(B,H),me=w(B,F),me=0|me+w(N,H),ye=w(N,F),he=0|he+w(C,z),me=0|me+w(C,K),me=0|me+w(P,z),ye=0|ye+w(P,K),he=0|he+w(A,G),me=0|me+w(A,W),me=0|me+w(E,G),ye=0|ye+w(E,W),he=0|he+w(k,Y),me=0|me+w(k,Z),me=0|me+w(x,Y),ye=0|ye+w(x,Z),he=0|he+w(y,$),me=0|me+w(y,Q),me=0|me+w(g,$),ye=0|ye+w(g,Q),he=0|he+w(b,te),me=0|me+w(b,re),me=0|me+w(h,te),ye=0|ye+w(h,re),he=0|he+w(p,ae),me=0|me+w(p,oe),me=0|me+w(l,ae),ye=0|ye+w(l,oe),he=0|he+w(s,ie),me=0|me+w(s,se),me=0|me+w(c,ie),ye=0|ye+w(c,se);var Ae=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ae>>>26),Ae&=67108863,he=w(M,H),me=w(M,F),me=0|me+w(L,H),ye=w(L,F),he=0|he+w(B,z),me=0|me+w(B,K),me=0|me+w(N,z),ye=0|ye+w(N,K),he=0|he+w(C,G),me=0|me+w(C,W),me=0|me+w(P,G),ye=0|ye+w(P,W),he=0|he+w(A,Y),me=0|me+w(A,Z),me=0|me+w(E,Y),ye=0|ye+w(E,Z),he=0|he+w(k,$),me=0|me+w(k,Q),me=0|me+w(x,$),ye=0|ye+w(x,Q),he=0|he+w(y,te),me=0|me+w(y,re),me=0|me+w(g,te),ye=0|ye+w(g,re),he=0|he+w(b,ae),me=0|me+w(b,oe),me=0|me+w(h,ae),ye=0|ye+w(h,oe),he=0|he+w(p,ie),me=0|me+w(p,se),me=0|me+w(l,ie),ye=0|ye+w(l,se),he=0|he+w(s,fe),me=0|me+w(s,pe),me=0|me+w(c,fe),ye=0|ye+w(c,pe);var Ee=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ee>>>26),Ee&=67108863,he=w(O,H),me=w(O,F),me=0|me+w(D,H),ye=w(D,F),he=0|he+w(M,z),me=0|me+w(M,K),me=0|me+w(L,z),ye=0|ye+w(L,K),he=0|he+w(B,G),me=0|me+w(B,W),me=0|me+w(N,G),ye=0|ye+w(N,W),he=0|he+w(C,Y),me=0|me+w(C,Z),me=0|me+w(P,Y),ye=0|ye+w(P,Z),he=0|he+w(A,$),me=0|me+w(A,Q),me=0|me+w(E,$),ye=0|ye+w(E,Q),he=0|he+w(k,te),me=0|me+w(k,re),me=0|me+w(x,te),ye=0|ye+w(x,re),he=0|he+w(y,ae),me=0|me+w(y,oe),me=0|me+w(g,ae),ye=0|ye+w(g,oe),he=0|he+w(b,ie),me=0|me+w(b,se),me=0|me+w(h,ie),ye=0|ye+w(h,se),he=0|he+w(p,fe),me=0|me+w(p,pe),me=0|me+w(l,fe),ye=0|ye+w(l,pe),he=0|he+w(s,ue),me=0|me+w(s,be),me=0|me+w(c,ue),ye=0|ye+w(c,be);var Ie=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ie>>>26),Ie&=67108863,he=w(O,z),me=w(O,K),me=0|me+w(D,z),ye=w(D,K),he=0|he+w(M,G),me=0|me+w(M,W),me=0|me+w(L,G),ye=0|ye+w(L,W),he=0|he+w(B,Y),me=0|me+w(B,Z),me=0|me+w(N,Y),ye=0|ye+w(N,Z),he=0|he+w(C,$),me=0|me+w(C,Q),me=0|me+w(P,$),ye=0|ye+w(P,Q),he=0|he+w(A,te),me=0|me+w(A,re),me=0|me+w(E,te),ye=0|ye+w(E,re),he=0|he+w(k,ae),me=0|me+w(k,oe),me=0|me+w(x,ae),ye=0|ye+w(x,oe),he=0|he+w(y,ie),me=0|me+w(y,se),me=0|me+w(g,ie),ye=0|ye+w(g,se),he=0|he+w(b,fe),me=0|me+w(b,pe),me=0|me+w(h,fe),ye=0|ye+w(h,pe),he=0|he+w(p,ue),me=0|me+w(p,be),me=0|me+w(l,ue),ye=0|ye+w(l,be);var Ce=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ce>>>26),Ce&=67108863,he=w(O,G),me=w(O,W),me=0|me+w(D,G),ye=w(D,W),he=0|he+w(M,Y),me=0|me+w(M,Z),me=0|me+w(L,Y),ye=0|ye+w(L,Z),he=0|he+w(B,$),me=0|me+w(B,Q),me=0|me+w(N,$),ye=0|ye+w(N,Q),he=0|he+w(C,te),me=0|me+w(C,re),me=0|me+w(P,te),ye=0|ye+w(P,re),he=0|he+w(A,ae),me=0|me+w(A,oe),me=0|me+w(E,ae),ye=0|ye+w(E,oe),he=0|he+w(k,ie),me=0|me+w(k,se),me=0|me+w(x,ie),ye=0|ye+w(x,se),he=0|he+w(y,fe),me=0|me+w(y,pe),me=0|me+w(g,fe),ye=0|ye+w(g,pe),he=0|he+w(b,ue),me=0|me+w(b,be),me=0|me+w(h,ue),ye=0|ye+w(h,be);var Pe=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Pe>>>26),Pe&=67108863,he=w(O,Y),me=w(O,Z),me=0|me+w(D,Y),ye=w(D,Z),he=0|he+w(M,$),me=0|me+w(M,Q),me=0|me+w(L,$),ye=0|ye+w(L,Q),he=0|he+w(B,te),me=0|me+w(B,re),me=0|me+w(N,te),ye=0|ye+w(N,re),he=0|he+w(C,ae),me=0|me+w(C,oe),me=0|me+w(P,ae),ye=0|ye+w(P,oe),he=0|he+w(A,ie),me=0|me+w(A,se),me=0|me+w(E,ie),ye=0|ye+w(E,se),he=0|he+w(k,fe),me=0|me+w(k,pe),me=0|me+w(x,fe),ye=0|ye+w(x,pe),he=0|he+w(y,ue),me=0|me+w(y,be),me=0|me+w(g,ue),ye=0|ye+w(g,be);var Te=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Te>>>26),Te&=67108863,he=w(O,$),me=w(O,Q),me=0|me+w(D,$),ye=w(D,Q),he=0|he+w(M,te),me=0|me+w(M,re),me=0|me+w(L,te),ye=0|ye+w(L,re),he=0|he+w(B,ae),me=0|me+w(B,oe),me=0|me+w(N,ae),ye=0|ye+w(N,oe),he=0|he+w(C,ie),me=0|me+w(C,se),me=0|me+w(P,ie),ye=0|ye+w(P,se),he=0|he+w(A,fe),me=0|me+w(A,pe),me=0|me+w(E,fe),ye=0|ye+w(E,pe),he=0|he+w(k,ue),me=0|me+w(k,be),me=0|me+w(x,ue),ye=0|ye+w(x,be);var Be=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Be>>>26),Be&=67108863,he=w(O,te),me=w(O,re),me=0|me+w(D,te),ye=w(D,re),he=0|he+w(M,ae),me=0|me+w(M,oe),me=0|me+w(L,ae),ye=0|ye+w(L,oe),he=0|he+w(B,ie),me=0|me+w(B,se),me=0|me+w(N,ie),ye=0|ye+w(N,se),he=0|he+w(C,fe),me=0|me+w(C,pe),me=0|me+w(P,fe),ye=0|ye+w(P,pe),he=0|he+w(A,ue),me=0|me+w(A,be),me=0|me+w(E,ue),ye=0|ye+w(E,be);var Ne=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ne>>>26),Ne&=67108863,he=w(O,ae),me=w(O,oe),me=0|me+w(D,ae),ye=w(D,oe),he=0|he+w(M,ie),me=0|me+w(M,se),me=0|me+w(L,ie),ye=0|ye+w(L,se),he=0|he+w(B,fe),me=0|me+w(B,pe),me=0|me+w(N,fe),ye=0|ye+w(N,pe),he=0|he+w(C,ue),me=0|me+w(C,be),me=0|me+w(P,ue),ye=0|ye+w(P,be);var Re=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Re>>>26),Re&=67108863,he=w(O,ie),me=w(O,se),me=0|me+w(D,ie),ye=w(D,se),he=0|he+w(M,fe),me=0|me+w(M,pe),me=0|me+w(L,fe),ye=0|ye+w(L,pe),he=0|he+w(B,ue),me=0|me+w(B,be),me=0|me+w(N,ue),ye=0|ye+w(N,be);var Me=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Me>>>26),Me&=67108863,he=w(O,fe),me=w(O,pe),me=0|me+w(D,fe),ye=w(D,pe),he=0|he+w(M,ue),me=0|me+w(M,be),me=0|me+w(L,ue),ye=0|ye+w(L,be);var Le=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Le>>>26),Le&=67108863,he=w(O,ue),me=w(O,be),me=0|me+w(D,ue),ye=w(D,be);var je=0|(0|o+he)+((8191&me)<<13);return o=0|(0|ye+(me>>>13))+(je>>>26),je&=67108863,d[0]=ge,d[1]=_e,d[2]=ve,d[3]=ke,d[4]=xe,d[5]=Se,d[6]=we,d[7]=Ae,d[8]=Ee,d[9]=Ie,d[10]=Ce,d[11]=Pe,d[12]=Te,d[13]=Be,d[14]=Ne,d[15]=Re,d[16]=Me,d[17]=Le,d[18]=je,0!=o&&(d[19]=o,r.length++),r};w||(T=i),h.prototype.mulTo=function(e,t){var r=this.length+e.length,n;return n=10===this.length&&10===e.length?T(this,e,t):63>r?i(this,e,t):1024>r?l(this,e,t):u(this,e,t),n},b.prototype.makeRBT=function(e){for(var r=Array(e),t=h.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,a,o){for(var d=0;d>>=1)a++;return 1<=n))for(var a=0,o;ao?0:0|o/67108864;return e},b.prototype.convert13b=function(e,t,r,n){for(var a=0,o=0;o>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;oe);for(var t=0,r=0;r>=26,t+=0|n/67108864,t+=a>>>26,this.words[r]=67108863&a}return 0!=t&&(this.words[r]=t,this.length++),this},h.prototype.muln=function(e){return this.clone().imuln(e)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(e){var t=p(e);if(0===t.length)return new h(1);for(var r=this,n=0;n>>26-t<<26-t,d=(0|this.words[n])-o<>>26-t}a&&(this.words[n]=a,this.length++)}if(0!=r){for(n=this.length-1;0<=n;n--)this.words[n+r]=this.words[n];for(n=0;nr)for(this.length-=r,p=0;p=a);p--){var l=0|this.words[p];this.words[p]=i<<26-c|l>>>c,i=l&(67108863^67108863>>>c<>>t<e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;tthis.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},h.prototype.addn=function(e){return this.clone().iaddn(e)},h.prototype.subn=function(e){return this.clone().isubn(e)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(e,t,r){var n=e.length+r,a;this._expand(n);var o=0,d;for(a=0;a>26)-(0|i/67108864),this.words[a+r]=67108863&d}for(;a>26,this.words[a+r]=67108863&d;if(0==o)return this.strip();for(f(-1==o),o=0,a=0;a>26,this.words[a]=67108863&d;return this.negative=1,this.strip()},h.prototype._wordDiv=function(e,t){var r=this.length-e.length,n=this.clone(),d=e,s=0|d.words[d.length-1],c=this._countBits(s);r=26-c,0!=r&&(d=d.ushln(r),n.iushln(r),s=0|d.words[d.length-1]);var f=n.length-d.length,p;if('mod'!==t){p=new h(null),p.length=f+1,p.words=Array(p.length);for(var l=0;lthis.length||0>this.cmp(e)?{div:new h(0),mod:this}:1===e.length?'div'===t?{div:this.divn(e.words[0]),mod:null}:'mod'===t?{div:null,mod:new h(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new h(this.modn(e.words[0]))}:this._wordDiv(e,t):(o=this.neg().divmod(e.neg(),t),'div'!==t&&(a=o.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:o.div,mod:a})},h.prototype.div=function(e){return this.divmod(e,'div',!1).div},h.prototype.mod=function(e){return this.divmod(e,'mod',!1).mod},h.prototype.umod=function(e){return this.divmod(e,'mod',!0).mod},h.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0===t.div.negative?t.mod:t.mod.isub(e),n=e.ushrn(1),a=e.andln(1),o=r.cmp(n);return 0>o||1===a&&0===o?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},h.prototype.modn=function(e){f(67108863>=e);for(var t=0,r=this.length-1;0<=r;r--)t=(67108864%e*t+(0|this.words[r]))%e;return t},h.prototype.idivn=function(e){f(67108863>=e);for(var t=0,r=this.length-1,n;0<=r;r--)n=(0|this.words[r])+67108864*t,this.words[r]=0|n/e,t=n%e;return this.strip()},h.prototype.divn=function(e){return this.clone().idivn(e)},h.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var t=this,r=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var n=new h(1),a=new h(0),o=new h(0),d=new h(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var c=r.clone(),p=t.clone();!t.isZero();){for(var l=0,i=1;0==(t.words[0]&i)&&26>l;++l,i<<=1);if(0u;++u,b<<=1);if(0d;++d,i<<=1);if(0s;++s,c<<=1);if(0p.cmpn(0)&&p.iadd(e),p},h.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var n=this.clone(),a=e.clone();n.negative=0,a.negative=0;for(var o=0;n.isEven()&&a.isEven();o++)n.iushrn(1),a.iushrn(1);do{for(;n.isEven();)n.iushrn(1);for(;a.isEven();)a.iushrn(1);var d=n.cmp(a);if(0>d){var r=n;n=a,a=r}else if(0===d||0===a.cmpn(1))break;n.isub(a)}while(!0);return a.iushln(o)},h.prototype.invm=function(e){return this.egcd(e).a.umod(e)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(e){return this.words[0]&e},h.prototype.bincn=function(e){f('number'==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,d&=67108863,this.words[o]=d;return 0!=a&&(this.words[o]=a,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(e){var t=0>e;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;this.strip();var r;if(1=e,'Number is too big');var n=0|this.words[0];r=n===e?0:ne.length)return 1;if(this.lengtha&&(t=1);break}}return t},h.prototype.gtn=function(e){return 1===this.cmpn(e)},h.prototype.gt=function(e){return 1===this.cmp(e)},h.prototype.gten=function(e){return 0<=this.cmpn(e)},h.prototype.gte=function(e){return 0<=this.cmp(e)},h.prototype.ltn=function(e){return-1===this.cmpn(e)},h.prototype.lt=function(e){return-1===this.cmp(e)},h.prototype.lten=function(e){return 0>=this.cmpn(e)},h.prototype.lte=function(e){return 0>=this.cmp(e)},h.prototype.eqn=function(e){return 0===this.cmpn(e)},h.prototype.eq=function(e){return 0===this.cmp(e)},h.red=function(e){return new x(e)},h.prototype.toRed=function(e){return f(!this.red,'Already a number in reduction context'),f(0===this.negative,'red works only with positives'),e.convertTo(this)._forceRed(e)},h.prototype.fromRed=function(){return f(this.red,'fromRed works only with numbers in reduction context'),this.red.convertFrom(this)},h.prototype._forceRed=function(e){return this.red=e,this},h.prototype.forceRed=function(e){return f(!this.red,'Already a number in reduction context'),this._forceRed(e)},h.prototype.redAdd=function(e){return f(this.red,'redAdd works only with red numbers'),this.red.add(this,e)},h.prototype.redIAdd=function(e){return f(this.red,'redIAdd works only with red numbers'),this.red.iadd(this,e)},h.prototype.redSub=function(e){return f(this.red,'redSub works only with red numbers'),this.red.sub(this,e)},h.prototype.redISub=function(e){return f(this.red,'redISub works only with red numbers'),this.red.isub(this,e)},h.prototype.redShl=function(e){return f(this.red,'redShl works only with red numbers'),this.red.shl(this,e)},h.prototype.redMul=function(e){return f(this.red,'redMul works only with red numbers'),this.red._verify2(this,e),this.red.mul(this,e)},h.prototype.redIMul=function(e){return f(this.red,'redMul works only with red numbers'),this.red._verify2(this,e),this.red.imul(this,e)},h.prototype.redSqr=function(){return f(this.red,'redSqr works only with red numbers'),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return f(this.red,'redISqr works only with red numbers'),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return f(this.red,'redSqrt works only with red numbers'),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return f(this.red,'redInvm works only with red numbers'),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return f(this.red,'redNeg works only with red numbers'),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(e){return f(this.red&&!e.red,'redPow(normalNum)'),this.red._verify1(this),this.red.pow(this,e)};var B={k256:null,p224:null,p192:null,p25519:null};m.prototype._tmp=function(){var e=new h(null);return e.words=Array(n(this.n/13)),e},m.prototype.ireduce=function(e){var t=e,r;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),r=t.bitLength();while(r>this.n);var n=r=e.length)return e.words[0]=0,void(e.length=1);var d=e.words[9];for(t.words[t.length++]=d&r,a=10;a>>22,d=i}d>>>=22,e.words[a-10]=d,e.length-=0===d&&10>>=26,e.words[r]=a,t=n}return 0!=t&&(e.words[e.length++]=t),e},h._prime=function(e){if(B[e])return B[e];var t;if('k256'===e)t=new y;else if('p224'===e)t=new g;else if('p192'===e)t=new v;else if('p25519'===e)t=new k;else throw new Error('Unknown prime '+e);return B[e]=t,t},x.prototype._verify1=function(e){f(0===e.negative,'red works only with positives'),f(e.red,'red works only with red numbers')},x.prototype._verify2=function(e,t){f(0==(e.negative|t.negative),'red works only with positives'),f(e.red&&e.red===t.red,'red works only with red numbers')},x.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},x.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},x.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},x.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},x.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},x.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},x.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},x.prototype.isqr=function(e){return this.imul(e,e.clone())},x.prototype.sqr=function(e){return this.mul(e,e)},x.prototype.sqrt=function(e){if(e.isZero())return e.clone();var n=this.m.andln(3);if(f(1==n%2),3===n){var a=this.m.add(new h(1)).iushrn(2);return this.pow(e,a)}for(var o=this.m.subn(1),d=0;!o.isZero()&&0===o.andln(1);)d++,o.iushrn(1);f(!o.isZero());var s=new h(1).toRed(this),p=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new h(2*u*u).toRed(this);0!==this.pow(u,l).cmp(p);)u.redIAdd(p);for(var y=this.pow(u,o),c=this.pow(e,o.addn(1).iushrn(1)),r=this.pow(e,o),t=d;0!==r.cmp(s);){for(var m=r,g=0;0!==m.cmp(s);g++)m=m.redSqr();f(g>f,o!==n[0]&&(o=this.sqr(o)),0===p&&0==d){i=0;continue}d<<=1,d|=p,i++,i!=r&&(0!==a||0!==f)||(o=this.mul(o,n[d]),i=0,d=0)}s=26}return o},x.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},x.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},h.mont=function(e){return new S(e)},a(S,x),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,r){if(e.isZero()||r.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(r),t=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(t).iushrn(this.shift),o=a;return 0<=a.cmp(this.m)?o=a.isub(this.m):0>a.cmpn(0)&&(o=a.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(e,r){if(e.isZero()||r.isZero())return new h(0)._forceRed(this);var n=e.mul(r),t=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(t).iushrn(this.shift),o=a;return 0<=a.cmp(this.m)?o=a.isub(this.m):0>a.cmpn(0)&&(o=a.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})('undefined'==typeof e||e,this)}).call(this,r(51)(e))},function(e,t,r){'use strict';var n=Math.pow,a=String.fromCharCode,o=Math.floor,d=Math.min;(function(e){function i(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(i()e)throw new RangeError('"size" argument must not be negative')}function l(e,t,r,n){return p(t),0>=t?s(e,t):void 0===r?s(e,t):'string'==typeof n?s(e,t).fill(r,n):s(e,t).fill(r)}function u(e,t){if(p(t),e=s(e,0>t?0:0|g(t)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;rt.length?0:0|g(t.length);e=s(e,r);for(var n=0;nr||t.byteLength=i())throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x'+i().toString(16)+' bytes');return 0|e}function v(e,t){if(c.isBuffer(e))return e.length;if('undefined'!=typeof ArrayBuffer&&'function'==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;'string'!=typeof e&&(e=''+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case'ascii':case'latin1':case'binary':return r;case'utf8':case'utf-8':case void 0:return X(e).length;case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return 2*r;case'hex':return r>>>1;case'base64':return J(e).length;default:if(n)return X(e).length;t=(''+t).toLowerCase(),n=!0;}}function k(e,t,r){var n=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return'';if((void 0===r||r>this.length)&&(r=this.length),0>=r)return'';if(r>>>=0,t>>>=0,r<=t)return'';for(e||(e='utf8');;)switch(e){case'hex':return j(this,t,r);case'utf8':case'utf-8':return N(this,t,r);case'ascii':return M(this,t,r);case'latin1':case'binary':return L(this,t,r);case'base64':return B(this,t,r);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return O(this,t,r);default:if(n)throw new TypeError('Unknown encoding: '+e);e=(e+'').toLowerCase(),n=!0;}}function x(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function S(e,t,r,n,a){if(0===e.length)return-1;if('string'==typeof r?(n=r,r=0):2147483647r&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),0>r&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(0>r)if(a)r=0;else return-1;if('string'==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,a);if('number'==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&'function'==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,a);throw new TypeError('val must be string, number or Buffer')}function w(e,t,r,n,a){function o(e,t){return 1===d?e[t]:e.readUInt16BE(t*d)}var d=1,s=e.length,c=t.length;if(void 0!==n&&(n=(n+'').toLowerCase(),'ucs2'===n||'ucs-2'===n||'utf16le'===n||'utf-16le'===n)){if(2>e.length||2>t.length)return-1;d=2,s/=2,c/=2,r/=2}var f;if(a){var i=-1;for(f=r;fs&&(r=s-c),f=r;0<=f;f--){for(var p=!0,l=0;la&&(n=a)):n=a;var o=t.length;if(0!=o%2)throw new TypeError('Invalid hex string');n>o/2&&(n=o/2);for(var d=0,i;do&&(i=o):2==s?(c=e[a+1],128==(192&c)&&(l=(31&o)<<6|63&c,127l||57343l&&(i=l))):void 0}null===i?(i=65533,s=1):65535>>10),i=56320|1023&i),n.push(i),a+=s}return R(n)}function R(e){var t=e.length;if(t<=ne)return a.apply(String,e);for(var r='',n=0;nt)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var a='',o=t;oe)throw new RangeError('offset is not uint');if(e+t>r)throw new RangeError('Trying to access beyond buffer length')}function U(e,t,r,n,a,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError('Index out of range')}function H(e,t,r,n){0>t&&(t=65535+t+1);for(var a=0,o=d(e.length-r,2);a>>8*(n?a:1-a)}function F(e,t,r,n){0>t&&(t=4294967295+t+1);for(var a=0,o=d(e.length-r,4);a>>8*(n?a:3-a)}function q(e,t,r,n){if(r+n>e.length)throw new RangeError('Index out of range');if(0>r)throw new RangeError('Index out of range')}function z(e,t,r,n,a){return a||q(e,t,r,4,34028234663852886e22,-34028234663852886e22),te.write(e,t,r,n,23,4),r+4}function K(e,t,r,n,a){return a||q(e,t,r,8,17976931348623157e292,-17976931348623157e292),te.write(e,t,r,n,52,8),r+8}function V(e){if(e=G(e).replace(ae,''),2>e.length)return'';for(;0!=e.length%4;)e+='=';return e}function G(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,'')}function W(e){return 16>e?'0'+e.toString(16):e.toString(16)}function X(e,t){t=t||Infinity;for(var r=e.length,n=null,a=[],o=0,d;od){if(!n){if(56319d){-1<(t-=3)&&a.push(239,191,189),n=d;continue}d=(n-55296<<10|d-56320)+65536}else n&&-1<(t-=3)&&a.push(239,191,189);if(n=null,128>d){if(0>(t-=1))break;a.push(d)}else if(2048>d){if(0>(t-=2))break;a.push(192|d>>6,128|63&d)}else if(65536>d){if(0>(t-=3))break;a.push(224|d>>12,128|63&d>>6,128|63&d)}else if(1114112>d){if(0>(t-=4))break;a.push(240|d>>18,128|63&d>>12,128|63&d>>6,128|63&d)}else throw new Error('Invalid code point')}return a}function Y(e){for(var t=[],r=0;r(t-=2));++n)a=e.charCodeAt(n),o=a>>8,d=a%256,r.push(d),r.push(o);return r}function J(e){return ee.toByteArray(V(e))}function $(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function Q(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */var ee=r(204),te=r(205),re=r(100);t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=e.TYPED_ARRAY_SUPPORT===void 0?function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&'function'==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}():e.TYPED_ARRAY_SUPPORT,t.kMaxLength=i(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,r){return f(null,e,t,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,'undefined'!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,r){return l(null,e,t,r)},c.allocUnsafe=function(e){return u(null,e)},c.allocUnsafeSlow=function(e){return u(null,e)},c.isBuffer=function(e){return!!(null!=e&&e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('Arguments must be Buffers');if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=d(r,n);ar&&(e+=' ... ')),''},c.prototype.compare=function(e,t,r,n,a){if(!c.isBuffer(e))throw new TypeError('Argument must be a Buffer');if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),0>t||r>e.length||0>n||a>this.length)throw new RangeError('out of range index');if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,s=r-t,f=d(o,s),p=this.slice(n,a),l=e.slice(t,r),u=0;ua)&&(r=a),0r||0>t)||t>this.length)throw new RangeError('Attempt to write outside buffer bounds');n||(n='utf8');for(var o=!1;;)switch(n){case'hex':return A(this,e,t,r);case'utf8':case'utf-8':return E(this,e,t,r);case'ascii':return I(this,e,t,r);case'latin1':case'binary':return C(this,e,t,r);case'base64':return P(this,e,t,r);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return T(this,e,t,r);default:if(o)throw new TypeError('Unknown encoding: '+n);n=(''+n).toLowerCase(),o=!0;}},c.prototype.toJSON=function(){return{type:'Buffer',data:Array.prototype.slice.call(this._arr||this,0)}};var ne=4096;c.prototype.slice=function(e,t){var r=this.length;e=~~e,t=t===void 0?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),t=o&&(a-=n(2,8*t)),a},c.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var a=t,o=1,d=this[e+--a];0=o&&(d-=n(2,8*t)),d},c.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),te.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),te.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),te.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),te.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,a){if(e=+e,t|=0,r|=0,!a){var o=n(2,8*r)-1;U(this,e,t,r,o,0)}var d=1,s=0;for(this[t]=255&e;++s>>8):H(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):H(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):F(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t|=0,!a){var o=n(2,8*r-1);U(this,e,t,r,o-1,-o)}var d=0,i=1,s=0;for(this[t]=255&e;++de&&0==s&&0!==this[t+d-1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},c.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t|=0,!a){var o=n(2,8*r-1);U(this,e,t,r,o-1,-o)}var d=r-1,i=1,s=0;for(this[t+d]=255&e;0<=--d&&(i*=256);)0>e&&0==s&&0!==this[t+d+1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=o(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):H(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):H(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):F(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,r){return z(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return z(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return K(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return K(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0t)throw new RangeError('targetStart out of bounds');if(0>r||r>=this.length)throw new RangeError('sourceStart out of bounds');if(0>n)throw new RangeError('sourceEnd out of bounds');n>this.length&&(n=this.length),e.length-ta||!c.TYPED_ARRAY_SUPPORT)for(o=0;oa&&(e=a)}if(void 0!==n&&'string'!=typeof n)throw new TypeError('encoding must be a string');if('string'==typeof n&&!c.isEncoding(n))throw new TypeError('Unknown encoding: '+n)}else'number'==typeof e&&(e&=255);if(0>t||this.length>>=0,r=r===void 0?this.length:r>>>0,e||(e=0);var o;if('number'==typeof e)for(o=t;os.a.toBN(e).toString(10),p=(e)=>'latest'===e||'pending'===e||'earliest'===e,l=(e)=>void 0===e?void 0:p(e)?e:s.a.isHexStrict(e)?Object(i.isString)(e)?e.toLowerCase():e:s.a.numberToHex(e),u=(e)=>{if(e.to&&(e.to=m(e.to)),e.data&&e.input)throw new Error('You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.');if(!e.data&&e.input&&(e.data=e.input,delete e.input),e.data&&!s.a.isHex(e.data))throw new Error('The data field must be HEX encoded data.');return(e.gas||e.gasLimit)&&(e.gas=e.gas||e.gasLimit),['gasPrice','gas','value','nonce'].filter((t)=>void 0!==e[t]).forEach((t)=>{e[t]=s.a.numberToHex(e[t])}),e},b=(e)=>(null!==e.blockNumber&&(e.blockNumber=s.a.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=s.a.hexToNumber(e.transactionIndex)),e.nonce=s.a.hexToNumber(e.nonce),e.gas=s.a.hexToNumber(e.gas),e.gasPrice=f(e.gasPrice),e.value=f(e.value),e.to=e.to&&s.a.isAddress(e.to)?s.a.toChecksumAddress(e.to):null,e.from&&(e.from=s.a.toChecksumAddress(e.from)),e),h=(e)=>{if('string'==typeof e.blockHash&&'string'==typeof e.transactionHash&&'string'==typeof e.logIndex){const t=s.a.sha3(e.blockHash.replace('0x','')+e.transactionHash.replace('0x','')+e.logIndex.replace('0x',''));e.id=`log_${t.replace('0x','').substr(0,8)}`}else e.id||(e.id=null);return null!==e.blockNumber&&(e.blockNumber=s.a.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=s.a.hexToNumber(e.transactionIndex)),null!==e.logIndex&&(e.logIndex=s.a.hexToNumber(e.logIndex)),e.address&&(e.address=s.a.toChecksumAddress(e.address)),e};var m=(e)=>{const t=new c.a(e);if(t.isValid()&&t.isDirect())return t.toAddress().toLowerCase();if(s.a.isAddress(e))return`0x${e.toLowerCase().replace('0x','')}`;throw new Error(`Provided address "${e}" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.`)};var y={inputDefaultBlockNumberFormatter:(e,t)=>void 0===e||null===e?t.defaultBlock:'genesis'===e||'earliest'===e?'0x0':l(e),inputBlockNumberFormatter:l,inputCallFormatter:(e,t)=>{e=u(e);let r=t.defaultAccount;return e.from&&(r=e.from),r&&(e.from=m(r)),e},inputTransactionFormatter:(e,t)=>{if(e=u(e),!Object(i.isNumber)(e.from)&&!Object(i.isObject)(e.from)){if(e.from||(e.from=t.defaultAccount),!e.from&&!Object(i.isNumber)(e.from))throw new Error('The send transactions "from" field must be defined!');e.from=m(e.from)}return e},inputAddressFormatter:m,inputPostFormatter:(e)=>(e.ttl&&(e.ttl=s.a.numberToHex(e.ttl)),e.workToProve&&(e.workToProve=s.a.numberToHex(e.workToProve)),e.priority&&(e.priority=s.a.numberToHex(e.priority)),Object(i.isArray)(e.topics)||(e.topics=e.topics?[e.topics]:[]),e.topics=e.topics.map((e)=>0===e.indexOf('0x')?e:s.a.fromUtf8(e)),e),inputLogFormatter:(e)=>{let t=(e)=>null===e||'undefined'==typeof e?null:(e+='',0===e.indexOf('0x')?e:s.a.fromUtf8(e));return e.fromBlock&&(e.fromBlock=l(e.fromBlock)),e.toBlock&&(e.toBlock=l(e.toBlock)),e.topics=e.topics||[],e.topics=e.topics.map((e)=>Object(i.isArray)(e)?e.map(t):t(e)),t=null,e.address&&(e.address=Object(i.isArray)(e.address)?e.address.map((e)=>m(e)):m(e.address)),e},inputSignFormatter:(e)=>s.a.isHexStrict(e)?e:s.a.utf8ToHex(e),outputBigNumberFormatter:f,outputTransactionFormatter:b,outputTransactionReceiptFormatter:(e)=>{if('object'!=typeof e)throw new Error(`Received receipt is invalid: ${e}`);return null!==e.blockNumber&&(e.blockNumber=s.a.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=s.a.hexToNumber(e.transactionIndex)),e.cumulativeGasUsed=s.a.hexToNumber(e.cumulativeGasUsed),e.gasUsed=s.a.hexToNumber(e.gasUsed),Object(i.isArray)(e.logs)&&(e.logs=e.logs.map(h)),e.contractAddress&&(e.contractAddress=s.a.toChecksumAddress(e.contractAddress)),'undefined'!=typeof e.status&&(e.status=!!parseInt(e.status)),e},outputBlockFormatter:(e)=>(e.gasLimit=s.a.hexToNumber(e.gasLimit),e.gasUsed=s.a.hexToNumber(e.gasUsed),e.size=s.a.hexToNumber(e.size),e.timestamp=s.a.hexToNumber(e.timestamp),null!==e.number&&(e.number=s.a.hexToNumber(e.number)),e.difficulty&&(e.difficulty=f(e.difficulty)),e.totalDifficulty&&(e.totalDifficulty=f(e.totalDifficulty)),Object(i.isArray)(e.transactions)&&e.transactions.forEach((e)=>{if(!Object(i.isString)(e))return b(e)}),e.miner&&(e.miner=s.a.toChecksumAddress(e.miner)),e),outputLogFormatter:h,outputPostFormatter:(e)=>(e.expiry=s.a.hexToNumber(e.expiry),e.sent=s.a.hexToNumber(e.sent),e.ttl=s.a.hexToNumber(e.ttl),e.workProved=s.a.hexToNumber(e.workProved),e.topics||(e.topics=[]),e.topics=e.topics.map((e)=>s.a.toUtf8(e)),e),outputSyncingFormatter:(e)=>(e.startingBlock=s.a.hexToNumber(e.startingBlock),e.currentBlock=s.a.hexToNumber(e.currentBlock),e.highestBlock=s.a.hexToNumber(e.highestBlock),e.knownStates&&(e.knownStates=s.a.hexToNumber(e.knownStates),e.pulledStates=s.a.hexToNumber(e.pulledStates)),e)};r.d(t,'a',function(){return n}),r.d(t,'b',function(){return y})},function(e,t,r){function n(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return d(e,t,r)}var o=r(3),d=o.Buffer;d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?e.exports=o:(n(o,t),t.Buffer=a),n(d,a),a.from=function(e,t,r){if('number'==typeof e)throw new TypeError('Argument must not be a number');return d(e,t,r)},a.alloc=function(e,t,r){if('number'!=typeof e)throw new TypeError('Argument must be a number');var n=d(e);return void 0===t?n.fill(0):'string'==typeof r?n.fill(t,r):n.fill(t),n},a.allocUnsafe=function(e){if('number'!=typeof e)throw new TypeError('Argument must be a number');return d(e)},a.allocUnsafeSlow=function(e){if('number'!=typeof e)throw new TypeError('Argument must be a number');return o.SlowBuffer(e)}},function(e){var t=function(){return this}();try{t=t||Function('return this')()||(1,eval)('this')}catch(r){'object'==typeof window&&(t=window)}e.exports=t},function(e,t,r){for(var n=r(169),a=r(93),o=r(36),d=r(24),s=r(25),c=r(71),f=r(23),p=f('iterator'),l=f('toStringTag'),u=c.Array,b={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=a(b),m=0;mthis.providersModuleFactory.createBatchRequest(this.currentProvider),null!==d&&'undefined'!=typeof d)return this.methodModelFactory=d,this.extend.formatters=this.methodModelFactory.formatters,new Proxy(this,{get:this.proxyHandler})}get currentProvider(){return this._currentProvider}set currentProvider(e){throw Error('The property currentProvider read-only!')}setProvider(e,t){if(!this.isSameProvider(e)){if(this.clearSubscriptions(),this._currentProvider=this.providerAdapterResolver.resolve(e,t),0!!r.setProvider(e,t));return!!(r&&this._currentProvider)}return!1}isSameProvider(e){return Object(a.isObject)(e)?this.currentProvider.provider.constructor.name===e.constructor.name&&this.currentProvider.host===e.host:this.currentProvider.host===e}clearSubscriptions(){'undefined'!=typeof this.currentProvider.clearSubscriptions&&0{class t extends AbstractMethodModel{constructor(t,r){super(e.call,e.params,t,r)}beforeExecution(t,r){e.inputFormatters.forEach((e,n)=>{e&&(t[n]=e(t[n],r))})}afterExecution(t){return Object(a.isArray)(t)?(t=t.map((t)=>e.outputFormatter&&t?e.outputFormatter(t):t),t):(e.outputFormatter&&result&&(t=e.outputFormatter(t)),t)}}r.methodModelFactory.methodModels[e.name]=t})}proxyHandler(e,t){if(e.methodModelFactory.hasMethodModel(t)){if('undefined'!=typeof e[t])throw new Error(`Duplicated method ${t}. This method is defined as RPC call and as Object method.`);const r=e.methodModelFactory.createMethodModel(t),n=()=>{if(r.methodArguments=arguments,r.parameters.length!==r.parametersAmount)throw Error(`Invalid parameters length the expected length would be ${r.parametersAmount} and not ${r.parameters.length}`);return e.methodController.execute(r,e.accounts,e)};return n.methodModel=r,n.request=r.request,n}return e[t]}throwIfMissing(){throw Error('Parameter with name ${name} is missing')}}r.d(t,'a',function(){return o})},function(e){function t(e,t){if(!e)throw new Error(t||'Assertion failed')}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||'Assertion failed: '+e+' != '+t)}},function(e,t,r){var n=String.fromCharCode;const a=r(230),o=(e,t)=>parseInt(e.slice(2*t+2,2*t+4),16),d=(e)=>(e.length-2)/2,i=(e,t)=>t.length===2*e+2?t:i(e,'0x0'+t.slice(2)),s=(e,t)=>t.length===2*e+2?t:s(e,t+'0'),c=(e)=>{let t=[];for(let r=2,n=e.length;r{let t='0x';for(let r=0,n=e.length,a;ra?'0':'')+a.toString(16);return t};e.exports={random:(e)=>{let t='undefined'!=typeof window&&window.crypto&&window.crypto.getRandomValues?window.crypto.getRandomValues(new Uint8Array(e)):r(108).randomBytes(e);let n='0x';for(let r=0;re.concat(t.slice(2)),flatten:(e)=>'0x'+e.reduce((e,t)=>e+t.slice(2),''),slice:(e,t,r)=>'0x'+r.slice(2*e+2,2*t+2),reverse:(e)=>{let t='0x';for(let r=0,n=d(e);r{let t='0x';for(let r=0;r{let t='';for(let r=2;r{const t=(e)=>{const t=e.toString(16);return 2>t.length?'0'+t:t};let r='0x';for(let n=0,a;n!=e.length;n++){if(a=e.charCodeAt(n),128>a){r+=t(a);continue}if(2048>a)r+=t(192|a>>6);else{if(55295a){if(++n==e.length)return null;let o=e.charCodeAt(n);if(56320>o||57343>18),r+=t(128|63&a>>12)}else r+=t(224|a>>12);r+=t(128|63&a>>6)}r+=t(128|63&a)}return r},toString:(e)=>{let t='',r=0,a=d(e);for(;rd){if(r>=a)return null;d=(31&d)<<6|63&o(e,r)}else if(223d){if(r+1>=a)return null;d=(15&d)<<12|(63&o(e,r))<<6|63&o(e,++r)}else if(239d){if(r+2>=a)return null;d=(7&d)<<18|(63&o(e,r))<<12|(63&o(e,++r))<<6|63&o(e,++r)}else return null;++r}if(65535>=d)t+=n(d);else if(1114111>=d)d-=65536,t+=n(55296|d>>10),t+=n(56320|1023&d);else return null}return t},fromNumber:(e)=>{let t=e.toString(16);return 0==t.length%2?'0x'+t:'0x0'+t},toNumber:(e)=>parseInt(e.slice(2),16),fromNat:(e)=>'0x0'===e?'0x':0==e.length%2?e:'0x0'+e.slice(2),toNat:(e)=>'0'===e[2]?'0x'+e.slice(3):e,fromArray:f,toArray:c,fromUint8Array:(e)=>f([].slice.call(e,0)),toUint8Array:(e)=>new Uint8Array(c(e))}},function(e,t,r){(function(t){const n=r(13),a=r(85),o=r(10),d=r(21),i=new o.ec('secp256k1'),{keccak256:s,keccak256s:c}=r(18),f=(e)=>{const t=c(e.slice(2));let r='0x';for(let n=0;40>n;n++)r+=7{const r=new t(e.slice(2),'hex'),n=i.keyFromPrivate(r),a='0x'+n.getPublic(!1,'hex').slice(2),o=s(a),d=f('0x'+o.slice(-40));return{address:d,privateKey:e}},l=([e,t,r])=>n.flatten([t,r,e]),u=(e)=>[n.slice(64,n.length(e),e),n.slice(0,32,e),n.slice(32,64,e)],b=(e)=>(r,o)=>{const d=i.keyFromPrivate(new t(o.slice(2),'hex')).sign(new t(r.slice(2),'hex'),{canonical:!0});return l([a.fromString(n.fromNumber(e+d.recoveryParam)),n.pad(32,n.fromNat('0x'+d.r.toString(16))),n.pad(32,n.fromNat('0x'+d.s.toString(16)))])},h=b(27);e.exports={create:(e)=>{const t=s(n.concat(n.random(32),e||n.random(32))),r=n.concat(n.concat(n.random(32),t),n.random(32)),a=s(r);return p(a)},toChecksum:f,fromPrivate:p,sign:h,makeSigner:b,recover:(e,r)=>{const a=u(r),o={v:n.toNumber(a[0]),r:a[1].slice(2),s:a[2].slice(2)},d=i.recoverPubKey(new t(e.slice(2),'hex'),o,2>o.v?o.v:1-o.v%2),c='0x'+d.encode('hex',!1).slice(2),p=s(c),l=f('0x'+p.slice(-40));return l},encodeSignature:l,decodeSignature:u}}).call(this,r(3).Buffer)},function(e,t,r){r(75)('replace',2,function(e,t,r){return[function(n,a){'use strict';var o=e(this),d=n==void 0?void 0:n[t];return d===void 0?r.call(o+'',n,a):d.call(n,o,a)},r]})},function(e,t,r){'use strict';r(189);var n=r(35),a=r(97),o=r(28),d='toString',i=/./[d],s=function(e){r(36)(RegExp.prototype,d,e,!0)};r(49)(function(){return'/a/b'!=i.call({source:'a',flags:'b'})})?s(function(){var e=n(this);return'/'.concat(e.source,'/','flags'in e?e.flags:!o&&e instanceof RegExp?a.call(e):void 0)}):i.name!=d&&s(function(){return i.call(this)})},function(e,t,r){'use strict';function n(e){return(e>>>24|65280&e>>>8|16711680&e<<8|(255&e)<<24)>>>0}function a(e){return 1===e.length?'0'+e:e}function o(e){return 7===e.length?'0'+e:6===e.length?'00'+e:5===e.length?'000'+e:4===e.length?'0000'+e:3===e.length?'00000'+e:2===e.length?'000000'+e:1===e.length?'0000000'+e:e}var d=r(12),i=r(4);t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(!('string'==typeof e))for(n=0;n>8,d=255&a;o?r.push(o,d):r.push(d)}else if('hex'===t)for(e=e.replace(/[^a-z0-9]+/ig,''),0!=e.length%2&&(e='0'+e),n=0;n>>0}return o},t.split32=function(e,t){for(var r=Array(4*e.length),n=0,a=0,o;n>>24,r[a+1]=255&o>>>16,r[a+2]=255&o>>>8,r[a+3]=255&o):(r[a+3]=o>>>24,r[a+2]=255&o>>>16,r[a+1]=255&o>>>8,r[a]=255&o);return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(t,r,n,a,o){return t+r+n+a+o>>>0},t.sum64=function(e,t,r,n){var a=e[t],o=e[t+1],d=n+o>>>0,i=(d>>0,e[t+1]=d},t.sum64_hi=function(e,t,r,n){var a=(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,a,o,d,i){var s=0,c=t;c=c+n>>>0,s+=c>>0,s+=c>>0,s+=c>>0},t.sum64_4_lo=function(e,t,r,n,a,o,d,i){return t+n+o+i>>>0},t.sum64_5_hi=function(e,t,r,n,a,o,d,i,s,c){var f=0,p=t;p=p+n>>>0,f+=p>>0,f+=p>>0,f+=p>>0,f+=p>>0},t.sum64_5_lo=function(e,t,r,n,a,o,d,i,s,c){return t+n+o+i+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e){const t=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'],r=[1,256,65536,16777216],n=[0,8,16,24],a=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],o=(e)=>({blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:((e)=>[].concat(e,e,e,e,e))([0,0,0,0,0,0,0,0,0,0])}),d=(e,a)=>{for(var o=a.length,d=e.blocks,f=e.blockCount<<2,p=e.blockCount,l=e.outputBlocks,u=e.s,s=0,b,i;s>2]|=a[s]<i?d[b>>2]|=i<i?(d[b>>2]|=(192|i>>6)<>2]|=(128|63&i)<i||57344<=i?(d[b>>2]|=(224|i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|63&i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<=f){for(e.start=b-f,e.block=d[p],b=0;b>2]|=r[3&b],e.lastByteIndex===f)for(d[0]=d[p],b=1;b>4]+t[15&y]+t[15&y>>12]+t[15&y>>8]+t[15&y>>20]+t[15&y>>16]+t[15&y>>28]+t[15&y>>24];0==m%p&&(c(u),b=0)}return'0x'+h},c=(e)=>{var t,r,o,n,d,i,s,c,f,p,l,u,b,h,m,y,g,v,k,x,S,w,A,E,I,C,P,T,B,N,R,M,L,j,O,D,U,H,F,q,z,K,V,G,W,X,Y,Z,J,$,Q,ee,te,re,ne,ae,oe,de,ie,se,ce,fe,pe;for(o=0;48>o;o+=2)n=e[0]^e[10]^e[20]^e[30]^e[40],d=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],p=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],u=e[8]^e[18]^e[28]^e[38]^e[48],b=e[9]^e[19]^e[29]^e[39]^e[49],t=u^(i<<1|s>>>31),r=b^(s<<1|i>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=n^(c<<1|f>>>31),r=d^(f<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=i^(p<<1|l>>>31),r=s^(l<<1|p>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(u<<1|b>>>31),r=f^(b<<1|u>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=p^(n<<1|d>>>31),r=l^(d<<1|n>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,h=e[0],m=e[1],X=e[11]<<4|e[10]>>>28,Y=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,B=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,O=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,fe=e[42]<<2|e[43]>>>30,pe=e[43]<<2|e[42]>>>30,re=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,k=e[24]<<11|e[25]>>>21,$=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,M=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,E=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,ae=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,H=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,x=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,ee=e[47]<<24|e[46]>>>8,te=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,P=e[19]<<20|e[18]>>>12,de=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,w=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=h^~y&v,e[1]=m^~g&k,e[10]=E^~C&T,e[11]=I^~P&B,e[20]=j^~D&H,e[21]=O^~U&F,e[30]=G^~X&Z,e[31]=W^~Y&J,e[40]=re^~ae&de,e[41]=ne^~oe&ie,e[2]=y^~v&x,e[3]=g^~k&S,e[12]=C^~T&N,e[13]=P^~B&R,e[22]=D^~H&q,e[23]=U^~F&z,e[32]=X^~Z&$,e[33]=Y^~J&Q,e[42]=ae^~de&se,e[43]=oe^~ie&ce,e[4]=v^~x&w,e[5]=k^~S&A,e[14]=T^~N&M,e[15]=B^~R&L,e[24]=H^~q&K,e[25]=F^~z&V,e[34]=Z^~$&ee,e[35]=J^~Q&te,e[44]=de^~se&fe,e[45]=ie^~ce&pe,e[6]=x^~w&h,e[7]=S^~A&m,e[16]=N^~M&E,e[17]=R^~L&I,e[26]=q^~K&j,e[27]=z^~V&O,e[36]=$^~ee&G,e[37]=Q^~te&W,e[46]=se^~fe&re,e[47]=ce^~pe&ne,e[8]=w^~h&y,e[9]=A^~m&g,e[18]=M^~E&C,e[19]=L^~I&P,e[28]=K^~j&D,e[29]=V^~O&U,e[38]=ee^~G&X,e[39]=te^~W&Y,e[48]=fe^~re&ae,e[49]=pe^~ne&oe,e[0]^=a[o],e[1]^=a[o+1]},i=(e)=>(t)=>{var r;if('0x'===t.slice(0,2)){r=[];for(var n=2,a=t.length;n{const t=(e)=>0==e.length%2?e:'0'+e,r=(e)=>t(e.toString(16)),n=(e,t)=>56>e?r(t+e):r(t+r(e).length/2+55)+r(e),a=(e)=>{if('string'==typeof e){const t=e.slice(2),r=2!=t.length||'80'<=t?n(t.length/2,128):'';return r+t}else{const t=e.map(a).join(''),r=n(t.length/2,192);return r+t}};return'0x'+a(e)},decode:(e)=>{let t=2;const r=()=>{if(t>=e.length)throw'';const r=e.slice(t,t+2);return'80'>r?(t+=2,'0x'+r):'c0'>r?a():o()},n=()=>{const r=parseInt(e.slice(t,t+=2),16)%64;return 56>r?r:parseInt(e.slice(t,t+=2*(r-55)),16)},a=()=>{const r=n();return'0x'+e.slice(t,t+=2*r)},o=()=>{const e=2*n()+t;let a=[];for(;ti)throw new Error('[ethjs-unit] while converting number '+e+' to wei, too many decimal places');for(;u.lengthr||256<=r||parseInt(r+'')!=r)return!1;return!0}function d(e){if(null==e&&u.throwError('cannot convert null value to array',u.INVALID_ARGUMENT,{arg:'value',value:e}),n(e)&&(e=e.toHexString()),'string'==typeof e){var t=e.match(/^(0x)?[0-9a-fA-F]*$/);t||u.throwError('invalid hexidecimal string',u.INVALID_ARGUMENT,{arg:'value',value:e}),'0x'!==t[1]&&u.throwError('hex string must have 0x prefix',u.INVALID_ARGUMENT,{arg:'value',value:e}),e=e.substring(2),e.length%2&&(e='0'+e);for(var r=[],d=0;de&&u.throwError('cannot hexlify negative value',u.INVALID_ARGUMENT,{arg:'value',value:e});for(var t='';e;)t=b[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t='0'+t),'0x'+t):'0x00'}if('string'==typeof e){var r=e.match(/^(0x)?[0-9a-fA-F]*$/);return r||u.throwError('invalid hexidecimal string',u.INVALID_ARGUMENT,{arg:'value',value:e}),'0x'!==r[1]&&u.throwError('hex string must have 0x prefix',u.INVALID_ARGUMENT,{arg:'value',value:e}),e.length%2&&(e='0x0'+e.substring(2)),e}if(o(e)){for(var a=[],d=0,i;d>4]+b[15&i]);return'0x'+a.join('')}return u.throwError('invalid hexlify value',null,{arg:'value',value:e}),'never'}function f(e,t){for(s(e)||u.throwError('invalid hex string',u.INVALID_ARGUMENT,{arg:'value',value:e});e.length<2*t+2;)e='0x0'+e.substring(2);return e}function p(e){return e&&null!=e.r&&null!=e.s}function l(e){var t=0,n='0x',a='0x';if(p(e)){null==e.v&&null==e.recoveryParam&&u.throwError('at least on of recoveryParam or v must be specified',u.INVALID_ARGUMENT,{argument:'signature',value:e}),n=f(e.r,32),a=f(e.s,32),t=e.v,'string'==typeof t&&(t=parseInt(t,16));var o=e.recoveryParam;null==o&&null!=e.v&&(o=1-t%2),t=27+o}else{var i=d(e);if(65!==i.length)throw new Error('invalid signature');n=c(i.slice(0,32)),a=c(i.slice(32,64)),t=i[64],27!==t&&28!==t&&(t=27+t%2)}return{r:n,s:a,recoveryParam:t-27,v:t}}Object.defineProperty(t,'__esModule',{value:!0});var u=r(53);t.AddressZero='0x0000000000000000000000000000000000000000',t.HashZero='0x0000000000000000000000000000000000000000000000000000000000000000',t.isArrayish=o,t.arrayify=d,t.concat=i,t.stripZeros=function(e){var t=d(e);if(0===t.length)return t;for(var r=0;0===t[r];)r++;return r&&(t=t.slice(r)),t},t.padZeros=function(e,t){if(e=d(e),t>>32-t}function s(e,t,r,n,a,d,i){return 0|o(0|e+(t&r|~t&n)+a+d,i)+t}function f(e,t,r,n,a,i,c){return 0|o(0|e+(t&n|r&~n)+a+i,c)+t}function p(e,t,r,n,a,d,i){return 0|o(0|e+(t^r^n)+a+d,i)+t}function l(e,t,r,n,a,i,c){return 0|o(0|e+(r^(t|~n))+a+i,c)+t}var a=r(4),d=r(109),c=Array(16);a(n,d),n.prototype._update=function(){for(var e=c,t=0;16>t;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,a=this._c,o=this._d;r=s(r,n,a,o,e[0],3614090360,7),o=s(o,r,n,a,e[1],3905402710,12),a=s(a,o,r,n,e[2],606105819,17),n=s(n,a,o,r,e[3],3250441966,22),r=s(r,n,a,o,e[4],4118548399,7),o=s(o,r,n,a,e[5],1200080426,12),a=s(a,o,r,n,e[6],2821735955,17),n=s(n,a,o,r,e[7],4249261313,22),r=s(r,n,a,o,e[8],1770035416,7),o=s(o,r,n,a,e[9],2336552879,12),a=s(a,o,r,n,e[10],4294925233,17),n=s(n,a,o,r,e[11],2304563134,22),r=s(r,n,a,o,e[12],1804603682,7),o=s(o,r,n,a,e[13],4254626195,12),a=s(a,o,r,n,e[14],2792965006,17),n=s(n,a,o,r,e[15],1236535329,22),r=f(r,n,a,o,e[1],4129170786,5),o=f(o,r,n,a,e[6],3225465664,9),a=f(a,o,r,n,e[11],643717713,14),n=f(n,a,o,r,e[0],3921069994,20),r=f(r,n,a,o,e[5],3593408605,5),o=f(o,r,n,a,e[10],38016083,9),a=f(a,o,r,n,e[15],3634488961,14),n=f(n,a,o,r,e[4],3889429448,20),r=f(r,n,a,o,e[9],568446438,5),o=f(o,r,n,a,e[14],3275163606,9),a=f(a,o,r,n,e[3],4107603335,14),n=f(n,a,o,r,e[8],1163531501,20),r=f(r,n,a,o,e[13],2850285829,5),o=f(o,r,n,a,e[2],4243563512,9),a=f(a,o,r,n,e[7],1735328473,14),n=f(n,a,o,r,e[12],2368359562,20),r=p(r,n,a,o,e[5],4294588738,4),o=p(o,r,n,a,e[8],2272392833,11),a=p(a,o,r,n,e[11],1839030562,16),n=p(n,a,o,r,e[14],4259657740,23),r=p(r,n,a,o,e[1],2763975236,4),o=p(o,r,n,a,e[4],1272893353,11),a=p(a,o,r,n,e[7],4139469664,16),n=p(n,a,o,r,e[10],3200236656,23),r=p(r,n,a,o,e[13],681279174,4),o=p(o,r,n,a,e[0],3936430074,11),a=p(a,o,r,n,e[3],3572445317,16),n=p(n,a,o,r,e[6],76029189,23),r=p(r,n,a,o,e[9],3654602809,4),o=p(o,r,n,a,e[12],3873151461,11),a=p(a,o,r,n,e[15],530742520,16),n=p(n,a,o,r,e[2],3299628645,23),r=l(r,n,a,o,e[0],4096336452,6),o=l(o,r,n,a,e[7],1126891415,10),a=l(a,o,r,n,e[14],2878612391,15),n=l(n,a,o,r,e[5],4237533241,21),r=l(r,n,a,o,e[12],1700485571,6),o=l(o,r,n,a,e[3],2399980690,10),a=l(a,o,r,n,e[10],4293915773,15),n=l(n,a,o,r,e[1],2240044497,21),r=l(r,n,a,o,e[8],1873313359,6),o=l(o,r,n,a,e[15],4264355552,10),a=l(a,o,r,n,e[6],2734768916,15),n=l(n,a,o,r,e[13],1309151649,21),r=l(r,n,a,o,e[4],4149444226,6),o=l(o,r,n,a,e[11],3174756917,10),a=l(a,o,r,n,e[2],718787259,15),n=l(n,a,o,r,e[9],3951481745,21),this._a=0|this._a+r,this._b=0|this._b+n,this._c=0|this._c+a,this._d=0|this._d+o},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(4294967295>=r)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0;this._block.writeUInt32BE((r-n)/4294967296,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},n.prototype._update=function(){throw new Error('_update must be implemented by subclass')},e.exports=n},function(e,t,r){(function(t){function n(e){var r;'object'!=typeof e||t.isBuffer(e)||(r=e.passphrase,e=e.key),'string'==typeof e&&(e=new t(e));var n=i(e,r),d=n.tag,s=n.data,c,f;switch(d){case'CERTIFICATE':f=o.certificate.decode(s,'der').tbsCertificate.subjectPublicKeyInfo;case'PUBLIC KEY':switch(f||(f=o.PublicKey.decode(s,'der')),c=f.algorithm.algorithm.join('.'),c){case'1.2.840.113549.1.1.1':return o.RSAPublicKey.decode(f.subjectPublicKey.data,'der');case'1.2.840.10045.2.1':return f.subjectPrivateKey=f.subjectPublicKey,{type:'ec',data:f};case'1.2.840.10040.4.1':return f.algorithm.params.pub_key=o.DSAparam.decode(f.subjectPublicKey.data,'der'),{type:'dsa',data:f.algorithm.params};default:throw new Error('unknown key id '+c);}throw new Error('unknown key type '+d);case'ENCRYPTED PRIVATE KEY':s=o.EncryptedPrivateKey.decode(s,'der'),s=a(s,r);case'PRIVATE KEY':switch(f=o.PrivateKey.decode(s,'der'),c=f.algorithm.algorithm.join('.'),c){case'1.2.840.113549.1.1.1':return o.RSAPrivateKey.decode(f.subjectPrivateKey,'der');case'1.2.840.10045.2.1':return{curve:f.algorithm.curve,privateKey:o.ECPrivateKey.decode(f.subjectPrivateKey,'der').privateKey};case'1.2.840.10040.4.1':return f.algorithm.params.priv_key=o.DSAparam.decode(f.subjectPrivateKey,'der'),{type:'dsa',params:f.algorithm.params};default:throw new Error('unknown key id '+c);}throw new Error('unknown key type '+d);case'RSA PUBLIC KEY':return o.RSAPublicKey.decode(s,'der');case'RSA PRIVATE KEY':return o.RSAPrivateKey.decode(s,'der');case'DSA PRIVATE KEY':return{type:'dsa',params:o.DSAPrivateKey.decode(s,'der')};case'EC PRIVATE KEY':return s=o.ECPrivateKey.decode(s,'der'),{curve:s.parameters.value,privateKey:s.privateKey};default:throw new Error('unknown key type '+d);}}function a(e,r){var n=e.algorithm.decrypt.kde.kdeparams.salt,a=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=d[e.algorithm.decrypt.cipher.algo.join('.')],i=e.algorithm.decrypt.cipher.iv,f=e.subjectPrivateKey,p=parseInt(o.split('-')[1],10)/8,l=c.pbkdf2Sync(r,n,a,p),u=s.createDecipheriv(o,l,i),b=[];return b.push(u.update(f)),b.push(u.final()),t.concat(b)}var o=r(283),d=r(295),i=r(296),s=r(57),c=r(116);e.exports=n,n.signature=o.signature}).call(this,r(3).Buffer)},function(e,t,r){var n=r(48);e.exports=function(e){if(!n(e))throw TypeError(e+' is not an object!');return e}},function(e,t,r){var n=r(24),a=r(25),o=r(50),d=r(70)('src'),i='toString',s=Function[i],c=(''+s).split(i);r(69).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,r,i){var s='function'==typeof r;s&&(o(r,'name')||a(r,'name',t));e[t]===r||(s&&(o(r,d)||a(r,d,e[t]?''+e[t]:c.join(t+''))),e===n?e[t]=r:i?e[t]?e[t]=r:a(e,t,r):(delete e[t],a(e,t,r)))})(Function.prototype,i,function(){return'function'==typeof this&&this[d]||s.call(this)})},function(e,t,r){'use strict';function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function a(e,t,r){if(e&&d.isObject(e)&&e instanceof n)return e;var a=new n;return a.parse(e,t,r),a}var o=r(101),d=r(209);t.parse=a,t.resolve=function(e,t){return a(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?a(e,!1,!0).resolveObject(t):t},t.format=function(e){return d.isString(e)&&(e=a(e)),e instanceof n?e.format():n.prototype.format.call(e)},t.Url=n;var c=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=['{','}','|','\\','^','`'].concat(['<','>','"','`',' ','\r','\n','\t']),p=['\''].concat(f),l=['%','/','?',';','#'].concat(p),u=['/','?','#'],b=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=r(210);n.prototype.parse=function(e,t,r){if(!d.isString(e))throw new TypeError('Parameter \'url\' must be a string, not '+typeof e);var n=e.indexOf('?'),a=-1!==n&&n255?'':this.hostname.toLowerCase(),N||(this.hostname=o.toASCII(this.hostname));var F=this.port?':'+this.port:'',q=this.hostname||'';this.host=q+F,this.href+=this.host,N&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),'/'!==S[0]&&(S='/'+S))}if(!m[E])for(var P=0,M=p.length,z;Pv.length&&v.unshift(''),r.pathname=v.join('/')}else r.pathname=e.pathname;if(r.search=e.search,r.query=e.query,r.host=e.host||'',r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var k=r.pathname||'',p=r.search||'';r.path=k+p}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var s=r.pathname&&'/'===r.pathname.charAt(0),x=e.host||e.pathname&&'/'===e.pathname.charAt(0),S=x||s||r.host&&e.pathname,w=S,A=r.pathname&&r.pathname.split('/')||[],v=e.pathname&&e.pathname.split('/')||[],E=r.protocol&&!g[r.protocol];if(E&&(r.hostname='',r.port=null,r.host&&(''===A[0]?A[0]=r.host:A.unshift(r.host)),r.host='',e.protocol&&(e.hostname=null,e.port=null,e.host&&(''===v[0]?v[0]=e.host:v.unshift(e.host)),e.host=null),S=S&&(''===v[0]||''===A[0])),x)r.host=e.host||''===e.host?e.host:r.host,r.hostname=e.hostname||''===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,A=v;else if(v.length)A||(A=[]),A.pop(),A=A.concat(v),r.search=e.search,r.query=e.query;else if(!d.isNullOrUndefined(e.search)){if(E){r.hostname=r.host=A.shift();var I=!!(r.host&&0=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24,a[o++]=255&e>>>16,a[o++]=255&e>>>8,a[o++]=255&e}else for(a[o++]=255&e,a[o++]=255&e>>>8,a[o++]=255&e>>>16,a[o++]=255&e>>>24,a[o++]=0,a[o++]=0,a[o++]=0,a[o++]=0,d=8;do;o++)r+='00';if(name=n(t),name)for(var d=name.split('.'),o=d.length-1,i;0<=o;o--)i=a(d[o]),r=a(new e(r+i,'hex'));return'0x'+r},t.normalize=n}).call(this,r(3).Buffer)},function(e,t,r){var n=r(35),a=r(171),o=r(172),d=Object.defineProperty;t.f=r(28)?Object.defineProperty:function(e,t,r){if(n(e),t=o(t,!0),n(r),a)try{return d(e,t,r)}catch(t){}if('get'in r||'set'in r)throw TypeError('Accessors not supported!');return'value'in r&&(e[t]=r.value),e}},function(e){e.exports=function(e){return'object'==typeof e?null!==e:'function'==typeof e}},function(e){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e){var t={}.hasOwnProperty;e.exports=function(e,r){return t.call(e,r)}},function(e){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],!e.children&&(e.children=[]),Object.defineProperty(e,'loaded',{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,'id',{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){r(75)('split',2,function(e,t,n){'use strict';var a=r(193),o=n,d=[].push,i='split',s='length',c='lastIndex';if('c'=='abbc'[i](/(b)*/)[1]||4!='test'[i](/(?:)/,-1)[s]||2!='ab'[i](/(?:ab)*/)[s]||4!='.'[i](/(.?)(.?)/)[s]||1<'.'[i](/()()/)[s]||''[i](/.?/)[s]){var f=/()??/.exec('')[1]===void 0;n=function(e,t){var r=this+'';if(void 0===e&&0===t)return[];if(!a(e))return o.call(r,e,t);var n=[],p=(e.ignoreCase?'i':'')+(e.multiline?'m':'')+(e.unicode?'u':'')+(e.sticky?'y':''),l=0,u=void 0===t?4294967295:t>>>0,b=new RegExp(e.source,p+'g'),h,m,y,g,v;for(f||(h=new RegExp('^'+b.source+'$(?!\\s)',p));(m=b.exec(r))&&(y=m.index+m[0][s],!(y>l&&(n.push(r.slice(l,m.index)),!f&&1=u)));)b[c]===m.index&&b[c]++;return l===r[s]?(g||!b.test(''))&&n.push(''):n.push(r.slice(l)),n[s]>u?n.slice(0,u):n}}else'0'[i](void 0,0)[s]&&(n=function(e,t){return void 0===e&&0===t?[]:o.call(this,e,t)});return[function(r,a){var o=e(this),d=r==void 0?void 0:r[t];return d===void 0?n.call(o+'',r,a):d.call(r,o,a)},n]})},function(e,t){'use strict';function r(e,r,n){if(o)throw new Error('unknown error');r||(r=t.UNKNOWN_ERROR),n||(n={});var a=[];Object.keys(n).forEach(function(e){try{a.push(e+'='+JSON.stringify(n[e]))}catch(t){a.push(e+'='+JSON.stringify(n[e].toString()))}});var d=e;a.length&&(e+=' ('+a.join(', ')+')');var i=new Error(e);throw i.reason=d,i.code=r,Object.keys(n).forEach(function(e){i[e]=n[e]}),i}function n(e,n){a&&r('error censorship permanent',t.UNSUPPORTED_OPERATION,{operation:'setCersorship'}),o=!!e,a=!!n}Object.defineProperty(t,'__esModule',{value:!0}),t.UNKNOWN_ERROR='UNKNOWN_ERROR',t.NOT_IMPLEMENTED='NOT_IMPLEMENTED',t.MISSING_NEW='MISSING_NEW',t.CALL_EXCEPTION='CALL_EXCEPTION',t.INVALID_ARGUMENT='INVALID_ARGUMENT',t.MISSING_ARGUMENT='MISSING_ARGUMENT',t.UNEXPECTED_ARGUMENT='UNEXPECTED_ARGUMENT',t.NUMERIC_FAULT='NUMERIC_FAULT',t.UNSUPPORTED_OPERATION='UNSUPPORTED_OPERATION';var a=!1,o=!1;t.throwError=r,t.checkNew=function(e,n){e instanceof n||r('missing new',t.MISSING_NEW,{name:n.name})},t.checkArgumentCount=function(e,n,a){a||(a=''),en&&r('too many arguments'+a,t.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})},t.setCensorship=n},function(e,t,r){'use strict';(function(t){e.exports=t.version&&0!==t.version.indexOf('v0.')&&(0!==t.version.indexOf('v1.')||0===t.version.indexOf('v1.8.'))?t:{nextTick:function(e,r,n,a){if('function'!=typeof e)throw new TypeError('"callback" argument must be a function');var o=arguments.length,d,s;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,a)});default:for(d=Array(o-1),s=0;s=e)return 0;return 6==e>>5?2:14==e>>4?3:30==e>>3?4:-1}function s(e,t,r){var n=t.length-1;if(n=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString('utf16le',t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):'';if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString('utf16le',0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0==r?e.toString('base64',t):(this.lastNeed=3-r,this.lastTotal=3,1==r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString('base64',t,e.length-r))}function u(e){var t=e&&e.length?this.write(e):'';return this.lastNeed?t+this.lastChar.toString('base64',0,3-this.lastNeed):t}function b(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):''}var m=r(6).Buffer,y=m.isEncoding||function(e){switch(e=''+e,e&&e.toLowerCase()){case'hex':case'utf8':case'utf-8':case'ascii':case'binary':case'base64':case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':case'raw':return!0;default:return!1;}};t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return'';var t,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return'';r=this.lastNeed,this.lastNeed=0}else r=0;return r>>24]^d[255&f>>>16]^i[255&p>>>8]^s[255&l]^t[u++],m=o[f>>>24]^d[255&p>>>16]^i[255&l>>>8]^s[255&c]^t[u++],y=o[p>>>24]^d[255&l>>>16]^i[255&c>>>8]^s[255&f]^t[u++],g=o[l>>>24]^d[255&c>>>16]^i[255&f>>>8]^s[255&p]^t[u++],c=h,f=m,p=y,l=g;return h=(n[c>>>24]<<24|n[255&f>>>16]<<16|n[255&p>>>8]<<8|n[255&l])^t[u++],m=(n[f>>>24]<<24|n[255&p>>>16]<<16|n[255&l>>>8]<<8|n[255&c])^t[u++],y=(n[p>>>24]<<24|n[255&l>>>16]<<16|n[255&c>>>8]<<8|n[255&f])^t[u++],g=(n[l>>>24]<<24|n[255&c>>>16]<<16|n[255&f>>>8]<<8|n[255&p])^t[u++],h>>>=0,m>>>=0,y>>>=0,g>>>=0,[h,m,y,g]}function d(e){this._key=n(e),this._reset()}var s=r(6).Buffer,i=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var e=Array(256),r=0;256>r;r++)e[r]=128>r?r<<1:283^r<<1;for(var n=[],a=[],o=[[],[],[],[]],d=[[],[],[],[]],s=0,c=0,f=0,i;256>f;++f){i=c^c<<1^c<<2^c<<3^c<<4,i=99^(i>>>8^255&i),n[s]=i,a[i]=s;var p=e[s],l=e[p],u=e[l],b=257*e[i]^16843008*i;o[0][s]=b<<24|b>>>8,o[1][s]=b<<16|b>>>16,o[2][s]=b<<8|b>>>24,o[3][s]=b,b=16843009*u^65537*l^257*p^16843008*s,d[0][i]=b<<24|b>>>8,d[1][i]=b<<16|b>>>16,d[2][i]=b<<8|b>>>24,d[3][i]=b,0==s?s=c=1:(s=p^e[e[e[u^p]]],c^=e[e[c]])}return{SBOX:n,INV_SBOX:a,SUB_MIX:o,INV_SUB_MIX:d}}();d.blockSize=16,d.keySize=32,d.prototype.blockSize=d.blockSize,d.prototype.keySize=d.keySize,d.prototype._reset=function(){for(var e=this._key,r=e.length,n=r+6,a=4*(n+1),o=[],d=0;d>>24,s=c.SBOX[s>>>24]<<24|c.SBOX[255&s>>>16]<<16|c.SBOX[255&s>>>8]<<8|c.SBOX[255&s],s^=i[0|d/r]<<24):6>>24]<<24|c.SBOX[255&s>>>16]<<16|c.SBOX[255&s>>>8]<<8|c.SBOX[255&s]),o[d]=o[d-r]^s}for(var t=[],f=0;ff||4>=p?l:c.INV_SUB_MIX[0][c.SBOX[l>>>24]]^c.INV_SUB_MIX[1][c.SBOX[255&l>>>16]]^c.INV_SUB_MIX[2][c.SBOX[255&l>>>8]]^c.INV_SUB_MIX[3][c.SBOX[255&l]]}this._nRounds=n,this._keySchedule=o,this._invKeySchedule=t},d.prototype.encryptBlockRaw=function(e){return e=n(e),o(e,this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},d.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=s.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},d.prototype.decryptBlock=function(e){e=n(e);var t=e[1];e[1]=e[3],e[3]=t;var r=o(e,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),a=s.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},d.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},e.exports.AES=d},function(e,t,r){var n=Math.min,a=r(6).Buffer,o=r(31);e.exports=function(e,t,r,d){if(a.isBuffer(e)||(e=a.from(e,'binary')),t&&(a.isBuffer(t)||(t=a.from(t,'binary')),8!==t.length))throw new RangeError('salt should be Buffer with 8 byte length');for(var i=r/8,s=a.alloc(i),c=a.alloc(d||0),f=a.alloc(0),p;0new window.WebSocket(e,t),h=btoa,m=(e)=>new URL(e);else{b=r(206).w3cwebsocket,h=(t)=>e(t).toString('base64');const t=r(37);if(t.URL){const e=t.URL;m=(t)=>new e(t)}else m=r(37).parse}class y{constructor(e,t){this.responseCallbacks={},this.notificationCallbacks=[],this.path=e,t=t||{},this._customTimeout=t.timeout;const r=m(e),n=t.headers||{},a=t.protocol||void 0;r.username&&r.password&&(n.authorization=`Basic ${h(`${r.username}:${r.password}`)}`);const o=t.clientConfig||void 0;r.auth&&(n.authorization=`Basic ${h(r.auth)}`),this.connection=new b(e,a,void 0,n,void 0,o),this.addDefaultEvents(),this.connection.onmessage=(t)=>{const e='string'==typeof t.data?t.data:'';this._parseResponse(e).forEach((e)=>{let t=null;_.isArray(e)?e.forEach((e)=>{this.responseCallbacks[e.id]&&(t=e.id)}):t=e.id,!t&&e&&e.method&&-1!==e.method.indexOf('_subscription')?this.notificationCallbacks.forEach((t)=>{_.isFunction(t)&&t(e)}):this.responseCallbacks[t]&&(this.responseCallbacks[t](null,e),delete this.responseCallbacks[t])})},Object.defineProperty(this,'connected',{get(){return this.connection&&this.connection.readyState===this.connection.OPEN},enumerable:!0})}addDefaultEvents(){this.connection.onerror=()=>{this._timeout()},this.connection.onclose=()=>{this._timeout(),this.reset()}}_parseResponse(e){const t=[],r=e.replace(/\}[\n\r]?\{/g,'}|--|{').replace(/\}\][\n\r]?\[\{/g,'}]|--|[{').replace(/\}[\n\r]?\[\{/g,'}|--|[{').replace(/\}\][\n\r]?\{/g,'}]|--|{').split('|--|');return r.forEach((e)=>{this.lastChunk&&(e=this.lastChunk+e);let r=null;try{r=JSON.parse(e)}catch(t){return this.lastChunk=e,clearTimeout(this.lastChunkTimeout),void(this.lastChunkTimeout=setTimeout(()=>{throw this._timeout(),u.a.InvalidResponse(e)},15000))}clearTimeout(this.lastChunkTimeout),this.lastChunk=null,r&&t.push(r)}),t}_addResponseCallback(e,t){const r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n,this._customTimeout&&setTimeout(()=>{this.responseCallbacks[r]&&(this.responseCallbacks[r](u.a.ConnectionTimeout(this._customTimeout)),delete this.responseCallbacks[r])},this._customTimeout)}_timeout(){for(const e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](u.a.InvalidConnection('on WS')),delete this.responseCallbacks[e])}send(e,t){return this.connection.readyState===this.connection.CONNECTING?void setTimeout(()=>{this.send(e,t)},10):this.connection.readyState===this.connection.OPEN?void(this.connection.send(JSON.stringify(e)),this._addResponseCallback(e,t)):(console.error('connection not open on send()'),'function'==typeof this.connection.onerror?this.connection.onerror(new Error('connection not open')):console.error('no error callback'),void t(new Error('connection not open')))}on(e,t){if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');'data'===e?this.notificationCallbacks.push(t):'connect'===e?this.connection.onopen=t:'end'===e?this.connection.onclose=t:'error'===e?this.connection.onerror=t:void 0}removeListener(e,t){'data'===e?this.notificationCallbacks.forEach((e,r)=>{e===t&&this.notificationCallbacks.splice(r,1)}):void 0}removeAllListeners(e){switch(e){case'data':this.notificationCallbacks=[];break;case'connect':this.connection.onopen=null;break;case'end':this.connection.onclose=null;break;case'error':this.connection.onerror=null;break;default:}}reset(){this._timeout(),this.notificationCallbacks=[],this.addDefaultEvents()}disconnect(){this.connection&&this.connection.close()}}}).call(this,r(3).Buffer)},function(e,t,r){(function(e){var n=r(214),a=r(103),o=r(223),d=r(224),i=r(37),s=t;s.request=function(t,r){t='string'==typeof t?i.parse(t):o(t);var a=-1===e.location.protocol.search(/^https?:$/)?'http:':'',d=t.protocol||a,s=t.hostname||t.host,c=t.port,f=t.path||'/';s&&-1!==s.indexOf(':')&&(s='['+s+']'),t.url=(s?d+'//'+s:'')+(c?':'+c:'')+f,t.method=(t.method||'GET').toUpperCase(),t.headers=t.headers||{};var p=new n(t);return r&&p.on('response',r),p},s.get=function(e,t){var r=s.request(e,t);return r.end(),r},s.ClientRequest=n,s.IncomingMessage=a.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=d,s.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE']}).call(this,r(7))},function(){},function(e,t,r){'use strict';var n=r(15),a=r(16),o=r(52),d=r(1),i=r(2),s=r.n(i);const c=(e,t)=>{let r=e;for(;r.length<2*t;)r=`0${r}`;return r},f=(e)=>{const t=65;return e=e.toUpperCase(),e=e.substr(4)+e.substr(0,4),e.split('').map((e)=>{const r=e.charCodeAt(0);return r>=t&&r<=90?r-t+10:e}).join('')},p=(e)=>{let t=e,r;for(;2e||isNaN(e))throw TypeError('n must be a positive number');return this._maxListeners=e,this},t.prototype.emit=function(e){var t,a,d,s,c,i;if(this._events||(this._events={}),'error'===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length))if(t=arguments[1],t instanceof Error)throw t;else{var f=new Error('Uncaught, unspecified "error" event. ('+t+')');throw f.context=t,f}if(a=this._events[e],o(a))return!1;if(r(a))switch(arguments.length){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),a.apply(this,s);}else if(n(a))for(s=Array.prototype.slice.call(arguments,1),i=a.slice(),d=i.length,c=0;cd&&(this._events[e].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[e].length),'function'==typeof console.trace&&console.trace())),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){function n(){this.removeListener(e,n),a||(a=!0,t.apply(this,arguments))}if(!r(t))throw TypeError('listener must be a function');var a=!1;return n.listener=t,this.on(e,n),this},t.prototype.removeListener=function(e,t){var a,o,d,s;if(!r(t))throw TypeError('listener must be a function');if(!this._events||!this._events[e])return this;if(a=this._events[e],d=a.length,o=-1,a===t||r(a.listener)&&a.listener===t)delete this._events[e],this._events.removeListener&&this.emit('removeListener',e,t);else if(n(a)){for(s=d;0o)return this;1===a.length?(a.length=0,delete this._events[e]):a.splice(o,1),this._events.removeListener&&this.emit('removeListener',e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)'removeListener'!==t&&this.removeAllListeners(t);return this.removeAllListeners('removeListener'),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[],t},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){'use strict';(function(t,n,a){function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){C(t,e)}}function d(e){return L.from(e)}function i(e){return L.isBuffer(e)||e instanceof j}function s(){}function c(e,t){B=B||r(26),e=e||{};var n=t instanceof B;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var a=e.highWaterMark,d=e.writableHighWaterMark,i=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:n&&(d||0===d)?d:i,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||'utf8',this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){g(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function f(e){return B=B||r(26),D.call(f,this)||this instanceof B?void(this._writableState=new c(e,this),this.writable=!0,e&&('function'==typeof e.write&&(this._write=e.write),'function'==typeof e.writev&&(this._writev=e.writev),'function'==typeof e.destroy&&(this._destroy=e.destroy),'function'==typeof e.final&&(this._final=e.final)),M.call(this)):new f(e)}function p(e,t){var r=new Error('write after end');e.emit('error',r),P.nextTick(t,r)}function l(e,t,r,n){var a=!0,o=!1;return null===r?o=new TypeError('May not write null values to stream'):'string'!=typeof r&&void 0!==r&&!t.objectMode&&(o=new TypeError('Invalid non-string/buffer chunk')),o&&(e.emit('error',o),P.nextTick(n,o),a=!1),a}function u(e,t,r){return e.objectMode||!1===e.decodeStrings||'string'!=typeof t||(t=L.from(t,r)),t}function b(e,t,r,n,a,o){if(!r){var d=u(t,n,a);n!==d&&(r=!0,a='buffer',n=d)}var i=t.objectMode?1:n.length;t.length+=i;var s=t.lengthr||this.listeners[e].splice(r,1)}},e.prototype.dispatchEvent=function(e){var t=e.type.toLowerCase();if(e.target=this,this.listeners[t])for(var r=0,n=this.listeners[t],a;r>>32-t}function a(t,r,n,a,d,e,i,c){return 0|o(0|t+(r^n^a)+e+i,c)+d}function d(t,r,n,a,d,e,i,c){return 0|o(0|t+(r&n|~r&a)+e+i,c)+d}function s(t,r,n,a,d,e,i,f){return 0|o(0|t+((r|~n)^a)+e+i,f)+d}function c(t,r,n,a,i,e,c,f){return 0|o(0|t+(r&a|n&~a)+e+c,f)+i}function f(t,r,n,a,i,e,c,f){return 0|o(0|t+(r^(n|~a))+e+c,f)+i}var i=r(3).Buffer,p=r(4),l=r(109),u=Array(16),b=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],g=[0,1518500249,1859775393,2400959708,2840853838],v=[1352829926,1548603684,1836072691,2053994217,0];p(n,l),n.prototype._update=function(){for(var e=u,r=0;16>r;++r)e[r]=this._block.readInt32LE(4*r);for(var n=0|this._a,p=0|this._b,l=0|this._c,k=0|this._d,x=0|this._e,S=0|this._a,w=0|this._b,A=0|this._c,E=0|this._d,I=0|this._e,C=0;80>C;C+=1){var i,P;16>C?(i=a(n,p,l,k,x,e[b[C]],g[0],m[C]),P=f(S,w,A,E,I,e[h[C]],v[0],y[C])):32>C?(i=d(n,p,l,k,x,e[b[C]],g[1],m[C]),P=c(S,w,A,E,I,e[h[C]],v[1],y[C])):48>C?(i=s(n,p,l,k,x,e[b[C]],g[2],m[C]),P=s(S,w,A,E,I,e[h[C]],v[2],y[C])):64>C?(i=c(n,p,l,k,x,e[b[C]],g[3],m[C]),P=d(S,w,A,E,I,e[h[C]],v[3],y[C])):(i=f(n,p,l,k,x,e[b[C]],g[4],m[C]),P=a(S,w,A,E,I,e[h[C]],v[4],y[C])),n=x,x=k,k=o(l,10),l=p,p=i,S=I,I=E,E=o(A,10),A=w,w=P}var T=0|this._b+l+E;this._b=0|this._c+k+I,this._c=0|this._d+x+S,this._d=0|this._e+n+w,this._e=0|this._a+p+A,this._a=T},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56>>32-t}function a(t,r,n,a,d,e,i,c){return 0|o(0|t+(r^n^a)+e+i,c)+d}function d(t,r,n,a,d,e,i,c){return 0|o(0|t+(r&n|~r&a)+e+i,c)+d}function s(t,r,n,a,d,e,i,f){return 0|o(0|t+((r|~n)^a)+e+i,f)+d}function c(t,r,n,a,i,e,c,f){return 0|o(0|t+(r&a|n&~a)+e+c,f)+i}function f(t,r,n,a,i,e,c,f){return 0|o(0|t+(r^(n|~a))+e+c,f)+i}var i=r(3).Buffer,p=r(27),l=r(305),u=Array(16),b=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],g=[0,1518500249,1859775393,2400959708,2840853838],v=[1352829926,1548603684,1836072691,2053994217,0];p(n,l),n.prototype._update=function(){for(var e=u,r=0;16>r;++r)e[r]=this._block.readInt32LE(4*r);for(var n=0|this._a,p=0|this._b,l=0|this._c,k=0|this._d,x=0|this._e,S=0|this._a,w=0|this._b,A=0|this._c,E=0|this._d,I=0|this._e,C=0;80>C;C+=1){var i,P;16>C?(i=a(n,p,l,k,x,e[b[C]],g[0],m[C]),P=f(S,w,A,E,I,e[h[C]],v[0],y[C])):32>C?(i=d(n,p,l,k,x,e[b[C]],g[1],m[C]),P=c(S,w,A,E,I,e[h[C]],v[1],y[C])):48>C?(i=s(n,p,l,k,x,e[b[C]],g[2],m[C]),P=s(S,w,A,E,I,e[h[C]],v[2],y[C])):64>C?(i=c(n,p,l,k,x,e[b[C]],g[3],m[C]),P=d(S,w,A,E,I,e[h[C]],v[3],y[C])):(i=f(n,p,l,k,x,e[b[C]],g[4],m[C]),P=a(S,w,A,E,I,e[h[C]],v[4],y[C])),n=x,x=k,k=o(l,10),l=p,p=i,S=I,I=E,E=o(A,10),A=w,w=P}var T=0|this._b+l+E;this._b=0|this._c+k+I,this._c=0|this._d+x+S,this._d=0|this._e+n+w,this._e=0|this._a+p+A,this._a=T},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56'0x'+e.toString('hex'),i=(e)=>new n(e.slice(2),16),a=(e)=>{const t='0x'+('0x'===e.slice(0,2)?new n(e.slice(2),16):new n(e,10)).toString('hex');return'0x0'==t?'0x':t},s=(e)=>'string'==typeof e?/^0x/.test(e)?e:'0x'+e:'0x'+new n(e).toString('hex'),c=(e)=>i(e).toNumber(),f=(e)=>(t,r)=>d(i(t)[e](i(r))),p=f('add'),l=f('mul'),u=f('div'),b=f('sub');e.exports={toString:(e)=>i(e).toString(10),fromString:a,toNumber:c,fromNumber:s,toEther:(e)=>c(u(e,a('10000000000')))/1e8,fromEther:(e)=>l(s(Math.floor(1e8*e)),a('10000000000')),toUint256:(e)=>o.pad(32,e),add:p,mul:l,div:u,sub:b}},function(e,t,r){(function(e,n){var a;/*! https://mths.be/utf8js v2.0.0 by @mathias */(function(o){function d(e){for(var t=[],r=0,n=e.length,a,o;r=a&&r>>10),a=56320|1023&a),n+=m(a);return n}function s(e){if(55296<=e&&57343>=e)throw Error('Lone surrogate U+'+e.toString(16).toUpperCase()+' is not a scalar value')}function c(e,t){return m(128|63&e>>t)}function f(e){if(0==(4294967168&e))return m(e);var t='';return 0==(4294965248&e)?t=m(192|31&e>>6):0==(4294901760&e)?(s(e),t=m(224|15&e>>12),t+=c(e,6)):0==(4292870144&e)&&(t=m(240|7&e>>18),t+=c(e,12),t+=c(e,6)),t+=m(128|63&e),t}function p(){if(k>=v)throw Error('Invalid byte index');var e=255&g[k];if(k++,128==(192&e))return 63&e;throw Error('Invalid continuation byte')}function l(){var e,t,r,n,a;if(k>v)throw Error('Invalid byte index');if(k==v)return!1;if(e=255&g[k],k++,0==(128&e))return e;if(192==(224&e)){var t=p();if(a=(31&e)<<6|t,128<=a)return a;throw Error('Invalid continuation byte')}if(224==(240&e)){if(t=p(),r=p(),a=(15&e)<<12|t<<6|r,2048<=a)return s(a),a;throw Error('Invalid continuation byte')}if(240==(248&e)&&(t=p(),r=p(),n=p(),a=(15&e)<<18|t<<12|r<<6|n,65536<=a&&1114111>=a))return a;throw Error('Invalid UTF-8 detected')}function u(e){g=d(e),v=g.length,k=0;for(var t=[],r;!1!==(r=l());)t.push(r);return i(t)}var b='object'==typeof e&&e&&e.exports==('object'==typeof t&&t)&&e,h='object'==typeof n&&n;(h.global===h||h.window===h)&&(o=h);var m=String.fromCharCode,y={version:'2.0.0',encode:function(e){for(var t=d(e),r=t.length,n=-1,a='',o;++n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;50>n;++n)this.s[n]=0}function c(e,t,r){d.call(this,e,t,r)}var s='input is invalid type',p='object'==typeof window,l=p?window:{};l.JS_SHA3_NO_WINDOW&&(p=!1);var u=!p&&'object'==typeof self,b=!l.JS_SHA3_NO_NODE_JS&&'object'==typeof n&&n.versions&&n.versions.node;b?l=a:u&&(l=self);var h=!l.JS_SHA3_NO_COMMON_JS&&'object'==typeof e&&e.exports,m=r(199),y=!l.JS_SHA3_NO_ARRAY_BUFFER&&'undefined'!=typeof ArrayBuffer,g=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'],v=[31,7936,2031616,520093696],k=[4,1024,262144,67108864],x=[1,256,65536,16777216],S=[6,1536,393216,100663296],w=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],E=[224,256,384,512],I=[128,256],C=['hex','buffer','arrayBuffer','array','digest'],P={128:168,256:136};(l.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return'[object Array]'===Object.prototype.toString.call(e)}),y&&(l.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return'object'==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var T=function(e,t,r){return function(n){return new d(e,t,e).update(n)[r]()}},B=function(e,t,r){return function(n,a){return new d(e,t,a).update(n)[r]()}},N=function(e,t,r){return function(t,a,o,n){return F['cshake'+e].update(t,a,o,n)[r]()}},R=function(e,t,r){return function(t,n,a,o){return F['kmac'+e].update(t,n,a,o)[r]()}},M=function(e,t,r,n){for(var a=0,o;a>2]|=e[c]<i?n[p>>2]|=i<i?(n[p>>2]|=(192|i>>6)<>2]|=(128|63&i)<i||57344<=i?(n[p>>2]|=(224|i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|63&i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<=a){for(this.start=p-a,this.block=n[d],p=0;p>=8,r=255&e;0>=8,r=255&e,++a;return t?n.push(a):n.unshift(a),this.update(n),n.length},d.prototype.encodeString=function(e){var t=typeof e,r;if('string'!=t){if('object'!=t)throw new Error(s);else if(null===e)throw new Error(s);else if(y&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!y||!ArrayBuffer.isView(e)))throw new Error(s);r=!0}var n=0,a=e.length;if(r)n=a;else for(var o=0,d;od?n+=1:2048>d?n+=2:55296>d||57344<=d?n+=3:(d=65536+((1023&d)<<10|1023&e.charCodeAt(++o)),n+=4);return n+=this.encode(8*n),this.update(e),n},d.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4]+g[15&i]+g[15&i>>12]+g[15&i>>8]+g[15&i>>20]+g[15&i>>16]+g[15&i>>28]+g[15&i>>24];0==o%e&&(W(t),a=0)}return n&&(i=t[a],d+=g[15&i>>4]+g[15&i],1>12]+g[15&i>>8]),2>20]+g[15&i>>16])),d},d.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,a=0,o=0,d=this.outputBits>>3,i;i=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(d);for(var s=new Uint32Array(i);o>8,d[i+2]=255&s>>16,d[i+3]=255&s>>24;0==o%e&&W(t)}return n&&(i=o<<2,s=t[a],d[i]=255&s,1>8),2>16)),d},c.prototype=new d,c.prototype.finalize=function(){return this.encode(this.outputBits,!0),d.prototype.finalize.call(this)};var W=function(e){var t,r,a,n,o,d,i,s,c,f,p,l,u,b,h,m,y,g,v,k,x,S,w,E,I,C,P,T,B,N,R,M,L,j,O,D,U,H,F,q,z,K,V,G,W,X,Y,Z,J,$,Q,ee,te,re,ne,ae,oe,de,ie,se,ce,fe,pe;for(a=0;48>a;a+=2)n=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],d=e[2]^e[12]^e[22]^e[32]^e[42],i=e[3]^e[13]^e[23]^e[33]^e[43],s=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],p=e[7]^e[17]^e[27]^e[37]^e[47],l=e[8]^e[18]^e[28]^e[38]^e[48],u=e[9]^e[19]^e[29]^e[39]^e[49],t=l^(d<<1|i>>>31),r=u^(i<<1|d>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=n^(s<<1|c>>>31),r=o^(c<<1|s>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=d^(f<<1|p>>>31),r=i^(p<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=s^(l<<1|u>>>31),r=c^(u<<1|l>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(n<<1|o>>>31),r=p^(o<<1|n>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,b=e[0],h=e[1],X=e[11]<<4|e[10]>>>28,Y=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,B=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,O=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,fe=e[42]<<2|e[43]>>>30,pe=e[43]<<2|e[42]>>>30,re=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,g=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,$=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,M=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,E=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,ae=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,H=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,k=e[36]<<21|e[37]>>>11,x=e[37]<<21|e[36]>>>11,ee=e[47]<<24|e[46]>>>8,te=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,P=e[19]<<20|e[18]>>>12,de=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,w=e[49]<<14|e[48]>>>18,e[0]=b^~m&g,e[1]=h^~y&v,e[10]=E^~C&T,e[11]=I^~P&B,e[20]=j^~D&H,e[21]=O^~U&F,e[30]=G^~X&Z,e[31]=W^~Y&J,e[40]=re^~ae&de,e[41]=ne^~oe&ie,e[2]=m^~g&k,e[3]=y^~v&x,e[12]=C^~T&N,e[13]=P^~B&R,e[22]=D^~H&q,e[23]=U^~F&z,e[32]=X^~Z&$,e[33]=Y^~J&Q,e[42]=ae^~de&se,e[43]=oe^~ie&ce,e[4]=g^~k&S,e[5]=v^~x&w,e[14]=T^~N&M,e[15]=B^~R&L,e[24]=H^~q&K,e[25]=F^~z&V,e[34]=Z^~$&ee,e[35]=J^~Q&te,e[44]=de^~se&fe,e[45]=ie^~ce&pe,e[6]=k^~S&b,e[7]=x^~w&h,e[16]=N^~M&E,e[17]=R^~L&I,e[26]=q^~K&j,e[27]=z^~V&O,e[36]=$^~ee&G,e[37]=Q^~te&W,e[46]=se^~fe&re,e[47]=ce^~pe&ne,e[8]=S^~b&m,e[9]=w^~h&y,e[18]=M^~E&C,e[19]=L^~I&P,e[28]=K^~j&D,e[29]=V^~O&U,e[38]=ee^~G&X,e[39]=te^~W&Y,e[48]=fe^~re&ae,e[49]=pe^~ne&oe,e[0]^=A[a],e[1]^=A[a+1]};if(h)e.exports=F;else{for(z=0;z=a&&r>>10),e=56320|1023&e),t+=L(e),t}).join('')}function p(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:x}function l(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function u(e,t,r){var n=0;for(e=r?M(e/E):e>>1,e+=M(e/t);e>R*A>>1;n+=x)e=M(e/R);return M(n+(R+1)*e/(e+w))}function b(e){var r=[],a=e.length,o=0,i=C,n=I,s,c,l,b,h,m,y,g,k,t;for(c=e.lastIndexOf(P),0>c&&(c=0),l=0;l=a&&d('invalid-input'),g=p(e.charCodeAt(b++)),(g>=x||g>M((v-o)/m))&&d('overflow'),o+=g*m,k=y<=n?S:y>=n+A?A:y-n,gM(v/t)&&d('overflow'),m*=t}s=r.length+1,n=u(o-h,s,0==h),M(o/s)>v-i&&d('overflow'),i+=M(o/s),o%=s,r.splice(o++,0,i)}return f(r)}function h(e){var r=[],a,n,o,i,s,f,p,b,h,m,t,y,g,k,w;for(e=c(e),y=e.length,a=C,n=0,s=I,f=0;ft&&r.push(L(t));for(o=i=r.length,i&&r.push(P);o=a&&tM((v-n)/g)&&d('overflow'),n+=(p-a)*g,a=p,f=0;fv&&d('overflow'),t==a){for(b=n,h=x;;h+=x){if(m=h<=s?S:h>=s+A?A:h-s,b= 0x80 (not a basic code point)',"invalid-input":'Invalid input'},R=x-S,M=Math.floor,L=String.fromCharCode,j;j={version:'1.4.1',ucs2:{decode:c,encode:f},decode:b,encode:h,toASCII:function(e){return s(e,function(e){return T.test(e)?'xn--'+h(e):e})},toUnicode:function(e){return s(e,function(e){return k.test(e)?b(e.slice(4).toLowerCase()):e})}},a=function(){return j}.call(t,r,t,e),!(a!==void 0&&(e.exports=a))})(this)}).call(this,r(51)(e),r(7))},function(e,t,r){(function(e){function r(){if(i!==void 0)return i;if(e.XMLHttpRequest){i=new e.XMLHttpRequest;try{i.open('GET',e.XDomainRequest?'/':'https://example.com')}catch(t){i=null}}else i=null;return i}function n(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(t){}return!1}function a(e){return'function'==typeof e}t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(t){}var o='undefined'!=typeof e.ArrayBuffer,d=o&&a(e.ArrayBuffer.prototype.slice),i;t.arraybuffer=t.fetch||o&&n('arraybuffer'),t.msstream=!t.fetch&&d&&n('ms-stream'),t.mozchunkedarraybuffer=!t.fetch&&o&&n('moz-chunked-arraybuffer'),t.overrideMimeType=t.fetch||!!r()&&a(r().overrideMimeType),t.vbArray=a(e.VBArray),i=null}).call(this,r(7))},function(e,t,r){(function(e,n,a){var o=r(102),d=r(4),i=r(38),s=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=t.IncomingMessage=function(t,r,d,s){var c=this;if(i.Readable.call(c),c._mode=d,c.headers={},c.rawHeaders=[],c.trailers={},c.rawTrailers=[],c.on('end',function(){e.nextTick(function(){c.emit('close')})}),'fetch'===d){function e(){p.read().then(function(t){return c._destroyed?void 0:t.done?(a.clearTimeout(s),void c.push(null)):void(c.push(new n(t.value)),e())}).catch(function(e){a.clearTimeout(s),c._destroyed||c.emit('error',e)})}if(c._fetchResponse=r,c.url=r.url,c.statusCode=r.status,c.statusMessage=r.statusText,r.headers.forEach(function(e,t){c.headers[t.toLowerCase()]=e,c.rawHeaders.push(t,e)}),o.writableStream){var f=new WritableStream({write:function(e){return new Promise(function(t,r){c._destroyed?r():c.push(new n(e))?t():c._resumeFetch=t})},close:function(){a.clearTimeout(s),c._destroyed||c.push(null)},abort:function(e){c._destroyed||c.emit('error',e)}});try{return void r.body.pipeTo(f).catch(function(e){a.clearTimeout(s),c._destroyed||c.emit('error',e)})}catch(t){}}var p=r.body.getReader();e()}else{c._xhr=t,c._pos=0,c.url=t.responseURL,c.statusCode=t.status,c.statusMessage=t.statusText;var l=t.getAllResponseHeaders().split(/\r?\n/);if(l.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();'set-cookie'===r?(void 0===c.headers[r]&&(c.headers[r]=[]),c.headers[r].push(t[2])):void 0===c.headers[r]?c.headers[r]=t[2]:c.headers[r]+=', '+t[2],c.rawHeaders.push(t[1],t[2])}}),c._charset='x-user-defined',!o.overrideMimeType){var u=c.rawHeaders['mime-type'];if(u){var b=u.match(/;\s*charset=([^;])(;|$)/);b&&(c._charset=b[1].toLowerCase())}c._charset||(c._charset='utf-8')}}};d(c,i.Readable),c.prototype._read=function(){var e=this,t=e._resumeFetch;t&&(e._resumeFetch=null,t())},c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,r=null;switch(e._mode){case'text:vbarray':if(t.readyState!==s.DONE)break;try{r=new a.VBArray(t.responseBody).toArray()}catch(t){}if(null!==r){e.push(new n(r));break}case'text':try{r=t.responseText}catch(t){e._mode='text:vbarray';break}if(r.length>e._pos){var o=r.substr(e._pos);if('x-user-defined'===e._charset){for(var d=new n(o.length),c=0;ce._pos&&(e.push(new n(new Uint8Array(i.result.slice(e._pos)))),e._pos=i.result.byteLength)},i.onload=function(){e.push(null)},i.readAsArrayBuffer(r);}e._xhr.readyState===s.DONE&&'ms-stream'!==e._mode&&e.push(null)}}).call(this,r(9),r(3).Buffer,r(7))},function(e,t,r){'use strict';(function(t,n){function a(e){return U.from(e)}function o(e){return U.isBuffer(e)||e instanceof H}function d(e,t,r){return'function'==typeof e.prependListener?e.prependListener(t,r):void(e._events&&e._events[t]?M(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r))}function i(e,t){L=L||r(26),e=e||{};var n=t instanceof L;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var a=e.highWaterMark,o=e.readableHighWaterMark,d=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:n&&(o||0===o)?o:d,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new K,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||'utf8',this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(!G&&(G=r(55).StringDecoder),this.decoder=new G(e.encoding),this.encoding=e.encoding)}function s(e){return L=L||r(26),this instanceof s?void(this._readableState=new i(e,this),this.readable=!0,e&&('function'==typeof e.read&&(this._read=e.read),'function'==typeof e.destroy&&(this._destroy=e.destroy)),D.call(this)):new s(e)}function c(e,t,r,n,o){var d=e._readableState;if(null===t)d.reading=!1,h(e,d);else{var i;o||(i=p(d,t)),i?e.emit('error',i):d.objectMode||t&&0=X?e=X:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function b(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function h(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,m(e)}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(z('emitReadable',t.flowing),t.emittedReadable=!0,t.sync?R.nextTick(y,e):y(e))}function y(e){z('emit readable'),e.emit('readable'),A(e)}function g(e,t){t.readingMore||(t.readingMore=!0,R.nextTick(v,e,t))}function v(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(''):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=I(e,t.buffer,t.decoder),r}function I(e,t,r){var n;return eo.length?o.length:e;if(a+=d===o.length?o:o.slice(0,e),e-=d,0===e){d===o.length?(++n,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=o.slice(d));break}++n}return t.length-=n,a}function P(e,t){var r=U.allocUnsafe(e),n=t.head,a=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,d=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,d),e-=d,0===e){d===o.length?(++a,t.head=n.next?n.next:t.tail=null):(t.head=n,n.data=o.slice(d));break}++a}return t.length-=a,r}function T(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return z('read: emitReadable',t.length,t.ended),0===t.length&&t.ended?T(this):m(this),null;if(e=b(e,t),0===e&&t.ended)return 0===t.length&&T(this),null;var n=t.needReadable;z('need readable',n),(0===t.length||t.length-e=this._blockSize;){for(var d=this._blockOffset;dr;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error('_digest is not implemented')},e.exports=a},function(e,t,r){function n(){this.init(),this._w=b,f.call(this,64,56)}function o(e,t,r){return r^e&(t^r)}function i(e,t,r){return e&t|r&(e|t)}function s(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function p(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function a(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}var c=r(4),f=r(33),l=r(6).Buffer,u=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=Array(64);c(n,f),n.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},n.prototype._update=function(t){for(var r=this._w,n=0|this._a,l=0|this._b,b=0|this._c,c=0|this._d,m=0|this._e,e=0|this._f,f=0|this._g,y=0|this._h,h=0;16>h;++h)r[h]=t.readInt32BE(4*h);for(;64>h;++h)r[h]=0|d(r[h-2])+r[h-7]+a(r[h-15])+r[h-16];for(var g=0;64>g;++g){var v=0|y+p(m)+o(m,e,f)+u[g]+r[g],k=0|s(n)+i(n,l,b);y=f,f=e,e=m,m=0|c+v,c=b,b=l,l=n,n=0|v+k}this._a=0|n+this._a,this._b=0|l+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|m+this._e,this._f=0|e+this._f,this._g=0|f+this._g,this._h=0|y+this._h},n.prototype._hash=function(){var e=l.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=y,b.call(this,128,112)}function a(e,t,r){return r^e&(t^r)}function o(e,t,r){return e&t|r&(e|t)}function d(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function i(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function s(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function c(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function f(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function p(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function l(e,t){return e>>>0>>0?1:0}var u=r(4),b=r(33),h=r(6).Buffer,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],y=Array(160);u(n,b),n.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},n.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,u=0|this._ch,b=0|this._dh,h=0|this._eh,y=0|this._fh,g=0|this._gh,v=0|this._hh,k=0|this._al,x=0|this._bl,S=0|this._cl,w=0|this._dl,A=0|this._el,E=0|this._fl,I=0|this._gl,C=0|this._hl,P=0;32>P;P+=2)t[P]=e.readInt32BE(4*P),t[P+1]=e.readInt32BE(4*P+4);for(;160>P;P+=2){var T=t[P-30],B=t[P-30+1],N=s(T,B),R=c(B,T);T=t[P-4],B=t[P-4+1];var M=f(T,B),L=p(B,T),O=t[P-14],D=t[P-14+1],U=t[P-32],H=t[P-32+1],F=0|R+D,q=0|N+O+l(F,R);F=0|F+L,q=0|q+M+l(F,L),F=0|F+H,q=0|q+U+l(F,H),t[P]=q,t[P+1]=F}for(var z=0;160>z;z+=2){q=t[z],F=t[z+1];var j=o(r,n,u),K=o(k,x,S),V=d(r,k),G=d(k,r),W=i(h,A),X=i(A,h),Y=m[z],Z=m[z+1],J=a(h,y,g),$=a(A,E,I),Q=0|C+X,ee=0|v+W+l(Q,C);Q=0|Q+$,ee=0|ee+J+l(Q,$),Q=0|Q+Z,ee=0|ee+Y+l(Q,Z),Q=0|Q+F,ee=0|ee+q+l(Q,F);var te=0|G+K,re=0|V+j+l(te,G);v=g,C=I,g=y,I=E,y=h,E=A,A=0|w+Q,h=0|b+ee+l(A,w),b=u,w=S,u=n,S=x,n=r,x=k,k=0|Q+te,r=0|ee+re+l(k,Q)}this._al=0|this._al+k,this._bl=0|this._bl+x,this._cl=0|this._cl+S,this._dl=0|this._dl+w,this._el=0|this._el+A,this._fl=0|this._fl+E,this._gl=0|this._gl+I,this._hl=0|this._hl+C,this._ah=0|this._ah+r+l(this._al,k),this._bh=0|this._bh+n+l(this._bl,x),this._ch=0|this._ch+u+l(this._cl,S),this._dh=0|this._dh+b+l(this._dl,w),this._eh=0|this._eh+h+l(this._el,A),this._fh=0|this._fh+y+l(this._fl,E),this._gh=0|this._gh+g+l(this._gl,I),this._hh=0|this._hh+v+l(this._hl,C)},n.prototype._hash=function(){function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}var t=h.allocUnsafe(64);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},e.exports=n},function(e,t,r){'use strict';function n(e,t){d.call(this,'digest'),'string'==typeof t&&(t=s.from(t));var r='sha512'===e||'sha384'===e?128:64;if(this._alg=e,this._key=t,t.length>r){var n='rmd160'===e?new c:f(e);t=n.update(t).digest()}else t.lengthn)throw new TypeError('Bad iterations');if('number'!=typeof a)throw new TypeError('Key length not a number');if(0>a||a>1073741823||a!==a)throw new TypeError('Bad key length')}}).call(this,r(3).Buffer)},function(e,t,r){(function(t){var r;if(t.browser)r='utf-8';else{var n=parseInt(t.version.split('.')[0].slice(1),10);r=6<=n?'utf-8':'binary'}e.exports=r}).call(this,r(9))},function(e,t,r){function n(e,t,r){var n=a(e),o='sha512'===e||'sha384'===e?128:64;t.length>o?t=n(t):t.lengtht&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error('Unsupported state or unable to authenticate data');var e=p(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&n(e,this._authTag))throw new Error('Unsupported state or unable to authenticate data');this._authTag=e,this._cipher.scrub()},o.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error('Attempting to get auth tag in unsupported state');return this._authTag},o.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error('Attempting to set auth tag in unsupported state');this._authTag=e},o.prototype.setAAD=function(e){if(this._called)throw new Error('Attempting to set AAD in unsupported state');this._ghash.update(e),this._alen+=e.length},e.exports=o},function(e,t,r){function n(e,t,r,n){d.call(this),this._cipher=new a.AES(t),this._prev=o.from(r),this._cache=o.allocUnsafe(0),this._secCache=o.allocUnsafe(0),this._decrypt=n,this._mode=e}var a=r(59),o=r(6).Buffer,d=r(20),i=r(4);i(n,d),n.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},n.prototype._final=function(){this._cipher.scrub()},e.exports=n},function(e,t,r){(function(e){function n(t,r,o,s){return e.isBuffer(r)||void 0===i[r]?n(t,'binary',r,o):(r=r||'binary',s=s||'binary',o=o||new e([2]),e.isBuffer(o)||(o=new e(o,s)),'number'==typeof t)?new d(a(t,o),o,!0):(e.isBuffer(t)||(t=new e(t,r)),new d(t,o,!0))}var a=r(126),o=r(259),d=r(260),i={binary:!0,hex:!0,base64:!0};t.DiffieHellmanGroup=t.createDiffieHellmanGroup=t.getDiffieHellman=function(t){var r=new e(o[t].prime,'hex'),n=new e(o[t].gen,'hex');return new d(r,n)},t.createDiffieHellman=t.DiffieHellman=n}).call(this,r(3).Buffer)},function(e,t,r){function n(){if(null!==A)return A;var e=[];e[0]=2;for(var t=1,r=3,n;r<1048576;r+=2){n=s(Math.sqrt(r));for(var a=0;ae)return 2===t||5===t?new c([140,123]):new c([140,39]);t=new c(t);for(var r,n;;){for(r=new c(i(s(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(b),!t.cmp(b))for(;r.mod(f).cmp(x);)r.iadd(S);else if(!t.cmp(h))for(;r.mod(g).cmp(v);)r.iadd(S);if(n=r.shrn(1),a(n)&&a(r)&&o(n)&&o(r)&&l.test(n)&&l.test(r))return r}}var s=Math.ceil,i=r(30);e.exports=d,d.simpleSieve=a,d.fermatTest=o;var c=r(2),f=new c(24),p=r(127),l=new p,u=new c(1),b=new c(2),h=new c(5),m=new c(16),y=new c(8),g=new c(10),v=new c(3),k=new c(7),x=new c(11),S=new c(4),w=new c(12),A=null},function(e,t,r){function n(e){this.rand=e||new a.Rand}var o=Math.max,c=r(2),a=r(128);e.exports=n,n.create=function(e){return new n(e)},n.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do var n=new c(this.rand.generate(r));while(0<=n.cmp(e));return n},n.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},n.prototype.test=function(e,t,r){var n=e.bitLength(),f=c.mont(e),p=new c(1).toRed(f);t||(t=o(1,0|n/48));for(var l=e.subn(1),u=0;!l.testn(u);u++);for(var s=e.shrn(u),d=l.toRed(f),b=!0;0>8,d=255&a;o?r.push(o,d):r.push(d)}return r},a.zero2=r,a.toHex=n,a.encode=function(e,t){return'hex'===t?n(e):e}},function(e,t,r){'use strict';function n(e,t,r){return e&t^~e&r}function a(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}var d=r(17),i=d.rotr32;t.ft_1=function(e,t,r,d){return 0===e?n(t,r,d):1===e||3===e?o(t,r,d):2===e?a(t,r,d):void 0},t.ch32=n,t.maj32=a,t.p32=o,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},function(e,t,r){'use strict';function n(){return this instanceof n?void(i.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=h,this.W=Array(64)):new n}var a=r(17),o=r(43),d=r(131),s=r(12),p=a.sum32,c=a.sum32_4,l=a.sum32_5,u=d.ch32,m=d.maj32,y=d.s0_256,v=d.s1_256,f=d.g0_256,b=d.g1_256,i=o.BlockHash,h=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];a.inherits(n,i),e.exports=n,n.blockSize=512,n.outSize=256,n.hmacStrength=192,n.padLength=64,n.prototype._update=function(t,r){for(var n=this.W,o=0;16>o;o++)n[o]=t[r+o];for(;od&&(d+=4294967296),d}function o(e,t,n,a,o,d){var i=t&a^~t&d;return 0>i&&(i+=4294967296),i}function d(e,t,n,a,o){var d=e&n^e&o^n&o;return 0>d&&(d+=4294967296),d}function s(e,t,n,a,o,d){var i=t&a^t&d^a&d;return 0>i&&(i+=4294967296),i}function c(e,t){var n=v(e,t,28),a=v(t,e,2),o=v(t,e,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function f(e,t){var n=k(e,t,28),a=k(t,e,2),o=k(t,e,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function p(e,t){var n=v(e,t,14),a=v(e,t,18),o=v(t,e,9),d=n^a^o;return 0>d&&(d+=4294967296),d}function l(e,t){var n=k(e,t,14),a=k(e,t,18),o=k(t,e,9),d=n^a^o;return 0>d&&(d+=4294967296),d}function u(e,t){var n=v(e,t,1),a=v(e,t,8),o=x(e,t,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function b(e,t){var n=k(e,t,1),a=k(e,t,8),o=S(e,t,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function h(e,t){var n=v(e,t,19),a=v(t,e,29),o=x(e,t,6),d=n^a^o;return 0>d&&(d+=4294967296),d}function m(e,t){var n=k(e,t,19),a=k(t,e,29),o=S(e,t,6),d=n^a^o;return 0>d&&(d+=4294967296),d}var i=r(17),y=r(43),g=r(12),v=i.rotr64_hi,k=i.rotr64_lo,x=i.shr64_hi,S=i.shr64_lo,w=i.sum64,A=i.sum64_hi,E=i.sum64_lo,I=i.sum64_4_hi,C=i.sum64_4_lo,P=i.sum64_5_hi,T=i.sum64_5_lo,B=y.BlockHash,N=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];i.inherits(n,B),e.exports=n,n.blockSize=1024,n.outSize=512,n.hmacStrength=192,n.padLength=128,n.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;32>n;n++)r[n]=e[t+n];for(;n=e))return t.error('non-byte EncoderBuffer value');this.value=e,this.length=1}else if('string'==typeof e)this.value=e,this.length=i.byteLength(e);else if(i.isBuffer(e))this.value=e,this.length=e.length;else return t.error('Unsupported type: '+typeof e)}var o=r(4),d=r(45).Reporter,i=r(3).Buffer;o(n,d),t.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:d.prototype.save.call(this)}},n.prototype.restore=function(e){var t=new n(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,d.prototype.restore.call(this,e.reporter),t},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||'DecoderBuffer overrun')},n.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||'DecoderBuffer overrun');var r=new n(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},n.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function(e,t){return(e||(e=new i(this.length)),t||(t=0),0===this.length)?e:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):('number'==typeof this.value?e[t]=this.value:'string'==typeof this.value?e.write(this.value,t):i.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},function(e,t,r){var n=t;n._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0);var n=e[r];t[n]=r}),t},n.der=r(289)},function(e,t,r){function n(e){this.enc='der',this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){c.Node.call(this,'der',e)}function o(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var n=p.tagClass[r>>6],a=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;var d=p.tag[r];return{cls:n,primitive:a,tag:r,tagStr:d}}function d(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;var a=127&n;if(4n?2e3+n:1900+n}else return e.error('Decoding '+t+' time is not supported yet');return Date.UTC(n,a-1,o,d,i,s,0)},a.prototype._decodeNull=function(){return null},a.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},a.prototype._decodeInt=function(e,t){var r=e.raw(),n=new f(r);return t&&(n=t[n.toString(10)]||n),n},a.prototype._use=function(e,t){return'function'==typeof e&&(e=e(t)),e._getDecoder('der').tree}},function(e,t,r){function n(e){this.enc='der',this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){f.Node.call(this,'der',e)}function o(e){return 10>e?'0'+e:e}function d(e,t,r,n){var a;if('seqof'===e?e='seq':'setof'==e&&(e='set'),p.tagByName.hasOwnProperty(e))a=p.tagByName[e];else if('number'==typeof e&&(0|e)===e)a=e;else return n.error('Unknown tag: '+e);return 31<=a?n.error('Multi-octet tag encoding unsupported'):(t||(a|=32),a|=p.tagClassByName[r||'universal']<<6,a)}var i=r(4),s=r(3).Buffer,c=r(44),f=c.base,p=c.constants.der;e.exports=n,n.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(a,f.Node),a.prototype._encodeComposite=function(e,t,r,n){var a=d(e,t,r,this.reporter);if(128>n.length){var o=new s(2);return o[0]=a,o[1]=n.length,this._createEncoderBuffer([o,n])}for(var c=1,f=n.length;256<=f;f>>=8)c++;var o=new s(2+c);o[0]=a,o[1]=128|c;for(var f=1+c,i=n.length;0>=8)o[f]=255&i;return this._createEncoderBuffer([o,n])},a.prototype._encodeStr=function(e,t){if('bitstr'===t)return this._createEncoderBuffer([0|e.unused,e.data]);if('bmpstr'===t){for(var r=new s(2*e.length),n=0;n>=7)a++;for(var d=new s(a),i=d.length-1,n=e.length-1,o;0<=n;n--)for(o=e[n],d[i--]=127&o;0<(o>>=7);)d[i--]=128|127&o;return this._createEncoderBuffer(d)},a.prototype._encodeTime=function(e,t){var r=new Date(e),n;return'gentime'===t?n=[o(r.getFullYear()),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),'Z'].join(''):'utctime'===t?n=[o(r.getFullYear()%100),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),'Z'].join(''):this.reporter.error('Encoding '+t+' time is not supported yet'),this._encodeStr(n,'octstr')},a.prototype._encodeNull=function(){return this._createEncoderBuffer('')},a.prototype._encodeInt=function(e,t){if('string'==typeof e){if(!t)return this.reporter.error('String int or enum given, but no values map');if(!t.hasOwnProperty(e))return this.reporter.error('Values map doesn\'t contain: '+JSON.stringify(e));e=t[e]}if('number'!=typeof e&&!s.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new s(r)}if(s.isBuffer(e)){var n=e.length;0===e.length&&n++;var a=new s(n);return e.copy(a),0===e.length&&(a[0]=0),this._createEncoderBuffer(a)}if(128>e)return this._createEncoderBuffer(e);if(256>e)return this._createEncoderBuffer([0,e]);for(var n=1,o=e;256<=o;o>>=8)n++;for(var a=Array(n),o=a.length-1;0<=o;o--)a[o]=255&e,e>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(new s(a))},a.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},a.prototype._use=function(e,t){return'function'==typeof e&&(e=e(t)),e._getEncoder('der').tree},a.prototype._skipDefault=function(e,t,r){var n=this._baseState,a;if(null===n['default'])return!1;var o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n['default'],t,r).join()),o.length!==n.defaultBuffer.length)return!1;for(a=0;an)throw new TypeError('Bad iterations');if('number'!=typeof a)throw new TypeError('Key length not a number');if(0>a||a>1073741823||a!==a)throw new TypeError('Bad key length')}}).call(this,r(3).Buffer)},function(e,t,r){(function(t){var r;if(t.browser)r='utf-8';else{var n=parseInt(t.version.split('.')[0].slice(1),10);r=6<=n?'utf-8':'binary'}e.exports=r}).call(this,r(9))},function(e,t,r){function n(e,t,r){var n=a(e),o='sha512'===e||'sha384'===e?128:64;t.length>o?t=n(t):t.lengthe;e++)0==(3&e)&&(t=4294967296*Math.random()),n[e]=255&t>>>((3&e)<<3);return n}}},function(e){function t(e,t){var n=t||0,a=r;return[a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]]].join('')}for(var r=[],n=0;256>n;++n)r[n]=(n+256).toString(16).substr(1);e.exports=t},function(e,t,r){(function(n){function a(e){var t=new n(4);return t.writeUInt32BE(e,0),t}var o=r(63);e.exports=function(e,r){for(var d=new n(''),t=0,i;d.lengthr;r++)t['_'+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if('0123456789'!==n.join(''))return!1;var a={};return['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t'].forEach(function(e){a[e]=e}),'abcdefghijklmnopqrst'===Object.keys(Object.assign({},a)).join('')}catch(e){return!1}}()?Object.assign:function(e){for(var o=t(e),d=1,s,c;d=parseInt(r[2])?t.toNumber():t};var P=/^([^)(]*)\((.*)\)([^)(]*)$/,T=/^[A-Za-z_][A-Za-z0-9_]*$/;t.parseParamType=function(e){return a(e,!0)},t.formatParamType=s,t.formatSignature=function(e){return e.name+'('+e.inputs.map(function(e){return s(e)}).join(',')+')'},t.parseSignature=function(e){if('string'==typeof e)return e=e.replace(/\(/g,' (').replace(/\)/g,') ').replace(/\s+/g,' '),e=e.trim(),'event '===e.substring(0,6)?o(e.substring(6).trim()):('function '===e.substring(0,9)&&(e=e.substring(9)),d(e.trim()));throw new Error('unknown signature')};var B=function(){return function(e,t,r,n,a){this.coerceFunc=e,this.name=t,this.type=r,this.localName=n,this.dynamic=a}}(),N=function(e){function t(t){var r=e.call(this,t.coerceFunc,t.name,t.type,void 0,t.dynamic)||this;return w.defineReadOnly(r,'coder',t),r}return y(t,e),t.prototype.encode=function(e){return this.coder.encode(e)},t.prototype.decode=function(e,t){return this.coder.decode(e,t)},t}(B),R=function(e){function t(t,r){return e.call(this,t,'null','',r,!1)||this}return y(t,e),t.prototype.encode=function(){return x.arrayify([])},t.prototype.decode=function(e,t){if(t>e.length)throw new Error('invalid null');return{consumed:0,value:this.coerceFunc('null',void 0)}},t}(B),M=function(e){function t(t,r,n,a){var o=this,d=(n?'int':'uint')+8*r;return o=e.call(this,t,d,d,a,!1)||this,o.size=r,o.signed=n,o}return y(t,e),t.prototype.encode=function(e){try{var t=k.bigNumberify(e);return t=t.toTwos(8*this.size).maskn(8*this.size),this.signed&&(t=t.fromTwos(8*this.size).toTwos(256)),x.padZeros(x.arrayify(t),32)}catch(t){A.throwError('invalid number value',A.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e})}return null},t.prototype.decode=function(e,t){e.lengthb&&(n('Max buffer length exceeded: textNode'),e=r(e,p.length)),H.length>b&&(n('Max buffer length exceeded: numberNode'),e=r(e,H.length)),U=b-e+Y}function n(e){p!==void 0&&(l(p),u(),p=void 0),$=s(e+'\nLn: '+J+'\nCol: '+Z+'\nChr: '+Q),i(K(void 0,void 0,$))}function a(){return z==y?(l({}),u(),void(q=!0)):void((z!==g||0!==X)&&n('Unexpected end'),p!==void 0&&(l(p),u(),p=void 0),q=!0)}function o(e){return'\r'==e||'\n'==e||' '==e||'\t'==e}function d(e){if(!$){if(q)return n('Cannot write after close');var r=0;for(Q=e[0];Q&&(0=U&&t()}}var f=e(xe).emit,l=e(Se).emit,u=e(we).emit,i=e(he).emit,b=65536,h=/[\\"\n]/g,m=0,y=m++,g=m++,v=m++,k=m++,x=m++,S=m++,w=m++,A=m++,E=m++,I=m++,C=m++,P=m++,T=m++,B=m++,N=m++,R=m++,M=m++,L=m++,j=m++,O=m++,D=m,U=b,H='',F=!1,q=!1,z=y,V=[],G=null,W=0,X=0,Y=0,Z=0,J=1,$,Q,ee,p;e(_e).on(d),e(ve).on(a)}function M(e,t){'use strict';function r(e){return function(t){a=e(a,t)}}var n={},a;for(var o in t)e(o).on(r(t[o]),n);e(ue).on(function(e){var t=re(a),r=de(t),n=ne(a),o;n&&(o=ie(re(n)),o[r]=e)}),e(be).on(function(){var e=re(a),t=de(e),r=ne(a),n;r&&(n=ie(re(r)),delete n[t])}),e(ke).on(function(){for(var r in t)e(r).un(n)})}function L(e){var t={};return e&&e.split('\r\n').forEach(function(e){var r=e.indexOf(': ');t[e.substring(0,r)]=e.substring(r+2)}),t}function j(e,t){function r(e){return{"http:":80,"https:":443}[e]}function n(t){return t.port||r(t.protocol||e.protocol)}return!!(t.protocol&&t.protocol!=e.protocol||t.host&&t.host!=e.host||t.host&&n(t)!=n(e))}function O(e){var t=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/,r=t.exec(e)||[];return{protocol:r[1]||'',host:r[2]||'',port:r[3]||''}}function D(){return new XMLHttpRequest}function U(e,t,r,n,a,d,i){'use strict';function s(){var e=t.responseText,r=e.substr(p);r&&c(r),p=Q(e)}var c=e(_e).emit,f=e(he).emit,p=0,l=!0;e(ke).on(function(){t.onreadystatechange=null,t.abort()}),'onprogress'in t&&(t.onprogress=s),t.onreadystatechange=function(){function r(){try{l&&e(ge).emit(t.status,L(t.getAllResponseHeaders())),l=!1}catch(t){}}switch(t.readyState){case 2:case 3:return r();case 4:r();var n=2==(t.status+'')[0];n?(s(),e(ve).emit()):f(K(t.status,t.responseText));}};try{for(var u in t.open(r,n,!0),d)t.setRequestHeader(u,d[u]);j(o.location,O(n))||t.setRequestHeader('X-Requested-With','XMLHttpRequest'),t.withCredentials=i,t.send(a)}catch(t){o.setTimeout(Z(f,K(void 0,void 0,t)),0)}}function H(e,t){return{key:e,node:t}}function F(e){function t(e,t){var r=ie(re(e));return v(i,r)?n(e,Q(r),t):e}function r(e,t,r){ie(re(e))[t]=r}function n(e,t,n){e&&r(e,t,n);var o=S(H(t,n),e);return a(o),o}var a=e(pe).emit,o=e(le).emit,d=e(ye).emit,s=e(me).emit,c={};return c[Se]=function(e,a){if(!e)return d(a),n(e,se,a);var o=t(e,a),i=ne(o),s=de(re(o));return r(i,s,a),S(H(s,a),i)},c[we]=function(e){return o(e),ne(e)||s(ie(re(e)))},c[xe]=n,c}function q(e,t,r){function n(e){return function(t){return t.id==e}}var a,o;return{on:function(r,n){var d={listener:r,id:n||r};return t&&t.emit(e,r,d.id),a=S(d,a),o=S(r,o),this},emit:function(){T(o,arguments)},un:function(t){var d;a=C(a,n(t),function(e){d=e}),d&&(o=C(o,function(e){return e==d.listener}),r&&r.emit(e,d.listener,d.id))},listeners:function(){return o},hasListener:function(e){var t=e?n(e):y;return k(N(t,a))}}}function z(){function e(e){return r[e]=q(e,n,a)}function t(t){return r[t]||e(t)}var r={},n=e('newListener'),a=e('removeListener');return['emit','on','un'].forEach(function(e){t[e]=u(function(r,n){l(n,t(r)[e])})}),t}function K(e,t,r){try{var n=c.parse(t)}catch(t){}return{statusCode:e,body:t,jsonBody:n,thrown:r}}function V(e,t){function r(e,t,r){var n=B(r);e(t,A(ne(E(de,n))),A(E(ie,n)))}function n(t,n,a){var o=e(t).emit;n.on(function(e){var t=a(e);!1!==t&&r(o,ie(t),e)},t),e('removeListener').on(function(r){r!=t||e(r).listeners()||n.un(t)})}var a={node:e(le),path:e(pe)};e('newListener').on(function(e){var r=/(node|path):(.*)/.exec(e);if(r){var o=a[r[1]];o.hasListener(e)||n(e,o,t(r[2]))}})}function G(e,t){function r(t,r){return e(t).on(a(r),r),S}function n(e,t,r){r=r||t;var n=a(t);return e.on(function(){var t=!1;S.forget=function(){t=!0},l(arguments,n),delete S.forget,t&&e.un(r)},r),S}function a(e){return function(){try{return e.apply(S,arguments)}catch(t){setTimeout(function(){throw new s(t.message)})}}}function o(t,r){return e(t+':'+r)}function d(e){return function(){var t=e.apply(this,arguments);k(t)&&(t==Y.drop?h():y(t))}}function i(e,t,r){var a;a='node'==e?d(r):r,n(o(e,t),a,r)}function c(e,t){for(var r in t)i(e,r,t[r])}function f(e,t,r){return ee(t)?i(e,t,r):c(e,t),S}var p=/^(node|path):./,b=e(me),h=e(be).emit,y=e(ue).emit,v=u(function(t,r){if(S[t])l(r,S[t]);else{var a=e(t),o=r[0];p.test(t)?n(a,o):a.on(o)}return S}),x=function(t,r,n){if('done'==t)b.un(r);else if('node'==t||'path'==t)e.un(t+':'+r,n);else{e(t).un(r)}return S},S;return e(ye).on(function(e){S.root=g(e)}),e(ge).on(function(e,t){S.header=function(e){return e?t[e]:t}}),S={on:v,addListener:v,removeListener:x,emit:e.emit,node:Z(f,'node'),path:Z(f,'path'),done:Z(n,b),start:Z(r,ge),fail:e(he).on,abort:e(ke).emit,header:m,root:m,source:t}}function W(e,t,r,n,a){var o=z();return t&&U(o,D(),e,t,r,n,a),R(o),M(o,F(o)),V(o,ce),G(o,t)}function X(e,t,r,n,a,o,d){return a=a?c.parse(c.stringify(a)):{},n?(!ee(n)&&(n=c.stringify(n),a['Content-Type']=a['Content-Type']||'application/json'),a['Content-Length']=a['Content-Length']||n.length):n=null,e(r||'GET',function(e,t){return!1===t&&(e+=-1==e.indexOf('?')?'?':'&',e+='_='+new Date().getTime()),e}(t,d),n,a,o||!1)}function Y(e){var t=ae('resume','pause','pipe'),r=Z(x,t);return e?r(e)||ee(e)?X(W,e):X(W,e.url,e.method,e.body,e.headers,e.withCredentials,e.cached):W()}var Z=u(function(e,t){var r=t.length;return u(function(n){for(var a=0;aObject(f.isUndefined)(e)||Object(f.isNull)(e),T=(e)=>{for(;e&&e.startsWith('0x0');)e=`0x${e.slice(3)}`;return e},B=(e)=>(1==e.length%2&&(e=e.replace('0x','0x0')),e);class N extends I.a{constructor(e,t,r,n,a,o,d,i,s){super(e,t,r,n,a,o,d),this.utils=i,this.formatters=s,this.wallet=new R(this)}_addAccountFunctions(e){const t=this;return e.signTransaction=function(r,n){return t.signTransaction(r,e.privateKey,n)},e.sign=function(r){return t.sign(r,e.privateKey)},e.encrypt=function(r,n){return t.encrypt(e.privateKey,r,n)},e}create(e){return this._addAccountFunctions(u.a.create(e||this.utils.randomHex(32)))}privateKeyToAccount(e){return this._addAccountFunctions(u.a.fromPrivate(e))}signTransaction(e,t,r){function n(e){if(e.gas||e.gasLimit||(o=new Error('gas is missing')),(0>e.nonce||0>e.gas||0>e.gasPrice||0>e.chainId)&&(o=new Error('Gas, gasPrice, nonce or chainId is lower than 0')),o)return r(o),Promise.reject(o);try{e=a.formatters.inputCallFormatter(e);const r=e;r.to=e.to||'0x',r.data=e.data||'0x',r.value=e.value||'0x',r.chainId=a.utils.numberToHex(e.chainId);const n=y.a.encode([x.a.fromNat(r.nonce),x.a.fromNat(r.gasPrice),x.a.fromNat(r.gas),r.to.toLowerCase(),x.a.fromNat(r.value),r.data,x.a.fromNat(r.chainId||'0x1'),'0x','0x']),o=h.a.keccak256(n),i=u.a.makeSigner(2*v.a.toNumber(r.chainId||'0x1')+35)(h.a.keccak256(n),t),s=y.a.decode(n).slice(0,6).concat(u.a.decodeSignature(i));s[6]=B(T(s[6])),s[7]=B(T(s[7])),s[8]=B(T(s[8]));const c=y.a.encode(s),f=y.a.decode(c);d={messageHash:o,v:T(f[6]),r:T(f[7]),s:T(f[8]),rawTransaction:c}}catch(t){return r(t),Promise.reject(t)}return r(null,d),d}const a=this;let o=!1,d;return r=r||(()=>{}),e?void 0!==e.nonce&&void 0!==e.chainId&&void 0!==e.gasPrice?Promise.resolve(n(e)):Promise.all([P(e.chainId)?a.getId():e.chainId,P(e.gasPrice)?a.getGasPrice():e.gasPrice,P(e.nonce)?a.getTransactionCount(a.privateKeyToAccount(t).address):e.nonce]).then((t)=>{if(P(t[0])||P(t[1])||P(t[2]))throw new Error(`One of the values 'chainId', 'gasPrice', or 'nonce' couldn't be fetched: ${JSON.stringify(t)}`);return n(Object(f.extend)(e,{chainId:t[0],gasPrice:t[1],nonce:t[2]}))}):(o=new Error('No transaction object given!'),r(o),Promise.reject(o))}recoverTransaction(e){const t=y.a.decode(e),r=u.a.encodeSignature(t.slice(6,9)),n=x.a.toNumber(t[6]),a=35>n?[]:[x.a.fromNumber(n-35>>1),'0x','0x'],o=t.slice(0,6).concat(a),d=y.a.encode(o);return u.a.recover(h.a.keccak256(d),r)}hashMessage(e){const t=this.utils.isHexStrict(e)?this.utils.hexToBytes(e):e,r=n.from(t),a=`\x19Ethereum Signed Message:\n${t.length}`,o=n.from(a),d=n.concat([o,r]);return h.a.keccak256s(d)}sign(e,t){const r=this.hashMessage(e),n=u.a.sign(r,t),a=u.a.decodeSignature(n);return{message:e,messageHash:r,v:a[0],r:a[1],s:a[2],signature:n}}recover(e,t,r){const n=[].slice.apply(arguments);return Object(f.isObject)(e)?this.recover(e.messageHash,u.a.encodeSignature([e.v,e.r,e.s]),!0):(r||(e=this.hashMessage(e)),4<=n.length?(r=n.slice(-1)[0],r=!!Object(f.isBoolean)(r)&&!!r,this.recover(e,u.a.encodeSignature(n.slice(1,4)),r)):u.a.recover(e,t))}decrypt(e,t,r){if(!Object(f.isString)(t))throw new Error('No password given.');const a=Object(f.isObject)(e)?e:JSON.parse(r?e.toLowerCase():e);if(3!==a.version)throw new Error('Not a valid V3 wallet');let o,d;if('scrypt'===a.crypto.kdf)d=a.crypto.kdfparams,o=w()(new n(t),new n(d.salt,'hex'),d.n,d.r,d.p,d.dklen);else if('pbkdf2'===a.crypto.kdf){if(d=a.crypto.kdfparams,'hmac-sha256'!==d.prf)throw new Error('Unsupported parameters to PBKDF2');o=C.pbkdf2Sync(new n(t),new n(d.salt,'hex'),d.c,d.dklen,'sha256')}else throw new Error('Unsupported key derivation scheme');const i=new n(a.crypto.ciphertext,'hex'),s=utils.sha3(n.concat([o.slice(16,32),i])).replace('0x','');if(s!==a.crypto.mac)throw new Error('Key derivation failed - possibly wrong password');const c=C.createDecipheriv(a.crypto.cipher,o.slice(0,16),new n(a.crypto.cipherparams.iv,'hex')),p=`0x${n.concat([c.update(i),c.final()]).toString('hex')}`;return this.privateKeyToAccount(p)}encrypt(e,t,r){const a=this.privateKeyToAccount(e);r=r||{};const o=r.salt||C.randomBytes(32),d=r.iv||C.randomBytes(16);let i;const s=r.kdf||'scrypt',c={dklen:r.dklen||32,salt:o.toString('hex')};if('pbkdf2'===s)c.c=r.c||262144,c.prf='hmac-sha256',i=C.pbkdf2Sync(new n(t),o,c.c,c.dklen,'sha256');else if('scrypt'===s)c.n=r.n||8192,c.r=r.r||8,c.p=r.p||1,i=w()(new n(t),o,c.n,c.r,c.p,c.dklen);else throw new Error('Unsupported kdf');const f=C.createCipheriv(r.cipher||'aes-128-ctr',i.slice(0,16),d);if(!f)throw new Error('Unsupported cipher');const p=n.concat([f.update(new n(a.privateKey.replace('0x',''),'hex')),f.final()]),l=this.utils.sha3(n.concat([i.slice(16,32),new n(p,'hex')])).replace('0x','');return{version:3,id:E.a.v4({random:r.uuid||C.randomBytes(16)}),address:a.address.toLowerCase().replace('0x',''),crypto:{ciphertext:p.toString('hex'),cipherparams:{iv:d.toString('hex')},cipher:r.cipher||'aes-128-ctr',kdf:s,kdfparams:c,mac:l.toString('hex')}}}}class R{constructor(e){this._accounts=e,this.length=0,this.defaultKeyName='web3js_wallet'}_findSafeIndex(e=0){return Object(f.has)(this,e)?this._findSafeIndex(e+1):e}_currentIndexes(){const e=Object.keys(this),t=e.map((e)=>parseInt(e)).filter((e)=>9e20>e);return t}create(e,t){for(let r=0;r{e.remove(t)}),this}encrypt(e,t){const r=this,n=this._currentIndexes(),a=n.map((n)=>r[n].encrypt(e,t));return a}decrypt(e,t){const r=this;return e.forEach((e)=>{const n=r._accounts.decrypt(e,t);if(n)r.add(n);else throw new Error('Couldn\'t decrypt accounts. Password wrong?')}),this}save(e,t){return localStorage.setItem(t||this.defaultKeyName,JSON.stringify(this.encrypt(e))),!0}load(e,t){let r=localStorage.getItem(t||this.defaultKeyName);if(r)try{r=JSON.parse(r)}catch(t){}return this.decrypt(r||[],e)}}'undefined'==typeof localStorage&&(delete R.prototype.save,delete R.prototype.load)}).call(this,r(7),r(3).Buffer)},function(e,t,r){var n=r(306),a=r(307),o=a;o.v1=n,o.v4=a,e.exports=o},function(e){'use strict';e.exports=[{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'resolver',outputs:[{name:'',type:'address'}],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'owner',outputs:[{name:'',type:'address'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'label',type:'bytes32'},{name:'owner',type:'address'}],name:'setSubnodeOwner',outputs:[],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'ttl',type:'uint64'}],name:'setTTL',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'ttl',outputs:[{name:'',type:'uint64'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'resolver',type:'address'}],name:'setResolver',outputs:[],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'owner',type:'address'}],name:'setOwner',outputs:[],payable:!1,type:'function'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'owner',type:'address'}],name:'Transfer',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!0,name:'label',type:'bytes32'},{indexed:!1,name:'owner',type:'address'}],name:'NewOwner',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'resolver',type:'address'}],name:'NewResolver',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'ttl',type:'uint64'}],name:'NewTTL',type:'event'}]},function(e){'use strict';e.exports=[{constant:!0,inputs:[{name:'interfaceID',type:'bytes4'}],name:'supportsInterface',outputs:[{name:'',type:'bool'}],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'},{name:'contentTypes',type:'uint256'}],name:'ABI',outputs:[{name:'contentType',type:'uint256'},{name:'data',type:'bytes'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'hash',type:'bytes'}],name:'setMultihash',outputs:[],payable:!1,stateMutability:'nonpayable',type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'multihash',outputs:[{name:'',type:'bytes'}],payable:!1,stateMutability:'view',type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'x',type:'bytes32'},{name:'y',type:'bytes32'}],name:'setPubkey',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'content',outputs:[{name:'ret',type:'bytes32'}],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'addr',outputs:[{name:'ret',type:'address'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'contentType',type:'uint256'},{name:'data',type:'bytes'}],name:'setABI',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'name',outputs:[{name:'ret',type:'string'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'name',type:'string'}],name:'setName',outputs:[],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'hash',type:'bytes32'}],name:'setContent',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'pubkey',outputs:[{name:'x',type:'bytes32'},{name:'y',type:'bytes32'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'addr',type:'address'}],name:'setAddr',outputs:[],payable:!1,type:'function'},{inputs:[{name:'ensAddr',type:'address'}],payable:!1,type:'constructor'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'a',type:'address'}],name:'AddrChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'hash',type:'bytes32'}],name:'ContentChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'name',type:'string'}],name:'NameChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!0,name:'contentType',type:'uint256'}],name:'ABIChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'x',type:'bytes32'},{indexed:!1,name:'y',type:'bytes32'}],name:'PubkeyChanged',type:'event'}]},function(e,t,r){var n=function(){throw'This swarm.js function isn\'t available on the browser.'},a=r(322),o=r(13),d=r(337),i=r(338),s=r(339);e.exports=s({fsp:{readFile:n},files:{download:n,safeDownloadArchived:n,directoryTree:n},os:{platform:n,arch:n},path:{join:n,slice:n},child_process:{spawn:n},defaultArchives:{},mimetype:{lookup:n},request:a,downloadUrl:null,bytes:o,hash:d,pick:i})},function(e){e.exports={a:'1.0.0-beta.36'}},function(e,t,r){'use strict';var n=r(170),a=r(173),o=r(71),d=r(72);e.exports=r(175)(Array,'Array',function(e,t){this._t=d(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,a(1)):'keys'==t?a(0,r):'values'==t?a(0,e[r]):a(0,[r,e[r]])},'values'),o.Arguments=o.Array,n('keys'),n('values'),n('entries')},function(e,t,r){var n=r(23)('unscopables'),a=Array.prototype;a[n]==void 0&&r(25)(a,n,{}),e.exports=function(e){a[n][e]=!0}},function(e,t,r){e.exports=!r(28)&&!r(49)(function(){return 7!=Object.defineProperty(r(90)('div'),'a',{get:function(){return 7}}).a})},function(e,t,r){var n=r(48);e.exports=function(e,t){if(!n(e))return e;var r,a;if(t&&'function'==typeof(r=e.toString)&&!n(a=r.call(e)))return a;if('function'==typeof(r=e.valueOf)&&!n(a=r.call(e)))return a;if(!t&&'function'==typeof(r=e.toString)&&!n(a=r.call(e)))return a;throw TypeError('Can\'t convert object to primitive value')}},function(e){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,r){var n=r(92);e.exports=Object('z').propertyIsEnumerable(0)?Object:function(e){return'String'==n(e)?e.split(''):Object(e)}},function(e,t,r){'use strict';var n=r(89),a=r(176),o=r(36),d=r(25),i=r(71),s=r(179),c=r(96),f=r(187),p=r(23)('iterator'),l=!([].keys&&'next'in[].keys()),u='keys',b='values',h=function(){return this};e.exports=function(e,t,r,m,y,g,v){s(r,t,m);var k=function(e){return!l&&e in A?A[e]:e===u?function(){return new r(this,e)}:e===b?function(){return new r(this,e)}:function(){return new r(this,e)}},x=t+' Iterator',S=y==b,w=!1,A=e.prototype,E=A[p]||A['@@iterator']||y&&A[y],I=E||k(y),C=y?S?k('entries'):I:void 0,P='Array'==t?A.entries||E:E,T,B,N;if(P&&(N=f(P.call(new e)),N!==Object.prototype&&N.next&&(c(N,x,!0),!n&&'function'!=typeof N[p]&&d(N,p,h))),S&&E&&E.name!==b&&(w=!0,I=function(){return E.call(this)}),(!n||v)&&(l||w||!A[p])&&d(A,p,I),i[t]=I,i[x]=h,y)if(T={values:S?I:k(b),keys:g?I:k(u),entries:C},v)for(B in T)B in A||o(A,B,T[B]);else a(a.P+a.F*(l||w),t,T);return T}},function(e,t,r){var n=r(24),a=r(69),o=r(25),d=r(36),i=r(177),s='prototype',c=function(e,t,r){var f=e&c.F,p=e&c.G,l=e&c.S,u=e&c.P,b=e&c.B,h=p?n:l?n[t]||(n[t]={}):(n[t]||{})[s],m=p?a:a[t]||(a[t]={}),y=m[s]||(m[s]={}),g,v,k,x;for(g in p&&(r=t),r)v=!f&&h&&void 0!==h[g],k=(v?h:r)[g],x=b&&v?i(k,n):u&&'function'==typeof k?i(Function.call,k):k,h&&d(h,g,k,e&c.U),m[g]!=k&&o(m,g,x),u&&y[g]!=k&&(y[g]=k)};n.core=a,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t,r){var n=r(178);e.exports=function(e,t,r){return(n(e),void 0===t)?e:1===r?function(r){return e.call(t,r)}:2===r?function(r,n){return e.call(t,r,n)}:3===r?function(r,n,a){return e.call(t,r,n,a)}:function(){return e.apply(t,arguments)}}},function(e){e.exports=function(e){if('function'!=typeof e)throw TypeError(e+' is not a function!');return e}},function(e,t,r){'use strict';var n=r(180),a=r(91),o=r(96),d={};r(25)(d,r(23)('iterator'),function(){return this}),e.exports=function(e,t,r){e.prototype=n(d,{next:a(1,r)}),o(e,t+' Iterator')}},function(e,t,r){var n=r(35),a=r(181),o=r(95),d=r(74)('IE_PROTO'),i=function(){},s='prototype',c=function(){var e=r(90)('iframe'),t=o.length,n='<',a='>',d;for(e.style.display='none',r(186).appendChild(e),e.src='javascript:',d=e.contentWindow.document,d.open(),d.write(n+'script'+a+'document.F=Object'+n+'/script'+a),d.close(),c=d.F;t--;)delete c[s][o[t]];return c()};e.exports=Object.create||function(e,t){var r;return null===e?r=c():(i[s]=n(e),r=new i,i[s]=null,r[d]=e),void 0===t?r:a(r,t)}},function(e,t,r){var n=r(47),a=r(35),o=r(93);e.exports=r(28)?Object.defineProperties:function(e,t){a(e);for(var r=o(t),d=r.length,s=0,i;d>s;)n.f(e,i=r[s++],t[i]);return e}},function(e,t,r){var n=r(50),a=r(72),o=r(183)(!1),d=r(74)('IE_PROTO');e.exports=function(e,t){var r=a(e),s=0,i=[],c;for(c in r)c!=d&&n(r,c)&&i.push(c);for(;t.length>s;)n(r,c=t[s++])&&(~o(i,c)||i.push(c));return i}},function(e,t,r){var n=r(72),a=r(184),o=r(185);e.exports=function(e){return function(t,r,d){var i=n(t),s=a(i.length),c=o(d,s),f;if(e&&r!=r){for(;s>c;)if(f=i[c++],f!=f)return!0;}else for(;s>c;c++)if((e||c in i)&&i[c]===r)return e||c||0;return!e&&-1}}},function(e,t,r){var n=r(94),a=Math.min;e.exports=function(e){return 0e?a(e+t,0):o(e,t)}},function(e,t,r){var n=r(24).document;e.exports=n&&n.documentElement},function(e,t,r){var n=r(50),a=r(188),o=r(74)('IE_PROTO'),d=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=a(e),n(e,o)?e[o]:'function'==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?d:null}},function(e,t,r){var n=r(73);e.exports=function(e){return Object(n(e))}},function(e,t,r){r(28)&&'g'!=/./g.flags&&r(47).f(RegExp.prototype,'flags',{configurable:!0,get:r(97)})},function(){},function(e,t,r){var n=r(192);e.exports=function(e){return'string'==typeof e?n(e)?e.slice(2):e:e}},function(e){e.exports=function(e){if('string'!=typeof e)throw new Error('[is-hex-prefixed] value must be type \'string\', is currently type '+typeof e+', while checking isHexPrefixed.');return'0x'===e.slice(0,2)}},function(e,t,r){var n=r(48),a=r(92),o=r(23)('match');e.exports=function(e){var t;return n(e)&&((t=e[o])===void 0?'RegExp'==a(e):!!t)}},function(e,t,r){e.exports=r(195)},function(e){e.exports=window.crypto},function(e,t,r){r(75)('match',1,function(e,t,r){return[function(r){'use strict';var n=e(this),a=r==void 0?void 0:r[t];return a===void 0?new RegExp(r)[t](n+''):a.call(r,n)},r]})},function(e,t,r){'use strict';function n(e){'string'==typeof e&&e.match(/^0x[0-9A-Fa-f]{40}$/)||l.throwError('invalid address',l.INVALID_ARGUMENT,{arg:'address',value:e}),e=e.toLowerCase();for(var t=e.substring(2).split(''),r=new Uint8Array(40),n=0;40>n;n++)r[n]=t[n].charCodeAt(0);r=c.arrayify(f.keccak256(r));for(var a=0;40>a;a+=2)8<=r[a>>1]>>4&&(t[a]=t[a].toUpperCase()),8<=(15&r[a>>1])&&(t[a+1]=t[a+1].toUpperCase());return'0x'+t.join('')}function a(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+'00';var t='';for(e.split('').forEach(function(e){t+=b[e]});t.length>=i;){var r=t.substring(0,i);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=98-parseInt(t,10)%97+'';2>n.length;)n='0'+n;return n}function o(e){var t=null;if('string'!=typeof e&&l.throwError('invalid address',l.INVALID_ARGUMENT,{arg:'address',value:e}),e.match(/^(0x)?[0-9a-fA-F]{40}$/))'0x'!==e.substring(0,2)&&(e='0x'+e),t=n(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&l.throwError('bad address checksum',l.INVALID_ARGUMENT,{arg:'address',value:e});else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==a(e)&&l.throwError('bad icap checksum',l.INVALID_ARGUMENT,{arg:'address',value:e}),t=new s.default.BN(e.substring(4),36).toString(16);40>t.length;)t='0'+t;t=n('0x'+t)}else l.throwError('invalid address',l.INVALID_ARGUMENT,{arg:'address',value:e});return t}var d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,'__esModule',{value:!0});for(var s=d(r(2)),c=r(29),f=r(198),p=r(200),l=r(53),u=9007199254740991,b={},h=0;10>h;h++)b[h+'']=h+'';for(var h=0;26>h;h++)b[String.fromCharCode(65+h)]=10+h+'';var i=Math.floor(function(e){var t=Math.log10;return t?t(e):Math.log(e)/Math.LN10}(u));t.getAddress=o,t.getIcapAddress=function(e){for(var t=new s.default.BN(o(e).substring(2),16).toString(36).toUpperCase();30>t.length;)t='0'+t;return'XE'+a('XE00'+t)+t},t.getContractAddress=function(e){if(!e.from)throw new Error('missing from address');var t=e.nonce;return o('0x'+f.keccak256(p.encode([o(e.from),c.stripZeros(c.hexlify(t))])).substring(26))}},function(e,t,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var n=r(98),a=r(29);t.keccak256=function(e){return'0x'+n.keccak_256(a.arrayify(e))}},function(e){(function(t){e.exports=t}).call(this,{})},function(e,t,r){'use strict';function n(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function a(e,t,r){for(var n=0,a=0;a=t.length)return t.unshift(192+t.length),t;var r=n(t.length);return r.unshift(247+r.length),r.concat(t)}var a=Array.prototype.slice.call(s.arrayify(e));if(1===a.length&&127>=a[0])return a;if(55>=a.length)return a.unshift(128+a.length),a;var r=n(a.length);return r.unshift(183+r.length),r.concat(a)}function d(e,t,r,n){for(var a=[],o;rt+1+n)throw new Error('invalid rlp');return{consumed:1+n,result:a}}function i(e,t){if(0===e.length)throw new Error('invalid rlp data');if(248<=e[t]){var r=e[t]-247;if(t+1+r>e.length)throw new Error('too short');var n=a(e,t+1,r);if(t+1+r+n>e.length)throw new Error('to short');return d(e,t,t+1+r,r+n)}if(192<=e[t]){var n=e[t]-192;if(t+1+n>e.length)throw new Error('invalid rlp data');return d(e,t,t+1,n)}if(184<=e[t]){var r=e[t]-183;if(t+1+r>e.length)throw new Error('invalid rlp data');var n=a(e,t+1,r);if(t+1+r+n>e.length)throw new Error('invalid rlp data');var o=s.hexlify(e.slice(t+1+r,t+1+r+n));return{consumed:1+r+n,result:o}}if(128<=e[t]){var n=e[t]-128;if(t+1+n>e.length)throw new Error('invlaid rlp data');var o=s.hexlify(e.slice(t+1,t+1+n));return{consumed:1+n,result:o}}return{consumed:1,result:s.hexlify(e[t])}}Object.defineProperty(t,'__esModule',{value:!0});var s=r(29);t.encode=function(e){return s.hexlify(o(e))},t.decode=function(e){var t=s.arrayify(e),r=i(t,0);if(r.consumed!==t.length)throw new Error('invalid rlp data');return r.result}},function(e,t,r){'use strict';function n(e){var t=e.toString(16);return'-'===t[0]?0==t.length%2?'-0x0'+t.substring(1):'-0x'+t.substring(1):1==t.length%2?'0x0'+t:'0x'+t}function a(e){return i(e)._bn}function d(e){return new m(n(e))}function i(e){return e instanceof m?e:new m(e)}var o=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t['default']=e,t};Object.defineProperty(t,'__esModule',{value:!0});var f=s(r(2)),p=r(29),l=r(99),u=r(202),b=c(r(53)),h=new f.default.BN(-1),m=function(e){function t(r){var o=e.call(this)||this;if(b.checkNew(o,t),'string'==typeof r)p.isHexString(r)?('0x'==r&&(r='0x0'),l.defineReadOnly(o,'_hex',r)):'-'===r[0]&&p.isHexString(r.substring(1))?l.defineReadOnly(o,'_hex',r):r.match(/^-?[0-9]*$/)?(''==r&&(r='0'),l.defineReadOnly(o,'_hex',n(new f.default.BN(r)))):b.throwError('invalid BigNumber string value',b.INVALID_ARGUMENT,{arg:'value',value:r});else if('number'==typeof r){parseInt(r+'')!==r&&b.throwError('underflow',b.NUMERIC_FAULT,{operation:'setValue',fault:'underflow',value:r,outputValue:parseInt(r+'')});try{l.defineReadOnly(o,'_hex',n(new f.default.BN(r)))}catch(e){b.throwError('overflow',b.NUMERIC_FAULT,{operation:'setValue',fault:'overflow',details:e.message})}}else r instanceof t?l.defineReadOnly(o,'_hex',r._hex):r.toHexString?l.defineReadOnly(o,'_hex',n(a(r.toHexString()))):p.isArrayish(r)?l.defineReadOnly(o,'_hex',n(new f.default.BN(p.hexlify(r).substring(2),16))):b.throwError('invalid BigNumber value',b.INVALID_ARGUMENT,{arg:'value',value:r});return o}return o(t,e),Object.defineProperty(t.prototype,'_bn',{get:function(){return'-'===this._hex[0]?new f.default.BN(this._hex.substring(3),16).mul(h):new f.default.BN(this._hex.substring(2),16)},enumerable:!0,configurable:!0}),t.prototype.fromTwos=function(e){return d(this._bn.fromTwos(e))},t.prototype.toTwos=function(e){return d(this._bn.toTwos(e))},t.prototype.add=function(e){return d(this._bn.add(a(e)))},t.prototype.sub=function(e){return d(this._bn.sub(a(e)))},t.prototype.div=function(e){var t=i(e);return t.isZero()&&b.throwError('division by zero',b.NUMERIC_FAULT,{operation:'divide',fault:'division by zero'}),d(this._bn.div(a(e)))},t.prototype.mul=function(e){return d(this._bn.mul(a(e)))},t.prototype.mod=function(e){return d(this._bn.mod(a(e)))},t.prototype.pow=function(e){return d(this._bn.pow(a(e)))},t.prototype.maskn=function(e){return d(this._bn.maskn(e))},t.prototype.eq=function(e){return this._bn.eq(a(e))},t.prototype.lt=function(e){return this._bn.lt(a(e))},t.prototype.lte=function(e){return this._bn.lte(a(e))},t.prototype.gt=function(e){return this._bn.gt(a(e))},t.prototype.gte=function(e){return this._bn.gte(a(e))},t.prototype.isZero=function(){return this._bn.isZero()},t.prototype.toNumber=function(){try{return this._bn.toNumber()}catch(e){b.throwError('overflow',b.NUMERIC_FAULT,{operation:'setValue',fault:'overflow',details:e.message})}return null},t.prototype.toString=function(){return this._bn.toString(10)},t.prototype.toHexString=function(){return this._hex},t}(u.BigNumber);t.bigNumberify=i,t.ConstantNegativeOne=i(-1),t.ConstantZero=i(0),t.ConstantOne=i(1),t.ConstantTwo=i(2),t.ConstantWeiPerEther=i('1000000000000000000')},function(e,t){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(){return function(){}}();t.BigNumber=r;var n=function(){return function(){}}();t.Indexed=n;var a=function(){return function(){}}();t.MinimalProvider=a;var o=function(){return function(){}}();t.Signer=o;var d=function(){return function(){}}();t.HDNode=d},function(e,t,r){'use strict';function n(e,t){void 0===t&&(t=d.current),t!=d.current&&(e=e.normalize(t));for(var r=[],n=0,a=0,i;ai?r[n++]=i:2048>i?(r[n++]=192|i>>6,r[n++]=128|63&i):55296==(64512&i)&&a+1>18,r[n++]=128|63&i>>12,r[n++]=128|63&i>>6,r[n++]=128|63&i):(r[n++]=224|i>>12,r[n++]=128|63&i>>6,r[n++]=128|63&i);return o.arrayify(r)}var a=String.fromCharCode;Object.defineProperty(t,'__esModule',{value:!0});var o=r(29),d;(function(e){e.current='',e.NFC='NFC',e.NFD='NFD',e.NFKC='NFKC',e.NFKD='NFKD'})(d=t.UnicodeNormalizationForm||(t.UnicodeNormalizationForm={}));t.toUtf8Bytes=n;t.toUtf8String=function(e){e=o.arrayify(e);for(var t='',r=0;r>7){t+=a(n);continue}if(2!=n>>6){var d=null;if(6==n>>5)d=1;else if(14==n>>4)d=2;else if(30==n>>3)d=3;else if(62==n>>2)d=4;else if(126==n>>1)d=5;else continue;if(r+d>e.length){for(;r>6;r++);if(r!=e.length)continue;return t}var i=n&(1<<8-d-1)-1,s;for(s=0;s>6)break;i=i<<6|63&c}if(s!=d){r--;continue}if(65535>=i){t+=a(i);continue}i-=65536,t+=a((1023&i>>10)+55296,(1023&i)+56320)}}return t}},function(e,t){'use strict';function r(e){var t=e.length;if(0>16,d[s++]=255&i>>8,d[s++]=255&i;return 2===o&&(i=f[e.charCodeAt(l)]<<2|f[e.charCodeAt(l+1)]>>4,d[s++]=255&i),1===o&&(i=f[e.charCodeAt(l)]<<10|f[e.charCodeAt(l+1)]<<4|f[e.charCodeAt(l+2)]>>2,d[s++]=255&i>>8,d[s++]=255&i),d}function o(e){return c[63&e>>18]+c[63&e>>12]+c[63&e>>6]+c[63&e]}function d(e,t,r){for(var n=[],a=t,d;ai?i:o+a));return 1==r?(s=e[t-1],n.push(c[s>>2]+c[63&s<<4]+'==')):2==r&&(s=(e[t-2]<<8)+e[t-1],n.push(c[s>>10]+c[63&s>>4]+c[63&s<<2]+'=')),n.join('')}t.byteLength=function(e){var t=r(e),n=t[0],a=t[1];return 3*(n+a)/4-a},t.toByteArray=a,t.fromByteArray=s;for(var c=[],f=[],p='undefined'==typeof Uint8Array?Array:Uint8Array,l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',u=0,i=l.length;u>1,u=-7,b=a?c-1:0,i=a?-1:1,d=t[n+b],s,e;for(b+=i,s=d&(1<<-u)-1,d>>=-u,u+=f;0>=-u,u+=o;0>1,h=23===f?5.960464477539063e-8-6.617444900424222e-24:0,y=o?0:p-1,i=o?1:-1,d=0>n||0===n&&0>1/n?1:0,s,g,m;for(n=Math.abs(n),isNaN(n)||n===Infinity?(g=isNaN(n)?1:0,s=u):(s=Math.floor(Math.log(n)/Math.LN2),1>n*(m=r(2,-s))&&(s--,m*=2),n+=1<=s+b?h/m:h*r(2,1-b),2<=n*m&&(s++,m/=2),s+b>=u?(g=0,s=u):1<=s+b?(g=(n*m-1)*r(2,f),s+=b):(g=n*r(2,b-1)*r(2,f),s=0));8<=f;t[a+y]=255&g,y+=i,g/=256,f-=8);for(s=s<=0.10.0'},homepage:'https://github.com/theturtle32/WebSocket-Node',keywords:['websocket','websockets','socket','networking','comet','push','RFC-6455','realtime','server','client'],license:'Apache-2.0',main:'index',name:'websocket',repository:{type:'git',url:'git+https://github.com/theturtle32/WebSocket-Node.git'},scripts:{gulp:'gulp',install:'(node-gyp rebuild 2> builderror.log) || (exit 0)',test:'faucet test/unit'},version:'1.0.26'}},function(e){'use strict';e.exports={isString:function(e){return'string'==typeof e},isObject:function(e){return'object'==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){'use strict';t.decode=t.parse=r(211),t.encode=t.stringify=r(212)},function(e){'use strict';function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,n,a,o){n=n||'&',a=a||'=';var d={};if('string'!=typeof e||0===e.length)return d;var s=/\+/g;e=e.split(n);var c=1e3;o&&'number'==typeof o.maxKeys&&(c=o.maxKeys);var f=e.length;0c&&(f=c);for(var p=0;p>>0),r=this.head,n=0;r;)a(r.data,t,n),n+=r.data.length,r=r.next;return t},e}(),d&&d.inspect&&d.inspect.custom&&(e.exports.prototype[d.inspect.custom]=function(){var e=d.inspect({length:this.length});return this.constructor.name+' '+e})},function(){},function(e,t,r){(function(e){function n(e,t){this._id=e,this._clearFn=t}var a='undefined'!=typeof e&&e||'undefined'!=typeof self&&self||window,o=Function.prototype.apply;t.setTimeout=function(){return new n(o.call(setTimeout,a,arguments),clearTimeout)},t.setInterval=function(){return new n(o.call(setInterval,a,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(a,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(219),t.setImmediate='undefined'!=typeof self&&self.setImmediate||'undefined'!=typeof e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate='undefined'!=typeof self&&self.clearImmediate||'undefined'!=typeof e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(7))},function(e,t,r){(function(e,t){(function(e){'use strict';function r(e){'function'!=typeof e&&(e=new Function(''+e));for(var t=Array(arguments.length-1),r=0;r{let r=[];for(var n=0;nt(e,()=>r),concat:(e,t)=>e.concat(t),flatten:(e)=>{let t=[];for(let r=0,n=e.length;r{let r=[];for(let n=0,a=t.length;n>>27}function i(e){return e<<30|e>>>2}function f(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}var a=r(4),d=r(33),s=r(6).Buffer,p=[1518500249,1859775393,-1894007588,-899497514],c=Array(80);a(n,d),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(r){for(var n=this._w,l=0|this._a,a=0|this._b,u=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)n[e]=r.readInt32BE(4*e);for(;80>e;++e)n[e]=n[e-3]^n[e-8]^n[e-14]^n[e-16];for(var b=0;80>b;++b){var h=~~(b/20),s=0|o(l)+f(h,a,u,c)+d+n[b]+p[h];d=c,c=u,u=i(a),a=l,l=s}this._a=0|l+this._a,this._b=0|a+this._b,this._c=0|u+this._c,this._d=0|c+this._d,this._e=0|d+this._e},n.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=l,s.call(this,64,56)}function a(e){return e<<1|e>>>31}function o(e){return e<<5|e>>>27}function i(e){return e<<30|e>>>2}function f(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}var d=r(4),s=r(33),c=r(6).Buffer,p=[1518500249,1859775393,-1894007588,-899497514],l=Array(80);d(n,s),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(r){for(var n=this._w,l=0|this._a,u=0|this._b,b=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)n[e]=r.readInt32BE(4*e);for(;80>e;++e)n[e]=a(n[e-3]^n[e-8]^n[e-14]^n[e-16]);for(var h=0;80>h;++h){var m=~~(h/20),s=0|o(l)+f(m,u,b,c)+d+n[h]+p[m];d=c,c=b,b=i(u),u=l,l=s}this._a=0|l+this._a,this._b=0|u+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|d+this._e},n.prototype._hash=function(){var e=c.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=s,d.call(this,64,56)}var a=r(4),o=r(110),d=r(33),i=r(6).Buffer,s=Array(64);a(n,o),n.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},n.prototype._hash=function(){var e=i.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=s,d.call(this,128,112)}var a=r(4),o=r(111),d=r(33),i=r(6).Buffer,s=Array(160);a(n,o),n.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},n.prototype._hash=function(){function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}var t=i.allocUnsafe(48);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},e.exports=n},function(e,t,r){'use strict';function n(e,t){d.call(this,'digest'),'string'==typeof t&&(t=o.from(t)),this._alg=e,this._key=t,t.length>c?t=e(t):t.length>>0},t.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=255&t>>>16,e[2+r]=255&t>>>8,e[3+r]=255&t},t.ip=function(e,t,r,n){for(var a=0,o=0,d=6;0<=d;d-=2){for(var i=0;24>=i;i+=8)a<<=1,a|=1&t>>>i+d;for(var i=0;24>=i;i+=8)a<<=1,a|=1&e>>>i+d}for(var d=6;0<=d;d-=2){for(var i=1;25>=i;i+=8)o<<=1,o|=1&t>>>i+d;for(var i=1;25>=i;i+=8)o<<=1,o|=1&e>>>i+d}r[n+0]=a>>>0,r[n+1]=o>>>0},t.rip=function(e,t,r,n){for(var a=0,o=0,d=0;4>d;d++)for(var i=24;0<=i;i-=8)a<<=1,a|=1&t>>>i+d,a<<=1,a|=1&e>>>i+d;for(var d=4;8>d;d++)for(var i=24;0<=i;i-=8)o<<=1,o|=1&t>>>i+d,o<<=1,o|=1&e>>>i+d;r[n+0]=a>>>0,r[n+1]=o>>>0},t.pc1=function(e,t,r,n){for(var a=0,o=0,d=7;5<=d;d--){for(var i=0;24>=i;i+=8)a<<=1,a|=1&t>>i+d;for(var i=0;24>=i;i+=8)a<<=1,a|=1&e>>i+d}for(var i=0;24>=i;i+=8)a<<=1,a|=1&t>>i+d;for(var d=1;3>=d;d++){for(var i=0;24>=i;i+=8)o<<=1,o|=1&t>>i+d;for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>i+d}for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>i+d;r[n+0]=a>>>0,r[n+1]=o>>>0},t.r28shl=function(e,t){return 268435455&e<>>28-t};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,n,a){for(var o=0,d=0,s=r.length>>>1,c=0;c>>r[c];for(var c=s;c>>r[c];n[a+0]=o>>>0,n[a+1]=d>>>0},t.expand=function(e,t,r){var n=0,a=0;n=(1&e)<<5|e>>>27;for(var o=23;15<=o;o-=4)n<<=6,n|=63&e>>>o;for(var o=11;3<=o;o-=4)a|=63&e>>>o,a<<=6;a|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=a>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var r=0,a=0;4>a;a++){var o=63&e>>>18-6*a,d=n[64*a+o];r<<=4,r|=d}for(var a=0;4>a;a++){var o=63&t>>>18-6*a,d=n[256+64*a+o];r<<=4,r|=d}return r>>>0};var a=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,r=0;r>>a[r];return t>>>0},t.padSplit=function(e,t,r){for(var n=e.toString(2);n.length>>1],r=c.r28shl(r,d),n=c.r28shl(n,d),c.pc2(r,n,e.keys,a)},a.prototype._update=function(e,t,n,a){var o=this._desState,d=c.readUInt32BE(e,t),i=c.readUInt32BE(e,t+4);c.ip(d,i,o.tmp,0),d=o.tmp[0],i=o.tmp[1],'encrypt'===this.type?this._encrypt(o,d,i,o.tmp,0):this._decrypt(o,d,i,o.tmp,0),d=o.tmp[0],i=o.tmp[1],c.writeUInt32BE(n,d,a),c.writeUInt32BE(n,i,a+4)},a.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,p=f}c.rip(l,p,o,d)},a.prototype._decrypt=function(e,n,a,o,d){for(var p=a,l=n,r=e.keys.length-2;0<=r;r-=2){var i=e.keys[r],u=e.keys[r+1];c.expand(p,e.tmp,0),i^=e.tmp[0],u^=e.tmp[1];var b=c.substitute(i,u),s=c.permute(b),f=p;p=(l^s)>>>0,l=f}c.rip(p,l,o,d)}},function(e,t,r){'use strict';function n(e){a.equal(e.length,8,'Invalid IV length'),this.iv=Array(8);for(var t=0;t>n%8,e._prev=a(e._prev,r?i:s);return o}function a(e,t){var r=e.length,n=-1,a=o.allocUnsafe(e.length);for(e=o.concat([e,o.from([t])]);++n>7;return a}var o=r(6).Buffer;t.encrypt=function(e,t,r){for(var a=t.length,d=o.allocUnsafe(a),s=-1;++s>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=d.alloc(16,0),this.cache=d.allocUnsafe(0)}var d=r(6).Buffer,i=d.alloc(16,0);o.prototype.ghash=function(e){for(var t=-1;++t++r;){for(d=0!=(this.state[~~(r/8)]&1<<7-r%8),d&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),i=0!=(1&e[3]),o=3;0>>1|(1&e[o-1])<<31;e[0]>>>=1,i&&(e[0]^=-520093696)}this.state=a(t)},o.prototype.update=function(e){this.cache=d.concat([this.cache,e]);for(var t;16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(d.concat([this.cache,i],16)),this.ghash(a([0,e,0,t])),this.state},e.exports=o},function(e,t,r){function n(e,t,r){p.call(this),this._cache=new a,this._last=void 0,this._cipher=new l.AES(t),this._prev=s.from(r),this._mode=e,this._autopadding=!0}function a(){this.cache=s.allocUnsafe(0)}function o(e){var t=e[15];if(1>t||16(n>>1)-1?(n>>1)-d:d,a.isubn(o)}else o=0;r.push(o);for(var s=0!==a.cmpn(0)&&0===a.andln(n-1)?t+1:1,c=1;c=s;t--)f=(f<<1)+n[t];d.push(f)}for(var p=this.jpoint(null,null,null),a=this.jpoint(null,null,null),u=o;0s)break;var i=o[s];l(0!==i),d='affine'===e.type?0>1]):d.mixedAdd(a[-i-1>>1].neg()):0>1]):d.add(a[-i-1>>1].neg())}return'affine'===e.type?d.toP():d},n.prototype._wnafMulAdd=function(e,t,r,n,d){for(var s=this._wnafT1,l=this._wnafT2,u=this._wnafT3,h=0,m=0;mm)break;for(var x=0;x>1]:0>C&&(i=l[x][-C-1>>1].neg());A='affine'===i.type?A.mixedAdd(i):A.add(i)}}for(var m=0;m=Math.ceil((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,a=0;an[0].cmp(n[1])?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)r=new c(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],p(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}var o;return o=e.basis?e.basis.map(function(e){return{a:new c(e.a,16),b:new c(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:o}}},n.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:c.mont(e),r=new c(2).toRed(t).redInvm(),n=r.redNeg(),a=new c(3).toRed(t).redNeg().redSqrt().redMul(r),o=n.redAdd(a).fromRed(),d=n.redSub(a).fromRed();return[o,d]},n.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,a=this.n.clone(),o=new c(1),d=new c(0),s=new c(0),f=new c(1),p=0,i,l,u,b,h,m,g,v,r,k;0!==n.cmpn(0);){k=a.div(n),v=a.sub(k.mul(n)),r=s.sub(k.mul(o));var x=f.sub(k.mul(d));if(!u&&0>v.cmp(t))i=g.neg(),l=o,u=v.neg(),b=r;else if(u&&2==++p)break;g=v,a=n,n=v,s=o,o=r,f=d,d=x}h=v.neg(),m=r;var y=u.sqr().add(b.sqr()),S=h.sqr().add(m.sqr());return 0<=S.cmp(y)&&(h=i,m=l),u.negative&&(u=u.neg(),b=b.neg()),h.negative&&(h=h.neg(),m=m.neg()),[{a:u,b:b},{a:h,b:m}]},n.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],a=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),d=a.mul(r.a),i=o.mul(n.a),s=a.mul(r.b),c=o.mul(n.b),f=e.sub(d).sub(i),p=s.add(c).neg();return{k1:f,k2:p}},n.prototype.pointFromX=function(e,t){e=new c(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error('invalid point');var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)},n.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(a).cmpn(0)},n.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,a=this._endoWnafT2,o=0;o':''},a.prototype.isInfinity=function(){return this.inf},a.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},a.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),a=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=a.redSqr().redISub(this.x.redAdd(this.x)),d=a.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,d)},a.prototype.getX=function(){return this.x.fromRed()},a.prototype.getY=function(){return this.y.fromRed()},a.prototype.mul=function(e){return e=new c(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a):this.curve._wnafMulAdd(1,n,a,2)},a.prototype.jmulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a,!0):this.curve._wnafMulAdd(1,n,a,2,!0)},a.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},a.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},a.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},s(o,f.BasePoint),n.prototype.jpoint=function(e,t,r){return new o(this,e,t,r)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),a=this.x.redMul(t),o=e.x.redMul(n),d=this.y.redMul(t.redMul(e.z)),i=e.y.redMul(n.redMul(this.z)),s=a.redSub(o),c=d.redSub(i);if(0===s.cmpn(0))return 0===c.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=s.redSqr(),f=r.redMul(s),p=a.redMul(r),l=c.redSqr().redIAdd(f).redISub(p).redISub(p),u=c.redMul(p.redISub(l)).redISub(d.redMul(f)),b=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,u,b)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,a=e.x.redMul(t),o=this.y,d=e.y.redMul(t).redMul(this.z),i=n.redSub(a),s=o.redSub(d);if(0===i.cmpn(0))return 0===s.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=i.redSqr(),c=r.redMul(i),f=n.redMul(r),p=s.redSqr().redIAdd(c).redISub(f).redISub(f),l=s.redMul(f.redISub(p)).redISub(o.redMul(c)),u=this.z.redMul(i);return this.curve.jpoint(p,l,u)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r':''},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){'use strict';function n(e){s.call(this,'mont',e),this.a=new d(e.a,16).toRed(this.red),this.b=new d(e.b,16).toRed(this.red),this.i4=new d(4).toRed(this.red).redInvm(),this.two=new d(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function a(e,t,r){s.BasePoint.call(this,e,'projective'),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new d(t,16),this.z=new d(r,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var o=r(61),d=r(2),i=r(4),s=o.base,c=r(10),f=c.utils;i(n,s),e.exports=n,n.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t),a=n.redSqrt();return 0===a.redSqr().cmp(n)},i(a,s.BasePoint),n.prototype.decodePoint=function(e,t){return this.point(f.toArray(e,t),1)},n.prototype.point=function(e,t){return new a(this,e,t)},n.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},a.prototype.precompute=function(){},a.prototype._encode=function(){return this.getX().toArray('be',this.curve.p.byteLength())},a.fromJSON=function(e,t){return new a(e,t[0],t[1]||e.one)},a.prototype.inspect=function(){return this.isInfinity()?'':''},a.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},a.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),r=this.x.redSub(this.z),n=r.redSqr(),a=t.redSub(n),o=t.redMul(n),d=a.redMul(n.redAdd(this.curve.a24.redMul(a)));return this.curve.point(o,d)},a.prototype.add=function(){throw new Error('Not supported on Montgomery curve')},a.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),a=e.x.redAdd(e.z),o=e.x.redSub(e.z),d=o.redMul(r),i=a.redMul(n),s=t.z.redMul(d.redAdd(i).redSqr()),c=t.x.redMul(d.redISub(i).redSqr());return this.curve.point(s,c)},a.prototype.mul=function(e){for(var r=e.clone(),t=this,n=this.curve.point(null,null),a=this,o=[];0!==r.cmpn(0);r.iushrn(1))o.push(r.andln(1));for(var d=o.length-1;0<=d;d--)0===o[d]?(t=t.diffAdd(n,a),n=n.dbl()):(n=t.diffAdd(n,a),t=t.dbl());return n},a.prototype.mulAdd=function(){throw new Error('Not supported on Montgomery curve')},a.prototype.jumlAdd=function(){throw new Error('Not supported on Montgomery curve')},a.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},a.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){'use strict';function n(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,c.call(this,'edwards',e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),f(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function a(e,r,n,a,o){c.BasePoint.call(this,e,'projective'),null===r&&null===n&&null===a?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(r,16),this.y=new i(n,16),this.z=a?new i(a,16):this.curve.one,this.t=o&&new i(o,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.y.red&&(this.y=this.y.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),!this.zOne&&(this.t=this.t.redMul(this.z.redInvm()))))}var o=r(61),d=r(10),i=r(2),s=r(4),c=o.base,f=d.utils.assert;s(n,c),e.exports=n,n.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},n.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},n.prototype.jpoint=function(e,r,n,a){return this.point(e,r,n,a)},n.prototype.pointFromX=function(e,t){e=new i(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(a.redInvm()),d=o.redSqrt();if(0!==d.redSqr().redSub(o).cmp(this.zero))throw new Error('invalid point');var s=d.fromRed().isOdd();return(t&&!s||!t&&s)&&(d=d.redNeg()),this.point(e,d)},n.prototype.pointFromY=function(e,t){e=new i(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.one),a=r.redMul(this.d).redAdd(this.one),o=n.redMul(a.redInvm());if(0===o.cmp(this.zero))if(t)throw new Error('invalid point');else return this.point(this.zero,e);var d=o.redSqrt();if(0!==d.redSqr().redSub(o).cmp(this.zero))throw new Error('invalid point');return d.isOdd()!==t&&(d=d.redNeg()),this.point(d,e)},n.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),a=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(a)},s(a,c.BasePoint),n.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},n.prototype.point=function(e,r,n,o){return new a(this,e,r,n,o)},a.fromJSON=function(e,t){return new a(e,t[0],t[1],t[2])},a.prototype.inspect=function(){return this.isInfinity()?'':''},a.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},a.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var a=this.curve._mulA(t),o=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),e=a.redAdd(r),d=e.redSub(n),i=a.redSub(r),s=o.redMul(d),c=e.redMul(i),f=o.redMul(i),p=d.redMul(e);return this.curve.point(s,c,p,f)},a.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),a,o,d;if(this.curve.twisted){var i=this.curve._mulA(r),e=i.redAdd(n);if(this.zOne)a=t.redSub(r).redSub(n).redMul(e.redSub(this.curve.two)),o=e.redMul(i.redSub(n)),d=e.redSqr().redSub(e).redSub(e);else{var s=this.z.redSqr(),c=e.redSub(s).redISub(s);a=t.redSub(r).redISub(n).redMul(c),o=e.redMul(i.redSub(n)),d=e.redMul(c)}}else{var i=r.redAdd(n),s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=i.redSub(s).redSub(s);a=this.curve._mulC(t.redISub(i)).redMul(c),o=this.curve._mulC(i).redMul(r.redISub(n)),d=i.redMul(c)}return this.curve.point(a,o,d)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},a.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),a=this.t.redMul(this.curve.dd).redMul(t.t),o=this.z.redMul(t.z.redAdd(t.z)),d=n.redSub(r),e=o.redSub(a),i=o.redAdd(a),s=n.redAdd(r),c=d.redMul(e),f=i.redMul(s),p=d.redMul(s),l=e.redMul(i);return this.curve.point(c,f,l,p)},a.prototype._projAdd=function(t){var r=this.z.redMul(t.z),n=r.redSqr(),a=this.x.redMul(t.x),o=this.y.redMul(t.y),d=this.curve.d.redMul(a).redMul(o),e=n.redSub(d),i=n.redAdd(d),s=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(a).redISub(o),c=r.redMul(e).redMul(s),f,p;return this.curve.twisted?(f=r.redMul(i).redMul(o.redSub(this.curve._mulA(a))),p=e.redMul(i)):(f=r.redMul(i).redMul(o.redSub(a)),p=this.curve._mulC(e).redMul(i)),this.curve.point(c,f,p)},a.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},a.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},a.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},a.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},a.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},a.prototype.getY=function(){return this.normalize(),this.y.fromRed()},a.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},a.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),a=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(r.redIAdd(a),0===this.x.cmp(r))return!0}return!1},a.prototype.toP=a.prototype.normalize,a.prototype.mixedAdd=a.prototype.add},function(e,t,r){'use strict';function n(e){this.curve='short'===e.type?new i.curve.short(e):'edwards'===e.type?new i.curve.edwards(e):new i.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),'Invalid curve'),s(this.g.mul(this.n).isInfinity(),'Invalid curve, G*N != O')}function a(e,t){Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get:function(){var r=new n(t);return Object.defineProperty(o,e,{configurable:!0,enumerable:!0,value:r}),r}})}var o=t,d=r(81),i=r(10),s=i.utils.assert;o.PresetCurve=n,a('p192',{type:'short',prime:'p192',p:'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',a:'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',b:'64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',n:'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',hash:d.sha256,gRed:!1,g:['188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012','07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811']}),a('p224',{type:'short',prime:'p224',p:'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',a:'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',b:'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',n:'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',hash:d.sha256,gRed:!1,g:['b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21','bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34']}),a('p256',{type:'short',prime:null,p:'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',a:'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',b:'5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',n:'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',hash:d.sha256,gRed:!1,g:['6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296','4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5']}),a('p384',{type:'short',prime:null,p:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff',a:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc',b:'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',n:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',hash:d.sha384,gRed:!1,g:['aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7','3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f']}),a('p521',{type:'short',prime:null,p:'000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff',a:'000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc',b:'00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',n:'000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',hash:d.sha512,gRed:!1,g:['000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66','00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650']}),a('curve25519',{type:'mont',prime:'p25519',p:'7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',a:'76d06',b:'1',n:'1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',hash:d.sha256,gRed:!1,g:['9']}),a('ed25519',{type:'edwards',prime:'p25519',p:'7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',a:'-1',c:'1',d:'52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',n:'1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',hash:d.sha256,gRed:!1,g:['216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a','6666666666666666666666666666666666666666666666666666666666666658']});var c;try{c=r(275)}catch(t){c=void 0}a('secp256k1',{type:'short',prime:'k256',p:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',a:'0',b:'7',n:'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',h:'1',hash:d.sha256,beta:'7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',lambda:'5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',basis:[{a:'3086d221a7d46bcde86c90e49284eb15',b:'-e4437ed6010e88286f547fa90abfe4c3'},{a:'114ca50f7a8e2f3f657c1108d9d44cfd8',b:'3086d221a7d46bcde86c90e49284eb15'}],gRed:!1,g:['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798','483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',c]})},function(e,t,r){'use strict';t.sha1=r(270),t.sha224=r(271),t.sha256=r(132),t.sha384=r(272),t.sha512=r(133)},function(e,t,r){'use strict';function n(){return this instanceof n?void(i.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)):new n}var a=r(17),o=r(43),d=r(131),f=a.rotl32,p=a.sum32,l=a.sum32_5,u=d.ft_1,i=o.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];a.inherits(n,i),e.exports=n,n.blockSize=512,n.outSize=160,n.hmacStrength=80,n.padLength=64,n.prototype._update=function(r,n){for(var o=this.W,m=0;16>m;m++)o[m]=r[n+m];for(;m=e?t^r^n:31>=e?t&r|~t&n:47>=e?(t|~r)^n:63>=e?t&n|r&~n:t^(r|~n)}function d(e){return 15>=e?0:31>=e?1518500249:47>=e?1859775393:63>=e?2400959708:2840853838}function i(e){return 15>=e?1352829926:31>=e?1548603684:47>=e?1836072691:63>=e?2053994217:0}var c=n(17),f=n(43),p=c.rotl32,l=c.sum32,u=c.sum32_3,b=c.sum32_4,h=f.BlockHash;c.inherits(a,h),t.ripemd160=a,a.blockSize=512,a.outSize=160,a.hmacStrength=192,a.padLength=64,a.prototype._update=function(e,t){for(var n=this.h[0],a=this.h[1],c=this.h[2],f=this.h[3],h=this.h[4],g=n,v=a,k=c,x=f,S=h,w=0,A;80>w;w++)A=l(p(b(n,o(w,a,c,f),e[m[w]+t],d(w)),y[w]),h),n=h,h=f,f=p(c,10),c=a,a=A,A=l(p(b(g,o(79-w,v,k,x),e[r[w]+t],i(w)),s[w]),S),g=S,S=x,x=p(k,10),k=v,v=A;A=u(this.h[1],c,x),this.h[1]=u(this.h[2],f,S),this.h[2]=u(this.h[3],h,g),this.h[3]=u(this.h[4],n,v),this.h[4]=u(this.h[0],a,k),this.h[0]=A},a.prototype._digest=function(e){return'hex'===e?c.toHex32(this.h,'little'):c.split32(this.h,'little')};var m=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],r=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],y=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],s=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(e,t,r){'use strict';function n(e,t,r){return this instanceof n?void(this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(a.toArray(t,r))):new n(e,t,r)}var a=r(17),o=r(12);e.exports=n,n.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t=h.cmpn(1)||0<=h.cmp(u))){var m=this.g.mul(h);if(!m.isInfinity()){var y=m.getX(),g=y.umod(this.n);if(0!==g.cmpn(0)){var v=h.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(v=v.umod(this.n),0!==v.cmpn(0)){var k=(m.getY().isOdd()?1:0)|(0===y.cmp(g)?0:2);return d.canonical&&0d.cmpn(1)||0<=d.cmp(this.n))return!1;if(0>r.cmpn(1)||0<=r.cmp(this.n))return!1;var i=r.invm(this.n),s=i.mul(e).umod(this.n),c=i.mul(d).umod(this.n);if(!this.curve._maxwellTrick){var l=this.g.mulAdd(s,n.getPublic(),c);return!l.isInfinity()&&0===l.getX().umod(this.n).cmp(d)}var l=this.g.jmulAdd(s,n.getPublic(),c);return!l.isInfinity()&&l.eqXToP(d)},n.prototype.recoverPubKey=function(t,o,d,i){c((3&d)===d,'The recovery param is more than two bits'),o=new f(o,i);var p=this.n,n=new a(t),e=o.r,r=o.s,s=1&d,l=d>>1;if(0<=e.cmp(this.curve.p.umod(this.curve.n))&&l)throw new Error('Unable to find sencond key candinate');e=l?this.curve.pointFromX(e.add(this.curve.n),s):this.curve.pointFromX(e,s);var u=o.r.invm(p),b=p.sub(n).mul(u).umod(p),h=r.mul(u).umod(p);return this.g.mulAdd(b,e,h)},n.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new f(e,n),null!==e.recoveryParam)return e.recoveryParam;for(var a=0;4>a;a++){var o;try{o=this.recoverPubKey(t,e,a)}catch(t){continue}if(o.eq(r))return a}throw new Error('Unable to find valid recovery factor')}},function(e,t,r){'use strict';function n(e){if(!(this instanceof n))return new n(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||'hex'),r=o.toArray(e.nonce,e.nonceEnc||'hex'),a=o.toArray(e.pers,e.persEnc||'hex');d(t.length>=this.minEntropy/8,'Not enough entropy. Minimum is: '+this.minEntropy+' bits'),this._init(t,r,a)}var a=r(81),o=r(130),d=r(12);e.exports=n,n.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,'Not enough entropy. Minimum is: '+this.minEntropy+' bits'),this._update(e.concat(r||[])),this._reseed=1},n.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error('Reseed is required');'string'!=typeof t&&(n=r,r=t,t=null),r&&(r=o.toArray(r,n||'hex'),this._update(r));for(var a=[];a.length'}},function(e,t,r){'use strict';function n(e,t){return e instanceof n?e:void(this._importDER(e,t)||(p(e.r&&e.s,'Signature without r or s'),this.r=new c(e.r,16),this.s=new c(e.s,16),this.recoveryParam=void 0===e.recoveryParam?null:e.recoveryParam))}function a(){this.place=0}function o(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=0,a=0,o=t.place;a<(15&r);a++,o++)n<<=8,n|=e[o];return t.place=o,n}function d(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&tt)return void e.push(t);var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(255&t>>>(r<<3));e.push(t)}var c=r(2),s=r(10),f=s.utils,p=f.assert;e.exports=n,n.prototype._importDER=function(e,t){e=f.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var d=o(e,n);if(d+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=o(e,n),p=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var r=o(e,n);if(e.length!==r+n.place)return!1;var l=e.slice(n.place,r+n.place);return 0===p[0]&&128&p[1]&&(p=p.slice(1)),0===l[0]&&128&l[1]&&(l=l.slice(1)),this.r=new c(p),this.s=new c(l),this.recoveryParam=null,!0},n.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=d(t),r=d(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var n=[2];i(n,t.length),n=n.concat(t),n.push(2),i(n,r.length);var a=n.concat(r),o=[48];return i(o,a.length),o=o.concat(a),f.encode(o,e)}},function(e,t,r){'use strict';function n(e){if(i('ed25519'===e,'only tested with ed25519 so far'),!(this instanceof n))return new n(e);var e=o.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=a.sha512}var a=r(81),o=r(10),d=o.utils,i=d.assert,s=d.parseBytes,c=r(281),f=r(282);e.exports=n,n.prototype.sign=function(e,t){e=s(e);var n=this.keyFromSecret(t),a=this.hashInt(n.messagePrefix(),e),r=this.g.mul(a),o=this.encodePoint(r),d=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),i=a.add(d).umod(this.curve.n);return this.makeSignature({R:r,S:i,Rencoded:o})},n.prototype.verify=function(e,t,r){e=s(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),a=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S()),d=t.R().add(n.pub().mul(a));return d.eq(o)},n.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=e.cmpn(0))throw new Error('invalid sig');if(e.cmp(t)>=t)throw new Error('invalid sig')}var d=r(2),i=r(10).ec,c=r(34),s=r(138);e.exports=function(e,r,o,s,f){var p=c(o);if('ec'===p.type){if('ecdsa'!==s&&'ecdsa/rsa'!==s)throw new Error('wrong public key type');return n(e,r,p)}if('dsa'===p.type){if('dsa'!==s)throw new Error('wrong public key type');return a(e,r,p)}if('rsa'!==s&&'ecdsa/rsa'!==s)throw new Error('wrong public key type');r=t.concat([f,r]);for(var l=p.modulus.byteLength(),u=[1],b=0;r.length+u.length+2b?1:0;for(l=Math.min(e.length,u.length),e.length!==u.length&&(m=1),h=-1;++hn-l-2)throw new Error('message too long');var u=new t(n-a-l-2);u.fill(0);var b=n-d-1,h=s(d),m=f(t.concat([o,u,new t([1]),r],b),c(h,b)),y=f(h,c(m,d));return new p(t.concat([new t([0]),y,m],n))}function a(e,r,n){var a=r.length,d=e.modulus.byteLength();if(a>d-11)throw new Error('message too long');var i;return n?(i=new t(d-a-3),i.fill(255)):i=o(d-a-3),new p(t.concat([new t([0,n?1:2]),i,new t([0]),r],d))}function o(e){for(var r=new t(e),n=0,a=s(2*e),o=0,d;n=t.length){o++;break}var d=t.slice(2,a-1),i=t.slice(a-1,a);if(('0002'!==n.toString('hex')&&!r||'0001'!==n.toString('hex')&&r)&&o++,8>d.length&&o++,o)throw new Error('decryption error');return t.slice(a)}function o(e,r){e=new t(e),r=new t(r);var n=0,a=e.length;e.length!==r.length&&(n++,a=Math.min(e.length,r.length));for(var o=-1;++op||0<=new i(r).cmp(c.modulus))throw new Error('decryption error');var u=o?l(new i(r),c):f(r,c);var b=new t(p-u.length);if(b.fill(0),u=t.concat([b,u],p),4===s)return n(c,u);if(1===s)return a(c,u,o);if(3===s)return u;throw new Error('unknown padding')}}).call(this,r(3).Buffer)},function(e,t,r){'use strict';(function(e,n){function a(){throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')}function o(e,t){if('number'!=typeof e||e!==e)throw new TypeError('offset must be a number');if(e>u||0>e)throw new TypeError('offset must be a uint32');if(e>p||e>t)throw new RangeError('offset out of range')}function d(e,t,r){if('number'!=typeof e||e!==e)throw new TypeError('size must be a number');if(e>u||0>e)throw new TypeError('size must be a uint32');if(e+t>r||e>p)throw new RangeError('buffer too small')}function i(e,t,r,a){if(n.browser){var o=e.buffer,d=new Uint8Array(o,t,r);return l.getRandomValues(d),a?void n.nextTick(function(){a(null,e)}):e}if(a)return void c(r,function(r,n){return r?a(r):void(n.copy(e,t),a(null,e))});var i=c(r);return i.copy(e,t),e}var s=r(6),c=r(30),f=s.Buffer,p=s.kMaxLength,l=e.crypto||e.msCrypto,u=4294967295;l&&l.getRandomValues||!n.browser?(t.randomFill=function(t,r,n,a){if(!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if('function'==typeof r)a=r,r=0,n=t.length;else if('function'==typeof n)a=n,n=t.length-r;else if('function'!=typeof a)throw new TypeError('"cb" argument must be a function');return o(r,t.length),d(n,r,t.length),i(t,r,n,a)},t.randomFillSync=function(t,r,n){if('undefined'==typeof r&&(r=0),!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return o(r,t.length),void 0===n&&(n=t.length-r),d(n,r,t.length),i(t,r,n)}):(t.randomFill=a,t.randomFillSync=a)}).call(this,r(7),r(9))},function(e,t,r){(function(t){function n(e,r,n,a,o){if(t.isBuffer(e)&&t.isBuffer(n))e.copy(n,a,r,r+o);else for(;o--;)n[a++]=e[r++]}var a=r(142).pbkdf2Sync,o=2147483647;e.exports=function(e,d,s,c,r,f,p){function l(e,t,n,r,a,o){var d=0,s=128*n,c;for(e.copy(o,d,t,t+s),c=0;c>>32-t}function h(e){var t;for(t=0;16>t;t++)v[t]=(255&e[4*t+0])<<0,v[t]|=(255&e[4*t+1])<<8,v[t]|=(255&e[4*t+2])<<16,v[t]|=(255&e[4*t+3])<<24;for(n(v,0,k,0,16),t=8;0t;++t)v[t]=k[t]+v[t];for(t=0;16>t;t++){var r=4*t;e[r+0]=255&v[t]>>0,e[r+1]=255&v[t]>>8,e[r+2]=255&v[t]>>16,e[r+3]=255&v[t]>>24}}function m(e,t,r,n,a){for(var o=0;o 0 and a power of 2');if(s>o/128/c)throw Error('Parameter N is too large');if(c>o/128/r)throw Error('Parameter r is too large');var y=new t(256*c),g=new t(128*c*s),v=new Int32Array(16),k=new Int32Array(16),x=new t(64),S=a(e,d,1,128*r*c,'sha256'),w;if(p){var A=2*(r*s),E=0;w=function(){++E,0==E%1e3&&p({current:E,total:A,percent:100*(E/A)})}}for(var I=0;I=this._blockSize;){for(var d=this._blockOffset;dr;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error('_digest is not implemented')},e.exports=a},function(e,t,r){function n(e,t,r){var p=t&&r||0,i=t||[];e=e||{};var l=e.node||c,u=void 0===e.clockseq?f:e.clockseq;if(null==l||null==u){var b=a();null==l&&(l=c=[1|b[0],b[1],b[2],b[3],b[4],b[5]]),null==u&&(u=f=16383&(b[6]<<8|b[7]))}var h=void 0===e.msecs?new Date().getTime():e.msecs,m=void 0===e.nsecs?s+1:e.nsecs,y=h-d+(m-s)/1e4;if(0>y&&void 0===e.clockseq&&(u=16383&u+1),(0>y||h>d)&&void 0===e.nsecs&&(m=0),1e4<=m)throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');d=h,s=m,f=u,h+=122192928e5;var g=(1e4*(268435455&h)+m)%4294967296;i[p++]=255&g>>>24,i[p++]=255&g>>>16,i[p++]=255&g>>>8,i[p++]=255&g;var v=268435455&1e4*(h/4294967296);i[p++]=255&v>>>8,i[p++]=255&v,i[p++]=16|15&v>>>24,i[p++]=255&v>>>16,i[p++]=128|u>>>8,i[p++]=255&u;for(var k=0;6>k;++k)i[p+k]=l[k];return t?t:o(i)}var a=r(147),o=r(148),d=0,s=0,c,f;e.exports=n},function(e,t,r){var n=r(147),a=r(148);e.exports=function(e,t,r){var o=t&&r||0;'string'==typeof e&&(t='binary'===e?Array(16):null,e=null),e=e||{};var d=e.random||(e.rng||n)();if(d[6]=64|15&d[6],d[8]=128|63&d[8],t)for(var i=0;16>i;++i)t[o+i]=d[i];return t||a(d)}},function(e,t,r){'use strict';t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=r(62),t.createHash=t.Hash=r(63),t.createHmac=t.Hmac=r(309);var n=r(114),a=Object.keys(n),o=['sha1','sha224','sha256','sha384','sha512','md5','rmd160'].concat(a);t.getHashes=function(){return o};var d=r(142);t.pbkdf2=d.pbkdf2,t.pbkdf2Sync=d.pbkdf2Sync;var i=r(311);t.Cipher=i.Cipher,t.createCipher=i.createCipher,t.Cipheriv=i.Cipheriv,t.createCipheriv=i.createCipheriv,t.Decipher=i.Decipher,t.createDecipher=i.createDecipher,t.Decipheriv=i.Decipheriv,t.createDecipheriv=i.createDecipheriv,t.getCiphers=i.getCiphers,t.listCiphers=i.listCiphers;var s=r(125);t.DiffieHellmanGroup=s.DiffieHellmanGroup,t.createDiffieHellmanGroup=s.createDiffieHellmanGroup,t.getDiffieHellman=s.getDiffieHellman,t.createDiffieHellman=s.createDiffieHellman,t.DiffieHellman=s.DiffieHellman;var c=r(129);t.createSign=c.createSign,t.Sign=c.Sign,t.createVerify=c.createVerify,t.Verify=c.Verify,t.createECDH=r(315);var f=r(316);t.publicEncrypt=f.publicEncrypt,t.privateEncrypt=f.privateEncrypt,t.publicDecrypt=f.publicDecrypt,t.privateDecrypt=f.privateDecrypt;var p=r(319);t.randomFill=p.randomFill,t.randomFillSync=p.randomFillSync,t.createCredentials=function(){throw new Error('sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/crypto-browserify/crypto-browserify')},t.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(e,t,r){'use strict';function n(e,t){d.call(this,'digest'),'string'==typeof t&&(t=s.from(t));var r='sha512'===e||'sha384'===e?128:64;if(this._alg=e,this._key=t,t.length>r){var n='rmd160'===e?new c:f(e);t=n.update(t).digest()}else t.lengthc?t=e(t):t.lengthn-l-2)throw new Error('message too long');var u=new t(n-a-l-2);u.fill(0);var b=n-d-1,h=s(d),m=f(t.concat([o,u,new t([1]),r],b),c(h,b)),y=f(h,c(m,d));return new p(t.concat([new t([0]),y,m],n))}function a(e,r,n){var a=r.length,d=e.modulus.byteLength();if(a>d-11)throw new Error('message too long');var i;return n?(i=new t(d-a-3),i.fill(255)):i=o(d-a-3),new p(t.concat([new t([0,n?1:2]),i,new t([0]),r],d))}function o(e){for(var r=new t(e),n=0,a=s(2*e),o=0,d;n=t.length){o++;break}var d=t.slice(2,a-1),i=t.slice(a-1,a);if(('0002'!==n.toString('hex')&&!r||'0001'!==n.toString('hex')&&r)&&o++,8>d.length&&o++,o)throw new Error('decryption error');return t.slice(a)}function o(e,r){e=new t(e),r=new t(r);var n=0,a=e.length;e.length!==r.length&&(n++,a=Math.min(e.length,r.length));for(var o=-1;++op||0<=new i(r).cmp(c.modulus))throw new Error('decryption error');var u=o?l(new i(r),c):f(r,c);var b=new t(p-u.length);if(b.fill(0),u=t.concat([b,u],p),4===s)return n(c,u);if(1===s)return a(c,u,o);if(3===s)return u;throw new Error('unknown padding')}}).call(this,r(3).Buffer)},function(e,t,r){'use strict';(function(e,n){function a(){throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')}function o(e,t){if('number'!=typeof e||e!==e)throw new TypeError('offset must be a number');if(e>u||0>e)throw new TypeError('offset must be a uint32');if(e>p||e>t)throw new RangeError('offset out of range')}function d(e,t,r){if('number'!=typeof e||e!==e)throw new TypeError('size must be a number');if(e>u||0>e)throw new TypeError('size must be a uint32');if(e+t>r||e>p)throw new RangeError('buffer too small')}function i(e,t,r,a){if(n.browser){var o=e.buffer,d=new Uint8Array(o,t,r);return l.getRandomValues(d),a?void n.nextTick(function(){a(null,e)}):e}if(a)return void c(r,function(r,n){return r?a(r):void(n.copy(e,t),a(null,e))});var i=c(r);return i.copy(e,t),e}var s=r(19),c=r(62),f=s.Buffer,p=s.kMaxLength,l=e.crypto||e.msCrypto,u=4294967295;l&&l.getRandomValues||!n.browser?(t.randomFill=function(t,r,n,a){if(!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if('function'==typeof r)a=r,r=0,n=t.length;else if('function'==typeof n)a=n,n=t.length-r;else if('function'!=typeof a)throw new TypeError('"cb" argument must be a function');return o(r,t.length),d(n,r,t.length),i(t,r,n,a)},t.randomFillSync=function(t,r,n){if('undefined'==typeof r&&(r=0),!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return o(r,t.length),void 0===n&&(n=t.length-r),d(n,r,t.length),i(t,r,n)}):(t.randomFill=a,t.randomFillSync=a)}).call(this,r(7),r(9))},function(e,t,r){var n,a;(function(o,d){n=[r(101),r(321)],a=function(e,t){return d(e,t)}.apply(t,n),!(a!==void 0&&(e.exports=a))})(this,function(e,t){function r(r,n,a){for(var o=[],d=e.ucs2.decode(r),s=0;s>21,l=t.mapStr.substr(65535&f>>5,31&f);if(0==p||n&&1&f>>23)throw new Error('Illegal char '+c);else 1==p?o.push(l):2==p?o.push(a?l:c):3==p&&o.push(c)}var u=o.join('').normalize('NFC');return u}function n(t,n,o){void 0===o&&(o=!1);var d=r(t,o,n),i=d.split('.');return i=i.map(function(t){return t.startsWith('xn--')?(t=e.decode(t.substring(4)),a(t,o,!1)):a(t,o,n),t}),i.join('.')}function a(e,n,a){if('-'===e[2]&&'-'===e[3])throw new Error('Failed to validate '+e);if(e.startsWith('-')||e.endsWith('-'))throw new Error('Failed to validate '+e);if(e.includes('.'))throw new Error('Failed to validate '+e);if(r(e,n,a)!==e)throw new Error('Failed to validate '+e);var o=e.codePointAt(0);if(t.mapChar(o)&16777216)throw new Error('Label contains illegal character: '+o)}function o(t,r){r===void 0&&(r={});var a=!('transitional'in r)||r.transitional,o=!!('useStd3ASCII'in r)&&r.useStd3ASCII,d=!!('verifyDnsLength'in r)&&r.verifyDnsLength,s=n(t,a,o).split('.'),c=s.map(e.toASCII),f=c.join('.'),p;if(d){if(1>f.length||253i.length||63\\$%@\u0621\u0624\u0629"\'^|~\u2985\u2986\u30FB\u30A5\u30E3\xA2\xA3\xAC\xA6\xA5\u20A9\u2502\u2190\u2191\u2192\u2193\u25A0\u25CB\uD801\uDC28\uD801\uDC29\uD801\uDC2A\uD801\uDC2B\uD801\uDC2C\uD801\uDC2D\uD801\uDC2E\uD801\uDC2F\uD801\uDC30\uD801\uDC31\uD801\uDC32\uD801\uDC33\uD801\uDC34\uD801\uDC35\uD801\uDC36\uD801\uDC37\uD801\uDC38\uD801\uDC39\uD801\uDC3A\uD801\uDC3B\uD801\uDC3C\uD801\uDC3D\uD801\uDC3E\uD801\uDC3F\uD801\uDC40\uD801\uDC41\uD801\uDC42\uD801\uDC43\uD801\uDC44\uD801\uDC45\uD801\uDC46\uD801\uDC47\uD801\uDC48\uD801\uDC49\uD801\uDC4A\uD801\uDC4B\uD801\uDC4C\uD801\uDC4D\uD801\uDC4E\uD801\uDC4F\uD801\uDCD8\uD801\uDCD9\uD801\uDCDA\uD801\uDCDB\uD801\uDCDC\uD801\uDCDD\uD801\uDCDE\uD801\uDCDF\uD801\uDCE0\uD801\uDCE1\uD801\uDCE2\uD801\uDCE3\uD801\uDCE4\uD801\uDCE5\uD801\uDCE6\uD801\uDCE7\uD801\uDCE8\uD801\uDCE9\uD801\uDCEA\uD801\uDCEB\uD801\uDCEC\uD801\uDCED\uD801\uDCEE\uD801\uDCEF\uD801\uDCF0\uD801\uDCF1\uD801\uDCF2\uD801\uDCF3\uD801\uDCF4\uD801\uDCF5\uD801\uDCF6\uD801\uDCF7\uD801\uDCF8\uD801\uDCF9\uD801\uDCFA\uD801\uDCFB\uD803\uDCC0\uD803\uDCC1\uD803\uDCC2\uD803\uDCC3\uD803\uDCC4\uD803\uDCC5\uD803\uDCC6\uD803\uDCC7\uD803\uDCC8\uD803\uDCC9\uD803\uDCCA\uD803\uDCCB\uD803\uDCCC\uD803\uDCCD\uD803\uDCCE\uD803\uDCCF\uD803\uDCD0\uD803\uDCD1\uD803\uDCD2\uD803\uDCD3\uD803\uDCD4\uD803\uDCD5\uD803\uDCD6\uD803\uDCD7\uD803\uDCD8\uD803\uDCD9\uD803\uDCDA\uD803\uDCDB\uD803\uDCDC\uD803\uDCDD\uD803\uDCDE\uD803\uDCDF\uD803\uDCE0\uD803\uDCE1\uD803\uDCE2\uD803\uDCE3\uD803\uDCE4\uD803\uDCE5\uD803\uDCE6\uD803\uDCE7\uD803\uDCE8\uD803\uDCE9\uD803\uDCEA\uD803\uDCEB\uD803\uDCEC\uD803\uDCED\uD803\uDCEE\uD803\uDCEF\uD803\uDCF0\uD803\uDCF1\uD803\uDCF2\uD806\uDCC0\uD806\uDCC1\uD806\uDCC2\uD806\uDCC3\uD806\uDCC4\uD806\uDCC5\uD806\uDCC6\uD806\uDCC7\uD806\uDCC8\uD806\uDCC9\uD806\uDCCA\uD806\uDCCB\uD806\uDCCC\uD806\uDCCD\uD806\uDCCE\uD806\uDCCF\uD806\uDCD0\uD806\uDCD1\uD806\uDCD2\uD806\uDCD3\uD806\uDCD4\uD806\uDCD5\uD806\uDCD6\uD806\uDCD7\uD806\uDCD8\uD806\uDCD9\uD806\uDCDA\uD806\uDCDB\uD806\uDCDC\uD806\uDCDD\uD806\uDCDE\uD806\uDCDF\u0131\u0237\u2207\u2202\uD83A\uDD22\uD83A\uDD23\uD83A\uDD24\uD83A\uDD25\uD83A\uDD26\uD83A\uDD27\uD83A\uDD28\uD83A\uDD29\uD83A\uDD2A\uD83A\uDD2B\uD83A\uDD2C\uD83A\uDD2D\uD83A\uDD2E\uD83A\uDD2F\uD83A\uDD30\uD83A\uDD31\uD83A\uDD32\uD83A\uDD33\uD83A\uDD34\uD83A\uDD35\uD83A\uDD36\uD83A\uDD37\uD83A\uDD38\uD83A\uDD39\uD83A\uDD3A\uD83A\uDD3B\uD83A\uDD3C\uD83A\uDD3D\uD83A\uDD3E\uD83A\uDD3F\uD83A\uDD40\uD83A\uDD41\uD83A\uDD42\uD83A\uDD43\u066E\u06A1\u066F\u5B57\u53CC\u591A\u89E3\u4EA4\u6620\u7121\u524D\u5F8C\u518D\u65B0\u521D\u7D42\u8CA9\u58F0\u5439\u6F14\u6295\u6355\u904A\u6307\u7981\u7A7A\u5408\u6E80\u7533\u5272\u55B6\u914D\u5F97\u53EF\u4E3D\u4E38\u4E41\uD840\uDD22\u4F60\u4FBB\u5002\u507A\u5099\u50CF\u349E\uD841\uDE3A\u5154\u5164\u5177\uD841\uDD1C\u34B9\u5167\uD841\uDD4B\u5197\u51A4\u4ECC\u51AC\uD864\uDDDF\u5203\u34DF\u523B\u5246\u5277\u3515\u5305\u5306\u5349\u535A\u5373\u537D\u537F\uD842\uDE2C\u7070\u53CA\u53DF\uD842\uDF63\u53EB\u53F1\u5406\u549E\u5438\u5448\u5468\u54A2\u54F6\u5510\u5553\u5563\u5584\u55AB\u55B3\u55C2\u5716\u5717\u5651\u5674\u58EE\u57CE\u57F4\u580D\u578B\u5832\u5831\u58AC\uD845\uDCE4\u58F2\u58F7\u5906\u5922\u5962\uD845\uDEA8\uD845\uDEEA\u59EC\u5A1B\u5A27\u59D8\u5A66\u36EE\u5B08\u5B3E\uD846\uDDC8\u5BC3\u5BD8\u5BF3\uD846\uDF18\u5BFF\u5C06\u3781\u5C60\u5CC0\u5C8D\uD847\uDDE4\u5D43\uD847\uDDE6\u5D6E\u5D6B\u5D7C\u5DE1\u5DE2\u382F\u5DFD\u5E28\u5E3D\u5E69\u3862\uD848\uDD83\u387C\u5EB0\u5EB3\u5EB6\uD868\uDF92\uD848\uDF31\u8201\u5F22\u38C7\uD84C\uDEB8\uD858\uDDDA\u5F62\u5F6B\u38E3\u5F9A\u5FCD\u5FD7\u5FF9\u6081\u393A\u391C\uD849\uDED4\u60C7\u6148\u614C\u617A\u61B2\u61A4\u61AF\u61DE\u621B\u625D\u62B1\u62D4\u6350\uD84A\uDF0C\u633D\u62FC\u6368\u6383\u63E4\uD84A\uDFF1\u6422\u63C5\u63A9\u3A2E\u6469\u647E\u649D\u6477\u3A6C\u656C\uD84C\uDC0A\u65E3\u66F8\u6649\u3B19\u3B08\u3AE4\u5192\u5195\u6700\u669C\u80AD\u43D9\u6721\u675E\u6753\uD84C\uDFC3\u3B49\u67FA\u6785\u6852\uD84D\uDC6D\u688E\u681F\u6914\u6942\u69A3\u69EA\u6AA8\uD84D\uDEA3\u6ADB\u3C18\u6B21\uD84E\uDCA7\u6B54\u3C4E\u6B72\u6B9F\u6BBB\uD84E\uDE8D\uD847\uDD0B\uD84E\uDEFA\u6C4E\uD84F\uDCBC\u6CBF\u6CCD\u6C67\u6D16\u6D3E\u6D69\u6D78\u6D85\uD84F\uDD1E\u6D34\u6E2F\u6E6E\u3D33\u6EC7\uD84F\uDED1\u6DF9\u6F6E\uD84F\uDF5E\uD84F\uDF8E\u6FC6\u7039\u701B\u3D96\u704A\u707D\u7077\u70AD\uD841\uDD25\u7145\uD850\uDE63\u719C\u7228\u7250\uD851\uDE08\u7280\u7295\uD851\uDF35\uD852\uDC14\u737A\u738B\u3EAC\u73A5\u3EB8\u7447\u745C\u7485\u74CA\u3F1B\u7524\uD853\uDC36\u753E\uD853\uDC92\uD848\uDD9F\u7610\uD853\uDFA1\uD853\uDFB8\uD854\uDC44\u3FFC\u4008\uD854\uDCF3\uD854\uDCF2\uD854\uDD19\uD854\uDD33\u771E\u771F\u778B\u4046\u4096\uD855\uDC1D\u784E\u40E3\uD855\uDE26\uD855\uDE9A\uD855\uDEC5\u79EB\u412F\u7A4A\u7A4F\uD856\uDD7C\uD856\uDEA7\u4202\uD856\uDFAB\u7BC6\u7BC9\u4227\uD857\uDC80\u7CD2\u42A0\u7CE8\u7CE3\u7D00\uD857\uDF86\u7D63\u4301\u7DC7\u7E02\u7E45\u4334\uD858\uDE28\uD858\uDE47\u4359\uD858\uDED9\u7F7A\uD858\uDF3E\u7F95\u7FFA\uD859\uDCDA\uD859\uDD23\u8060\uD859\uDDA8\u8070\uD84C\uDF5F\u43D5\u80B2\u8103\u440B\u813E\u5AB5\uD859\uDFA7\uD859\uDFB5\uD84C\uDF93\uD84C\uDF9C\u8204\u8F9E\u446B\u8291\u828B\u829D\u52B3\u82B1\u82B3\u82BD\u82E6\uD85A\uDF3C\u831D\u8363\u83AD\u8323\u83BD\u83E7\u8353\u83CA\u83CC\u83DC\uD85B\uDC36\uD85B\uDD6B\uD85B\uDCD5\u452B\u84F1\u84F3\u8516\uD85C\uDFCA\u8564\uD85B\uDF2C\u455D\u4561\uD85B\uDFB1\uD85C\uDCD2\u456B\u8650\u8667\u8669\u86A9\u8688\u870E\u86E2\u8728\u876B\u8786\u87E1\u8801\u45F9\u8860\uD85D\uDE67\u88D7\u88DE\u4635\u88FA\u34BB\uD85E\uDCAE\uD85E\uDD66\u46BE\u46C7\u8AA0\uD85F\uDCA8\u8CAB\u8CC1\u8D1B\u8D77\uD85F\uDF2F\uD842\uDC04\u8DCB\u8DBC\u8DF0\uD842\uDCDE\u8ED4\uD861\uDDD2\uD861\uDDED\u9094\u90F1\u9111\uD861\uDF2E\u911B\u9238\u92D7\u92D8\u927C\u93F9\u9415\uD862\uDFFA\u958B\u4995\u95B7\uD863\uDD77\u49E6\u96C3\u5DB2\u9723\uD864\uDD45\uD864\uDE1A\u4A6E\u4A76\u97E0\uD865\uDC0A\u4AB2\uD865\uDC96\u9829\uD865\uDDB6\u98E2\u4B33\u9929\u99A7\u99C2\u99FE\u4BCE\uD866\uDF30\u9C40\u9CFD\u4CCE\u4CED\u9D67\uD868\uDCCE\u4CF8\uD868\uDD05\uD868\uDE0E\uD868\uDE91\u4D56\u9EFE\u9F05\u9F0F\u9F16\uD869\uDE00',mapChar:function(r){return 196608<=r?917760<=r&&917999>=r?18874368:0:e[t[r>>4]][15&r]}}})},function(e,t,r){var n=r(323);e.exports=function(e,t){return new Promise(function(r,a){n(e,t,function(e,t){e?a(e):r(t)})})}},function(e,t,r){var n=r(324),a=r(327),o=r(153),d=r(328),i=r(329),s='application/json',c=function(){};e.exports=function(e,t,r){if(!e||'string'!=typeof e)throw new TypeError('must specify a URL');if('function'==typeof t&&(r=t,t={}),r&&'function'!=typeof r)throw new TypeError('expected cb to be undefined or a function');r=r||c,t=t||{};var f=t.json?'json':'text';t=o({responseType:f},t);var p=t.headers||{},l=(t.method||'GET').toUpperCase(),u=t.query;return u&&('string'!=typeof u&&(u=n.stringify(u)),e=a(e,u)),'json'===t.responseType&&d(p,'Accept',s),t.json&&'GET'!==l&&'HEAD'!==l&&(d(p,'Content-Type',s),t.body=JSON.stringify(t.body)),t.method=l,t.url=e,t.headers=p,delete t.query,delete t.json,i(t,r)}},function(e,t,r){'use strict';function n(e){switch(e.arrayFormat){case'index':return function(t,r,n){return null===r?[o(t,e),'[',n,']'].join(''):[o(t,e),'[',o(n,e),']=',o(r,e)].join('')};case'bracket':return function(t,r){return null===r?o(t,e):[o(t,e),'[]=',o(r,e)].join('')};default:return function(t,r){return null===r?o(t,e):[o(t,e),'=',o(r,e)].join('')};}}function a(e){var t;switch(e.arrayFormat){case'index':return function(e,r,n){return t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,''),t?void(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):void(n[e]=r)};case'bracket':return function(e,r,n){return(t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,''),!t)?void(n[e]=r):void 0===n[e]?void(n[e]=[r]):void(n[e]=[].concat(n[e],r))};default:return function(e,t,r){return void 0===r[e]?void(r[e]=t):void(r[e]=[].concat(r[e],t))};}}function o(e,t){return t.encode?t.strict?c(e):encodeURIComponent(e):e}function d(e){if(Array.isArray(e))return e.sort();return'object'==typeof e?d(Object.keys(e)).sort(function(e,t){return+e-+t}).map(function(t){return e[t]}):e}function i(e){var t=e.indexOf('?');return-1===t?'':e.slice(t+1)}function s(e,t){t=f({arrayFormat:'none'},t);var r=a(t),n=Object.create(null);return'string'==typeof e?(e=e.trim().replace(/^[?#&]/,''),!e)?n:(e.split('&').forEach(function(e){var t=e.replace(/\+/g,' ').split('='),a=t.shift(),o=0arguments.length&&(r=this),'[object Array]'===i.call(e)?n(e,t,r):'string'==typeof e?a(e,t,r):o(e,t,r)};var i=Object.prototype.toString,s=Object.prototype.hasOwnProperty},function(e){e.exports=function(){for(var e={},r=0,n;r=r)return o(r,t);for(var n=4096;n*128{this.resolve=e,this.reject=t}),this.eventEmitter=new i.a,new Proxy(this,{get:this.proxyHandler})}proxyHandler(e,t){if('resolve'===t||'reject'===t)return e[t];if(this.promise[t])return e.promise[t];if(this.eventEmitter[t])return e.eventEmitter[t];throw Error(`Method with name ${t} not found`)}}var c=r(1),f=r(15),p=r(8),l=r(16),u=r(196),b=r(0),h=r.n(b),m=r(157);const y=new m.AbiCoder((e,t)=>!e.match(/^u?int/)||Object(b.isArray)(t)||Object(b.isObject)(t)&&'BN'===t.constructor.name?t:t.toString());class g{constructor(e){this.utils=e}encodeFunctionSignature(e){return Object(b.isObject)(e)&&(e=this.utils._jsonInterfaceMethodToString(e)),this.utils.sha3(e).slice(0,10)}encodeEventSignature(e){return Object(b.isObject)(e)&&(e=this.utils._jsonInterfaceMethodToString(e)),this.utils.sha3(e)}encodeParameter(e,t){return this.encodeParameters([e],[t])}encodeParameters(e,t){return y.encode(this.mapTypes(e),t)}mapTypes(e){const t=[];return e.forEach((e)=>{if(this.isSimplifiedStructFormat(e)){const r=Object.keys(e)[0];return void t.push(Object.assign(this.mapStructNameAndType(r),{components:this.mapStructToCoderFormat(e[r])}))}t.push(e)}),t}isSimplifiedStructFormat(e){return'object'==typeof e&&'undefined'==typeof e.components&&'undefined'==typeof e.name}mapStructNameAndType(e){let t='tuple';return-1'object'==typeof e[r]?void t.push(Object.assign(this.mapStructNameAndType(r),{components:this.mapStructToCoderFormat(e[r])})):void t.push({name:r,type:e[r]})),t}encodeFunctionCall(e,t){return this.encodeFunctionSignature(e)+this.encodeParameters(e.inputs,t).replace('0x','')}decodeParameter(e,t){return this.decodeParameters([e],t)[0]}decodeParameters(e,t){if(!t||'0x'===t||'0X'===t)throw new Error('Returned values aren\'t valid, did it run Out of Gas?');const r=y.decode(this.mapTypes(e),`0x${t.replace(/0x/i,'')}`),a=new n;return a.__length__=0,e.forEach((e,t)=>{let n=r[a.__length__];n='0x'===n?null:n,a[t]=n,Object(b.isObject)(e)&&e.name&&(a[e.name]=n),a.__length__++}),a}decodeLog(e,t,r){const a=this;r=Object(b.isArray)(r)?r:[r],t=t||'';const o=[],d=[];let s=0;e.forEach((e,t)=>{e.indexed?(d[t]=['bool','int','uint','address','fixed','ufixed'].find((t)=>-1!==e.type.indexOf(t))?a.decodeParameter(e.type,r[s]):r[s],s++):o[t]=e});const i=t,c=i?this.decodeParameters(o,i):[],f=new n;return f.__length__=0,e.forEach((e,t)=>{f[t]='string'===e.type?'':null,'undefined'!=typeof c[t]&&(f[t]=c[t]),'undefined'!=typeof d[t]&&(f[t]=d[t]),e.name&&(f[e.name]=f[t]),f.__length__++}),f}}class v{createABICoder(e){return new g(e)}}const k=()=>new v().createABICoder(c.a);class x{constructor(e){this.providersPackageFactory=e}resolve(e,t){if('string'==typeof e){if(/^http(s)?:\/\//i.test(e))return this.providersPackageFactory.createHttpProviderAdapter(this.providersPackageFactory.createHttpProvider(e));if(/^ws(s)?:\/\//i.test(e))return this.providersPackageFactory.createSocketProviderAdapter(this.providersPackageFactory.createWebsocketProvider(e));if(e&&_.isObject(t)&&_.isFunction(t.connect))return this.providersPackageFactory.createSocketProviderAdapter(this.providersPackageFactory.createIpcProvider(e,t))}if(_.isFunction(e.sendAsync))return this.providersPackageFactory.createInpageProviderAdapter(e);switch(e.constructor.name){case'HttpProvider':return this.providersPackageFactory.createHttpProviderAdapter(e);case'WebsocketProvider':case'IpcProvider':return this.providersPackageFactory.createSocketProviderAdapter(e);case'EthereumProvider':case'HttpProviderAdapter':case'SocketProviderAdapter':case'InpageProviderAdapter':return e;}throw Error('Please provide an valid Web3 provider or the EthereumProvider')}}let S;try{S=Function('return this')()}catch(t){S=window}class w{detect(){return'undefined'==typeof S.ethereumProvider?'undefined'!=typeof S.web3&&S.web3.currentProvider?(this.isIpcProviderWrapper(S.web3.currentProvider)&&(S.web3.currentProvider=this.addSubscriptionsToIpcProviderWrapper(S.web3.currentProvider)),S.web3.currentProvider):void 0:S.ethereumProvider}isIpcProviderWrapper(e){return!e.on&&e.connection&&'ipcProviderWrapper'===e.connection.constructor.name}addSubscriptionsToIpcProviderWrapper(e){return e.on=(e,t)=>{if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');'data'===e?this.connection.on('data',(e)=>{let r='';e=e.toString();try{r=JSON.parse(e)}catch(r){return t(new Error(`Couldn't parse response data${e}`))}r.id||-1===r.method.indexOf('_subscription')||t(null,r)}):this.connection.on(e,t)},e}}let A=0;class E{static toPayload(e,t){if(!e)throw new Error(`JSONRPC method should be specified for params: "${JSON.stringify(t)}"!`);return A++,{jsonrpc:'2.0',id:A,method:e,params:t||[]}}static toBatchPayload(e){return e.map((e)=>(e.beforeExecution(),E.toPayload(e.rpcMethod,e.parameters)))}}class I{static isValid(e){return Array.isArray(e)?e.every(this.isResponseItemValid):this.isResponseItemValid(e)}static isResponseItemValid(e){return!!e&&!e.error&&'2.0'===e.jsonrpc&&('number'==typeof e.id||'string'==typeof e.id)&&e.result!==void 0}}var C=r(158),P=r.n(C);class T extends P.a{constructor(e){super(),this.provider=e}send(e,t){const r=E.toPayload(e,t);return new Promise((e,t)=>{this.provider.send(r,(r,n)=>{this.handleResponse(t,e,r,n)})})}sendBatch(e,t){this.provider.send(e,t)}subscribe(){return new Promise((e,t)=>{t(new Error(`The current provider does not support subscriptions: ${this.provider.constructor.name}`))})}unsubscribe(){return new Promise((e,t)=>{t(new Error(`The current provider does not support subscriptions: ${this.provider.constructor.name}`))})}handleResponse(e,t,r,n){return n&&n.id&&payload.id!==n.id?void e(new Error(`Wrong response id "${n.id}" (expected: "${payload.id}") in ${JSON.stringify(payload)}`)):n&&n.error?void e(o.a.ErrorResponse(n)):I.isValid(n.result)?r?void e(r):void t(n.result):void e(o.a.InvalidResponse(n))}isConnected(){return this.provider.connected}}class B extends T{constructor(e){super(e),this.host=e.path,this.subscriptions=[],this.registerSubscriptionListener()}subscribe(e,t,r){return this.send(e,r.unshift(t)).then((e,t)=>{if(!e)return this.subscriptions.push(t),t;throw new Error(`Provider error: ${e}`)})}unsubscribe(e,t){return this.send(t,[e]).then(function(t){return!!t&&(this.subscriptions=this.subscriptions.filter((t)=>t!==e),!0)})}registerSubscriptionListener(){this.provider.on('data',(e,t)=>{e=e||t,e.method&&this.hasSubscription(e.params.subscription)&&this.emit(e.params.subscription,e.params.result)})}hasSubscription(e){return-1{e.push(this.unsubscribe(t))}),Promise.all(e).then(()=>{this.provider.reset(),this.subscriptions=[]})}removeSubscription(e,t){return this.unsubscribe(e,t).then((t)=>!!t&&(delete this.subscriptions[this.subscriptions.indexOf(e)],!0))}}class N extends T{constructor(e){super(e),this.provider.send=this.provider.sendAsync,delete this.provider.sendAsync}isConnected(){return this.provider.isConnected}}class R extends T{constructor(e){super(e),this.host=e.host}}var M=r(65),L=r(52),j=r(159),O=r.n(j);class D{constructor(e,t){this.responseCallbacks={},this.notificationCallbacks=[],this.path=e,this.connected=!1,this.connection=t.connect({path:this.path}),this.addDefaultEvents();const r=(e)=>{let t=null;Object(b.isArray)(e)?e.forEach((e)=>{this.responseCallbacks[e.id]&&(t=e.id)}):t=e.id,t||-1===e.method.indexOf('_subscription')?this.responseCallbacks[t]&&(this.responseCallbacks[t](null,e),delete this.responseCallbacks[t]):this.notificationCallbacks.forEach((t)=>{Object(b.isFunction)(t)&&t(e)})};'Socket'===t.constructor.name?O()(this.connection).done(r):this.connection.on('data',(e)=>{this._parseResponse(e.toString()).forEach(r)})}addDefaultEvents(){this.connection.on('connect',()=>{this.connected=!0}),this.connection.on('close',()=>{this.connected=!1}),this.connection.on('error',()=>{this._timeout()}),this.connection.on('end',()=>{this._timeout()}),this.connection.on('timeout',()=>{this._timeout()})}_parseResponse(e){const t=[],r=e.replace(/\}[\n\r]?\{/g,'}|--|{').replace(/\}\][\n\r]?\[\{/g,'}]|--|[{').replace(/\}[\n\r]?\[\{/g,'}|--|[{').replace(/\}\][\n\r]?\{/g,'}]|--|{').split('|--|');return r.forEach((e)=>{let r=null;this.lastChunk&&(e=this.lastChunk+e);try{r=JSON.parse(e)}catch(t){return this.lastChunk=e,clearTimeout(this.lastChunkTimeout),void(this.lastChunkTimeout=setTimeout(()=>{throw this._timeout(),o.a.InvalidResponse(e)},15000))}clearTimeout(this.lastChunkTimeout),this.lastChunk=null,r&&t.push(r)}),t}_addResponseCallback(e,t){const r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n}_timeout(){for(const e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](o.a.InvalidConnection('on IPC')),delete this.responseCallbacks[e])}reconnect(){this.connection.connect({path:this.path})}send(e,t){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(e)),this._addResponseCallback(e,t)}on(e,t){if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');switch(e){case'data':this.notificationCallbacks.push(t);break;default:this.connection.on(e,t);}}once(e,t){if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');this.connection.once(e,t)}removeListener(e,t){switch(e){case'data':this.notificationCallbacks.forEach((e,r)=>{e===t&&this.notificationCallbacks.splice(r,1)});break;default:this.connection.removeListener(e,t);}}removeAllListeners(e){switch(e){case'data':this.notificationCallbacks=[];break;default:this.connection.removeAllListeners(e);}}reset(){this._timeout(),this.notificationCallbacks=[],this.connection.removeAllListeners('error'),this.connection.removeAllListeners('end'),this.connection.removeAllListeners('timeout'),this.addDefaultEvents()}}var U=r(160),H=r(66),F=r.n(H),q=r(84),z=r.n(q);class K{constructor(e,t={}){this.host=e||'http://localhost:8545','https'===this.host.substring(0,5)?this.httpsAgent=new z.a.Agent({keepAlive:!0}):this.httpAgent=new F.a.Agent({keepAlive:!0}),this.timeout=t.timeout||0,this.headers=t.headers,this.connected=!1}_prepareRequest(){const e=new U.XMLHttpRequest;return e.nodejsSet({httpsAgent:this.httpsAgent,httpAgent:this.httpAgent}),e.open('POST',this.host,!0),e.setRequestHeader('Content-Type','application/json'),e.timeout=this.timeout&&1!==this.timeout?this.timeout:0,e.withCredentials=!0,this.headers&&this.headers.forEach((t)=>{e.setRequestHeader(t.name,t.value)}),e}send(e,t){const r=this._prepareRequest();r.onreadystatechange=()=>{if(4===r.readyState&&1!==r.timeout){let e=r.responseText,n=null;try{e=JSON.parse(e)}catch(t){n=o.a.InvalidResponse(r.responseText)}this.connected=!0,t(n,e)}},r.ontimeout=function(){this.connected=!1,t(o.a.ConnectionTimeout(this.timeout))};try{r.send(JSON.stringify(e))}catch(e){this.connected=!1,t(o.a.InvalidConnection(this.host))}}disconnect(){}}class V{constructor(e,t,r){this.provider=e,this.jsonRpcMapper=t,this.jsonRpcResponseValidator=r,this.requests=[]}add(e){this.requests.push(e)}execute(){this.provider.sendBatch(this.jsonRpcMapper.toBatchPayload(this.requests),(e,t)=>Object(b.isArray)(t)?void this.requests.forEach(function(e,r){const n=t[r]||null;if(Object(b.isFunction)(e.callback)){Object(b.isObject)(n)&&n.error&&e.callback(o.a.ErrorResponse(n)),this.jsonRpcResponseValidator.isValid(n)||e.callback(o.a.InvalidResponse(n));try{const t=e.afterExecution(n.result);e.callback(null,t)}catch(t){e.callback(t,null)}}}):void request.callback(o.a.InvalidResponse(t)))}hasOutputFormatter(e){return Object(b.isFunction)(e.methodModel.outputFormatter)}}class G{createBatchRequest(e){return new V(e,E,I)}createProviderAdapterResolver(){return new x(this)}createProviderDetector(){return new w}createHttpProvider(e){return new K(e)}createWebsocketProvider(e){return new M.a(e)}createIpcProvider(e,t){return new D(e,t)}createHttpProviderAdapter(e){return new R(e)}createSocketProviderAdapter(e){return new B(e)}createInpageProviderAdapter(e){return new N(e)}createJSONRpcResponseValidator(){return new I}}const W={HttpProvider,WebsocketProvider,IpcProvider};class X{constructor(e){this.abi=e}getMethod(e){return!!this.hasMethod(e)&&this.abi.methods[e]}getEvent(e){return!!this.hasEvent(e)&&this.abi.events[e]}getEvents(){return this.abi.events}getEventBySignature(e){return this.abi.events.find((t)=>t.signature===e)}hasMethod(e){return'undefined'!=typeof this.abi.methods[e]}hasEvent(e){return'undefined'!=typeof this.abi.events[e]}}class Y{constructor(e){this.abiItem=e,this.signature=this.abiItem.signature,this.name=this.abiItem.name,this.anonymous=this.abiItem.anonymous,this.contractMethodParameters=[],Object.defineProperty(this,'requestType',{get(){return'function'===e.type?!0===e.constant?'call':'send':'constructor'===e.type?'contract-deployment':void 0}})}getInputLength(){return h.a.isArray(this.abiItem.inputs)?this.abiItem.inputs.length:0}getInputs(){let e=[];return h.a.isArray(this.abiItem.inputs)&&(e=this.abiItem.inputs),e}givenParametersLengthIsValid(){const e=this.getInputLength();return!(this.contractMethodParameters.length!==e)||new Error(`The number of arguments is not matching the methods required number. You need to pass ${e} arguments.`)}getIndexedInputs(){return this.getInputs().filter((e)=>!0===e.indexed)}isOfType(e){return this.abiItem.type===e}}class Z{constructor(e){this.abiCoder=e}encode(e,t){let r;try{r=this.abiCoder.encodeParameters(e.getInputs(),e.contractMethodParameters).replace('0x','')}catch(e){return e}return'constructor'===e.signature?t?t+r:new Error('The contract has no contract data option set. This is necessary to append the constructor parameters.'):e.isOfType('function')?e.signature+r:r}}class J{constructor(e){this.abiCoder=e}encode(e,t){const r=e.getIndexedInputs();let n=[];return r.forEach((e)=>{if('undefined'!=typeof t[e.name]){const r=t[e.name];if(_.isArray(r))return r.map((t)=>this.abiCoder.encodeParameter(e.type,t)),void n.push(r);n.push(this.abiCoder.encodeParameter(e.type,r))}}),n}}class $ extends J{constructor(e){super(e)}encode(e,t){const r=e.getEvents();let n=[];return Object.keys(r).forEach((e)=>{n.push(super.encode(r[e],t))}),n}}class Q{constructor(e){this.abiCoder=e}decode(e,t){if(!t)return null;2<=t.length&&(t=t.slice(2));const r=this.abiCoder.decodeParameters(e,t);return 1===r.__length__?r[0]:r}}var ee=r(67),te=r.n(ee);class re extends te.a{constructor(e,t,r){super(t,r),this.abiModel=e}decode(e,t){return super.decode(this.abiModel.getEventBySignature(t.topics[0]),t)}}class ne{constructor(e,t,r){this.utils=r,this.abiCoder=t,this.contractPackageFactory=e}map(e){const t=this,r={methods:{},events:{}};return e.forEach((e)=>{e.constant=t.isConstant(e),e.payable=t.isPayable(e),e.name&&(e.funcName=t.utils._jsonInterfaceMethodToString(e));let n;return'function'===e.type?(e.signature=t.abiCoder.encodeFunctionSignature(e.funcName),n=t.contractPackageFactory.createABIItemModel(e),r.methods[e.name]?_.isArray(r.methods[e.name])?r.methods[e.name].push(n):r.methods[e.name]=[r.methods[e.name],n]:r.methods[e.name]=n,r.methods[e.signature]=n,void(r.methods[e.funcName]=n)):void('event'===e.type&&(e.signature=t.abiCoder.encodeEventSignature(e.funcName),e=t.contractPackageFactory.createABIItemModel(event),(!r.events[e.name]||'bound '===r.events[e.name].name)&&(r.events[e.name]=n),r.events[e.signature]=n,r.events[e.funcName]=n),'constructor'===e.type&&(e.signature=e.type,r.methods.contractConstructor=t.contractPackageFactory.createABIItemModel(e)))}),this.contractPackageFactory.createABIModel(r)}isConstant(e){return'view'===e.stateMutability||'pure'===e.stateMutability||e.constant}isPayable(e){return'payable'===e.stateMutability||e.payable}}class ae{constructor(e,t){this.utils=e,this.formatters=t}map(e,t){let r=null;t.gasPrice&&(r=t.gasPrice+'');let n=null;return t.from&&(n=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(t.from))),t.data=t.data||e.options.data,t.from=n||e.defaultAccount,t.gasPrice=r||e.options.gasPrice,t.gas=t.gas||t.gasLimit||e.options.gas,delete t.gasLimit,t}}class oe{constructor(e,t){this.formatters=e,this.eventFilterEncoder=t}map(e,t,r){return'undefined'==typeof r.topics&&(r.topics=[]),'undefined'!=typeof r.fromBlock&&(r.fromBlock=this.formatters.inputBlockNumberFormatter(r.fromBlock)),'undefined'!=typeof r.toBlock&&(r.toBlock=this.formatters.inputBlockNumberFormatter(r.toBlock)),e.anonymous||r.topics.unshift(e.signature),'undefined'!=typeof r.filters&&r.topics.concat(this.eventFilterEncoder.encode(e,r.filter)),r.address||(r.address=t.options.address),r}}class de{constructor(e,t){this.formatters=e,this.allEventsFilterEncoder=t}map(e,t,r){return r.topics=[],'undefined'!=typeof r.fromBlock&&(r.fromBlock=this.formatters.inputBlockNumberFormatter(r.fromBlock)),'undefined'!=typeof r.toBlock&&(r.toBlock=this.formatters.inputBlockNumberFormatter(r.toBlock)),'undefined'!=typeof r.filters&&r.topics.concat(this.allEventsFilterEncoder.encode(e,r.filter)),r.address||(r.address=t.options.address),r}}class ie{constructor(e,t,r,n,a,o,d,i){return this.contract=e,this.abiModel=t,this.rpcMethodModelFactory=r,this.methodController=n,this.methodEncoder=a,this.rpcMethodOptionsValidator=o,this.rpcMethodOptionsMapper=d,this.promiEvent=i,new Proxy(this,{get:this.proxyHandler})}proxyHandler(e,t){const r=this.abiModel.getMethod(t);if(r){let t=r.requestType;'contract-deployment'===t&&(t='send');const n=()=>{let n=arguments;'contract-deployment'===t&&(arguments[0].data&&(e.contract.options.data=e.contract.options.data||arguments[0].data),arguments[0].arguments&&(n=arguments[0].arguments)),r.contractMethodParameters=n};n[t]=()=>e.executeMethod(r,arguments),n[t].request=()=>e.createRpcMethodModel(r,arguments),n.estimateGas=()=>(r.requestType='estimate',e.executeMethod(r,arguments)),n.encodeAbi=()=>e.methodEncoder.encode(r,e.contract.options.data)}if(e[t])return this[t];throw Error(`Method with name "${t}" not found`)}executeMethod(e,t){const r=this.createRpcMethodModel(e,t);return'undefined'==typeof r.error?this.methodController.execute(r,this.contract.accounts,this.contract):this.handleValidationError(r.error,r.callback)}createRpcMethodModel(e,t){let r;if(_.isArray(e)){let n=!1;if(e.some((a)=>(r=this.rpcMethodModelFactory.createRpcMethodByRequestType(a,this.contract),r.methodArguments=t,n=e.givenParametersLengthIsValid(),!0===n)),!0!==n)return{error:n,callback:r.callback}}else r=this.rpcMethodModelFactory.createRpcMethodByRequestType(e,this.contract),r.methodArguments=t;const n=e.givenParametersLengthIsValid();if(n instanceof Error)return{error:n,callback:r.callback};const a=this.methodEncoder.encode(e,this.contract.options.data);if(a instanceof Error)return{error:a,callback:r.callback};r.parameters[0].data=a,r.parameters=this.rpcMethodOptionsMapper.map(this.contract,r.parameters[0]);const o=this.rpcMethodOptionsValidator.validate(e,r);return o instanceof Error?{error:o,callback:r.callback}:r}handleValidationError(e,t){const r=new this.promiEvent;return r.resolve(null),r.reject(e),r.emit('error',e),_.isFunction(t)&&t(e,null),r}}class se{constructor(e,t,r,n,a,o,d){return this.contract=e,this.eventSubscriptionFactory=r,this.abiModel=t,this.eventOptionsMapper=n,this.eventLogDecoder=a,this.allEventsLogDecoder=o,this.allEventsOptionsMapper=d,new Proxy(this,{get:this.proxyHandler})}proxyHandler(e,t){if(this.abiModel.hasEvent(t))return(r,n)=>e.subscribe(e.abiModel.getEvent(t),r,n);if('allEvents'===t)return(t,r)=>e.subscribeAll(t,r);if(e[t])return e[t];throw Error(`Event with name "${t}" not found`)}subscribe(e,t,r){return'undefined'!=typeof t.filters&&'undefined'!=typeof t.topics?this.handleValidationError('Invalid subscription options: Only filter or topics are allowed and not both',r):this.eventSubscriptionFactory.createEventLogSubscription(this.eventLogDecoder,e,this.contract,this.eventOptionsMapper.map(e,this.contract,t)).subscribe(r)}subscribeAll(e,t){return'undefined'==typeof e.topics?this.eventSubscriptionFactory.createAllEventLogSubscription(this.allEventsLogDecoder,this.contract,this.allEventsOptionsMapper.map(this.abiModel,this.contract,e)).subscribe(t):this.handleValidationError('Invalid subscription options: Topics are not allowed for the "allEvents" subscription',t)}handleValidationError(e,t){const r=new this.promiEventPackage.PromiEvent;return r.emit('error',new Error(e)),_.isFunction(t)&&t(error,null),r}}class ce{constructor(e){this.utils=e}validate(e,t){return this.isToSet(e,t)?new Error('This contract object doesn\'t have address set yet, please set an address first.'):this.isFromSet(t)?new Error('No "from" address specified in neither the given options, nor the default options.'):!this.isValueValid(e,t)||new Error('Can not send value to non-payable contract method or constructor')}isToSet(e,t){return!('constructor'!==e.signature)||!!t.parameters[0].to}isFromSet(e){return this.utils.isAddress(e.parameters[0].from)}isValueValid(e,t){return!(!e.payable&&t.parameters[0].value&&0this.eventLogDecoder.decode(self.abiItemModel,e)),t}}class ue extends kt{constructor(e,t,r,n,a){super(r,n,a),this.abiItemModel=e,this.allEventsLogDecoder=t}afterExecution(e){return h.a.isArray(e.logs)&&(e.events={},e.logs.map(function(e){return this.allEventsLogDecoder.decode(null,e)}),e.logs.forEach((t,r)=>t.event?e.events[t.event]?h.a.isArray(e.events[t.event])?void e.events[t.event].push(t):void(e.events[t.event]=[e.events[t.event],t]):void(e.events[t.event]=t):void(e.events[r]=t)),delete e.logs),e}}class be{constructor(e,t,r,n){this.utils=r,this.formatters=n,this.callMethodResponseDecoder=e,this.accounts=t}createRpcMethodByRequestType(e,t){let r;switch(e.requestType){case'call':r=this.createCallContractMethodModel(e);break;case'send':r=this.createSendContractMethodModel(e);break;case'estimate':r=this.createEstimateGasMethodModel();break;case'contract-deployment':r=this.createContractDeployMethodModel(t);}if('undefined'==typeof r)throw Error(`Unknown RPC call with requestType "${e.requestType}"`);return r}createPastEventLogsMethodModel(e){return new le(e,this.utils,this.formatters)}createCallContractMethodModel(e){return new fe(e,this.callMethodResponseDecoder,this.utils,this.formatters)}createSendContractMethodModel(e){return new ue(e,this.allEventsLogDecoder,this.utils,this.formatters,this.accounts)}createContractDeployMethodModel(e){return new pe(e,this.utils,this.formatters,this.accounts)}createEstimateGasMethodModel(){return new Et(this.utils,this.formatters)}}var he=r(161),me=r.n(he);class ye extends me.a{constructor(e,t){super(),this.subscriptionModel=e,this.moduleInstance=t,this.subscriptionId=null}subscribe(e){return this.subscriptionModel.beforeSubscription(this,this.moduleInstance,e),this.moduleInstance.currentProvider.subscribe(this.subscriptionModel.subscriptionType,this.subscriptionModel.subscriptionMethod,[this.subscriptionModel.options]).then((t)=>{this.subscriptionId=t,this.moduleInstance.currentProvider.on(this.subscriptionId,(t,r)=>t?void(self.moduleInstance.currentProvider.once&&this.reconnect(e),Object(b.isFunction)(e)&&e(t,null),this.emit('error',t)):void this.handleSubscriptionResponse(r,e))}),this}handleSubscriptionResponse(e,t){Object(b.isArray)(e)||(e=[e]),e.forEach(function(e){const r=this.subscriptionModel.onNewSubscriptionItem(this,e);this.emit('data',r),Object(b.isFunction)(t)&&t(!1,r)})}reconnect(e){const t=setInterval(()=>{this.moduleInstance.currentProvider.reconnect&&this.moduleInstance.currentProvider.reconnect()},500);this.moduleInstance.currentProvider.once('connect',()=>{clearInterval(t),this.unsubscribe().then(()=>{this.subscribe(e)}).catch((t)=>{this.emit('error',t),Object(b.isFunction)(e)&&e(t,null)})})}unsubscribe(e){return this.moduleInstance.currentProvider.unsubscribe(this.subscriptionId,this.subscriptionModel.subscriptionType).then((t)=>(this.removeAllListeners('data'),this.removeAllListeners('error'),!t)?(this.subscriptionId=null,Object(b.isFunction)(e)&&e(!0,!1),!0):(Object(b.isFunction)(e)&&e(!1,!0),!1))}}class ge{constructor(e,t,r,n,a){this.subscriptionType=e,this.subscriptionMethod=t,this.options=r,this.util=n,this.formatters=a}beforeSubscription(){}onNewSubscriptionItem(e,t){return this.formatters.outputLogFormatter(t)}}class _e extends ge{constructor(e,t,r,n,a){super('eth_subscribe','logs',e,t,r),this.getPastLogsMethodModel=n,this.methodController=a}beforeSubscription(e,t,r){const n=this;this.options=this.formatters.inputLogFormatter(this.options),this.getPastLogsMethodModel.parameters=[options],this.methodController.execute(this.getPastLogsMethodModel,t.currentProvider,null,t).then((t)=>{t.forEach((t)=>{r(!1,t),e.emit('data',t)}),delete n.options.fromBlock}).catch((t)=>{e.emit('error',t),r(t,null)})}onNewSubscriptionItem(e,t){return this.formatters.outputLogFormatter(t)}}class ve extends ge{constructor(e,t){super('eth_subscribe','newHeads',null,e,t)}onNewSubscriptionItem(e,t){return this.formatters.outputBlockFormatter(t)}}class ke extends ge{constructor(e,t){super('eth_subscribe','newPendingTransactions',null,e,t)}}class xe extends ge{constructor(e,t){super('eth_subscribe','syncing',null,e,t),this.isSyncing=null}onNewSubscriptionItem(e,t){const r=t.result.syncing;return null===this.isSyncing&&(this.isSyncing=r,e.emit('changed',this.isSyncing)),!0===this.isSyncing&&!1===r&&(this.isSyncing=r,e.emit('changed',this.isSyncing)),!1===this.isSyncing&&!0===r&&(this.isSyncing=r,e.emit('changed',this.isSyncing)),this.formatters.outputSyncingFormatter(t)}}class Se extends ge{constructor(e,t,r){super('shh_subscribe','messages',e,t,r)}}class we{constructor(e,t){this.utils=e,this.formatters=t}createLogSubscription(e,t,r,n){return new ye(new _e(t,this.utils,this.formatters,r,n),e)}createNewHeadsSubscription(e){return new ye(new ve(this.utils,this.formatters),e)}createNewPendingTransactionsSubscription(e){return new ye(new ke(this.utils,this.formatters),e)}createSyncingSubscriptionModel(e){return new ye(new xe(this.utils,this.formatters),e)}createShhMessagesSubscription(e,t){return new ye(new Se(t,this.utils,this.formatters),e)}}class Ae{createSubscriptionsFactory(e,t){return new we(e,t)}}const Ee=()=>new Ae().createSubscriptionsFactory(c.a,o.b);class Ie extends _e{constructor(e,t,r,n,a,o,d){super(t,r,n,a,o),this.eventLogDecoder=d,this.abiItemModel=e}onNewSubscriptionItem(e,t){return this.eventLogDecoder.decode(this.abiItemModel,this.formatters.outputLogFormatter(t))}}class Ce extends _e{constructor(e,t,r,n,a,o){super(e,t,r,n,a),this.allEventsLogDecoder=o}onNewSubscriptionItem(e,t){return this.allEventsLogDecoder.decode(null,this.formatters.outputLogFormatter(t))}}class Pe{constructor(e,t,r){this.methodController=r}createEventLogSubscription(e,t,r,n){return new ye(r,new Ie(t,n,this.utils,this.formatters,new It(this.utils,this.formatters),this.methodController,e))}createAllEventLogSubscription(e,t,r){return new ye(t,new Ce(r,this.utils,this.formatters,new It(this.utils,this.formatters),this.methodController,e))}}class Te extends a.a{constructor(e,t,r,n,a,o,d,i,s,c,f,p,l,u,b,h){if(super(e,t,r,n,a,o,null),!(this instanceof Te))throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!');if(!u||!Array.isArray(u))throw new Error('You must provide the json interface of the contract when instantiating a contract object.');this.contractModuleFactory=d,this.abiCoder=s,this.utils=c,this.formatters=f,this.accounts=p,this.abiMapper=l,this.options=h,this.promiEvent=i,this.rpcMethodModelFactory=d.createRpcMethodModelFactory(),this._defaultAccount=null,this._defaultBlock='latest',this.abiModel=l.map(u),this.options.address=b,Object.defineProperty(this.options,'jsonInterface',{get:()=>this.abiModel,set:(e)=>{this.abiModel=this.abiMapper.map(e),this.methods.abiModel=this.abiModel,this.events.abiModel=this.abiModel},enumerable:!0}),Object.defineProperty(this.options,'address',{get:()=>this._address,set:(e)=>{this._address=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))},enumerable:!0}),this.methods=d.createMethodsProxy(this,this.abiModel,this.methodController,this.promiEvent),this.events=d.createEventSubscriptionsProxy(this,this.abiModel,this.methodController)}get defaultAccount(){return this._defaultAccount}set defaultAccount(e){this._defaultAccount=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))}get defaultBlock(){return this._defaultBlock}set defaultBlock(e){this._defaultBlock=e}once(e,t,r){if(!r)throw new Error('Once requires a callback function.');t&&delete t.fromBlock;const n=this.events[event](t,r);n.on('data',()=>{n.unsubscribe()})}getPastEvents(e,t,r){if(!this.options.jsonInterface.hasEvent(e))throw Error(`Event with name "${e}does not exists.`);const n=this.rpcMethodModelFactory.createPastEventLogsMethodModel(this.options.jsonInterface.getEvent(e));return n.parameters=[t],n.callback=r,this.methodController.execute(n,this.accounts,this)}deploy(e){return this.methods.contractConstructor(e)}clone(){const e=new this.constructor(this.currentProvider,this.providerDetector,this.providerAdapterResolver,this.providersModuleFactory,this.providers,this.methodController,this.contractModuleFactory,this.promiEvent,this.abiCoder,this.utils,this.formatters,this.accounts,this.abiMapper,{},this.options.address,this.options);return e.abiModel=this.abiModel,e}setProvider(e,t){return!!(super.setProvider(e,t)&&this.accounts.setProvider(e,t))}}class Be{constructor(e,t,r,n){this.utils=e,this.formatters=t,this.abiCoder=r,this.accounts=n}createContract(e,t,r,n,a,o,d,i,s,c){return new Te(e,t,r,n,a,o,this,d,this.abiCoder,this.utils,this.formatters,this.accounts,this.createABIMapper(),i,s,c)}createABIModel(e){return new X(e)}createABIItemModel(e){return new Y(e)}createMethodEncoder(){return new Z(this.abiCoder)}createEventFilterEncoder(){return new J(this.abiCoder)}createAllEventsFilterEncoder(){return new $(this.abiCoder)}createABIMapper(){return new ne(this,this.abiCoder,this.utils)}createCallMethodResponseDecoder(){return new Q(this.abiCoder)}createEventLogDecoder(){return new te.a(this.abiCoder,this.formatters)}createAllEventsLogDecoder(){return new re(this.abiCoder,this.formatters)}createRpcMethodOptionsValidator(){return new ce(this.utils)}createRpcMethodOptionsMapper(){return new ae(this.utils,this.formatters)}createEventOptionsMapper(){return new oe(this.formatters,this.createEventFilterEncoder())}createAllEventsOptionsMapper(){return new de(this.formatters,this.createAllEventsFilterEncoder())}createRpcMethodModelFactory(){return new be(this.createCallMethodResponseDecoder(),this.accounts,this.utils,this.formatters)}createMethodsProxy(e,t,r,n){return new ie(e,t,this.createRpcMethodModelFactory(),r,this.createMethodEncoder(),this.createRpcMethodOptionsValidator(),this.createRpcMethodOptionsMapper(),n)}createEventSubscriptionsProxy(e,t,r){new se(e,t,this.createEventSubscriptionFactory(r),this.createEventOptionsMapper(),this.createEventLogDecoder(),this.createAllEventsLogDecoder(),this.createAllEventsOptionsMapper())}createEventSubscriptionFactory(e){new Pe(this.utils,this.formatters,e)}}const Ne=(e,t,r,n,a)=>{const d=new G;return new Be(c.a,o.b,new k(),t).createContract(e,d.createProviderDetector(),d.createProviderAdapterResolver(),d,W,new nr,s,r,n,a)};class Re{constructor(e,t,r,n){this.transactionConfirmationModel=e,this.transactionReceiptValidator=t,this.newHeadsWatcher=r,this.formatters=n}execute(e,t,r,n){this.getTransactionReceipt(t,r).then((a)=>{if(a&&a.blockHash){const t=this.transactionReceiptValidator.validate(a);return!0===t?void this.handleSuccessState(a,e,n):void this.handleErrorState(t,e,n)}this.newHeadsWatcher.watch(t).on('newHead',()=>{if(this.transactionConfirmationModel.timeoutCounter++,!this.transactionConfirmationModel.isTimeoutTimeExceeded())return void this.getTransactionReceipt(r).then((t)=>{const r=this.transactionReceiptValidator.validate(t,e.parameters);return!0===r?(this.transactionConfirmationModel.addConfirmation(t),n.emit('confirmation',this.transactionConfirmationModel.confirmationsCount,t),void(this.transactionConfirmationModel.isConfirmed()&&this.handleSuccessState(t,e,n))):void(n.reject(r),n.emit('error',r,t),n.removeAllListeners(),e.callback&&e.callback(r,null))});let t=new Error(`Transaction was not mined within ${this.transactionConfirmationModel.TIMEOUTBLOCK} blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!`);this.newHeadsWatcher.isPolling&&(t=new Error(`Transaction was not mined within${this.transactionConfirmationModel.POLLINGTIMEOUT} seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!`)),this.handleErrorState(t,e,n)})})}getTransactionReceipt(e,t){return e.currentProvider.send('eth_getTransactionReceipt',[t]).then((e)=>this.formatters.outputTransactionReceiptFormatter(e))}handleSuccessState(e,t,r){if(this.newHeadsWatcher.stop(),t instanceof pe)return r.resolve(t.afterExecution(e)),r.emit('receipt',e),r.removeAllListeners(),void(t.callback&&t.callback(!1,e));const n=t.afterExecution(e);r.resolve(n),r.emit('receipt',n),r.removeAllListeners(),t.callback&&t.callback(!1,n)}handleErrorState(e,t,r){this.newHeadsWatcher.stop(),r.reject(e),r.emit('error',e),r.removeAllListeners(),t.callback&&t.callback(e,null)}}class Me{getWallet(e,t){if(h.a.isNumber(e))return t.wallet[e];if(h.a.isObject(e)&&e.address&&e.privateKey)return e;const r=t.wallet[e.toLowerCase()];return r?r:null}}class Le extends Me{async sign(e,t){const r=this.getWallet(e.from,t);if(r&&r.privateKey)return delete e.from,await t.signTransaction(e,r.privateKey);throw new Error('Wallet or privateKey in wallet is not set!')}}class je extends Me{sign(e,t,r){const n=this.getWallet(t,r);if(n&&n.privateKey)return r.sign(e,n.privateKey).signature;throw new Error('Wallet or privateKey in wallet is not set!')}}class Oe{constructor(){this.confirmations=[],this.timeoutCounter=0,this._pollingTimeout=15,this.timeoutBlock=50,this.confirmationBlocks=24}get pollingTimeout(){return this._pollingTimeout*this.timeoutBlock}set pollingTimeout(e){this._pollingTimeout=e}addConfirmation(e){this.confirmations.push(e)}isConfirmed(){return this.confirmations.length===this.confirmationBlocks+1}isTimeoutTimeExceeded(e){return e?this.timeoutCounter-1>=this.pollingTimeout:this.timeoutCounter-1>=this.timeoutBlock}}class De{validate(e,t){if(this.isValidGasUsage(e,t)&&this.isValidReceiptStatus(e))return!0;const r=JSON.stringify(e,null,2);return!1===e.status||'0x0'===e.status?new Error(`Transaction has been reverted by the EVM:\n${r}`):new Error(`Transaction ran out of gas. Please provide more gas:\n${r}`)}isValidReceiptStatus(e){return!0===e.status||'0x1'===e.status||'undefined'==typeof e.status}isValidGasUsage(e,t){let r=null;return Object(b.isObject)(t[0])&&t[0].gas&&(r=t[0].gas),!e.outOfGas&&(!r||r!==e.gasUsed)}}var Ue=r(162),He=r.n(Ue);class Fe extends He.a{constructor(e){super(),this.subscriptionsFactory=e,this.confirmationInterval=null,this.confirmationSubscription=null,this.isPolling=!1}watch(e){return e.currentProvider instanceof B?(this.confirmationSubscription=this.subscriptionsFactory.createNewHeadsSubscription(e).subscribe(()=>{this.emit('newHead')}),this):(this.isPolling=!0,this.confirmationInterval=setInterval(()=>{this.emit('newHead')},1e3),this)}stop(){this.confirmationSubscription&&this.confirmationSubscription.unsubscribe(),this.confirmationInterval&&clearInterval(this.confirmationInterval),this.removeAllListeners('newHead')}}class qe{constructor(e,t,r,n,a){this.callMethodCommand=e,this.sendMethodCommand=t,this.signAndSendMethodCommand=r,this.signMessageCommand=n,this.promiEventObject=a}execute(e,t,r){if(this.hasWallets(t)){if(e.isSign())return this.signMessageCommand.execute(r,e,t);if(e.isSendTransaction())return this.signAndSendMethodCommand.execute(r,e,new this.promiEventObject,t)}return e.isSendTransaction()||e.isSendRawTransaction()||e.isSign()?this.sendMethodCommand.execute(r,e,new this.promiEventObject):this.callMethodCommand.execute(r,e)}hasWallets(e){return e&&0{Object(b.isObject)(t.parameters[0])&&(t.parameters[0].gasPrice=n),this.send(t,r,e)}),r)}send(e,t,r){return r.currentProvider.send(e.rpcMethod,e.parameters).then((n)=>{this.transactionConfirmationWorkflow.execute(e,r,n,t),t.emit('transactionHash',n),e.callback&&e.callback(!1,n)}).catch((r)=>{t.reject(r),t.emit('error',r),t.removeAllListeners(),e.callback&&e.callback(r,null)}),t}isGasPriceDefined(e){return Object(b.isObject)(e[0])&&'undefined'!=typeof e[0].gasPrice}getGasPrice(e){return e.send('eth_gasPrice',[])}}class Ve extends Ke{constructor(e,t){super(e),this.transactionSigner=t}execute(e,t,r,n){return t.beforeExecution(e),t.rpcMethod='eth_sendRawTransaction',this.transactionSigner.sign(t.parameters[0],n).then((n)=>{t.parameters=[n.rawTransaction],this.send(t,r,e)}).catch((e)=>{r.reject(e),r.emit('error',e),r.removeAllListeners(),t.callback&&t.callback(e,null)}),r}}class Ge{constructor(e){this.messageSigner=e}execute(e,t,r){let n;t.beforeExecution(e);try{n=t.afterExecution(this.messageSigner.sign(t.parameters[0],t.parameters[1],r))}catch(e){throw t.callback(e,null),e}return t.callback&&t.callback(!1,n),n}}class We{createMethodController(e,t,r){return new qe(this.createCallMethodCommand(),this.createSendMethodCommand(t,r),this.createSignAndSendMethodCommand(t,r),this.createSignMessageCommand(),e)}createCallMethodCommand(){return new ze}createSendMethodCommand(e,t){return new Ke(this.createTransactionConfirmationWorkflow(e,t))}createSignAndSendMethodCommand(e,t){return new Ve(this.createTransactionConfirmationWorkflow(e,t),this.createTransactionSigner())}createSignMessageCommand(){return new Ge(this.createMessageSigner())}createTransactionConfirmationWorkflow(e,t){return new Re(this.createTransactionConfirmationModel(),this.createTransactionReceiptValidator(),this.createNewHeadsWatcher(e),t)}createTransactionSigner(){return new Le}createMessageSigner(){return new je}createTransactionConfirmationModel(){return new Oe}createTransactionReceiptValidator(){return new De}createNewHeadsWatcher(e){return new Fe(e)}}class Xe{constructor(e,t,r){this.utils=t,this.formatters=r,this.methodModels=e}hasMethodModel(e){return'undefined'!=typeof this.methodModels[e]}createMethodModel(e){return new this.methodModels[e](this.utils,this.formatters)}}class Ye{constructor(e,t,r,n){this.rpcMethod=e,this.parametersAmount=t,this.utils=r,this.formatters=n;const a={};Object.defineProperty(this,'methodArguments',{get(){return a},set(e){e=this.mapFunctionArguments(e)},enumerable:!0}),this.parameters=this.methodArguments.parameters,this.callback=this.methodArguments.callback}beforeExecution(){}afterExecution(e){return e}request(){return this.methodArguments=arguments,this}mapFunctionArguments(e){let t=e,r=!1;if(e.lengththis.parametersAmount){if(r=e.slice(-1),!h.a.isFunction(r))throw new Error('The latest parameter should be a function otherwise it can not be used as callback');t=e.slice(0,-1)}return{callback:r,parameters:t}}isSign(){return'eth_sign'===this.rpcMethod}isSendTransaction(){return'eth_sendTransaction'===this.rpcMethod}isSendRawTransaction(){return'eth_sendRawTransaction'===this.rpcMethod}isHash(e){return h.a.isString(e)&&0===e.indexOf('0x')}}class Ze extends Ye{constructor(e,t){super('eth_protocolVersion',0,e,t)}}class Je extends Ye{constructor(e,t){super('eth_protocolVersion',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class $e extends Ye{constructor(e,t){super('net_listening',0,e,t)}}class Qe extends Ye{constructor(e,t){super('net_peerCount',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class et extends Ye{constructor(e,t){super('web3_clientVersion',0,e,t)}}class tt extends Ye{constructor(e,t){super('eth_coinbase',0,e,t)}}class rt extends Ye{constructor(e,t){super('eth_mining',0,e,t)}}class nt extends Ye{constructor(e,t){super('eth_hashrate',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class at extends Ye{constructor(e,t){super('eth_syncing',0,e,t)}afterExecution(e){return this.formatters.outputSyncingFormatter(e)}}class ot extends Ye{constructor(e,t){super('eth_gasPrice',0,e,t)}afterExecution(e){return this.formatters.outputBigNumberFormatter(e)}}class dt extends Ye{constructor(e,t){super('eth_submitWork',3,e,t)}}class it extends Ye{constructor(e,t){super('eth_getWork',0,e,t)}}class st extends Ye{constructor(e,t){super('eth_accounts',0,e,t)}afterExecution(e){return e.map((e)=>this.utils.toChecksumAddress(e))}}class ct extends Ye{constructor(e,t){super('eth_getBalance',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}afterExecution(e){return this.formatters.outputBigNumberFormatter(e)}}class ft extends Ye{constructor(e,t){super('eth_getTransactionCount',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}afterExecution(e){return this.utils.hexToNumber(e)}}class pt extends Ye{constructor(e,t){super('eth_blockNumber',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class lt extends Ye{constructor(e,t){super('eth_getBlockByNumber',2,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getBlockByHash'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0]),this.parameters[1]=!!this.parameters[1]}afterExecution(e){return this.formatters.outputBlockFormatter(e)}}class ut extends Ye{constructor(e,t){super('eth_getUncleByBlockNumberAndIndex',2,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getUncleByBlockHashAndIndex'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0]),this.parameters[1]=this.utils.numberToHex(this.parameters[1])}afterExecution(e){return this.formatters.outputBlockFormatter(e)}}class bt extends Ye{constructor(e,t){super('eth_getTransactionByBlockNumberAndIndex',1,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getTransactionByBlockHashAndIndex'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0])}afterExecution(e){return this.utils.hexToNumber(e)}}class ht extends Ye{constructor(e,t){super('eth_getUncleCountByBlockNumber',1,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getUncleCountByBlockHash'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0])}afterExecution(e){return this.utils.hexToNumber(e)}}class mt extends Ye{constructor(e,t){super('eth_getTransactionByHash',1,e,t)}afterExecution(e){return this.formatters.outputTransactionFormatter(e)}}class yt extends Ye{constructor(e,t){super('eth_getTransactionByBlockNumberAndIndex',2,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getTransactionByBlockHashAndIndex'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0]),this.parameters[1]=this.utils.numberToHex(this.parameters[1])}afterExecution(e){return this.formatters.outputTransactionFormatter(e)}}class gt extends Ye{constructor(e,t){super('eth_getTransactionReceipt',1,e,t)}afterExecution(e){return this.formatters.outputTransactionFormatter(e)}}class _t extends Ye{constructor(e,t){super('eth_sendRawTransaction',1,e,t)}}class vt extends Ye{constructor(e,t){super('eth_signTransaction',1,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class kt extends Ye{constructor(e,t,r){super('eth_sendTransaction',1,e,t),this.accounts=r}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class xt extends Ye{constructor(e,t){super('eth_getCode',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}}class St extends Ye{constructor(e,t,r){super('eth_sign',2,e,t),this.accounts=r}beforeExecution(){this.parameters[0]=this.formatters.inputSignFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputAddressFormatter(this.parameters[1])}}class wt extends Ye{constructor(e,t){super('eth_call',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputCallFormatter(this.parameters[0],e),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}}class At extends Ye{constructor(e,t){super('eth_getStorageAt',3,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.utils.numberToHex(this.parameters[1]),this.parameters[2]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2],e)}}class Et extends Ye{constructor(e,t){super('eth_estimateGas',1,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputCallFormatter(this.parameters[0],e)}afterExecution(e){return this.utils.hexToNumber(e)}}class It extends Ye{constructor(e,t){super('eth_getLogs',1,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputLogFormatter(this.parameters[0])}afterExecution(e){return e.map((e)=>this.formatters.outputLogFormatter(e))}}class Ct extends Ye{constructor(e,t){super('personal_ecRecover',3,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputSignFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputAddressFormatter(this.parameters[1])}}class Pt extends Ye{constructor(e,t){super('personal_importRawKey',2,e,t)}}class Tt extends Ye{constructor(e,t){super('personal_lockAccount',1,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0])}}class Bt extends Ye{constructor(e,t){super('personal_newAccount',0,e,t)}afterExecution(e){return this.utils.toChecksumAddress(e)}}class Nt extends Ye{constructor(e,t){super('personal_sendTransaction',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class Rt extends Ye{constructor(e,t){super('personal_sign',3,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputSignFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputAddressFormatter(this.parameters[1])}}class Mt extends Ye{constructor(e,t){super('personal_signTransaction',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class Lt extends Ye{constructor(e,t){super('personal_unlockAccount',3,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0])}}class jt extends Ye{constructor(e,t){super('shh_addPrivateKey',1,e,t)}}class Ot extends Ye{constructor(e,t){super('shh_addSymKey',1,e,t)}}class Dt extends Ye{constructor(e,t){super('shh_deleteKeyPair',1,e,t)}}class Ut extends Ye{constructor(e,t){super('shh_deleteMessageFilter',1,e,t)}}class Ht extends Ye{constructor(e,t){super('shh_deleteSymKey',1,e,t)}}class Ft extends Ye{constructor(e,t){super('shh_generateSymKeyFromPassword',1,e,t)}}class qt extends Ye{constructor(e,t){super('shh_getFilterMessages',1,e,t)}}class zt extends Ye{constructor(e,t){super('shh_info',0,e,t)}}class Kt extends Ye{constructor(e,t){super('shh_getPrivateKey',1,e,t)}}class Vt extends Ye{constructor(e,t){super('shh_getPublicKey',1,e,t)}}class Gt extends Ye{constructor(e,t){super('shh_getSymKey',1,e,t)}}class Wt extends Ye{constructor(e,t){super('shh_hasKeyPair',1,e,t)}}class Xt extends Ye{constructor(e,t){super('shh_hasSymKey',1,e,t)}}class Yt extends Ye{constructor(e,t){super('shh_markTrustedPeer',1,e,t)}}class Zt extends Ye{constructor(e,t){super('shh_newKeyPair',1,e,t)}}class Jt extends Ye{constructor(e,t){super('shh_newMessageFilter',1,e,t)}}class $t extends Ye{constructor(e,t){super('shh_newSymKey',0,e,t)}}class Qt extends Ye{constructor(e,t){super('shh_post',1,e,t)}}class er extends Ye{constructor(e,t){super('shh_setMaxMessageSize',1,e,t)}}class tr extends Ye{constructor(e,t){super('shh_setMinPoW',1,e,t)}}class rr extends Ye{constructor(e,t){super('shh_version',0,e,t)}}const nr=()=>new We().createMethodController(s,new Ee,o.b);class ar extends a.a{constructor(e,t,r,n,a,o,d,i,s){super(e,t,r,n,a,o,d),this.formatters=i,this.utils=s}getNetworkType(e){let t;return this.getId().then((e)=>(t=e,this.getBlock(0,!1))).then((r)=>{let n='private';return r===('0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3'===r.hash&&1===t)?n='main':r===('0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303'===r.hash&&2===t)?n='morden':r===('0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d'===r.hash&&3===t)?n='ropsten':r===('0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177'===r.hash&&4===t)?n='rinkeby':r===('0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9'===r.hash&&42===t)?n='kovan':void 0,_.isFunction(e)&&e(null,n),n}).catch((t)=>{if(_.isFunction(e))return void e(t);throw t})}}class or extends Xe{constructor(e,t){super({getId:Je,getBlock:lt,isListening:$e,getPeerCount:Qe},e,t)}}class dr{constructor(e,t){this.utils=e,this.formatters=t}createNetworkModule(e,t,r,n,a,o){return new ar(e,t,r,n,a,o,this.createMethodModelFactory(),this.formatters,this.utils)}createMethodModelFactory(){return new or(this.utils,this.formatters)}}const ir=(e)=>{const t=new G;return new dr(c.a,o.b).createNetworkModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr)};class sr extends Xe{constructor(e,t){super({getGasPrice:ot,getTransactionCount:ft,getId:Je},e,t)}}var cr=r(163);class fr{constructor(e,t){this.utils=e,this.formatters=t}createAccounts(e,t,r,n,a,o){return new cr.a(e,t,r,n,a,o,this.createMethodModelFactory(),this.utils,this.formatters)}createMethodModelFactory(){return new sr(this.utils,this.formatters)}}const pr=(e)=>{const t=new G;return new fr(c.a,o.b).createAccounts(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr)};class lr extends a.a{constructor(e,t,r,n,a,o,d,i,s,c){super(e,t,r,n,a,o,d),this.utils=s,this.formatters=c,this.net=i,this._defaultAccount=null,this._defaultBlock='latest'}get defaultAccount(){return this._defaultAccount}set defaultAccount(e){this._defaultAccount=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))}get defaultBlock(){return this._defaultBlock}set defaultBlock(e){this._defaultBlock=e}setProvider(e,t){return!!(super.setProvider(e,t)&&this.net.setProvider(e,t))}}class ur extends Xe{constructor(e,t){super({getAccounts:st,newAccount:Bt,unlockAccount:Lt,lockAccount:Tt,importRawKey:Pt,sendTransaction:Nt,signTransaction:Mt,sign:Rt,ecRecover:Ct},e,t)}}class br{constructor(e,t){this.utils=e,this.formatters=t}createPersonal(e,t,r,n,a,o,d){return new lr(e,t,r,n,a,o,this.createMethodModelFactory(),d,this.utils,this.formatters)}createMethodModelFactory(){return new ur(this.utils,this.formatters)}}const hr=(e)=>{const t=new G;return new br(c.a,o.b).createPersonalModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr,new ir(e))};var mr=r(165),yr=r.n(mr),gr=r(166),_r=r.n(gr);class vr{constructor(e,t){this.registry=e,this.resolverMethodHandler=t}setProvider(e,t){return this.registry.setProvider(e,t)}resolver(e){return this.registry.resolver(e)}getAddress(e,t){return this.resolverMethodHandler.method(e,'addr',[]).call(t)}setAddress(e,t,r,n){return this.resolverMethodHandler.method(e,'setAddr',[t]).send(r,n)}getPubkey(e,t){return this.resolverMethodHandler.method(e,'pubkey',[]).call(t)}setPubkey(e,t,r,n,a){return this.resolverMethodHandler.method(e,'setPubkey',[t,r]).send(n,a)}getContent(e,t){return this.resolverMethodHandler.method(e,'content',[]).call(t)}setContent(e,t,r,n){return this.resolverMethodHandler.method(e,'setContent',[t]).send(r,n)}getMultihash(e,t){return this.resolverMethodHandler.method(e,'multihash',[]).call(t)}setMultihash(e,t,r,n){return this.resolverMethodHandler.method(e,'multihash',[t]).send(r,n)}}var kr=r(46),xr=r.n(kr);class Sr{constructor(e,t,r,n,a){this.net=net,this.accounts=t,this.contractObject=r,this.registryABI=n,this.resolverABI=a,this.provider=e,this.contract=this.checkNetwork().then((e)=>new this.contractObject(this.provider,this.accounts,this.registryABI,e))}setProvider(e,t){return this.provider=this.providersPackage.resolve(e,t),!!(this.net.setProvider(e,t)&&this.accounts.setProvider(e,t)&&this.provider)}owner(e,t){return new Promise((r,n)=>{this.contract.then((a)=>{a.methods.owner(xr.a.hash(e)).call().then((e)=>{r(e),Object(b.isFunction)(t)&&t(!1,e)}).catch((e)=>{n(e),Object(b.isFunction)(t)&&t(e,null)})})})}resolver(e){return this.contract.then((t)=>t.methods.resolver(xr.a.hash(e)).call()).then((e)=>new this.Contract.Contract(this.provider,this.accounts,this.resolverABI,e))}checkNetwork(){const e={main:'0x314159265dD8dbb310642f98f50C066173C1259b',ropsten:'0x112234455c3a32fd11230c42e7bccd4a84e02010',rinkeby:'0xe7410170f87102df0055eb195163a03b7f2bff4a'};return this.net.getBlock('latest',!1).then((e)=>{const t=new Date/1e3-e.timestamp;if(3600{const r=e[t];if('undefined'==typeof r)throw new Error(`ENS is not supported on network ${t}`);return r})}}class wr{constructor(e,t){this.registry=e,this.promiEventPackage=t}method(e,t,r){return{call:this.call.bind({ensName:e,methodName:t,methodArguments:r,parent:this}),send:this.send.bind({ensName:e,methodName:t,methodArguments:r,parent:this})}}call(e){const t=new this.promiEventPackage.PromiEvent,r=this.parent.prepareArguments(this.ensName,this.methodArguments);return this.parent.registry.resolver(this.ensName).then((n)=>{this.parent.handleCall(t,n.methods[this.methodName],r,e)}).catch((e)=>{t.reject(e)}),t}send(e,t){const r=new this.promiEventPackage.PromiEvent,n=this.parent.prepareArguments(this.ensName,this.methodArguments);return this.parent.registry.resolver(this.ensName).then((a)=>{this.parent.handleSend(r,a.methods[this.methodName],n,e,t)}).catch((e)=>{r.reject(e)}),r}handleCall(e,t,r,n){return t.apply(this,r).call().then((t)=>{e.resolve(t),h.a.isFunction(n)&&n(t)}).catch((t)=>{e.reject(t),h.a.isFunction(n)&&n(t)}),e}handleSend(e,t,r,n,a){return t.apply(this,r).send(n).on('transactionHash',(t)=>{e.emit('transactionHash',t)}).on('confirmation',(t,r)=>{e.emit('confirmation',t,r)}).on('receipt',(t)=>{e.emit('receipt',t),e.resolve(t),h.a.isFunction(a)&&a(t)}).on('error',(t)=>{e.emit('error',t),e.reject(t),h.a.isFunction(a)&&a(t)}),e}prepareArguments(e,t){const r=xr.a.hash(e);return 0new Ar().createENS(e,t,r,Ne,yr.a,_r.a,s);var Ir=r(68);class Cr extends Xe{constructor(e,t,r){super({getNodeInfo:et,getProtocolVersion:Ze,getCoinbase:tt,isMining:rt,getHashrate:nt,isSyncing:at,getGasPrice:ot,getAccounts:st,getBlockNumber:pt,getBalance:ct,getStorageAt:At,getCode:xt,getBlock:lt,getUncle:ut,getBlockTransactionCount:bt,getBlockUncleCount:ht,getTransaction:mt,getTransactionFromBlock:yt,getTransactionReceipt:gt,getTransactionCount:ft,sendSignedTransaction:_t,signTransaction:vt,sendTransaction:kt,sign:St,call:wt,estimateGas:Et,submitWork:dt,getWork:it,getPastLogs:It},e,t),this.accounts=r}createMethodModel(e){return new this.methodModels[e](this.utils,this.formatters,this.accounts)}}class Pr extends a.a{constructor(e,t,r,n,a,o,d,i,s,c,f,p,l,u,b,h,m){super(e,t,r,n,a,o,d),this.net=i,this.accounts=c,this.personal=f,this.Iban=Iban,this.abi=l,this.ens=u,this.utils=b,this.formatters=h,this.subscriptionsFactory=m,this.initiatedContracts=[],this._defaultAccount=null,this._defaultBlock='latest',this.Contract=(e,t,r)=>{const n=new s(this.currentProvider,this.accounts,e,t,r);return this.initiatedContracts.push(n),n}}get defaultAccount(){return this._defaultAccount}set defaultAccount(e){this.initiatedContracts.forEach((t)=>{t.defaultAccount=e}),this.personal.defaultAccount=e,this._defaultAccount=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))}get defaultBlock(){return this._defaultBlock}set defaultBlock(e){this._defaultBlock=e,this.initiatedContracts.forEach((t)=>{t.defaultBlock=e}),this.personal.defaultBlock=this._defaultBlock}subscribe(e,t,r){switch(e){case'logs':return this.subscriptionsFactory.createLogSubscription(this,t,this.methodModelFactory.createMethodModel('getPastLogs'),this.methodController).subscribe(r);case'newBlockHeaders':return this.subscriptionsFactory.createNewHeadsSubscription(this).subscribe(r);case'pendingTransactions':return this.subscriptionsFactory.createNewPendingTransactionsSubscription(this).subscribe(r);case'syncing':return this.subscriptionsFactory.createSyncingSubscriptionModel(this).subscribe(r);default:throw Error(`Unknown subscription: ${e}`);}}setProvider(e,t){const r=this.initiatedContracts.every((r)=>r.setProvider(e,t));return!!(super.setProvider(e,t)&&this.net.setProvider(e,t)&&this.personal.setProvider(e,t)&&this.accounts.setProvider(e,t)&&r)}}class Tr{constructor(e,t){this.utils=e,this.formatters=t}createEthModule(e,t,r,n,a,o,d,i,s,c,f,p,l,u){return new Pr(e,t,r,n,a,o,this.createMethodModelFactory(s),d,i,s,c,f,p,l,this.utils,this.formatters,u)}createMethodModelFactory(e){return new Cr(this.utils,this.formatters,e)}}const Br=(e)=>{const t=new G;return new Tr(c.a,o.b).createEthModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr,new ir,Ne,new pr(e),new hr(e),Ir.a,new k(c.a),new Er(e),new Ee)};class Nr extends a.a{constructor(e,t,r,n,a,o,d,i,s){super(e,t,r,n,a,o,d),this.subscriptionsFactory=i,this.net=s}subscribe(e,t,r){if('messages'===e)return this.subscriptionsFactory.createShhMessagesSubscription(this,t).subscribe(r);throw Error(`Unknown subscription: ${e}`)}setProvider(e,t){return!!(super.setProvider(e,t)&&this.net.setProvider(e,t))}}class Rr extends Xe{constructor(e,t){super({getVersion:rr,getInfo:zt,setMaxMessageSize:er,setMinPoW:tr,markTrustedPeer:Yt,newKeyPair:Zt,addPrivateKey:jt,deleteKeyPair:Dt,hasKeyPair:Wt,getPublicKey:Vt,getPrivateKey:Kt,newSymKey:$t,addSymKey:Ot,generateSymKeyFromPassword:Ft,hasSymKey:Xt,getSymKey:Gt,deleteSymKey:Ht,newMessageFilter:Jt,getFilterMessages:qt,deleteMessageFilter:Ut,post:Qt},e,t)}}class Mr{constructor(e,t){this.utils=e,this.formatters=t}createShhModule(e,t,r,n,a,o,d,i){return new Nr(e,t,r,n,a,o,this.createMethodModelFactory(),d,i)}createMethodModelFactory(){return new Rr(this.utils,this.formatters)}}const Lr=(e)=>{const t=new G;return new Mr(c.a,o.b).createShhModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr,new Ee,new ir(e))};var jr=r(167),Or=r.n(jr);class Dr{constructor(e){this.givenProvider=Dr.givenProvider,this.currentProvider=null,this.setProvider(e)}pick(){if('undefined'!=typeof document)return this.swarm.pick;throw Error('Pick is not supported for this environment.')}download(e,t){return this.hasProvider()?this.swarm.download(e,t):void this.throwProviderError()}upload(e){return this.hasProvider()?this.swarm.upload(e):void this.throwProviderError()}isAvailable(){return this.hasProvider()?this.swarm.isAvailable():void this.throwProviderError()}hasProvider(){return!!this.currentProvider}throwProviderError(){throw new Error('No provider set, please set one using bzz.setProvider().')}setProvider(e){return(Object(b.isObject)(e)&&Object(b.isString)(e.bzz)&&(e=e.bzz),Object(b.isString)(e))?(this.currentProvider=e,this.swarm=Or.a.at(e),!0):(this.currentProvider=null,!1)}}Dr.givenProvider=null,'undefined'!=typeof ethereumProvider&ðereumProvider.bzz&&(Dr.givenProvider=ethereumProvider.bzz);var Ur=r(168);r.d(t,'default',function(){return Hr});class Hr extends a.a{constructor(e,t){var r=new G,n=r.createProviderAdapterResolver(),a=r.createProviderDetector();e=n.resolve(e,t),super(e,a,n,r,W,new nr,new Xe({},utils,o.b)),this.eth=new Br(e),this.shh=new Lr(e),this.bzz=new Dr(e)}setProvider(e,t){return!!(super.setProvider(e,t)&&this.eth.setProvider(e,t)&&this.shh.setProvider(e,t)&&this.bzz.setProvider(e))}static get givenProvider(){return new G().createProviderDetector().detect()}static get version(){return Ur.a}static get utils(){return c.a}static get modules(){const e=new G().createProviderAdapterResolver();return{Eth:(t,r)=>new Br(e.resolve(t,r)),Net:(t,r)=>new ir(e.resolve(t,r)),Personal:(t,r)=>new hr(e.resolve(t,r)),Shh:(t,r)=>new Lr(e.resolve(t,r)),Bzz:(t,r)=>new Dr(e.resolve(t,r))}}static get providers(){return W}}}]); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 1d298e94e57..00000000000 --- a/gulpfile.js +++ /dev/null @@ -1,199 +0,0 @@ -#!/usr/bin/env node - -'use strict'; - -var lernaJSON = require('./lerna.json'); -var path = require('path'); - -var del = require('del'); -var gulp = require('gulp'); -var browserify = require('browserify'); -var jshint = require('gulp-jshint'); -var uglify = require('gulp-uglify'); -var babel = require('gulp-babel'); -var rename = require('gulp-rename'); -var source = require('vinyl-source-stream'); -var exorcist = require('exorcist'); -var bower = require('bower'); -var streamify = require('gulp-streamify'); -var replace = require('gulp-replace'); -var exec = require('child_process').exec; - -var DEST = path.join(__dirname, 'dist/'); - -var packages = [{ - fileName: 'web3', - expose: 'Web3', - src: './packages/web3/src/index.js', - ignore: ['xmlhttprequest', 'websocket'] -}, { - fileName: 'web3-utils', - expose: 'Web3Utils', - src: './packages/web3-utils/src/index.js' -}, { - fileName: 'web3-eth', - expose: 'Web3Eth', - src: './packages/web3-eth/src/index.js' -}, { - fileName: 'web3-eth-accounts', - expose: 'Web3EthAccounts', - src: './packages/web3-eth-accounts/src/index.js' -}, { - fileName: 'web3-eth-contract', - expose: 'Web3EthContract', - src: './packages/web3-eth-contract/src/index.js' -}, { - fileName: 'web3-eth-personal', - expose: 'Web3EthPersonal', - src: './packages/web3-eth-personal/src/index.js' -}, { - fileName: 'web3-eth-iban', - expose: 'Web3EthIban', - src: './packages/web3-eth-iban/src/index.js' -}, { - fileName: 'web3-eth-abi', - expose: 'Web3EthAbi', - src: './packages/web3-eth-abi/src/index.js' -},{ - fileName: 'web3-eth-ens', - expose: 'EthEns', - src: './packages/web3-eth-ens/src/index.js' -}, { - fileName: 'web3-shh', - expose: 'Web3Shh', - src: './packages/web3-shh/src/index.js' -}, { - fileName: 'web3-bzz', - expose: 'Web3Bzz', - src: './packages/web3-bzz/src/index.js' -}, { - fileName: 'web3-providers', - expose: 'Web3Providers', - src: './packages/web3-providers/src/index.js' -}, { - fileName: 'web3-core-subscriptions', - expose: 'Web3Subscriptions', - src: './packages/web3-core-subscriptions/src/index.js' -}, { - fileName: 'web3-core-promievent', - expose: 'Web3PromiEvent', - src: './packages/web3-core-promievent/src/index.js' -}, { - fileName: 'web3-core-method', - expose: 'Web3Method', - src: './packages/web3-core-method/src/index.js' -}, { - fileName: 'web3-core', - expose: 'Web3Package', - src: './packages/web3-core/src/index.js' -}, { - fileName: 'web3-net', - expose: 'Web3Net', - src: './packages/web3-net/src/index.js' -}]; - -var browserifyOptions = { - debug: true, - // standalone: 'Web3', - derequire: true, - insertGlobalVars: false, // jshint ignore:line - detectGlobals: true, - bundleExternal: true -}; - -var ugliyOptions = { - compress: { - dead_code: true, // jshint ignore:line - drop_debugger: true, // jshint ignore:line - global_defs: { // jshint ignore:line - "DEBUG": false // matters for some libraries - } - } -}; - -gulp.task('version', function () { - if (!lernaJSON.version) { - throw new Error("version property is missing from lerna.json"); - } - - var version = lernaJSON.version; - var jsonPattern = /"version": "[.0-9\-a-z]*"/; - var jsPattern = /version: '[.0-9\-a-z]*'/; - var glob = [ - './package.json', - './bower.json', - './package.js' - ]; - - return gulp.src(glob, {base: './'}) - .pipe(replace(jsonPattern, '"version": "' + version + '"')) - .pipe(replace(jsPattern, "version: '" + version + "'")) - .pipe(gulp.dest('./')); -}); - -gulp.task('bower', gulp.series('version', function (cb) { - bower.commands.install().on('end', function (installed) { - console.log(installed); - cb(); - }); -})); - -gulp.task('lint', function () { - return gulp.src(['./*.js', './lib/*.js']) - .pipe(jshint()) - .pipe(jshint.reporter('default')); -}); - -gulp.task('clean', gulp.series('lint', function (cb) { - del([DEST]).then(cb.bind(null, null)); -})); - -packages.forEach(function (pckg, i) { - var prevPckg = (!i) ? 'clean' : packages[i - 1].fileName; - - gulp.task(pckg.fileName, gulp.series(prevPckg, function () { - browserifyOptions.standalone = pckg.expose; - - var pipe = browserify(browserifyOptions) - .require(pckg.src, { expose: pckg.expose }) - .require('bn.js', { expose: 'BN' }) // expose it to dapp developers - .add(pckg.src); - - if (pckg.ignore) { - pckg.ignore.forEach(function (ignore) { - pipe.ignore(ignore); - }); - } - - return pipe.bundle() - .pipe(exorcist(path.join(DEST, pckg.fileName + '.js.map'))) - .pipe(source(pckg.fileName + '.js')) - .pipe(streamify(babel({ - compact: false, - presets: ['env'] - }))) - .pipe(gulp.dest(DEST)) - .pipe(streamify(babel({ - compact: true, - presets: ['env'] - }))) - .pipe(streamify(uglify(ugliyOptions))) - .on('error', function (err) { console.error(err); }) - .pipe(rename(pckg.fileName + '.min.js')) - .pipe(gulp.dest(DEST)); - })); -}); - - -gulp.task('publishTag', function () { - exec("git commit -am \"add tag v"+ lernaJSON.version +"\"; git tag v"+ lernaJSON.version +"; git push origin v"+ lernaJSON.version +";"); -}); - -gulp.task('watch', function () { - gulp.watch(['./packages/web3/src/*.js'], gulp.series('lint', 'default')); -}); - -gulp.task('all', gulp.series('version', 'lint', 'clean', packages[packages.length - 1].fileName)); - -gulp.task('default', gulp.series('version', 'lint', 'clean', packages[0].fileName)); - diff --git a/package-lock.json b/package-lock.json index aa63975da39..455578fa486 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,839 +4,2893 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@sinonjs/commons": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.0.2.tgz", - "integrity": "sha512-WR3dlgqJP4QNrLC4iXN/5/2WaLQQ0VijOOkmflqFGVJ6wLEpbSjo7c0ZeGIdtY8Crk7xBBp87sM6+Mkerz7alw==", + "@babel/cli": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.1.2.tgz", + "integrity": "sha512-K3WDlpBPGpoW11SLKFEBhMsITomPovsrZ/wnM3y+WStbytukDXC0OBic3yQp+j058QUw0+R/jfx2obwp1fOzcA==", + "dev": true, + "requires": { + "chokidar": "^2.0.3", + "commander": "^2.8.1", + "convert-source-map": "^1.1.0", + "fs-readdir-recursive": "^1.1.0", + "glob": "^7.0.0", + "lodash": "^4.17.10", + "mkdirp": "^0.5.1", + "output-file-sync": "^2.0.0", + "slash": "^2.0.0", + "source-map": "^0.5.0" + }, + "dependencies": { + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true + } + } + }, + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", "dev": true, "requires": { - "type-detect": "4.0.8" + "@babel/highlight": "^7.0.0" } }, - "@sinonjs/formatio": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.0.0.tgz", - "integrity": "sha512-vdjoYLDptCgvtJs57ULshak3iJe4NW3sJ3g36xVDGff5AE8P30S6A093EIEPjdi2noGhfuNOEkbxt3J3awFW1w==", + "@babel/core": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.1.2.tgz", + "integrity": "sha512-IFeSSnjXdhDaoysIlev//UzHZbdEmm7D0EIH2qtse9xK7mXEZQpYjs2P00XlP1qYsYvid79p+Zgg6tz1mp6iVw==", "dev": true, "requires": { - "@sinonjs/samsam": "2.1.0" + "@babel/code-frame": "^7.0.0", + "@babel/generator": "^7.1.2", + "@babel/helpers": "^7.1.2", + "@babel/parser": "^7.1.2", + "@babel/template": "^7.1.2", + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.1.2", + "convert-source-map": "^1.1.0", + "debug": "^3.1.0", + "json5": "^0.5.0", + "lodash": "^4.17.10", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" }, "dependencies": { - "@sinonjs/samsam": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.0.tgz", - "integrity": "sha512-5x2kFgJYupaF1ns/RmharQ90lQkd2ELS8A9X0ymkAAdemYHGtI2KiUHG8nX2WU0T1qgnOU5YMqnBM2V7NUanNw==", + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "dev": true, "requires": { - "array-from": "^2.1.1" + "ms": "^2.1.1" } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true } } }, - "@sinonjs/samsam": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.2.tgz", - "integrity": "sha512-ZwTHAlC9akprWDinwEPD4kOuwaYZlyMwVJIANsKNC3QVp0AHB04m7RnB4eqeWfgmxw8MGTzS9uMaw93Z3QcZbw==", - "dev": true - }, - "@types/bignumber.js": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/bignumber.js/-/bignumber.js-4.0.3.tgz", - "integrity": "sha512-KoJPKjhlWBry4fk8qcIufXFOU+zcZBfkHQWKbnAMQTMoe2GDeLpjSQHS+22gv+dg7gKdTP2WCjSeCVnfj8e+Gw==", - "dev": true - }, - "@types/underscore": { - "version": "1.8.8", - "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.8.8.tgz", - "integrity": "sha512-EquzRwzAAs04anQ8/6MYXFKvHoD+MIlF+gu87EDda7dN9zrKvQYHsc9VFAPB1xY4tUHQVvBMtjsHrvof2EE1Mg==", - "dev": true - }, - "JSONStream": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.3.tgz", - "integrity": "sha512-3Sp6WZZ/lXl+nTDoGpGWHEpTnnC6X5fnkolYZR6nwIfzbxxvA8utPWe1gCt7i0m9uVGsSz2IS8K8mJ7HmlduMg==", - "dev": true, - "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - } - }, - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", - "dev": true - }, - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", - "dev": true - }, - "acorn-node": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.3.0.tgz", - "integrity": "sha512-efP54n3d1aLfjL2UMdaXa6DsswwzJeI5rqhbFvXMrKiJ6eJFpf+7R0zN7t8IC+XKn2YOAFAv6xbBNgHUkoHWLw==", + "@babel/generator": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.1.3.tgz", + "integrity": "sha512-ZoCZGcfIJFJuZBqxcY9OjC1KW2lWK64qrX1o4UYL3yshVhwKFYgzpWZ0vvtGMNJdTlvkw0W+HR1VnYN8q3QPFQ==", "dev": true, "requires": { - "acorn": "^5.4.1", - "xtend": "^4.0.1" + "@babel/types": "^7.1.3", + "jsesc": "^2.5.1", + "lodash": "^4.17.10", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" }, "dependencies": { - "acorn": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", - "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", "dev": true } } }, - "add-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", - "integrity": "sha1-anmQQ3ynNtXhKI25K9MmbV9csqo=", - "dev": true - }, - "aes-js": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.1.tgz", - "integrity": "sha512-cEA0gBelItZZV7iBiL8ApCiNgc+gBWJJ4uoORhbu6vOqAJ0UL9wIlxr4RI7ij9SSVzy6AnPwiu37kVYiHCl3nw==", - "dev": true - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "@babel/helper-annotate-as-pure": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz", + "integrity": "sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q==", "dev": true, "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" + "@babel/types": "^7.0.0" } }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz", + "integrity": "sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w==", "dev": true, "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } + "@babel/helper-explode-assignable-expression": "^7.1.0", + "@babel/types": "^7.0.0" } }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true - }, - "ansi-colors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", - "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", + "@babel/helper-call-delegate": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.1.0.tgz", + "integrity": "sha512-YEtYZrw3GUK6emQHKthltKNZwszBcHK58Ygcis+gVUrF4/FmTVr5CCqQNSfmvg2y+YDEANyYoaLz/SHsnusCwQ==", "dev": true, "requires": { - "ansi-wrap": "^0.1.0" + "@babel/helper-hoist-variables": "^7.0.0", + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.0.0" } }, - "ansi-cyan": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", - "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", + "@babel/helper-define-map": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz", + "integrity": "sha512-yPPcW8dc3gZLN+U1mhYV91QU3n5uTbx7DUdf8NnPbjS0RMwBuHi9Xt2MUgppmNz7CJxTBWsGczTiEp1CSOTPRg==", "dev": true, "requires": { - "ansi-wrap": "0.1.0" + "@babel/helper-function-name": "^7.1.0", + "@babel/types": "^7.0.0", + "lodash": "^4.17.10" } }, - "ansi-escapes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", - "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", - "dev": true - }, - "ansi-gray": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", - "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=", + "@babel/helper-explode-assignable-expression": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz", + "integrity": "sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA==", "dev": true, "requires": { - "ansi-wrap": "0.1.0" + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.0.0" } }, - "ansi-red": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", - "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "@babel/helper-function-name": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", + "integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", "dev": true, "requires": { - "ansi-wrap": "0.1.0" + "@babel/helper-get-function-arity": "^7.0.0", + "@babel/template": "^7.1.0", + "@babel/types": "^7.0.0" } }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "ansi-wrap": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", - "dev": true - }, - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "@babel/helper-get-function-arity": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", + "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", "dev": true, "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" + "@babel/types": "^7.0.0" } }, - "append-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/append-buffer/-/append-buffer-1.0.2.tgz", - "integrity": "sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE=", + "@babel/helper-hoist-variables": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0.tgz", + "integrity": "sha512-Ggv5sldXUeSKsuzLkddtyhyHe2YantsxWKNi7A+7LeD12ExRDWTRk29JCXpaHPAbMaIPZSil7n+lq78WY2VY7w==", "dev": true, "requires": { - "buffer-equal": "^1.0.0" + "@babel/types": "^7.0.0" } }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true - }, - "archy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", - "dev": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "@babel/helper-member-expression-to-functions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz", + "integrity": "sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg==", "dev": true, "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" + "@babel/types": "^7.0.0" } }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "@babel/helper-module-imports": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz", + "integrity": "sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A==", "dev": true, "requires": { - "sprintf-js": "~1.0.2" + "@babel/types": "^7.0.0" } }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true + "@babel/helper-module-transforms": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.1.0.tgz", + "integrity": "sha512-0JZRd2yhawo79Rcm4w0LwSMILFmFXjugG3yqf+P/UsKsRS1mJCmMwwlHDlMg7Avr9LrvSpp4ZSULO9r8jpCzcw==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-simple-access": "^7.1.0", + "@babel/helper-split-export-declaration": "^7.0.0", + "@babel/template": "^7.1.0", + "@babel/types": "^7.0.0", + "lodash": "^4.17.10" + } }, - "arr-filter": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/arr-filter/-/arr-filter-1.1.2.tgz", - "integrity": "sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4=", + "@babel/helper-optimise-call-expression": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz", + "integrity": "sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g==", "dev": true, "requires": { - "make-iterator": "^1.0.0" + "@babel/types": "^7.0.0" } }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "@babel/helper-plugin-utils": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", + "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==", "dev": true }, - "arr-map": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/arr-map/-/arr-map-2.0.2.tgz", - "integrity": "sha1-Onc0X/wc814qkYJWAfnljy4kysQ=", + "@babel/helper-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.0.0.tgz", + "integrity": "sha512-TR0/N0NDCcUIUEbqV6dCO+LptmmSQFQ7q70lfcEB4URsjD0E1HzicrwUH+ap6BAQ2jhCX9Q4UqZy4wilujWlkg==", "dev": true, "requires": { - "make-iterator": "^1.0.0" + "lodash": "^4.17.10" } }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", - "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", - "dev": true + "@babel/helper-remap-async-to-generator": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz", + "integrity": "sha512-3fOK0L+Fdlg8S5al8u/hWE6vhufGSn0bN09xm2LXMy//REAF8kDCrYoOBKYmA8m5Nom+sV9LyLCwrFynA8/slg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-wrap-function": "^7.1.0", + "@babel/template": "^7.1.0", + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.0.0" + } }, - "array-filter": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", - "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", - "dev": true + "@babel/helper-replace-supers": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.1.0.tgz", + "integrity": "sha512-BvcDWYZRWVuDeXTYZWxekQNO5D4kO55aArwZOTFXw6rlLQA8ZaDicJR1sO47h+HrnCiDFiww0fSPV0d713KBGQ==", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "^7.0.0", + "@babel/helper-optimise-call-expression": "^7.0.0", + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.0.0" + } }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", - "dev": true + "@babel/helper-simple-access": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz", + "integrity": "sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w==", + "dev": true, + "requires": { + "@babel/template": "^7.1.0", + "@babel/types": "^7.0.0" + } }, - "array-from": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", - "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", - "dev": true + "@babel/helper-split-export-declaration": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz", + "integrity": "sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } }, - "array-ify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", - "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", - "dev": true + "@babel/helper-wrap-function": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.1.0.tgz", + "integrity": "sha512-R6HU3dete+rwsdAfrOzTlE9Mcpk4RjU3aX3gi9grtmugQY0u79X7eogUvfXA5sI81Mfq1cn6AgxihfN33STjJA==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.1.0", + "@babel/template": "^7.1.0", + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.0.0" + } }, - "array-initial": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz", - "integrity": "sha1-L6dLJnOTccOUe9enrcc74zSz15U=", + "@babel/helpers": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.1.2.tgz", + "integrity": "sha512-Myc3pUE8eswD73aWcartxB16K6CGmHDv9KxOmD2CeOs/FaEAQodr3VYGmlvOmog60vNQ2w8QbatuahepZwrHiA==", "dev": true, "requires": { - "array-slice": "^1.0.0", - "is-number": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - } + "@babel/template": "^7.1.2", + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.1.2" } }, - "array-last": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array-last/-/array-last-1.3.0.tgz", - "integrity": "sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==", + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", "dev": true, "requires": { - "is-number": "^4.0.0" + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" }, "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - } - } - }, - "array-map": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", - "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", - "dev": true + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } }, - "array-reduce": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", - "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", + "@babel/parser": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.1.3.tgz", + "integrity": "sha512-gqmspPZOMW3MIRb9HlrnbZHXI1/KHTOroBwN1NcLL6pWxzqzEKGvRTq0W/PxS45OtQGbaFikSQpkS5zbnsQm2w==", "dev": true }, - "array-slice": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", - "dev": true + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.1.0.tgz", + "integrity": "sha512-Fq803F3Jcxo20MXUSDdmZZXrPe6BWyGcWBPPNB/M7WaUYESKDeKMOGIxEzQOjGSmW/NWb6UaPZrtTB2ekhB/ew==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-remap-async-to-generator": "^7.1.0", + "@babel/plugin-syntax-async-generators": "^7.0.0" + } }, - "array-sort": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-1.0.0.tgz", - "integrity": "sha512-ihLeJkonmdiAsD7vpgN3CRcx2J2S0TiYW+IS/5zHBI7mKUq3ySvBdzzBfD236ubDBQFiiyG3SWCPc+msQ9KoYg==", + "@babel/plugin-proposal-export-default-from": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.0.0.tgz", + "integrity": "sha512-cWhkx6SyjZ4caFOanoPmDNgQCuYYTmou4QXy886JsyLTw/vhWQbop2gLKsWyyswrJkKTB7fSNxVYbP/oEsoySA==", "dev": true, "requires": { - "default-compare": "^1.0.0", - "get-value": "^2.0.6", - "kind-of": "^5.0.2" + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-export-default-from": "^7.0.0" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.0.0.tgz", + "integrity": "sha512-kfVdUkIAGJIVmHmtS/40i/fg/AGnw/rsZBCaapY5yjeO5RA9m165Xbw9KMOu2nqXP5dTFjEjHdfNdoVcHv133Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-json-strings": "^7.0.0" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.0.0.tgz", + "integrity": "sha512-14fhfoPcNu7itSen7Py1iGN0gEm87hX/B+8nZPqkdmANyyYWYMY2pjA3r8WXbWVKMzfnSNS0xY8GVS0IjXi/iw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-object-rest-spread": "^7.0.0" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.0.0.tgz", + "integrity": "sha512-JPqAvLG1s13B/AuoBjdBYvn38RqW6n1TzrQO839/sIpqLpbnXKacsAgpZHzLD83Sm8SDXMkkrAvEnJ25+0yIpw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.0.0" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.0.0.tgz", + "integrity": "sha512-tM3icA6GhC3ch2SkmSxv7J/hCWKISzwycub6eGsDrFDgukD4dZ/I+x81XgW0YslS6mzNuQ1Cbzh5osjIMgepPQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-regex": "^7.0.0", + "regexpu-core": "^4.2.0" }, "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "regexpu-core": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.2.0.tgz", + "integrity": "sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw==", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^7.0.0", + "regjsgen": "^0.4.0", + "regjsparser": "^0.3.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.0.2" + } + }, + "regjsgen": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.4.0.tgz", + "integrity": "sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA==", "dev": true + }, + "regjsparser": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.3.0.tgz", + "integrity": "sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + } } } }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "@babel/plugin-syntax-async-generators": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.0.0.tgz", + "integrity": "sha512-im7ged00ddGKAjcZgewXmp1vxSZQQywuQXe2B1A7kajjZmDeY/ekMPmWr9zJgveSaQH0k7BcGrojQhcK06l0zA==", "dev": true, "requires": { - "array-uniq": "^1.0.1" + "@babel/helper-plugin-utils": "^7.0.0" } }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true + "@babel/plugin-syntax-export-default-from": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-default-from/-/plugin-syntax-export-default-from-7.0.0.tgz", + "integrity": "sha512-HNnjg/fFFbnuLAqr/Ocp1Y3GB4AjmXcu1xxn3ql3bS2kGrB/qi+Povshb8i3hOkE5jNozzh8r/0/lq1w8oOWbQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true + "@babel/plugin-syntax-json-strings": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.0.0.tgz", + "integrity": "sha512-UlSfNydC+XLj4bw7ijpldc1uZ/HB84vw+U6BTuqMdIEmz/LDe63w/GHtpQMdXWdqQZFeAI9PjnHe/vDhwirhKA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.0.0.tgz", + "integrity": "sha512-5A0n4p6bIiVe5OvQPxBnesezsgFJdHhSs3uFSvaPdMqtsovajLZ+G2vZyvNe10EzJBWWo3AcHGKhAFUxqwp2dw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.0.0.tgz", + "integrity": "sha512-Wc+HVvwjcq5qBg1w5RG9o9RVzmCaAg/Vp0erHCKpAYV8La6I94o4GQAmFYNmkzoMO6gzoOSulpKeSSz6mPEoZw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } }, - "asn1.js": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", - "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "@babel/plugin-transform-arrow-functions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.0.0.tgz", + "integrity": "sha512-2EZDBl1WIO/q4DIkIp4s86sdp4ZifL51MoIviLY/gG/mLSuOIEg7J8o6mhbxOTvUJkaN50n+8u41FVsr5KLy/w==", "dev": true, "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" + "@babel/helper-plugin-utils": "^7.0.0" } }, - "assert": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", - "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "@babel/plugin-transform-async-to-generator": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.1.0.tgz", + "integrity": "sha512-rNmcmoQ78IrvNCIt/R9U+cixUHeYAzgusTFgIAv+wQb9HJU4szhpDD6e5GCACmj/JP5KxuCwM96bX3L9v4ZN/g==", "dev": true, "requires": { - "util": "0.10.3" + "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-remap-async-to-generator": "^7.1.0" } }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.0.0.tgz", + "integrity": "sha512-AOBiyUp7vYTqz2Jibe1UaAWL0Hl9JUXEgjFvvvcSc9MVDItv46ViXFw2F7SVt1B5k+KWjl44eeXOAk3UDEaJjQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true + "@babel/plugin-transform-block-scoping": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.0.0.tgz", + "integrity": "sha512-GWEMCrmHQcYWISilUrk9GDqH4enf3UmhOEbNbNrlNAX1ssH3MsS1xLOS6rdjRVPgA7XXVPn87tRkdTEoA/dxEg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "lodash": "^4.17.10" + } }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true + "@babel/plugin-transform-classes": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.1.0.tgz", + "integrity": "sha512-rNaqoD+4OCBZjM7VaskladgqnZ1LO6o2UxuWSDzljzW21pN1KXkB7BstAVweZdxQkHAujps5QMNOTWesBciKFg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-define-map": "^7.1.0", + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-optimise-call-expression": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-replace-supers": "^7.1.0", + "@babel/helper-split-export-declaration": "^7.0.0", + "globals": "^11.1.0" + }, + "dependencies": { + "globals": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", + "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", + "dev": true + } + } }, - "astw": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/astw/-/astw-2.2.0.tgz", - "integrity": "sha1-e9QXhNMkk5h66yOba04cV6hzuRc=", + "@babel/plugin-transform-computed-properties": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.0.0.tgz", + "integrity": "sha512-ubouZdChNAv4AAWAgU7QKbB93NU5sHwInEWfp+/OzJKA02E6Woh9RVoX4sZrbRwtybky/d7baTUqwFx+HgbvMA==", "dev": true, "requires": { - "acorn": "^4.0.3" + "@babel/helper-plugin-utils": "^7.0.0" } }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true + "@babel/plugin-transform-destructuring": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.1.3.tgz", + "integrity": "sha512-Mb9M4DGIOspH1ExHOUnn2UUXFOyVTiX84fXCd+6B5iWrQg/QMeeRmSwpZ9lnjYLSXtZwiw80ytVMr3zue0ucYw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } }, - "async-done": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.1.tgz", - "integrity": "sha512-R1BaUeJ4PMoLNJuk+0tLJgjmEqVsdN118+Z8O+alhnQDQgy0kmD5Mqi0DNEmMx2LM0Ed5yekKu+ZXYvIHceicg==", + "@babel/plugin-transform-dotall-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.0.0.tgz", + "integrity": "sha512-00THs8eJxOJUFVx1w8i1MBF4XH4PsAjKjQ1eqN/uCH3YKwP21GCKfrn6YZFZswbOk9+0cw1zGQPHVc1KBlSxig==", "dev": true, "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.2", - "process-nextick-args": "^1.0.7", - "stream-exhaust": "^1.0.1" + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-regex": "^7.0.0", + "regexpu-core": "^4.1.3" }, "dependencies": { - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "regexpu-core": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.2.0.tgz", + "integrity": "sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw==", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^7.0.0", + "regjsgen": "^0.4.0", + "regjsparser": "^0.3.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.0.2" + } + }, + "regjsgen": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.4.0.tgz", + "integrity": "sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA==", "dev": true + }, + "regjsparser": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.3.0.tgz", + "integrity": "sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + } } } }, - "async-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", - "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", - "dev": true - }, - "async-settle": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz", - "integrity": "sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs=", + "@babel/plugin-transform-duplicate-keys": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.0.0.tgz", + "integrity": "sha512-w2vfPkMqRkdxx+C71ATLJG30PpwtTpW7DDdLqYt2acXU7YjztzeWW2Jk1T6hKqCLYCcEA5UQM/+xTAm+QCSnuQ==", "dev": true, "requires": { - "async-done": "^1.2.2" + "@babel/helper-plugin-utils": "^7.0.0" } }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "atob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", - "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.1.0.tgz", + "integrity": "sha512-uZt9kD1Pp/JubkukOGQml9tqAeI8NkE98oZnHZ2qHRElmeKCodbTZgOEUtujSCSLhHSBWbzNiFSDIMC4/RBTLQ==", + "dev": true, + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.1.0", + "@babel/helper-plugin-utils": "^7.0.0" + } }, - "aws4": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", - "dev": true + "@babel/plugin-transform-for-of": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.0.0.tgz", + "integrity": "sha512-TlxKecN20X2tt2UEr2LNE6aqA0oPeMT1Y3cgz8k4Dn1j5ObT8M3nl9aA37LLklx0PBZKETC9ZAf9n/6SujTuXA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "@babel/plugin-transform-function-name": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.1.0.tgz", + "integrity": "sha512-VxOa1TMlFMtqPW2IDYZQaHsFrq/dDoIjgN098NowhexhZcz3UGlvPgZXuE1jEvNygyWyxRacqDpCZt+par1FNg==", "dev": true, "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-core": { - "version": "6.26.3", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", - "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "@babel/plugin-transform-instanceof": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-instanceof/-/plugin-transform-instanceof-7.0.0-beta.53.tgz", + "integrity": "sha1-WC2CtyUYggGtDiIx8fzpTHRaLAY=", "dev": true, "requires": { - "babel-code-frame": "^6.26.0", - "babel-generator": "^6.26.0", - "babel-helpers": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-register": "^6.26.0", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "convert-source-map": "^1.5.1", - "debug": "^2.6.9", - "json5": "^0.5.1", - "lodash": "^4.17.4", - "minimatch": "^3.0.4", - "path-is-absolute": "^1.0.1", - "private": "^0.1.8", - "slash": "^1.0.0", - "source-map": "^0.5.7" - }, - "dependencies": { - "convert-source-map": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", - "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", - "dev": true - } - } - }, - "babel-generator": { - "version": "6.26.1", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", - "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", - "dev": true, - "requires": { - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "detect-indent": "^4.0.0", - "jsesc": "^1.3.0", - "lodash": "^4.17.4", - "source-map": "^0.5.7", - "trim-right": "^1.0.1" + "@babel/helper-plugin-utils": "7.0.0-beta.53" }, "dependencies": { - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "@babel/helper-plugin-utils": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0-beta.53.tgz", + "integrity": "sha1-1kRYY2/8JYtCcUqd2Trrb4uM8+0=", "dev": true } } }, - "babel-helper-builder-binary-assignment-operator-visitor": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", - "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", - "dev": true, - "requires": { - "babel-helper-explode-assignable-expression": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-call-delegate": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", - "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "@babel/plugin-transform-literals": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.0.0.tgz", + "integrity": "sha512-1NTDBWkeNXgpUcyoVFxbr9hS57EpZYXpje92zv0SUzjdu3enaRwF/l3cmyRnXLtIdyJASyiS6PtybK+CgKf7jA==", "dev": true, "requires": { - "babel-helper-hoist-variables": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-helper-define-map": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", - "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", + "@babel/plugin-transform-modules-amd": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.1.0.tgz", + "integrity": "sha512-wt8P+xQ85rrnGNr2x1iV3DW32W8zrB6ctuBkYBbf5/ZzJY99Ob4MFgsZDFgczNU76iy9PWsy4EuxOliDjdKw6A==", "dev": true, "requires": { - "babel-helper-function-name": "^6.24.1", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" + "@babel/helper-module-transforms": "^7.1.0", + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-helper-explode-assignable-expression": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", - "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "@babel/plugin-transform-modules-commonjs": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.1.0.tgz", + "integrity": "sha512-wtNwtMjn1XGwM0AXPspQgvmE6msSJP15CX2RVfpTSTNPLhKhaOjaIfBaVfj4iUZ/VrFSodcFedwtPg/NxwQlPA==", "dev": true, "requires": { - "babel-runtime": "^6.22.0", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" + "@babel/helper-module-transforms": "^7.1.0", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-simple-access": "^7.1.0" } }, - "babel-helper-function-name": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", - "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "@babel/plugin-transform-modules-systemjs": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.1.3.tgz", + "integrity": "sha512-PvTxgjxQAq4pvVUZF3mD5gEtVDuId8NtWkJsZLEJZMZAW3TvgQl1pmydLLN1bM8huHFVVU43lf0uvjQj9FRkKw==", "dev": true, "requires": { - "babel-helper-get-function-arity": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" + "@babel/helper-hoist-variables": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-helper-get-function-arity": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", - "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "@babel/plugin-transform-modules-umd": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.1.0.tgz", + "integrity": "sha512-enrRtn5TfRhMmbRwm7F8qOj0qEYByqUvTttPEGimcBH4CJHphjyK1Vg7sdU7JjeEmgSpM890IT/efS2nMHwYig==", "dev": true, "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" + "@babel/helper-module-transforms": "^7.1.0", + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-helper-hoist-variables": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", - "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", + "@babel/plugin-transform-new-target": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.0.0.tgz", + "integrity": "sha512-yin069FYjah+LbqfGeTfzIBODex/e++Yfa0rH0fpfam9uTbuEeEOx5GLGr210ggOV77mVRNoeqSYqeuaqSzVSw==", "dev": true, "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-helper-optimise-call-expression": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", - "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "@babel/plugin-transform-object-super": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.1.0.tgz", + "integrity": "sha512-/O02Je1CRTSk2SSJaq0xjwQ8hG4zhZGNjE8psTsSNPXyLRCODv7/PBozqT5AmQMzp7MI3ndvMhGdqp9c96tTEw==", "dev": true, "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-replace-supers": "^7.1.0" } }, - "babel-helper-regex": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", - "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", + "@babel/plugin-transform-parameters": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.1.0.tgz", + "integrity": "sha512-vHV7oxkEJ8IHxTfRr3hNGzV446GAb+0hgbA7o/0Jd76s+YzccdWuTU296FOCOl/xweU4t/Ya4g41yWz80RFCRw==", "dev": true, "requires": { - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" + "@babel/helper-call-delegate": "^7.1.0", + "@babel/helper-get-function-arity": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-helper-remap-async-to-generator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", - "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "@babel/plugin-transform-regenerator": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0.tgz", + "integrity": "sha512-sj2qzsEx8KDVv1QuJc/dEfilkg3RRPvPYx/VnKLtItVQRWt1Wqf5eVCOLZm29CiGFfYYsA3VPjfizTCV0S0Dlw==", "dev": true, "requires": { - "babel-helper-function-name": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" + "regenerator-transform": "^0.13.3" + }, + "dependencies": { + "regenerator-transform": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.13.3.tgz", + "integrity": "sha512-5ipTrZFSq5vU2YoGoww4uaRVAK4wyYC4TSICibbfEPOruUu8FFP7ErV0BjmbIOEpn3O/k9na9UEdYR/3m7N6uA==", + "dev": true, + "requires": { + "private": "^0.1.6" + } + } } }, - "babel-helper-replace-supers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", - "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "@babel/plugin-transform-shorthand-properties": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.0.0.tgz", + "integrity": "sha512-g/99LI4vm5iOf5r1Gdxq5Xmu91zvjhEG5+yZDJW268AZELAu4J1EiFLnkSG3yuUsZyOipVOVUKoGPYwfsTymhw==", "dev": true, "requires": { - "babel-helper-optimise-call-expression": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-helpers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", - "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "@babel/plugin-transform-spread": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.0.0.tgz", + "integrity": "sha512-L702YFy2EvirrR4shTj0g2xQp7aNwZoWNCkNu2mcoU0uyzMl0XRwDSwzB/xp6DSUFiBmEXuyAyEN16LsgVqGGQ==", "dev": true, "requires": { - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "@babel/plugin-transform-sticky-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.0.0.tgz", + "integrity": "sha512-LFUToxiyS/WD+XEWpkx/XJBrUXKewSZpzX68s+yEOtIbdnsRjpryDw9U06gYc6klYEij/+KQVRnD3nz3AoKmjw==", "dev": true, "requires": { - "babel-runtime": "^6.22.0" + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-regex": "^7.0.0" } }, - "babel-plugin-check-es2015-constants": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", - "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "@babel/plugin-transform-template-literals": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.0.0.tgz", + "integrity": "sha512-vA6rkTCabRZu7Nbl9DfLZE1imj4tzdWcg5vtdQGvj+OH9itNNB6hxuRMHuIY8SGnEt1T9g5foqs9LnrHzsqEFg==", "dev": true, "requires": { - "babel-runtime": "^6.22.0" + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-plugin-syntax-async-functions": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", - "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", - "dev": true - }, - "babel-plugin-syntax-exponentiation-operator": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", - "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", - "dev": true - }, - "babel-plugin-syntax-trailing-function-commas": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", - "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", - "dev": true - }, - "babel-plugin-transform-async-to-generator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", - "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "@babel/plugin-transform-typeof-symbol": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.0.0.tgz", + "integrity": "sha512-1r1X5DO78WnaAIvs5uC48t41LLckxsYklJrZjNKcevyz83sF2l4RHbw29qrCPr/6ksFsdfRpT/ZgxNWHXRnffg==", "dev": true, "requires": { - "babel-helper-remap-async-to-generator": "^6.24.1", - "babel-plugin-syntax-async-functions": "^6.8.0", - "babel-runtime": "^6.22.0" + "@babel/helper-plugin-utils": "^7.0.0" } }, - "babel-plugin-transform-es2015-arrow-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", - "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "@babel/plugin-transform-unicode-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.0.0.tgz", + "integrity": "sha512-uJBrJhBOEa3D033P95nPHu3nbFwFE9ZgXsfEitzoIXIwqAZWk7uXcg06yFKXz9FSxBH5ucgU/cYdX0IV8ldHKw==", "dev": true, "requires": { - "babel-runtime": "^6.22.0" + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-regex": "^7.0.0", + "regexpu-core": "^4.1.3" + }, + "dependencies": { + "regexpu-core": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.2.0.tgz", + "integrity": "sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw==", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^7.0.0", + "regjsgen": "^0.4.0", + "regjsparser": "^0.3.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.0.2" + } + }, + "regjsgen": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.4.0.tgz", + "integrity": "sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA==", + "dev": true + }, + "regjsparser": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.3.0.tgz", + "integrity": "sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + } + } } }, - "babel-plugin-transform-es2015-block-scoped-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", - "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", - "dev": true, + "@babel/polyfill": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.0.0.tgz", + "integrity": "sha512-dnrMRkyyr74CRelJwvgnnSUDh2ge2NCTyHVwpOdvRMHtJUyxLtMAfhBN3s64pY41zdw0kgiLPh6S20eb1NcX6Q==", "requires": { - "babel-runtime": "^6.22.0" + "core-js": "^2.5.7", + "regenerator-runtime": "^0.11.1" } }, - "babel-plugin-transform-es2015-block-scoping": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", - "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" + "@babel/preset-env": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.1.0.tgz", + "integrity": "sha512-ZLVSynfAoDHB/34A17/JCZbyrzbQj59QC1Anyueb4Bwjh373nVPq5/HMph0z+tCmcDjXDe+DlKQq9ywQuvWrQg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-async-generator-functions": "^7.1.0", + "@babel/plugin-proposal-json-strings": "^7.0.0", + "@babel/plugin-proposal-object-rest-spread": "^7.0.0", + "@babel/plugin-proposal-optional-catch-binding": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.0.0", + "@babel/plugin-syntax-async-generators": "^7.0.0", + "@babel/plugin-syntax-object-rest-spread": "^7.0.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.0.0", + "@babel/plugin-transform-arrow-functions": "^7.0.0", + "@babel/plugin-transform-async-to-generator": "^7.1.0", + "@babel/plugin-transform-block-scoped-functions": "^7.0.0", + "@babel/plugin-transform-block-scoping": "^7.0.0", + "@babel/plugin-transform-classes": "^7.1.0", + "@babel/plugin-transform-computed-properties": "^7.0.0", + "@babel/plugin-transform-destructuring": "^7.0.0", + "@babel/plugin-transform-dotall-regex": "^7.0.0", + "@babel/plugin-transform-duplicate-keys": "^7.0.0", + "@babel/plugin-transform-exponentiation-operator": "^7.1.0", + "@babel/plugin-transform-for-of": "^7.0.0", + "@babel/plugin-transform-function-name": "^7.1.0", + "@babel/plugin-transform-literals": "^7.0.0", + "@babel/plugin-transform-modules-amd": "^7.1.0", + "@babel/plugin-transform-modules-commonjs": "^7.1.0", + "@babel/plugin-transform-modules-systemjs": "^7.0.0", + "@babel/plugin-transform-modules-umd": "^7.1.0", + "@babel/plugin-transform-new-target": "^7.0.0", + "@babel/plugin-transform-object-super": "^7.1.0", + "@babel/plugin-transform-parameters": "^7.1.0", + "@babel/plugin-transform-regenerator": "^7.0.0", + "@babel/plugin-transform-shorthand-properties": "^7.0.0", + "@babel/plugin-transform-spread": "^7.0.0", + "@babel/plugin-transform-sticky-regex": "^7.0.0", + "@babel/plugin-transform-template-literals": "^7.0.0", + "@babel/plugin-transform-typeof-symbol": "^7.0.0", + "@babel/plugin-transform-unicode-regex": "^7.0.0", + "browserslist": "^4.1.0", + "invariant": "^2.2.2", + "js-levenshtein": "^1.1.3", + "semver": "^5.3.0" + }, + "dependencies": { + "browserslist": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.2.1.tgz", + "integrity": "sha512-1oO0c7Zhejwd+LXihS89WqtKionSbz298rJZKJgfrHIZhrV8AC15gw553VcB0lcEugja7IhWD7iAlrsamfYVPA==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000890", + "electron-to-chromium": "^1.3.79", + "node-releases": "^1.0.0-alpha.14" + } + }, + "caniuse-lite": { + "version": "1.0.30000893", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000893.tgz", + "integrity": "sha512-kOddHcTEef+NgN/fs0zmX2brHTNATVOWMEIhlZHCuwQRtXobjSw9pAECc44Op4bTBcavRjkLaPrGomknH7+Jvg==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.80", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.80.tgz", + "integrity": "sha512-WClidEWEUNx7OfwXehB0qaxCuetjbKjev2SmXWgybWPLKAThBiMTF/2Pd8GSUDtoGOavxVzdkKwfFAPRSWlkLw==", + "dev": true + } } }, - "babel-plugin-transform-es2015-classes": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", - "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", - "dev": true, - "requires": { - "babel-helper-define-map": "^6.24.1", - "babel-helper-function-name": "^6.24.1", - "babel-helper-optimise-call-expression": "^6.24.1", - "babel-helper-replace-supers": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } + "@babel/preset-es2015": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/preset-es2015/-/preset-es2015-7.0.0-beta.53.tgz", + "integrity": "sha1-SYL6GUjbEJN2Yoj2mRPizjYDEeQ=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53", + "@babel/plugin-transform-arrow-functions": "7.0.0-beta.53", + "@babel/plugin-transform-block-scoped-functions": "7.0.0-beta.53", + "@babel/plugin-transform-block-scoping": "7.0.0-beta.53", + "@babel/plugin-transform-classes": "7.0.0-beta.53", + "@babel/plugin-transform-computed-properties": "7.0.0-beta.53", + "@babel/plugin-transform-destructuring": "7.0.0-beta.53", + "@babel/plugin-transform-duplicate-keys": "7.0.0-beta.53", + "@babel/plugin-transform-for-of": "7.0.0-beta.53", + "@babel/plugin-transform-function-name": "7.0.0-beta.53", + "@babel/plugin-transform-instanceof": "7.0.0-beta.53", + "@babel/plugin-transform-literals": "7.0.0-beta.53", + "@babel/plugin-transform-modules-amd": "7.0.0-beta.53", + "@babel/plugin-transform-modules-commonjs": "7.0.0-beta.53", + "@babel/plugin-transform-modules-systemjs": "7.0.0-beta.53", + "@babel/plugin-transform-modules-umd": "7.0.0-beta.53", + "@babel/plugin-transform-object-super": "7.0.0-beta.53", + "@babel/plugin-transform-parameters": "7.0.0-beta.53", + "@babel/plugin-transform-regenerator": "7.0.0-beta.53", + "@babel/plugin-transform-shorthand-properties": "7.0.0-beta.53", + "@babel/plugin-transform-spread": "7.0.0-beta.53", + "@babel/plugin-transform-sticky-regex": "7.0.0-beta.53", + "@babel/plugin-transform-template-literals": "7.0.0-beta.53", + "@babel/plugin-transform-typeof-symbol": "7.0.0-beta.53", + "@babel/plugin-transform-unicode-regex": "7.0.0-beta.53" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.53.tgz", + "integrity": "sha1-mA0VYLhjV1v1o3eSUDfgEy71kh4=", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0-beta.53" + } + }, + "@babel/generator": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.53.tgz", + "integrity": "sha1-uMrXLFcr4yNK/94ivm2sxCUOA0s=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.53", + "jsesc": "^2.5.1", + "lodash": "^4.17.5", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0-beta.53.tgz", + "integrity": "sha1-WZYGKDdcvu+WoH7f4co4t1bwGqg=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.53" + } + }, + "@babel/helper-call-delegate": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.0.0-beta.53.tgz", + "integrity": "sha1-ld6Lq9A/nmz08rVkoDhwjBOP/jE=", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "7.0.0-beta.53", + "@babel/traverse": "7.0.0-beta.53", + "@babel/types": "7.0.0-beta.53" + } + }, + "@babel/helper-define-map": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.0.0-beta.53.tgz", + "integrity": "sha1-SOniJlRTeHl1BD76qx7a0jnqlpU=", + "dev": true, + "requires": { + "@babel/helper-function-name": "7.0.0-beta.53", + "@babel/types": "7.0.0-beta.53", + "lodash": "^4.17.5" + } + }, + "@babel/helper-function-name": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.53.tgz", + "integrity": "sha1-USgEro6cvOVDHr6hnkdijC7WU/I=", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "7.0.0-beta.53", + "@babel/template": "7.0.0-beta.53", + "@babel/types": "7.0.0-beta.53" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.53.tgz", + "integrity": "sha1-3tiKsp+bHbYch9G7jTijXdp3neY=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.53" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0-beta.53.tgz", + "integrity": "sha1-TCfjuHP6CcWtbpPrQHBMIA+EE3w=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.53" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0-beta.53.tgz", + "integrity": "sha1-D7Dviy07kD0cO/Qm2kp0V14BnOQ=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.53" + } + }, + "@babel/helper-module-imports": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0-beta.53.tgz", + "integrity": "sha1-5zXmqjClBLD52Fw4ptRwqfSqgdk=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.53", + "lodash": "^4.17.5" + } + }, + "@babel/helper-module-transforms": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.0.0-beta.53.tgz", + "integrity": "sha1-e6IUzcyPhiPy0Xl96v8f80mqzhM=", + "dev": true, + "requires": { + "@babel/helper-module-imports": "7.0.0-beta.53", + "@babel/helper-simple-access": "7.0.0-beta.53", + "@babel/helper-split-export-declaration": "7.0.0-beta.53", + "@babel/template": "7.0.0-beta.53", + "@babel/types": "7.0.0-beta.53", + "lodash": "^4.17.5" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0-beta.53.tgz", + "integrity": "sha1-j8eO9MD2n4uzu980zSMsIBIEFMg=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.53" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0-beta.53.tgz", + "integrity": "sha1-1kRYY2/8JYtCcUqd2Trrb4uM8+0=", + "dev": true + }, + "@babel/helper-regex": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.0.0-beta.53.tgz", + "integrity": "sha1-bp0hl7Vid54iVWWUaumoXCFbIl4=", + "dev": true, + "requires": { + "lodash": "^4.17.5" + } + }, + "@babel/helper-replace-supers": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.0.0-beta.53.tgz", + "integrity": "sha1-M5tb3BAilElbGifFWBMjBuG3vKc=", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "7.0.0-beta.53", + "@babel/helper-optimise-call-expression": "7.0.0-beta.53", + "@babel/traverse": "7.0.0-beta.53", + "@babel/types": "7.0.0-beta.53" + } + }, + "@babel/helper-simple-access": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.0.0-beta.53.tgz", + "integrity": "sha1-cvbbmr5C+GgfpvAo79WdgVRHUrM=", + "dev": true, + "requires": { + "@babel/template": "7.0.0-beta.53", + "@babel/types": "7.0.0-beta.53", + "lodash": "^4.17.5" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.53.tgz", + "integrity": "sha1-rvVLix+ZYW6jfJhHhxajeAJjMls=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.53" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.53.tgz", + "integrity": "sha1-9OlS2tF4fSBeGI0+OEzc5JyjaPs=", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + } + }, + "@babel/parser": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.0.0-beta.53.tgz", + "integrity": "sha1-H0XrYXv5Rj1IKywE00nZ5O2/SJI=", + "dev": true + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.0.0-beta.53.tgz", + "integrity": "sha1-p19fqEl6rBcp0DO/QcJQQWudHgQ=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.0.0-beta.53.tgz", + "integrity": "sha1-CkMiGhsMkM1NCfG0a5Wd0khlf3M=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.0.0-beta.53.tgz", + "integrity": "sha1-nv1uUMofo5jcqnEZYh2j8fu4IbY=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53", + "lodash": "^4.17.5" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.0.0-beta.53.tgz", + "integrity": "sha1-XcLsMb8emAZqzfDEiHt3RMFL7G4=", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "7.0.0-beta.53", + "@babel/helper-define-map": "7.0.0-beta.53", + "@babel/helper-function-name": "7.0.0-beta.53", + "@babel/helper-optimise-call-expression": "7.0.0-beta.53", + "@babel/helper-plugin-utils": "7.0.0-beta.53", + "@babel/helper-replace-supers": "7.0.0-beta.53", + "@babel/helper-split-export-declaration": "7.0.0-beta.53", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.0.0-beta.53.tgz", + "integrity": "sha1-l0fiYIKulO2lMPmNLCBZ6NLbwAU=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.0.0-beta.53.tgz", + "integrity": "sha1-DwrbDhptzTWjZkEBYJ7AYv8SenY=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.0.0-beta.53.tgz", + "integrity": "sha1-D1WZE6v6GCOcpOCPc+7DbF5XuB8=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.0.0-beta.53.tgz", + "integrity": "sha1-+gZSFeGFacj3TdUktXIeEdzKlzs=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.0.0-beta.53.tgz", + "integrity": "sha1-Kzpbs2TB4cV+zL/iXGv1XygEET4=", + "dev": true, + "requires": { + "@babel/helper-function-name": "7.0.0-beta.53", + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.0.0-beta.53.tgz", + "integrity": "sha1-vsTxROmpbvUSHRQwx+vl/QiGV8k=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.0.0-beta.53.tgz", + "integrity": "sha1-WFTXOeZ5IzqId8C0GCaca+t6Miw=", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "7.0.0-beta.53", + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.0.0-beta.53.tgz", + "integrity": "sha1-68P7ocWmyHQ7kJQD7NPn42gcr6U=", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "7.0.0-beta.53", + "@babel/helper-plugin-utils": "7.0.0-beta.53", + "@babel/helper-simple-access": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.0.0-beta.53.tgz", + "integrity": "sha1-uA/NnBWXLcaCMhT1JIUnhgu/BY4=", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "7.0.0-beta.53", + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.0.0-beta.53.tgz", + "integrity": "sha1-Kjar5AodpnbkOhwwcVeOJ70tZ50=", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "7.0.0-beta.53", + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.0.0-beta.53.tgz", + "integrity": "sha1-4sTwbts0s9eksnV7oYgp0N8gKcs=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53", + "@babel/helper-replace-supers": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.0.0-beta.53.tgz", + "integrity": "sha1-7+YM7IzsoNGdXG+hrnm8TjMnnVY=", + "dev": true, + "requires": { + "@babel/helper-call-delegate": "7.0.0-beta.53", + "@babel/helper-get-function-arity": "7.0.0-beta.53", + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0-beta.53.tgz", + "integrity": "sha1-T+u/YISvoMHJ7ISX3mjAaV/p2gs=", + "dev": true, + "requires": { + "regenerator-transform": "^0.13.3" + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.0.0-beta.53.tgz", + "integrity": "sha1-38SIG2vXZYoAMew7gWPliPCJjUs=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.0.0-beta.53.tgz", + "integrity": "sha1-g+j2Rsok8cmCKPnxREz2DL1JOLw=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.0.0-beta.53.tgz", + "integrity": "sha1-D888mUq92Lq1m6l4L+TZ+KVF1uc=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53", + "@babel/helper-regex": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.0.0-beta.53.tgz", + "integrity": "sha1-+msLQXEA0j4tsUwd9HorGzl48dk=", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "7.0.0-beta.53", + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.0.0-beta.53.tgz", + "integrity": "sha1-ZarocamqQPYRSDZlcxIJrr1cKis=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.0.0-beta.53.tgz", + "integrity": "sha1-CvdOyAGefVnji+ZNt/YikZQv7SU=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0-beta.53", + "@babel/helper-regex": "7.0.0-beta.53", + "regexpu-core": "^4.1.3" + } + }, + "@babel/template": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.53.tgz", + "integrity": "sha1-MyIpCQDQsYewpxdDgeHzu3EFDS4=", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.53", + "@babel/parser": "7.0.0-beta.53", + "@babel/types": "7.0.0-beta.53", + "lodash": "^4.17.5" + } + }, + "@babel/traverse": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.53.tgz", + "integrity": "sha1-ANMs2NC1j0wB0xFXvmIsZigm00Q=", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.53", + "@babel/generator": "7.0.0-beta.53", + "@babel/helper-function-name": "7.0.0-beta.53", + "@babel/helper-split-export-declaration": "7.0.0-beta.53", + "@babel/parser": "7.0.0-beta.53", + "@babel/types": "7.0.0-beta.53", + "debug": "^3.1.0", + "globals": "^11.1.0", + "invariant": "^2.2.0", + "lodash": "^4.17.5" + } + }, + "@babel/types": { + "version": "7.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.53.tgz", + "integrity": "sha1-GaRhwNpRVZXftnQLS0Xce7Dms3U=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.5", + "to-fast-properties": "^2.0.0" + } + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "globals": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", + "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "regenerator-transform": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.13.3.tgz", + "integrity": "sha512-5ipTrZFSq5vU2YoGoww4uaRVAK4wyYC4TSICibbfEPOruUu8FFP7ErV0BjmbIOEpn3O/k9na9UEdYR/3m7N6uA==", + "dev": true, + "requires": { + "private": "^0.1.6" + } + }, + "regexpu-core": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.2.0.tgz", + "integrity": "sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw==", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^7.0.0", + "regjsgen": "^0.4.0", + "regjsparser": "^0.3.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.0.2" + } + }, + "regjsgen": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.4.0.tgz", + "integrity": "sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA==", + "dev": true + }, + "regjsparser": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.3.0.tgz", + "integrity": "sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + } + } + }, + "@babel/template": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.2.tgz", + "integrity": "sha512-SY1MmplssORfFiLDcOETrW7fCLl+PavlwMh92rrGcikQaRq4iWPVH0MpwPpY3etVMx6RnDjXtr6VZYr/IbP/Ag==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.1.2", + "@babel/types": "^7.1.2" + } + }, + "@babel/traverse": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.1.4.tgz", + "integrity": "sha512-my9mdrAIGdDiSVBuMjpn/oXYpva0/EZwWL3sm3Wcy/AVWO2eXnsoZruOT9jOGNRXU8KbCIu5zsKnXcAJ6PcV6Q==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/generator": "^7.1.3", + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-split-export-declaration": "^7.0.0", + "@babel/parser": "^7.1.3", + "@babel/types": "^7.1.3", + "debug": "^3.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.10" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "globals": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", + "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.1.3.tgz", + "integrity": "sha512-RpPOVfK+yatXyn8n4PB1NW6k9qjinrXrRR8ugBN8fD6hCy5RXI6PSbVqpOJBO9oSaY7Nom4ohj35feb0UR9hSA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.10", + "to-fast-properties": "^2.0.0" + }, + "dependencies": { + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + } + } + }, + "@types/bignumber.js": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/bignumber.js/-/bignumber.js-4.0.3.tgz", + "integrity": "sha512-KoJPKjhlWBry4fk8qcIufXFOU+zcZBfkHQWKbnAMQTMoe2GDeLpjSQHS+22gv+dg7gKdTP2WCjSeCVnfj8e+Gw==", + "dev": true + }, + "@types/underscore": { + "version": "1.8.8", + "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.8.8.tgz", + "integrity": "sha512-EquzRwzAAs04anQ8/6MYXFKvHoD+MIlF+gu87EDda7dN9zrKvQYHsc9VFAPB1xY4tUHQVvBMtjsHrvof2EE1Mg==", + "dev": true + }, + "@webassemblyjs/ast": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.7.8.tgz", + "integrity": "sha512-dOrtdtEyB8sInpl75yLPNksY4sRl0j/+t6aHyB/YA+ab9hV3Fo7FmG12FHzP+2MvWVAJtDb+6eXR5EZbZJ+uVg==", + "dev": true, + "requires": { + "@webassemblyjs/helper-module-context": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/wast-parser": "1.7.8" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.7.8.tgz", + "integrity": "sha512-kn2zNKGsbql5i56VAgRYkpG+VazqHhQQZQycT2uXAazrAEDs23gy+Odkh5VblybjnwX2/BITkDtNmSO76hdIvQ==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.7.8.tgz", + "integrity": "sha512-xUwxDXsd1dUKArJEP5wWM5zxgCSwZApSOJyP1XO7M8rNUChUDblcLQ4FpzTpWG2YeylMwMl1MlP5Ztryiz1x4g==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.7.8.tgz", + "integrity": "sha512-WXiIMnuvuwlhWvVOm8xEXU9DnHaa3AgAU0ZPfvY8vO1cSsmYb2WbGbHnMLgs43vXnA7XAob9b56zuZaMkxpCBg==", + "dev": true + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.7.8.tgz", + "integrity": "sha512-TLQxyD9qGOIdX5LPQOPo0Ernd88U5rHkFb8WAjeMIeA0sPjCHeVPaGqUGGIXjUcblUkjuDAc07bruCcNHUrHDA==", + "dev": true, + "requires": { + "@webassemblyjs/wast-printer": "1.7.8" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.7.8.tgz", + "integrity": "sha512-TjK0CnD8hAPkV5mbSp5aWl6SO1+H3WFcjWtixWoy8EMA99YnNzYhpc/WSYWhf7yrhpzkq5tZB0tvLK3Svr3IXA==", + "dev": true + }, + "@webassemblyjs/helper-module-context": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.7.8.tgz", + "integrity": "sha512-uCutAKR7Nm0VsFixcvnB4HhAyHouNbj0Dx1p7eRjFjXGGZ+N7ftTaG1ZbWCasAEbtwGj54LP8+lkBZdTCPmLGg==", + "dev": true + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.7.8.tgz", + "integrity": "sha512-AdCCE3BMW6V34WYaKUmPgVHa88t2Z14P4/0LjLwuGkI0X6pf7nzp0CehzVVk51cKm2ymVXjl9dCG+gR1yhITIQ==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.7.8.tgz", + "integrity": "sha512-BkBhYQuzyl4hgTGOKo87Vdw6f9nj8HhI7WYpI0MCC5qFa5ahrAPOGgyETVdnRbv+Rjukl9MxxfDmVcVC435lDg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-buffer": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/wasm-gen": "1.7.8" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.7.8.tgz", + "integrity": "sha512-tOarWChdG1a3y1yqCX0JMDKzrat5tQe4pV6K/TX19BcXsBLYxFQOL1DEDa5KG9syeyvCrvZ+i1+Mv1ExngvktQ==", + "dev": true, + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.7.8.tgz", + "integrity": "sha512-GCYeGPgUFWJiZuP4NICbcyUQNxNLJIf476Ei+K+jVuuebtLpfvwkvYT6iTUE7oZYehhkor4Zz2g7SJ/iZaPudQ==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.1" + } + }, + "@webassemblyjs/utf8": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.7.8.tgz", + "integrity": "sha512-9X+f0VV+xNXW2ujfIRSXBJENGE6Qh7bNVKqu3yDjTFB3ar3nsThsGBBKdTG58aXOm2iUH6v28VIf88ymPXODHA==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.7.8.tgz", + "integrity": "sha512-6D3Hm2gFixrfyx9XjSON4ml1FZTugqpkIz5Awvrou8fnpyprVzcm4X8pyGRtA2Piixjl3DqmX/HB1xdWyE097A==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-buffer": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/helper-wasm-section": "1.7.8", + "@webassemblyjs/wasm-gen": "1.7.8", + "@webassemblyjs/wasm-opt": "1.7.8", + "@webassemblyjs/wasm-parser": "1.7.8", + "@webassemblyjs/wast-printer": "1.7.8" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.7.8.tgz", + "integrity": "sha512-a7O/wE6eBeVKKUYgpMK7NOHmMADD85rSXLe3CqrWRDwWff5y3cSVbzpN6Qv3z6C4hdkpq9qyij1Ga1kemOZGvQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/ieee754": "1.7.8", + "@webassemblyjs/leb128": "1.7.8", + "@webassemblyjs/utf8": "1.7.8" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.7.8.tgz", + "integrity": "sha512-3lbQ0PT81NHCdi1sR/7+SNpZadM4qYcTSr62nFFAA7e5lFwJr14M1Gi+A/Y3PgcDWOHYjsaNGPpPU0H03N6Blg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-buffer": "1.7.8", + "@webassemblyjs/wasm-gen": "1.7.8", + "@webassemblyjs/wasm-parser": "1.7.8" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.7.8.tgz", + "integrity": "sha512-rZ/zlhp9DHR/05zh1MbAjT2t624sjrPP/OkJCjXqzm7ynH+nIdNcn9Ixc+qzPMFXhIrk0rBoQ3to6sEIvHh9jQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-api-error": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/ieee754": "1.7.8", + "@webassemblyjs/leb128": "1.7.8", + "@webassemblyjs/utf8": "1.7.8" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.7.8.tgz", + "integrity": "sha512-Q/zrvtUvzWuSiJMcSp90fi6gp2nraiHXjTV2VgAluVdVapM4gy1MQn7akja2p6eSBDQpKJPJ6P4TxRkghRS5dg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/floating-point-hex-parser": "1.7.8", + "@webassemblyjs/helper-api-error": "1.7.8", + "@webassemblyjs/helper-code-frame": "1.7.8", + "@webassemblyjs/helper-fsm": "1.7.8", + "@xtuc/long": "4.2.1" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.7.8.tgz", + "integrity": "sha512-GllIthRtwTxRDAURRNXscu7Napzmdf1jt1gpiZiK/QN4fH0lSGs3OTmvdfsMNP7tqI4B3ZtfaaWRlNIQug6Xyg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/wast-parser": "1.7.8", + "@xtuc/long": "4.2.1" + } + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.1.tgz", + "integrity": "sha512-FZdkNBDqBRHKQ2MEbSC17xnPFOhZxeJ2YGSfr2BKf3sujG49Qe3bB+rGCwQfIaA7WHnGeGkSijX4FuBCdrzW/g==", + "dev": true + }, + "JSONStream": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.3.tgz", + "integrity": "sha512-3Sp6WZZ/lXl+nTDoGpGWHEpTnnC6X5fnkolYZR6nwIfzbxxvA8utPWe1gCt7i0m9uVGsSz2IS8K8mJ7HmlduMg==", + "dev": true, + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, + "abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=" + }, + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "dev": true, + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "acorn": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", + "dev": true + }, + "acorn-dynamic-import": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", + "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", + "dev": true, + "requires": { + "acorn": "^5.0.0" + }, + "dependencies": { + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + } + } + }, + "acorn-node": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.3.0.tgz", + "integrity": "sha512-efP54n3d1aLfjL2UMdaXa6DsswwzJeI5rqhbFvXMrKiJ6eJFpf+7R0zN7t8IC+XKn2YOAFAv6xbBNgHUkoHWLw==", + "dev": true, + "requires": { + "acorn": "^5.4.1", + "xtend": "^4.0.1" + }, + "dependencies": { + "acorn": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", + "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", + "dev": true + } + } + }, + "add-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", + "integrity": "sha1-anmQQ3ynNtXhKI25K9MmbV9csqo=", + "dev": true + }, + "aes-js": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.1.tgz", + "integrity": "sha512-cEA0gBelItZZV7iBiL8ApCiNgc+gBWJJ4uoORhbu6vOqAJ0UL9wIlxr4RI7ij9SSVzy6AnPwiu37kVYiHCl3nw==", + "dev": true + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "ajv-errors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.0.tgz", + "integrity": "sha1-7PAh+hCP0X37Xms4Py3SM+Mf/Fk=", + "dev": true + }, + "ajv-keywords": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", + "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", + "dev": true + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=", + "dev": true + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-filter": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", + "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", + "dev": true + }, + "array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", + "dev": true + }, + "array-map": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", + "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", + "dev": true + }, + "array-reduce": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", + "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "dev": true, + "requires": { + "util": "0.10.3" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "astw": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/astw/-/astw-2.2.0.tgz", + "integrity": "sha1-e9QXhNMkk5h66yOba04cV6hzuRc=", + "dev": true, + "requires": { + "acorn": "^4.0.3" + } + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", + "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + } + }, + "babel-collect-imports": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/babel-collect-imports/-/babel-collect-imports-1.1.0.tgz", + "integrity": "sha1-E//Q92LX85+722f9dj0JEWOYe1A=", + "dev": true, + "requires": { + "babel-file-loader": "^1.0.3", + "babel-flow-types": "^1.2.3", + "resolve": "^1.5.0" + } + }, + "babel-core": { + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.8", + "slash": "^1.0.0", + "source-map": "^0.5.7" + }, + "dependencies": { + "convert-source-map": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", + "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", + "dev": true + } + } + }, + "babel-errors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/babel-errors/-/babel-errors-1.1.1.tgz", + "integrity": "sha1-Q/cULdOzZWM8dY0VW/+jukFSN5Q=", + "dev": true + }, + "babel-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/babel-file/-/babel-file-1.0.2.tgz", + "integrity": "sha1-ZDXAH8ecMzZXUZVxVqBWGWWinVY=", + "dev": true, + "requires": { + "babel-core": "^6.24.1", + "babel-errors": "^1.0.1" + } + }, + "babel-file-loader": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/babel-file-loader/-/babel-file-loader-1.0.3.tgz", + "integrity": "sha1-ud+HXhNtbN3J38s2M0zRrVj//n8=", + "dev": true, + "requires": { + "babel-errors": "^1.0.1", + "babel-file": "^1.0.2", + "babel-plugin-tester": "^3.0.0", + "babel-types": "^6.24.1", + "read-file-async": "^1.0.0", + "resolve": "^1.3.3", + "resolve-async": "^1.0.1" + } + }, + "babel-flow-types": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/babel-flow-types/-/babel-flow-types-1.2.3.tgz", + "integrity": "sha1-6clKwQY6iFf4sqZ8LhfrbMzVGeM=", + "dev": true + }, + "babel-generator": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", + "dev": true, + "requires": { + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" + }, + "dependencies": { + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + } + } + }, + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", + "dev": true, + "requires": { + "babel-helper-explode-assignable-expression": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-define-map": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } + }, + "babel-helper-evaluate-path": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-helper-evaluate-path/-/babel-helper-evaluate-path-0.5.0.tgz", + "integrity": "sha512-mUh0UhS607bGh5wUMAQfOpt2JX2ThXMtppHRdRU1kL7ZLRWIXxoV2UIV1r2cAeeNeU1M5SB5/RSUgUxrK8yOkA==", + "dev": true + }, + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-flip-expressions": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.4.3.tgz", + "integrity": "sha1-NpZzahKKwYvCUlS19AoizrPB0/0=", + "dev": true + }, + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "dev": true, + "requires": { + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-is-nodes-equiv": { + "version": "0.0.1", + "resolved": "http://registry.npmjs.org/babel-helper-is-nodes-equiv/-/babel-helper-is-nodes-equiv-0.0.1.tgz", + "integrity": "sha1-NOmzALFHnd2Y7HfqC76TQt/jloQ=", + "dev": true + }, + "babel-helper-is-void-0": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-is-void-0/-/babel-helper-is-void-0-0.4.3.tgz", + "integrity": "sha1-fZwBtFYee5Xb2g9u7kj1tg5nMT4=", + "dev": true + }, + "babel-helper-mark-eval-scopes": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.4.3.tgz", + "integrity": "sha1-0kSjvvmESHJgP/tG4izorN9VFWI=", + "dev": true + }, + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-regex": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } + }, + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-remove-or-void": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.4.3.tgz", + "integrity": "sha1-pPA7QAd6D/6I5F0HAQ3uJB/1rmA=", + "dev": true + }, + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "dev": true, + "requires": { + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-to-multiple-sequence-expressions": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.5.0.tgz", + "integrity": "sha512-m2CvfDW4+1qfDdsrtf4dwOslQC3yhbgyBFptncp4wvtdrDHqueW7slsYv4gArie056phvQFhT2nRcGS4bnm6mA==", + "dev": true + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-loader": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.4.tgz", + "integrity": "sha512-fhBhNkUToJcW9nV46v8w87AJOwAJDz84c1CL57n3Stj73FANM/b9TbCUK4YhdOwEyZ+OxhYpdeZDNzSI29Firw==", + "dev": true, + "requires": { + "find-cache-dir": "^1.0.0", + "loader-utils": "^1.0.2", + "mkdirp": "^0.5.1", + "util.promisify": "^1.0.0" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-minify-webpack-plugin": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/babel-minify-webpack-plugin/-/babel-minify-webpack-plugin-0.3.1.tgz", + "integrity": "sha512-Johg6Ju0Gxevk2R55eutMqnyXwlyUzCtwunBpiyNzoxGnKum+x5nfNuYZYHGd5Bmc1gmhjwzb7GkxHWOtYWmtQ==", + "dev": true, + "requires": { + "babel-core": "^6.26.0", + "babel-preset-minify": "^0.3.0", + "webpack-sources": "^1.0.1" + }, + "dependencies": { + "babel-helper-evaluate-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-helper-evaluate-path/-/babel-helper-evaluate-path-0.3.0.tgz", + "integrity": "sha512-dRFlMTqUJRGzx5a2smKxmptDdNCXKSkPcXWzKLwAV72hvIZumrd/0z9RcewHkr7PmAEq+ETtpD1GK6wZ6ZUXzw==", + "dev": true + }, + "babel-helper-flip-expressions": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.3.0.tgz", + "integrity": "sha512-kNGohWmtAG3b7tN1xocRQ5rsKkH/hpvZsMiGOJ1VwGJKhnwzR5KlB3rvKBaBPl5/IGHcopB2JN+r1SUEX1iMAw==", + "dev": true + }, + "babel-helper-is-void-0": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-helper-is-void-0/-/babel-helper-is-void-0-0.3.0.tgz", + "integrity": "sha512-JVqdX8y7Rf/x4NwbqtUI7mdQjL9HWoDnoAEQ8Gv8oxzjvbJv+n75f7l36m9Y8C7sCUltX3V5edndrp7Hp1oSXQ==", + "dev": true + }, + "babel-helper-mark-eval-scopes": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.3.0.tgz", + "integrity": "sha512-nrho5Dg4vl0VUgURVpGpEGiwbst5JX7efIyDHFxmkCx/ocQFnrPt8ze9Kxl6TKjR29bJ7D/XKY1NMlSxOQJRbQ==", + "dev": true + }, + "babel-helper-remove-or-void": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.3.0.tgz", + "integrity": "sha512-D68W1M3ibCcbg0ysh3ww4/O0g10X1CXK720oOuR8kpfY7w0yP4tVcpK7zDmI1JecynycTQYAZ1rhLJo9aVtIKQ==", + "dev": true + }, + "babel-helper-to-multiple-sequence-expressions": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.3.0.tgz", + "integrity": "sha512-1uCrBD+EAaMnAYh7hc944n8Ga19y3daEnoXWPYDvFVsxMCc1l8aDjksApaCEaNSSuewq8BEcff47Cy1PbLg2Gw==", + "dev": true + }, + "babel-plugin-minify-builtins": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.3.0.tgz", + "integrity": "sha512-MqhSHlxkmgURqj3144qPksbZ/qof1JWdumcbucc4tysFcf3P3V3z3munTevQgKEFNMd8F5/ECGnwb63xogLjAg==", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.3.0" + } + }, + "babel-plugin-minify-constant-folding": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-constant-folding/-/babel-plugin-minify-constant-folding-0.3.0.tgz", + "integrity": "sha512-1XeRpx+aY1BuNY6QU/cm6P+FtEi3ar3XceYbmC+4q4W+2Ewq5pL7V68oHg1hKXkBIE0Z4/FjSoHz6vosZLOe/A==", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.3.0" + } + }, + "babel-plugin-minify-dead-code-elimination": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.3.0.tgz", + "integrity": "sha512-SjM2Fzg85YZz+q/PNJ/HU4O3W98FKFOiP9K5z3sfonlamGOzvZw3Eup2OTiEBsbbqTeY8yzNCAv3qpJRYCgGmw==", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.3.0", + "babel-helper-mark-eval-scopes": "^0.3.0", + "babel-helper-remove-or-void": "^0.3.0", + "lodash.some": "^4.6.0" + } + }, + "babel-plugin-minify-flip-comparisons": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-flip-comparisons/-/babel-plugin-minify-flip-comparisons-0.3.0.tgz", + "integrity": "sha512-B8lK+ekcpSNVH7PZpWDe5nC5zxjRiiT4nTsa6h3QkF3Kk6y9qooIFLemdGlqBq6j0zALEnebvCpw8v7gAdpgnw==", + "dev": true, + "requires": { + "babel-helper-is-void-0": "^0.3.0" + } + }, + "babel-plugin-minify-guarded-expressions": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-guarded-expressions/-/babel-plugin-minify-guarded-expressions-0.3.0.tgz", + "integrity": "sha512-O+6CvF5/Ttsth3LMg4/BhyvVZ82GImeKMXGdVRQGK/8jFiP15EjRpdgFlxv3cnqRjqdYxLCS6r28VfLpb9C/kA==", + "dev": true, + "requires": { + "babel-helper-flip-expressions": "^0.3.0" + } + }, + "babel-plugin-minify-infinity": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.3.0.tgz", + "integrity": "sha512-Sj8ia3/w9158DWieUxU6/VvnYVy59geeFEkVgLZYBE8EBP+sN48tHtBM/jSgz0ejEdBlcfqJ6TnvPmVXTzR2BQ==", + "dev": true + }, + "babel-plugin-minify-mangle-names": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-mangle-names/-/babel-plugin-minify-mangle-names-0.3.0.tgz", + "integrity": "sha512-PYTonhFWURsfAN8achDwvR5Xgy6EeTClLz+fSgGRqjAIXb0OyFm3/xfccbQviVi1qDXmlSnt6oJhBg8KE4Fn7Q==", + "dev": true, + "requires": { + "babel-helper-mark-eval-scopes": "^0.3.0" + } + }, + "babel-plugin-minify-numeric-literals": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.3.0.tgz", + "integrity": "sha512-TgZj6ay8zDw74AS3yiIfoQ8vRSNJisYO/Du60S8nPV7EW7JM6fDMx5Sar6yVHlVuuwNgvDUBh191K33bVrAhpg==", + "dev": true + }, + "babel-plugin-minify-replace": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-replace/-/babel-plugin-minify-replace-0.3.0.tgz", + "integrity": "sha512-VR6tTg2Lt0TicHIOw04fsUtpPw7RaRP8PC8YzSFwEixnzvguZjZJoL7TgG7ZyEWQD1cJ96UezswECmFNa815bg==", + "dev": true + }, + "babel-plugin-minify-simplify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-simplify/-/babel-plugin-minify-simplify-0.3.0.tgz", + "integrity": "sha512-2M16ytQOCqBi7bYMu4DCWn8e6KyFCA108F6+tVrBJxOmm5u2sOmTFEa8s94tR9RHRRNYmcUf+rgidfnzL3ik9Q==", + "dev": true, + "requires": { + "babel-helper-flip-expressions": "^0.3.0", + "babel-helper-is-nodes-equiv": "^0.0.1", + "babel-helper-to-multiple-sequence-expressions": "^0.3.0" + } + }, + "babel-plugin-minify-type-constructors": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-type-constructors/-/babel-plugin-minify-type-constructors-0.3.0.tgz", + "integrity": "sha512-XRXpvsUCPeVw9YEUw+9vSiugcSZfow81oIJT0yR9s8H4W7yJ6FHbImi5DJHoL8KcDUjYnL9wYASXk/fOkbyR6Q==", + "dev": true, + "requires": { + "babel-helper-is-void-0": "^0.3.0" + } + }, + "babel-plugin-transform-inline-consecutive-adds": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.3.0.tgz", + "integrity": "sha512-iZsYAIjYLLfLK0yN5WVT7Xf7Y3wQ9Z75j9A8q/0IglQSpUt2ppTdHlwl/GeaXnxdaSmsxBu861klbTBbv2n+RA==", + "dev": true + }, + "babel-plugin-transform-regexp-constructors": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.3.0.tgz", + "integrity": "sha512-h92YHzyl042rb0naKO8frTHntpRFwRgKkfWD8602kFHoQingjJNtbvZzvxqHncJ6XmKVyYvfrBpDOSkCTDIIxw==", + "dev": true + }, + "babel-plugin-transform-remove-undefined": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.3.0.tgz", + "integrity": "sha512-TYGQucc8iP3LJwN3kDZLEz5aa/2KuFrqpT+s8f8NnHsBU1sAgR3y8Opns0xhC+smyDYWscqFCKM1gbkWQOhhnw==", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.3.0" + } + }, + "babel-preset-minify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-preset-minify/-/babel-preset-minify-0.3.0.tgz", + "integrity": "sha512-+VV2GWEyak3eDOmzT1DDMuqHrw3VbE9nBNkx2LLVs4pH/Me32ND8DRpVDd8IRvk1xX5p75nygyRPtkMh6GIAbQ==", + "dev": true, + "requires": { + "babel-plugin-minify-builtins": "^0.3.0", + "babel-plugin-minify-constant-folding": "^0.3.0", + "babel-plugin-minify-dead-code-elimination": "^0.3.0", + "babel-plugin-minify-flip-comparisons": "^0.3.0", + "babel-plugin-minify-guarded-expressions": "^0.3.0", + "babel-plugin-minify-infinity": "^0.3.0", + "babel-plugin-minify-mangle-names": "^0.3.0", + "babel-plugin-minify-numeric-literals": "^0.3.0", + "babel-plugin-minify-replace": "^0.3.0", + "babel-plugin-minify-simplify": "^0.3.0", + "babel-plugin-minify-type-constructors": "^0.3.0", + "babel-plugin-transform-inline-consecutive-adds": "^0.3.0", + "babel-plugin-transform-member-expression-literals": "^6.9.0", + "babel-plugin-transform-merge-sibling-variables": "^6.9.0", + "babel-plugin-transform-minify-booleans": "^6.9.0", + "babel-plugin-transform-property-literals": "^6.9.0", + "babel-plugin-transform-regexp-constructors": "^0.3.0", + "babel-plugin-transform-remove-console": "^6.9.0", + "babel-plugin-transform-remove-debugger": "^6.9.0", + "babel-plugin-transform-remove-undefined": "^0.3.0", + "babel-plugin-transform-simplify-comparison-operators": "^6.9.0", + "babel-plugin-transform-undefined-to-void": "^6.9.0", + "lodash.isplainobject": "^4.0.6" + } + } + } + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-minify-builtins": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.5.0.tgz", + "integrity": "sha512-wpqbN7Ov5hsNwGdzuzvFcjgRlzbIeVv1gMIlICbPj0xkexnfoIDe7q+AZHMkQmAE/F9R5jkrB6TLfTegImlXag==", + "dev": true + }, + "babel-plugin-minify-constant-folding": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-constant-folding/-/babel-plugin-minify-constant-folding-0.5.0.tgz", + "integrity": "sha512-Vj97CTn/lE9hR1D+jKUeHfNy+m1baNiJ1wJvoGyOBUx7F7kJqDZxr9nCHjO/Ad+irbR3HzR6jABpSSA29QsrXQ==", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.5.0" + } + }, + "babel-plugin-minify-dead-code-elimination": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.0.tgz", + "integrity": "sha512-XQteBGXlgEoAKc/BhO6oafUdT4LBa7ARi55mxoyhLHNuA+RlzRmeMAfc31pb/UqU01wBzRc36YqHQzopnkd/6Q==", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.5.0", + "babel-helper-mark-eval-scopes": "^0.4.3", + "babel-helper-remove-or-void": "^0.4.3", + "lodash.some": "^4.6.0" + } + }, + "babel-plugin-minify-flip-comparisons": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-flip-comparisons/-/babel-plugin-minify-flip-comparisons-0.4.3.tgz", + "integrity": "sha1-AMqHDLjxO0XAOLPB68DyJyk8llo=", + "dev": true, + "requires": { + "babel-helper-is-void-0": "^0.4.3" + } + }, + "babel-plugin-minify-guarded-expressions": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-guarded-expressions/-/babel-plugin-minify-guarded-expressions-0.4.3.tgz", + "integrity": "sha1-zHCbRFP9IbHzAod0RMifiEJ845c=", + "dev": true, + "requires": { + "babel-helper-flip-expressions": "^0.4.3" + } + }, + "babel-plugin-minify-infinity": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.4.3.tgz", + "integrity": "sha1-37h2obCKBldjhO8/kuZTumB7Oco=", + "dev": true + }, + "babel-plugin-minify-mangle-names": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-mangle-names/-/babel-plugin-minify-mangle-names-0.5.0.tgz", + "integrity": "sha512-3jdNv6hCAw6fsX1p2wBGPfWuK69sfOjfd3zjUXkbq8McbohWy23tpXfy5RnToYWggvqzuMOwlId1PhyHOfgnGw==", + "dev": true, + "requires": { + "babel-helper-mark-eval-scopes": "^0.4.3" + } + }, + "babel-plugin-minify-numeric-literals": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.4.3.tgz", + "integrity": "sha1-jk/VYcefeAEob/YOjF/Z3u6TwLw=", + "dev": true + }, + "babel-plugin-minify-replace": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-replace/-/babel-plugin-minify-replace-0.5.0.tgz", + "integrity": "sha512-aXZiaqWDNUbyNNNpWs/8NyST+oU7QTpK7J9zFEFSA0eOmtUNMU3fczlTTTlnCxHmq/jYNFEmkkSG3DDBtW3Y4Q==", + "dev": true + }, + "babel-plugin-minify-simplify": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-simplify/-/babel-plugin-minify-simplify-0.5.0.tgz", + "integrity": "sha512-TM01J/YcKZ8XIQd1Z3nF2AdWHoDsarjtZ5fWPDksYZNsoOjQ2UO2EWm824Ym6sp127m44gPlLFiO5KFxU8pA5Q==", + "dev": true, + "requires": { + "babel-helper-flip-expressions": "^0.4.3", + "babel-helper-is-nodes-equiv": "^0.0.1", + "babel-helper-to-multiple-sequence-expressions": "^0.5.0" + } + }, + "babel-plugin-minify-type-constructors": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-type-constructors/-/babel-plugin-minify-type-constructors-0.4.3.tgz", + "integrity": "sha1-G8bxW4f3qxCF1CszC3F2V6IVZQA=", + "dev": true, + "requires": { + "babel-helper-is-void-0": "^0.4.3" + } + }, + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", + "dev": true + }, + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", + "dev": true + }, + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", + "dev": true + }, + "babel-plugin-tester": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-tester/-/babel-plugin-tester-3.3.0.tgz", + "integrity": "sha1-mET3emYbSLXH4IvVSsylkNvO5bQ=", + "dev": true, + "requires": { + "babel-core": "^6.25.0", + "common-tags": "^1.4.0", + "invariant": "^2.2.2", + "lodash.merge": "^4.6.0", + "path-exists": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "dev": true, + "requires": { + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-functions": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", + "dev": true, + "requires": { + "babel-helper-define-map": "^6.24.1", + "babel-helper-function-name": "^6.24.1", + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-helper-replace-supers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } }, "babel-plugin-transform-es2015-computed-properties": { "version": "6.24.1", @@ -1035,6 +3089,39 @@ "babel-runtime": "^6.22.0" } }, + "babel-plugin-transform-inline-consecutive-adds": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.4.3.tgz", + "integrity": "sha1-Mj1Ho+pjqDp6w8gRro5pQfrysNE=", + "dev": true + }, + "babel-plugin-transform-member-expression-literals": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.9.4.tgz", + "integrity": "sha1-NwOcmgwzE6OUlfqsL/OmtbnQOL8=", + "dev": true + }, + "babel-plugin-transform-merge-sibling-variables": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.9.4.tgz", + "integrity": "sha1-hbQi/DN3tEnJ0c3kQIcgNTJAHa4=", + "dev": true + }, + "babel-plugin-transform-minify-booleans": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.9.4.tgz", + "integrity": "sha1-rLs+VqNVXdI5KOS1gtKFFi3SsZg=", + "dev": true + }, + "babel-plugin-transform-property-literals": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.9.4.tgz", + "integrity": "sha1-mMHSHiVXNlc/k+zlRFn2ziSYXTk=", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "babel-plugin-transform-regenerator": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", @@ -1044,6 +3131,39 @@ "regenerator-transform": "^0.10.0" } }, + "babel-plugin-transform-regexp-constructors": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.4.3.tgz", + "integrity": "sha1-WLd3W2OvzzMyj66aX4j71PsLSWU=", + "dev": true + }, + "babel-plugin-transform-remove-console": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz", + "integrity": "sha1-uYA2DAZzhOJLNXpYjYB9PINSd4A=", + "dev": true + }, + "babel-plugin-transform-remove-debugger": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.9.4.tgz", + "integrity": "sha1-QrcnYxyXl44estGZp67IShgznvI=", + "dev": true + }, + "babel-plugin-transform-remove-undefined": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.5.0.tgz", + "integrity": "sha512-+M7fJYFaEE/M9CXa0/IRkDbiV3wRELzA1kKQFCJ4ifhrzLKn/9VCCgj9OFmYWwBd8IB48YdgPkHYtbYq+4vtHQ==", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.5.0" + } + }, + "babel-plugin-transform-simplify-comparison-operators": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.9.4.tgz", + "integrity": "sha1-9ir+CWyrDh9ootdT/fKDiIRxzrk=", + "dev": true + }, "babel-plugin-transform-strict-mode": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", @@ -1054,6 +3174,12 @@ "babel-types": "^6.24.1" } }, + "babel-plugin-transform-undefined-to-void": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.9.4.tgz", + "integrity": "sha1-viQcqBQEAwZ4t0hxcyK4nQyP4oA=", + "dev": true + }, "babel-preset-env": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz", @@ -1092,6 +3218,37 @@ "semver": "^5.3.0" } }, + "babel-preset-minify": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/babel-preset-minify/-/babel-preset-minify-0.5.0.tgz", + "integrity": "sha512-xj1s9Mon+RFubH569vrGCayA9Fm2GMsCgDRm1Jb8SgctOB7KFcrVc2o8K3YHUyMz+SWP8aea75BoS8YfsXXuiA==", + "dev": true, + "requires": { + "babel-plugin-minify-builtins": "^0.5.0", + "babel-plugin-minify-constant-folding": "^0.5.0", + "babel-plugin-minify-dead-code-elimination": "^0.5.0", + "babel-plugin-minify-flip-comparisons": "^0.4.3", + "babel-plugin-minify-guarded-expressions": "^0.4.3", + "babel-plugin-minify-infinity": "^0.4.3", + "babel-plugin-minify-mangle-names": "^0.5.0", + "babel-plugin-minify-numeric-literals": "^0.4.3", + "babel-plugin-minify-replace": "^0.5.0", + "babel-plugin-minify-simplify": "^0.5.0", + "babel-plugin-minify-type-constructors": "^0.4.3", + "babel-plugin-transform-inline-consecutive-adds": "^0.4.3", + "babel-plugin-transform-member-expression-literals": "^6.9.4", + "babel-plugin-transform-merge-sibling-variables": "^6.9.4", + "babel-plugin-transform-minify-booleans": "^6.9.4", + "babel-plugin-transform-property-literals": "^6.9.4", + "babel-plugin-transform-regexp-constructors": "^0.4.3", + "babel-plugin-transform-remove-console": "^6.9.4", + "babel-plugin-transform-remove-debugger": "^6.9.4", + "babel-plugin-transform-remove-undefined": "^0.5.0", + "babel-plugin-transform-simplify-comparison-operators": "^6.9.4", + "babel-plugin-transform-undefined-to-void": "^6.9.4", + "lodash.isplainobject": "^4.0.6" + } + }, "babel-register": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", @@ -1165,23 +3322,6 @@ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, - "bach": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", - "integrity": "sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA=", - "dev": true, - "requires": { - "arr-filter": "^1.1.1", - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "array-each": "^1.0.0", - "array-initial": "^1.0.0", - "array-last": "^1.1.1", - "async-done": "^1.2.2", - "async-settle": "^1.0.0", - "now-and-later": "^2.0.0" - } - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -1268,6 +3408,32 @@ "tweetnacl": "^0.14.3" } }, + "bfj": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/bfj/-/bfj-6.1.1.tgz", + "integrity": "sha512-+GUNvzHR4nRyGybQc2WpNJL4MJazMuvf92ueIyA0bIkPRwhhQu3IfZQ2PSoVPpCBJfmoSdOxu5rnotfFLlvYRQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.1", + "check-types": "^7.3.0", + "hoopy": "^0.1.2", + "tryer": "^1.0.0" + }, + "dependencies": { + "bluebird": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.2.tgz", + "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg==", + "dev": true + } + } + }, + "big.js": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", + "dev": true + }, "bignumber.js": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.1.0.tgz", @@ -1280,12 +3446,6 @@ "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", "dev": true }, - "binaryextensions": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-1.0.1.tgz", - "integrity": "sha1-HmN0iLNbWL2l9HdL+WpSEqjJB1U=", - "dev": true - }, "bindings": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", @@ -1313,11 +3473,23 @@ "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", "dev": true }, - "bower": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/bower/-/bower-1.8.4.tgz", - "integrity": "sha1-54dqB23rgTf30GUl3F6MZtuC8oo=", - "dev": true + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "dev": true, + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } }, "brace-expansion": { "version": "1.1.11", @@ -1395,12 +3567,6 @@ } } }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, "browserify": { "version": "14.5.0", "resolved": "https://registry.npmjs.org/browserify/-/browserify-14.5.0.tgz", @@ -1566,18 +3732,18 @@ "ieee754": "^1.1.4" } }, - "buffer-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", - "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=", - "dev": true - }, "buffer-from": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", "dev": true }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=", + "dev": true + }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", @@ -1602,6 +3768,48 @@ "integrity": "sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE=", "dev": true }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, + "cacache": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-11.2.0.tgz", + "integrity": "sha512-IFWl6lfK6wSeYCHUXh+N1lY72UDrpyrYQJNIVQf48paDuWbv5RbAtJYf/4gUQFObTCHZwdZ5sI8Iw7nqwP6nlQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.1", + "chownr": "^1.0.1", + "figgy-pudding": "^3.1.0", + "glob": "^7.1.2", + "graceful-fs": "^4.1.11", + "lru-cache": "^4.1.3", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.2", + "ssri": "^6.0.0", + "unique-filename": "^1.1.0", + "y18n": "^4.0.0" + }, + "dependencies": { + "bluebird": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.2.tgz", + "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg==", + "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + } + } + }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -1719,6 +3927,12 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, + "check-types": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/check-types/-/check-types-7.4.0.tgz", + "integrity": "sha512-YbulWHdfP99UfZ73NcUDlNJhEIDgm9Doq9GhpyXbF+7Aegi3CVV7qqMCKTTqJxlvEvnQBp9IA+dxsGN6xK/nSg==", + "dev": true + }, "chokidar": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", @@ -1751,6 +3965,21 @@ } } }, + "chownr": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", + "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", + "dev": true + }, + "chrome-trace-event": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.0.tgz", + "integrity": "sha512-xDbVgyfDTT2piup/h8dK/y4QZfJRSa73bw1WZ8b4XM1o7fsFubUVGYcE+1ANtOzJJELGpYoG2961z0Z6OAld9A==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, "ci-info": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.3.tgz", @@ -1848,6 +4077,12 @@ "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", "dev": true }, + "clone-stats": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + }, "cloneable-readable": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz", @@ -1867,14 +4102,6 @@ "requires": { "graceful-fs": "^4.1.2", "mkdirp": "~0.5.0" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - } } }, "co": { @@ -1886,8 +4113,7 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "coinstring": { "version": "2.3.0", @@ -1907,17 +4133,6 @@ } } }, - "collection-map": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-map/-/collection-map-1.0.0.tgz", - "integrity": "sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw=", - "dev": true, - "requires": { - "arr-map": "^2.0.2", - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -1943,12 +4158,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true - }, "colors": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", @@ -1999,6 +4208,18 @@ "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, + "common-tags": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz", + "integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, "compare-func": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.2.tgz", @@ -2081,6 +4302,18 @@ "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", "dev": true }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=", + "dev": true + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true + }, "conventional-changelog": { "version": "1.1.24", "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-1.1.24.tgz", @@ -2162,18 +4395,6 @@ "through2": "^2.0.0" }, "dependencies": { - "dateformat": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -2223,15 +4444,6 @@ "normalize-package-data": "^2.3.2", "path-type": "^1.0.0" } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } } } }, @@ -2312,14 +4524,6 @@ "semver": "^5.5.0", "split": "^1.0.0", "through2": "^2.0.0" - }, - "dependencies": { - "dateformat": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", - "dev": true - } } }, "conventional-commits-filter": { @@ -2444,27 +4648,42 @@ "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", "dev": true }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", "dev": true }, - "copy-props": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.4.tgz", - "integrity": "sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==", + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", + "dev": true + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", "dev": true, "requires": { - "each-props": "^1.3.0", - "is-plain-object": "^2.0.1" + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" } }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, "core-js": { "version": "2.5.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", - "dev": true + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" }, "core-util-is": { "version": "1.0.2", @@ -2559,18 +4778,6 @@ "lru-cache": "^4.0.1", "shebang-command": "^1.2.0", "which": "^1.2.9" - }, - "dependencies": { - "lru-cache": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", - "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - } } }, "crypto-browserify": { @@ -2614,14 +4821,11 @@ "dev": true, "optional": true }, - "d": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", - "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", - "dev": true, - "requires": { - "es5-ext": "^0.10.9" - } + "cyclist": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", + "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", + "dev": true }, "dargs": { "version": "4.1.0", @@ -2647,6 +4851,12 @@ "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", "dev": true }, + "dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -2686,6 +4896,15 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, "dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -2713,29 +4932,6 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, - "default-compare": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz", - "integrity": "sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ==", - "dev": true, - "requires": { - "kind-of": "^5.0.2" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "default-resolution": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz", - "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", - "dev": true - }, "defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", @@ -2828,6 +5024,12 @@ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, "deps-sort": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz", @@ -2850,10 +5052,10 @@ "minimalistic-assert": "^1.0.0" } }, - "detect-file": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", - "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", "dev": true }, "detect-indent": { @@ -2865,6 +5067,13 @@ "repeating": "^2.0.0" } }, + "detect-libc": { + "version": "1.0.3", + "resolved": false, + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", + "dev": true, + "optional": true + }, "detective": { "version": "4.7.1", "resolved": "https://registry.npmjs.org/detective/-/detective-4.7.1.tgz", @@ -2883,12 +5092,6 @@ } } }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -2924,6 +5127,12 @@ } } }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=", + "dev": true + }, "domain-browser": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz", @@ -3008,14 +5217,53 @@ "stream-shift": "^1.0.0" } }, - "each-props": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz", - "integrity": "sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA==", + "duplicate-package-checker-webpack-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/duplicate-package-checker-webpack-plugin/-/duplicate-package-checker-webpack-plugin-3.0.0.tgz", + "integrity": "sha512-aO50/qPC7X2ChjRFniRiscxBLT/K01bALqfcDaf8Ih5OqQ1N4iT/Abx9Ofu3/ms446vHTm46FACIuJUmgUQcDQ==", "dev": true, "requires": { - "is-plain-object": "^2.0.1", - "object.defaults": "^1.1.0" + "chalk": "^2.3.0", + "find-root": "^1.0.0", + "lodash": "^4.17.4", + "semver": "^5.4.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "ecc-jsbn": { @@ -3028,6 +5276,18 @@ "jsbn": "~0.1.0" } }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "ejs": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.1.tgz", + "integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==", + "dev": true + }, "electron-to-chromium": { "version": "1.3.48", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz", @@ -3049,6 +5309,18 @@ "minimalistic-crypto-utils": "^1.0.0" } }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true + }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -3058,12 +5330,32 @@ "once": "^1.4.0" } }, + "enhanced-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", + "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.4.0", + "tapable": "^1.0.0" + } + }, "entities": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", "dev": true }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "~1.0.1" + } + }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", @@ -3073,26 +5365,28 @@ "is-arrayish": "^0.2.1" } }, - "es5-ext": { - "version": "0.10.45", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.45.tgz", - "integrity": "sha512-FkfM6Vxxfmztilbxxz5UKSD4ICMf5tSpRFtDNtkAhOxZ0EKtX6qwmXNyH/sFyIbX2P/nU5AMiA9jilWsUGJzCQ==", + "es-abstract": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", + "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", "dev": true, "requires": { - "es6-iterator": "~2.0.3", - "es6-symbol": "~3.1.1", - "next-tick": "1" + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" } }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", "dev": true, "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" } }, "es6-promise": { @@ -3102,27 +5396,11 @@ "dev": true, "optional": true }, - "es6-symbol": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", - "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.14" - } - }, - "es6-weak-map": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", - "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "^0.10.14", - "es6-iterator": "^2.0.1", - "es6-symbol": "^3.1.1" - } + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true }, "escape-string-regexp": { "version": "1.0.5", @@ -3155,12 +5433,47 @@ } } }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + }, + "dependencies": { + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + } + } + }, "esprima": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", "dev": true }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + }, + "dependencies": { + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + } + } + }, "estraverse": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", @@ -3173,6 +5486,23 @@ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true + }, + "eth-lib": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "dev": true, + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, "ethereumjs-util": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", @@ -3346,13 +5676,50 @@ } } }, - "expand-tilde": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", - "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", "dev": true, "requires": { - "homedir-polyfill": "^1.0.1" + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", + "dev": true + } } }, "extend": { @@ -3499,17 +5866,6 @@ "dev": true, "optional": true }, - "fancy-log": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.2.tgz", - "integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=", - "dev": true, - "requires": { - "ansi-gray": "^0.1.1", - "color-support": "^1.1.3", - "time-stamp": "^1.0.0" - } - }, "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", @@ -3538,6 +5894,12 @@ "pend": "~1.2.0" } }, + "figgy-pudding": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", + "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==", + "dev": true + }, "figures": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", @@ -3547,6 +5909,12 @@ "escape-string-regexp": "^1.0.5" } }, + "filesize": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz", + "integrity": "sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==", + "dev": true + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -3570,46 +5938,47 @@ } } }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", "dev": true, "requires": { - "locate-path": "^2.0.0" + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" } }, - "findup-sync": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", - "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", + "find-cache-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", + "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", "dev": true, "requires": { - "detect-file": "^1.0.0", - "is-glob": "^3.1.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" + "commondir": "^1.0.1", + "make-dir": "^1.0.0", + "pkg-dir": "^2.0.0" } }, - "fined": { + "find-root": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fined/-/fined-1.1.0.tgz", - "integrity": "sha1-s33IRLdqL15wgeiE98CuNE8VNHY=", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", + "dev": true + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^2.0.3", - "object.defaults": "^1.1.0", - "object.pick": "^1.2.0", - "parse-filepath": "^1.0.1" + "locate-path": "^2.0.0" } }, - "flagged-respawn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.0.tgz", - "integrity": "sha1-Tnmumy6zi/hrO7Vr8+ClaqX8q9c=", - "dev": true - }, "flush-write-stream": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", @@ -3620,21 +5989,21 @@ "readable-stream": "^2.0.4" } }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true }, - "for-own": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", - "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - }, "foreach": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", @@ -3658,6 +6027,12 @@ "mime-types": "^2.1.12" } }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", + "dev": true + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -3667,6 +6042,22 @@ "map-cache": "^0.2.2" } }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true + }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, "fs-extra": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", @@ -3676,24 +6067,34 @@ "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - } } }, - "fs-mkdirp-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz", - "integrity": "sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=", + "fs-minipass": { + "version": "1.2.5", + "resolved": false, + "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "dev": true, + "optional": true, "requires": { - "graceful-fs": "^4.1.11", - "through2": "^2.0.3" + "minipass": "^2.2.1" + } + }, + "fs-readdir-recursive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", + "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", + "dev": true + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" } }, "fs.realpath": { @@ -3701,523 +6102,66 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true - }, - "fsevents": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", - "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", - "dev": true, - "optional": true, - "requires": { - "nan": "^2.9.2", - "node-pre-gyp": "^0.10.0" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "resolved": false, - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": false, - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "aproba": { - "version": "1.2.0", - "resolved": false, - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.4", - "resolved": false, - "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", - "dev": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": false, - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": false, - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.0.1", - "resolved": false, - "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "resolved": false, - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": false, - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "resolved": false, - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": false, - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true, - "optional": true - }, - "debug": { - "version": "2.6.9", - "resolved": false, - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - }, + }, + "fsevents": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" + }, + "dependencies": { "deep-extend": { "version": "0.5.1", "resolved": false, - "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "resolved": false, - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "resolved": false, - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.5", - "resolved": false, - "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": false, - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "resolved": false, - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.2", - "resolved": false, - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "optional": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "resolved": false, - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.21", - "resolved": false, - "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", - "dev": true, - "optional": true, - "requires": { - "safer-buffer": "^2.1.0" - } - }, - "ignore-walk": { - "version": "3.0.1", - "resolved": false, - "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", - "dev": true, - "optional": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": false, - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "optional": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": false, - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "ini": { - "version": "1.3.5", - "resolved": false, - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true, - "optional": true + "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==" }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, "requires": { "number-is-nan": "^1.0.0" } }, - "isarray": { - "version": "1.0.0", - "resolved": false, - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": false, - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, "minimist": { "version": "0.0.8", "resolved": false, - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "minipass": { - "version": "2.2.4", - "resolved": false, - "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.1", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.1.0", - "resolved": false, - "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": false, - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "resolved": false, - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true, - "optional": true - }, - "needle": { - "version": "2.2.0", - "resolved": false, - "integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==", - "dev": true, - "optional": true, - "requires": { - "debug": "^2.1.2", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.10.0", - "resolved": false, - "integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==", - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.0", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.1.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "nopt": { "version": "4.0.1", "resolved": false, "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.0.3", - "resolved": false, - "integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==", - "dev": true, - "optional": true - }, - "npm-packlist": { - "version": "1.1.10", - "resolved": false, - "integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==", - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "resolved": false, - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": false, - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": false, - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "resolved": false, - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "resolved": false, - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": false, - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "resolved": false, - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "dev": true, - "optional": true, "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" + "abbrev": "1" } }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": false, - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": false, - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true, - "optional": true - }, "rc": { "version": "1.2.7", "resolved": false, "integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==", - "dev": true, - "optional": true, - "requires": { - "deep-extend": "^0.5.1", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": false, - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": false, - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.6.2", - "resolved": false, - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "optional": true, "requires": { - "glob": "^7.0.5" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": false, - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": false, - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "resolved": false, - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true, - "optional": true - }, - "semver": { - "version": "5.5.0", - "resolved": false, - "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": false, - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": false, - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true, - "optional": true + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": false, + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } + } }, "string-width": { "version": "1.0.2", "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4228,72 +6172,27 @@ "version": "1.1.1", "resolved": false, "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "optional": true, "requires": { "safe-buffer": "~5.1.0" } }, - "strip-ansi": { - "version": "3.0.1", - "resolved": false, - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, "strip-json-comments": { "version": "2.0.1", "resolved": false, - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.1", - "resolved": false, - "integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==", - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.0.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", - "yallist": "^3.0.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": false, - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true, - "optional": true + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, "wide-align": { "version": "1.1.2", "resolved": false, "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", - "dev": true, - "optional": true, "requires": { "string-width": "^1.0.2" } }, - "wrappy": { - "version": "1.0.2", - "resolved": false, - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, "yallist": { "version": "3.0.2", "resolved": false, - "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", - "dev": true + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=" } } }, @@ -4486,27 +6385,6 @@ "meow": "^4.0.0", "split2": "^2.0.0", "through2": "^2.0.0" - }, - "dependencies": { - "lodash.template": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", - "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", - "dev": true, - "requires": { - "lodash._reinterpolate": "~3.0.0", - "lodash.templatesettings": "^4.0.0" - } - }, - "lodash.templatesettings": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", - "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", - "dev": true, - "requires": { - "lodash._reinterpolate": "~3.0.0" - } - } } }, "git-remote-origin-url": { @@ -4570,388 +6448,96 @@ "path-dirname": "^1.0.0" } }, - "glob-stream": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", - "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", - "dev": true, - "requires": { - "extend": "^3.0.0", - "glob": "^7.1.1", - "glob-parent": "^3.1.0", - "is-negated-glob": "^1.0.0", - "ordered-read-streams": "^1.0.0", - "pumpify": "^1.3.5", - "readable-stream": "^2.1.5", - "remove-trailing-separator": "^1.0.1", - "to-absolute-glob": "^2.0.0", - "unique-stream": "^2.0.2" - } - }, - "glob-watcher": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-5.0.1.tgz", - "integrity": "sha512-fK92r2COMC199WCyGUblrZKhjra3cyVMDiypDdqg1vsSDmexnbYivK1kNR4QItiNXLKmGlqan469ks67RtNa2g==", - "dev": true, - "requires": { - "async-done": "^1.2.0", - "chokidar": "^2.0.0", - "just-debounce": "^1.0.0", - "object.defaults": "^1.1.0" - } - }, - "global-modules": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", - "dev": true, - "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" - } - }, - "global-prefix": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", - "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - } - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, - "globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } - } - }, - "glogg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz", - "integrity": "sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw==", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } - }, - "got": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", - "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", - "dev": true, - "requires": { - "create-error-class": "^3.0.0", - "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "is-redirect": "^1.0.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "lowercase-keys": "^1.0.0", - "safe-buffer": "^5.0.1", - "timed-out": "^4.0.0", - "unzip-response": "^2.0.1", - "url-parse-lax": "^1.0.0" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "gulp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.0.tgz", - "integrity": "sha1-lXZsYB2t5Kd+0+eyttwDiBtZY2Y=", - "dev": true, - "requires": { - "glob-watcher": "^5.0.0", - "gulp-cli": "^2.0.0", - "undertaker": "^1.0.0", - "vinyl-fs": "^3.0.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "gulp-cli": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.0.1.tgz", - "integrity": "sha512-RxujJJdN8/O6IW2nPugl7YazhmrIEjmiVfPKrWt68r71UCaLKS71Hp0gpKT+F6qOUFtr7KqtifDKaAJPRVvMYQ==", - "dev": true, - "requires": { - "ansi-colors": "^1.0.1", - "archy": "^1.0.0", - "array-sort": "^1.0.0", - "color-support": "^1.1.3", - "concat-stream": "^1.6.0", - "copy-props": "^2.0.1", - "fancy-log": "^1.3.2", - "gulplog": "^1.0.0", - "interpret": "^1.1.0", - "isobject": "^3.0.1", - "liftoff": "^2.5.0", - "matchdep": "^2.0.0", - "mute-stdout": "^1.0.0", - "pretty-hrtime": "^1.0.0", - "replace-homedir": "^1.0.0", - "semver-greatest-satisfied-range": "^1.1.0", - "v8flags": "^3.0.1", - "yargs": "^7.1.0" - } - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", - "dev": true, - "requires": { - "lcid": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", - "dev": true - }, - "yargs": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", - "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", - "dev": true, - "requires": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^5.0.0" - } - }, - "yargs-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", - "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", - "dev": true, - "requires": { - "camelcase": "^3.0.0" - } - } - } - }, - "gulp-babel": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/gulp-babel/-/gulp-babel-6.1.3.tgz", - "integrity": "sha512-tm15R3rt4gO59WXCuqrwf4QXJM9VIJC+0J2NPYSC6xZn+cZRD5y5RPGAiHaDxCJq7Rz5BDljlrk3cEjWADF+wQ==", + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", "dev": true, "requires": { - "babel-core": "^6.23.1", - "object-assign": "^4.0.1", - "plugin-error": "^1.0.1", - "replace-ext": "0.0.1", - "through2": "^2.0.0", - "vinyl-sourcemaps-apply": "^0.2.0" - } - }, - "gulp-jshint": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/gulp-jshint/-/gulp-jshint-2.1.0.tgz", - "integrity": "sha512-sP3NK8Y/1e58O0PH9t6s7DAr/lKDSUbIY207oWSeufM6/VclB7jJrIBcPCsyhrFTCDUl9DauePbt6VqP2vPM5w==", - "dev": true, - "requires": { - "lodash": "^4.12.0", - "minimatch": "^3.0.3", - "plugin-error": "^0.1.2", - "rcloader": "^0.2.2", - "through2": "^2.0.0" - }, - "dependencies": { - "arr-diff": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz", - "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1", - "array-slice": "^0.2.3" - } - }, - "arr-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-2.1.0.tgz", - "integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=", - "dev": true - }, - "array-slice": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", - "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", - "dev": true - }, - "extend-shallow": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-1.1.4.tgz", - "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", - "dev": true, - "requires": { - "kind-of": "^1.1.0" - } - }, - "kind-of": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", - "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", - "dev": true - }, - "plugin-error": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz", - "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", - "dev": true, - "requires": { - "ansi-cyan": "^0.1.1", - "ansi-red": "^0.1.1", - "arr-diff": "^1.0.1", - "arr-union": "^2.0.1", - "extend-shallow": "^1.1.2" - } + "min-document": "^2.19.0", + "process": "~0.5.1" + }, + "dependencies": { + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=", + "dev": true } } }, - "gulp-rename": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.2.3.tgz", - "integrity": "sha512-CmdPM0BjJ105QCX1fk+j7NGhiN/1rCl9HLGss+KllBS/tdYadpjTxqdKyh/5fNV+M3yjT1MFz5z93bXdrTyzAw==", + "global-modules-path": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/global-modules-path/-/global-modules-path-2.3.0.tgz", + "integrity": "sha512-HchvMJNYh9dGSCy8pOQ2O8u/hoXaL+0XhnrwH0RyLiSXMMTl9W3N6KUU73+JFOg5PGjtzl6VZzUQsnrpm7Szag==", "dev": true }, - "gulp-replace": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-0.6.1.tgz", - "integrity": "sha1-Eb+Mj85TPjPi9qjy9DC5VboL4GY=", - "dev": true, - "requires": { - "istextorbinary": "1.0.2", - "readable-stream": "^2.0.1", - "replacestream": "^4.0.0" - } + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true }, - "gulp-streamify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/gulp-streamify/-/gulp-streamify-1.0.2.tgz", - "integrity": "sha1-ANazgU1IbAiPeHOO0HZqvBY4nk0=", + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { - "plexer": "1.0.1" + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } } }, - "gulp-uglify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gulp-uglify/-/gulp-uglify-3.0.0.tgz", - "integrity": "sha1-DfAzHXKg0wLj434QlIXd3zPG0co=", + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { - "gulplog": "^1.0.0", - "has-gulplog": "^0.1.0", - "lodash": "^4.13.1", - "make-error-cause": "^1.1.1", - "through2": "^2.0.0", - "uglify-js": "^3.0.5", - "vinyl-sourcemaps-apply": "^0.2.0" + "create-error-class": "^3.0.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-redirect": "^1.0.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "lowercase-keys": "^1.0.0", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "unzip-response": "^2.0.1", + "url-parse-lax": "^1.0.0" } }, - "gulplog": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", - "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "gzip-size": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.0.0.tgz", + "integrity": "sha512-5iI7omclyqrnWw4XbXAmGhPsABkSIDQonv2K0h61lybgofWa6iZyvrI3r2zsJH4P8Nb64fFVzlvfhs0g7BBxAA==", "dev": true, "requires": { - "glogg": "^1.0.0" + "duplexer": "^0.1.1", + "pify": "^3.0.0" } }, "handlebars": { @@ -5038,15 +6624,6 @@ "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", "dev": true }, - "has-gulplog": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", - "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } - }, "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", @@ -5133,12 +6710,6 @@ "secp256k1": "^3.0.1" } }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -5160,14 +6731,11 @@ "os-tmpdir": "^1.0.1" } }, - "homedir-polyfill": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", - "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", - "dev": true, - "requires": { - "parse-passwd": "^1.0.0" - } + "hoopy": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz", + "integrity": "sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ==", + "dev": true }, "hosted-git-info": { "version": "2.6.0", @@ -5220,6 +6788,18 @@ } } }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -5252,6 +6832,86 @@ "integrity": "sha512-VhDzCKN7K8ufStx/CLj5/PDTMgph+qwN5Pkd5i0sGnVwk56zJ0lkT8Qzi1xqWLS0Wp29DgDtNeS7v8/wMoZeHg==", "dev": true }, + "iferr": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, + "ignore-walk": { + "version": "3.0.1", + "resolved": false, + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "import-local": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", + "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "dev": true, + "requires": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + } + } + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -5289,8 +6949,7 @@ "ini": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" }, "inline-source-map": { "version": "0.6.2", @@ -5427,15 +7086,11 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, - "is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "dev": true, - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - } + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=", + "dev": true }, "is-accessor-descriptor": { "version": "0.1.6", @@ -5487,6 +7142,12 @@ "builtin-modules": "^1.0.0" } }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true + }, "is-ci": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.1.0.tgz", @@ -5516,6 +7177,12 @@ } } }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -5562,6 +7229,12 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=", + "dev": true + }, "is-glob": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", @@ -5577,12 +7250,6 @@ "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=", "dev": true }, - "is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", - "dev": true - }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -5660,13 +7327,13 @@ "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", "dev": true }, - "is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { - "is-unc-path": "^1.0.0" + "has": "^1.0.1" } }, "is-retry-allowed": { @@ -5687,6 +7354,15 @@ "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=", "dev": true }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, "is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", @@ -5702,27 +7378,12 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, - "is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "dev": true, - "requires": { - "unc-path-regex": "^0.1.2" - } - }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, - "is-valid-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", - "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=", - "dev": true - }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -5805,15 +7466,17 @@ } } }, - "istextorbinary": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-1.0.2.tgz", - "integrity": "sha1-rOGTVNGpoBc+/rEITOD4ewrX3s8=", - "dev": true, - "requires": { - "binaryextensions": "~1.0.0", - "textextensions": "~1.0.0" - } + "js-levenshtein": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.4.tgz", + "integrity": "sha512-PxfGzSs0ztShKrUYPIn5r0MtyAhYcCwmndozzpz8YObbPnD1jFxzlBGbRnX2mIu6Z13xN6+PTu05TQFnZFlzow==", + "dev": true + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "dev": true }, "js-tokens": { "version": "3.0.2", @@ -5909,15 +7572,6 @@ "dev": true, "requires": { "graceful-fs": "^4.1.6" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true, - "optional": true - } } }, "jsonify": { @@ -5944,18 +7598,6 @@ "verror": "1.10.0" } }, - "just-debounce": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", - "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=", - "dev": true - }, - "just-extend": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-3.0.0.tgz", - "integrity": "sha512-Fu3T6pKBuxjWT/p4DkqGHFRsysc8OauWr4ZRTY9dIx07Y9O0RkoR5jcv28aeD1vuAwhm3nLkDurwLXoALp4DpQ==", - "dev": true - }, "keccak": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", @@ -6010,16 +7652,6 @@ } } }, - "last-run": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", - "integrity": "sha1-RblpQsF7HHnHchmCWbqUO+v4yls=", - "dev": true, - "requires": { - "default-resolution": "^2.0.0", - "es6-weak-map": "^2.0.1" - } - }, "lazy-cache": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", @@ -6027,15 +7659,6 @@ "dev": true, "optional": true }, - "lazystream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", - "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", - "dev": true, - "requires": { - "readable-stream": "^2.0.5" - } - }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -6051,15 +7674,6 @@ "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", "dev": true }, - "lead": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", - "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", - "dev": true, - "requires": { - "flush-write-stream": "^1.0.2" - } - }, "lerna": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/lerna/-/lerna-2.11.0.tgz", @@ -6157,12 +7771,6 @@ } } }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -6294,22 +7902,6 @@ "astw": "^2.0.0" } }, - "liftoff": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz", - "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=", - "dev": true, - "requires": { - "extend": "^3.0.0", - "findup-sync": "^2.0.0", - "fined": "^1.0.1", - "flagged-respawn": "^1.0.0", - "is-plain-object": "^2.0.4", - "object.map": "^1.0.0", - "rechoir": "^0.6.2", - "resolve": "^1.1.7" - } - }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -6322,12 +7914,6 @@ "strip-bom": "^3.0.0" }, "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -6336,6 +7922,23 @@ } } }, + "loader-runner": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.1.tgz", + "integrity": "sha512-By6ZFY7ETWOc9RFaAIb23IjJVcM4dvJC/N57nmdz9RSkMXvAXGI7SyVlAw3v8vjtDRlqThgVDVmTnr9fqMlxkw==", + "dev": true + }, + "loader-utils": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", + "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0" + } + }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -6358,34 +7961,16 @@ "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", "dev": true }, - "lodash.assign": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", - "dev": true - }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, "lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", "dev": true }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", - "dev": true - }, - "lodash.isobject": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", - "integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=", + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", "dev": true }, "lodash.memoize": { @@ -6400,18 +7985,37 @@ "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==", "dev": true }, + "lodash.some": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=", + "dev": true + }, + "lodash.template": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", + "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "lodash.templatesettings": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", + "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0" + } + }, "log-driver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", "dev": true }, - "lolex": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", - "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", - "dev": true - }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -6443,6 +8047,16 @@ "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", "dev": true }, + "lru-cache": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, "make-dir": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", @@ -6452,28 +8066,13 @@ "pify": "^3.0.0" } }, - "make-error": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz", - "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==", - "dev": true - }, - "make-error-cause": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/make-error-cause/-/make-error-cause-1.2.2.tgz", - "integrity": "sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0=", - "dev": true, - "requires": { - "make-error": "^1.2.0" - } - }, - "make-iterator": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", - "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", + "map-age-cleaner": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.2.tgz", + "integrity": "sha512-UN1dNocxQq44IhJyMI4TU8phc2m9BddacHRPRjKGLYaF0jqd3xLz0jS0skpAU9WgYyoR4gHtUpzytNBS385FWQ==", "dev": true, "requires": { - "kind-of": "^6.0.2" + "p-defer": "^1.0.0" } }, "map-cache": { @@ -6494,27 +8093,7 @@ "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "dev": true, "requires": { - "object-visit": "^1.0.0" - } - }, - "matchdep": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz", - "integrity": "sha1-xvNINKDY28OzfCfui7yyfHd1WC4=", - "dev": true, - "requires": { - "findup-sync": "^2.0.0", - "micromatch": "^3.0.4", - "resolve": "^1.4.0", - "stack-trace": "0.0.10" - }, - "dependencies": { - "stack-trace": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", - "dev": true - } + "object-visit": "^1.0.0" } }, "md5.js": { @@ -6527,6 +8106,12 @@ "inherits": "^2.0.1" } }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true + }, "mem": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", @@ -6536,6 +8121,16 @@ "mimic-fn": "^1.0.0" } }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, "meow": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", @@ -6565,6 +8160,18 @@ } } }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "dev": true + }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -6596,6 +8203,12 @@ "brorand": "^1.0.1" } }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", + "dev": true + }, "mime-db": { "version": "1.33.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", @@ -6617,6 +8230,21 @@ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "dev": true, + "requires": { + "dom-walk": "^0.1.0" + } + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -6654,6 +8282,55 @@ "is-plain-obj": "^1.1.0" } }, + "minipass": { + "version": "2.2.4", + "resolved": false, + "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.1" + } + }, + "minizlib": { + "version": "1.1.0", + "resolved": false, + "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mississippi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", + "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==", + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^3.0.0", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + }, + "dependencies": { + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + } + } + }, "mixin-deep": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", @@ -6692,51 +8369,6 @@ } } }, - "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", - "dev": true, - "requires": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, "modify-values": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", @@ -6790,18 +8422,26 @@ "integrity": "sha512-shJkRTSebXvsVqk56I+lkb2latjBs8I+pc2TzWc545y2iFnSjm7Wg0QMh+ZWcdSLQyGEau5jI8ocnmkyTgr9YQ==", "dev": true }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "mute-stdout": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.0.tgz", - "integrity": "sha1-WzLqB+tDyd7WEwQ0z5JvRrKn/U0=", - "dev": true - }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -6839,23 +8479,120 @@ "integrity": "sha1-Ws7HI3WFblx2yDvSGmjXE+tfG6Q=", "dev": true }, - "next-tick": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", - "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", + "needle": { + "version": "2.2.0", + "resolved": false, + "integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==", + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", + "dev": true + }, + "neo-async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz", + "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, - "nise": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.4.5.tgz", - "integrity": "sha512-OHRVvdxKgwZELf2DTgsJEIA4MOq8XWvpSUzoOXyxJ2mY0mMENWC66+70AShLR2z05B1dzrzWlUQJmJERlOUpZw==", + "node-libs-browser": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", + "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", + "dev": true, + "requires": { + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^1.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "0.0.0", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.10.3", + "vm-browserify": "0.0.4" + }, + "dependencies": { + "buffer": { + "version": "4.9.1", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "timers-browserify": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", + "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", + "dev": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + } + } + }, + "node-pre-gyp": { + "version": "0.10.0", + "resolved": false, + "integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==", + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "node-releases": { + "version": "1.0.0-alpha.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.0.0-alpha.14.tgz", + "integrity": "sha512-G8nnF9cP9QPP/jUmYWw/uUUhumHmkm+X/EarCugYFjYm2uXRMFeOD6CVT3RLdoyCvDUNy51nirGfUItKWs/S1g==", "dev": true, "requires": { - "@sinonjs/formatio": "3.0.0", - "just-extend": "^3.0.0", - "lolex": "^2.3.2", - "path-to-regexp": "^1.7.0", - "text-encoding": "^0.6.4" + "semver": "^5.3.0" } }, "nopt": { @@ -6888,13 +8625,22 @@ "remove-trailing-separator": "^1.0.1" } }, - "now-and-later": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.0.tgz", - "integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=", + "npm-bundled": { + "version": "1.0.3", + "resolved": false, + "integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==", + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "resolved": false, + "integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==", "dev": true, + "optional": true, "requires": { - "once": "^1.3.2" + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" } }, "npm-run-path": { @@ -6921,8 +8667,7 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "number-to-bn": { "version": "1.1.0", @@ -7001,38 +8746,14 @@ "isobject": "^3.0.0" } }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", "dev": true, "requires": { "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, - "object.defaults": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", - "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", - "dev": true, - "requires": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "object.map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", - "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", - "dev": true, - "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" + "es-abstract": "^1.5.1" } }, "object.pick": { @@ -7044,14 +8765,13 @@ "isobject": "^3.0.1" } }, - "object.reduce": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.reduce/-/object.reduce-1.0.1.tgz", - "integrity": "sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60=", + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", "dev": true, "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" + "ee-first": "1.1.1" } }, "once": { @@ -7072,6 +8792,12 @@ "mimic-fn": "^1.0.0" } }, + "opener": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.1.tgz", + "integrity": "sha512-goYSy5c2UXE4Ra1xixabeVh1guIX/ZV/YokJksb6q2lubWu6UbvPQ20p542/sFIll1nl8JnCyK9oBaOcCWXwvA==", + "dev": true + }, "optimist": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", @@ -7110,15 +8836,6 @@ "wordwrap": "~1.0.0" } }, - "ordered-read-streams": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", - "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", - "dev": true, - "requires": { - "readable-stream": "^2.0.1" - } - }, "os-browserify": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", @@ -7165,12 +8882,35 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, + "output-file-sync": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-2.0.1.tgz", + "integrity": "sha512-mDho4qm7WgIXIGf4eYU1RHN2UU5tPfVYVSRwDJw0uTmj35DQUt/eNp19N7v6T3SrR0ESTEf2up2CGO73qI35zQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "is-plain-obj": "^1.1.0", + "mkdirp": "^0.5.1" + } + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, + "p-is-promise": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", + "dev": true + }, "p-limit": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz", @@ -7219,6 +8959,17 @@ "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", "dev": true }, + "parallel-transform": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", + "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", + "dev": true, + "requires": { + "cyclist": "~0.2.2", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + } + }, "parents": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", @@ -7241,23 +8992,22 @@ "pbkdf2": "^3.0.3" } }, - "parse-filepath": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", - "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" - } - }, "parse-github-repo-url": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz", "integrity": "sha1-nn2LslKmy2ukJZUGC3v23z28H1A=", "dev": true }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "dev": true, + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, "parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -7268,10 +9018,10 @@ "json-parse-better-errors": "^1.0.1" } }, - "parse-passwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=", "dev": true }, "pascalcase": { @@ -7328,38 +9078,6 @@ "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", "dev": true }, - "path-root": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", - "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", - "dev": true, - "requires": { - "path-root-regex": "^0.1.0" - } - }, - "path-root-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", - "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", - "dev": true - }, - "path-to-regexp": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", - "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", - "dev": true, - "requires": { - "isarray": "0.0.1" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - } - } - }, "path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", @@ -7476,26 +9194,13 @@ "pinkie": "^2.0.0" } }, - "plexer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/plexer/-/plexer-1.0.1.tgz", - "integrity": "sha1-qAG2Ur+BRXOXlepNO/CvlGwwwN0=", - "dev": true, - "requires": { - "isstream": "^0.1.2", - "readable-stream": "^2.0.2" - } - }, - "plugin-error": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", - "integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==", + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", "dev": true, "requires": { - "ansi-colors": "^1.0.1", - "arr-diff": "^4.0.0", - "arr-union": "^3.1.0", - "extend-shallow": "^3.0.2" + "find-up": "^2.1.0" } }, "posix-character-classes": { @@ -7516,12 +9221,6 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, - "pretty-hrtime": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", - "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", - "dev": true - }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", @@ -7547,6 +9246,28 @@ "dev": true, "optional": true }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "dev": true, + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -7605,6 +9326,17 @@ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "dev": true, + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", @@ -7632,14 +9364,32 @@ "safe-buffer": "^5.1.0" } }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", + "dev": true + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", "dev": true, "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" } }, "rc": { @@ -7662,27 +9412,6 @@ } } }, - "rcfinder": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/rcfinder/-/rcfinder-0.1.9.tgz", - "integrity": "sha1-8+gPOH3fmugK4wpBADKWQuroERU=", - "dev": true, - "requires": { - "lodash.clonedeep": "^4.3.2" - } - }, - "rcloader": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/rcloader/-/rcloader-0.2.2.tgz", - "integrity": "sha1-WNIpi0YtC5v9ITPSoex0+9cFxxc=", - "dev": true, - "requires": { - "lodash.assign": "^4.2.0", - "lodash.isobject": "^3.0.2", - "lodash.merge": "^4.6.0", - "rcfinder": "^0.1.6" - } - }, "read-cmd-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-1.0.1.tgz", @@ -7690,14 +9419,16 @@ "dev": true, "requires": { "graceful-fs": "^4.1.2" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - } + } + }, + "read-file-async": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-file-async/-/read-file-async-1.0.0.tgz", + "integrity": "sha1-EY/QuND3bclcu2WOcupvEHIQ3q4=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "typeable-promisify": "^1.0.1" } }, "read-only-stream": { @@ -7740,12 +9471,6 @@ "pinkie-promise": "^2.0.0" } }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -7804,15 +9529,6 @@ "normalize-package-data": "^2.3.2", "path-type": "^1.0.0" } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } } } }, @@ -7854,15 +9570,6 @@ "set-immediate-shim": "^1.0.1" } }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, "redent": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", @@ -7879,11 +9586,19 @@ "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", "dev": true }, + "regenerate-unicode-properties": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-7.0.0.tgz", + "integrity": "sha512-s5NGghCE4itSlUS+0WUj88G6cfMVMmH8boTPNvABf8od+2dhT9WDlWu8n01raQAJZMOK8Ch6jSexaRO7swd6aw==", + "dev": true, + "requires": { + "regenerate": "^1.4.0" + } + }, "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", - "dev": true + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" }, "regenerator-transform": { "version": "0.10.1", @@ -7951,27 +9666,6 @@ "jsesc": "~0.5.0" } }, - "remove-bom-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", - "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==", - "dev": true, - "requires": { - "is-buffer": "^1.1.5", - "is-utf8": "^0.2.1" - } - }, - "remove-bom-stream": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/remove-bom-stream/-/remove-bom-stream-1.2.0.tgz", - "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=", - "dev": true, - "requires": { - "remove-bom-buffer": "^3.0.0", - "safe-buffer": "^5.1.0", - "through2": "^2.0.3" - } - }, "remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", @@ -7999,34 +9693,6 @@ "is-finite": "^1.0.0" } }, - "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", - "dev": true - }, - "replace-homedir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-1.0.0.tgz", - "integrity": "sha1-6H9tUTuSjd6AgmDBK+f+xv9ueYw=", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1", - "is-absolute": "^1.0.0", - "remove-trailing-separator": "^1.1.0" - } - }, - "replacestream": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz", - "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.3", - "object-assign": "^4.0.1", - "readable-stream": "^2.0.2" - } - }, "request": { "version": "2.87.0", "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", @@ -8092,25 +9758,31 @@ "path-parse": "^1.0.5" } }, - "resolve-dir": { + "resolve-async": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", - "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", + "resolved": "https://registry.npmjs.org/resolve-async/-/resolve-async-1.0.1.tgz", + "integrity": "sha1-a/nyZFHppkpYoT7bguYV3fy9qGs=", "dev": true, "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" + "resolve": "^1.3.3", + "typeable-promisify": "^1.0.1" } }, - "resolve-options": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-1.1.0.tgz", - "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=", + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", "dev": true, "requires": { - "value-or-function": "^3.0.0" + "resolve-from": "^3.0.0" } }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -8177,6 +9849,15 @@ "is-promise": "^2.1.0" } }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + }, "rx-lite": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", @@ -8195,8 +9876,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safe-regex": { "version": "1.1.0", @@ -8223,6 +9903,49 @@ "stack-trace": "0.0.9" } }, + "sax": { + "version": "1.2.4", + "resolved": false, + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true, + "optional": true + }, + "schema-utils": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", + "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0" + }, + "dependencies": { + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + } + } + }, "scrypt": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz", @@ -8273,13 +9996,43 @@ "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "dev": true }, - "semver-greatest-satisfied-range": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz", - "integrity": "sha1-E+jCZYq5aRywzXEJMkAoDTb3els=", + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "dev": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + } + }, + "serialize-javascript": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz", + "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==", + "dev": true + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", "dev": true, "requires": { - "sver-compat": "^1.5.0" + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" } }, "set-blocking": { @@ -8317,6 +10070,18 @@ } } }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -8376,46 +10141,23 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "sinon": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-6.3.5.tgz", - "integrity": "sha512-xgoZ2gKjyVRcF08RrIQc+srnSyY1JDJtxu3Nsz07j1ffjgXoY6uPLf/qja6nDBZgzYYEovVkFryw2+KiZz11xQ==", + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=", + "dev": true + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", "dev": true, "requires": { - "@sinonjs/commons": "^1.0.2", - "@sinonjs/formatio": "^3.0.0", - "@sinonjs/samsam": "^2.1.2", - "diff": "^3.5.0", - "lodash.get": "^4.4.2", - "lolex": "^2.7.5", - "nise": "^1.4.5", - "supports-color": "^5.5.0", - "type-detect": "^4.0.8" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" } }, - "sinon-chai": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.2.0.tgz", - "integrity": "sha512-Z72B4a0l0IQe5uWi9yzcqX/Ml6K9e1Hp03NmkjJnRG3gDsKTX7KvLFZsVUmCaz0eqeXLLK089mwTsP1P1W+DUQ==", - "dev": true - }, "slash": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", @@ -8538,6 +10280,12 @@ "is-plain-obj": "^1.0.0" } }, + "source-list-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", + "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", + "dev": true + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -8572,12 +10320,6 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, - "sparkles": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz", - "integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==", - "dev": true - }, "spdx-correct": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", @@ -8660,6 +10402,15 @@ "tweetnacl": "~0.14.0" } }, + "ssri": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", + "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1" + } + }, "stack-trace": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz", @@ -8687,6 +10438,12 @@ } } }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", + "dev": true + }, "stream-browserify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", @@ -8707,11 +10464,15 @@ "readable-stream": "^2.0.2" } }, - "stream-exhaust": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", - "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==", - "dev": true + "stream-each": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", + "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + } }, "stream-http": { "version": "2.8.2", @@ -8742,6 +10503,12 @@ "readable-stream": "^2.0.2" } }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -8782,11 +10549,19 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, "requires": { "ansi-regex": "^2.0.0" } }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, "strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", @@ -8850,16 +10625,6 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, - "sver-compat": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/sver-compat/-/sver-compat-1.5.0.tgz", - "integrity": "sha1-PPh9/rTQe0o/FIJ7wYaz/QxkXNg=", - "dev": true, - "requires": { - "es6-iterator": "^2.0.1", - "es6-symbol": "^3.1.1" - } - }, "syntax-error": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", @@ -8869,6 +10634,27 @@ "acorn-node": "^1.2.0" } }, + "tapable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.0.tgz", + "integrity": "sha512-IlqtmLVaZA2qab8epUXbVWRn3aB1imbDMJtjB3nu4X0NqPkcY/JH9ZtCBWKHWPxs8Svi9tyo8w2dBoi07qZbBA==", + "dev": true + }, + "tar": { + "version": "4.4.1", + "resolved": false, + "integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==", + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1" + } + }, "temp-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", @@ -8887,14 +10673,6 @@ "pify": "^3.0.0", "temp-dir": "^1.0.0", "uuid": "^3.0.1" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - } } }, "tempfile": { @@ -8915,24 +10693,12 @@ } } }, - "text-encoding": { - "version": "0.6.4", - "resolved": "http://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", - "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", - "dev": true - }, "text-extensions": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.7.0.tgz", "integrity": "sha512-AKXZeDq230UaSzaO5s3qQUZOaC7iKbzq0jOFL614R7d9R593HLqAOL0cYoqLdkNrjBSOdmoQI06yigq1TSBXAg==", "dev": true }, - "textextensions": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-1.0.2.tgz", - "integrity": "sha1-ZUhjk+4fK7A5pgy7oFsLaL2VAdI=", - "dev": true - }, "throttleit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", @@ -8956,22 +10722,6 @@ "xtend": "~4.0.1" } }, - "through2-filter": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz", - "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", - "dev": true, - "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" - } - }, - "time-stamp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", - "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", - "dev": true - }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", @@ -8996,16 +10746,6 @@ "os-tmpdir": "~1.0.2" } }, - "to-absolute-glob": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", - "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "is-negated-glob": "^1.0.0" - } - }, "to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", @@ -9060,15 +10800,6 @@ "repeat-string": "^1.6.1" } }, - "to-through": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-through/-/to-through-2.0.0.tgz", - "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=", - "dev": true, - "requires": { - "through2": "^2.0.3" - } - }, "tough-cookie": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", @@ -9078,6 +10809,12 @@ "punycode": "^1.4.1" } }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", + "dev": true + }, "trim-newlines": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", @@ -9096,6 +10833,18 @@ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "dev": true }, + "tryer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz", + "integrity": "sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==", + "dev": true + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": true + }, "tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -9133,6 +10882,25 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "dev": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typeable-promisify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typeable-promisify/-/typeable-promisify-1.0.1.tgz", + "integrity": "sha1-AF1DUC53U6/8zIr4wF46wk8w5hc=", + "dev": true, + "requires": { + "any-promise": "^1.3.0" + } + }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -9157,58 +10925,179 @@ } } }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "dev": true, - "optional": true - }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, + "uglifyjs-webpack-plugin": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-2.0.1.tgz", + "integrity": "sha512-1HhCHkOB6wRCcv7htcz1QRPVbWPEY074RP9vzt/X0LF4xXm9l4YGd0qja7z88abDixQlnVwBjXsTBs+Xsn/eeQ==", + "dev": true, + "requires": { + "cacache": "^11.2.0", + "find-cache-dir": "^2.0.0", + "schema-utils": "^1.0.0", + "serialize-javascript": "^1.4.0", + "source-map": "^0.6.1", + "uglify-js": "^3.0.0", + "webpack-sources": "^1.1.0", + "worker-farm": "^1.5.2" + }, + "dependencies": { + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "find-cache-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.0.0.tgz", + "integrity": "sha512-LDUY6V1Xs5eFskUVYtIwatojt6+9xC9Chnlk/jYOOvn3FAFfSaWddxahDGyNHh0b2dMXa6YW2m0tk8TdVaXHlA==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^1.0.0", + "pkg-dir": "^3.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, "umd": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", "dev": true }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", - "dev": true - }, "underscore": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.0.tgz", "integrity": "sha512-4IV1DSSxC1QK48j9ONFK1MoIAKKkbE8i7u55w2R6IqBqbT7A/iG7aZBCR2Bi8piF0Uz+i/MG1aeqLwl/5vqF+A==", "dev": true }, - "undertaker": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.0.tgz", - "integrity": "sha1-M52kZGJS0ILcN45wgGcpl1DhG0k=", + "unicode-5.2.0": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/unicode-5.2.0/-/unicode-5.2.0-0.7.5.tgz", + "integrity": "sha512-KVGLW1Bri30x00yv4HNM8kBxoqFXr0Sbo55735nvrlsx4PYBZol3UtoWgO492fSwmsetzPEZzy73rbU8OGXJcA==", + "dev": true + }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", "dev": true, "requires": { - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "bach": "^1.0.0", - "collection-map": "^1.0.0", - "es6-weak-map": "^2.0.1", - "last-run": "^1.1.0", - "object.defaults": "^1.0.0", - "object.reduce": "^1.0.0", - "undertaker-registry": "^1.0.0" + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" } }, - "undertaker-registry": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-1.0.1.tgz", - "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA=", + "unicode-match-property-value-ecmascript": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz", + "integrity": "sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ==", "dev": true }, - "unicode-5.2.0": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/unicode-5.2.0/-/unicode-5.2.0-0.7.5.tgz", - "integrity": "sha512-KVGLW1Bri30x00yv4HNM8kBxoqFXr0Sbo55735nvrlsx4PYBZol3UtoWgO492fSwmsetzPEZzy73rbU8OGXJcA==", + "unicode-property-aliases-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz", + "integrity": "sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg==", "dev": true }, "union-value": { @@ -9246,25 +11135,22 @@ } } }, - "unique-stream": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.2.1.tgz", - "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", + "unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", "dev": true, "requires": { - "json-stable-stringify": "^1.0.0", - "through2-filter": "^2.0.0" - }, - "dependencies": { - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "~0.0.0" - } - } + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.1.tgz", + "integrity": "sha512-n9cU6+gITaVu7VGj1Z8feKMmfAjEAQGhwD9fE3zvpRRa0wEIx8ODYkVGfSc94M2OX00tUFV8wH3zYbm1I8mxFg==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" } }, "universalify": { @@ -9273,6 +11159,12 @@ "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=", "dev": true }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -9325,6 +11217,23 @@ "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", "dev": true }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + } + } + }, "urix": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", @@ -9358,6 +11267,12 @@ "prepend-http": "^1.0.1" } }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=", + "dev": true + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -9393,20 +11308,33 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true + }, "uuid": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", "dev": true }, - "v8flags": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.1.tgz", - "integrity": "sha512-iw/1ViSEaff8NJ3HLyEjawk/8hjJib3E7pvG4pddVXfUg1983s3VGsiClDjhK64MQVDGqc1Q8r18S4VKQZS9EQ==", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1" - } + "v8-compile-cache": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.2.tgz", + "integrity": "sha512-1wFuMUIM16MDJRCrpbpuEPTUGmM5QMUg0cr3KFwra2XgOgFcPGDQHDh3CszSCD2Zewc/dh/pamNEW8CbfDebUw==", + "dev": true }, "validate-npm-package-license": { "version": "3.0.3", @@ -9418,10 +11346,10 @@ "spdx-expression-parse": "^3.0.0" } }, - "value-or-function": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-3.0.0.tgz", - "integrity": "sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM=", + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", "dev": true }, "verror": { @@ -9435,125 +11363,555 @@ "extsprintf": "^1.2.0" } }, - "vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "vinyl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "dev": true, + "requires": { + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" + }, + "dependencies": { + "clone": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", + "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", + "dev": true + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true + } + } + }, + "vinyl-source-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vinyl-source-stream/-/vinyl-source-stream-2.0.0.tgz", + "integrity": "sha1-84pa+53R6Ttl1VBGmsYYKsT1S44=", + "dev": true, + "requires": { + "through2": "^2.0.3", + "vinyl": "^2.1.0" + } + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "dev": true, + "requires": { + "indexof": "0.0.1" + } + }, + "watchpack": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", + "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", + "dev": true, + "requires": { + "chokidar": "^2.0.2", + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0" + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, + "webpack": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.21.0.tgz", + "integrity": "sha512-CGBeop4AYR0dcmk9Afl33qQULwTHQCXQPAIBTHMJoy9DpY8FPUDna/NUlAGTr5o5y9QC901Ww3wCY4wNo1X9Lw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-module-context": "1.7.8", + "@webassemblyjs/wasm-edit": "1.7.8", + "@webassemblyjs/wasm-parser": "1.7.8", + "acorn": "^5.6.2", + "acorn-dynamic-import": "^3.0.0", + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0", + "chrome-trace-event": "^1.0.0", + "enhanced-resolve": "^4.1.0", + "eslint-scope": "^4.0.0", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^2.3.0", + "loader-utils": "^1.1.0", + "memory-fs": "~0.4.1", + "micromatch": "^3.1.8", + "mkdirp": "~0.5.0", + "neo-async": "^2.5.0", + "node-libs-browser": "^2.0.0", + "schema-utils": "^0.4.4", + "tapable": "^1.1.0", + "uglifyjs-webpack-plugin": "^1.2.4", + "watchpack": "^1.5.0", + "webpack-sources": "^1.3.0" + }, + "dependencies": { + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + }, + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "bluebird": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.2.tgz", + "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg==", + "dev": true + }, + "cacache": { + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", + "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", + "dev": true, + "requires": { + "bluebird": "^3.5.1", + "chownr": "^1.0.1", + "glob": "^7.1.2", + "graceful-fs": "^4.1.11", + "lru-cache": "^4.1.1", + "mississippi": "^2.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.2", + "ssri": "^5.2.4", + "unique-filename": "^1.1.0", + "y18n": "^4.0.0" + } + }, + "commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "dev": true + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "mississippi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", + "integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==", + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^2.0.1", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "ssri": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", + "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.1" + } + }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "dev": true, + "requires": { + "commander": "~2.13.0", + "source-map": "~0.6.1" + } + }, + "uglifyjs-webpack-plugin": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.3.0.tgz", + "integrity": "sha512-ovHIch0AMlxjD/97j9AYovZxG5wnHOPkL7T1GKochBADp/Zwc44pEWNqpKl1Loupp1WhFg7SlYmHZRUfdAacgw==", + "dev": true, + "requires": { + "cacache": "^10.0.4", + "find-cache-dir": "^1.0.0", + "schema-utils": "^0.4.5", + "serialize-javascript": "^1.4.0", + "source-map": "^0.6.1", + "uglify-es": "^3.3.4", + "webpack-sources": "^1.1.0", + "worker-farm": "^1.5.2" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + } + } + }, + "webpack-bundle-analyzer": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-3.0.3.tgz", + "integrity": "sha512-naLWiRfmtH4UJgtUktRTLw6FdoZJ2RvCR9ePbwM9aRMsS/KjFerkPZG9epEvXRAw5d5oPdrs9+3p+afNjxW8Xw==", + "dev": true, + "requires": { + "acorn": "^5.7.3", + "bfj": "^6.1.1", + "chalk": "^2.4.1", + "commander": "^2.18.0", + "ejs": "^2.6.1", + "express": "^4.16.3", + "filesize": "^3.6.1", + "gzip-size": "^5.0.0", + "lodash": "^4.17.10", + "mkdirp": "^0.5.1", + "opener": "^1.5.1", + "ws": "^6.0.0" + }, + "dependencies": { + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "webpack-cli": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.1.2.tgz", + "integrity": "sha512-Cnqo7CeqeSvC6PTdts+dywNi5CRlIPbLx1AoUPK2T6vC1YAugMG3IOoO9DmEscd+Dghw7uRlnzV1KwOe5IrtgQ==", "dev": true, "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" + "chalk": "^2.4.1", + "cross-spawn": "^6.0.5", + "enhanced-resolve": "^4.1.0", + "global-modules-path": "^2.3.0", + "import-local": "^2.0.0", + "interpret": "^1.1.0", + "loader-utils": "^1.1.0", + "supports-color": "^5.5.0", + "v8-compile-cache": "^2.0.2", + "yargs": "^12.0.2" }, "dependencies": { - "clone": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", - "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "decamelize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", + "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", + "dev": true, + "requires": { + "xregexp": "4.0.0" + } + }, + "execa": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", + "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "dev": true, + "requires": { + "invert-kv": "^2.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "mem": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz", + "integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==", + "dev": true, + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^1.1.0" + } + }, + "os-locale": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.0.1.tgz", + "integrity": "sha512-7g5e7dmXPtzcP4bgsZ8ixDVqA7oWYuEz4lOSujeWyliPai4gfVDiFIcwBg3aGCPnmSGfzOKTK3ccPn0CKv3DBw==", + "dev": true, + "requires": { + "execa": "^0.10.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "yargs": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz", + "integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^2.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^10.1.0" + } + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } } } }, - "vinyl-fs": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.3.tgz", - "integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==", - "dev": true, - "requires": { - "fs-mkdirp-stream": "^1.0.0", - "glob-stream": "^6.1.0", - "graceful-fs": "^4.0.0", - "is-valid-glob": "^1.0.0", - "lazystream": "^1.0.0", - "lead": "^1.0.0", - "object.assign": "^4.0.4", - "pumpify": "^1.3.5", - "readable-stream": "^2.3.3", - "remove-bom-buffer": "^3.0.0", - "remove-bom-stream": "^1.2.0", - "resolve-options": "^1.1.0", - "through2": "^2.0.0", - "to-through": "^2.0.0", - "value-or-function": "^3.0.0", - "vinyl": "^2.0.0", - "vinyl-sourcemap": "^1.1.0" - } - }, - "vinyl-source-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vinyl-source-stream/-/vinyl-source-stream-2.0.0.tgz", - "integrity": "sha1-84pa+53R6Ttl1VBGmsYYKsT1S44=", - "dev": true, - "requires": { - "through2": "^2.0.3", - "vinyl": "^2.1.0" - } - }, - "vinyl-sourcemap": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz", - "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=", + "webpack-sources": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz", + "integrity": "sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA==", "dev": true, "requires": { - "append-buffer": "^1.0.2", - "convert-source-map": "^1.5.0", - "graceful-fs": "^4.1.6", - "normalize-path": "^2.1.1", - "now-and-later": "^2.0.0", - "remove-bom-buffer": "^3.0.0", - "vinyl": "^2.0.0" + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" }, "dependencies": { - "convert-source-map": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", - "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true } } }, - "vinyl-sourcemaps-apply": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz", - "integrity": "sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=", - "dev": true, - "requires": { - "source-map": "^0.5.1" - } - }, - "vm-browserify": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", - "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", - "dev": true, - "requires": { - "indexof": "0.0.1" - } - }, - "wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", - "dev": true, - "requires": { - "defaults": "^1.0.3" - } - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -9615,6 +11973,15 @@ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", "dev": true }, + "worker-farm": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz", + "integrity": "sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ==", + "dev": true, + "requires": { + "errno": "~0.1.7" + } + }, "wrap-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", @@ -9662,14 +12029,6 @@ "graceful-fs": "^4.1.11", "imurmurhash": "^0.1.4", "signal-exit": "^3.0.2" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - } } }, "write-json-file": { @@ -9691,12 +12050,6 @@ "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=", "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true } } }, @@ -9710,6 +12063,57 @@ "write-json-file": "^2.2.0" } }, + "ws": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.0.tgz", + "integrity": "sha512-H3dGVdGvW2H8bnYpIDc3u3LH8Wue3Qh+Zto6aXXFzvESkTVT6rAfKR6tR/+coaUvxs8yHtmNV0uioBF62ZGSTg==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "dev": true, + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "dev": true, + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "dev": true, + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xregexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz", + "integrity": "sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg==", + "dev": true + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", diff --git a/package.js b/package.js index 1d95c5d7ddf..0eac620e977 100644 --- a/package.js +++ b/package.js @@ -2,7 +2,7 @@ Package.describe({ name: 'ethereum:web3', version: '1.0.0-beta.36', - summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC', + summary: 'Ethereum JavaScript API, middleware to talk to a ethereum node over RPC', git: 'https://github.com/ethereum/ethereum.js', // By default, Meteor will default to using README.md for documentation. // To avoid submitting documentation, set this field to null. diff --git a/package.json b/package.json index 62fbc58e231..38af689f4f9 100644 --- a/package.json +++ b/package.json @@ -11,14 +11,10 @@ }, "scripts": { "postinstall": "lerna bootstrap", - "build": "gulp", - "build-all": "gulp all", + "build": "webpack --mode production", "release": "lerna bootstrap; lerna publish; gulp version; gulp; gulp publishTag; git push --tags", - "watch": "gulp watch", "docs": "cd docs; make html;", - "lint": "jshint *.js packages", - "test": "mocha; jshint *.js packages", - "test-coveralls": "istanbul cover _mocha -- -R spec && cat coverage/lcov.info | coveralls --verbose" + "lint": "jshint *.js packages" }, "repository": { "type": "git", @@ -66,36 +62,44 @@ } ], "devDependencies": { + "@babel/cli": "^7.1.2", + "@babel/core": "^7.1.2", + "@babel/plugin-proposal-export-default-from": "^7.0.0", + "@babel/preset-env": "^7.1.0", + "@babel/preset-es2015": "^7.0.0-beta.53", "@types/bignumber.js": "^4.0.2", "@types/underscore": "^1.8.0", + "babel-collect-imports": "^1.1.0", + "babel-loader": "^8.0.4", + "babel-minify-webpack-plugin": "^0.3.1", "babel-preset-env": "^1.6.0", + "babel-preset-minify": "^0.5.0", "bignumber.js": "^4.0.0", "bluebird": "3.3.1", - "bn.js": "^4.11.8", - "bower": ">=1.4.1", + "bn.js": "4.11.8", "browserify": "^14.4.0", "chai": "^4.0.0", "coveralls": "^3.0.2", "crypto-js": "^3.1.4", "del": ">=2.0.2", + "duplicate-package-checker-webpack-plugin": "^3.0.0", + "eth-lib": "^0.2.8", "ethereumjs-wallet": "^0.6.2", "ethjs-signer": "^0.1.1", "exorcist": "^0.4.0", - "gulp": "^4.0.0", - "gulp-babel": "^6.1.2", - "gulp-jshint": "^2.0.4", - "gulp-rename": "^1.2.2", - "gulp-replace": "^0.6.1", - "gulp-streamify": "^1.0.2", - "gulp-uglify": "^3.0.0", "istanbul": "^0.4.4", + "js-sha3": "^0.8.0", "jshint": ">=2.5.0", "lerna": "^2.5.1", - "mocha": ">=2.3.3", "sandboxed-module": "^2.0.2", - "sinon": "^6.3.5", - "sinon-chai": "^3.2.0", + "uglifyjs-webpack-plugin": "^2.0.1", "underscore": "^1.8.3", - "vinyl-source-stream": "^2.0.0" + "vinyl-source-stream": "^2.0.0", + "webpack": "^4.21.0", + "webpack-bundle-analyzer": "^3.0.3", + "webpack-cli": "^3.1.2" + }, + "dependencies": { + "@babel/polyfill": "^7.0.0" } } diff --git a/packages/web3-bzz/package-lock.json b/packages/web3-bzz/package-lock.json index ae8f1ae4add..7275670ae68 100644 --- a/packages/web3-bzz/package-lock.json +++ b/packages/web3-bzz/package-lock.json @@ -1620,9 +1620,9 @@ } }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" }, "unpipe": { "version": "1.0.0", diff --git a/packages/web3-bzz/package.json b/packages/web3-bzz/package.json index 62f2b703a1d..8956be8a56f 100644 --- a/packages/web3-bzz/package.json +++ b/packages/web3-bzz/package.json @@ -9,6 +9,6 @@ "dependencies": { "got": "7.1.0", "swarm-js": "0.1.37", - "underscore": "1.8.3" + "underscore": "1.9.1" } } diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index 539cb0defb7..e4cd6e4f524 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -20,7 +20,7 @@ * @date 2017 */ -import _ from 'underscore'; +import {isObject, isString} from 'underscore'; import swarm from 'swarm-js'; export default class Bzz { @@ -132,11 +132,11 @@ export default class Bzz { */ setProvider(provider) { // is ethereum provider - if (_.isObject(provider) && _.isString(provider.bzz)) { + if (isObject(provider) && isString(provider.bzz)) { provider = provider.bzz; } - if (_.isString(provider)) { + if (isString(provider)) { this.currentProvider = provider; this.swarm = swarm.at(provider); diff --git a/packages/web3-core-helpers/package-lock.json b/packages/web3-core-helpers/package-lock.json index 07f47fab5fe..d8f894cdc17 100644 --- a/packages/web3-core-helpers/package-lock.json +++ b/packages/web3-core-helpers/package-lock.json @@ -3,9 +3,9 @@ "lockfileVersion": 1, "dependencies": { "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" } } } diff --git a/packages/web3-core-helpers/package.json b/packages/web3-core-helpers/package.json index a9dfb77bb3d..7ef217f3d4f 100644 --- a/packages/web3-core-helpers/package.json +++ b/packages/web3-core-helpers/package.json @@ -7,7 +7,7 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "underscore": "1.8.3", + "underscore": "1.9.1", "web3-eth-iban": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36" } diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index 303b5e602ff..ddbd76acb1b 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -21,7 +21,7 @@ * @date 2017 */ -import _ from 'underscore'; +import {isString, isObject, isNumber, isArray} from 'underscore'; import Utils from 'web3-utils'; import {Iban} from 'web3-eth-iban'; @@ -70,7 +70,7 @@ const inputBlockNumberFormatter = blockNumber => { return blockNumber; } - return (Utils.isHexStrict(blockNumber)) ? ((_.isString(blockNumber)) ? blockNumber.toLowerCase() : blockNumber) : Utils.numberToHex(blockNumber); + return (Utils.isHexStrict(blockNumber)) ? ((isString(blockNumber)) ? blockNumber.toLowerCase() : blockNumber) : Utils.numberToHex(blockNumber); }; /** @@ -151,12 +151,12 @@ const inputCallFormatter = (options, moduleInstance) => { const inputTransactionFormatter = (options, moduleInstance) => { options = _txInputFormatter(options); - if (!_.isNumber(options.from) && !_.isObject(options.from)) { + if (!isNumber(options.from) && !isObject(options.from)) { if (!options.from) { options.from = moduleInstance.defaultAccount; } - if (!options.from && !_.isNumber(options.from)) { + if (!options.from && !isNumber(options.from)) { throw new Error('The send transactions "from" field must be defined!'); } @@ -226,7 +226,7 @@ const outputTransactionReceiptFormatter = receipt => { receipt.cumulativeGasUsed = Utils.hexToNumber(receipt.cumulativeGasUsed); receipt.gasUsed = Utils.hexToNumber(receipt.gasUsed); - if(_.isArray(receipt.logs)) { + if(isArray(receipt.logs)) { receipt.logs = receipt.logs.map(outputLogFormatter); } @@ -263,9 +263,9 @@ const outputBlockFormatter = block => { if(block.totalDifficulty) block.totalDifficulty = outputBigNumberFormatter(block.totalDifficulty); - if (_.isArray(block.transactions)) { + if (isArray(block.transactions)) { block.transactions.forEach(item => { - if(!_.isString(item)) + if(!isString(item)) return outputTransactionFormatter(item); }); } @@ -307,13 +307,13 @@ const inputLogFormatter = options => { // make sure topics, get converted to hex options.topics = options.topics || []; options.topics = options.topics.map(topic => { - return (_.isArray(topic)) ? topic.map(toTopic) : toTopic(topic); + return (isArray(topic)) ? topic.map(toTopic) : toTopic(topic); }); toTopic = null; if (options.address) { - options.address = (_.isArray(options.address)) ? options.address.map(addr => { + options.address = (isArray(options.address)) ? options.address.map(addr => { return inputAddressFormatter(addr); }) : inputAddressFormatter(options.address); } @@ -373,7 +373,7 @@ const inputPostFormatter = post => { post.priority = Utils.numberToHex(post.priority); // fallback - if (!_.isArray(post.topics)) { + if (!isArray(post.topics)) { post.topics = post.topics ? [post.topics] : []; } diff --git a/packages/web3-core-method/package-lock.json b/packages/web3-core-method/package-lock.json index 0413b70bd3a..74384d417f7 100644 --- a/packages/web3-core-method/package-lock.json +++ b/packages/web3-core-method/package-lock.json @@ -32,40 +32,10 @@ } } }, - "@sinonjs/commons": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.0.2.tgz", - "integrity": "sha512-WR3dlgqJP4QNrLC4iXN/5/2WaLQQ0VijOOkmflqFGVJ6wLEpbSjo7c0ZeGIdtY8Crk7xBBp87sM6+Mkerz7alw==", - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@sinonjs/formatio": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.0.0.tgz", - "integrity": "sha512-vdjoYLDptCgvtJs57ULshak3iJe4NW3sJ3g36xVDGff5AE8P30S6A093EIEPjdi2noGhfuNOEkbxt3J3awFW1w==", - "dev": true, - "requires": { - "@sinonjs/samsam": "2.1.0" - }, - "dependencies": { - "@sinonjs/samsam": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.0.tgz", - "integrity": "sha512-5x2kFgJYupaF1ns/RmharQ90lQkd2ELS8A9X0ymkAAdemYHGtI2KiUHG8nX2WU0T1qgnOU5YMqnBM2V7NUanNw==", - "dev": true, - "requires": { - "array-from": "^2.1.1" - } - } - } - }, - "@sinonjs/samsam": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.2.tgz", - "integrity": "sha512-ZwTHAlC9akprWDinwEPD4kOuwaYZlyMwVJIANsKNC3QVp0AHB04m7RnB4eqeWfgmxw8MGTzS9uMaw93Z3QcZbw==", - "dev": true + "@types/node": { + "version": "10.12.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.0.tgz", + "integrity": "sha512-3TUHC3jsBAB7qVRGxT6lWyYo2v96BMmD2PTcl47H25Lu7UXtFH/2qqmKiVrnel6Ne//0TFYf6uvNX+HW2FRkLQ==" }, "abab": { "version": "2.0.0", @@ -112,6 +82,11 @@ "integrity": "sha512-ugTb7Lq7u4GfWSqqpwE0bGyoBZNMTok/zDBXxfEG0QM50jNlGhIWjRC1pPN7bvV1anhF+bs+/gNcRw+o55Evbg==", "dev": true }, + "aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" + }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -144,6 +119,11 @@ "color-convert": "^1.9.0" } }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, "anymatch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", @@ -489,12 +469,6 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, - "array-from": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", - "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", - "dev": true - }, "array-unique": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", @@ -515,17 +489,21 @@ "safer-buffer": "~2.1.0" } }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", @@ -1443,6 +1421,56 @@ "resolve": "1.1.7" } }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, "browserify-sha3": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", @@ -1451,6 +1479,20 @@ "js-sha3": "^0.3.1" } }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "requires": { + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" + } + }, "browserslist": { "version": "3.2.8", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz", @@ -1481,6 +1523,11 @@ "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -1549,20 +1596,6 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, - "chai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", - "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.1.0", - "type-detect": "^4.0.5" - } - }, "chalk": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", @@ -1574,18 +1607,21 @@ "supports-color": "^5.3.0" } }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, "ci-info": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", "dev": true }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", @@ -1711,6 +1747,11 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -1737,6 +1778,40 @@ "vary": "^1" } }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -1748,6 +1823,24 @@ "which": "^1.2.9" } }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, "cssom": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", @@ -1823,15 +1916,6 @@ "mimic-response": "^1.0.0" } }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", @@ -1919,6 +2003,15 @@ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, "destroy": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", @@ -1945,6 +2038,16 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, "dom-walk": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", @@ -2108,6 +2211,55 @@ "xhr-request-promise": "^0.1.2" } }, + "ethers": { + "version": "4.0.0-beta.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.1.tgz", + "integrity": "sha512-SoYhktEbLxf+fiux5SfCEwdzWENMvgIbMZD90I62s4GZD9nEjgEWy8ZboI3hck193Vs0bDoTohDISx84f2H2tw==", + "requires": { + "@types/node": "^10.3.2", + "aes-js": "3.0.0", + "bn.js": "^4.4.0", + "elliptic": "6.3.3", + "hash.js": "1.1.3", + "js-sha3": "0.5.7", + "scrypt-js": "2.0.3", + "setimmediate": "1.0.4", + "uuid": "2.0.1", + "xmlhttprequest": "1.8.0" + }, + "dependencies": { + "elliptic": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", + "integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "js-sha3": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" + }, + "uuid": { + "version": "2.0.1", + "resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", + "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" + } + } + }, "ethjs-unit": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", @@ -2122,6 +2274,15 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, "exec-sh": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.2.tgz", @@ -3043,12 +3204,6 @@ "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, "get-stream": { "version": "3.0.0", "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", @@ -3253,6 +3408,15 @@ } } }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, "hash.js": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", @@ -3308,6 +3472,11 @@ "statuses": ">= 1.4.0 < 2" } }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -3601,12 +3770,6 @@ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -4248,12 +4411,6 @@ "verror": "1.10.0" } }, - "just-extend": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-3.0.0.tgz", - "integrity": "sha512-Fu3T6pKBuxjWT/p4DkqGHFRsysc8OauWr4ZRTY9dIx07Y9O0RkoR5jcv28aeD1vuAwhm3nLkDurwLXoALp4DpQ==", - "dev": true - }, "keccakjs": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", @@ -4338,24 +4495,12 @@ "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "dev": true }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", - "dev": true - }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", "dev": true }, - "lolex": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", - "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", - "dev": true - }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -4405,6 +4550,23 @@ "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", "dev": true }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -4465,6 +4627,15 @@ "regex-cache": "^0.4.2" } }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, "mime": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", @@ -4622,30 +4793,6 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" }, - "nise": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.4.5.tgz", - "integrity": "sha512-OHRVvdxKgwZELf2DTgsJEIA4MOq8XWvpSUzoOXyxJ2mY0mMENWC66+70AShLR2z05B1dzrzWlUQJmJERlOUpZw==", - "dev": true, - "requires": { - "@sinonjs/formatio": "3.0.0", - "just-extend": "^3.0.0", - "lolex": "^2.3.2", - "path-to-regexp": "^1.7.0", - "text-encoding": "^0.6.4" - }, - "dependencies": { - "path-to-regexp": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", - "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", - "dev": true, - "requires": { - "isarray": "0.0.1" - } - } - } - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -4807,6 +4954,14 @@ } } }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -4908,6 +5063,18 @@ "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", "dev": true }, + "parse-asn1": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" + } + }, "parse-glob": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", @@ -4995,11 +5162,17 @@ "pinkie-promise": "^2.0.0" } }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", - "dev": true + "pbkdf2": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", + "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } }, "performance-now": { "version": "2.1.0", @@ -5125,6 +5298,26 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -5170,6 +5363,23 @@ } } }, + "randombytes": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", + "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, "randomhex": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", @@ -5476,6 +5686,15 @@ "glob": "^7.0.5" } }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, "rsvp": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.6.2.tgz", @@ -5815,6 +6034,36 @@ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "dev": true }, + "scrypt": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz", + "integrity": "sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=", + "requires": { + "nan": "^2.0.8" + } + }, + "scrypt-js": { + "version": "2.0.3", + "resolved": "http://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", + "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" + }, + "scrypt.js": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/scrypt.js/-/scrypt.js-0.2.0.tgz", + "integrity": "sha1-r40UZbcemZARC+38WTuUeeA6ito=", + "requires": { + "scrypt": "^6.0.2", + "scryptsy": "^1.2.1" + } + }, + "scryptsy": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-1.2.1.tgz", + "integrity": "sha1-oyJfpLJST4AnAHYeKFW987LZIWM=", + "requires": { + "pbkdf2": "^3.0.3" + } + }, "semver": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", @@ -5908,11 +6157,25 @@ } } }, + "setimmediate": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", + "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" + }, "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" }, + "sha.js": { + "version": "2.4.11", + "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, "sha3": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", @@ -5963,34 +6226,6 @@ "simple-concat": "^1.0.0" } }, - "sinon": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-6.3.5.tgz", - "integrity": "sha512-xgoZ2gKjyVRcF08RrIQc+srnSyY1JDJtxu3Nsz07j1ffjgXoY6uPLf/qja6nDBZgzYYEovVkFryw2+KiZz11xQ==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.0.2", - "@sinonjs/formatio": "^3.0.0", - "@sinonjs/samsam": "^2.1.2", - "diff": "^3.5.0", - "lodash.get": "^4.4.2", - "lolex": "^2.7.5", - "nise": "^1.4.5", - "supports-color": "^5.5.0", - "type-detect": "^4.0.8" - }, - "dependencies": { - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, "sisteransi": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-0.1.1.tgz", @@ -6357,12 +6592,6 @@ "require-main-filename": "^1.0.1" } }, - "text-encoding": { - "version": "0.6.4", - "resolved": "http://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", - "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", - "dev": true - }, "throat": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", @@ -6488,12 +6717,6 @@ "prelude-ls": "~1.1.2" } }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, "type-is": { "version": "1.6.16", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", @@ -6503,6 +6726,14 @@ "mime-types": "~2.1.18" } }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, "uglify-js": { "version": "3.4.9", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", @@ -6741,6 +6972,17 @@ } } }, + "web3-core": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.36.tgz", + "integrity": "sha512-C2QW9CMMRZdYAiKiLkMrKRSp+gekSqTDgZTNvlxAdN1hXn4d9UmcmWSJXOmIHqr5N2ISbRod+bW+qChODxVE3Q==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-requestmanager": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, "web3-core-helpers": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", @@ -6758,6 +7000,160 @@ } } }, + "web3-core-method": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.36.tgz", + "integrity": "sha512-dJsP3KkGaqBBSdxfzvLsYPOmVaSs1lR/3oKob/gtUYG7UyTnwquwliAc7OXj+gqRA2E/FHZcM83cWdl31ltdSA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-promievent": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.36.tgz", + "integrity": "sha512-RGIL6TjcOeJTullFLMurChPTsg94cPF6LI763y/sPYtXTDol1vVa+J5aGLp/4WW8v+s+1bSQO6zYq2ZtkbmtEQ==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "1.1.1" + }, + "dependencies": { + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + } + } + }, + "web3-core-requestmanager": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.36.tgz", + "integrity": "sha512-/CHuaMbiMDu1v8ANGYI7yFCnh1GaCWx5pKnUPJf+QTk2xAAw+Bvd97yZJIWPOK5AOPUIzxgwx9Ob/5ln6mTmYA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-providers-http": "1.0.0-beta.36", + "web3-providers-ipc": "1.0.0-beta.36", + "web3-providers-ws": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-subscriptions": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", + "integrity": "sha512-/evyLQ8CMEYXC5aUCodDpmEnmGVYQxaIjiEIfA/85f9ifHkfzP1aOwCAjcsLsJWnwrWDagxSpjCYrDtnNabdEw==", + "requires": { + "eventemitter3": "1.1.1", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-abi": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.36.tgz", + "integrity": "sha512-fBfW+7hvA0rxEMV45fO7JU+0R32ayT7aRwG9Cl6NW2/QvhFeME2qVbMIWw0q5MryPZGIN8A6366hKNuWvVidDg==", + "requires": { + "ethers": "4.0.0-beta.1", + "underscore": "1.8.3", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-accounts": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.0.0-beta.36.tgz", + "integrity": "sha512-MmgIlBEZ0ILLWV4+wfMrbeVVMU/VmQnCpgSDcw7wHKOKu47bKncJ6rVqVsUbC6d9F613Rios+Yj2Ua6SCHtmrg==", + "requires": { + "any-promise": "1.3.0", + "crypto-browserify": "3.12.0", + "eth-lib": "0.2.7", + "scrypt.js": "0.2.0", + "underscore": "1.8.3", + "uuid": "2.0.1", + "web3-core": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "uuid": { + "version": "2.0.1", + "resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", + "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" + } + } + }, + "web3-eth-contract": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.36.tgz", + "integrity": "sha512-cywqcIrUsCW4fyqsHdOb24OCC8AnBol8kNiptI+IHRylyCjTNgr53bUbjrXWjmEnear90rO0QhAVjLB1a4iEbQ==", + "requires": { + "underscore": "1.8.3", + "web3-core": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-eth-abi": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, "web3-eth-iban": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", @@ -6767,6 +7163,49 @@ "web3-utils": "1.0.0-beta.36" } }, + "web3-providers-http": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.36.tgz", + "integrity": "sha512-KLSqMS59nRdpet9B0B64MKgtM3n9wAHTcAHJ03hv79avQNTjHxtjZm0ttcjcFUPpWDgTCtcYCa7tqaYo9Pbeog==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.36.tgz", + "integrity": "sha512-iEUrmdd2CzoWgp+75/ydom/1IaoLw95qkAzsgwjjZp1waDncHP/cvVGX74+fbUx4hRaPdchyzxCQfNpgLDmNjQ==", + "requires": { + "oboe": "2.1.3", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-providers-ws": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.36.tgz", + "integrity": "sha512-wAnENuZx75T5ZSrT2De2LOaUuPf2yRjq1VfcbD7+Zd79F3DZZLBJcPyCNVQ1U0fAXt0wfgCKl7sVw5pffqR9Bw==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, "web3-utils": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", @@ -6794,6 +7233,26 @@ "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", "dev": true }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, "whatwg-encoding": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", @@ -6952,12 +7411,25 @@ "xhr-request": "^1.0.1" } }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "dev": true }, + "xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", @@ -6969,6 +7441,11 @@ "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", "dev": true }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", diff --git a/packages/web3-core-method/package.json b/packages/web3-core-method/package.json index da0078c5b27..221c5e0e031 100644 --- a/packages/web3-core-method/package.json +++ b/packages/web3-core-method/package.json @@ -14,7 +14,6 @@ "underscore": "1.9.1", "web3-core-helpers": "1.0.0-beta.36", "web3-core-promievent": "1.0.0-beta.36", - "web3-providers": "1.0.0-beta.36", "web3-core": "1.0.0-beta.36", "web3-core-subscriptions": "1.0.0-beta.36", "web3-eth-accounts": "1.0.0-beta.36", @@ -28,7 +27,9 @@ "notifyMode": "success-change", "notify": true, "clearMocks": true, - "testMatch": ["/**/**Test.js"], + "testMatch": [ + "/**/**Test.js" + ], "bail": true } } diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index 825c351a8f8..b40f88a109e 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -20,7 +20,7 @@ * @date 2018 */ -import _ from 'underscore'; +import {isObject} from 'underscore'; export default class SendMethodCommand { @@ -55,7 +55,7 @@ export default class SendMethodCommand { } this.getGasPrice(moduleInstance.currentProvider).then(gasPrice => { - if (_.isObject(methodModel.parameters[0])) { + if (isObject(methodModel.parameters[0])) { methodModel.parameters[0].gasPrice = gasPrice; } @@ -116,7 +116,7 @@ export default class SendMethodCommand { * @returns {Boolean} */ isGasPriceDefined(parameters) { - return _.isObject(parameters[0]) && typeof parameters[0].gasPrice !== 'undefined'; + return isObject(parameters[0]) && typeof parameters[0].gasPrice !== 'undefined'; } /** diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index 901c96eb9af..3288dec24a1 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -20,7 +20,7 @@ * @date 2018 */ -import _ from 'underscore'; +import {isObject} from 'underscore'; export default class TransactionReceiptValidator { @@ -74,7 +74,7 @@ export default class TransactionReceiptValidator { isValidGasUsage(receipt, methodParameters) { let gasProvided = null; - if (_.isObject(methodParameters[0]) && methodParameters[0].gas) { + if (isObject(methodParameters[0]) && methodParameters[0].gas) { gasProvided = methodParameters[0].gas; } diff --git a/packages/web3-core-subscriptions/package-lock.json b/packages/web3-core-subscriptions/package-lock.json index 7dfa94a0423..bf14f2c92b5 100644 --- a/packages/web3-core-subscriptions/package-lock.json +++ b/packages/web3-core-subscriptions/package-lock.json @@ -4,1011 +4,21 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "requires": { - "tweetnacl": "^0.14.3" - } - }, "bn.js": { "version": "4.11.6", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" }, - "body-parser": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "~1.6.3", - "iconv-lite": "0.4.23", - "on-finished": "~2.3.0", - "qs": "6.5.2", - "raw-body": "2.3.3", - "type-is": "~1.6.16" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "browserify-sha3": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", - "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", - "requires": { - "js-sha3": "^0.3.1" - } - }, - "buffer-to-arraybuffer": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", - "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "combined-stream": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", - "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cors": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", - "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "requires": { - "mimic-response": "^1.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "dom-walk": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", - "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "elliptic": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", - "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "eth-lib": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", - "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "keccakjs": "^0.2.1", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", - "xhr-request-promise": "^0.1.2" - } - }, - "ethjs-unit": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", - "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", - "requires": { - "bn.js": "4.11.6", - "number-to-bn": "1.7.0" - } - }, "eventemitter3": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" }, - "express": { - "version": "4.16.4", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", - "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.3", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.4", - "qs": "6.5.2", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.2", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "finalhandler": { - "version": "1.1.1", - "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "requires": { - "is-callable": "^1.1.3" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" - }, - "dependencies": { - "combined-stream": { - "version": "1.0.6", - "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "requires": { - "delayed-stream": "~1.0.0" - } - } - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "global": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", - "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", - "requires": { - "min-document": "^2.19.0", - "process": "~0.5.1" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", - "requires": { - "ajv": "^5.3.0", - "har-schema": "^2.0.0" - } - }, - "hash.js": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", - "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "http-errors": { - "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" - }, - "is-function": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", - "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" - }, - "is-hex-prefixed": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "js-sha3": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", - "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "keccakjs": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", - "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", - "requires": { - "browserify-sha3": "^0.0.1", - "sha3": "^1.1.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - }, - "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" - }, - "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", - "requires": { - "mime-db": "~1.36.0" - } - }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, - "min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", - "requires": { - "dom-walk": "^0.1.0" - } - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "nan": { - "version": "2.10.0", - "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" - }, - "nano-json-stream-parser": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", - "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, - "number-to-bn": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", - "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", - "requires": { - "bn.js": "4.11.6", - "strip-hex-prefix": "1.0.0" - } - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "parse-headers": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", - "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", - "requires": { - "for-each": "^0.3.2", - "trim": "0.0.1" - } - }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "process": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", - "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" - }, - "proxy-addr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.8.0" - } - }, - "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "query-string": { - "version": "5.1.1", - "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", - "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", - "requires": { - "decode-uri-component": "^0.2.0", - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - } - }, - "randomhex": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", - "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" - }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.3", - "iconv-lite": "0.4.23", - "unpipe": "1.0.0" - } - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, - "servify": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", - "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", - "requires": { - "body-parser": "^1.16.0", - "cors": "^2.8.1", - "express": "^4.14.0", - "request": "^2.79.0", - "xhr": "^2.3.3" - } - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, - "sha3": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", - "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", - "requires": { - "nan": "2.10.0" - } - }, - "simple-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", - "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" - }, - "simple-get": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", - "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", - "requires": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, - "sshpk": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", - "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" - }, - "strip-hex-prefix": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", - "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", - "requires": { - "is-hex-prefixed": "1.0.0" - } - }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" - }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - } - }, - "trim": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", - "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" - }, "underscore": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "url-set-query": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", - "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" - }, - "utf8": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", - "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "web3-core-helpers": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", @@ -1049,65 +59,908 @@ "utf8": "2.1.1" }, "dependencies": { + "accepts": { + "version": "1.3.5", + "bundled": true, + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "bundled": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "bundled": true + }, + "asn1": { + "version": "0.2.4", + "bundled": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "bundled": true + }, + "async-limiter": { + "version": "1.0.0", + "bundled": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true + }, + "aws-sign2": { + "version": "0.7.0", + "bundled": true + }, + "aws4": { + "version": "1.8.0", + "bundled": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "bundled": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "bundled": true + }, + "body-parser": { + "version": "1.18.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "bundled": true + }, + "browserify-sha3": { + "version": "0.0.1", + "bundled": true, + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "bundled": true + }, + "bytes": { + "version": "3.0.0", + "bundled": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true + }, + "co": { + "version": "4.6.0", + "bundled": true + }, + "combined-stream": { + "version": "1.0.7", + "bundled": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "bundled": true + }, + "content-type": { + "version": "1.0.4", + "bundled": true + }, + "cookie": { + "version": "0.3.1", + "bundled": true + }, + "cookie-signature": { + "version": "1.0.6", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "cors": { + "version": "2.8.4", + "bundled": true, + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "bundled": true + }, + "decompress-response": { + "version": "3.3.0", + "bundled": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true + }, + "depd": { + "version": "1.1.2", + "bundled": true + }, + "destroy": { + "version": "1.0.4", + "bundled": true + }, + "dom-walk": { + "version": "0.1.1", + "bundled": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "bundled": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "bundled": true + }, + "elliptic": { + "version": "6.4.1", + "bundled": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "bundled": true + }, + "escape-html": { + "version": "1.0.3", + "bundled": true + }, + "etag": { + "version": "1.8.1", + "bundled": true + }, + "eth-lib": { + "version": "0.1.27", + "bundled": true, + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "express": { + "version": "4.16.4", + "bundled": true, + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "bundled": true + }, + "extsprintf": { + "version": "1.3.0", + "bundled": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "bundled": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "bundled": true + }, + "finalhandler": { + "version": "1.1.1", + "bundled": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "bundled": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true + }, + "form-data": { + "version": "2.3.3", + "bundled": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "bundled": true + }, + "fresh": { + "version": "0.5.2", + "bundled": true + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "bundled": true, + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "bundled": true + }, + "har-validator": { + "version": "5.1.0", + "bundled": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "bundled": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "bundled": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.2.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "bundled": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "ipaddr.js": { + "version": "1.8.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-function": { + "version": "1.0.1", + "bundled": true + }, + "is-hex-prefixed": { + "version": "1.0.0", + "bundled": true + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true + }, + "js-sha3": { + "version": "0.3.1", + "bundled": true + }, + "jsbn": { + "version": "0.1.1", + "bundled": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "bundled": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true + }, + "jsprim": { + "version": "1.4.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "bundled": true, + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "bundled": true + }, + "merge-descriptors": { + "version": "1.0.1", + "bundled": true + }, + "methods": { + "version": "1.1.2", + "bundled": true + }, + "mime": { + "version": "1.4.1", + "bundled": true + }, + "mime-db": { + "version": "1.36.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.20", + "bundled": true, + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "bundled": true + }, + "min-document": { + "version": "2.19.0", + "bundled": true, + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "bundled": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "bundled": true + }, + "ms": { + "version": "2.0.0", + "bundled": true + }, + "nan": { + "version": "2.10.0", + "bundled": true + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "bundled": true + }, + "negotiator": { + "version": "0.6.1", + "bundled": true + }, + "number-to-bn": { + "version": "1.7.0", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "on-finished": { + "version": "2.3.0", + "bundled": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "bundled": true, + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "bundled": true + }, + "path-to-regexp": { + "version": "0.1.7", + "bundled": true + }, + "performance-now": { + "version": "2.1.0", + "bundled": true + }, + "process": { + "version": "0.5.2", + "bundled": true + }, + "proxy-addr": { + "version": "2.0.4", + "bundled": true, + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "bundled": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.5.2", + "bundled": true + }, + "query-string": { + "version": "5.1.1", + "bundled": true, + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "bundled": true + }, + "range-parser": { + "version": "1.2.0", + "bundled": true + }, + "raw-body": { + "version": "2.3.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "bundled": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true + }, + "send": { + "version": "0.16.2", + "bundled": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "bundled": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "bundled": true, + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "bundled": true + }, + "sha3": { + "version": "1.2.2", + "bundled": true, + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "bundled": true + }, + "simple-get": { + "version": "2.8.1", + "bundled": true, + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "bundled": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "bundled": true + }, + "strict-uri-encode": { + "version": "1.1.0", + "bundled": true + }, + "strip-hex-prefix": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "bundled": true + }, + "tough-cookie": { + "version": "2.4.3", + "bundled": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "bundled": true + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true + }, + "type-is": { + "version": "1.6.16", + "bundled": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "ultron": { + "version": "1.1.1", + "bundled": true + }, "underscore": { "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "bundled": true + }, + "unpipe": { + "version": "1.0.0", + "bundled": true + }, + "url-set-query": { + "version": "1.0.0", + "bundled": true + }, + "utf8": { + "version": "2.1.1", + "bundled": true + }, + "utils-merge": { + "version": "1.0.1", + "bundled": true + }, + "uuid": { + "version": "3.3.2", + "bundled": true + }, + "vary": { + "version": "1.1.2", + "bundled": true + }, + "verror": { + "version": "1.10.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "ws": { + "version": "3.3.3", + "bundled": true, + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "bundled": true, + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "bundled": true, + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "bundled": true, + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xtend": { + "version": "4.0.1", + "bundled": true } } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - }, - "xhr": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", - "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", - "requires": { - "global": "~4.3.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "xhr-request": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", - "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", - "requires": { - "buffer-to-arraybuffer": "^0.0.5", - "object-assign": "^4.1.1", - "query-string": "^5.0.1", - "simple-get": "^2.7.0", - "timed-out": "^4.0.1", - "url-set-query": "^1.0.0", - "xhr": "^2.0.4" - } - }, - "xhr-request-promise": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", - "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", - "requires": { - "xhr-request": "^1.0.1" - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" } } } diff --git a/packages/web3-core-subscriptions/src/Subscription.js b/packages/web3-core-subscriptions/src/Subscription.js index 076cd582518..c5bc0c94e06 100644 --- a/packages/web3-core-subscriptions/src/Subscription.js +++ b/packages/web3-core-subscriptions/src/Subscription.js @@ -20,7 +20,7 @@ * @date 2018 */ -import _ from 'underscore'; +import {isArray, isFunction} from 'underscore'; import EventEmitter from 'eventemitter3'; export default class Subscription extends EventEmitter { @@ -69,7 +69,7 @@ export default class Subscription extends EventEmitter { this.reconnect(callback); } - if (_.isFunction(callback)) { + if (isFunction(callback)) { callback(error, null); } @@ -92,7 +92,7 @@ export default class Subscription extends EventEmitter { * @callback callback callback(error, result) */ handleSubscriptionResponse(response, callback) { - if (!_.isArray(response)) { + if (!isArray(response)) { response = [response]; } @@ -101,7 +101,7 @@ export default class Subscription extends EventEmitter { this.emit('data', formattedOutput); - if (_.isFunction(callback)) { + if (isFunction(callback)) { callback(false, formattedOutput); } }); @@ -131,7 +131,7 @@ export default class Subscription extends EventEmitter { }).catch(error => { this.emit('error', error); - if (_.isFunction(callback)) { + if (isFunction(callback)) { callback(error, null); } }); @@ -159,14 +159,14 @@ export default class Subscription extends EventEmitter { if (!response) { this.subscriptionId = null; - if (_.isFunction(callback)) { + if (isFunction(callback)) { callback(true, false); } return true; } - if (_.isFunction(callback)) { + if (isFunction(callback)) { callback(false, true); } diff --git a/packages/web3-core/src/AbstractWeb3Module.js b/packages/web3-core/src/AbstractWeb3Module.js index be87e28618d..dc953186a4e 100644 --- a/packages/web3-core/src/AbstractWeb3Module.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -20,7 +20,7 @@ * @date 2018 */ -import _ from 'underscore'; +import {isArray, isObject} from 'underscore'; export default class AbstractWeb3Module { @@ -125,7 +125,7 @@ export default class AbstractWeb3Module { * @returns {Boolean} */ isSameProvider(provider) { - if (_.isObject(provider)) { + if (isObject(provider)) { if (this.currentProvider.provider.constructor.name === provider.constructor.name) { return this.currentProvider.host === provider.host; } @@ -193,7 +193,7 @@ export default class AbstractWeb3Module { } afterExecution(response) { - if (_.isArray(response)) { + if (isArray(response)) { response = response.map(responseItem => { if (method.outputFormatter && responseItem) { return method.outputFormatter(responseItem); diff --git a/packages/web3-eth-abi/package-lock.json b/packages/web3-eth-abi/package-lock.json index 16f43d5a3bb..b385334ddf9 100644 --- a/packages/web3-eth-abi/package-lock.json +++ b/packages/web3-eth-abi/package-lock.json @@ -1,27 +1,252 @@ { - "requires": true, + "name": "web3-eth-abi", + "version": "1.0.0-beta.36", "lockfileVersion": 1, + "requires": true, "dependencies": { "@types/node": { "version": "10.5.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.2.tgz", "integrity": "sha512-m9zXmifkZsMHZBOyxZWilMwmTlpC8x5Ty360JKTiXvlXZfBWYpsg9ZZvP/Ye+iZUh+Q+MxDLjItVTWIsfwz+8Q==" }, + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, "aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + }, + "dependencies": { + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + } + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, "elliptic": { "version": "6.3.3", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", @@ -33,6 +258,51 @@ "inherits": "^2.0.1" } }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + }, + "dependencies": { + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + } + } + }, "ethers": { "version": "4.0.0-beta.1", "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.1.tgz", @@ -50,6 +320,171 @@ "xmlhttprequest": "1.8.0" } }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } + } + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, "hash.js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", @@ -59,45 +494,667 @@ "minimalistic-assert": "^1.0.0" } }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, "js-sha3": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + } + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "scrypt-js": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, "setimmediate": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, "uuid": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, "xmlhttprequest": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" } } } diff --git a/packages/web3-eth-abi/src/ABICoder.js b/packages/web3-eth-abi/src/ABICoder.js index 60eeaf4f3c4..b97b254e93d 100644 --- a/packages/web3-eth-abi/src/ABICoder.js +++ b/packages/web3-eth-abi/src/ABICoder.js @@ -21,11 +21,11 @@ * @date 2018 */ -import _ from 'underscore'; +import {isArray, isObject} from 'underscore'; import {AbiCoder as EthersAbi} from 'ethers/utils/abi-coder'; const ethersAbiCoder = new EthersAbi((type, value) => { - if (type.match(/^u?int/) && !_.isArray(value) && (!_.isObject(value) || value.constructor.name !== 'BN')) { + if (type.match(/^u?int/) && !isArray(value) && (!isObject(value) || value.constructor.name !== 'BN')) { return value.toString(); } return value; @@ -56,7 +56,7 @@ export default class ABICoder { * @returns {String} encoded function name */ encodeFunctionSignature(functionName) { - if (_.isObject(functionName)) { + if (isObject(functionName)) { functionName = this.utils._jsonInterfaceMethodToString(functionName); } @@ -73,7 +73,7 @@ export default class ABICoder { * @returns {String} encoded function name */ encodeEventSignature(functionName) { - if (_.isObject(functionName)) { + if (isObject(functionName)) { functionName = this.utils._jsonInterfaceMethodToString(functionName); } @@ -260,7 +260,7 @@ export default class ABICoder { returnValue[i] = decodedValue; - if (_.isObject(output) && output.name) { + if (isObject(output) && output.name) { returnValue[output.name] = decodedValue; } @@ -283,7 +283,7 @@ export default class ABICoder { */ decodeLog(inputs, data, topics) { const _this = this; - topics = _.isArray(topics) ? topics : [topics]; + topics = isArray(topics) ? topics : [topics]; data = data || ''; diff --git a/packages/web3-eth-accounts/package-lock.json b/packages/web3-eth-accounts/package-lock.json index 7da3bc7490d..f70d5d83e47 100644 --- a/packages/web3-eth-accounts/package-lock.json +++ b/packages/web3-eth-accounts/package-lock.json @@ -238,6 +238,11 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -653,6 +658,11 @@ "statuses": ">= 1.4.0 < 2" } }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -871,6 +881,14 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -1257,6 +1275,14 @@ "mime-types": "~2.1.18" } }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", @@ -1307,6 +1333,17 @@ "extsprintf": "^1.2.0" } }, + "web3-core": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.36.tgz", + "integrity": "sha512-C2QW9CMMRZdYAiKiLkMrKRSp+gekSqTDgZTNvlxAdN1hXn4d9UmcmWSJXOmIHqr5N2ISbRod+bW+qChODxVE3Q==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-requestmanager": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, "web3-core-helpers": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", @@ -1352,6 +1389,25 @@ "eventemitter3": "1.1.1" } }, + "web3-core-requestmanager": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.36.tgz", + "integrity": "sha512-/CHuaMbiMDu1v8ANGYI7yFCnh1GaCWx5pKnUPJf+QTk2xAAw+Bvd97yZJIWPOK5AOPUIzxgwx9Ob/5ln6mTmYA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-providers-http": "1.0.0-beta.36", + "web3-providers-ipc": "1.0.0-beta.36", + "web3-providers-ws": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, "web3-core-subscriptions": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", @@ -1385,6 +1441,49 @@ } } }, + "web3-providers-http": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.36.tgz", + "integrity": "sha512-KLSqMS59nRdpet9B0B64MKgtM3n9wAHTcAHJ03hv79avQNTjHxtjZm0ttcjcFUPpWDgTCtcYCa7tqaYo9Pbeog==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.36.tgz", + "integrity": "sha512-iEUrmdd2CzoWgp+75/ydom/1IaoLw95qkAzsgwjjZp1waDncHP/cvVGX74+fbUx4hRaPdchyzxCQfNpgLDmNjQ==", + "requires": { + "oboe": "2.1.3", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-providers-ws": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.36.tgz", + "integrity": "sha512-wAnENuZx75T5ZSrT2De2LOaUuPf2yRjq1VfcbD7+Zd79F3DZZLBJcPyCNVQ1U0fAXt0wfgCKl7sVw5pffqR9Bw==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, "web3-utils": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", @@ -1425,6 +1524,16 @@ } } }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -1473,10 +1582,23 @@ "xhr-request": "^1.0.1" } }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" } } } diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json index bca99db81c6..ca72969ca0f 100644 --- a/packages/web3-eth-accounts/package.json +++ b/packages/web3-eth-accounts/package.json @@ -15,7 +15,6 @@ "web3-core": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", - "web3-providers": "1.0.0-beta.36", "web3-utils": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index 1ea677a9137..d55f5d1d6bb 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -20,12 +20,12 @@ * @date 2017 */ -import _ from "underscore"; -import Account from "eth-lib/lib/account"; -import Hash from "eth-lib/lib/hash"; -import RLP from "eth-lib/lib/rlp"; -import Nat from "eth-lib/lib/nat"; -import Bytes from "eth-lib/lib/bytes"; +import {isUndefined, isNull, extend, isObject, isBoolean, isString, has} from 'underscore'; +import Account from 'eth-lib/lib/account'; +import Hash from 'eth-lib/lib/hash'; +import RLP from 'eth-lib/lib/rlp'; +import Nat from 'eth-lib/lib/nat'; +import Bytes from 'eth-lib/lib/bytes'; import scryptsy from 'scrypt.js'; import uuid from 'uuid'; import {AbstractWeb3Module} from 'web3-core'; @@ -33,7 +33,7 @@ import {AbstractWeb3Module} from 'web3-core'; const cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); const isNot = value => { - return (_.isUndefined(value) || _.isNull(value)); + return (isUndefined(value) || isNull(value)); }; const trimLeadingZero = hex => { @@ -176,7 +176,7 @@ export default class Accounts extends AbstractWeb3Module { function signed(tx) { if (!tx.gas && !tx.gasLimit) { - error = new Error('"gas" is missing'); + error = new Error('gas is missing'); } if (tx.nonce < 0 || @@ -207,14 +207,14 @@ export default class Accounts extends AbstractWeb3Module { transaction.to.toLowerCase(), Bytes.fromNat(transaction.value), transaction.data, - Bytes.fromNat(transaction.chainId || "0x1"), - "0x", - "0x"]); + Bytes.fromNat(transaction.chainId || '0x1'), + '0x', + '0x']); const hash = Hash.keccak256(rlpEncoded); - const signature = Account.makeSigner(Nat.toNumber(transaction.chainId || "0x1") * 2 + 35)(Hash.keccak256(rlpEncoded), privateKey); + const signature = Account.makeSigner(Nat.toNumber(transaction.chainId || '0x1') * 2 + 35)(Hash.keccak256(rlpEncoded), privateKey); const rawTx = RLP.decode(rlpEncoded).slice(0, 6).concat(Account.decodeSignature(signature)); @@ -255,9 +255,9 @@ export default class Accounts extends AbstractWeb3Module { isNot(tx.nonce) ? _this.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce ]).then(args => { if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) { - throw new Error(`One of the values "chainId", "gasPrice", or "nonce" couldn't be fetched: ${JSON.stringify(args)}`); + throw new Error(`One of the values 'chainId', 'gasPrice', or 'nonce' couldn't be fetched: ${JSON.stringify(args)}`); } - return signed(_.extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2]})); + return signed(extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2]})); }); } @@ -275,7 +275,7 @@ export default class Accounts extends AbstractWeb3Module { const values = RLP.decode(rawTx); const signature = Account.encodeSignature(values.slice(6, 9)); const recovery = Bytes.toNumber(values[6]); - const extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), "0x", "0x"]; + const extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), '0x', '0x']; const signingData = values.slice(0, 6).concat(extraData); const signingDataHex = RLP.encode(signingData); @@ -342,7 +342,7 @@ export default class Accounts extends AbstractWeb3Module { const args = [].slice.apply(arguments); - if (_.isObject(message)) { + if (isObject(message)) { return this.recover(message.messageHash, Account.encodeSignature([message.v, message.r, message.s]), true); } @@ -352,7 +352,7 @@ export default class Accounts extends AbstractWeb3Module { if (args.length >= 4) { preFixed = args.slice(-1)[0]; - preFixed = _.isBoolean(preFixed) ? !!preFixed : false; + preFixed = isBoolean(preFixed) ? !!preFixed : false; return this.recover(message, Account.encodeSignature(args.slice(1, 4)), preFixed); // v, r, s } @@ -375,11 +375,11 @@ export default class Accounts extends AbstractWeb3Module { decrypt(v3Keystore, password, nonStrict) { /* jshint maxcomplexity: 10 */ - if (!_.isString(password)) { + if (!isString(password)) { throw new Error('No password given.'); } - const json = (_.isObject(v3Keystore)) ? v3Keystore : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore); + const json = (isObject(v3Keystore)) ? v3Keystore : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore); if (json.version !== 3) { throw new Error('Not a valid V3 wallet'); @@ -496,7 +496,7 @@ class Wallet { constructor(accounts) { this._accounts = accounts; this.length = 0; - this.defaultKeyName = "web3js_wallet"; + this.defaultKeyName = 'web3js_wallet'; } /** @@ -510,7 +510,7 @@ class Wallet { * @returns {*} */ _findSafeIndex(pointer = 0) { - if (_.has(this, pointer)) { + if (has(this, pointer)) { return this._findSafeIndex(pointer + 1); } else { return pointer; @@ -566,7 +566,7 @@ class Wallet { */ add(account) { - if (_.isString(account)) { + if (isString(account)) { account = this._accounts.privateKeyToAccount(account); } if (!this[account.address]) { diff --git a/packages/web3-eth-contract/package-lock.json b/packages/web3-eth-contract/package-lock.json index 5c55a0bfbf2..2107463d52b 100644 --- a/packages/web3-eth-contract/package-lock.json +++ b/packages/web3-eth-contract/package-lock.json @@ -4,11 +4,6 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@types/node": { - "version": "10.11.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.7.tgz", - "integrity": "sha512-yOxFfkN9xUFLyvWaeYj90mlqTJ41CsQzWKS3gXdOMOyPVacUsymejKxJ4/pMW7exouubuEeZLJawGgcNGYlTeg==" - }, "accepts": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", @@ -18,11 +13,6 @@ "negotiator": "0.6.1" } }, - "aes-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" - }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -168,6 +158,11 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -288,55 +283,6 @@ "xhr-request-promise": "^0.1.2" } }, - "ethers": { - "version": "4.0.0-beta.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.1.tgz", - "integrity": "sha512-SoYhktEbLxf+fiux5SfCEwdzWENMvgIbMZD90I62s4GZD9nEjgEWy8ZboI3hck193Vs0bDoTohDISx84f2H2tw==", - "requires": { - "@types/node": "^10.3.2", - "aes-js": "3.0.0", - "bn.js": "^4.4.0", - "elliptic": "6.3.3", - "hash.js": "1.1.3", - "js-sha3": "0.5.7", - "scrypt-js": "2.0.3", - "setimmediate": "1.0.4", - "uuid": "2.0.1", - "xmlhttprequest": "1.8.0" - }, - "dependencies": { - "elliptic": { - "version": "6.3.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", - "integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "inherits": "^2.0.1" - } - }, - "hash.js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" - } - }, - "js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" - }, - "uuid": { - "version": "2.0.1", - "resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", - "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" - } - } - }, "ethjs-unit": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", @@ -450,23 +396,13 @@ "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "requires": { "asynckit": "^0.4.0", - "combined-stream": "1.0.6", + "combined-stream": "^1.0.6", "mime-types": "^2.1.12" - }, - "dependencies": { - "combined-stream": { - "version": "1.0.6", - "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "requires": { - "delayed-stream": "~1.0.0" - } - } } }, "forwarded": { @@ -540,6 +476,11 @@ "statuses": ">= 1.4.0 < 2" } }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -659,16 +600,16 @@ "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" }, "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" }, "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", "requires": { - "mime-db": "~1.36.0" + "mime-db": "~1.37.0" } }, "mimic-response": { @@ -733,6 +674,14 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -870,11 +819,6 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "scrypt-js": { - "version": "2.0.3", - "resolved": "http://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", - "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" - }, "send": { "version": "0.16.2", "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", @@ -925,11 +869,6 @@ "xhr": "^2.3.3" } }, - "setimmediate": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", - "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" - }, "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", @@ -1033,6 +972,14 @@ "mime-types": "~2.1.18" } }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", @@ -1083,6 +1030,17 @@ "extsprintf": "^1.2.0" } }, + "web3-core": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.36.tgz", + "integrity": "sha512-C2QW9CMMRZdYAiKiLkMrKRSp+gekSqTDgZTNvlxAdN1hXn4d9UmcmWSJXOmIHqr5N2ISbRod+bW+qChODxVE3Q==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-requestmanager": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, "web3-core-helpers": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", @@ -1128,6 +1086,25 @@ "eventemitter3": "1.1.1" } }, + "web3-core-requestmanager": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.36.tgz", + "integrity": "sha512-/CHuaMbiMDu1v8ANGYI7yFCnh1GaCWx5pKnUPJf+QTk2xAAw+Bvd97yZJIWPOK5AOPUIzxgwx9Ob/5ln6mTmYA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-providers-http": "1.0.0-beta.36", + "web3-providers-ipc": "1.0.0-beta.36", + "web3-providers-ws": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, "web3-core-subscriptions": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", @@ -1147,18 +1124,1004 @@ }, "web3-eth-abi": { "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.36.tgz", - "integrity": "sha512-fBfW+7hvA0rxEMV45fO7JU+0R32ayT7aRwG9Cl6NW2/QvhFeME2qVbMIWw0q5MryPZGIN8A6366hKNuWvVidDg==", "requires": { "ethers": "4.0.0-beta.1", - "underscore": "1.8.3", + "underscore": "1.9.1", "web3-utils": "1.0.0-beta.36" }, "dependencies": { + "@types/node": { + "version": "10.5.2", + "bundled": true + }, + "accepts": { + "version": "1.3.5", + "bundled": true, + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "aes-js": { + "version": "3.0.0", + "bundled": true + }, + "ajv": { + "version": "5.5.2", + "bundled": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "bundled": true + }, + "asn1": { + "version": "0.2.4", + "bundled": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "bundled": true + }, + "async-limiter": { + "version": "1.0.0", + "bundled": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true + }, + "aws-sign2": { + "version": "0.7.0", + "bundled": true + }, + "aws4": { + "version": "1.8.0", + "bundled": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "bundled": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.8", + "bundled": true + }, + "body-parser": { + "version": "1.18.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "bundled": true + }, + "browserify-sha3": { + "version": "0.0.1", + "bundled": true, + "requires": { + "js-sha3": "^0.3.1" + }, + "dependencies": { + "js-sha3": { + "version": "0.3.1", + "bundled": true + } + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "bundled": true + }, + "bytes": { + "version": "3.0.0", + "bundled": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true + }, + "co": { + "version": "4.6.0", + "bundled": true + }, + "combined-stream": { + "version": "1.0.7", + "bundled": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "bundled": true + }, + "content-type": { + "version": "1.0.4", + "bundled": true + }, + "cookie": { + "version": "0.3.1", + "bundled": true + }, + "cookie-signature": { + "version": "1.0.6", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "cors": { + "version": "2.8.4", + "bundled": true, + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "bundled": true + }, + "decompress-response": { + "version": "3.3.0", + "bundled": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true + }, + "depd": { + "version": "1.1.2", + "bundled": true + }, + "destroy": { + "version": "1.0.4", + "bundled": true + }, + "dom-walk": { + "version": "0.1.1", + "bundled": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "bundled": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "bundled": true + }, + "elliptic": { + "version": "6.3.3", + "bundled": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "encodeurl": { + "version": "1.0.2", + "bundled": true + }, + "escape-html": { + "version": "1.0.3", + "bundled": true + }, + "etag": { + "version": "1.8.1", + "bundled": true + }, + "eth-lib": { + "version": "0.1.27", + "bundled": true, + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + }, + "dependencies": { + "elliptic": { + "version": "6.4.1", + "bundled": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + } + } + }, + "ethers": { + "version": "4.0.0-beta.1", + "bundled": true, + "requires": { + "@types/node": "^10.3.2", + "aes-js": "3.0.0", + "bn.js": "^4.4.0", + "elliptic": "6.3.3", + "hash.js": "1.1.3", + "js-sha3": "0.5.7", + "scrypt-js": "2.0.3", + "setimmediate": "1.0.4", + "uuid": "2.0.1", + "xmlhttprequest": "1.8.0" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "bundled": true + } + } + }, + "express": { + "version": "4.16.4", + "bundled": true, + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "extend": { + "version": "3.0.2", + "bundled": true + }, + "extsprintf": { + "version": "1.3.0", + "bundled": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "bundled": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "bundled": true + }, + "finalhandler": { + "version": "1.1.1", + "bundled": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "for-each": { + "version": "0.3.3", + "bundled": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true + }, + "form-data": { + "version": "2.3.3", + "bundled": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "bundled": true + }, + "fresh": { + "version": "0.5.2", + "bundled": true + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "bundled": true, + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "bundled": true + }, + "har-validator": { + "version": "5.1.0", + "bundled": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.3", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "bundled": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "bundled": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.2.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "bundled": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "ipaddr.js": { + "version": "1.8.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-function": { + "version": "1.0.1", + "bundled": true + }, + "is-hex-prefixed": { + "version": "1.0.0", + "bundled": true + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true + }, + "js-sha3": { + "version": "0.5.7", + "bundled": true + }, + "jsbn": { + "version": "0.1.1", + "bundled": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "bundled": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true + }, + "jsprim": { + "version": "1.4.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "bundled": true, + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "bundled": true + }, + "merge-descriptors": { + "version": "1.0.1", + "bundled": true + }, + "methods": { + "version": "1.1.2", + "bundled": true + }, + "mime": { + "version": "1.4.1", + "bundled": true + }, + "mime-db": { + "version": "1.36.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.20", + "bundled": true, + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "bundled": true + }, + "min-document": { + "version": "2.19.0", + "bundled": true, + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "bundled": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "bundled": true + }, + "ms": { + "version": "2.0.0", + "bundled": true + }, + "nan": { + "version": "2.10.0", + "bundled": true + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "bundled": true + }, + "negotiator": { + "version": "0.6.1", + "bundled": true + }, + "number-to-bn": { + "version": "1.7.0", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "bundled": true + } + } + }, + "oauth-sign": { + "version": "0.9.0", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "on-finished": { + "version": "2.3.0", + "bundled": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "bundled": true, + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "bundled": true + }, + "path-to-regexp": { + "version": "0.1.7", + "bundled": true + }, + "performance-now": { + "version": "2.1.0", + "bundled": true + }, + "process": { + "version": "0.5.2", + "bundled": true + }, + "proxy-addr": { + "version": "2.0.4", + "bundled": true, + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "bundled": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.5.2", + "bundled": true + }, + "query-string": { + "version": "5.1.1", + "bundled": true, + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "bundled": true + }, + "range-parser": { + "version": "1.2.0", + "bundled": true + }, + "raw-body": { + "version": "2.3.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "bundled": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "uuid": { + "version": "3.3.2", + "bundled": true + } + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true + }, + "scrypt-js": { + "version": "2.0.3", + "bundled": true + }, + "send": { + "version": "0.16.2", + "bundled": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "serve-static": { + "version": "1.13.2", + "bundled": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "bundled": true, + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setimmediate": { + "version": "1.0.4", + "bundled": true + }, + "setprototypeof": { + "version": "1.1.0", + "bundled": true + }, + "sha3": { + "version": "1.2.2", + "bundled": true, + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "bundled": true + }, + "simple-get": { + "version": "2.8.1", + "bundled": true, + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "bundled": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "bundled": true + }, + "strict-uri-encode": { + "version": "1.1.0", + "bundled": true + }, + "strip-hex-prefix": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "bundled": true + }, + "tough-cookie": { + "version": "2.4.3", + "bundled": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "bundled": true + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true + }, + "type-is": { + "version": "1.6.16", + "bundled": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "ultron": { + "version": "1.1.1", + "bundled": true + }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "bundled": true + }, + "unpipe": { + "version": "1.0.0", + "bundled": true + }, + "url-set-query": { + "version": "1.0.0", + "bundled": true + }, + "utf8": { + "version": "2.1.1", + "bundled": true + }, + "utils-merge": { + "version": "1.0.1", + "bundled": true + }, + "uuid": { + "version": "2.0.1", + "bundled": true + }, + "vary": { + "version": "1.1.2", + "bundled": true + }, + "verror": { + "version": "1.10.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "bundled": true + }, + "underscore": { + "version": "1.8.3", + "bundled": true + } + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "ws": { + "version": "3.3.3", + "bundled": true, + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "bundled": true, + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "bundled": true, + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "bundled": true, + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xmlhttprequest": { + "version": "1.8.0", + "bundled": true + }, + "xtend": { + "version": "4.0.1", + "bundled": true } } }, @@ -1171,6 +2134,49 @@ "web3-utils": "1.0.0-beta.36" } }, + "web3-providers-http": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.36.tgz", + "integrity": "sha512-KLSqMS59nRdpet9B0B64MKgtM3n9wAHTcAHJ03hv79avQNTjHxtjZm0ttcjcFUPpWDgTCtcYCa7tqaYo9Pbeog==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.36.tgz", + "integrity": "sha512-iEUrmdd2CzoWgp+75/ydom/1IaoLw95qkAzsgwjjZp1waDncHP/cvVGX74+fbUx4hRaPdchyzxCQfNpgLDmNjQ==", + "requires": { + "oboe": "2.1.3", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-providers-ws": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.36.tgz", + "integrity": "sha512-wAnENuZx75T5ZSrT2De2LOaUuPf2yRjq1VfcbD7+Zd79F3DZZLBJcPyCNVQ1U0fAXt0wfgCKl7sVw5pffqR9Bw==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, "web3-utils": { "version": "1.0.0-beta.36", "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", @@ -1192,6 +2198,16 @@ } } }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -1240,15 +2256,23 @@ "xhr-request": "^1.0.1" } }, - "xmlhttprequest": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", - "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" } } } diff --git a/packages/web3-eth-contract/package.json b/packages/web3-eth-contract/package.json index 795f1fdd147..65cbef2e557 100644 --- a/packages/web3-eth-contract/package.json +++ b/packages/web3-eth-contract/package.json @@ -8,12 +8,12 @@ "main": "src/index.js", "dependencies": { "underscore": "1.9.1", - "web3-core-promievent": "1.0.0-beta.36", - "web3-core-method": "1.0.0-beta.36", - "web3-eth-abi": "1.0.0-beta.36", - "web3-utils": "1.0.0-beta.36", "web3-core": "1.0.0-beta.36", "web3-core-helpers": "1.0.0-beta.36", - "web3-core-subscriptions": "1.0.0-beta.36" + "web3-core-method": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-eth-abi": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" } } diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 431f8892eef..e73f4fd5a03 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -20,7 +20,7 @@ * @date 2018 */ -import PromiEvent from 'web3-core-promievent'; +import {PromiEvent} from 'web3-core-promievent'; import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; import Utils from 'web3-utils'; diff --git a/packages/web3-eth-ens/package-lock.json b/packages/web3-eth-ens/package-lock.json index dd41017582c..a0ff01c456d 100644 --- a/packages/web3-eth-ens/package-lock.json +++ b/packages/web3-eth-ens/package-lock.json @@ -1,7 +1,291 @@ { - "requires": true, + "name": "web3-eth-ens", + "version": "1.0.0-beta.36", "lockfileVersion": 1, + "requires": true, "dependencies": { + "@types/node": { + "version": "10.12.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.0.tgz", + "integrity": "sha512-3TUHC3jsBAB7qVRGxT6lWyYo2v96BMmD2PTcl47H25Lu7UXtFH/2qqmKiVrnel6Ne//0TFYf6uvNX+HW2FRkLQ==" + }, + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + }, + "dependencies": { + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + } + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, "eth-ens-namehash": { "version": "2.0.8", "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", @@ -11,6 +295,280 @@ "js-sha3": "^0.5.7" } }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethers": { + "version": "4.0.0-beta.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.1.tgz", + "integrity": "sha512-SoYhktEbLxf+fiux5SfCEwdzWENMvgIbMZD90I62s4GZD9nEjgEWy8ZboI3hck193Vs0bDoTohDISx84f2H2tw==", + "requires": { + "@types/node": "^10.3.2", + "aes-js": "3.0.0", + "bn.js": "^4.4.0", + "elliptic": "6.3.3", + "hash.js": "1.1.3", + "js-sha3": "0.5.7", + "scrypt-js": "2.0.3", + "setimmediate": "1.0.4", + "uuid": "2.0.1", + "xmlhttprequest": "1.8.0" + }, + "dependencies": { + "elliptic": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", + "integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "uuid": { + "version": "2.0.1", + "resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", + "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" + } + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, "idna-uts46-hx": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", @@ -19,20 +577,838 @@ "punycode": "2.1.0" } }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, "js-sha3": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" + }, + "mime-types": { + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", + "requires": { + "mime-db": "~1.37.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, "punycode": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=" }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "scrypt-js": { + "version": "2.0.3", + "resolved": "http://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", + "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setimmediate": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", + "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.36.tgz", + "integrity": "sha512-C2QW9CMMRZdYAiKiLkMrKRSp+gekSqTDgZTNvlxAdN1hXn4d9UmcmWSJXOmIHqr5N2ISbRod+bW+qChODxVE3Q==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-requestmanager": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-method": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.36.tgz", + "integrity": "sha512-dJsP3KkGaqBBSdxfzvLsYPOmVaSs1lR/3oKob/gtUYG7UyTnwquwliAc7OXj+gqRA2E/FHZcM83cWdl31ltdSA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-promievent": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.36.tgz", + "integrity": "sha512-RGIL6TjcOeJTullFLMurChPTsg94cPF6LI763y/sPYtXTDol1vVa+J5aGLp/4WW8v+s+1bSQO6zYq2ZtkbmtEQ==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "1.1.1" + } + }, + "web3-core-requestmanager": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.36.tgz", + "integrity": "sha512-/CHuaMbiMDu1v8ANGYI7yFCnh1GaCWx5pKnUPJf+QTk2xAAw+Bvd97yZJIWPOK5AOPUIzxgwx9Ob/5ln6mTmYA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-providers-http": "1.0.0-beta.36", + "web3-providers-ipc": "1.0.0-beta.36", + "web3-providers-ws": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-core-subscriptions": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", + "integrity": "sha512-/evyLQ8CMEYXC5aUCodDpmEnmGVYQxaIjiEIfA/85f9ifHkfzP1aOwCAjcsLsJWnwrWDagxSpjCYrDtnNabdEw==", + "requires": { + "eventemitter3": "1.1.1", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-abi": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.36.tgz", + "integrity": "sha512-fBfW+7hvA0rxEMV45fO7JU+0R32ayT7aRwG9Cl6NW2/QvhFeME2qVbMIWw0q5MryPZGIN8A6366hKNuWvVidDg==", + "requires": { + "ethers": "4.0.0-beta.1", + "underscore": "1.8.3", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-contract": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.36.tgz", + "integrity": "sha512-cywqcIrUsCW4fyqsHdOb24OCC8AnBol8kNiptI+IHRylyCjTNgr53bUbjrXWjmEnear90rO0QhAVjLB1a4iEbQ==", + "requires": { + "underscore": "1.8.3", + "web3-core": "1.0.0-beta.36", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-eth-abi": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-providers-http": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.36.tgz", + "integrity": "sha512-KLSqMS59nRdpet9B0B64MKgtM3n9wAHTcAHJ03hv79avQNTjHxtjZm0ttcjcFUPpWDgTCtcYCa7tqaYo9Pbeog==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.36.tgz", + "integrity": "sha512-iEUrmdd2CzoWgp+75/ydom/1IaoLw95qkAzsgwjjZp1waDncHP/cvVGX74+fbUx4hRaPdchyzxCQfNpgLDmNjQ==", + "requires": { + "oboe": "2.1.3", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-providers-ws": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.36.tgz", + "integrity": "sha512-wAnENuZx75T5ZSrT2De2LOaUuPf2yRjq1VfcbD7+Zd79F3DZZLBJcPyCNVQ1U0fAXt0wfgCKl7sVw5pffqR9Bw==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" } } } diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index 7d31aed7259..6445fb06833 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -17,7 +17,7 @@ * @date 2018 */ -import _ from 'underscore'; +import {isFunction} from 'underscore'; import namehash from 'eth-ens-namehash'; export default class Registry { @@ -85,14 +85,14 @@ export default class Registry { .then(receipt => { resolve(receipt); - if (_.isFunction(callback)) { + if (isFunction(callback)) { callback(false, receipt); } }) .catch(error => { reject(error); - if (_.isFunction(callback)) { + if (isFunction(callback)) { callback(error, null); } }); diff --git a/packages/web3-eth-iban/package-lock.json b/packages/web3-eth-iban/package-lock.json index 9b08a6a5503..b93ffb640f3 100644 --- a/packages/web3-eth-iban/package-lock.json +++ b/packages/web3-eth-iban/package-lock.json @@ -1,11 +1,1086 @@ { - "requires": true, + "name": "web3-eth-iban", + "version": "1.0.0-beta.36", "lockfileVersion": 1, + "requires": true, "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } + } + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" + }, + "mime-types": { + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", + "requires": { + "mime-db": "~1.37.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" } } } diff --git a/packages/web3-eth-personal/package-lock.json b/packages/web3-eth-personal/package-lock.json new file mode 100644 index 00000000000..aca74ffdf30 --- /dev/null +++ b/packages/web3-eth-personal/package-lock.json @@ -0,0 +1,2237 @@ +{ + "name": "web3-eth-personal", + "version": "1.0.0-beta.36", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" + }, + "mime-types": { + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", + "requires": { + "mime-db": "~1.37.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.36.tgz", + "integrity": "sha512-C2QW9CMMRZdYAiKiLkMrKRSp+gekSqTDgZTNvlxAdN1hXn4d9UmcmWSJXOmIHqr5N2ISbRod+bW+qChODxVE3Q==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-requestmanager": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-method": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.36.tgz", + "integrity": "sha512-dJsP3KkGaqBBSdxfzvLsYPOmVaSs1lR/3oKob/gtUYG7UyTnwquwliAc7OXj+gqRA2E/FHZcM83cWdl31ltdSA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-promievent": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.36.tgz", + "integrity": "sha512-RGIL6TjcOeJTullFLMurChPTsg94cPF6LI763y/sPYtXTDol1vVa+J5aGLp/4WW8v+s+1bSQO6zYq2ZtkbmtEQ==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "1.1.1" + } + }, + "web3-core-requestmanager": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.36.tgz", + "integrity": "sha512-/CHuaMbiMDu1v8ANGYI7yFCnh1GaCWx5pKnUPJf+QTk2xAAw+Bvd97yZJIWPOK5AOPUIzxgwx9Ob/5ln6mTmYA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-providers-http": "1.0.0-beta.36", + "web3-providers-ipc": "1.0.0-beta.36", + "web3-providers-ws": "1.0.0-beta.36" + } + }, + "web3-core-subscriptions": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", + "integrity": "sha512-/evyLQ8CMEYXC5aUCodDpmEnmGVYQxaIjiEIfA/85f9ifHkfzP1aOwCAjcsLsJWnwrWDagxSpjCYrDtnNabdEw==", + "requires": { + "eventemitter3": "1.1.1", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-net": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.0.0-beta.36.tgz", + "integrity": "sha512-BriXK0Pjr6Hc/VDq1Vn8vyOum4JB//wpCjgeGziFD6jC7Of8YaWC7AJYXje89OckzfcqX1aJyJlBwDpasNkAzQ==", + "requires": { + "web3-core": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-providers": { + "version": "1.0.0-beta.36", + "requires": { + "eventemitter3": "3.1.0", + "oboe": "2.1.4", + "underscore": "1.9.1", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "xhr2-cookies": "1.1.0" + }, + "dependencies": { + "accepts": { + "version": "1.3.5", + "bundled": true, + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "bundled": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "bundled": true + }, + "asn1": { + "version": "0.2.4", + "bundled": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "bundled": true + }, + "async-limiter": { + "version": "1.0.0", + "bundled": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true + }, + "aws-sign2": { + "version": "0.7.0", + "bundled": true + }, + "aws4": { + "version": "1.8.0", + "bundled": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "bundled": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "bundled": true + }, + "body-parser": { + "version": "1.18.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "bundled": true + }, + "browserify-sha3": { + "version": "0.0.1", + "bundled": true, + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "bundled": true + }, + "bytes": { + "version": "3.0.0", + "bundled": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true + }, + "co": { + "version": "4.6.0", + "bundled": true + }, + "combined-stream": { + "version": "1.0.7", + "bundled": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "bundled": true + }, + "content-type": { + "version": "1.0.4", + "bundled": true + }, + "cookie": { + "version": "0.3.1", + "bundled": true + }, + "cookie-signature": { + "version": "1.0.6", + "bundled": true + }, + "cookiejar": { + "version": "2.1.2", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "cors": { + "version": "2.8.4", + "bundled": true, + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "bundled": true + }, + "decompress-response": { + "version": "3.3.0", + "bundled": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true + }, + "depd": { + "version": "1.1.2", + "bundled": true + }, + "destroy": { + "version": "1.0.4", + "bundled": true + }, + "dom-walk": { + "version": "0.1.1", + "bundled": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "bundled": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "bundled": true + }, + "elliptic": { + "version": "6.4.1", + "bundled": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "bundled": true + }, + "escape-html": { + "version": "1.0.3", + "bundled": true + }, + "etag": { + "version": "1.8.1", + "bundled": true + }, + "eth-lib": { + "version": "0.1.27", + "bundled": true, + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "3.1.0", + "bundled": true + }, + "express": { + "version": "4.16.4", + "bundled": true, + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "extend": { + "version": "3.0.2", + "bundled": true + }, + "extsprintf": { + "version": "1.3.0", + "bundled": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "bundled": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "bundled": true + }, + "finalhandler": { + "version": "1.1.1", + "bundled": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "for-each": { + "version": "0.3.3", + "bundled": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true + }, + "form-data": { + "version": "2.3.3", + "bundled": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "bundled": true + }, + "fresh": { + "version": "0.5.2", + "bundled": true + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "bundled": true, + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "bundled": true + }, + "har-validator": { + "version": "5.1.0", + "bundled": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "bundled": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "bundled": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-https": { + "version": "1.0.0", + "bundled": true + }, + "http-signature": { + "version": "1.2.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "bundled": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "ipaddr.js": { + "version": "1.8.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-function": { + "version": "1.0.1", + "bundled": true + }, + "is-hex-prefixed": { + "version": "1.0.0", + "bundled": true + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true + }, + "js-sha3": { + "version": "0.3.1", + "bundled": true + }, + "jsbn": { + "version": "0.1.1", + "bundled": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "bundled": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true + }, + "jsprim": { + "version": "1.4.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "bundled": true, + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "bundled": true + }, + "merge-descriptors": { + "version": "1.0.1", + "bundled": true + }, + "methods": { + "version": "1.1.2", + "bundled": true + }, + "mime": { + "version": "1.4.1", + "bundled": true + }, + "mime-db": { + "version": "1.36.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.20", + "bundled": true, + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "bundled": true + }, + "min-document": { + "version": "2.19.0", + "bundled": true, + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "bundled": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "bundled": true + }, + "ms": { + "version": "2.0.0", + "bundled": true + }, + "nan": { + "version": "2.10.0", + "bundled": true + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "bundled": true + }, + "negotiator": { + "version": "0.6.1", + "bundled": true + }, + "number-to-bn": { + "version": "1.7.0", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "oboe": { + "version": "2.1.4", + "bundled": true, + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.3.0", + "bundled": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "bundled": true, + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "bundled": true + }, + "path-to-regexp": { + "version": "0.1.7", + "bundled": true + }, + "performance-now": { + "version": "2.1.0", + "bundled": true + }, + "process": { + "version": "0.5.2", + "bundled": true + }, + "proxy-addr": { + "version": "2.0.4", + "bundled": true, + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "bundled": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.5.2", + "bundled": true + }, + "query-string": { + "version": "5.1.1", + "bundled": true, + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "bundled": true + }, + "range-parser": { + "version": "1.2.0", + "bundled": true + }, + "raw-body": { + "version": "2.3.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "bundled": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true + }, + "send": { + "version": "0.16.2", + "bundled": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "serve-static": { + "version": "1.13.2", + "bundled": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "bundled": true, + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "bundled": true + }, + "sha3": { + "version": "1.2.2", + "bundled": true, + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "bundled": true + }, + "simple-get": { + "version": "2.8.1", + "bundled": true, + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "bundled": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "bundled": true + }, + "strict-uri-encode": { + "version": "1.1.0", + "bundled": true + }, + "strip-hex-prefix": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "bundled": true + }, + "tough-cookie": { + "version": "2.4.3", + "bundled": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "bundled": true + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true + }, + "type-is": { + "version": "1.6.16", + "bundled": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "bundled": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "ultron": { + "version": "1.1.1", + "bundled": true + }, + "underscore": { + "version": "1.9.1", + "bundled": true + }, + "unpipe": { + "version": "1.0.0", + "bundled": true + }, + "url-set-query": { + "version": "1.0.0", + "bundled": true + }, + "utf8": { + "version": "2.1.1", + "bundled": true + }, + "utils-merge": { + "version": "1.0.1", + "bundled": true + }, + "uuid": { + "version": "3.3.2", + "bundled": true + }, + "vary": { + "version": "1.1.2", + "bundled": true + }, + "verror": { + "version": "1.10.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "bundled": true + } + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "bundled": true + } + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "bundled": true, + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "ws": { + "version": "3.3.3", + "bundled": true, + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "bundled": true, + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "bundled": true, + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "bundled": true, + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "bundled": true, + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xtend": { + "version": "4.0.1", + "bundled": true + }, + "yaeti": { + "version": "0.0.6", + "bundled": true + } + } + }, + "web3-providers-http": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.36.tgz", + "integrity": "sha512-KLSqMS59nRdpet9B0B64MKgtM3n9wAHTcAHJ03hv79avQNTjHxtjZm0ttcjcFUPpWDgTCtcYCa7tqaYo9Pbeog==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.36.tgz", + "integrity": "sha512-iEUrmdd2CzoWgp+75/ydom/1IaoLw95qkAzsgwjjZp1waDncHP/cvVGX74+fbUx4hRaPdchyzxCQfNpgLDmNjQ==", + "requires": { + "oboe": "2.1.3", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + } + }, + "web3-providers-ws": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.36.tgz", + "integrity": "sha512-wAnENuZx75T5ZSrT2De2LOaUuPf2yRjq1VfcbD7+Zd79F3DZZLBJcPyCNVQ1U0fAXt0wfgCKl7sVw5pffqR9Bw==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + } + } +} diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index ce531a9ca42..230f1739b59 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -19,6 +19,6 @@ "web3-core-subscriptions": "1.0.0-beta.36", "web3-core-method": "1.0.0-beta.36", "web3-providers": "1.0.0-beta.36", - "web3-net": "1.0.0-beta.36", + "web3-net": "1.0.0-beta.36" } } diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 7bad9164bb8..3d2ac8cce85 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -212,7 +212,7 @@ export default class Eth extends AbstractWeb3Module { */ setProvider(provider, net) { const setContractProviders = this.initiatedContracts.every(contract => { - return !!contract.setProvider(provider, net); + return contract.setProvider(provider, net); }); return !!( diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 00a239c0d29..69bb54b3dee 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -20,9 +20,40 @@ * @date 2018 */ -import web3CoreMethod from 'web3-core-method'; +import { + AbstractMethodModelFactory, + GetNodeInfoMethodModel, + GetProtocolVersionMethodModel, + GetCoinbaseMethodModel, + IsMiningMethodModel, + GetHashrateMethodModel, + IsSyncingMethodModel, + GetGasPriceMethodModel, + GetAccountsMethodModel, + GetBlockNumberMethodModel, + GetBalanceMethodModel, + GetStorageAtMethodModel, + GetCodeMethodModel, + GetBlockMethodModel, + GetUncleMethodModel, + GetBlockTransactionCountMethodModel, + GetBlockUncleCountMethodModel, + GetTransactionMethodModel, + GetTransactionFromBlockMethodModel, + GetTransactionReceipt, + GetTransactionCountMethodModel, + SendSignedTransactionMethodModel, + SignTransactionMethodModel, + SendTransactionMethodModel, + SignMethodModel, + CallMethodModel, + EstimateGasMethodModel, + SubmitWorkMethodModel, + GetWorkMethodModel, + GetPastLogsMethodModel +} from 'web3-core-method'; -export default class MethodModelFactory extends web3CoreMethod.AbstractMethodModelFactory { +export default class MethodModelFactory extends AbstractMethodModelFactory { /** * @param {Object} utils @@ -34,35 +65,35 @@ export default class MethodModelFactory extends web3CoreMethod.AbstractMethodMod constructor(utils, formatters, accounts) { super( { - getNodeInfo: web3CoreMethod.GetNodeInfoMethodModel, - getProtocolVersion: web3CoreMethod.GetProtocolVersionMethodModel, - getCoinbase: web3CoreMethod.GetCoinbaseMethodModel, - isMining: web3CoreMethod.IsMiningMethodModel, - getHashrate: web3CoreMethod.GetHashrateMethodModel, - isSyncing: web3CoreMethod.IsSyncingMethodModel, - getGasPrice: web3CoreMethod.GetGasPriceMethodModel, - getAccounts: web3CoreMethod.GetAccountsMethodModel, - getBlockNumber: web3CoreMethod.GetBlockNumberMethodModel, - getBalance: web3CoreMethod.GetBalanceMethodModel, - getStorageAt: web3CoreMethod.GetStroageAtMethodModel, - getCode: web3CoreMethod.GetCodeMethodModel, - getBlock: web3CoreMethod.GetBlockMethodModel, - getUncle: web3CoreMethod.GetUncleMethodModel, - getBlockTransactionCount: web3CoreMethod.GetBlockTransactionCountMethodModel, - getBlockUncleCount: web3CoreMethod.GetBlockUncleCountMethodModel, - getTransaction: web3CoreMethod.GetTransactionMethodModel, - getTransactionFromBlock: web3CoreMethod.GetTransactionFromBlockMethodModel, - getTransactionReceipt: web3CoreMethod.GetTransactionReceipt, - getTransactionCount: web3CoreMethod.GetTransactionCountMethodModel, - sendSignedTransaction: web3CoreMethod.SendSignedTransactionMethodModel, - signTransaction: web3CoreMethod.SignTransactionMethodModel, - sendTransaction: web3CoreMethod.SendTransactionMethodModel, - sign: web3CoreMethod.SignMethodModel, - call: web3CoreMethod.CallMethodModel, - estimateGas: web3CoreMethod.EstimateGasMethodModel, - submitWork: web3CoreMethod.SubmitWorkMethodModel, - getWork: web3CoreMethod.GetWorkMethodModel, - getPastLogs: web3CoreMethod.GetPastLogsMethodModel + getNodeInfo: GetNodeInfoMethodModel, + getProtocolVersion: GetProtocolVersionMethodModel, + getCoinbase: GetCoinbaseMethodModel, + isMining: IsMiningMethodModel, + getHashrate: GetHashrateMethodModel, + isSyncing: IsSyncingMethodModel, + getGasPrice: GetGasPriceMethodModel, + getAccounts: GetAccountsMethodModel, + getBlockNumber: GetBlockNumberMethodModel, + getBalance: GetBalanceMethodModel, + getStorageAt: GetStorageAtMethodModel, + getCode: GetCodeMethodModel, + getBlock: GetBlockMethodModel, + getUncle: GetUncleMethodModel, + getBlockTransactionCount: GetBlockTransactionCountMethodModel, + getBlockUncleCount: GetBlockUncleCountMethodModel, + getTransaction: GetTransactionMethodModel, + getTransactionFromBlock: GetTransactionFromBlockMethodModel, + getTransactionReceipt: GetTransactionReceipt, + getTransactionCount: GetTransactionCountMethodModel, + sendSignedTransaction: SendSignedTransactionMethodModel, + signTransaction: SignTransactionMethodModel, + sendTransaction: SendTransactionMethodModel, + sign: SignMethodModel, + call: CallMethodModel, + estimateGas: EstimateGasMethodModel, + submitWork: SubmitWorkMethodModel, + getWork: GetWorkMethodModel, + getPastLogs: GetPastLogsMethodModel }, utils, formatters diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index b0dac782829..c2327a8c3ab 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -29,7 +29,7 @@ import {Accounts} from 'web3-eth-accounts'; import {Personal} from 'web3-eth-personal'; import {ENS} from 'web3-eth-ens'; import {SubscriptionsFactory} from 'web3-core-subscriptions'; -import {AbiCoder} from 'web3-eth-abi'; +import {ABICoder} from 'web3-eth-abi'; import {Iban} from 'web3-eth-iban'; import {Contract} from 'web3-eth-contract'; import EthModuleFactory from './factories/EthModuleFactory'; @@ -58,7 +58,7 @@ export const Eth = (provider) => { new Accounts(provider), new Personal(provider), Iban, - new AbiCoder(Utils), + new ABICoder(Utils), new ENS(provider), new SubscriptionsFactory(), ); diff --git a/packages/web3-net/package-lock.json b/packages/web3-net/package-lock.json new file mode 100644 index 00000000000..fe2ed6fd30a --- /dev/null +++ b/packages/web3-net/package-lock.json @@ -0,0 +1,2227 @@ +{ + "name": "web3-net", + "version": "1.0.0-beta.36", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" + }, + "mime-types": { + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", + "requires": { + "mime-db": "~1.37.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.36.tgz", + "integrity": "sha512-C2QW9CMMRZdYAiKiLkMrKRSp+gekSqTDgZTNvlxAdN1hXn4d9UmcmWSJXOmIHqr5N2ISbRod+bW+qChODxVE3Q==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-requestmanager": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-method": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.36.tgz", + "integrity": "sha512-dJsP3KkGaqBBSdxfzvLsYPOmVaSs1lR/3oKob/gtUYG7UyTnwquwliAc7OXj+gqRA2E/FHZcM83cWdl31ltdSA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-promievent": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.36.tgz", + "integrity": "sha512-RGIL6TjcOeJTullFLMurChPTsg94cPF6LI763y/sPYtXTDol1vVa+J5aGLp/4WW8v+s+1bSQO6zYq2ZtkbmtEQ==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "1.1.1" + } + }, + "web3-core-requestmanager": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.36.tgz", + "integrity": "sha512-/CHuaMbiMDu1v8ANGYI7yFCnh1GaCWx5pKnUPJf+QTk2xAAw+Bvd97yZJIWPOK5AOPUIzxgwx9Ob/5ln6mTmYA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-providers-http": "1.0.0-beta.36", + "web3-providers-ipc": "1.0.0-beta.36", + "web3-providers-ws": "1.0.0-beta.36" + } + }, + "web3-core-subscriptions": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", + "integrity": "sha512-/evyLQ8CMEYXC5aUCodDpmEnmGVYQxaIjiEIfA/85f9ifHkfzP1aOwCAjcsLsJWnwrWDagxSpjCYrDtnNabdEw==", + "requires": { + "eventemitter3": "1.1.1", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-providers": { + "version": "1.0.0-beta.36", + "requires": { + "eventemitter3": "3.1.0", + "oboe": "2.1.4", + "underscore": "1.9.1", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "xhr2-cookies": "1.1.0" + }, + "dependencies": { + "accepts": { + "version": "1.3.5", + "bundled": true, + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "bundled": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "bundled": true + }, + "asn1": { + "version": "0.2.4", + "bundled": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "bundled": true + }, + "async-limiter": { + "version": "1.0.0", + "bundled": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true + }, + "aws-sign2": { + "version": "0.7.0", + "bundled": true + }, + "aws4": { + "version": "1.8.0", + "bundled": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "bundled": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "bundled": true + }, + "body-parser": { + "version": "1.18.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "bundled": true + }, + "browserify-sha3": { + "version": "0.0.1", + "bundled": true, + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "bundled": true + }, + "bytes": { + "version": "3.0.0", + "bundled": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true + }, + "co": { + "version": "4.6.0", + "bundled": true + }, + "combined-stream": { + "version": "1.0.7", + "bundled": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "bundled": true + }, + "content-type": { + "version": "1.0.4", + "bundled": true + }, + "cookie": { + "version": "0.3.1", + "bundled": true + }, + "cookie-signature": { + "version": "1.0.6", + "bundled": true + }, + "cookiejar": { + "version": "2.1.2", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "cors": { + "version": "2.8.4", + "bundled": true, + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "bundled": true + }, + "decompress-response": { + "version": "3.3.0", + "bundled": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true + }, + "depd": { + "version": "1.1.2", + "bundled": true + }, + "destroy": { + "version": "1.0.4", + "bundled": true + }, + "dom-walk": { + "version": "0.1.1", + "bundled": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "bundled": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "bundled": true + }, + "elliptic": { + "version": "6.4.1", + "bundled": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "bundled": true + }, + "escape-html": { + "version": "1.0.3", + "bundled": true + }, + "etag": { + "version": "1.8.1", + "bundled": true + }, + "eth-lib": { + "version": "0.1.27", + "bundled": true, + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "3.1.0", + "bundled": true + }, + "express": { + "version": "4.16.4", + "bundled": true, + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "extend": { + "version": "3.0.2", + "bundled": true + }, + "extsprintf": { + "version": "1.3.0", + "bundled": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "bundled": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "bundled": true + }, + "finalhandler": { + "version": "1.1.1", + "bundled": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "for-each": { + "version": "0.3.3", + "bundled": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true + }, + "form-data": { + "version": "2.3.3", + "bundled": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "bundled": true + }, + "fresh": { + "version": "0.5.2", + "bundled": true + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "bundled": true, + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "bundled": true + }, + "har-validator": { + "version": "5.1.0", + "bundled": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "bundled": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "bundled": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-https": { + "version": "1.0.0", + "bundled": true + }, + "http-signature": { + "version": "1.2.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "bundled": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "ipaddr.js": { + "version": "1.8.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-function": { + "version": "1.0.1", + "bundled": true + }, + "is-hex-prefixed": { + "version": "1.0.0", + "bundled": true + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true + }, + "js-sha3": { + "version": "0.3.1", + "bundled": true + }, + "jsbn": { + "version": "0.1.1", + "bundled": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "bundled": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true + }, + "jsprim": { + "version": "1.4.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "bundled": true, + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "bundled": true + }, + "merge-descriptors": { + "version": "1.0.1", + "bundled": true + }, + "methods": { + "version": "1.1.2", + "bundled": true + }, + "mime": { + "version": "1.4.1", + "bundled": true + }, + "mime-db": { + "version": "1.36.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.20", + "bundled": true, + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "bundled": true + }, + "min-document": { + "version": "2.19.0", + "bundled": true, + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "bundled": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "bundled": true + }, + "ms": { + "version": "2.0.0", + "bundled": true + }, + "nan": { + "version": "2.10.0", + "bundled": true + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "bundled": true + }, + "negotiator": { + "version": "0.6.1", + "bundled": true + }, + "number-to-bn": { + "version": "1.7.0", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "oboe": { + "version": "2.1.4", + "bundled": true, + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.3.0", + "bundled": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "bundled": true, + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "bundled": true + }, + "path-to-regexp": { + "version": "0.1.7", + "bundled": true + }, + "performance-now": { + "version": "2.1.0", + "bundled": true + }, + "process": { + "version": "0.5.2", + "bundled": true + }, + "proxy-addr": { + "version": "2.0.4", + "bundled": true, + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "bundled": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.5.2", + "bundled": true + }, + "query-string": { + "version": "5.1.1", + "bundled": true, + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "bundled": true + }, + "range-parser": { + "version": "1.2.0", + "bundled": true + }, + "raw-body": { + "version": "2.3.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "bundled": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true + }, + "send": { + "version": "0.16.2", + "bundled": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "serve-static": { + "version": "1.13.2", + "bundled": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "bundled": true, + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "bundled": true + }, + "sha3": { + "version": "1.2.2", + "bundled": true, + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "bundled": true + }, + "simple-get": { + "version": "2.8.1", + "bundled": true, + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "bundled": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "bundled": true + }, + "strict-uri-encode": { + "version": "1.1.0", + "bundled": true + }, + "strip-hex-prefix": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "bundled": true + }, + "tough-cookie": { + "version": "2.4.3", + "bundled": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "bundled": true + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true + }, + "type-is": { + "version": "1.6.16", + "bundled": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "bundled": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "ultron": { + "version": "1.1.1", + "bundled": true + }, + "underscore": { + "version": "1.9.1", + "bundled": true + }, + "unpipe": { + "version": "1.0.0", + "bundled": true + }, + "url-set-query": { + "version": "1.0.0", + "bundled": true + }, + "utf8": { + "version": "2.1.1", + "bundled": true + }, + "utils-merge": { + "version": "1.0.1", + "bundled": true + }, + "uuid": { + "version": "3.3.2", + "bundled": true + }, + "vary": { + "version": "1.1.2", + "bundled": true + }, + "verror": { + "version": "1.10.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "bundled": true + } + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "bundled": true + } + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "bundled": true, + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "ws": { + "version": "3.3.3", + "bundled": true, + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "bundled": true, + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "bundled": true, + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "bundled": true, + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "bundled": true, + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xtend": { + "version": "4.0.1", + "bundled": true + }, + "yaeti": { + "version": "0.0.6", + "bundled": true + } + } + }, + "web3-providers-http": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.36.tgz", + "integrity": "sha512-KLSqMS59nRdpet9B0B64MKgtM3n9wAHTcAHJ03hv79avQNTjHxtjZm0ttcjcFUPpWDgTCtcYCa7tqaYo9Pbeog==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.36.tgz", + "integrity": "sha512-iEUrmdd2CzoWgp+75/ydom/1IaoLw95qkAzsgwjjZp1waDncHP/cvVGX74+fbUx4hRaPdchyzxCQfNpgLDmNjQ==", + "requires": { + "oboe": "2.1.3", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + } + }, + "web3-providers-ws": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.36.tgz", + "integrity": "sha512-wAnENuZx75T5ZSrT2De2LOaUuPf2yRjq1VfcbD7+Zd79F3DZZLBJcPyCNVQ1U0fAXt0wfgCKl7sVw5pffqR9Bw==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + } + } +} diff --git a/packages/web3-providers/package-lock.json b/packages/web3-providers/package-lock.json index 1158e22b290..c215484deff 100644 --- a/packages/web3-providers/package-lock.json +++ b/packages/web3-providers/package-lock.json @@ -1,185 +1,12 @@ { - "name": "web3-providers", - "version": "1.0.0-beta.36", - "lockfileVersion": 1, "requires": true, + "lockfileVersion": 1, "dependencies": { - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" - }, - "body-parser": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "~1.6.3", - "iconv-lite": "0.4.23", - "on-finished": "~2.3.0", - "qs": "6.5.2", - "raw-body": "2.3.3", - "type-is": "~1.6.16" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "browserify-sha3": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", - "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", - "requires": { - "js-sha3": "^0.3.1" - } - }, - "buffer-to-arraybuffer": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", - "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "combined-stream": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", - "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, "cookiejar": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cors": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", - "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -188,448 +15,21 @@ "ms": "2.0.0" } }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "requires": { - "mimic-response": "^1.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "dom-walk": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", - "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "elliptic": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", - "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "eth-lib": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", - "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "keccakjs": "^0.2.1", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", - "xhr-request-promise": "^0.1.2" - } - }, - "ethjs-unit": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", - "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", - "requires": { - "bn.js": "4.11.6", - "number-to-bn": "1.7.0" - } - }, "eventemitter3": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" }, - "express": { - "version": "4.16.4", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", - "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.3", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.4", - "qs": "6.5.2", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.2", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "finalhandler": { - "version": "1.1.1", - "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "requires": { - "is-callable": "^1.1.3" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "global": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", - "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", - "requires": { - "min-document": "^2.19.0", - "process": "~0.5.1" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", - "requires": { - "ajv": "^5.3.0", - "har-schema": "^2.0.0" - } - }, - "hash.js": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", - "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "http-errors": { - "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, "http-https": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" - }, - "is-function": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", - "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" - }, - "is-hex-prefixed": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" - }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "js-sha3": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", - "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "keccakjs": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", - "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", - "requires": { - "browserify-sha3": "^0.0.1", - "sha3": "^1.1.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - }, - "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" - }, - "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", - "requires": { - "mime-db": "~1.36.0" - } - }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, - "min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", - "requires": { - "dom-walk": "^0.1.0" - } - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -640,35 +40,6 @@ "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" }, - "nano-json-stream-parser": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", - "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, - "number-to-bn": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", - "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", - "requires": { - "bn.js": "4.11.6", - "strip-hex-prefix": "1.0.0" - } - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, "oboe": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.4.tgz", @@ -677,296 +48,6 @@ "http-https": "^1.0.0" } }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "parse-headers": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", - "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", - "requires": { - "for-each": "^0.3.2", - "trim": "0.0.1" - } - }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "process": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", - "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" - }, - "proxy-addr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.8.0" - } - }, - "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "query-string": { - "version": "5.1.1", - "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", - "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", - "requires": { - "decode-uri-component": "^0.2.0", - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - } - }, - "randomhex": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", - "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" - }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.3", - "iconv-lite": "0.4.23", - "unpipe": "1.0.0" - } - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, - "servify": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", - "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", - "requires": { - "body-parser": "^1.16.0", - "cors": "^2.8.1", - "express": "^4.14.0", - "request": "^2.79.0", - "xhr": "^2.3.3" - } - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, - "sha3": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", - "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", - "requires": { - "nan": "2.10.0" - } - }, - "simple-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", - "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" - }, - "simple-get": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", - "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", - "requires": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, - "sshpk": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", - "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" - }, - "strip-hex-prefix": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", - "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", - "requires": { - "is-hex-prefixed": "1.0.0" - } - }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" - }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - } - }, - "trim": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", - "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, "typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -975,103 +56,11 @@ "is-typedarray": "^1.0.0" } }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" - }, "underscore": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "url-set-query": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", - "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" - }, - "utf8": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", - "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "web3-core-helpers": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", - "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", - "requires": { - "underscore": "1.8.3", - "web3-eth-iban": "1.0.0-beta.36", - "web3-utils": "1.0.0-beta.36" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } - }, - "web3-eth-iban": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", - "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", - "requires": { - "bn.js": "4.11.6", - "web3-utils": "1.0.0-beta.36" - } - }, - "web3-utils": { - "version": "1.0.0-beta.36", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", - "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", - "requires": { - "bn.js": "4.11.6", - "eth-lib": "0.1.27", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randomhex": "0.1.5", - "underscore": "1.8.3", - "utf8": "2.1.1" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - } - } - }, "websocket": { "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", @@ -1082,54 +71,6 @@ "yaeti": "^0.0.6" } }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - }, - "xhr": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", - "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", - "requires": { - "global": "~4.3.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "xhr-request": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", - "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", - "requires": { - "buffer-to-arraybuffer": "^0.0.5", - "object-assign": "^4.1.1", - "query-string": "^5.0.1", - "simple-get": "^2.7.0", - "timed-out": "^4.0.1", - "url-set-query": "^1.0.0", - "xhr": "^2.0.4" - } - }, - "xhr-request-promise": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", - "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", - "requires": { - "xhr-request": "^1.0.1" - } - }, "xhr2-cookies": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", @@ -1138,11 +79,6 @@ "cookiejar": "^2.1.1" } }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - }, "yaeti": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", diff --git a/packages/web3-providers/src/batch-request/BatchRequest.js b/packages/web3-providers/src/batch-request/BatchRequest.js index d4c90329e18..8cb3c8c4c23 100644 --- a/packages/web3-providers/src/batch-request/BatchRequest.js +++ b/packages/web3-providers/src/batch-request/BatchRequest.js @@ -21,7 +21,7 @@ */ import {errors} from 'web3-core-helpers'; -import _ from 'underscore'; +import {isFunction, isObject, isArray} from 'underscore'; export default class BatchRequest { @@ -59,7 +59,7 @@ export default class BatchRequest { this.provider.sendBatch( this.jsonRpcMapper.toBatchPayload(this.requests), (err, results) => { - if (!_.isArray(results)) { + if (!isArray(results)) { request.callback(errors.InvalidResponse(results)); return; @@ -68,8 +68,8 @@ export default class BatchRequest { this.requests.forEach(function (request, index) { const result = results[index] || null; - if (_.isFunction(request.callback)) { - if (_.isObject(result) && result.error) { + if (isFunction(request.callback)) { + if (isObject(result) && result.error) { request.callback(errors.ErrorResponse(result)); } @@ -99,6 +99,6 @@ export default class BatchRequest { * @returns {Boolean} */ hasOutputFormatter(request) { - return _.isFunction(request.methodModel.outputFormatter); + return isFunction(request.methodModel.outputFormatter); } } diff --git a/packages/web3-providers/src/providers/IpcProvider.js b/packages/web3-providers/src/providers/IpcProvider.js index 12ccb97cbcd..1c24a0174e1 100644 --- a/packages/web3-providers/src/providers/IpcProvider.js +++ b/packages/web3-providers/src/providers/IpcProvider.js @@ -20,7 +20,7 @@ * @date 2017 */ -import _ from 'underscore'; +import {isArray, isFunction} from 'underscore'; import {errors} from 'web3-core-helpers'; import oboe from 'oboe'; @@ -49,7 +49,7 @@ export default class IpcProvider { let id = null; // get the id which matches the returned id - if (_.isArray(result)) { + if (isArray(result)) { result.forEach(load => { if (this.responseCallbacks[load.id]) id = load.id; @@ -61,7 +61,7 @@ export default class IpcProvider { // notification if (!id && result.method.indexOf('_subscription') !== -1) { this.notificationCallbacks.forEach(callback => { - if (_.isFunction(callback)) + if (isFunction(callback)) callback(result); }); diff --git a/packages/web3-providers/src/providers/WebsocketProvider.js b/packages/web3-providers/src/providers/WebsocketProvider.js index dedb83ba18f..654646206d7 100644 --- a/packages/web3-providers/src/providers/WebsocketProvider.js +++ b/packages/web3-providers/src/providers/WebsocketProvider.js @@ -20,7 +20,7 @@ * @date 2017 */ -import _ from 'underscore'; +import {isArray, isFunction} from 'underscore'; import {errors} from 'web3-core-helpers'; let Ws = null; diff --git a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js index 2b487450422..e1c075a81a5 100644 --- a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js @@ -20,7 +20,7 @@ * @date 2018 */ -import _ from 'underscore'; +import {isObject, isFunction} from 'underscore'; export default class ProviderAdapterResolver { diff --git a/packages/web3-shh/package-lock.json b/packages/web3-shh/package-lock.json new file mode 100644 index 00000000000..04ade2ac699 --- /dev/null +++ b/packages/web3-shh/package-lock.json @@ -0,0 +1,2237 @@ +{ + "name": "web3-shh", + "version": "1.0.0-beta.36", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" + }, + "mime-types": { + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", + "requires": { + "mime-db": "~1.37.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", + "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.36.tgz", + "integrity": "sha512-C2QW9CMMRZdYAiKiLkMrKRSp+gekSqTDgZTNvlxAdN1hXn4d9UmcmWSJXOmIHqr5N2ISbRod+bW+qChODxVE3Q==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-core-requestmanager": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.36.tgz", + "integrity": "sha512-gu74l0htiGWuxLQuMnZqKToFvkSM+UFPE7qUuy1ZosH/h2Jd+VBWg6k4CyNYVYfP0hL5x3CN8SBmB+HMowo55A==", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-method": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.36.tgz", + "integrity": "sha512-dJsP3KkGaqBBSdxfzvLsYPOmVaSs1lR/3oKob/gtUYG7UyTnwquwliAc7OXj+gqRA2E/FHZcM83cWdl31ltdSA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-core-promievent": "1.0.0-beta.36", + "web3-core-subscriptions": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-core-promievent": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.36.tgz", + "integrity": "sha512-RGIL6TjcOeJTullFLMurChPTsg94cPF6LI763y/sPYtXTDol1vVa+J5aGLp/4WW8v+s+1bSQO6zYq2ZtkbmtEQ==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "1.1.1" + } + }, + "web3-core-requestmanager": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.36.tgz", + "integrity": "sha512-/CHuaMbiMDu1v8ANGYI7yFCnh1GaCWx5pKnUPJf+QTk2xAAw+Bvd97yZJIWPOK5AOPUIzxgwx9Ob/5ln6mTmYA==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "web3-providers-http": "1.0.0-beta.36", + "web3-providers-ipc": "1.0.0-beta.36", + "web3-providers-ws": "1.0.0-beta.36" + } + }, + "web3-core-subscriptions": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.36.tgz", + "integrity": "sha512-/evyLQ8CMEYXC5aUCodDpmEnmGVYQxaIjiEIfA/85f9ifHkfzP1aOwCAjcsLsJWnwrWDagxSpjCYrDtnNabdEw==", + "requires": { + "eventemitter3": "1.1.1", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.36.tgz", + "integrity": "sha512-b5AEDjjhOLR4q47Hbzf65zYE+7U7JgCgrUb13RU4HMIGoMb1q4DXaJw1UH8VVHCZulevl2QBjpCyrntecMqqCQ==", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-net": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.0.0-beta.36.tgz", + "integrity": "sha512-BriXK0Pjr6Hc/VDq1Vn8vyOum4JB//wpCjgeGziFD6jC7Of8YaWC7AJYXje89OckzfcqX1aJyJlBwDpasNkAzQ==", + "requires": { + "web3-core": "1.0.0-beta.36", + "web3-core-method": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-providers": { + "version": "1.0.0-beta.36", + "requires": { + "eventemitter3": "3.1.0", + "oboe": "2.1.4", + "underscore": "1.9.1", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "xhr2-cookies": "1.1.0" + }, + "dependencies": { + "accepts": { + "version": "1.3.5", + "bundled": true, + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "bundled": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "bundled": true + }, + "asn1": { + "version": "0.2.4", + "bundled": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "bundled": true + }, + "async-limiter": { + "version": "1.0.0", + "bundled": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true + }, + "aws-sign2": { + "version": "0.7.0", + "bundled": true + }, + "aws4": { + "version": "1.8.0", + "bundled": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "bundled": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "bundled": true + }, + "body-parser": { + "version": "1.18.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brorand": { + "version": "1.1.0", + "bundled": true + }, + "browserify-sha3": { + "version": "0.0.1", + "bundled": true, + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "bundled": true + }, + "bytes": { + "version": "3.0.0", + "bundled": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true + }, + "co": { + "version": "4.6.0", + "bundled": true + }, + "combined-stream": { + "version": "1.0.7", + "bundled": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "bundled": true + }, + "content-type": { + "version": "1.0.4", + "bundled": true + }, + "cookie": { + "version": "0.3.1", + "bundled": true + }, + "cookie-signature": { + "version": "1.0.6", + "bundled": true + }, + "cookiejar": { + "version": "2.1.2", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "cors": { + "version": "2.8.4", + "bundled": true, + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "bundled": true + }, + "decompress-response": { + "version": "3.3.0", + "bundled": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true + }, + "depd": { + "version": "1.1.2", + "bundled": true + }, + "destroy": { + "version": "1.0.4", + "bundled": true + }, + "dom-walk": { + "version": "0.1.1", + "bundled": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "bundled": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "bundled": true + }, + "elliptic": { + "version": "6.4.1", + "bundled": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.2", + "bundled": true + }, + "escape-html": { + "version": "1.0.3", + "bundled": true + }, + "etag": { + "version": "1.8.1", + "bundled": true + }, + "eth-lib": { + "version": "0.1.27", + "bundled": true, + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "eventemitter3": { + "version": "3.1.0", + "bundled": true + }, + "express": { + "version": "4.16.4", + "bundled": true, + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "extend": { + "version": "3.0.2", + "bundled": true + }, + "extsprintf": { + "version": "1.3.0", + "bundled": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "bundled": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "bundled": true + }, + "finalhandler": { + "version": "1.1.1", + "bundled": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "for-each": { + "version": "0.3.3", + "bundled": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true + }, + "form-data": { + "version": "2.3.3", + "bundled": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "bundled": true + }, + "fresh": { + "version": "0.5.2", + "bundled": true + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "global": { + "version": "4.3.2", + "bundled": true, + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "bundled": true + }, + "har-validator": { + "version": "5.1.0", + "bundled": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.5", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "bundled": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-errors": { + "version": "1.6.3", + "bundled": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-https": { + "version": "1.0.0", + "bundled": true + }, + "http-signature": { + "version": "1.2.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "bundled": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "ipaddr.js": { + "version": "1.8.0", + "bundled": true + }, + "is-callable": { + "version": "1.1.4", + "bundled": true + }, + "is-function": { + "version": "1.0.1", + "bundled": true + }, + "is-hex-prefixed": { + "version": "1.0.0", + "bundled": true + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true + }, + "js-sha3": { + "version": "0.3.1", + "bundled": true + }, + "jsbn": { + "version": "0.1.1", + "bundled": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "bundled": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true + }, + "jsprim": { + "version": "1.4.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "bundled": true, + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "media-typer": { + "version": "0.3.0", + "bundled": true + }, + "merge-descriptors": { + "version": "1.0.1", + "bundled": true + }, + "methods": { + "version": "1.1.2", + "bundled": true + }, + "mime": { + "version": "1.4.1", + "bundled": true + }, + "mime-db": { + "version": "1.36.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.20", + "bundled": true, + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "bundled": true + }, + "min-document": { + "version": "2.19.0", + "bundled": true, + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "bundled": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "bundled": true + }, + "ms": { + "version": "2.0.0", + "bundled": true + }, + "nan": { + "version": "2.10.0", + "bundled": true + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "bundled": true + }, + "negotiator": { + "version": "0.6.1", + "bundled": true + }, + "number-to-bn": { + "version": "1.7.0", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "oboe": { + "version": "2.1.4", + "bundled": true, + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.3.0", + "bundled": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "bundled": true, + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "bundled": true + }, + "path-to-regexp": { + "version": "0.1.7", + "bundled": true + }, + "performance-now": { + "version": "2.1.0", + "bundled": true + }, + "process": { + "version": "0.5.2", + "bundled": true + }, + "proxy-addr": { + "version": "2.0.4", + "bundled": true, + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "psl": { + "version": "1.1.29", + "bundled": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.5.2", + "bundled": true + }, + "query-string": { + "version": "5.1.1", + "bundled": true, + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "bundled": true + }, + "range-parser": { + "version": "1.2.0", + "bundled": true + }, + "raw-body": { + "version": "2.3.3", + "bundled": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.88.0", + "bundled": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true + }, + "send": { + "version": "0.16.2", + "bundled": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "bundled": true + } + } + }, + "serve-static": { + "version": "1.13.2", + "bundled": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "servify": { + "version": "0.1.12", + "bundled": true, + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.1.0", + "bundled": true + }, + "sha3": { + "version": "1.2.2", + "bundled": true, + "requires": { + "nan": "2.10.0" + } + }, + "simple-concat": { + "version": "1.0.0", + "bundled": true + }, + "simple-get": { + "version": "2.8.1", + "bundled": true, + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sshpk": { + "version": "1.15.1", + "bundled": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.5.0", + "bundled": true + }, + "strict-uri-encode": { + "version": "1.1.0", + "bundled": true + }, + "strip-hex-prefix": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "timed-out": { + "version": "4.0.1", + "bundled": true + }, + "tough-cookie": { + "version": "2.4.3", + "bundled": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "bundled": true + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true + }, + "type-is": { + "version": "1.6.16", + "bundled": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "bundled": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "ultron": { + "version": "1.1.1", + "bundled": true + }, + "underscore": { + "version": "1.9.1", + "bundled": true + }, + "unpipe": { + "version": "1.0.0", + "bundled": true + }, + "url-set-query": { + "version": "1.0.0", + "bundled": true + }, + "utf8": { + "version": "2.1.1", + "bundled": true + }, + "utils-merge": { + "version": "1.0.1", + "bundled": true + }, + "uuid": { + "version": "3.3.2", + "bundled": true + }, + "vary": { + "version": "1.1.2", + "bundled": true + }, + "verror": { + "version": "1.10.0", + "bundled": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.36", + "web3-utils": "1.0.0-beta.36" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "bundled": true + } + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.36" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "bundled": true, + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "bundled": true + } + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "bundled": true, + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "ws": { + "version": "3.3.3", + "bundled": true, + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "bundled": true, + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "bundled": true, + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "bundled": true, + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "bundled": true, + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xtend": { + "version": "4.0.1", + "bundled": true + }, + "yaeti": { + "version": "0.0.6", + "bundled": true + } + } + }, + "web3-providers-http": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.36.tgz", + "integrity": "sha512-KLSqMS59nRdpet9B0B64MKgtM3n9wAHTcAHJ03hv79avQNTjHxtjZm0ttcjcFUPpWDgTCtcYCa7tqaYo9Pbeog==", + "requires": { + "web3-core-helpers": "1.0.0-beta.36", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.36.tgz", + "integrity": "sha512-iEUrmdd2CzoWgp+75/ydom/1IaoLw95qkAzsgwjjZp1waDncHP/cvVGX74+fbUx4hRaPdchyzxCQfNpgLDmNjQ==", + "requires": { + "oboe": "2.1.3", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36" + } + }, + "web3-providers-ws": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.36.tgz", + "integrity": "sha512-wAnENuZx75T5ZSrT2De2LOaUuPf2yRjq1VfcbD7+Zd79F3DZZLBJcPyCNVQ1U0fAXt0wfgCKl7sVw5pffqR9Bw==", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.36", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + } + }, + "web3-utils": { + "version": "1.0.0-beta.36", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.36.tgz", + "integrity": "sha512-7ri74lG5fS2Th0fhYvTtiEHMB1Pmf2p7dQx1COQ3OHNI/CHNEMjzoNMEbBU6FAENrywfoFur40K4m0AOmEUq5A==", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + } + } +} diff --git a/packages/web3-utils/package-lock.json b/packages/web3-utils/package-lock.json index bb2c8dc773f..23899f89204 100644 --- a/packages/web3-utils/package-lock.json +++ b/packages/web3-utils/package-lock.json @@ -2,183 +2,21 @@ "requires": true, "lockfileVersion": 1, "dependencies": { - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" - }, - "body-parser": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "~1.6.3", - "iconv-lite": "0.4.23", - "on-finished": "~2.3.0", - "qs": "6.5.2", - "raw-body": "2.3.3", - "type-is": "~1.6.16" - } + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, - "browserify-sha3": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", - "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", - "requires": { - "js-sha3": "^0.3.1" - } - }, "buffer-to-arraybuffer": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cors": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", - "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", @@ -192,44 +30,15 @@ "mimic-response": "^1.0.0" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, "dom-walk": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, "elliptic": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", "requires": { "bn.js": "^4.4.0", "brorand": "^1.0.1", @@ -240,32 +49,13 @@ "minimalistic-crypto-utils": "^1.0.0" } }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, "eth-lib": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", - "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", "requires": { "bn.js": "^4.11.6", "elliptic": "^6.4.0", - "keccakjs": "^0.2.1", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", "xhr-request-promise": "^0.1.2" } }, @@ -276,193 +66,21 @@ "requires": { "bn.js": "4.11.6", "number-to-bn": "1.7.0" - } - }, - "express": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - } - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" - } - } - }, - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "finalhandler": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" }, "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" } } }, "for-each": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.2.tgz", - "integrity": "sha1-LEBFC5NI6X8oEyJZO6lnBLmr1NQ=", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "requires": { - "is-function": "~1.0.0" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" + "is-callable": "^1.1.3" } }, "global": { @@ -474,27 +92,13 @@ "process": "~0.5.1" } }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "requires": { - "ajv": "^5.1.0", - "har-schema": "^2.0.0" - } - }, "hash.js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", "requires": { "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" + "minimalistic-assert": "^1.0.1" } }, "hmac-drbg": { @@ -507,44 +111,15 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, - "ipaddr.js": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", - "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" }, "is-function": { "version": "1.0.1", @@ -556,99 +131,10 @@ "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "js-sha3": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", - "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "keccakjs": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", - "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", - "requires": { - "browserify-sha3": "^0.0.1", - "sha3": "^1.1.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - }, - "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" - }, - "mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", - "requires": { - "mime-db": "~1.33.0" - } - }, "mimic-response": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.0.tgz", - "integrity": "sha1-3z02Uqc/3ta5sLJBRub9BSNTRY4=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" }, "min-document": { "version": "2.19.0", @@ -668,26 +154,6 @@ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "nan": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" - }, - "nano-json-stream-parser": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", - "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, "number-to-bn": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", @@ -695,26 +161,20 @@ "requires": { "bn.js": "4.11.6", "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + } } }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -732,48 +192,14 @@ "trim": "0.0.1" } }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, "process": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" }, - "proxy-addr": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", - "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.6.0" - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, "query-string": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", "requires": { "decode-uri-component": "^0.2.0", @@ -786,122 +212,6 @@ "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.3", - "iconv-lite": "0.4.23", - "unpipe": "1.0.0" - } - }, - "request": { - "version": "2.87.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", - "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", - "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", - "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "tough-cookie": "~2.3.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, - "servify": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", - "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", - "requires": { - "body-parser": "^1.16.0", - "cors": "^2.8.1", - "express": "^4.14.0", - "request": "^2.79.0", - "xhr": "^2.3.3" - } - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, - "sha3": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", - "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", - "requires": { - "nan": "2.10.0" - } - }, "simple-concat": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", @@ -917,26 +227,6 @@ "simple-concat": "^1.0.0" } }, - "sshpk": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", - "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, "strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", @@ -955,56 +245,15 @@ "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" }, - "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", - "requires": { - "punycode": "^1.4.1" - } - }, "trim": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" - }, "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" }, "url-set-query": { "version": "1.0.0", @@ -1016,46 +265,11 @@ "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - }, "xhr": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", diff --git a/packages/web3-utils/package.json b/packages/web3-utils/package.json index 507257ca331..bedec1e09ec 100644 --- a/packages/web3-utils/package.json +++ b/packages/web3-utils/package.json @@ -7,8 +7,8 @@ "license": "LGPL-3.0", "main": "src/index.js", "dependencies": { - "bn.js": "4.11.6", - "eth-lib": "0.1.27", + "bn.js": "4.11.8", + "eth-lib": "0.2.8", "ethjs-unit": "0.1.6", "number-to-bn": "1.7.0", "randomhex": "0.1.5", diff --git a/packages/web3-utils/src/index.js b/packages/web3-utils/src/index.js index 9bbefa30ce4..2c5dd7f79be 100644 --- a/packages/web3-utils/src/index.js +++ b/packages/web3-utils/src/index.js @@ -21,7 +21,7 @@ * @date 2017 */ -import _ from 'underscore'; +import {isObject, isString, isArray, isFunction} from 'underscore'; import ethjsUnit from 'ethjs-unit'; import utils from './utils.js'; import soliditySha3 from './soliditySha3.js'; @@ -41,27 +41,27 @@ const _fireError = (error, emitter, reject, callback) => { /*jshint maxcomplexity: 10 */ // add data if given - if (_.isObject(error) && !(error instanceof Error) && error.data) { - if (_.isObject(error.data) || _.isArray(error.data)) { + if (isObject(error) && !(error instanceof Error) && error.data) { + if (isObject(error.data) || isArray(error.data)) { error.data = JSON.stringify(error.data, null, 2); } error = `${error.message}\n${error.data}`; } - if (_.isString(error)) { + if (isString(error)) { error = new Error(error); } - if (_.isFunction(callback)) { + if (isFunction(callback)) { callback(error); } - if (_.isFunction(reject)) { + if (isFunction(reject)) { // suppress uncatched error if an error listener is present // OR suppress uncatched error if an callback listener is present if (emitter && - (_.isFunction(emitter.listeners) && - emitter.listeners('error').length) || _.isFunction(callback)) { + (isFunction(emitter.listeners) && + emitter.listeners('error').length) || isFunction(callback)) { emitter.catch(() => { }); } @@ -71,7 +71,7 @@ const _fireError = (error, emitter, reject, callback) => { }, 1); } - if (emitter && _.isFunction(emitter.emit)) { + if (emitter && isFunction(emitter.emit)) { // emit later, to be able to return emitter setTimeout(() => { emitter.emit('error', error); @@ -90,7 +90,7 @@ const _fireError = (error, emitter, reject, callback) => { * @return {String} full function/event name */ const _jsonInterfaceMethodToString = json => { - if (_.isObject(json) && json.name && json.name.indexOf('(') !== -1) { + if (isObject(json) && json.name && json.name.indexOf('(') !== -1) { return json.name; } @@ -121,7 +121,7 @@ const _flattenTypes = (includeTuple, puts) => { } const result = _flattenTypes(includeTuple, param.components); // console.log("result should have things: " + result) - if (_.isArray(result) && includeTuple) { + if (isArray(result) && includeTuple) { // console.log("include tuple word, and its an array. joining...: " + result.types) types.push(`tuple(${result.join(',')})${suffix}`); } @@ -227,7 +227,7 @@ const getUnitValue = unit => { const fromWei = (number, unit) => { unit = getUnitValue(unit); - if (!utils.isBN(number) && !_.isString(number)) { + if (!utils.isBN(number) && !isString(number)) { throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); } @@ -259,7 +259,7 @@ const fromWei = (number, unit) => { const toWei = (number, unit) => { unit = getUnitValue(unit); - if (!utils.isBN(number) && !_.isString(number)) { + if (!utils.isBN(number) && !isString(number)) { throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); } diff --git a/packages/web3-utils/src/soliditySha3.js b/packages/web3-utils/src/soliditySha3.js index ab182aefba8..489de3a61ae 100644 --- a/packages/web3-utils/src/soliditySha3.js +++ b/packages/web3-utils/src/soliditySha3.js @@ -20,7 +20,7 @@ * @date 2017 */ -import _ from 'underscore'; +import {isArray, isObject, map} from 'underscore'; import BN from 'bn.js'; import utils from './utils.js'; @@ -172,7 +172,7 @@ const _solidityPack = (type, value, arraySize) => { const _processSoliditySha3Args = arg => { /*jshint maxcomplexity:false */ - if (_.isArray(arg)) { + if (isArray(arg)) { throw new Error('Autodetection of array types is not supported.'); } @@ -180,7 +180,7 @@ const _processSoliditySha3Args = arg => { let hexArg, arraySize; // if type is given - if (_.isObject(arg) && (arg.hasOwnProperty('v') || arg.hasOwnProperty('t') || arg.hasOwnProperty('value') || arg.hasOwnProperty('type'))) { + if (isObject(arg) && (arg.hasOwnProperty('v') || arg.hasOwnProperty('t') || arg.hasOwnProperty('value') || arg.hasOwnProperty('type'))) { type = arg.hasOwnProperty('t') ? arg.t : arg.type; value = arg.hasOwnProperty('v') ? arg.v : arg.value; @@ -200,7 +200,7 @@ const _processSoliditySha3Args = arg => { } // get the array size - if (_.isArray(value)) { + if (isArray(value)) { arraySize = _parseTypeNArray(type); if (arraySize && value.length !== arraySize) { throw new Error(`${type} is not matching the given array ${JSON.stringify(value)}`); @@ -210,7 +210,7 @@ const _processSoliditySha3Args = arg => { } - if (_.isArray(value)) { + if (isArray(value)) { hexArg = value.map(val => { return _solidityPack(type, val, arraySize).toString('hex').replace('0x', ''); }); @@ -233,7 +233,7 @@ const soliditySha3 = () => { const args = Array.prototype.slice.call(arguments); - const hexArgs = _.map(args, _processSoliditySha3Args); + const hexArgs = map(args, _processSoliditySha3Args); // console.log(args, hexArgs); // console.log('0x'+ hexArgs.join('')); diff --git a/packages/web3-utils/src/utils.js b/packages/web3-utils/src/utils.js index 38c59c2d5be..1ad571336db 100644 --- a/packages/web3-utils/src/utils.js +++ b/packages/web3-utils/src/utils.js @@ -20,7 +20,7 @@ * @date 2017 */ -import _ from 'underscore'; +import {isNull, isUndefined, isBoolean, isString, isNumber, isObject} from 'underscore'; import BN from 'bn.js'; import numberToBN from 'number-to-bn'; @@ -256,7 +256,7 @@ const hexToNumberString = value => { * @return {String} */ const numberToHex = value => { - if (_.isNull(value) || _.isUndefined(value)) { + if (isNull(value) || isUndefined(value)) { return value; } @@ -330,17 +330,17 @@ const toHex = (value, returnType) => { return returnType ? 'address' : `0x${value.toLowerCase().replace(/^0x/i, '')}`; } - if (_.isBoolean(value)) { + if (isBoolean(value)) { return returnType ? 'bool' : value ? '0x01' : '0x00'; } - if (_.isObject(value) && !isBigNumber(value) && !isBN(value)) { + if (isObject(value) && !isBigNumber(value) && !isBN(value)) { return returnType ? 'string' : utf8ToHex(JSON.stringify(value)); } // if its a negative number, pass it through numberToHex - if (_.isString(value)) { + if (isString(value)) { if (value.indexOf('-0x') === 0 || value.indexOf('-0X') === 0) { return returnType ? 'int256' : numberToHex(value); } else if (value.indexOf('0x') === 0 || value.indexOf('0X') === 0) { @@ -362,7 +362,7 @@ const toHex = (value, returnType) => { * @returns {Boolean} */ const isHexStrict = hex => { - return ((_.isString(hex) || _.isNumber(hex)) && /^(-)?0x[0-9a-f]*$/i.test(hex)); + return ((isString(hex) || isNumber(hex)) && /^(-)?0x[0-9a-f]*$/i.test(hex)); }; /** @@ -373,7 +373,7 @@ const isHexStrict = hex => { * @returns {Boolean} */ const isHex = hex => { - return ((_.isString(hex) || _.isNumber(hex)) && /^(-0x|0x)?[0-9a-f]*$/i.test(hex)); + return ((isString(hex) || isNumber(hex)) && /^(-0x|0x)?[0-9a-f]*$/i.test(hex)); }; diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index ebf784cda11..feab9b3a40f 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -24,7 +24,7 @@ import {AbstractWeb3Module} from 'web3-core'; import {formatters} from 'web3-core-helpers'; import {AbstractMethodModelFactory, MethodController} from 'web3-core-method'; import {ProvidersModuleFactory, providers} from 'web3-providers'; -import {Utils} from 'web3-utils'; +import Utils from 'web3-utils'; import {Eth} from 'web3-eth'; import {Shh} from 'web3-shh'; import {Bzz} from 'web3-bzz'; diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000000..7858aa852db --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,86 @@ +var path = require('path'); +var DuplicatePackageCheckerPlugin = require("duplicate-package-checker-webpack-plugin"); +var BabelMinify = require('babel-minify-webpack-plugin'); +const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; + +module.exports = { + mode: 'production', + entry: './packages/web3/src/index.js', + output: { + filename: 'web3.min.js', + path: path.resolve(__dirname, 'dist') + }, + resolve: { + alias: { + 'web3-core': path.resolve(__dirname, 'packages/web3-core/src'), + 'web3-core-method': path.resolve(__dirname, 'packages/web3-core-method/src'), + 'web3-core-subscriptions': path.resolve(__dirname, 'packages/web3-core-subscriptions/src'), + 'web3-core-promievent': path.resolve(__dirname, 'packages/web3-core-promievent/src'), + 'web3-core-helpers': path.resolve(__dirname, 'packages/web3-core-helpers/src'), + 'web3-utils': path.resolve(__dirname, 'packages/web3-utils/src'), + 'web3-providers': path.resolve(__dirname, 'packages/web3-providers/src'), + 'web3-eth-abi': path.resolve(__dirname, 'packages/web3-eth-abi/src'), + 'web3-eth-accounts': path.resolve(__dirname, 'packages/web3-eth-accounts/src'), + 'web3-eth-contract': path.resolve(__dirname, 'packages/web3-eth-contract/src'), + 'web3-eth-ens': path.resolve(__dirname, 'packages/web3-eth-ens/src'), + 'web3-eth-iban': path.resolve(__dirname, 'packages/web3-eth-iban/src'), + 'web3-eth-personal': path.resolve(__dirname, 'packages/web3-eth-personal/src'), + 'web3-bzz': path.resolve(__dirname, 'packages/web3-bzz/src'), + 'bn.js': path.resolve(__dirname, 'node_modules/bn.js'), + 'underscore': path.resolve(__dirname, 'node_modules/underscore'), + 'elliptic': path.resolve(__dirname, 'node_modules/elliptic'), + 'asn1.js': path.resolve(__dirname, 'node_modules/asn1.js'), + 'hash.js': path.resolve(__dirname, 'node_modules/hash.js'), + 'browser.js': path.resolve(__dirname, 'node_modules/browser.js'), + 'eth-lib': path.resolve(__dirname, 'node_modules/eth-lib'), + 'browserify-aes': path.resolve(__dirname, 'node_modules/browserify-aes'), + 'browserify-sign': path.resolve(__dirname, 'node_modules/browserify-sign'), + 'sha.js': path.resolve(__dirname, 'node_modules/sha.js'), + 'des.js': path.resolve(__dirname, 'node_modules/des.js'), + 'diffie-hellman': path.resolve(__dirname, 'node_modules/diffie-hellman'), + 'md5.js': path.resolve(__dirname, 'node_modules/md5.js'), + 'js-sha3': path.resolve(__dirname, 'node_modules/js-sha3'), + 'parse-asn1': path.resolve(__dirname, 'node_modules/parse-asn1'), + } + }, + module: { + rules: [ + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader', + query: { + presets: [ + [ + '@babel/preset-env', + { + 'useBuiltIns': 'usage', + 'targets': { + 'browsers': [ + 'last 2 Chrome versions', + 'last 2 Safari versions', + 'last 2 Edge versions', + 'last 2 Firefox versions', + 'last 2 Electron versions', + 'last 2 Opera versions' + ], + 'node': true + } + } + ], + ], + plugins: ['@babel/plugin-proposal-export-default-from'] + } + } + ] + }, + plugins: [ + new BundleAnalyzerPlugin(), + new DuplicatePackageCheckerPlugin() + ], + optimization: { + minimizer: [ + new BabelMinify() + ] + } +}; From a7e3cf06e86d49d3f6b0ec301620f1f19e7a5eb2 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Sat, 20 Oct 2018 20:15:24 +0200 Subject: [PATCH 0301/1045] package.json cleaned --- dist/web3.min.js | 8 +- package-lock.json | 1035 +---------------- package.json | 10 - packages/web3-core-helpers/src/formatters.js | 2 +- .../src/factories/MethodModuleFactory.js | 2 +- packages/web3-core/src/AbstractWeb3Module.js | 12 +- packages/web3/src/index.js | 4 +- 7 files changed, 20 insertions(+), 1053 deletions(-) diff --git a/dist/web3.min.js b/dist/web3.min.js index 9f49d75bf3b..a601ddc2b46 100644 --- a/dist/web3.min.js +++ b/dist/web3.min.js @@ -1,17 +1,17 @@ -(function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&'object'==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,'default',{enumerable:!0,value:e}),2&r&&'string'!=typeof e)for(var a in e)t.d(n,a,function(t){return e[t]}.bind(null,a));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e['default']}:function(){return e};return t.d(r,'a',r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p='',t(t.s=340)})([function(e,t,r){var n=Math.floor,a=Math.min,o=Math.max;(function(e,r){var d,i;(function(){var s='object'==typeof self&&self.self===self&&self||'object'==typeof e&&e.global===e&&e||this||{},c=s._,f=Array.prototype,p=Object.prototype,l='undefined'==typeof Symbol?null:Symbol.prototype,u=f.push,b=f.slice,h=p.toString,m=p.hasOwnProperty,y=Array.isArray,g=Object.keys,v=Object.create,k=function(){},x=function(e){return e instanceof x?e:this instanceof x?void(this._wrapped=e):new x(e)};'undefined'==typeof t||t.nodeType?s._=x:('undefined'!=typeof r&&!r.nodeType&&r.exports&&(t=r.exports=x),t._=x),x.VERSION='1.9.0';var S=function(e,t,r){if(void 0===t)return e;switch(null==r?3:r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,n,a){return e.call(t,r,n,a)};case 4:return function(r,n,a,o){return e.call(t,r,n,a,o)};}return function(){return e.apply(t,arguments)}},w=function(e,t,r){return x.iteratee===A?null==e?x.identity:x.isFunction(e)?S(e,t,r):x.isObject(e)&&!x.isArray(e)?x.matcher(e):x.property(e):x.iteratee(e,t)},A;x.iteratee=A=function(e,t){return w(e,t,Infinity)};var E=function(e,t){return t=null==t?e.length-1:+t,function(){for(var r=o(arguments.length-t,0),n=Array(r),a=0;an&&(n=o)}else t=w(t,r),x.each(e,function(e,r,o){d=t(e,r,o),(d>a||d===-Infinity&&n===-Infinity)&&(n=e,a=d)});return n},x.min=function(e,t,r){var n=Infinity,a=Infinity,o,d;if(null==t||'number'==typeof t&&'object'!=typeof e[0]&&null!=e){e=B(e)?e:x.values(e);for(var s=0,i=e.length;sn||void 0===r)return 1;if(re.length?void 0:null==t||r?e[0]:x.initial(e,e.length-t)},x.initial=function(e,t,r){return b.call(e,0,o(0,e.length-(null==t||r?1:t)))},x.last=function(e,t,r){return null==e||1>e.length?void 0:null==t||r?e[e.length-1]:x.rest(e,o(0,e.length-t))},x.rest=x.tail=x.drop=function(e,t,r){return b.call(e,null==t||r?1:t)},x.compact=function(e){return x.filter(e,Boolean)};var L=function(e,t,r,n){n=n||[];for(var a=n.length,o=0,d=T(e),i;ot)return[];for(var r=[],n=0,a=e.length;nr)throw new Error('bindAll must be passed function names');for(;r--;){var n=t[r];e[n]=x.bind(e[n],e)}}),x.memoize=function(e,t){var r=function(n){var a=r.cache,o=''+(t?t.apply(this,arguments):n);return x.has(a,o)||(a[o]=e.apply(this,arguments)),a[o]};return r.cache={},r},x.delay=E(function(e,t,r){return setTimeout(function(){return e.apply(null,r)},t)}),x.defer=x.partial(x.delay,x,1),x.throttle=function(e,t,r){var n=0,a,o,d,i;r||(r={});var s=function(){n=!1===r.leading?0:x.now(),a=null,i=e.apply(o,d),a||(o=d=null)},c=function(){var c=x.now();n||!1!==r.leading||(n=c);var f=t-(c-n);return o=this,d=arguments,0>=f||f>t?(a&&(clearTimeout(a),a=null),n=c,i=e.apply(o,d),!a&&(o=d=null)):!a&&!1!==r.trailing&&(a=setTimeout(s,f)),i};return c.cancel=function(){clearTimeout(a),n=0,a=o=d=null},c},x.debounce=function(e,t,r){var n=function(t,r){o=null,r&&(d=e.apply(t,r))},a=E(function(a){if(o&&clearTimeout(o),r){var i=!o;o=setTimeout(n,t),i&&(d=e.apply(this,a))}else o=x.delay(n,t,this,a);return d}),o,d;return a.cancel=function(){clearTimeout(o),o=null},a},x.wrap=function(e,t){return x.partial(t,e)},x.negate=function(e){return function(){return!e.apply(this,arguments)}},x.compose=function(){var e=arguments,t=e.length-1;return function(){for(var r=t,n=e[t].apply(this,arguments);r--;)n=e[r].call(this,n);return n}},x.after=function(e,t){return function(){if(1>--e)return t.apply(this,arguments)}},x.before=function(e,t){var r;return function(){return 0<--e&&(r=t.apply(this,arguments)),1>=e&&(t=null),r}},x.once=x.partial(x.before,2),x.restArguments=E;var U=!{toString:null}.propertyIsEnumerable('toString'),H=['valueOf','isPrototypeOf','toString','propertyIsEnumerable','hasOwnProperty','toLocaleString'],F=function(e,t){var r=H.length,n=e.constructor,a=x.isFunction(n)&&n.prototype||p,o='constructor';for(x.has(e,o)&&!x.contains(t,o)&&t.push(o);r--;)o=H[r],o in e&&e[o]!==a[o]&&!x.contains(t,o)&&t.push(o)};x.keys=function(e){if(!x.isObject(e))return[];if(g)return g(e);var t=[];for(var r in e)x.has(e,r)&&t.push(r);return U&&F(e,t),t},x.allKeys=function(e){if(!x.isObject(e))return[];var t=[];for(var r in e)t.push(r);return U&&F(e,t),t},x.values=function(e){for(var t=x.keys(e),r=t.length,n=Array(r),a=0;an||null==r)return r;for(var a=1;a":'>','"':'"',"'":''',"`":'`'},X=x.invert(W),Y=function(e){var t=function(t){return e[t]},r='(?:'+x.keys(e).join('|')+')',n=RegExp(r),a=RegExp(r,'g');return function(e){return e=null==e?'':''+e,n.test(e)?e.replace(a,t):e}};x.escape=Y(W),x.unescape=Y(X),x.result=function(e,t,r){x.isArray(t)||(t=[t]);var n=t.length;if(!n)return x.isFunction(r)?r.call(e):r;for(var a=0,o;a/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,$={"'":'\'',"\\":'\\',"\r":'r',"\n":'n',"\u2028":'u2028',"\u2029":'u2029'},Q=/\\|'|\r|\n|\u2028|\u2029/g,ee=function(e){return'\\'+$[e]};x.template=function(e,t,r){!t&&r&&(t=r),t=x.defaults({},t,x.templateSettings);var n=RegExp([(t.escape||J).source,(t.interpolate||J).source,(t.evaluate||J).source].join('|')+'|$','g'),a=0,o='__p+=\'';e.replace(n,function(t,r,n,d,i){return o+=e.slice(a,i).replace(Q,ee),a=i+t.length,r?o+='\'+\n((__t=('+r+'))==null?\'\':_.escape(__t))+\n\'':n?o+='\'+\n((__t=('+n+'))==null?\'\':__t)+\n\'':d&&(o+='\';\n'+d+'\n__p+=\''),t}),o+='\';\n',t.variable||(o='with(obj||{}){\n'+o+'}\n'),o='var __t,__p=\'\',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,\'\');};\n'+o+'return __p;\n';var d;try{d=new Function(t.variable||'obj','_',o)}catch(t){throw t.source=o,t}var i=function(e){return d.call(this,e,x)},s=t.variable||'obj';return i.source='function('+s+'){\n'+o+'}',i},x.chain=function(e){var t=x(e);return t._chain=!0,t};var te=function(e,t){return e._chain?x(t).chain():t};x.mixin=function(e){return x.each(x.functions(e),function(t){var r=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return u.apply(e,arguments),te(this,r.apply(x,e))}}),x},x.mixin(x),x.each(['pop','push','reverse','shift','sort','splice','unshift'],function(e){var t=f[e];x.prototype[e]=function(){var r=this._wrapped;return t.apply(r,arguments),('shift'===e||'splice'===e)&&0===r.length&&delete r[0],te(this,r)}}),x.each(['concat','join','slice'],function(e){var t=f[e];x.prototype[e]=function(){return te(this,t.apply(this._wrapped,arguments))}}),x.prototype.value=function(){return this._wrapped},x.prototype.valueOf=x.prototype.toJSON=x.prototype.value,x.prototype.toString=function(){return this._wrapped+''},d=[],i=function(){return x}.apply(t,d),!(i!==void 0&&(r.exports=i))})()}).call(this,r(7),r(51)(e))},function(e,t,r){'use strict';var n=String.fromCharCode,a=r(15),o=r(16),d=r(8),i=r(0),s=r(22),c=r.n(s),f=r(52),p=r(2),l=r.n(p),u=r(83),b=r.n(u),h=r(86),m=r.n(h),y=r(18),g=r.n(y);const v=(e)=>e instanceof l.a||e&&e.constructor&&'BN'===e.constructor.name,k=(e)=>e&&e.constructor&&'BigNumber'===e.constructor.name,x=(t)=>{try{return b.a.apply(null,arguments)}catch(r){throw new Error(`${r} Given value: "${t}"`)}},S=(e)=>!!/^(0x)?[0-9a-f]{40}$/i.test(e)&&(!!(/^(0x|0X)?[0-9a-f]{40}$/.test(e)||/^(0x|0X)?[0-9A-F]{40}$/.test(e))||w(e)),w=(e)=>{e=e.replace(/^0x/i,'');const t=P(e.toLowerCase()).replace(/^0x/i,'');for(let r=0;40>r;r++)if(7=parseInt(t[r],16)&&e[r].toLowerCase()!==e[r])return!1;return!0},A=(e)=>{e=m.a.encode(e);let t='';e=e.replace(/^(?:\u0000)*/,''),e=e.split('').reverse().join(''),e=e.replace(/^(?:\u0000)*/,''),e=e.split('').reverse().join('');for(let r=0;ro.length?`0${o}`:o}return`0x${t}`},E=(e)=>{if(Object(i.isNull)(e)||Object(i.isUndefined)(e))return e;if(!isFinite(e)&&!C(e))throw new Error(`Given input "${e}" is not a number.`);const t=x(e),r=t.toString(16);return t.lt(new l.a(0))?`-0x${r.substr(1)}`:`0x${r}`},I=(e)=>{if(e=e.toString(16),!C(e))throw new Error(`Given value "${e}" is not a valid hex string.`);e=e.replace(/^0x/i,'');for(let t=[],r=0;r(Object(i.isString)(e)||Object(i.isNumber)(e))&&/^(-)?0x[0-9a-f]*$/i.test(e),P=(e)=>{C(e)&&/^0x/i.test(e.toString())&&(e=I(e));const t=g.a.keccak256(e);return t==='0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'?null:t};P._Hash=g.a;var T={BN:l.a,isBN:v,isBigNumber:k,toBN:x,isAddress:S,isBloom:(e)=>{if(!/^(0x)?[0-9a-f]{512}$/i.test(e))return!1;return!!(/^(0x)?[0-9a-f]{512}$/.test(e)||/^(0x)?[0-9A-F]{512}$/.test(e))},isTopic:(e)=>{if(!/^(0x)?[0-9a-f]{64}$/i.test(e))return!1;return!!(/^(0x)?[0-9a-f]{64}$/.test(e)||/^(0x)?[0-9A-F]{64}$/.test(e))},checkAddressChecksum:w,utf8ToHex:A,hexToUtf8:(e)=>{if(!C(e))throw new Error(`The parameter "${e}" must be a valid HEX string.`);let t='',r=0;e=e.replace(/^0x/i,''),e=e.replace(/^(?:00)*/,''),e=e.split('').reverse().join(''),e=e.replace(/^(?:00)*/,''),e=e.split('').reverse().join('');const a=e.length;for(let o=0;oe?x(e).toNumber():e,hexToNumberString:(e)=>e?x(e).toString(10):e,numberToHex:E,toHex:(e,t)=>{if(S(e))return t?'address':`0x${e.toLowerCase().replace(/^0x/i,'')}`;if(Object(i.isBoolean)(e))return t?'bool':e?'0x01':'0x00';if(Object(i.isObject)(e)&&!k(e)&&!v(e))return t?'string':A(JSON.stringify(e));if(Object(i.isString)(e)){if(0===e.indexOf('-0x')||0===e.indexOf('-0X'))return t?'int256':E(e);if(0===e.indexOf('0x')||0===e.indexOf('0X'))return t?'bytes':e;if(!isFinite(e))return t?'string':A(e)}return t?0>e?'int256':'uint256':E(e)},hexToBytes:I,bytesToHex:(e)=>{for(let t=[],r=0;r>>4).toString(16)),t.push((15&e[r]).toString(16));return`0x${hex.join('')}`},isHex:(e)=>(Object(i.isString)(e)||Object(i.isNumber)(e))&&/^(-0x|0x)?[0-9a-f]*$/i.test(e),isHexStrict:C,leftPad:(e,t,r)=>{const n=/^0x/i.test(e)||'number'==typeof e;e=e.toString(16).replace(/^0x/i,'');const a=0<=t-e.length+1?t-e.length+1:0;return(n?'0x':'')+Array(a).join(r?r:'0')+e},rightPad:(e,t,r)=>{const n=/^0x/i.test(e)||'number'==typeof e;e=e.toString(16).replace(/^0x/i,'');const a=0<=t-e.length+1?t-e.length+1:0;return(n?'0x':'')+e+Array(a).join(r?r:'0')},toTwosComplement:(e)=>`0x${x(e).toTwos(256).toString(16,64)}`,sha3:P};const B=(e)=>{if(e.startsWith('int['))return`int256${e.slice(3)}`;return'int'===e?'int256':e.startsWith('uint[')?`uint256${e.slice(4)}`:'uint'===e?'uint256':e.startsWith('fixed[')?`fixed128x128${e.slice(5)}`:'fixed'===e?'fixed128x128':e.startsWith('ufixed[')?`ufixed128x128${e.slice(6)}`:'ufixed'===e?'ufixed128x128':e},N=(e)=>{const t=/^\D+(\d+).*$/.exec(e);return t?parseInt(t[1],10):null},R=(e)=>{const t=/^\D+\d*\[(\d+)\]$/.exec(e);return t?parseInt(t[1],10):null},M=(e)=>{const t=typeof e;if('string'==t)return T.isHexStrict(e)?new l.a(e.replace(/0x/i,''),16):new l.a(e,10);if('number'==t)return new l.a(e);if(T.isBigNumber(e))return new l.a(e.toString(10));if(T.isBN(e))return e;throw new Error(`${e} is not a number`)},L=(e,t,r)=>{let n,a;if(e=B(e),'bytes'===e){if(0!=t.replace(/^0x/i,'').length%2)throw new Error(`Invalid bytes characters ${t.length}`);return t}if('string'===e)return T.utf8ToHex(t);if('bool'===e)return t?'01':'00';if(e.startsWith('address')){if(n=r?64:40,!T.isAddress(t))throw new Error(`${t} is not a valid address, or the checksum is invalid.`);return T.leftPad(t.toLowerCase(),n)}if(n=N(e),e.startsWith('bytes')){if(!n)throw new Error('bytes[] not yet supported in solidity');if(r&&(n=32),1>n||32n||256n)throw new Error(`Supplied uint exceeds width: ${n} vs ${a.bitLength()}`);if(a.lt(new l.a(0)))throw new Error(`Supplied uint ${a.toString()} is negative`);return n?T.leftPad(a.toString('hex'),2*(n/8)):a}if(e.startsWith('int')){if(n%8||8>n||256n)throw new Error(`Supplied int exceeds width: ${n} vs ${a.bitLength()}`);return a.lt(new l.a(0))?a.toTwos(n).toString('hex'):n?T.leftPad(a.toString('hex'),2*(n/8)):a}throw new Error(`Unsupported or invalid type: ${e}`)},j=(e)=>{if(Object(i.isArray)(e))throw new Error('Autodetection of array types is not supported.');let t='',r,n,a;if(Object(i.isObject)(e)&&(e.hasOwnProperty('v')||e.hasOwnProperty('t')||e.hasOwnProperty('value')||e.hasOwnProperty('type'))?(r=e.hasOwnProperty('t')?e.t:e.type,t=e.hasOwnProperty('v')?e.v:e.value):(r=T.toHex(e,!0),t=T.toHex(e),!r.startsWith('int')&&!r.startsWith('uint')&&(r='bytes')),(r.startsWith('int')||r.startsWith('uint'))&&'string'==typeof t&&!/^(-)?0x/i.test(t)&&(t=new l.a(t)),Object(i.isArray)(t))if(a=R(r),a&&t.length!==a)throw new Error(`${r} is not matching the given array ${JSON.stringify(t)}`);else a=t.length;return Object(i.isArray)(t)?(n=t.map((e)=>L(r,e,a).toString('hex').replace('0x','')),n.join('')):(n=L(r,t,a),n.toString('hex').replace('0x',''))};var O=r(155),D=r.n(O);const U=(e,t)=>{const r=[];return t.forEach((t)=>{if('object'==typeof t.components){if('tuple'!==t.type.substring(0,5))throw new Error('components found but type is not tuple; report on GitHub');let n='';const a=t.type.indexOf('[');0<=a&&(n=t.type.substring(a));const o=U(e,t.components);Object(i.isArray)(o)&&e?r.push(`tuple(${o.join(',')})${n}`):e?r.push(`(${o})`):r.push(`(${o.join(',')})${n}`)}else r.push(t.type)}),r},H=(e)=>{if(!T.isHexStrict(e))throw new Error('The parameter must be a valid HEX string.');let t='',r=0;const a=e.length;for('0x'===e.substring(0,2)&&(r=2);r{if(!e)return'0x00';let t='';for(let r=0;ro.length?`0${o}`:o}return`0x${t}`},q=(e)=>{if(e=e?e.toLowerCase():'ether',!c.a.unitMap[e])throw new Error(`This unit "${e}" doesn't exist, please use the one of the following units${JSON.stringify(c.a.unitMap,null,2)}`);return e};t.a={_fireError:(e,t,r,n)=>(Object(i.isObject)(e)&&!(e instanceof Error)&&e.data&&((Object(i.isObject)(e.data)||Object(i.isArray)(e.data))&&(e.data=JSON.stringify(e.data,null,2)),e=`${e.message}\n${e.data}`),Object(i.isString)(e)&&(e=new Error(e)),Object(i.isFunction)(n)&&n(e),Object(i.isFunction)(r)&&((t&&Object(i.isFunction)(t.listeners)&&t.listeners('error').length||Object(i.isFunction)(n))&&t.catch(()=>{}),setTimeout(()=>{r(e)},1)),t&&Object(i.isFunction)(t.emit)&&setTimeout(()=>{t.emit('error',e),t.removeAllListeners()},1),t),_jsonInterfaceMethodToString:(e)=>Object(i.isObject)(e)&&e.name&&-1!==e.name.indexOf('(')?e.name:`${e.name}(${U(!1,e.inputs).join(',')})`,_flattenTypes:U,randomHex:D.a,_,BN:T.BN,isBN:T.isBN,isBigNumber:T.isBigNumber,isHex:T.isHex,isHexStrict:T.isHexStrict,sha3:T.sha3,keccak256:T.sha3,soliditySha3:()=>{const e=Array.prototype.slice.call(arguments),t=Object(i.map)(e,j);return T.sha3(`0x${t.join('')}`)},isAddress:T.isAddress,checkAddressChecksum:T.checkAddressChecksum,toChecksumAddress:(e)=>{if('undefined'==typeof e)return'';if(!/^(0x)?[0-9a-f]{40}$/i.test(e))throw new Error(`Given address "${e}" is not a valid Ethereum address.`);e=e.toLowerCase().replace(/^0x/i,'');const t=T.sha3(e).replace(/^0x/i,'');let r='0x';for(let n=0;n{if(t=q(t),!T.isBN(e)&&!Object(i.isString)(e))throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.');return T.isBN(e)?c.a.toWei(e,t):c.a.toWei(e,t).toString(10)},fromWei:(e,t)=>{if(t=q(t),!T.isBN(e)&&!Object(i.isString)(e))throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.');return T.isBN(e)?c.a.fromWei(e,t):c.a.fromWei(e,t).toString(10)},padLeft:T.leftPad,leftPad:T.leftPad,padRight:T.rightPad,rightPad:T.rightPad,toTwosComplement:T.toTwosComplement}},function(e,t,r){var n=Math.ceil,o=Math.min,d=Math.max;(function(e){(function(e,t){'use strict';function f(e,t){if(!e)throw new Error(t||'Assertion failed')}function a(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function h(e,t,r){return h.isBN(e)?e:void(this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(('le'===t||'be'===t)&&(r=t,t=10),this._init(e||0,t||10,r||'be')))}function s(e,t,n){for(var a=0,r=o(e.length,n),d=t,i;d=i?i-49+10:17<=i&&22>=i?i-17+10:15&i;return a}function c(e,t,n,a){for(var d=0,r=o(e.length,n),s=t,i;s>>a}return t}function i(e,t,n){n.negative=t.negative^e.negative;var s=0|e.length+t.length;n.length=s,s=0|s-1;var c=0|e.words[0],a=0|t.words[0],f=c*a,r=67108863&f,p=0|f/67108864;n.words[0]=r;for(var l=1;l>>26,b=67108863&p,h=o(l,t.length-1),m=d(0,l-e.length+1),y;m<=h;m++)y=0|l-m,c=0|e.words[y],a=0|t.words[m],f=c*a+b,u+=0|f/67108864,b=67108863&f;n.words[l]=0|b,p=0|u}return 0==p?n.length--:n.words[l]=0|p,n.strip()}function l(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var s=0,c=0,f=0,p;f>>26),c+=p>>>26,p&=67108863}n.words[f]=l,s=p,p=c}return 0==s?n.length--:n.words[f]=s,n.strip()}function u(e,t,r){var n=new b;return n.mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}function m(e,t){this.name=e,this.p=new h(t,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,'k256','ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f')}function g(){m.call(this,'p224','ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001')}function v(){m.call(this,'p192','ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff')}function k(){m.call(this,'25519','7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed')}function x(e){if('string'==typeof e){var t=h._prime(e);this.m=t.p,this.prime=t}else f(e.gtn(1),'modulus must be greater than 1'),this.m=e,this.prime=null}function S(e){x.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var w=Math.imul,A=Math.clz32;'object'==typeof e?e.exports=h:t.BN=h,h.BN=h,h.wordSize=26;var E;try{E=r(190).Buffer}catch(t){}h.isBN=function(e){return!!(e instanceof h)||null!==e&&'object'==typeof e&&e.constructor.wordSize===h.wordSize&&Array.isArray(e.words)},h.max=function(e,t){return 0e.cmp(t)?e:t},h.prototype._init=function(e,t,r){if('number'==typeof e)return this._initNumber(e,t,r);if('object'==typeof e)return this._initArray(e,t,r);'hex'===t&&(t=16),f(t===(0|t)&&2<=t&&36>=t),e=e.toString().replace(/\s+/g,'');var n=0;'-'===e[0]&&n++,16===t?this._parseHex(e,n):this._parseBase(e,t,n),'-'===e[0]&&(this.negative=1),this.strip();'le'!==r||this._initArray(this.toArray(),t,r)},h.prototype._initNumber=function(e,t,r){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(f(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3);'le'!==r||this._initArray(this.toArray(),t,r)},h.prototype._initArray=function(e,t,r){if(f('number'==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=n(e.length/3),this.words=Array(this.length);for(var a=0;a>>26-o,o+=24,26<=o&&(o-=26,d++);else if('le'===r)for(a=0,d=0;a>>26-o,o+=24,26<=o&&(o-=26,d++);return this.strip()},h.prototype._parseHex=function(e,t){this.length=n((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=6)d=s(e,r,r+6),this.words[o]|=67108863&d<>>26-a,a+=24,26<=a&&(a-=26,o++);r+6!==t&&(d=s(e,t,r+6),this.words[o]|=67108863&d<>>26-a),this.strip()},h.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;67108863>=a;a*=t)n++;n--,a=0|a/t;for(var d=e.length-r,s=d%n,f=o(d,d-s)+r,p=0,l=r;lthis.words[0]+p?this.words[0]+=p:this._iaddn(p);if(0!=s){var i=1;for(p=c(e,l,e.length,t),l=0;lthis.words[0]+p?this.words[0]+=p:this._iaddn(p)}},h.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t'};var I=['','0','00','000','0000','00000','000000','0000000','00000000','000000000','0000000000','00000000000','000000000000','0000000000000','00000000000000','000000000000000','0000000000000000','00000000000000000','000000000000000000','0000000000000000000','00000000000000000000','000000000000000000000','0000000000000000000000','00000000000000000000000','000000000000000000000000','0000000000000000000000000'],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],P=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(e,t){e=e||10,t=0|t||1;var n;if(16===e||'hex'===e){n='';for(var a=0,o=0,d=0;d>>24-a,n=0!=o||d!==this.length-1?I[6-s.length]+s+n:s+n,a+=2,26<=a&&(a-=26,d--)}for(0!=o&&(n=o.toString(16)+n);0!=n.length%t;)n='0'+n;return 0!==this.negative&&(n='-'+n),n}if(e===(0|e)&&2<=e&&36>=e){var p=C[e],l=P[e];n='';var u=this.clone();for(u.negative=0;!u.isZero();){var c=u.modn(l).toString(e);u=u.idivn(l),n=u.isZero()?c+n:I[p-c.length]+c+n}for(this.isZero()&&(n='0'+n);0!=n.length%t;)n='0'+n;return 0!==this.negative&&(n='-'+n),n}f(!1,'Base should be between 2 and 36')},h.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=n&&(t+=7,n>>>=7),8<=n&&(t+=4,n>>>=4),2<=n&&(t+=2,n>>>=2),t+n},h.prototype._zeroBits=function(e){if(0===e)return 26;var n=e,t=0;return 0==(8191&n)&&(t+=13,n>>>=13),0==(127&n)&&(t+=7,n>>>=7),0==(15&n)&&(t+=4,n>>>=4),0==(3&n)&&(t+=2,n>>>=2),0==(1&n)&&t++,t},h.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0,r;te.length?this.clone().ior(e):e.clone().ior(this)},h.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},h.prototype.iuand=function(e){var t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},h.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},h.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},h.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},h.prototype.inotn=function(e){f('number'==typeof e&&0<=e);var t=0|n(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},h.prototype.notn=function(e){return this.clone().inotn(e)},h.prototype.setn=function(e,t){f('number'==typeof e&&0<=e);var r=0|e/26,n=e%26;return this._expand(r+1),t?this.words[r]|=1<e.length?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o>>26;for(;0!=a&&o>>26;if(this.length=r.length,0!=a)this.words[this.length]=a,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},h.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,a;0>26,this.words[s]=67108863&t;for(;0!=o&&s>26,this.words[s]=67108863&t;if(0==o&&s>>13,f=0|n[1],p=8191&f,l=f>>>13,u=0|n[2],b=8191&u,h=u>>>13,m=0|n[3],y=8191&m,g=m>>>13,v=0|n[4],k=8191&v,x=v>>>13,S=0|n[5],A=8191&S,E=S>>>13,I=0|n[6],C=8191&I,P=I>>>13,T=0|n[7],B=8191&T,N=T>>>13,R=0|n[8],M=8191&R,L=R>>>13,j=0|n[9],O=8191&j,D=j>>>13,U=0|a[0],H=8191&U,F=U>>>13,q=0|a[1],z=8191&q,K=q>>>13,V=0|a[2],G=8191&V,W=V>>>13,X=0|a[3],Y=8191&X,Z=X>>>13,J=0|a[4],$=8191&J,Q=J>>>13,ee=0|a[5],te=8191&ee,re=ee>>>13,ne=0|a[6],ae=8191&ne,oe=ne>>>13,de=0|a[7],ie=8191&de,se=de>>>13,ce=0|a[8],fe=8191&ce,pe=ce>>>13,le=0|a[9],ue=8191&le,be=le>>>13,he,me,ye;r.negative=e.negative^t.negative,r.length=19,he=w(s,H),me=w(s,F),me=0|me+w(c,H),ye=w(c,F);var ge=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(ge>>>26),ge&=67108863,he=w(p,H),me=w(p,F),me=0|me+w(l,H),ye=w(l,F),he=0|he+w(s,z),me=0|me+w(s,K),me=0|me+w(c,z),ye=0|ye+w(c,K);var _e=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(_e>>>26),_e&=67108863,he=w(b,H),me=w(b,F),me=0|me+w(h,H),ye=w(h,F),he=0|he+w(p,z),me=0|me+w(p,K),me=0|me+w(l,z),ye=0|ye+w(l,K),he=0|he+w(s,G),me=0|me+w(s,W),me=0|me+w(c,G),ye=0|ye+w(c,W);var ve=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(ve>>>26),ve&=67108863,he=w(y,H),me=w(y,F),me=0|me+w(g,H),ye=w(g,F),he=0|he+w(b,z),me=0|me+w(b,K),me=0|me+w(h,z),ye=0|ye+w(h,K),he=0|he+w(p,G),me=0|me+w(p,W),me=0|me+w(l,G),ye=0|ye+w(l,W),he=0|he+w(s,Y),me=0|me+w(s,Z),me=0|me+w(c,Y),ye=0|ye+w(c,Z);var ke=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(ke>>>26),ke&=67108863,he=w(k,H),me=w(k,F),me=0|me+w(x,H),ye=w(x,F),he=0|he+w(y,z),me=0|me+w(y,K),me=0|me+w(g,z),ye=0|ye+w(g,K),he=0|he+w(b,G),me=0|me+w(b,W),me=0|me+w(h,G),ye=0|ye+w(h,W),he=0|he+w(p,Y),me=0|me+w(p,Z),me=0|me+w(l,Y),ye=0|ye+w(l,Z),he=0|he+w(s,$),me=0|me+w(s,Q),me=0|me+w(c,$),ye=0|ye+w(c,Q);var xe=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(xe>>>26),xe&=67108863,he=w(A,H),me=w(A,F),me=0|me+w(E,H),ye=w(E,F),he=0|he+w(k,z),me=0|me+w(k,K),me=0|me+w(x,z),ye=0|ye+w(x,K),he=0|he+w(y,G),me=0|me+w(y,W),me=0|me+w(g,G),ye=0|ye+w(g,W),he=0|he+w(b,Y),me=0|me+w(b,Z),me=0|me+w(h,Y),ye=0|ye+w(h,Z),he=0|he+w(p,$),me=0|me+w(p,Q),me=0|me+w(l,$),ye=0|ye+w(l,Q),he=0|he+w(s,te),me=0|me+w(s,re),me=0|me+w(c,te),ye=0|ye+w(c,re);var Se=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Se>>>26),Se&=67108863,he=w(C,H),me=w(C,F),me=0|me+w(P,H),ye=w(P,F),he=0|he+w(A,z),me=0|me+w(A,K),me=0|me+w(E,z),ye=0|ye+w(E,K),he=0|he+w(k,G),me=0|me+w(k,W),me=0|me+w(x,G),ye=0|ye+w(x,W),he=0|he+w(y,Y),me=0|me+w(y,Z),me=0|me+w(g,Y),ye=0|ye+w(g,Z),he=0|he+w(b,$),me=0|me+w(b,Q),me=0|me+w(h,$),ye=0|ye+w(h,Q),he=0|he+w(p,te),me=0|me+w(p,re),me=0|me+w(l,te),ye=0|ye+w(l,re),he=0|he+w(s,ae),me=0|me+w(s,oe),me=0|me+w(c,ae),ye=0|ye+w(c,oe);var we=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(we>>>26),we&=67108863,he=w(B,H),me=w(B,F),me=0|me+w(N,H),ye=w(N,F),he=0|he+w(C,z),me=0|me+w(C,K),me=0|me+w(P,z),ye=0|ye+w(P,K),he=0|he+w(A,G),me=0|me+w(A,W),me=0|me+w(E,G),ye=0|ye+w(E,W),he=0|he+w(k,Y),me=0|me+w(k,Z),me=0|me+w(x,Y),ye=0|ye+w(x,Z),he=0|he+w(y,$),me=0|me+w(y,Q),me=0|me+w(g,$),ye=0|ye+w(g,Q),he=0|he+w(b,te),me=0|me+w(b,re),me=0|me+w(h,te),ye=0|ye+w(h,re),he=0|he+w(p,ae),me=0|me+w(p,oe),me=0|me+w(l,ae),ye=0|ye+w(l,oe),he=0|he+w(s,ie),me=0|me+w(s,se),me=0|me+w(c,ie),ye=0|ye+w(c,se);var Ae=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ae>>>26),Ae&=67108863,he=w(M,H),me=w(M,F),me=0|me+w(L,H),ye=w(L,F),he=0|he+w(B,z),me=0|me+w(B,K),me=0|me+w(N,z),ye=0|ye+w(N,K),he=0|he+w(C,G),me=0|me+w(C,W),me=0|me+w(P,G),ye=0|ye+w(P,W),he=0|he+w(A,Y),me=0|me+w(A,Z),me=0|me+w(E,Y),ye=0|ye+w(E,Z),he=0|he+w(k,$),me=0|me+w(k,Q),me=0|me+w(x,$),ye=0|ye+w(x,Q),he=0|he+w(y,te),me=0|me+w(y,re),me=0|me+w(g,te),ye=0|ye+w(g,re),he=0|he+w(b,ae),me=0|me+w(b,oe),me=0|me+w(h,ae),ye=0|ye+w(h,oe),he=0|he+w(p,ie),me=0|me+w(p,se),me=0|me+w(l,ie),ye=0|ye+w(l,se),he=0|he+w(s,fe),me=0|me+w(s,pe),me=0|me+w(c,fe),ye=0|ye+w(c,pe);var Ee=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ee>>>26),Ee&=67108863,he=w(O,H),me=w(O,F),me=0|me+w(D,H),ye=w(D,F),he=0|he+w(M,z),me=0|me+w(M,K),me=0|me+w(L,z),ye=0|ye+w(L,K),he=0|he+w(B,G),me=0|me+w(B,W),me=0|me+w(N,G),ye=0|ye+w(N,W),he=0|he+w(C,Y),me=0|me+w(C,Z),me=0|me+w(P,Y),ye=0|ye+w(P,Z),he=0|he+w(A,$),me=0|me+w(A,Q),me=0|me+w(E,$),ye=0|ye+w(E,Q),he=0|he+w(k,te),me=0|me+w(k,re),me=0|me+w(x,te),ye=0|ye+w(x,re),he=0|he+w(y,ae),me=0|me+w(y,oe),me=0|me+w(g,ae),ye=0|ye+w(g,oe),he=0|he+w(b,ie),me=0|me+w(b,se),me=0|me+w(h,ie),ye=0|ye+w(h,se),he=0|he+w(p,fe),me=0|me+w(p,pe),me=0|me+w(l,fe),ye=0|ye+w(l,pe),he=0|he+w(s,ue),me=0|me+w(s,be),me=0|me+w(c,ue),ye=0|ye+w(c,be);var Ie=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ie>>>26),Ie&=67108863,he=w(O,z),me=w(O,K),me=0|me+w(D,z),ye=w(D,K),he=0|he+w(M,G),me=0|me+w(M,W),me=0|me+w(L,G),ye=0|ye+w(L,W),he=0|he+w(B,Y),me=0|me+w(B,Z),me=0|me+w(N,Y),ye=0|ye+w(N,Z),he=0|he+w(C,$),me=0|me+w(C,Q),me=0|me+w(P,$),ye=0|ye+w(P,Q),he=0|he+w(A,te),me=0|me+w(A,re),me=0|me+w(E,te),ye=0|ye+w(E,re),he=0|he+w(k,ae),me=0|me+w(k,oe),me=0|me+w(x,ae),ye=0|ye+w(x,oe),he=0|he+w(y,ie),me=0|me+w(y,se),me=0|me+w(g,ie),ye=0|ye+w(g,se),he=0|he+w(b,fe),me=0|me+w(b,pe),me=0|me+w(h,fe),ye=0|ye+w(h,pe),he=0|he+w(p,ue),me=0|me+w(p,be),me=0|me+w(l,ue),ye=0|ye+w(l,be);var Ce=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ce>>>26),Ce&=67108863,he=w(O,G),me=w(O,W),me=0|me+w(D,G),ye=w(D,W),he=0|he+w(M,Y),me=0|me+w(M,Z),me=0|me+w(L,Y),ye=0|ye+w(L,Z),he=0|he+w(B,$),me=0|me+w(B,Q),me=0|me+w(N,$),ye=0|ye+w(N,Q),he=0|he+w(C,te),me=0|me+w(C,re),me=0|me+w(P,te),ye=0|ye+w(P,re),he=0|he+w(A,ae),me=0|me+w(A,oe),me=0|me+w(E,ae),ye=0|ye+w(E,oe),he=0|he+w(k,ie),me=0|me+w(k,se),me=0|me+w(x,ie),ye=0|ye+w(x,se),he=0|he+w(y,fe),me=0|me+w(y,pe),me=0|me+w(g,fe),ye=0|ye+w(g,pe),he=0|he+w(b,ue),me=0|me+w(b,be),me=0|me+w(h,ue),ye=0|ye+w(h,be);var Pe=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Pe>>>26),Pe&=67108863,he=w(O,Y),me=w(O,Z),me=0|me+w(D,Y),ye=w(D,Z),he=0|he+w(M,$),me=0|me+w(M,Q),me=0|me+w(L,$),ye=0|ye+w(L,Q),he=0|he+w(B,te),me=0|me+w(B,re),me=0|me+w(N,te),ye=0|ye+w(N,re),he=0|he+w(C,ae),me=0|me+w(C,oe),me=0|me+w(P,ae),ye=0|ye+w(P,oe),he=0|he+w(A,ie),me=0|me+w(A,se),me=0|me+w(E,ie),ye=0|ye+w(E,se),he=0|he+w(k,fe),me=0|me+w(k,pe),me=0|me+w(x,fe),ye=0|ye+w(x,pe),he=0|he+w(y,ue),me=0|me+w(y,be),me=0|me+w(g,ue),ye=0|ye+w(g,be);var Te=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Te>>>26),Te&=67108863,he=w(O,$),me=w(O,Q),me=0|me+w(D,$),ye=w(D,Q),he=0|he+w(M,te),me=0|me+w(M,re),me=0|me+w(L,te),ye=0|ye+w(L,re),he=0|he+w(B,ae),me=0|me+w(B,oe),me=0|me+w(N,ae),ye=0|ye+w(N,oe),he=0|he+w(C,ie),me=0|me+w(C,se),me=0|me+w(P,ie),ye=0|ye+w(P,se),he=0|he+w(A,fe),me=0|me+w(A,pe),me=0|me+w(E,fe),ye=0|ye+w(E,pe),he=0|he+w(k,ue),me=0|me+w(k,be),me=0|me+w(x,ue),ye=0|ye+w(x,be);var Be=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Be>>>26),Be&=67108863,he=w(O,te),me=w(O,re),me=0|me+w(D,te),ye=w(D,re),he=0|he+w(M,ae),me=0|me+w(M,oe),me=0|me+w(L,ae),ye=0|ye+w(L,oe),he=0|he+w(B,ie),me=0|me+w(B,se),me=0|me+w(N,ie),ye=0|ye+w(N,se),he=0|he+w(C,fe),me=0|me+w(C,pe),me=0|me+w(P,fe),ye=0|ye+w(P,pe),he=0|he+w(A,ue),me=0|me+w(A,be),me=0|me+w(E,ue),ye=0|ye+w(E,be);var Ne=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ne>>>26),Ne&=67108863,he=w(O,ae),me=w(O,oe),me=0|me+w(D,ae),ye=w(D,oe),he=0|he+w(M,ie),me=0|me+w(M,se),me=0|me+w(L,ie),ye=0|ye+w(L,se),he=0|he+w(B,fe),me=0|me+w(B,pe),me=0|me+w(N,fe),ye=0|ye+w(N,pe),he=0|he+w(C,ue),me=0|me+w(C,be),me=0|me+w(P,ue),ye=0|ye+w(P,be);var Re=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Re>>>26),Re&=67108863,he=w(O,ie),me=w(O,se),me=0|me+w(D,ie),ye=w(D,se),he=0|he+w(M,fe),me=0|me+w(M,pe),me=0|me+w(L,fe),ye=0|ye+w(L,pe),he=0|he+w(B,ue),me=0|me+w(B,be),me=0|me+w(N,ue),ye=0|ye+w(N,be);var Me=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Me>>>26),Me&=67108863,he=w(O,fe),me=w(O,pe),me=0|me+w(D,fe),ye=w(D,pe),he=0|he+w(M,ue),me=0|me+w(M,be),me=0|me+w(L,ue),ye=0|ye+w(L,be);var Le=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Le>>>26),Le&=67108863,he=w(O,ue),me=w(O,be),me=0|me+w(D,ue),ye=w(D,be);var je=0|(0|o+he)+((8191&me)<<13);return o=0|(0|ye+(me>>>13))+(je>>>26),je&=67108863,d[0]=ge,d[1]=_e,d[2]=ve,d[3]=ke,d[4]=xe,d[5]=Se,d[6]=we,d[7]=Ae,d[8]=Ee,d[9]=Ie,d[10]=Ce,d[11]=Pe,d[12]=Te,d[13]=Be,d[14]=Ne,d[15]=Re,d[16]=Me,d[17]=Le,d[18]=je,0!=o&&(d[19]=o,r.length++),r};w||(T=i),h.prototype.mulTo=function(e,t){var r=this.length+e.length,n;return n=10===this.length&&10===e.length?T(this,e,t):63>r?i(this,e,t):1024>r?l(this,e,t):u(this,e,t),n},b.prototype.makeRBT=function(e){for(var r=Array(e),t=h.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,a,o){for(var d=0;d>>=1)a++;return 1<=n))for(var a=0,o;ao?0:0|o/67108864;return e},b.prototype.convert13b=function(e,t,r,n){for(var a=0,o=0;o>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;oe);for(var t=0,r=0;r>=26,t+=0|n/67108864,t+=a>>>26,this.words[r]=67108863&a}return 0!=t&&(this.words[r]=t,this.length++),this},h.prototype.muln=function(e){return this.clone().imuln(e)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(e){var t=p(e);if(0===t.length)return new h(1);for(var r=this,n=0;n>>26-t<<26-t,d=(0|this.words[n])-o<>>26-t}a&&(this.words[n]=a,this.length++)}if(0!=r){for(n=this.length-1;0<=n;n--)this.words[n+r]=this.words[n];for(n=0;nr)for(this.length-=r,p=0;p=a);p--){var l=0|this.words[p];this.words[p]=i<<26-c|l>>>c,i=l&(67108863^67108863>>>c<>>t<e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;tthis.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},h.prototype.addn=function(e){return this.clone().iaddn(e)},h.prototype.subn=function(e){return this.clone().isubn(e)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(e,t,r){var n=e.length+r,a;this._expand(n);var o=0,d;for(a=0;a>26)-(0|i/67108864),this.words[a+r]=67108863&d}for(;a>26,this.words[a+r]=67108863&d;if(0==o)return this.strip();for(f(-1==o),o=0,a=0;a>26,this.words[a]=67108863&d;return this.negative=1,this.strip()},h.prototype._wordDiv=function(e,t){var r=this.length-e.length,n=this.clone(),d=e,s=0|d.words[d.length-1],c=this._countBits(s);r=26-c,0!=r&&(d=d.ushln(r),n.iushln(r),s=0|d.words[d.length-1]);var f=n.length-d.length,p;if('mod'!==t){p=new h(null),p.length=f+1,p.words=Array(p.length);for(var l=0;lthis.length||0>this.cmp(e)?{div:new h(0),mod:this}:1===e.length?'div'===t?{div:this.divn(e.words[0]),mod:null}:'mod'===t?{div:null,mod:new h(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new h(this.modn(e.words[0]))}:this._wordDiv(e,t):(o=this.neg().divmod(e.neg(),t),'div'!==t&&(a=o.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:o.div,mod:a})},h.prototype.div=function(e){return this.divmod(e,'div',!1).div},h.prototype.mod=function(e){return this.divmod(e,'mod',!1).mod},h.prototype.umod=function(e){return this.divmod(e,'mod',!0).mod},h.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0===t.div.negative?t.mod:t.mod.isub(e),n=e.ushrn(1),a=e.andln(1),o=r.cmp(n);return 0>o||1===a&&0===o?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},h.prototype.modn=function(e){f(67108863>=e);for(var t=0,r=this.length-1;0<=r;r--)t=(67108864%e*t+(0|this.words[r]))%e;return t},h.prototype.idivn=function(e){f(67108863>=e);for(var t=0,r=this.length-1,n;0<=r;r--)n=(0|this.words[r])+67108864*t,this.words[r]=0|n/e,t=n%e;return this.strip()},h.prototype.divn=function(e){return this.clone().idivn(e)},h.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var t=this,r=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var n=new h(1),a=new h(0),o=new h(0),d=new h(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var c=r.clone(),p=t.clone();!t.isZero();){for(var l=0,i=1;0==(t.words[0]&i)&&26>l;++l,i<<=1);if(0u;++u,b<<=1);if(0d;++d,i<<=1);if(0s;++s,c<<=1);if(0p.cmpn(0)&&p.iadd(e),p},h.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var n=this.clone(),a=e.clone();n.negative=0,a.negative=0;for(var o=0;n.isEven()&&a.isEven();o++)n.iushrn(1),a.iushrn(1);do{for(;n.isEven();)n.iushrn(1);for(;a.isEven();)a.iushrn(1);var d=n.cmp(a);if(0>d){var r=n;n=a,a=r}else if(0===d||0===a.cmpn(1))break;n.isub(a)}while(!0);return a.iushln(o)},h.prototype.invm=function(e){return this.egcd(e).a.umod(e)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(e){return this.words[0]&e},h.prototype.bincn=function(e){f('number'==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,d&=67108863,this.words[o]=d;return 0!=a&&(this.words[o]=a,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(e){var t=0>e;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;this.strip();var r;if(1=e,'Number is too big');var n=0|this.words[0];r=n===e?0:ne.length)return 1;if(this.lengtha&&(t=1);break}}return t},h.prototype.gtn=function(e){return 1===this.cmpn(e)},h.prototype.gt=function(e){return 1===this.cmp(e)},h.prototype.gten=function(e){return 0<=this.cmpn(e)},h.prototype.gte=function(e){return 0<=this.cmp(e)},h.prototype.ltn=function(e){return-1===this.cmpn(e)},h.prototype.lt=function(e){return-1===this.cmp(e)},h.prototype.lten=function(e){return 0>=this.cmpn(e)},h.prototype.lte=function(e){return 0>=this.cmp(e)},h.prototype.eqn=function(e){return 0===this.cmpn(e)},h.prototype.eq=function(e){return 0===this.cmp(e)},h.red=function(e){return new x(e)},h.prototype.toRed=function(e){return f(!this.red,'Already a number in reduction context'),f(0===this.negative,'red works only with positives'),e.convertTo(this)._forceRed(e)},h.prototype.fromRed=function(){return f(this.red,'fromRed works only with numbers in reduction context'),this.red.convertFrom(this)},h.prototype._forceRed=function(e){return this.red=e,this},h.prototype.forceRed=function(e){return f(!this.red,'Already a number in reduction context'),this._forceRed(e)},h.prototype.redAdd=function(e){return f(this.red,'redAdd works only with red numbers'),this.red.add(this,e)},h.prototype.redIAdd=function(e){return f(this.red,'redIAdd works only with red numbers'),this.red.iadd(this,e)},h.prototype.redSub=function(e){return f(this.red,'redSub works only with red numbers'),this.red.sub(this,e)},h.prototype.redISub=function(e){return f(this.red,'redISub works only with red numbers'),this.red.isub(this,e)},h.prototype.redShl=function(e){return f(this.red,'redShl works only with red numbers'),this.red.shl(this,e)},h.prototype.redMul=function(e){return f(this.red,'redMul works only with red numbers'),this.red._verify2(this,e),this.red.mul(this,e)},h.prototype.redIMul=function(e){return f(this.red,'redMul works only with red numbers'),this.red._verify2(this,e),this.red.imul(this,e)},h.prototype.redSqr=function(){return f(this.red,'redSqr works only with red numbers'),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return f(this.red,'redISqr works only with red numbers'),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return f(this.red,'redSqrt works only with red numbers'),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return f(this.red,'redInvm works only with red numbers'),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return f(this.red,'redNeg works only with red numbers'),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(e){return f(this.red&&!e.red,'redPow(normalNum)'),this.red._verify1(this),this.red.pow(this,e)};var B={k256:null,p224:null,p192:null,p25519:null};m.prototype._tmp=function(){var e=new h(null);return e.words=Array(n(this.n/13)),e},m.prototype.ireduce=function(e){var t=e,r;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),r=t.bitLength();while(r>this.n);var n=r=e.length)return e.words[0]=0,void(e.length=1);var d=e.words[9];for(t.words[t.length++]=d&r,a=10;a>>22,d=i}d>>>=22,e.words[a-10]=d,e.length-=0===d&&10>>=26,e.words[r]=a,t=n}return 0!=t&&(e.words[e.length++]=t),e},h._prime=function(e){if(B[e])return B[e];var t;if('k256'===e)t=new y;else if('p224'===e)t=new g;else if('p192'===e)t=new v;else if('p25519'===e)t=new k;else throw new Error('Unknown prime '+e);return B[e]=t,t},x.prototype._verify1=function(e){f(0===e.negative,'red works only with positives'),f(e.red,'red works only with red numbers')},x.prototype._verify2=function(e,t){f(0==(e.negative|t.negative),'red works only with positives'),f(e.red&&e.red===t.red,'red works only with red numbers')},x.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},x.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},x.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},x.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},x.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},x.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},x.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},x.prototype.isqr=function(e){return this.imul(e,e.clone())},x.prototype.sqr=function(e){return this.mul(e,e)},x.prototype.sqrt=function(e){if(e.isZero())return e.clone();var n=this.m.andln(3);if(f(1==n%2),3===n){var a=this.m.add(new h(1)).iushrn(2);return this.pow(e,a)}for(var o=this.m.subn(1),d=0;!o.isZero()&&0===o.andln(1);)d++,o.iushrn(1);f(!o.isZero());var s=new h(1).toRed(this),p=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new h(2*u*u).toRed(this);0!==this.pow(u,l).cmp(p);)u.redIAdd(p);for(var y=this.pow(u,o),c=this.pow(e,o.addn(1).iushrn(1)),r=this.pow(e,o),t=d;0!==r.cmp(s);){for(var m=r,g=0;0!==m.cmp(s);g++)m=m.redSqr();f(g>f,o!==n[0]&&(o=this.sqr(o)),0===p&&0==d){i=0;continue}d<<=1,d|=p,i++,i!=r&&(0!==a||0!==f)||(o=this.mul(o,n[d]),i=0,d=0)}s=26}return o},x.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},x.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},h.mont=function(e){return new S(e)},a(S,x),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,r){if(e.isZero()||r.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(r),t=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(t).iushrn(this.shift),o=a;return 0<=a.cmp(this.m)?o=a.isub(this.m):0>a.cmpn(0)&&(o=a.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(e,r){if(e.isZero()||r.isZero())return new h(0)._forceRed(this);var n=e.mul(r),t=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(t).iushrn(this.shift),o=a;return 0<=a.cmp(this.m)?o=a.isub(this.m):0>a.cmpn(0)&&(o=a.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})('undefined'==typeof e||e,this)}).call(this,r(51)(e))},function(e,t,r){'use strict';var n=Math.pow,a=String.fromCharCode,o=Math.floor,d=Math.min;(function(e){function i(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(i()e)throw new RangeError('"size" argument must not be negative')}function l(e,t,r,n){return p(t),0>=t?s(e,t):void 0===r?s(e,t):'string'==typeof n?s(e,t).fill(r,n):s(e,t).fill(r)}function u(e,t){if(p(t),e=s(e,0>t?0:0|g(t)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;rt.length?0:0|g(t.length);e=s(e,r);for(var n=0;nr||t.byteLength=i())throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x'+i().toString(16)+' bytes');return 0|e}function v(e,t){if(c.isBuffer(e))return e.length;if('undefined'!=typeof ArrayBuffer&&'function'==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;'string'!=typeof e&&(e=''+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case'ascii':case'latin1':case'binary':return r;case'utf8':case'utf-8':case void 0:return X(e).length;case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return 2*r;case'hex':return r>>>1;case'base64':return J(e).length;default:if(n)return X(e).length;t=(''+t).toLowerCase(),n=!0;}}function k(e,t,r){var n=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return'';if((void 0===r||r>this.length)&&(r=this.length),0>=r)return'';if(r>>>=0,t>>>=0,r<=t)return'';for(e||(e='utf8');;)switch(e){case'hex':return j(this,t,r);case'utf8':case'utf-8':return N(this,t,r);case'ascii':return M(this,t,r);case'latin1':case'binary':return L(this,t,r);case'base64':return B(this,t,r);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return O(this,t,r);default:if(n)throw new TypeError('Unknown encoding: '+e);e=(e+'').toLowerCase(),n=!0;}}function x(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function S(e,t,r,n,a){if(0===e.length)return-1;if('string'==typeof r?(n=r,r=0):2147483647r&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),0>r&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(0>r)if(a)r=0;else return-1;if('string'==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,a);if('number'==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&'function'==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,a);throw new TypeError('val must be string, number or Buffer')}function w(e,t,r,n,a){function o(e,t){return 1===d?e[t]:e.readUInt16BE(t*d)}var d=1,s=e.length,c=t.length;if(void 0!==n&&(n=(n+'').toLowerCase(),'ucs2'===n||'ucs-2'===n||'utf16le'===n||'utf-16le'===n)){if(2>e.length||2>t.length)return-1;d=2,s/=2,c/=2,r/=2}var f;if(a){var i=-1;for(f=r;fs&&(r=s-c),f=r;0<=f;f--){for(var p=!0,l=0;la&&(n=a)):n=a;var o=t.length;if(0!=o%2)throw new TypeError('Invalid hex string');n>o/2&&(n=o/2);for(var d=0,i;do&&(i=o):2==s?(c=e[a+1],128==(192&c)&&(l=(31&o)<<6|63&c,127l||57343l&&(i=l))):void 0}null===i?(i=65533,s=1):65535>>10),i=56320|1023&i),n.push(i),a+=s}return R(n)}function R(e){var t=e.length;if(t<=ne)return a.apply(String,e);for(var r='',n=0;nt)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var a='',o=t;oe)throw new RangeError('offset is not uint');if(e+t>r)throw new RangeError('Trying to access beyond buffer length')}function U(e,t,r,n,a,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError('Index out of range')}function H(e,t,r,n){0>t&&(t=65535+t+1);for(var a=0,o=d(e.length-r,2);a>>8*(n?a:1-a)}function F(e,t,r,n){0>t&&(t=4294967295+t+1);for(var a=0,o=d(e.length-r,4);a>>8*(n?a:3-a)}function q(e,t,r,n){if(r+n>e.length)throw new RangeError('Index out of range');if(0>r)throw new RangeError('Index out of range')}function z(e,t,r,n,a){return a||q(e,t,r,4,34028234663852886e22,-34028234663852886e22),te.write(e,t,r,n,23,4),r+4}function K(e,t,r,n,a){return a||q(e,t,r,8,17976931348623157e292,-17976931348623157e292),te.write(e,t,r,n,52,8),r+8}function V(e){if(e=G(e).replace(ae,''),2>e.length)return'';for(;0!=e.length%4;)e+='=';return e}function G(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,'')}function W(e){return 16>e?'0'+e.toString(16):e.toString(16)}function X(e,t){t=t||Infinity;for(var r=e.length,n=null,a=[],o=0,d;od){if(!n){if(56319d){-1<(t-=3)&&a.push(239,191,189),n=d;continue}d=(n-55296<<10|d-56320)+65536}else n&&-1<(t-=3)&&a.push(239,191,189);if(n=null,128>d){if(0>(t-=1))break;a.push(d)}else if(2048>d){if(0>(t-=2))break;a.push(192|d>>6,128|63&d)}else if(65536>d){if(0>(t-=3))break;a.push(224|d>>12,128|63&d>>6,128|63&d)}else if(1114112>d){if(0>(t-=4))break;a.push(240|d>>18,128|63&d>>12,128|63&d>>6,128|63&d)}else throw new Error('Invalid code point')}return a}function Y(e){for(var t=[],r=0;r(t-=2));++n)a=e.charCodeAt(n),o=a>>8,d=a%256,r.push(d),r.push(o);return r}function J(e){return ee.toByteArray(V(e))}function $(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function Q(e){return e!==e}/*! +(function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&'object'==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,'default',{enumerable:!0,value:e}),2&r&&'string'!=typeof e)for(var a in e)t.d(n,a,function(t){return e[t]}.bind(null,a));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e['default']}:function(){return e};return t.d(r,'a',r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p='',t(t.s=346)})([function(e,t,r){var n=Math.floor,a=Math.min,o=Math.max;(function(e,r){var d,i;(function(){var s='object'==typeof self&&self.self===self&&self||'object'==typeof e&&e.global===e&&e||this||{},c=s._,f=Array.prototype,p=Object.prototype,l='undefined'==typeof Symbol?null:Symbol.prototype,u=f.push,b=f.slice,h=p.toString,m=p.hasOwnProperty,y=Array.isArray,g=Object.keys,v=Object.create,k=function(){},x=function(e){return e instanceof x?e:this instanceof x?void(this._wrapped=e):new x(e)};'undefined'==typeof t||t.nodeType?s._=x:('undefined'!=typeof r&&!r.nodeType&&r.exports&&(t=r.exports=x),t._=x),x.VERSION='1.9.0';var S=function(e,t,r){if(void 0===t)return e;switch(null==r?3:r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,n,a){return e.call(t,r,n,a)};case 4:return function(r,n,a,o){return e.call(t,r,n,a,o)};}return function(){return e.apply(t,arguments)}},w=function(e,t,r){return x.iteratee===A?null==e?x.identity:x.isFunction(e)?S(e,t,r):x.isObject(e)&&!x.isArray(e)?x.matcher(e):x.property(e):x.iteratee(e,t)},A;x.iteratee=A=function(e,t){return w(e,t,Infinity)};var E=function(e,t){return t=null==t?e.length-1:+t,function(){for(var r=o(arguments.length-t,0),n=Array(r),a=0;an&&(n=o)}else t=w(t,r),x.each(e,function(e,r,o){d=t(e,r,o),(d>a||d===-Infinity&&n===-Infinity)&&(n=e,a=d)});return n},x.min=function(e,t,r){var n=Infinity,a=Infinity,o,d;if(null==t||'number'==typeof t&&'object'!=typeof e[0]&&null!=e){e=B(e)?e:x.values(e);for(var s=0,i=e.length;sn||void 0===r)return 1;if(re.length?void 0:null==t||r?e[0]:x.initial(e,e.length-t)},x.initial=function(e,t,r){return b.call(e,0,o(0,e.length-(null==t||r?1:t)))},x.last=function(e,t,r){return null==e||1>e.length?void 0:null==t||r?e[e.length-1]:x.rest(e,o(0,e.length-t))},x.rest=x.tail=x.drop=function(e,t,r){return b.call(e,null==t||r?1:t)},x.compact=function(e){return x.filter(e,Boolean)};var L=function(e,t,r,n){n=n||[];for(var a=n.length,o=0,d=T(e),i;ot)return[];for(var r=[],n=0,a=e.length;nr)throw new Error('bindAll must be passed function names');for(;r--;){var n=t[r];e[n]=x.bind(e[n],e)}}),x.memoize=function(e,t){var r=function(n){var a=r.cache,o=''+(t?t.apply(this,arguments):n);return x.has(a,o)||(a[o]=e.apply(this,arguments)),a[o]};return r.cache={},r},x.delay=E(function(e,t,r){return setTimeout(function(){return e.apply(null,r)},t)}),x.defer=x.partial(x.delay,x,1),x.throttle=function(e,t,r){var n=0,a,o,d,i;r||(r={});var s=function(){n=!1===r.leading?0:x.now(),a=null,i=e.apply(o,d),a||(o=d=null)},c=function(){var c=x.now();n||!1!==r.leading||(n=c);var f=t-(c-n);return o=this,d=arguments,0>=f||f>t?(a&&(clearTimeout(a),a=null),n=c,i=e.apply(o,d),!a&&(o=d=null)):!a&&!1!==r.trailing&&(a=setTimeout(s,f)),i};return c.cancel=function(){clearTimeout(a),n=0,a=o=d=null},c},x.debounce=function(e,t,r){var n=function(t,r){o=null,r&&(d=e.apply(t,r))},a=E(function(a){if(o&&clearTimeout(o),r){var i=!o;o=setTimeout(n,t),i&&(d=e.apply(this,a))}else o=x.delay(n,t,this,a);return d}),o,d;return a.cancel=function(){clearTimeout(o),o=null},a},x.wrap=function(e,t){return x.partial(t,e)},x.negate=function(e){return function(){return!e.apply(this,arguments)}},x.compose=function(){var e=arguments,t=e.length-1;return function(){for(var r=t,n=e[t].apply(this,arguments);r--;)n=e[r].call(this,n);return n}},x.after=function(e,t){return function(){if(1>--e)return t.apply(this,arguments)}},x.before=function(e,t){var r;return function(){return 0<--e&&(r=t.apply(this,arguments)),1>=e&&(t=null),r}},x.once=x.partial(x.before,2),x.restArguments=E;var U=!{toString:null}.propertyIsEnumerable('toString'),H=['valueOf','isPrototypeOf','toString','propertyIsEnumerable','hasOwnProperty','toLocaleString'],F=function(e,t){var r=H.length,n=e.constructor,a=x.isFunction(n)&&n.prototype||p,o='constructor';for(x.has(e,o)&&!x.contains(t,o)&&t.push(o);r--;)o=H[r],o in e&&e[o]!==a[o]&&!x.contains(t,o)&&t.push(o)};x.keys=function(e){if(!x.isObject(e))return[];if(g)return g(e);var t=[];for(var r in e)x.has(e,r)&&t.push(r);return U&&F(e,t),t},x.allKeys=function(e){if(!x.isObject(e))return[];var t=[];for(var r in e)t.push(r);return U&&F(e,t),t},x.values=function(e){for(var t=x.keys(e),r=t.length,n=Array(r),a=0;an||null==r)return r;for(var a=1;a":'>','"':'"',"'":''',"`":'`'},X=x.invert(W),Y=function(e){var t=function(t){return e[t]},r='(?:'+x.keys(e).join('|')+')',n=RegExp(r),a=RegExp(r,'g');return function(e){return e=null==e?'':''+e,n.test(e)?e.replace(a,t):e}};x.escape=Y(W),x.unescape=Y(X),x.result=function(e,t,r){x.isArray(t)||(t=[t]);var n=t.length;if(!n)return x.isFunction(r)?r.call(e):r;for(var a=0,o;a/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,$={"'":'\'',"\\":'\\',"\r":'r',"\n":'n',"\u2028":'u2028',"\u2029":'u2029'},Q=/\\|'|\r|\n|\u2028|\u2029/g,ee=function(e){return'\\'+$[e]};x.template=function(e,t,r){!t&&r&&(t=r),t=x.defaults({},t,x.templateSettings);var n=RegExp([(t.escape||J).source,(t.interpolate||J).source,(t.evaluate||J).source].join('|')+'|$','g'),a=0,o='__p+=\'';e.replace(n,function(t,r,n,d,i){return o+=e.slice(a,i).replace(Q,ee),a=i+t.length,r?o+='\'+\n((__t=('+r+'))==null?\'\':_.escape(__t))+\n\'':n?o+='\'+\n((__t=('+n+'))==null?\'\':__t)+\n\'':d&&(o+='\';\n'+d+'\n__p+=\''),t}),o+='\';\n',t.variable||(o='with(obj||{}){\n'+o+'}\n'),o='var __t,__p=\'\',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,\'\');};\n'+o+'return __p;\n';var d;try{d=new Function(t.variable||'obj','_',o)}catch(t){throw t.source=o,t}var i=function(e){return d.call(this,e,x)},s=t.variable||'obj';return i.source='function('+s+'){\n'+o+'}',i},x.chain=function(e){var t=x(e);return t._chain=!0,t};var te=function(e,t){return e._chain?x(t).chain():t};x.mixin=function(e){return x.each(x.functions(e),function(t){var r=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return u.apply(e,arguments),te(this,r.apply(x,e))}}),x},x.mixin(x),x.each(['pop','push','reverse','shift','sort','splice','unshift'],function(e){var t=f[e];x.prototype[e]=function(){var r=this._wrapped;return t.apply(r,arguments),('shift'===e||'splice'===e)&&0===r.length&&delete r[0],te(this,r)}}),x.each(['concat','join','slice'],function(e){var t=f[e];x.prototype[e]=function(){return te(this,t.apply(this._wrapped,arguments))}}),x.prototype.value=function(){return this._wrapped},x.prototype.valueOf=x.prototype.toJSON=x.prototype.value,x.prototype.toString=function(){return this._wrapped+''},d=[],i=function(){return x}.apply(t,d),!(i!==void 0&&(r.exports=i))})()}).call(this,r(9),r(56)(e))},function(e,t,r){'use strict';var n=r(38);class a{constructor(e,t,r,n){this.transactionConfirmationModel=e,this.transactionReceiptValidator=t,this.newHeadsWatcher=r,this.formatters=n}execute(e,t,r,n){this.getTransactionReceipt(t,r).then((a)=>{if(a&&a.blockHash){const t=this.transactionReceiptValidator.validate(a);return!0===t?void this.handleSuccessState(a,e,n):void this.handleErrorState(t,e,n)}this.newHeadsWatcher.watch(t).on('newHead',()=>{if(this.transactionConfirmationModel.timeoutCounter++,!this.transactionConfirmationModel.isTimeoutTimeExceeded())return void this.getTransactionReceipt(r).then((t)=>{const r=this.transactionReceiptValidator.validate(t,e.parameters);return!0===r?(this.transactionConfirmationModel.addConfirmation(t),n.emit('confirmation',this.transactionConfirmationModel.confirmationsCount,t),void(this.transactionConfirmationModel.isConfirmed()&&this.handleSuccessState(t,e,n))):void(n.reject(r),n.emit('error',r,t),n.removeAllListeners(),e.callback&&e.callback(r,null))});let t=new Error(`Transaction was not mined within ${this.transactionConfirmationModel.TIMEOUTBLOCK} blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!`);this.newHeadsWatcher.isPolling&&(t=new Error(`Transaction was not mined within${this.transactionConfirmationModel.POLLINGTIMEOUT} seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!`)),this.handleErrorState(t,e,n)})})}getTransactionReceipt(e,t){return e.currentProvider.send('eth_getTransactionReceipt',[t]).then((e)=>this.formatters.outputTransactionReceiptFormatter(e))}handleSuccessState(e,t,r){if(this.newHeadsWatcher.stop(),t instanceof n.b)return r.resolve(t.afterExecution(e)),r.emit('receipt',e),r.removeAllListeners(),void(t.callback&&t.callback(!1,e));const a=t.afterExecution(e);r.resolve(a),r.emit('receipt',a),r.removeAllListeners(),t.callback&&t.callback(!1,a)}handleErrorState(e,t,r){this.newHeadsWatcher.stop(),r.reject(e),r.emit('error',e),r.removeAllListeners(),t.callback&&t.callback(e,null)}}var o=r(0),d=r.n(o);class i{getWallet(e,t){if(d.a.isNumber(e))return t.wallet[e];if(d.a.isObject(e)&&e.address&&e.privateKey)return e;const r=t.wallet[e.toLowerCase()];return r?r:null}}class s extends i{async sign(e,t){const r=this.getWallet(e.from,t);if(r&&r.privateKey)return delete e.from,await t.signTransaction(e,r.privateKey);throw new Error('Wallet or privateKey in wallet is not set!')}}class c extends i{sign(e,t,r){const n=this.getWallet(t,r);if(n&&n.privateKey)return r.sign(e,n.privateKey).signature;throw new Error('Wallet or privateKey in wallet is not set!')}}class f{constructor(){this.confirmations=[],this.timeoutCounter=0,this._pollingTimeout=15,this.timeoutBlock=50,this.confirmationBlocks=24}get pollingTimeout(){return this._pollingTimeout*this.timeoutBlock}set pollingTimeout(e){this._pollingTimeout=e}addConfirmation(e){this.confirmations.push(e)}isConfirmed(){return this.confirmations.length===this.confirmationBlocks+1}isTimeoutTimeExceeded(e){return e?this.timeoutCounter-1>=this.pollingTimeout:this.timeoutCounter-1>=this.timeoutBlock}}class p{validate(e,t){if(this.isValidGasUsage(e,t)&&this.isValidReceiptStatus(e))return!0;const r=JSON.stringify(e,null,2);return!1===e.status||'0x0'===e.status?new Error(`Transaction has been reverted by the EVM:\n${r}`):new Error(`Transaction ran out of gas. Please provide more gas:\n${r}`)}isValidReceiptStatus(e){return!0===e.status||'0x1'===e.status||'undefined'==typeof e.status}isValidGasUsage(e,t){let r=null;return Object(o.isObject)(t[0])&&t[0].gas&&(r=t[0].gas),!e.outOfGas&&(!r||r!==e.gasUsed)}}var l=r(8),u=r(168),b=r.n(u);class h extends b.a{constructor(e){super(),this.subscriptionsFactory=e,this.confirmationInterval=null,this.confirmationSubscription=null,this.isPolling=!1}watch(e){return e.currentProvider instanceof l.b?(this.confirmationSubscription=this.subscriptionsFactory.createNewHeadsSubscription(e).subscribe(()=>{this.emit('newHead')}),this):(this.isPolling=!0,this.confirmationInterval=setInterval(()=>{this.emit('newHead')},1e3),this)}stop(){this.confirmationSubscription&&this.confirmationSubscription.unsubscribe(),this.confirmationInterval&&clearInterval(this.confirmationInterval),this.removeAllListeners('newHead')}}class m{constructor(e,t,r,n,a){this.callMethodCommand=e,this.sendMethodCommand=t,this.signAndSendMethodCommand=r,this.signMessageCommand=n,this.promiEventObject=a}execute(e,t,r){if(this.hasWallets(t)){if(e.isSign())return this.signMessageCommand.execute(r,e,t);if(e.isSendTransaction())return this.signAndSendMethodCommand.execute(r,e,new this.promiEventObject,t)}return e.isSendTransaction()||e.isSendRawTransaction()||e.isSign()?this.sendMethodCommand.execute(r,e,new this.promiEventObject):this.callMethodCommand.execute(r,e)}hasWallets(e){return e&&0{Object(o.isObject)(t.parameters[0])&&(t.parameters[0].gasPrice=n),this.send(t,r,e)}),r)}send(e,t,r){return r.currentProvider.send(e.rpcMethod,e.parameters).then((n)=>{this.transactionConfirmationWorkflow.execute(e,r,n,t),t.emit('transactionHash',n),e.callback&&e.callback(!1,n)}).catch((r)=>{t.reject(r),t.emit('error',r),t.removeAllListeners(),e.callback&&e.callback(r,null)}),t}isGasPriceDefined(e){return Object(o.isObject)(e[0])&&'undefined'!=typeof e[0].gasPrice}getGasPrice(e){return e.send('eth_gasPrice',[])}}class v extends g{constructor(e,t){super(e),this.transactionSigner=t}execute(e,t,r,n){return t.beforeExecution(e),t.rpcMethod='eth_sendRawTransaction',this.transactionSigner.sign(t.parameters[0],n).then((n)=>{t.parameters=[n.rawTransaction],this.send(t,r,e)}).catch((e)=>{r.reject(e),r.emit('error',e),r.removeAllListeners(),t.callback&&t.callback(e,null)}),r}}class k{constructor(e){this.messageSigner=e}execute(e,t,r){let n;t.beforeExecution(e);try{n=t.afterExecution(this.messageSigner.sign(t.parameters[0],t.parameters[1],r))}catch(e){throw t.callback(e,null),e}return t.callback&&t.callback(!1,n),n}}class x{createMethodController(e,t,r){return new m(this.createCallMethodCommand(),this.createSendMethodCommand(t,r),this.createSignAndSendMethodCommand(t,r),this.createSignMessageCommand(),e)}createCallMethodCommand(){return new y}createSendMethodCommand(e,t){return new g(this.createTransactionConfirmationWorkflow(e,t))}createSignAndSendMethodCommand(e,t){return new v(this.createTransactionConfirmationWorkflow(e,t),this.createTransactionSigner())}createSignMessageCommand(){return new k(this.createMessageSigner())}createTransactionConfirmationWorkflow(e,t){return new a(this.createTransactionConfirmationModel(),this.createTransactionReceiptValidator(),this.createNewHeadsWatcher(e),t)}createTransactionSigner(){return new s}createMessageSigner(){return new c}createTransactionConfirmationModel(){return new f}createTransactionReceiptValidator(){return new p}createNewHeadsWatcher(e){return new h(e)}}var S=r(39),w=r(14),A=r(6);class E{constructor(e,t,r){this.utils=t,this.formatters=r,this.methodModels=e}hasMethodModel(e){return'undefined'!=typeof this.methodModels[e]}createMethodModel(e){return new this.methodModels[e](this.utils,this.formatters)}}class I{constructor(e,t,r,n){this.rpcMethod=e,this.parametersAmount=t,this.utils=r,this.formatters=n;const a={};Object.defineProperty(this,'methodArguments',{get(){return a},set(e){e=this.mapFunctionArguments(e)},enumerable:!0}),this.parameters=this.methodArguments.parameters,this.callback=this.methodArguments.callback}beforeExecution(){}afterExecution(e){return e}request(){return this.methodArguments=arguments,this}mapFunctionArguments(e){let t=e,r=!1;if(e.lengththis.parametersAmount){if(r=e.slice(-1),!d.a.isFunction(r))throw new Error('The latest parameter should be a function otherwise it can not be used as callback');t=e.slice(0,-1)}return{callback:r,parameters:t}}isSign(){return'eth_sign'===this.rpcMethod}isSendTransaction(){return'eth_sendTransaction'===this.rpcMethod}isSendRawTransaction(){return'eth_sendRawTransaction'===this.rpcMethod}isHash(e){return d.a.isString(e)&&0===e.indexOf('0x')}}class C extends I{constructor(e,t){super('eth_protocolVersion',0,e,t)}}class P extends I{constructor(e,t){super('eth_protocolVersion',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class T extends I{constructor(e,t){super('net_listening',0,e,t)}}class B extends I{constructor(e,t){super('net_peerCount',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class N extends I{constructor(e,t){super('web3_clientVersion',0,e,t)}}class R extends I{constructor(e,t){super('eth_coinbase',0,e,t)}}class M extends I{constructor(e,t){super('eth_mining',0,e,t)}}class L extends I{constructor(e,t){super('eth_hashrate',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class j extends I{constructor(e,t){super('eth_syncing',0,e,t)}afterExecution(e){return this.formatters.outputSyncingFormatter(e)}}class O extends I{constructor(e,t){super('eth_gasPrice',0,e,t)}afterExecution(e){return this.formatters.outputBigNumberFormatter(e)}}class D extends I{constructor(e,t){super('eth_submitWork',3,e,t)}}class U extends I{constructor(e,t){super('eth_getWork',0,e,t)}}class H extends I{constructor(e,t){super('eth_accounts',0,e,t)}afterExecution(e){return e.map((e)=>this.utils.toChecksumAddress(e))}}class F extends I{constructor(e,t){super('eth_getBalance',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}afterExecution(e){return this.formatters.outputBigNumberFormatter(e)}}class q extends I{constructor(e,t){super('eth_getTransactionCount',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}afterExecution(e){return this.utils.hexToNumber(e)}}class z extends I{constructor(e,t){super('eth_blockNumber',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class K extends I{constructor(e,t){super('eth_getBlockByNumber',2,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getBlockByHash'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0]),this.parameters[1]=!!this.parameters[1]}afterExecution(e){return this.formatters.outputBlockFormatter(e)}}class V extends I{constructor(e,t){super('eth_getUncleByBlockNumberAndIndex',2,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getUncleByBlockHashAndIndex'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0]),this.parameters[1]=this.utils.numberToHex(this.parameters[1])}afterExecution(e){return this.formatters.outputBlockFormatter(e)}}class G extends I{constructor(e,t){super('eth_getTransactionByBlockNumberAndIndex',1,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getTransactionByBlockHashAndIndex'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0])}afterExecution(e){return this.utils.hexToNumber(e)}}class W extends I{constructor(e,t){super('eth_getUncleCountByBlockNumber',1,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getUncleCountByBlockHash'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0])}afterExecution(e){return this.utils.hexToNumber(e)}}class X extends I{constructor(e,t){super('eth_getTransactionByHash',1,e,t)}afterExecution(e){return this.formatters.outputTransactionFormatter(e)}}class Y extends I{constructor(e,t){super('eth_getTransactionByBlockNumberAndIndex',2,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getTransactionByBlockHashAndIndex'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0]),this.parameters[1]=this.utils.numberToHex(this.parameters[1])}afterExecution(e){return this.formatters.outputTransactionFormatter(e)}}class Z extends I{constructor(e,t){super('eth_getTransactionReceipt',1,e,t)}afterExecution(e){return this.formatters.outputTransactionFormatter(e)}}class J extends I{constructor(e,t){super('eth_sendRawTransaction',1,e,t)}}class $ extends I{constructor(e,t){super('eth_signTransaction',1,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class Q extends I{constructor(e,t,r){super('eth_sendTransaction',1,e,t),this.accounts=r}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class ee extends I{constructor(e,t){super('eth_getCode',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}}class te extends I{constructor(e,t,r){super('eth_sign',2,e,t),this.accounts=r}beforeExecution(){this.parameters[0]=this.formatters.inputSignFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputAddressFormatter(this.parameters[1])}}class re extends I{constructor(e,t){super('eth_call',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputCallFormatter(this.parameters[0],e),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}}class ne extends I{constructor(e,t){super('eth_getStorageAt',3,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.utils.numberToHex(this.parameters[1]),this.parameters[2]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2],e)}}class ae extends I{constructor(e,t){super('eth_estimateGas',1,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputCallFormatter(this.parameters[0],e)}afterExecution(e){return this.utils.hexToNumber(e)}}class oe extends I{constructor(e,t){super('eth_getLogs',1,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputLogFormatter(this.parameters[0])}afterExecution(e){return e.map((e)=>this.formatters.outputLogFormatter(e))}}class de extends I{constructor(e,t){super('personal_ecRecover',3,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputSignFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputAddressFormatter(this.parameters[1])}}class ie extends I{constructor(e,t){super('personal_importRawKey',2,e,t)}}class se extends I{constructor(e,t){super('personal_lockAccount',1,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0])}}class ce extends I{constructor(e,t){super('personal_newAccount',0,e,t)}afterExecution(e){return this.utils.toChecksumAddress(e)}}class fe extends I{constructor(e,t){super('personal_sendTransaction',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class pe extends I{constructor(e,t){super('personal_sign',3,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputSignFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputAddressFormatter(this.parameters[1])}}class le extends I{constructor(e,t){super('personal_signTransaction',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class ue extends I{constructor(e,t){super('personal_unlockAccount',3,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0])}}class be extends I{constructor(e,t){super('shh_addPrivateKey',1,e,t)}}class he extends I{constructor(e,t){super('shh_addSymKey',1,e,t)}}class me extends I{constructor(e,t){super('shh_deleteKeyPair',1,e,t)}}class ye extends I{constructor(e,t){super('shh_deleteMessageFilter',1,e,t)}}class ge extends I{constructor(e,t){super('shh_deleteSymKey',1,e,t)}}class _e extends I{constructor(e,t){super('shh_generateSymKeyFromPassword',1,e,t)}}class ve extends I{constructor(e,t){super('shh_getFilterMessages',1,e,t)}}class ke extends I{constructor(e,t){super('shh_info',0,e,t)}}class xe extends I{constructor(e,t){super('shh_getPrivateKey',1,e,t)}}class Se extends I{constructor(e,t){super('shh_getPublicKey',1,e,t)}}class we extends I{constructor(e,t){super('shh_getSymKey',1,e,t)}}class Ae extends I{constructor(e,t){super('shh_hasKeyPair',1,e,t)}}class Ee extends I{constructor(e,t){super('shh_hasSymKey',1,e,t)}}class Ie extends I{constructor(e,t){super('shh_markTrustedPeer',1,e,t)}}class Ce extends I{constructor(e,t){super('shh_newKeyPair',1,e,t)}}class Pe extends I{constructor(e,t){super('shh_newMessageFilter',1,e,t)}}class Te extends I{constructor(e,t){super('shh_newSymKey',0,e,t)}}class Be extends I{constructor(e,t){super('shh_post',1,e,t)}}class Ne extends I{constructor(e,t){super('shh_setMaxMessageSize',1,e,t)}}class Re extends I{constructor(e,t){super('shh_setMinPoW',1,e,t)}}class Me extends I{constructor(e,t){super('shh_version',0,e,t)}}r.d(t,'S',function(){return Le}),r.d(t,'b',function(){return E}),r.d(t,'A',function(){return C}),r.d(t,'lb',function(){return P}),r.d(t,'P',function(){return T}),r.d(t,'X',function(){return B}),r.d(t,'x',function(){return N}),r.d(t,'s',function(){return R}),r.d(t,'N',function(){return M}),r.d(t,'v',function(){return L}),r.d(t,'O',function(){return j}),r.d(t,'u',function(){return O}),r.d(t,'jb',function(){return D}),r.d(t,'J',function(){return U}),r.d(t,'l',function(){return H}),r.d(t,'m',function(){return F}),r.d(t,'E',function(){return q}),r.d(t,'o',function(){return z}),r.d(t,'n',function(){return K}),r.d(t,'I',function(){return V}),r.d(t,'p',function(){return G}),r.d(t,'q',function(){return W}),r.d(t,'G',function(){return X}),r.d(t,'F',function(){return Y}),r.d(t,'H',function(){return Z}),r.d(t,'cb',function(){return J}),r.d(t,'ib',function(){return $}),r.d(t,'db',function(){return Q}),r.d(t,'r',function(){return ee}),r.d(t,'hb',function(){return te}),r.d(t,'e',function(){return re}),r.d(t,'C',function(){return ne}),r.d(t,'j',function(){return ae}),r.d(t,'y',function(){return oe}),r.d(t,'i',function(){return de}),r.d(t,'M',function(){return ie}),r.d(t,'Q',function(){return se}),r.d(t,'T',function(){return ce}),r.d(t,'Y',function(){return fe}),r.d(t,'Z',function(){return pe}),r.d(t,'ab',function(){return le}),r.d(t,'kb',function(){return ue}),r.d(t,'c',function(){return be}),r.d(t,'d',function(){return he}),r.d(t,'f',function(){return me}),r.d(t,'g',function(){return ye}),r.d(t,'h',function(){return ge}),r.d(t,'k',function(){return _e}),r.d(t,'t',function(){return ve}),r.d(t,'w',function(){return ke}),r.d(t,'z',function(){return xe}),r.d(t,'B',function(){return Se}),r.d(t,'D',function(){return we}),r.d(t,'K',function(){return Ae}),r.d(t,'L',function(){return Ee}),r.d(t,'R',function(){return Ie}),r.d(t,'U',function(){return Ce}),r.d(t,'V',function(){return Pe}),r.d(t,'W',function(){return Te}),r.d(t,'bb',function(){return Be}),r.d(t,'eb',function(){return Ne}),r.d(t,'fb',function(){return Re}),r.d(t,'gb',function(){return Me});const Le=()=>new x().createMethodController(S.a,new w.c,A.b)},function(e,t,r){'use strict';var n=String.fromCharCode,a=r(18),o=r(19),d=r(10),i=r(0),s=r(25),c=r.n(s),f=r(57),p=r(3),l=r.n(p),u=r(89),b=r.n(u),h=r(92),m=r.n(h),y=r(21),g=r.n(y);const v=(e)=>e instanceof l.a||e&&e.constructor&&'BN'===e.constructor.name,k=(e)=>e&&e.constructor&&'BigNumber'===e.constructor.name,x=(t)=>{try{return b.a.apply(null,arguments)}catch(r){throw new Error(`${r} Given value: "${t}"`)}},S=(e)=>!!/^(0x)?[0-9a-f]{40}$/i.test(e)&&(!!(/^(0x|0X)?[0-9a-f]{40}$/.test(e)||/^(0x|0X)?[0-9A-F]{40}$/.test(e))||w(e)),w=(e)=>{e=e.replace(/^0x/i,'');const t=P(e.toLowerCase()).replace(/^0x/i,'');for(let r=0;40>r;r++)if(7=parseInt(t[r],16)&&e[r].toLowerCase()!==e[r])return!1;return!0},A=(e)=>{e=m.a.encode(e);let t='';e=e.replace(/^(?:\u0000)*/,''),e=e.split('').reverse().join(''),e=e.replace(/^(?:\u0000)*/,''),e=e.split('').reverse().join('');for(let r=0;ro.length?`0${o}`:o}return`0x${t}`},E=(e)=>{if(Object(i.isNull)(e)||Object(i.isUndefined)(e))return e;if(!isFinite(e)&&!C(e))throw new Error(`Given input "${e}" is not a number.`);const t=x(e),r=t.toString(16);return t.lt(new l.a(0))?`-0x${r.substr(1)}`:`0x${r}`},I=(e)=>{if(e=e.toString(16),!C(e))throw new Error(`Given value "${e}" is not a valid hex string.`);e=e.replace(/^0x/i,'');for(let t=[],r=0;r(Object(i.isString)(e)||Object(i.isNumber)(e))&&/^(-)?0x[0-9a-f]*$/i.test(e),P=(e)=>{C(e)&&/^0x/i.test(e.toString())&&(e=I(e));const t=g.a.keccak256(e);return t==='0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'?null:t};P._Hash=g.a;var T={BN:l.a,isBN:v,isBigNumber:k,toBN:x,isAddress:S,isBloom:(e)=>{if(!/^(0x)?[0-9a-f]{512}$/i.test(e))return!1;return!!(/^(0x)?[0-9a-f]{512}$/.test(e)||/^(0x)?[0-9A-F]{512}$/.test(e))},isTopic:(e)=>{if(!/^(0x)?[0-9a-f]{64}$/i.test(e))return!1;return!!(/^(0x)?[0-9a-f]{64}$/.test(e)||/^(0x)?[0-9A-F]{64}$/.test(e))},checkAddressChecksum:w,utf8ToHex:A,hexToUtf8:(e)=>{if(!C(e))throw new Error(`The parameter "${e}" must be a valid HEX string.`);let t='',r=0;e=e.replace(/^0x/i,''),e=e.replace(/^(?:00)*/,''),e=e.split('').reverse().join(''),e=e.replace(/^(?:00)*/,''),e=e.split('').reverse().join('');const a=e.length;for(let o=0;oe?x(e).toNumber():e,hexToNumberString:(e)=>e?x(e).toString(10):e,numberToHex:E,toHex:(e,t)=>{if(S(e))return t?'address':`0x${e.toLowerCase().replace(/^0x/i,'')}`;if(Object(i.isBoolean)(e))return t?'bool':e?'0x01':'0x00';if(Object(i.isObject)(e)&&!k(e)&&!v(e))return t?'string':A(JSON.stringify(e));if(Object(i.isString)(e)){if(0===e.indexOf('-0x')||0===e.indexOf('-0X'))return t?'int256':E(e);if(0===e.indexOf('0x')||0===e.indexOf('0X'))return t?'bytes':e;if(!isFinite(e))return t?'string':A(e)}return t?0>e?'int256':'uint256':E(e)},hexToBytes:I,bytesToHex:(e)=>{for(let t=[],r=0;r>>4).toString(16)),t.push((15&e[r]).toString(16));return`0x${hex.join('')}`},isHex:(e)=>(Object(i.isString)(e)||Object(i.isNumber)(e))&&/^(-0x|0x)?[0-9a-f]*$/i.test(e),isHexStrict:C,leftPad:(e,t,r)=>{const n=/^0x/i.test(e)||'number'==typeof e;e=e.toString(16).replace(/^0x/i,'');const a=0<=t-e.length+1?t-e.length+1:0;return(n?'0x':'')+Array(a).join(r?r:'0')+e},rightPad:(e,t,r)=>{const n=/^0x/i.test(e)||'number'==typeof e;e=e.toString(16).replace(/^0x/i,'');const a=0<=t-e.length+1?t-e.length+1:0;return(n?'0x':'')+e+Array(a).join(r?r:'0')},toTwosComplement:(e)=>`0x${x(e).toTwos(256).toString(16,64)}`,sha3:P};const B=(e)=>{if(e.startsWith('int['))return`int256${e.slice(3)}`;return'int'===e?'int256':e.startsWith('uint[')?`uint256${e.slice(4)}`:'uint'===e?'uint256':e.startsWith('fixed[')?`fixed128x128${e.slice(5)}`:'fixed'===e?'fixed128x128':e.startsWith('ufixed[')?`ufixed128x128${e.slice(6)}`:'ufixed'===e?'ufixed128x128':e},N=(e)=>{const t=/^\D+(\d+).*$/.exec(e);return t?parseInt(t[1],10):null},R=(e)=>{const t=/^\D+\d*\[(\d+)\]$/.exec(e);return t?parseInt(t[1],10):null},M=(e)=>{const t=typeof e;if('string'==t)return T.isHexStrict(e)?new l.a(e.replace(/0x/i,''),16):new l.a(e,10);if('number'==t)return new l.a(e);if(T.isBigNumber(e))return new l.a(e.toString(10));if(T.isBN(e))return e;throw new Error(`${e} is not a number`)},L=(e,t,r)=>{let n,a;if(e=B(e),'bytes'===e){if(0!=t.replace(/^0x/i,'').length%2)throw new Error(`Invalid bytes characters ${t.length}`);return t}if('string'===e)return T.utf8ToHex(t);if('bool'===e)return t?'01':'00';if(e.startsWith('address')){if(n=r?64:40,!T.isAddress(t))throw new Error(`${t} is not a valid address, or the checksum is invalid.`);return T.leftPad(t.toLowerCase(),n)}if(n=N(e),e.startsWith('bytes')){if(!n)throw new Error('bytes[] not yet supported in solidity');if(r&&(n=32),1>n||32n||256n)throw new Error(`Supplied uint exceeds width: ${n} vs ${a.bitLength()}`);if(a.lt(new l.a(0)))throw new Error(`Supplied uint ${a.toString()} is negative`);return n?T.leftPad(a.toString('hex'),2*(n/8)):a}if(e.startsWith('int')){if(n%8||8>n||256n)throw new Error(`Supplied int exceeds width: ${n} vs ${a.bitLength()}`);return a.lt(new l.a(0))?a.toTwos(n).toString('hex'):n?T.leftPad(a.toString('hex'),2*(n/8)):a}throw new Error(`Unsupported or invalid type: ${e}`)},j=(e)=>{if(Object(i.isArray)(e))throw new Error('Autodetection of array types is not supported.');let t='',r,n,a;if(Object(i.isObject)(e)&&(e.hasOwnProperty('v')||e.hasOwnProperty('t')||e.hasOwnProperty('value')||e.hasOwnProperty('type'))?(r=e.hasOwnProperty('t')?e.t:e.type,t=e.hasOwnProperty('v')?e.v:e.value):(r=T.toHex(e,!0),t=T.toHex(e),!r.startsWith('int')&&!r.startsWith('uint')&&(r='bytes')),(r.startsWith('int')||r.startsWith('uint'))&&'string'==typeof t&&!/^(-)?0x/i.test(t)&&(t=new l.a(t)),Object(i.isArray)(t))if(a=R(r),a&&t.length!==a)throw new Error(`${r} is not matching the given array ${JSON.stringify(t)}`);else a=t.length;return Object(i.isArray)(t)?(n=t.map((e)=>L(r,e,a).toString('hex').replace('0x','')),n.join('')):(n=L(r,t,a),n.toString('hex').replace('0x',''))};var O=r(162),D=r.n(O);const U=(e,t)=>{const r=[];return t.forEach((t)=>{if('object'==typeof t.components){if('tuple'!==t.type.substring(0,5))throw new Error('components found but type is not tuple; report on GitHub');let n='';const a=t.type.indexOf('[');0<=a&&(n=t.type.substring(a));const o=U(e,t.components);Object(i.isArray)(o)&&e?r.push(`tuple(${o.join(',')})${n}`):e?r.push(`(${o})`):r.push(`(${o.join(',')})${n}`)}else r.push(t.type)}),r},H=(e)=>{if(!T.isHexStrict(e))throw new Error('The parameter must be a valid HEX string.');let t='',r=0;const a=e.length;for('0x'===e.substring(0,2)&&(r=2);r{if(!e)return'0x00';let t='';for(let r=0;ro.length?`0${o}`:o}return`0x${t}`},q=(e)=>{if(e=e?e.toLowerCase():'ether',!c.a.unitMap[e])throw new Error(`This unit "${e}" doesn't exist, please use the one of the following units${JSON.stringify(c.a.unitMap,null,2)}`);return e};t.a={_fireError:(e,t,r,n)=>(Object(i.isObject)(e)&&!(e instanceof Error)&&e.data&&((Object(i.isObject)(e.data)||Object(i.isArray)(e.data))&&(e.data=JSON.stringify(e.data,null,2)),e=`${e.message}\n${e.data}`),Object(i.isString)(e)&&(e=new Error(e)),Object(i.isFunction)(n)&&n(e),Object(i.isFunction)(r)&&((t&&Object(i.isFunction)(t.listeners)&&t.listeners('error').length||Object(i.isFunction)(n))&&t.catch(()=>{}),setTimeout(()=>{r(e)},1)),t&&Object(i.isFunction)(t.emit)&&setTimeout(()=>{t.emit('error',e),t.removeAllListeners()},1),t),_jsonInterfaceMethodToString:(e)=>Object(i.isObject)(e)&&e.name&&-1!==e.name.indexOf('(')?e.name:`${e.name}(${U(!1,e.inputs).join(',')})`,_flattenTypes:U,randomHex:D.a,_,BN:T.BN,isBN:T.isBN,isBigNumber:T.isBigNumber,isHex:T.isHex,isHexStrict:T.isHexStrict,sha3:T.sha3,keccak256:T.sha3,soliditySha3:()=>{const e=Array.prototype.slice.call(arguments),t=Object(i.map)(e,j);return T.sha3(`0x${t.join('')}`)},isAddress:T.isAddress,checkAddressChecksum:T.checkAddressChecksum,toChecksumAddress:(e)=>{if('undefined'==typeof e)return'';if(!/^(0x)?[0-9a-f]{40}$/i.test(e))throw new Error(`Given address "${e}" is not a valid Ethereum address.`);e=e.toLowerCase().replace(/^0x/i,'');const t=T.sha3(e).replace(/^0x/i,'');let r='0x';for(let n=0;n{if(t=q(t),!T.isBN(e)&&!Object(i.isString)(e))throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.');return T.isBN(e)?c.a.toWei(e,t):c.a.toWei(e,t).toString(10)},fromWei:(e,t)=>{if(t=q(t),!T.isBN(e)&&!Object(i.isString)(e))throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.');return T.isBN(e)?c.a.fromWei(e,t):c.a.fromWei(e,t).toString(10)},padLeft:T.leftPad,leftPad:T.leftPad,padRight:T.rightPad,rightPad:T.rightPad,toTwosComplement:T.toTwosComplement}},function(e,t,r){var n=Math.ceil,o=Math.min,d=Math.max;(function(e){(function(e,t){'use strict';function f(e,t){if(!e)throw new Error(t||'Assertion failed')}function a(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function h(e,t,r){return h.isBN(e)?e:void(this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(('le'===t||'be'===t)&&(r=t,t=10),this._init(e||0,t||10,r||'be')))}function s(e,t,n){for(var a=0,r=o(e.length,n),d=t,i;d=i?i-49+10:17<=i&&22>=i?i-17+10:15&i;return a}function c(e,t,n,a){for(var d=0,r=o(e.length,n),s=t,i;s>>a}return t}function i(e,t,n){n.negative=t.negative^e.negative;var s=0|e.length+t.length;n.length=s,s=0|s-1;var c=0|e.words[0],a=0|t.words[0],f=c*a,r=67108863&f,p=0|f/67108864;n.words[0]=r;for(var l=1;l>>26,b=67108863&p,h=o(l,t.length-1),m=d(0,l-e.length+1),y;m<=h;m++)y=0|l-m,c=0|e.words[y],a=0|t.words[m],f=c*a+b,u+=0|f/67108864,b=67108863&f;n.words[l]=0|b,p=0|u}return 0==p?n.length--:n.words[l]=0|p,n.strip()}function l(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var s=0,c=0,f=0,p;f>>26),c+=p>>>26,p&=67108863}n.words[f]=l,s=p,p=c}return 0==s?n.length--:n.words[f]=s,n.strip()}function u(e,t,r){var n=new b;return n.mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}function m(e,t){this.name=e,this.p=new h(t,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,'k256','ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f')}function g(){m.call(this,'p224','ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001')}function v(){m.call(this,'p192','ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff')}function k(){m.call(this,'25519','7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed')}function x(e){if('string'==typeof e){var t=h._prime(e);this.m=t.p,this.prime=t}else f(e.gtn(1),'modulus must be greater than 1'),this.m=e,this.prime=null}function S(e){x.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var w=Math.imul,A=Math.clz32;'object'==typeof e?e.exports=h:t.BN=h,h.BN=h,h.wordSize=26;var E;try{E=r(196).Buffer}catch(t){}h.isBN=function(e){return!!(e instanceof h)||null!==e&&'object'==typeof e&&e.constructor.wordSize===h.wordSize&&Array.isArray(e.words)},h.max=function(e,t){return 0e.cmp(t)?e:t},h.prototype._init=function(e,t,r){if('number'==typeof e)return this._initNumber(e,t,r);if('object'==typeof e)return this._initArray(e,t,r);'hex'===t&&(t=16),f(t===(0|t)&&2<=t&&36>=t),e=e.toString().replace(/\s+/g,'');var n=0;'-'===e[0]&&n++,16===t?this._parseHex(e,n):this._parseBase(e,t,n),'-'===e[0]&&(this.negative=1),this.strip();'le'!==r||this._initArray(this.toArray(),t,r)},h.prototype._initNumber=function(e,t,r){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(f(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3);'le'!==r||this._initArray(this.toArray(),t,r)},h.prototype._initArray=function(e,t,r){if(f('number'==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=n(e.length/3),this.words=Array(this.length);for(var a=0;a>>26-o,o+=24,26<=o&&(o-=26,d++);else if('le'===r)for(a=0,d=0;a>>26-o,o+=24,26<=o&&(o-=26,d++);return this.strip()},h.prototype._parseHex=function(e,t){this.length=n((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=6)d=s(e,r,r+6),this.words[o]|=67108863&d<>>26-a,a+=24,26<=a&&(a-=26,o++);r+6!==t&&(d=s(e,t,r+6),this.words[o]|=67108863&d<>>26-a),this.strip()},h.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;67108863>=a;a*=t)n++;n--,a=0|a/t;for(var d=e.length-r,s=d%n,f=o(d,d-s)+r,p=0,l=r;lthis.words[0]+p?this.words[0]+=p:this._iaddn(p);if(0!=s){var i=1;for(p=c(e,l,e.length,t),l=0;lthis.words[0]+p?this.words[0]+=p:this._iaddn(p)}},h.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t'};var I=['','0','00','000','0000','00000','000000','0000000','00000000','000000000','0000000000','00000000000','000000000000','0000000000000','00000000000000','000000000000000','0000000000000000','00000000000000000','000000000000000000','0000000000000000000','00000000000000000000','000000000000000000000','0000000000000000000000','00000000000000000000000','000000000000000000000000','0000000000000000000000000'],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],P=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(e,t){e=e||10,t=0|t||1;var n;if(16===e||'hex'===e){n='';for(var a=0,o=0,d=0;d>>24-a,n=0!=o||d!==this.length-1?I[6-s.length]+s+n:s+n,a+=2,26<=a&&(a-=26,d--)}for(0!=o&&(n=o.toString(16)+n);0!=n.length%t;)n='0'+n;return 0!==this.negative&&(n='-'+n),n}if(e===(0|e)&&2<=e&&36>=e){var p=C[e],l=P[e];n='';var u=this.clone();for(u.negative=0;!u.isZero();){var c=u.modn(l).toString(e);u=u.idivn(l),n=u.isZero()?c+n:I[p-c.length]+c+n}for(this.isZero()&&(n='0'+n);0!=n.length%t;)n='0'+n;return 0!==this.negative&&(n='-'+n),n}f(!1,'Base should be between 2 and 36')},h.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=n&&(t+=7,n>>>=7),8<=n&&(t+=4,n>>>=4),2<=n&&(t+=2,n>>>=2),t+n},h.prototype._zeroBits=function(e){if(0===e)return 26;var n=e,t=0;return 0==(8191&n)&&(t+=13,n>>>=13),0==(127&n)&&(t+=7,n>>>=7),0==(15&n)&&(t+=4,n>>>=4),0==(3&n)&&(t+=2,n>>>=2),0==(1&n)&&t++,t},h.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0,r;te.length?this.clone().ior(e):e.clone().ior(this)},h.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},h.prototype.iuand=function(e){var t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},h.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},h.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},h.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},h.prototype.inotn=function(e){f('number'==typeof e&&0<=e);var t=0|n(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},h.prototype.notn=function(e){return this.clone().inotn(e)},h.prototype.setn=function(e,t){f('number'==typeof e&&0<=e);var r=0|e/26,n=e%26;return this._expand(r+1),t?this.words[r]|=1<e.length?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o>>26;for(;0!=a&&o>>26;if(this.length=r.length,0!=a)this.words[this.length]=a,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},h.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,a;0>26,this.words[s]=67108863&t;for(;0!=o&&s>26,this.words[s]=67108863&t;if(0==o&&s>>13,f=0|n[1],p=8191&f,l=f>>>13,u=0|n[2],b=8191&u,h=u>>>13,m=0|n[3],y=8191&m,g=m>>>13,v=0|n[4],k=8191&v,x=v>>>13,S=0|n[5],A=8191&S,E=S>>>13,I=0|n[6],C=8191&I,P=I>>>13,T=0|n[7],B=8191&T,N=T>>>13,R=0|n[8],M=8191&R,L=R>>>13,j=0|n[9],O=8191&j,D=j>>>13,U=0|a[0],H=8191&U,F=U>>>13,q=0|a[1],z=8191&q,K=q>>>13,V=0|a[2],G=8191&V,W=V>>>13,X=0|a[3],Y=8191&X,Z=X>>>13,J=0|a[4],$=8191&J,Q=J>>>13,ee=0|a[5],te=8191&ee,re=ee>>>13,ne=0|a[6],ae=8191&ne,oe=ne>>>13,de=0|a[7],ie=8191&de,se=de>>>13,ce=0|a[8],fe=8191&ce,pe=ce>>>13,le=0|a[9],ue=8191&le,be=le>>>13,he,me,ye;r.negative=e.negative^t.negative,r.length=19,he=w(s,H),me=w(s,F),me=0|me+w(c,H),ye=w(c,F);var ge=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(ge>>>26),ge&=67108863,he=w(p,H),me=w(p,F),me=0|me+w(l,H),ye=w(l,F),he=0|he+w(s,z),me=0|me+w(s,K),me=0|me+w(c,z),ye=0|ye+w(c,K);var _e=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(_e>>>26),_e&=67108863,he=w(b,H),me=w(b,F),me=0|me+w(h,H),ye=w(h,F),he=0|he+w(p,z),me=0|me+w(p,K),me=0|me+w(l,z),ye=0|ye+w(l,K),he=0|he+w(s,G),me=0|me+w(s,W),me=0|me+w(c,G),ye=0|ye+w(c,W);var ve=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(ve>>>26),ve&=67108863,he=w(y,H),me=w(y,F),me=0|me+w(g,H),ye=w(g,F),he=0|he+w(b,z),me=0|me+w(b,K),me=0|me+w(h,z),ye=0|ye+w(h,K),he=0|he+w(p,G),me=0|me+w(p,W),me=0|me+w(l,G),ye=0|ye+w(l,W),he=0|he+w(s,Y),me=0|me+w(s,Z),me=0|me+w(c,Y),ye=0|ye+w(c,Z);var ke=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(ke>>>26),ke&=67108863,he=w(k,H),me=w(k,F),me=0|me+w(x,H),ye=w(x,F),he=0|he+w(y,z),me=0|me+w(y,K),me=0|me+w(g,z),ye=0|ye+w(g,K),he=0|he+w(b,G),me=0|me+w(b,W),me=0|me+w(h,G),ye=0|ye+w(h,W),he=0|he+w(p,Y),me=0|me+w(p,Z),me=0|me+w(l,Y),ye=0|ye+w(l,Z),he=0|he+w(s,$),me=0|me+w(s,Q),me=0|me+w(c,$),ye=0|ye+w(c,Q);var xe=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(xe>>>26),xe&=67108863,he=w(A,H),me=w(A,F),me=0|me+w(E,H),ye=w(E,F),he=0|he+w(k,z),me=0|me+w(k,K),me=0|me+w(x,z),ye=0|ye+w(x,K),he=0|he+w(y,G),me=0|me+w(y,W),me=0|me+w(g,G),ye=0|ye+w(g,W),he=0|he+w(b,Y),me=0|me+w(b,Z),me=0|me+w(h,Y),ye=0|ye+w(h,Z),he=0|he+w(p,$),me=0|me+w(p,Q),me=0|me+w(l,$),ye=0|ye+w(l,Q),he=0|he+w(s,te),me=0|me+w(s,re),me=0|me+w(c,te),ye=0|ye+w(c,re);var Se=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Se>>>26),Se&=67108863,he=w(C,H),me=w(C,F),me=0|me+w(P,H),ye=w(P,F),he=0|he+w(A,z),me=0|me+w(A,K),me=0|me+w(E,z),ye=0|ye+w(E,K),he=0|he+w(k,G),me=0|me+w(k,W),me=0|me+w(x,G),ye=0|ye+w(x,W),he=0|he+w(y,Y),me=0|me+w(y,Z),me=0|me+w(g,Y),ye=0|ye+w(g,Z),he=0|he+w(b,$),me=0|me+w(b,Q),me=0|me+w(h,$),ye=0|ye+w(h,Q),he=0|he+w(p,te),me=0|me+w(p,re),me=0|me+w(l,te),ye=0|ye+w(l,re),he=0|he+w(s,ae),me=0|me+w(s,oe),me=0|me+w(c,ae),ye=0|ye+w(c,oe);var we=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(we>>>26),we&=67108863,he=w(B,H),me=w(B,F),me=0|me+w(N,H),ye=w(N,F),he=0|he+w(C,z),me=0|me+w(C,K),me=0|me+w(P,z),ye=0|ye+w(P,K),he=0|he+w(A,G),me=0|me+w(A,W),me=0|me+w(E,G),ye=0|ye+w(E,W),he=0|he+w(k,Y),me=0|me+w(k,Z),me=0|me+w(x,Y),ye=0|ye+w(x,Z),he=0|he+w(y,$),me=0|me+w(y,Q),me=0|me+w(g,$),ye=0|ye+w(g,Q),he=0|he+w(b,te),me=0|me+w(b,re),me=0|me+w(h,te),ye=0|ye+w(h,re),he=0|he+w(p,ae),me=0|me+w(p,oe),me=0|me+w(l,ae),ye=0|ye+w(l,oe),he=0|he+w(s,ie),me=0|me+w(s,se),me=0|me+w(c,ie),ye=0|ye+w(c,se);var Ae=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ae>>>26),Ae&=67108863,he=w(M,H),me=w(M,F),me=0|me+w(L,H),ye=w(L,F),he=0|he+w(B,z),me=0|me+w(B,K),me=0|me+w(N,z),ye=0|ye+w(N,K),he=0|he+w(C,G),me=0|me+w(C,W),me=0|me+w(P,G),ye=0|ye+w(P,W),he=0|he+w(A,Y),me=0|me+w(A,Z),me=0|me+w(E,Y),ye=0|ye+w(E,Z),he=0|he+w(k,$),me=0|me+w(k,Q),me=0|me+w(x,$),ye=0|ye+w(x,Q),he=0|he+w(y,te),me=0|me+w(y,re),me=0|me+w(g,te),ye=0|ye+w(g,re),he=0|he+w(b,ae),me=0|me+w(b,oe),me=0|me+w(h,ae),ye=0|ye+w(h,oe),he=0|he+w(p,ie),me=0|me+w(p,se),me=0|me+w(l,ie),ye=0|ye+w(l,se),he=0|he+w(s,fe),me=0|me+w(s,pe),me=0|me+w(c,fe),ye=0|ye+w(c,pe);var Ee=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ee>>>26),Ee&=67108863,he=w(O,H),me=w(O,F),me=0|me+w(D,H),ye=w(D,F),he=0|he+w(M,z),me=0|me+w(M,K),me=0|me+w(L,z),ye=0|ye+w(L,K),he=0|he+w(B,G),me=0|me+w(B,W),me=0|me+w(N,G),ye=0|ye+w(N,W),he=0|he+w(C,Y),me=0|me+w(C,Z),me=0|me+w(P,Y),ye=0|ye+w(P,Z),he=0|he+w(A,$),me=0|me+w(A,Q),me=0|me+w(E,$),ye=0|ye+w(E,Q),he=0|he+w(k,te),me=0|me+w(k,re),me=0|me+w(x,te),ye=0|ye+w(x,re),he=0|he+w(y,ae),me=0|me+w(y,oe),me=0|me+w(g,ae),ye=0|ye+w(g,oe),he=0|he+w(b,ie),me=0|me+w(b,se),me=0|me+w(h,ie),ye=0|ye+w(h,se),he=0|he+w(p,fe),me=0|me+w(p,pe),me=0|me+w(l,fe),ye=0|ye+w(l,pe),he=0|he+w(s,ue),me=0|me+w(s,be),me=0|me+w(c,ue),ye=0|ye+w(c,be);var Ie=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ie>>>26),Ie&=67108863,he=w(O,z),me=w(O,K),me=0|me+w(D,z),ye=w(D,K),he=0|he+w(M,G),me=0|me+w(M,W),me=0|me+w(L,G),ye=0|ye+w(L,W),he=0|he+w(B,Y),me=0|me+w(B,Z),me=0|me+w(N,Y),ye=0|ye+w(N,Z),he=0|he+w(C,$),me=0|me+w(C,Q),me=0|me+w(P,$),ye=0|ye+w(P,Q),he=0|he+w(A,te),me=0|me+w(A,re),me=0|me+w(E,te),ye=0|ye+w(E,re),he=0|he+w(k,ae),me=0|me+w(k,oe),me=0|me+w(x,ae),ye=0|ye+w(x,oe),he=0|he+w(y,ie),me=0|me+w(y,se),me=0|me+w(g,ie),ye=0|ye+w(g,se),he=0|he+w(b,fe),me=0|me+w(b,pe),me=0|me+w(h,fe),ye=0|ye+w(h,pe),he=0|he+w(p,ue),me=0|me+w(p,be),me=0|me+w(l,ue),ye=0|ye+w(l,be);var Ce=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ce>>>26),Ce&=67108863,he=w(O,G),me=w(O,W),me=0|me+w(D,G),ye=w(D,W),he=0|he+w(M,Y),me=0|me+w(M,Z),me=0|me+w(L,Y),ye=0|ye+w(L,Z),he=0|he+w(B,$),me=0|me+w(B,Q),me=0|me+w(N,$),ye=0|ye+w(N,Q),he=0|he+w(C,te),me=0|me+w(C,re),me=0|me+w(P,te),ye=0|ye+w(P,re),he=0|he+w(A,ae),me=0|me+w(A,oe),me=0|me+w(E,ae),ye=0|ye+w(E,oe),he=0|he+w(k,ie),me=0|me+w(k,se),me=0|me+w(x,ie),ye=0|ye+w(x,se),he=0|he+w(y,fe),me=0|me+w(y,pe),me=0|me+w(g,fe),ye=0|ye+w(g,pe),he=0|he+w(b,ue),me=0|me+w(b,be),me=0|me+w(h,ue),ye=0|ye+w(h,be);var Pe=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Pe>>>26),Pe&=67108863,he=w(O,Y),me=w(O,Z),me=0|me+w(D,Y),ye=w(D,Z),he=0|he+w(M,$),me=0|me+w(M,Q),me=0|me+w(L,$),ye=0|ye+w(L,Q),he=0|he+w(B,te),me=0|me+w(B,re),me=0|me+w(N,te),ye=0|ye+w(N,re),he=0|he+w(C,ae),me=0|me+w(C,oe),me=0|me+w(P,ae),ye=0|ye+w(P,oe),he=0|he+w(A,ie),me=0|me+w(A,se),me=0|me+w(E,ie),ye=0|ye+w(E,se),he=0|he+w(k,fe),me=0|me+w(k,pe),me=0|me+w(x,fe),ye=0|ye+w(x,pe),he=0|he+w(y,ue),me=0|me+w(y,be),me=0|me+w(g,ue),ye=0|ye+w(g,be);var Te=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Te>>>26),Te&=67108863,he=w(O,$),me=w(O,Q),me=0|me+w(D,$),ye=w(D,Q),he=0|he+w(M,te),me=0|me+w(M,re),me=0|me+w(L,te),ye=0|ye+w(L,re),he=0|he+w(B,ae),me=0|me+w(B,oe),me=0|me+w(N,ae),ye=0|ye+w(N,oe),he=0|he+w(C,ie),me=0|me+w(C,se),me=0|me+w(P,ie),ye=0|ye+w(P,se),he=0|he+w(A,fe),me=0|me+w(A,pe),me=0|me+w(E,fe),ye=0|ye+w(E,pe),he=0|he+w(k,ue),me=0|me+w(k,be),me=0|me+w(x,ue),ye=0|ye+w(x,be);var Be=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Be>>>26),Be&=67108863,he=w(O,te),me=w(O,re),me=0|me+w(D,te),ye=w(D,re),he=0|he+w(M,ae),me=0|me+w(M,oe),me=0|me+w(L,ae),ye=0|ye+w(L,oe),he=0|he+w(B,ie),me=0|me+w(B,se),me=0|me+w(N,ie),ye=0|ye+w(N,se),he=0|he+w(C,fe),me=0|me+w(C,pe),me=0|me+w(P,fe),ye=0|ye+w(P,pe),he=0|he+w(A,ue),me=0|me+w(A,be),me=0|me+w(E,ue),ye=0|ye+w(E,be);var Ne=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Ne>>>26),Ne&=67108863,he=w(O,ae),me=w(O,oe),me=0|me+w(D,ae),ye=w(D,oe),he=0|he+w(M,ie),me=0|me+w(M,se),me=0|me+w(L,ie),ye=0|ye+w(L,se),he=0|he+w(B,fe),me=0|me+w(B,pe),me=0|me+w(N,fe),ye=0|ye+w(N,pe),he=0|he+w(C,ue),me=0|me+w(C,be),me=0|me+w(P,ue),ye=0|ye+w(P,be);var Re=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Re>>>26),Re&=67108863,he=w(O,ie),me=w(O,se),me=0|me+w(D,ie),ye=w(D,se),he=0|he+w(M,fe),me=0|me+w(M,pe),me=0|me+w(L,fe),ye=0|ye+w(L,pe),he=0|he+w(B,ue),me=0|me+w(B,be),me=0|me+w(N,ue),ye=0|ye+w(N,be);var Me=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Me>>>26),Me&=67108863,he=w(O,fe),me=w(O,pe),me=0|me+w(D,fe),ye=w(D,pe),he=0|he+w(M,ue),me=0|me+w(M,be),me=0|me+w(L,ue),ye=0|ye+w(L,be);var Le=0|(0|o+he)+((8191&me)<<13);o=0|(0|ye+(me>>>13))+(Le>>>26),Le&=67108863,he=w(O,ue),me=w(O,be),me=0|me+w(D,ue),ye=w(D,be);var je=0|(0|o+he)+((8191&me)<<13);return o=0|(0|ye+(me>>>13))+(je>>>26),je&=67108863,d[0]=ge,d[1]=_e,d[2]=ve,d[3]=ke,d[4]=xe,d[5]=Se,d[6]=we,d[7]=Ae,d[8]=Ee,d[9]=Ie,d[10]=Ce,d[11]=Pe,d[12]=Te,d[13]=Be,d[14]=Ne,d[15]=Re,d[16]=Me,d[17]=Le,d[18]=je,0!=o&&(d[19]=o,r.length++),r};w||(T=i),h.prototype.mulTo=function(e,t){var r=this.length+e.length,n;return n=10===this.length&&10===e.length?T(this,e,t):63>r?i(this,e,t):1024>r?l(this,e,t):u(this,e,t),n},b.prototype.makeRBT=function(e){for(var r=Array(e),t=h.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,a,o){for(var d=0;d>>=1)a++;return 1<=n))for(var a=0,o;ao?0:0|o/67108864;return e},b.prototype.convert13b=function(e,t,r,n){for(var a=0,o=0;o>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;oe);for(var t=0,r=0;r>=26,t+=0|n/67108864,t+=a>>>26,this.words[r]=67108863&a}return 0!=t&&(this.words[r]=t,this.length++),this},h.prototype.muln=function(e){return this.clone().imuln(e)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(e){var t=p(e);if(0===t.length)return new h(1);for(var r=this,n=0;n>>26-t<<26-t,d=(0|this.words[n])-o<>>26-t}a&&(this.words[n]=a,this.length++)}if(0!=r){for(n=this.length-1;0<=n;n--)this.words[n+r]=this.words[n];for(n=0;nr)for(this.length-=r,p=0;p=a);p--){var l=0|this.words[p];this.words[p]=i<<26-c|l>>>c,i=l&(67108863^67108863>>>c<>>t<e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;tthis.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},h.prototype.addn=function(e){return this.clone().iaddn(e)},h.prototype.subn=function(e){return this.clone().isubn(e)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(e,t,r){var n=e.length+r,a;this._expand(n);var o=0,d;for(a=0;a>26)-(0|i/67108864),this.words[a+r]=67108863&d}for(;a>26,this.words[a+r]=67108863&d;if(0==o)return this.strip();for(f(-1==o),o=0,a=0;a>26,this.words[a]=67108863&d;return this.negative=1,this.strip()},h.prototype._wordDiv=function(e,t){var r=this.length-e.length,n=this.clone(),d=e,s=0|d.words[d.length-1],c=this._countBits(s);r=26-c,0!=r&&(d=d.ushln(r),n.iushln(r),s=0|d.words[d.length-1]);var f=n.length-d.length,p;if('mod'!==t){p=new h(null),p.length=f+1,p.words=Array(p.length);for(var l=0;lthis.length||0>this.cmp(e)?{div:new h(0),mod:this}:1===e.length?'div'===t?{div:this.divn(e.words[0]),mod:null}:'mod'===t?{div:null,mod:new h(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new h(this.modn(e.words[0]))}:this._wordDiv(e,t):(o=this.neg().divmod(e.neg(),t),'div'!==t&&(a=o.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:o.div,mod:a})},h.prototype.div=function(e){return this.divmod(e,'div',!1).div},h.prototype.mod=function(e){return this.divmod(e,'mod',!1).mod},h.prototype.umod=function(e){return this.divmod(e,'mod',!0).mod},h.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0===t.div.negative?t.mod:t.mod.isub(e),n=e.ushrn(1),a=e.andln(1),o=r.cmp(n);return 0>o||1===a&&0===o?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},h.prototype.modn=function(e){f(67108863>=e);for(var t=0,r=this.length-1;0<=r;r--)t=(67108864%e*t+(0|this.words[r]))%e;return t},h.prototype.idivn=function(e){f(67108863>=e);for(var t=0,r=this.length-1,n;0<=r;r--)n=(0|this.words[r])+67108864*t,this.words[r]=0|n/e,t=n%e;return this.strip()},h.prototype.divn=function(e){return this.clone().idivn(e)},h.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var t=this,r=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var n=new h(1),a=new h(0),o=new h(0),d=new h(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var c=r.clone(),p=t.clone();!t.isZero();){for(var l=0,i=1;0==(t.words[0]&i)&&26>l;++l,i<<=1);if(0u;++u,b<<=1);if(0d;++d,i<<=1);if(0s;++s,c<<=1);if(0p.cmpn(0)&&p.iadd(e),p},h.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var n=this.clone(),a=e.clone();n.negative=0,a.negative=0;for(var o=0;n.isEven()&&a.isEven();o++)n.iushrn(1),a.iushrn(1);do{for(;n.isEven();)n.iushrn(1);for(;a.isEven();)a.iushrn(1);var d=n.cmp(a);if(0>d){var r=n;n=a,a=r}else if(0===d||0===a.cmpn(1))break;n.isub(a)}while(!0);return a.iushln(o)},h.prototype.invm=function(e){return this.egcd(e).a.umod(e)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(e){return this.words[0]&e},h.prototype.bincn=function(e){f('number'==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,d&=67108863,this.words[o]=d;return 0!=a&&(this.words[o]=a,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(e){var t=0>e;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;this.strip();var r;if(1=e,'Number is too big');var n=0|this.words[0];r=n===e?0:ne.length)return 1;if(this.lengtha&&(t=1);break}}return t},h.prototype.gtn=function(e){return 1===this.cmpn(e)},h.prototype.gt=function(e){return 1===this.cmp(e)},h.prototype.gten=function(e){return 0<=this.cmpn(e)},h.prototype.gte=function(e){return 0<=this.cmp(e)},h.prototype.ltn=function(e){return-1===this.cmpn(e)},h.prototype.lt=function(e){return-1===this.cmp(e)},h.prototype.lten=function(e){return 0>=this.cmpn(e)},h.prototype.lte=function(e){return 0>=this.cmp(e)},h.prototype.eqn=function(e){return 0===this.cmpn(e)},h.prototype.eq=function(e){return 0===this.cmp(e)},h.red=function(e){return new x(e)},h.prototype.toRed=function(e){return f(!this.red,'Already a number in reduction context'),f(0===this.negative,'red works only with positives'),e.convertTo(this)._forceRed(e)},h.prototype.fromRed=function(){return f(this.red,'fromRed works only with numbers in reduction context'),this.red.convertFrom(this)},h.prototype._forceRed=function(e){return this.red=e,this},h.prototype.forceRed=function(e){return f(!this.red,'Already a number in reduction context'),this._forceRed(e)},h.prototype.redAdd=function(e){return f(this.red,'redAdd works only with red numbers'),this.red.add(this,e)},h.prototype.redIAdd=function(e){return f(this.red,'redIAdd works only with red numbers'),this.red.iadd(this,e)},h.prototype.redSub=function(e){return f(this.red,'redSub works only with red numbers'),this.red.sub(this,e)},h.prototype.redISub=function(e){return f(this.red,'redISub works only with red numbers'),this.red.isub(this,e)},h.prototype.redShl=function(e){return f(this.red,'redShl works only with red numbers'),this.red.shl(this,e)},h.prototype.redMul=function(e){return f(this.red,'redMul works only with red numbers'),this.red._verify2(this,e),this.red.mul(this,e)},h.prototype.redIMul=function(e){return f(this.red,'redMul works only with red numbers'),this.red._verify2(this,e),this.red.imul(this,e)},h.prototype.redSqr=function(){return f(this.red,'redSqr works only with red numbers'),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return f(this.red,'redISqr works only with red numbers'),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return f(this.red,'redSqrt works only with red numbers'),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return f(this.red,'redInvm works only with red numbers'),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return f(this.red,'redNeg works only with red numbers'),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(e){return f(this.red&&!e.red,'redPow(normalNum)'),this.red._verify1(this),this.red.pow(this,e)};var B={k256:null,p224:null,p192:null,p25519:null};m.prototype._tmp=function(){var e=new h(null);return e.words=Array(n(this.n/13)),e},m.prototype.ireduce=function(e){var t=e,r;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),r=t.bitLength();while(r>this.n);var n=r=e.length)return e.words[0]=0,void(e.length=1);var d=e.words[9];for(t.words[t.length++]=d&r,a=10;a>>22,d=i}d>>>=22,e.words[a-10]=d,e.length-=0===d&&10>>=26,e.words[r]=a,t=n}return 0!=t&&(e.words[e.length++]=t),e},h._prime=function(e){if(B[e])return B[e];var t;if('k256'===e)t=new y;else if('p224'===e)t=new g;else if('p192'===e)t=new v;else if('p25519'===e)t=new k;else throw new Error('Unknown prime '+e);return B[e]=t,t},x.prototype._verify1=function(e){f(0===e.negative,'red works only with positives'),f(e.red,'red works only with red numbers')},x.prototype._verify2=function(e,t){f(0==(e.negative|t.negative),'red works only with positives'),f(e.red&&e.red===t.red,'red works only with red numbers')},x.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},x.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},x.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},x.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},x.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},x.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},x.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},x.prototype.isqr=function(e){return this.imul(e,e.clone())},x.prototype.sqr=function(e){return this.mul(e,e)},x.prototype.sqrt=function(e){if(e.isZero())return e.clone();var n=this.m.andln(3);if(f(1==n%2),3===n){var a=this.m.add(new h(1)).iushrn(2);return this.pow(e,a)}for(var o=this.m.subn(1),d=0;!o.isZero()&&0===o.andln(1);)d++,o.iushrn(1);f(!o.isZero());var s=new h(1).toRed(this),p=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new h(2*u*u).toRed(this);0!==this.pow(u,l).cmp(p);)u.redIAdd(p);for(var y=this.pow(u,o),c=this.pow(e,o.addn(1).iushrn(1)),r=this.pow(e,o),t=d;0!==r.cmp(s);){for(var m=r,g=0;0!==m.cmp(s);g++)m=m.redSqr();f(g>f,o!==n[0]&&(o=this.sqr(o)),0===p&&0==d){i=0;continue}d<<=1,d|=p,i++,i!=r&&(0!==a||0!==f)||(o=this.mul(o,n[d]),i=0,d=0)}s=26}return o},x.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},x.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},h.mont=function(e){return new S(e)},a(S,x),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,r){if(e.isZero()||r.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(r),t=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(t).iushrn(this.shift),o=a;return 0<=a.cmp(this.m)?o=a.isub(this.m):0>a.cmpn(0)&&(o=a.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(e,r){if(e.isZero()||r.isZero())return new h(0)._forceRed(this);var n=e.mul(r),t=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(t).iushrn(this.shift),o=a;return 0<=a.cmp(this.m)?o=a.isub(this.m):0>a.cmpn(0)&&(o=a.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})('undefined'==typeof e||e,this)}).call(this,r(56)(e))},function(e,t,r){'use strict';var n=Math.pow,a=String.fromCharCode,o=Math.floor,d=Math.min;(function(e){function i(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(i()e)throw new RangeError('"size" argument must not be negative')}function l(e,t,r,n){return p(t),0>=t?s(e,t):void 0===r?s(e,t):'string'==typeof n?s(e,t).fill(r,n):s(e,t).fill(r)}function u(e,t){if(p(t),e=s(e,0>t?0:0|g(t)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;rt.length?0:0|g(t.length);e=s(e,r);for(var n=0;nr||t.byteLength=i())throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x'+i().toString(16)+' bytes');return 0|e}function v(e,t){if(c.isBuffer(e))return e.length;if('undefined'!=typeof ArrayBuffer&&'function'==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;'string'!=typeof e&&(e=''+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case'ascii':case'latin1':case'binary':return r;case'utf8':case'utf-8':case void 0:return X(e).length;case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return 2*r;case'hex':return r>>>1;case'base64':return J(e).length;default:if(n)return X(e).length;t=(''+t).toLowerCase(),n=!0;}}function k(e,t,r){var n=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return'';if((void 0===r||r>this.length)&&(r=this.length),0>=r)return'';if(r>>>=0,t>>>=0,r<=t)return'';for(e||(e='utf8');;)switch(e){case'hex':return j(this,t,r);case'utf8':case'utf-8':return N(this,t,r);case'ascii':return M(this,t,r);case'latin1':case'binary':return L(this,t,r);case'base64':return B(this,t,r);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return O(this,t,r);default:if(n)throw new TypeError('Unknown encoding: '+e);e=(e+'').toLowerCase(),n=!0;}}function x(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function S(e,t,r,n,a){if(0===e.length)return-1;if('string'==typeof r?(n=r,r=0):2147483647r&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),0>r&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(0>r)if(a)r=0;else return-1;if('string'==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,a);if('number'==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&'function'==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,a);throw new TypeError('val must be string, number or Buffer')}function w(e,t,r,n,a){function o(e,t){return 1===d?e[t]:e.readUInt16BE(t*d)}var d=1,s=e.length,c=t.length;if(void 0!==n&&(n=(n+'').toLowerCase(),'ucs2'===n||'ucs-2'===n||'utf16le'===n||'utf-16le'===n)){if(2>e.length||2>t.length)return-1;d=2,s/=2,c/=2,r/=2}var f;if(a){var i=-1;for(f=r;fs&&(r=s-c),f=r;0<=f;f--){for(var p=!0,l=0;la&&(n=a)):n=a;var o=t.length;if(0!=o%2)throw new TypeError('Invalid hex string');n>o/2&&(n=o/2);for(var d=0,i;do&&(i=o):2==s?(c=e[a+1],128==(192&c)&&(l=(31&o)<<6|63&c,127l||57343l&&(i=l))):void 0}null===i?(i=65533,s=1):65535>>10),i=56320|1023&i),n.push(i),a+=s}return R(n)}function R(e){var t=e.length;if(t<=ne)return a.apply(String,e);for(var r='',n=0;nt)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var a='',o=t;oe)throw new RangeError('offset is not uint');if(e+t>r)throw new RangeError('Trying to access beyond buffer length')}function U(e,t,r,n,a,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError('Index out of range')}function H(e,t,r,n){0>t&&(t=65535+t+1);for(var a=0,o=d(e.length-r,2);a>>8*(n?a:1-a)}function F(e,t,r,n){0>t&&(t=4294967295+t+1);for(var a=0,o=d(e.length-r,4);a>>8*(n?a:3-a)}function q(e,t,r,n){if(r+n>e.length)throw new RangeError('Index out of range');if(0>r)throw new RangeError('Index out of range')}function z(e,t,r,n,a){return a||q(e,t,r,4,34028234663852886e22,-34028234663852886e22),te.write(e,t,r,n,23,4),r+4}function K(e,t,r,n,a){return a||q(e,t,r,8,17976931348623157e292,-17976931348623157e292),te.write(e,t,r,n,52,8),r+8}function V(e){if(e=G(e).replace(ae,''),2>e.length)return'';for(;0!=e.length%4;)e+='=';return e}function G(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,'')}function W(e){return 16>e?'0'+e.toString(16):e.toString(16)}function X(e,t){t=t||Infinity;for(var r=e.length,n=null,a=[],o=0,d;od){if(!n){if(56319d){-1<(t-=3)&&a.push(239,191,189),n=d;continue}d=(n-55296<<10|d-56320)+65536}else n&&-1<(t-=3)&&a.push(239,191,189);if(n=null,128>d){if(0>(t-=1))break;a.push(d)}else if(2048>d){if(0>(t-=2))break;a.push(192|d>>6,128|63&d)}else if(65536>d){if(0>(t-=3))break;a.push(224|d>>12,128|63&d>>6,128|63&d)}else if(1114112>d){if(0>(t-=4))break;a.push(240|d>>18,128|63&d>>12,128|63&d>>6,128|63&d)}else throw new Error('Invalid code point')}return a}function Y(e){for(var t=[],r=0;r(t-=2));++n)a=e.charCodeAt(n),o=a>>8,d=a%256,r.push(d),r.push(o);return r}function J(e){return ee.toByteArray(V(e))}function $(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function Q(e){return e!==e}/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */var ee=r(204),te=r(205),re=r(100);t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=e.TYPED_ARRAY_SUPPORT===void 0?function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&'function'==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}():e.TYPED_ARRAY_SUPPORT,t.kMaxLength=i(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,r){return f(null,e,t,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,'undefined'!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,r){return l(null,e,t,r)},c.allocUnsafe=function(e){return u(null,e)},c.allocUnsafeSlow=function(e){return u(null,e)},c.isBuffer=function(e){return!!(null!=e&&e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('Arguments must be Buffers');if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=d(r,n);ar&&(e+=' ... ')),''},c.prototype.compare=function(e,t,r,n,a){if(!c.isBuffer(e))throw new TypeError('Argument must be a Buffer');if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),0>t||r>e.length||0>n||a>this.length)throw new RangeError('out of range index');if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,s=r-t,f=d(o,s),p=this.slice(n,a),l=e.slice(t,r),u=0;ua)&&(r=a),0r||0>t)||t>this.length)throw new RangeError('Attempt to write outside buffer bounds');n||(n='utf8');for(var o=!1;;)switch(n){case'hex':return A(this,e,t,r);case'utf8':case'utf-8':return E(this,e,t,r);case'ascii':return I(this,e,t,r);case'latin1':case'binary':return C(this,e,t,r);case'base64':return P(this,e,t,r);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return T(this,e,t,r);default:if(o)throw new TypeError('Unknown encoding: '+n);n=(''+n).toLowerCase(),o=!0;}},c.prototype.toJSON=function(){return{type:'Buffer',data:Array.prototype.slice.call(this._arr||this,0)}};var ne=4096;c.prototype.slice=function(e,t){var r=this.length;e=~~e,t=t===void 0?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),t=o&&(a-=n(2,8*t)),a},c.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var a=t,o=1,d=this[e+--a];0=o&&(d-=n(2,8*t)),d},c.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),te.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),te.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),te.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),te.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,a){if(e=+e,t|=0,r|=0,!a){var o=n(2,8*r)-1;U(this,e,t,r,o,0)}var d=1,s=0;for(this[t]=255&e;++s>>8):H(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):H(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):F(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t|=0,!a){var o=n(2,8*r-1);U(this,e,t,r,o-1,-o)}var d=0,i=1,s=0;for(this[t]=255&e;++de&&0==s&&0!==this[t+d-1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},c.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t|=0,!a){var o=n(2,8*r-1);U(this,e,t,r,o-1,-o)}var d=r-1,i=1,s=0;for(this[t+d]=255&e;0<=--d&&(i*=256);)0>e&&0==s&&0!==this[t+d+1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=o(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):H(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):H(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):F(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,r){return z(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return z(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return K(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return K(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0t)throw new RangeError('targetStart out of bounds');if(0>r||r>=this.length)throw new RangeError('sourceStart out of bounds');if(0>n)throw new RangeError('sourceEnd out of bounds');n>this.length&&(n=this.length),e.length-ta||!c.TYPED_ARRAY_SUPPORT)for(o=0;oa&&(e=a)}if(void 0!==n&&'string'!=typeof n)throw new TypeError('encoding must be a string');if('string'==typeof n&&!c.isEncoding(n))throw new TypeError('Unknown encoding: '+n)}else'number'==typeof e&&(e&=255);if(0>t||this.length>>=0,r=r===void 0?this.length:r>>>0,e||(e=0);var o;if('number'==typeof e)for(o=t;os.a.toBN(e).toString(10),p=(e)=>'latest'===e||'pending'===e||'earliest'===e,l=(e)=>void 0===e?void 0:p(e)?e:s.a.isHexStrict(e)?Object(i.isString)(e)?e.toLowerCase():e:s.a.numberToHex(e),u=(e)=>{if(e.to&&(e.to=m(e.to)),e.data&&e.input)throw new Error('You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.');if(!e.data&&e.input&&(e.data=e.input,delete e.input),e.data&&!s.a.isHex(e.data))throw new Error('The data field must be HEX encoded data.');return(e.gas||e.gasLimit)&&(e.gas=e.gas||e.gasLimit),['gasPrice','gas','value','nonce'].filter((t)=>void 0!==e[t]).forEach((t)=>{e[t]=s.a.numberToHex(e[t])}),e},b=(e)=>(null!==e.blockNumber&&(e.blockNumber=s.a.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=s.a.hexToNumber(e.transactionIndex)),e.nonce=s.a.hexToNumber(e.nonce),e.gas=s.a.hexToNumber(e.gas),e.gasPrice=f(e.gasPrice),e.value=f(e.value),e.to=e.to&&s.a.isAddress(e.to)?s.a.toChecksumAddress(e.to):null,e.from&&(e.from=s.a.toChecksumAddress(e.from)),e),h=(e)=>{if('string'==typeof e.blockHash&&'string'==typeof e.transactionHash&&'string'==typeof e.logIndex){const t=s.a.sha3(e.blockHash.replace('0x','')+e.transactionHash.replace('0x','')+e.logIndex.replace('0x',''));e.id=`log_${t.replace('0x','').substr(0,8)}`}else e.id||(e.id=null);return null!==e.blockNumber&&(e.blockNumber=s.a.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=s.a.hexToNumber(e.transactionIndex)),null!==e.logIndex&&(e.logIndex=s.a.hexToNumber(e.logIndex)),e.address&&(e.address=s.a.toChecksumAddress(e.address)),e};var m=(e)=>{const t=new c.a(e);if(t.isValid()&&t.isDirect())return t.toAddress().toLowerCase();if(s.a.isAddress(e))return`0x${e.toLowerCase().replace('0x','')}`;throw new Error(`Provided address "${e}" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.`)};var y={inputDefaultBlockNumberFormatter:(e,t)=>void 0===e||null===e?t.defaultBlock:'genesis'===e||'earliest'===e?'0x0':l(e),inputBlockNumberFormatter:l,inputCallFormatter:(e,t)=>{e=u(e);let r=t.defaultAccount;return e.from&&(r=e.from),r&&(e.from=m(r)),e},inputTransactionFormatter:(e,t)=>{if(e=u(e),!Object(i.isNumber)(e.from)&&!Object(i.isObject)(e.from)){if(e.from||(e.from=t.defaultAccount),!e.from&&!Object(i.isNumber)(e.from))throw new Error('The send transactions "from" field must be defined!');e.from=m(e.from)}return e},inputAddressFormatter:m,inputPostFormatter:(e)=>(e.ttl&&(e.ttl=s.a.numberToHex(e.ttl)),e.workToProve&&(e.workToProve=s.a.numberToHex(e.workToProve)),e.priority&&(e.priority=s.a.numberToHex(e.priority)),Object(i.isArray)(e.topics)||(e.topics=e.topics?[e.topics]:[]),e.topics=e.topics.map((e)=>0===e.indexOf('0x')?e:s.a.fromUtf8(e)),e),inputLogFormatter:(e)=>{let t=(e)=>null===e||'undefined'==typeof e?null:(e+='',0===e.indexOf('0x')?e:s.a.fromUtf8(e));return e.fromBlock&&(e.fromBlock=l(e.fromBlock)),e.toBlock&&(e.toBlock=l(e.toBlock)),e.topics=e.topics||[],e.topics=e.topics.map((e)=>Object(i.isArray)(e)?e.map(t):t(e)),t=null,e.address&&(e.address=Object(i.isArray)(e.address)?e.address.map((e)=>m(e)):m(e.address)),e},inputSignFormatter:(e)=>s.a.isHexStrict(e)?e:s.a.utf8ToHex(e),outputBigNumberFormatter:f,outputTransactionFormatter:b,outputTransactionReceiptFormatter:(e)=>{if('object'!=typeof e)throw new Error(`Received receipt is invalid: ${e}`);return null!==e.blockNumber&&(e.blockNumber=s.a.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=s.a.hexToNumber(e.transactionIndex)),e.cumulativeGasUsed=s.a.hexToNumber(e.cumulativeGasUsed),e.gasUsed=s.a.hexToNumber(e.gasUsed),Object(i.isArray)(e.logs)&&(e.logs=e.logs.map(h)),e.contractAddress&&(e.contractAddress=s.a.toChecksumAddress(e.contractAddress)),'undefined'!=typeof e.status&&(e.status=!!parseInt(e.status)),e},outputBlockFormatter:(e)=>(e.gasLimit=s.a.hexToNumber(e.gasLimit),e.gasUsed=s.a.hexToNumber(e.gasUsed),e.size=s.a.hexToNumber(e.size),e.timestamp=s.a.hexToNumber(e.timestamp),null!==e.number&&(e.number=s.a.hexToNumber(e.number)),e.difficulty&&(e.difficulty=f(e.difficulty)),e.totalDifficulty&&(e.totalDifficulty=f(e.totalDifficulty)),Object(i.isArray)(e.transactions)&&e.transactions.forEach((e)=>{if(!Object(i.isString)(e))return b(e)}),e.miner&&(e.miner=s.a.toChecksumAddress(e.miner)),e),outputLogFormatter:h,outputPostFormatter:(e)=>(e.expiry=s.a.hexToNumber(e.expiry),e.sent=s.a.hexToNumber(e.sent),e.ttl=s.a.hexToNumber(e.ttl),e.workProved=s.a.hexToNumber(e.workProved),e.topics||(e.topics=[]),e.topics=e.topics.map((e)=>s.a.toUtf8(e)),e),outputSyncingFormatter:(e)=>(e.startingBlock=s.a.hexToNumber(e.startingBlock),e.currentBlock=s.a.hexToNumber(e.currentBlock),e.highestBlock=s.a.hexToNumber(e.highestBlock),e.knownStates&&(e.knownStates=s.a.hexToNumber(e.knownStates),e.pulledStates=s.a.hexToNumber(e.pulledStates)),e)};r.d(t,'a',function(){return n}),r.d(t,'b',function(){return y})},function(e,t,r){function n(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return d(e,t,r)}var o=r(3),d=o.Buffer;d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?e.exports=o:(n(o,t),t.Buffer=a),n(d,a),a.from=function(e,t,r){if('number'==typeof e)throw new TypeError('Argument must not be a number');return d(e,t,r)},a.alloc=function(e,t,r){if('number'!=typeof e)throw new TypeError('Argument must be a number');var n=d(e);return void 0===t?n.fill(0):'string'==typeof r?n.fill(t,r):n.fill(t),n},a.allocUnsafe=function(e){if('number'!=typeof e)throw new TypeError('Argument must be a number');return d(e)},a.allocUnsafeSlow=function(e){if('number'!=typeof e)throw new TypeError('Argument must be a number');return o.SlowBuffer(e)}},function(e){var t=function(){return this}();try{t=t||Function('return this')()||(1,eval)('this')}catch(r){'object'==typeof window&&(t=window)}e.exports=t},function(e,t,r){for(var n=r(169),a=r(93),o=r(36),d=r(24),s=r(25),c=r(71),f=r(23),p=f('iterator'),l=f('toStringTag'),u=c.Array,b={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=a(b),m=0;mthis.providersModuleFactory.createBatchRequest(this.currentProvider),null!==d&&'undefined'!=typeof d)return this.methodModelFactory=d,this.extend.formatters=this.methodModelFactory.formatters,new Proxy(this,{get:this.proxyHandler})}get currentProvider(){return this._currentProvider}set currentProvider(e){throw Error('The property currentProvider read-only!')}setProvider(e,t){if(!this.isSameProvider(e)){if(this.clearSubscriptions(),this._currentProvider=this.providerAdapterResolver.resolve(e,t),0!!r.setProvider(e,t));return!!(r&&this._currentProvider)}return!1}isSameProvider(e){return Object(a.isObject)(e)?this.currentProvider.provider.constructor.name===e.constructor.name&&this.currentProvider.host===e.host:this.currentProvider.host===e}clearSubscriptions(){'undefined'!=typeof this.currentProvider.clearSubscriptions&&0{class t extends AbstractMethodModel{constructor(t,r){super(e.call,e.params,t,r)}beforeExecution(t,r){e.inputFormatters.forEach((e,n)=>{e&&(t[n]=e(t[n],r))})}afterExecution(t){return Object(a.isArray)(t)?(t=t.map((t)=>e.outputFormatter&&t?e.outputFormatter(t):t),t):(e.outputFormatter&&result&&(t=e.outputFormatter(t)),t)}}r.methodModelFactory.methodModels[e.name]=t})}proxyHandler(e,t){if(e.methodModelFactory.hasMethodModel(t)){if('undefined'!=typeof e[t])throw new Error(`Duplicated method ${t}. This method is defined as RPC call and as Object method.`);const r=e.methodModelFactory.createMethodModel(t),n=()=>{if(r.methodArguments=arguments,r.parameters.length!==r.parametersAmount)throw Error(`Invalid parameters length the expected length would be ${r.parametersAmount} and not ${r.parameters.length}`);return e.methodController.execute(r,e.accounts,e)};return n.methodModel=r,n.request=r.request,n}return e[t]}throwIfMissing(){throw Error('Parameter with name ${name} is missing')}}r.d(t,'a',function(){return o})},function(e){function t(e,t){if(!e)throw new Error(t||'Assertion failed')}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||'Assertion failed: '+e+' != '+t)}},function(e,t,r){var n=String.fromCharCode;const a=r(230),o=(e,t)=>parseInt(e.slice(2*t+2,2*t+4),16),d=(e)=>(e.length-2)/2,i=(e,t)=>t.length===2*e+2?t:i(e,'0x0'+t.slice(2)),s=(e,t)=>t.length===2*e+2?t:s(e,t+'0'),c=(e)=>{let t=[];for(let r=2,n=e.length;r{let t='0x';for(let r=0,n=e.length,a;ra?'0':'')+a.toString(16);return t};e.exports={random:(e)=>{let t='undefined'!=typeof window&&window.crypto&&window.crypto.getRandomValues?window.crypto.getRandomValues(new Uint8Array(e)):r(108).randomBytes(e);let n='0x';for(let r=0;re.concat(t.slice(2)),flatten:(e)=>'0x'+e.reduce((e,t)=>e+t.slice(2),''),slice:(e,t,r)=>'0x'+r.slice(2*e+2,2*t+2),reverse:(e)=>{let t='0x';for(let r=0,n=d(e);r{let t='0x';for(let r=0;r{let t='';for(let r=2;r{const t=(e)=>{const t=e.toString(16);return 2>t.length?'0'+t:t};let r='0x';for(let n=0,a;n!=e.length;n++){if(a=e.charCodeAt(n),128>a){r+=t(a);continue}if(2048>a)r+=t(192|a>>6);else{if(55295a){if(++n==e.length)return null;let o=e.charCodeAt(n);if(56320>o||57343>18),r+=t(128|63&a>>12)}else r+=t(224|a>>12);r+=t(128|63&a>>6)}r+=t(128|63&a)}return r},toString:(e)=>{let t='',r=0,a=d(e);for(;rd){if(r>=a)return null;d=(31&d)<<6|63&o(e,r)}else if(223d){if(r+1>=a)return null;d=(15&d)<<12|(63&o(e,r))<<6|63&o(e,++r)}else if(239d){if(r+2>=a)return null;d=(7&d)<<18|(63&o(e,r))<<12|(63&o(e,++r))<<6|63&o(e,++r)}else return null;++r}if(65535>=d)t+=n(d);else if(1114111>=d)d-=65536,t+=n(55296|d>>10),t+=n(56320|1023&d);else return null}return t},fromNumber:(e)=>{let t=e.toString(16);return 0==t.length%2?'0x'+t:'0x0'+t},toNumber:(e)=>parseInt(e.slice(2),16),fromNat:(e)=>'0x0'===e?'0x':0==e.length%2?e:'0x0'+e.slice(2),toNat:(e)=>'0'===e[2]?'0x'+e.slice(3):e,fromArray:f,toArray:c,fromUint8Array:(e)=>f([].slice.call(e,0)),toUint8Array:(e)=>new Uint8Array(c(e))}},function(e,t,r){(function(t){const n=r(13),a=r(85),o=r(10),d=r(21),i=new o.ec('secp256k1'),{keccak256:s,keccak256s:c}=r(18),f=(e)=>{const t=c(e.slice(2));let r='0x';for(let n=0;40>n;n++)r+=7{const r=new t(e.slice(2),'hex'),n=i.keyFromPrivate(r),a='0x'+n.getPublic(!1,'hex').slice(2),o=s(a),d=f('0x'+o.slice(-40));return{address:d,privateKey:e}},l=([e,t,r])=>n.flatten([t,r,e]),u=(e)=>[n.slice(64,n.length(e),e),n.slice(0,32,e),n.slice(32,64,e)],b=(e)=>(r,o)=>{const d=i.keyFromPrivate(new t(o.slice(2),'hex')).sign(new t(r.slice(2),'hex'),{canonical:!0});return l([a.fromString(n.fromNumber(e+d.recoveryParam)),n.pad(32,n.fromNat('0x'+d.r.toString(16))),n.pad(32,n.fromNat('0x'+d.s.toString(16)))])},h=b(27);e.exports={create:(e)=>{const t=s(n.concat(n.random(32),e||n.random(32))),r=n.concat(n.concat(n.random(32),t),n.random(32)),a=s(r);return p(a)},toChecksum:f,fromPrivate:p,sign:h,makeSigner:b,recover:(e,r)=>{const a=u(r),o={v:n.toNumber(a[0]),r:a[1].slice(2),s:a[2].slice(2)},d=i.recoverPubKey(new t(e.slice(2),'hex'),o,2>o.v?o.v:1-o.v%2),c='0x'+d.encode('hex',!1).slice(2),p=s(c),l=f('0x'+p.slice(-40));return l},encodeSignature:l,decodeSignature:u}}).call(this,r(3).Buffer)},function(e,t,r){r(75)('replace',2,function(e,t,r){return[function(n,a){'use strict';var o=e(this),d=n==void 0?void 0:n[t];return d===void 0?r.call(o+'',n,a):d.call(n,o,a)},r]})},function(e,t,r){'use strict';r(189);var n=r(35),a=r(97),o=r(28),d='toString',i=/./[d],s=function(e){r(36)(RegExp.prototype,d,e,!0)};r(49)(function(){return'/a/b'!=i.call({source:'a',flags:'b'})})?s(function(){var e=n(this);return'/'.concat(e.source,'/','flags'in e?e.flags:!o&&e instanceof RegExp?a.call(e):void 0)}):i.name!=d&&s(function(){return i.call(this)})},function(e,t,r){'use strict';function n(e){return(e>>>24|65280&e>>>8|16711680&e<<8|(255&e)<<24)>>>0}function a(e){return 1===e.length?'0'+e:e}function o(e){return 7===e.length?'0'+e:6===e.length?'00'+e:5===e.length?'000'+e:4===e.length?'0000'+e:3===e.length?'00000'+e:2===e.length?'000000'+e:1===e.length?'0000000'+e:e}var d=r(12),i=r(4);t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(!('string'==typeof e))for(n=0;n>8,d=255&a;o?r.push(o,d):r.push(d)}else if('hex'===t)for(e=e.replace(/[^a-z0-9]+/ig,''),0!=e.length%2&&(e='0'+e),n=0;n>>0}return o},t.split32=function(e,t){for(var r=Array(4*e.length),n=0,a=0,o;n>>24,r[a+1]=255&o>>>16,r[a+2]=255&o>>>8,r[a+3]=255&o):(r[a+3]=o>>>24,r[a+2]=255&o>>>16,r[a+1]=255&o>>>8,r[a]=255&o);return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(t,r,n,a,o){return t+r+n+a+o>>>0},t.sum64=function(e,t,r,n){var a=e[t],o=e[t+1],d=n+o>>>0,i=(d>>0,e[t+1]=d},t.sum64_hi=function(e,t,r,n){var a=(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,a,o,d,i){var s=0,c=t;c=c+n>>>0,s+=c>>0,s+=c>>0,s+=c>>0},t.sum64_4_lo=function(e,t,r,n,a,o,d,i){return t+n+o+i>>>0},t.sum64_5_hi=function(e,t,r,n,a,o,d,i,s,c){var f=0,p=t;p=p+n>>>0,f+=p>>0,f+=p>>0,f+=p>>0,f+=p>>0},t.sum64_5_lo=function(e,t,r,n,a,o,d,i,s,c){return t+n+o+i+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e){const t=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'],r=[1,256,65536,16777216],n=[0,8,16,24],a=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],o=(e)=>({blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:((e)=>[].concat(e,e,e,e,e))([0,0,0,0,0,0,0,0,0,0])}),d=(e,a)=>{for(var o=a.length,d=e.blocks,f=e.blockCount<<2,p=e.blockCount,l=e.outputBlocks,u=e.s,s=0,b,i;s>2]|=a[s]<i?d[b>>2]|=i<i?(d[b>>2]|=(192|i>>6)<>2]|=(128|63&i)<i||57344<=i?(d[b>>2]|=(224|i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|63&i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<=f){for(e.start=b-f,e.block=d[p],b=0;b>2]|=r[3&b],e.lastByteIndex===f)for(d[0]=d[p],b=1;b>4]+t[15&y]+t[15&y>>12]+t[15&y>>8]+t[15&y>>20]+t[15&y>>16]+t[15&y>>28]+t[15&y>>24];0==m%p&&(c(u),b=0)}return'0x'+h},c=(e)=>{var t,r,o,n,d,i,s,c,f,p,l,u,b,h,m,y,g,v,k,x,S,w,A,E,I,C,P,T,B,N,R,M,L,j,O,D,U,H,F,q,z,K,V,G,W,X,Y,Z,J,$,Q,ee,te,re,ne,ae,oe,de,ie,se,ce,fe,pe;for(o=0;48>o;o+=2)n=e[0]^e[10]^e[20]^e[30]^e[40],d=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],p=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],u=e[8]^e[18]^e[28]^e[38]^e[48],b=e[9]^e[19]^e[29]^e[39]^e[49],t=u^(i<<1|s>>>31),r=b^(s<<1|i>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=n^(c<<1|f>>>31),r=d^(f<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=i^(p<<1|l>>>31),r=s^(l<<1|p>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(u<<1|b>>>31),r=f^(b<<1|u>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=p^(n<<1|d>>>31),r=l^(d<<1|n>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,h=e[0],m=e[1],X=e[11]<<4|e[10]>>>28,Y=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,B=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,O=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,fe=e[42]<<2|e[43]>>>30,pe=e[43]<<2|e[42]>>>30,re=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,k=e[24]<<11|e[25]>>>21,$=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,M=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,E=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,ae=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,H=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,x=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,ee=e[47]<<24|e[46]>>>8,te=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,P=e[19]<<20|e[18]>>>12,de=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,w=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=h^~y&v,e[1]=m^~g&k,e[10]=E^~C&T,e[11]=I^~P&B,e[20]=j^~D&H,e[21]=O^~U&F,e[30]=G^~X&Z,e[31]=W^~Y&J,e[40]=re^~ae&de,e[41]=ne^~oe&ie,e[2]=y^~v&x,e[3]=g^~k&S,e[12]=C^~T&N,e[13]=P^~B&R,e[22]=D^~H&q,e[23]=U^~F&z,e[32]=X^~Z&$,e[33]=Y^~J&Q,e[42]=ae^~de&se,e[43]=oe^~ie&ce,e[4]=v^~x&w,e[5]=k^~S&A,e[14]=T^~N&M,e[15]=B^~R&L,e[24]=H^~q&K,e[25]=F^~z&V,e[34]=Z^~$&ee,e[35]=J^~Q&te,e[44]=de^~se&fe,e[45]=ie^~ce&pe,e[6]=x^~w&h,e[7]=S^~A&m,e[16]=N^~M&E,e[17]=R^~L&I,e[26]=q^~K&j,e[27]=z^~V&O,e[36]=$^~ee&G,e[37]=Q^~te&W,e[46]=se^~fe&re,e[47]=ce^~pe&ne,e[8]=w^~h&y,e[9]=A^~m&g,e[18]=M^~E&C,e[19]=L^~I&P,e[28]=K^~j&D,e[29]=V^~O&U,e[38]=ee^~G&X,e[39]=te^~W&Y,e[48]=fe^~re&ae,e[49]=pe^~ne&oe,e[0]^=a[o],e[1]^=a[o+1]},i=(e)=>(t)=>{var r;if('0x'===t.slice(0,2)){r=[];for(var n=2,a=t.length;n{const t=(e)=>0==e.length%2?e:'0'+e,r=(e)=>t(e.toString(16)),n=(e,t)=>56>e?r(t+e):r(t+r(e).length/2+55)+r(e),a=(e)=>{if('string'==typeof e){const t=e.slice(2),r=2!=t.length||'80'<=t?n(t.length/2,128):'';return r+t}else{const t=e.map(a).join(''),r=n(t.length/2,192);return r+t}};return'0x'+a(e)},decode:(e)=>{let t=2;const r=()=>{if(t>=e.length)throw'';const r=e.slice(t,t+2);return'80'>r?(t+=2,'0x'+r):'c0'>r?a():o()},n=()=>{const r=parseInt(e.slice(t,t+=2),16)%64;return 56>r?r:parseInt(e.slice(t,t+=2*(r-55)),16)},a=()=>{const r=n();return'0x'+e.slice(t,t+=2*r)},o=()=>{const e=2*n()+t;let a=[];for(;ti)throw new Error('[ethjs-unit] while converting number '+e+' to wei, too many decimal places');for(;u.lengthr||256<=r||parseInt(r+'')!=r)return!1;return!0}function d(e){if(null==e&&u.throwError('cannot convert null value to array',u.INVALID_ARGUMENT,{arg:'value',value:e}),n(e)&&(e=e.toHexString()),'string'==typeof e){var t=e.match(/^(0x)?[0-9a-fA-F]*$/);t||u.throwError('invalid hexidecimal string',u.INVALID_ARGUMENT,{arg:'value',value:e}),'0x'!==t[1]&&u.throwError('hex string must have 0x prefix',u.INVALID_ARGUMENT,{arg:'value',value:e}),e=e.substring(2),e.length%2&&(e='0'+e);for(var r=[],d=0;de&&u.throwError('cannot hexlify negative value',u.INVALID_ARGUMENT,{arg:'value',value:e});for(var t='';e;)t=b[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t='0'+t),'0x'+t):'0x00'}if('string'==typeof e){var r=e.match(/^(0x)?[0-9a-fA-F]*$/);return r||u.throwError('invalid hexidecimal string',u.INVALID_ARGUMENT,{arg:'value',value:e}),'0x'!==r[1]&&u.throwError('hex string must have 0x prefix',u.INVALID_ARGUMENT,{arg:'value',value:e}),e.length%2&&(e='0x0'+e.substring(2)),e}if(o(e)){for(var a=[],d=0,i;d>4]+b[15&i]);return'0x'+a.join('')}return u.throwError('invalid hexlify value',null,{arg:'value',value:e}),'never'}function f(e,t){for(s(e)||u.throwError('invalid hex string',u.INVALID_ARGUMENT,{arg:'value',value:e});e.length<2*t+2;)e='0x0'+e.substring(2);return e}function p(e){return e&&null!=e.r&&null!=e.s}function l(e){var t=0,n='0x',a='0x';if(p(e)){null==e.v&&null==e.recoveryParam&&u.throwError('at least on of recoveryParam or v must be specified',u.INVALID_ARGUMENT,{argument:'signature',value:e}),n=f(e.r,32),a=f(e.s,32),t=e.v,'string'==typeof t&&(t=parseInt(t,16));var o=e.recoveryParam;null==o&&null!=e.v&&(o=1-t%2),t=27+o}else{var i=d(e);if(65!==i.length)throw new Error('invalid signature');n=c(i.slice(0,32)),a=c(i.slice(32,64)),t=i[64],27!==t&&28!==t&&(t=27+t%2)}return{r:n,s:a,recoveryParam:t-27,v:t}}Object.defineProperty(t,'__esModule',{value:!0});var u=r(53);t.AddressZero='0x0000000000000000000000000000000000000000',t.HashZero='0x0000000000000000000000000000000000000000000000000000000000000000',t.isArrayish=o,t.arrayify=d,t.concat=i,t.stripZeros=function(e){var t=d(e);if(0===t.length)return t;for(var r=0;0===t[r];)r++;return r&&(t=t.slice(r)),t},t.padZeros=function(e,t){if(e=d(e),t>>32-t}function s(e,t,r,n,a,d,i){return 0|o(0|e+(t&r|~t&n)+a+d,i)+t}function f(e,t,r,n,a,i,c){return 0|o(0|e+(t&n|r&~n)+a+i,c)+t}function p(e,t,r,n,a,d,i){return 0|o(0|e+(t^r^n)+a+d,i)+t}function l(e,t,r,n,a,i,c){return 0|o(0|e+(r^(t|~n))+a+i,c)+t}var a=r(4),d=r(109),c=Array(16);a(n,d),n.prototype._update=function(){for(var e=c,t=0;16>t;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,a=this._c,o=this._d;r=s(r,n,a,o,e[0],3614090360,7),o=s(o,r,n,a,e[1],3905402710,12),a=s(a,o,r,n,e[2],606105819,17),n=s(n,a,o,r,e[3],3250441966,22),r=s(r,n,a,o,e[4],4118548399,7),o=s(o,r,n,a,e[5],1200080426,12),a=s(a,o,r,n,e[6],2821735955,17),n=s(n,a,o,r,e[7],4249261313,22),r=s(r,n,a,o,e[8],1770035416,7),o=s(o,r,n,a,e[9],2336552879,12),a=s(a,o,r,n,e[10],4294925233,17),n=s(n,a,o,r,e[11],2304563134,22),r=s(r,n,a,o,e[12],1804603682,7),o=s(o,r,n,a,e[13],4254626195,12),a=s(a,o,r,n,e[14],2792965006,17),n=s(n,a,o,r,e[15],1236535329,22),r=f(r,n,a,o,e[1],4129170786,5),o=f(o,r,n,a,e[6],3225465664,9),a=f(a,o,r,n,e[11],643717713,14),n=f(n,a,o,r,e[0],3921069994,20),r=f(r,n,a,o,e[5],3593408605,5),o=f(o,r,n,a,e[10],38016083,9),a=f(a,o,r,n,e[15],3634488961,14),n=f(n,a,o,r,e[4],3889429448,20),r=f(r,n,a,o,e[9],568446438,5),o=f(o,r,n,a,e[14],3275163606,9),a=f(a,o,r,n,e[3],4107603335,14),n=f(n,a,o,r,e[8],1163531501,20),r=f(r,n,a,o,e[13],2850285829,5),o=f(o,r,n,a,e[2],4243563512,9),a=f(a,o,r,n,e[7],1735328473,14),n=f(n,a,o,r,e[12],2368359562,20),r=p(r,n,a,o,e[5],4294588738,4),o=p(o,r,n,a,e[8],2272392833,11),a=p(a,o,r,n,e[11],1839030562,16),n=p(n,a,o,r,e[14],4259657740,23),r=p(r,n,a,o,e[1],2763975236,4),o=p(o,r,n,a,e[4],1272893353,11),a=p(a,o,r,n,e[7],4139469664,16),n=p(n,a,o,r,e[10],3200236656,23),r=p(r,n,a,o,e[13],681279174,4),o=p(o,r,n,a,e[0],3936430074,11),a=p(a,o,r,n,e[3],3572445317,16),n=p(n,a,o,r,e[6],76029189,23),r=p(r,n,a,o,e[9],3654602809,4),o=p(o,r,n,a,e[12],3873151461,11),a=p(a,o,r,n,e[15],530742520,16),n=p(n,a,o,r,e[2],3299628645,23),r=l(r,n,a,o,e[0],4096336452,6),o=l(o,r,n,a,e[7],1126891415,10),a=l(a,o,r,n,e[14],2878612391,15),n=l(n,a,o,r,e[5],4237533241,21),r=l(r,n,a,o,e[12],1700485571,6),o=l(o,r,n,a,e[3],2399980690,10),a=l(a,o,r,n,e[10],4293915773,15),n=l(n,a,o,r,e[1],2240044497,21),r=l(r,n,a,o,e[8],1873313359,6),o=l(o,r,n,a,e[15],4264355552,10),a=l(a,o,r,n,e[6],2734768916,15),n=l(n,a,o,r,e[13],1309151649,21),r=l(r,n,a,o,e[4],4149444226,6),o=l(o,r,n,a,e[11],3174756917,10),a=l(a,o,r,n,e[2],718787259,15),n=l(n,a,o,r,e[9],3951481745,21),this._a=0|this._a+r,this._b=0|this._b+n,this._c=0|this._c+a,this._d=0|this._d+o},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(4294967295>=r)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0;this._block.writeUInt32BE((r-n)/4294967296,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},n.prototype._update=function(){throw new Error('_update must be implemented by subclass')},e.exports=n},function(e,t,r){(function(t){function n(e){var r;'object'!=typeof e||t.isBuffer(e)||(r=e.passphrase,e=e.key),'string'==typeof e&&(e=new t(e));var n=i(e,r),d=n.tag,s=n.data,c,f;switch(d){case'CERTIFICATE':f=o.certificate.decode(s,'der').tbsCertificate.subjectPublicKeyInfo;case'PUBLIC KEY':switch(f||(f=o.PublicKey.decode(s,'der')),c=f.algorithm.algorithm.join('.'),c){case'1.2.840.113549.1.1.1':return o.RSAPublicKey.decode(f.subjectPublicKey.data,'der');case'1.2.840.10045.2.1':return f.subjectPrivateKey=f.subjectPublicKey,{type:'ec',data:f};case'1.2.840.10040.4.1':return f.algorithm.params.pub_key=o.DSAparam.decode(f.subjectPublicKey.data,'der'),{type:'dsa',data:f.algorithm.params};default:throw new Error('unknown key id '+c);}throw new Error('unknown key type '+d);case'ENCRYPTED PRIVATE KEY':s=o.EncryptedPrivateKey.decode(s,'der'),s=a(s,r);case'PRIVATE KEY':switch(f=o.PrivateKey.decode(s,'der'),c=f.algorithm.algorithm.join('.'),c){case'1.2.840.113549.1.1.1':return o.RSAPrivateKey.decode(f.subjectPrivateKey,'der');case'1.2.840.10045.2.1':return{curve:f.algorithm.curve,privateKey:o.ECPrivateKey.decode(f.subjectPrivateKey,'der').privateKey};case'1.2.840.10040.4.1':return f.algorithm.params.priv_key=o.DSAparam.decode(f.subjectPrivateKey,'der'),{type:'dsa',params:f.algorithm.params};default:throw new Error('unknown key id '+c);}throw new Error('unknown key type '+d);case'RSA PUBLIC KEY':return o.RSAPublicKey.decode(s,'der');case'RSA PRIVATE KEY':return o.RSAPrivateKey.decode(s,'der');case'DSA PRIVATE KEY':return{type:'dsa',params:o.DSAPrivateKey.decode(s,'der')};case'EC PRIVATE KEY':return s=o.ECPrivateKey.decode(s,'der'),{curve:s.parameters.value,privateKey:s.privateKey};default:throw new Error('unknown key type '+d);}}function a(e,r){var n=e.algorithm.decrypt.kde.kdeparams.salt,a=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=d[e.algorithm.decrypt.cipher.algo.join('.')],i=e.algorithm.decrypt.cipher.iv,f=e.subjectPrivateKey,p=parseInt(o.split('-')[1],10)/8,l=c.pbkdf2Sync(r,n,a,p),u=s.createDecipheriv(o,l,i),b=[];return b.push(u.update(f)),b.push(u.final()),t.concat(b)}var o=r(283),d=r(295),i=r(296),s=r(57),c=r(116);e.exports=n,n.signature=o.signature}).call(this,r(3).Buffer)},function(e,t,r){var n=r(48);e.exports=function(e){if(!n(e))throw TypeError(e+' is not an object!');return e}},function(e,t,r){var n=r(24),a=r(25),o=r(50),d=r(70)('src'),i='toString',s=Function[i],c=(''+s).split(i);r(69).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,r,i){var s='function'==typeof r;s&&(o(r,'name')||a(r,'name',t));e[t]===r||(s&&(o(r,d)||a(r,d,e[t]?''+e[t]:c.join(t+''))),e===n?e[t]=r:i?e[t]?e[t]=r:a(e,t,r):(delete e[t],a(e,t,r)))})(Function.prototype,i,function(){return'function'==typeof this&&this[d]||s.call(this)})},function(e,t,r){'use strict';function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function a(e,t,r){if(e&&d.isObject(e)&&e instanceof n)return e;var a=new n;return a.parse(e,t,r),a}var o=r(101),d=r(209);t.parse=a,t.resolve=function(e,t){return a(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?a(e,!1,!0).resolveObject(t):t},t.format=function(e){return d.isString(e)&&(e=a(e)),e instanceof n?e.format():n.prototype.format.call(e)},t.Url=n;var c=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=['{','}','|','\\','^','`'].concat(['<','>','"','`',' ','\r','\n','\t']),p=['\''].concat(f),l=['%','/','?',';','#'].concat(p),u=['/','?','#'],b=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=r(210);n.prototype.parse=function(e,t,r){if(!d.isString(e))throw new TypeError('Parameter \'url\' must be a string, not '+typeof e);var n=e.indexOf('?'),a=-1!==n&&n255?'':this.hostname.toLowerCase(),N||(this.hostname=o.toASCII(this.hostname));var F=this.port?':'+this.port:'',q=this.hostname||'';this.host=q+F,this.href+=this.host,N&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),'/'!==S[0]&&(S='/'+S))}if(!m[E])for(var P=0,M=p.length,z;Pv.length&&v.unshift(''),r.pathname=v.join('/')}else r.pathname=e.pathname;if(r.search=e.search,r.query=e.query,r.host=e.host||'',r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var k=r.pathname||'',p=r.search||'';r.path=k+p}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var s=r.pathname&&'/'===r.pathname.charAt(0),x=e.host||e.pathname&&'/'===e.pathname.charAt(0),S=x||s||r.host&&e.pathname,w=S,A=r.pathname&&r.pathname.split('/')||[],v=e.pathname&&e.pathname.split('/')||[],E=r.protocol&&!g[r.protocol];if(E&&(r.hostname='',r.port=null,r.host&&(''===A[0]?A[0]=r.host:A.unshift(r.host)),r.host='',e.protocol&&(e.hostname=null,e.port=null,e.host&&(''===v[0]?v[0]=e.host:v.unshift(e.host)),e.host=null),S=S&&(''===v[0]||''===A[0])),x)r.host=e.host||''===e.host?e.host:r.host,r.hostname=e.hostname||''===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,A=v;else if(v.length)A||(A=[]),A.pop(),A=A.concat(v),r.search=e.search,r.query=e.query;else if(!d.isNullOrUndefined(e.search)){if(E){r.hostname=r.host=A.shift();var I=!!(r.host&&0=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24,a[o++]=255&e>>>16,a[o++]=255&e>>>8,a[o++]=255&e}else for(a[o++]=255&e,a[o++]=255&e>>>8,a[o++]=255&e>>>16,a[o++]=255&e>>>24,a[o++]=0,a[o++]=0,a[o++]=0,a[o++]=0,d=8;do;o++)r+='00';if(name=n(t),name)for(var d=name.split('.'),o=d.length-1,i;0<=o;o--)i=a(d[o]),r=a(new e(r+i,'hex'));return'0x'+r},t.normalize=n}).call(this,r(3).Buffer)},function(e,t,r){var n=r(35),a=r(171),o=r(172),d=Object.defineProperty;t.f=r(28)?Object.defineProperty:function(e,t,r){if(n(e),t=o(t,!0),n(r),a)try{return d(e,t,r)}catch(t){}if('get'in r||'set'in r)throw TypeError('Accessors not supported!');return'value'in r&&(e[t]=r.value),e}},function(e){e.exports=function(e){return'object'==typeof e?null!==e:'function'==typeof e}},function(e){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e){var t={}.hasOwnProperty;e.exports=function(e,r){return t.call(e,r)}},function(e){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],!e.children&&(e.children=[]),Object.defineProperty(e,'loaded',{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,'id',{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){r(75)('split',2,function(e,t,n){'use strict';var a=r(193),o=n,d=[].push,i='split',s='length',c='lastIndex';if('c'=='abbc'[i](/(b)*/)[1]||4!='test'[i](/(?:)/,-1)[s]||2!='ab'[i](/(?:ab)*/)[s]||4!='.'[i](/(.?)(.?)/)[s]||1<'.'[i](/()()/)[s]||''[i](/.?/)[s]){var f=/()??/.exec('')[1]===void 0;n=function(e,t){var r=this+'';if(void 0===e&&0===t)return[];if(!a(e))return o.call(r,e,t);var n=[],p=(e.ignoreCase?'i':'')+(e.multiline?'m':'')+(e.unicode?'u':'')+(e.sticky?'y':''),l=0,u=void 0===t?4294967295:t>>>0,b=new RegExp(e.source,p+'g'),h,m,y,g,v;for(f||(h=new RegExp('^'+b.source+'$(?!\\s)',p));(m=b.exec(r))&&(y=m.index+m[0][s],!(y>l&&(n.push(r.slice(l,m.index)),!f&&1=u)));)b[c]===m.index&&b[c]++;return l===r[s]?(g||!b.test(''))&&n.push(''):n.push(r.slice(l)),n[s]>u?n.slice(0,u):n}}else'0'[i](void 0,0)[s]&&(n=function(e,t){return void 0===e&&0===t?[]:o.call(this,e,t)});return[function(r,a){var o=e(this),d=r==void 0?void 0:r[t];return d===void 0?n.call(o+'',r,a):d.call(r,o,a)},n]})},function(e,t){'use strict';function r(e,r,n){if(o)throw new Error('unknown error');r||(r=t.UNKNOWN_ERROR),n||(n={});var a=[];Object.keys(n).forEach(function(e){try{a.push(e+'='+JSON.stringify(n[e]))}catch(t){a.push(e+'='+JSON.stringify(n[e].toString()))}});var d=e;a.length&&(e+=' ('+a.join(', ')+')');var i=new Error(e);throw i.reason=d,i.code=r,Object.keys(n).forEach(function(e){i[e]=n[e]}),i}function n(e,n){a&&r('error censorship permanent',t.UNSUPPORTED_OPERATION,{operation:'setCersorship'}),o=!!e,a=!!n}Object.defineProperty(t,'__esModule',{value:!0}),t.UNKNOWN_ERROR='UNKNOWN_ERROR',t.NOT_IMPLEMENTED='NOT_IMPLEMENTED',t.MISSING_NEW='MISSING_NEW',t.CALL_EXCEPTION='CALL_EXCEPTION',t.INVALID_ARGUMENT='INVALID_ARGUMENT',t.MISSING_ARGUMENT='MISSING_ARGUMENT',t.UNEXPECTED_ARGUMENT='UNEXPECTED_ARGUMENT',t.NUMERIC_FAULT='NUMERIC_FAULT',t.UNSUPPORTED_OPERATION='UNSUPPORTED_OPERATION';var a=!1,o=!1;t.throwError=r,t.checkNew=function(e,n){e instanceof n||r('missing new',t.MISSING_NEW,{name:n.name})},t.checkArgumentCount=function(e,n,a){a||(a=''),en&&r('too many arguments'+a,t.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})},t.setCensorship=n},function(e,t,r){'use strict';(function(t){e.exports=t.version&&0!==t.version.indexOf('v0.')&&(0!==t.version.indexOf('v1.')||0===t.version.indexOf('v1.8.'))?t:{nextTick:function(e,r,n,a){if('function'!=typeof e)throw new TypeError('"callback" argument must be a function');var o=arguments.length,d,s;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,a)});default:for(d=Array(o-1),s=0;s=e)return 0;return 6==e>>5?2:14==e>>4?3:30==e>>3?4:-1}function s(e,t,r){var n=t.length-1;if(n=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString('utf16le',t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):'';if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString('utf16le',0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0==r?e.toString('base64',t):(this.lastNeed=3-r,this.lastTotal=3,1==r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString('base64',t,e.length-r))}function u(e){var t=e&&e.length?this.write(e):'';return this.lastNeed?t+this.lastChar.toString('base64',0,3-this.lastNeed):t}function b(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):''}var m=r(6).Buffer,y=m.isEncoding||function(e){switch(e=''+e,e&&e.toLowerCase()){case'hex':case'utf8':case'utf-8':case'ascii':case'binary':case'base64':case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':case'raw':return!0;default:return!1;}};t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return'';var t,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return'';r=this.lastNeed,this.lastNeed=0}else r=0;return r>>24]^d[255&f>>>16]^i[255&p>>>8]^s[255&l]^t[u++],m=o[f>>>24]^d[255&p>>>16]^i[255&l>>>8]^s[255&c]^t[u++],y=o[p>>>24]^d[255&l>>>16]^i[255&c>>>8]^s[255&f]^t[u++],g=o[l>>>24]^d[255&c>>>16]^i[255&f>>>8]^s[255&p]^t[u++],c=h,f=m,p=y,l=g;return h=(n[c>>>24]<<24|n[255&f>>>16]<<16|n[255&p>>>8]<<8|n[255&l])^t[u++],m=(n[f>>>24]<<24|n[255&p>>>16]<<16|n[255&l>>>8]<<8|n[255&c])^t[u++],y=(n[p>>>24]<<24|n[255&l>>>16]<<16|n[255&c>>>8]<<8|n[255&f])^t[u++],g=(n[l>>>24]<<24|n[255&c>>>16]<<16|n[255&f>>>8]<<8|n[255&p])^t[u++],h>>>=0,m>>>=0,y>>>=0,g>>>=0,[h,m,y,g]}function d(e){this._key=n(e),this._reset()}var s=r(6).Buffer,i=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var e=Array(256),r=0;256>r;r++)e[r]=128>r?r<<1:283^r<<1;for(var n=[],a=[],o=[[],[],[],[]],d=[[],[],[],[]],s=0,c=0,f=0,i;256>f;++f){i=c^c<<1^c<<2^c<<3^c<<4,i=99^(i>>>8^255&i),n[s]=i,a[i]=s;var p=e[s],l=e[p],u=e[l],b=257*e[i]^16843008*i;o[0][s]=b<<24|b>>>8,o[1][s]=b<<16|b>>>16,o[2][s]=b<<8|b>>>24,o[3][s]=b,b=16843009*u^65537*l^257*p^16843008*s,d[0][i]=b<<24|b>>>8,d[1][i]=b<<16|b>>>16,d[2][i]=b<<8|b>>>24,d[3][i]=b,0==s?s=c=1:(s=p^e[e[e[u^p]]],c^=e[e[c]])}return{SBOX:n,INV_SBOX:a,SUB_MIX:o,INV_SUB_MIX:d}}();d.blockSize=16,d.keySize=32,d.prototype.blockSize=d.blockSize,d.prototype.keySize=d.keySize,d.prototype._reset=function(){for(var e=this._key,r=e.length,n=r+6,a=4*(n+1),o=[],d=0;d>>24,s=c.SBOX[s>>>24]<<24|c.SBOX[255&s>>>16]<<16|c.SBOX[255&s>>>8]<<8|c.SBOX[255&s],s^=i[0|d/r]<<24):6>>24]<<24|c.SBOX[255&s>>>16]<<16|c.SBOX[255&s>>>8]<<8|c.SBOX[255&s]),o[d]=o[d-r]^s}for(var t=[],f=0;ff||4>=p?l:c.INV_SUB_MIX[0][c.SBOX[l>>>24]]^c.INV_SUB_MIX[1][c.SBOX[255&l>>>16]]^c.INV_SUB_MIX[2][c.SBOX[255&l>>>8]]^c.INV_SUB_MIX[3][c.SBOX[255&l]]}this._nRounds=n,this._keySchedule=o,this._invKeySchedule=t},d.prototype.encryptBlockRaw=function(e){return e=n(e),o(e,this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},d.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=s.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},d.prototype.decryptBlock=function(e){e=n(e);var t=e[1];e[1]=e[3],e[3]=t;var r=o(e,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),a=s.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},d.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},e.exports.AES=d},function(e,t,r){var n=Math.min,a=r(6).Buffer,o=r(31);e.exports=function(e,t,r,d){if(a.isBuffer(e)||(e=a.from(e,'binary')),t&&(a.isBuffer(t)||(t=a.from(t,'binary')),8!==t.length))throw new RangeError('salt should be Buffer with 8 byte length');for(var i=r/8,s=a.alloc(i),c=a.alloc(d||0),f=a.alloc(0),p;0new window.WebSocket(e,t),h=btoa,m=(e)=>new URL(e);else{b=r(206).w3cwebsocket,h=(t)=>e(t).toString('base64');const t=r(37);if(t.URL){const e=t.URL;m=(t)=>new e(t)}else m=r(37).parse}class y{constructor(e,t){this.responseCallbacks={},this.notificationCallbacks=[],this.path=e,t=t||{},this._customTimeout=t.timeout;const r=m(e),n=t.headers||{},a=t.protocol||void 0;r.username&&r.password&&(n.authorization=`Basic ${h(`${r.username}:${r.password}`)}`);const o=t.clientConfig||void 0;r.auth&&(n.authorization=`Basic ${h(r.auth)}`),this.connection=new b(e,a,void 0,n,void 0,o),this.addDefaultEvents(),this.connection.onmessage=(t)=>{const e='string'==typeof t.data?t.data:'';this._parseResponse(e).forEach((e)=>{let t=null;_.isArray(e)?e.forEach((e)=>{this.responseCallbacks[e.id]&&(t=e.id)}):t=e.id,!t&&e&&e.method&&-1!==e.method.indexOf('_subscription')?this.notificationCallbacks.forEach((t)=>{_.isFunction(t)&&t(e)}):this.responseCallbacks[t]&&(this.responseCallbacks[t](null,e),delete this.responseCallbacks[t])})},Object.defineProperty(this,'connected',{get(){return this.connection&&this.connection.readyState===this.connection.OPEN},enumerable:!0})}addDefaultEvents(){this.connection.onerror=()=>{this._timeout()},this.connection.onclose=()=>{this._timeout(),this.reset()}}_parseResponse(e){const t=[],r=e.replace(/\}[\n\r]?\{/g,'}|--|{').replace(/\}\][\n\r]?\[\{/g,'}]|--|[{').replace(/\}[\n\r]?\[\{/g,'}|--|[{').replace(/\}\][\n\r]?\{/g,'}]|--|{').split('|--|');return r.forEach((e)=>{this.lastChunk&&(e=this.lastChunk+e);let r=null;try{r=JSON.parse(e)}catch(t){return this.lastChunk=e,clearTimeout(this.lastChunkTimeout),void(this.lastChunkTimeout=setTimeout(()=>{throw this._timeout(),u.a.InvalidResponse(e)},15000))}clearTimeout(this.lastChunkTimeout),this.lastChunk=null,r&&t.push(r)}),t}_addResponseCallback(e,t){const r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n,this._customTimeout&&setTimeout(()=>{this.responseCallbacks[r]&&(this.responseCallbacks[r](u.a.ConnectionTimeout(this._customTimeout)),delete this.responseCallbacks[r])},this._customTimeout)}_timeout(){for(const e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](u.a.InvalidConnection('on WS')),delete this.responseCallbacks[e])}send(e,t){return this.connection.readyState===this.connection.CONNECTING?void setTimeout(()=>{this.send(e,t)},10):this.connection.readyState===this.connection.OPEN?void(this.connection.send(JSON.stringify(e)),this._addResponseCallback(e,t)):(console.error('connection not open on send()'),'function'==typeof this.connection.onerror?this.connection.onerror(new Error('connection not open')):console.error('no error callback'),void t(new Error('connection not open')))}on(e,t){if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');'data'===e?this.notificationCallbacks.push(t):'connect'===e?this.connection.onopen=t:'end'===e?this.connection.onclose=t:'error'===e?this.connection.onerror=t:void 0}removeListener(e,t){'data'===e?this.notificationCallbacks.forEach((e,r)=>{e===t&&this.notificationCallbacks.splice(r,1)}):void 0}removeAllListeners(e){switch(e){case'data':this.notificationCallbacks=[];break;case'connect':this.connection.onopen=null;break;case'end':this.connection.onclose=null;break;case'error':this.connection.onerror=null;break;default:}}reset(){this._timeout(),this.notificationCallbacks=[],this.addDefaultEvents()}disconnect(){this.connection&&this.connection.close()}}}).call(this,r(3).Buffer)},function(e,t,r){(function(e){var n=r(214),a=r(103),o=r(223),d=r(224),i=r(37),s=t;s.request=function(t,r){t='string'==typeof t?i.parse(t):o(t);var a=-1===e.location.protocol.search(/^https?:$/)?'http:':'',d=t.protocol||a,s=t.hostname||t.host,c=t.port,f=t.path||'/';s&&-1!==s.indexOf(':')&&(s='['+s+']'),t.url=(s?d+'//'+s:'')+(c?':'+c:'')+f,t.method=(t.method||'GET').toUpperCase(),t.headers=t.headers||{};var p=new n(t);return r&&p.on('response',r),p},s.get=function(e,t){var r=s.request(e,t);return r.end(),r},s.ClientRequest=n,s.IncomingMessage=a.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=d,s.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE']}).call(this,r(7))},function(){},function(e,t,r){'use strict';var n=r(15),a=r(16),o=r(52),d=r(1),i=r(2),s=r.n(i);const c=(e,t)=>{let r=e;for(;r.length<2*t;)r=`0${r}`;return r},f=(e)=>{const t=65;return e=e.toUpperCase(),e=e.substr(4)+e.substr(0,4),e.split('').map((e)=>{const r=e.charCodeAt(0);return r>=t&&r<=90?r-t+10:e}).join('')},p=(e)=>{let t=e,r;for(;2e||isNaN(e))throw TypeError('n must be a positive number');return this._maxListeners=e,this},t.prototype.emit=function(e){var t,a,d,s,c,i;if(this._events||(this._events={}),'error'===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length))if(t=arguments[1],t instanceof Error)throw t;else{var f=new Error('Uncaught, unspecified "error" event. ('+t+')');throw f.context=t,f}if(a=this._events[e],o(a))return!1;if(r(a))switch(arguments.length){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),a.apply(this,s);}else if(n(a))for(s=Array.prototype.slice.call(arguments,1),i=a.slice(),d=i.length,c=0;cd&&(this._events[e].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[e].length),'function'==typeof console.trace&&console.trace())),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){function n(){this.removeListener(e,n),a||(a=!0,t.apply(this,arguments))}if(!r(t))throw TypeError('listener must be a function');var a=!1;return n.listener=t,this.on(e,n),this},t.prototype.removeListener=function(e,t){var a,o,d,s;if(!r(t))throw TypeError('listener must be a function');if(!this._events||!this._events[e])return this;if(a=this._events[e],d=a.length,o=-1,a===t||r(a.listener)&&a.listener===t)delete this._events[e],this._events.removeListener&&this.emit('removeListener',e,t);else if(n(a)){for(s=d;0o)return this;1===a.length?(a.length=0,delete this._events[e]):a.splice(o,1),this._events.removeListener&&this.emit('removeListener',e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)'removeListener'!==t&&this.removeAllListeners(t);return this.removeAllListeners('removeListener'),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[],t},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){'use strict';(function(t,n,a){function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){C(t,e)}}function d(e){return L.from(e)}function i(e){return L.isBuffer(e)||e instanceof j}function s(){}function c(e,t){B=B||r(26),e=e||{};var n=t instanceof B;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var a=e.highWaterMark,d=e.writableHighWaterMark,i=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:n&&(d||0===d)?d:i,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||'utf8',this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){g(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function f(e){return B=B||r(26),D.call(f,this)||this instanceof B?void(this._writableState=new c(e,this),this.writable=!0,e&&('function'==typeof e.write&&(this._write=e.write),'function'==typeof e.writev&&(this._writev=e.writev),'function'==typeof e.destroy&&(this._destroy=e.destroy),'function'==typeof e.final&&(this._final=e.final)),M.call(this)):new f(e)}function p(e,t){var r=new Error('write after end');e.emit('error',r),P.nextTick(t,r)}function l(e,t,r,n){var a=!0,o=!1;return null===r?o=new TypeError('May not write null values to stream'):'string'!=typeof r&&void 0!==r&&!t.objectMode&&(o=new TypeError('Invalid non-string/buffer chunk')),o&&(e.emit('error',o),P.nextTick(n,o),a=!1),a}function u(e,t,r){return e.objectMode||!1===e.decodeStrings||'string'!=typeof t||(t=L.from(t,r)),t}function b(e,t,r,n,a,o){if(!r){var d=u(t,n,a);n!==d&&(r=!0,a='buffer',n=d)}var i=t.objectMode?1:n.length;t.length+=i;var s=t.lengthr||this.listeners[e].splice(r,1)}},e.prototype.dispatchEvent=function(e){var t=e.type.toLowerCase();if(e.target=this,this.listeners[t])for(var r=0,n=this.listeners[t],a;r>>32-t}function a(t,r,n,a,d,e,i,c){return 0|o(0|t+(r^n^a)+e+i,c)+d}function d(t,r,n,a,d,e,i,c){return 0|o(0|t+(r&n|~r&a)+e+i,c)+d}function s(t,r,n,a,d,e,i,f){return 0|o(0|t+((r|~n)^a)+e+i,f)+d}function c(t,r,n,a,i,e,c,f){return 0|o(0|t+(r&a|n&~a)+e+c,f)+i}function f(t,r,n,a,i,e,c,f){return 0|o(0|t+(r^(n|~a))+e+c,f)+i}var i=r(3).Buffer,p=r(4),l=r(109),u=Array(16),b=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],g=[0,1518500249,1859775393,2400959708,2840853838],v=[1352829926,1548603684,1836072691,2053994217,0];p(n,l),n.prototype._update=function(){for(var e=u,r=0;16>r;++r)e[r]=this._block.readInt32LE(4*r);for(var n=0|this._a,p=0|this._b,l=0|this._c,k=0|this._d,x=0|this._e,S=0|this._a,w=0|this._b,A=0|this._c,E=0|this._d,I=0|this._e,C=0;80>C;C+=1){var i,P;16>C?(i=a(n,p,l,k,x,e[b[C]],g[0],m[C]),P=f(S,w,A,E,I,e[h[C]],v[0],y[C])):32>C?(i=d(n,p,l,k,x,e[b[C]],g[1],m[C]),P=c(S,w,A,E,I,e[h[C]],v[1],y[C])):48>C?(i=s(n,p,l,k,x,e[b[C]],g[2],m[C]),P=s(S,w,A,E,I,e[h[C]],v[2],y[C])):64>C?(i=c(n,p,l,k,x,e[b[C]],g[3],m[C]),P=d(S,w,A,E,I,e[h[C]],v[3],y[C])):(i=f(n,p,l,k,x,e[b[C]],g[4],m[C]),P=a(S,w,A,E,I,e[h[C]],v[4],y[C])),n=x,x=k,k=o(l,10),l=p,p=i,S=I,I=E,E=o(A,10),A=w,w=P}var T=0|this._b+l+E;this._b=0|this._c+k+I,this._c=0|this._d+x+S,this._d=0|this._e+n+w,this._e=0|this._a+p+A,this._a=T},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56>>32-t}function a(t,r,n,a,d,e,i,c){return 0|o(0|t+(r^n^a)+e+i,c)+d}function d(t,r,n,a,d,e,i,c){return 0|o(0|t+(r&n|~r&a)+e+i,c)+d}function s(t,r,n,a,d,e,i,f){return 0|o(0|t+((r|~n)^a)+e+i,f)+d}function c(t,r,n,a,i,e,c,f){return 0|o(0|t+(r&a|n&~a)+e+c,f)+i}function f(t,r,n,a,i,e,c,f){return 0|o(0|t+(r^(n|~a))+e+c,f)+i}var i=r(3).Buffer,p=r(27),l=r(305),u=Array(16),b=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],g=[0,1518500249,1859775393,2400959708,2840853838],v=[1352829926,1548603684,1836072691,2053994217,0];p(n,l),n.prototype._update=function(){for(var e=u,r=0;16>r;++r)e[r]=this._block.readInt32LE(4*r);for(var n=0|this._a,p=0|this._b,l=0|this._c,k=0|this._d,x=0|this._e,S=0|this._a,w=0|this._b,A=0|this._c,E=0|this._d,I=0|this._e,C=0;80>C;C+=1){var i,P;16>C?(i=a(n,p,l,k,x,e[b[C]],g[0],m[C]),P=f(S,w,A,E,I,e[h[C]],v[0],y[C])):32>C?(i=d(n,p,l,k,x,e[b[C]],g[1],m[C]),P=c(S,w,A,E,I,e[h[C]],v[1],y[C])):48>C?(i=s(n,p,l,k,x,e[b[C]],g[2],m[C]),P=s(S,w,A,E,I,e[h[C]],v[2],y[C])):64>C?(i=c(n,p,l,k,x,e[b[C]],g[3],m[C]),P=d(S,w,A,E,I,e[h[C]],v[3],y[C])):(i=f(n,p,l,k,x,e[b[C]],g[4],m[C]),P=a(S,w,A,E,I,e[h[C]],v[4],y[C])),n=x,x=k,k=o(l,10),l=p,p=i,S=I,I=E,E=o(A,10),A=w,w=P}var T=0|this._b+l+E;this._b=0|this._c+k+I,this._c=0|this._d+x+S,this._d=0|this._e+n+w,this._e=0|this._a+p+A,this._a=T},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56'0x'+e.toString('hex'),i=(e)=>new n(e.slice(2),16),a=(e)=>{const t='0x'+('0x'===e.slice(0,2)?new n(e.slice(2),16):new n(e,10)).toString('hex');return'0x0'==t?'0x':t},s=(e)=>'string'==typeof e?/^0x/.test(e)?e:'0x'+e:'0x'+new n(e).toString('hex'),c=(e)=>i(e).toNumber(),f=(e)=>(t,r)=>d(i(t)[e](i(r))),p=f('add'),l=f('mul'),u=f('div'),b=f('sub');e.exports={toString:(e)=>i(e).toString(10),fromString:a,toNumber:c,fromNumber:s,toEther:(e)=>c(u(e,a('10000000000')))/1e8,fromEther:(e)=>l(s(Math.floor(1e8*e)),a('10000000000')),toUint256:(e)=>o.pad(32,e),add:p,mul:l,div:u,sub:b}},function(e,t,r){(function(e,n){var a;/*! https://mths.be/utf8js v2.0.0 by @mathias */(function(o){function d(e){for(var t=[],r=0,n=e.length,a,o;r=a&&r>>10),a=56320|1023&a),n+=m(a);return n}function s(e){if(55296<=e&&57343>=e)throw Error('Lone surrogate U+'+e.toString(16).toUpperCase()+' is not a scalar value')}function c(e,t){return m(128|63&e>>t)}function f(e){if(0==(4294967168&e))return m(e);var t='';return 0==(4294965248&e)?t=m(192|31&e>>6):0==(4294901760&e)?(s(e),t=m(224|15&e>>12),t+=c(e,6)):0==(4292870144&e)&&(t=m(240|7&e>>18),t+=c(e,12),t+=c(e,6)),t+=m(128|63&e),t}function p(){if(k>=v)throw Error('Invalid byte index');var e=255&g[k];if(k++,128==(192&e))return 63&e;throw Error('Invalid continuation byte')}function l(){var e,t,r,n,a;if(k>v)throw Error('Invalid byte index');if(k==v)return!1;if(e=255&g[k],k++,0==(128&e))return e;if(192==(224&e)){var t=p();if(a=(31&e)<<6|t,128<=a)return a;throw Error('Invalid continuation byte')}if(224==(240&e)){if(t=p(),r=p(),a=(15&e)<<12|t<<6|r,2048<=a)return s(a),a;throw Error('Invalid continuation byte')}if(240==(248&e)&&(t=p(),r=p(),n=p(),a=(15&e)<<18|t<<12|r<<6|n,65536<=a&&1114111>=a))return a;throw Error('Invalid UTF-8 detected')}function u(e){g=d(e),v=g.length,k=0;for(var t=[],r;!1!==(r=l());)t.push(r);return i(t)}var b='object'==typeof e&&e&&e.exports==('object'==typeof t&&t)&&e,h='object'==typeof n&&n;(h.global===h||h.window===h)&&(o=h);var m=String.fromCharCode,y={version:'2.0.0',encode:function(e){for(var t=d(e),r=t.length,n=-1,a='',o;++nr&&(e+=' ... ')),''},c.prototype.compare=function(e,t,r,n,a){if(!c.isBuffer(e))throw new TypeError('Argument must be a Buffer');if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),0>t||r>e.length||0>n||a>this.length)throw new RangeError('out of range index');if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,s=r-t,f=d(o,s),p=this.slice(n,a),l=e.slice(t,r),u=0;ua)&&(r=a),0r||0>t)||t>this.length)throw new RangeError('Attempt to write outside buffer bounds');n||(n='utf8');for(var o=!1;;)switch(n){case'hex':return A(this,e,t,r);case'utf8':case'utf-8':return E(this,e,t,r);case'ascii':return I(this,e,t,r);case'latin1':case'binary':return C(this,e,t,r);case'base64':return P(this,e,t,r);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return T(this,e,t,r);default:if(o)throw new TypeError('Unknown encoding: '+n);n=(''+n).toLowerCase(),o=!0;}},c.prototype.toJSON=function(){return{type:'Buffer',data:Array.prototype.slice.call(this._arr||this,0)}};var ne=4096;c.prototype.slice=function(e,t){var r=this.length;e=~~e,t=t===void 0?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),t=o&&(a-=n(2,8*t)),a},c.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var a=t,o=1,d=this[e+--a];0=o&&(d-=n(2,8*t)),d},c.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),te.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),te.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),te.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),te.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,a){if(e=+e,t|=0,r|=0,!a){var o=n(2,8*r)-1;U(this,e,t,r,o,0)}var d=1,s=0;for(this[t]=255&e;++s>>8):H(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):H(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):F(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t|=0,!a){var o=n(2,8*r-1);U(this,e,t,r,o-1,-o)}var d=0,i=1,s=0;for(this[t]=255&e;++de&&0==s&&0!==this[t+d-1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},c.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t|=0,!a){var o=n(2,8*r-1);U(this,e,t,r,o-1,-o)}var d=r-1,i=1,s=0;for(this[t+d]=255&e;0<=--d&&(i*=256);)0>e&&0==s&&0!==this[t+d+1]&&(s=1),this[t+d]=255&(e/i>>0)-s;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=o(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):H(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):H(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):F(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,r){return z(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return z(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return K(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return K(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0t)throw new RangeError('targetStart out of bounds');if(0>r||r>=this.length)throw new RangeError('sourceStart out of bounds');if(0>n)throw new RangeError('sourceEnd out of bounds');n>this.length&&(n=this.length),e.length-ta||!c.TYPED_ARRAY_SUPPORT)for(o=0;oa&&(e=a)}if(void 0!==n&&'string'!=typeof n)throw new TypeError('encoding must be a string');if('string'==typeof n&&!c.isEncoding(n))throw new TypeError('Unknown encoding: '+n)}else'number'==typeof e&&(e&=255);if(0>t||this.length>>=0,r=r===void 0?this.length:r>>>0,e||(e=0);var o;if('number'==typeof e)for(o=t;os.a.toBN(e).toString(10),p=(e)=>'latest'===e||'pending'===e||'earliest'===e,l=(e)=>void 0===e?void 0:p(e)?e:s.a.isHexStrict(e)?Object(i.isString)(e)?e.toLowerCase():e:s.a.numberToHex(e),u=(e)=>{if(e.to&&(e.to=m(e.to)),e.data&&e.input)throw new Error('You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.');if(!e.data&&e.input&&(e.data=e.input,delete e.input),e.data&&!s.a.isHex(e.data))throw new Error('The data field must be HEX encoded data.');return(e.gas||e.gasLimit)&&(e.gas=e.gas||e.gasLimit),['gasPrice','gas','value','nonce'].filter((t)=>void 0!==e[t]).forEach((t)=>{e[t]=s.a.numberToHex(e[t])}),e},b=(e)=>(null!==e.blockNumber&&(e.blockNumber=s.a.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=s.a.hexToNumber(e.transactionIndex)),e.nonce=s.a.hexToNumber(e.nonce),e.gas=s.a.hexToNumber(e.gas),e.gasPrice=f(e.gasPrice),e.value=f(e.value),e.to=e.to&&s.a.isAddress(e.to)?s.a.toChecksumAddress(e.to):null,e.from&&(e.from=s.a.toChecksumAddress(e.from)),e),h=(e)=>{if('string'==typeof e.blockHash&&'string'==typeof e.transactionHash&&'string'==typeof e.logIndex){const t=s.a.sha3(e.blockHash.replace('0x','')+e.transactionHash.replace('0x','')+e.logIndex.replace('0x',''));e.id=`log_${t.replace('0x','').substr(0,8)}`}else e.id||(e.id=null);return null!==e.blockNumber&&(e.blockNumber=s.a.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=s.a.hexToNumber(e.transactionIndex)),null!==e.logIndex&&(e.logIndex=s.a.hexToNumber(e.logIndex)),e.address&&(e.address=s.a.toChecksumAddress(e.address)),e};var m=(e)=>{const t=new c.a(e);if(t.isValid()&&t.isDirect())return t.toAddress().toLowerCase();if(s.a.isAddress(e))return`0x${e.toLowerCase().replace('0x','')}`;throw new Error(`Provided address "${e}" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.`)};var y={inputDefaultBlockNumberFormatter:(e,t)=>void 0===e||null===e?t.defaultBlock:'genesis'===e||'earliest'===e?'0x0':l(e),inputBlockNumberFormatter:l,inputCallFormatter:(e,t)=>{e=u(e);let r=t.defaultAccount;return e.from&&(r=e.from),r&&(e.from=m(r)),e},inputTransactionFormatter:(e,t)=>{if(e=u(e),!Object(i.isNumber)(e.from)&&!Object(i.isObject)(e.from)){if(e.from||(e.from=t.defaultAccount),!e.from&&!Object(i.isNumber)(e.from))throw new Error('The send transactions "from" field must be defined!');e.from=m(e.from)}return e},inputAddressFormatter:m,inputPostFormatter:(e)=>(e.ttl&&(e.ttl=s.a.numberToHex(e.ttl)),e.workToProve&&(e.workToProve=s.a.numberToHex(e.workToProve)),e.priority&&(e.priority=s.a.numberToHex(e.priority)),Object(i.isArray)(e.topics)||(e.topics=e.topics?[e.topics]:[]),e.topics=e.topics.map((e)=>0===e.indexOf('0x')?e:s.a.fromUtf8(e)),e),inputLogFormatter:(e)=>{let t=(e)=>null===e||'undefined'==typeof e?null:(e+='',0===e.indexOf('0x')?e:s.a.fromUtf8(e));return e.fromBlock&&(e.fromBlock=l(e.fromBlock)),e.toBlock&&(e.toBlock=l(e.toBlock)),e.topics=e.topics||[],e.topics=e.topics.map((e)=>Object(i.isArray)(e)?e.map(t):t(e)),t=null,e.address&&(e.address=Object(i.isArray)(e.address)?e.address.map((e)=>m(e)):m(e.address)),e},inputSignFormatter:(e)=>s.a.isHexStrict(e)?e:s.a.utf8ToHex(e),outputBigNumberFormatter:f,outputTransactionFormatter:b,outputTransactionReceiptFormatter:(e)=>{if('object'!=typeof e)throw new Error(`Received receipt is invalid: ${e}`);return null!==e.blockNumber&&(e.blockNumber=s.a.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=s.a.hexToNumber(e.transactionIndex)),e.cumulativeGasUsed=s.a.hexToNumber(e.cumulativeGasUsed),e.gasUsed=s.a.hexToNumber(e.gasUsed),Object(i.isArray)(e.logs)&&(e.logs=e.logs.map(h)),e.contractAddress&&(e.contractAddress=s.a.toChecksumAddress(e.contractAddress)),'undefined'!=typeof e.status&&(e.status=!!parseInt(e.status)),e},outputBlockFormatter:(e)=>(e.gasLimit=s.a.hexToNumber(e.gasLimit),e.gasUsed=s.a.hexToNumber(e.gasUsed),e.size=s.a.hexToNumber(e.size),e.timestamp=s.a.hexToNumber(e.timestamp),null!==e.number&&(e.number=s.a.hexToNumber(e.number)),e.difficulty&&(e.difficulty=f(e.difficulty)),e.totalDifficulty&&(e.totalDifficulty=f(e.totalDifficulty)),Object(i.isArray)(e.transactions)&&e.transactions.forEach((e)=>{if(!Object(i.isString)(e))return b(e)}),e.miner&&(e.miner=s.a.toChecksumAddress(e.miner)),e),outputLogFormatter:h,outputPostFormatter:(e)=>(e.expiry=s.a.hexToNumber(e.expiry),e.sent=s.a.hexToNumber(e.sent),e.ttl=s.a.hexToNumber(e.ttl),e.workProved=s.a.hexToNumber(e.workProved),e.topics||(e.topics=[]),e.topics=e.topics.map((e)=>s.a.toUtf8(e)),e),outputSyncingFormatter:(e)=>(e.startingBlock=s.a.hexToNumber(e.startingBlock),e.currentBlock=s.a.hexToNumber(e.currentBlock),e.highestBlock=s.a.hexToNumber(e.highestBlock),e.knownStates&&(e.knownStates=s.a.hexToNumber(e.knownStates),e.pulledStates=s.a.hexToNumber(e.pulledStates)),e)};r.d(t,'a',function(){return n}),r.d(t,'b',function(){return y})},function(e,t,r){function n(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return d(e,t,r)}var o=r(4),d=o.Buffer;d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?e.exports=o:(n(o,t),t.Buffer=a),n(d,a),a.from=function(e,t,r){if('number'==typeof e)throw new TypeError('Argument must not be a number');return d(e,t,r)},a.alloc=function(e,t,r){if('number'!=typeof e)throw new TypeError('Argument must be a number');var n=d(e);return void 0===t?n.fill(0):'string'==typeof r?n.fill(t,r):n.fill(t),n},a.allocUnsafe=function(e){if('number'!=typeof e)throw new TypeError('Argument must be a number');return d(e)},a.allocUnsafeSlow=function(e){if('number'!=typeof e)throw new TypeError('Argument must be a number');return o.SlowBuffer(e)}},function(e,t,r){'use strict';var n=r(0);class a{constructor(e){this.providersPackageFactory=e}resolve(e,t){if('string'==typeof e){if(/^http(s)?:\/\//i.test(e))return this.providersPackageFactory.createHttpProviderAdapter(this.providersPackageFactory.createHttpProvider(e));if(/^ws(s)?:\/\//i.test(e))return this.providersPackageFactory.createSocketProviderAdapter(this.providersPackageFactory.createWebsocketProvider(e));if(e&&_.isObject(t)&&_.isFunction(t.connect))return this.providersPackageFactory.createSocketProviderAdapter(this.providersPackageFactory.createIpcProvider(e,t))}if(_.isFunction(e.sendAsync))return this.providersPackageFactory.createInpageProviderAdapter(e);switch(e.constructor.name){case'HttpProvider':return this.providersPackageFactory.createHttpProviderAdapter(e);case'WebsocketProvider':case'IpcProvider':return this.providersPackageFactory.createSocketProviderAdapter(e);case'EthereumProvider':case'HttpProviderAdapter':case'SocketProviderAdapter':case'InpageProviderAdapter':return e;}throw Error('Please provide an valid Web3 provider or the EthereumProvider')}}r(19);let o;try{o=Function('return this')()}catch(t){o=window}class d{detect(){return'undefined'==typeof o.ethereumProvider?'undefined'!=typeof o.web3&&o.web3.currentProvider?(this.isIpcProviderWrapper(o.web3.currentProvider)&&(o.web3.currentProvider=this.addSubscriptionsToIpcProviderWrapper(o.web3.currentProvider)),o.web3.currentProvider):void 0:o.ethereumProvider}isIpcProviderWrapper(e){return!e.on&&e.connection&&'ipcProviderWrapper'===e.connection.constructor.name}addSubscriptionsToIpcProviderWrapper(e){return e.on=(e,t)=>{if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');'data'===e?this.connection.on('data',(e)=>{let r='';e=e.toString();try{r=JSON.parse(e)}catch(r){return t(new Error(`Couldn't parse response data${e}`))}r.id||-1===r.method.indexOf('_subscription')||t(null,r)}):this.connection.on(e,t)},e}}r(10);let i=0;class s{static toPayload(e,t){if(!e)throw new Error(`JSONRPC method should be specified for params: "${JSON.stringify(t)}"!`);return i++,{jsonrpc:'2.0',id:i,method:e,params:t||[]}}static toBatchPayload(e){return e.map((e)=>(e.beforeExecution(),s.toPayload(e.rpcMethod,e.parameters)))}}class c{static isValid(e){return Array.isArray(e)?e.every(this.isResponseItemValid):this.isResponseItemValid(e)}static isResponseItemValid(e){return!!e&&!e.error&&'2.0'===e.jsonrpc&&('number'==typeof e.id||'string'==typeof e.id)&&e.result!==void 0}}var f=r(6),p=r(164),l=r.n(p);class u extends l.a{constructor(e){super(),this.provider=e}send(e,t){const r=s.toPayload(e,t);return new Promise((e,t)=>{this.provider.send(r,(r,n)=>{this.handleResponse(t,e,r,n)})})}sendBatch(e,t){this.provider.send(e,t)}subscribe(){return new Promise((e,t)=>{t(new Error(`The current provider does not support subscriptions: ${this.provider.constructor.name}`))})}unsubscribe(){return new Promise((e,t)=>{t(new Error(`The current provider does not support subscriptions: ${this.provider.constructor.name}`))})}handleResponse(e,t,r,n){return n&&n.id&&payload.id!==n.id?void e(new Error(`Wrong response id "${n.id}" (expected: "${payload.id}") in ${JSON.stringify(payload)}`)):n&&n.error?void e(f.a.ErrorResponse(n)):c.isValid(n.result)?r?void e(r):void t(n.result):void e(f.a.InvalidResponse(n))}isConnected(){return this.provider.connected}}class b extends u{constructor(e){super(e),this.host=e.path,this.subscriptions=[],this.registerSubscriptionListener()}subscribe(e,t,r){return this.send(e,r.unshift(t)).then((e,t)=>{if(!e)return this.subscriptions.push(t),t;throw new Error(`Provider error: ${e}`)})}unsubscribe(e,t){return this.send(t,[e]).then(function(t){return!!t&&(this.subscriptions=this.subscriptions.filter((t)=>t!==e),!0)})}registerSubscriptionListener(){this.provider.on('data',(e,t)=>{e=e||t,e.method&&this.hasSubscription(e.params.subscription)&&this.emit(e.params.subscription,e.params.result)})}hasSubscription(e){return-1{e.push(this.unsubscribe(t))}),Promise.all(e).then(()=>{this.provider.reset(),this.subscriptions=[]})}removeSubscription(e,t){return this.unsubscribe(e,t).then((t)=>!!t&&(delete this.subscriptions[this.subscriptions.indexOf(e)],!0))}}class h extends u{constructor(e){super(e),this.provider.send=this.provider.sendAsync,delete this.provider.sendAsync}isConnected(){return this.provider.isConnected}}class m extends u{constructor(e){super(e),this.host=e.host}}var y=r(70),g=r(18),v=r(57),k=r(165),x=r.n(k);class S{constructor(e,t){this.responseCallbacks={},this.notificationCallbacks=[],this.path=e,this.connected=!1,this.connection=t.connect({path:this.path}),this.addDefaultEvents();const r=(e)=>{let t=null;Object(n.isArray)(e)?e.forEach((e)=>{this.responseCallbacks[e.id]&&(t=e.id)}):t=e.id,t||-1===e.method.indexOf('_subscription')?this.responseCallbacks[t]&&(this.responseCallbacks[t](null,e),delete this.responseCallbacks[t]):this.notificationCallbacks.forEach((t)=>{Object(n.isFunction)(t)&&t(e)})};'Socket'===t.constructor.name?x()(this.connection).done(r):this.connection.on('data',(e)=>{this._parseResponse(e.toString()).forEach(r)})}addDefaultEvents(){this.connection.on('connect',()=>{this.connected=!0}),this.connection.on('close',()=>{this.connected=!1}),this.connection.on('error',()=>{this._timeout()}),this.connection.on('end',()=>{this._timeout()}),this.connection.on('timeout',()=>{this._timeout()})}_parseResponse(e){const t=[],r=e.replace(/\}[\n\r]?\{/g,'}|--|{').replace(/\}\][\n\r]?\[\{/g,'}]|--|[{').replace(/\}[\n\r]?\[\{/g,'}|--|[{').replace(/\}\][\n\r]?\{/g,'}]|--|{').split('|--|');return r.forEach((e)=>{let r=null;this.lastChunk&&(e=this.lastChunk+e);try{r=JSON.parse(e)}catch(t){return this.lastChunk=e,clearTimeout(this.lastChunkTimeout),void(this.lastChunkTimeout=setTimeout(()=>{throw this._timeout(),f.a.InvalidResponse(e)},15000))}clearTimeout(this.lastChunkTimeout),this.lastChunk=null,r&&t.push(r)}),t}_addResponseCallback(e,t){const r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n}_timeout(){for(const e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](f.a.InvalidConnection('on IPC')),delete this.responseCallbacks[e])}reconnect(){this.connection.connect({path:this.path})}send(e,t){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(e)),this._addResponseCallback(e,t)}on(e,t){if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');switch(e){case'data':this.notificationCallbacks.push(t);break;default:this.connection.on(e,t);}}once(e,t){if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');this.connection.once(e,t)}removeListener(e,t){switch(e){case'data':this.notificationCallbacks.forEach((e,r)=>{e===t&&this.notificationCallbacks.splice(r,1)});break;default:this.connection.removeListener(e,t);}}removeAllListeners(e){switch(e){case'data':this.notificationCallbacks=[];break;default:this.connection.removeAllListeners(e);}}reset(){this._timeout(),this.notificationCallbacks=[],this.connection.removeAllListeners('error'),this.connection.removeAllListeners('end'),this.connection.removeAllListeners('timeout'),this.addDefaultEvents()}}var w=r(166),A=r(71),E=r.n(A),I=r(90),C=r.n(I);class P{constructor(e,t={}){this.host=e||'http://localhost:8545','https'===this.host.substring(0,5)?this.httpsAgent=new C.a.Agent({keepAlive:!0}):this.httpAgent=new E.a.Agent({keepAlive:!0}),this.timeout=t.timeout||0,this.headers=t.headers,this.connected=!1}_prepareRequest(){const e=new w.XMLHttpRequest;return e.nodejsSet({httpsAgent:this.httpsAgent,httpAgent:this.httpAgent}),e.open('POST',this.host,!0),e.setRequestHeader('Content-Type','application/json'),e.timeout=this.timeout&&1!==this.timeout?this.timeout:0,e.withCredentials=!0,this.headers&&this.headers.forEach((t)=>{e.setRequestHeader(t.name,t.value)}),e}send(e,t){const r=this._prepareRequest();r.onreadystatechange=()=>{if(4===r.readyState&&1!==r.timeout){let e=r.responseText,n=null;try{e=JSON.parse(e)}catch(t){n=f.a.InvalidResponse(r.responseText)}this.connected=!0,t(n,e)}},r.ontimeout=function(){this.connected=!1,t(f.a.ConnectionTimeout(this.timeout))};try{r.send(JSON.stringify(e))}catch(e){this.connected=!1,t(f.a.InvalidConnection(this.host))}}disconnect(){}}class T{constructor(e,t,r){this.provider=e,this.jsonRpcMapper=t,this.jsonRpcResponseValidator=r,this.requests=[]}add(e){this.requests.push(e)}execute(){this.provider.sendBatch(this.jsonRpcMapper.toBatchPayload(this.requests),(e,t)=>Object(n.isArray)(t)?void this.requests.forEach(function(e,r){const a=t[r]||null;if(Object(n.isFunction)(e.callback)){Object(n.isObject)(a)&&a.error&&e.callback(f.a.ErrorResponse(a)),this.jsonRpcResponseValidator.isValid(a)||e.callback(f.a.InvalidResponse(a));try{const t=e.afterExecution(a.result);e.callback(null,t)}catch(t){e.callback(t,null)}}}):void request.callback(f.a.InvalidResponse(t)))}hasOutputFormatter(e){return Object(n.isFunction)(e.methodModel.outputFormatter)}}class B{createBatchRequest(e){return new T(e,s,c)}createProviderAdapterResolver(){return new a(this)}createProviderDetector(){return new d}createHttpProvider(e){return new P(e)}createWebsocketProvider(e){return new y.a(e)}createIpcProvider(e,t){return new S(e,t)}createHttpProviderAdapter(e){return new m(e)}createSocketProviderAdapter(e){return new b(e)}createInpageProviderAdapter(e){return new h(e)}createJSONRpcResponseValidator(){return new c}}r.d(t,'c',function(){return N}),r.d(t,'b',function(){return b}),r.d(t,'a',function(){return B});const N={HttpProvider,WebsocketProvider,IpcProvider}},function(e){var t=function(){return this}();try{t=t||Function('return this')()||(1,eval)('this')}catch(r){'object'==typeof window&&(t=window)}e.exports=t},function(e,t,r){for(var n=r(175),a=r(99),o=r(41),d=r(27),s=r(28),c=r(77),f=r(26),p=f('iterator'),l=f('toStringTag'),u=c.Array,b={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=a(b),m=0;mthis.providersModuleFactory.createBatchRequest(this.currentProvider),null!==d&&'undefined'!=typeof d)return this.methodModelFactory=d,this.extend.formatters=this.methodModelFactory.formatters,new Proxy(this,{get:this.proxyHandler})}get currentProvider(){return this._currentProvider}set currentProvider(e){throw Error('The property currentProvider read-only!')}setProvider(e,t){if(!this.isSameProvider(e)){this.clearSubscriptions(),this._currentProvider=this.providerAdapterResolver.resolve(e,t);var r=!0;return 0r.setProvider(e,t))),!!(r&&this._currentProvider)}return!1}isSameProvider(e){return Object(a.isObject)(e)?this.currentProvider.provider.constructor.name===e.constructor.name&&this.currentProvider.host===e.host:this.currentProvider.host===e}clearSubscriptions(){'undefined'!=typeof this.currentProvider.clearSubscriptions&&0{class t extends o.AbstractMethodModel{constructor(t,r){super(e.call,e.params,t,r)}beforeExecution(t,r){e.inputFormatters.forEach((e,n)=>{e&&(t[n]=e(t[n],r))})}afterExecution(t){return Object(a.isArray)(t)?(t=t.map((t)=>e.outputFormatter&&t?e.outputFormatter(t):t),t):(e.outputFormatter&&t&&(t=e.outputFormatter(t)),t)}}r.methodModelFactory.methodModels[e.name]=t})}proxyHandler(e,t){if(e.methodModelFactory.hasMethodModel(t)){if('undefined'!=typeof e[t])throw new Error(`Duplicated method ${t}. This method is defined as RPC call and as Object method.`);const r=e.methodModelFactory.createMethodModel(t),n=()=>{if(r.methodArguments=arguments,r.parameters.length!==r.parametersAmount)throw Error(`Invalid parameters length the expected length would be ${r.parametersAmount} and not ${r.parameters.length}`);return e.methodController.execute(r,e.accounts,e)};return n.methodModel=r,n.request=r.request,n}return e[t]}throwIfMissing(e){throw Error(`Parameter with name ${e} is missing`)}}r.d(t,'a',function(){return d})},function(e,t,r){'use strict';var n=r(2),a=r(6),o=r(10),d=r(0),i=r(167),s=r.n(i);class c extends s.a{constructor(e,t){super(),this.subscriptionModel=e,this.moduleInstance=t,this.subscriptionId=null}subscribe(e){return this.subscriptionModel.beforeSubscription(this,this.moduleInstance,e),this.moduleInstance.currentProvider.subscribe(this.subscriptionModel.subscriptionType,this.subscriptionModel.subscriptionMethod,[this.subscriptionModel.options]).then((t)=>{this.subscriptionId=t,this.moduleInstance.currentProvider.on(this.subscriptionId,(t,r)=>t?void(self.moduleInstance.currentProvider.once&&this.reconnect(e),Object(d.isFunction)(e)&&e(t,null),this.emit('error',t)):void this.handleSubscriptionResponse(r,e))}),this}handleSubscriptionResponse(e,t){Object(d.isArray)(e)||(e=[e]),e.forEach(function(e){const r=this.subscriptionModel.onNewSubscriptionItem(this,e);this.emit('data',r),Object(d.isFunction)(t)&&t(!1,r)})}reconnect(e){const t=setInterval(()=>{this.moduleInstance.currentProvider.reconnect&&this.moduleInstance.currentProvider.reconnect()},500);this.moduleInstance.currentProvider.once('connect',()=>{clearInterval(t),this.unsubscribe().then(()=>{this.subscribe(e)}).catch((t)=>{this.emit('error',t),Object(d.isFunction)(e)&&e(t,null)})})}unsubscribe(e){return this.moduleInstance.currentProvider.unsubscribe(this.subscriptionId,this.subscriptionModel.subscriptionType).then((t)=>(this.removeAllListeners('data'),this.removeAllListeners('error'),!t)?(this.subscriptionId=null,Object(d.isFunction)(e)&&e(!0,!1),!0):(Object(d.isFunction)(e)&&e(!1,!0),!1))}}class f{constructor(e,t,r,n,a){this.subscriptionType=e,this.subscriptionMethod=t,this.options=r,this.util=n,this.formatters=a}beforeSubscription(){}onNewSubscriptionItem(e,t){return this.formatters.outputLogFormatter(t)}}class p extends f{constructor(e,t,r,n,a){super('eth_subscribe','logs',e,t,r),this.getPastLogsMethodModel=n,this.methodController=a}beforeSubscription(e,t,r){const n=this;this.options=this.formatters.inputLogFormatter(this.options),this.getPastLogsMethodModel.parameters=[options],this.methodController.execute(this.getPastLogsMethodModel,t.currentProvider,null,t).then((t)=>{t.forEach((t)=>{r(!1,t),e.emit('data',t)}),delete n.options.fromBlock}).catch((t)=>{e.emit('error',t),r(t,null)})}onNewSubscriptionItem(e,t){return this.formatters.outputLogFormatter(t)}}class l extends f{constructor(e,t){super('eth_subscribe','newHeads',null,e,t)}onNewSubscriptionItem(e,t){return this.formatters.outputBlockFormatter(t)}}class u extends f{constructor(e,t){super('eth_subscribe','newPendingTransactions',null,e,t)}}class b extends f{constructor(e,t){super('eth_subscribe','syncing',null,e,t),this.isSyncing=null}onNewSubscriptionItem(e,t){const r=t.result.syncing;return null===this.isSyncing&&(this.isSyncing=r,e.emit('changed',this.isSyncing)),!0===this.isSyncing&&!1===r&&(this.isSyncing=r,e.emit('changed',this.isSyncing)),!1===this.isSyncing&&!0===r&&(this.isSyncing=r,e.emit('changed',this.isSyncing)),this.formatters.outputSyncingFormatter(t)}}class h extends f{constructor(e,t,r){super('shh_subscribe','messages',e,t,r)}}class m{constructor(e,t){this.utils=e,this.formatters=t}createLogSubscription(e,t,r,n){return new c(new p(t,this.utils,this.formatters,r,n),e)}createNewHeadsSubscription(e){return new c(new l(this.utils,this.formatters),e)}createNewPendingTransactionsSubscription(e){return new c(new u(this.utils,this.formatters),e)}createSyncingSubscriptionModel(e){return new c(new b(this.utils,this.formatters),e)}createShhMessagesSubscription(e,t){return new c(new h(t,this.utils,this.formatters),e)}}class y{createSubscriptionsFactory(e,t){return new m(e,t)}}r.d(t,'c',function(){return g}),r.d(t,'a',function(){return p}),r.d(t,'b',function(){return c});const g=()=>new y().createSubscriptionsFactory(n.a,a.b)},function(e){function t(e,t){if(!e)throw new Error(t||'Assertion failed')}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||'Assertion failed: '+e+' != '+t)}},function(e,t,r){var n=String.fromCharCode;const a=r(236),o=(e,t)=>parseInt(e.slice(2*t+2,2*t+4),16),d=(e)=>(e.length-2)/2,i=(e,t)=>t.length===2*e+2?t:i(e,'0x0'+t.slice(2)),s=(e,t)=>t.length===2*e+2?t:s(e,t+'0'),c=(e)=>{let t=[];for(let r=2,n=e.length;r{let t='0x';for(let r=0,n=e.length,a;ra?'0':'')+a.toString(16);return t};e.exports={random:(e)=>{let t='undefined'!=typeof window&&window.crypto&&window.crypto.getRandomValues?window.crypto.getRandomValues(new Uint8Array(e)):r(114).randomBytes(e);let n='0x';for(let r=0;re.concat(t.slice(2)),flatten:(e)=>'0x'+e.reduce((e,t)=>e+t.slice(2),''),slice:(e,t,r)=>'0x'+r.slice(2*e+2,2*t+2),reverse:(e)=>{let t='0x';for(let r=0,n=d(e);r{let t='0x';for(let r=0;r{let t='';for(let r=2;r{const t=(e)=>{const t=e.toString(16);return 2>t.length?'0'+t:t};let r='0x';for(let n=0,a;n!=e.length;n++){if(a=e.charCodeAt(n),128>a){r+=t(a);continue}if(2048>a)r+=t(192|a>>6);else{if(55295a){if(++n==e.length)return null;let o=e.charCodeAt(n);if(56320>o||57343>18),r+=t(128|63&a>>12)}else r+=t(224|a>>12);r+=t(128|63&a>>6)}r+=t(128|63&a)}return r},toString:(e)=>{let t='',r=0,a=d(e);for(;rd){if(r>=a)return null;d=(31&d)<<6|63&o(e,r)}else if(223d){if(r+1>=a)return null;d=(15&d)<<12|(63&o(e,r))<<6|63&o(e,++r)}else if(239d){if(r+2>=a)return null;d=(7&d)<<18|(63&o(e,r))<<12|(63&o(e,++r))<<6|63&o(e,++r)}else return null;++r}if(65535>=d)t+=n(d);else if(1114111>=d)d-=65536,t+=n(55296|d>>10),t+=n(56320|1023&d);else return null}return t},fromNumber:(e)=>{let t=e.toString(16);return 0==t.length%2?'0x'+t:'0x0'+t},toNumber:(e)=>parseInt(e.slice(2),16),fromNat:(e)=>'0x0'===e?'0x':0==e.length%2?e:'0x0'+e.slice(2),toNat:(e)=>'0'===e[2]?'0x'+e.slice(3):e,fromArray:f,toArray:c,fromUint8Array:(e)=>f([].slice.call(e,0)),toUint8Array:(e)=>new Uint8Array(c(e))}},function(e,t,r){(function(t){const n=r(16),a=r(91),o=r(12),d=r(24),i=new o.ec('secp256k1'),{keccak256:s,keccak256s:c}=r(21),f=(e)=>{const t=c(e.slice(2));let r='0x';for(let n=0;40>n;n++)r+=7{const r=new t(e.slice(2),'hex'),n=i.keyFromPrivate(r),a='0x'+n.getPublic(!1,'hex').slice(2),o=s(a),d=f('0x'+o.slice(-40));return{address:d,privateKey:e}},l=([e,t,r])=>n.flatten([t,r,e]),u=(e)=>[n.slice(64,n.length(e),e),n.slice(0,32,e),n.slice(32,64,e)],b=(e)=>(r,o)=>{const d=i.keyFromPrivate(new t(o.slice(2),'hex')).sign(new t(r.slice(2),'hex'),{canonical:!0});return l([a.fromString(n.fromNumber(e+d.recoveryParam)),n.pad(32,n.fromNat('0x'+d.r.toString(16))),n.pad(32,n.fromNat('0x'+d.s.toString(16)))])},h=b(27);e.exports={create:(e)=>{const t=s(n.concat(n.random(32),e||n.random(32))),r=n.concat(n.concat(n.random(32),t),n.random(32)),a=s(r);return p(a)},toChecksum:f,fromPrivate:p,sign:h,makeSigner:b,recover:(e,r)=>{const a=u(r),o={v:n.toNumber(a[0]),r:a[1].slice(2),s:a[2].slice(2)},d=i.recoverPubKey(new t(e.slice(2),'hex'),o,2>o.v?o.v:1-o.v%2),c='0x'+d.encode('hex',!1).slice(2),p=s(c),l=f('0x'+p.slice(-40));return l},encodeSignature:l,decodeSignature:u}}).call(this,r(4).Buffer)},function(e,t,r){r(81)('replace',2,function(e,t,r){return[function(n,a){'use strict';var o=e(this),d=n==void 0?void 0:n[t];return d===void 0?r.call(o+'',n,a):d.call(n,o,a)},r]})},function(e,t,r){'use strict';r(195);var n=r(40),a=r(103),o=r(31),d='toString',i=/./[d],s=function(e){r(41)(RegExp.prototype,d,e,!0)};r(54)(function(){return'/a/b'!=i.call({source:'a',flags:'b'})})?s(function(){var e=n(this);return'/'.concat(e.source,'/','flags'in e?e.flags:!o&&e instanceof RegExp?a.call(e):void 0)}):i.name!=d&&s(function(){return i.call(this)})},function(e,t,r){'use strict';function n(e){return(e>>>24|65280&e>>>8|16711680&e<<8|(255&e)<<24)>>>0}function a(e){return 1===e.length?'0'+e:e}function o(e){return 7===e.length?'0'+e:6===e.length?'00'+e:5===e.length?'000'+e:4===e.length?'0000'+e:3===e.length?'00000'+e:2===e.length?'000000'+e:1===e.length?'0000000'+e:e}var d=r(15),i=r(5);t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(!('string'==typeof e))for(n=0;n>8,d=255&a;o?r.push(o,d):r.push(d)}else if('hex'===t)for(e=e.replace(/[^a-z0-9]+/ig,''),0!=e.length%2&&(e='0'+e),n=0;n>>0}return o},t.split32=function(e,t){for(var r=Array(4*e.length),n=0,a=0,o;n>>24,r[a+1]=255&o>>>16,r[a+2]=255&o>>>8,r[a+3]=255&o):(r[a+3]=o>>>24,r[a+2]=255&o>>>16,r[a+1]=255&o>>>8,r[a]=255&o);return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(t,r,n,a,o){return t+r+n+a+o>>>0},t.sum64=function(e,t,r,n){var a=e[t],o=e[t+1],d=n+o>>>0,i=(d>>0,e[t+1]=d},t.sum64_hi=function(e,t,r,n){var a=(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,a,o,d,i){var s=0,c=t;c=c+n>>>0,s+=c>>0,s+=c>>0,s+=c>>0},t.sum64_4_lo=function(e,t,r,n,a,o,d,i){return t+n+o+i>>>0},t.sum64_5_hi=function(e,t,r,n,a,o,d,i,s,c){var f=0,p=t;p=p+n>>>0,f+=p>>0,f+=p>>0,f+=p>>0,f+=p>>0},t.sum64_5_lo=function(e,t,r,n,a,o,d,i,s,c){return t+n+o+i+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e){const t=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'],r=[1,256,65536,16777216],n=[0,8,16,24],a=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],o=(e)=>({blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:((e)=>[].concat(e,e,e,e,e))([0,0,0,0,0,0,0,0,0,0])}),d=(e,a)=>{for(var o=a.length,d=e.blocks,f=e.blockCount<<2,p=e.blockCount,l=e.outputBlocks,u=e.s,s=0,b,i;s>2]|=a[s]<i?d[b>>2]|=i<i?(d[b>>2]|=(192|i>>6)<>2]|=(128|63&i)<i||57344<=i?(d[b>>2]|=(224|i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|63&i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<=f){for(e.start=b-f,e.block=d[p],b=0;b>2]|=r[3&b],e.lastByteIndex===f)for(d[0]=d[p],b=1;b>4]+t[15&y]+t[15&y>>12]+t[15&y>>8]+t[15&y>>20]+t[15&y>>16]+t[15&y>>28]+t[15&y>>24];0==m%p&&(c(u),b=0)}return'0x'+h},c=(e)=>{var t,r,o,n,d,i,s,c,f,p,l,u,b,h,m,y,g,v,k,x,S,w,A,E,I,C,P,T,B,N,R,M,L,j,O,D,U,H,F,q,z,K,V,G,W,X,Y,Z,J,$,Q,ee,te,re,ne,ae,oe,de,ie,se,ce,fe,pe;for(o=0;48>o;o+=2)n=e[0]^e[10]^e[20]^e[30]^e[40],d=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],p=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],u=e[8]^e[18]^e[28]^e[38]^e[48],b=e[9]^e[19]^e[29]^e[39]^e[49],t=u^(i<<1|s>>>31),r=b^(s<<1|i>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=n^(c<<1|f>>>31),r=d^(f<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=i^(p<<1|l>>>31),r=s^(l<<1|p>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(u<<1|b>>>31),r=f^(b<<1|u>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=p^(n<<1|d>>>31),r=l^(d<<1|n>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,h=e[0],m=e[1],X=e[11]<<4|e[10]>>>28,Y=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,B=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,O=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,fe=e[42]<<2|e[43]>>>30,pe=e[43]<<2|e[42]>>>30,re=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,k=e[24]<<11|e[25]>>>21,$=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,M=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,E=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,ae=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,H=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,x=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,ee=e[47]<<24|e[46]>>>8,te=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,P=e[19]<<20|e[18]>>>12,de=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,w=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=h^~y&v,e[1]=m^~g&k,e[10]=E^~C&T,e[11]=I^~P&B,e[20]=j^~D&H,e[21]=O^~U&F,e[30]=G^~X&Z,e[31]=W^~Y&J,e[40]=re^~ae&de,e[41]=ne^~oe&ie,e[2]=y^~v&x,e[3]=g^~k&S,e[12]=C^~T&N,e[13]=P^~B&R,e[22]=D^~H&q,e[23]=U^~F&z,e[32]=X^~Z&$,e[33]=Y^~J&Q,e[42]=ae^~de&se,e[43]=oe^~ie&ce,e[4]=v^~x&w,e[5]=k^~S&A,e[14]=T^~N&M,e[15]=B^~R&L,e[24]=H^~q&K,e[25]=F^~z&V,e[34]=Z^~$&ee,e[35]=J^~Q&te,e[44]=de^~se&fe,e[45]=ie^~ce&pe,e[6]=x^~w&h,e[7]=S^~A&m,e[16]=N^~M&E,e[17]=R^~L&I,e[26]=q^~K&j,e[27]=z^~V&O,e[36]=$^~ee&G,e[37]=Q^~te&W,e[46]=se^~fe&re,e[47]=ce^~pe&ne,e[8]=w^~h&y,e[9]=A^~m&g,e[18]=M^~E&C,e[19]=L^~I&P,e[28]=K^~j&D,e[29]=V^~O&U,e[38]=ee^~G&X,e[39]=te^~W&Y,e[48]=fe^~re&ae,e[49]=pe^~ne&oe,e[0]^=a[o],e[1]^=a[o+1]},i=(e)=>(t)=>{var r;if('0x'===t.slice(0,2)){r=[];for(var n=2,a=t.length;n{const t=(e)=>0==e.length%2?e:'0'+e,r=(e)=>t(e.toString(16)),n=(e,t)=>56>e?r(t+e):r(t+r(e).length/2+55)+r(e),a=(e)=>{if('string'==typeof e){const t=e.slice(2),r=2!=t.length||'80'<=t?n(t.length/2,128):'';return r+t}else{const t=e.map(a).join(''),r=n(t.length/2,192);return r+t}};return'0x'+a(e)},decode:(e)=>{let t=2;const r=()=>{if(t>=e.length)throw'';const r=e.slice(t,t+2);return'80'>r?(t+=2,'0x'+r):'c0'>r?a():o()},n=()=>{const r=parseInt(e.slice(t,t+=2),16)%64;return 56>r?r:parseInt(e.slice(t,t+=2*(r-55)),16)},a=()=>{const r=n();return'0x'+e.slice(t,t+=2*r)},o=()=>{const e=2*n()+t;let a=[];for(;ti)throw new Error('[ethjs-unit] while converting number '+e+' to wei, too many decimal places');for(;u.lengthr||256<=r||parseInt(r+'')!=r)return!1;return!0}function d(e){if(null==e&&u.throwError('cannot convert null value to array',u.INVALID_ARGUMENT,{arg:'value',value:e}),n(e)&&(e=e.toHexString()),'string'==typeof e){var t=e.match(/^(0x)?[0-9a-fA-F]*$/);t||u.throwError('invalid hexidecimal string',u.INVALID_ARGUMENT,{arg:'value',value:e}),'0x'!==t[1]&&u.throwError('hex string must have 0x prefix',u.INVALID_ARGUMENT,{arg:'value',value:e}),e=e.substring(2),e.length%2&&(e='0'+e);for(var r=[],d=0;de&&u.throwError('cannot hexlify negative value',u.INVALID_ARGUMENT,{arg:'value',value:e});for(var t='';e;)t=b[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t='0'+t),'0x'+t):'0x00'}if('string'==typeof e){var r=e.match(/^(0x)?[0-9a-fA-F]*$/);return r||u.throwError('invalid hexidecimal string',u.INVALID_ARGUMENT,{arg:'value',value:e}),'0x'!==r[1]&&u.throwError('hex string must have 0x prefix',u.INVALID_ARGUMENT,{arg:'value',value:e}),e.length%2&&(e='0x0'+e.substring(2)),e}if(o(e)){for(var a=[],d=0,i;d>4]+b[15&i]);return'0x'+a.join('')}return u.throwError('invalid hexlify value',null,{arg:'value',value:e}),'never'}function f(e,t){for(s(e)||u.throwError('invalid hex string',u.INVALID_ARGUMENT,{arg:'value',value:e});e.length<2*t+2;)e='0x0'+e.substring(2);return e}function p(e){return e&&null!=e.r&&null!=e.s}function l(e){var t=0,n='0x',a='0x';if(p(e)){null==e.v&&null==e.recoveryParam&&u.throwError('at least on of recoveryParam or v must be specified',u.INVALID_ARGUMENT,{argument:'signature',value:e}),n=f(e.r,32),a=f(e.s,32),t=e.v,'string'==typeof t&&(t=parseInt(t,16));var o=e.recoveryParam;null==o&&null!=e.v&&(o=1-t%2),t=27+o}else{var i=d(e);if(65!==i.length)throw new Error('invalid signature');n=c(i.slice(0,32)),a=c(i.slice(32,64)),t=i[64],27!==t&&28!==t&&(t=27+t%2)}return{r:n,s:a,recoveryParam:t-27,v:t}}Object.defineProperty(t,'__esModule',{value:!0});var u=r(58);t.AddressZero='0x0000000000000000000000000000000000000000',t.HashZero='0x0000000000000000000000000000000000000000000000000000000000000000',t.isArrayish=o,t.arrayify=d,t.concat=i,t.stripZeros=function(e){var t=d(e);if(0===t.length)return t;for(var r=0;0===t[r];)r++;return r&&(t=t.slice(r)),t},t.padZeros=function(e,t){if(e=d(e),t>>32-t}function s(e,t,r,n,a,d,i){return 0|o(0|e+(t&r|~t&n)+a+d,i)+t}function f(e,t,r,n,a,i,c){return 0|o(0|e+(t&n|r&~n)+a+i,c)+t}function p(e,t,r,n,a,d,i){return 0|o(0|e+(t^r^n)+a+d,i)+t}function l(e,t,r,n,a,i,c){return 0|o(0|e+(r^(t|~n))+a+i,c)+t}var a=r(5),d=r(115),c=Array(16);a(n,d),n.prototype._update=function(){for(var e=c,t=0;16>t;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,a=this._c,o=this._d;r=s(r,n,a,o,e[0],3614090360,7),o=s(o,r,n,a,e[1],3905402710,12),a=s(a,o,r,n,e[2],606105819,17),n=s(n,a,o,r,e[3],3250441966,22),r=s(r,n,a,o,e[4],4118548399,7),o=s(o,r,n,a,e[5],1200080426,12),a=s(a,o,r,n,e[6],2821735955,17),n=s(n,a,o,r,e[7],4249261313,22),r=s(r,n,a,o,e[8],1770035416,7),o=s(o,r,n,a,e[9],2336552879,12),a=s(a,o,r,n,e[10],4294925233,17),n=s(n,a,o,r,e[11],2304563134,22),r=s(r,n,a,o,e[12],1804603682,7),o=s(o,r,n,a,e[13],4254626195,12),a=s(a,o,r,n,e[14],2792965006,17),n=s(n,a,o,r,e[15],1236535329,22),r=f(r,n,a,o,e[1],4129170786,5),o=f(o,r,n,a,e[6],3225465664,9),a=f(a,o,r,n,e[11],643717713,14),n=f(n,a,o,r,e[0],3921069994,20),r=f(r,n,a,o,e[5],3593408605,5),o=f(o,r,n,a,e[10],38016083,9),a=f(a,o,r,n,e[15],3634488961,14),n=f(n,a,o,r,e[4],3889429448,20),r=f(r,n,a,o,e[9],568446438,5),o=f(o,r,n,a,e[14],3275163606,9),a=f(a,o,r,n,e[3],4107603335,14),n=f(n,a,o,r,e[8],1163531501,20),r=f(r,n,a,o,e[13],2850285829,5),o=f(o,r,n,a,e[2],4243563512,9),a=f(a,o,r,n,e[7],1735328473,14),n=f(n,a,o,r,e[12],2368359562,20),r=p(r,n,a,o,e[5],4294588738,4),o=p(o,r,n,a,e[8],2272392833,11),a=p(a,o,r,n,e[11],1839030562,16),n=p(n,a,o,r,e[14],4259657740,23),r=p(r,n,a,o,e[1],2763975236,4),o=p(o,r,n,a,e[4],1272893353,11),a=p(a,o,r,n,e[7],4139469664,16),n=p(n,a,o,r,e[10],3200236656,23),r=p(r,n,a,o,e[13],681279174,4),o=p(o,r,n,a,e[0],3936430074,11),a=p(a,o,r,n,e[3],3572445317,16),n=p(n,a,o,r,e[6],76029189,23),r=p(r,n,a,o,e[9],3654602809,4),o=p(o,r,n,a,e[12],3873151461,11),a=p(a,o,r,n,e[15],530742520,16),n=p(n,a,o,r,e[2],3299628645,23),r=l(r,n,a,o,e[0],4096336452,6),o=l(o,r,n,a,e[7],1126891415,10),a=l(a,o,r,n,e[14],2878612391,15),n=l(n,a,o,r,e[5],4237533241,21),r=l(r,n,a,o,e[12],1700485571,6),o=l(o,r,n,a,e[3],2399980690,10),a=l(a,o,r,n,e[10],4293915773,15),n=l(n,a,o,r,e[1],2240044497,21),r=l(r,n,a,o,e[8],1873313359,6),o=l(o,r,n,a,e[15],4264355552,10),a=l(a,o,r,n,e[6],2734768916,15),n=l(n,a,o,r,e[13],1309151649,21),r=l(r,n,a,o,e[4],4149444226,6),o=l(o,r,n,a,e[11],3174756917,10),a=l(a,o,r,n,e[2],718787259,15),n=l(n,a,o,r,e[9],3951481745,21),this._a=0|this._a+r,this._b=0|this._b+n,this._c=0|this._c+a,this._d=0|this._d+o},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(4294967295>=r)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0;this._block.writeUInt32BE((r-n)/4294967296,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},n.prototype._update=function(){throw new Error('_update must be implemented by subclass')},e.exports=n},function(e,t,r){(function(t){function n(e){var r;'object'!=typeof e||t.isBuffer(e)||(r=e.passphrase,e=e.key),'string'==typeof e&&(e=new t(e));var n=i(e,r),d=n.tag,s=n.data,c,f;switch(d){case'CERTIFICATE':f=o.certificate.decode(s,'der').tbsCertificate.subjectPublicKeyInfo;case'PUBLIC KEY':switch(f||(f=o.PublicKey.decode(s,'der')),c=f.algorithm.algorithm.join('.'),c){case'1.2.840.113549.1.1.1':return o.RSAPublicKey.decode(f.subjectPublicKey.data,'der');case'1.2.840.10045.2.1':return f.subjectPrivateKey=f.subjectPublicKey,{type:'ec',data:f};case'1.2.840.10040.4.1':return f.algorithm.params.pub_key=o.DSAparam.decode(f.subjectPublicKey.data,'der'),{type:'dsa',data:f.algorithm.params};default:throw new Error('unknown key id '+c);}throw new Error('unknown key type '+d);case'ENCRYPTED PRIVATE KEY':s=o.EncryptedPrivateKey.decode(s,'der'),s=a(s,r);case'PRIVATE KEY':switch(f=o.PrivateKey.decode(s,'der'),c=f.algorithm.algorithm.join('.'),c){case'1.2.840.113549.1.1.1':return o.RSAPrivateKey.decode(f.subjectPrivateKey,'der');case'1.2.840.10045.2.1':return{curve:f.algorithm.curve,privateKey:o.ECPrivateKey.decode(f.subjectPrivateKey,'der').privateKey};case'1.2.840.10040.4.1':return f.algorithm.params.priv_key=o.DSAparam.decode(f.subjectPrivateKey,'der'),{type:'dsa',params:f.algorithm.params};default:throw new Error('unknown key id '+c);}throw new Error('unknown key type '+d);case'RSA PUBLIC KEY':return o.RSAPublicKey.decode(s,'der');case'RSA PRIVATE KEY':return o.RSAPrivateKey.decode(s,'der');case'DSA PRIVATE KEY':return{type:'dsa',params:o.DSAPrivateKey.decode(s,'der')};case'EC PRIVATE KEY':return s=o.ECPrivateKey.decode(s,'der'),{curve:s.parameters.value,privateKey:s.privateKey};default:throw new Error('unknown key type '+d);}}function a(e,r){var n=e.algorithm.decrypt.kde.kdeparams.salt,a=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=d[e.algorithm.decrypt.cipher.algo.join('.')],i=e.algorithm.decrypt.cipher.iv,f=e.subjectPrivateKey,p=parseInt(o.split('-')[1],10)/8,l=c.pbkdf2Sync(r,n,a,p),u=s.createDecipheriv(o,l,i),b=[];return b.push(u.update(f)),b.push(u.final()),t.concat(b)}var o=r(289),d=r(301),i=r(302),s=r(62),c=r(122);e.exports=n,n.signature=o.signature}).call(this,r(4).Buffer)},function(e,t,r){'use strict';var n=r(39),a=r(1),o=r(6),d=r(2),i=r(73),s=r(8);class c{constructor(e){this.abi=e}getMethod(e){return!!this.hasMethod(e)&&this.abi.methods[e]}getEvent(e){return!!this.hasEvent(e)&&this.abi.events[e]}getEvents(){return this.abi.events}getEventBySignature(e){return this.abi.events.find((t)=>t.signature===e)}hasMethod(e){return'undefined'!=typeof this.abi.methods[e]}hasEvent(e){return'undefined'!=typeof this.abi.events[e]}}var f=r(0),p=r.n(f);class l{constructor(e){this.abiItem=e,this.signature=this.abiItem.signature,this.name=this.abiItem.name,this.anonymous=this.abiItem.anonymous,this.contractMethodParameters=[],Object.defineProperty(this,'requestType',{get(){return'function'===e.type?!0===e.constant?'call':'send':'constructor'===e.type?'contract-deployment':void 0}})}getInputLength(){return p.a.isArray(this.abiItem.inputs)?this.abiItem.inputs.length:0}getInputs(){let e=[];return p.a.isArray(this.abiItem.inputs)&&(e=this.abiItem.inputs),e}givenParametersLengthIsValid(){const e=this.getInputLength();return!(this.contractMethodParameters.length!==e)||new Error(`The number of arguments is not matching the methods required number. You need to pass ${e} arguments.`)}getIndexedInputs(){return this.getInputs().filter((e)=>!0===e.indexed)}isOfType(e){return this.abiItem.type===e}}r(18);class u{constructor(e){this.abiCoder=e}encode(e,t){let r;try{r=this.abiCoder.encodeParameters(e.getInputs(),e.contractMethodParameters).replace('0x','')}catch(e){return e}return'constructor'===e.signature?t?t+r:new Error('The contract has no contract data option set. This is necessary to append the constructor parameters.'):e.isOfType('function')?e.signature+r:r}}r(10);class b{constructor(e){this.abiCoder=e}encode(e,t){const r=e.getIndexedInputs();let n=[];return r.forEach((e)=>{if('undefined'!=typeof t[e.name]){const r=t[e.name];if(_.isArray(r))return r.map((t)=>this.abiCoder.encodeParameter(e.type,t)),void n.push(r);n.push(this.abiCoder.encodeParameter(e.type,r))}}),n}}class h extends b{constructor(e){super(e)}encode(e,t){const r=e.getEvents();let n=[];return Object.keys(r).forEach((e)=>{n.push(super.encode(r[e],t))}),n}}class m{constructor(e){this.abiCoder=e}decode(e,t){if(!t)return null;2<=t.length&&(t=t.slice(2));const r=this.abiCoder.decodeParameters(e,t);return 1===r.__length__?r[0]:r}}var y=r(72),g=r.n(y);class v extends g.a{constructor(e,t,r){super(t,r),this.abiModel=e}decode(e,t){return super.decode(this.abiModel.getEventBySignature(t.topics[0]),t)}}class k{constructor(e,t,r){this.utils=r,this.abiCoder=t,this.contractPackageFactory=e}map(e){const t=this,r={methods:{},events:{}};return e.forEach((e)=>{e.constant=t.isConstant(e),e.payable=t.isPayable(e),e.name&&(e.funcName=t.utils._jsonInterfaceMethodToString(e));let n;return'function'===e.type?(e.signature=t.abiCoder.encodeFunctionSignature(e.funcName),n=t.contractPackageFactory.createABIItemModel(e),r.methods[e.name]?_.isArray(r.methods[e.name])?r.methods[e.name].push(n):r.methods[e.name]=[r.methods[e.name],n]:r.methods[e.name]=n,r.methods[e.signature]=n,void(r.methods[e.funcName]=n)):void('event'===e.type&&(e.signature=t.abiCoder.encodeEventSignature(e.funcName),e=t.contractPackageFactory.createABIItemModel(event),(!r.events[e.name]||'bound '===r.events[e.name].name)&&(r.events[e.name]=n),r.events[e.signature]=n,r.events[e.funcName]=n),'constructor'===e.type&&(e.signature=e.type,r.methods.contractConstructor=t.contractPackageFactory.createABIItemModel(e)))}),this.contractPackageFactory.createABIModel(r)}isConstant(e){return'view'===e.stateMutability||'pure'===e.stateMutability||e.constant}isPayable(e){return'payable'===e.stateMutability||e.payable}}class x{constructor(e,t){this.utils=e,this.formatters=t}map(e,t){let r=null;t.gasPrice&&(r=t.gasPrice+'');let n=null;return t.from&&(n=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(t.from))),t.data=t.data||e.options.data,t.from=n||e.defaultAccount,t.gasPrice=r||e.options.gasPrice,t.gas=t.gas||t.gasLimit||e.options.gas,delete t.gasLimit,t}}class S{constructor(e,t){this.formatters=e,this.eventFilterEncoder=t}map(e,t,r){return'undefined'==typeof r.topics&&(r.topics=[]),'undefined'!=typeof r.fromBlock&&(r.fromBlock=this.formatters.inputBlockNumberFormatter(r.fromBlock)),'undefined'!=typeof r.toBlock&&(r.toBlock=this.formatters.inputBlockNumberFormatter(r.toBlock)),e.anonymous||r.topics.unshift(e.signature),'undefined'!=typeof r.filters&&r.topics.concat(this.eventFilterEncoder.encode(e,r.filter)),r.address||(r.address=t.options.address),r}}class w{constructor(e,t){this.formatters=e,this.allEventsFilterEncoder=t}map(e,t,r){return r.topics=[],'undefined'!=typeof r.fromBlock&&(r.fromBlock=this.formatters.inputBlockNumberFormatter(r.fromBlock)),'undefined'!=typeof r.toBlock&&(r.toBlock=this.formatters.inputBlockNumberFormatter(r.toBlock)),'undefined'!=typeof r.filters&&r.topics.concat(this.allEventsFilterEncoder.encode(e,r.filter)),r.address||(r.address=t.options.address),r}}class A{constructor(e,t,r,n,a,o,d,i){return this.contract=e,this.abiModel=t,this.rpcMethodModelFactory=r,this.methodController=n,this.methodEncoder=a,this.rpcMethodOptionsValidator=o,this.rpcMethodOptionsMapper=d,this.promiEvent=i,new Proxy(this,{get:this.proxyHandler})}proxyHandler(e,t){const r=this.abiModel.getMethod(t);if(r){let t=r.requestType;'contract-deployment'===t&&(t='send');const n=()=>{let n=arguments;'contract-deployment'===t&&(arguments[0].data&&(e.contract.options.data=e.contract.options.data||arguments[0].data),arguments[0].arguments&&(n=arguments[0].arguments)),r.contractMethodParameters=n};n[t]=()=>e.executeMethod(r,arguments),n[t].request=()=>e.createRpcMethodModel(r,arguments),n.estimateGas=()=>(r.requestType='estimate',e.executeMethod(r,arguments)),n.encodeAbi=()=>e.methodEncoder.encode(r,e.contract.options.data)}if(e[t])return this[t];throw Error(`Method with name "${t}" not found`)}executeMethod(e,t){const r=this.createRpcMethodModel(e,t);return'undefined'==typeof r.error?this.methodController.execute(r,this.contract.accounts,this.contract):this.handleValidationError(r.error,r.callback)}createRpcMethodModel(e,t){let r;if(_.isArray(e)){let n=!1;if(e.some((a)=>(r=this.rpcMethodModelFactory.createRpcMethodByRequestType(a,this.contract),r.methodArguments=t,n=e.givenParametersLengthIsValid(),!0===n)),!0!==n)return{error:n,callback:r.callback}}else r=this.rpcMethodModelFactory.createRpcMethodByRequestType(e,this.contract),r.methodArguments=t;const n=e.givenParametersLengthIsValid();if(n instanceof Error)return{error:n,callback:r.callback};const a=this.methodEncoder.encode(e,this.contract.options.data);if(a instanceof Error)return{error:a,callback:r.callback};r.parameters[0].data=a,r.parameters=this.rpcMethodOptionsMapper.map(this.contract,r.parameters[0]);const o=this.rpcMethodOptionsValidator.validate(e,r);return o instanceof Error?{error:o,callback:r.callback}:r}handleValidationError(e,t){const r=new this.promiEvent;return r.resolve(null),r.reject(e),r.emit('error',e),_.isFunction(t)&&t(e,null),r}}class E{constructor(e,t,r,n,a,o,d){return this.contract=e,this.eventSubscriptionFactory=r,this.abiModel=t,this.eventOptionsMapper=n,this.eventLogDecoder=a,this.allEventsLogDecoder=o,this.allEventsOptionsMapper=d,new Proxy(this,{get:this.proxyHandler})}proxyHandler(e,t){if(this.abiModel.hasEvent(t))return(r,n)=>e.subscribe(e.abiModel.getEvent(t),r,n);if('allEvents'===t)return(t,r)=>e.subscribeAll(t,r);if(e[t])return e[t];throw Error(`Event with name "${t}" not found`)}subscribe(e,t,r){return'undefined'!=typeof t.filters&&'undefined'!=typeof t.topics?this.handleValidationError('Invalid subscription options: Only filter or topics are allowed and not both',r):this.eventSubscriptionFactory.createEventLogSubscription(this.eventLogDecoder,e,this.contract,this.eventOptionsMapper.map(e,this.contract,t)).subscribe(r)}subscribeAll(e,t){return'undefined'==typeof e.topics?this.eventSubscriptionFactory.createAllEventLogSubscription(this.allEventsLogDecoder,this.contract,this.allEventsOptionsMapper.map(this.abiModel,this.contract,e)).subscribe(t):this.handleValidationError('Invalid subscription options: Topics are not allowed for the "allEvents" subscription',t)}handleValidationError(e,t){const r=new this.promiEventPackage.PromiEvent;return r.emit('error',new Error(e)),_.isFunction(t)&&t(error,null),r}}class I{constructor(e){this.utils=e}validate(e,t){return this.isToSet(e,t)?new Error('This contract object doesn\'t have address set yet, please set an address first.'):this.isFromSet(t)?new Error('No "from" address specified in neither the given options, nor the default options.'):!this.isValueValid(e,t)||new Error('Can not send value to non-payable contract method or constructor')}isToSet(e,t){return!('constructor'!==e.signature)||!!t.parameters[0].to}isFromSet(e){return this.utils.isAddress(e.parameters[0].from)}isValueValid(e,t){return!(!e.payable&&t.parameters[0].value&&0this.eventLogDecoder.decode(self.abiItemModel,e)),t}}class B extends a.db{constructor(e,t,r,n,a){super(r,n,a),this.abiItemModel=e,this.allEventsLogDecoder=t}afterExecution(e){return p.a.isArray(e.logs)&&(e.events={},e.logs.map(function(e){return this.allEventsLogDecoder.decode(null,e)}),e.logs.forEach((t,r)=>t.event?e.events[t.event]?p.a.isArray(e.events[t.event])?void e.events[t.event].push(t):void(e.events[t.event]=[e.events[t.event],t]):void(e.events[t.event]=t):void(e.events[r]=t)),delete e.logs),e}}class N{constructor(e,t,r,n){this.utils=r,this.formatters=n,this.callMethodResponseDecoder=e,this.accounts=t}createRpcMethodByRequestType(e,t){let r;switch(e.requestType){case'call':r=this.createCallContractMethodModel(e);break;case'send':r=this.createSendContractMethodModel(e);break;case'estimate':r=this.createEstimateGasMethodModel();break;case'contract-deployment':r=this.createContractDeployMethodModel(t);}if('undefined'==typeof r)throw Error(`Unknown RPC call with requestType "${e.requestType}"`);return r}createPastEventLogsMethodModel(e){return new T(e,this.utils,this.formatters)}createCallContractMethodModel(e){return new C(e,this.callMethodResponseDecoder,this.utils,this.formatters)}createSendContractMethodModel(e){return new B(e,this.allEventsLogDecoder,this.utils,this.formatters,this.accounts)}createContractDeployMethodModel(e){return new P(e,this.utils,this.formatters,this.accounts)}createEstimateGasMethodModel(){return new a.j(this.utils,this.formatters)}}var R=r(14);class M extends R.a{constructor(e,t,r,n,a,o,d){super(t,r,n,a,o),this.eventLogDecoder=d,this.abiItemModel=e}onNewSubscriptionItem(e,t){return this.eventLogDecoder.decode(this.abiItemModel,this.formatters.outputLogFormatter(t))}}class L extends R.a{constructor(e,t,r,n,a,o){super(e,t,r,n,a),this.allEventsLogDecoder=o}onNewSubscriptionItem(e,t){return this.allEventsLogDecoder.decode(null,this.formatters.outputLogFormatter(t))}}class j{constructor(e,t,r){this.methodController=r}createEventLogSubscription(e,t,r,n){return new R.b(r,new M(t,n,this.utils,this.formatters,new a.y(this.utils,this.formatters),this.methodController,e))}createAllEventLogSubscription(e,t,r){return new R.b(t,new L(r,this.utils,this.formatters,new a.y(this.utils,this.formatters),this.methodController,e))}}var O=r(13);class D extends O.a{constructor(e,t,r,n,a,o,d,i,s,c,f,p,l,u,b,h){if(super(e,t,r,n,a,o,null),!(this instanceof D))throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!');if(!u||!Array.isArray(u))throw new Error('You must provide the json interface of the contract when instantiating a contract object.');this.contractModuleFactory=d,this.abiCoder=s,this.utils=c,this.formatters=f,this.accounts=p,this.abiMapper=l,this.options=h,this.promiEvent=i,this.rpcMethodModelFactory=d.createRpcMethodModelFactory(),this._defaultAccount=null,this._defaultBlock='latest',this.abiModel=l.map(u),this.options.address=b,Object.defineProperty(this.options,'jsonInterface',{get:()=>this.abiModel,set:(e)=>{this.abiModel=this.abiMapper.map(e),this.methods.abiModel=this.abiModel,this.events.abiModel=this.abiModel},enumerable:!0}),Object.defineProperty(this.options,'address',{get:()=>this._address,set:(e)=>{this._address=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))},enumerable:!0}),this.methods=d.createMethodsProxy(this,this.abiModel,this.methodController,this.promiEvent),this.events=d.createEventSubscriptionsProxy(this,this.abiModel,this.methodController)}get defaultAccount(){return this._defaultAccount}set defaultAccount(e){this._defaultAccount=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))}get defaultBlock(){return this._defaultBlock}set defaultBlock(e){this._defaultBlock=e}once(e,t,r){if(!r)throw new Error('Once requires a callback function.');t&&delete t.fromBlock;const n=this.events[event](t,r);n.on('data',()=>{n.unsubscribe()})}getPastEvents(e,t,r){if(!this.options.jsonInterface.hasEvent(e))throw Error(`Event with name "${e}does not exists.`);const n=this.rpcMethodModelFactory.createPastEventLogsMethodModel(this.options.jsonInterface.getEvent(e));return n.parameters=[t],n.callback=r,this.methodController.execute(n,this.accounts,this)}deploy(e){return this.methods.contractConstructor(e)}clone(){const e=new this.constructor(this.currentProvider,this.providerDetector,this.providerAdapterResolver,this.providersModuleFactory,this.providers,this.methodController,this.contractModuleFactory,this.promiEvent,this.abiCoder,this.utils,this.formatters,this.accounts,this.abiMapper,{},this.options.address,this.options);return e.abiModel=this.abiModel,e}setProvider(e,t){return!!(super.setProvider(e,t)&&this.accounts.setProvider(e,t))}}class U{constructor(e,t,r,n){this.utils=e,this.formatters=t,this.abiCoder=r,this.accounts=n}createContract(e,t,r,n,a,o,d,i,s,c){return new D(e,t,r,n,a,o,this,d,this.abiCoder,this.utils,this.formatters,this.accounts,this.createABIMapper(),i,s,c)}createABIModel(e){return new c(e)}createABIItemModel(e){return new l(e)}createMethodEncoder(){return new u(this.abiCoder)}createEventFilterEncoder(){return new b(this.abiCoder)}createAllEventsFilterEncoder(){return new h(this.abiCoder)}createABIMapper(){return new k(this,this.abiCoder,this.utils)}createCallMethodResponseDecoder(){return new m(this.abiCoder)}createEventLogDecoder(){return new g.a(this.abiCoder,this.formatters)}createAllEventsLogDecoder(){return new v(this.abiCoder,this.formatters)}createRpcMethodOptionsValidator(){return new I(this.utils)}createRpcMethodOptionsMapper(){return new x(this.utils,this.formatters)}createEventOptionsMapper(){return new S(this.formatters,this.createEventFilterEncoder())}createAllEventsOptionsMapper(){return new w(this.formatters,this.createAllEventsFilterEncoder())}createRpcMethodModelFactory(){return new N(this.createCallMethodResponseDecoder(),this.accounts,this.utils,this.formatters)}createMethodsProxy(e,t,r,n){return new A(e,t,this.createRpcMethodModelFactory(),r,this.createMethodEncoder(),this.createRpcMethodOptionsValidator(),this.createRpcMethodOptionsMapper(),n)}createEventSubscriptionsProxy(e,t,r){new E(e,t,this.createEventSubscriptionFactory(r),this.createEventOptionsMapper(),this.createEventLogDecoder(),this.createAllEventsLogDecoder(),this.createAllEventsOptionsMapper())}createEventSubscriptionFactory(e){new j(this.utils,this.formatters,e)}}r.d(t,'a',function(){return H}),r.d(t,'b',function(){return P});const H=(e,t,r,c,f)=>{const p=new s.a;return new U(d.a,o.b,new i.a(),t).createContract(e,p.createProviderDetector(),p.createProviderAdapterResolver(),p,s.c,new a.S,n.a,r,c,f)}},function(e,t,r){'use strict';var n=r(161),a=r.n(n);class o{constructor(){return this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t}),this.eventEmitter=new a.a,new Proxy(this,{get:this.proxyHandler})}proxyHandler(e,t){if('resolve'===t||'reject'===t)return e[t];if(this.promise[t])return e.promise[t];if(this.eventEmitter[t])return e.eventEmitter[t];throw Error(`Method with name ${t} not found`)}}r.d(t,'a',function(){return o})},function(e,t,r){var n=r(53);e.exports=function(e){if(!n(e))throw TypeError(e+' is not an object!');return e}},function(e,t,r){var n=r(27),a=r(28),o=r(55),d=r(76)('src'),i='toString',s=Function[i],c=(''+s).split(i);r(75).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,r,i){var s='function'==typeof r;s&&(o(r,'name')||a(r,'name',t));e[t]===r||(s&&(o(r,d)||a(r,d,e[t]?''+e[t]:c.join(t+''))),e===n?e[t]=r:i?e[t]?e[t]=r:a(e,t,r):(delete e[t],a(e,t,r)))})(Function.prototype,i,function(){return'function'==typeof this&&this[d]||s.call(this)})},function(e,t,r){'use strict';function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function a(e,t,r){if(e&&d.isObject(e)&&e instanceof n)return e;var a=new n;return a.parse(e,t,r),a}var o=r(107),d=r(215);t.parse=a,t.resolve=function(e,t){return a(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?a(e,!1,!0).resolveObject(t):t},t.format=function(e){return d.isString(e)&&(e=a(e)),e instanceof n?e.format():n.prototype.format.call(e)},t.Url=n;var c=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=['{','}','|','\\','^','`'].concat(['<','>','"','`',' ','\r','\n','\t']),p=['\''].concat(f),l=['%','/','?',';','#'].concat(p),u=['/','?','#'],b=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=r(216);n.prototype.parse=function(e,t,r){if(!d.isString(e))throw new TypeError('Parameter \'url\' must be a string, not '+typeof e);var n=e.indexOf('?'),a=-1!==n&&n255?'':this.hostname.toLowerCase(),N||(this.hostname=o.toASCII(this.hostname));var F=this.port?':'+this.port:'',q=this.hostname||'';this.host=q+F,this.href+=this.host,N&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),'/'!==S[0]&&(S='/'+S))}if(!m[E])for(var P=0,M=p.length,z;Pv.length&&v.unshift(''),r.pathname=v.join('/')}else r.pathname=e.pathname;if(r.search=e.search,r.query=e.query,r.host=e.host||'',r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var k=r.pathname||'',p=r.search||'';r.path=k+p}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var s=r.pathname&&'/'===r.pathname.charAt(0),x=e.host||e.pathname&&'/'===e.pathname.charAt(0),S=x||s||r.host&&e.pathname,w=S,A=r.pathname&&r.pathname.split('/')||[],v=e.pathname&&e.pathname.split('/')||[],E=r.protocol&&!g[r.protocol];if(E&&(r.hostname='',r.port=null,r.host&&(''===A[0]?A[0]=r.host:A.unshift(r.host)),r.host='',e.protocol&&(e.hostname=null,e.port=null,e.host&&(''===v[0]?v[0]=e.host:v.unshift(e.host)),e.host=null),S=S&&(''===v[0]||''===A[0])),x)r.host=e.host||''===e.host?e.host:r.host,r.hostname=e.hostname||''===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,A=v;else if(v.length)A||(A=[]),A.pop(),A=A.concat(v),r.search=e.search,r.query=e.query;else if(!d.isNullOrUndefined(e.search)){if(E){r.hostname=r.host=A.shift();var I=!!(r.host&&0=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24,a[o++]=255&e>>>16,a[o++]=255&e>>>8,a[o++]=255&e}else for(a[o++]=255&e,a[o++]=255&e>>>8,a[o++]=255&e>>>16,a[o++]=255&e>>>24,a[o++]=0,a[o++]=0,a[o++]=0,a[o++]=0,d=8;do;o++)r+='00';if(name=n(t),name)for(var d=name.split('.'),o=d.length-1,i;0<=o;o--)i=a(d[o]),r=a(new e(r+i,'hex'));return'0x'+r},t.normalize=n}).call(this,r(4).Buffer)},function(e,t,r){var n=r(40),a=r(177),o=r(178),d=Object.defineProperty;t.f=r(31)?Object.defineProperty:function(e,t,r){if(n(e),t=o(t,!0),n(r),a)try{return d(e,t,r)}catch(t){}if('get'in r||'set'in r)throw TypeError('Accessors not supported!');return'value'in r&&(e[t]=r.value),e}},function(e){e.exports=function(e){return'object'==typeof e?null!==e:'function'==typeof e}},function(e){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e){var t={}.hasOwnProperty;e.exports=function(e,r){return t.call(e,r)}},function(e){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],!e.children&&(e.children=[]),Object.defineProperty(e,'loaded',{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,'id',{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){r(81)('split',2,function(e,t,n){'use strict';var a=r(199),o=n,d=[].push,i='split',s='length',c='lastIndex';if('c'=='abbc'[i](/(b)*/)[1]||4!='test'[i](/(?:)/,-1)[s]||2!='ab'[i](/(?:ab)*/)[s]||4!='.'[i](/(.?)(.?)/)[s]||1<'.'[i](/()()/)[s]||''[i](/.?/)[s]){var f=/()??/.exec('')[1]===void 0;n=function(e,t){var r=this+'';if(void 0===e&&0===t)return[];if(!a(e))return o.call(r,e,t);var n=[],p=(e.ignoreCase?'i':'')+(e.multiline?'m':'')+(e.unicode?'u':'')+(e.sticky?'y':''),l=0,u=void 0===t?4294967295:t>>>0,b=new RegExp(e.source,p+'g'),h,m,y,g,v;for(f||(h=new RegExp('^'+b.source+'$(?!\\s)',p));(m=b.exec(r))&&(y=m.index+m[0][s],!(y>l&&(n.push(r.slice(l,m.index)),!f&&1=u)));)b[c]===m.index&&b[c]++;return l===r[s]?(g||!b.test(''))&&n.push(''):n.push(r.slice(l)),n[s]>u?n.slice(0,u):n}}else'0'[i](void 0,0)[s]&&(n=function(e,t){return void 0===e&&0===t?[]:o.call(this,e,t)});return[function(r,a){var o=e(this),d=r==void 0?void 0:r[t];return d===void 0?n.call(o+'',r,a):d.call(r,o,a)},n]})},function(e,t){'use strict';function r(e,r,n){if(o)throw new Error('unknown error');r||(r=t.UNKNOWN_ERROR),n||(n={});var a=[];Object.keys(n).forEach(function(e){try{a.push(e+'='+JSON.stringify(n[e]))}catch(t){a.push(e+'='+JSON.stringify(n[e].toString()))}});var d=e;a.length&&(e+=' ('+a.join(', ')+')');var i=new Error(e);throw i.reason=d,i.code=r,Object.keys(n).forEach(function(e){i[e]=n[e]}),i}function n(e,n){a&&r('error censorship permanent',t.UNSUPPORTED_OPERATION,{operation:'setCersorship'}),o=!!e,a=!!n}Object.defineProperty(t,'__esModule',{value:!0}),t.UNKNOWN_ERROR='UNKNOWN_ERROR',t.NOT_IMPLEMENTED='NOT_IMPLEMENTED',t.MISSING_NEW='MISSING_NEW',t.CALL_EXCEPTION='CALL_EXCEPTION',t.INVALID_ARGUMENT='INVALID_ARGUMENT',t.MISSING_ARGUMENT='MISSING_ARGUMENT',t.UNEXPECTED_ARGUMENT='UNEXPECTED_ARGUMENT',t.NUMERIC_FAULT='NUMERIC_FAULT',t.UNSUPPORTED_OPERATION='UNSUPPORTED_OPERATION';var a=!1,o=!1;t.throwError=r,t.checkNew=function(e,n){e instanceof n||r('missing new',t.MISSING_NEW,{name:n.name})},t.checkArgumentCount=function(e,n,a){a||(a=''),en&&r('too many arguments'+a,t.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})},t.setCensorship=n},function(e,t,r){'use strict';(function(t){e.exports=t.version&&0!==t.version.indexOf('v0.')&&(0!==t.version.indexOf('v1.')||0===t.version.indexOf('v1.8.'))?t:{nextTick:function(e,r,n,a){if('function'!=typeof e)throw new TypeError('"callback" argument must be a function');var o=arguments.length,d,s;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,a)});default:for(d=Array(o-1),s=0;s=e)return 0;return 6==e>>5?2:14==e>>4?3:30==e>>3?4:-1}function s(e,t,r){var n=t.length-1;if(n=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString('utf16le',t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):'';if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString('utf16le',0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0==r?e.toString('base64',t):(this.lastNeed=3-r,this.lastTotal=3,1==r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString('base64',t,e.length-r))}function u(e){var t=e&&e.length?this.write(e):'';return this.lastNeed?t+this.lastChar.toString('base64',0,3-this.lastNeed):t}function b(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):''}var m=r(7).Buffer,y=m.isEncoding||function(e){switch(e=''+e,e&&e.toLowerCase()){case'hex':case'utf8':case'utf-8':case'ascii':case'binary':case'base64':case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':case'raw':return!0;default:return!1;}};t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return'';var t,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return'';r=this.lastNeed,this.lastNeed=0}else r=0;return r>>24]^d[255&f>>>16]^i[255&p>>>8]^s[255&l]^t[u++],m=o[f>>>24]^d[255&p>>>16]^i[255&l>>>8]^s[255&c]^t[u++],y=o[p>>>24]^d[255&l>>>16]^i[255&c>>>8]^s[255&f]^t[u++],g=o[l>>>24]^d[255&c>>>16]^i[255&f>>>8]^s[255&p]^t[u++],c=h,f=m,p=y,l=g;return h=(n[c>>>24]<<24|n[255&f>>>16]<<16|n[255&p>>>8]<<8|n[255&l])^t[u++],m=(n[f>>>24]<<24|n[255&p>>>16]<<16|n[255&l>>>8]<<8|n[255&c])^t[u++],y=(n[p>>>24]<<24|n[255&l>>>16]<<16|n[255&c>>>8]<<8|n[255&f])^t[u++],g=(n[l>>>24]<<24|n[255&c>>>16]<<16|n[255&f>>>8]<<8|n[255&p])^t[u++],h>>>=0,m>>>=0,y>>>=0,g>>>=0,[h,m,y,g]}function d(e){this._key=n(e),this._reset()}var s=r(7).Buffer,i=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var e=Array(256),r=0;256>r;r++)e[r]=128>r?r<<1:283^r<<1;for(var n=[],a=[],o=[[],[],[],[]],d=[[],[],[],[]],s=0,c=0,f=0,i;256>f;++f){i=c^c<<1^c<<2^c<<3^c<<4,i=99^(i>>>8^255&i),n[s]=i,a[i]=s;var p=e[s],l=e[p],u=e[l],b=257*e[i]^16843008*i;o[0][s]=b<<24|b>>>8,o[1][s]=b<<16|b>>>16,o[2][s]=b<<8|b>>>24,o[3][s]=b,b=16843009*u^65537*l^257*p^16843008*s,d[0][i]=b<<24|b>>>8,d[1][i]=b<<16|b>>>16,d[2][i]=b<<8|b>>>24,d[3][i]=b,0==s?s=c=1:(s=p^e[e[e[u^p]]],c^=e[e[c]])}return{SBOX:n,INV_SBOX:a,SUB_MIX:o,INV_SUB_MIX:d}}();d.blockSize=16,d.keySize=32,d.prototype.blockSize=d.blockSize,d.prototype.keySize=d.keySize,d.prototype._reset=function(){for(var e=this._key,r=e.length,n=r+6,a=4*(n+1),o=[],d=0;d>>24,s=c.SBOX[s>>>24]<<24|c.SBOX[255&s>>>16]<<16|c.SBOX[255&s>>>8]<<8|c.SBOX[255&s],s^=i[0|d/r]<<24):6>>24]<<24|c.SBOX[255&s>>>16]<<16|c.SBOX[255&s>>>8]<<8|c.SBOX[255&s]),o[d]=o[d-r]^s}for(var t=[],f=0;ff||4>=p?l:c.INV_SUB_MIX[0][c.SBOX[l>>>24]]^c.INV_SUB_MIX[1][c.SBOX[255&l>>>16]]^c.INV_SUB_MIX[2][c.SBOX[255&l>>>8]]^c.INV_SUB_MIX[3][c.SBOX[255&l]]}this._nRounds=n,this._keySchedule=o,this._invKeySchedule=t},d.prototype.encryptBlockRaw=function(e){return e=n(e),o(e,this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},d.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=s.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},d.prototype.decryptBlock=function(e){e=n(e);var t=e[1];e[1]=e[3],e[3]=t;var r=o(e,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),a=s.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},d.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},e.exports.AES=d},function(e,t,r){var n=Math.min,a=r(7).Buffer,o=r(34);e.exports=function(e,t,r,d){if(a.isBuffer(e)||(e=a.from(e,'binary')),t&&(a.isBuffer(t)||(t=a.from(t,'binary')),8!==t.length))throw new RangeError('salt should be Buffer with 8 byte length');for(var i=r/8,s=a.alloc(i),c=a.alloc(d||0),f=a.alloc(0),p;0new window.WebSocket(e,t),h=btoa,m=(e)=>new URL(e);else{b=r(212).w3cwebsocket,h=(t)=>e(t).toString('base64');const t=r(42);if(t.URL){const e=t.URL;m=(t)=>new e(t)}else m=r(42).parse}class y{constructor(e,t){this.responseCallbacks={},this.notificationCallbacks=[],this.path=e,t=t||{},this._customTimeout=t.timeout;const r=m(e),n=t.headers||{},a=t.protocol||void 0;r.username&&r.password&&(n.authorization=`Basic ${h(`${r.username}:${r.password}`)}`);const o=t.clientConfig||void 0;r.auth&&(n.authorization=`Basic ${h(r.auth)}`),this.connection=new b(e,a,void 0,n,void 0,o),this.addDefaultEvents(),this.connection.onmessage=(t)=>{const e='string'==typeof t.data?t.data:'';this._parseResponse(e).forEach((e)=>{let t=null;_.isArray(e)?e.forEach((e)=>{this.responseCallbacks[e.id]&&(t=e.id)}):t=e.id,!t&&e&&e.method&&-1!==e.method.indexOf('_subscription')?this.notificationCallbacks.forEach((t)=>{_.isFunction(t)&&t(e)}):this.responseCallbacks[t]&&(this.responseCallbacks[t](null,e),delete this.responseCallbacks[t])})},Object.defineProperty(this,'connected',{get(){return this.connection&&this.connection.readyState===this.connection.OPEN},enumerable:!0})}addDefaultEvents(){this.connection.onerror=()=>{this._timeout()},this.connection.onclose=()=>{this._timeout(),this.reset()}}_parseResponse(e){const t=[],r=e.replace(/\}[\n\r]?\{/g,'}|--|{').replace(/\}\][\n\r]?\[\{/g,'}]|--|[{').replace(/\}[\n\r]?\[\{/g,'}|--|[{').replace(/\}\][\n\r]?\{/g,'}]|--|{').split('|--|');return r.forEach((e)=>{this.lastChunk&&(e=this.lastChunk+e);let r=null;try{r=JSON.parse(e)}catch(t){return this.lastChunk=e,clearTimeout(this.lastChunkTimeout),void(this.lastChunkTimeout=setTimeout(()=>{throw this._timeout(),u.a.InvalidResponse(e)},15000))}clearTimeout(this.lastChunkTimeout),this.lastChunk=null,r&&t.push(r)}),t}_addResponseCallback(e,t){const r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n,this._customTimeout&&setTimeout(()=>{this.responseCallbacks[r]&&(this.responseCallbacks[r](u.a.ConnectionTimeout(this._customTimeout)),delete this.responseCallbacks[r])},this._customTimeout)}_timeout(){for(const e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](u.a.InvalidConnection('on WS')),delete this.responseCallbacks[e])}send(e,t){return this.connection.readyState===this.connection.CONNECTING?void setTimeout(()=>{this.send(e,t)},10):this.connection.readyState===this.connection.OPEN?void(this.connection.send(JSON.stringify(e)),this._addResponseCallback(e,t)):(console.error('connection not open on send()'),'function'==typeof this.connection.onerror?this.connection.onerror(new Error('connection not open')):console.error('no error callback'),void t(new Error('connection not open')))}on(e,t){if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');'data'===e?this.notificationCallbacks.push(t):'connect'===e?this.connection.onopen=t:'end'===e?this.connection.onclose=t:'error'===e?this.connection.onerror=t:void 0}removeListener(e,t){'data'===e?this.notificationCallbacks.forEach((e,r)=>{e===t&&this.notificationCallbacks.splice(r,1)}):void 0}removeAllListeners(e){switch(e){case'data':this.notificationCallbacks=[];break;case'connect':this.connection.onopen=null;break;case'end':this.connection.onclose=null;break;case'error':this.connection.onerror=null;break;default:}}reset(){this._timeout(),this.notificationCallbacks=[],this.addDefaultEvents()}disconnect(){this.connection&&this.connection.close()}}}).call(this,r(4).Buffer)},function(e,t,r){(function(e){var n=r(220),a=r(109),o=r(229),d=r(230),i=r(42),s=t;s.request=function(t,r){t='string'==typeof t?i.parse(t):o(t);var a=-1===e.location.protocol.search(/^https?:$/)?'http:':'',d=t.protocol||a,s=t.hostname||t.host,c=t.port,f=t.path||'/';s&&-1!==s.indexOf(':')&&(s='['+s+']'),t.url=(s?d+'//'+s:'')+(c?':'+c:'')+f,t.method=(t.method||'GET').toUpperCase(),t.headers=t.headers||{};var p=new n(t);return r&&p.on('response',r),p},s.get=function(e,t){var r=s.request(e,t);return r.end(),r},s.ClientRequest=n,s.IncomingMessage=a.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=d,s.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE']}).call(this,r(9))},function(){},function(e,t,r){'use strict';function n(){}var a=r(2),o=r(18),d=r(10),i=r(19),s=r(202),c=r(0),f=r(163);const p=new f.AbiCoder((e,t)=>!e.match(/^u?int/)||Object(c.isArray)(t)||Object(c.isObject)(t)&&'BN'===t.constructor.name?t:t.toString());class l{constructor(e){this.utils=e}encodeFunctionSignature(e){return Object(c.isObject)(e)&&(e=this.utils._jsonInterfaceMethodToString(e)),this.utils.sha3(e).slice(0,10)}encodeEventSignature(e){return Object(c.isObject)(e)&&(e=this.utils._jsonInterfaceMethodToString(e)),this.utils.sha3(e)}encodeParameter(e,t){return this.encodeParameters([e],[t])}encodeParameters(e,t){return p.encode(this.mapTypes(e),t)}mapTypes(e){const t=[];return e.forEach((e)=>{if(this.isSimplifiedStructFormat(e)){const r=Object.keys(e)[0];return void t.push(Object.assign(this.mapStructNameAndType(r),{components:this.mapStructToCoderFormat(e[r])}))}t.push(e)}),t}isSimplifiedStructFormat(e){return'object'==typeof e&&'undefined'==typeof e.components&&'undefined'==typeof e.name}mapStructNameAndType(e){let t='tuple';return-1'object'==typeof e[r]?void t.push(Object.assign(this.mapStructNameAndType(r),{components:this.mapStructToCoderFormat(e[r])})):void t.push({name:r,type:e[r]})),t}encodeFunctionCall(e,t){return this.encodeFunctionSignature(e)+this.encodeParameters(e.inputs,t).replace('0x','')}decodeParameter(e,t){return this.decodeParameters([e],t)[0]}decodeParameters(e,t){if(!t||'0x'===t||'0X'===t)throw new Error('Returned values aren\'t valid, did it run Out of Gas?');const r=p.decode(this.mapTypes(e),`0x${t.replace(/0x/i,'')}`),a=new n;return a.__length__=0,e.forEach((e,t)=>{let n=r[a.__length__];n='0x'===n?null:n,a[t]=n,Object(c.isObject)(e)&&e.name&&(a[e.name]=n),a.__length__++}),a}decodeLog(e,t,r){const a=this;r=Object(c.isArray)(r)?r:[r],t=t||'';const o=[],d=[];let s=0;e.forEach((e,t)=>{e.indexed?(d[t]=['bool','int','uint','address','fixed','ufixed'].find((t)=>-1!==e.type.indexOf(t))?a.decodeParameter(e.type,r[s]):r[s],s++):o[t]=e});const i=t,f=i?this.decodeParameters(o,i):[],p=new n;return p.__length__=0,e.forEach((e,t)=>{p[t]='string'===e.type?'':null,'undefined'!=typeof f[t]&&(p[t]=f[t]),'undefined'!=typeof d[t]&&(p[t]=d[t]),e.name&&(p[e.name]=p[t]),p.__length__++}),p}}class u{createABICoder(e){return new l(e)}}r.d(t,'a',function(){return b});const b=()=>new u().createABICoder(a.a)},function(e,t,r){'use strict';var n=r(18),a=r(19),o=r(57),d=r(2),i=r(3),s=r.n(i);const c=(e,t)=>{let r=e;for(;r.length<2*t;)r=`0${r}`;return r},f=(e)=>{const t=65;return e=e.toUpperCase(),e=e.substr(4)+e.substr(0,4),e.split('').map((e)=>{const r=e.charCodeAt(0);return r>=t&&r<=90?r-t+10:e}).join('')},p=(e)=>{let t=e,r;for(;2e||isNaN(e))throw TypeError('n must be a positive number');return this._maxListeners=e,this},t.prototype.emit=function(e){var t,a,d,s,c,i;if(this._events||(this._events={}),'error'===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length))if(t=arguments[1],t instanceof Error)throw t;else{var f=new Error('Uncaught, unspecified "error" event. ('+t+')');throw f.context=t,f}if(a=this._events[e],o(a))return!1;if(r(a))switch(arguments.length){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),a.apply(this,s);}else if(n(a))for(s=Array.prototype.slice.call(arguments,1),i=a.slice(),d=i.length,c=0;cd&&(this._events[e].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[e].length),'function'==typeof console.trace&&console.trace())),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){function n(){this.removeListener(e,n),a||(a=!0,t.apply(this,arguments))}if(!r(t))throw TypeError('listener must be a function');var a=!1;return n.listener=t,this.on(e,n),this},t.prototype.removeListener=function(e,t){var a,o,d,s;if(!r(t))throw TypeError('listener must be a function');if(!this._events||!this._events[e])return this;if(a=this._events[e],d=a.length,o=-1,a===t||r(a.listener)&&a.listener===t)delete this._events[e],this._events.removeListener&&this.emit('removeListener',e,t);else if(n(a)){for(s=d;0o)return this;1===a.length?(a.length=0,delete this._events[e]):a.splice(o,1),this._events.removeListener&&this.emit('removeListener',e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)'removeListener'!==t&&this.removeAllListeners(t);return this.removeAllListeners('removeListener'),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[],t},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){'use strict';(function(t,n,a){function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){C(t,e)}}function d(e){return L.from(e)}function i(e){return L.isBuffer(e)||e instanceof j}function s(){}function c(e,t){B=B||r(29),e=e||{};var n=t instanceof B;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var a=e.highWaterMark,d=e.writableHighWaterMark,i=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:n&&(d||0===d)?d:i,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||'utf8',this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){g(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function f(e){return B=B||r(29),D.call(f,this)||this instanceof B?void(this._writableState=new c(e,this),this.writable=!0,e&&('function'==typeof e.write&&(this._write=e.write),'function'==typeof e.writev&&(this._writev=e.writev),'function'==typeof e.destroy&&(this._destroy=e.destroy),'function'==typeof e.final&&(this._final=e.final)),M.call(this)):new f(e)}function p(e,t){var r=new Error('write after end');e.emit('error',r),P.nextTick(t,r)}function l(e,t,r,n){var a=!0,o=!1;return null===r?o=new TypeError('May not write null values to stream'):'string'!=typeof r&&void 0!==r&&!t.objectMode&&(o=new TypeError('Invalid non-string/buffer chunk')),o&&(e.emit('error',o),P.nextTick(n,o),a=!1),a}function u(e,t,r){return e.objectMode||!1===e.decodeStrings||'string'!=typeof t||(t=L.from(t,r)),t}function b(e,t,r,n,a,o){if(!r){var d=u(t,n,a);n!==d&&(r=!0,a='buffer',n=d)}var i=t.objectMode?1:n.length;t.length+=i;var s=t.lengthr||this.listeners[e].splice(r,1)}},e.prototype.dispatchEvent=function(e){var t=e.type.toLowerCase();if(e.target=this,this.listeners[t])for(var r=0,n=this.listeners[t],a;r>>32-t}function a(t,r,n,a,d,e,i,c){return 0|o(0|t+(r^n^a)+e+i,c)+d}function d(t,r,n,a,d,e,i,c){return 0|o(0|t+(r&n|~r&a)+e+i,c)+d}function s(t,r,n,a,d,e,i,f){return 0|o(0|t+((r|~n)^a)+e+i,f)+d}function c(t,r,n,a,i,e,c,f){return 0|o(0|t+(r&a|n&~a)+e+c,f)+i}function f(t,r,n,a,i,e,c,f){return 0|o(0|t+(r^(n|~a))+e+c,f)+i}var i=r(4).Buffer,p=r(5),l=r(115),u=Array(16),b=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],g=[0,1518500249,1859775393,2400959708,2840853838],v=[1352829926,1548603684,1836072691,2053994217,0];p(n,l),n.prototype._update=function(){for(var e=u,r=0;16>r;++r)e[r]=this._block.readInt32LE(4*r);for(var n=0|this._a,p=0|this._b,l=0|this._c,k=0|this._d,x=0|this._e,S=0|this._a,w=0|this._b,A=0|this._c,E=0|this._d,I=0|this._e,C=0;80>C;C+=1){var i,P;16>C?(i=a(n,p,l,k,x,e[b[C]],g[0],m[C]),P=f(S,w,A,E,I,e[h[C]],v[0],y[C])):32>C?(i=d(n,p,l,k,x,e[b[C]],g[1],m[C]),P=c(S,w,A,E,I,e[h[C]],v[1],y[C])):48>C?(i=s(n,p,l,k,x,e[b[C]],g[2],m[C]),P=s(S,w,A,E,I,e[h[C]],v[2],y[C])):64>C?(i=c(n,p,l,k,x,e[b[C]],g[3],m[C]),P=d(S,w,A,E,I,e[h[C]],v[3],y[C])):(i=f(n,p,l,k,x,e[b[C]],g[4],m[C]),P=a(S,w,A,E,I,e[h[C]],v[4],y[C])),n=x,x=k,k=o(l,10),l=p,p=i,S=I,I=E,E=o(A,10),A=w,w=P}var T=0|this._b+l+E;this._b=0|this._c+k+I,this._c=0|this._d+x+S,this._d=0|this._e+n+w,this._e=0|this._a+p+A,this._a=T},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56>>32-t}function a(t,r,n,a,d,e,i,c){return 0|o(0|t+(r^n^a)+e+i,c)+d}function d(t,r,n,a,d,e,i,c){return 0|o(0|t+(r&n|~r&a)+e+i,c)+d}function s(t,r,n,a,d,e,i,f){return 0|o(0|t+((r|~n)^a)+e+i,f)+d}function c(t,r,n,a,i,e,c,f){return 0|o(0|t+(r&a|n&~a)+e+c,f)+i}function f(t,r,n,a,i,e,c,f){return 0|o(0|t+(r^(n|~a))+e+c,f)+i}var i=r(4).Buffer,p=r(30),l=r(311),u=Array(16),b=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],g=[0,1518500249,1859775393,2400959708,2840853838],v=[1352829926,1548603684,1836072691,2053994217,0];p(n,l),n.prototype._update=function(){for(var e=u,r=0;16>r;++r)e[r]=this._block.readInt32LE(4*r);for(var n=0|this._a,p=0|this._b,l=0|this._c,k=0|this._d,x=0|this._e,S=0|this._a,w=0|this._b,A=0|this._c,E=0|this._d,I=0|this._e,C=0;80>C;C+=1){var i,P;16>C?(i=a(n,p,l,k,x,e[b[C]],g[0],m[C]),P=f(S,w,A,E,I,e[h[C]],v[0],y[C])):32>C?(i=d(n,p,l,k,x,e[b[C]],g[1],m[C]),P=c(S,w,A,E,I,e[h[C]],v[1],y[C])):48>C?(i=s(n,p,l,k,x,e[b[C]],g[2],m[C]),P=s(S,w,A,E,I,e[h[C]],v[2],y[C])):64>C?(i=c(n,p,l,k,x,e[b[C]],g[3],m[C]),P=d(S,w,A,E,I,e[h[C]],v[3],y[C])):(i=f(n,p,l,k,x,e[b[C]],g[4],m[C]),P=a(S,w,A,E,I,e[h[C]],v[4],y[C])),n=x,x=k,k=o(l,10),l=p,p=i,S=I,I=E,E=o(A,10),A=w,w=P}var T=0|this._b+l+E;this._b=0|this._c+k+I,this._c=0|this._d+x+S,this._d=0|this._e+n+w,this._e=0|this._a+p+A,this._a=T},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56'0x'+e.toString('hex'),i=(e)=>new n(e.slice(2),16),a=(e)=>{const t='0x'+('0x'===e.slice(0,2)?new n(e.slice(2),16):new n(e,10)).toString('hex');return'0x0'==t?'0x':t},s=(e)=>'string'==typeof e?/^0x/.test(e)?e:'0x'+e:'0x'+new n(e).toString('hex'),c=(e)=>i(e).toNumber(),f=(e)=>(t,r)=>d(i(t)[e](i(r))),p=f('add'),l=f('mul'),u=f('div'),b=f('sub');e.exports={toString:(e)=>i(e).toString(10),fromString:a,toNumber:c,fromNumber:s,toEther:(e)=>c(u(e,a('10000000000')))/1e8,fromEther:(e)=>l(s(Math.floor(1e8*e)),a('10000000000')),toUint256:(e)=>o.pad(32,e),add:p,mul:l,div:u,sub:b}},function(e,t,r){(function(e,n){var a;/*! https://mths.be/utf8js v2.0.0 by @mathias */(function(o){function d(e){for(var t=[],r=0,n=e.length,a,o;r=a&&r>>10),a=56320|1023&a),n+=m(a);return n}function s(e){if(55296<=e&&57343>=e)throw Error('Lone surrogate U+'+e.toString(16).toUpperCase()+' is not a scalar value')}function c(e,t){return m(128|63&e>>t)}function f(e){if(0==(4294967168&e))return m(e);var t='';return 0==(4294965248&e)?t=m(192|31&e>>6):0==(4294901760&e)?(s(e),t=m(224|15&e>>12),t+=c(e,6)):0==(4292870144&e)&&(t=m(240|7&e>>18),t+=c(e,12),t+=c(e,6)),t+=m(128|63&e),t}function p(){if(k>=v)throw Error('Invalid byte index');var e=255&g[k];if(k++,128==(192&e))return 63&e;throw Error('Invalid continuation byte')}function l(){var e,t,r,n,a;if(k>v)throw Error('Invalid byte index');if(k==v)return!1;if(e=255&g[k],k++,0==(128&e))return e;if(192==(224&e)){var t=p();if(a=(31&e)<<6|t,128<=a)return a;throw Error('Invalid continuation byte')}if(224==(240&e)){if(t=p(),r=p(),a=(15&e)<<12|t<<6|r,2048<=a)return s(a),a;throw Error('Invalid continuation byte')}if(240==(248&e)&&(t=p(),r=p(),n=p(),a=(15&e)<<18|t<<12|r<<6|n,65536<=a&&1114111>=a))return a;throw Error('Invalid UTF-8 detected')}function u(e){g=d(e),v=g.length,k=0;for(var t=[],r;!1!==(r=l());)t.push(r);return i(t)}var b='object'==typeof e&&e&&e.exports==('object'==typeof t&&t)&&e,h='object'==typeof n&&n;(h.global===h||h.window===h)&&(o=h);var m=String.fromCharCode,y={version:'2.0.0',encode:function(e){for(var t=d(e),r=t.length,n=-1,a='',o;++n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;50>n;++n)this.s[n]=0}function c(e,t,r){d.call(this,e,t,r)}var s='input is invalid type',p='object'==typeof window,l=p?window:{};l.JS_SHA3_NO_WINDOW&&(p=!1);var u=!p&&'object'==typeof self,b=!l.JS_SHA3_NO_NODE_JS&&'object'==typeof n&&n.versions&&n.versions.node;b?l=a:u&&(l=self);var h=!l.JS_SHA3_NO_COMMON_JS&&'object'==typeof e&&e.exports,m=r(199),y=!l.JS_SHA3_NO_ARRAY_BUFFER&&'undefined'!=typeof ArrayBuffer,g=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'],v=[31,7936,2031616,520093696],k=[4,1024,262144,67108864],x=[1,256,65536,16777216],S=[6,1536,393216,100663296],w=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],E=[224,256,384,512],I=[128,256],C=['hex','buffer','arrayBuffer','array','digest'],P={128:168,256:136};(l.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return'[object Array]'===Object.prototype.toString.call(e)}),y&&(l.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return'object'==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var T=function(e,t,r){return function(n){return new d(e,t,e).update(n)[r]()}},B=function(e,t,r){return function(n,a){return new d(e,t,a).update(n)[r]()}},N=function(e,t,r){return function(t,a,o,n){return F['cshake'+e].update(t,a,o,n)[r]()}},R=function(e,t,r){return function(t,n,a,o){return F['kmac'+e].update(t,n,a,o)[r]()}},M=function(e,t,r,n){for(var a=0,o;a>2]|=e[c]<i?n[p>>2]|=i<i?(n[p>>2]|=(192|i>>6)<>2]|=(128|63&i)<i||57344<=i?(n[p>>2]|=(224|i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|63&i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<=a){for(this.start=p-a,this.block=n[d],p=0;p>=8,r=255&e;0>=8,r=255&e,++a;return t?n.push(a):n.unshift(a),this.update(n),n.length},d.prototype.encodeString=function(e){var t=typeof e,r;if('string'!=t){if('object'!=t)throw new Error(s);else if(null===e)throw new Error(s);else if(y&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!y||!ArrayBuffer.isView(e)))throw new Error(s);r=!0}var n=0,a=e.length;if(r)n=a;else for(var o=0,d;od?n+=1:2048>d?n+=2:55296>d||57344<=d?n+=3:(d=65536+((1023&d)<<10|1023&e.charCodeAt(++o)),n+=4);return n+=this.encode(8*n),this.update(e),n},d.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4]+g[15&i]+g[15&i>>12]+g[15&i>>8]+g[15&i>>20]+g[15&i>>16]+g[15&i>>28]+g[15&i>>24];0==o%e&&(W(t),a=0)}return n&&(i=t[a],d+=g[15&i>>4]+g[15&i],1>12]+g[15&i>>8]),2>20]+g[15&i>>16])),d},d.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,a=0,o=0,d=this.outputBits>>3,i;i=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(d);for(var s=new Uint32Array(i);o>8,d[i+2]=255&s>>16,d[i+3]=255&s>>24;0==o%e&&W(t)}return n&&(i=o<<2,s=t[a],d[i]=255&s,1>8),2>16)),d},c.prototype=new d,c.prototype.finalize=function(){return this.encode(this.outputBits,!0),d.prototype.finalize.call(this)};var W=function(e){var t,r,a,n,o,d,i,s,c,f,p,l,u,b,h,m,y,g,v,k,x,S,w,E,I,C,P,T,B,N,R,M,L,j,O,D,U,H,F,q,z,K,V,G,W,X,Y,Z,J,$,Q,ee,te,re,ne,ae,oe,de,ie,se,ce,fe,pe;for(a=0;48>a;a+=2)n=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],d=e[2]^e[12]^e[22]^e[32]^e[42],i=e[3]^e[13]^e[23]^e[33]^e[43],s=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],p=e[7]^e[17]^e[27]^e[37]^e[47],l=e[8]^e[18]^e[28]^e[38]^e[48],u=e[9]^e[19]^e[29]^e[39]^e[49],t=l^(d<<1|i>>>31),r=u^(i<<1|d>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=n^(s<<1|c>>>31),r=o^(c<<1|s>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=d^(f<<1|p>>>31),r=i^(p<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=s^(l<<1|u>>>31),r=c^(u<<1|l>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(n<<1|o>>>31),r=p^(o<<1|n>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,b=e[0],h=e[1],X=e[11]<<4|e[10]>>>28,Y=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,B=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,O=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,fe=e[42]<<2|e[43]>>>30,pe=e[43]<<2|e[42]>>>30,re=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,g=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,$=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,M=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,E=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,ae=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,H=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,k=e[36]<<21|e[37]>>>11,x=e[37]<<21|e[36]>>>11,ee=e[47]<<24|e[46]>>>8,te=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,P=e[19]<<20|e[18]>>>12,de=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,w=e[49]<<14|e[48]>>>18,e[0]=b^~m&g,e[1]=h^~y&v,e[10]=E^~C&T,e[11]=I^~P&B,e[20]=j^~D&H,e[21]=O^~U&F,e[30]=G^~X&Z,e[31]=W^~Y&J,e[40]=re^~ae&de,e[41]=ne^~oe&ie,e[2]=m^~g&k,e[3]=y^~v&x,e[12]=C^~T&N,e[13]=P^~B&R,e[22]=D^~H&q,e[23]=U^~F&z,e[32]=X^~Z&$,e[33]=Y^~J&Q,e[42]=ae^~de&se,e[43]=oe^~ie&ce,e[4]=g^~k&S,e[5]=v^~x&w,e[14]=T^~N&M,e[15]=B^~R&L,e[24]=H^~q&K,e[25]=F^~z&V,e[34]=Z^~$&ee,e[35]=J^~Q&te,e[44]=de^~se&fe,e[45]=ie^~ce&pe,e[6]=k^~S&b,e[7]=x^~w&h,e[16]=N^~M&E,e[17]=R^~L&I,e[26]=q^~K&j,e[27]=z^~V&O,e[36]=$^~ee&G,e[37]=Q^~te&W,e[46]=se^~fe&re,e[47]=ce^~pe&ne,e[8]=S^~b&m,e[9]=w^~h&y,e[18]=M^~E&C,e[19]=L^~I&P,e[28]=K^~j&D,e[29]=V^~O&U,e[38]=ee^~G&X,e[39]=te^~W&Y,e[48]=fe^~re&ae,e[49]=pe^~ne&oe,e[0]^=A[a],e[1]^=A[a+1]};if(h)e.exports=F;else{for(z=0;z=a&&r>>10),e=56320|1023&e),t+=L(e),t}).join('')}function p(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:x}function l(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function u(e,t,r){var n=0;for(e=r?M(e/E):e>>1,e+=M(e/t);e>R*A>>1;n+=x)e=M(e/R);return M(n+(R+1)*e/(e+w))}function b(e){var r=[],a=e.length,o=0,i=C,n=I,s,c,l,b,h,m,y,g,k,t;for(c=e.lastIndexOf(P),0>c&&(c=0),l=0;l=a&&d('invalid-input'),g=p(e.charCodeAt(b++)),(g>=x||g>M((v-o)/m))&&d('overflow'),o+=g*m,k=y<=n?S:y>=n+A?A:y-n,gM(v/t)&&d('overflow'),m*=t}s=r.length+1,n=u(o-h,s,0==h),M(o/s)>v-i&&d('overflow'),i+=M(o/s),o%=s,r.splice(o++,0,i)}return f(r)}function h(e){var r=[],a,n,o,i,s,f,p,b,h,m,t,y,g,k,w;for(e=c(e),y=e.length,a=C,n=0,s=I,f=0;ft&&r.push(L(t));for(o=i=r.length,i&&r.push(P);o=a&&tM((v-n)/g)&&d('overflow'),n+=(p-a)*g,a=p,f=0;fv&&d('overflow'),t==a){for(b=n,h=x;;h+=x){if(m=h<=s?S:h>=s+A?A:h-s,b= 0x80 (not a basic code point)',"invalid-input":'Invalid input'},R=x-S,M=Math.floor,L=String.fromCharCode,j;j={version:'1.4.1',ucs2:{decode:c,encode:f},decode:b,encode:h,toASCII:function(e){return s(e,function(e){return T.test(e)?'xn--'+h(e):e})},toUnicode:function(e){return s(e,function(e){return k.test(e)?b(e.slice(4).toLowerCase()):e})}},a=function(){return j}.call(t,r,t,e),!(a!==void 0&&(e.exports=a))})(this)}).call(this,r(51)(e),r(7))},function(e,t,r){(function(e){function r(){if(i!==void 0)return i;if(e.XMLHttpRequest){i=new e.XMLHttpRequest;try{i.open('GET',e.XDomainRequest?'/':'https://example.com')}catch(t){i=null}}else i=null;return i}function n(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(t){}return!1}function a(e){return'function'==typeof e}t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(t){}var o='undefined'!=typeof e.ArrayBuffer,d=o&&a(e.ArrayBuffer.prototype.slice),i;t.arraybuffer=t.fetch||o&&n('arraybuffer'),t.msstream=!t.fetch&&d&&n('ms-stream'),t.mozchunkedarraybuffer=!t.fetch&&o&&n('moz-chunked-arraybuffer'),t.overrideMimeType=t.fetch||!!r()&&a(r().overrideMimeType),t.vbArray=a(e.VBArray),i=null}).call(this,r(7))},function(e,t,r){(function(e,n,a){var o=r(102),d=r(4),i=r(38),s=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=t.IncomingMessage=function(t,r,d,s){var c=this;if(i.Readable.call(c),c._mode=d,c.headers={},c.rawHeaders=[],c.trailers={},c.rawTrailers=[],c.on('end',function(){e.nextTick(function(){c.emit('close')})}),'fetch'===d){function e(){p.read().then(function(t){return c._destroyed?void 0:t.done?(a.clearTimeout(s),void c.push(null)):void(c.push(new n(t.value)),e())}).catch(function(e){a.clearTimeout(s),c._destroyed||c.emit('error',e)})}if(c._fetchResponse=r,c.url=r.url,c.statusCode=r.status,c.statusMessage=r.statusText,r.headers.forEach(function(e,t){c.headers[t.toLowerCase()]=e,c.rawHeaders.push(t,e)}),o.writableStream){var f=new WritableStream({write:function(e){return new Promise(function(t,r){c._destroyed?r():c.push(new n(e))?t():c._resumeFetch=t})},close:function(){a.clearTimeout(s),c._destroyed||c.push(null)},abort:function(e){c._destroyed||c.emit('error',e)}});try{return void r.body.pipeTo(f).catch(function(e){a.clearTimeout(s),c._destroyed||c.emit('error',e)})}catch(t){}}var p=r.body.getReader();e()}else{c._xhr=t,c._pos=0,c.url=t.responseURL,c.statusCode=t.status,c.statusMessage=t.statusText;var l=t.getAllResponseHeaders().split(/\r?\n/);if(l.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();'set-cookie'===r?(void 0===c.headers[r]&&(c.headers[r]=[]),c.headers[r].push(t[2])):void 0===c.headers[r]?c.headers[r]=t[2]:c.headers[r]+=', '+t[2],c.rawHeaders.push(t[1],t[2])}}),c._charset='x-user-defined',!o.overrideMimeType){var u=c.rawHeaders['mime-type'];if(u){var b=u.match(/;\s*charset=([^;])(;|$)/);b&&(c._charset=b[1].toLowerCase())}c._charset||(c._charset='utf-8')}}};d(c,i.Readable),c.prototype._read=function(){var e=this,t=e._resumeFetch;t&&(e._resumeFetch=null,t())},c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,r=null;switch(e._mode){case'text:vbarray':if(t.readyState!==s.DONE)break;try{r=new a.VBArray(t.responseBody).toArray()}catch(t){}if(null!==r){e.push(new n(r));break}case'text':try{r=t.responseText}catch(t){e._mode='text:vbarray';break}if(r.length>e._pos){var o=r.substr(e._pos);if('x-user-defined'===e._charset){for(var d=new n(o.length),c=0;ce._pos&&(e.push(new n(new Uint8Array(i.result.slice(e._pos)))),e._pos=i.result.byteLength)},i.onload=function(){e.push(null)},i.readAsArrayBuffer(r);}e._xhr.readyState===s.DONE&&'ms-stream'!==e._mode&&e.push(null)}}).call(this,r(9),r(3).Buffer,r(7))},function(e,t,r){'use strict';(function(t,n){function a(e){return U.from(e)}function o(e){return U.isBuffer(e)||e instanceof H}function d(e,t,r){return'function'==typeof e.prependListener?e.prependListener(t,r):void(e._events&&e._events[t]?M(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r))}function i(e,t){L=L||r(26),e=e||{};var n=t instanceof L;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var a=e.highWaterMark,o=e.readableHighWaterMark,d=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:n&&(o||0===o)?o:d,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new K,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||'utf8',this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(!G&&(G=r(55).StringDecoder),this.decoder=new G(e.encoding),this.encoding=e.encoding)}function s(e){return L=L||r(26),this instanceof s?void(this._readableState=new i(e,this),this.readable=!0,e&&('function'==typeof e.read&&(this._read=e.read),'function'==typeof e.destroy&&(this._destroy=e.destroy)),D.call(this)):new s(e)}function c(e,t,r,n,o){var d=e._readableState;if(null===t)d.reading=!1,h(e,d);else{var i;o||(i=p(d,t)),i?e.emit('error',i):d.objectMode||t&&0=X?e=X:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function b(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function h(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,m(e)}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(z('emitReadable',t.flowing),t.emittedReadable=!0,t.sync?R.nextTick(y,e):y(e))}function y(e){z('emit readable'),e.emit('readable'),A(e)}function g(e,t){t.readingMore||(t.readingMore=!0,R.nextTick(v,e,t))}function v(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(''):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=I(e,t.buffer,t.decoder),r}function I(e,t,r){var n;return eo.length?o.length:e;if(a+=d===o.length?o:o.slice(0,e),e-=d,0===e){d===o.length?(++n,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=o.slice(d));break}++n}return t.length-=n,a}function P(e,t){var r=U.allocUnsafe(e),n=t.head,a=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,d=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,d),e-=d,0===e){d===o.length?(++a,t.head=n.next?n.next:t.tail=null):(t.head=n,n.data=o.slice(d));break}++a}return t.length-=a,r}function T(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return z('read: emitReadable',t.length,t.ended),0===t.length&&t.ended?T(this):m(this),null;if(e=b(e,t),0===e&&t.ended)return 0===t.length&&T(this),null;var n=t.needReadable;z('need readable',n),(0===t.length||t.length-e=this._blockSize;){for(var d=this._blockOffset;dr;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error('_digest is not implemented')},e.exports=a},function(e,t,r){function n(){this.init(),this._w=b,f.call(this,64,56)}function o(e,t,r){return r^e&(t^r)}function i(e,t,r){return e&t|r&(e|t)}function s(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function p(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function a(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}var c=r(4),f=r(33),l=r(6).Buffer,u=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=Array(64);c(n,f),n.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},n.prototype._update=function(t){for(var r=this._w,n=0|this._a,l=0|this._b,b=0|this._c,c=0|this._d,m=0|this._e,e=0|this._f,f=0|this._g,y=0|this._h,h=0;16>h;++h)r[h]=t.readInt32BE(4*h);for(;64>h;++h)r[h]=0|d(r[h-2])+r[h-7]+a(r[h-15])+r[h-16];for(var g=0;64>g;++g){var v=0|y+p(m)+o(m,e,f)+u[g]+r[g],k=0|s(n)+i(n,l,b);y=f,f=e,e=m,m=0|c+v,c=b,b=l,l=n,n=0|v+k}this._a=0|n+this._a,this._b=0|l+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|m+this._e,this._f=0|e+this._f,this._g=0|f+this._g,this._h=0|y+this._h},n.prototype._hash=function(){var e=l.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=y,b.call(this,128,112)}function a(e,t,r){return r^e&(t^r)}function o(e,t,r){return e&t|r&(e|t)}function d(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function i(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function s(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function c(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function f(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function p(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function l(e,t){return e>>>0>>0?1:0}var u=r(4),b=r(33),h=r(6).Buffer,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],y=Array(160);u(n,b),n.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},n.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,u=0|this._ch,b=0|this._dh,h=0|this._eh,y=0|this._fh,g=0|this._gh,v=0|this._hh,k=0|this._al,x=0|this._bl,S=0|this._cl,w=0|this._dl,A=0|this._el,E=0|this._fl,I=0|this._gl,C=0|this._hl,P=0;32>P;P+=2)t[P]=e.readInt32BE(4*P),t[P+1]=e.readInt32BE(4*P+4);for(;160>P;P+=2){var T=t[P-30],B=t[P-30+1],N=s(T,B),R=c(B,T);T=t[P-4],B=t[P-4+1];var M=f(T,B),L=p(B,T),O=t[P-14],D=t[P-14+1],U=t[P-32],H=t[P-32+1],F=0|R+D,q=0|N+O+l(F,R);F=0|F+L,q=0|q+M+l(F,L),F=0|F+H,q=0|q+U+l(F,H),t[P]=q,t[P+1]=F}for(var z=0;160>z;z+=2){q=t[z],F=t[z+1];var j=o(r,n,u),K=o(k,x,S),V=d(r,k),G=d(k,r),W=i(h,A),X=i(A,h),Y=m[z],Z=m[z+1],J=a(h,y,g),$=a(A,E,I),Q=0|C+X,ee=0|v+W+l(Q,C);Q=0|Q+$,ee=0|ee+J+l(Q,$),Q=0|Q+Z,ee=0|ee+Y+l(Q,Z),Q=0|Q+F,ee=0|ee+q+l(Q,F);var te=0|G+K,re=0|V+j+l(te,G);v=g,C=I,g=y,I=E,y=h,E=A,A=0|w+Q,h=0|b+ee+l(A,w),b=u,w=S,u=n,S=x,n=r,x=k,k=0|Q+te,r=0|ee+re+l(k,Q)}this._al=0|this._al+k,this._bl=0|this._bl+x,this._cl=0|this._cl+S,this._dl=0|this._dl+w,this._el=0|this._el+A,this._fl=0|this._fl+E,this._gl=0|this._gl+I,this._hl=0|this._hl+C,this._ah=0|this._ah+r+l(this._al,k),this._bh=0|this._bh+n+l(this._bl,x),this._ch=0|this._ch+u+l(this._cl,S),this._dh=0|this._dh+b+l(this._dl,w),this._eh=0|this._eh+h+l(this._el,A),this._fh=0|this._fh+y+l(this._fl,E),this._gh=0|this._gh+g+l(this._gl,I),this._hh=0|this._hh+v+l(this._hl,C)},n.prototype._hash=function(){function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}var t=h.allocUnsafe(64);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},e.exports=n},function(e,t,r){'use strict';function n(e,t){d.call(this,'digest'),'string'==typeof t&&(t=s.from(t));var r='sha512'===e||'sha384'===e?128:64;if(this._alg=e,this._key=t,t.length>r){var n='rmd160'===e?new c:f(e);t=n.update(t).digest()}else t.lengthn)throw new TypeError('Bad iterations');if('number'!=typeof a)throw new TypeError('Key length not a number');if(0>a||a>1073741823||a!==a)throw new TypeError('Bad key length')}}).call(this,r(3).Buffer)},function(e,t,r){(function(t){var r;if(t.browser)r='utf-8';else{var n=parseInt(t.version.split('.')[0].slice(1),10);r=6<=n?'utf-8':'binary'}e.exports=r}).call(this,r(9))},function(e,t,r){function n(e,t,r){var n=a(e),o='sha512'===e||'sha384'===e?128:64;t.length>o?t=n(t):t.lengtht&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error('Unsupported state or unable to authenticate data');var e=p(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&n(e,this._authTag))throw new Error('Unsupported state or unable to authenticate data');this._authTag=e,this._cipher.scrub()},o.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error('Attempting to get auth tag in unsupported state');return this._authTag},o.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error('Attempting to set auth tag in unsupported state');this._authTag=e},o.prototype.setAAD=function(e){if(this._called)throw new Error('Attempting to set AAD in unsupported state');this._ghash.update(e),this._alen+=e.length},e.exports=o},function(e,t,r){function n(e,t,r,n){d.call(this),this._cipher=new a.AES(t),this._prev=o.from(r),this._cache=o.allocUnsafe(0),this._secCache=o.allocUnsafe(0),this._decrypt=n,this._mode=e}var a=r(59),o=r(6).Buffer,d=r(20),i=r(4);i(n,d),n.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},n.prototype._final=function(){this._cipher.scrub()},e.exports=n},function(e,t,r){(function(e){function n(t,r,o,s){return e.isBuffer(r)||void 0===i[r]?n(t,'binary',r,o):(r=r||'binary',s=s||'binary',o=o||new e([2]),e.isBuffer(o)||(o=new e(o,s)),'number'==typeof t)?new d(a(t,o),o,!0):(e.isBuffer(t)||(t=new e(t,r)),new d(t,o,!0))}var a=r(126),o=r(259),d=r(260),i={binary:!0,hex:!0,base64:!0};t.DiffieHellmanGroup=t.createDiffieHellmanGroup=t.getDiffieHellman=function(t){var r=new e(o[t].prime,'hex'),n=new e(o[t].gen,'hex');return new d(r,n)},t.createDiffieHellman=t.DiffieHellman=n}).call(this,r(3).Buffer)},function(e,t,r){function n(){if(null!==A)return A;var e=[];e[0]=2;for(var t=1,r=3,n;r<1048576;r+=2){n=s(Math.sqrt(r));for(var a=0;ae)return 2===t||5===t?new c([140,123]):new c([140,39]);t=new c(t);for(var r,n;;){for(r=new c(i(s(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(b),!t.cmp(b))for(;r.mod(f).cmp(x);)r.iadd(S);else if(!t.cmp(h))for(;r.mod(g).cmp(v);)r.iadd(S);if(n=r.shrn(1),a(n)&&a(r)&&o(n)&&o(r)&&l.test(n)&&l.test(r))return r}}var s=Math.ceil,i=r(30);e.exports=d,d.simpleSieve=a,d.fermatTest=o;var c=r(2),f=new c(24),p=r(127),l=new p,u=new c(1),b=new c(2),h=new c(5),m=new c(16),y=new c(8),g=new c(10),v=new c(3),k=new c(7),x=new c(11),S=new c(4),w=new c(12),A=null},function(e,t,r){function n(e){this.rand=e||new a.Rand}var o=Math.max,c=r(2),a=r(128);e.exports=n,n.create=function(e){return new n(e)},n.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do var n=new c(this.rand.generate(r));while(0<=n.cmp(e));return n},n.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},n.prototype.test=function(e,t,r){var n=e.bitLength(),f=c.mont(e),p=new c(1).toRed(f);t||(t=o(1,0|n/48));for(var l=e.subn(1),u=0;!l.testn(u);u++);for(var s=e.shrn(u),d=l.toRed(f),b=!0;0>8,d=255&a;o?r.push(o,d):r.push(d)}return r},a.zero2=r,a.toHex=n,a.encode=function(e,t){return'hex'===t?n(e):e}},function(e,t,r){'use strict';function n(e,t,r){return e&t^~e&r}function a(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}var d=r(17),i=d.rotr32;t.ft_1=function(e,t,r,d){return 0===e?n(t,r,d):1===e||3===e?o(t,r,d):2===e?a(t,r,d):void 0},t.ch32=n,t.maj32=a,t.p32=o,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},function(e,t,r){'use strict';function n(){return this instanceof n?void(i.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=h,this.W=Array(64)):new n}var a=r(17),o=r(43),d=r(131),s=r(12),p=a.sum32,c=a.sum32_4,l=a.sum32_5,u=d.ch32,m=d.maj32,y=d.s0_256,v=d.s1_256,f=d.g0_256,b=d.g1_256,i=o.BlockHash,h=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];a.inherits(n,i),e.exports=n,n.blockSize=512,n.outSize=256,n.hmacStrength=192,n.padLength=64,n.prototype._update=function(t,r){for(var n=this.W,o=0;16>o;o++)n[o]=t[r+o];for(;od&&(d+=4294967296),d}function o(e,t,n,a,o,d){var i=t&a^~t&d;return 0>i&&(i+=4294967296),i}function d(e,t,n,a,o){var d=e&n^e&o^n&o;return 0>d&&(d+=4294967296),d}function s(e,t,n,a,o,d){var i=t&a^t&d^a&d;return 0>i&&(i+=4294967296),i}function c(e,t){var n=v(e,t,28),a=v(t,e,2),o=v(t,e,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function f(e,t){var n=k(e,t,28),a=k(t,e,2),o=k(t,e,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function p(e,t){var n=v(e,t,14),a=v(e,t,18),o=v(t,e,9),d=n^a^o;return 0>d&&(d+=4294967296),d}function l(e,t){var n=k(e,t,14),a=k(e,t,18),o=k(t,e,9),d=n^a^o;return 0>d&&(d+=4294967296),d}function u(e,t){var n=v(e,t,1),a=v(e,t,8),o=x(e,t,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function b(e,t){var n=k(e,t,1),a=k(e,t,8),o=S(e,t,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function h(e,t){var n=v(e,t,19),a=v(t,e,29),o=x(e,t,6),d=n^a^o;return 0>d&&(d+=4294967296),d}function m(e,t){var n=k(e,t,19),a=k(t,e,29),o=S(e,t,6),d=n^a^o;return 0>d&&(d+=4294967296),d}var i=r(17),y=r(43),g=r(12),v=i.rotr64_hi,k=i.rotr64_lo,x=i.shr64_hi,S=i.shr64_lo,w=i.sum64,A=i.sum64_hi,E=i.sum64_lo,I=i.sum64_4_hi,C=i.sum64_4_lo,P=i.sum64_5_hi,T=i.sum64_5_lo,B=y.BlockHash,N=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];i.inherits(n,B),e.exports=n,n.blockSize=1024,n.outSize=512,n.hmacStrength=192,n.padLength=128,n.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;32>n;n++)r[n]=e[t+n];for(;n=e))return t.error('non-byte EncoderBuffer value');this.value=e,this.length=1}else if('string'==typeof e)this.value=e,this.length=i.byteLength(e);else if(i.isBuffer(e))this.value=e,this.length=e.length;else return t.error('Unsupported type: '+typeof e)}var o=r(4),d=r(45).Reporter,i=r(3).Buffer;o(n,d),t.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:d.prototype.save.call(this)}},n.prototype.restore=function(e){var t=new n(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,d.prototype.restore.call(this,e.reporter),t},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||'DecoderBuffer overrun')},n.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||'DecoderBuffer overrun');var r=new n(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},n.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function(e,t){return(e||(e=new i(this.length)),t||(t=0),0===this.length)?e:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):('number'==typeof this.value?e[t]=this.value:'string'==typeof this.value?e.write(this.value,t):i.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},function(e,t,r){var n=t;n._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0);var n=e[r];t[n]=r}),t},n.der=r(289)},function(e,t,r){function n(e){this.enc='der',this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){c.Node.call(this,'der',e)}function o(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var n=p.tagClass[r>>6],a=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;var d=p.tag[r];return{cls:n,primitive:a,tag:r,tagStr:d}}function d(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;var a=127&n;if(4n?2e3+n:1900+n}else return e.error('Decoding '+t+' time is not supported yet');return Date.UTC(n,a-1,o,d,i,s,0)},a.prototype._decodeNull=function(){return null},a.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},a.prototype._decodeInt=function(e,t){var r=e.raw(),n=new f(r);return t&&(n=t[n.toString(10)]||n),n},a.prototype._use=function(e,t){return'function'==typeof e&&(e=e(t)),e._getDecoder('der').tree}},function(e,t,r){function n(e){this.enc='der',this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){f.Node.call(this,'der',e)}function o(e){return 10>e?'0'+e:e}function d(e,t,r,n){var a;if('seqof'===e?e='seq':'setof'==e&&(e='set'),p.tagByName.hasOwnProperty(e))a=p.tagByName[e];else if('number'==typeof e&&(0|e)===e)a=e;else return n.error('Unknown tag: '+e);return 31<=a?n.error('Multi-octet tag encoding unsupported'):(t||(a|=32),a|=p.tagClassByName[r||'universal']<<6,a)}var i=r(4),s=r(3).Buffer,c=r(44),f=c.base,p=c.constants.der;e.exports=n,n.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(a,f.Node),a.prototype._encodeComposite=function(e,t,r,n){var a=d(e,t,r,this.reporter);if(128>n.length){var o=new s(2);return o[0]=a,o[1]=n.length,this._createEncoderBuffer([o,n])}for(var c=1,f=n.length;256<=f;f>>=8)c++;var o=new s(2+c);o[0]=a,o[1]=128|c;for(var f=1+c,i=n.length;0>=8)o[f]=255&i;return this._createEncoderBuffer([o,n])},a.prototype._encodeStr=function(e,t){if('bitstr'===t)return this._createEncoderBuffer([0|e.unused,e.data]);if('bmpstr'===t){for(var r=new s(2*e.length),n=0;n>=7)a++;for(var d=new s(a),i=d.length-1,n=e.length-1,o;0<=n;n--)for(o=e[n],d[i--]=127&o;0<(o>>=7);)d[i--]=128|127&o;return this._createEncoderBuffer(d)},a.prototype._encodeTime=function(e,t){var r=new Date(e),n;return'gentime'===t?n=[o(r.getFullYear()),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),'Z'].join(''):'utctime'===t?n=[o(r.getFullYear()%100),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),'Z'].join(''):this.reporter.error('Encoding '+t+' time is not supported yet'),this._encodeStr(n,'octstr')},a.prototype._encodeNull=function(){return this._createEncoderBuffer('')},a.prototype._encodeInt=function(e,t){if('string'==typeof e){if(!t)return this.reporter.error('String int or enum given, but no values map');if(!t.hasOwnProperty(e))return this.reporter.error('Values map doesn\'t contain: '+JSON.stringify(e));e=t[e]}if('number'!=typeof e&&!s.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new s(r)}if(s.isBuffer(e)){var n=e.length;0===e.length&&n++;var a=new s(n);return e.copy(a),0===e.length&&(a[0]=0),this._createEncoderBuffer(a)}if(128>e)return this._createEncoderBuffer(e);if(256>e)return this._createEncoderBuffer([0,e]);for(var n=1,o=e;256<=o;o>>=8)n++;for(var a=Array(n),o=a.length-1;0<=o;o--)a[o]=255&e,e>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(new s(a))},a.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},a.prototype._use=function(e,t){return'function'==typeof e&&(e=e(t)),e._getEncoder('der').tree},a.prototype._skipDefault=function(e,t,r){var n=this._baseState,a;if(null===n['default'])return!1;var o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n['default'],t,r).join()),o.length!==n.defaultBuffer.length)return!1;for(a=0;an)throw new TypeError('Bad iterations');if('number'!=typeof a)throw new TypeError('Key length not a number');if(0>a||a>1073741823||a!==a)throw new TypeError('Bad key length')}}).call(this,r(3).Buffer)},function(e,t,r){(function(t){var r;if(t.browser)r='utf-8';else{var n=parseInt(t.version.split('.')[0].slice(1),10);r=6<=n?'utf-8':'binary'}e.exports=r}).call(this,r(9))},function(e,t,r){function n(e,t,r){var n=a(e),o='sha512'===e||'sha384'===e?128:64;t.length>o?t=n(t):t.lengthe;e++)0==(3&e)&&(t=4294967296*Math.random()),n[e]=255&t>>>((3&e)<<3);return n}}},function(e){function t(e,t){var n=t||0,a=r;return[a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]]].join('')}for(var r=[],n=0;256>n;++n)r[n]=(n+256).toString(16).substr(1);e.exports=t},function(e,t,r){(function(n){function a(e){var t=new n(4);return t.writeUInt32BE(e,0),t}var o=r(63);e.exports=function(e,r){for(var d=new n(''),t=0,i;d.length>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;50>n;++n)this.s[n]=0}function c(e,t,r){d.call(this,e,t,r)}var s='input is invalid type',p='object'==typeof window,l=p?window:{};l.JS_SHA3_NO_WINDOW&&(p=!1);var u=!p&&'object'==typeof self,b=!l.JS_SHA3_NO_NODE_JS&&'object'==typeof n&&n.versions&&n.versions.node;b?l=a:u&&(l=self);var h=!l.JS_SHA3_NO_COMMON_JS&&'object'==typeof e&&e.exports,m=r(205),y=!l.JS_SHA3_NO_ARRAY_BUFFER&&'undefined'!=typeof ArrayBuffer,g=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'],v=[31,7936,2031616,520093696],k=[4,1024,262144,67108864],x=[1,256,65536,16777216],S=[6,1536,393216,100663296],w=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],E=[224,256,384,512],I=[128,256],C=['hex','buffer','arrayBuffer','array','digest'],P={128:168,256:136};(l.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return'[object Array]'===Object.prototype.toString.call(e)}),y&&(l.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return'object'==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var T=function(e,t,r){return function(n){return new d(e,t,e).update(n)[r]()}},B=function(e,t,r){return function(n,a){return new d(e,t,a).update(n)[r]()}},N=function(e,t,r){return function(t,a,o,n){return F['cshake'+e].update(t,a,o,n)[r]()}},R=function(e,t,r){return function(t,n,a,o){return F['kmac'+e].update(t,n,a,o)[r]()}},M=function(e,t,r,n){for(var a=0,o;a>2]|=e[c]<i?n[p>>2]|=i<i?(n[p>>2]|=(192|i>>6)<>2]|=(128|63&i)<i||57344<=i?(n[p>>2]|=(224|i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|63&i>>12)<>2]|=(128|63&i>>6)<>2]|=(128|63&i)<=a){for(this.start=p-a,this.block=n[d],p=0;p>=8,r=255&e;0>=8,r=255&e,++a;return t?n.push(a):n.unshift(a),this.update(n),n.length},d.prototype.encodeString=function(e){var t=typeof e,r;if('string'!=t){if('object'!=t)throw new Error(s);else if(null===e)throw new Error(s);else if(y&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!y||!ArrayBuffer.isView(e)))throw new Error(s);r=!0}var n=0,a=e.length;if(r)n=a;else for(var o=0,d;od?n+=1:2048>d?n+=2:55296>d||57344<=d?n+=3:(d=65536+((1023&d)<<10|1023&e.charCodeAt(++o)),n+=4);return n+=this.encode(8*n),this.update(e),n},d.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4]+g[15&i]+g[15&i>>12]+g[15&i>>8]+g[15&i>>20]+g[15&i>>16]+g[15&i>>28]+g[15&i>>24];0==o%e&&(W(t),a=0)}return n&&(i=t[a],d+=g[15&i>>4]+g[15&i],1>12]+g[15&i>>8]),2>20]+g[15&i>>16])),d},d.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,a=0,o=0,d=this.outputBits>>3,i;i=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(d);for(var s=new Uint32Array(i);o>8,d[i+2]=255&s>>16,d[i+3]=255&s>>24;0==o%e&&W(t)}return n&&(i=o<<2,s=t[a],d[i]=255&s,1>8),2>16)),d},c.prototype=new d,c.prototype.finalize=function(){return this.encode(this.outputBits,!0),d.prototype.finalize.call(this)};var W=function(e){var t,r,a,n,o,d,i,s,c,f,p,l,u,b,h,m,y,g,v,k,x,S,w,E,I,C,P,T,B,N,R,M,L,j,O,D,U,H,F,q,z,K,V,G,W,X,Y,Z,J,$,Q,ee,te,re,ne,ae,oe,de,ie,se,ce,fe,pe;for(a=0;48>a;a+=2)n=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],d=e[2]^e[12]^e[22]^e[32]^e[42],i=e[3]^e[13]^e[23]^e[33]^e[43],s=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],p=e[7]^e[17]^e[27]^e[37]^e[47],l=e[8]^e[18]^e[28]^e[38]^e[48],u=e[9]^e[19]^e[29]^e[39]^e[49],t=l^(d<<1|i>>>31),r=u^(i<<1|d>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=n^(s<<1|c>>>31),r=o^(c<<1|s>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=d^(f<<1|p>>>31),r=i^(p<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=s^(l<<1|u>>>31),r=c^(u<<1|l>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(n<<1|o>>>31),r=p^(o<<1|n>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,b=e[0],h=e[1],X=e[11]<<4|e[10]>>>28,Y=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,B=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,j=e[2]<<1|e[3]>>>31,O=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,fe=e[42]<<2|e[43]>>>30,pe=e[43]<<2|e[42]>>>30,re=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,g=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,$=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,M=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,E=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,ae=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,H=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,k=e[36]<<21|e[37]>>>11,x=e[37]<<21|e[36]>>>11,ee=e[47]<<24|e[46]>>>8,te=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,P=e[19]<<20|e[18]>>>12,de=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,w=e[49]<<14|e[48]>>>18,e[0]=b^~m&g,e[1]=h^~y&v,e[10]=E^~C&T,e[11]=I^~P&B,e[20]=j^~D&H,e[21]=O^~U&F,e[30]=G^~X&Z,e[31]=W^~Y&J,e[40]=re^~ae&de,e[41]=ne^~oe&ie,e[2]=m^~g&k,e[3]=y^~v&x,e[12]=C^~T&N,e[13]=P^~B&R,e[22]=D^~H&q,e[23]=U^~F&z,e[32]=X^~Z&$,e[33]=Y^~J&Q,e[42]=ae^~de&se,e[43]=oe^~ie&ce,e[4]=g^~k&S,e[5]=v^~x&w,e[14]=T^~N&M,e[15]=B^~R&L,e[24]=H^~q&K,e[25]=F^~z&V,e[34]=Z^~$&ee,e[35]=J^~Q&te,e[44]=de^~se&fe,e[45]=ie^~ce&pe,e[6]=k^~S&b,e[7]=x^~w&h,e[16]=N^~M&E,e[17]=R^~L&I,e[26]=q^~K&j,e[27]=z^~V&O,e[36]=$^~ee&G,e[37]=Q^~te&W,e[46]=se^~fe&re,e[47]=ce^~pe&ne,e[8]=S^~b&m,e[9]=w^~h&y,e[18]=M^~E&C,e[19]=L^~I&P,e[28]=K^~j&D,e[29]=V^~O&U,e[38]=ee^~G&X,e[39]=te^~W&Y,e[48]=fe^~re&ae,e[49]=pe^~ne&oe,e[0]^=A[a],e[1]^=A[a+1]};if(h)e.exports=F;else{for(z=0;z=a&&r>>10),e=56320|1023&e),t+=L(e),t}).join('')}function p(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:x}function l(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function u(e,t,r){var n=0;for(e=r?M(e/E):e>>1,e+=M(e/t);e>R*A>>1;n+=x)e=M(e/R);return M(n+(R+1)*e/(e+w))}function b(e){var r=[],a=e.length,o=0,i=C,n=I,s,c,l,b,h,m,y,g,k,t;for(c=e.lastIndexOf(P),0>c&&(c=0),l=0;l=a&&d('invalid-input'),g=p(e.charCodeAt(b++)),(g>=x||g>M((v-o)/m))&&d('overflow'),o+=g*m,k=y<=n?S:y>=n+A?A:y-n,gM(v/t)&&d('overflow'),m*=t}s=r.length+1,n=u(o-h,s,0==h),M(o/s)>v-i&&d('overflow'),i+=M(o/s),o%=s,r.splice(o++,0,i)}return f(r)}function h(e){var r=[],a,n,o,i,s,f,p,b,h,m,t,y,g,k,w;for(e=c(e),y=e.length,a=C,n=0,s=I,f=0;ft&&r.push(L(t));for(o=i=r.length,i&&r.push(P);o=a&&tM((v-n)/g)&&d('overflow'),n+=(p-a)*g,a=p,f=0;fv&&d('overflow'),t==a){for(b=n,h=x;;h+=x){if(m=h<=s?S:h>=s+A?A:h-s,b= 0x80 (not a basic code point)',"invalid-input":'Invalid input'},R=x-S,M=Math.floor,L=String.fromCharCode,j;j={version:'1.4.1',ucs2:{decode:c,encode:f},decode:b,encode:h,toASCII:function(e){return s(e,function(e){return T.test(e)?'xn--'+h(e):e})},toUnicode:function(e){return s(e,function(e){return k.test(e)?b(e.slice(4).toLowerCase()):e})}},a=function(){return j}.call(t,r,t,e),!(a!==void 0&&(e.exports=a))})(this)}).call(this,r(56)(e),r(9))},function(e,t,r){(function(e){function r(){if(i!==void 0)return i;if(e.XMLHttpRequest){i=new e.XMLHttpRequest;try{i.open('GET',e.XDomainRequest?'/':'https://example.com')}catch(t){i=null}}else i=null;return i}function n(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(t){}return!1}function a(e){return'function'==typeof e}t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(t){}var o='undefined'!=typeof e.ArrayBuffer,d=o&&a(e.ArrayBuffer.prototype.slice),i;t.arraybuffer=t.fetch||o&&n('arraybuffer'),t.msstream=!t.fetch&&d&&n('ms-stream'),t.mozchunkedarraybuffer=!t.fetch&&o&&n('moz-chunked-arraybuffer'),t.overrideMimeType=t.fetch||!!r()&&a(r().overrideMimeType),t.vbArray=a(e.VBArray),i=null}).call(this,r(9))},function(e,t,r){(function(e,n,a){var o=r(108),d=r(5),i=r(43),s=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=t.IncomingMessage=function(t,r,d,s){var c=this;if(i.Readable.call(c),c._mode=d,c.headers={},c.rawHeaders=[],c.trailers={},c.rawTrailers=[],c.on('end',function(){e.nextTick(function(){c.emit('close')})}),'fetch'===d){function e(){p.read().then(function(t){return c._destroyed?void 0:t.done?(a.clearTimeout(s),void c.push(null)):void(c.push(new n(t.value)),e())}).catch(function(e){a.clearTimeout(s),c._destroyed||c.emit('error',e)})}if(c._fetchResponse=r,c.url=r.url,c.statusCode=r.status,c.statusMessage=r.statusText,r.headers.forEach(function(e,t){c.headers[t.toLowerCase()]=e,c.rawHeaders.push(t,e)}),o.writableStream){var f=new WritableStream({write:function(e){return new Promise(function(t,r){c._destroyed?r():c.push(new n(e))?t():c._resumeFetch=t})},close:function(){a.clearTimeout(s),c._destroyed||c.push(null)},abort:function(e){c._destroyed||c.emit('error',e)}});try{return void r.body.pipeTo(f).catch(function(e){a.clearTimeout(s),c._destroyed||c.emit('error',e)})}catch(t){}}var p=r.body.getReader();e()}else{c._xhr=t,c._pos=0,c.url=t.responseURL,c.statusCode=t.status,c.statusMessage=t.statusText;var l=t.getAllResponseHeaders().split(/\r?\n/);if(l.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();'set-cookie'===r?(void 0===c.headers[r]&&(c.headers[r]=[]),c.headers[r].push(t[2])):void 0===c.headers[r]?c.headers[r]=t[2]:c.headers[r]+=', '+t[2],c.rawHeaders.push(t[1],t[2])}}),c._charset='x-user-defined',!o.overrideMimeType){var u=c.rawHeaders['mime-type'];if(u){var b=u.match(/;\s*charset=([^;])(;|$)/);b&&(c._charset=b[1].toLowerCase())}c._charset||(c._charset='utf-8')}}};d(c,i.Readable),c.prototype._read=function(){var e=this,t=e._resumeFetch;t&&(e._resumeFetch=null,t())},c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,r=null;switch(e._mode){case'text:vbarray':if(t.readyState!==s.DONE)break;try{r=new a.VBArray(t.responseBody).toArray()}catch(t){}if(null!==r){e.push(new n(r));break}case'text':try{r=t.responseText}catch(t){e._mode='text:vbarray';break}if(r.length>e._pos){var o=r.substr(e._pos);if('x-user-defined'===e._charset){for(var d=new n(o.length),c=0;ce._pos&&(e.push(new n(new Uint8Array(i.result.slice(e._pos)))),e._pos=i.result.byteLength)},i.onload=function(){e.push(null)},i.readAsArrayBuffer(r);}e._xhr.readyState===s.DONE&&'ms-stream'!==e._mode&&e.push(null)}}).call(this,r(11),r(4).Buffer,r(9))},function(e,t,r){'use strict';(function(t,n){function a(e){return U.from(e)}function o(e){return U.isBuffer(e)||e instanceof H}function d(e,t,r){return'function'==typeof e.prependListener?e.prependListener(t,r):void(e._events&&e._events[t]?M(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r))}function i(e,t){L=L||r(29),e=e||{};var n=t instanceof L;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var a=e.highWaterMark,o=e.readableHighWaterMark,d=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:n&&(o||0===o)?o:d,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new K,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||'utf8',this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(!G&&(G=r(60).StringDecoder),this.decoder=new G(e.encoding),this.encoding=e.encoding)}function s(e){return L=L||r(29),this instanceof s?void(this._readableState=new i(e,this),this.readable=!0,e&&('function'==typeof e.read&&(this._read=e.read),'function'==typeof e.destroy&&(this._destroy=e.destroy)),D.call(this)):new s(e)}function c(e,t,r,n,o){var d=e._readableState;if(null===t)d.reading=!1,h(e,d);else{var i;o||(i=p(d,t)),i?e.emit('error',i):d.objectMode||t&&0=X?e=X:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function b(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function h(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,m(e)}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(z('emitReadable',t.flowing),t.emittedReadable=!0,t.sync?R.nextTick(y,e):y(e))}function y(e){z('emit readable'),e.emit('readable'),A(e)}function g(e,t){t.readingMore||(t.readingMore=!0,R.nextTick(v,e,t))}function v(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(''):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=I(e,t.buffer,t.decoder),r}function I(e,t,r){var n;return eo.length?o.length:e;if(a+=d===o.length?o:o.slice(0,e),e-=d,0===e){d===o.length?(++n,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=o.slice(d));break}++n}return t.length-=n,a}function P(e,t){var r=U.allocUnsafe(e),n=t.head,a=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,d=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,d),e-=d,0===e){d===o.length?(++a,t.head=n.next?n.next:t.tail=null):(t.head=n,n.data=o.slice(d));break}++a}return t.length-=a,r}function T(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return z('read: emitReadable',t.length,t.ended),0===t.length&&t.ended?T(this):m(this),null;if(e=b(e,t),0===e&&t.ended)return 0===t.length&&T(this),null;var n=t.needReadable;z('need readable',n),(0===t.length||t.length-e=this._blockSize;){for(var d=this._blockOffset;dr;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error('_digest is not implemented')},e.exports=a},function(e,t,r){function n(){this.init(),this._w=b,f.call(this,64,56)}function o(e,t,r){return r^e&(t^r)}function i(e,t,r){return e&t|r&(e|t)}function s(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function p(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function a(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function d(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}var c=r(5),f=r(36),l=r(7).Buffer,u=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=Array(64);c(n,f),n.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},n.prototype._update=function(t){for(var r=this._w,n=0|this._a,l=0|this._b,b=0|this._c,c=0|this._d,m=0|this._e,e=0|this._f,f=0|this._g,y=0|this._h,h=0;16>h;++h)r[h]=t.readInt32BE(4*h);for(;64>h;++h)r[h]=0|d(r[h-2])+r[h-7]+a(r[h-15])+r[h-16];for(var g=0;64>g;++g){var v=0|y+p(m)+o(m,e,f)+u[g]+r[g],k=0|s(n)+i(n,l,b);y=f,f=e,e=m,m=0|c+v,c=b,b=l,l=n,n=0|v+k}this._a=0|n+this._a,this._b=0|l+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|m+this._e,this._f=0|e+this._f,this._g=0|f+this._g,this._h=0|y+this._h},n.prototype._hash=function(){var e=l.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=y,b.call(this,128,112)}function a(e,t,r){return r^e&(t^r)}function o(e,t,r){return e&t|r&(e|t)}function d(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function i(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function s(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function c(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function f(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function p(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function l(e,t){return e>>>0>>0?1:0}var u=r(5),b=r(36),h=r(7).Buffer,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],y=Array(160);u(n,b),n.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},n.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,u=0|this._ch,b=0|this._dh,h=0|this._eh,y=0|this._fh,g=0|this._gh,v=0|this._hh,k=0|this._al,x=0|this._bl,S=0|this._cl,w=0|this._dl,A=0|this._el,E=0|this._fl,I=0|this._gl,C=0|this._hl,P=0;32>P;P+=2)t[P]=e.readInt32BE(4*P),t[P+1]=e.readInt32BE(4*P+4);for(;160>P;P+=2){var T=t[P-30],B=t[P-30+1],N=s(T,B),R=c(B,T);T=t[P-4],B=t[P-4+1];var M=f(T,B),L=p(B,T),O=t[P-14],D=t[P-14+1],U=t[P-32],H=t[P-32+1],F=0|R+D,q=0|N+O+l(F,R);F=0|F+L,q=0|q+M+l(F,L),F=0|F+H,q=0|q+U+l(F,H),t[P]=q,t[P+1]=F}for(var z=0;160>z;z+=2){q=t[z],F=t[z+1];var j=o(r,n,u),K=o(k,x,S),V=d(r,k),G=d(k,r),W=i(h,A),X=i(A,h),Y=m[z],Z=m[z+1],J=a(h,y,g),$=a(A,E,I),Q=0|C+X,ee=0|v+W+l(Q,C);Q=0|Q+$,ee=0|ee+J+l(Q,$),Q=0|Q+Z,ee=0|ee+Y+l(Q,Z),Q=0|Q+F,ee=0|ee+q+l(Q,F);var te=0|G+K,re=0|V+j+l(te,G);v=g,C=I,g=y,I=E,y=h,E=A,A=0|w+Q,h=0|b+ee+l(A,w),b=u,w=S,u=n,S=x,n=r,x=k,k=0|Q+te,r=0|ee+re+l(k,Q)}this._al=0|this._al+k,this._bl=0|this._bl+x,this._cl=0|this._cl+S,this._dl=0|this._dl+w,this._el=0|this._el+A,this._fl=0|this._fl+E,this._gl=0|this._gl+I,this._hl=0|this._hl+C,this._ah=0|this._ah+r+l(this._al,k),this._bh=0|this._bh+n+l(this._bl,x),this._ch=0|this._ch+u+l(this._cl,S),this._dh=0|this._dh+b+l(this._dl,w),this._eh=0|this._eh+h+l(this._el,A),this._fh=0|this._fh+y+l(this._fl,E),this._gh=0|this._gh+g+l(this._gl,I),this._hh=0|this._hh+v+l(this._hl,C)},n.prototype._hash=function(){function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}var t=h.allocUnsafe(64);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},e.exports=n},function(e,t,r){'use strict';function n(e,t){d.call(this,'digest'),'string'==typeof t&&(t=s.from(t));var r='sha512'===e||'sha384'===e?128:64;if(this._alg=e,this._key=t,t.length>r){var n='rmd160'===e?new c:f(e);t=n.update(t).digest()}else t.lengthn)throw new TypeError('Bad iterations');if('number'!=typeof a)throw new TypeError('Key length not a number');if(0>a||a>1073741823||a!==a)throw new TypeError('Bad key length')}}).call(this,r(4).Buffer)},function(e,t,r){(function(t){var r;if(t.browser)r='utf-8';else{var n=parseInt(t.version.split('.')[0].slice(1),10);r=6<=n?'utf-8':'binary'}e.exports=r}).call(this,r(11))},function(e,t,r){function n(e,t,r){var n=a(e),o='sha512'===e||'sha384'===e?128:64;t.length>o?t=n(t):t.lengtht&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error('Unsupported state or unable to authenticate data');var e=p(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&n(e,this._authTag))throw new Error('Unsupported state or unable to authenticate data');this._authTag=e,this._cipher.scrub()},o.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error('Attempting to get auth tag in unsupported state');return this._authTag},o.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error('Attempting to set auth tag in unsupported state');this._authTag=e},o.prototype.setAAD=function(e){if(this._called)throw new Error('Attempting to set AAD in unsupported state');this._ghash.update(e),this._alen+=e.length},e.exports=o},function(e,t,r){function n(e,t,r,n){d.call(this),this._cipher=new a.AES(t),this._prev=o.from(r),this._cache=o.allocUnsafe(0),this._secCache=o.allocUnsafe(0),this._decrypt=n,this._mode=e}var a=r(64),o=r(7).Buffer,d=r(23),i=r(5);i(n,d),n.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},n.prototype._final=function(){this._cipher.scrub()},e.exports=n},function(e,t,r){(function(e){function n(t,r,o,s){return e.isBuffer(r)||void 0===i[r]?n(t,'binary',r,o):(r=r||'binary',s=s||'binary',o=o||new e([2]),e.isBuffer(o)||(o=new e(o,s)),'number'==typeof t)?new d(a(t,o),o,!0):(e.isBuffer(t)||(t=new e(t,r)),new d(t,o,!0))}var a=r(132),o=r(265),d=r(266),i={binary:!0,hex:!0,base64:!0};t.DiffieHellmanGroup=t.createDiffieHellmanGroup=t.getDiffieHellman=function(t){var r=new e(o[t].prime,'hex'),n=new e(o[t].gen,'hex');return new d(r,n)},t.createDiffieHellman=t.DiffieHellman=n}).call(this,r(4).Buffer)},function(e,t,r){function n(){if(null!==A)return A;var e=[];e[0]=2;for(var t=1,r=3,n;r<1048576;r+=2){n=s(Math.sqrt(r));for(var a=0;ae)return 2===t||5===t?new c([140,123]):new c([140,39]);t=new c(t);for(var r,n;;){for(r=new c(i(s(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(b),!t.cmp(b))for(;r.mod(f).cmp(x);)r.iadd(S);else if(!t.cmp(h))for(;r.mod(g).cmp(v);)r.iadd(S);if(n=r.shrn(1),a(n)&&a(r)&&o(n)&&o(r)&&l.test(n)&&l.test(r))return r}}var s=Math.ceil,i=r(33);e.exports=d,d.simpleSieve=a,d.fermatTest=o;var c=r(3),f=new c(24),p=r(133),l=new p,u=new c(1),b=new c(2),h=new c(5),m=new c(16),y=new c(8),g=new c(10),v=new c(3),k=new c(7),x=new c(11),S=new c(4),w=new c(12),A=null},function(e,t,r){function n(e){this.rand=e||new a.Rand}var o=Math.max,c=r(3),a=r(134);e.exports=n,n.create=function(e){return new n(e)},n.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do var n=new c(this.rand.generate(r));while(0<=n.cmp(e));return n},n.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},n.prototype.test=function(e,t,r){var n=e.bitLength(),f=c.mont(e),p=new c(1).toRed(f);t||(t=o(1,0|n/48));for(var l=e.subn(1),u=0;!l.testn(u);u++);for(var s=e.shrn(u),d=l.toRed(f),b=!0;0>8,d=255&a;o?r.push(o,d):r.push(d)}return r},a.zero2=r,a.toHex=n,a.encode=function(e,t){return'hex'===t?n(e):e}},function(e,t,r){'use strict';function n(e,t,r){return e&t^~e&r}function a(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}var d=r(20),i=d.rotr32;t.ft_1=function(e,t,r,d){return 0===e?n(t,r,d):1===e||3===e?o(t,r,d):2===e?a(t,r,d):void 0},t.ch32=n,t.maj32=a,t.p32=o,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},function(e,t,r){'use strict';function n(){return this instanceof n?void(i.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=h,this.W=Array(64)):new n}var a=r(20),o=r(48),d=r(137),s=r(15),p=a.sum32,c=a.sum32_4,l=a.sum32_5,u=d.ch32,m=d.maj32,y=d.s0_256,v=d.s1_256,f=d.g0_256,b=d.g1_256,i=o.BlockHash,h=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];a.inherits(n,i),e.exports=n,n.blockSize=512,n.outSize=256,n.hmacStrength=192,n.padLength=64,n.prototype._update=function(t,r){for(var n=this.W,o=0;16>o;o++)n[o]=t[r+o];for(;od&&(d+=4294967296),d}function o(e,t,n,a,o,d){var i=t&a^~t&d;return 0>i&&(i+=4294967296),i}function d(e,t,n,a,o){var d=e&n^e&o^n&o;return 0>d&&(d+=4294967296),d}function s(e,t,n,a,o,d){var i=t&a^t&d^a&d;return 0>i&&(i+=4294967296),i}function c(e,t){var n=v(e,t,28),a=v(t,e,2),o=v(t,e,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function f(e,t){var n=k(e,t,28),a=k(t,e,2),o=k(t,e,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function p(e,t){var n=v(e,t,14),a=v(e,t,18),o=v(t,e,9),d=n^a^o;return 0>d&&(d+=4294967296),d}function l(e,t){var n=k(e,t,14),a=k(e,t,18),o=k(t,e,9),d=n^a^o;return 0>d&&(d+=4294967296),d}function u(e,t){var n=v(e,t,1),a=v(e,t,8),o=x(e,t,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function b(e,t){var n=k(e,t,1),a=k(e,t,8),o=S(e,t,7),d=n^a^o;return 0>d&&(d+=4294967296),d}function h(e,t){var n=v(e,t,19),a=v(t,e,29),o=x(e,t,6),d=n^a^o;return 0>d&&(d+=4294967296),d}function m(e,t){var n=k(e,t,19),a=k(t,e,29),o=S(e,t,6),d=n^a^o;return 0>d&&(d+=4294967296),d}var i=r(20),y=r(48),g=r(15),v=i.rotr64_hi,k=i.rotr64_lo,x=i.shr64_hi,S=i.shr64_lo,w=i.sum64,A=i.sum64_hi,E=i.sum64_lo,I=i.sum64_4_hi,C=i.sum64_4_lo,P=i.sum64_5_hi,T=i.sum64_5_lo,B=y.BlockHash,N=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];i.inherits(n,B),e.exports=n,n.blockSize=1024,n.outSize=512,n.hmacStrength=192,n.padLength=128,n.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;32>n;n++)r[n]=e[t+n];for(;n=e))return t.error('non-byte EncoderBuffer value');this.value=e,this.length=1}else if('string'==typeof e)this.value=e,this.length=i.byteLength(e);else if(i.isBuffer(e))this.value=e,this.length=e.length;else return t.error('Unsupported type: '+typeof e)}var o=r(5),d=r(50).Reporter,i=r(4).Buffer;o(n,d),t.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:d.prototype.save.call(this)}},n.prototype.restore=function(e){var t=new n(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,d.prototype.restore.call(this,e.reporter),t},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||'DecoderBuffer overrun')},n.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||'DecoderBuffer overrun');var r=new n(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},n.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=a,a.prototype.join=function(e,t){return(e||(e=new i(this.length)),t||(t=0),0===this.length)?e:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):('number'==typeof this.value?e[t]=this.value:'string'==typeof this.value?e.write(this.value,t):i.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},function(e,t,r){var n=t;n._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0);var n=e[r];t[n]=r}),t},n.der=r(295)},function(e,t,r){function n(e){this.enc='der',this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){c.Node.call(this,'der',e)}function o(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var n=p.tagClass[r>>6],a=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;var d=p.tag[r];return{cls:n,primitive:a,tag:r,tagStr:d}}function d(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;var a=127&n;if(4n?2e3+n:1900+n}else return e.error('Decoding '+t+' time is not supported yet');return Date.UTC(n,a-1,o,d,i,s,0)},a.prototype._decodeNull=function(){return null},a.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},a.prototype._decodeInt=function(e,t){var r=e.raw(),n=new f(r);return t&&(n=t[n.toString(10)]||n),n},a.prototype._use=function(e,t){return'function'==typeof e&&(e=e(t)),e._getDecoder('der').tree}},function(e,t,r){function n(e){this.enc='der',this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){f.Node.call(this,'der',e)}function o(e){return 10>e?'0'+e:e}function d(e,t,r,n){var a;if('seqof'===e?e='seq':'setof'==e&&(e='set'),p.tagByName.hasOwnProperty(e))a=p.tagByName[e];else if('number'==typeof e&&(0|e)===e)a=e;else return n.error('Unknown tag: '+e);return 31<=a?n.error('Multi-octet tag encoding unsupported'):(t||(a|=32),a|=p.tagClassByName[r||'universal']<<6,a)}var i=r(5),s=r(4).Buffer,c=r(49),f=c.base,p=c.constants.der;e.exports=n,n.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(a,f.Node),a.prototype._encodeComposite=function(e,t,r,n){var a=d(e,t,r,this.reporter);if(128>n.length){var o=new s(2);return o[0]=a,o[1]=n.length,this._createEncoderBuffer([o,n])}for(var c=1,f=n.length;256<=f;f>>=8)c++;var o=new s(2+c);o[0]=a,o[1]=128|c;for(var f=1+c,i=n.length;0>=8)o[f]=255&i;return this._createEncoderBuffer([o,n])},a.prototype._encodeStr=function(e,t){if('bitstr'===t)return this._createEncoderBuffer([0|e.unused,e.data]);if('bmpstr'===t){for(var r=new s(2*e.length),n=0;n>=7)a++;for(var d=new s(a),i=d.length-1,n=e.length-1,o;0<=n;n--)for(o=e[n],d[i--]=127&o;0<(o>>=7);)d[i--]=128|127&o;return this._createEncoderBuffer(d)},a.prototype._encodeTime=function(e,t){var r=new Date(e),n;return'gentime'===t?n=[o(r.getFullYear()),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),'Z'].join(''):'utctime'===t?n=[o(r.getFullYear()%100),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),'Z'].join(''):this.reporter.error('Encoding '+t+' time is not supported yet'),this._encodeStr(n,'octstr')},a.prototype._encodeNull=function(){return this._createEncoderBuffer('')},a.prototype._encodeInt=function(e,t){if('string'==typeof e){if(!t)return this.reporter.error('String int or enum given, but no values map');if(!t.hasOwnProperty(e))return this.reporter.error('Values map doesn\'t contain: '+JSON.stringify(e));e=t[e]}if('number'!=typeof e&&!s.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new s(r)}if(s.isBuffer(e)){var n=e.length;0===e.length&&n++;var a=new s(n);return e.copy(a),0===e.length&&(a[0]=0),this._createEncoderBuffer(a)}if(128>e)return this._createEncoderBuffer(e);if(256>e)return this._createEncoderBuffer([0,e]);for(var n=1,o=e;256<=o;o>>=8)n++;for(var a=Array(n),o=a.length-1;0<=o;o--)a[o]=255&e,e>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(new s(a))},a.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},a.prototype._use=function(e,t){return'function'==typeof e&&(e=e(t)),e._getEncoder('der').tree},a.prototype._skipDefault=function(e,t,r){var n=this._baseState,a;if(null===n['default'])return!1;var o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n['default'],t,r).join()),o.length!==n.defaultBuffer.length)return!1;for(a=0;an)throw new TypeError('Bad iterations');if('number'!=typeof a)throw new TypeError('Key length not a number');if(0>a||a>1073741823||a!==a)throw new TypeError('Bad key length')}}).call(this,r(4).Buffer)},function(e,t,r){(function(t){var r;if(t.browser)r='utf-8';else{var n=parseInt(t.version.split('.')[0].slice(1),10);r=6<=n?'utf-8':'binary'}e.exports=r}).call(this,r(11))},function(e,t,r){function n(e,t,r){var n=a(e),o='sha512'===e||'sha384'===e?128:64;t.length>o?t=n(t):t.lengthe;e++)0==(3&e)&&(t=4294967296*Math.random()),n[e]=255&t>>>((3&e)<<3);return n}}},function(e){function t(e,t){var n=t||0,a=r;return[a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],'-',a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]]].join('')}for(var r=[],n=0;256>n;++n)r[n]=(n+256).toString(16).substr(1);e.exports=t},function(e,t,r){(function(n){function a(e){var t=new n(4);return t.writeUInt32BE(e,0),t}var o=r(68);e.exports=function(e,r){for(var d=new n(''),t=0,i;d.lengthr;r++)t['_'+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if('0123456789'!==n.join(''))return!1;var a={};return['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t'].forEach(function(e){a[e]=e}),'abcdefghijklmnopqrst'===Object.keys(Object.assign({},a)).join('')}catch(e){return!1}}()?Object.assign:function(e){for(var o=t(e),d=1,s,c;d=parseInt(r[2])?t.toNumber():t};var P=/^([^)(]*)\((.*)\)([^)(]*)$/,T=/^[A-Za-z_][A-Za-z0-9_]*$/;t.parseParamType=function(e){return a(e,!0)},t.formatParamType=s,t.formatSignature=function(e){return e.name+'('+e.inputs.map(function(e){return s(e)}).join(',')+')'},t.parseSignature=function(e){if('string'==typeof e)return e=e.replace(/\(/g,' (').replace(/\)/g,') ').replace(/\s+/g,' '),e=e.trim(),'event '===e.substring(0,6)?o(e.substring(6).trim()):('function '===e.substring(0,9)&&(e=e.substring(9)),d(e.trim()));throw new Error('unknown signature')};var B=function(){return function(e,t,r,n,a){this.coerceFunc=e,this.name=t,this.type=r,this.localName=n,this.dynamic=a}}(),N=function(e){function t(t){var r=e.call(this,t.coerceFunc,t.name,t.type,void 0,t.dynamic)||this;return w.defineReadOnly(r,'coder',t),r}return y(t,e),t.prototype.encode=function(e){return this.coder.encode(e)},t.prototype.decode=function(e,t){return this.coder.decode(e,t)},t}(B),R=function(e){function t(t,r){return e.call(this,t,'null','',r,!1)||this}return y(t,e),t.prototype.encode=function(){return x.arrayify([])},t.prototype.decode=function(e,t){if(t>e.length)throw new Error('invalid null');return{consumed:0,value:this.coerceFunc('null',void 0)}},t}(B),M=function(e){function t(t,r,n,a){var o=this,d=(n?'int':'uint')+8*r;return o=e.call(this,t,d,d,a,!1)||this,o.size=r,o.signed=n,o}return y(t,e),t.prototype.encode=function(e){try{var t=k.bigNumberify(e);return t=t.toTwos(8*this.size).maskn(8*this.size),this.signed&&(t=t.fromTwos(8*this.size).toTwos(256)),x.padZeros(x.arrayify(t),32)}catch(t){A.throwError('invalid number value',A.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e})}return null},t.prototype.decode=function(e,t){e.lengthb&&(n('Max buffer length exceeded: textNode'),e=r(e,p.length)),H.length>b&&(n('Max buffer length exceeded: numberNode'),e=r(e,H.length)),U=b-e+Y}function n(e){p!==void 0&&(l(p),u(),p=void 0),$=s(e+'\nLn: '+J+'\nCol: '+Z+'\nChr: '+Q),i(K(void 0,void 0,$))}function a(){return z==y?(l({}),u(),void(q=!0)):void((z!==g||0!==X)&&n('Unexpected end'),p!==void 0&&(l(p),u(),p=void 0),q=!0)}function o(e){return'\r'==e||'\n'==e||' '==e||'\t'==e}function d(e){if(!$){if(q)return n('Cannot write after close');var r=0;for(Q=e[0];Q&&(0=U&&t()}}var f=e(xe).emit,l=e(Se).emit,u=e(we).emit,i=e(he).emit,b=65536,h=/[\\"\n]/g,m=0,y=m++,g=m++,v=m++,k=m++,x=m++,S=m++,w=m++,A=m++,E=m++,I=m++,C=m++,P=m++,T=m++,B=m++,N=m++,R=m++,M=m++,L=m++,j=m++,O=m++,D=m,U=b,H='',F=!1,q=!1,z=y,V=[],G=null,W=0,X=0,Y=0,Z=0,J=1,$,Q,ee,p;e(_e).on(d),e(ve).on(a)}function M(e,t){'use strict';function r(e){return function(t){a=e(a,t)}}var n={},a;for(var o in t)e(o).on(r(t[o]),n);e(ue).on(function(e){var t=re(a),r=de(t),n=ne(a),o;n&&(o=ie(re(n)),o[r]=e)}),e(be).on(function(){var e=re(a),t=de(e),r=ne(a),n;r&&(n=ie(re(r)),delete n[t])}),e(ke).on(function(){for(var r in t)e(r).un(n)})}function L(e){var t={};return e&&e.split('\r\n').forEach(function(e){var r=e.indexOf(': ');t[e.substring(0,r)]=e.substring(r+2)}),t}function j(e,t){function r(e){return{"http:":80,"https:":443}[e]}function n(t){return t.port||r(t.protocol||e.protocol)}return!!(t.protocol&&t.protocol!=e.protocol||t.host&&t.host!=e.host||t.host&&n(t)!=n(e))}function O(e){var t=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/,r=t.exec(e)||[];return{protocol:r[1]||'',host:r[2]||'',port:r[3]||''}}function D(){return new XMLHttpRequest}function U(e,t,r,n,a,d,i){'use strict';function s(){var e=t.responseText,r=e.substr(p);r&&c(r),p=Q(e)}var c=e(_e).emit,f=e(he).emit,p=0,l=!0;e(ke).on(function(){t.onreadystatechange=null,t.abort()}),'onprogress'in t&&(t.onprogress=s),t.onreadystatechange=function(){function r(){try{l&&e(ge).emit(t.status,L(t.getAllResponseHeaders())),l=!1}catch(t){}}switch(t.readyState){case 2:case 3:return r();case 4:r();var n=2==(t.status+'')[0];n?(s(),e(ve).emit()):f(K(t.status,t.responseText));}};try{for(var u in t.open(r,n,!0),d)t.setRequestHeader(u,d[u]);j(o.location,O(n))||t.setRequestHeader('X-Requested-With','XMLHttpRequest'),t.withCredentials=i,t.send(a)}catch(t){o.setTimeout(Z(f,K(void 0,void 0,t)),0)}}function H(e,t){return{key:e,node:t}}function F(e){function t(e,t){var r=ie(re(e));return v(i,r)?n(e,Q(r),t):e}function r(e,t,r){ie(re(e))[t]=r}function n(e,t,n){e&&r(e,t,n);var o=S(H(t,n),e);return a(o),o}var a=e(pe).emit,o=e(le).emit,d=e(ye).emit,s=e(me).emit,c={};return c[Se]=function(e,a){if(!e)return d(a),n(e,se,a);var o=t(e,a),i=ne(o),s=de(re(o));return r(i,s,a),S(H(s,a),i)},c[we]=function(e){return o(e),ne(e)||s(ie(re(e)))},c[xe]=n,c}function q(e,t,r){function n(e){return function(t){return t.id==e}}var a,o;return{on:function(r,n){var d={listener:r,id:n||r};return t&&t.emit(e,r,d.id),a=S(d,a),o=S(r,o),this},emit:function(){T(o,arguments)},un:function(t){var d;a=C(a,n(t),function(e){d=e}),d&&(o=C(o,function(e){return e==d.listener}),r&&r.emit(e,d.listener,d.id))},listeners:function(){return o},hasListener:function(e){var t=e?n(e):y;return k(N(t,a))}}}function z(){function e(e){return r[e]=q(e,n,a)}function t(t){return r[t]||e(t)}var r={},n=e('newListener'),a=e('removeListener');return['emit','on','un'].forEach(function(e){t[e]=u(function(r,n){l(n,t(r)[e])})}),t}function K(e,t,r){try{var n=c.parse(t)}catch(t){}return{statusCode:e,body:t,jsonBody:n,thrown:r}}function V(e,t){function r(e,t,r){var n=B(r);e(t,A(ne(E(de,n))),A(E(ie,n)))}function n(t,n,a){var o=e(t).emit;n.on(function(e){var t=a(e);!1!==t&&r(o,ie(t),e)},t),e('removeListener').on(function(r){r!=t||e(r).listeners()||n.un(t)})}var a={node:e(le),path:e(pe)};e('newListener').on(function(e){var r=/(node|path):(.*)/.exec(e);if(r){var o=a[r[1]];o.hasListener(e)||n(e,o,t(r[2]))}})}function G(e,t){function r(t,r){return e(t).on(a(r),r),S}function n(e,t,r){r=r||t;var n=a(t);return e.on(function(){var t=!1;S.forget=function(){t=!0},l(arguments,n),delete S.forget,t&&e.un(r)},r),S}function a(e){return function(){try{return e.apply(S,arguments)}catch(t){setTimeout(function(){throw new s(t.message)})}}}function o(t,r){return e(t+':'+r)}function d(e){return function(){var t=e.apply(this,arguments);k(t)&&(t==Y.drop?h():y(t))}}function i(e,t,r){var a;a='node'==e?d(r):r,n(o(e,t),a,r)}function c(e,t){for(var r in t)i(e,r,t[r])}function f(e,t,r){return ee(t)?i(e,t,r):c(e,t),S}var p=/^(node|path):./,b=e(me),h=e(be).emit,y=e(ue).emit,v=u(function(t,r){if(S[t])l(r,S[t]);else{var a=e(t),o=r[0];p.test(t)?n(a,o):a.on(o)}return S}),x=function(t,r,n){if('done'==t)b.un(r);else if('node'==t||'path'==t)e.un(t+':'+r,n);else{e(t).un(r)}return S},S;return e(ye).on(function(e){S.root=g(e)}),e(ge).on(function(e,t){S.header=function(e){return e?t[e]:t}}),S={on:v,addListener:v,removeListener:x,emit:e.emit,node:Z(f,'node'),path:Z(f,'path'),done:Z(n,b),start:Z(r,ge),fail:e(he).on,abort:e(ke).emit,header:m,root:m,source:t}}function W(e,t,r,n,a){var o=z();return t&&U(o,D(),e,t,r,n,a),R(o),M(o,F(o)),V(o,ce),G(o,t)}function X(e,t,r,n,a,o,d){return a=a?c.parse(c.stringify(a)):{},n?(!ee(n)&&(n=c.stringify(n),a['Content-Type']=a['Content-Type']||'application/json'),a['Content-Length']=a['Content-Length']||n.length):n=null,e(r||'GET',function(e,t){return!1===t&&(e+=-1==e.indexOf('?')?'?':'&',e+='_='+new Date().getTime()),e}(t,d),n,a,o||!1)}function Y(e){var t=ae('resume','pause','pipe'),r=Z(x,t);return e?r(e)||ee(e)?X(W,e):X(W,e.url,e.method,e.body,e.headers,e.withCredentials,e.cached):W()}var Z=u(function(e,t){var r=t.length;return u(function(n){for(var a=0;aObject(f.isUndefined)(e)||Object(f.isNull)(e),T=(e)=>{for(;e&&e.startsWith('0x0');)e=`0x${e.slice(3)}`;return e},B=(e)=>(1==e.length%2&&(e=e.replace('0x','0x0')),e);class N extends I.a{constructor(e,t,r,n,a,o,d,i,s){super(e,t,r,n,a,o,d),this.utils=i,this.formatters=s,this.wallet=new R(this)}_addAccountFunctions(e){const t=this;return e.signTransaction=function(r,n){return t.signTransaction(r,e.privateKey,n)},e.sign=function(r){return t.sign(r,e.privateKey)},e.encrypt=function(r,n){return t.encrypt(e.privateKey,r,n)},e}create(e){return this._addAccountFunctions(u.a.create(e||this.utils.randomHex(32)))}privateKeyToAccount(e){return this._addAccountFunctions(u.a.fromPrivate(e))}signTransaction(e,t,r){function n(e){if(e.gas||e.gasLimit||(o=new Error('gas is missing')),(0>e.nonce||0>e.gas||0>e.gasPrice||0>e.chainId)&&(o=new Error('Gas, gasPrice, nonce or chainId is lower than 0')),o)return r(o),Promise.reject(o);try{e=a.formatters.inputCallFormatter(e);const r=e;r.to=e.to||'0x',r.data=e.data||'0x',r.value=e.value||'0x',r.chainId=a.utils.numberToHex(e.chainId);const n=y.a.encode([x.a.fromNat(r.nonce),x.a.fromNat(r.gasPrice),x.a.fromNat(r.gas),r.to.toLowerCase(),x.a.fromNat(r.value),r.data,x.a.fromNat(r.chainId||'0x1'),'0x','0x']),o=h.a.keccak256(n),i=u.a.makeSigner(2*v.a.toNumber(r.chainId||'0x1')+35)(h.a.keccak256(n),t),s=y.a.decode(n).slice(0,6).concat(u.a.decodeSignature(i));s[6]=B(T(s[6])),s[7]=B(T(s[7])),s[8]=B(T(s[8]));const c=y.a.encode(s),f=y.a.decode(c);d={messageHash:o,v:T(f[6]),r:T(f[7]),s:T(f[8]),rawTransaction:c}}catch(t){return r(t),Promise.reject(t)}return r(null,d),d}const a=this;let o=!1,d;return r=r||(()=>{}),e?void 0!==e.nonce&&void 0!==e.chainId&&void 0!==e.gasPrice?Promise.resolve(n(e)):Promise.all([P(e.chainId)?a.getId():e.chainId,P(e.gasPrice)?a.getGasPrice():e.gasPrice,P(e.nonce)?a.getTransactionCount(a.privateKeyToAccount(t).address):e.nonce]).then((t)=>{if(P(t[0])||P(t[1])||P(t[2]))throw new Error(`One of the values 'chainId', 'gasPrice', or 'nonce' couldn't be fetched: ${JSON.stringify(t)}`);return n(Object(f.extend)(e,{chainId:t[0],gasPrice:t[1],nonce:t[2]}))}):(o=new Error('No transaction object given!'),r(o),Promise.reject(o))}recoverTransaction(e){const t=y.a.decode(e),r=u.a.encodeSignature(t.slice(6,9)),n=x.a.toNumber(t[6]),a=35>n?[]:[x.a.fromNumber(n-35>>1),'0x','0x'],o=t.slice(0,6).concat(a),d=y.a.encode(o);return u.a.recover(h.a.keccak256(d),r)}hashMessage(e){const t=this.utils.isHexStrict(e)?this.utils.hexToBytes(e):e,r=n.from(t),a=`\x19Ethereum Signed Message:\n${t.length}`,o=n.from(a),d=n.concat([o,r]);return h.a.keccak256s(d)}sign(e,t){const r=this.hashMessage(e),n=u.a.sign(r,t),a=u.a.decodeSignature(n);return{message:e,messageHash:r,v:a[0],r:a[1],s:a[2],signature:n}}recover(e,t,r){const n=[].slice.apply(arguments);return Object(f.isObject)(e)?this.recover(e.messageHash,u.a.encodeSignature([e.v,e.r,e.s]),!0):(r||(e=this.hashMessage(e)),4<=n.length?(r=n.slice(-1)[0],r=!!Object(f.isBoolean)(r)&&!!r,this.recover(e,u.a.encodeSignature(n.slice(1,4)),r)):u.a.recover(e,t))}decrypt(e,t,r){if(!Object(f.isString)(t))throw new Error('No password given.');const a=Object(f.isObject)(e)?e:JSON.parse(r?e.toLowerCase():e);if(3!==a.version)throw new Error('Not a valid V3 wallet');let o,d;if('scrypt'===a.crypto.kdf)d=a.crypto.kdfparams,o=w()(new n(t),new n(d.salt,'hex'),d.n,d.r,d.p,d.dklen);else if('pbkdf2'===a.crypto.kdf){if(d=a.crypto.kdfparams,'hmac-sha256'!==d.prf)throw new Error('Unsupported parameters to PBKDF2');o=C.pbkdf2Sync(new n(t),new n(d.salt,'hex'),d.c,d.dklen,'sha256')}else throw new Error('Unsupported key derivation scheme');const i=new n(a.crypto.ciphertext,'hex'),s=utils.sha3(n.concat([o.slice(16,32),i])).replace('0x','');if(s!==a.crypto.mac)throw new Error('Key derivation failed - possibly wrong password');const c=C.createDecipheriv(a.crypto.cipher,o.slice(0,16),new n(a.crypto.cipherparams.iv,'hex')),p=`0x${n.concat([c.update(i),c.final()]).toString('hex')}`;return this.privateKeyToAccount(p)}encrypt(e,t,r){const a=this.privateKeyToAccount(e);r=r||{};const o=r.salt||C.randomBytes(32),d=r.iv||C.randomBytes(16);let i;const s=r.kdf||'scrypt',c={dklen:r.dklen||32,salt:o.toString('hex')};if('pbkdf2'===s)c.c=r.c||262144,c.prf='hmac-sha256',i=C.pbkdf2Sync(new n(t),o,c.c,c.dklen,'sha256');else if('scrypt'===s)c.n=r.n||8192,c.r=r.r||8,c.p=r.p||1,i=w()(new n(t),o,c.n,c.r,c.p,c.dklen);else throw new Error('Unsupported kdf');const f=C.createCipheriv(r.cipher||'aes-128-ctr',i.slice(0,16),d);if(!f)throw new Error('Unsupported cipher');const p=n.concat([f.update(new n(a.privateKey.replace('0x',''),'hex')),f.final()]),l=this.utils.sha3(n.concat([i.slice(16,32),new n(p,'hex')])).replace('0x','');return{version:3,id:E.a.v4({random:r.uuid||C.randomBytes(16)}),address:a.address.toLowerCase().replace('0x',''),crypto:{ciphertext:p.toString('hex'),cipherparams:{iv:d.toString('hex')},cipher:r.cipher||'aes-128-ctr',kdf:s,kdfparams:c,mac:l.toString('hex')}}}}class R{constructor(e){this._accounts=e,this.length=0,this.defaultKeyName='web3js_wallet'}_findSafeIndex(e=0){return Object(f.has)(this,e)?this._findSafeIndex(e+1):e}_currentIndexes(){const e=Object.keys(this),t=e.map((e)=>parseInt(e)).filter((e)=>9e20>e);return t}create(e,t){for(let r=0;r{e.remove(t)}),this}encrypt(e,t){const r=this,n=this._currentIndexes(),a=n.map((n)=>r[n].encrypt(e,t));return a}decrypt(e,t){const r=this;return e.forEach((e)=>{const n=r._accounts.decrypt(e,t);if(n)r.add(n);else throw new Error('Couldn\'t decrypt accounts. Password wrong?')}),this}save(e,t){return localStorage.setItem(t||this.defaultKeyName,JSON.stringify(this.encrypt(e))),!0}load(e,t){let r=localStorage.getItem(t||this.defaultKeyName);if(r)try{r=JSON.parse(r)}catch(t){}return this.decrypt(r||[],e)}}'undefined'==typeof localStorage&&(delete R.prototype.save,delete R.prototype.load)}).call(this,r(7),r(3).Buffer)},function(e,t,r){var n=r(306),a=r(307),o=a;o.v1=n,o.v4=a,e.exports=o},function(e){'use strict';e.exports=[{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'resolver',outputs:[{name:'',type:'address'}],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'owner',outputs:[{name:'',type:'address'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'label',type:'bytes32'},{name:'owner',type:'address'}],name:'setSubnodeOwner',outputs:[],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'ttl',type:'uint64'}],name:'setTTL',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'ttl',outputs:[{name:'',type:'uint64'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'resolver',type:'address'}],name:'setResolver',outputs:[],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'owner',type:'address'}],name:'setOwner',outputs:[],payable:!1,type:'function'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'owner',type:'address'}],name:'Transfer',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!0,name:'label',type:'bytes32'},{indexed:!1,name:'owner',type:'address'}],name:'NewOwner',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'resolver',type:'address'}],name:'NewResolver',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'ttl',type:'uint64'}],name:'NewTTL',type:'event'}]},function(e){'use strict';e.exports=[{constant:!0,inputs:[{name:'interfaceID',type:'bytes4'}],name:'supportsInterface',outputs:[{name:'',type:'bool'}],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'},{name:'contentTypes',type:'uint256'}],name:'ABI',outputs:[{name:'contentType',type:'uint256'},{name:'data',type:'bytes'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'hash',type:'bytes'}],name:'setMultihash',outputs:[],payable:!1,stateMutability:'nonpayable',type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'multihash',outputs:[{name:'',type:'bytes'}],payable:!1,stateMutability:'view',type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'x',type:'bytes32'},{name:'y',type:'bytes32'}],name:'setPubkey',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'content',outputs:[{name:'ret',type:'bytes32'}],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'addr',outputs:[{name:'ret',type:'address'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'contentType',type:'uint256'},{name:'data',type:'bytes'}],name:'setABI',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'name',outputs:[{name:'ret',type:'string'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'name',type:'string'}],name:'setName',outputs:[],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'hash',type:'bytes32'}],name:'setContent',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'pubkey',outputs:[{name:'x',type:'bytes32'},{name:'y',type:'bytes32'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'addr',type:'address'}],name:'setAddr',outputs:[],payable:!1,type:'function'},{inputs:[{name:'ensAddr',type:'address'}],payable:!1,type:'constructor'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'a',type:'address'}],name:'AddrChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'hash',type:'bytes32'}],name:'ContentChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'name',type:'string'}],name:'NameChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!0,name:'contentType',type:'uint256'}],name:'ABIChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'x',type:'bytes32'},{indexed:!1,name:'y',type:'bytes32'}],name:'PubkeyChanged',type:'event'}]},function(e,t,r){var n=function(){throw'This swarm.js function isn\'t available on the browser.'},a=r(322),o=r(13),d=r(337),i=r(338),s=r(339);e.exports=s({fsp:{readFile:n},files:{download:n,safeDownloadArchived:n,directoryTree:n},os:{platform:n,arch:n},path:{join:n,slice:n},child_process:{spawn:n},defaultArchives:{},mimetype:{lookup:n},request:a,downloadUrl:null,bytes:o,hash:d,pick:i})},function(e){e.exports={a:'1.0.0-beta.36'}},function(e,t,r){'use strict';var n=r(170),a=r(173),o=r(71),d=r(72);e.exports=r(175)(Array,'Array',function(e,t){this._t=d(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,a(1)):'keys'==t?a(0,r):'values'==t?a(0,e[r]):a(0,[r,e[r]])},'values'),o.Arguments=o.Array,n('keys'),n('values'),n('entries')},function(e,t,r){var n=r(23)('unscopables'),a=Array.prototype;a[n]==void 0&&r(25)(a,n,{}),e.exports=function(e){a[n][e]=!0}},function(e,t,r){e.exports=!r(28)&&!r(49)(function(){return 7!=Object.defineProperty(r(90)('div'),'a',{get:function(){return 7}}).a})},function(e,t,r){var n=r(48);e.exports=function(e,t){if(!n(e))return e;var r,a;if(t&&'function'==typeof(r=e.toString)&&!n(a=r.call(e)))return a;if('function'==typeof(r=e.valueOf)&&!n(a=r.call(e)))return a;if(!t&&'function'==typeof(r=e.toString)&&!n(a=r.call(e)))return a;throw TypeError('Can\'t convert object to primitive value')}},function(e){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,r){var n=r(92);e.exports=Object('z').propertyIsEnumerable(0)?Object:function(e){return'String'==n(e)?e.split(''):Object(e)}},function(e,t,r){'use strict';var n=r(89),a=r(176),o=r(36),d=r(25),i=r(71),s=r(179),c=r(96),f=r(187),p=r(23)('iterator'),l=!([].keys&&'next'in[].keys()),u='keys',b='values',h=function(){return this};e.exports=function(e,t,r,m,y,g,v){s(r,t,m);var k=function(e){return!l&&e in A?A[e]:e===u?function(){return new r(this,e)}:e===b?function(){return new r(this,e)}:function(){return new r(this,e)}},x=t+' Iterator',S=y==b,w=!1,A=e.prototype,E=A[p]||A['@@iterator']||y&&A[y],I=E||k(y),C=y?S?k('entries'):I:void 0,P='Array'==t?A.entries||E:E,T,B,N;if(P&&(N=f(P.call(new e)),N!==Object.prototype&&N.next&&(c(N,x,!0),!n&&'function'!=typeof N[p]&&d(N,p,h))),S&&E&&E.name!==b&&(w=!0,I=function(){return E.call(this)}),(!n||v)&&(l||w||!A[p])&&d(A,p,I),i[t]=I,i[x]=h,y)if(T={values:S?I:k(b),keys:g?I:k(u),entries:C},v)for(B in T)B in A||o(A,B,T[B]);else a(a.P+a.F*(l||w),t,T);return T}},function(e,t,r){var n=r(24),a=r(69),o=r(25),d=r(36),i=r(177),s='prototype',c=function(e,t,r){var f=e&c.F,p=e&c.G,l=e&c.S,u=e&c.P,b=e&c.B,h=p?n:l?n[t]||(n[t]={}):(n[t]||{})[s],m=p?a:a[t]||(a[t]={}),y=m[s]||(m[s]={}),g,v,k,x;for(g in p&&(r=t),r)v=!f&&h&&void 0!==h[g],k=(v?h:r)[g],x=b&&v?i(k,n):u&&'function'==typeof k?i(Function.call,k):k,h&&d(h,g,k,e&c.U),m[g]!=k&&o(m,g,x),u&&y[g]!=k&&(y[g]=k)};n.core=a,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t,r){var n=r(178);e.exports=function(e,t,r){return(n(e),void 0===t)?e:1===r?function(r){return e.call(t,r)}:2===r?function(r,n){return e.call(t,r,n)}:3===r?function(r,n,a){return e.call(t,r,n,a)}:function(){return e.apply(t,arguments)}}},function(e){e.exports=function(e){if('function'!=typeof e)throw TypeError(e+' is not a function!');return e}},function(e,t,r){'use strict';var n=r(180),a=r(91),o=r(96),d={};r(25)(d,r(23)('iterator'),function(){return this}),e.exports=function(e,t,r){e.prototype=n(d,{next:a(1,r)}),o(e,t+' Iterator')}},function(e,t,r){var n=r(35),a=r(181),o=r(95),d=r(74)('IE_PROTO'),i=function(){},s='prototype',c=function(){var e=r(90)('iframe'),t=o.length,n='<',a='>',d;for(e.style.display='none',r(186).appendChild(e),e.src='javascript:',d=e.contentWindow.document,d.open(),d.write(n+'script'+a+'document.F=Object'+n+'/script'+a),d.close(),c=d.F;t--;)delete c[s][o[t]];return c()};e.exports=Object.create||function(e,t){var r;return null===e?r=c():(i[s]=n(e),r=new i,i[s]=null,r[d]=e),void 0===t?r:a(r,t)}},function(e,t,r){var n=r(47),a=r(35),o=r(93);e.exports=r(28)?Object.defineProperties:function(e,t){a(e);for(var r=o(t),d=r.length,s=0,i;d>s;)n.f(e,i=r[s++],t[i]);return e}},function(e,t,r){var n=r(50),a=r(72),o=r(183)(!1),d=r(74)('IE_PROTO');e.exports=function(e,t){var r=a(e),s=0,i=[],c;for(c in r)c!=d&&n(r,c)&&i.push(c);for(;t.length>s;)n(r,c=t[s++])&&(~o(i,c)||i.push(c));return i}},function(e,t,r){var n=r(72),a=r(184),o=r(185);e.exports=function(e){return function(t,r,d){var i=n(t),s=a(i.length),c=o(d,s),f;if(e&&r!=r){for(;s>c;)if(f=i[c++],f!=f)return!0;}else for(;s>c;c++)if((e||c in i)&&i[c]===r)return e||c||0;return!e&&-1}}},function(e,t,r){var n=r(94),a=Math.min;e.exports=function(e){return 0e?a(e+t,0):o(e,t)}},function(e,t,r){var n=r(24).document;e.exports=n&&n.documentElement},function(e,t,r){var n=r(50),a=r(188),o=r(74)('IE_PROTO'),d=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=a(e),n(e,o)?e[o]:'function'==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?d:null}},function(e,t,r){var n=r(73);e.exports=function(e){return Object(n(e))}},function(e,t,r){r(28)&&'g'!=/./g.flags&&r(47).f(RegExp.prototype,'flags',{configurable:!0,get:r(97)})},function(){},function(e,t,r){var n=r(192);e.exports=function(e){return'string'==typeof e?n(e)?e.slice(2):e:e}},function(e){e.exports=function(e){if('string'!=typeof e)throw new Error('[is-hex-prefixed] value must be type \'string\', is currently type '+typeof e+', while checking isHexPrefixed.');return'0x'===e.slice(0,2)}},function(e,t,r){var n=r(48),a=r(92),o=r(23)('match');e.exports=function(e){var t;return n(e)&&((t=e[o])===void 0?'RegExp'==a(e):!!t)}},function(e,t,r){e.exports=r(195)},function(e){e.exports=window.crypto},function(e,t,r){r(75)('match',1,function(e,t,r){return[function(r){'use strict';var n=e(this),a=r==void 0?void 0:r[t];return a===void 0?new RegExp(r)[t](n+''):a.call(r,n)},r]})},function(e,t,r){'use strict';function n(e){'string'==typeof e&&e.match(/^0x[0-9A-Fa-f]{40}$/)||l.throwError('invalid address',l.INVALID_ARGUMENT,{arg:'address',value:e}),e=e.toLowerCase();for(var t=e.substring(2).split(''),r=new Uint8Array(40),n=0;40>n;n++)r[n]=t[n].charCodeAt(0);r=c.arrayify(f.keccak256(r));for(var a=0;40>a;a+=2)8<=r[a>>1]>>4&&(t[a]=t[a].toUpperCase()),8<=(15&r[a>>1])&&(t[a+1]=t[a+1].toUpperCase());return'0x'+t.join('')}function a(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+'00';var t='';for(e.split('').forEach(function(e){t+=b[e]});t.length>=i;){var r=t.substring(0,i);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=98-parseInt(t,10)%97+'';2>n.length;)n='0'+n;return n}function o(e){var t=null;if('string'!=typeof e&&l.throwError('invalid address',l.INVALID_ARGUMENT,{arg:'address',value:e}),e.match(/^(0x)?[0-9a-fA-F]{40}$/))'0x'!==e.substring(0,2)&&(e='0x'+e),t=n(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&l.throwError('bad address checksum',l.INVALID_ARGUMENT,{arg:'address',value:e});else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==a(e)&&l.throwError('bad icap checksum',l.INVALID_ARGUMENT,{arg:'address',value:e}),t=new s.default.BN(e.substring(4),36).toString(16);40>t.length;)t='0'+t;t=n('0x'+t)}else l.throwError('invalid address',l.INVALID_ARGUMENT,{arg:'address',value:e});return t}var d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,'__esModule',{value:!0});for(var s=d(r(2)),c=r(29),f=r(198),p=r(200),l=r(53),u=9007199254740991,b={},h=0;10>h;h++)b[h+'']=h+'';for(var h=0;26>h;h++)b[String.fromCharCode(65+h)]=10+h+'';var i=Math.floor(function(e){var t=Math.log10;return t?t(e):Math.log(e)/Math.LN10}(u));t.getAddress=o,t.getIcapAddress=function(e){for(var t=new s.default.BN(o(e).substring(2),16).toString(36).toUpperCase();30>t.length;)t='0'+t;return'XE'+a('XE00'+t)+t},t.getContractAddress=function(e){if(!e.from)throw new Error('missing from address');var t=e.nonce;return o('0x'+f.keccak256(p.encode([o(e.from),c.stripZeros(c.hexlify(t))])).substring(26))}},function(e,t,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var n=r(98),a=r(29);t.keccak256=function(e){return'0x'+n.keccak_256(a.arrayify(e))}},function(e){(function(t){e.exports=t}).call(this,{})},function(e,t,r){'use strict';function n(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function a(e,t,r){for(var n=0,a=0;a=t.length)return t.unshift(192+t.length),t;var r=n(t.length);return r.unshift(247+r.length),r.concat(t)}var a=Array.prototype.slice.call(s.arrayify(e));if(1===a.length&&127>=a[0])return a;if(55>=a.length)return a.unshift(128+a.length),a;var r=n(a.length);return r.unshift(183+r.length),r.concat(a)}function d(e,t,r,n){for(var a=[],o;rt+1+n)throw new Error('invalid rlp');return{consumed:1+n,result:a}}function i(e,t){if(0===e.length)throw new Error('invalid rlp data');if(248<=e[t]){var r=e[t]-247;if(t+1+r>e.length)throw new Error('too short');var n=a(e,t+1,r);if(t+1+r+n>e.length)throw new Error('to short');return d(e,t,t+1+r,r+n)}if(192<=e[t]){var n=e[t]-192;if(t+1+n>e.length)throw new Error('invalid rlp data');return d(e,t,t+1,n)}if(184<=e[t]){var r=e[t]-183;if(t+1+r>e.length)throw new Error('invalid rlp data');var n=a(e,t+1,r);if(t+1+r+n>e.length)throw new Error('invalid rlp data');var o=s.hexlify(e.slice(t+1+r,t+1+r+n));return{consumed:1+r+n,result:o}}if(128<=e[t]){var n=e[t]-128;if(t+1+n>e.length)throw new Error('invlaid rlp data');var o=s.hexlify(e.slice(t+1,t+1+n));return{consumed:1+n,result:o}}return{consumed:1,result:s.hexlify(e[t])}}Object.defineProperty(t,'__esModule',{value:!0});var s=r(29);t.encode=function(e){return s.hexlify(o(e))},t.decode=function(e){var t=s.arrayify(e),r=i(t,0);if(r.consumed!==t.length)throw new Error('invalid rlp data');return r.result}},function(e,t,r){'use strict';function n(e){var t=e.toString(16);return'-'===t[0]?0==t.length%2?'-0x0'+t.substring(1):'-0x'+t.substring(1):1==t.length%2?'0x0'+t:'0x'+t}function a(e){return i(e)._bn}function d(e){return new m(n(e))}function i(e){return e instanceof m?e:new m(e)}var o=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t['default']=e,t};Object.defineProperty(t,'__esModule',{value:!0});var f=s(r(2)),p=r(29),l=r(99),u=r(202),b=c(r(53)),h=new f.default.BN(-1),m=function(e){function t(r){var o=e.call(this)||this;if(b.checkNew(o,t),'string'==typeof r)p.isHexString(r)?('0x'==r&&(r='0x0'),l.defineReadOnly(o,'_hex',r)):'-'===r[0]&&p.isHexString(r.substring(1))?l.defineReadOnly(o,'_hex',r):r.match(/^-?[0-9]*$/)?(''==r&&(r='0'),l.defineReadOnly(o,'_hex',n(new f.default.BN(r)))):b.throwError('invalid BigNumber string value',b.INVALID_ARGUMENT,{arg:'value',value:r});else if('number'==typeof r){parseInt(r+'')!==r&&b.throwError('underflow',b.NUMERIC_FAULT,{operation:'setValue',fault:'underflow',value:r,outputValue:parseInt(r+'')});try{l.defineReadOnly(o,'_hex',n(new f.default.BN(r)))}catch(e){b.throwError('overflow',b.NUMERIC_FAULT,{operation:'setValue',fault:'overflow',details:e.message})}}else r instanceof t?l.defineReadOnly(o,'_hex',r._hex):r.toHexString?l.defineReadOnly(o,'_hex',n(a(r.toHexString()))):p.isArrayish(r)?l.defineReadOnly(o,'_hex',n(new f.default.BN(p.hexlify(r).substring(2),16))):b.throwError('invalid BigNumber value',b.INVALID_ARGUMENT,{arg:'value',value:r});return o}return o(t,e),Object.defineProperty(t.prototype,'_bn',{get:function(){return'-'===this._hex[0]?new f.default.BN(this._hex.substring(3),16).mul(h):new f.default.BN(this._hex.substring(2),16)},enumerable:!0,configurable:!0}),t.prototype.fromTwos=function(e){return d(this._bn.fromTwos(e))},t.prototype.toTwos=function(e){return d(this._bn.toTwos(e))},t.prototype.add=function(e){return d(this._bn.add(a(e)))},t.prototype.sub=function(e){return d(this._bn.sub(a(e)))},t.prototype.div=function(e){var t=i(e);return t.isZero()&&b.throwError('division by zero',b.NUMERIC_FAULT,{operation:'divide',fault:'division by zero'}),d(this._bn.div(a(e)))},t.prototype.mul=function(e){return d(this._bn.mul(a(e)))},t.prototype.mod=function(e){return d(this._bn.mod(a(e)))},t.prototype.pow=function(e){return d(this._bn.pow(a(e)))},t.prototype.maskn=function(e){return d(this._bn.maskn(e))},t.prototype.eq=function(e){return this._bn.eq(a(e))},t.prototype.lt=function(e){return this._bn.lt(a(e))},t.prototype.lte=function(e){return this._bn.lte(a(e))},t.prototype.gt=function(e){return this._bn.gt(a(e))},t.prototype.gte=function(e){return this._bn.gte(a(e))},t.prototype.isZero=function(){return this._bn.isZero()},t.prototype.toNumber=function(){try{return this._bn.toNumber()}catch(e){b.throwError('overflow',b.NUMERIC_FAULT,{operation:'setValue',fault:'overflow',details:e.message})}return null},t.prototype.toString=function(){return this._bn.toString(10)},t.prototype.toHexString=function(){return this._hex},t}(u.BigNumber);t.bigNumberify=i,t.ConstantNegativeOne=i(-1),t.ConstantZero=i(0),t.ConstantOne=i(1),t.ConstantTwo=i(2),t.ConstantWeiPerEther=i('1000000000000000000')},function(e,t){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(){return function(){}}();t.BigNumber=r;var n=function(){return function(){}}();t.Indexed=n;var a=function(){return function(){}}();t.MinimalProvider=a;var o=function(){return function(){}}();t.Signer=o;var d=function(){return function(){}}();t.HDNode=d},function(e,t,r){'use strict';function n(e,t){void 0===t&&(t=d.current),t!=d.current&&(e=e.normalize(t));for(var r=[],n=0,a=0,i;ai?r[n++]=i:2048>i?(r[n++]=192|i>>6,r[n++]=128|63&i):55296==(64512&i)&&a+1>18,r[n++]=128|63&i>>12,r[n++]=128|63&i>>6,r[n++]=128|63&i):(r[n++]=224|i>>12,r[n++]=128|63&i>>6,r[n++]=128|63&i);return o.arrayify(r)}var a=String.fromCharCode;Object.defineProperty(t,'__esModule',{value:!0});var o=r(29),d;(function(e){e.current='',e.NFC='NFC',e.NFD='NFD',e.NFKC='NFKC',e.NFKD='NFKD'})(d=t.UnicodeNormalizationForm||(t.UnicodeNormalizationForm={}));t.toUtf8Bytes=n;t.toUtf8String=function(e){e=o.arrayify(e);for(var t='',r=0;r>7){t+=a(n);continue}if(2!=n>>6){var d=null;if(6==n>>5)d=1;else if(14==n>>4)d=2;else if(30==n>>3)d=3;else if(62==n>>2)d=4;else if(126==n>>1)d=5;else continue;if(r+d>e.length){for(;r>6;r++);if(r!=e.length)continue;return t}var i=n&(1<<8-d-1)-1,s;for(s=0;s>6)break;i=i<<6|63&c}if(s!=d){r--;continue}if(65535>=i){t+=a(i);continue}i-=65536,t+=a((1023&i>>10)+55296,(1023&i)+56320)}}return t}},function(e,t){'use strict';function r(e){var t=e.length;if(0>16,d[s++]=255&i>>8,d[s++]=255&i;return 2===o&&(i=f[e.charCodeAt(l)]<<2|f[e.charCodeAt(l+1)]>>4,d[s++]=255&i),1===o&&(i=f[e.charCodeAt(l)]<<10|f[e.charCodeAt(l+1)]<<4|f[e.charCodeAt(l+2)]>>2,d[s++]=255&i>>8,d[s++]=255&i),d}function o(e){return c[63&e>>18]+c[63&e>>12]+c[63&e>>6]+c[63&e]}function d(e,t,r){for(var n=[],a=t,d;ai?i:o+a));return 1==r?(s=e[t-1],n.push(c[s>>2]+c[63&s<<4]+'==')):2==r&&(s=(e[t-2]<<8)+e[t-1],n.push(c[s>>10]+c[63&s>>4]+c[63&s<<2]+'=')),n.join('')}t.byteLength=function(e){var t=r(e),n=t[0],a=t[1];return 3*(n+a)/4-a},t.toByteArray=a,t.fromByteArray=s;for(var c=[],f=[],p='undefined'==typeof Uint8Array?Array:Uint8Array,l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',u=0,i=l.length;u>1,u=-7,b=a?c-1:0,i=a?-1:1,d=t[n+b],s,e;for(b+=i,s=d&(1<<-u)-1,d>>=-u,u+=f;0>=-u,u+=o;0>1,h=23===f?5.960464477539063e-8-6.617444900424222e-24:0,y=o?0:p-1,i=o?1:-1,d=0>n||0===n&&0>1/n?1:0,s,g,m;for(n=Math.abs(n),isNaN(n)||n===Infinity?(g=isNaN(n)?1:0,s=u):(s=Math.floor(Math.log(n)/Math.LN2),1>n*(m=r(2,-s))&&(s--,m*=2),n+=1<=s+b?h/m:h*r(2,1-b),2<=n*m&&(s++,m/=2),s+b>=u?(g=0,s=u):1<=s+b?(g=(n*m-1)*r(2,f),s+=b):(g=n*r(2,b-1)*r(2,f),s=0));8<=f;t[a+y]=255&g,y+=i,g/=256,f-=8);for(s=s<=0.10.0'},homepage:'https://github.com/theturtle32/WebSocket-Node',keywords:['websocket','websockets','socket','networking','comet','push','RFC-6455','realtime','server','client'],license:'Apache-2.0',main:'index',name:'websocket',repository:{type:'git',url:'git+https://github.com/theturtle32/WebSocket-Node.git'},scripts:{gulp:'gulp',install:'(node-gyp rebuild 2> builderror.log) || (exit 0)',test:'faucet test/unit'},version:'1.0.26'}},function(e){'use strict';e.exports={isString:function(e){return'string'==typeof e},isObject:function(e){return'object'==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){'use strict';t.decode=t.parse=r(211),t.encode=t.stringify=r(212)},function(e){'use strict';function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,n,a,o){n=n||'&',a=a||'=';var d={};if('string'!=typeof e||0===e.length)return d;var s=/\+/g;e=e.split(n);var c=1e3;o&&'number'==typeof o.maxKeys&&(c=o.maxKeys);var f=e.length;0c&&(f=c);for(var p=0;p>>0),r=this.head,n=0;r;)a(r.data,t,n),n+=r.data.length,r=r.next;return t},e}(),d&&d.inspect&&d.inspect.custom&&(e.exports.prototype[d.inspect.custom]=function(){var e=d.inspect({length:this.length});return this.constructor.name+' '+e})},function(){},function(e,t,r){(function(e){function n(e,t){this._id=e,this._clearFn=t}var a='undefined'!=typeof e&&e||'undefined'!=typeof self&&self||window,o=Function.prototype.apply;t.setTimeout=function(){return new n(o.call(setTimeout,a,arguments),clearTimeout)},t.setInterval=function(){return new n(o.call(setInterval,a,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(a,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(219),t.setImmediate='undefined'!=typeof self&&self.setImmediate||'undefined'!=typeof e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate='undefined'!=typeof self&&self.clearImmediate||'undefined'!=typeof e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(7))},function(e,t,r){(function(e,t){(function(e){'use strict';function r(e){'function'!=typeof e&&(e=new Function(''+e));for(var t=Array(arguments.length-1),r=0;r{let r=[];for(var n=0;nt(e,()=>r),concat:(e,t)=>e.concat(t),flatten:(e)=>{let t=[];for(let r=0,n=e.length;r{let r=[];for(let n=0,a=t.length;n>>27}function i(e){return e<<30|e>>>2}function f(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}var a=r(4),d=r(33),s=r(6).Buffer,p=[1518500249,1859775393,-1894007588,-899497514],c=Array(80);a(n,d),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(r){for(var n=this._w,l=0|this._a,a=0|this._b,u=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)n[e]=r.readInt32BE(4*e);for(;80>e;++e)n[e]=n[e-3]^n[e-8]^n[e-14]^n[e-16];for(var b=0;80>b;++b){var h=~~(b/20),s=0|o(l)+f(h,a,u,c)+d+n[b]+p[h];d=c,c=u,u=i(a),a=l,l=s}this._a=0|l+this._a,this._b=0|a+this._b,this._c=0|u+this._c,this._d=0|c+this._d,this._e=0|d+this._e},n.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=l,s.call(this,64,56)}function a(e){return e<<1|e>>>31}function o(e){return e<<5|e>>>27}function i(e){return e<<30|e>>>2}function f(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}var d=r(4),s=r(33),c=r(6).Buffer,p=[1518500249,1859775393,-1894007588,-899497514],l=Array(80);d(n,s),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(r){for(var n=this._w,l=0|this._a,u=0|this._b,b=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)n[e]=r.readInt32BE(4*e);for(;80>e;++e)n[e]=a(n[e-3]^n[e-8]^n[e-14]^n[e-16]);for(var h=0;80>h;++h){var m=~~(h/20),s=0|o(l)+f(m,u,b,c)+d+n[h]+p[m];d=c,c=b,b=i(u),u=l,l=s}this._a=0|l+this._a,this._b=0|u+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|d+this._e},n.prototype._hash=function(){var e=c.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=s,d.call(this,64,56)}var a=r(4),o=r(110),d=r(33),i=r(6).Buffer,s=Array(64);a(n,o),n.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},n.prototype._hash=function(){var e=i.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=s,d.call(this,128,112)}var a=r(4),o=r(111),d=r(33),i=r(6).Buffer,s=Array(160);a(n,o),n.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},n.prototype._hash=function(){function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}var t=i.allocUnsafe(48);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},e.exports=n},function(e,t,r){'use strict';function n(e,t){d.call(this,'digest'),'string'==typeof t&&(t=o.from(t)),this._alg=e,this._key=t,t.length>c?t=e(t):t.length>>0},t.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=255&t>>>16,e[2+r]=255&t>>>8,e[3+r]=255&t},t.ip=function(e,t,r,n){for(var a=0,o=0,d=6;0<=d;d-=2){for(var i=0;24>=i;i+=8)a<<=1,a|=1&t>>>i+d;for(var i=0;24>=i;i+=8)a<<=1,a|=1&e>>>i+d}for(var d=6;0<=d;d-=2){for(var i=1;25>=i;i+=8)o<<=1,o|=1&t>>>i+d;for(var i=1;25>=i;i+=8)o<<=1,o|=1&e>>>i+d}r[n+0]=a>>>0,r[n+1]=o>>>0},t.rip=function(e,t,r,n){for(var a=0,o=0,d=0;4>d;d++)for(var i=24;0<=i;i-=8)a<<=1,a|=1&t>>>i+d,a<<=1,a|=1&e>>>i+d;for(var d=4;8>d;d++)for(var i=24;0<=i;i-=8)o<<=1,o|=1&t>>>i+d,o<<=1,o|=1&e>>>i+d;r[n+0]=a>>>0,r[n+1]=o>>>0},t.pc1=function(e,t,r,n){for(var a=0,o=0,d=7;5<=d;d--){for(var i=0;24>=i;i+=8)a<<=1,a|=1&t>>i+d;for(var i=0;24>=i;i+=8)a<<=1,a|=1&e>>i+d}for(var i=0;24>=i;i+=8)a<<=1,a|=1&t>>i+d;for(var d=1;3>=d;d++){for(var i=0;24>=i;i+=8)o<<=1,o|=1&t>>i+d;for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>i+d}for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>i+d;r[n+0]=a>>>0,r[n+1]=o>>>0},t.r28shl=function(e,t){return 268435455&e<>>28-t};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,n,a){for(var o=0,d=0,s=r.length>>>1,c=0;c>>r[c];for(var c=s;c>>r[c];n[a+0]=o>>>0,n[a+1]=d>>>0},t.expand=function(e,t,r){var n=0,a=0;n=(1&e)<<5|e>>>27;for(var o=23;15<=o;o-=4)n<<=6,n|=63&e>>>o;for(var o=11;3<=o;o-=4)a|=63&e>>>o,a<<=6;a|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=a>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var r=0,a=0;4>a;a++){var o=63&e>>>18-6*a,d=n[64*a+o];r<<=4,r|=d}for(var a=0;4>a;a++){var o=63&t>>>18-6*a,d=n[256+64*a+o];r<<=4,r|=d}return r>>>0};var a=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,r=0;r>>a[r];return t>>>0},t.padSplit=function(e,t,r){for(var n=e.toString(2);n.length>>1],r=c.r28shl(r,d),n=c.r28shl(n,d),c.pc2(r,n,e.keys,a)},a.prototype._update=function(e,t,n,a){var o=this._desState,d=c.readUInt32BE(e,t),i=c.readUInt32BE(e,t+4);c.ip(d,i,o.tmp,0),d=o.tmp[0],i=o.tmp[1],'encrypt'===this.type?this._encrypt(o,d,i,o.tmp,0):this._decrypt(o,d,i,o.tmp,0),d=o.tmp[0],i=o.tmp[1],c.writeUInt32BE(n,d,a),c.writeUInt32BE(n,i,a+4)},a.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,p=f}c.rip(l,p,o,d)},a.prototype._decrypt=function(e,n,a,o,d){for(var p=a,l=n,r=e.keys.length-2;0<=r;r-=2){var i=e.keys[r],u=e.keys[r+1];c.expand(p,e.tmp,0),i^=e.tmp[0],u^=e.tmp[1];var b=c.substitute(i,u),s=c.permute(b),f=p;p=(l^s)>>>0,l=f}c.rip(p,l,o,d)}},function(e,t,r){'use strict';function n(e){a.equal(e.length,8,'Invalid IV length'),this.iv=Array(8);for(var t=0;t>n%8,e._prev=a(e._prev,r?i:s);return o}function a(e,t){var r=e.length,n=-1,a=o.allocUnsafe(e.length);for(e=o.concat([e,o.from([t])]);++n>7;return a}var o=r(6).Buffer;t.encrypt=function(e,t,r){for(var a=t.length,d=o.allocUnsafe(a),s=-1;++s>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=d.alloc(16,0),this.cache=d.allocUnsafe(0)}var d=r(6).Buffer,i=d.alloc(16,0);o.prototype.ghash=function(e){for(var t=-1;++t++r;){for(d=0!=(this.state[~~(r/8)]&1<<7-r%8),d&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),i=0!=(1&e[3]),o=3;0>>1|(1&e[o-1])<<31;e[0]>>>=1,i&&(e[0]^=-520093696)}this.state=a(t)},o.prototype.update=function(e){this.cache=d.concat([this.cache,e]);for(var t;16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(d.concat([this.cache,i],16)),this.ghash(a([0,e,0,t])),this.state},e.exports=o},function(e,t,r){function n(e,t,r){p.call(this),this._cache=new a,this._last=void 0,this._cipher=new l.AES(t),this._prev=s.from(r),this._mode=e,this._autopadding=!0}function a(){this.cache=s.allocUnsafe(0)}function o(e){var t=e[15];if(1>t||16(n>>1)-1?(n>>1)-d:d,a.isubn(o)}else o=0;r.push(o);for(var s=0!==a.cmpn(0)&&0===a.andln(n-1)?t+1:1,c=1;c=s;t--)f=(f<<1)+n[t];d.push(f)}for(var p=this.jpoint(null,null,null),a=this.jpoint(null,null,null),u=o;0s)break;var i=o[s];l(0!==i),d='affine'===e.type?0>1]):d.mixedAdd(a[-i-1>>1].neg()):0>1]):d.add(a[-i-1>>1].neg())}return'affine'===e.type?d.toP():d},n.prototype._wnafMulAdd=function(e,t,r,n,d){for(var s=this._wnafT1,l=this._wnafT2,u=this._wnafT3,h=0,m=0;mm)break;for(var x=0;x>1]:0>C&&(i=l[x][-C-1>>1].neg());A='affine'===i.type?A.mixedAdd(i):A.add(i)}}for(var m=0;m=Math.ceil((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,a=0;an[0].cmp(n[1])?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)r=new c(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],p(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}var o;return o=e.basis?e.basis.map(function(e){return{a:new c(e.a,16),b:new c(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:o}}},n.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:c.mont(e),r=new c(2).toRed(t).redInvm(),n=r.redNeg(),a=new c(3).toRed(t).redNeg().redSqrt().redMul(r),o=n.redAdd(a).fromRed(),d=n.redSub(a).fromRed();return[o,d]},n.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,a=this.n.clone(),o=new c(1),d=new c(0),s=new c(0),f=new c(1),p=0,i,l,u,b,h,m,g,v,r,k;0!==n.cmpn(0);){k=a.div(n),v=a.sub(k.mul(n)),r=s.sub(k.mul(o));var x=f.sub(k.mul(d));if(!u&&0>v.cmp(t))i=g.neg(),l=o,u=v.neg(),b=r;else if(u&&2==++p)break;g=v,a=n,n=v,s=o,o=r,f=d,d=x}h=v.neg(),m=r;var y=u.sqr().add(b.sqr()),S=h.sqr().add(m.sqr());return 0<=S.cmp(y)&&(h=i,m=l),u.negative&&(u=u.neg(),b=b.neg()),h.negative&&(h=h.neg(),m=m.neg()),[{a:u,b:b},{a:h,b:m}]},n.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],a=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),d=a.mul(r.a),i=o.mul(n.a),s=a.mul(r.b),c=o.mul(n.b),f=e.sub(d).sub(i),p=s.add(c).neg();return{k1:f,k2:p}},n.prototype.pointFromX=function(e,t){e=new c(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error('invalid point');var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)},n.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(a).cmpn(0)},n.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,a=this._endoWnafT2,o=0;o':''},a.prototype.isInfinity=function(){return this.inf},a.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},a.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),a=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=a.redSqr().redISub(this.x.redAdd(this.x)),d=a.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,d)},a.prototype.getX=function(){return this.x.fromRed()},a.prototype.getY=function(){return this.y.fromRed()},a.prototype.mul=function(e){return e=new c(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a):this.curve._wnafMulAdd(1,n,a,2)},a.prototype.jmulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a,!0):this.curve._wnafMulAdd(1,n,a,2,!0)},a.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},a.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},a.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},s(o,f.BasePoint),n.prototype.jpoint=function(e,t,r){return new o(this,e,t,r)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),a=this.x.redMul(t),o=e.x.redMul(n),d=this.y.redMul(t.redMul(e.z)),i=e.y.redMul(n.redMul(this.z)),s=a.redSub(o),c=d.redSub(i);if(0===s.cmpn(0))return 0===c.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=s.redSqr(),f=r.redMul(s),p=a.redMul(r),l=c.redSqr().redIAdd(f).redISub(p).redISub(p),u=c.redMul(p.redISub(l)).redISub(d.redMul(f)),b=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,u,b)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,a=e.x.redMul(t),o=this.y,d=e.y.redMul(t).redMul(this.z),i=n.redSub(a),s=o.redSub(d);if(0===i.cmpn(0))return 0===s.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=i.redSqr(),c=r.redMul(i),f=n.redMul(r),p=s.redSqr().redIAdd(c).redISub(f).redISub(f),l=s.redMul(f.redISub(p)).redISub(o.redMul(c)),u=this.z.redMul(i);return this.curve.jpoint(p,l,u)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r':''},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){'use strict';function n(e){s.call(this,'mont',e),this.a=new d(e.a,16).toRed(this.red),this.b=new d(e.b,16).toRed(this.red),this.i4=new d(4).toRed(this.red).redInvm(),this.two=new d(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function a(e,t,r){s.BasePoint.call(this,e,'projective'),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new d(t,16),this.z=new d(r,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var o=r(61),d=r(2),i=r(4),s=o.base,c=r(10),f=c.utils;i(n,s),e.exports=n,n.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t),a=n.redSqrt();return 0===a.redSqr().cmp(n)},i(a,s.BasePoint),n.prototype.decodePoint=function(e,t){return this.point(f.toArray(e,t),1)},n.prototype.point=function(e,t){return new a(this,e,t)},n.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},a.prototype.precompute=function(){},a.prototype._encode=function(){return this.getX().toArray('be',this.curve.p.byteLength())},a.fromJSON=function(e,t){return new a(e,t[0],t[1]||e.one)},a.prototype.inspect=function(){return this.isInfinity()?'':''},a.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},a.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),r=this.x.redSub(this.z),n=r.redSqr(),a=t.redSub(n),o=t.redMul(n),d=a.redMul(n.redAdd(this.curve.a24.redMul(a)));return this.curve.point(o,d)},a.prototype.add=function(){throw new Error('Not supported on Montgomery curve')},a.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),a=e.x.redAdd(e.z),o=e.x.redSub(e.z),d=o.redMul(r),i=a.redMul(n),s=t.z.redMul(d.redAdd(i).redSqr()),c=t.x.redMul(d.redISub(i).redSqr());return this.curve.point(s,c)},a.prototype.mul=function(e){for(var r=e.clone(),t=this,n=this.curve.point(null,null),a=this,o=[];0!==r.cmpn(0);r.iushrn(1))o.push(r.andln(1));for(var d=o.length-1;0<=d;d--)0===o[d]?(t=t.diffAdd(n,a),n=n.dbl()):(n=t.diffAdd(n,a),t=t.dbl());return n},a.prototype.mulAdd=function(){throw new Error('Not supported on Montgomery curve')},a.prototype.jumlAdd=function(){throw new Error('Not supported on Montgomery curve')},a.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},a.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){'use strict';function n(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,c.call(this,'edwards',e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),f(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function a(e,r,n,a,o){c.BasePoint.call(this,e,'projective'),null===r&&null===n&&null===a?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(r,16),this.y=new i(n,16),this.z=a?new i(a,16):this.curve.one,this.t=o&&new i(o,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.y.red&&(this.y=this.y.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),!this.zOne&&(this.t=this.t.redMul(this.z.redInvm()))))}var o=r(61),d=r(10),i=r(2),s=r(4),c=o.base,f=d.utils.assert;s(n,c),e.exports=n,n.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},n.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},n.prototype.jpoint=function(e,r,n,a){return this.point(e,r,n,a)},n.prototype.pointFromX=function(e,t){e=new i(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(a.redInvm()),d=o.redSqrt();if(0!==d.redSqr().redSub(o).cmp(this.zero))throw new Error('invalid point');var s=d.fromRed().isOdd();return(t&&!s||!t&&s)&&(d=d.redNeg()),this.point(e,d)},n.prototype.pointFromY=function(e,t){e=new i(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.one),a=r.redMul(this.d).redAdd(this.one),o=n.redMul(a.redInvm());if(0===o.cmp(this.zero))if(t)throw new Error('invalid point');else return this.point(this.zero,e);var d=o.redSqrt();if(0!==d.redSqr().redSub(o).cmp(this.zero))throw new Error('invalid point');return d.isOdd()!==t&&(d=d.redNeg()),this.point(d,e)},n.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),a=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(a)},s(a,c.BasePoint),n.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},n.prototype.point=function(e,r,n,o){return new a(this,e,r,n,o)},a.fromJSON=function(e,t){return new a(e,t[0],t[1],t[2])},a.prototype.inspect=function(){return this.isInfinity()?'':''},a.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},a.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var a=this.curve._mulA(t),o=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),e=a.redAdd(r),d=e.redSub(n),i=a.redSub(r),s=o.redMul(d),c=e.redMul(i),f=o.redMul(i),p=d.redMul(e);return this.curve.point(s,c,p,f)},a.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),a,o,d;if(this.curve.twisted){var i=this.curve._mulA(r),e=i.redAdd(n);if(this.zOne)a=t.redSub(r).redSub(n).redMul(e.redSub(this.curve.two)),o=e.redMul(i.redSub(n)),d=e.redSqr().redSub(e).redSub(e);else{var s=this.z.redSqr(),c=e.redSub(s).redISub(s);a=t.redSub(r).redISub(n).redMul(c),o=e.redMul(i.redSub(n)),d=e.redMul(c)}}else{var i=r.redAdd(n),s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=i.redSub(s).redSub(s);a=this.curve._mulC(t.redISub(i)).redMul(c),o=this.curve._mulC(i).redMul(r.redISub(n)),d=i.redMul(c)}return this.curve.point(a,o,d)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},a.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),a=this.t.redMul(this.curve.dd).redMul(t.t),o=this.z.redMul(t.z.redAdd(t.z)),d=n.redSub(r),e=o.redSub(a),i=o.redAdd(a),s=n.redAdd(r),c=d.redMul(e),f=i.redMul(s),p=d.redMul(s),l=e.redMul(i);return this.curve.point(c,f,l,p)},a.prototype._projAdd=function(t){var r=this.z.redMul(t.z),n=r.redSqr(),a=this.x.redMul(t.x),o=this.y.redMul(t.y),d=this.curve.d.redMul(a).redMul(o),e=n.redSub(d),i=n.redAdd(d),s=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(a).redISub(o),c=r.redMul(e).redMul(s),f,p;return this.curve.twisted?(f=r.redMul(i).redMul(o.redSub(this.curve._mulA(a))),p=e.redMul(i)):(f=r.redMul(i).redMul(o.redSub(a)),p=this.curve._mulC(e).redMul(i)),this.curve.point(c,f,p)},a.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},a.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},a.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},a.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},a.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},a.prototype.getY=function(){return this.normalize(),this.y.fromRed()},a.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},a.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),a=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(r.redIAdd(a),0===this.x.cmp(r))return!0}return!1},a.prototype.toP=a.prototype.normalize,a.prototype.mixedAdd=a.prototype.add},function(e,t,r){'use strict';function n(e){this.curve='short'===e.type?new i.curve.short(e):'edwards'===e.type?new i.curve.edwards(e):new i.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),'Invalid curve'),s(this.g.mul(this.n).isInfinity(),'Invalid curve, G*N != O')}function a(e,t){Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get:function(){var r=new n(t);return Object.defineProperty(o,e,{configurable:!0,enumerable:!0,value:r}),r}})}var o=t,d=r(81),i=r(10),s=i.utils.assert;o.PresetCurve=n,a('p192',{type:'short',prime:'p192',p:'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',a:'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',b:'64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',n:'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',hash:d.sha256,gRed:!1,g:['188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012','07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811']}),a('p224',{type:'short',prime:'p224',p:'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',a:'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',b:'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',n:'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',hash:d.sha256,gRed:!1,g:['b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21','bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34']}),a('p256',{type:'short',prime:null,p:'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',a:'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',b:'5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',n:'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',hash:d.sha256,gRed:!1,g:['6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296','4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5']}),a('p384',{type:'short',prime:null,p:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff',a:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc',b:'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',n:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',hash:d.sha384,gRed:!1,g:['aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7','3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f']}),a('p521',{type:'short',prime:null,p:'000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff',a:'000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc',b:'00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',n:'000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',hash:d.sha512,gRed:!1,g:['000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66','00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650']}),a('curve25519',{type:'mont',prime:'p25519',p:'7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',a:'76d06',b:'1',n:'1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',hash:d.sha256,gRed:!1,g:['9']}),a('ed25519',{type:'edwards',prime:'p25519',p:'7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',a:'-1',c:'1',d:'52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',n:'1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',hash:d.sha256,gRed:!1,g:['216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a','6666666666666666666666666666666666666666666666666666666666666658']});var c;try{c=r(275)}catch(t){c=void 0}a('secp256k1',{type:'short',prime:'k256',p:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',a:'0',b:'7',n:'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',h:'1',hash:d.sha256,beta:'7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',lambda:'5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',basis:[{a:'3086d221a7d46bcde86c90e49284eb15',b:'-e4437ed6010e88286f547fa90abfe4c3'},{a:'114ca50f7a8e2f3f657c1108d9d44cfd8',b:'3086d221a7d46bcde86c90e49284eb15'}],gRed:!1,g:['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798','483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',c]})},function(e,t,r){'use strict';t.sha1=r(270),t.sha224=r(271),t.sha256=r(132),t.sha384=r(272),t.sha512=r(133)},function(e,t,r){'use strict';function n(){return this instanceof n?void(i.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)):new n}var a=r(17),o=r(43),d=r(131),f=a.rotl32,p=a.sum32,l=a.sum32_5,u=d.ft_1,i=o.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];a.inherits(n,i),e.exports=n,n.blockSize=512,n.outSize=160,n.hmacStrength=80,n.padLength=64,n.prototype._update=function(r,n){for(var o=this.W,m=0;16>m;m++)o[m]=r[n+m];for(;m=e?t^r^n:31>=e?t&r|~t&n:47>=e?(t|~r)^n:63>=e?t&n|r&~n:t^(r|~n)}function d(e){return 15>=e?0:31>=e?1518500249:47>=e?1859775393:63>=e?2400959708:2840853838}function i(e){return 15>=e?1352829926:31>=e?1548603684:47>=e?1836072691:63>=e?2053994217:0}var c=n(17),f=n(43),p=c.rotl32,l=c.sum32,u=c.sum32_3,b=c.sum32_4,h=f.BlockHash;c.inherits(a,h),t.ripemd160=a,a.blockSize=512,a.outSize=160,a.hmacStrength=192,a.padLength=64,a.prototype._update=function(e,t){for(var n=this.h[0],a=this.h[1],c=this.h[2],f=this.h[3],h=this.h[4],g=n,v=a,k=c,x=f,S=h,w=0,A;80>w;w++)A=l(p(b(n,o(w,a,c,f),e[m[w]+t],d(w)),y[w]),h),n=h,h=f,f=p(c,10),c=a,a=A,A=l(p(b(g,o(79-w,v,k,x),e[r[w]+t],i(w)),s[w]),S),g=S,S=x,x=p(k,10),k=v,v=A;A=u(this.h[1],c,x),this.h[1]=u(this.h[2],f,S),this.h[2]=u(this.h[3],h,g),this.h[3]=u(this.h[4],n,v),this.h[4]=u(this.h[0],a,k),this.h[0]=A},a.prototype._digest=function(e){return'hex'===e?c.toHex32(this.h,'little'):c.split32(this.h,'little')};var m=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],r=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],y=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],s=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(e,t,r){'use strict';function n(e,t,r){return this instanceof n?void(this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(a.toArray(t,r))):new n(e,t,r)}var a=r(17),o=r(12);e.exports=n,n.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t=h.cmpn(1)||0<=h.cmp(u))){var m=this.g.mul(h);if(!m.isInfinity()){var y=m.getX(),g=y.umod(this.n);if(0!==g.cmpn(0)){var v=h.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(v=v.umod(this.n),0!==v.cmpn(0)){var k=(m.getY().isOdd()?1:0)|(0===y.cmp(g)?0:2);return d.canonical&&0d.cmpn(1)||0<=d.cmp(this.n))return!1;if(0>r.cmpn(1)||0<=r.cmp(this.n))return!1;var i=r.invm(this.n),s=i.mul(e).umod(this.n),c=i.mul(d).umod(this.n);if(!this.curve._maxwellTrick){var l=this.g.mulAdd(s,n.getPublic(),c);return!l.isInfinity()&&0===l.getX().umod(this.n).cmp(d)}var l=this.g.jmulAdd(s,n.getPublic(),c);return!l.isInfinity()&&l.eqXToP(d)},n.prototype.recoverPubKey=function(t,o,d,i){c((3&d)===d,'The recovery param is more than two bits'),o=new f(o,i);var p=this.n,n=new a(t),e=o.r,r=o.s,s=1&d,l=d>>1;if(0<=e.cmp(this.curve.p.umod(this.curve.n))&&l)throw new Error('Unable to find sencond key candinate');e=l?this.curve.pointFromX(e.add(this.curve.n),s):this.curve.pointFromX(e,s);var u=o.r.invm(p),b=p.sub(n).mul(u).umod(p),h=r.mul(u).umod(p);return this.g.mulAdd(b,e,h)},n.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new f(e,n),null!==e.recoveryParam)return e.recoveryParam;for(var a=0;4>a;a++){var o;try{o=this.recoverPubKey(t,e,a)}catch(t){continue}if(o.eq(r))return a}throw new Error('Unable to find valid recovery factor')}},function(e,t,r){'use strict';function n(e){if(!(this instanceof n))return new n(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||'hex'),r=o.toArray(e.nonce,e.nonceEnc||'hex'),a=o.toArray(e.pers,e.persEnc||'hex');d(t.length>=this.minEntropy/8,'Not enough entropy. Minimum is: '+this.minEntropy+' bits'),this._init(t,r,a)}var a=r(81),o=r(130),d=r(12);e.exports=n,n.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,'Not enough entropy. Minimum is: '+this.minEntropy+' bits'),this._update(e.concat(r||[])),this._reseed=1},n.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error('Reseed is required');'string'!=typeof t&&(n=r,r=t,t=null),r&&(r=o.toArray(r,n||'hex'),this._update(r));for(var a=[];a.length'}},function(e,t,r){'use strict';function n(e,t){return e instanceof n?e:void(this._importDER(e,t)||(p(e.r&&e.s,'Signature without r or s'),this.r=new c(e.r,16),this.s=new c(e.s,16),this.recoveryParam=void 0===e.recoveryParam?null:e.recoveryParam))}function a(){this.place=0}function o(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=0,a=0,o=t.place;a<(15&r);a++,o++)n<<=8,n|=e[o];return t.place=o,n}function d(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&tt)return void e.push(t);var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(255&t>>>(r<<3));e.push(t)}var c=r(2),s=r(10),f=s.utils,p=f.assert;e.exports=n,n.prototype._importDER=function(e,t){e=f.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var d=o(e,n);if(d+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=o(e,n),p=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var r=o(e,n);if(e.length!==r+n.place)return!1;var l=e.slice(n.place,r+n.place);return 0===p[0]&&128&p[1]&&(p=p.slice(1)),0===l[0]&&128&l[1]&&(l=l.slice(1)),this.r=new c(p),this.s=new c(l),this.recoveryParam=null,!0},n.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=d(t),r=d(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var n=[2];i(n,t.length),n=n.concat(t),n.push(2),i(n,r.length);var a=n.concat(r),o=[48];return i(o,a.length),o=o.concat(a),f.encode(o,e)}},function(e,t,r){'use strict';function n(e){if(i('ed25519'===e,'only tested with ed25519 so far'),!(this instanceof n))return new n(e);var e=o.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=a.sha512}var a=r(81),o=r(10),d=o.utils,i=d.assert,s=d.parseBytes,c=r(281),f=r(282);e.exports=n,n.prototype.sign=function(e,t){e=s(e);var n=this.keyFromSecret(t),a=this.hashInt(n.messagePrefix(),e),r=this.g.mul(a),o=this.encodePoint(r),d=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),i=a.add(d).umod(this.curve.n);return this.makeSignature({R:r,S:i,Rencoded:o})},n.prototype.verify=function(e,t,r){e=s(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),a=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S()),d=t.R().add(n.pub().mul(a));return d.eq(o)},n.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=e.cmpn(0))throw new Error('invalid sig');if(e.cmp(t)>=t)throw new Error('invalid sig')}var d=r(2),i=r(10).ec,c=r(34),s=r(138);e.exports=function(e,r,o,s,f){var p=c(o);if('ec'===p.type){if('ecdsa'!==s&&'ecdsa/rsa'!==s)throw new Error('wrong public key type');return n(e,r,p)}if('dsa'===p.type){if('dsa'!==s)throw new Error('wrong public key type');return a(e,r,p)}if('rsa'!==s&&'ecdsa/rsa'!==s)throw new Error('wrong public key type');r=t.concat([f,r]);for(var l=p.modulus.byteLength(),u=[1],b=0;r.length+u.length+2b?1:0;for(l=Math.min(e.length,u.length),e.length!==u.length&&(m=1),h=-1;++hn-l-2)throw new Error('message too long');var u=new t(n-a-l-2);u.fill(0);var b=n-d-1,h=s(d),m=f(t.concat([o,u,new t([1]),r],b),c(h,b)),y=f(h,c(m,d));return new p(t.concat([new t([0]),y,m],n))}function a(e,r,n){var a=r.length,d=e.modulus.byteLength();if(a>d-11)throw new Error('message too long');var i;return n?(i=new t(d-a-3),i.fill(255)):i=o(d-a-3),new p(t.concat([new t([0,n?1:2]),i,new t([0]),r],d))}function o(e){for(var r=new t(e),n=0,a=s(2*e),o=0,d;n=t.length){o++;break}var d=t.slice(2,a-1),i=t.slice(a-1,a);if(('0002'!==n.toString('hex')&&!r||'0001'!==n.toString('hex')&&r)&&o++,8>d.length&&o++,o)throw new Error('decryption error');return t.slice(a)}function o(e,r){e=new t(e),r=new t(r);var n=0,a=e.length;e.length!==r.length&&(n++,a=Math.min(e.length,r.length));for(var o=-1;++op||0<=new i(r).cmp(c.modulus))throw new Error('decryption error');var u=o?l(new i(r),c):f(r,c);var b=new t(p-u.length);if(b.fill(0),u=t.concat([b,u],p),4===s)return n(c,u);if(1===s)return a(c,u,o);if(3===s)return u;throw new Error('unknown padding')}}).call(this,r(3).Buffer)},function(e,t,r){'use strict';(function(e,n){function a(){throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')}function o(e,t){if('number'!=typeof e||e!==e)throw new TypeError('offset must be a number');if(e>u||0>e)throw new TypeError('offset must be a uint32');if(e>p||e>t)throw new RangeError('offset out of range')}function d(e,t,r){if('number'!=typeof e||e!==e)throw new TypeError('size must be a number');if(e>u||0>e)throw new TypeError('size must be a uint32');if(e+t>r||e>p)throw new RangeError('buffer too small')}function i(e,t,r,a){if(n.browser){var o=e.buffer,d=new Uint8Array(o,t,r);return l.getRandomValues(d),a?void n.nextTick(function(){a(null,e)}):e}if(a)return void c(r,function(r,n){return r?a(r):void(n.copy(e,t),a(null,e))});var i=c(r);return i.copy(e,t),e}var s=r(6),c=r(30),f=s.Buffer,p=s.kMaxLength,l=e.crypto||e.msCrypto,u=4294967295;l&&l.getRandomValues||!n.browser?(t.randomFill=function(t,r,n,a){if(!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if('function'==typeof r)a=r,r=0,n=t.length;else if('function'==typeof n)a=n,n=t.length-r;else if('function'!=typeof a)throw new TypeError('"cb" argument must be a function');return o(r,t.length),d(n,r,t.length),i(t,r,n,a)},t.randomFillSync=function(t,r,n){if('undefined'==typeof r&&(r=0),!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return o(r,t.length),void 0===n&&(n=t.length-r),d(n,r,t.length),i(t,r,n)}):(t.randomFill=a,t.randomFillSync=a)}).call(this,r(7),r(9))},function(e,t,r){(function(t){function n(e,r,n,a,o){if(t.isBuffer(e)&&t.isBuffer(n))e.copy(n,a,r,r+o);else for(;o--;)n[a++]=e[r++]}var a=r(142).pbkdf2Sync,o=2147483647;e.exports=function(e,d,s,c,r,f,p){function l(e,t,n,r,a,o){var d=0,s=128*n,c;for(e.copy(o,d,t,t+s),c=0;c>>32-t}function h(e){var t;for(t=0;16>t;t++)v[t]=(255&e[4*t+0])<<0,v[t]|=(255&e[4*t+1])<<8,v[t]|=(255&e[4*t+2])<<16,v[t]|=(255&e[4*t+3])<<24;for(n(v,0,k,0,16),t=8;0t;++t)v[t]=k[t]+v[t];for(t=0;16>t;t++){var r=4*t;e[r+0]=255&v[t]>>0,e[r+1]=255&v[t]>>8,e[r+2]=255&v[t]>>16,e[r+3]=255&v[t]>>24}}function m(e,t,r,n,a){for(var o=0;o 0 and a power of 2');if(s>o/128/c)throw Error('Parameter N is too large');if(c>o/128/r)throw Error('Parameter r is too large');var y=new t(256*c),g=new t(128*c*s),v=new Int32Array(16),k=new Int32Array(16),x=new t(64),S=a(e,d,1,128*r*c,'sha256'),w;if(p){var A=2*(r*s),E=0;w=function(){++E,0==E%1e3&&p({current:E,total:A,percent:100*(E/A)})}}for(var I=0;I=this._blockSize;){for(var d=this._blockOffset;dr;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error('_digest is not implemented')},e.exports=a},function(e,t,r){function n(e,t,r){var p=t&&r||0,i=t||[];e=e||{};var l=e.node||c,u=void 0===e.clockseq?f:e.clockseq;if(null==l||null==u){var b=a();null==l&&(l=c=[1|b[0],b[1],b[2],b[3],b[4],b[5]]),null==u&&(u=f=16383&(b[6]<<8|b[7]))}var h=void 0===e.msecs?new Date().getTime():e.msecs,m=void 0===e.nsecs?s+1:e.nsecs,y=h-d+(m-s)/1e4;if(0>y&&void 0===e.clockseq&&(u=16383&u+1),(0>y||h>d)&&void 0===e.nsecs&&(m=0),1e4<=m)throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');d=h,s=m,f=u,h+=122192928e5;var g=(1e4*(268435455&h)+m)%4294967296;i[p++]=255&g>>>24,i[p++]=255&g>>>16,i[p++]=255&g>>>8,i[p++]=255&g;var v=268435455&1e4*(h/4294967296);i[p++]=255&v>>>8,i[p++]=255&v,i[p++]=16|15&v>>>24,i[p++]=255&v>>>16,i[p++]=128|u>>>8,i[p++]=255&u;for(var k=0;6>k;++k)i[p+k]=l[k];return t?t:o(i)}var a=r(147),o=r(148),d=0,s=0,c,f;e.exports=n},function(e,t,r){var n=r(147),a=r(148);e.exports=function(e,t,r){var o=t&&r||0;'string'==typeof e&&(t='binary'===e?Array(16):null,e=null),e=e||{};var d=e.random||(e.rng||n)();if(d[6]=64|15&d[6],d[8]=128|63&d[8],t)for(var i=0;16>i;++i)t[o+i]=d[i];return t||a(d)}},function(e,t,r){'use strict';t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=r(62),t.createHash=t.Hash=r(63),t.createHmac=t.Hmac=r(309);var n=r(114),a=Object.keys(n),o=['sha1','sha224','sha256','sha384','sha512','md5','rmd160'].concat(a);t.getHashes=function(){return o};var d=r(142);t.pbkdf2=d.pbkdf2,t.pbkdf2Sync=d.pbkdf2Sync;var i=r(311);t.Cipher=i.Cipher,t.createCipher=i.createCipher,t.Cipheriv=i.Cipheriv,t.createCipheriv=i.createCipheriv,t.Decipher=i.Decipher,t.createDecipher=i.createDecipher,t.Decipheriv=i.Decipheriv,t.createDecipheriv=i.createDecipheriv,t.getCiphers=i.getCiphers,t.listCiphers=i.listCiphers;var s=r(125);t.DiffieHellmanGroup=s.DiffieHellmanGroup,t.createDiffieHellmanGroup=s.createDiffieHellmanGroup,t.getDiffieHellman=s.getDiffieHellman,t.createDiffieHellman=s.createDiffieHellman,t.DiffieHellman=s.DiffieHellman;var c=r(129);t.createSign=c.createSign,t.Sign=c.Sign,t.createVerify=c.createVerify,t.Verify=c.Verify,t.createECDH=r(315);var f=r(316);t.publicEncrypt=f.publicEncrypt,t.privateEncrypt=f.privateEncrypt,t.publicDecrypt=f.publicDecrypt,t.privateDecrypt=f.privateDecrypt;var p=r(319);t.randomFill=p.randomFill,t.randomFillSync=p.randomFillSync,t.createCredentials=function(){throw new Error('sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/crypto-browserify/crypto-browserify')},t.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(e,t,r){'use strict';function n(e,t){d.call(this,'digest'),'string'==typeof t&&(t=s.from(t));var r='sha512'===e||'sha384'===e?128:64;if(this._alg=e,this._key=t,t.length>r){var n='rmd160'===e?new c:f(e);t=n.update(t).digest()}else t.lengthc?t=e(t):t.lengthn-l-2)throw new Error('message too long');var u=new t(n-a-l-2);u.fill(0);var b=n-d-1,h=s(d),m=f(t.concat([o,u,new t([1]),r],b),c(h,b)),y=f(h,c(m,d));return new p(t.concat([new t([0]),y,m],n))}function a(e,r,n){var a=r.length,d=e.modulus.byteLength();if(a>d-11)throw new Error('message too long');var i;return n?(i=new t(d-a-3),i.fill(255)):i=o(d-a-3),new p(t.concat([new t([0,n?1:2]),i,new t([0]),r],d))}function o(e){for(var r=new t(e),n=0,a=s(2*e),o=0,d;n=t.length){o++;break}var d=t.slice(2,a-1),i=t.slice(a-1,a);if(('0002'!==n.toString('hex')&&!r||'0001'!==n.toString('hex')&&r)&&o++,8>d.length&&o++,o)throw new Error('decryption error');return t.slice(a)}function o(e,r){e=new t(e),r=new t(r);var n=0,a=e.length;e.length!==r.length&&(n++,a=Math.min(e.length,r.length));for(var o=-1;++op||0<=new i(r).cmp(c.modulus))throw new Error('decryption error');var u=o?l(new i(r),c):f(r,c);var b=new t(p-u.length);if(b.fill(0),u=t.concat([b,u],p),4===s)return n(c,u);if(1===s)return a(c,u,o);if(3===s)return u;throw new Error('unknown padding')}}).call(this,r(3).Buffer)},function(e,t,r){'use strict';(function(e,n){function a(){throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')}function o(e,t){if('number'!=typeof e||e!==e)throw new TypeError('offset must be a number');if(e>u||0>e)throw new TypeError('offset must be a uint32');if(e>p||e>t)throw new RangeError('offset out of range')}function d(e,t,r){if('number'!=typeof e||e!==e)throw new TypeError('size must be a number');if(e>u||0>e)throw new TypeError('size must be a uint32');if(e+t>r||e>p)throw new RangeError('buffer too small')}function i(e,t,r,a){if(n.browser){var o=e.buffer,d=new Uint8Array(o,t,r);return l.getRandomValues(d),a?void n.nextTick(function(){a(null,e)}):e}if(a)return void c(r,function(r,n){return r?a(r):void(n.copy(e,t),a(null,e))});var i=c(r);return i.copy(e,t),e}var s=r(19),c=r(62),f=s.Buffer,p=s.kMaxLength,l=e.crypto||e.msCrypto,u=4294967295;l&&l.getRandomValues||!n.browser?(t.randomFill=function(t,r,n,a){if(!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if('function'==typeof r)a=r,r=0,n=t.length;else if('function'==typeof n)a=n,n=t.length-r;else if('function'!=typeof a)throw new TypeError('"cb" argument must be a function');return o(r,t.length),d(n,r,t.length),i(t,r,n,a)},t.randomFillSync=function(t,r,n){if('undefined'==typeof r&&(r=0),!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return o(r,t.length),void 0===n&&(n=t.length-r),d(n,r,t.length),i(t,r,n)}):(t.randomFill=a,t.randomFillSync=a)}).call(this,r(7),r(9))},function(e,t,r){var n,a;(function(o,d){n=[r(101),r(321)],a=function(e,t){return d(e,t)}.apply(t,n),!(a!==void 0&&(e.exports=a))})(this,function(e,t){function r(r,n,a){for(var o=[],d=e.ucs2.decode(r),s=0;s>21,l=t.mapStr.substr(65535&f>>5,31&f);if(0==p||n&&1&f>>23)throw new Error('Illegal char '+c);else 1==p?o.push(l):2==p?o.push(a?l:c):3==p&&o.push(c)}var u=o.join('').normalize('NFC');return u}function n(t,n,o){void 0===o&&(o=!1);var d=r(t,o,n),i=d.split('.');return i=i.map(function(t){return t.startsWith('xn--')?(t=e.decode(t.substring(4)),a(t,o,!1)):a(t,o,n),t}),i.join('.')}function a(e,n,a){if('-'===e[2]&&'-'===e[3])throw new Error('Failed to validate '+e);if(e.startsWith('-')||e.endsWith('-'))throw new Error('Failed to validate '+e);if(e.includes('.'))throw new Error('Failed to validate '+e);if(r(e,n,a)!==e)throw new Error('Failed to validate '+e);var o=e.codePointAt(0);if(t.mapChar(o)&16777216)throw new Error('Label contains illegal character: '+o)}function o(t,r){r===void 0&&(r={});var a=!('transitional'in r)||r.transitional,o=!!('useStd3ASCII'in r)&&r.useStd3ASCII,d=!!('verifyDnsLength'in r)&&r.verifyDnsLength,s=n(t,a,o).split('.'),c=s.map(e.toASCII),f=c.join('.'),p;if(d){if(1>f.length||253i.length||63\\$%@\u0621\u0624\u0629"\'^|~\u2985\u2986\u30FB\u30A5\u30E3\xA2\xA3\xAC\xA6\xA5\u20A9\u2502\u2190\u2191\u2192\u2193\u25A0\u25CB\uD801\uDC28\uD801\uDC29\uD801\uDC2A\uD801\uDC2B\uD801\uDC2C\uD801\uDC2D\uD801\uDC2E\uD801\uDC2F\uD801\uDC30\uD801\uDC31\uD801\uDC32\uD801\uDC33\uD801\uDC34\uD801\uDC35\uD801\uDC36\uD801\uDC37\uD801\uDC38\uD801\uDC39\uD801\uDC3A\uD801\uDC3B\uD801\uDC3C\uD801\uDC3D\uD801\uDC3E\uD801\uDC3F\uD801\uDC40\uD801\uDC41\uD801\uDC42\uD801\uDC43\uD801\uDC44\uD801\uDC45\uD801\uDC46\uD801\uDC47\uD801\uDC48\uD801\uDC49\uD801\uDC4A\uD801\uDC4B\uD801\uDC4C\uD801\uDC4D\uD801\uDC4E\uD801\uDC4F\uD801\uDCD8\uD801\uDCD9\uD801\uDCDA\uD801\uDCDB\uD801\uDCDC\uD801\uDCDD\uD801\uDCDE\uD801\uDCDF\uD801\uDCE0\uD801\uDCE1\uD801\uDCE2\uD801\uDCE3\uD801\uDCE4\uD801\uDCE5\uD801\uDCE6\uD801\uDCE7\uD801\uDCE8\uD801\uDCE9\uD801\uDCEA\uD801\uDCEB\uD801\uDCEC\uD801\uDCED\uD801\uDCEE\uD801\uDCEF\uD801\uDCF0\uD801\uDCF1\uD801\uDCF2\uD801\uDCF3\uD801\uDCF4\uD801\uDCF5\uD801\uDCF6\uD801\uDCF7\uD801\uDCF8\uD801\uDCF9\uD801\uDCFA\uD801\uDCFB\uD803\uDCC0\uD803\uDCC1\uD803\uDCC2\uD803\uDCC3\uD803\uDCC4\uD803\uDCC5\uD803\uDCC6\uD803\uDCC7\uD803\uDCC8\uD803\uDCC9\uD803\uDCCA\uD803\uDCCB\uD803\uDCCC\uD803\uDCCD\uD803\uDCCE\uD803\uDCCF\uD803\uDCD0\uD803\uDCD1\uD803\uDCD2\uD803\uDCD3\uD803\uDCD4\uD803\uDCD5\uD803\uDCD6\uD803\uDCD7\uD803\uDCD8\uD803\uDCD9\uD803\uDCDA\uD803\uDCDB\uD803\uDCDC\uD803\uDCDD\uD803\uDCDE\uD803\uDCDF\uD803\uDCE0\uD803\uDCE1\uD803\uDCE2\uD803\uDCE3\uD803\uDCE4\uD803\uDCE5\uD803\uDCE6\uD803\uDCE7\uD803\uDCE8\uD803\uDCE9\uD803\uDCEA\uD803\uDCEB\uD803\uDCEC\uD803\uDCED\uD803\uDCEE\uD803\uDCEF\uD803\uDCF0\uD803\uDCF1\uD803\uDCF2\uD806\uDCC0\uD806\uDCC1\uD806\uDCC2\uD806\uDCC3\uD806\uDCC4\uD806\uDCC5\uD806\uDCC6\uD806\uDCC7\uD806\uDCC8\uD806\uDCC9\uD806\uDCCA\uD806\uDCCB\uD806\uDCCC\uD806\uDCCD\uD806\uDCCE\uD806\uDCCF\uD806\uDCD0\uD806\uDCD1\uD806\uDCD2\uD806\uDCD3\uD806\uDCD4\uD806\uDCD5\uD806\uDCD6\uD806\uDCD7\uD806\uDCD8\uD806\uDCD9\uD806\uDCDA\uD806\uDCDB\uD806\uDCDC\uD806\uDCDD\uD806\uDCDE\uD806\uDCDF\u0131\u0237\u2207\u2202\uD83A\uDD22\uD83A\uDD23\uD83A\uDD24\uD83A\uDD25\uD83A\uDD26\uD83A\uDD27\uD83A\uDD28\uD83A\uDD29\uD83A\uDD2A\uD83A\uDD2B\uD83A\uDD2C\uD83A\uDD2D\uD83A\uDD2E\uD83A\uDD2F\uD83A\uDD30\uD83A\uDD31\uD83A\uDD32\uD83A\uDD33\uD83A\uDD34\uD83A\uDD35\uD83A\uDD36\uD83A\uDD37\uD83A\uDD38\uD83A\uDD39\uD83A\uDD3A\uD83A\uDD3B\uD83A\uDD3C\uD83A\uDD3D\uD83A\uDD3E\uD83A\uDD3F\uD83A\uDD40\uD83A\uDD41\uD83A\uDD42\uD83A\uDD43\u066E\u06A1\u066F\u5B57\u53CC\u591A\u89E3\u4EA4\u6620\u7121\u524D\u5F8C\u518D\u65B0\u521D\u7D42\u8CA9\u58F0\u5439\u6F14\u6295\u6355\u904A\u6307\u7981\u7A7A\u5408\u6E80\u7533\u5272\u55B6\u914D\u5F97\u53EF\u4E3D\u4E38\u4E41\uD840\uDD22\u4F60\u4FBB\u5002\u507A\u5099\u50CF\u349E\uD841\uDE3A\u5154\u5164\u5177\uD841\uDD1C\u34B9\u5167\uD841\uDD4B\u5197\u51A4\u4ECC\u51AC\uD864\uDDDF\u5203\u34DF\u523B\u5246\u5277\u3515\u5305\u5306\u5349\u535A\u5373\u537D\u537F\uD842\uDE2C\u7070\u53CA\u53DF\uD842\uDF63\u53EB\u53F1\u5406\u549E\u5438\u5448\u5468\u54A2\u54F6\u5510\u5553\u5563\u5584\u55AB\u55B3\u55C2\u5716\u5717\u5651\u5674\u58EE\u57CE\u57F4\u580D\u578B\u5832\u5831\u58AC\uD845\uDCE4\u58F2\u58F7\u5906\u5922\u5962\uD845\uDEA8\uD845\uDEEA\u59EC\u5A1B\u5A27\u59D8\u5A66\u36EE\u5B08\u5B3E\uD846\uDDC8\u5BC3\u5BD8\u5BF3\uD846\uDF18\u5BFF\u5C06\u3781\u5C60\u5CC0\u5C8D\uD847\uDDE4\u5D43\uD847\uDDE6\u5D6E\u5D6B\u5D7C\u5DE1\u5DE2\u382F\u5DFD\u5E28\u5E3D\u5E69\u3862\uD848\uDD83\u387C\u5EB0\u5EB3\u5EB6\uD868\uDF92\uD848\uDF31\u8201\u5F22\u38C7\uD84C\uDEB8\uD858\uDDDA\u5F62\u5F6B\u38E3\u5F9A\u5FCD\u5FD7\u5FF9\u6081\u393A\u391C\uD849\uDED4\u60C7\u6148\u614C\u617A\u61B2\u61A4\u61AF\u61DE\u621B\u625D\u62B1\u62D4\u6350\uD84A\uDF0C\u633D\u62FC\u6368\u6383\u63E4\uD84A\uDFF1\u6422\u63C5\u63A9\u3A2E\u6469\u647E\u649D\u6477\u3A6C\u656C\uD84C\uDC0A\u65E3\u66F8\u6649\u3B19\u3B08\u3AE4\u5192\u5195\u6700\u669C\u80AD\u43D9\u6721\u675E\u6753\uD84C\uDFC3\u3B49\u67FA\u6785\u6852\uD84D\uDC6D\u688E\u681F\u6914\u6942\u69A3\u69EA\u6AA8\uD84D\uDEA3\u6ADB\u3C18\u6B21\uD84E\uDCA7\u6B54\u3C4E\u6B72\u6B9F\u6BBB\uD84E\uDE8D\uD847\uDD0B\uD84E\uDEFA\u6C4E\uD84F\uDCBC\u6CBF\u6CCD\u6C67\u6D16\u6D3E\u6D69\u6D78\u6D85\uD84F\uDD1E\u6D34\u6E2F\u6E6E\u3D33\u6EC7\uD84F\uDED1\u6DF9\u6F6E\uD84F\uDF5E\uD84F\uDF8E\u6FC6\u7039\u701B\u3D96\u704A\u707D\u7077\u70AD\uD841\uDD25\u7145\uD850\uDE63\u719C\u7228\u7250\uD851\uDE08\u7280\u7295\uD851\uDF35\uD852\uDC14\u737A\u738B\u3EAC\u73A5\u3EB8\u7447\u745C\u7485\u74CA\u3F1B\u7524\uD853\uDC36\u753E\uD853\uDC92\uD848\uDD9F\u7610\uD853\uDFA1\uD853\uDFB8\uD854\uDC44\u3FFC\u4008\uD854\uDCF3\uD854\uDCF2\uD854\uDD19\uD854\uDD33\u771E\u771F\u778B\u4046\u4096\uD855\uDC1D\u784E\u40E3\uD855\uDE26\uD855\uDE9A\uD855\uDEC5\u79EB\u412F\u7A4A\u7A4F\uD856\uDD7C\uD856\uDEA7\u4202\uD856\uDFAB\u7BC6\u7BC9\u4227\uD857\uDC80\u7CD2\u42A0\u7CE8\u7CE3\u7D00\uD857\uDF86\u7D63\u4301\u7DC7\u7E02\u7E45\u4334\uD858\uDE28\uD858\uDE47\u4359\uD858\uDED9\u7F7A\uD858\uDF3E\u7F95\u7FFA\uD859\uDCDA\uD859\uDD23\u8060\uD859\uDDA8\u8070\uD84C\uDF5F\u43D5\u80B2\u8103\u440B\u813E\u5AB5\uD859\uDFA7\uD859\uDFB5\uD84C\uDF93\uD84C\uDF9C\u8204\u8F9E\u446B\u8291\u828B\u829D\u52B3\u82B1\u82B3\u82BD\u82E6\uD85A\uDF3C\u831D\u8363\u83AD\u8323\u83BD\u83E7\u8353\u83CA\u83CC\u83DC\uD85B\uDC36\uD85B\uDD6B\uD85B\uDCD5\u452B\u84F1\u84F3\u8516\uD85C\uDFCA\u8564\uD85B\uDF2C\u455D\u4561\uD85B\uDFB1\uD85C\uDCD2\u456B\u8650\u8667\u8669\u86A9\u8688\u870E\u86E2\u8728\u876B\u8786\u87E1\u8801\u45F9\u8860\uD85D\uDE67\u88D7\u88DE\u4635\u88FA\u34BB\uD85E\uDCAE\uD85E\uDD66\u46BE\u46C7\u8AA0\uD85F\uDCA8\u8CAB\u8CC1\u8D1B\u8D77\uD85F\uDF2F\uD842\uDC04\u8DCB\u8DBC\u8DF0\uD842\uDCDE\u8ED4\uD861\uDDD2\uD861\uDDED\u9094\u90F1\u9111\uD861\uDF2E\u911B\u9238\u92D7\u92D8\u927C\u93F9\u9415\uD862\uDFFA\u958B\u4995\u95B7\uD863\uDD77\u49E6\u96C3\u5DB2\u9723\uD864\uDD45\uD864\uDE1A\u4A6E\u4A76\u97E0\uD865\uDC0A\u4AB2\uD865\uDC96\u9829\uD865\uDDB6\u98E2\u4B33\u9929\u99A7\u99C2\u99FE\u4BCE\uD866\uDF30\u9C40\u9CFD\u4CCE\u4CED\u9D67\uD868\uDCCE\u4CF8\uD868\uDD05\uD868\uDE0E\uD868\uDE91\u4D56\u9EFE\u9F05\u9F0F\u9F16\uD869\uDE00',mapChar:function(r){return 196608<=r?917760<=r&&917999>=r?18874368:0:e[t[r>>4]][15&r]}}})},function(e,t,r){var n=r(323);e.exports=function(e,t){return new Promise(function(r,a){n(e,t,function(e,t){e?a(e):r(t)})})}},function(e,t,r){var n=r(324),a=r(327),o=r(153),d=r(328),i=r(329),s='application/json',c=function(){};e.exports=function(e,t,r){if(!e||'string'!=typeof e)throw new TypeError('must specify a URL');if('function'==typeof t&&(r=t,t={}),r&&'function'!=typeof r)throw new TypeError('expected cb to be undefined or a function');r=r||c,t=t||{};var f=t.json?'json':'text';t=o({responseType:f},t);var p=t.headers||{},l=(t.method||'GET').toUpperCase(),u=t.query;return u&&('string'!=typeof u&&(u=n.stringify(u)),e=a(e,u)),'json'===t.responseType&&d(p,'Accept',s),t.json&&'GET'!==l&&'HEAD'!==l&&(d(p,'Content-Type',s),t.body=JSON.stringify(t.body)),t.method=l,t.url=e,t.headers=p,delete t.query,delete t.json,i(t,r)}},function(e,t,r){'use strict';function n(e){switch(e.arrayFormat){case'index':return function(t,r,n){return null===r?[o(t,e),'[',n,']'].join(''):[o(t,e),'[',o(n,e),']=',o(r,e)].join('')};case'bracket':return function(t,r){return null===r?o(t,e):[o(t,e),'[]=',o(r,e)].join('')};default:return function(t,r){return null===r?o(t,e):[o(t,e),'=',o(r,e)].join('')};}}function a(e){var t;switch(e.arrayFormat){case'index':return function(e,r,n){return t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,''),t?void(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):void(n[e]=r)};case'bracket':return function(e,r,n){return(t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,''),!t)?void(n[e]=r):void 0===n[e]?void(n[e]=[r]):void(n[e]=[].concat(n[e],r))};default:return function(e,t,r){return void 0===r[e]?void(r[e]=t):void(r[e]=[].concat(r[e],t))};}}function o(e,t){return t.encode?t.strict?c(e):encodeURIComponent(e):e}function d(e){if(Array.isArray(e))return e.sort();return'object'==typeof e?d(Object.keys(e)).sort(function(e,t){return+e-+t}).map(function(t){return e[t]}):e}function i(e){var t=e.indexOf('?');return-1===t?'':e.slice(t+1)}function s(e,t){t=f({arrayFormat:'none'},t);var r=a(t),n=Object.create(null);return'string'==typeof e?(e=e.trim().replace(/^[?#&]/,''),!e)?n:(e.split('&').forEach(function(e){var t=e.replace(/\+/g,' ').split('='),a=t.shift(),o=0arguments.length&&(r=this),'[object Array]'===i.call(e)?n(e,t,r):'string'==typeof e?a(e,t,r):o(e,t,r)};var i=Object.prototype.toString,s=Object.prototype.hasOwnProperty},function(e){e.exports=function(){for(var e={},r=0,n;r=r)return o(r,t);for(var n=4096;n*128{this.resolve=e,this.reject=t}),this.eventEmitter=new i.a,new Proxy(this,{get:this.proxyHandler})}proxyHandler(e,t){if('resolve'===t||'reject'===t)return e[t];if(this.promise[t])return e.promise[t];if(this.eventEmitter[t])return e.eventEmitter[t];throw Error(`Method with name ${t} not found`)}}var c=r(1),f=r(15),p=r(8),l=r(16),u=r(196),b=r(0),h=r.n(b),m=r(157);const y=new m.AbiCoder((e,t)=>!e.match(/^u?int/)||Object(b.isArray)(t)||Object(b.isObject)(t)&&'BN'===t.constructor.name?t:t.toString());class g{constructor(e){this.utils=e}encodeFunctionSignature(e){return Object(b.isObject)(e)&&(e=this.utils._jsonInterfaceMethodToString(e)),this.utils.sha3(e).slice(0,10)}encodeEventSignature(e){return Object(b.isObject)(e)&&(e=this.utils._jsonInterfaceMethodToString(e)),this.utils.sha3(e)}encodeParameter(e,t){return this.encodeParameters([e],[t])}encodeParameters(e,t){return y.encode(this.mapTypes(e),t)}mapTypes(e){const t=[];return e.forEach((e)=>{if(this.isSimplifiedStructFormat(e)){const r=Object.keys(e)[0];return void t.push(Object.assign(this.mapStructNameAndType(r),{components:this.mapStructToCoderFormat(e[r])}))}t.push(e)}),t}isSimplifiedStructFormat(e){return'object'==typeof e&&'undefined'==typeof e.components&&'undefined'==typeof e.name}mapStructNameAndType(e){let t='tuple';return-1'object'==typeof e[r]?void t.push(Object.assign(this.mapStructNameAndType(r),{components:this.mapStructToCoderFormat(e[r])})):void t.push({name:r,type:e[r]})),t}encodeFunctionCall(e,t){return this.encodeFunctionSignature(e)+this.encodeParameters(e.inputs,t).replace('0x','')}decodeParameter(e,t){return this.decodeParameters([e],t)[0]}decodeParameters(e,t){if(!t||'0x'===t||'0X'===t)throw new Error('Returned values aren\'t valid, did it run Out of Gas?');const r=y.decode(this.mapTypes(e),`0x${t.replace(/0x/i,'')}`),a=new n;return a.__length__=0,e.forEach((e,t)=>{let n=r[a.__length__];n='0x'===n?null:n,a[t]=n,Object(b.isObject)(e)&&e.name&&(a[e.name]=n),a.__length__++}),a}decodeLog(e,t,r){const a=this;r=Object(b.isArray)(r)?r:[r],t=t||'';const o=[],d=[];let s=0;e.forEach((e,t)=>{e.indexed?(d[t]=['bool','int','uint','address','fixed','ufixed'].find((t)=>-1!==e.type.indexOf(t))?a.decodeParameter(e.type,r[s]):r[s],s++):o[t]=e});const i=t,c=i?this.decodeParameters(o,i):[],f=new n;return f.__length__=0,e.forEach((e,t)=>{f[t]='string'===e.type?'':null,'undefined'!=typeof c[t]&&(f[t]=c[t]),'undefined'!=typeof d[t]&&(f[t]=d[t]),e.name&&(f[e.name]=f[t]),f.__length__++}),f}}class v{createABICoder(e){return new g(e)}}const k=()=>new v().createABICoder(c.a);class x{constructor(e){this.providersPackageFactory=e}resolve(e,t){if('string'==typeof e){if(/^http(s)?:\/\//i.test(e))return this.providersPackageFactory.createHttpProviderAdapter(this.providersPackageFactory.createHttpProvider(e));if(/^ws(s)?:\/\//i.test(e))return this.providersPackageFactory.createSocketProviderAdapter(this.providersPackageFactory.createWebsocketProvider(e));if(e&&_.isObject(t)&&_.isFunction(t.connect))return this.providersPackageFactory.createSocketProviderAdapter(this.providersPackageFactory.createIpcProvider(e,t))}if(_.isFunction(e.sendAsync))return this.providersPackageFactory.createInpageProviderAdapter(e);switch(e.constructor.name){case'HttpProvider':return this.providersPackageFactory.createHttpProviderAdapter(e);case'WebsocketProvider':case'IpcProvider':return this.providersPackageFactory.createSocketProviderAdapter(e);case'EthereumProvider':case'HttpProviderAdapter':case'SocketProviderAdapter':case'InpageProviderAdapter':return e;}throw Error('Please provide an valid Web3 provider or the EthereumProvider')}}let S;try{S=Function('return this')()}catch(t){S=window}class w{detect(){return'undefined'==typeof S.ethereumProvider?'undefined'!=typeof S.web3&&S.web3.currentProvider?(this.isIpcProviderWrapper(S.web3.currentProvider)&&(S.web3.currentProvider=this.addSubscriptionsToIpcProviderWrapper(S.web3.currentProvider)),S.web3.currentProvider):void 0:S.ethereumProvider}isIpcProviderWrapper(e){return!e.on&&e.connection&&'ipcProviderWrapper'===e.connection.constructor.name}addSubscriptionsToIpcProviderWrapper(e){return e.on=(e,t)=>{if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');'data'===e?this.connection.on('data',(e)=>{let r='';e=e.toString();try{r=JSON.parse(e)}catch(r){return t(new Error(`Couldn't parse response data${e}`))}r.id||-1===r.method.indexOf('_subscription')||t(null,r)}):this.connection.on(e,t)},e}}let A=0;class E{static toPayload(e,t){if(!e)throw new Error(`JSONRPC method should be specified for params: "${JSON.stringify(t)}"!`);return A++,{jsonrpc:'2.0',id:A,method:e,params:t||[]}}static toBatchPayload(e){return e.map((e)=>(e.beforeExecution(),E.toPayload(e.rpcMethod,e.parameters)))}}class I{static isValid(e){return Array.isArray(e)?e.every(this.isResponseItemValid):this.isResponseItemValid(e)}static isResponseItemValid(e){return!!e&&!e.error&&'2.0'===e.jsonrpc&&('number'==typeof e.id||'string'==typeof e.id)&&e.result!==void 0}}var C=r(158),P=r.n(C);class T extends P.a{constructor(e){super(),this.provider=e}send(e,t){const r=E.toPayload(e,t);return new Promise((e,t)=>{this.provider.send(r,(r,n)=>{this.handleResponse(t,e,r,n)})})}sendBatch(e,t){this.provider.send(e,t)}subscribe(){return new Promise((e,t)=>{t(new Error(`The current provider does not support subscriptions: ${this.provider.constructor.name}`))})}unsubscribe(){return new Promise((e,t)=>{t(new Error(`The current provider does not support subscriptions: ${this.provider.constructor.name}`))})}handleResponse(e,t,r,n){return n&&n.id&&payload.id!==n.id?void e(new Error(`Wrong response id "${n.id}" (expected: "${payload.id}") in ${JSON.stringify(payload)}`)):n&&n.error?void e(o.a.ErrorResponse(n)):I.isValid(n.result)?r?void e(r):void t(n.result):void e(o.a.InvalidResponse(n))}isConnected(){return this.provider.connected}}class B extends T{constructor(e){super(e),this.host=e.path,this.subscriptions=[],this.registerSubscriptionListener()}subscribe(e,t,r){return this.send(e,r.unshift(t)).then((e,t)=>{if(!e)return this.subscriptions.push(t),t;throw new Error(`Provider error: ${e}`)})}unsubscribe(e,t){return this.send(t,[e]).then(function(t){return!!t&&(this.subscriptions=this.subscriptions.filter((t)=>t!==e),!0)})}registerSubscriptionListener(){this.provider.on('data',(e,t)=>{e=e||t,e.method&&this.hasSubscription(e.params.subscription)&&this.emit(e.params.subscription,e.params.result)})}hasSubscription(e){return-1{e.push(this.unsubscribe(t))}),Promise.all(e).then(()=>{this.provider.reset(),this.subscriptions=[]})}removeSubscription(e,t){return this.unsubscribe(e,t).then((t)=>!!t&&(delete this.subscriptions[this.subscriptions.indexOf(e)],!0))}}class N extends T{constructor(e){super(e),this.provider.send=this.provider.sendAsync,delete this.provider.sendAsync}isConnected(){return this.provider.isConnected}}class R extends T{constructor(e){super(e),this.host=e.host}}var M=r(65),L=r(52),j=r(159),O=r.n(j);class D{constructor(e,t){this.responseCallbacks={},this.notificationCallbacks=[],this.path=e,this.connected=!1,this.connection=t.connect({path:this.path}),this.addDefaultEvents();const r=(e)=>{let t=null;Object(b.isArray)(e)?e.forEach((e)=>{this.responseCallbacks[e.id]&&(t=e.id)}):t=e.id,t||-1===e.method.indexOf('_subscription')?this.responseCallbacks[t]&&(this.responseCallbacks[t](null,e),delete this.responseCallbacks[t]):this.notificationCallbacks.forEach((t)=>{Object(b.isFunction)(t)&&t(e)})};'Socket'===t.constructor.name?O()(this.connection).done(r):this.connection.on('data',(e)=>{this._parseResponse(e.toString()).forEach(r)})}addDefaultEvents(){this.connection.on('connect',()=>{this.connected=!0}),this.connection.on('close',()=>{this.connected=!1}),this.connection.on('error',()=>{this._timeout()}),this.connection.on('end',()=>{this._timeout()}),this.connection.on('timeout',()=>{this._timeout()})}_parseResponse(e){const t=[],r=e.replace(/\}[\n\r]?\{/g,'}|--|{').replace(/\}\][\n\r]?\[\{/g,'}]|--|[{').replace(/\}[\n\r]?\[\{/g,'}|--|[{').replace(/\}\][\n\r]?\{/g,'}]|--|{').split('|--|');return r.forEach((e)=>{let r=null;this.lastChunk&&(e=this.lastChunk+e);try{r=JSON.parse(e)}catch(t){return this.lastChunk=e,clearTimeout(this.lastChunkTimeout),void(this.lastChunkTimeout=setTimeout(()=>{throw this._timeout(),o.a.InvalidResponse(e)},15000))}clearTimeout(this.lastChunkTimeout),this.lastChunk=null,r&&t.push(r)}),t}_addResponseCallback(e,t){const r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n}_timeout(){for(const e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](o.a.InvalidConnection('on IPC')),delete this.responseCallbacks[e])}reconnect(){this.connection.connect({path:this.path})}send(e,t){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(e)),this._addResponseCallback(e,t)}on(e,t){if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');switch(e){case'data':this.notificationCallbacks.push(t);break;default:this.connection.on(e,t);}}once(e,t){if('function'!=typeof t)throw new Error('The second parameter callback must be a function.');this.connection.once(e,t)}removeListener(e,t){switch(e){case'data':this.notificationCallbacks.forEach((e,r)=>{e===t&&this.notificationCallbacks.splice(r,1)});break;default:this.connection.removeListener(e,t);}}removeAllListeners(e){switch(e){case'data':this.notificationCallbacks=[];break;default:this.connection.removeAllListeners(e);}}reset(){this._timeout(),this.notificationCallbacks=[],this.connection.removeAllListeners('error'),this.connection.removeAllListeners('end'),this.connection.removeAllListeners('timeout'),this.addDefaultEvents()}}var U=r(160),H=r(66),F=r.n(H),q=r(84),z=r.n(q);class K{constructor(e,t={}){this.host=e||'http://localhost:8545','https'===this.host.substring(0,5)?this.httpsAgent=new z.a.Agent({keepAlive:!0}):this.httpAgent=new F.a.Agent({keepAlive:!0}),this.timeout=t.timeout||0,this.headers=t.headers,this.connected=!1}_prepareRequest(){const e=new U.XMLHttpRequest;return e.nodejsSet({httpsAgent:this.httpsAgent,httpAgent:this.httpAgent}),e.open('POST',this.host,!0),e.setRequestHeader('Content-Type','application/json'),e.timeout=this.timeout&&1!==this.timeout?this.timeout:0,e.withCredentials=!0,this.headers&&this.headers.forEach((t)=>{e.setRequestHeader(t.name,t.value)}),e}send(e,t){const r=this._prepareRequest();r.onreadystatechange=()=>{if(4===r.readyState&&1!==r.timeout){let e=r.responseText,n=null;try{e=JSON.parse(e)}catch(t){n=o.a.InvalidResponse(r.responseText)}this.connected=!0,t(n,e)}},r.ontimeout=function(){this.connected=!1,t(o.a.ConnectionTimeout(this.timeout))};try{r.send(JSON.stringify(e))}catch(e){this.connected=!1,t(o.a.InvalidConnection(this.host))}}disconnect(){}}class V{constructor(e,t,r){this.provider=e,this.jsonRpcMapper=t,this.jsonRpcResponseValidator=r,this.requests=[]}add(e){this.requests.push(e)}execute(){this.provider.sendBatch(this.jsonRpcMapper.toBatchPayload(this.requests),(e,t)=>Object(b.isArray)(t)?void this.requests.forEach(function(e,r){const n=t[r]||null;if(Object(b.isFunction)(e.callback)){Object(b.isObject)(n)&&n.error&&e.callback(o.a.ErrorResponse(n)),this.jsonRpcResponseValidator.isValid(n)||e.callback(o.a.InvalidResponse(n));try{const t=e.afterExecution(n.result);e.callback(null,t)}catch(t){e.callback(t,null)}}}):void request.callback(o.a.InvalidResponse(t)))}hasOutputFormatter(e){return Object(b.isFunction)(e.methodModel.outputFormatter)}}class G{createBatchRequest(e){return new V(e,E,I)}createProviderAdapterResolver(){return new x(this)}createProviderDetector(){return new w}createHttpProvider(e){return new K(e)}createWebsocketProvider(e){return new M.a(e)}createIpcProvider(e,t){return new D(e,t)}createHttpProviderAdapter(e){return new R(e)}createSocketProviderAdapter(e){return new B(e)}createInpageProviderAdapter(e){return new N(e)}createJSONRpcResponseValidator(){return new I}}const W={HttpProvider,WebsocketProvider,IpcProvider};class X{constructor(e){this.abi=e}getMethod(e){return!!this.hasMethod(e)&&this.abi.methods[e]}getEvent(e){return!!this.hasEvent(e)&&this.abi.events[e]}getEvents(){return this.abi.events}getEventBySignature(e){return this.abi.events.find((t)=>t.signature===e)}hasMethod(e){return'undefined'!=typeof this.abi.methods[e]}hasEvent(e){return'undefined'!=typeof this.abi.events[e]}}class Y{constructor(e){this.abiItem=e,this.signature=this.abiItem.signature,this.name=this.abiItem.name,this.anonymous=this.abiItem.anonymous,this.contractMethodParameters=[],Object.defineProperty(this,'requestType',{get(){return'function'===e.type?!0===e.constant?'call':'send':'constructor'===e.type?'contract-deployment':void 0}})}getInputLength(){return h.a.isArray(this.abiItem.inputs)?this.abiItem.inputs.length:0}getInputs(){let e=[];return h.a.isArray(this.abiItem.inputs)&&(e=this.abiItem.inputs),e}givenParametersLengthIsValid(){const e=this.getInputLength();return!(this.contractMethodParameters.length!==e)||new Error(`The number of arguments is not matching the methods required number. You need to pass ${e} arguments.`)}getIndexedInputs(){return this.getInputs().filter((e)=>!0===e.indexed)}isOfType(e){return this.abiItem.type===e}}class Z{constructor(e){this.abiCoder=e}encode(e,t){let r;try{r=this.abiCoder.encodeParameters(e.getInputs(),e.contractMethodParameters).replace('0x','')}catch(e){return e}return'constructor'===e.signature?t?t+r:new Error('The contract has no contract data option set. This is necessary to append the constructor parameters.'):e.isOfType('function')?e.signature+r:r}}class J{constructor(e){this.abiCoder=e}encode(e,t){const r=e.getIndexedInputs();let n=[];return r.forEach((e)=>{if('undefined'!=typeof t[e.name]){const r=t[e.name];if(_.isArray(r))return r.map((t)=>this.abiCoder.encodeParameter(e.type,t)),void n.push(r);n.push(this.abiCoder.encodeParameter(e.type,r))}}),n}}class $ extends J{constructor(e){super(e)}encode(e,t){const r=e.getEvents();let n=[];return Object.keys(r).forEach((e)=>{n.push(super.encode(r[e],t))}),n}}class Q{constructor(e){this.abiCoder=e}decode(e,t){if(!t)return null;2<=t.length&&(t=t.slice(2));const r=this.abiCoder.decodeParameters(e,t);return 1===r.__length__?r[0]:r}}var ee=r(67),te=r.n(ee);class re extends te.a{constructor(e,t,r){super(t,r),this.abiModel=e}decode(e,t){return super.decode(this.abiModel.getEventBySignature(t.topics[0]),t)}}class ne{constructor(e,t,r){this.utils=r,this.abiCoder=t,this.contractPackageFactory=e}map(e){const t=this,r={methods:{},events:{}};return e.forEach((e)=>{e.constant=t.isConstant(e),e.payable=t.isPayable(e),e.name&&(e.funcName=t.utils._jsonInterfaceMethodToString(e));let n;return'function'===e.type?(e.signature=t.abiCoder.encodeFunctionSignature(e.funcName),n=t.contractPackageFactory.createABIItemModel(e),r.methods[e.name]?_.isArray(r.methods[e.name])?r.methods[e.name].push(n):r.methods[e.name]=[r.methods[e.name],n]:r.methods[e.name]=n,r.methods[e.signature]=n,void(r.methods[e.funcName]=n)):void('event'===e.type&&(e.signature=t.abiCoder.encodeEventSignature(e.funcName),e=t.contractPackageFactory.createABIItemModel(event),(!r.events[e.name]||'bound '===r.events[e.name].name)&&(r.events[e.name]=n),r.events[e.signature]=n,r.events[e.funcName]=n),'constructor'===e.type&&(e.signature=e.type,r.methods.contractConstructor=t.contractPackageFactory.createABIItemModel(e)))}),this.contractPackageFactory.createABIModel(r)}isConstant(e){return'view'===e.stateMutability||'pure'===e.stateMutability||e.constant}isPayable(e){return'payable'===e.stateMutability||e.payable}}class ae{constructor(e,t){this.utils=e,this.formatters=t}map(e,t){let r=null;t.gasPrice&&(r=t.gasPrice+'');let n=null;return t.from&&(n=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(t.from))),t.data=t.data||e.options.data,t.from=n||e.defaultAccount,t.gasPrice=r||e.options.gasPrice,t.gas=t.gas||t.gasLimit||e.options.gas,delete t.gasLimit,t}}class oe{constructor(e,t){this.formatters=e,this.eventFilterEncoder=t}map(e,t,r){return'undefined'==typeof r.topics&&(r.topics=[]),'undefined'!=typeof r.fromBlock&&(r.fromBlock=this.formatters.inputBlockNumberFormatter(r.fromBlock)),'undefined'!=typeof r.toBlock&&(r.toBlock=this.formatters.inputBlockNumberFormatter(r.toBlock)),e.anonymous||r.topics.unshift(e.signature),'undefined'!=typeof r.filters&&r.topics.concat(this.eventFilterEncoder.encode(e,r.filter)),r.address||(r.address=t.options.address),r}}class de{constructor(e,t){this.formatters=e,this.allEventsFilterEncoder=t}map(e,t,r){return r.topics=[],'undefined'!=typeof r.fromBlock&&(r.fromBlock=this.formatters.inputBlockNumberFormatter(r.fromBlock)),'undefined'!=typeof r.toBlock&&(r.toBlock=this.formatters.inputBlockNumberFormatter(r.toBlock)),'undefined'!=typeof r.filters&&r.topics.concat(this.allEventsFilterEncoder.encode(e,r.filter)),r.address||(r.address=t.options.address),r}}class ie{constructor(e,t,r,n,a,o,d,i){return this.contract=e,this.abiModel=t,this.rpcMethodModelFactory=r,this.methodController=n,this.methodEncoder=a,this.rpcMethodOptionsValidator=o,this.rpcMethodOptionsMapper=d,this.promiEvent=i,new Proxy(this,{get:this.proxyHandler})}proxyHandler(e,t){const r=this.abiModel.getMethod(t);if(r){let t=r.requestType;'contract-deployment'===t&&(t='send');const n=()=>{let n=arguments;'contract-deployment'===t&&(arguments[0].data&&(e.contract.options.data=e.contract.options.data||arguments[0].data),arguments[0].arguments&&(n=arguments[0].arguments)),r.contractMethodParameters=n};n[t]=()=>e.executeMethod(r,arguments),n[t].request=()=>e.createRpcMethodModel(r,arguments),n.estimateGas=()=>(r.requestType='estimate',e.executeMethod(r,arguments)),n.encodeAbi=()=>e.methodEncoder.encode(r,e.contract.options.data)}if(e[t])return this[t];throw Error(`Method with name "${t}" not found`)}executeMethod(e,t){const r=this.createRpcMethodModel(e,t);return'undefined'==typeof r.error?this.methodController.execute(r,this.contract.accounts,this.contract):this.handleValidationError(r.error,r.callback)}createRpcMethodModel(e,t){let r;if(_.isArray(e)){let n=!1;if(e.some((a)=>(r=this.rpcMethodModelFactory.createRpcMethodByRequestType(a,this.contract),r.methodArguments=t,n=e.givenParametersLengthIsValid(),!0===n)),!0!==n)return{error:n,callback:r.callback}}else r=this.rpcMethodModelFactory.createRpcMethodByRequestType(e,this.contract),r.methodArguments=t;const n=e.givenParametersLengthIsValid();if(n instanceof Error)return{error:n,callback:r.callback};const a=this.methodEncoder.encode(e,this.contract.options.data);if(a instanceof Error)return{error:a,callback:r.callback};r.parameters[0].data=a,r.parameters=this.rpcMethodOptionsMapper.map(this.contract,r.parameters[0]);const o=this.rpcMethodOptionsValidator.validate(e,r);return o instanceof Error?{error:o,callback:r.callback}:r}handleValidationError(e,t){const r=new this.promiEvent;return r.resolve(null),r.reject(e),r.emit('error',e),_.isFunction(t)&&t(e,null),r}}class se{constructor(e,t,r,n,a,o,d){return this.contract=e,this.eventSubscriptionFactory=r,this.abiModel=t,this.eventOptionsMapper=n,this.eventLogDecoder=a,this.allEventsLogDecoder=o,this.allEventsOptionsMapper=d,new Proxy(this,{get:this.proxyHandler})}proxyHandler(e,t){if(this.abiModel.hasEvent(t))return(r,n)=>e.subscribe(e.abiModel.getEvent(t),r,n);if('allEvents'===t)return(t,r)=>e.subscribeAll(t,r);if(e[t])return e[t];throw Error(`Event with name "${t}" not found`)}subscribe(e,t,r){return'undefined'!=typeof t.filters&&'undefined'!=typeof t.topics?this.handleValidationError('Invalid subscription options: Only filter or topics are allowed and not both',r):this.eventSubscriptionFactory.createEventLogSubscription(this.eventLogDecoder,e,this.contract,this.eventOptionsMapper.map(e,this.contract,t)).subscribe(r)}subscribeAll(e,t){return'undefined'==typeof e.topics?this.eventSubscriptionFactory.createAllEventLogSubscription(this.allEventsLogDecoder,this.contract,this.allEventsOptionsMapper.map(this.abiModel,this.contract,e)).subscribe(t):this.handleValidationError('Invalid subscription options: Topics are not allowed for the "allEvents" subscription',t)}handleValidationError(e,t){const r=new this.promiEventPackage.PromiEvent;return r.emit('error',new Error(e)),_.isFunction(t)&&t(error,null),r}}class ce{constructor(e){this.utils=e}validate(e,t){return this.isToSet(e,t)?new Error('This contract object doesn\'t have address set yet, please set an address first.'):this.isFromSet(t)?new Error('No "from" address specified in neither the given options, nor the default options.'):!this.isValueValid(e,t)||new Error('Can not send value to non-payable contract method or constructor')}isToSet(e,t){return!('constructor'!==e.signature)||!!t.parameters[0].to}isFromSet(e){return this.utils.isAddress(e.parameters[0].from)}isValueValid(e,t){return!(!e.payable&&t.parameters[0].value&&0this.eventLogDecoder.decode(self.abiItemModel,e)),t}}class ue extends kt{constructor(e,t,r,n,a){super(r,n,a),this.abiItemModel=e,this.allEventsLogDecoder=t}afterExecution(e){return h.a.isArray(e.logs)&&(e.events={},e.logs.map(function(e){return this.allEventsLogDecoder.decode(null,e)}),e.logs.forEach((t,r)=>t.event?e.events[t.event]?h.a.isArray(e.events[t.event])?void e.events[t.event].push(t):void(e.events[t.event]=[e.events[t.event],t]):void(e.events[t.event]=t):void(e.events[r]=t)),delete e.logs),e}}class be{constructor(e,t,r,n){this.utils=r,this.formatters=n,this.callMethodResponseDecoder=e,this.accounts=t}createRpcMethodByRequestType(e,t){let r;switch(e.requestType){case'call':r=this.createCallContractMethodModel(e);break;case'send':r=this.createSendContractMethodModel(e);break;case'estimate':r=this.createEstimateGasMethodModel();break;case'contract-deployment':r=this.createContractDeployMethodModel(t);}if('undefined'==typeof r)throw Error(`Unknown RPC call with requestType "${e.requestType}"`);return r}createPastEventLogsMethodModel(e){return new le(e,this.utils,this.formatters)}createCallContractMethodModel(e){return new fe(e,this.callMethodResponseDecoder,this.utils,this.formatters)}createSendContractMethodModel(e){return new ue(e,this.allEventsLogDecoder,this.utils,this.formatters,this.accounts)}createContractDeployMethodModel(e){return new pe(e,this.utils,this.formatters,this.accounts)}createEstimateGasMethodModel(){return new Et(this.utils,this.formatters)}}var he=r(161),me=r.n(he);class ye extends me.a{constructor(e,t){super(),this.subscriptionModel=e,this.moduleInstance=t,this.subscriptionId=null}subscribe(e){return this.subscriptionModel.beforeSubscription(this,this.moduleInstance,e),this.moduleInstance.currentProvider.subscribe(this.subscriptionModel.subscriptionType,this.subscriptionModel.subscriptionMethod,[this.subscriptionModel.options]).then((t)=>{this.subscriptionId=t,this.moduleInstance.currentProvider.on(this.subscriptionId,(t,r)=>t?void(self.moduleInstance.currentProvider.once&&this.reconnect(e),Object(b.isFunction)(e)&&e(t,null),this.emit('error',t)):void this.handleSubscriptionResponse(r,e))}),this}handleSubscriptionResponse(e,t){Object(b.isArray)(e)||(e=[e]),e.forEach(function(e){const r=this.subscriptionModel.onNewSubscriptionItem(this,e);this.emit('data',r),Object(b.isFunction)(t)&&t(!1,r)})}reconnect(e){const t=setInterval(()=>{this.moduleInstance.currentProvider.reconnect&&this.moduleInstance.currentProvider.reconnect()},500);this.moduleInstance.currentProvider.once('connect',()=>{clearInterval(t),this.unsubscribe().then(()=>{this.subscribe(e)}).catch((t)=>{this.emit('error',t),Object(b.isFunction)(e)&&e(t,null)})})}unsubscribe(e){return this.moduleInstance.currentProvider.unsubscribe(this.subscriptionId,this.subscriptionModel.subscriptionType).then((t)=>(this.removeAllListeners('data'),this.removeAllListeners('error'),!t)?(this.subscriptionId=null,Object(b.isFunction)(e)&&e(!0,!1),!0):(Object(b.isFunction)(e)&&e(!1,!0),!1))}}class ge{constructor(e,t,r,n,a){this.subscriptionType=e,this.subscriptionMethod=t,this.options=r,this.util=n,this.formatters=a}beforeSubscription(){}onNewSubscriptionItem(e,t){return this.formatters.outputLogFormatter(t)}}class _e extends ge{constructor(e,t,r,n,a){super('eth_subscribe','logs',e,t,r),this.getPastLogsMethodModel=n,this.methodController=a}beforeSubscription(e,t,r){const n=this;this.options=this.formatters.inputLogFormatter(this.options),this.getPastLogsMethodModel.parameters=[options],this.methodController.execute(this.getPastLogsMethodModel,t.currentProvider,null,t).then((t)=>{t.forEach((t)=>{r(!1,t),e.emit('data',t)}),delete n.options.fromBlock}).catch((t)=>{e.emit('error',t),r(t,null)})}onNewSubscriptionItem(e,t){return this.formatters.outputLogFormatter(t)}}class ve extends ge{constructor(e,t){super('eth_subscribe','newHeads',null,e,t)}onNewSubscriptionItem(e,t){return this.formatters.outputBlockFormatter(t)}}class ke extends ge{constructor(e,t){super('eth_subscribe','newPendingTransactions',null,e,t)}}class xe extends ge{constructor(e,t){super('eth_subscribe','syncing',null,e,t),this.isSyncing=null}onNewSubscriptionItem(e,t){const r=t.result.syncing;return null===this.isSyncing&&(this.isSyncing=r,e.emit('changed',this.isSyncing)),!0===this.isSyncing&&!1===r&&(this.isSyncing=r,e.emit('changed',this.isSyncing)),!1===this.isSyncing&&!0===r&&(this.isSyncing=r,e.emit('changed',this.isSyncing)),this.formatters.outputSyncingFormatter(t)}}class Se extends ge{constructor(e,t,r){super('shh_subscribe','messages',e,t,r)}}class we{constructor(e,t){this.utils=e,this.formatters=t}createLogSubscription(e,t,r,n){return new ye(new _e(t,this.utils,this.formatters,r,n),e)}createNewHeadsSubscription(e){return new ye(new ve(this.utils,this.formatters),e)}createNewPendingTransactionsSubscription(e){return new ye(new ke(this.utils,this.formatters),e)}createSyncingSubscriptionModel(e){return new ye(new xe(this.utils,this.formatters),e)}createShhMessagesSubscription(e,t){return new ye(new Se(t,this.utils,this.formatters),e)}}class Ae{createSubscriptionsFactory(e,t){return new we(e,t)}}const Ee=()=>new Ae().createSubscriptionsFactory(c.a,o.b);class Ie extends _e{constructor(e,t,r,n,a,o,d){super(t,r,n,a,o),this.eventLogDecoder=d,this.abiItemModel=e}onNewSubscriptionItem(e,t){return this.eventLogDecoder.decode(this.abiItemModel,this.formatters.outputLogFormatter(t))}}class Ce extends _e{constructor(e,t,r,n,a,o){super(e,t,r,n,a),this.allEventsLogDecoder=o}onNewSubscriptionItem(e,t){return this.allEventsLogDecoder.decode(null,this.formatters.outputLogFormatter(t))}}class Pe{constructor(e,t,r){this.methodController=r}createEventLogSubscription(e,t,r,n){return new ye(r,new Ie(t,n,this.utils,this.formatters,new It(this.utils,this.formatters),this.methodController,e))}createAllEventLogSubscription(e,t,r){return new ye(t,new Ce(r,this.utils,this.formatters,new It(this.utils,this.formatters),this.methodController,e))}}class Te extends a.a{constructor(e,t,r,n,a,o,d,i,s,c,f,p,l,u,b,h){if(super(e,t,r,n,a,o,null),!(this instanceof Te))throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!');if(!u||!Array.isArray(u))throw new Error('You must provide the json interface of the contract when instantiating a contract object.');this.contractModuleFactory=d,this.abiCoder=s,this.utils=c,this.formatters=f,this.accounts=p,this.abiMapper=l,this.options=h,this.promiEvent=i,this.rpcMethodModelFactory=d.createRpcMethodModelFactory(),this._defaultAccount=null,this._defaultBlock='latest',this.abiModel=l.map(u),this.options.address=b,Object.defineProperty(this.options,'jsonInterface',{get:()=>this.abiModel,set:(e)=>{this.abiModel=this.abiMapper.map(e),this.methods.abiModel=this.abiModel,this.events.abiModel=this.abiModel},enumerable:!0}),Object.defineProperty(this.options,'address',{get:()=>this._address,set:(e)=>{this._address=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))},enumerable:!0}),this.methods=d.createMethodsProxy(this,this.abiModel,this.methodController,this.promiEvent),this.events=d.createEventSubscriptionsProxy(this,this.abiModel,this.methodController)}get defaultAccount(){return this._defaultAccount}set defaultAccount(e){this._defaultAccount=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))}get defaultBlock(){return this._defaultBlock}set defaultBlock(e){this._defaultBlock=e}once(e,t,r){if(!r)throw new Error('Once requires a callback function.');t&&delete t.fromBlock;const n=this.events[event](t,r);n.on('data',()=>{n.unsubscribe()})}getPastEvents(e,t,r){if(!this.options.jsonInterface.hasEvent(e))throw Error(`Event with name "${e}does not exists.`);const n=this.rpcMethodModelFactory.createPastEventLogsMethodModel(this.options.jsonInterface.getEvent(e));return n.parameters=[t],n.callback=r,this.methodController.execute(n,this.accounts,this)}deploy(e){return this.methods.contractConstructor(e)}clone(){const e=new this.constructor(this.currentProvider,this.providerDetector,this.providerAdapterResolver,this.providersModuleFactory,this.providers,this.methodController,this.contractModuleFactory,this.promiEvent,this.abiCoder,this.utils,this.formatters,this.accounts,this.abiMapper,{},this.options.address,this.options);return e.abiModel=this.abiModel,e}setProvider(e,t){return!!(super.setProvider(e,t)&&this.accounts.setProvider(e,t))}}class Be{constructor(e,t,r,n){this.utils=e,this.formatters=t,this.abiCoder=r,this.accounts=n}createContract(e,t,r,n,a,o,d,i,s,c){return new Te(e,t,r,n,a,o,this,d,this.abiCoder,this.utils,this.formatters,this.accounts,this.createABIMapper(),i,s,c)}createABIModel(e){return new X(e)}createABIItemModel(e){return new Y(e)}createMethodEncoder(){return new Z(this.abiCoder)}createEventFilterEncoder(){return new J(this.abiCoder)}createAllEventsFilterEncoder(){return new $(this.abiCoder)}createABIMapper(){return new ne(this,this.abiCoder,this.utils)}createCallMethodResponseDecoder(){return new Q(this.abiCoder)}createEventLogDecoder(){return new te.a(this.abiCoder,this.formatters)}createAllEventsLogDecoder(){return new re(this.abiCoder,this.formatters)}createRpcMethodOptionsValidator(){return new ce(this.utils)}createRpcMethodOptionsMapper(){return new ae(this.utils,this.formatters)}createEventOptionsMapper(){return new oe(this.formatters,this.createEventFilterEncoder())}createAllEventsOptionsMapper(){return new de(this.formatters,this.createAllEventsFilterEncoder())}createRpcMethodModelFactory(){return new be(this.createCallMethodResponseDecoder(),this.accounts,this.utils,this.formatters)}createMethodsProxy(e,t,r,n){return new ie(e,t,this.createRpcMethodModelFactory(),r,this.createMethodEncoder(),this.createRpcMethodOptionsValidator(),this.createRpcMethodOptionsMapper(),n)}createEventSubscriptionsProxy(e,t,r){new se(e,t,this.createEventSubscriptionFactory(r),this.createEventOptionsMapper(),this.createEventLogDecoder(),this.createAllEventsLogDecoder(),this.createAllEventsOptionsMapper())}createEventSubscriptionFactory(e){new Pe(this.utils,this.formatters,e)}}const Ne=(e,t,r,n,a)=>{const d=new G;return new Be(c.a,o.b,new k(),t).createContract(e,d.createProviderDetector(),d.createProviderAdapterResolver(),d,W,new nr,s,r,n,a)};class Re{constructor(e,t,r,n){this.transactionConfirmationModel=e,this.transactionReceiptValidator=t,this.newHeadsWatcher=r,this.formatters=n}execute(e,t,r,n){this.getTransactionReceipt(t,r).then((a)=>{if(a&&a.blockHash){const t=this.transactionReceiptValidator.validate(a);return!0===t?void this.handleSuccessState(a,e,n):void this.handleErrorState(t,e,n)}this.newHeadsWatcher.watch(t).on('newHead',()=>{if(this.transactionConfirmationModel.timeoutCounter++,!this.transactionConfirmationModel.isTimeoutTimeExceeded())return void this.getTransactionReceipt(r).then((t)=>{const r=this.transactionReceiptValidator.validate(t,e.parameters);return!0===r?(this.transactionConfirmationModel.addConfirmation(t),n.emit('confirmation',this.transactionConfirmationModel.confirmationsCount,t),void(this.transactionConfirmationModel.isConfirmed()&&this.handleSuccessState(t,e,n))):void(n.reject(r),n.emit('error',r,t),n.removeAllListeners(),e.callback&&e.callback(r,null))});let t=new Error(`Transaction was not mined within ${this.transactionConfirmationModel.TIMEOUTBLOCK} blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!`);this.newHeadsWatcher.isPolling&&(t=new Error(`Transaction was not mined within${this.transactionConfirmationModel.POLLINGTIMEOUT} seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!`)),this.handleErrorState(t,e,n)})})}getTransactionReceipt(e,t){return e.currentProvider.send('eth_getTransactionReceipt',[t]).then((e)=>this.formatters.outputTransactionReceiptFormatter(e))}handleSuccessState(e,t,r){if(this.newHeadsWatcher.stop(),t instanceof pe)return r.resolve(t.afterExecution(e)),r.emit('receipt',e),r.removeAllListeners(),void(t.callback&&t.callback(!1,e));const n=t.afterExecution(e);r.resolve(n),r.emit('receipt',n),r.removeAllListeners(),t.callback&&t.callback(!1,n)}handleErrorState(e,t,r){this.newHeadsWatcher.stop(),r.reject(e),r.emit('error',e),r.removeAllListeners(),t.callback&&t.callback(e,null)}}class Me{getWallet(e,t){if(h.a.isNumber(e))return t.wallet[e];if(h.a.isObject(e)&&e.address&&e.privateKey)return e;const r=t.wallet[e.toLowerCase()];return r?r:null}}class Le extends Me{async sign(e,t){const r=this.getWallet(e.from,t);if(r&&r.privateKey)return delete e.from,await t.signTransaction(e,r.privateKey);throw new Error('Wallet or privateKey in wallet is not set!')}}class je extends Me{sign(e,t,r){const n=this.getWallet(t,r);if(n&&n.privateKey)return r.sign(e,n.privateKey).signature;throw new Error('Wallet or privateKey in wallet is not set!')}}class Oe{constructor(){this.confirmations=[],this.timeoutCounter=0,this._pollingTimeout=15,this.timeoutBlock=50,this.confirmationBlocks=24}get pollingTimeout(){return this._pollingTimeout*this.timeoutBlock}set pollingTimeout(e){this._pollingTimeout=e}addConfirmation(e){this.confirmations.push(e)}isConfirmed(){return this.confirmations.length===this.confirmationBlocks+1}isTimeoutTimeExceeded(e){return e?this.timeoutCounter-1>=this.pollingTimeout:this.timeoutCounter-1>=this.timeoutBlock}}class De{validate(e,t){if(this.isValidGasUsage(e,t)&&this.isValidReceiptStatus(e))return!0;const r=JSON.stringify(e,null,2);return!1===e.status||'0x0'===e.status?new Error(`Transaction has been reverted by the EVM:\n${r}`):new Error(`Transaction ran out of gas. Please provide more gas:\n${r}`)}isValidReceiptStatus(e){return!0===e.status||'0x1'===e.status||'undefined'==typeof e.status}isValidGasUsage(e,t){let r=null;return Object(b.isObject)(t[0])&&t[0].gas&&(r=t[0].gas),!e.outOfGas&&(!r||r!==e.gasUsed)}}var Ue=r(162),He=r.n(Ue);class Fe extends He.a{constructor(e){super(),this.subscriptionsFactory=e,this.confirmationInterval=null,this.confirmationSubscription=null,this.isPolling=!1}watch(e){return e.currentProvider instanceof B?(this.confirmationSubscription=this.subscriptionsFactory.createNewHeadsSubscription(e).subscribe(()=>{this.emit('newHead')}),this):(this.isPolling=!0,this.confirmationInterval=setInterval(()=>{this.emit('newHead')},1e3),this)}stop(){this.confirmationSubscription&&this.confirmationSubscription.unsubscribe(),this.confirmationInterval&&clearInterval(this.confirmationInterval),this.removeAllListeners('newHead')}}class qe{constructor(e,t,r,n,a){this.callMethodCommand=e,this.sendMethodCommand=t,this.signAndSendMethodCommand=r,this.signMessageCommand=n,this.promiEventObject=a}execute(e,t,r){if(this.hasWallets(t)){if(e.isSign())return this.signMessageCommand.execute(r,e,t);if(e.isSendTransaction())return this.signAndSendMethodCommand.execute(r,e,new this.promiEventObject,t)}return e.isSendTransaction()||e.isSendRawTransaction()||e.isSign()?this.sendMethodCommand.execute(r,e,new this.promiEventObject):this.callMethodCommand.execute(r,e)}hasWallets(e){return e&&0{Object(b.isObject)(t.parameters[0])&&(t.parameters[0].gasPrice=n),this.send(t,r,e)}),r)}send(e,t,r){return r.currentProvider.send(e.rpcMethod,e.parameters).then((n)=>{this.transactionConfirmationWorkflow.execute(e,r,n,t),t.emit('transactionHash',n),e.callback&&e.callback(!1,n)}).catch((r)=>{t.reject(r),t.emit('error',r),t.removeAllListeners(),e.callback&&e.callback(r,null)}),t}isGasPriceDefined(e){return Object(b.isObject)(e[0])&&'undefined'!=typeof e[0].gasPrice}getGasPrice(e){return e.send('eth_gasPrice',[])}}class Ve extends Ke{constructor(e,t){super(e),this.transactionSigner=t}execute(e,t,r,n){return t.beforeExecution(e),t.rpcMethod='eth_sendRawTransaction',this.transactionSigner.sign(t.parameters[0],n).then((n)=>{t.parameters=[n.rawTransaction],this.send(t,r,e)}).catch((e)=>{r.reject(e),r.emit('error',e),r.removeAllListeners(),t.callback&&t.callback(e,null)}),r}}class Ge{constructor(e){this.messageSigner=e}execute(e,t,r){let n;t.beforeExecution(e);try{n=t.afterExecution(this.messageSigner.sign(t.parameters[0],t.parameters[1],r))}catch(e){throw t.callback(e,null),e}return t.callback&&t.callback(!1,n),n}}class We{createMethodController(e,t,r){return new qe(this.createCallMethodCommand(),this.createSendMethodCommand(t,r),this.createSignAndSendMethodCommand(t,r),this.createSignMessageCommand(),e)}createCallMethodCommand(){return new ze}createSendMethodCommand(e,t){return new Ke(this.createTransactionConfirmationWorkflow(e,t))}createSignAndSendMethodCommand(e,t){return new Ve(this.createTransactionConfirmationWorkflow(e,t),this.createTransactionSigner())}createSignMessageCommand(){return new Ge(this.createMessageSigner())}createTransactionConfirmationWorkflow(e,t){return new Re(this.createTransactionConfirmationModel(),this.createTransactionReceiptValidator(),this.createNewHeadsWatcher(e),t)}createTransactionSigner(){return new Le}createMessageSigner(){return new je}createTransactionConfirmationModel(){return new Oe}createTransactionReceiptValidator(){return new De}createNewHeadsWatcher(e){return new Fe(e)}}class Xe{constructor(e,t,r){this.utils=t,this.formatters=r,this.methodModels=e}hasMethodModel(e){return'undefined'!=typeof this.methodModels[e]}createMethodModel(e){return new this.methodModels[e](this.utils,this.formatters)}}class Ye{constructor(e,t,r,n){this.rpcMethod=e,this.parametersAmount=t,this.utils=r,this.formatters=n;const a={};Object.defineProperty(this,'methodArguments',{get(){return a},set(e){e=this.mapFunctionArguments(e)},enumerable:!0}),this.parameters=this.methodArguments.parameters,this.callback=this.methodArguments.callback}beforeExecution(){}afterExecution(e){return e}request(){return this.methodArguments=arguments,this}mapFunctionArguments(e){let t=e,r=!1;if(e.lengththis.parametersAmount){if(r=e.slice(-1),!h.a.isFunction(r))throw new Error('The latest parameter should be a function otherwise it can not be used as callback');t=e.slice(0,-1)}return{callback:r,parameters:t}}isSign(){return'eth_sign'===this.rpcMethod}isSendTransaction(){return'eth_sendTransaction'===this.rpcMethod}isSendRawTransaction(){return'eth_sendRawTransaction'===this.rpcMethod}isHash(e){return h.a.isString(e)&&0===e.indexOf('0x')}}class Ze extends Ye{constructor(e,t){super('eth_protocolVersion',0,e,t)}}class Je extends Ye{constructor(e,t){super('eth_protocolVersion',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class $e extends Ye{constructor(e,t){super('net_listening',0,e,t)}}class Qe extends Ye{constructor(e,t){super('net_peerCount',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class et extends Ye{constructor(e,t){super('web3_clientVersion',0,e,t)}}class tt extends Ye{constructor(e,t){super('eth_coinbase',0,e,t)}}class rt extends Ye{constructor(e,t){super('eth_mining',0,e,t)}}class nt extends Ye{constructor(e,t){super('eth_hashrate',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class at extends Ye{constructor(e,t){super('eth_syncing',0,e,t)}afterExecution(e){return this.formatters.outputSyncingFormatter(e)}}class ot extends Ye{constructor(e,t){super('eth_gasPrice',0,e,t)}afterExecution(e){return this.formatters.outputBigNumberFormatter(e)}}class dt extends Ye{constructor(e,t){super('eth_submitWork',3,e,t)}}class it extends Ye{constructor(e,t){super('eth_getWork',0,e,t)}}class st extends Ye{constructor(e,t){super('eth_accounts',0,e,t)}afterExecution(e){return e.map((e)=>this.utils.toChecksumAddress(e))}}class ct extends Ye{constructor(e,t){super('eth_getBalance',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}afterExecution(e){return this.formatters.outputBigNumberFormatter(e)}}class ft extends Ye{constructor(e,t){super('eth_getTransactionCount',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}afterExecution(e){return this.utils.hexToNumber(e)}}class pt extends Ye{constructor(e,t){super('eth_blockNumber',0,e,t)}afterExecution(e){return this.utils.hexToNumber(e)}}class lt extends Ye{constructor(e,t){super('eth_getBlockByNumber',2,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getBlockByHash'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0]),this.parameters[1]=!!this.parameters[1]}afterExecution(e){return this.formatters.outputBlockFormatter(e)}}class ut extends Ye{constructor(e,t){super('eth_getUncleByBlockNumberAndIndex',2,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getUncleByBlockHashAndIndex'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0]),this.parameters[1]=this.utils.numberToHex(this.parameters[1])}afterExecution(e){return this.formatters.outputBlockFormatter(e)}}class bt extends Ye{constructor(e,t){super('eth_getTransactionByBlockNumberAndIndex',1,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getTransactionByBlockHashAndIndex'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0])}afterExecution(e){return this.utils.hexToNumber(e)}}class ht extends Ye{constructor(e,t){super('eth_getUncleCountByBlockNumber',1,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getUncleCountByBlockHash'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0])}afterExecution(e){return this.utils.hexToNumber(e)}}class mt extends Ye{constructor(e,t){super('eth_getTransactionByHash',1,e,t)}afterExecution(e){return this.formatters.outputTransactionFormatter(e)}}class yt extends Ye{constructor(e,t){super('eth_getTransactionByBlockNumberAndIndex',2,e,t)}beforeExecution(){this.isHash(this.parameters[0])&&(this.rpcMethod='eth_getTransactionByBlockHashAndIndex'),this.parameters[0]=this.formatters.inputBlockNumberFormatter(this.parameters[0]),this.parameters[1]=this.utils.numberToHex(this.parameters[1])}afterExecution(e){return this.formatters.outputTransactionFormatter(e)}}class gt extends Ye{constructor(e,t){super('eth_getTransactionReceipt',1,e,t)}afterExecution(e){return this.formatters.outputTransactionFormatter(e)}}class _t extends Ye{constructor(e,t){super('eth_sendRawTransaction',1,e,t)}}class vt extends Ye{constructor(e,t){super('eth_signTransaction',1,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class kt extends Ye{constructor(e,t,r){super('eth_sendTransaction',1,e,t),this.accounts=r}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class xt extends Ye{constructor(e,t){super('eth_getCode',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}}class St extends Ye{constructor(e,t,r){super('eth_sign',2,e,t),this.accounts=r}beforeExecution(){this.parameters[0]=this.formatters.inputSignFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputAddressFormatter(this.parameters[1])}}class wt extends Ye{constructor(e,t){super('eth_call',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputCallFormatter(this.parameters[0],e),this.parameters[1]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1],e)}}class At extends Ye{constructor(e,t){super('eth_getStorageAt',3,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0]),this.parameters[1]=this.utils.numberToHex(this.parameters[1]),this.parameters[2]=this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2],e)}}class Et extends Ye{constructor(e,t){super('eth_estimateGas',1,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputCallFormatter(this.parameters[0],e)}afterExecution(e){return this.utils.hexToNumber(e)}}class It extends Ye{constructor(e,t){super('eth_getLogs',1,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputLogFormatter(this.parameters[0])}afterExecution(e){return e.map((e)=>this.formatters.outputLogFormatter(e))}}class Ct extends Ye{constructor(e,t){super('personal_ecRecover',3,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputSignFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputAddressFormatter(this.parameters[1])}}class Pt extends Ye{constructor(e,t){super('personal_importRawKey',2,e,t)}}class Tt extends Ye{constructor(e,t){super('personal_lockAccount',1,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0])}}class Bt extends Ye{constructor(e,t){super('personal_newAccount',0,e,t)}afterExecution(e){return this.utils.toChecksumAddress(e)}}class Nt extends Ye{constructor(e,t){super('personal_sendTransaction',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class Rt extends Ye{constructor(e,t){super('personal_sign',3,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputSignFormatter(this.parameters[0]),this.parameters[1]=this.formatters.inputAddressFormatter(this.parameters[1])}}class Mt extends Ye{constructor(e,t){super('personal_signTransaction',2,e,t)}beforeExecution(e){this.parameters[0]=this.formatters.inputTransactionFormatter(this.parameters[0],e)}}class Lt extends Ye{constructor(e,t){super('personal_unlockAccount',3,e,t)}beforeExecution(){this.parameters[0]=this.formatters.inputAddressFormatter(this.parameters[0])}}class jt extends Ye{constructor(e,t){super('shh_addPrivateKey',1,e,t)}}class Ot extends Ye{constructor(e,t){super('shh_addSymKey',1,e,t)}}class Dt extends Ye{constructor(e,t){super('shh_deleteKeyPair',1,e,t)}}class Ut extends Ye{constructor(e,t){super('shh_deleteMessageFilter',1,e,t)}}class Ht extends Ye{constructor(e,t){super('shh_deleteSymKey',1,e,t)}}class Ft extends Ye{constructor(e,t){super('shh_generateSymKeyFromPassword',1,e,t)}}class qt extends Ye{constructor(e,t){super('shh_getFilterMessages',1,e,t)}}class zt extends Ye{constructor(e,t){super('shh_info',0,e,t)}}class Kt extends Ye{constructor(e,t){super('shh_getPrivateKey',1,e,t)}}class Vt extends Ye{constructor(e,t){super('shh_getPublicKey',1,e,t)}}class Gt extends Ye{constructor(e,t){super('shh_getSymKey',1,e,t)}}class Wt extends Ye{constructor(e,t){super('shh_hasKeyPair',1,e,t)}}class Xt extends Ye{constructor(e,t){super('shh_hasSymKey',1,e,t)}}class Yt extends Ye{constructor(e,t){super('shh_markTrustedPeer',1,e,t)}}class Zt extends Ye{constructor(e,t){super('shh_newKeyPair',1,e,t)}}class Jt extends Ye{constructor(e,t){super('shh_newMessageFilter',1,e,t)}}class $t extends Ye{constructor(e,t){super('shh_newSymKey',0,e,t)}}class Qt extends Ye{constructor(e,t){super('shh_post',1,e,t)}}class er extends Ye{constructor(e,t){super('shh_setMaxMessageSize',1,e,t)}}class tr extends Ye{constructor(e,t){super('shh_setMinPoW',1,e,t)}}class rr extends Ye{constructor(e,t){super('shh_version',0,e,t)}}const nr=()=>new We().createMethodController(s,new Ee,o.b);class ar extends a.a{constructor(e,t,r,n,a,o,d,i,s){super(e,t,r,n,a,o,d),this.formatters=i,this.utils=s}getNetworkType(e){let t;return this.getId().then((e)=>(t=e,this.getBlock(0,!1))).then((r)=>{let n='private';return r===('0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3'===r.hash&&1===t)?n='main':r===('0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303'===r.hash&&2===t)?n='morden':r===('0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d'===r.hash&&3===t)?n='ropsten':r===('0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177'===r.hash&&4===t)?n='rinkeby':r===('0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9'===r.hash&&42===t)?n='kovan':void 0,_.isFunction(e)&&e(null,n),n}).catch((t)=>{if(_.isFunction(e))return void e(t);throw t})}}class or extends Xe{constructor(e,t){super({getId:Je,getBlock:lt,isListening:$e,getPeerCount:Qe},e,t)}}class dr{constructor(e,t){this.utils=e,this.formatters=t}createNetworkModule(e,t,r,n,a,o){return new ar(e,t,r,n,a,o,this.createMethodModelFactory(),this.formatters,this.utils)}createMethodModelFactory(){return new or(this.utils,this.formatters)}}const ir=(e)=>{const t=new G;return new dr(c.a,o.b).createNetworkModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr)};class sr extends Xe{constructor(e,t){super({getGasPrice:ot,getTransactionCount:ft,getId:Je},e,t)}}var cr=r(163);class fr{constructor(e,t){this.utils=e,this.formatters=t}createAccounts(e,t,r,n,a,o){return new cr.a(e,t,r,n,a,o,this.createMethodModelFactory(),this.utils,this.formatters)}createMethodModelFactory(){return new sr(this.utils,this.formatters)}}const pr=(e)=>{const t=new G;return new fr(c.a,o.b).createAccounts(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr)};class lr extends a.a{constructor(e,t,r,n,a,o,d,i,s,c){super(e,t,r,n,a,o,d),this.utils=s,this.formatters=c,this.net=i,this._defaultAccount=null,this._defaultBlock='latest'}get defaultAccount(){return this._defaultAccount}set defaultAccount(e){this._defaultAccount=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))}get defaultBlock(){return this._defaultBlock}set defaultBlock(e){this._defaultBlock=e}setProvider(e,t){return!!(super.setProvider(e,t)&&this.net.setProvider(e,t))}}class ur extends Xe{constructor(e,t){super({getAccounts:st,newAccount:Bt,unlockAccount:Lt,lockAccount:Tt,importRawKey:Pt,sendTransaction:Nt,signTransaction:Mt,sign:Rt,ecRecover:Ct},e,t)}}class br{constructor(e,t){this.utils=e,this.formatters=t}createPersonal(e,t,r,n,a,o,d){return new lr(e,t,r,n,a,o,this.createMethodModelFactory(),d,this.utils,this.formatters)}createMethodModelFactory(){return new ur(this.utils,this.formatters)}}const hr=(e)=>{const t=new G;return new br(c.a,o.b).createPersonalModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr,new ir(e))};var mr=r(165),yr=r.n(mr),gr=r(166),_r=r.n(gr);class vr{constructor(e,t){this.registry=e,this.resolverMethodHandler=t}setProvider(e,t){return this.registry.setProvider(e,t)}resolver(e){return this.registry.resolver(e)}getAddress(e,t){return this.resolverMethodHandler.method(e,'addr',[]).call(t)}setAddress(e,t,r,n){return this.resolverMethodHandler.method(e,'setAddr',[t]).send(r,n)}getPubkey(e,t){return this.resolverMethodHandler.method(e,'pubkey',[]).call(t)}setPubkey(e,t,r,n,a){return this.resolverMethodHandler.method(e,'setPubkey',[t,r]).send(n,a)}getContent(e,t){return this.resolverMethodHandler.method(e,'content',[]).call(t)}setContent(e,t,r,n){return this.resolverMethodHandler.method(e,'setContent',[t]).send(r,n)}getMultihash(e,t){return this.resolverMethodHandler.method(e,'multihash',[]).call(t)}setMultihash(e,t,r,n){return this.resolverMethodHandler.method(e,'multihash',[t]).send(r,n)}}var kr=r(46),xr=r.n(kr);class Sr{constructor(e,t,r,n,a){this.net=net,this.accounts=t,this.contractObject=r,this.registryABI=n,this.resolverABI=a,this.provider=e,this.contract=this.checkNetwork().then((e)=>new this.contractObject(this.provider,this.accounts,this.registryABI,e))}setProvider(e,t){return this.provider=this.providersPackage.resolve(e,t),!!(this.net.setProvider(e,t)&&this.accounts.setProvider(e,t)&&this.provider)}owner(e,t){return new Promise((r,n)=>{this.contract.then((a)=>{a.methods.owner(xr.a.hash(e)).call().then((e)=>{r(e),Object(b.isFunction)(t)&&t(!1,e)}).catch((e)=>{n(e),Object(b.isFunction)(t)&&t(e,null)})})})}resolver(e){return this.contract.then((t)=>t.methods.resolver(xr.a.hash(e)).call()).then((e)=>new this.Contract.Contract(this.provider,this.accounts,this.resolverABI,e))}checkNetwork(){const e={main:'0x314159265dD8dbb310642f98f50C066173C1259b',ropsten:'0x112234455c3a32fd11230c42e7bccd4a84e02010',rinkeby:'0xe7410170f87102df0055eb195163a03b7f2bff4a'};return this.net.getBlock('latest',!1).then((e)=>{const t=new Date/1e3-e.timestamp;if(3600{const r=e[t];if('undefined'==typeof r)throw new Error(`ENS is not supported on network ${t}`);return r})}}class wr{constructor(e,t){this.registry=e,this.promiEventPackage=t}method(e,t,r){return{call:this.call.bind({ensName:e,methodName:t,methodArguments:r,parent:this}),send:this.send.bind({ensName:e,methodName:t,methodArguments:r,parent:this})}}call(e){const t=new this.promiEventPackage.PromiEvent,r=this.parent.prepareArguments(this.ensName,this.methodArguments);return this.parent.registry.resolver(this.ensName).then((n)=>{this.parent.handleCall(t,n.methods[this.methodName],r,e)}).catch((e)=>{t.reject(e)}),t}send(e,t){const r=new this.promiEventPackage.PromiEvent,n=this.parent.prepareArguments(this.ensName,this.methodArguments);return this.parent.registry.resolver(this.ensName).then((a)=>{this.parent.handleSend(r,a.methods[this.methodName],n,e,t)}).catch((e)=>{r.reject(e)}),r}handleCall(e,t,r,n){return t.apply(this,r).call().then((t)=>{e.resolve(t),h.a.isFunction(n)&&n(t)}).catch((t)=>{e.reject(t),h.a.isFunction(n)&&n(t)}),e}handleSend(e,t,r,n,a){return t.apply(this,r).send(n).on('transactionHash',(t)=>{e.emit('transactionHash',t)}).on('confirmation',(t,r)=>{e.emit('confirmation',t,r)}).on('receipt',(t)=>{e.emit('receipt',t),e.resolve(t),h.a.isFunction(a)&&a(t)}).on('error',(t)=>{e.emit('error',t),e.reject(t),h.a.isFunction(a)&&a(t)}),e}prepareArguments(e,t){const r=xr.a.hash(e);return 0new Ar().createENS(e,t,r,Ne,yr.a,_r.a,s);var Ir=r(68);class Cr extends Xe{constructor(e,t,r){super({getNodeInfo:et,getProtocolVersion:Ze,getCoinbase:tt,isMining:rt,getHashrate:nt,isSyncing:at,getGasPrice:ot,getAccounts:st,getBlockNumber:pt,getBalance:ct,getStorageAt:At,getCode:xt,getBlock:lt,getUncle:ut,getBlockTransactionCount:bt,getBlockUncleCount:ht,getTransaction:mt,getTransactionFromBlock:yt,getTransactionReceipt:gt,getTransactionCount:ft,sendSignedTransaction:_t,signTransaction:vt,sendTransaction:kt,sign:St,call:wt,estimateGas:Et,submitWork:dt,getWork:it,getPastLogs:It},e,t),this.accounts=r}createMethodModel(e){return new this.methodModels[e](this.utils,this.formatters,this.accounts)}}class Pr extends a.a{constructor(e,t,r,n,a,o,d,i,s,c,f,p,l,u,b,h,m){super(e,t,r,n,a,o,d),this.net=i,this.accounts=c,this.personal=f,this.Iban=Iban,this.abi=l,this.ens=u,this.utils=b,this.formatters=h,this.subscriptionsFactory=m,this.initiatedContracts=[],this._defaultAccount=null,this._defaultBlock='latest',this.Contract=(e,t,r)=>{const n=new s(this.currentProvider,this.accounts,e,t,r);return this.initiatedContracts.push(n),n}}get defaultAccount(){return this._defaultAccount}set defaultAccount(e){this.initiatedContracts.forEach((t)=>{t.defaultAccount=e}),this.personal.defaultAccount=e,this._defaultAccount=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))}get defaultBlock(){return this._defaultBlock}set defaultBlock(e){this._defaultBlock=e,this.initiatedContracts.forEach((t)=>{t.defaultBlock=e}),this.personal.defaultBlock=this._defaultBlock}subscribe(e,t,r){switch(e){case'logs':return this.subscriptionsFactory.createLogSubscription(this,t,this.methodModelFactory.createMethodModel('getPastLogs'),this.methodController).subscribe(r);case'newBlockHeaders':return this.subscriptionsFactory.createNewHeadsSubscription(this).subscribe(r);case'pendingTransactions':return this.subscriptionsFactory.createNewPendingTransactionsSubscription(this).subscribe(r);case'syncing':return this.subscriptionsFactory.createSyncingSubscriptionModel(this).subscribe(r);default:throw Error(`Unknown subscription: ${e}`);}}setProvider(e,t){const r=this.initiatedContracts.every((r)=>r.setProvider(e,t));return!!(super.setProvider(e,t)&&this.net.setProvider(e,t)&&this.personal.setProvider(e,t)&&this.accounts.setProvider(e,t)&&r)}}class Tr{constructor(e,t){this.utils=e,this.formatters=t}createEthModule(e,t,r,n,a,o,d,i,s,c,f,p,l,u){return new Pr(e,t,r,n,a,o,this.createMethodModelFactory(s),d,i,s,c,f,p,l,this.utils,this.formatters,u)}createMethodModelFactory(e){return new Cr(this.utils,this.formatters,e)}}const Br=(e)=>{const t=new G;return new Tr(c.a,o.b).createEthModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr,new ir,Ne,new pr(e),new hr(e),Ir.a,new k(c.a),new Er(e),new Ee)};class Nr extends a.a{constructor(e,t,r,n,a,o,d,i,s){super(e,t,r,n,a,o,d),this.subscriptionsFactory=i,this.net=s}subscribe(e,t,r){if('messages'===e)return this.subscriptionsFactory.createShhMessagesSubscription(this,t).subscribe(r);throw Error(`Unknown subscription: ${e}`)}setProvider(e,t){return!!(super.setProvider(e,t)&&this.net.setProvider(e,t))}}class Rr extends Xe{constructor(e,t){super({getVersion:rr,getInfo:zt,setMaxMessageSize:er,setMinPoW:tr,markTrustedPeer:Yt,newKeyPair:Zt,addPrivateKey:jt,deleteKeyPair:Dt,hasKeyPair:Wt,getPublicKey:Vt,getPrivateKey:Kt,newSymKey:$t,addSymKey:Ot,generateSymKeyFromPassword:Ft,hasSymKey:Xt,getSymKey:Gt,deleteSymKey:Ht,newMessageFilter:Jt,getFilterMessages:qt,deleteMessageFilter:Ut,post:Qt},e,t)}}class Mr{constructor(e,t){this.utils=e,this.formatters=t}createShhModule(e,t,r,n,a,o,d,i){return new Nr(e,t,r,n,a,o,this.createMethodModelFactory(),d,i)}createMethodModelFactory(){return new Rr(this.utils,this.formatters)}}const Lr=(e)=>{const t=new G;return new Mr(c.a,o.b).createShhModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,W,new nr,new Ee,new ir(e))};var jr=r(167),Or=r.n(jr);class Dr{constructor(e){this.givenProvider=Dr.givenProvider,this.currentProvider=null,this.setProvider(e)}pick(){if('undefined'!=typeof document)return this.swarm.pick;throw Error('Pick is not supported for this environment.')}download(e,t){return this.hasProvider()?this.swarm.download(e,t):void this.throwProviderError()}upload(e){return this.hasProvider()?this.swarm.upload(e):void this.throwProviderError()}isAvailable(){return this.hasProvider()?this.swarm.isAvailable():void this.throwProviderError()}hasProvider(){return!!this.currentProvider}throwProviderError(){throw new Error('No provider set, please set one using bzz.setProvider().')}setProvider(e){return(Object(b.isObject)(e)&&Object(b.isString)(e.bzz)&&(e=e.bzz),Object(b.isString)(e))?(this.currentProvider=e,this.swarm=Or.a.at(e),!0):(this.currentProvider=null,!1)}}Dr.givenProvider=null,'undefined'!=typeof ethereumProvider&ðereumProvider.bzz&&(Dr.givenProvider=ethereumProvider.bzz);var Ur=r(168);r.d(t,'default',function(){return Hr});class Hr extends a.a{constructor(e,t){var r=new G,n=r.createProviderAdapterResolver(),a=r.createProviderDetector();e=n.resolve(e,t),super(e,a,n,r,W,new nr,new Xe({},utils,o.b)),this.eth=new Br(e),this.shh=new Lr(e),this.bzz=new Dr(e)}setProvider(e,t){return!!(super.setProvider(e,t)&&this.eth.setProvider(e,t)&&this.shh.setProvider(e,t)&&this.bzz.setProvider(e))}static get givenProvider(){return new G().createProviderDetector().detect()}static get version(){return Ur.a}static get utils(){return c.a}static get modules(){const e=new G().createProviderAdapterResolver();return{Eth:(t,r)=>new Br(e.resolve(t,r)),Net:(t,r)=>new ir(e.resolve(t,r)),Personal:(t,r)=>new hr(e.resolve(t,r)),Shh:(t,r)=>new Lr(e.resolve(t,r)),Bzz:(t,r)=>new Dr(e.resolve(t,r))}}static get providers(){return W}}}]); \ No newline at end of file +*/function t(e){if(null===e||e===void 0)throw new TypeError('Object.assign cannot be called with null or undefined');return Object(e)}var r=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String('abc');if(e[5]='de','5'===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;10>r;r++)t['_'+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if('0123456789'!==n.join(''))return!1;var a={};return['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t'].forEach(function(e){a[e]=e}),'abcdefghijklmnopqrst'===Object.keys(Object.assign({},a)).join('')}catch(e){return!1}}()?Object.assign:function(e){for(var o=t(e),d=1,s,c;d=parseInt(r[2])?t.toNumber():t};var P=/^([^)(]*)\((.*)\)([^)(]*)$/,T=/^[A-Za-z_][A-Za-z0-9_]*$/;t.parseParamType=function(e){return a(e,!0)},t.formatParamType=s,t.formatSignature=function(e){return e.name+'('+e.inputs.map(function(e){return s(e)}).join(',')+')'},t.parseSignature=function(e){if('string'==typeof e)return e=e.replace(/\(/g,' (').replace(/\)/g,') ').replace(/\s+/g,' '),e=e.trim(),'event '===e.substring(0,6)?o(e.substring(6).trim()):('function '===e.substring(0,9)&&(e=e.substring(9)),d(e.trim()));throw new Error('unknown signature')};var B=function(){return function(e,t,r,n,a){this.coerceFunc=e,this.name=t,this.type=r,this.localName=n,this.dynamic=a}}(),N=function(e){function t(t){var r=e.call(this,t.coerceFunc,t.name,t.type,void 0,t.dynamic)||this;return w.defineReadOnly(r,'coder',t),r}return y(t,e),t.prototype.encode=function(e){return this.coder.encode(e)},t.prototype.decode=function(e,t){return this.coder.decode(e,t)},t}(B),R=function(e){function t(t,r){return e.call(this,t,'null','',r,!1)||this}return y(t,e),t.prototype.encode=function(){return x.arrayify([])},t.prototype.decode=function(e,t){if(t>e.length)throw new Error('invalid null');return{consumed:0,value:this.coerceFunc('null',void 0)}},t}(B),M=function(e){function t(t,r,n,a){var o=this,d=(n?'int':'uint')+8*r;return o=e.call(this,t,d,d,a,!1)||this,o.size=r,o.signed=n,o}return y(t,e),t.prototype.encode=function(e){try{var t=k.bigNumberify(e);return t=t.toTwos(8*this.size).maskn(8*this.size),this.signed&&(t=t.fromTwos(8*this.size).toTwos(256)),x.padZeros(x.arrayify(t),32)}catch(t){A.throwError('invalid number value',A.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e})}return null},t.prototype.decode=function(e,t){e.lengthb&&(n('Max buffer length exceeded: textNode'),e=r(e,p.length)),H.length>b&&(n('Max buffer length exceeded: numberNode'),e=r(e,H.length)),U=b-e+Y}function n(e){p!==void 0&&(l(p),u(),p=void 0),$=s(e+'\nLn: '+J+'\nCol: '+Z+'\nChr: '+Q),i(K(void 0,void 0,$))}function a(){return z==y?(l({}),u(),void(q=!0)):void((z!==g||0!==X)&&n('Unexpected end'),p!==void 0&&(l(p),u(),p=void 0),q=!0)}function o(e){return'\r'==e||'\n'==e||' '==e||'\t'==e}function d(e){if(!$){if(q)return n('Cannot write after close');var r=0;for(Q=e[0];Q&&(0=U&&t()}}var f=e(xe).emit,l=e(Se).emit,u=e(we).emit,i=e(he).emit,b=65536,h=/[\\"\n]/g,m=0,y=m++,g=m++,v=m++,k=m++,x=m++,S=m++,w=m++,A=m++,E=m++,I=m++,C=m++,P=m++,T=m++,B=m++,N=m++,R=m++,M=m++,L=m++,j=m++,O=m++,D=m,U=b,H='',F=!1,q=!1,z=y,V=[],G=null,W=0,X=0,Y=0,Z=0,J=1,$,Q,ee,p;e(_e).on(d),e(ve).on(a)}function M(e,t){'use strict';function r(e){return function(t){a=e(a,t)}}var n={},a;for(var o in t)e(o).on(r(t[o]),n);e(ue).on(function(e){var t=re(a),r=de(t),n=ne(a),o;n&&(o=ie(re(n)),o[r]=e)}),e(be).on(function(){var e=re(a),t=de(e),r=ne(a),n;r&&(n=ie(re(r)),delete n[t])}),e(ke).on(function(){for(var r in t)e(r).un(n)})}function L(e){var t={};return e&&e.split('\r\n').forEach(function(e){var r=e.indexOf(': ');t[e.substring(0,r)]=e.substring(r+2)}),t}function j(e,t){function r(e){return{"http:":80,"https:":443}[e]}function n(t){return t.port||r(t.protocol||e.protocol)}return!!(t.protocol&&t.protocol!=e.protocol||t.host&&t.host!=e.host||t.host&&n(t)!=n(e))}function O(e){var t=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/,r=t.exec(e)||[];return{protocol:r[1]||'',host:r[2]||'',port:r[3]||''}}function D(){return new XMLHttpRequest}function U(e,t,r,n,a,d,i){'use strict';function s(){var e=t.responseText,r=e.substr(p);r&&c(r),p=Q(e)}var c=e(_e).emit,f=e(he).emit,p=0,l=!0;e(ke).on(function(){t.onreadystatechange=null,t.abort()}),'onprogress'in t&&(t.onprogress=s),t.onreadystatechange=function(){function r(){try{l&&e(ge).emit(t.status,L(t.getAllResponseHeaders())),l=!1}catch(t){}}switch(t.readyState){case 2:case 3:return r();case 4:r();var n=2==(t.status+'')[0];n?(s(),e(ve).emit()):f(K(t.status,t.responseText));}};try{for(var u in t.open(r,n,!0),d)t.setRequestHeader(u,d[u]);j(o.location,O(n))||t.setRequestHeader('X-Requested-With','XMLHttpRequest'),t.withCredentials=i,t.send(a)}catch(t){o.setTimeout(Z(f,K(void 0,void 0,t)),0)}}function H(e,t){return{key:e,node:t}}function F(e){function t(e,t){var r=ie(re(e));return v(i,r)?n(e,Q(r),t):e}function r(e,t,r){ie(re(e))[t]=r}function n(e,t,n){e&&r(e,t,n);var o=S(H(t,n),e);return a(o),o}var a=e(pe).emit,o=e(le).emit,d=e(ye).emit,s=e(me).emit,c={};return c[Se]=function(e,a){if(!e)return d(a),n(e,se,a);var o=t(e,a),i=ne(o),s=de(re(o));return r(i,s,a),S(H(s,a),i)},c[we]=function(e){return o(e),ne(e)||s(ie(re(e)))},c[xe]=n,c}function q(e,t,r){function n(e){return function(t){return t.id==e}}var a,o;return{on:function(r,n){var d={listener:r,id:n||r};return t&&t.emit(e,r,d.id),a=S(d,a),o=S(r,o),this},emit:function(){T(o,arguments)},un:function(t){var d;a=C(a,n(t),function(e){d=e}),d&&(o=C(o,function(e){return e==d.listener}),r&&r.emit(e,d.listener,d.id))},listeners:function(){return o},hasListener:function(e){var t=e?n(e):y;return k(N(t,a))}}}function z(){function e(e){return r[e]=q(e,n,a)}function t(t){return r[t]||e(t)}var r={},n=e('newListener'),a=e('removeListener');return['emit','on','un'].forEach(function(e){t[e]=u(function(r,n){l(n,t(r)[e])})}),t}function K(e,t,r){try{var n=c.parse(t)}catch(t){}return{statusCode:e,body:t,jsonBody:n,thrown:r}}function V(e,t){function r(e,t,r){var n=B(r);e(t,A(ne(E(de,n))),A(E(ie,n)))}function n(t,n,a){var o=e(t).emit;n.on(function(e){var t=a(e);!1!==t&&r(o,ie(t),e)},t),e('removeListener').on(function(r){r!=t||e(r).listeners()||n.un(t)})}var a={node:e(le),path:e(pe)};e('newListener').on(function(e){var r=/(node|path):(.*)/.exec(e);if(r){var o=a[r[1]];o.hasListener(e)||n(e,o,t(r[2]))}})}function G(e,t){function r(t,r){return e(t).on(a(r),r),S}function n(e,t,r){r=r||t;var n=a(t);return e.on(function(){var t=!1;S.forget=function(){t=!0},l(arguments,n),delete S.forget,t&&e.un(r)},r),S}function a(e){return function(){try{return e.apply(S,arguments)}catch(t){setTimeout(function(){throw new s(t.message)})}}}function o(t,r){return e(t+':'+r)}function d(e){return function(){var t=e.apply(this,arguments);k(t)&&(t==Y.drop?h():y(t))}}function i(e,t,r){var a;a='node'==e?d(r):r,n(o(e,t),a,r)}function c(e,t){for(var r in t)i(e,r,t[r])}function f(e,t,r){return ee(t)?i(e,t,r):c(e,t),S}var p=/^(node|path):./,b=e(me),h=e(be).emit,y=e(ue).emit,v=u(function(t,r){if(S[t])l(r,S[t]);else{var a=e(t),o=r[0];p.test(t)?n(a,o):a.on(o)}return S}),x=function(t,r,n){if('done'==t)b.un(r);else if('node'==t||'path'==t)e.un(t+':'+r,n);else{e(t).un(r)}return S},S;return e(ye).on(function(e){S.root=g(e)}),e(ge).on(function(e,t){S.header=function(e){return e?t[e]:t}}),S={on:v,addListener:v,removeListener:x,emit:e.emit,node:Z(f,'node'),path:Z(f,'path'),done:Z(n,b),start:Z(r,ge),fail:e(he).on,abort:e(ke).emit,header:m,root:m,source:t}}function W(e,t,r,n,a){var o=z();return t&&U(o,D(),e,t,r,n,a),R(o),M(o,F(o)),V(o,ce),G(o,t)}function X(e,t,r,n,a,o,d){return a=a?c.parse(c.stringify(a)):{},n?(!ee(n)&&(n=c.stringify(n),a['Content-Type']=a['Content-Type']||'application/json'),a['Content-Length']=a['Content-Length']||n.length):n=null,e(r||'GET',function(e,t){return!1===t&&(e+=-1==e.indexOf('?')?'?':'&',e+='_='+new Date().getTime()),e}(t,d),n,a,o||!1)}function Y(e){var t=ae('resume','pause','pipe'),r=Z(x,t);return e?r(e)||ee(e)?X(W,e):X(W,e.url,e.method,e.body,e.headers,e.withCredentials,e.cached):W()}var Z=u(function(e,t){var r=t.length;return u(function(n){for(var a=0;aObject(f.isUndefined)(e)||Object(f.isNull)(e),T=(e)=>{for(;e&&e.startsWith('0x0');)e=`0x${e.slice(3)}`;return e},B=(e)=>(1==e.length%2&&(e=e.replace('0x','0x0')),e);class N extends I.a{constructor(e,t,r,n,a,o,d,i,s){super(e,t,r,n,a,o,d),this.utils=i,this.formatters=s,this.wallet=new R(this)}_addAccountFunctions(e){const t=this;return e.signTransaction=function(r,n){return t.signTransaction(r,e.privateKey,n)},e.sign=function(r){return t.sign(r,e.privateKey)},e.encrypt=function(r,n){return t.encrypt(e.privateKey,r,n)},e}create(e){return this._addAccountFunctions(u.a.create(e||this.utils.randomHex(32)))}privateKeyToAccount(e){return this._addAccountFunctions(u.a.fromPrivate(e))}signTransaction(e,t,r){function n(e){if(e.gas||e.gasLimit||(o=new Error('gas is missing')),(0>e.nonce||0>e.gas||0>e.gasPrice||0>e.chainId)&&(o=new Error('Gas, gasPrice, nonce or chainId is lower than 0')),o)return r(o),Promise.reject(o);try{e=a.formatters.inputCallFormatter(e);const r=e;r.to=e.to||'0x',r.data=e.data||'0x',r.value=e.value||'0x',r.chainId=a.utils.numberToHex(e.chainId);const n=y.a.encode([x.a.fromNat(r.nonce),x.a.fromNat(r.gasPrice),x.a.fromNat(r.gas),r.to.toLowerCase(),x.a.fromNat(r.value),r.data,x.a.fromNat(r.chainId||'0x1'),'0x','0x']),o=h.a.keccak256(n),i=u.a.makeSigner(2*v.a.toNumber(r.chainId||'0x1')+35)(h.a.keccak256(n),t),s=y.a.decode(n).slice(0,6).concat(u.a.decodeSignature(i));s[6]=B(T(s[6])),s[7]=B(T(s[7])),s[8]=B(T(s[8]));const c=y.a.encode(s),f=y.a.decode(c);d={messageHash:o,v:T(f[6]),r:T(f[7]),s:T(f[8]),rawTransaction:c}}catch(t){return r(t),Promise.reject(t)}return r(null,d),d}const a=this;let o=!1,d;return r=r||(()=>{}),e?void 0!==e.nonce&&void 0!==e.chainId&&void 0!==e.gasPrice?Promise.resolve(n(e)):Promise.all([P(e.chainId)?a.getId():e.chainId,P(e.gasPrice)?a.getGasPrice():e.gasPrice,P(e.nonce)?a.getTransactionCount(a.privateKeyToAccount(t).address):e.nonce]).then((t)=>{if(P(t[0])||P(t[1])||P(t[2]))throw new Error(`One of the values 'chainId', 'gasPrice', or 'nonce' couldn't be fetched: ${JSON.stringify(t)}`);return n(Object(f.extend)(e,{chainId:t[0],gasPrice:t[1],nonce:t[2]}))}):(o=new Error('No transaction object given!'),r(o),Promise.reject(o))}recoverTransaction(e){const t=y.a.decode(e),r=u.a.encodeSignature(t.slice(6,9)),n=x.a.toNumber(t[6]),a=35>n?[]:[x.a.fromNumber(n-35>>1),'0x','0x'],o=t.slice(0,6).concat(a),d=y.a.encode(o);return u.a.recover(h.a.keccak256(d),r)}hashMessage(e){const t=this.utils.isHexStrict(e)?this.utils.hexToBytes(e):e,r=n.from(t),a=`\x19Ethereum Signed Message:\n${t.length}`,o=n.from(a),d=n.concat([o,r]);return h.a.keccak256s(d)}sign(e,t){const r=this.hashMessage(e),n=u.a.sign(r,t),a=u.a.decodeSignature(n);return{message:e,messageHash:r,v:a[0],r:a[1],s:a[2],signature:n}}recover(e,t,r){const n=[].slice.apply(arguments);return Object(f.isObject)(e)?this.recover(e.messageHash,u.a.encodeSignature([e.v,e.r,e.s]),!0):(r||(e=this.hashMessage(e)),4<=n.length?(r=n.slice(-1)[0],r=!!Object(f.isBoolean)(r)&&!!r,this.recover(e,u.a.encodeSignature(n.slice(1,4)),r)):u.a.recover(e,t))}decrypt(e,t,r){if(!Object(f.isString)(t))throw new Error('No password given.');const a=Object(f.isObject)(e)?e:JSON.parse(r?e.toLowerCase():e);if(3!==a.version)throw new Error('Not a valid V3 wallet');let o,d;if('scrypt'===a.crypto.kdf)d=a.crypto.kdfparams,o=w()(new n(t),new n(d.salt,'hex'),d.n,d.r,d.p,d.dklen);else if('pbkdf2'===a.crypto.kdf){if(d=a.crypto.kdfparams,'hmac-sha256'!==d.prf)throw new Error('Unsupported parameters to PBKDF2');o=C.pbkdf2Sync(new n(t),new n(d.salt,'hex'),d.c,d.dklen,'sha256')}else throw new Error('Unsupported key derivation scheme');const i=new n(a.crypto.ciphertext,'hex'),s=utils.sha3(n.concat([o.slice(16,32),i])).replace('0x','');if(s!==a.crypto.mac)throw new Error('Key derivation failed - possibly wrong password');const c=C.createDecipheriv(a.crypto.cipher,o.slice(0,16),new n(a.crypto.cipherparams.iv,'hex')),p=`0x${n.concat([c.update(i),c.final()]).toString('hex')}`;return this.privateKeyToAccount(p)}encrypt(e,t,r){const a=this.privateKeyToAccount(e);r=r||{};const o=r.salt||C.randomBytes(32),d=r.iv||C.randomBytes(16);let i;const s=r.kdf||'scrypt',c={dklen:r.dklen||32,salt:o.toString('hex')};if('pbkdf2'===s)c.c=r.c||262144,c.prf='hmac-sha256',i=C.pbkdf2Sync(new n(t),o,c.c,c.dklen,'sha256');else if('scrypt'===s)c.n=r.n||8192,c.r=r.r||8,c.p=r.p||1,i=w()(new n(t),o,c.n,c.r,c.p,c.dklen);else throw new Error('Unsupported kdf');const f=C.createCipheriv(r.cipher||'aes-128-ctr',i.slice(0,16),d);if(!f)throw new Error('Unsupported cipher');const p=n.concat([f.update(new n(a.privateKey.replace('0x',''),'hex')),f.final()]),l=this.utils.sha3(n.concat([i.slice(16,32),new n(p,'hex')])).replace('0x','');return{version:3,id:E.a.v4({random:r.uuid||C.randomBytes(16)}),address:a.address.toLowerCase().replace('0x',''),crypto:{ciphertext:p.toString('hex'),cipherparams:{iv:d.toString('hex')},cipher:r.cipher||'aes-128-ctr',kdf:s,kdfparams:c,mac:l.toString('hex')}}}}class R{constructor(e){this._accounts=e,this.length=0,this.defaultKeyName='web3js_wallet'}_findSafeIndex(e=0){return Object(f.has)(this,e)?this._findSafeIndex(e+1):e}_currentIndexes(){const e=Object.keys(this),t=e.map((e)=>parseInt(e)).filter((e)=>9e20>e);return t}create(e,t){for(let r=0;r{e.remove(t)}),this}encrypt(e,t){const r=this,n=this._currentIndexes(),a=n.map((n)=>r[n].encrypt(e,t));return a}decrypt(e,t){const r=this;return e.forEach((e)=>{const n=r._accounts.decrypt(e,t);if(n)r.add(n);else throw new Error('Couldn\'t decrypt accounts. Password wrong?')}),this}save(e,t){return localStorage.setItem(t||this.defaultKeyName,JSON.stringify(this.encrypt(e))),!0}load(e,t){let r=localStorage.getItem(t||this.defaultKeyName);if(r)try{r=JSON.parse(r)}catch(t){}return this.decrypt(r||[],e)}}'undefined'==typeof localStorage&&(delete R.prototype.save,delete R.prototype.load)}).call(this,r(9),r(4).Buffer)},function(e,t,r){var n=r(312),a=r(313),o=a;o.v1=n,o.v4=a,e.exports=o},function(e){'use strict';e.exports=[{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'resolver',outputs:[{name:'',type:'address'}],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'owner',outputs:[{name:'',type:'address'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'label',type:'bytes32'},{name:'owner',type:'address'}],name:'setSubnodeOwner',outputs:[],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'ttl',type:'uint64'}],name:'setTTL',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'ttl',outputs:[{name:'',type:'uint64'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'resolver',type:'address'}],name:'setResolver',outputs:[],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'owner',type:'address'}],name:'setOwner',outputs:[],payable:!1,type:'function'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'owner',type:'address'}],name:'Transfer',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!0,name:'label',type:'bytes32'},{indexed:!1,name:'owner',type:'address'}],name:'NewOwner',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'resolver',type:'address'}],name:'NewResolver',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'ttl',type:'uint64'}],name:'NewTTL',type:'event'}]},function(e){'use strict';e.exports=[{constant:!0,inputs:[{name:'interfaceID',type:'bytes4'}],name:'supportsInterface',outputs:[{name:'',type:'bool'}],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'},{name:'contentTypes',type:'uint256'}],name:'ABI',outputs:[{name:'contentType',type:'uint256'},{name:'data',type:'bytes'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'hash',type:'bytes'}],name:'setMultihash',outputs:[],payable:!1,stateMutability:'nonpayable',type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'multihash',outputs:[{name:'',type:'bytes'}],payable:!1,stateMutability:'view',type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'x',type:'bytes32'},{name:'y',type:'bytes32'}],name:'setPubkey',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'content',outputs:[{name:'ret',type:'bytes32'}],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'addr',outputs:[{name:'ret',type:'address'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'contentType',type:'uint256'},{name:'data',type:'bytes'}],name:'setABI',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'name',outputs:[{name:'ret',type:'string'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'name',type:'string'}],name:'setName',outputs:[],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'hash',type:'bytes32'}],name:'setContent',outputs:[],payable:!1,type:'function'},{constant:!0,inputs:[{name:'node',type:'bytes32'}],name:'pubkey',outputs:[{name:'x',type:'bytes32'},{name:'y',type:'bytes32'}],payable:!1,type:'function'},{constant:!1,inputs:[{name:'node',type:'bytes32'},{name:'addr',type:'address'}],name:'setAddr',outputs:[],payable:!1,type:'function'},{inputs:[{name:'ensAddr',type:'address'}],payable:!1,type:'constructor'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'a',type:'address'}],name:'AddrChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'hash',type:'bytes32'}],name:'ContentChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'name',type:'string'}],name:'NameChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!0,name:'contentType',type:'uint256'}],name:'ABIChanged',type:'event'},{anonymous:!1,inputs:[{indexed:!0,name:'node',type:'bytes32'},{indexed:!1,name:'x',type:'bytes32'},{indexed:!1,name:'y',type:'bytes32'}],name:'PubkeyChanged',type:'event'}]},function(e,t,r){var n=function(){throw'This swarm.js function isn\'t available on the browser.'},a=r(328),o=r(16),d=r(343),i=r(344),s=r(345);e.exports=s({fsp:{readFile:n},files:{download:n,safeDownloadArchived:n,directoryTree:n},os:{platform:n,arch:n},path:{join:n,slice:n},child_process:{spawn:n},defaultArchives:{},mimetype:{lookup:n},request:a,downloadUrl:null,bytes:o,hash:d,pick:i})},function(e){e.exports={a:'1.0.0-beta.36'}},function(e,t,r){'use strict';var n=r(176),a=r(179),o=r(77),d=r(78);e.exports=r(181)(Array,'Array',function(e,t){this._t=d(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,a(1)):'keys'==t?a(0,r):'values'==t?a(0,e[r]):a(0,[r,e[r]])},'values'),o.Arguments=o.Array,n('keys'),n('values'),n('entries')},function(e,t,r){var n=r(26)('unscopables'),a=Array.prototype;a[n]==void 0&&r(28)(a,n,{}),e.exports=function(e){a[n][e]=!0}},function(e,t,r){e.exports=!r(31)&&!r(54)(function(){return 7!=Object.defineProperty(r(96)('div'),'a',{get:function(){return 7}}).a})},function(e,t,r){var n=r(53);e.exports=function(e,t){if(!n(e))return e;var r,a;if(t&&'function'==typeof(r=e.toString)&&!n(a=r.call(e)))return a;if('function'==typeof(r=e.valueOf)&&!n(a=r.call(e)))return a;if(!t&&'function'==typeof(r=e.toString)&&!n(a=r.call(e)))return a;throw TypeError('Can\'t convert object to primitive value')}},function(e){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,r){var n=r(98);e.exports=Object('z').propertyIsEnumerable(0)?Object:function(e){return'String'==n(e)?e.split(''):Object(e)}},function(e,t,r){'use strict';var n=r(95),a=r(182),o=r(41),d=r(28),i=r(77),s=r(185),c=r(102),f=r(193),p=r(26)('iterator'),l=!([].keys&&'next'in[].keys()),u='keys',b='values',h=function(){return this};e.exports=function(e,t,r,m,y,g,v){s(r,t,m);var k=function(e){return!l&&e in A?A[e]:e===u?function(){return new r(this,e)}:e===b?function(){return new r(this,e)}:function(){return new r(this,e)}},x=t+' Iterator',S=y==b,w=!1,A=e.prototype,E=A[p]||A['@@iterator']||y&&A[y],I=E||k(y),C=y?S?k('entries'):I:void 0,P='Array'==t?A.entries||E:E,T,B,N;if(P&&(N=f(P.call(new e)),N!==Object.prototype&&N.next&&(c(N,x,!0),!n&&'function'!=typeof N[p]&&d(N,p,h))),S&&E&&E.name!==b&&(w=!0,I=function(){return E.call(this)}),(!n||v)&&(l||w||!A[p])&&d(A,p,I),i[t]=I,i[x]=h,y)if(T={values:S?I:k(b),keys:g?I:k(u),entries:C},v)for(B in T)B in A||o(A,B,T[B]);else a(a.P+a.F*(l||w),t,T);return T}},function(e,t,r){var n=r(27),a=r(75),o=r(28),d=r(41),i=r(183),s='prototype',c=function(e,t,r){var f=e&c.F,p=e&c.G,l=e&c.S,u=e&c.P,b=e&c.B,h=p?n:l?n[t]||(n[t]={}):(n[t]||{})[s],m=p?a:a[t]||(a[t]={}),y=m[s]||(m[s]={}),g,v,k,x;for(g in p&&(r=t),r)v=!f&&h&&void 0!==h[g],k=(v?h:r)[g],x=b&&v?i(k,n):u&&'function'==typeof k?i(Function.call,k):k,h&&d(h,g,k,e&c.U),m[g]!=k&&o(m,g,x),u&&y[g]!=k&&(y[g]=k)};n.core=a,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t,r){var n=r(184);e.exports=function(e,t,r){return(n(e),void 0===t)?e:1===r?function(r){return e.call(t,r)}:2===r?function(r,n){return e.call(t,r,n)}:3===r?function(r,n,a){return e.call(t,r,n,a)}:function(){return e.apply(t,arguments)}}},function(e){e.exports=function(e){if('function'!=typeof e)throw TypeError(e+' is not a function!');return e}},function(e,t,r){'use strict';var n=r(186),a=r(97),o=r(102),d={};r(28)(d,r(26)('iterator'),function(){return this}),e.exports=function(e,t,r){e.prototype=n(d,{next:a(1,r)}),o(e,t+' Iterator')}},function(e,t,r){var n=r(40),a=r(187),o=r(101),d=r(80)('IE_PROTO'),i=function(){},s='prototype',c=function(){var e=r(96)('iframe'),t=o.length,n='<',a='>',d;for(e.style.display='none',r(192).appendChild(e),e.src='javascript:',d=e.contentWindow.document,d.open(),d.write(n+'script'+a+'document.F=Object'+n+'/script'+a),d.close(),c=d.F;t--;)delete c[s][o[t]];return c()};e.exports=Object.create||function(e,t){var r;return null===e?r=c():(i[s]=n(e),r=new i,i[s]=null,r[d]=e),void 0===t?r:a(r,t)}},function(e,t,r){var n=r(52),a=r(40),o=r(99);e.exports=r(31)?Object.defineProperties:function(e,t){a(e);for(var r=o(t),d=r.length,s=0,i;d>s;)n.f(e,i=r[s++],t[i]);return e}},function(e,t,r){var n=r(55),a=r(78),o=r(189)(!1),d=r(80)('IE_PROTO');e.exports=function(e,t){var r=a(e),s=0,i=[],c;for(c in r)c!=d&&n(r,c)&&i.push(c);for(;t.length>s;)n(r,c=t[s++])&&(~o(i,c)||i.push(c));return i}},function(e,t,r){var n=r(78),a=r(190),o=r(191);e.exports=function(e){return function(t,r,d){var i=n(t),s=a(i.length),c=o(d,s),f;if(e&&r!=r){for(;s>c;)if(f=i[c++],f!=f)return!0;}else for(;s>c;c++)if((e||c in i)&&i[c]===r)return e||c||0;return!e&&-1}}},function(e,t,r){var n=r(100),a=Math.min;e.exports=function(e){return 0e?a(e+t,0):o(e,t)}},function(e,t,r){var n=r(27).document;e.exports=n&&n.documentElement},function(e,t,r){var n=r(55),a=r(194),o=r(80)('IE_PROTO'),d=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=a(e),n(e,o)?e[o]:'function'==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?d:null}},function(e,t,r){var n=r(79);e.exports=function(e){return Object(n(e))}},function(e,t,r){r(31)&&'g'!=/./g.flags&&r(52).f(RegExp.prototype,'flags',{configurable:!0,get:r(103)})},function(){},function(e,t,r){var n=r(198);e.exports=function(e){return'string'==typeof e?n(e)?e.slice(2):e:e}},function(e){e.exports=function(e){if('string'!=typeof e)throw new Error('[is-hex-prefixed] value must be type \'string\', is currently type '+typeof e+', while checking isHexPrefixed.');return'0x'===e.slice(0,2)}},function(e,t,r){var n=r(53),a=r(98),o=r(26)('match');e.exports=function(e){var t;return n(e)&&((t=e[o])===void 0?'RegExp'==a(e):!!t)}},function(e,t,r){e.exports=r(201)},function(e){e.exports=window.crypto},function(e,t,r){r(81)('match',1,function(e,t,r){return[function(r){'use strict';var n=e(this),a=r==void 0?void 0:r[t];return a===void 0?new RegExp(r)[t](n+''):a.call(r,n)},r]})},function(e,t,r){'use strict';function n(e){'string'==typeof e&&e.match(/^0x[0-9A-Fa-f]{40}$/)||l.throwError('invalid address',l.INVALID_ARGUMENT,{arg:'address',value:e}),e=e.toLowerCase();for(var t=e.substring(2).split(''),r=new Uint8Array(40),n=0;40>n;n++)r[n]=t[n].charCodeAt(0);r=c.arrayify(f.keccak256(r));for(var a=0;40>a;a+=2)8<=r[a>>1]>>4&&(t[a]=t[a].toUpperCase()),8<=(15&r[a>>1])&&(t[a+1]=t[a+1].toUpperCase());return'0x'+t.join('')}function a(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+'00';var t='';for(e.split('').forEach(function(e){t+=b[e]});t.length>=i;){var r=t.substring(0,i);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=98-parseInt(t,10)%97+'';2>n.length;)n='0'+n;return n}function o(e){var t=null;if('string'!=typeof e&&l.throwError('invalid address',l.INVALID_ARGUMENT,{arg:'address',value:e}),e.match(/^(0x)?[0-9a-fA-F]{40}$/))'0x'!==e.substring(0,2)&&(e='0x'+e),t=n(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&l.throwError('bad address checksum',l.INVALID_ARGUMENT,{arg:'address',value:e});else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==a(e)&&l.throwError('bad icap checksum',l.INVALID_ARGUMENT,{arg:'address',value:e}),t=new s.default.BN(e.substring(4),36).toString(16);40>t.length;)t='0'+t;t=n('0x'+t)}else l.throwError('invalid address',l.INVALID_ARGUMENT,{arg:'address',value:e});return t}var d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,'__esModule',{value:!0});for(var s=d(r(3)),c=r(32),f=r(204),p=r(206),l=r(58),u=9007199254740991,b={},h=0;10>h;h++)b[h+'']=h+'';for(var h=0;26>h;h++)b[String.fromCharCode(65+h)]=10+h+'';var i=Math.floor(function(e){var t=Math.log10;return t?t(e):Math.log(e)/Math.LN10}(u));t.getAddress=o,t.getIcapAddress=function(e){for(var t=new s.default.BN(o(e).substring(2),16).toString(36).toUpperCase();30>t.length;)t='0'+t;return'XE'+a('XE00'+t)+t},t.getContractAddress=function(e){if(!e.from)throw new Error('missing from address');var t=e.nonce;return o('0x'+f.keccak256(p.encode([o(e.from),c.stripZeros(c.hexlify(t))])).substring(26))}},function(e,t,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var n=r(104),a=r(32);t.keccak256=function(e){return'0x'+n.keccak_256(a.arrayify(e))}},function(e){(function(t){e.exports=t}).call(this,{})},function(e,t,r){'use strict';function n(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function a(e,t,r){for(var n=0,a=0;a=t.length)return t.unshift(192+t.length),t;var r=n(t.length);return r.unshift(247+r.length),r.concat(t)}var a=Array.prototype.slice.call(s.arrayify(e));if(1===a.length&&127>=a[0])return a;if(55>=a.length)return a.unshift(128+a.length),a;var r=n(a.length);return r.unshift(183+r.length),r.concat(a)}function d(e,t,r,n){for(var a=[],o;rt+1+n)throw new Error('invalid rlp');return{consumed:1+n,result:a}}function i(e,t){if(0===e.length)throw new Error('invalid rlp data');if(248<=e[t]){var r=e[t]-247;if(t+1+r>e.length)throw new Error('too short');var n=a(e,t+1,r);if(t+1+r+n>e.length)throw new Error('to short');return d(e,t,t+1+r,r+n)}if(192<=e[t]){var n=e[t]-192;if(t+1+n>e.length)throw new Error('invalid rlp data');return d(e,t,t+1,n)}if(184<=e[t]){var r=e[t]-183;if(t+1+r>e.length)throw new Error('invalid rlp data');var n=a(e,t+1,r);if(t+1+r+n>e.length)throw new Error('invalid rlp data');var o=s.hexlify(e.slice(t+1+r,t+1+r+n));return{consumed:1+r+n,result:o}}if(128<=e[t]){var n=e[t]-128;if(t+1+n>e.length)throw new Error('invlaid rlp data');var o=s.hexlify(e.slice(t+1,t+1+n));return{consumed:1+n,result:o}}return{consumed:1,result:s.hexlify(e[t])}}Object.defineProperty(t,'__esModule',{value:!0});var s=r(32);t.encode=function(e){return s.hexlify(o(e))},t.decode=function(e){var t=s.arrayify(e),r=i(t,0);if(r.consumed!==t.length)throw new Error('invalid rlp data');return r.result}},function(e,t,r){'use strict';function n(e){var t=e.toString(16);return'-'===t[0]?0==t.length%2?'-0x0'+t.substring(1):'-0x'+t.substring(1):1==t.length%2?'0x0'+t:'0x'+t}function a(e){return i(e)._bn}function d(e){return new m(n(e))}function i(e){return e instanceof m?e:new m(e)}var o=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t['default']=e,t};Object.defineProperty(t,'__esModule',{value:!0});var f=s(r(3)),p=r(32),l=r(105),u=r(208),b=c(r(58)),h=new f.default.BN(-1),m=function(e){function t(r){var o=e.call(this)||this;if(b.checkNew(o,t),'string'==typeof r)p.isHexString(r)?('0x'==r&&(r='0x0'),l.defineReadOnly(o,'_hex',r)):'-'===r[0]&&p.isHexString(r.substring(1))?l.defineReadOnly(o,'_hex',r):r.match(/^-?[0-9]*$/)?(''==r&&(r='0'),l.defineReadOnly(o,'_hex',n(new f.default.BN(r)))):b.throwError('invalid BigNumber string value',b.INVALID_ARGUMENT,{arg:'value',value:r});else if('number'==typeof r){parseInt(r+'')!==r&&b.throwError('underflow',b.NUMERIC_FAULT,{operation:'setValue',fault:'underflow',value:r,outputValue:parseInt(r+'')});try{l.defineReadOnly(o,'_hex',n(new f.default.BN(r)))}catch(e){b.throwError('overflow',b.NUMERIC_FAULT,{operation:'setValue',fault:'overflow',details:e.message})}}else r instanceof t?l.defineReadOnly(o,'_hex',r._hex):r.toHexString?l.defineReadOnly(o,'_hex',n(a(r.toHexString()))):p.isArrayish(r)?l.defineReadOnly(o,'_hex',n(new f.default.BN(p.hexlify(r).substring(2),16))):b.throwError('invalid BigNumber value',b.INVALID_ARGUMENT,{arg:'value',value:r});return o}return o(t,e),Object.defineProperty(t.prototype,'_bn',{get:function(){return'-'===this._hex[0]?new f.default.BN(this._hex.substring(3),16).mul(h):new f.default.BN(this._hex.substring(2),16)},enumerable:!0,configurable:!0}),t.prototype.fromTwos=function(e){return d(this._bn.fromTwos(e))},t.prototype.toTwos=function(e){return d(this._bn.toTwos(e))},t.prototype.add=function(e){return d(this._bn.add(a(e)))},t.prototype.sub=function(e){return d(this._bn.sub(a(e)))},t.prototype.div=function(e){var t=i(e);return t.isZero()&&b.throwError('division by zero',b.NUMERIC_FAULT,{operation:'divide',fault:'division by zero'}),d(this._bn.div(a(e)))},t.prototype.mul=function(e){return d(this._bn.mul(a(e)))},t.prototype.mod=function(e){return d(this._bn.mod(a(e)))},t.prototype.pow=function(e){return d(this._bn.pow(a(e)))},t.prototype.maskn=function(e){return d(this._bn.maskn(e))},t.prototype.eq=function(e){return this._bn.eq(a(e))},t.prototype.lt=function(e){return this._bn.lt(a(e))},t.prototype.lte=function(e){return this._bn.lte(a(e))},t.prototype.gt=function(e){return this._bn.gt(a(e))},t.prototype.gte=function(e){return this._bn.gte(a(e))},t.prototype.isZero=function(){return this._bn.isZero()},t.prototype.toNumber=function(){try{return this._bn.toNumber()}catch(e){b.throwError('overflow',b.NUMERIC_FAULT,{operation:'setValue',fault:'overflow',details:e.message})}return null},t.prototype.toString=function(){return this._bn.toString(10)},t.prototype.toHexString=function(){return this._hex},t}(u.BigNumber);t.bigNumberify=i,t.ConstantNegativeOne=i(-1),t.ConstantZero=i(0),t.ConstantOne=i(1),t.ConstantTwo=i(2),t.ConstantWeiPerEther=i('1000000000000000000')},function(e,t){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(){return function(){}}();t.BigNumber=r;var n=function(){return function(){}}();t.Indexed=n;var a=function(){return function(){}}();t.MinimalProvider=a;var o=function(){return function(){}}();t.Signer=o;var d=function(){return function(){}}();t.HDNode=d},function(e,t,r){'use strict';function n(e,t){void 0===t&&(t=d.current),t!=d.current&&(e=e.normalize(t));for(var r=[],n=0,a=0,i;ai?r[n++]=i:2048>i?(r[n++]=192|i>>6,r[n++]=128|63&i):55296==(64512&i)&&a+1>18,r[n++]=128|63&i>>12,r[n++]=128|63&i>>6,r[n++]=128|63&i):(r[n++]=224|i>>12,r[n++]=128|63&i>>6,r[n++]=128|63&i);return o.arrayify(r)}var a=String.fromCharCode;Object.defineProperty(t,'__esModule',{value:!0});var o=r(32),d;(function(e){e.current='',e.NFC='NFC',e.NFD='NFD',e.NFKC='NFKC',e.NFKD='NFKD'})(d=t.UnicodeNormalizationForm||(t.UnicodeNormalizationForm={}));t.toUtf8Bytes=n;t.toUtf8String=function(e){e=o.arrayify(e);for(var t='',r=0;r>7){t+=a(n);continue}if(2!=n>>6){var d=null;if(6==n>>5)d=1;else if(14==n>>4)d=2;else if(30==n>>3)d=3;else if(62==n>>2)d=4;else if(126==n>>1)d=5;else continue;if(r+d>e.length){for(;r>6;r++);if(r!=e.length)continue;return t}var i=n&(1<<8-d-1)-1,s;for(s=0;s>6)break;i=i<<6|63&c}if(s!=d){r--;continue}if(65535>=i){t+=a(i);continue}i-=65536,t+=a((1023&i>>10)+55296,(1023&i)+56320)}}return t}},function(e,t){'use strict';function r(e){var t=e.length;if(0>16,d[s++]=255&i>>8,d[s++]=255&i;return 2===o&&(i=f[e.charCodeAt(l)]<<2|f[e.charCodeAt(l+1)]>>4,d[s++]=255&i),1===o&&(i=f[e.charCodeAt(l)]<<10|f[e.charCodeAt(l+1)]<<4|f[e.charCodeAt(l+2)]>>2,d[s++]=255&i>>8,d[s++]=255&i),d}function o(e){return c[63&e>>18]+c[63&e>>12]+c[63&e>>6]+c[63&e]}function d(e,t,r){for(var n=[],a=t,d;ai?i:o+a));return 1==r?(s=e[t-1],n.push(c[s>>2]+c[63&s<<4]+'==')):2==r&&(s=(e[t-2]<<8)+e[t-1],n.push(c[s>>10]+c[63&s>>4]+c[63&s<<2]+'=')),n.join('')}t.byteLength=function(e){var t=r(e),n=t[0],a=t[1];return 3*(n+a)/4-a},t.toByteArray=a,t.fromByteArray=s;for(var c=[],f=[],p='undefined'==typeof Uint8Array?Array:Uint8Array,l='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',u=0,i=l.length;u>1,u=-7,b=a?c-1:0,i=a?-1:1,d=t[n+b],s,e;for(b+=i,s=d&(1<<-u)-1,d>>=-u,u+=f;0>=-u,u+=o;0>1,h=23===f?5.960464477539063e-8-6.617444900424222e-24:0,y=o?0:p-1,i=o?1:-1,d=0>n||0===n&&0>1/n?1:0,s,g,m;for(n=Math.abs(n),isNaN(n)||n===Infinity?(g=isNaN(n)?1:0,s=u):(s=Math.floor(Math.log(n)/Math.LN2),1>n*(m=r(2,-s))&&(s--,m*=2),n+=1<=s+b?h/m:h*r(2,1-b),2<=n*m&&(s++,m/=2),s+b>=u?(g=0,s=u):1<=s+b?(g=(n*m-1)*r(2,f),s+=b):(g=n*r(2,b-1)*r(2,f),s=0));8<=f;t[a+y]=255&g,y+=i,g/=256,f-=8);for(s=s<=0.10.0'},homepage:'https://github.com/theturtle32/WebSocket-Node',keywords:['websocket','websockets','socket','networking','comet','push','RFC-6455','realtime','server','client'],license:'Apache-2.0',main:'index',name:'websocket',repository:{type:'git',url:'git+https://github.com/theturtle32/WebSocket-Node.git'},scripts:{gulp:'gulp',install:'(node-gyp rebuild 2> builderror.log) || (exit 0)',test:'faucet test/unit'},version:'1.0.26'}},function(e){'use strict';e.exports={isString:function(e){return'string'==typeof e},isObject:function(e){return'object'==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){'use strict';t.decode=t.parse=r(217),t.encode=t.stringify=r(218)},function(e){'use strict';function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,n,a,o){n=n||'&',a=a||'=';var d={};if('string'!=typeof e||0===e.length)return d;var s=/\+/g;e=e.split(n);var c=1e3;o&&'number'==typeof o.maxKeys&&(c=o.maxKeys);var f=e.length;0c&&(f=c);for(var p=0;p>>0),r=this.head,n=0;r;)a(r.data,t,n),n+=r.data.length,r=r.next;return t},e}(),d&&d.inspect&&d.inspect.custom&&(e.exports.prototype[d.inspect.custom]=function(){var e=d.inspect({length:this.length});return this.constructor.name+' '+e})},function(){},function(e,t,r){(function(e){function n(e,t){this._id=e,this._clearFn=t}var a='undefined'!=typeof e&&e||'undefined'!=typeof self&&self||window,o=Function.prototype.apply;t.setTimeout=function(){return new n(o.call(setTimeout,a,arguments),clearTimeout)},t.setInterval=function(){return new n(o.call(setInterval,a,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(a,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(225),t.setImmediate='undefined'!=typeof self&&self.setImmediate||'undefined'!=typeof e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate='undefined'!=typeof self&&self.clearImmediate||'undefined'!=typeof e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(9))},function(e,t,r){(function(e,t){(function(e){'use strict';function r(e){'function'!=typeof e&&(e=new Function(''+e));for(var t=Array(arguments.length-1),r=0;r{let r=[];for(var n=0;nt(e,()=>r),concat:(e,t)=>e.concat(t),flatten:(e)=>{let t=[];for(let r=0,n=e.length;r{let r=[];for(let n=0,a=t.length;n>>27}function i(e){return e<<30|e>>>2}function f(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}var a=r(5),d=r(36),s=r(7).Buffer,p=[1518500249,1859775393,-1894007588,-899497514],c=Array(80);a(n,d),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(r){for(var n=this._w,l=0|this._a,a=0|this._b,u=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)n[e]=r.readInt32BE(4*e);for(;80>e;++e)n[e]=n[e-3]^n[e-8]^n[e-14]^n[e-16];for(var b=0;80>b;++b){var h=~~(b/20),s=0|o(l)+f(h,a,u,c)+d+n[b]+p[h];d=c,c=u,u=i(a),a=l,l=s}this._a=0|l+this._a,this._b=0|a+this._b,this._c=0|u+this._c,this._d=0|c+this._d,this._e=0|d+this._e},n.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=l,s.call(this,64,56)}function a(e){return e<<1|e>>>31}function o(e){return e<<5|e>>>27}function i(e){return e<<30|e>>>2}function f(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}var d=r(5),s=r(36),c=r(7).Buffer,p=[1518500249,1859775393,-1894007588,-899497514],l=Array(80);d(n,s),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(r){for(var n=this._w,l=0|this._a,u=0|this._b,b=0|this._c,c=0|this._d,d=0|this._e,e=0;16>e;++e)n[e]=r.readInt32BE(4*e);for(;80>e;++e)n[e]=a(n[e-3]^n[e-8]^n[e-14]^n[e-16]);for(var h=0;80>h;++h){var m=~~(h/20),s=0|o(l)+f(m,u,b,c)+d+n[h]+p[m];d=c,c=b,b=i(u),u=l,l=s}this._a=0|l+this._a,this._b=0|u+this._b,this._c=0|b+this._c,this._d=0|c+this._d,this._e=0|d+this._e},n.prototype._hash=function(){var e=c.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=s,d.call(this,64,56)}var a=r(5),o=r(116),d=r(36),i=r(7).Buffer,s=Array(64);a(n,o),n.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},n.prototype._hash=function(){var e=i.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=n},function(e,t,r){function n(){this.init(),this._w=s,d.call(this,128,112)}var a=r(5),o=r(117),d=r(36),i=r(7).Buffer,s=Array(160);a(n,o),n.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},n.prototype._hash=function(){function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}var t=i.allocUnsafe(48);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},e.exports=n},function(e,t,r){'use strict';function n(e,t){d.call(this,'digest'),'string'==typeof t&&(t=o.from(t)),this._alg=e,this._key=t,t.length>c?t=e(t):t.length>>0},t.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=255&t>>>16,e[2+r]=255&t>>>8,e[3+r]=255&t},t.ip=function(e,t,r,n){for(var a=0,o=0,d=6;0<=d;d-=2){for(var i=0;24>=i;i+=8)a<<=1,a|=1&t>>>i+d;for(var i=0;24>=i;i+=8)a<<=1,a|=1&e>>>i+d}for(var d=6;0<=d;d-=2){for(var i=1;25>=i;i+=8)o<<=1,o|=1&t>>>i+d;for(var i=1;25>=i;i+=8)o<<=1,o|=1&e>>>i+d}r[n+0]=a>>>0,r[n+1]=o>>>0},t.rip=function(e,t,r,n){for(var a=0,o=0,d=0;4>d;d++)for(var i=24;0<=i;i-=8)a<<=1,a|=1&t>>>i+d,a<<=1,a|=1&e>>>i+d;for(var d=4;8>d;d++)for(var i=24;0<=i;i-=8)o<<=1,o|=1&t>>>i+d,o<<=1,o|=1&e>>>i+d;r[n+0]=a>>>0,r[n+1]=o>>>0},t.pc1=function(e,t,r,n){for(var a=0,o=0,d=7;5<=d;d--){for(var i=0;24>=i;i+=8)a<<=1,a|=1&t>>i+d;for(var i=0;24>=i;i+=8)a<<=1,a|=1&e>>i+d}for(var i=0;24>=i;i+=8)a<<=1,a|=1&t>>i+d;for(var d=1;3>=d;d++){for(var i=0;24>=i;i+=8)o<<=1,o|=1&t>>i+d;for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>i+d}for(var i=0;24>=i;i+=8)o<<=1,o|=1&e>>i+d;r[n+0]=a>>>0,r[n+1]=o>>>0},t.r28shl=function(e,t){return 268435455&e<>>28-t};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,n,a){for(var o=0,d=0,s=r.length>>>1,c=0;c>>r[c];for(var c=s;c>>r[c];n[a+0]=o>>>0,n[a+1]=d>>>0},t.expand=function(e,t,r){var n=0,a=0;n=(1&e)<<5|e>>>27;for(var o=23;15<=o;o-=4)n<<=6,n|=63&e>>>o;for(var o=11;3<=o;o-=4)a|=63&e>>>o,a<<=6;a|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=a>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var r=0,a=0;4>a;a++){var o=63&e>>>18-6*a,d=n[64*a+o];r<<=4,r|=d}for(var a=0;4>a;a++){var o=63&t>>>18-6*a,d=n[256+64*a+o];r<<=4,r|=d}return r>>>0};var a=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,r=0;r>>a[r];return t>>>0},t.padSplit=function(e,t,r){for(var n=e.toString(2);n.length>>1],r=c.r28shl(r,d),n=c.r28shl(n,d),c.pc2(r,n,e.keys,a)},a.prototype._update=function(e,t,n,a){var o=this._desState,d=c.readUInt32BE(e,t),i=c.readUInt32BE(e,t+4);c.ip(d,i,o.tmp,0),d=o.tmp[0],i=o.tmp[1],'encrypt'===this.type?this._encrypt(o,d,i,o.tmp,0):this._decrypt(o,d,i,o.tmp,0),d=o.tmp[0],i=o.tmp[1],c.writeUInt32BE(n,d,a),c.writeUInt32BE(n,i,a+4)},a.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,p=f}c.rip(l,p,o,d)},a.prototype._decrypt=function(e,n,a,o,d){for(var p=a,l=n,r=e.keys.length-2;0<=r;r-=2){var i=e.keys[r],u=e.keys[r+1];c.expand(p,e.tmp,0),i^=e.tmp[0],u^=e.tmp[1];var b=c.substitute(i,u),s=c.permute(b),f=p;p=(l^s)>>>0,l=f}c.rip(p,l,o,d)}},function(e,t,r){'use strict';function n(e){a.equal(e.length,8,'Invalid IV length'),this.iv=Array(8);for(var t=0;t>n%8,e._prev=a(e._prev,r?i:s);return o}function a(e,t){var r=e.length,n=-1,a=o.allocUnsafe(e.length);for(e=o.concat([e,o.from([t])]);++n>7;return a}var o=r(7).Buffer;t.encrypt=function(e,t,r){for(var a=t.length,d=o.allocUnsafe(a),s=-1;++s>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=d.alloc(16,0),this.cache=d.allocUnsafe(0)}var d=r(7).Buffer,i=d.alloc(16,0);o.prototype.ghash=function(e){for(var t=-1;++t++r;){for(d=0!=(this.state[~~(r/8)]&1<<7-r%8),d&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),i=0!=(1&e[3]),o=3;0>>1|(1&e[o-1])<<31;e[0]>>>=1,i&&(e[0]^=-520093696)}this.state=a(t)},o.prototype.update=function(e){this.cache=d.concat([this.cache,e]);for(var t;16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(d.concat([this.cache,i],16)),this.ghash(a([0,e,0,t])),this.state},e.exports=o},function(e,t,r){function n(e,t,r){p.call(this),this._cache=new a,this._last=void 0,this._cipher=new l.AES(t),this._prev=s.from(r),this._mode=e,this._autopadding=!0}function a(){this.cache=s.allocUnsafe(0)}function o(e){var t=e[15];if(1>t||16(n>>1)-1?(n>>1)-d:d,a.isubn(o)}else o=0;r.push(o);for(var s=0!==a.cmpn(0)&&0===a.andln(n-1)?t+1:1,c=1;c=s;t--)f=(f<<1)+n[t];d.push(f)}for(var p=this.jpoint(null,null,null),a=this.jpoint(null,null,null),u=o;0s)break;var i=o[s];l(0!==i),d='affine'===e.type?0>1]):d.mixedAdd(a[-i-1>>1].neg()):0>1]):d.add(a[-i-1>>1].neg())}return'affine'===e.type?d.toP():d},n.prototype._wnafMulAdd=function(e,t,r,n,d){for(var s=this._wnafT1,l=this._wnafT2,u=this._wnafT3,h=0,m=0;mm)break;for(var x=0;x>1]:0>C&&(i=l[x][-C-1>>1].neg());A='affine'===i.type?A.mixedAdd(i):A.add(i)}}for(var m=0;m=Math.ceil((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,a=0;an[0].cmp(n[1])?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)r=new c(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],p(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}var o;return o=e.basis?e.basis.map(function(e){return{a:new c(e.a,16),b:new c(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:o}}},n.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:c.mont(e),r=new c(2).toRed(t).redInvm(),n=r.redNeg(),a=new c(3).toRed(t).redNeg().redSqrt().redMul(r),o=n.redAdd(a).fromRed(),d=n.redSub(a).fromRed();return[o,d]},n.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,a=this.n.clone(),o=new c(1),d=new c(0),s=new c(0),f=new c(1),p=0,i,l,u,b,h,m,g,v,r,k;0!==n.cmpn(0);){k=a.div(n),v=a.sub(k.mul(n)),r=s.sub(k.mul(o));var x=f.sub(k.mul(d));if(!u&&0>v.cmp(t))i=g.neg(),l=o,u=v.neg(),b=r;else if(u&&2==++p)break;g=v,a=n,n=v,s=o,o=r,f=d,d=x}h=v.neg(),m=r;var y=u.sqr().add(b.sqr()),S=h.sqr().add(m.sqr());return 0<=S.cmp(y)&&(h=i,m=l),u.negative&&(u=u.neg(),b=b.neg()),h.negative&&(h=h.neg(),m=m.neg()),[{a:u,b:b},{a:h,b:m}]},n.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],a=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),d=a.mul(r.a),i=o.mul(n.a),s=a.mul(r.b),c=o.mul(n.b),f=e.sub(d).sub(i),p=s.add(c).neg();return{k1:f,k2:p}},n.prototype.pointFromX=function(e,t){e=new c(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error('invalid point');var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)},n.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(a).cmpn(0)},n.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,a=this._endoWnafT2,o=0;o':''},a.prototype.isInfinity=function(){return this.inf},a.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},a.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),a=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=a.redSqr().redISub(this.x.redAdd(this.x)),d=a.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,d)},a.prototype.getX=function(){return this.x.fromRed()},a.prototype.getY=function(){return this.y.fromRed()},a.prototype.mul=function(e){return e=new c(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a):this.curve._wnafMulAdd(1,n,a,2)},a.prototype.jmulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a,!0):this.curve._wnafMulAdd(1,n,a,2,!0)},a.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},a.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},a.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},s(o,f.BasePoint),n.prototype.jpoint=function(e,t,r){return new o(this,e,t,r)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),a=this.x.redMul(t),o=e.x.redMul(n),d=this.y.redMul(t.redMul(e.z)),i=e.y.redMul(n.redMul(this.z)),s=a.redSub(o),c=d.redSub(i);if(0===s.cmpn(0))return 0===c.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=s.redSqr(),f=r.redMul(s),p=a.redMul(r),l=c.redSqr().redIAdd(f).redISub(p).redISub(p),u=c.redMul(p.redISub(l)).redISub(d.redMul(f)),b=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,u,b)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,a=e.x.redMul(t),o=this.y,d=e.y.redMul(t).redMul(this.z),i=n.redSub(a),s=o.redSub(d);if(0===i.cmpn(0))return 0===s.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var r=i.redSqr(),c=r.redMul(i),f=n.redMul(r),p=s.redSqr().redIAdd(c).redISub(f).redISub(f),l=s.redMul(f.redISub(p)).redISub(o.redMul(c)),u=this.z.redMul(i);return this.curve.jpoint(p,l,u)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r':''},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){'use strict';function n(e){s.call(this,'mont',e),this.a=new d(e.a,16).toRed(this.red),this.b=new d(e.b,16).toRed(this.red),this.i4=new d(4).toRed(this.red).redInvm(),this.two=new d(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function a(e,t,r){s.BasePoint.call(this,e,'projective'),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new d(t,16),this.z=new d(r,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var o=r(66),d=r(3),i=r(5),s=o.base,c=r(12),f=c.utils;i(n,s),e.exports=n,n.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t),a=n.redSqrt();return 0===a.redSqr().cmp(n)},i(a,s.BasePoint),n.prototype.decodePoint=function(e,t){return this.point(f.toArray(e,t),1)},n.prototype.point=function(e,t){return new a(this,e,t)},n.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},a.prototype.precompute=function(){},a.prototype._encode=function(){return this.getX().toArray('be',this.curve.p.byteLength())},a.fromJSON=function(e,t){return new a(e,t[0],t[1]||e.one)},a.prototype.inspect=function(){return this.isInfinity()?'':''},a.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},a.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),r=this.x.redSub(this.z),n=r.redSqr(),a=t.redSub(n),o=t.redMul(n),d=a.redMul(n.redAdd(this.curve.a24.redMul(a)));return this.curve.point(o,d)},a.prototype.add=function(){throw new Error('Not supported on Montgomery curve')},a.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),a=e.x.redAdd(e.z),o=e.x.redSub(e.z),d=o.redMul(r),i=a.redMul(n),s=t.z.redMul(d.redAdd(i).redSqr()),c=t.x.redMul(d.redISub(i).redSqr());return this.curve.point(s,c)},a.prototype.mul=function(e){for(var r=e.clone(),t=this,n=this.curve.point(null,null),a=this,o=[];0!==r.cmpn(0);r.iushrn(1))o.push(r.andln(1));for(var d=o.length-1;0<=d;d--)0===o[d]?(t=t.diffAdd(n,a),n=n.dbl()):(n=t.diffAdd(n,a),t=t.dbl());return n},a.prototype.mulAdd=function(){throw new Error('Not supported on Montgomery curve')},a.prototype.jumlAdd=function(){throw new Error('Not supported on Montgomery curve')},a.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},a.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){'use strict';function n(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,c.call(this,'edwards',e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),f(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function a(e,r,n,a,o){c.BasePoint.call(this,e,'projective'),null===r&&null===n&&null===a?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(r,16),this.y=new i(n,16),this.z=a?new i(a,16):this.curve.one,this.t=o&&new i(o,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.y.red&&(this.y=this.y.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),!this.zOne&&(this.t=this.t.redMul(this.z.redInvm()))))}var o=r(66),d=r(12),i=r(3),s=r(5),c=o.base,f=d.utils.assert;s(n,c),e.exports=n,n.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},n.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},n.prototype.jpoint=function(e,r,n,a){return this.point(e,r,n,a)},n.prototype.pointFromX=function(e,t){e=new i(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(a.redInvm()),d=o.redSqrt();if(0!==d.redSqr().redSub(o).cmp(this.zero))throw new Error('invalid point');var s=d.fromRed().isOdd();return(t&&!s||!t&&s)&&(d=d.redNeg()),this.point(e,d)},n.prototype.pointFromY=function(e,t){e=new i(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.one),a=r.redMul(this.d).redAdd(this.one),o=n.redMul(a.redInvm());if(0===o.cmp(this.zero))if(t)throw new Error('invalid point');else return this.point(this.zero,e);var d=o.redSqrt();if(0!==d.redSqr().redSub(o).cmp(this.zero))throw new Error('invalid point');return d.isOdd()!==t&&(d=d.redNeg()),this.point(d,e)},n.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),a=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(a)},s(a,c.BasePoint),n.prototype.pointFromJSON=function(e){return a.fromJSON(this,e)},n.prototype.point=function(e,r,n,o){return new a(this,e,r,n,o)},a.fromJSON=function(e,t){return new a(e,t[0],t[1],t[2])},a.prototype.inspect=function(){return this.isInfinity()?'':''},a.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},a.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var a=this.curve._mulA(t),o=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),e=a.redAdd(r),d=e.redSub(n),i=a.redSub(r),s=o.redMul(d),c=e.redMul(i),f=o.redMul(i),p=d.redMul(e);return this.curve.point(s,c,p,f)},a.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),a,o,d;if(this.curve.twisted){var i=this.curve._mulA(r),e=i.redAdd(n);if(this.zOne)a=t.redSub(r).redSub(n).redMul(e.redSub(this.curve.two)),o=e.redMul(i.redSub(n)),d=e.redSqr().redSub(e).redSub(e);else{var s=this.z.redSqr(),c=e.redSub(s).redISub(s);a=t.redSub(r).redISub(n).redMul(c),o=e.redMul(i.redSub(n)),d=e.redMul(c)}}else{var i=r.redAdd(n),s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=i.redSub(s).redSub(s);a=this.curve._mulC(t.redISub(i)).redMul(c),o=this.curve._mulC(i).redMul(r.redISub(n)),d=i.redMul(c)}return this.curve.point(a,o,d)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},a.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),a=this.t.redMul(this.curve.dd).redMul(t.t),o=this.z.redMul(t.z.redAdd(t.z)),d=n.redSub(r),e=o.redSub(a),i=o.redAdd(a),s=n.redAdd(r),c=d.redMul(e),f=i.redMul(s),p=d.redMul(s),l=e.redMul(i);return this.curve.point(c,f,l,p)},a.prototype._projAdd=function(t){var r=this.z.redMul(t.z),n=r.redSqr(),a=this.x.redMul(t.x),o=this.y.redMul(t.y),d=this.curve.d.redMul(a).redMul(o),e=n.redSub(d),i=n.redAdd(d),s=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(a).redISub(o),c=r.redMul(e).redMul(s),f,p;return this.curve.twisted?(f=r.redMul(i).redMul(o.redSub(this.curve._mulA(a))),p=e.redMul(i)):(f=r.redMul(i).redMul(o.redSub(a)),p=this.curve._mulC(e).redMul(i)),this.curve.point(c,f,p)},a.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},a.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},a.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},a.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},a.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},a.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},a.prototype.getX=function(){return this.normalize(),this.x.fromRed()},a.prototype.getY=function(){return this.normalize(),this.y.fromRed()},a.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},a.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),a=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(r.redIAdd(a),0===this.x.cmp(r))return!0}return!1},a.prototype.toP=a.prototype.normalize,a.prototype.mixedAdd=a.prototype.add},function(e,t,r){'use strict';function n(e){this.curve='short'===e.type?new i.curve.short(e):'edwards'===e.type?new i.curve.edwards(e):new i.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),'Invalid curve'),s(this.g.mul(this.n).isInfinity(),'Invalid curve, G*N != O')}function a(e,t){Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get:function(){var r=new n(t);return Object.defineProperty(o,e,{configurable:!0,enumerable:!0,value:r}),r}})}var o=t,d=r(87),i=r(12),s=i.utils.assert;o.PresetCurve=n,a('p192',{type:'short',prime:'p192',p:'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',a:'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',b:'64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',n:'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',hash:d.sha256,gRed:!1,g:['188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012','07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811']}),a('p224',{type:'short',prime:'p224',p:'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',a:'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',b:'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',n:'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',hash:d.sha256,gRed:!1,g:['b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21','bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34']}),a('p256',{type:'short',prime:null,p:'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',a:'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',b:'5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',n:'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',hash:d.sha256,gRed:!1,g:['6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296','4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5']}),a('p384',{type:'short',prime:null,p:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff',a:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc',b:'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',n:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',hash:d.sha384,gRed:!1,g:['aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7','3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f']}),a('p521',{type:'short',prime:null,p:'000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff',a:'000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc',b:'00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',n:'000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',hash:d.sha512,gRed:!1,g:['000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66','00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650']}),a('curve25519',{type:'mont',prime:'p25519',p:'7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',a:'76d06',b:'1',n:'1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',hash:d.sha256,gRed:!1,g:['9']}),a('ed25519',{type:'edwards',prime:'p25519',p:'7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',a:'-1',c:'1',d:'52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',n:'1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',hash:d.sha256,gRed:!1,g:['216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a','6666666666666666666666666666666666666666666666666666666666666658']});var c;try{c=r(281)}catch(t){c=void 0}a('secp256k1',{type:'short',prime:'k256',p:'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',a:'0',b:'7',n:'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',h:'1',hash:d.sha256,beta:'7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',lambda:'5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',basis:[{a:'3086d221a7d46bcde86c90e49284eb15',b:'-e4437ed6010e88286f547fa90abfe4c3'},{a:'114ca50f7a8e2f3f657c1108d9d44cfd8',b:'3086d221a7d46bcde86c90e49284eb15'}],gRed:!1,g:['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798','483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',c]})},function(e,t,r){'use strict';t.sha1=r(276),t.sha224=r(277),t.sha256=r(138),t.sha384=r(278),t.sha512=r(139)},function(e,t,r){'use strict';function n(){return this instanceof n?void(i.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)):new n}var a=r(20),o=r(48),d=r(137),f=a.rotl32,p=a.sum32,l=a.sum32_5,u=d.ft_1,i=o.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];a.inherits(n,i),e.exports=n,n.blockSize=512,n.outSize=160,n.hmacStrength=80,n.padLength=64,n.prototype._update=function(r,n){for(var o=this.W,m=0;16>m;m++)o[m]=r[n+m];for(;m=e?t^r^n:31>=e?t&r|~t&n:47>=e?(t|~r)^n:63>=e?t&n|r&~n:t^(r|~n)}function d(e){return 15>=e?0:31>=e?1518500249:47>=e?1859775393:63>=e?2400959708:2840853838}function i(e){return 15>=e?1352829926:31>=e?1548603684:47>=e?1836072691:63>=e?2053994217:0}var c=n(20),f=n(48),p=c.rotl32,l=c.sum32,u=c.sum32_3,b=c.sum32_4,h=f.BlockHash;c.inherits(a,h),t.ripemd160=a,a.blockSize=512,a.outSize=160,a.hmacStrength=192,a.padLength=64,a.prototype._update=function(e,t){for(var n=this.h[0],a=this.h[1],c=this.h[2],f=this.h[3],h=this.h[4],g=n,v=a,k=c,x=f,S=h,w=0,A;80>w;w++)A=l(p(b(n,o(w,a,c,f),e[m[w]+t],d(w)),y[w]),h),n=h,h=f,f=p(c,10),c=a,a=A,A=l(p(b(g,o(79-w,v,k,x),e[r[w]+t],i(w)),s[w]),S),g=S,S=x,x=p(k,10),k=v,v=A;A=u(this.h[1],c,x),this.h[1]=u(this.h[2],f,S),this.h[2]=u(this.h[3],h,g),this.h[3]=u(this.h[4],n,v),this.h[4]=u(this.h[0],a,k),this.h[0]=A},a.prototype._digest=function(e){return'hex'===e?c.toHex32(this.h,'little'):c.split32(this.h,'little')};var m=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],r=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],y=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],s=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(e,t,r){'use strict';function n(e,t,r){return this instanceof n?void(this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(a.toArray(t,r))):new n(e,t,r)}var a=r(20),o=r(15);e.exports=n,n.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t=h.cmpn(1)||0<=h.cmp(u))){var m=this.g.mul(h);if(!m.isInfinity()){var y=m.getX(),g=y.umod(this.n);if(0!==g.cmpn(0)){var v=h.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(v=v.umod(this.n),0!==v.cmpn(0)){var k=(m.getY().isOdd()?1:0)|(0===y.cmp(g)?0:2);return d.canonical&&0d.cmpn(1)||0<=d.cmp(this.n))return!1;if(0>r.cmpn(1)||0<=r.cmp(this.n))return!1;var i=r.invm(this.n),s=i.mul(e).umod(this.n),c=i.mul(d).umod(this.n);if(!this.curve._maxwellTrick){var l=this.g.mulAdd(s,n.getPublic(),c);return!l.isInfinity()&&0===l.getX().umod(this.n).cmp(d)}var l=this.g.jmulAdd(s,n.getPublic(),c);return!l.isInfinity()&&l.eqXToP(d)},n.prototype.recoverPubKey=function(t,o,d,i){c((3&d)===d,'The recovery param is more than two bits'),o=new f(o,i);var p=this.n,n=new a(t),e=o.r,r=o.s,s=1&d,l=d>>1;if(0<=e.cmp(this.curve.p.umod(this.curve.n))&&l)throw new Error('Unable to find sencond key candinate');e=l?this.curve.pointFromX(e.add(this.curve.n),s):this.curve.pointFromX(e,s);var u=o.r.invm(p),b=p.sub(n).mul(u).umod(p),h=r.mul(u).umod(p);return this.g.mulAdd(b,e,h)},n.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new f(e,n),null!==e.recoveryParam)return e.recoveryParam;for(var a=0;4>a;a++){var o;try{o=this.recoverPubKey(t,e,a)}catch(t){continue}if(o.eq(r))return a}throw new Error('Unable to find valid recovery factor')}},function(e,t,r){'use strict';function n(e){if(!(this instanceof n))return new n(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||'hex'),r=o.toArray(e.nonce,e.nonceEnc||'hex'),a=o.toArray(e.pers,e.persEnc||'hex');d(t.length>=this.minEntropy/8,'Not enough entropy. Minimum is: '+this.minEntropy+' bits'),this._init(t,r,a)}var a=r(87),o=r(136),d=r(15);e.exports=n,n.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,'Not enough entropy. Minimum is: '+this.minEntropy+' bits'),this._update(e.concat(r||[])),this._reseed=1},n.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error('Reseed is required');'string'!=typeof t&&(n=r,r=t,t=null),r&&(r=o.toArray(r,n||'hex'),this._update(r));for(var a=[];a.length'}},function(e,t,r){'use strict';function n(e,t){return e instanceof n?e:void(this._importDER(e,t)||(p(e.r&&e.s,'Signature without r or s'),this.r=new c(e.r,16),this.s=new c(e.s,16),this.recoveryParam=void 0===e.recoveryParam?null:e.recoveryParam))}function a(){this.place=0}function o(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=0,a=0,o=t.place;a<(15&r);a++,o++)n<<=8,n|=e[o];return t.place=o,n}function d(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&tt)return void e.push(t);var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(255&t>>>(r<<3));e.push(t)}var c=r(3),s=r(12),f=s.utils,p=f.assert;e.exports=n,n.prototype._importDER=function(e,t){e=f.toArray(e,t);var n=new a;if(48!==e[n.place++])return!1;var d=o(e,n);if(d+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=o(e,n),p=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var r=o(e,n);if(e.length!==r+n.place)return!1;var l=e.slice(n.place,r+n.place);return 0===p[0]&&128&p[1]&&(p=p.slice(1)),0===l[0]&&128&l[1]&&(l=l.slice(1)),this.r=new c(p),this.s=new c(l),this.recoveryParam=null,!0},n.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=d(t),r=d(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var n=[2];i(n,t.length),n=n.concat(t),n.push(2),i(n,r.length);var a=n.concat(r),o=[48];return i(o,a.length),o=o.concat(a),f.encode(o,e)}},function(e,t,r){'use strict';function n(e){if(i('ed25519'===e,'only tested with ed25519 so far'),!(this instanceof n))return new n(e);var e=o.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=a.sha512}var a=r(87),o=r(12),d=o.utils,i=d.assert,s=d.parseBytes,c=r(287),f=r(288);e.exports=n,n.prototype.sign=function(e,t){e=s(e);var n=this.keyFromSecret(t),a=this.hashInt(n.messagePrefix(),e),r=this.g.mul(a),o=this.encodePoint(r),d=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),i=a.add(d).umod(this.curve.n);return this.makeSignature({R:r,S:i,Rencoded:o})},n.prototype.verify=function(e,t,r){e=s(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),a=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S()),d=t.R().add(n.pub().mul(a));return d.eq(o)},n.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=e.cmpn(0))throw new Error('invalid sig');if(e.cmp(t)>=t)throw new Error('invalid sig')}var d=r(3),i=r(12).ec,c=r(37),s=r(144);e.exports=function(e,r,o,s,f){var p=c(o);if('ec'===p.type){if('ecdsa'!==s&&'ecdsa/rsa'!==s)throw new Error('wrong public key type');return n(e,r,p)}if('dsa'===p.type){if('dsa'!==s)throw new Error('wrong public key type');return a(e,r,p)}if('rsa'!==s&&'ecdsa/rsa'!==s)throw new Error('wrong public key type');r=t.concat([f,r]);for(var l=p.modulus.byteLength(),u=[1],b=0;r.length+u.length+2b?1:0;for(l=Math.min(e.length,u.length),e.length!==u.length&&(m=1),h=-1;++hn-l-2)throw new Error('message too long');var u=new t(n-a-l-2);u.fill(0);var b=n-d-1,h=s(d),m=f(t.concat([o,u,new t([1]),r],b),c(h,b)),y=f(h,c(m,d));return new p(t.concat([new t([0]),y,m],n))}function a(e,r,n){var a=r.length,d=e.modulus.byteLength();if(a>d-11)throw new Error('message too long');var i;return n?(i=new t(d-a-3),i.fill(255)):i=o(d-a-3),new p(t.concat([new t([0,n?1:2]),i,new t([0]),r],d))}function o(e){for(var r=new t(e),n=0,a=s(2*e),o=0,d;n=t.length){o++;break}var d=t.slice(2,a-1),i=t.slice(a-1,a);if(('0002'!==n.toString('hex')&&!r||'0001'!==n.toString('hex')&&r)&&o++,8>d.length&&o++,o)throw new Error('decryption error');return t.slice(a)}function o(e,r){e=new t(e),r=new t(r);var n=0,a=e.length;e.length!==r.length&&(n++,a=Math.min(e.length,r.length));for(var o=-1;++op||0<=new i(r).cmp(c.modulus))throw new Error('decryption error');var u=o?l(new i(r),c):f(r,c);var b=new t(p-u.length);if(b.fill(0),u=t.concat([b,u],p),4===s)return n(c,u);if(1===s)return a(c,u,o);if(3===s)return u;throw new Error('unknown padding')}}).call(this,r(4).Buffer)},function(e,t,r){'use strict';(function(e,n){function a(){throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')}function o(e,t){if('number'!=typeof e||e!==e)throw new TypeError('offset must be a number');if(e>u||0>e)throw new TypeError('offset must be a uint32');if(e>p||e>t)throw new RangeError('offset out of range')}function d(e,t,r){if('number'!=typeof e||e!==e)throw new TypeError('size must be a number');if(e>u||0>e)throw new TypeError('size must be a uint32');if(e+t>r||e>p)throw new RangeError('buffer too small')}function i(e,t,r,a){if(n.browser){var o=e.buffer,d=new Uint8Array(o,t,r);return l.getRandomValues(d),a?void n.nextTick(function(){a(null,e)}):e}if(a)return void c(r,function(r,n){return r?a(r):void(n.copy(e,t),a(null,e))});var i=c(r);return i.copy(e,t),e}var s=r(7),c=r(33),f=s.Buffer,p=s.kMaxLength,l=e.crypto||e.msCrypto,u=4294967295;l&&l.getRandomValues||!n.browser?(t.randomFill=function(t,r,n,a){if(!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if('function'==typeof r)a=r,r=0,n=t.length;else if('function'==typeof n)a=n,n=t.length-r;else if('function'!=typeof a)throw new TypeError('"cb" argument must be a function');return o(r,t.length),d(n,r,t.length),i(t,r,n,a)},t.randomFillSync=function(t,r,n){if('undefined'==typeof r&&(r=0),!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return o(r,t.length),void 0===n&&(n=t.length-r),d(n,r,t.length),i(t,r,n)}):(t.randomFill=a,t.randomFillSync=a)}).call(this,r(9),r(11))},function(e,t,r){(function(t){function n(e,r,n,a,o){if(t.isBuffer(e)&&t.isBuffer(n))e.copy(n,a,r,r+o);else for(;o--;)n[a++]=e[r++]}var a=r(148).pbkdf2Sync,o=2147483647;e.exports=function(e,d,s,c,r,f,p){function l(e,t,n,r,a,o){var d=0,s=128*n,c;for(e.copy(o,d,t,t+s),c=0;c>>32-t}function h(e){var t;for(t=0;16>t;t++)v[t]=(255&e[4*t+0])<<0,v[t]|=(255&e[4*t+1])<<8,v[t]|=(255&e[4*t+2])<<16,v[t]|=(255&e[4*t+3])<<24;for(n(v,0,k,0,16),t=8;0t;++t)v[t]=k[t]+v[t];for(t=0;16>t;t++){var r=4*t;e[r+0]=255&v[t]>>0,e[r+1]=255&v[t]>>8,e[r+2]=255&v[t]>>16,e[r+3]=255&v[t]>>24}}function m(e,t,r,n,a){for(var o=0;o 0 and a power of 2');if(s>o/128/c)throw Error('Parameter N is too large');if(c>o/128/r)throw Error('Parameter r is too large');var y=new t(256*c),g=new t(128*c*s),v=new Int32Array(16),k=new Int32Array(16),x=new t(64),S=a(e,d,1,128*r*c,'sha256'),w;if(p){var A=2*(r*s),E=0;w=function(){++E,0==E%1e3&&p({current:E,total:A,percent:100*(E/A)})}}for(var I=0;I=this._blockSize;){for(var d=this._blockOffset;dr;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error('_digest is not implemented')},e.exports=a},function(e,t,r){function n(e,t,r){var p=t&&r||0,i=t||[];e=e||{};var l=e.node||c,u=void 0===e.clockseq?f:e.clockseq;if(null==l||null==u){var b=a();null==l&&(l=c=[1|b[0],b[1],b[2],b[3],b[4],b[5]]),null==u&&(u=f=16383&(b[6]<<8|b[7]))}var h=void 0===e.msecs?new Date().getTime():e.msecs,m=void 0===e.nsecs?s+1:e.nsecs,y=h-d+(m-s)/1e4;if(0>y&&void 0===e.clockseq&&(u=16383&u+1),(0>y||h>d)&&void 0===e.nsecs&&(m=0),1e4<=m)throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');d=h,s=m,f=u,h+=122192928e5;var g=(1e4*(268435455&h)+m)%4294967296;i[p++]=255&g>>>24,i[p++]=255&g>>>16,i[p++]=255&g>>>8,i[p++]=255&g;var v=268435455&1e4*(h/4294967296);i[p++]=255&v>>>8,i[p++]=255&v,i[p++]=16|15&v>>>24,i[p++]=255&v>>>16,i[p++]=128|u>>>8,i[p++]=255&u;for(var k=0;6>k;++k)i[p+k]=l[k];return t?t:o(i)}var a=r(153),o=r(154),d=0,s=0,c,f;e.exports=n},function(e,t,r){var n=r(153),a=r(154);e.exports=function(e,t,r){var o=t&&r||0;'string'==typeof e&&(t='binary'===e?Array(16):null,e=null),e=e||{};var d=e.random||(e.rng||n)();if(d[6]=64|15&d[6],d[8]=128|63&d[8],t)for(var i=0;16>i;++i)t[o+i]=d[i];return t||a(d)}},function(e,t,r){'use strict';t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=r(67),t.createHash=t.Hash=r(68),t.createHmac=t.Hmac=r(315);var n=r(120),a=Object.keys(n),o=['sha1','sha224','sha256','sha384','sha512','md5','rmd160'].concat(a);t.getHashes=function(){return o};var d=r(148);t.pbkdf2=d.pbkdf2,t.pbkdf2Sync=d.pbkdf2Sync;var i=r(317);t.Cipher=i.Cipher,t.createCipher=i.createCipher,t.Cipheriv=i.Cipheriv,t.createCipheriv=i.createCipheriv,t.Decipher=i.Decipher,t.createDecipher=i.createDecipher,t.Decipheriv=i.Decipheriv,t.createDecipheriv=i.createDecipheriv,t.getCiphers=i.getCiphers,t.listCiphers=i.listCiphers;var s=r(131);t.DiffieHellmanGroup=s.DiffieHellmanGroup,t.createDiffieHellmanGroup=s.createDiffieHellmanGroup,t.getDiffieHellman=s.getDiffieHellman,t.createDiffieHellman=s.createDiffieHellman,t.DiffieHellman=s.DiffieHellman;var c=r(135);t.createSign=c.createSign,t.Sign=c.Sign,t.createVerify=c.createVerify,t.Verify=c.Verify,t.createECDH=r(321);var f=r(322);t.publicEncrypt=f.publicEncrypt,t.privateEncrypt=f.privateEncrypt,t.publicDecrypt=f.publicDecrypt,t.privateDecrypt=f.privateDecrypt;var p=r(325);t.randomFill=p.randomFill,t.randomFillSync=p.randomFillSync,t.createCredentials=function(){throw new Error('sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/crypto-browserify/crypto-browserify')},t.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(e,t,r){'use strict';function n(e,t){d.call(this,'digest'),'string'==typeof t&&(t=s.from(t));var r='sha512'===e||'sha384'===e?128:64;if(this._alg=e,this._key=t,t.length>r){var n='rmd160'===e?new c:f(e);t=n.update(t).digest()}else t.lengthc?t=e(t):t.lengthn-l-2)throw new Error('message too long');var u=new t(n-a-l-2);u.fill(0);var b=n-d-1,h=s(d),m=f(t.concat([o,u,new t([1]),r],b),c(h,b)),y=f(h,c(m,d));return new p(t.concat([new t([0]),y,m],n))}function a(e,r,n){var a=r.length,d=e.modulus.byteLength();if(a>d-11)throw new Error('message too long');var i;return n?(i=new t(d-a-3),i.fill(255)):i=o(d-a-3),new p(t.concat([new t([0,n?1:2]),i,new t([0]),r],d))}function o(e){for(var r=new t(e),n=0,a=s(2*e),o=0,d;n=t.length){o++;break}var d=t.slice(2,a-1),i=t.slice(a-1,a);if(('0002'!==n.toString('hex')&&!r||'0001'!==n.toString('hex')&&r)&&o++,8>d.length&&o++,o)throw new Error('decryption error');return t.slice(a)}function o(e,r){e=new t(e),r=new t(r);var n=0,a=e.length;e.length!==r.length&&(n++,a=Math.min(e.length,r.length));for(var o=-1;++op||0<=new i(r).cmp(c.modulus))throw new Error('decryption error');var u=o?l(new i(r),c):f(r,c);var b=new t(p-u.length);if(b.fill(0),u=t.concat([b,u],p),4===s)return n(c,u);if(1===s)return a(c,u,o);if(3===s)return u;throw new Error('unknown padding')}}).call(this,r(4).Buffer)},function(e,t,r){'use strict';(function(e,n){function a(){throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')}function o(e,t){if('number'!=typeof e||e!==e)throw new TypeError('offset must be a number');if(e>u||0>e)throw new TypeError('offset must be a uint32');if(e>p||e>t)throw new RangeError('offset out of range')}function d(e,t,r){if('number'!=typeof e||e!==e)throw new TypeError('size must be a number');if(e>u||0>e)throw new TypeError('size must be a uint32');if(e+t>r||e>p)throw new RangeError('buffer too small')}function i(e,t,r,a){if(n.browser){var o=e.buffer,d=new Uint8Array(o,t,r);return l.getRandomValues(d),a?void n.nextTick(function(){a(null,e)}):e}if(a)return void c(r,function(r,n){return r?a(r):void(n.copy(e,t),a(null,e))});var i=c(r);return i.copy(e,t),e}var s=r(22),c=r(67),f=s.Buffer,p=s.kMaxLength,l=e.crypto||e.msCrypto,u=4294967295;l&&l.getRandomValues||!n.browser?(t.randomFill=function(t,r,n,a){if(!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if('function'==typeof r)a=r,r=0,n=t.length;else if('function'==typeof n)a=n,n=t.length-r;else if('function'!=typeof a)throw new TypeError('"cb" argument must be a function');return o(r,t.length),d(n,r,t.length),i(t,r,n,a)},t.randomFillSync=function(t,r,n){if('undefined'==typeof r&&(r=0),!f.isBuffer(t)&&!(t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return o(r,t.length),void 0===n&&(n=t.length-r),d(n,r,t.length),i(t,r,n)}):(t.randomFill=a,t.randomFillSync=a)}).call(this,r(9),r(11))},function(e,t,r){var n,a;(function(o,d){n=[r(107),r(327)],a=function(e,t){return d(e,t)}.apply(t,n),!(a!==void 0&&(e.exports=a))})(this,function(e,t){function r(r,n,a){for(var o=[],d=e.ucs2.decode(r),s=0;s>21,l=t.mapStr.substr(65535&f>>5,31&f);if(0==p||n&&1&f>>23)throw new Error('Illegal char '+c);else 1==p?o.push(l):2==p?o.push(a?l:c):3==p&&o.push(c)}var u=o.join('').normalize('NFC');return u}function n(t,n,o){void 0===o&&(o=!1);var d=r(t,o,n),i=d.split('.');return i=i.map(function(t){return t.startsWith('xn--')?(t=e.decode(t.substring(4)),a(t,o,!1)):a(t,o,n),t}),i.join('.')}function a(e,n,a){if('-'===e[2]&&'-'===e[3])throw new Error('Failed to validate '+e);if(e.startsWith('-')||e.endsWith('-'))throw new Error('Failed to validate '+e);if(e.includes('.'))throw new Error('Failed to validate '+e);if(r(e,n,a)!==e)throw new Error('Failed to validate '+e);var o=e.codePointAt(0);if(t.mapChar(o)&16777216)throw new Error('Label contains illegal character: '+o)}function o(t,r){r===void 0&&(r={});var a=!('transitional'in r)||r.transitional,o=!!('useStd3ASCII'in r)&&r.useStd3ASCII,d=!!('verifyDnsLength'in r)&&r.verifyDnsLength,s=n(t,a,o).split('.'),c=s.map(e.toASCII),f=c.join('.'),p;if(d){if(1>f.length||253i.length||63\\$%@\u0621\u0624\u0629"\'^|~\u2985\u2986\u30FB\u30A5\u30E3\xA2\xA3\xAC\xA6\xA5\u20A9\u2502\u2190\u2191\u2192\u2193\u25A0\u25CB\uD801\uDC28\uD801\uDC29\uD801\uDC2A\uD801\uDC2B\uD801\uDC2C\uD801\uDC2D\uD801\uDC2E\uD801\uDC2F\uD801\uDC30\uD801\uDC31\uD801\uDC32\uD801\uDC33\uD801\uDC34\uD801\uDC35\uD801\uDC36\uD801\uDC37\uD801\uDC38\uD801\uDC39\uD801\uDC3A\uD801\uDC3B\uD801\uDC3C\uD801\uDC3D\uD801\uDC3E\uD801\uDC3F\uD801\uDC40\uD801\uDC41\uD801\uDC42\uD801\uDC43\uD801\uDC44\uD801\uDC45\uD801\uDC46\uD801\uDC47\uD801\uDC48\uD801\uDC49\uD801\uDC4A\uD801\uDC4B\uD801\uDC4C\uD801\uDC4D\uD801\uDC4E\uD801\uDC4F\uD801\uDCD8\uD801\uDCD9\uD801\uDCDA\uD801\uDCDB\uD801\uDCDC\uD801\uDCDD\uD801\uDCDE\uD801\uDCDF\uD801\uDCE0\uD801\uDCE1\uD801\uDCE2\uD801\uDCE3\uD801\uDCE4\uD801\uDCE5\uD801\uDCE6\uD801\uDCE7\uD801\uDCE8\uD801\uDCE9\uD801\uDCEA\uD801\uDCEB\uD801\uDCEC\uD801\uDCED\uD801\uDCEE\uD801\uDCEF\uD801\uDCF0\uD801\uDCF1\uD801\uDCF2\uD801\uDCF3\uD801\uDCF4\uD801\uDCF5\uD801\uDCF6\uD801\uDCF7\uD801\uDCF8\uD801\uDCF9\uD801\uDCFA\uD801\uDCFB\uD803\uDCC0\uD803\uDCC1\uD803\uDCC2\uD803\uDCC3\uD803\uDCC4\uD803\uDCC5\uD803\uDCC6\uD803\uDCC7\uD803\uDCC8\uD803\uDCC9\uD803\uDCCA\uD803\uDCCB\uD803\uDCCC\uD803\uDCCD\uD803\uDCCE\uD803\uDCCF\uD803\uDCD0\uD803\uDCD1\uD803\uDCD2\uD803\uDCD3\uD803\uDCD4\uD803\uDCD5\uD803\uDCD6\uD803\uDCD7\uD803\uDCD8\uD803\uDCD9\uD803\uDCDA\uD803\uDCDB\uD803\uDCDC\uD803\uDCDD\uD803\uDCDE\uD803\uDCDF\uD803\uDCE0\uD803\uDCE1\uD803\uDCE2\uD803\uDCE3\uD803\uDCE4\uD803\uDCE5\uD803\uDCE6\uD803\uDCE7\uD803\uDCE8\uD803\uDCE9\uD803\uDCEA\uD803\uDCEB\uD803\uDCEC\uD803\uDCED\uD803\uDCEE\uD803\uDCEF\uD803\uDCF0\uD803\uDCF1\uD803\uDCF2\uD806\uDCC0\uD806\uDCC1\uD806\uDCC2\uD806\uDCC3\uD806\uDCC4\uD806\uDCC5\uD806\uDCC6\uD806\uDCC7\uD806\uDCC8\uD806\uDCC9\uD806\uDCCA\uD806\uDCCB\uD806\uDCCC\uD806\uDCCD\uD806\uDCCE\uD806\uDCCF\uD806\uDCD0\uD806\uDCD1\uD806\uDCD2\uD806\uDCD3\uD806\uDCD4\uD806\uDCD5\uD806\uDCD6\uD806\uDCD7\uD806\uDCD8\uD806\uDCD9\uD806\uDCDA\uD806\uDCDB\uD806\uDCDC\uD806\uDCDD\uD806\uDCDE\uD806\uDCDF\u0131\u0237\u2207\u2202\uD83A\uDD22\uD83A\uDD23\uD83A\uDD24\uD83A\uDD25\uD83A\uDD26\uD83A\uDD27\uD83A\uDD28\uD83A\uDD29\uD83A\uDD2A\uD83A\uDD2B\uD83A\uDD2C\uD83A\uDD2D\uD83A\uDD2E\uD83A\uDD2F\uD83A\uDD30\uD83A\uDD31\uD83A\uDD32\uD83A\uDD33\uD83A\uDD34\uD83A\uDD35\uD83A\uDD36\uD83A\uDD37\uD83A\uDD38\uD83A\uDD39\uD83A\uDD3A\uD83A\uDD3B\uD83A\uDD3C\uD83A\uDD3D\uD83A\uDD3E\uD83A\uDD3F\uD83A\uDD40\uD83A\uDD41\uD83A\uDD42\uD83A\uDD43\u066E\u06A1\u066F\u5B57\u53CC\u591A\u89E3\u4EA4\u6620\u7121\u524D\u5F8C\u518D\u65B0\u521D\u7D42\u8CA9\u58F0\u5439\u6F14\u6295\u6355\u904A\u6307\u7981\u7A7A\u5408\u6E80\u7533\u5272\u55B6\u914D\u5F97\u53EF\u4E3D\u4E38\u4E41\uD840\uDD22\u4F60\u4FBB\u5002\u507A\u5099\u50CF\u349E\uD841\uDE3A\u5154\u5164\u5177\uD841\uDD1C\u34B9\u5167\uD841\uDD4B\u5197\u51A4\u4ECC\u51AC\uD864\uDDDF\u5203\u34DF\u523B\u5246\u5277\u3515\u5305\u5306\u5349\u535A\u5373\u537D\u537F\uD842\uDE2C\u7070\u53CA\u53DF\uD842\uDF63\u53EB\u53F1\u5406\u549E\u5438\u5448\u5468\u54A2\u54F6\u5510\u5553\u5563\u5584\u55AB\u55B3\u55C2\u5716\u5717\u5651\u5674\u58EE\u57CE\u57F4\u580D\u578B\u5832\u5831\u58AC\uD845\uDCE4\u58F2\u58F7\u5906\u5922\u5962\uD845\uDEA8\uD845\uDEEA\u59EC\u5A1B\u5A27\u59D8\u5A66\u36EE\u5B08\u5B3E\uD846\uDDC8\u5BC3\u5BD8\u5BF3\uD846\uDF18\u5BFF\u5C06\u3781\u5C60\u5CC0\u5C8D\uD847\uDDE4\u5D43\uD847\uDDE6\u5D6E\u5D6B\u5D7C\u5DE1\u5DE2\u382F\u5DFD\u5E28\u5E3D\u5E69\u3862\uD848\uDD83\u387C\u5EB0\u5EB3\u5EB6\uD868\uDF92\uD848\uDF31\u8201\u5F22\u38C7\uD84C\uDEB8\uD858\uDDDA\u5F62\u5F6B\u38E3\u5F9A\u5FCD\u5FD7\u5FF9\u6081\u393A\u391C\uD849\uDED4\u60C7\u6148\u614C\u617A\u61B2\u61A4\u61AF\u61DE\u621B\u625D\u62B1\u62D4\u6350\uD84A\uDF0C\u633D\u62FC\u6368\u6383\u63E4\uD84A\uDFF1\u6422\u63C5\u63A9\u3A2E\u6469\u647E\u649D\u6477\u3A6C\u656C\uD84C\uDC0A\u65E3\u66F8\u6649\u3B19\u3B08\u3AE4\u5192\u5195\u6700\u669C\u80AD\u43D9\u6721\u675E\u6753\uD84C\uDFC3\u3B49\u67FA\u6785\u6852\uD84D\uDC6D\u688E\u681F\u6914\u6942\u69A3\u69EA\u6AA8\uD84D\uDEA3\u6ADB\u3C18\u6B21\uD84E\uDCA7\u6B54\u3C4E\u6B72\u6B9F\u6BBB\uD84E\uDE8D\uD847\uDD0B\uD84E\uDEFA\u6C4E\uD84F\uDCBC\u6CBF\u6CCD\u6C67\u6D16\u6D3E\u6D69\u6D78\u6D85\uD84F\uDD1E\u6D34\u6E2F\u6E6E\u3D33\u6EC7\uD84F\uDED1\u6DF9\u6F6E\uD84F\uDF5E\uD84F\uDF8E\u6FC6\u7039\u701B\u3D96\u704A\u707D\u7077\u70AD\uD841\uDD25\u7145\uD850\uDE63\u719C\u7228\u7250\uD851\uDE08\u7280\u7295\uD851\uDF35\uD852\uDC14\u737A\u738B\u3EAC\u73A5\u3EB8\u7447\u745C\u7485\u74CA\u3F1B\u7524\uD853\uDC36\u753E\uD853\uDC92\uD848\uDD9F\u7610\uD853\uDFA1\uD853\uDFB8\uD854\uDC44\u3FFC\u4008\uD854\uDCF3\uD854\uDCF2\uD854\uDD19\uD854\uDD33\u771E\u771F\u778B\u4046\u4096\uD855\uDC1D\u784E\u40E3\uD855\uDE26\uD855\uDE9A\uD855\uDEC5\u79EB\u412F\u7A4A\u7A4F\uD856\uDD7C\uD856\uDEA7\u4202\uD856\uDFAB\u7BC6\u7BC9\u4227\uD857\uDC80\u7CD2\u42A0\u7CE8\u7CE3\u7D00\uD857\uDF86\u7D63\u4301\u7DC7\u7E02\u7E45\u4334\uD858\uDE28\uD858\uDE47\u4359\uD858\uDED9\u7F7A\uD858\uDF3E\u7F95\u7FFA\uD859\uDCDA\uD859\uDD23\u8060\uD859\uDDA8\u8070\uD84C\uDF5F\u43D5\u80B2\u8103\u440B\u813E\u5AB5\uD859\uDFA7\uD859\uDFB5\uD84C\uDF93\uD84C\uDF9C\u8204\u8F9E\u446B\u8291\u828B\u829D\u52B3\u82B1\u82B3\u82BD\u82E6\uD85A\uDF3C\u831D\u8363\u83AD\u8323\u83BD\u83E7\u8353\u83CA\u83CC\u83DC\uD85B\uDC36\uD85B\uDD6B\uD85B\uDCD5\u452B\u84F1\u84F3\u8516\uD85C\uDFCA\u8564\uD85B\uDF2C\u455D\u4561\uD85B\uDFB1\uD85C\uDCD2\u456B\u8650\u8667\u8669\u86A9\u8688\u870E\u86E2\u8728\u876B\u8786\u87E1\u8801\u45F9\u8860\uD85D\uDE67\u88D7\u88DE\u4635\u88FA\u34BB\uD85E\uDCAE\uD85E\uDD66\u46BE\u46C7\u8AA0\uD85F\uDCA8\u8CAB\u8CC1\u8D1B\u8D77\uD85F\uDF2F\uD842\uDC04\u8DCB\u8DBC\u8DF0\uD842\uDCDE\u8ED4\uD861\uDDD2\uD861\uDDED\u9094\u90F1\u9111\uD861\uDF2E\u911B\u9238\u92D7\u92D8\u927C\u93F9\u9415\uD862\uDFFA\u958B\u4995\u95B7\uD863\uDD77\u49E6\u96C3\u5DB2\u9723\uD864\uDD45\uD864\uDE1A\u4A6E\u4A76\u97E0\uD865\uDC0A\u4AB2\uD865\uDC96\u9829\uD865\uDDB6\u98E2\u4B33\u9929\u99A7\u99C2\u99FE\u4BCE\uD866\uDF30\u9C40\u9CFD\u4CCE\u4CED\u9D67\uD868\uDCCE\u4CF8\uD868\uDD05\uD868\uDE0E\uD868\uDE91\u4D56\u9EFE\u9F05\u9F0F\u9F16\uD869\uDE00',mapChar:function(r){return 196608<=r?917760<=r&&917999>=r?18874368:0:e[t[r>>4]][15&r]}}})},function(e,t,r){var n=r(329);e.exports=function(e,t){return new Promise(function(r,a){n(e,t,function(e,t){e?a(e):r(t)})})}},function(e,t,r){var n=r(330),a=r(333),o=r(159),d=r(334),i=r(335),s='application/json',c=function(){};e.exports=function(e,t,r){if(!e||'string'!=typeof e)throw new TypeError('must specify a URL');if('function'==typeof t&&(r=t,t={}),r&&'function'!=typeof r)throw new TypeError('expected cb to be undefined or a function');r=r||c,t=t||{};var f=t.json?'json':'text';t=o({responseType:f},t);var p=t.headers||{},l=(t.method||'GET').toUpperCase(),u=t.query;return u&&('string'!=typeof u&&(u=n.stringify(u)),e=a(e,u)),'json'===t.responseType&&d(p,'Accept',s),t.json&&'GET'!==l&&'HEAD'!==l&&(d(p,'Content-Type',s),t.body=JSON.stringify(t.body)),t.method=l,t.url=e,t.headers=p,delete t.query,delete t.json,i(t,r)}},function(e,t,r){'use strict';function n(e){switch(e.arrayFormat){case'index':return function(t,r,n){return null===r?[o(t,e),'[',n,']'].join(''):[o(t,e),'[',o(n,e),']=',o(r,e)].join('')};case'bracket':return function(t,r){return null===r?o(t,e):[o(t,e),'[]=',o(r,e)].join('')};default:return function(t,r){return null===r?o(t,e):[o(t,e),'=',o(r,e)].join('')};}}function a(e){var t;switch(e.arrayFormat){case'index':return function(e,r,n){return t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,''),t?void(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):void(n[e]=r)};case'bracket':return function(e,r,n){return(t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,''),!t)?void(n[e]=r):void 0===n[e]?void(n[e]=[r]):void(n[e]=[].concat(n[e],r))};default:return function(e,t,r){return void 0===r[e]?void(r[e]=t):void(r[e]=[].concat(r[e],t))};}}function o(e,t){return t.encode?t.strict?c(e):encodeURIComponent(e):e}function d(e){if(Array.isArray(e))return e.sort();return'object'==typeof e?d(Object.keys(e)).sort(function(e,t){return+e-+t}).map(function(t){return e[t]}):e}function i(e){var t=e.indexOf('?');return-1===t?'':e.slice(t+1)}function s(e,t){t=f({arrayFormat:'none'},t);var r=a(t),n=Object.create(null);return'string'==typeof e?(e=e.trim().replace(/^[?#&]/,''),!e)?n:(e.split('&').forEach(function(e){var t=e.replace(/\+/g,' ').split('='),a=t.shift(),o=0arguments.length&&(r=this),'[object Array]'===i.call(e)?n(e,t,r):'string'==typeof e?a(e,t,r):o(e,t,r)};var i=Object.prototype.toString,s=Object.prototype.hasOwnProperty},function(e){e.exports=function(){for(var e={},r=0,n;r=r)return o(r,t);for(var n=4096;n*128(t=e,this.getBlock(0,!1))).then((r)=>{let n='private';return r===('0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3'===r.hash&&1===t)?n='main':r===('0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303'===r.hash&&2===t)?n='morden':r===('0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d'===r.hash&&3===t)?n='ropsten':r===('0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177'===r.hash&&4===t)?n='rinkeby':r===('0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9'===r.hash&&42===t)?n='kovan':void 0,_.isFunction(e)&&e(null,n),n}).catch((t)=>{if(_.isFunction(e))return void e(t);throw t})}}class c extends o.b{constructor(e,t){super({getId:o.lb,getBlock:o.n,isListening:o.P,getPeerCount:o.X},e,t)}}class f{constructor(e,t){this.utils=e,this.formatters=t}createNetworkModule(e,t,r,n,a,o){return new s(e,t,r,n,a,o,this.createMethodModelFactory(),this.formatters,this.utils)}createMethodModelFactory(){return new c(this.utils,this.formatters)}}const p=(e)=>{const t=new d.a;return new f(i.a,a.b).createNetworkModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,d.c,new o.S)};class l extends o.b{constructor(e,t){super({getGasPrice:o.u,getTransactionCount:o.E,getId:o.lb},e,t)}}var u=r(169);class b{constructor(e,t){this.utils=e,this.formatters=t}createAccounts(e,t,r,n,a,o){return new u.a(e,t,r,n,a,o,this.createMethodModelFactory(),this.utils,this.formatters)}createMethodModelFactory(){return new l(this.utils,this.formatters)}}const h=(e)=>{const t=new d.a;return new b(i.a,a.b).createAccounts(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,d.c,new o.S)};class m extends n.a{constructor(e,t,r,n,a,o,d,i,s,c){super(e,t,r,n,a,o,d),this.utils=s,this.formatters=c,this.net=i,this._defaultAccount=null,this._defaultBlock='latest'}get defaultAccount(){return this._defaultAccount}set defaultAccount(e){this._defaultAccount=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))}get defaultBlock(){return this._defaultBlock}set defaultBlock(e){this._defaultBlock=e}setProvider(e,t){return!!(super.setProvider(e,t)&&this.net.setProvider(e,t))}}class y extends o.b{constructor(e,t){super({getAccounts:o.l,newAccount:o.T,unlockAccount:o.kb,lockAccount:o.Q,importRawKey:o.M,sendTransaction:o.Y,signTransaction:o.ab,sign:o.Z,ecRecover:o.i},e,t)}}class g{constructor(e,t){this.utils=e,this.formatters=t}createPersonal(e,t,r,n,a,o,d){return new m(e,t,r,n,a,o,this.createMethodModelFactory(),d,this.utils,this.formatters)}createMethodModelFactory(){return new y(this.utils,this.formatters)}}const v=(e)=>{const t=new d.a;return new g(i.a,a.b).createPersonalModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,d.c,new o.S,new p(e))};var k=r(38),x=r(39),S=r(171),w=r.n(S),A=r(172),E=r.n(A);class I{constructor(e,t){this.registry=e,this.resolverMethodHandler=t}setProvider(e,t){return this.registry.setProvider(e,t)}resolver(e){return this.registry.resolver(e)}getAddress(e,t){return this.resolverMethodHandler.method(e,'addr',[]).call(t)}setAddress(e,t,r,n){return this.resolverMethodHandler.method(e,'setAddr',[t]).send(r,n)}getPubkey(e,t){return this.resolverMethodHandler.method(e,'pubkey',[]).call(t)}setPubkey(e,t,r,n,a){return this.resolverMethodHandler.method(e,'setPubkey',[t,r]).send(n,a)}getContent(e,t){return this.resolverMethodHandler.method(e,'content',[]).call(t)}setContent(e,t,r,n){return this.resolverMethodHandler.method(e,'setContent',[t]).send(r,n)}getMultihash(e,t){return this.resolverMethodHandler.method(e,'multihash',[]).call(t)}setMultihash(e,t,r,n){return this.resolverMethodHandler.method(e,'multihash',[t]).send(r,n)}}var C=r(0),P=r.n(C),T=r(51),B=r.n(T);class N{constructor(e,t,r,n,a){this.net=net,this.accounts=t,this.contractObject=r,this.registryABI=n,this.resolverABI=a,this.provider=e,this.contract=this.checkNetwork().then((e)=>new this.contractObject(this.provider,this.accounts,this.registryABI,e))}setProvider(e,t){return this.provider=this.providersPackage.resolve(e,t),!!(this.net.setProvider(e,t)&&this.accounts.setProvider(e,t)&&this.provider)}owner(e,t){return new Promise((r,n)=>{this.contract.then((a)=>{a.methods.owner(B.a.hash(e)).call().then((e)=>{r(e),Object(C.isFunction)(t)&&t(!1,e)}).catch((e)=>{n(e),Object(C.isFunction)(t)&&t(e,null)})})})}resolver(e){return this.contract.then((t)=>t.methods.resolver(B.a.hash(e)).call()).then((e)=>new this.Contract.Contract(this.provider,this.accounts,this.resolverABI,e))}checkNetwork(){const e={main:'0x314159265dD8dbb310642f98f50C066173C1259b',ropsten:'0x112234455c3a32fd11230c42e7bccd4a84e02010',rinkeby:'0xe7410170f87102df0055eb195163a03b7f2bff4a'};return this.net.getBlock('latest',!1).then((e)=>{const t=new Date/1e3-e.timestamp;if(3600{const r=e[t];if('undefined'==typeof r)throw new Error(`ENS is not supported on network ${t}`);return r})}}class R{constructor(e,t){this.registry=e,this.promiEventPackage=t}method(e,t,r){return{call:this.call.bind({ensName:e,methodName:t,methodArguments:r,parent:this}),send:this.send.bind({ensName:e,methodName:t,methodArguments:r,parent:this})}}call(e){const t=new this.promiEventPackage.PromiEvent,r=this.parent.prepareArguments(this.ensName,this.methodArguments);return this.parent.registry.resolver(this.ensName).then((n)=>{this.parent.handleCall(t,n.methods[this.methodName],r,e)}).catch((e)=>{t.reject(e)}),t}send(e,t){const r=new this.promiEventPackage.PromiEvent,n=this.parent.prepareArguments(this.ensName,this.methodArguments);return this.parent.registry.resolver(this.ensName).then((a)=>{this.parent.handleSend(r,a.methods[this.methodName],n,e,t)}).catch((e)=>{r.reject(e)}),r}handleCall(e,t,r,n){return t.apply(this,r).call().then((t)=>{e.resolve(t),P.a.isFunction(n)&&n(t)}).catch((t)=>{e.reject(t),P.a.isFunction(n)&&n(t)}),e}handleSend(e,t,r,n,a){return t.apply(this,r).send(n).on('transactionHash',(t)=>{e.emit('transactionHash',t)}).on('confirmation',(t,r)=>{e.emit('confirmation',t,r)}).on('receipt',(t)=>{e.emit('receipt',t),e.resolve(t),P.a.isFunction(a)&&a(t)}).on('error',(t)=>{e.emit('error',t),e.reject(t),P.a.isFunction(a)&&a(t)}),e}prepareArguments(e,t){const r=B.a.hash(e);return 0new M().createENS(e,t,r,k.a,w.a,E.a,x.a);var j=r(14),O=r(73),D=r(74);class U extends o.b{constructor(e,t,r){super({getNodeInfo:o.x,getProtocolVersion:o.A,getCoinbase:o.s,isMining:o.N,getHashrate:o.v,isSyncing:o.O,getGasPrice:o.u,getAccounts:o.l,getBlockNumber:o.o,getBalance:o.m,getStorageAt:o.C,getCode:o.r,getBlock:o.n,getUncle:o.I,getBlockTransactionCount:o.p,getBlockUncleCount:o.q,getTransaction:o.G,getTransactionFromBlock:o.F,getTransactionReceipt:o.H,getTransactionCount:o.E,sendSignedTransaction:o.cb,signTransaction:o.ib,sendTransaction:o.db,sign:o.hb,call:o.e,estimateGas:o.j,submitWork:o.jb,getWork:o.J,getPastLogs:o.y},e,t),this.accounts=r}createMethodModel(e){return new this.methodModels[e](this.utils,this.formatters,this.accounts)}}r(10);class H extends n.a{constructor(e,t,r,n,a,o,d,i,s,c,f,p,l,u,b,h,m){super(e,t,r,n,a,o,d),this.net=i,this.accounts=c,this.personal=f,this.Iban=Iban,this.abi=l,this.ens=u,this.utils=b,this.formatters=h,this.subscriptionsFactory=m,this.initiatedContracts=[],this._defaultAccount=null,this._defaultBlock='latest',this.Contract=(e,t,r)=>{const n=new s(this.currentProvider,this.accounts,e,t,r);return this.initiatedContracts.push(n),n}}get defaultAccount(){return this._defaultAccount}set defaultAccount(e){this.initiatedContracts.forEach((t)=>{t.defaultAccount=e}),this.personal.defaultAccount=e,this._defaultAccount=this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(e))}get defaultBlock(){return this._defaultBlock}set defaultBlock(e){this._defaultBlock=e,this.initiatedContracts.forEach((t)=>{t.defaultBlock=e}),this.personal.defaultBlock=this._defaultBlock}subscribe(e,t,r){switch(e){case'logs':return this.subscriptionsFactory.createLogSubscription(this,t,this.methodModelFactory.createMethodModel('getPastLogs'),this.methodController).subscribe(r);case'newBlockHeaders':return this.subscriptionsFactory.createNewHeadsSubscription(this).subscribe(r);case'pendingTransactions':return this.subscriptionsFactory.createNewPendingTransactionsSubscription(this).subscribe(r);case'syncing':return this.subscriptionsFactory.createSyncingSubscriptionModel(this).subscribe(r);default:throw Error(`Unknown subscription: ${e}`);}}setProvider(e,t){const r=this.initiatedContracts.every((r)=>r.setProvider(e,t));return!!(super.setProvider(e,t)&&this.net.setProvider(e,t)&&this.personal.setProvider(e,t)&&this.accounts.setProvider(e,t)&&r)}}class F{constructor(e,t){this.utils=e,this.formatters=t}createEthModule(e,t,r,n,a,o,d,i,s,c,f,p,l,u){return new H(e,t,r,n,a,o,this.createMethodModelFactory(s),d,i,s,c,f,p,l,this.utils,this.formatters,u)}createMethodModelFactory(e){return new U(this.utils,this.formatters,e)}}const q=(e)=>{const t=new d.a;return new F(i.a,a.b).createEthModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,d.c,new o.S,new p,k.a,new h(e),new v(e),D.a,new O.a(i.a),new L(e),new j.c)};class z extends n.a{constructor(e,t,r,n,a,o,d,i,s){super(e,t,r,n,a,o,d),this.subscriptionsFactory=i,this.net=s}subscribe(e,t,r){if('messages'===e)return this.subscriptionsFactory.createShhMessagesSubscription(this,t).subscribe(r);throw Error(`Unknown subscription: ${e}`)}setProvider(e,t){return!!(super.setProvider(e,t)&&this.net.setProvider(e,t))}}class K extends o.b{constructor(e,t){super({getVersion:o.gb,getInfo:o.w,setMaxMessageSize:o.eb,setMinPoW:o.fb,markTrustedPeer:o.R,newKeyPair:o.U,addPrivateKey:o.c,deleteKeyPair:o.f,hasKeyPair:o.K,getPublicKey:o.B,getPrivateKey:o.z,newSymKey:o.W,addSymKey:o.d,generateSymKeyFromPassword:o.k,hasSymKey:o.L,getSymKey:o.D,deleteSymKey:o.h,newMessageFilter:o.V,getFilterMessages:o.t,deleteMessageFilter:o.g,post:o.bb},e,t)}}class V{constructor(e,t){this.utils=e,this.formatters=t}createShhModule(e,t,r,n,a,o,d,i){return new z(e,t,r,n,a,o,this.createMethodModelFactory(),d,i)}createMethodModelFactory(){return new K(this.utils,this.formatters)}}const G=(e)=>{const t=new d.a;return new V(i.a,a.b).createShhModule(e,t.createProviderDetector(),t.createProviderAdapterResolver(),t,d.c,new o.S,new j.c,new p(e))};var W=r(173),X=r.n(W);class Y{constructor(e){this.givenProvider=Y.givenProvider,this.currentProvider=null,this.setProvider(e)}pick(){if('undefined'!=typeof document)return this.swarm.pick;throw Error('Pick is not supported for this environment.')}download(e,t){return this.hasProvider()?this.swarm.download(e,t):void this.throwProviderError()}upload(e){return this.hasProvider()?this.swarm.upload(e):void this.throwProviderError()}isAvailable(){return this.hasProvider()?this.swarm.isAvailable():void this.throwProviderError()}hasProvider(){return!!this.currentProvider}throwProviderError(){throw new Error('No provider set, please set one using bzz.setProvider().')}setProvider(e){return(Object(C.isObject)(e)&&Object(C.isString)(e.bzz)&&(e=e.bzz),Object(C.isString)(e))?(this.currentProvider=e,this.swarm=X.a.at(e),!0):(this.currentProvider=null,!1)}}Y.givenProvider=null,'undefined'!=typeof ethereumProvider&ðereumProvider.bzz&&(Y.givenProvider=ethereumProvider.bzz);var Z=r(174);r.d(t,'default',function(){return J});class J extends n.a{constructor(e,t){var r=new d.a,n=r.createProviderAdapterResolver(),s=r.createProviderDetector();e=n.resolve(e,t),super(e,s,n,r,d.c,new o.S,new o.b({},i.a,a.b)),this.eth=new q(e),this.shh=new G(e),this.bzz=new Y(e)}setProvider(e,t){return!!(super.setProvider(e,t)&&this.eth.setProvider(e,t)&&this.shh.setProvider(e,t)&&this.bzz.setProvider(e))}static get givenProvider(){return new d.a().createProviderDetector().detect()}static get version(){return Z.a}static get utils(){return i.a}static get modules(){const e=new d.a().createProviderAdapterResolver();return{Eth:(t,r)=>new q(e.resolve(t,r)),Net:(t,r)=>new p(e.resolve(t,r)),Personal:(t,r)=>new v(e.resolve(t,r)),Shh:(t,r)=>new G(e.resolve(t,r)),Bzz:(t,r)=>new Y(e.resolve(t,r))}}static get providers(){return d.c}}}]); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 455578fa486..bec23119dff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1832,11 +1832,6 @@ "through": ">=2.2.7 <3" } }, - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=" - }, "accepts": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", @@ -1847,12 +1842,6 @@ "negotiator": "0.6.1" } }, - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", - "dev": true - }, "acorn-dynamic-import": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", @@ -1870,24 +1859,6 @@ } } }, - "acorn-node": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.3.0.tgz", - "integrity": "sha512-efP54n3d1aLfjL2UMdaXa6DsswwzJeI5rqhbFvXMrKiJ6eJFpf+7R0zN7t8IC+XKn2YOAFAv6xbBNgHUkoHWLw==", - "dev": true, - "requires": { - "acorn": "^5.4.1", - "xtend": "^4.0.1" - }, - "dependencies": { - "acorn": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", - "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", - "dev": true - } - } - }, "add-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", @@ -2028,12 +1999,6 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, - "array-filter": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", - "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", - "dev": true - }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -2052,18 +2017,6 @@ "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, - "array-map": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", - "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", - "dev": true - }, - "array-reduce": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", - "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", - "dev": true - }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -2123,27 +2076,12 @@ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, - "astw": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/astw/-/astw-2.2.0.tgz", - "integrity": "sha1-e9QXhNMkk5h66yOba04cV6hzuRc=", - "dev": true, - "requires": { - "acorn": "^4.0.3" - } - }, "async": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", @@ -2339,12 +2277,6 @@ "lodash": "^4.17.4" } }, - "babel-helper-evaluate-path": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-helper-evaluate-path/-/babel-helper-evaluate-path-0.5.0.tgz", - "integrity": "sha512-mUh0UhS607bGh5wUMAQfOpt2JX2ThXMtppHRdRU1kL7ZLRWIXxoV2UIV1r2cAeeNeU1M5SB5/RSUgUxrK8yOkA==", - "dev": true - }, "babel-helper-explode-assignable-expression": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", @@ -2356,12 +2288,6 @@ "babel-types": "^6.24.1" } }, - "babel-helper-flip-expressions": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.4.3.tgz", - "integrity": "sha1-NpZzahKKwYvCUlS19AoizrPB0/0=", - "dev": true - }, "babel-helper-function-name": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", @@ -2401,18 +2327,6 @@ "integrity": "sha1-NOmzALFHnd2Y7HfqC76TQt/jloQ=", "dev": true }, - "babel-helper-is-void-0": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-helper-is-void-0/-/babel-helper-is-void-0-0.4.3.tgz", - "integrity": "sha1-fZwBtFYee5Xb2g9u7kj1tg5nMT4=", - "dev": true - }, - "babel-helper-mark-eval-scopes": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.4.3.tgz", - "integrity": "sha1-0kSjvvmESHJgP/tG4izorN9VFWI=", - "dev": true - }, "babel-helper-optimise-call-expression": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", @@ -2447,12 +2361,6 @@ "babel-types": "^6.24.1" } }, - "babel-helper-remove-or-void": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.4.3.tgz", - "integrity": "sha1-pPA7QAd6D/6I5F0HAQ3uJB/1rmA=", - "dev": true - }, "babel-helper-replace-supers": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", @@ -2467,12 +2375,6 @@ "babel-types": "^6.24.1" } }, - "babel-helper-to-multiple-sequence-expressions": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.5.0.tgz", - "integrity": "sha512-m2CvfDW4+1qfDdsrtf4dwOslQC3yhbgyBFptncp4wvtdrDHqueW7slsYv4gArie056phvQFhT2nRcGS4bnm6mA==", - "dev": true - }, "babel-helpers": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", @@ -2709,98 +2611,6 @@ "babel-runtime": "^6.22.0" } }, - "babel-plugin-minify-builtins": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.5.0.tgz", - "integrity": "sha512-wpqbN7Ov5hsNwGdzuzvFcjgRlzbIeVv1gMIlICbPj0xkexnfoIDe7q+AZHMkQmAE/F9R5jkrB6TLfTegImlXag==", - "dev": true - }, - "babel-plugin-minify-constant-folding": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-constant-folding/-/babel-plugin-minify-constant-folding-0.5.0.tgz", - "integrity": "sha512-Vj97CTn/lE9hR1D+jKUeHfNy+m1baNiJ1wJvoGyOBUx7F7kJqDZxr9nCHjO/Ad+irbR3HzR6jABpSSA29QsrXQ==", - "dev": true, - "requires": { - "babel-helper-evaluate-path": "^0.5.0" - } - }, - "babel-plugin-minify-dead-code-elimination": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.0.tgz", - "integrity": "sha512-XQteBGXlgEoAKc/BhO6oafUdT4LBa7ARi55mxoyhLHNuA+RlzRmeMAfc31pb/UqU01wBzRc36YqHQzopnkd/6Q==", - "dev": true, - "requires": { - "babel-helper-evaluate-path": "^0.5.0", - "babel-helper-mark-eval-scopes": "^0.4.3", - "babel-helper-remove-or-void": "^0.4.3", - "lodash.some": "^4.6.0" - } - }, - "babel-plugin-minify-flip-comparisons": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-flip-comparisons/-/babel-plugin-minify-flip-comparisons-0.4.3.tgz", - "integrity": "sha1-AMqHDLjxO0XAOLPB68DyJyk8llo=", - "dev": true, - "requires": { - "babel-helper-is-void-0": "^0.4.3" - } - }, - "babel-plugin-minify-guarded-expressions": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-guarded-expressions/-/babel-plugin-minify-guarded-expressions-0.4.3.tgz", - "integrity": "sha1-zHCbRFP9IbHzAod0RMifiEJ845c=", - "dev": true, - "requires": { - "babel-helper-flip-expressions": "^0.4.3" - } - }, - "babel-plugin-minify-infinity": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.4.3.tgz", - "integrity": "sha1-37h2obCKBldjhO8/kuZTumB7Oco=", - "dev": true - }, - "babel-plugin-minify-mangle-names": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-mangle-names/-/babel-plugin-minify-mangle-names-0.5.0.tgz", - "integrity": "sha512-3jdNv6hCAw6fsX1p2wBGPfWuK69sfOjfd3zjUXkbq8McbohWy23tpXfy5RnToYWggvqzuMOwlId1PhyHOfgnGw==", - "dev": true, - "requires": { - "babel-helper-mark-eval-scopes": "^0.4.3" - } - }, - "babel-plugin-minify-numeric-literals": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.4.3.tgz", - "integrity": "sha1-jk/VYcefeAEob/YOjF/Z3u6TwLw=", - "dev": true - }, - "babel-plugin-minify-replace": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-replace/-/babel-plugin-minify-replace-0.5.0.tgz", - "integrity": "sha512-aXZiaqWDNUbyNNNpWs/8NyST+oU7QTpK7J9zFEFSA0eOmtUNMU3fczlTTTlnCxHmq/jYNFEmkkSG3DDBtW3Y4Q==", - "dev": true - }, - "babel-plugin-minify-simplify": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-simplify/-/babel-plugin-minify-simplify-0.5.0.tgz", - "integrity": "sha512-TM01J/YcKZ8XIQd1Z3nF2AdWHoDsarjtZ5fWPDksYZNsoOjQ2UO2EWm824Ym6sp127m44gPlLFiO5KFxU8pA5Q==", - "dev": true, - "requires": { - "babel-helper-flip-expressions": "^0.4.3", - "babel-helper-is-nodes-equiv": "^0.0.1", - "babel-helper-to-multiple-sequence-expressions": "^0.5.0" - } - }, - "babel-plugin-minify-type-constructors": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-type-constructors/-/babel-plugin-minify-type-constructors-0.4.3.tgz", - "integrity": "sha1-G8bxW4f3qxCF1CszC3F2V6IVZQA=", - "dev": true, - "requires": { - "babel-helper-is-void-0": "^0.4.3" - } - }, "babel-plugin-syntax-async-functions": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", @@ -3089,12 +2899,6 @@ "babel-runtime": "^6.22.0" } }, - "babel-plugin-transform-inline-consecutive-adds": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.4.3.tgz", - "integrity": "sha1-Mj1Ho+pjqDp6w8gRro5pQfrysNE=", - "dev": true - }, "babel-plugin-transform-member-expression-literals": { "version": "6.9.4", "resolved": "https://registry.npmjs.org/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.9.4.tgz", @@ -3131,12 +2935,6 @@ "regenerator-transform": "^0.10.0" } }, - "babel-plugin-transform-regexp-constructors": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.4.3.tgz", - "integrity": "sha1-WLd3W2OvzzMyj66aX4j71PsLSWU=", - "dev": true - }, "babel-plugin-transform-remove-console": { "version": "6.9.4", "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz", @@ -3149,15 +2947,6 @@ "integrity": "sha1-QrcnYxyXl44estGZp67IShgznvI=", "dev": true }, - "babel-plugin-transform-remove-undefined": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.5.0.tgz", - "integrity": "sha512-+M7fJYFaEE/M9CXa0/IRkDbiV3wRELzA1kKQFCJ4ifhrzLKn/9VCCgj9OFmYWwBd8IB48YdgPkHYtbYq+4vtHQ==", - "dev": true, - "requires": { - "babel-helper-evaluate-path": "^0.5.0" - } - }, "babel-plugin-transform-simplify-comparison-operators": { "version": "6.9.4", "resolved": "https://registry.npmjs.org/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.9.4.tgz", @@ -3218,37 +3007,6 @@ "semver": "^5.3.0" } }, - "babel-preset-minify": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/babel-preset-minify/-/babel-preset-minify-0.5.0.tgz", - "integrity": "sha512-xj1s9Mon+RFubH569vrGCayA9Fm2GMsCgDRm1Jb8SgctOB7KFcrVc2o8K3YHUyMz+SWP8aea75BoS8YfsXXuiA==", - "dev": true, - "requires": { - "babel-plugin-minify-builtins": "^0.5.0", - "babel-plugin-minify-constant-folding": "^0.5.0", - "babel-plugin-minify-dead-code-elimination": "^0.5.0", - "babel-plugin-minify-flip-comparisons": "^0.4.3", - "babel-plugin-minify-guarded-expressions": "^0.4.3", - "babel-plugin-minify-infinity": "^0.4.3", - "babel-plugin-minify-mangle-names": "^0.5.0", - "babel-plugin-minify-numeric-literals": "^0.4.3", - "babel-plugin-minify-replace": "^0.5.0", - "babel-plugin-minify-simplify": "^0.5.0", - "babel-plugin-minify-type-constructors": "^0.4.3", - "babel-plugin-transform-inline-consecutive-adds": "^0.4.3", - "babel-plugin-transform-member-expression-literals": "^6.9.4", - "babel-plugin-transform-merge-sibling-variables": "^6.9.4", - "babel-plugin-transform-minify-booleans": "^6.9.4", - "babel-plugin-transform-property-literals": "^6.9.4", - "babel-plugin-transform-regexp-constructors": "^0.4.3", - "babel-plugin-transform-remove-console": "^6.9.4", - "babel-plugin-transform-remove-debugger": "^6.9.4", - "babel-plugin-transform-remove-undefined": "^0.5.0", - "babel-plugin-transform-simplify-comparison-operators": "^6.9.4", - "babel-plugin-transform-undefined-to-void": "^6.9.4", - "lodash.isplainobject": "^4.0.6" - } - }, "babel-register": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", @@ -3434,12 +3192,6 @@ "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", "dev": true }, - "bignumber.js": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.1.0.tgz", - "integrity": "sha512-eJzYkFYy9L4JzXsbymsFn3p54D+llV27oTQ+ziJG7WFRheJcNZilgVXMG0LoZtlQSKBsJdWtLFqOD0u+U0jZKA==", - "dev": true - }, "binary-extensions": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", @@ -3461,12 +3213,6 @@ "safe-buffer": "^5.0.1" } }, - "bluebird": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.3.1.tgz", - "integrity": "sha1-+Xrhlw9B2FF3KDBT6aEgFg5mxh0=", - "dev": true - }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", @@ -3536,92 +3282,6 @@ "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "dev": true }, - "browser-pack": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", - "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "combine-source-map": "~0.8.0", - "defined": "^1.0.0", - "safe-buffer": "^5.1.1", - "through2": "^2.0.0", - "umd": "^3.0.0" - } - }, - "browser-resolve": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz", - "integrity": "sha1-j/CbCixCFxihBRwmCzLkj0QpOM4=", - "dev": true, - "requires": { - "resolve": "1.1.7" - }, - "dependencies": { - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - } - } - }, - "browserify": { - "version": "14.5.0", - "resolved": "https://registry.npmjs.org/browserify/-/browserify-14.5.0.tgz", - "integrity": "sha512-gKfOsNQv/toWz+60nSPfYzuwSEdzvV2WdxrVPUbPD/qui44rAkB3t3muNtmmGYHqrG56FGwX9SUEQmzNLAeS7g==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "assert": "^1.4.0", - "browser-pack": "^6.0.1", - "browser-resolve": "^1.11.0", - "browserify-zlib": "~0.2.0", - "buffer": "^5.0.2", - "cached-path-relative": "^1.0.0", - "concat-stream": "~1.5.1", - "console-browserify": "^1.1.0", - "constants-browserify": "~1.0.0", - "crypto-browserify": "^3.0.0", - "defined": "^1.0.0", - "deps-sort": "^2.0.0", - "domain-browser": "~1.1.0", - "duplexer2": "~0.1.2", - "events": "~1.1.0", - "glob": "^7.1.0", - "has": "^1.0.0", - "htmlescape": "^1.1.0", - "https-browserify": "^1.0.0", - "inherits": "~2.0.1", - "insert-module-globals": "^7.0.0", - "labeled-stream-splicer": "^2.0.0", - "module-deps": "^4.0.8", - "os-browserify": "~0.3.0", - "parents": "^1.0.1", - "path-browserify": "~0.0.0", - "process": "~0.11.0", - "punycode": "^1.3.2", - "querystring-es3": "~0.2.0", - "read-only-stream": "^2.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.1.4", - "shasum": "^1.0.0", - "shell-quote": "^1.6.1", - "stream-browserify": "^2.0.0", - "stream-http": "^2.0.0", - "string_decoder": "~1.0.0", - "subarg": "^1.0.0", - "syntax-error": "^1.1.1", - "through2": "^2.0.0", - "timers-browserify": "^1.0.1", - "tty-browserify": "~0.0.0", - "url": "~0.11.0", - "util": "~0.10.1", - "vm-browserify": "~0.0.1", - "xtend": "^4.0.0" - } - }, "browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -3722,21 +3382,12 @@ "safe-buffer": "^5.1.2" } }, - "buffer": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.1.0.tgz", - "integrity": "sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==", - "dev": true, - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, "buffer-from": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", - "dev": true + "dev": true, + "optional": true }, "buffer-to-arraybuffer": { "version": "0.0.5", @@ -3827,12 +3478,6 @@ "unset-value": "^1.0.0" } }, - "cached-path-relative": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.1.tgz", - "integrity": "sha1-0JxLUoAKpMB44t2BqGmqyQ0uVOc=", - "dev": true - }, "camelcase": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", @@ -3888,20 +3533,6 @@ "lazy-cache": "^1.0.3" } }, - "chai": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", - "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", - "dev": true, - "requires": { - "assertion-error": "^1.0.1", - "check-error": "^1.0.1", - "deep-eql": "^3.0.0", - "get-func-name": "^2.0.0", - "pathval": "^1.0.0", - "type-detect": "^4.0.0" - } - }, "chalk": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", @@ -3921,12 +3552,6 @@ "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", "dev": true }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, "check-types": { "version": "7.4.0", "resolved": "https://registry.npmjs.org/check-types/-/check-types-7.4.0.tgz", @@ -4071,29 +3696,6 @@ "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "dev": true }, - "clone-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", - "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", - "dev": true - }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", - "dev": true - }, - "cloneable-readable": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz", - "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" - } - }, "cmd-shim": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-2.0.2.tgz", @@ -4175,18 +3777,6 @@ "wcwidth": "^1.0.0" } }, - "combine-source-map": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", - "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", - "dev": true, - "requires": { - "convert-source-map": "~1.1.0", - "inline-source-map": "~0.6.0", - "lodash.memoize": "~3.0.3", - "source-map": "~0.5.3" - } - }, "combined-stream": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", @@ -4911,27 +4501,12 @@ "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", "dev": true }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, "defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", @@ -4992,26 +4567,6 @@ } } }, - "defined": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", - "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", - "dev": true - }, - "del": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", - "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", - "dev": true, - "requires": { - "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" - } - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -5030,18 +4585,6 @@ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", "dev": true }, - "deps-sort": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz", - "integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "shasum": "^1.0.0", - "subarg": "^1.0.0", - "through2": "^2.0.0" - } - }, "des.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", @@ -5074,24 +4617,6 @@ "dev": true, "optional": true }, - "detective": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/detective/-/detective-4.7.1.tgz", - "integrity": "sha512-H6PmeeUcZloWtdt4DAkFyzFL94arpHr3NOwwmVILFiy+9Qd4JTxxXrzfyGk/lmct2qVGBwTSwSXagqu2BxmWig==", - "dev": true, - "requires": { - "acorn": "^5.2.1", - "defined": "^1.0.0" - }, - "dependencies": { - "acorn": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", - "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", - "dev": true - } - } - }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -5190,15 +4715,6 @@ "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "dev": true }, - "duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - } - }, "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", @@ -5408,31 +4924,6 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", - "dev": true, - "requires": { - "esprima": "^2.7.1", - "estraverse": "^1.9.1", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" - }, - "dependencies": { - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true, - "requires": { - "amdefine": ">=0.0.4" - } - } - } - }, "eslint-scope": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", @@ -5451,12 +4942,6 @@ } } }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", @@ -5474,12 +4959,6 @@ } } }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", @@ -5622,25 +5101,6 @@ "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", "dev": true }, - "exorcist": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/exorcist/-/exorcist-0.4.0.tgz", - "integrity": "sha1-EjD/3t2SSPQvvM+LSkTUyrKePGQ=", - "dev": true, - "requires": { - "minimist": "0.0.5", - "mold-source-map": "~0.4.0", - "nave": "~0.5.1" - }, - "dependencies": { - "minimist": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.5.tgz", - "integrity": "sha1-16oye87PUY+RBqxrjwA/o7zqhWY=", - "dev": true - } - } - }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -5878,12 +5338,6 @@ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, "fd-slicer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", @@ -6135,10 +5589,7 @@ "nopt": { "version": "4.0.1", "resolved": false, - "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", - "requires": { - "abbrev": "1" - } + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=" }, "rc": { "version": "1.2.7", @@ -6246,12 +5697,6 @@ "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", "dev": true }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, "get-pkg-repo": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", @@ -6618,12 +6063,6 @@ "ansi-regex": "^2.0.0" } }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", @@ -6743,12 +6182,6 @@ "integrity": "sha512-lIbgIIQA3lz5XaB6vxakj6sDHADJiZadYEJB+FgA+C4nubM1NwcuvUr9EJPmnH1skZqpqUzWborWo8EIUi0Sdw==", "dev": true }, - "htmlescape": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", - "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", - "dev": true - }, "htmlparser2": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", @@ -6951,15 +6384,6 @@ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" }, - "inline-source-map": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", - "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", - "dev": true, - "requires": { - "source-map": "~0.5.3" - } - }, "inquirer": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", @@ -7034,37 +6458,6 @@ } } }, - "insert-module-globals": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.1.0.tgz", - "integrity": "sha512-LbYZdybvKjbbcKLp03lB323Cgc8f0iL0Rjh8U6JZ7K1gZSf7MxQH191iCNUcLX4qIQ6/yWe4Q4ZsQ+opcReNFg==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "combine-source-map": "^0.8.0", - "concat-stream": "^1.6.1", - "is-buffer": "^1.1.0", - "lexical-scope": "^1.2.0", - "path-is-absolute": "^1.0.1", - "process": "~0.11.0", - "through2": "^2.0.0", - "xtend": "^4.0.0" - }, - "dependencies": { - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - } - } - }, "interpret": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", @@ -7276,30 +6669,6 @@ "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, - "is-path-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", - "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", - "dev": true - }, - "is-path-in-cwd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", - "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", - "dev": true, - "requires": { - "is-path-inside": "^1.0.0" - } - }, - "is-path-inside": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", - "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", - "dev": true, - "requires": { - "path-is-inside": "^1.0.1" - } - }, "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -7414,58 +6783,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", - "dev": true, - "requires": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" - }, - "dependencies": { - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true, - "requires": { - "has-flag": "^1.0.0" - } - } - } - }, "js-levenshtein": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.4.tgz", @@ -7484,16 +6801,6 @@ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true }, - "js-yaml": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", - "integrity": "sha1-bl/mfYsgXOTSL60Ft3geja3MSzA=", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^2.6.0" - } - }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", @@ -7544,15 +6851,6 @@ "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", "dev": true }, - "json-stable-stringify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", - "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", - "dev": true, - "requires": { - "jsonify": "~0.0.0" - } - }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -7574,12 +6872,6 @@ "graceful-fs": "^4.1.6" } }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -7633,25 +6925,6 @@ "graceful-fs": "^4.1.9" } }, - "labeled-stream-splicer": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.1.tgz", - "integrity": "sha512-MC94mHZRvJ3LfykJlTUipBqenZz1pacOZEMhhQ8dMGcDHs0SBE5GbsavUXV7YtP3icBW17W0Zy1I0lfASmo9Pg==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "isarray": "^2.0.4", - "stream-splicer": "^2.0.0" - }, - "dependencies": { - "isarray": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.4.tgz", - "integrity": "sha512-GMxXOiUirWg1xTKRipM0Ek07rX+ubx4nNVElTJdNLYmNO/2YrDkgJGw9CljXn+r4EWiDQg/8lsRdHyg2PJuUaA==", - "dev": true - } - } - }, "lazy-cache": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", @@ -7883,25 +7156,6 @@ } } }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "lexical-scope": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/lexical-scope/-/lexical-scope-1.2.0.tgz", - "integrity": "sha1-/Ope3HBKSzqHls3KQZw6CvryLfQ=", - "dev": true, - "requires": { - "astw": "^2.0.0" - } - }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -7973,12 +7227,6 @@ "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", "dev": true }, - "lodash.memoize": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", - "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", - "dev": true - }, "lodash.merge": { "version": "4.6.1", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", @@ -8375,47 +7623,6 @@ "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", "dev": true }, - "module-deps": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-4.1.1.tgz", - "integrity": "sha1-IyFYM/HaE/1gbMuAh7RIUty4If0=", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "browser-resolve": "^1.7.0", - "cached-path-relative": "^1.0.0", - "concat-stream": "~1.5.0", - "defined": "^1.0.0", - "detective": "^4.0.0", - "duplexer2": "^0.1.2", - "inherits": "^2.0.1", - "parents": "^1.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.1.3", - "stream-combiner2": "^1.1.1", - "subarg": "^1.0.0", - "through2": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "mold-source-map": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/mold-source-map/-/mold-source-map-0.4.0.tgz", - "integrity": "sha1-z2fgsxxHq5uttcnCVlGGISe7gxc=", - "dev": true, - "requires": { - "convert-source-map": "^1.1.0", - "through": "~2.2.7" - }, - "dependencies": { - "through": { - "version": "2.2.7", - "resolved": "https://registry.npmjs.org/through/-/through-2.2.7.tgz", - "integrity": "sha1-bo4hIAGR1OtqmfbwEN9Gqhxusr0=", - "dev": true - } - } - }, "moment": { "version": "2.22.1", "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.1.tgz", @@ -8473,12 +7680,6 @@ "to-regex": "^3.0.1" } }, - "nave": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/nave/-/nave-0.5.3.tgz", - "integrity": "sha1-Ws7HI3WFblx2yDvSGmjXE+tfG6Q=", - "dev": true - }, "needle": { "version": "2.2.0", "resolved": false, @@ -8595,15 +7796,6 @@ "semver": "^5.3.0" } }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "dev": true, - "requires": { - "abbrev": "1" - } - }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -8822,20 +8014,6 @@ } } }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" - } - }, "os-browserify": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", @@ -8929,12 +8107,6 @@ "p-limit": "^1.1.0" } }, - "p-map": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", - "dev": true - }, "p-try": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", @@ -8970,15 +8142,6 @@ "readable-stream": "^2.1.5" } }, - "parents": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", - "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", - "dev": true, - "requires": { - "path-platform": "~0.11.15" - } - }, "parse-asn1": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", @@ -9054,12 +8217,6 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", @@ -9072,12 +8229,6 @@ "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", "dev": true }, - "path-platform": { - "version": "0.11.15", - "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", - "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", - "dev": true - }, "path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", @@ -9087,12 +8238,6 @@ "pify": "^3.0.0" } }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", - "dev": true - }, "pbkdf2": { "version": "3.0.16", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", @@ -9209,12 +8354,6 @@ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, "prepend-http": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", @@ -9431,15 +8570,6 @@ "typeable-promisify": "^1.0.1" } }, - "read-only-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", - "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - } - }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -9737,12 +8867,6 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, - "require-like": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/require-like/-/require-like-0.1.2.tgz", - "integrity": "sha1-rW8wwTvs15cBDEaK+ndcDAprR/o=", - "dev": true - }, "require-main-filename": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", @@ -9893,16 +9017,6 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "sandboxed-module": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/sandboxed-module/-/sandboxed-module-2.0.3.tgz", - "integrity": "sha1-x+VFkzm7y6KMUwPusz9ug4e/upY=", - "dev": true, - "requires": { - "require-like": "0.1.2", - "stack-trace": "0.0.9" - } - }, "sax": { "version": "1.2.4", "resolved": false, @@ -10092,16 +9206,6 @@ "safe-buffer": "^5.0.1" } }, - "shasum": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", - "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", - "dev": true, - "requires": { - "json-stable-stringify": "~0.0.0", - "sha.js": "~2.4.4" - } - }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -10117,18 +9221,6 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, - "shell-quote": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", - "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", - "dev": true, - "requires": { - "array-filter": "~0.0.0", - "array-map": "~0.0.0", - "array-reduce": "~0.0.0", - "jsonify": "~0.0.0" - } - }, "shelljs": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", @@ -10415,7 +9507,8 @@ "version": "0.0.9", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz", "integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=", - "dev": true + "dev": true, + "optional": true }, "static-extend": { "version": "0.1.2", @@ -10454,16 +9547,6 @@ "readable-stream": "^2.0.2" } }, - "stream-combiner2": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", - "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", - "dev": true, - "requires": { - "duplexer2": "~0.1.0", - "readable-stream": "^2.0.2" - } - }, "stream-each": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", @@ -10493,16 +9576,6 @@ "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", "dev": true }, - "stream-splicer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.0.tgz", - "integrity": "sha1-G2O+Q4oTPktnHMGTUZdgAXWRDYM=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" - } - }, "strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", @@ -10610,30 +9683,12 @@ } } }, - "subarg": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", - "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", - "dev": true, - "requires": { - "minimist": "^1.1.0" - } - }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, - "syntax-error": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", - "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", - "dev": true, - "requires": { - "acorn-node": "^1.2.0" - } - }, "tapable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.0.tgz", @@ -10728,15 +9783,6 @@ "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", "dev": true }, - "timers-browserify": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", - "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", - "dev": true, - "requires": { - "process": "~0.11.0" - } - }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -10845,12 +9891,6 @@ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", "dev": true }, - "tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", - "dev": true - }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -10867,21 +9907,6 @@ "dev": true, "optional": true }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, "type-is": { "version": "1.6.16", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", @@ -11054,12 +10079,6 @@ } } }, - "umd": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", - "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", - "dev": true - }, "underscore": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.0.tgz", @@ -11363,44 +10382,6 @@ "extsprintf": "^1.2.0" } }, - "vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", - "dev": true, - "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - }, - "dependencies": { - "clone": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", - "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", - "dev": true - }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", - "dev": true - } - } - }, - "vinyl-source-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vinyl-source-stream/-/vinyl-source-stream-2.0.0.tgz", - "integrity": "sha1-84pa+53R6Ttl1VBGmsYYKsT1S44=", - "dev": true, - "requires": { - "through2": "^2.0.3", - "vinyl": "^2.1.0" - } - }, "vm-browserify": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", @@ -11967,12 +10948,6 @@ } } }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, "worker-farm": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz", diff --git a/package.json b/package.json index 38af689f4f9..87926a923c3 100644 --- a/package.json +++ b/package.json @@ -73,28 +73,18 @@ "babel-loader": "^8.0.4", "babel-minify-webpack-plugin": "^0.3.1", "babel-preset-env": "^1.6.0", - "babel-preset-minify": "^0.5.0", - "bignumber.js": "^4.0.0", - "bluebird": "3.3.1", "bn.js": "4.11.8", - "browserify": "^14.4.0", - "chai": "^4.0.0", "coveralls": "^3.0.2", "crypto-js": "^3.1.4", - "del": ">=2.0.2", "duplicate-package-checker-webpack-plugin": "^3.0.0", "eth-lib": "^0.2.8", "ethereumjs-wallet": "^0.6.2", "ethjs-signer": "^0.1.1", - "exorcist": "^0.4.0", - "istanbul": "^0.4.4", "js-sha3": "^0.8.0", "jshint": ">=2.5.0", "lerna": "^2.5.1", - "sandboxed-module": "^2.0.2", "uglifyjs-webpack-plugin": "^2.0.1", "underscore": "^1.8.3", - "vinyl-source-stream": "^2.0.0", "webpack": "^4.21.0", "webpack-bundle-analyzer": "^3.0.3", "webpack-cli": "^3.1.2" diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index ddbd76acb1b..0875c77962b 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -128,7 +128,7 @@ const inputCallFormatter = (options, moduleInstance) => { let from = moduleInstance.defaultAccount; if (options.from) { - from = options.from + from = options.from; } if (from) { diff --git a/packages/web3-core-method/src/factories/MethodModuleFactory.js b/packages/web3-core-method/src/factories/MethodModuleFactory.js index 8f474491578..c383115b07a 100644 --- a/packages/web3-core-method/src/factories/MethodModuleFactory.js +++ b/packages/web3-core-method/src/factories/MethodModuleFactory.js @@ -161,7 +161,7 @@ export default class MethodModuleFactory { * @returns {TransactionConfirmationModel} */ createTransactionConfirmationModel() { - return new TransactionConfirmationModel() + return new TransactionConfirmationModel(); } /** diff --git a/packages/web3-core/src/AbstractWeb3Module.js b/packages/web3-core/src/AbstractWeb3Module.js index dc953186a4e..6ffee5f33ab 100644 --- a/packages/web3-core/src/AbstractWeb3Module.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -21,6 +21,7 @@ */ import {isArray, isObject} from 'underscore'; +import {AbstractMethodModel} from 'web3-core-method'; export default class AbstractWeb3Module { @@ -64,7 +65,7 @@ export default class AbstractWeb3Module { { get: this.proxyHandler } - ) + ); } } @@ -103,9 +104,10 @@ export default class AbstractWeb3Module { this.clearSubscriptions(); this._currentProvider = this.providerAdapterResolver.resolve(provider, net); + var setExtendedPackagesProvider = true; if (this.extendedPackages.length > 0) { - var setExtendedPackagesProvider = this.extendedPackages.every(extendedPackage => { - return !!extendedPackage.setProvider(provider, net); + setExtendedPackagesProvider = this.extendedPackages.every(extendedPackage => { + return extendedPackage.setProvider(provider, net); }); } @@ -205,7 +207,7 @@ export default class AbstractWeb3Module { return response; } - if (method.outputFormatter && result) { + if (method.outputFormatter && response) { response = method.outputFormatter(response); } @@ -263,6 +265,6 @@ export default class AbstractWeb3Module { * @param {String} name */ throwIfMissing(name) { - throw Error('Parameter with name ${name} is missing'); + throw Error(`Parameter with name ${name} is missing`); } } diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index feab9b3a40f..2f37ba105b8 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -54,7 +54,7 @@ export default class Web3 extends AbstractWeb3Module { providersModuleFactory, providers, new MethodController(), - new AbstractMethodModelFactory({}, utils, formatters) + new AbstractMethodModelFactory({}, Utils, formatters) ); this.eth = new Eth(provider); @@ -132,7 +132,7 @@ export default class Web3 extends AbstractWeb3Module { Bzz: (provider, net) => { return new Bzz(providerAdapterResolver.resolve(provider, net)); } - } + }; } /** From 4ee5145d146760438c33446e71d65daeafd65d82 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 22 Oct 2018 12:50:31 +0200 Subject: [PATCH 0302/1045] prettier added --- .jshintignore | 2 - .jshintrc | 19 - .prettierignore | 5 + .prettierrc | 11 + package-lock.json | 12 +- package.json | 5 +- packages/web3-bzz/src/Bzz.js | 1 - packages/web3-core-helpers/src/errors.js | 8 +- packages/web3-core-helpers/src/formatters.js | 199 ++++----- .../lib/models/AbstractMethodModel.js | 10 +- .../lib/signers/AbstractSigner.js | 2 - .../src/commands/CallMethodCommand.js | 1 - .../src/commands/SendMethodCommand.js | 48 +-- .../src/commands/SignAndSendMethodCommand.js | 26 +- .../src/commands/SignMessageCommand.js | 3 +- .../src/controllers/MethodController.js | 30 +- .../src/factories/MethodModuleFactory.js | 9 +- packages/web3-core-method/src/index.js | 6 +- .../models/TransactionConfirmationModel.js | 7 +- .../src/models/methods/CallMethodModel.js | 8 +- .../models/methods/EstimateGasMethodModel.js | 8 +- .../src/models/methods/GetCodeMethodModel.js | 7 +- .../models/methods/GetPastLogsMethodModel.js | 10 +- .../models/methods/GetStorageAtMethodModel.js | 8 +- .../src/models/methods/SignMethodModel.js | 20 +- .../methods/account/GetAccountsMethodModel.js | 10 +- .../methods/account/GetBalanceMethodModel.js | 7 +- .../account/GetTransactionCountMethodModel.js | 8 +- .../methods/block/GetBlockMethodModel.js | 8 +- .../block/GetBlockNumberMethodModel.js | 7 +- .../GetBlockTransactionCountMethodModel.js | 8 +- .../block/GetBlockUncleCountMethodModel.js | 8 +- .../methods/block/GetUncleMethodModel.js | 8 +- .../network/GetProtocolVersionMethodModel.js | 8 +- .../methods/network/ListeningMethodModel.js | 8 +- .../methods/network/PeerCountMethodModel.js | 8 +- .../methods/network/VersionMethodModel.js | 8 +- .../methods/node/GetCoinbaseMethodModel.js | 8 +- .../methods/node/GetGasPriceMethodModel.js | 7 +- .../methods/node/GetHashrateMethodModel.js | 8 +- .../methods/node/GetNodeInfoMethodModel.js | 8 +- .../models/methods/node/GetWorkMethodModel.js | 8 +- .../methods/node/IsMiningMethodModel.js | 8 +- .../methods/node/IsSyncingMethodModel.js | 8 +- .../methods/node/SubmitWorkMethodModel.js | 8 +- .../methods/personal/EcRecoverMethodModel.js | 8 +- .../personal/ImportRawKeyMethodModel.js | 8 +- .../personal/ListAccountsMethodModel.js | 10 +- .../personal/LockAccountMethodModel.js | 8 +- .../methods/personal/NewAccountMethodModel.js | 8 +- .../PersonalSendTransactionMethodModel.js | 8 +- .../personal/PersonalSignMethodModel.js | 8 +- .../PersonalSignTransactionMethodModel.js | 8 +- .../personal/UnlockAccountMethodModel.js | 7 +- .../methods/shh/AddPrivateKeyMethodModel.js | 8 +- .../methods/shh/AddSymKeyMethodModel.js | 8 +- .../methods/shh/DeleteKeyPairMethodModel.js | 8 +- .../shh/DeleteMessageFilterMethodModel.js | 8 +- .../methods/shh/DeleteSymKeyMethodModel.js | 8 +- .../GenerateSymKeyFromPasswordMethodModel.js | 8 +- .../shh/GetFilterMessagesMethodModel.js | 7 +- .../models/methods/shh/GetInfoMethodModel.js | 8 +- .../methods/shh/GetPrivateKeyMethodModel.js | 8 +- .../methods/shh/GetPublicKeyMethodModel.js | 8 +- .../methods/shh/GetSymKeyMethodModel.js | 8 +- .../methods/shh/HasKeyPairMethodModel.js | 8 +- .../methods/shh/HasSymKeyMethodModel.js | 8 +- .../methods/shh/MarkTrustedPeerMethodModel.js | 8 +- .../methods/shh/NewKeyPairMethodModel.js | 8 +- .../shh/NewMessageFilterMethodModel.js | 8 +- .../methods/shh/NewSymKeyMethodModel.js | 8 +- .../src/models/methods/shh/PostMethodModel.js | 8 +- .../shh/SetMaxMessageSizeMethodModel.js | 8 +- .../methods/shh/SetMinPoWMethodModel.js | 8 +- .../methods/shh/ShhVersionMethodModel.js | 8 +- .../GetTransactionFromBlockMethodModel.js | 8 +- .../transaction/GetTransactionMethodModel.js | 8 +- .../GetTransactionReceiptMethodModel.js | 7 +- .../SendSignedTransactionMethodModel.js | 8 +- .../transaction/SendTransactionMethodModel.js | 7 +- .../transaction/SignTransactionMethodModel.js | 8 +- .../src/signers/MessageSigner.js | 1 - .../src/signers/TransactionSigner.js | 1 - .../validators/TransactionReceiptValidator.js | 3 +- .../src/watchers/NewHeadsWatcher.js | 3 +- .../TransactionConfirmationWorkflow.js | 37 +- .../tests/commands/CallMethodCommandTest.js | 30 +- .../tests/commands/SendMethodCommandTest.js | 50 +-- .../commands/SignAndSendMethodCommandTest.js | 41 +- .../tests/commands/SignMessageCommandTest.js | 22 +- .../tests/controllers/MethodControllerTest.js | 18 +- .../factories/MethodPackageFactoryTest.js | 69 ++- .../TransactionConfirmationModelTest.js | 65 +-- .../models/methods/CallMethodModelTest.js | 14 +- .../methods/EstimateGasMethodModelTest.js | 14 +- .../models/methods/GetCodeMethodModelTest.js | 14 +- .../methods/GetPastLogsMethodModelTest.js | 14 +- .../methods/GetStorageAtMethodModelTest.js | 16 +- .../models/methods/SignMethodModelTest.js | 18 +- .../account/GetAccountsMethodModelTest.js | 16 +- .../account/GetBalanceMethodModelTest.js | 14 +- .../GetTransactionCountMethodModelTest.js | 14 +- .../methods/block/GetBlockMethodModelTest.js | 16 +- .../block/GetBlockNumberMethodModelTest.js | 16 +- ...GetBlockTransactionCountMethodModelTest.js | 17 +- .../GetBlockUncleCountMethodModelTest.js | 16 +- .../methods/block/GetUncleMethodModelTest.js | 18 +- .../GetProtocolVersionMethodModelTest.js | 12 +- .../network/ListeningMethodModelTest.js | 12 +- .../network/PeerCountMethodModelTest.js | 16 +- .../methods/network/VersionMethodModelTest.js | 16 +- .../node/GetCoinbaseMethodModelTest.js | 16 +- .../node/GetGasPriceMethodModelTest.js | 16 +- .../node/GetHashrateMethodModelTest.js | 18 +- .../node/GetNodeInfoMethodModelTest.js | 12 +- .../methods/node/GetWorkMethodModelTest.js | 12 +- .../methods/node/IsMiningMethodModelTest.js | 12 +- .../methods/node/IsSyncingMethodModelTest.js | 14 +- .../methods/node/SubmitWorkMethodModelTest.js | 12 +- .../personal/EcRecoverMethodModelTest.js | 15 +- .../personal/ImportRawKeyMethodModelTest.js | 12 +- .../personal/ListAccountsMethodModelTest.js | 14 +- .../personal/LockAccountMethodModelTest.js | 14 +- .../personal/NewAccountMethodModelTest.js | 14 +- .../PersonalSendTransactionMethodModelTest.js | 14 +- .../personal/PersonalSignMethodModelTest.js | 14 +- .../personal/UnlockAccountMethodModelTest.js | 14 +- .../methods/shh/GenericShhMethodModelsTest.js | 6 +- .../GetTransactionFromBlockMethodModelTest.js | 26 +- .../GetTransactionMethodModelTest.js | 15 +- .../GetTransactionReceiptMethodModelTest.js | 15 +- .../SendSignedTransactionMethodModelTest.js | 13 +- .../SendTransactionMethodModelTest.js | 16 +- .../SignTransactionMethodModelTest.js | 14 +- .../tests/signers/MessageSignerTest.js | 22 +- .../tests/signers/TransactionSignerTest.js | 30 +- .../TransactionReceiptValidatorTest.js | 36 +- .../tests/watchers/NewHeadsWatcherTest.js | 14 +- .../TransactionConfirmationWorkflowTest.js | 57 ++- .../web3-core-promievent/src/PromiEvent.js | 1 - .../lib/models/AbstractSubscriptionModel.js | 3 +- .../src/Subscription.js | 96 ++--- .../src/factories/SubscriptionsFactory.js | 24 +- .../factories/SubscriptionsModuleFactory.js | 1 - .../subscriptions/eth/LogSubscriptionModel.js | 37 +- .../eth/NewHeadsSubscriptionModel.js | 9 +- ...NewPendingTransactionsSubscriptionModel.js | 9 +- .../eth/SyncingSubscriptionModel.js | 9 +- .../shh/MessagesSubscriptionModel.js | 9 +- packages/web3-core/src/AbstractWeb3Module.js | 22 +- packages/web3-eth-abi/src/ABICoder.js | 47 +- .../src/factories/ABIModuleFactory.js | 1 - packages/web3-eth-accounts/src/Accounts.js | 97 +++-- .../src/factories/AccountsModuleFactory.js | 1 - .../src/factories/MethodModelFactory.js | 1 - packages/web3-eth-accounts/src/index.js | 2 +- packages/web3-eth-contract/src/Contract.js | 31 +- .../src/decoders/AllEventsLogDecoder.js | 6 +- .../src/decoders/CallMethodResponseDecoder.js | 1 - .../src/decoders/EventLogDecoder.js | 1 - .../src/encoders/AllEventsFilterEncoder.js | 3 +- .../src/encoders/EventFilterEncoder.js | 7 +- .../src/encoders/MethodEncoder.js | 8 +- .../src/factories/ContractModuleFactory.js | 18 +- .../src/factories/EventSubscriptionFactory.js | 7 +- .../src/factories/RpcMethodModelFactory.js | 12 +- packages/web3-eth-contract/src/index.js | 7 +- .../src/mappers/ABIMapper.js | 12 +- .../src/mappers/AllEventsOptionsMapper.js | 1 - .../src/mappers/EventOptionsMapper.js | 1 - .../src/mappers/RpcMethodOptionsMapper.js | 3 +- .../src/models/abi/ABIItemModel.js | 5 +- .../src/models/abi/ABIModel.js | 3 +- .../models/methods/CallContractMethodModel.js | 6 +- .../methods/ContractDeployMethodModel.js | 7 +- .../methods/PastEventLogsMethodModel.js | 8 +- .../models/methods/SendContractMethodModel.js | 9 +- .../subscriptions/AllEventsLogSubscription.js | 18 +- .../subscriptions/EventLogSubscription.js | 19 +- .../src/proxies/EventSubscriptionsProxy.js | 27 +- .../src/proxies/MethodsProxy.js | 10 +- .../validators/RpcMethodOptionsValidator.js | 5 +- .../web3-eth-ens/ressources/ABI/Registry.js | 232 +++++----- .../web3-eth-ens/ressources/ABI/Resolver.js | 402 +++++++++--------- packages/web3-eth-ens/src/ENS.js | 1 - .../web3-eth-ens/src/contracts/Registry.js | 71 ++-- .../src/factories/ENSModuleFactory.js | 11 +- .../src/handlers/ResolverMethodHandler.js | 68 +-- packages/web3-eth-ens/src/index.js | 10 +- packages/web3-eth-iban/src/Iban.js | 43 +- packages/web3-eth-personal/src/Personal.js | 1 - .../src/factories/MethodModelFactory.js | 1 - .../src/factories/PersonalModuleFactory.js | 1 - packages/web3-eth/src/Eth.js | 35 +- .../src/factories/EthModuleFactory.js | 3 +- .../src/factories/MethodModelFactory.js | 1 - packages/web3-eth/src/index.js | 2 +- packages/web3-net/src/Network.js | 75 ++-- .../src/factories/MethodModelFactory.js | 3 +- .../src/factories/NetworkModuleFactory.js | 5 +- packages/web3-net/src/index.js | 6 +- .../lib/adapters/AbstractProviderAdapter.js | 9 +- .../src/adapters/HttpProviderAdapter.js | 1 - .../src/adapters/InpageProviderAdapter.js | 4 +- .../src/adapters/SocketProviderAdapter.js | 7 +- .../src/batch-request/BatchRequest.js | 48 +-- .../src/detectors/ProviderDetector.js | 13 +- .../src/factories/ProvidersModuleFactory.js | 5 +- .../src/mappers/JSONRpcMapper.js | 7 +- .../src/providers/HttpProvider.js | 23 +- .../src/providers/IpcProvider.js | 24 +- .../src/providers/WebsocketProvider.js | 48 +-- .../src/resolvers/ProviderAdapterResolver.js | 1 - .../validators/JSONRpcResponseValidator.js | 9 +- packages/web3-shh/src/Shh.js | 6 +- .../src/factories/MethodModelFactory.js | 3 +- .../src/factories/ShhModuleFactory.js | 7 +- packages/web3-utils/src/bloomFilter.js | 21 +- packages/web3-utils/src/index.js | 48 +-- packages/web3-utils/src/soliditySha3.js | 46 +- packages/web3-utils/src/utils.js | 110 ++--- packages/web3/src/index.js | 9 +- 222 files changed, 1698 insertions(+), 2336 deletions(-) delete mode 100644 .jshintignore delete mode 100644 .jshintrc create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 42bb00f77d8..00000000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -packages/**/node_modules/ diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 8471c8490ca..00000000000 --- a/.jshintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "browserify": true, - "bitwise": true, - "camelcase": true, - "eqeqeq": true, - "freeze": true, - "funcscope": false, - "maxcomplexity": 15, - "maxdepth": 4, - "maxerr": 50, - /*"maxlen": 80*/ /*this should be our goal*/ - /*"maxparams": 3,*/ - "nonew": true, - "unused": true, - "undef": true, - "predef": [ - "console" - ] -} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..1895102c047 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +node_modules +dist +_build +build +coverage diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000000..1dfd63cf622 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "printWidth": 120, + "tabWidth": 4, + "useTabs": false, + "semi": true, + "singleQuote": true, + "trailingComma": "none", + "bracketSpacing": false, + "arrowParens": "always", + "proseWrap": "never" +} diff --git a/package-lock.json b/package-lock.json index bec23119dff..3df75ea4993 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4389,12 +4389,6 @@ "randomfill": "^1.0.3" } }, - "crypto-js": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.8.tgz", - "integrity": "sha1-cV8HC/YBTyrpkqmLOSkli3E/CNU=", - "dev": true - }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", @@ -8360,6 +8354,12 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "prettier": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.3.tgz", + "integrity": "sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==", + "dev": true + }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", diff --git a/package.json b/package.json index 87926a923c3..ea84f52a126 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "build": "webpack --mode production", "release": "lerna bootstrap; lerna publish; gulp version; gulp; gulp publishTag; git push --tags", "docs": "cd docs; make html;", - "lint": "jshint *.js packages" + "format": "prettier --config ./.prettierrc --write ./packages/**/*.js" }, "repository": { "type": "git", @@ -75,14 +75,13 @@ "babel-preset-env": "^1.6.0", "bn.js": "4.11.8", "coveralls": "^3.0.2", - "crypto-js": "^3.1.4", "duplicate-package-checker-webpack-plugin": "^3.0.0", "eth-lib": "^0.2.8", "ethereumjs-wallet": "^0.6.2", "ethjs-signer": "^0.1.1", "js-sha3": "^0.8.0", - "jshint": ">=2.5.0", "lerna": "^2.5.1", + "prettier": "1.14.3", "uglifyjs-webpack-plugin": "^2.0.1", "underscore": "^1.8.3", "webpack": "^4.21.0", diff --git a/packages/web3-bzz/src/Bzz.js b/packages/web3-bzz/src/Bzz.js index e4cd6e4f524..c18946b58d1 100644 --- a/packages/web3-bzz/src/Bzz.js +++ b/packages/web3-bzz/src/Bzz.js @@ -24,7 +24,6 @@ import {isObject, isString} from 'underscore'; import swarm from 'swarm-js'; export default class Bzz { - /** * @param {Object|String} provider * diff --git a/packages/web3-core-helpers/src/errors.js b/packages/web3-core-helpers/src/errors.js index 81614b383e3..1a6c5ffbfab 100644 --- a/packages/web3-core-helpers/src/errors.js +++ b/packages/web3-core-helpers/src/errors.js @@ -23,7 +23,8 @@ export default { ErrorResponse(result) { - const message = !!result && !!result.error && !!result.error.message ? result.error.message : JSON.stringify(result); + const message = + !!result && !!result.error && !!result.error.message ? result.error.message : JSON.stringify(result); return new Error(`Returned error: ${message}`); }, InvalidNumberOfParams(got, expected, method) { @@ -36,7 +37,10 @@ export default { return new Error('Provider not set or invalid'); }, InvalidResponse(result) { - const message = !!result && !!result.error && !!result.error.message ? result.error.message : `Invalid JSON RPC response: ${JSON.stringify(result)}`; + const message = + !!result && !!result.error && !!result.error.message + ? result.error.message + : `Invalid JSON RPC response: ${JSON.stringify(result)}`; return new Error(message); }, ConnectionTimeout(ms) { diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index 0875c77962b..e2b702be03f 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -32,11 +32,11 @@ import {Iban} from 'web3-eth-iban'; * @param {String|Number|BigNumber} number * @returns {BigNumber} object */ -const outputBigNumberFormatter = number => { +const outputBigNumberFormatter = (number) => { return Utils.toBN(number).toString(10); }; -const isPredefinedBlockNumber = blockNumber => { +const isPredefinedBlockNumber = (blockNumber) => { return blockNumber === 'latest' || blockNumber === 'pending' || blockNumber === 'earliest'; }; @@ -61,7 +61,7 @@ const inputDefaultBlockNumberFormatter = (blockNumber, moduleInstance) => { return inputBlockNumberFormatter(blockNumber); }; -const inputBlockNumberFormatter = blockNumber => { +const inputBlockNumberFormatter = (blockNumber) => { if (blockNumber === undefined) { return undefined; } @@ -70,7 +70,11 @@ const inputBlockNumberFormatter = blockNumber => { return blockNumber; } - return (Utils.isHexStrict(blockNumber)) ? ((isString(blockNumber)) ? blockNumber.toLowerCase() : blockNumber) : Utils.numberToHex(blockNumber); + return Utils.isHexStrict(blockNumber) + ? isString(blockNumber) + ? blockNumber.toLowerCase() + : blockNumber + : Utils.numberToHex(blockNumber); }; /** @@ -80,14 +84,16 @@ const inputBlockNumberFormatter = blockNumber => { * @param {Object} transaction options * @returns object */ -const _txInputFormatter = options => { - - if (options.to) { // it might be contract creation +const _txInputFormatter = (options) => { + if (options.to) { + // it might be contract creation options.to = inputAddressFormatter(options.to); } if (options.data && options.input) { - throw new Error('You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.'); + throw new Error( + 'You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.' + ); } if (!options.data && options.input) { @@ -95,7 +101,7 @@ const _txInputFormatter = options => { delete options.input; } - if(options.data && !Utils.isHex(options.data)) { + if (options.data && !Utils.isHex(options.data)) { throw new Error('The data field must be HEX encoded data.'); } @@ -104,11 +110,13 @@ const _txInputFormatter = options => { options.gas = options.gas || options.gasLimit; } - ['gasPrice', 'gas', 'value', 'nonce'].filter(key => { - return options[key] !== undefined; - }).forEach(key => { - options[key] = Utils.numberToHex(options[key]); - }); + ['gasPrice', 'gas', 'value', 'nonce'] + .filter((key) => { + return options[key] !== undefined; + }) + .forEach((key) => { + options[key] = Utils.numberToHex(options[key]); + }); return options; }; @@ -122,7 +130,7 @@ const _txInputFormatter = options => { * @param {AbstractWeb3Module} moduleInstance * * @returns object -*/ + */ const inputCallFormatter = (options, moduleInstance) => { options = _txInputFormatter(options); let from = moduleInstance.defaultAccount; @@ -147,7 +155,7 @@ const inputCallFormatter = (options, moduleInstance) => { * @param {AbstractWeb3Module} moduleInstance * * @returns object -*/ + */ const inputTransactionFormatter = (options, moduleInstance) => { options = _txInputFormatter(options); @@ -173,8 +181,8 @@ const inputTransactionFormatter = (options, moduleInstance) => { * @param {String} data * @returns {String} */ -const inputSignFormatter = data => { - return (Utils.isHexStrict(data)) ? data : Utils.utf8ToHex(data); +const inputSignFormatter = (data) => { + return Utils.isHexStrict(data) ? data : Utils.utf8ToHex(data); }; /** @@ -183,24 +191,23 @@ const inputSignFormatter = data => { * @method outputTransactionFormatter * @param {Object} tx * @returns {Object} -*/ -const outputTransactionFormatter = tx => { - if(tx.blockNumber !== null) - tx.blockNumber = Utils.hexToNumber(tx.blockNumber); - if(tx.transactionIndex !== null) - tx.transactionIndex = Utils.hexToNumber(tx.transactionIndex); + */ +const outputTransactionFormatter = (tx) => { + if (tx.blockNumber !== null) tx.blockNumber = Utils.hexToNumber(tx.blockNumber); + if (tx.transactionIndex !== null) tx.transactionIndex = Utils.hexToNumber(tx.transactionIndex); tx.nonce = Utils.hexToNumber(tx.nonce); tx.gas = Utils.hexToNumber(tx.gas); tx.gasPrice = outputBigNumberFormatter(tx.gasPrice); tx.value = outputBigNumberFormatter(tx.value); - if(tx.to && Utils.isAddress(tx.to)) { // tx.to could be `0x0` or `null` while contract creation + if (tx.to && Utils.isAddress(tx.to)) { + // tx.to could be `0x0` or `null` while contract creation tx.to = Utils.toChecksumAddress(tx.to); } else { tx.to = null; // set to `null` if invalid address } - if(tx.from) { + if (tx.from) { tx.from = Utils.toChecksumAddress(tx.from); } @@ -213,28 +220,26 @@ const outputTransactionFormatter = tx => { * @method outputTransactionReceiptFormatter * @param {Object} receipt * @returns {Object} -*/ -const outputTransactionReceiptFormatter = receipt => { - if(typeof receipt !== 'object') { + */ +const outputTransactionReceiptFormatter = (receipt) => { + if (typeof receipt !== 'object') { throw new Error(`Received receipt is invalid: ${receipt}`); } - if(receipt.blockNumber !== null) - receipt.blockNumber = Utils.hexToNumber(receipt.blockNumber); - if(receipt.transactionIndex !== null) - receipt.transactionIndex = Utils.hexToNumber(receipt.transactionIndex); + if (receipt.blockNumber !== null) receipt.blockNumber = Utils.hexToNumber(receipt.blockNumber); + if (receipt.transactionIndex !== null) receipt.transactionIndex = Utils.hexToNumber(receipt.transactionIndex); receipt.cumulativeGasUsed = Utils.hexToNumber(receipt.cumulativeGasUsed); receipt.gasUsed = Utils.hexToNumber(receipt.gasUsed); - if(isArray(receipt.logs)) { + if (isArray(receipt.logs)) { receipt.logs = receipt.logs.map(outputLogFormatter); } - if(receipt.contractAddress) { + if (receipt.contractAddress) { receipt.contractAddress = Utils.toChecksumAddress(receipt.contractAddress); } - if(typeof receipt.status !== 'undefined') { + if (typeof receipt.status !== 'undefined') { receipt.status = Boolean(parseInt(receipt.status)); } @@ -247,31 +252,25 @@ const outputTransactionReceiptFormatter = receipt => { * @method outputBlockFormatter * @param {Object} block * @returns {Object} -*/ -const outputBlockFormatter = block => { - + */ +const outputBlockFormatter = (block) => { // transform to number block.gasLimit = Utils.hexToNumber(block.gasLimit); block.gasUsed = Utils.hexToNumber(block.gasUsed); block.size = Utils.hexToNumber(block.size); block.timestamp = Utils.hexToNumber(block.timestamp); - if (block.number !== null) - block.number = Utils.hexToNumber(block.number); + if (block.number !== null) block.number = Utils.hexToNumber(block.number); - if(block.difficulty) - block.difficulty = outputBigNumberFormatter(block.difficulty); - if(block.totalDifficulty) - block.totalDifficulty = outputBigNumberFormatter(block.totalDifficulty); + if (block.difficulty) block.difficulty = outputBigNumberFormatter(block.difficulty); + if (block.totalDifficulty) block.totalDifficulty = outputBigNumberFormatter(block.totalDifficulty); if (isArray(block.transactions)) { - block.transactions.forEach(item => { - if(!isString(item)) - return outputTransactionFormatter(item); + block.transactions.forEach((item) => { + if (!isString(item)) return outputTransactionFormatter(item); }); } - if (block.miner) - block.miner = Utils.toChecksumAddress(block.miner); + if (block.miner) block.miner = Utils.toChecksumAddress(block.miner); return block; }; @@ -282,40 +281,35 @@ const outputBlockFormatter = block => { * @method inputLogFormatter * @param {Object} log object * @returns {Object} log -*/ -const inputLogFormatter = options => { - let toTopic = value => { - - if(value === null || typeof value === 'undefined') - return null; + */ +const inputLogFormatter = (options) => { + let toTopic = (value) => { + if (value === null || typeof value === 'undefined') return null; value = String(value); - if(value.indexOf('0x') === 0) - return value; - else - return Utils.fromUtf8(value); + if (value.indexOf('0x') === 0) return value; + else return Utils.fromUtf8(value); }; - if (options.fromBlock) - options.fromBlock = inputBlockNumberFormatter(options.fromBlock); - - if (options.toBlock) - options.toBlock = inputBlockNumberFormatter(options.toBlock); + if (options.fromBlock) options.fromBlock = inputBlockNumberFormatter(options.fromBlock); + if (options.toBlock) options.toBlock = inputBlockNumberFormatter(options.toBlock); // make sure topics, get converted to hex options.topics = options.topics || []; - options.topics = options.topics.map(topic => { - return (isArray(topic)) ? topic.map(toTopic) : toTopic(topic); + options.topics = options.topics.map((topic) => { + return isArray(topic) ? topic.map(toTopic) : toTopic(topic); }); toTopic = null; if (options.address) { - options.address = (isArray(options.address)) ? options.address.map(addr => { - return inputAddressFormatter(addr); - }) : inputAddressFormatter(options.address); + options.address = isArray(options.address) + ? options.address.map((addr) => { + return inputAddressFormatter(addr); + }) + : inputAddressFormatter(options.address); } return options; @@ -327,25 +321,25 @@ const inputLogFormatter = options => { * @method outputLogFormatter * @param {Object} log object * @returns {Object} log -*/ -const outputLogFormatter = log => { - + */ +const outputLogFormatter = (log) => { // generate a custom log id - if(typeof log.blockHash === 'string' && - typeof log.transactionHash === 'string' && - typeof log.logIndex === 'string') { - const shaId = Utils.sha3(log.blockHash.replace('0x','') + log.transactionHash.replace('0x','') + log.logIndex.replace('0x','')); - log.id = `log_${shaId.replace('0x','').substr(0,8)}`; - } else if(!log.id) { + if ( + typeof log.blockHash === 'string' && + typeof log.transactionHash === 'string' && + typeof log.logIndex === 'string' + ) { + const shaId = Utils.sha3( + log.blockHash.replace('0x', '') + log.transactionHash.replace('0x', '') + log.logIndex.replace('0x', '') + ); + log.id = `log_${shaId.replace('0x', '').substr(0, 8)}`; + } else if (!log.id) { log.id = null; } - if (log.blockNumber !== null) - log.blockNumber = Utils.hexToNumber(log.blockNumber); - if (log.transactionIndex !== null) - log.transactionIndex = Utils.hexToNumber(log.transactionIndex); - if (log.logIndex !== null) - log.logIndex = Utils.hexToNumber(log.logIndex); + if (log.blockNumber !== null) log.blockNumber = Utils.hexToNumber(log.blockNumber); + if (log.transactionIndex !== null) log.transactionIndex = Utils.hexToNumber(log.transactionIndex); + if (log.logIndex !== null) log.logIndex = Utils.hexToNumber(log.logIndex); if (log.address) { log.address = Utils.toChecksumAddress(log.address); @@ -360,17 +354,13 @@ const outputLogFormatter = log => { * @method inputPostFormatter * @param {Object} transaction object * @returns {Object} -*/ -const inputPostFormatter = post => { - + */ +const inputPostFormatter = (post) => { // post.payload = Utils.toHex(post.payload); - if (post.ttl) - post.ttl = Utils.numberToHex(post.ttl); - if (post.workToProve) - post.workToProve = Utils.numberToHex(post.workToProve); - if (post.priority) - post.priority = Utils.numberToHex(post.priority); + if (post.ttl) post.ttl = Utils.numberToHex(post.ttl); + if (post.workToProve) post.workToProve = Utils.numberToHex(post.workToProve); + if (post.priority) post.priority = Utils.numberToHex(post.priority); // fallback if (!isArray(post.topics)) { @@ -378,9 +368,9 @@ const inputPostFormatter = post => { } // format the following options - post.topics = post.topics.map(topic => { + post.topics = post.topics.map((topic) => { // convert only if not hex - return (topic.indexOf('0x') === 0) ? topic : Utils.fromUtf8(topic); + return topic.indexOf('0x') === 0 ? topic : Utils.fromUtf8(topic); }); return post; @@ -393,7 +383,7 @@ const inputPostFormatter = post => { * @param {Object} * @returns {Object} */ -const outputPostFormatter = post => { +const outputPostFormatter = (post) => { post.expiry = Utils.hexToNumber(post.expiry); post.sent = Utils.hexToNumber(post.sent); post.ttl = Utils.hexToNumber(post.ttl); @@ -409,28 +399,28 @@ const outputPostFormatter = post => { if (!post.topics) { post.topics = []; } - post.topics = post.topics.map(topic => { + post.topics = post.topics.map((topic) => { return Utils.toUtf8(topic); }); return post; }; -var inputAddressFormatter = address => { +var inputAddressFormatter = (address) => { const iban = new Iban(address); if (iban.isValid() && iban.isDirect()) { return iban.toAddress().toLowerCase(); } else if (Utils.isAddress(address)) { - return `0x${address.toLowerCase().replace('0x','')}`; + return `0x${address.toLowerCase().replace('0x', '')}`; } - throw new Error(`Provided address "${address}" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.`); + throw new Error( + `Provided address "${address}" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.` + ); }; - -const outputSyncingFormatter = result => { - +const outputSyncingFormatter = (result) => { result.startingBlock = Utils.hexToNumber(result.startingBlock); result.currentBlock = Utils.hexToNumber(result.currentBlock); result.highestBlock = Utils.hexToNumber(result.highestBlock); @@ -459,4 +449,3 @@ export default { outputPostFormatter, outputSyncingFormatter }; - diff --git a/packages/web3-core-method/lib/models/AbstractMethodModel.js b/packages/web3-core-method/lib/models/AbstractMethodModel.js index 88ee85d3809..fae7c47e1f1 100644 --- a/packages/web3-core-method/lib/models/AbstractMethodModel.js +++ b/packages/web3-core-method/lib/models/AbstractMethodModel.js @@ -23,7 +23,6 @@ import _ from 'underscore'; export default class AbstractMethodModel { - /** * @param {String|Function} rpcMethod * @param {Number} parametersAmount @@ -63,7 +62,7 @@ export default class AbstractMethodModel { * * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. */ - beforeExecution(moduleInstance) { } + beforeExecution(moduleInstance) {} /** * This method will be executed after the RPC request. @@ -101,7 +100,8 @@ export default class AbstractMethodModel { * @returns {Object} */ mapFunctionArguments(args) { - let parameters = args, callback = false; + let parameters = args, + callback = false; if (args.length < this.parametersAmount) { throw new Error( @@ -112,9 +112,7 @@ export default class AbstractMethodModel { if (args.length > this.parametersAmount) { callback = args.slice(-1); if (!_.isFunction(callback)) { - throw new Error( - 'The latest parameter should be a function otherwise it can not be used as callback' - ); + throw new Error('The latest parameter should be a function otherwise it can not be used as callback'); } parameters = args.slice(0, -1); } diff --git a/packages/web3-core-method/lib/signers/AbstractSigner.js b/packages/web3-core-method/lib/signers/AbstractSigner.js index a70d2c13d91..4222ed4d233 100644 --- a/packages/web3-core-method/lib/signers/AbstractSigner.js +++ b/packages/web3-core-method/lib/signers/AbstractSigner.js @@ -23,7 +23,6 @@ import _ from 'underscore'; export default class AbstractSigner { - /** * Get wallet for address with accounts package * @@ -36,7 +35,6 @@ export default class AbstractSigner { // is index given if (_.isNumber(from)) { return accounts.wallet[from]; - } // is account given diff --git a/packages/web3-core-method/src/commands/CallMethodCommand.js b/packages/web3-core-method/src/commands/CallMethodCommand.js index 5c94c89e4c7..12e6bf7aded 100644 --- a/packages/web3-core-method/src/commands/CallMethodCommand.js +++ b/packages/web3-core-method/src/commands/CallMethodCommand.js @@ -21,7 +21,6 @@ */ export default class CallMethodCommand { - /** * Sends a JSON-RPC call request * diff --git a/packages/web3-core-method/src/commands/SendMethodCommand.js b/packages/web3-core-method/src/commands/SendMethodCommand.js index b40f88a109e..5d91ce86158 100644 --- a/packages/web3-core-method/src/commands/SendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SendMethodCommand.js @@ -23,7 +23,6 @@ import {isObject} from 'underscore'; export default class SendMethodCommand { - /** * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow * @@ -54,7 +53,7 @@ export default class SendMethodCommand { return promiEvent; } - this.getGasPrice(moduleInstance.currentProvider).then(gasPrice => { + this.getGasPrice(moduleInstance.currentProvider).then((gasPrice) => { if (isObject(methodModel.parameters[0])) { methodModel.parameters[0].gasPrice = gasPrice; } @@ -77,31 +76,26 @@ export default class SendMethodCommand { * @returns {PromiEvent} */ send(methodModel, promiEvent, moduleInstance) { - moduleInstance.currentProvider.send( - methodModel.rpcMethod, - methodModel.parameters - ).then(response => { - this.transactionConfirmationWorkflow.execute( - methodModel, - moduleInstance, - response, - promiEvent - ); - - promiEvent.emit('transactionHash', response); - - if (methodModel.callback) { - methodModel.callback(false, response); - } - }).catch(error => { - promiEvent.reject(error); - promiEvent.emit('error', error); - promiEvent.removeAllListeners(); - - if (methodModel.callback) { - methodModel.callback(error, null); - } - }); + moduleInstance.currentProvider + .send(methodModel.rpcMethod, methodModel.parameters) + .then((response) => { + this.transactionConfirmationWorkflow.execute(methodModel, moduleInstance, response, promiEvent); + + promiEvent.emit('transactionHash', response); + + if (methodModel.callback) { + methodModel.callback(false, response); + } + }) + .catch((error) => { + promiEvent.reject(error); + promiEvent.emit('error', error); + promiEvent.removeAllListeners(); + + if (methodModel.callback) { + methodModel.callback(error, null); + } + }); return promiEvent; } diff --git a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js index 0499758b506..a23b5d3771d 100644 --- a/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js +++ b/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js @@ -23,7 +23,6 @@ import SendMethodCommand from './SendMethodCommand'; export default class SignAndSendMethodCommand extends SendMethodCommand { - /** * @param {TransactionConfirmationWorkflow} transactionConfirmationWorkflow * @param {TransactionSigner} transactionSigner @@ -52,18 +51,21 @@ export default class SignAndSendMethodCommand extends SendMethodCommand { methodModel.beforeExecution(moduleInstance); methodModel.rpcMethod = 'eth_sendRawTransaction'; - this.transactionSigner.sign(methodModel.parameters[0], accounts).then(response => { - methodModel.parameters = [response.rawTransaction]; - this.send(methodModel, promiEvent, moduleInstance); - }).catch(error => { - promiEvent.reject(error); - promiEvent.emit('error', error); - promiEvent.removeAllListeners(); + this.transactionSigner + .sign(methodModel.parameters[0], accounts) + .then((response) => { + methodModel.parameters = [response.rawTransaction]; + this.send(methodModel, promiEvent, moduleInstance); + }) + .catch((error) => { + promiEvent.reject(error); + promiEvent.emit('error', error); + promiEvent.removeAllListeners(); - if (methodModel.callback) { - methodModel.callback(error, null); - } - }); + if (methodModel.callback) { + methodModel.callback(error, null); + } + }); return promiEvent; } diff --git a/packages/web3-core-method/src/commands/SignMessageCommand.js b/packages/web3-core-method/src/commands/SignMessageCommand.js index 37038e5dc19..4b3032a5815 100644 --- a/packages/web3-core-method/src/commands/SignMessageCommand.js +++ b/packages/web3-core-method/src/commands/SignMessageCommand.js @@ -21,7 +21,6 @@ */ export default class SignMessageCommand { - /** * @param {MessageSigner} messageSigner * @@ -52,7 +51,7 @@ export default class SignMessageCommand { signedMessage = methodModel.afterExecution( this.messageSigner.sign(methodModel.parameters[0], methodModel.parameters[1], accounts) ); - } catch(error) { + } catch (error) { methodModel.callback(error, null); throw error; diff --git a/packages/web3-core-method/src/controllers/MethodController.js b/packages/web3-core-method/src/controllers/MethodController.js index 92893a8c1ed..23bdb7366f3 100644 --- a/packages/web3-core-method/src/controllers/MethodController.js +++ b/packages/web3-core-method/src/controllers/MethodController.js @@ -21,7 +21,6 @@ */ export default class MethodController { - /** * @param {CallMethodCommand} callMethodCommand * @param {SendMethodCommand} sendMethodCommand @@ -31,13 +30,7 @@ export default class MethodController { * * @constructor */ - constructor( - callMethodCommand, - sendMethodCommand, - signAndSendMethodCommand, - signMessageCommand, - promiEventObject - ) { + constructor(callMethodCommand, sendMethodCommand, signAndSendMethodCommand, signMessageCommand, promiEventObject) { this.callMethodCommand = callMethodCommand; this.sendMethodCommand = sendMethodCommand; this.signAndSendMethodCommand = signAndSendMethodCommand; @@ -59,11 +52,7 @@ export default class MethodController { execute(methodModel, accounts, moduleInstance) { if (this.hasWallets(accounts)) { if (methodModel.isSign()) { - return this.signMessageCommand.execute( - moduleInstance, - methodModel, - accounts, - ); + return this.signMessageCommand.execute(moduleInstance, methodModel, accounts); } if (methodModel.isSendTransaction()) { @@ -71,23 +60,16 @@ export default class MethodController { moduleInstance, methodModel, new this.promiEventObject(), - accounts, + accounts ); } } if (methodModel.isSendTransaction() || methodModel.isSendRawTransaction() || methodModel.isSign()) { - return this.sendMethodCommand.execute( - moduleInstance, - methodModel, - new this.promiEventObject() - ); + return this.sendMethodCommand.execute(moduleInstance, methodModel, new this.promiEventObject()); } - return this.callMethodCommand.execute( - moduleInstance, - methodModel, - ); + return this.callMethodCommand.execute(moduleInstance, methodModel); } /** @@ -100,6 +82,6 @@ export default class MethodController { * @returns {Boolean} */ hasWallets(accounts) { - return (accounts && accounts.wallet.length > 0); + return accounts && accounts.wallet.length > 0; } } diff --git a/packages/web3-core-method/src/factories/MethodModuleFactory.js b/packages/web3-core-method/src/factories/MethodModuleFactory.js index c383115b07a..bf78447680d 100644 --- a/packages/web3-core-method/src/factories/MethodModuleFactory.js +++ b/packages/web3-core-method/src/factories/MethodModuleFactory.js @@ -33,7 +33,6 @@ import SignAndSendMethodCommand from '../commands/SignAndSendMethodCommand'; import SignMessageCommand from '../commands/SignMessageCommand'; export default class MethodModuleFactory { - /** * Returns the MethodController object * @@ -77,9 +76,7 @@ export default class MethodModuleFactory { * @returns {SendMethodCommand} */ createSendMethodCommand(subscriptionsFactory, formatters) { - return new SendMethodCommand( - this.createTransactionConfirmationWorkflow(subscriptionsFactory, formatters) - ); + return new SendMethodCommand(this.createTransactionConfirmationWorkflow(subscriptionsFactory, formatters)); } /** @@ -107,9 +104,7 @@ export default class MethodModuleFactory { * @returns {SignMessageCommand} */ createSignMessageCommand() { - return new SignMessageCommand( - this.createMessageSigner() - ); + return new SignMessageCommand(this.createMessageSigner()); } /** diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 85ad644b389..66b3c51d350 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -35,11 +35,7 @@ import {formatters} from 'web3-core-helpers'; * @returns {MethodController} */ export const MethodController = () => { - return new MethodModuleFactory().createMethodController( - PromiEvent, - new SubscriptionsFactory(), - formatters - ); + return new MethodModuleFactory().createMethodController(PromiEvent, new SubscriptionsFactory(), formatters); }; export AbstractMethodModelFactory from '../lib/factories/AbstractMethodModelFactory'; diff --git a/packages/web3-core-method/src/models/TransactionConfirmationModel.js b/packages/web3-core-method/src/models/TransactionConfirmationModel.js index e8eeee97858..f66d420e496 100644 --- a/packages/web3-core-method/src/models/TransactionConfirmationModel.js +++ b/packages/web3-core-method/src/models/TransactionConfirmationModel.js @@ -21,7 +21,6 @@ */ export default class TransactionConfirmationModel { - /** * @constructor */ @@ -74,7 +73,7 @@ export default class TransactionConfirmationModel { * @returns {Boolean} */ isConfirmed() { - return this.confirmations.length === (this.confirmationBlocks + 1); + return this.confirmations.length === this.confirmationBlocks + 1; } /** @@ -86,9 +85,9 @@ export default class TransactionConfirmationModel { */ isTimeoutTimeExceeded(watcherIsPolling) { if (watcherIsPolling) { - return (this.timeoutCounter - 1) >= this.pollingTimeout; + return this.timeoutCounter - 1 >= this.pollingTimeout; } - return (this.timeoutCounter - 1) >= this.timeoutBlock; + return this.timeoutCounter - 1 >= this.timeoutBlock; } } diff --git a/packages/web3-core-method/src/models/methods/CallMethodModel.js b/packages/web3-core-method/src/models/methods/CallMethodModel.js index c62675e3570..862941ca8ff 100644 --- a/packages/web3-core-method/src/models/methods/CallMethodModel.js +++ b/packages/web3-core-method/src/models/methods/CallMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class CallMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class CallMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_call', - 2, - utils, - formatters - ); + super('eth_call', 2, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js index 5164a6caba3..bf1e2736be2 100644 --- a/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js +++ b/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class EstimateGasMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class EstimateGasMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_estimateGas', - 1, - utils, - formatters - ); + super('eth_estimateGas', 1, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js index 98291a861af..baa838cc547 100644 --- a/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js @@ -30,12 +30,7 @@ export default class GetCodeMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_getCode', - 2, - utils, - formatters - ); + super('eth_getCode', 2, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js index a9d55024ae8..81d696a23a9 100644 --- a/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class GetPastLogsMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetPastLogsMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_getLogs', - 1, - utils, - formatters - ); + super('eth_getLogs', 1, utils, formatters); } /** @@ -60,7 +54,7 @@ export default class GetPastLogsMethodModel extends AbstractMethodModel { * @returns {Array} */ afterExecution(response) { - return response.map(responseItem => { + return response.map((responseItem) => { return this.formatters.outputLogFormatter(responseItem); }); } diff --git a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js index 3ab01d869ac..8fa4456932d 100644 --- a/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js +++ b/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class GetStorageAtMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetStorageAtMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_getStorageAt', - 3, - utils, - formatters - ); + super('eth_getStorageAt', 3, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/SignMethodModel.js b/packages/web3-core-method/src/models/methods/SignMethodModel.js index 0abb0c1787d..747936ee26e 100644 --- a/packages/web3-core-method/src/models/methods/SignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/SignMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../lib/models/AbstractMethodModel'; export default class SignMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -32,22 +31,17 @@ export default class SignMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters, accounts) { - super( - 'eth_sign', - 2, - utils, - formatters - ); + super('eth_sign', 2, utils, formatters); this.accounts = accounts; } /** - * This method will be executed before the RPC request. - * - * @method beforeExecution - * - * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. - */ + * This method will be executed before the RPC request. + * + * @method beforeExecution + * + * @param {AbstractWeb3Module} moduleInstance - The package where the method is called from for example Eth. + */ beforeExecution(moduleInstance) { this.parameters[0] = this.formatters.inputSignFormatter(this.parameters[0]); this.parameters[1] = this.formatters.inputAddressFormatter(this.parameters[1]); diff --git a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js index 5d2d59c15bf..94d1df6e9fb 100644 --- a/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetAccountsMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetAccountsMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_accounts', - 0, - utils, - formatters - ); + super('eth_accounts', 0, utils, formatters); } /** @@ -49,7 +43,7 @@ export default class GetAccountsMethodModel extends AbstractMethodModel { * @returns {Array} */ afterExecution(response) { - return response.map(responseItem => { + return response.map((responseItem) => { return this.utils.toChecksumAddress(responseItem); }); } diff --git a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js index 06b3eb8afd9..7cfa8d9872c 100644 --- a/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js @@ -30,12 +30,7 @@ export default class GetBalanceMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_getBalance', - 2, - utils, - formatters - ); + super('eth_getBalance', 2, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js index 2f6e6f2b700..b149b6b21c2 100644 --- a/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetTransactionCountMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetTransactionCountMethodModel extends AbstractMethodModel * @constructor */ constructor(utils, formatters) { - super( - 'eth_getTransactionCount', - 2, - utils, - formatters - ); + super('eth_getTransactionCount', 2, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js index 747096488ee..c63ad16a85f 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetBlockMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetBlockMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_getBlockByNumber', - 2, - utils, - formatters - ); + super('eth_getBlockByNumber', 2, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js index 7b2c19e908e..b7c5be11189 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js @@ -30,12 +30,7 @@ export default class GetBlockNumberMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_blockNumber', - 0, - utils, - formatters - ); + super('eth_blockNumber', 0, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js index 4c33ed2822d..5b85ef5a3d3 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetBlockTransactionCountMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetBlockTransactionCountMethodModel extends AbstractMethodM * @constructor */ constructor(utils, formatters) { - super( - 'eth_getTransactionByBlockNumberAndIndex', - 1, - utils, - formatters - ); + super('eth_getTransactionByBlockNumberAndIndex', 1, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js index eeae51679d3..151399c92ce 100644 --- a/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetBlockUncleCountMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetBlockUncleCountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_getUncleCountByBlockNumber', - 1, - utils, - formatters - ); + super('eth_getUncleCountByBlockNumber', 1, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js index beb1867310d..68db5c6fe27 100644 --- a/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js +++ b/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetUncleMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetUncleMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_getUncleByBlockNumberAndIndex', - 2, - utils, - formatters - ); + super('eth_getUncleByBlockNumberAndIndex', 2, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js index 7cc37dc0cd8..c0384f2dda2 100644 --- a/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetProtocolVersionMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class GetProtocolVersionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_protocolVersion', - 0, - utils, - formatters - ); + super('eth_protocolVersion', 0, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js index 93e4ccea1ca..6c87160f81b 100644 --- a/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class ListeningMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class ListeningMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'net_listening', - 0, - utils, - formatters - ); + super('net_listening', 0, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js index e0c5944acb5..6eb4a7f640a 100644 --- a/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PeerCountMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class PeerCountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'net_peerCount', - 0, - utils, - formatters - ); + super('net_peerCount', 0, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js index 5c0a489dc43..72ff5aee016 100644 --- a/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class VersionMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class VersionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_protocolVersion', - 0, - utils, - formatters - ); + super('eth_protocolVersion', 0, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js index 9efd47b39d1..fd1d5809180 100644 --- a/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetCoinbaseMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class GetCoinbaseMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_coinbase', - 0, - utils, - formatters - ); + super('eth_coinbase', 0, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js index 309123ca568..1d2a0170fc8 100644 --- a/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js @@ -30,12 +30,7 @@ export default class GetGasPriceMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_gasPrice', - 0, - utils, - formatters - ); + super('eth_gasPrice', 0, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js index ad1f4e40063..6a252e6c3ee 100644 --- a/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetHashrateMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetHashrateMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_hashrate', - 0, - utils, - formatters - ); + super('eth_hashrate', 0, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js index a7f6d4e700b..3234ce4b577 100644 --- a/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetNodeInfoMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class GetNodeInfoMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'web3_clientVersion', - 0, - utils, - formatters - ); + super('web3_clientVersion', 0, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js index bb7a0e3b2d5..bda8ed5fea8 100644 --- a/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetWorkMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class GetWorkMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_getWork', - 0, - utils, - formatters - ); + super('eth_getWork', 0, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js index bb0f9fbf1c5..016051ba180 100644 --- a/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class IsMiningMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class IsMiningMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_mining', - 0, - utils, - formatters - ); + super('eth_mining', 0, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js index e6d3be234da..cf49ea86451 100644 --- a/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class IsSyncingMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class IsSyncingMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_syncing', - 0, - utils, - formatters - ); + super('eth_syncing', 0, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js index 3b7989b83cb..b79de980ace 100644 --- a/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js +++ b/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SubmitWorkMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class SubmitWorkMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_submitWork', - 3, - utils, - formatters - ); + super('eth_submitWork', 3, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js index c1bc27ab1fc..e77d9768d47 100644 --- a/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class EcRecoverMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class EcRecoverMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'personal_ecRecover', - 3, - utils, - formatters - ); + super('personal_ecRecover', 3, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js index 5e34c85872e..a85d42a3219 100644 --- a/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class ImportRawKeyMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class ImportRawKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'personal_importRawKey', - 2, - utils, - formatters - ); + super('personal_importRawKey', 2, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js index 604a55781d3..65971ac88b8 100644 --- a/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class ListAccountsMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class ListAccountsMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'personal_listAccounts', - 0, - utils, - formatters - ); + super('personal_listAccounts', 0, utils, formatters); } /** @@ -49,7 +43,7 @@ export default class ListAccountsMethodModel extends AbstractMethodModel { * @returns {Array} */ afterExecution(response) { - return response.map(responseItem => { + return response.map((responseItem) => { return this.utils.toChecksumAddress(responseItem); }); } diff --git a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js index b81bd8a1166..11d07b7a75e 100644 --- a/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class LockAccountMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class LockAccountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'personal_lockAccount', - 1, - utils, - formatters - ); + super('personal_lockAccount', 1, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js index dc2dffc281d..5e8e94c73b4 100644 --- a/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class NewAccountMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class NewAccountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'personal_newAccount', - 0, - utils, - formatters - ); + super('personal_newAccount', 0, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js index 0b37d8fbdb6..399a561e2a1 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PersonalSendTransactionMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class PersonalSendTransactionMethodModel extends AbstractMethodMo * @constructor */ constructor(utils, formatters) { - super( - 'personal_sendTransaction', - 2, - utils, - formatters - ); + super('personal_sendTransaction', 2, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js index b9668daf6c3..7ce25d0dac8 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PersonalSignMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class PersonalSignMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'personal_sign', - 3, - utils, - formatters - ); + super('personal_sign', 3, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js index fa5bf5c947a..722c02582ab 100644 --- a/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PersonalSignTransactionMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class PersonalSignTransactionMethodModel extends AbstractMethodMo * @constructor */ constructor(utils, formatters) { - super( - 'personal_signTransaction', - 2, - utils, - formatters - ); + super('personal_signTransaction', 2, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js index 796fdf39931..52f4296971e 100644 --- a/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js +++ b/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js @@ -30,12 +30,7 @@ export default class UnlockAccountMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'personal_unlockAccount', - 3, - utils, - formatters - ); + super('personal_unlockAccount', 3, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js index 92f9dd58b40..d1c1f93ba28 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class AddPrivateKeyMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class AddPrivateKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_addPrivateKey', - 1, - utils, - formatters - ); + super('shh_addPrivateKey', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js index 846bd20dbd1..c0365bea397 100644 --- a/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class AddSymKeyMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class AddSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_addSymKey', - 1, - utils, - formatters - ); + super('shh_addSymKey', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js index 6d092701e72..fd7ebe789e0 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class DeleteKeyPairMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class DeleteKeyPairMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_deleteKeyPair', - 1, - utils, - formatters - ); + super('shh_deleteKeyPair', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js index c4262b4f7ea..ed08a893b89 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class DeleteMessageFilterMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class DeleteMessageFilterMethodModel extends AbstractMethodModel * @constructor */ constructor(utils, formatters) { - super( - 'shh_deleteMessageFilter', - 1, - utils, - formatters - ); + super('shh_deleteMessageFilter', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js index 3554a5b661e..191d03f4209 100644 --- a/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class DeleteSymKeyMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class DeleteSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_deleteSymKey', - 1, - utils, - formatters - ); + super('shh_deleteSymKey', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js index 76d63915d2e..97147a7bfcd 100644 --- a/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GenerateSymKeyFromPasswordMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class GenerateSymKeyFromPasswordMethodModel extends AbstractMetho * @constructor */ constructor(utils, formatters) { - super( - 'shh_generateSymKeyFromPassword', - 1, - utils, - formatters - ); + super('shh_generateSymKeyFromPassword', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js index edc7d355122..14158cc8ace 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js @@ -30,11 +30,6 @@ export default class GetFilterMessagesMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_getFilterMessages', - 1, - utils, - formatters - ); + super('shh_getFilterMessages', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js index 26489784488..e0eb616e8fa 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetInfoMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class GetInfoMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_info', - 0, - utils, - formatters - ); + super('shh_info', 0, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js index dc80269059a..b6e02f45028 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetPrivateKeyMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class GetPrivateKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_getPrivateKey', - 1, - utils, - formatters - ); + super('shh_getPrivateKey', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js index fbadfca255e..aec4ab1666e 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetPublicKeyMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class GetPublicKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_getPublicKey', - 1, - utils, - formatters - ); + super('shh_getPublicKey', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js index 916586a701b..b4528068e5e 100644 --- a/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetSymKeyMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class GetSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_getSymKey', - 1, - utils, - formatters - ); + super('shh_getSymKey', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js index e702440f865..a16c149adf4 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class HasKeyPairMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class HasKeyPairMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_hasKeyPair', - 1, - utils, - formatters - ); + super('shh_hasKeyPair', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js index 31160b4f0a5..98a10a476d8 100644 --- a/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class HasSymKeyMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class HasSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_hasSymKey', - 1, - utils, - formatters - ); + super('shh_hasSymKey', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js index c52dccb4b2e..a9037227648 100644 --- a/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class MarkTrustedPeerMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class MarkTrustedPeerMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_markTrustedPeer', - 1, - utils, - formatters - ); + super('shh_markTrustedPeer', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js index 3d845ca235e..26598850ab2 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class NewKeyPairMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class NewKeyPairMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_newKeyPair', - 1, - utils, - formatters - ); + super('shh_newKeyPair', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js index 9b6258a7ffd..f5acc7a3c19 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class NewMessageFilterMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class NewMessageFilterMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_newMessageFilter', - 1, - utils, - formatters - ); + super('shh_newMessageFilter', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js index af132d72a96..f2042f5ed18 100644 --- a/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class NewSymKeyMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class NewSymKeyMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_newSymKey', - 0, - utils, - formatters - ); + super('shh_newSymKey', 0, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js index 34d28681551..198ab241c52 100644 --- a/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class PostMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class PostMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_post', - 1, - utils, - formatters - ); + super('shh_post', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js index 3550f1d26b5..0f6c608db9e 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SetMaxMessageSizeMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class SetMaxMessageSizeMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_setMaxMessageSize', - 1, - utils, - formatters - ); + super('shh_setMaxMessageSize', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js index c8777dff05f..498e726b7f8 100644 --- a/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SetMinPoWMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class SetMinPoWMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_setMinPoW', - 1, - utils, - formatters - ); + super('shh_setMinPoW', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js index ba2df7342e9..b2c25c53894 100644 --- a/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class ShhVersionMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class ShhVersionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'shh_version', - 0, - utils, - formatters - ); + super('shh_version', 0, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js index 9b0cb44ff54..8277c4abbee 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetTransactionFromBlockMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetTransactionFromBlockMethodModel extends AbstractMethodMo * @constructor */ constructor(utils, formatters) { - super( - 'eth_getTransactionByBlockNumberAndIndex', - 2, - utils, - formatters - ); + super('eth_getTransactionByBlockNumberAndIndex', 2, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js index cd25da8fcc0..68c03c41828 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class GetTransactionMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class GetTransactionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_getTransactionByHash', - 1, - utils, - formatters - ); + super('eth_getTransactionByHash', 1, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js index c2889a901ad..64a41499440 100644 --- a/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js @@ -30,12 +30,7 @@ export default class GetTransactionReceiptMethodModel extends AbstractMethodMode * @constructor */ constructor(utils, formatters) { - super( - 'eth_getTransactionReceipt', - 1, - utils, - formatters - ); + super('eth_getTransactionReceipt', 1, utils, formatters); } /** diff --git a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js index e057b2a3a7c..9bd95b99bf1 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SendSignedTransactionMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,11 +30,6 @@ export default class SendSignedTransactionMethodModel extends AbstractMethodMode * @constructor */ constructor(utils, formatters) { - super( - 'eth_sendRawTransaction', - 1, - utils, - formatters - ); + super('eth_sendRawTransaction', 1, utils, formatters); } } diff --git a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js index 9ccc564f3c9..eccac3ba05e 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js @@ -31,12 +31,7 @@ export default class SendTransactionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters, accounts) { - super( - 'eth_sendTransaction', - 1, - utils, - formatters - ); + super('eth_sendTransaction', 1, utils, formatters); this.accounts = accounts; } diff --git a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js index 05db25853bc..a6980462efa 100644 --- a/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js +++ b/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js @@ -23,7 +23,6 @@ import AbstractMethodModel from '../../../../lib/models/AbstractMethodModel'; export default class SignTransactionMethodModel extends AbstractMethodModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,7 @@ export default class SignTransactionMethodModel extends AbstractMethodModel { * @constructor */ constructor(utils, formatters) { - super( - 'eth_signTransaction', - 1, - utils, - formatters - ); + super('eth_signTransaction', 1, utils, formatters); } /** diff --git a/packages/web3-core-method/src/signers/MessageSigner.js b/packages/web3-core-method/src/signers/MessageSigner.js index ab797573520..604cd067a81 100644 --- a/packages/web3-core-method/src/signers/MessageSigner.js +++ b/packages/web3-core-method/src/signers/MessageSigner.js @@ -23,7 +23,6 @@ import AbstractSigner from '../../lib/signers/AbstractSigner'; export default class MessageSigner extends AbstractSigner { - /** * Signs a given message * diff --git a/packages/web3-core-method/src/signers/TransactionSigner.js b/packages/web3-core-method/src/signers/TransactionSigner.js index 5d1b9541d40..da6854c6b23 100644 --- a/packages/web3-core-method/src/signers/TransactionSigner.js +++ b/packages/web3-core-method/src/signers/TransactionSigner.js @@ -23,7 +23,6 @@ import AbstractSigner from '../../lib/signers/AbstractSigner'; export default class TransactionSigner extends AbstractSigner { - /** * Signs the given transaction * diff --git a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js index 3288dec24a1..442fbc35e7a 100644 --- a/packages/web3-core-method/src/validators/TransactionReceiptValidator.js +++ b/packages/web3-core-method/src/validators/TransactionReceiptValidator.js @@ -23,7 +23,6 @@ import {isObject} from 'underscore'; export default class TransactionReceiptValidator { - /** * Validates the receipt * @@ -58,7 +57,7 @@ export default class TransactionReceiptValidator { * @returns {Boolean} */ isValidReceiptStatus(receipt) { - return receipt.status === true || receipt.status === '0x1' || typeof receipt.status === 'undefined' + return receipt.status === true || receipt.status === '0x1' || typeof receipt.status === 'undefined'; } /** diff --git a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js index 8365ed1aaa5..4d7f7ee2d43 100644 --- a/packages/web3-core-method/src/watchers/NewHeadsWatcher.js +++ b/packages/web3-core-method/src/watchers/NewHeadsWatcher.js @@ -24,7 +24,6 @@ import {SocketProviderAdapter} from 'web3-providers'; import EventEmitter from 'eventemitter3'; export default class NewHeadsWatcher extends EventEmitter { - /** * @param {SubscriptionsFactory} subscriptionsFactory * @@ -60,7 +59,7 @@ export default class NewHeadsWatcher extends EventEmitter { this.isPolling = true; this.confirmationInterval = setInterval(() => { - this.emit('newHead') + this.emit('newHead'); }, 1000); return this; diff --git a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js index 9332618a234..0f288a25688 100644 --- a/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js +++ b/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js @@ -23,7 +23,6 @@ import {ContractDeployMethodModel} from 'web3-eth-contract'; export default class TransactionConfirmationWorkflow { - /** * @param {TransactionConfirmationModel} transactionConfirmationModel * @param {TransactionReceiptValidator} transactionReceiptValidator @@ -32,12 +31,7 @@ export default class TransactionConfirmationWorkflow { * * @constructor */ - constructor( - transactionConfirmationModel, - transactionReceiptValidator, - newHeadsWatcher, - formatters - ) { + constructor(transactionConfirmationModel, transactionReceiptValidator, newHeadsWatcher, formatters) { this.transactionConfirmationModel = transactionConfirmationModel; this.transactionReceiptValidator = transactionReceiptValidator; this.newHeadsWatcher = newHeadsWatcher; @@ -57,7 +51,7 @@ export default class TransactionConfirmationWorkflow { * @callback callback callback(error, result) */ execute(methodModel, moduleInstance, transactionHash, promiEvent) { - this.getTransactionReceipt(moduleInstance, transactionHash).then(receipt => { + this.getTransactionReceipt(moduleInstance, transactionHash).then((receipt) => { if (receipt && receipt.blockHash) { const validationResult = this.transactionReceiptValidator.validate(receipt); if (validationResult === true) { @@ -74,8 +68,11 @@ export default class TransactionConfirmationWorkflow { this.newHeadsWatcher.watch(moduleInstance).on('newHead', () => { this.transactionConfirmationModel.timeoutCounter++; if (!this.transactionConfirmationModel.isTimeoutTimeExceeded()) { - this.getTransactionReceipt(transactionHash).then(receipt => { - const validationResult = this.transactionReceiptValidator.validate(receipt, methodModel.parameters); + this.getTransactionReceipt(transactionHash).then((receipt) => { + const validationResult = this.transactionReceiptValidator.validate( + receipt, + methodModel.parameters + ); if (validationResult === true) { this.transactionConfirmationModel.addConfirmation(receipt); @@ -104,10 +101,18 @@ export default class TransactionConfirmationWorkflow { return; } - let error = new Error(`Transaction was not mined within ${this.transactionConfirmationModel.TIMEOUTBLOCK} blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!`); + let error = new Error( + `Transaction was not mined within ${ + this.transactionConfirmationModel.TIMEOUTBLOCK + } blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!` + ); if (this.newHeadsWatcher.isPolling) { - error = new Error(`Transaction was not mined within${this.transactionConfirmationModel.POLLINGTIMEOUT} seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!`) + error = new Error( + `Transaction was not mined within${ + this.transactionConfirmationModel.POLLINGTIMEOUT + } seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!` + ); } this.handleErrorState(error, methodModel, promiEvent); @@ -126,11 +131,9 @@ export default class TransactionConfirmationWorkflow { * @returns {Promise} */ getTransactionReceipt(moduleInstance, transactionHash) { - return moduleInstance.currentProvider - .send('eth_getTransactionReceipt', [transactionHash]) - .then(receipt => { - return this.formatters.outputTransactionReceiptFormatter(receipt); - }); + return moduleInstance.currentProvider.send('eth_getTransactionReceipt', [transactionHash]).then((receipt) => { + return this.formatters.outputTransactionReceiptFormatter(receipt); + }); } /** diff --git a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js index c8c4a165774..ece24f36978 100644 --- a/packages/web3-core-method/tests/commands/CallMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/CallMethodCommandTest.js @@ -8,7 +8,7 @@ import AbstractWeb3Module from 'web3-core'; /** * CallMethodCommand test */ -describe('CallMethodCommandTest', function () { +describe('CallMethodCommandTest', function() { var callMethodCommand, provider, providerMock, @@ -19,7 +19,7 @@ describe('CallMethodCommandTest', function () { methodModelCallbackSpy, methodModelMock; - beforeEach(function () { + beforeEach(function() { provider = new WebsocketProvider('ws://127.0.0.1', {}); providerMock = sinon.mock(provider); @@ -36,11 +36,11 @@ describe('CallMethodCommandTest', function () { callMethodCommand = new CallMethodCommand(); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('calls execute', async function () { + it('calls execute', async function() { methodModelMock .expects('beforeExecution') .withArgs(moduleInstance) @@ -48,11 +48,11 @@ describe('CallMethodCommandTest', function () { providerAdapterMock .expects('send') - .returns(new Promise( - function (resolve) { - resolve('response') - } - )) + .returns( + new Promise(function(resolve) { + resolve('response'); + }) + ) .once(); methodModelMock @@ -71,7 +71,7 @@ describe('CallMethodCommandTest', function () { providerAdapterMock.verify(); }); - it('calls execute and throws error', async function () { + it('calls execute and throws error', async function() { methodModelMock .expects('beforeExecution') .withArgs(moduleInstance) @@ -79,11 +79,11 @@ describe('CallMethodCommandTest', function () { providerAdapterMock .expects('send') - .returns(new Promise( - function (resolve, reject) { - reject('error') - } - )) + .returns( + new Promise(function(resolve, reject) { + reject('error'); + }) + ) .once(); try { diff --git a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js index 8c1f03be28d..895914f001a 100644 --- a/packages/web3-core-method/tests/commands/SendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SendMethodCommandTest.js @@ -12,7 +12,7 @@ var PromiEvent = require('web3-core-promievent').PromiEvent; /** * SendMethodCommand test */ -describe('SendMethodCommandTest', function () { +describe('SendMethodCommandTest', function() { var sendMethodCommand, provider, providerMock, @@ -28,7 +28,7 @@ describe('SendMethodCommandTest', function () { transactionConfirmationWorkflow, transactionConfirmationWorkflowMock; - beforeEach(function () { + beforeEach(function() { provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); providerMock = sinon.mock(provider); @@ -50,11 +50,11 @@ describe('SendMethodCommandTest', function () { sendMethodCommand = new SendMethodCommand(transactionConfirmationWorkflow); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('calls execute with gasPrice defined', function () { + it('calls execute with gasPrice defined', function() { methodModel.parameters = [{gasPrice: 100}]; methodModel.rpcMethod = 'eth_sendTransaction'; @@ -66,11 +66,11 @@ describe('SendMethodCommandTest', function () { providerAdapterMock .expects('send') .withArgs(methodModel.rpcMethod, methodModel.parameters) - .returns(new Promise( - function (resolve) { + .returns( + new Promise(function(resolve) { resolve('response'); - } - )) + }) + ) .once(); transactionConfirmationWorkflowMock @@ -82,14 +82,14 @@ describe('SendMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.on('transactionHash', function () { + promiEvent.on('transactionHash', function() { transactionConfirmationWorkflowMock.verify(); providerAdapterMock.verify(); methodModelMock.verify(); }); }); - it('calls execute without gasPrice defined', function () { + it('calls execute without gasPrice defined', function() { methodModel.parameters = [{}]; methodModel.rpcMethod = 'eth_sendTransaction'; @@ -101,21 +101,21 @@ describe('SendMethodCommandTest', function () { providerAdapterMock .expects('send') .withArgs('eth_gasPrice', []) - .returns(new Promise( - function (resolve) { + .returns( + new Promise(function(resolve) { resolve(100); - } - )) + }) + ) .once(); providerAdapterMock .expects('send') .withArgs(methodModel.rpcMethod, methodModel.parameters) - .returns(new Promise( - function (resolve) { + .returns( + new Promise(function(resolve) { resolve('response'); - } - )) + }) + ) .once(); transactionConfirmationWorkflowMock @@ -127,7 +127,7 @@ describe('SendMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.on('transactionHash', function (response) { + promiEvent.on('transactionHash', function(response) { expect(response).equal('response'); expect(methodModel.parameters[0].gasPrice).equal(100); @@ -137,7 +137,7 @@ describe('SendMethodCommandTest', function () { }); }); - it('calls execute and throws error', function () { + it('calls execute and throws error', function() { methodModel.parameters = [{gasPrice: 100}]; methodModel.rpcMethod = 'eth_sendTransaction'; @@ -149,11 +149,11 @@ describe('SendMethodCommandTest', function () { providerAdapterMock .expects('send') .withArgs(methodModel.rpcMethod, methodModel.parameters) - .returns(new Promise( - function (resolve, reject) { + .returns( + new Promise(function(resolve, reject) { reject('error'); - } - )) + }) + ) .once(); promiEventMock @@ -165,7 +165,7 @@ describe('SendMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.on('error', function (error) { + promiEvent.on('error', function(error) { expect(error).equal('error'); providerAdapterMock.verify(); diff --git a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js index a8ac1b14c7c..a97357764c6 100644 --- a/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js @@ -13,7 +13,7 @@ var PromiEvent = require('web3-core-promievent').PromiEvent; /** * SendAndSignMethodCommand test */ -describe('SendAndSignMethodCommandTest', function () { +describe('SendAndSignMethodCommandTest', function() { var signAndSendMethodCommand, provider, providerMock, @@ -33,7 +33,7 @@ describe('SendAndSignMethodCommandTest', function () { transactionConfirmationWorkflow, transactionConfirmationWorkflowMock; - beforeEach(function () { + beforeEach(function() { provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); providerMock = sinon.mock(provider); @@ -66,11 +66,11 @@ describe('SendAndSignMethodCommandTest', function () { signAndSendMethodCommand = new SignAndSendMethodCommand(transactionConfirmationWorkflow, transactionSigner); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('calls execute', function () { + it('calls execute', function() { methodModel.parameters = []; methodModelMock @@ -81,21 +81,24 @@ describe('SendAndSignMethodCommandTest', function () { transactionSignerMock .expects('sign') .withArgs(methodModel.parameters[0], {}) - .returns(new Promise(function (resolve) { - resolve({ - rawTransaction: '' + .returns( + new Promise(function(resolve) { + resolve({ + rawTransaction: '' + }); }) - })) + ) .once(); providerAdapterMock .expects('send') .withArgs('eth_sendRawTransaction', ['']) - .returns(new Promise( - function (resolve) { + .returns( + new Promise(function(resolve) { resolve('response'); - } - )).once(); + }) + ) + .once(); transactionConfirmationWorkflowMock .expects('execute') @@ -106,7 +109,7 @@ describe('SendAndSignMethodCommandTest', function () { expect(returnedPromiEvent).equal(promiEvent); - promiEvent.then(function () { + promiEvent.then(function() { expect(promiEventEmitSpy.calledOnce).to.be.true; expect(promiEventEmitSpy.calledWith('transactionHash', 'response')).to.be.true; @@ -122,7 +125,7 @@ describe('SendAndSignMethodCommandTest', function () { }); }); - it('calls execute and throws error', function () { + it('calls execute and throws error', function() { methodModel.parameters = [{gasPrice: 100}]; methodModelMock @@ -133,16 +136,18 @@ describe('SendAndSignMethodCommandTest', function () { transactionSignerMock .expects('sign') .withArgs(methodModel.parameters[0], {}) - .returns(new Promise(function (resolve, reject) { - reject('error') - })) + .returns( + new Promise(function(resolve, reject) { + reject('error'); + }) + ) .once(); var returnedPromiEvent = signAndSendMethodCommand.execute(moduleInstance, methodModel, promiEvent, {}); expect(returnedPromiEvent).equal(promiEvent); - promiEvent.catch(function (error) { + promiEvent.catch(function(error) { expect(promiEventRemoveListenersSpy.calledOnce).to.be.true; expect(promiEventEmitSpy.calledOnce).to.be.true; expect(promiEventEmitSpy.calledWith('error', 'error')).to.be.true; diff --git a/packages/web3-core-method/tests/commands/SignMessageCommandTest.js b/packages/web3-core-method/tests/commands/SignMessageCommandTest.js index 85166617cb2..e2adb43a62f 100644 --- a/packages/web3-core-method/tests/commands/SignMessageCommandTest.js +++ b/packages/web3-core-method/tests/commands/SignMessageCommandTest.js @@ -7,15 +7,10 @@ import AbstractMethodModel from '../../lib/models/AbstractMethodModel'; /** * SignMessageCommand test */ -describe('SignMessageCommandTest', function () { - var signMessageCommand, - methodModel, - methodModelCallbackSpy, - methodModelMock, - messageSigner, - messageSignerMock; - - beforeEach(function () { +describe('SignMessageCommandTest', function() { + var signMessageCommand, methodModel, methodModelCallbackSpy, methodModelMock, messageSigner, messageSignerMock; + + beforeEach(function() { methodModel = new AbstractMethodModel('', 0, {}, {}); methodModelCallbackSpy = sinon.spy(); methodModel.callback = methodModelCallbackSpy; @@ -27,11 +22,11 @@ describe('SignMessageCommandTest', function () { signMessageCommand = new SignMessageCommand(messageSigner); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('calls execute and returns signed message', function () { + it('calls execute and returns signed message', function() { methodModel.parameters = ['string', '0x0']; methodModelMock @@ -61,7 +56,7 @@ describe('SignMessageCommandTest', function () { messageSignerMock.verify(); }); - it('calls execute and throws error', function () { + it('calls execute and throws error', function() { methodModel.parameters = ['string', '0x0']; var error = new Error('PANIC'); @@ -78,7 +73,7 @@ describe('SignMessageCommandTest', function () { try { signMessageCommand.execute({}, methodModel, {}); - } catch(error) { + } catch (error) { expect(methodModelCallbackSpy.calledOnce).toBeTruthy(); expect(methodModelCallbackSpy.calledWith(error, null)).toBeTruthy(); expect(error).toBeInstanceOf(Error); @@ -87,6 +82,5 @@ describe('SignMessageCommandTest', function () { methodModelMock.verify(); messageSignerMock.verify(); } - }); }); diff --git a/packages/web3-core-method/tests/controllers/MethodControllerTest.js b/packages/web3-core-method/tests/controllers/MethodControllerTest.js index 1d933c92211..6af2ceb876f 100644 --- a/packages/web3-core-method/tests/controllers/MethodControllerTest.js +++ b/packages/web3-core-method/tests/controllers/MethodControllerTest.js @@ -13,7 +13,7 @@ var MethodController = require('../../src/controllers/MethodController'); /** * MethodController test */ -describe('MethodControllerTest', function () { +describe('MethodControllerTest', function() { var methodController, methodModel, methodModelMock, @@ -27,7 +27,7 @@ describe('MethodControllerTest', function () { signAndSendMethodCommand, signMessageCommand; - beforeEach(function () { + beforeEach(function() { callMethodCommand = new CallMethodCommand(); sendMethodCommand = new SendMethodCommand({}); signAndSendMethodCommand = new SignAndSendMethodCommand({}, {}); @@ -50,11 +50,11 @@ describe('MethodControllerTest', function () { ); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('constructor is setting all the dependencies correctly', function () { + it('constructor is setting all the dependencies correctly', function() { expect(methodController.callMethodCommand).to.be.an.instanceof(CallMethodCommand); expect(methodController.sendMethodCommand).to.be.an.instanceof(SendMethodCommand); expect(methodController.signAndSendMethodCommand).to.be.an.instanceof(SignAndSendMethodCommand); @@ -62,7 +62,7 @@ describe('MethodControllerTest', function () { expect(methodController.promiEventPackage).to.be.an.instanceof(Object); }); - it('execute calls signMessageCommand', function () { + it('execute calls signMessageCommand', function() { var accounts = {wallet: [0]}; methodModelMock @@ -82,7 +82,7 @@ describe('MethodControllerTest', function () { signMessageCommandMock.verify(); }); - it('execute calls signAndSendMethodCommand', function () { + it('execute calls signAndSendMethodCommand', function() { var accounts = {wallet: [0]}; methodModelMock @@ -102,7 +102,7 @@ describe('MethodControllerTest', function () { signAndSendMethodCommandMock.verify(); }); - it('execute calls sendMethodCommand with sendTransaction rpc method', function () { + it('execute calls sendMethodCommand with sendTransaction rpc method', function() { methodModelMock .expects('isSendTransaction') .returns(true) @@ -120,7 +120,7 @@ describe('MethodControllerTest', function () { signAndSendMethodCommandMock.verify(); }); - it('execute calls sendMethodCommand with sendRawTransaction rpc method', function () { + it('execute calls sendMethodCommand with sendRawTransaction rpc method', function() { methodModelMock .expects('isSendTransaction') .returns(false) @@ -143,7 +143,7 @@ describe('MethodControllerTest', function () { signAndSendMethodCommandMock.verify(); }); - it('execute calls callMethodCommand', function () { + it('execute calls callMethodCommand', function() { methodModelMock .expects('isSendTransaction') .returns(false) diff --git a/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js index 4e482ea5b97..6238396afa6 100644 --- a/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js +++ b/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js @@ -17,79 +17,62 @@ var NewHeadsWatcher = require('../../src/watchers/NewHeadsWatcher'); /** * MethodModuleFactory test */ -describe('MethodPackageFactoryTest', function () { +describe('MethodPackageFactoryTest', function() { var methodPackageFactory; - beforeEach(function () { + beforeEach(function() { methodPackageFactory = new MethodPackageFactory(); }); - it('calls createMethodController and should return an instance of MethodController', function () { + it('calls createMethodController and should return an instance of MethodController', function() { expect(methodPackageFactory.createMethodController({}, {}, {})).to.be.an.instanceof(MethodController); }); - it('calls createCallMethodCommand and should return an instance of CallMethodCommand', function () { + it('calls createCallMethodCommand and should return an instance of CallMethodCommand', function() { expect(methodPackageFactory.createCallMethodCommand()).to.be.an.instanceof(CallMethodCommand); }); - it('calls createSendMethodCommand and should return an instance of SendMethodCommand', function () { + it('calls createSendMethodCommand and should return an instance of SendMethodCommand', function() { expect(methodPackageFactory.createSendMethodCommand({}, {})).to.be.an.instanceof(SendMethodCommand); }); - it('calls createSignAndSendMethodCommand and should return an instance of SignAndSendMethodCommand', function () { - expect( - methodPackageFactory.createSignAndSendMethodCommand({}, {}) - ).to.be.an.instanceof( + it('calls createSignAndSendMethodCommand and should return an instance of SignAndSendMethodCommand', function() { + expect(methodPackageFactory.createSignAndSendMethodCommand({}, {})).to.be.an.instanceof( SignAndSendMethodCommand ); }); - it('calls createSignMessageCommand and should return an instance of SignMessageCommand', function () { + it('calls createSignMessageCommand and should return an instance of SignMessageCommand', function() { expect(methodPackageFactory.createSignMessageCommand()).to.be.an.instanceof(SignMessageCommand); }); - it( - 'calls createTransactionConfirmationWorkflow and should return an instance of TransactionConfirmationWorkflow', - function () { - expect( - methodPackageFactory.createTransactionConfirmationWorkflow({}, {}) - ).to.be.an.instanceof( - TransactionConfirmationWorkflow - ); - } - ); + it('calls createTransactionConfirmationWorkflow and should return an instance of TransactionConfirmationWorkflow', function() { + expect(methodPackageFactory.createTransactionConfirmationWorkflow({}, {})).to.be.an.instanceof( + TransactionConfirmationWorkflow + ); + }); - it('calls createTransactionSigner and should return an instance of TransactionSigner', function () { + it('calls createTransactionSigner and should return an instance of TransactionSigner', function() { expect(methodPackageFactory.createTransactionSigner()).to.be.an.instanceof(TransactionSigner); }); - it('calls createMessageSigner and should return an instance of MessageSigner', function () { + it('calls createMessageSigner and should return an instance of MessageSigner', function() { expect(methodPackageFactory.createMessageSigner()).to.be.an.instanceof(MessageSigner); }); - it( - 'calls createTransactionConfirmationModel and should return an instance of TransactionConfirmationModel', - function () { - expect( - methodPackageFactory.createTransactionConfirmationModel() - ).to.be.an.instanceof( - TransactionConfirmationModel - ); - } - ); + it('calls createTransactionConfirmationModel and should return an instance of TransactionConfirmationModel', function() { + expect(methodPackageFactory.createTransactionConfirmationModel()).to.be.an.instanceof( + TransactionConfirmationModel + ); + }); - it( - 'calls createTransactionReceiptValidator and should return an instance of TransactionReceiptValidator', - function () { - expect( - methodPackageFactory.createTransactionReceiptValidator() - ).to.be.an.instanceof( - TransactionReceiptValidator - ); - } - ); + it('calls createTransactionReceiptValidator and should return an instance of TransactionReceiptValidator', function() { + expect(methodPackageFactory.createTransactionReceiptValidator()).to.be.an.instanceof( + TransactionReceiptValidator + ); + }); - it('calls createNewHeadsWatcher and should return an instance of NewHeadsWatcher', function () { + it('calls createNewHeadsWatcher and should return an instance of NewHeadsWatcher', function() { expect(methodPackageFactory.createNewHeadsWatcher({})).to.be.an.instanceof(NewHeadsWatcher); }); }); diff --git a/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js b/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js index cc3d1bf81de..64b51b7afd5 100644 --- a/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js +++ b/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js @@ -1,44 +1,40 @@ var assert = require('chai').assert; var TransactionConfirmationModel = require('../../src/models/TransactionConfirmationModel'); - /** * TransactionConfirmationModel test */ -describe('TransactionConfirmationModel', function () { +describe('TransactionConfirmationModel', function() { var model; - beforeEach(function () { + beforeEach(function() { model = new TransactionConfirmationModel(); }); - it('POLLINGTIMEOUT should return 15 * TIMEOUTBLOCK', function () { + it('POLLINGTIMEOUT should return 15 * TIMEOUTBLOCK', function() { assert.equal(model.POLLINGTIMEOUT, 15 * model.TIMEOUTBLOCK); }); - it('TIMOUTBLOCK should return 50', function () { + it('TIMOUTBLOCK should return 50', function() { assert.equal(model.TIMEOUTBLOCK, 50); }); - it('CONFIRMATIONBLOCKS should return 24', function () { + it('CONFIRMATIONBLOCKS should return 24', function() { assert.equal(model.TIMEOUTBLOCK, 50); }); - it('confirmationsCount should return 0 as the initial value', function () { + it('confirmationsCount should return 0 as the initial value', function() { assert.equal(model.confirmationsCount, 0); }); - it('confirmationsCount should return one more after adding an confirmation', function () { + it('confirmationsCount should return one more after adding an confirmation', function() { assert.equal(model.confirmationsCount, 0); model.addConfirmation({}); assert.equal(model.confirmationsCount, 1); }); - it('addConfirmation should just add the confirmations without changing something', function () { - var confirmations = [ - {test: 'asdf'}, - {test: 'asdf'} - ]; + it('addConfirmation should just add the confirmations without changing something', function() { + var confirmations = [{test: 'asdf'}, {test: 'asdf'}]; model.addConfirmation(confirmations[0]); model.addConfirmation(confirmations[1]); @@ -46,40 +42,59 @@ describe('TransactionConfirmationModel', function () { assert.deepEqual(model.confirmations, confirmations); }); - it('isConfirmed should return true ', function () { + it('isConfirmed should return true ', function() { model.confirmations = [ - {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, - {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, - {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, - {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, + {test: 'asdf'}, {test: 'asdf'} ]; - assert.isTrue(model.isConfirmed()); }); - it('isConfirmed should return false ', function () { + it('isConfirmed should return false ', function() { model.confirmations = [{test: 'asdf'}]; assert.isFalse(model.isConfirmed()); }); - it('isTimeoutTimeExceeded should return true and watcher should not polling', function () { + it('isTimeoutTimeExceeded should return true and watcher should not polling', function() { model.timeoutCounter = 51; assert.isTrue(model.isTimeoutTimeExceeded(false)); }); - it('should return false ', function () { + it('should return false ', function() { model.timeoutCounter = 40; assert.isFalse(model.isTimeoutTimeExceeded(false)); }); - it('isTimeoutTimeExceeded should return true with polling watcher', function () { - model.timeoutCounter = 1 + (15 * model.TIMEOUTBLOCK); + it('isTimeoutTimeExceeded should return true with polling watcher', function() { + model.timeoutCounter = 1 + 15 * model.TIMEOUTBLOCK; assert.isTrue(model.isTimeoutTimeExceeded(true)); }); - it('should return false ', function () { + it('should return false ', function() { model.timeoutCounter = 40; assert.isFalse(model.isTimeoutTimeExceeded(true)); }); diff --git a/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js b/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js index b8d838291af..c17d8fc7389 100644 --- a/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js @@ -8,27 +8,27 @@ var CallMethodModel = require('../../../src/models/methods/CallMethodModel'); /** * CallMethodModel test */ -describe('CallMethodModelTest', function () { +describe('CallMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new CallMethodModel({}, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_call', function () { + it('rpcMethod should return eth_call', function() { expect(model.rpcMethod).to.equal('eth_call'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('beforeExecution should call inputCallFormatter and inputDefaultBlockNumberFormatter', function () { + it('beforeExecution should call inputCallFormatter and inputDefaultBlockNumberFormatter', function() { model.parameters = [{}, 100]; formattersMock @@ -51,7 +51,7 @@ describe('CallMethodModelTest', function () { formattersMock.verify(); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { var object = {}; expect(model.afterExecution(object)).to.equal(object); diff --git a/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js b/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js index db75ce48718..c7e6d791357 100644 --- a/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js @@ -9,28 +9,28 @@ var EstimateGasMethodModel = require('../../../src/models/methods/EstimateGasMet /** * EstimateGasMethodModel test */ -describe('EstimateGasMethodModelTest', function () { +describe('EstimateGasMethodModelTest', function() { var model, formattersMock, utilsMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); utilsMock = sinon.mock(utils); model = new EstimateGasMethodModel(utils, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_estimateGas', function () { + it('rpcMethod should return eth_estimateGas', function() { expect(model.rpcMethod).to.equal('eth_estimateGas'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - it('beforeExecution should call the inputCallFormatter', function () { + it('beforeExecution should call the inputCallFormatter', function() { model.parameters = [{}]; formattersMock @@ -46,7 +46,7 @@ describe('EstimateGasMethodModelTest', function () { formattersMock.verify(); }); - it('afterExecution should call hexToNumber and return the response', function () { + it('afterExecution should call hexToNumber and return the response', function() { utilsMock .expects('hexToNumber') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js index 8b5800e5ad3..bef632665d8 100644 --- a/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js @@ -8,27 +8,27 @@ var GetCodeMethodModel = require('../../../src/models/methods/GetCodeMethodModel /** * GetCodeMethodModel test */ -describe('GetCodeMethodModelTest', function () { +describe('GetCodeMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new GetCodeMethodModel({}, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getCode', function () { + it('rpcMethod should return eth_getCode', function() { expect(model.rpcMethod).to.equal('eth_getCode'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('beforeExecution should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function () { + it('beforeExecution should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function() { model.parameters = ['string', 100]; formattersMock @@ -51,7 +51,7 @@ describe('GetCodeMethodModelTest', function () { formattersMock.verify(); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { var object = {}; expect(model.afterExecution(object)).to.equal(object); diff --git a/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js index f2a555e2c4d..e97a33f5807 100644 --- a/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js @@ -8,27 +8,27 @@ var GetPastLogsMethodModel = require('../../../src/models/methods/GetPastLogsMet /** * GetPastLogsMethodModel test */ -describe('GetPastLogsMethodModelTest', function () { +describe('GetPastLogsMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new GetPastLogsMethodModel({}, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getLogs', function () { + it('rpcMethod should return eth_getLogs', function() { expect(model.rpcMethod).to.equal('eth_getLogs'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - it('beforeExecution should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function () { + it('beforeExecution should call the inputAddressFormatter and inputDefaultBlockNumberFormatter method', function() { model.parameters = [{}]; formattersMock @@ -44,7 +44,7 @@ describe('GetPastLogsMethodModelTest', function () { formattersMock.verify(); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { formattersMock .expects('outputLogFormatter') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js b/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js index f609bfedb81..c61a576f037 100644 --- a/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js @@ -9,31 +9,31 @@ var GetStorageAtMethodModel = require('../../../src/models/methods/GetStorageAtM /** * GetStorageAtMethodModel test */ -describe('GetStorageAtMethodModelTest', function () { +describe('GetStorageAtMethodModelTest', function() { var model, formattersMock, utilsMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); utilsMock = sinon.mock(utils); model = new GetStorageAtMethodModel(utils, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getStorageAt', function () { + it('rpcMethod should return eth_getStorageAt', function() { expect(model.rpcMethod).to.equal('eth_getStorageAt'); }); - it('parametersAmount should return 3', function () { + it('parametersAmount should return 3', function() { expect(model.parametersAmount).to.equal(3); }); it( 'beforeExecution should call the formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter ' + - 'and utils.numberToHex method', - function () { + 'and utils.numberToHex method', + function() { model.parameters = ['string', 100, 100]; formattersMock @@ -64,7 +64,7 @@ describe('GetStorageAtMethodModelTest', function () { } ); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { var object = {}; expect(model.afterExecution(object)).to.equal(object); diff --git a/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js b/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js index c0005906da6..8e1b28d6841 100644 --- a/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js @@ -8,31 +8,31 @@ var SignMethodModel = require('../../../src/models/methods/SignMethodModel'); /** * GetStorageAtMethodModel test */ -describe('SignMethodModelTest', function () { +describe('SignMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new SignMethodModel({}, formatters, {test: true}); }); - afterEach(function () { - sinon.restore(); + afterEach(function() { + sinon.restore(); }); - it('accounts should be defined', function () { + it('accounts should be defined', function() { expect(model.accounts.test).to.be.true; }); - it('rpcMethod should return eth_sign', function () { + it('rpcMethod should return eth_sign', function() { expect(model.rpcMethod).to.equal('eth_sign'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('beforeExecution should call the inputSignFormatter and inputAddressFormatter', function () { + it('beforeExecution should call the inputSignFormatter and inputAddressFormatter', function() { model.parameters = ['string', 'string']; formattersMock @@ -55,7 +55,7 @@ describe('SignMethodModelTest', function () { formattersMock.verify(); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { var object = {}; expect(model.afterExecution(object)).to.equal(object); diff --git a/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js b/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js index f2b89bca4f9..d41a4124d67 100644 --- a/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js @@ -8,34 +8,34 @@ var GetAccountsMethodModel = require('../../../../src/models/methods/account/Get /** * GetAccountsMethodModel test */ -describe('GetAccountsMethodModelTest', function () { +describe('GetAccountsMethodModelTest', function() { var model, utilsMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); model = new GetAccountsMethodModel(utils, {}); }); - afterEach(function () { - sinon.restore(); + afterEach(function() { + sinon.restore(); }); - it('rpcMethod should return eth_accounts', function () { + it('rpcMethod should return eth_accounts', function() { expect(model.rpcMethod).to.equal('eth_accounts'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { utilsMock .expects('toChecksumAddress') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js b/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js index 7558aea129a..5608d14e967 100644 --- a/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js @@ -8,27 +8,27 @@ var GetBalanceMethodModel = require('../../../../src/models/methods/account/GetB /** * GetBalanceMethodModel test */ -describe('GetBalanceMethodModelTest', function () { +describe('GetBalanceMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new GetBalanceMethodModel({}, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getBalance', function () { + it('rpcMethod should return eth_getBalance', function() { expect(model.rpcMethod).to.equal('eth_getBalance'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('beforeExecution should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function () { + it('beforeExecution should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function() { model.parameters = ['string', 100]; formattersMock @@ -51,7 +51,7 @@ describe('GetBalanceMethodModelTest', function () { formattersMock.verify(); }); - it('afterExecution should call outputBigNumberFormatter on the response and return it', function () { + it('afterExecution should call outputBigNumberFormatter on the response and return it', function() { var response = {}; formattersMock diff --git a/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js index 42f284b6f06..44bce0a63fb 100644 --- a/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js @@ -9,28 +9,28 @@ var GetTransactionCountMethodModel = require('../../../../src/models/methods/acc /** * GetTransactionCountMethodModel test */ -describe('GetTransactionCountMethodModelTest', function () { +describe('GetTransactionCountMethodModelTest', function() { var model, formattersMock, utilsMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); utilsMock = sinon.mock(utils); model = new GetTransactionCountMethodModel(utils, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getTransactionCount', function () { + it('rpcMethod should return eth_getTransactionCount', function() { expect(model.rpcMethod).to.equal('eth_getTransactionCount'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('beforeExecution should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function () { + it('beforeExecution should call inputAddressFormatter and inputDefaultBlockNumberFormatter', function() { model.parameters = ['string', 100]; formattersMock @@ -53,7 +53,7 @@ describe('GetTransactionCountMethodModelTest', function () { formattersMock.verify(); }); - it('afterExecution should call hexToNumber on the response and return it', function () { + it('afterExecution should call hexToNumber on the response and return it', function() { utilsMock .expects('hexToNumber') .withArgs('0x0') diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js index f61ccde5d50..f946f25ed4e 100644 --- a/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js @@ -8,27 +8,27 @@ var GetBlockMethodModel = require('../../../../src/models/methods/block/GetBlock /** * GetBlockMethodModel test */ -describe('GetBlockMethodModelTest', function () { +describe('GetBlockMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new GetBlockMethodModel({}, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getBlockByNumber', function () { + it('rpcMethod should return eth_getBlockByNumber', function() { expect(model.rpcMethod).to.equal('eth_getBlockByNumber'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('should call beforeExecution with block hash as parameter and call inputBlockNumberFormatter', function () { + it('should call beforeExecution with block hash as parameter and call inputBlockNumberFormatter', function() { model.parameters = ['0x0', true]; formattersMock @@ -47,7 +47,7 @@ describe('GetBlockMethodModelTest', function () { expect(model.rpcMethod).equal('eth_getBlockByHash'); }); - it('should call beforeExecution with block number as parameter and call inputBlockNumberFormatter', function () { + it('should call beforeExecution with block number as parameter and call inputBlockNumberFormatter', function() { model.parameters = [100, true]; formattersMock @@ -66,7 +66,7 @@ describe('GetBlockMethodModelTest', function () { expect(model.rpcMethod).equal('eth_getBlockByNumber'); }); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { formattersMock .expects('outputBlockFormatter') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js index 1b45c73be96..47fa537d2c6 100644 --- a/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js @@ -8,34 +8,34 @@ var GetBlockNumberMethodModel = require('../../../../src/models/methods/block/Ge /** * GetBlockNumberMethodModel test */ -describe('GetBlockNumberMethodModelTest', function () { +describe('GetBlockNumberMethodModelTest', function() { var model, utilsMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); model = new GetBlockNumberMethodModel(utils, {}); }); - afterEach(function () { - sinon.restore(); + afterEach(function() { + sinon.restore(); }); - it('rpcMethod should return eth_blockNumber', function () { + it('rpcMethod should return eth_blockNumber', function() { expect(model.rpcMethod).to.equal('eth_blockNumber'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should map theresponse', function () { + it('afterExecution should map theresponse', function() { utilsMock .expects('hexToNumber') .withArgs('0x0') diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js index abac97c4b4a..297f1b6a0ff 100644 --- a/packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js @@ -9,28 +9,28 @@ var GetBlockTransactionCountMethodModel = require('../../../../src/models/method /** * GetBlockTransactionCountMethodModel test */ -describe('GetBlockTransactionCountMethodModelTest', function () { +describe('GetBlockTransactionCountMethodModelTest', function() { var model, utilsMock, formattersMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); formattersMock = sinon.mock(formatters); model = new GetBlockTransactionCountMethodModel(utils, formatters); }); afterEach(function() { - sinon.restore(); + sinon.restore(); }); - it('rpcMethod should return eth_getTransactionByBlockNumberAndIndex', function () { + it('rpcMethod should return eth_getTransactionByBlockNumberAndIndex', function() { expect(model.rpcMethod).to.equal('eth_getTransactionByBlockNumberAndIndex'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - it('beforeExecution should call method with block hash as parameter and call inputBlockNumberFormatter', function () { + it('beforeExecution should call method with block hash as parameter and call inputBlockNumberFormatter', function() { model.parameters = ['0x0']; formattersMock @@ -48,8 +48,7 @@ describe('GetBlockTransactionCountMethodModelTest', function () { expect(model.rpcMethod).equal('eth_getTransactionByBlockHashAndIndex'); }); - it('beforeExecution should call method with block number as parameter and call inputBlockNumberFormatter', function () { - + it('beforeExecution should call method with block number as parameter and call inputBlockNumberFormatter', function() { model.parameters = [100]; formattersMock @@ -67,7 +66,7 @@ describe('GetBlockTransactionCountMethodModelTest', function () { expect(model.rpcMethod).equal('eth_getTransactionByBlockNumberAndIndex'); }); - it('afterExecution should map the hex string to a number', function () { + it('afterExecution should map the hex string to a number', function() { utilsMock .expects('hexToNumber') .withArgs('0x0') diff --git a/packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js index 7f89397cf31..8fb9fe93eca 100644 --- a/packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js @@ -9,29 +9,29 @@ var GetBlockUncleCountMethodModel = require('../../../../src/models/methods/bloc /** * GetBlockUncleCountMethodModel test */ -describe('GetBlockUncleCountMethodModelTest', function () { +describe('GetBlockUncleCountMethodModelTest', function() { var model, utilsMock, formattersMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); formattersMock = sinon.mock(formatters); model = new GetBlockUncleCountMethodModel(utils, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getUncleCountByBlockNumber', function () { + it('rpcMethod should return eth_getUncleCountByBlockNumber', function() { expect(model.rpcMethod).to.equal('eth_getUncleCountByBlockNumber'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - it('should call beforeExecution with block hash as parameter and call inputBlockNumberFormatter', function () { + it('should call beforeExecution with block hash as parameter and call inputBlockNumberFormatter', function() { model.parameters = ['0x0']; formattersMock @@ -49,7 +49,7 @@ describe('GetBlockUncleCountMethodModelTest', function () { expect(model.rpcMethod).equal('eth_getUncleCountByBlockHash'); }); - it('should call beforeExecution with block number as parameter and call inputBlockNumberFormatter', function () { + it('should call beforeExecution with block number as parameter and call inputBlockNumberFormatter', function() { model.parameters = [100]; formattersMock @@ -67,7 +67,7 @@ describe('GetBlockUncleCountMethodModelTest', function () { expect(model.rpcMethod).equal('eth_getUncleCountByBlockNumber'); }); - it('afterExecution should map the hex string to a number', function () { + it('afterExecution should map the hex string to a number', function() { utilsMock .expects('hexToNumber') .withArgs('0x0') diff --git a/packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js b/packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js index 50677a655ea..1c2d7a84dea 100644 --- a/packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js @@ -9,28 +9,28 @@ var GetUncleMethodModel = require('../../../../src/models/methods/block/GetUncle /** * GetUncleMethodModel test */ -describe('GetUncleMethodModelTest', function () { +describe('GetUncleMethodModelTest', function() { var model, utilsMock, formattersMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); formattersMock = sinon.mock(formatters); model = new GetUncleMethodModel(utils, formatters); }); - afterEach(function () { - sinon.restore(); + afterEach(function() { + sinon.restore(); }); - it('rpcMethod should return eth_getUncleByBlockNumberAndIndex', function () { + it('rpcMethod should return eth_getUncleByBlockNumberAndIndex', function() { expect(model.rpcMethod).to.equal('eth_getUncleByBlockNumberAndIndex'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('should call beforeExecution with block hash as parameter and call inputBlockNumberFormatter', function () { + it('should call beforeExecution with block hash as parameter and call inputBlockNumberFormatter', function() { model.parameters = ['0x0', 100]; formattersMock @@ -55,7 +55,7 @@ describe('GetUncleMethodModelTest', function () { expect(model.rpcMethod).equal('eth_getUncleByBlockHashAndIndex'); }); - it('should call beforeExecution with block number as parameter and call inputBlockNumberFormatter', function () { + it('should call beforeExecution with block number as parameter and call inputBlockNumberFormatter', function() { model.parameters = [100, 100]; formattersMock @@ -80,7 +80,7 @@ describe('GetUncleMethodModelTest', function () { expect(model.rpcMethod).equal('eth_getUncleByBlockNumberAndIndex'); }); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { formattersMock .expects('outputBlockFormatter') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js index b13ff5e5f24..6b82dc7894a 100644 --- a/packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js @@ -6,29 +6,29 @@ var GetProtocolVersionMethodModel = require('../../../../src/models/methods/netw /** * GetProtocolVersionMethodModel test */ -describe('GetProtocolVersionMethodModelTest', function () { +describe('GetProtocolVersionMethodModelTest', function() { var model; - beforeEach(function () { + beforeEach(function() { model = new GetProtocolVersionMethodModel({}, {}); }); - it('rpcMethod should return eth_protocolVersion', function () { + it('rpcMethod should return eth_protocolVersion', function() { expect(model.rpcMethod).to.equal('eth_protocolVersion'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('version')).equal('version'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js b/packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js index 44faa5d482c..6ae7a703977 100644 --- a/packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js @@ -6,29 +6,29 @@ var ListeningMethodModel = require('../../../../src/models/methods/network/Liste /** * ListeningMethodModel test */ -describe('ListeningMethodModelTest', function () { +describe('ListeningMethodModelTest', function() { var model; - beforeEach(function () { + beforeEach(function() { model = new ListeningMethodModel({}, {}); }); - it('rpcMethod should return net_listening', function () { + it('rpcMethod should return net_listening', function() { expect(model.rpcMethod).to.equal('net_listening'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('version')).equal('version'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js index 49dcd48d923..102392d3692 100644 --- a/packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js @@ -8,34 +8,34 @@ var PeerCountMethodModel = require('../../../../src/models/methods/network/PeerC /** * PeerCountMethodModel test */ -describe('PeerCountMethodModelTest', function () { +describe('PeerCountMethodModelTest', function() { var model, utilsMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); model = new PeerCountMethodModel(utils, {}); }); - afterEach(function () { - sinon.restore(); + afterEach(function() { + sinon.restore(); }); - it('rpcMethod should return net_peerCount', function () { + it('rpcMethod should return net_peerCount', function() { expect(model.rpcMethod).to.equal('net_peerCount'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { utilsMock .expects('hexToNumber') .withArgs('0x0') diff --git a/packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js index e9dd231fc1a..4b905af2dd6 100644 --- a/packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js @@ -8,34 +8,34 @@ var VersionMethodModel = require('../../../../src/models/methods/network/Version /** * VersionMethodModel test */ -describe('VersionMethodModelTest', function () { +describe('VersionMethodModelTest', function() { var model, utilsMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); model = new VersionMethodModel(utils, {}); }); - afterEach(function () { - sinon.restore(); + afterEach(function() { + sinon.restore(); }); - it('rpcMethod should return eth_protocolVersion', function () { + it('rpcMethod should return eth_protocolVersion', function() { expect(model.rpcMethod).to.equal('eth_protocolVersion'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { utilsMock .expects('hexToNumber') .withArgs('0x0') diff --git a/packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js index 76ef06f0059..a2f7958b65d 100644 --- a/packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js @@ -8,34 +8,34 @@ var GetCoinbaseMethodModel = require('../../../../src/models/methods/node/GetCoi /** * GetCoinbaseMethodModel test */ -describe('GetCoinbaseMethodModelTest', function () { +describe('GetCoinbaseMethodModelTest', function() { var model, utilsMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); model = new GetCoinbaseMethodModel(utils, {}); }); - afterEach(function () { - sinon.restore(); + afterEach(function() { + sinon.restore(); }); - it('rpcMethod should return eth_coinbase', function () { + it('rpcMethod should return eth_coinbase', function() { expect(model.rpcMethod).to.equal('eth_coinbase'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('coinbase')).equal('coinbase'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js index bfafeed3abe..23a5257f827 100644 --- a/packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js @@ -8,34 +8,34 @@ var GetGasPriceMethodModel = require('../../../../src/models/methods/node/GetGas /** * GetGasPriceMethodModel test */ -describe('GetGasPriceMethodModelTest', function () { +describe('GetGasPriceMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new GetGasPriceMethodModel({}, formatters); }); - afterEach(function () { - sinon.restore(); + afterEach(function() { + sinon.restore(); }); - it('rpcMethod should return eth_gasPrice', function () { + it('rpcMethod should return eth_gasPrice', function() { expect(model.rpcMethod).to.equal('eth_gasPrice'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { formattersMock .expects('outputBigNumberFormatter') .withArgs('1000') diff --git a/packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js index b543ee9073e..570d124d669 100644 --- a/packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js @@ -8,34 +8,34 @@ var GetHashrateMethodModel = require('../../../../src/models/methods/node/GetHas /** * GetHashrateMethodModel test */ -describe('GetHashrateMethodModelTest', function () { +describe('GetHashrateMethodModelTest', function() { var model, utilsMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); model = new GetHashrateMethodModel(utils, {}); }); - afterEach(function () { - sinon.restore(); + afterEach(function() { + sinon.restore(); }); - it('rpcMethod should return eth_hashrate', function () { + it('rpcMethod should return eth_hashrate', function() { expect(model.rpcMethod).to.equal('eth_hashrate'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { utilsMock .expects('hexToNumber') .withArgs('0x0') @@ -44,6 +44,6 @@ describe('GetHashrateMethodModelTest', function () { expect(model.afterExecution('0x0')).equal(100); - utilsMock.verify() + utilsMock.verify(); }); }); diff --git a/packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js index da9a7b23768..e103a857d9a 100644 --- a/packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js @@ -6,29 +6,29 @@ var GetNodeInfoMethodModel = require('../../../../src/models/methods/node/GetNod /** * GetNodeInfoMethodModel test */ -describe('GetNodeInfoMethodModelTest', function () { +describe('GetNodeInfoMethodModelTest', function() { var model; - beforeEach(function () { + beforeEach(function() { model = new GetNodeInfoMethodModel({}, {}); }); - it('rpcMethod should return web3_clientVersion', function () { + it('rpcMethod should return web3_clientVersion', function() { expect(model.rpcMethod).to.equal('web3_clientVersion'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('version')).equal('version'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js index b28df77195b..dc9454d56df 100644 --- a/packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js @@ -6,29 +6,29 @@ var GetWorkMethodModel = require('../../../../src/models/methods/node/GetWorkMet /** * GetWorkMethodModel test */ -describe('GetWorkMethodModelTest', function () { +describe('GetWorkMethodModelTest', function() { var model; - beforeEach(function () { + beforeEach(function() { model = new GetWorkMethodModel({}, {}); }); - it('rpcMethod should return eth_getWork', function () { + it('rpcMethod should return eth_getWork', function() { expect(model.rpcMethod).to.equal('eth_getWork'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('version')).equal('version'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js index 0142400c602..3aded49969f 100644 --- a/packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js @@ -6,29 +6,29 @@ var IsMiningMethodModel = require('../../../../src/models/methods/node/IsMiningM /** * IsMiningMethodModel test */ -describe('IsMiningMethodModelTest', function () { +describe('IsMiningMethodModelTest', function() { var model; - beforeEach(function () { + beforeEach(function() { model = new IsMiningMethodModel({}, {}); }); - it('rpcMethod should return eth_mining', function () { + it('rpcMethod should return eth_mining', function() { expect(model.rpcMethod).to.equal('eth_mining'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('version')).equal('version'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js index e66c3c8cbff..abfca5267f5 100644 --- a/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js @@ -8,34 +8,34 @@ var IsSyncingMethodModel = require('../../../../src/models/methods/node/IsSyncin /** * IsSyncingMethodModel test */ -describe('IsSyncingMethodModelTest', function () { +describe('IsSyncingMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new IsSyncingMethodModel({}, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_syncing', function () { + it('rpcMethod should return eth_syncing', function() { expect(model.rpcMethod).to.equal('eth_syncing'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { formattersMock .expects('outputSyncingFormatter') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js b/packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js index c7cfb7bf3a4..c09de6f604c 100644 --- a/packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js @@ -6,29 +6,29 @@ var SubmitWorkMethodModel = require('../../../../src/models/methods/node/SubmitW /** * SubmitWorkMethodModel test */ -describe('SubmitWorkMethodModelTest', function () { +describe('SubmitWorkMethodModelTest', function() { var model; - beforeEach(function () { + beforeEach(function() { model = new SubmitWorkMethodModel({}, {}); }); - it('rpcMethod should return eth_submitWork', function () { + it('rpcMethod should return eth_submitWork', function() { expect(model.rpcMethod).to.equal('eth_submitWork'); }); - it('parametersAmount should return 3', function () { + it('parametersAmount should return 3', function() { expect(model.parametersAmount).to.equal(3); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('submitWork')).equal('submitWork'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js index 307a0464057..8a7f1400b8f 100644 --- a/packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js @@ -8,27 +8,27 @@ var EcRecoverMethodModel = require('../../../../src/models/methods/personal/EcRe /** * EcRecoverMethodModel test */ -describe('EcRecoverMethodModelTest', function () { +describe('EcRecoverMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new EcRecoverMethodModel({}, formatters); }); afterEach(function() { - sinon.restore(); + sinon.restore(); }); - it('rpcMethod should return personal_ecRecover', function () { + it('rpcMethod should return personal_ecRecover', function() { expect(model.rpcMethod).to.equal('personal_ecRecover'); }); - it('parametersAmount should return 3', function () { + it('parametersAmount should return 3', function() { expect(model.parametersAmount).to.equal(3); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = [{}, '0x0']; formattersMock @@ -49,10 +49,9 @@ describe('EcRecoverMethodModelTest', function () { expect(model.parameters[1]).equal('0x0'); formattersMock.verify(); - }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('submitWork')).equal('submitWork'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js index 8123e2eb498..3ab4f866ef7 100644 --- a/packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js @@ -6,29 +6,29 @@ var ImportRawKeyMethodModel = require('../../../../src/models/methods/personal/I /** * ImportRawKeyMethodModel test */ -describe('ImportRawKeyMethodModelTest', function () { +describe('ImportRawKeyMethodModelTest', function() { var model; - beforeEach(function () { + beforeEach(function() { model = new ImportRawKeyMethodModel({}, {}); }); - it('rpcMethod should return personal_importRawKey', function () { + it('rpcMethod should return personal_importRawKey', function() { expect(model.rpcMethod).to.equal('personal_importRawKey'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('version')).equal('version'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js index c8ce680f494..f6662f718e0 100644 --- a/packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js @@ -8,34 +8,34 @@ var ListAccountsMethodModel = require('../../../../src/models/methods/personal/L /** * ListAccountsMethodModel test */ -describe('ListAccountsMethodModelTest', function () { +describe('ListAccountsMethodModelTest', function() { var model, utilsMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); model = new ListAccountsMethodModel(utils, {}); }); afterEach(function() { - sinon.restore(); + sinon.restore(); }); - it('rpcMethod should return personal_listAccounts', function () { + it('rpcMethod should return personal_listAccounts', function() { expect(model.rpcMethod).to.equal('personal_listAccounts'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { utilsMock .expects('toChecksumAddress') .withArgs('0x0') diff --git a/packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js index b0f89e66c83..7fbcfb71363 100644 --- a/packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js @@ -8,27 +8,27 @@ var LockAccountMethodModel = require('../../../../src/models/methods/personal/Lo /** * LockAccountMethodModel test */ -describe('LockAccountMethodModelTest', function () { +describe('LockAccountMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new LockAccountMethodModel({}, formatters); }); afterEach(function() { - sinon.restore(); + sinon.restore(); }); - it('rpcMethod should return personal_lockAccount', function () { + it('rpcMethod should return personal_lockAccount', function() { expect(model.rpcMethod).to.equal('personal_lockAccount'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - it('beforeExecution should call inputAddressFormatter', function () { + it('beforeExecution should call inputAddressFormatter', function() { model.parameters = ['0x0']; formattersMock @@ -44,7 +44,7 @@ describe('LockAccountMethodModelTest', function () { expect(model.parameters[0]).equal('0x0'); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('lockAccount')).equal('lockAccount'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js index c21f2f0ccb1..0a0878a7fb3 100644 --- a/packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js @@ -8,34 +8,34 @@ var NewAccountMethodModel = require('../../../../src/models/methods/personal/New /** * NewAccountMethodModel test */ -describe('NewAccountMethodModelTest', function () { +describe('NewAccountMethodModelTest', function() { var model, utilsMock; - beforeEach(function () { + beforeEach(function() { utilsMock = sinon.mock(utils); model = new NewAccountMethodModel(utils, {}); }); afterEach(function() { - sinon.restore(); + sinon.restore(); }); - it('rpcMethod should return personal_newAccount', function () { + it('rpcMethod should return personal_newAccount', function() { expect(model.rpcMethod).to.equal('personal_newAccount'); }); - it('parametersAmount should return 0', function () { + it('parametersAmount should return 0', function() { expect(model.parametersAmount).to.equal(0); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { utilsMock .expects('toChecksumAddress') .withArgs('0x0') diff --git a/packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js index 03d67136139..5f86a05c379 100644 --- a/packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js @@ -8,27 +8,27 @@ var PersonalSendTransactionMethodModel = require('../../../../src/models/methods /** * PersonalSendTransactionMethodModel test */ -describe('PersonalSendTransactionMethodModelTest', function () { +describe('PersonalSendTransactionMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new PersonalSendTransactionMethodModel({}, formatters); }); afterEach(function() { - sinon.restore(); + sinon.restore(); }); - it('rpcMethod should return personal_sendTransaction', function () { + it('rpcMethod should return personal_sendTransaction', function() { expect(model.rpcMethod).to.equal('personal_sendTransaction'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('beforeExecution should call inputTransactionFormatter', function () { + it('beforeExecution should call inputTransactionFormatter', function() { model.parameters = [{}]; formattersMock @@ -44,7 +44,7 @@ describe('PersonalSendTransactionMethodModelTest', function () { expect(model.parameters[0]).to.be.property('send', true); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('personalSend')).equal('personalSend'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js index ae3090d95b2..a63830ecd90 100644 --- a/packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js @@ -8,27 +8,27 @@ var PersonalSignMethodModel = require('../../../../src/models/methods/personal/P /** * PersonalSignMethodModel test */ -describe('PersonalSignMethodModelTest', function () { +describe('PersonalSignMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new PersonalSignMethodModel({}, formatters); }); afterEach(function() { - sinon.restore(); + sinon.restore(); }); - it('rpcMethod should return personal_sign', function () { + it('rpcMethod should return personal_sign', function() { expect(model.rpcMethod).to.equal('personal_sign'); }); - it('parametersAmount should return 3', function () { + it('parametersAmount should return 3', function() { expect(model.parametersAmount).to.equal(3); }); - it('beforeExecution should call inputSignFormatter and inputAddressFormatter', function () { + it('beforeExecution should call inputSignFormatter and inputAddressFormatter', function() { model.parameters = ['sign', '0x0']; formattersMock @@ -51,7 +51,7 @@ describe('PersonalSignMethodModelTest', function () { expect(model.parameters[1]).equal('0x00'); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('personalSign')).equal('personalSign'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js b/packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js index ce5b0b6e913..a6d2d1577f7 100644 --- a/packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js @@ -8,27 +8,27 @@ var UnlockAccountMethodModel = require('../../../../src/models/methods/personal/ /** * UnlockAccountMethodModel test */ -describe('UnlockAccountMethodModelTest', function () { +describe('UnlockAccountMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new UnlockAccountMethodModel({}, formatters); }); afterEach(function() { - sinon.restore(); + sinon.restore(); }); - it('rpcMethod should return personal_unlockAccount', function () { + it('rpcMethod should return personal_unlockAccount', function() { expect(model.rpcMethod).to.equal('personal_unlockAccount'); }); - it('parametersAmount should return 3', function () { + it('parametersAmount should return 3', function() { expect(model.parametersAmount).to.equal(3); }); - it('beforeExecution should call inputSignFormatter and inputAddressFormatter', function () { + it('beforeExecution should call inputSignFormatter and inputAddressFormatter', function() { model.parameters = ['0x0']; formattersMock @@ -44,7 +44,7 @@ describe('UnlockAccountMethodModelTest', function () { expect(model.parameters[0]).equal('0x00'); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('unlockAccount')).equal('unlockAccount'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js b/packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js index 2abc96e7f0d..2ed819682e9 100644 --- a/packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js +++ b/packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js @@ -109,8 +109,8 @@ var tests = [ } ]; -describe('GenericShhMethodModelsTest', function () { - it('all models should have the correct properties set', function () { +describe('GenericShhMethodModelsTest', function() { + it('all models should have the correct properties set', function() { var model, testModel; tests.forEach(function(test) { testModel = require('../../../../src/models/methods/shh/' + test.model); @@ -118,5 +118,5 @@ describe('GenericShhMethodModelsTest', function () { expect(model.rpcMethod).equal(test.rpcMethod); expect(model.parametersAmount).equal(test.parametersAmount); }); - }) + }); }); diff --git a/packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js index 0d880abdf5c..b981bd98ee9 100644 --- a/packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js @@ -9,30 +9,31 @@ var GetTransactionFromBlockMethodModel = require('../../../../src/models/methods /** * GetStorageAtMethodModel test */ -describe('GetStorageAtMethodModelTest', function () { +describe('GetStorageAtMethodModelTest', function() { var model, formattersMock, utilsMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); utilsMock = sinon.mock(utils); model = new GetTransactionFromBlockMethodModel(utils, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getTransactionByBlockNumberAndIndex', function () { + it('rpcMethod should return eth_getTransactionByBlockNumberAndIndex', function() { expect(model.rpcMethod).to.equal('eth_getTransactionByBlockNumberAndIndex'); }); - it('parametersAmount should return 2', function () { + it('parametersAmount should return 2', function() { expect(model.parametersAmount).to.equal(2); }); - it('should call beforeExecution with block hash as parameter ' + - 'and should call formatters.inputBlockNumberFormatter and utils.numberToHex', - function () { + it( + 'should call beforeExecution with block hash as parameter ' + + 'and should call formatters.inputBlockNumberFormatter and utils.numberToHex', + function() { model.parameters = ['0x0', 100]; formattersMock @@ -59,9 +60,10 @@ describe('GetStorageAtMethodModelTest', function () { } ); - it('should call beforeExecution with block number as parameter ' + - 'and should call formatters.inputBlockNumberFormatter and utils.numberToHex', - function () { + it( + 'should call beforeExecution with block number as parameter ' + + 'and should call formatters.inputBlockNumberFormatter and utils.numberToHex', + function() { model.parameters = [100, 100]; formattersMock @@ -88,7 +90,7 @@ describe('GetStorageAtMethodModelTest', function () { } ); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { formattersMock .expects('outputTransactionFormatter') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js index ea73b5fa8e3..b8b23ec2e93 100644 --- a/packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js @@ -8,28 +8,27 @@ var GetTransactionMethodModel = require('../../../../src/models/methods/transact /** * GetTransactionMethodModel test */ -describe('GetTransactionMethodModelTest', function () { +describe('GetTransactionMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new GetTransactionMethodModel({}, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getTransactionByHash', function () { + it('rpcMethod should return eth_getTransactionByHash', function() { expect(model.rpcMethod).to.equal('eth_getTransactionByHash'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); @@ -37,7 +36,7 @@ describe('GetTransactionMethodModelTest', function () { expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { formattersMock .expects('outputTransactionFormatter') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js index 1b56f30d100..60cab94d4a1 100644 --- a/packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js @@ -8,28 +8,27 @@ var GetTransactionReceiptMethodModel = require('../../../../src/models/methods/t /** * GetTransactionReceiptMethodModel test */ -describe('GetTransactionReceiptMethodModelTest', function () { +describe('GetTransactionReceiptMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new GetTransactionReceiptMethodModel({}, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_getTransactionReceipt', function () { + it('rpcMethod should return eth_getTransactionReceipt', function() { expect(model.rpcMethod).to.equal('eth_getTransactionReceipt'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); @@ -37,7 +36,7 @@ describe('GetTransactionReceiptMethodModelTest', function () { expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should map the response', function () { + it('afterExecution should map the response', function() { formattersMock .expects('outputTransactionFormatter') .withArgs({}) diff --git a/packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js index 54ea3bbf640..289ec24357c 100644 --- a/packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js @@ -6,23 +6,22 @@ var SendSignedTransactionMethodModel = require('../../../../src/models/methods/t /** * SendSignedTransactionMethodModel test */ -describe('SendSignedTransactionMethodModelTest', function () { +describe('SendSignedTransactionMethodModelTest', function() { var model; - beforeEach(function () { + beforeEach(function() { model = new SendSignedTransactionMethodModel({}, {}); }); - it('rpcMethod should return eth_sendRawTransaction', function () { + it('rpcMethod should return eth_sendRawTransaction', function() { expect(model.rpcMethod).to.equal('eth_sendRawTransaction'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = []; model.beforeExecution(); @@ -30,7 +29,7 @@ describe('SendSignedTransactionMethodModelTest', function () { expect(model.parameters[0]).equal(undefined); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('sendSignedTransaction')).equal('sendSignedTransaction'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js index b2fc85c96bc..047194191fb 100644 --- a/packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js @@ -8,31 +8,31 @@ var SendTransactionMethodModel = require('../../../../src/models/methods/transac /** * SendTransactionMethodModel test */ -describe('SendTransactionMethodModelTest', function () { +describe('SendTransactionMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new SendTransactionMethodModel({}, formatters, {accounts: true}); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('accounts is set', function () { + it('accounts is set', function() { expect(model.accounts).to.be.property('accounts', true); }); - it('rpcMethod should return eth_sendTransaction', function () { + it('rpcMethod should return eth_sendTransaction', function() { expect(model.rpcMethod).to.equal('eth_sendTransaction'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = [{}]; formattersMock @@ -46,7 +46,7 @@ describe('SendTransactionMethodModelTest', function () { expect(model.parameters[0]).to.be.property('empty', false); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('sendTransaction')).equal('sendTransaction'); }); }); diff --git a/packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js b/packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js index 1f5d1a66431..c48b5fec6f0 100644 --- a/packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js +++ b/packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js @@ -8,27 +8,27 @@ var SignTransactionMethodModel = require('../../../../src/models/methods/transac /** * SendTransactionMethodModel test */ -describe('SendTransactionMethodModelTest', function () { +describe('SendTransactionMethodModelTest', function() { var model, formattersMock; - beforeEach(function () { + beforeEach(function() { formattersMock = sinon.mock(formatters); model = new SignTransactionMethodModel({}, formatters); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('rpcMethod should return eth_signTransaction', function () { + it('rpcMethod should return eth_signTransaction', function() { expect(model.rpcMethod).to.equal('eth_signTransaction'); }); - it('parametersAmount should return 1', function () { + it('parametersAmount should return 1', function() { expect(model.parametersAmount).to.equal(1); }); - it('beforeExecution should do nothing with the parameters', function () { + it('beforeExecution should do nothing with the parameters', function() { model.parameters = [{}]; formattersMock @@ -42,7 +42,7 @@ describe('SendTransactionMethodModelTest', function () { expect(model.parameters[0]).to.be.property('empty', false); }); - it('afterExecution should just return the response', function () { + it('afterExecution should just return the response', function() { expect(model.afterExecution('sendTransaction')).equal('sendTransaction'); }); }); diff --git a/packages/web3-core-method/tests/signers/MessageSignerTest.js b/packages/web3-core-method/tests/signers/MessageSignerTest.js index ce5a6ab2835..769121a26af 100644 --- a/packages/web3-core-method/tests/signers/MessageSignerTest.js +++ b/packages/web3-core-method/tests/signers/MessageSignerTest.js @@ -9,16 +9,10 @@ var MessageSigner = require('../../src/signers/MessageSigner'); /** * MessageSigner test */ -describe('MessageSignerTest', function () { - var messageSigner, - provider, - providerMock, - providerAdapter, - providerAdapterMock, - accounts, - accountsMock; - - beforeEach(function () { +describe('MessageSignerTest', function() { + var messageSigner, provider, providerMock, providerAdapter, providerAdapterMock, accounts, accountsMock; + + beforeEach(function() { provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); providerMock = sinon.mock(provider); @@ -31,19 +25,19 @@ describe('MessageSignerTest', function () { messageSigner = new MessageSigner(); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('calls sign and throws error', function () { + it('calls sign and throws error', function() { try { - messageSigner.sign('string', 0, accounts) + messageSigner.sign('string', 0, accounts); } catch (error) { expect(error.message).equal('Wallet or privateKey in wallet is not set!'); } }); - it('calls sign and returns signed message', function () { + it('calls sign and returns signed message', function() { accounts.wallet[0] = {privateKey: '0x0'}; accountsMock diff --git a/packages/web3-core-method/tests/signers/TransactionSignerTest.js b/packages/web3-core-method/tests/signers/TransactionSignerTest.js index fb14174c597..083cf2c4b8c 100644 --- a/packages/web3-core-method/tests/signers/TransactionSignerTest.js +++ b/packages/web3-core-method/tests/signers/TransactionSignerTest.js @@ -9,16 +9,10 @@ var TransactionSigner = require('../../src/signers/TransactionSigner'); /** * TransactionSigner test */ -describe('TransactionSignerTest', function () { - var transactionSigner, - provider, - providerMock, - providerAdapter, - providerAdapterMock, - accounts, - accountsMock; +describe('TransactionSignerTest', function() { + var transactionSigner, provider, providerMock, providerAdapter, providerAdapterMock, accounts, accountsMock; - beforeEach(function () { + beforeEach(function() { provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); providerMock = sinon.mock(provider); @@ -31,30 +25,30 @@ describe('TransactionSignerTest', function () { transactionSigner = new TransactionSigner(); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('calls sign and throws error', function () { - transactionSigner.sign({from: 0}, accounts).catch(function (error) { + it('calls sign and throws error', function() { + transactionSigner.sign({from: 0}, accounts).catch(function(error) { expect(error.message).equal('Wallet or privateKey in wallet is not set!'); }); }); - it('calls sign and returns signed transaction', async function () { + it('calls sign and returns signed transaction', async function() { accounts.wallet[0] = {privateKey: '0x0'}; var transaction = { - from: 0, + from: 0 }; accountsMock .expects('signTransaction') .withArgs(transaction, '0x0') - .returns(new Promise( - function (resolve) { + .returns( + new Promise(function(resolve) { resolve('0x0'); - } - )) + }) + ) .once(); var returnValue = await transactionSigner.sign(transaction, accounts); diff --git a/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js b/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js index 8a77b5def5f..b70993ace4e 100644 --- a/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js +++ b/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js @@ -6,29 +6,31 @@ var TransactionReceiptValidator = require('../../src/validators/TransactionRecei /** * TransactionReceiptValidator test */ -describe('TransactionReceiptValidatorTest', function () { +describe('TransactionReceiptValidatorTest', function() { var transactionReceiptValidator; - beforeEach(function () { + beforeEach(function() { transactionReceiptValidator = new TransactionReceiptValidator(); }); - it('calls validate and returns true', function () { - expect(transactionReceiptValidator.validate( - { - status: true, - outOfGas: false, - gasUsed: 90 - }, - [ + it('calls validate and returns true', function() { + expect( + transactionReceiptValidator.validate( { - gas: 100 - } - ] - )).to.be.true; + status: true, + outOfGas: false, + gasUsed: 90 + }, + [ + { + gas: 100 + } + ] + ) + ).to.be.true; }); - it('calls validate and returns error because if invalid gasUsage', function () { + it('calls validate and returns error because if invalid gasUsage', function() { var error = transactionReceiptValidator.validate( { status: true, @@ -42,12 +44,11 @@ describe('TransactionReceiptValidatorTest', function () { ] ); - expect(error).to.be.an.instanceof(Error); expect(error.message).to.have.string('Transaction ran out of gas. Please provide more gas:'); }); - it('calls validate and returns error because the EVM has reverted it', function () { + it('calls validate and returns error because the EVM has reverted it', function() { var error = transactionReceiptValidator.validate( { status: false, @@ -61,7 +62,6 @@ describe('TransactionReceiptValidatorTest', function () { ] ); - expect(error).to.be.an.instanceof(Error); expect(error.message).to.have.string('Transaction has been reverted by the EVM:'); }); diff --git a/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js b/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js index 99cbe443f54..de6293f1ac5 100644 --- a/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js +++ b/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js @@ -10,7 +10,7 @@ var NewHeadsWatcher = require('../../src/watchers/NewHeadsWatcher'); /** * NewHeadsWatcher test */ -describe('NewHeadsWatcherTest', function () { +describe('NewHeadsWatcherTest', function() { var newHeadsWatcher, provider, providerMock, @@ -23,14 +23,14 @@ describe('NewHeadsWatcherTest', function () { subscription, subscriptionMock; - beforeEach(function () { + beforeEach(function() { subscriptionsFactory = new SubscriptionsPackage.createSubscriptionsFactory(); subscriptionsFactoryMock = sinon.mock(subscriptionsFactory); newHeadsWatcher = new NewHeadsWatcher(subscriptionsFactory); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); @@ -41,7 +41,7 @@ describe('NewHeadsWatcherTest', function () { expect(newHeadsWatcher.confirmationInterval).to.be.null; }); - it('calls watch and stop with HttpProviderAdapter', function () { + it('calls watch and stop with HttpProviderAdapter', function() { provider = new ProvidersPackage.HttpProvider('http://127.0.0.1', {}); providerMock = sinon.mock(provider); @@ -61,7 +61,7 @@ describe('NewHeadsWatcherTest', function () { expect(newHeadsWatcher.listeners('newHead').length).equal(0); }); - it('calls watch and stop with SocketProviderAdapter', function () { + it('calls watch and stop with SocketProviderAdapter', function() { provider = new ProvidersPackage.WebsocketProvider('ws://127.0.0.1', {}); providerMock = sinon.mock(provider); @@ -79,9 +79,7 @@ describe('NewHeadsWatcherTest', function () { .returns(subscription) .once(); - subscriptionMock - .expects('unsubscribe') - .once(); + subscriptionMock.expects('unsubscribe').once(); subscriptionsFactoryMock .expects('createNewHeadsSubscription') diff --git a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js index 83244aa66e1..ff9b1bee08b 100644 --- a/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js +++ b/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js @@ -15,7 +15,7 @@ var TransactionConfirmationWorkflow = require('../../src/workflows/TransactionCo /** * TransactionConfirmationWorkflow test */ -describe('TransactionConfirmationWorkflowTest', function () { +describe('TransactionConfirmationWorkflowTest', function() { var transactionConfirmationWorkflow, transactionConfirmationModel, transactionConfirmationModelMock, @@ -36,7 +36,7 @@ describe('TransactionConfirmationWorkflowTest', function () { promiEvent, promiEventMock; - beforeEach(function () { + beforeEach(function() { transactionConfirmationModel = new TransactionConfirmationModel(); transactionConfirmationModelMock = sinon.mock(transactionConfirmationModel); @@ -73,19 +73,19 @@ describe('TransactionConfirmationWorkflowTest', function () { ); }); - afterEach(function () { + afterEach(function() { sinon.restore(); }); - it('calls executes and receipt does already exists', function () { + it('calls executes and receipt does already exists', function() { providerAdapterMock .expects('send') .withArgs('eth_getTransactionReceipt', ['0x0']) - .returns(new Promise( - function (resolve) { + .returns( + new Promise(function(resolve) { resolve({}); - } - )) + }) + ) .once(); formattersMock @@ -100,9 +100,7 @@ describe('TransactionConfirmationWorkflowTest', function () { .returns(true) .once(); - newHeadsWatcherMock - .expects('stop') - .once(); + newHeadsWatcherMock.expects('stop').once(); methodModelMock .expects('afterExecution') @@ -110,25 +108,22 @@ describe('TransactionConfirmationWorkflowTest', function () { .returns({blockHash: '0x00'}) .once(); - transactionConfirmationWorkflow.execute( - methodModel, - moduleInstance, - '0x0', - promiEvent - ); - - promiEvent.on('receipt', function (receipt) { - expect(receipt).to.has.an.property('blockHash', '0x00'); - }).then(function (response) { - expect(methodModelCallbackSpy.calledOnce).to.be.true; - expect(methodModelCallbackSpy.calledWith(false, {blockHash: '0x00'})); - expect(response).to.has.an.property('blockHash', '0x00'); - - providerMock.verify(); - formattersMock.verify(); - transactionReceiptValidatorMock.verify(); - newHeadsWatcherMock.verify(); - methodModelMock.verify(); - }); + transactionConfirmationWorkflow.execute(methodModel, moduleInstance, '0x0', promiEvent); + + promiEvent + .on('receipt', function(receipt) { + expect(receipt).to.has.an.property('blockHash', '0x00'); + }) + .then(function(response) { + expect(methodModelCallbackSpy.calledOnce).to.be.true; + expect(methodModelCallbackSpy.calledWith(false, {blockHash: '0x00'})); + expect(response).to.has.an.property('blockHash', '0x00'); + + providerMock.verify(); + formattersMock.verify(); + transactionReceiptValidatorMock.verify(); + newHeadsWatcherMock.verify(); + methodModelMock.verify(); + }); }); }); diff --git a/packages/web3-core-promievent/src/PromiEvent.js b/packages/web3-core-promievent/src/PromiEvent.js index c3e804b7569..a5a08f08c96 100644 --- a/packages/web3-core-promievent/src/PromiEvent.js +++ b/packages/web3-core-promievent/src/PromiEvent.js @@ -23,7 +23,6 @@ import EventEmitter from 'eventemitter3'; export default class PromiEvent { - /** * @constructor */ diff --git a/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js b/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js index ae62c7f03d5..6f3e122a9a9 100644 --- a/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js +++ b/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js @@ -21,7 +21,6 @@ */ export default class AbstractSubscriptionModel { - /** * @param {String} subscriptionType * @param {String} subscriptionMethod @@ -48,7 +47,7 @@ export default class AbstractSubscriptionModel { * @param {AbstractWeb3Module} moduleInstance * @param {Function} callback */ - beforeSubscription(subscription, moduleInstance, callback) { } + beforeSubscription(subscription, moduleInstance, callback) {} /** * This method will be executed on each new subscription item. diff --git a/packages/web3-core-subscriptions/src/Subscription.js b/packages/web3-core-subscriptions/src/Subscription.js index c5bc0c94e06..f0bc8909c9b 100644 --- a/packages/web3-core-subscriptions/src/Subscription.js +++ b/packages/web3-core-subscriptions/src/Subscription.js @@ -24,7 +24,6 @@ import {isArray, isFunction} from 'underscore'; import EventEmitter from 'eventemitter3'; export default class Subscription extends EventEmitter { - /** * @param {AbstractSubscriptionModel} subscriptionModel * @param {AbstractWeb3Module} moduleInstance @@ -51,31 +50,31 @@ export default class Subscription extends EventEmitter { subscribe(callback) { this.subscriptionModel.beforeSubscription(this, this.moduleInstance, callback); - this.moduleInstance.currentProvider.subscribe( - this.subscriptionModel.subscriptionType, - this.subscriptionModel.subscriptionMethod, - [this.subscriptionModel.options] - ).then(subscriptionId => { - this.subscriptionId = subscriptionId; + this.moduleInstance.currentProvider + .subscribe(this.subscriptionModel.subscriptionType, this.subscriptionModel.subscriptionMethod, [ + this.subscriptionModel.options + ]) + .then((subscriptionId) => { + this.subscriptionId = subscriptionId; - this.moduleInstance.currentProvider.on(this.subscriptionId, (error, response) => { - if (!error) { - this.handleSubscriptionResponse(response, callback); + this.moduleInstance.currentProvider.on(this.subscriptionId, (error, response) => { + if (!error) { + this.handleSubscriptionResponse(response, callback); - return; - } + return; + } - if (self.moduleInstance.currentProvider.once) { - this.reconnect(callback); - } + if (self.moduleInstance.currentProvider.once) { + this.reconnect(callback); + } - if (isFunction(callback)) { - callback(error, null); - } + if (isFunction(callback)) { + callback(error, null); + } - this.emit('error', error); + this.emit('error', error); + }); }); - }); return this; } @@ -96,7 +95,7 @@ export default class Subscription extends EventEmitter { response = [response]; } - response.forEach(function (item) { + response.forEach(function(item) { const formattedOutput = this.subscriptionModel.onNewSubscriptionItem(this, item); this.emit('data', formattedOutput); @@ -126,15 +125,17 @@ export default class Subscription extends EventEmitter { this.moduleInstance.currentProvider.once('connect', () => { clearInterval(interval); - this.unsubscribe().then(() => { - this.subscribe(callback); - }).catch(error => { - this.emit('error', error); - - if (isFunction(callback)) { - callback(error, null); - } - }); + this.unsubscribe() + .then(() => { + this.subscribe(callback); + }) + .catch((error) => { + this.emit('error', error); + + if (isFunction(callback)) { + callback(error, null); + } + }); }); } @@ -149,28 +150,27 @@ export default class Subscription extends EventEmitter { * @returns {Promise} */ unsubscribe(callback) { - return this.moduleInstance.currentProvider.unsubscribe( - this.subscriptionId, - this.subscriptionModel.subscriptionType - ).then(response => { - this.removeAllListeners('data'); - this.removeAllListeners('error'); + return this.moduleInstance.currentProvider + .unsubscribe(this.subscriptionId, this.subscriptionModel.subscriptionType) + .then((response) => { + this.removeAllListeners('data'); + this.removeAllListeners('error'); - if (!response) { - this.subscriptionId = null; + if (!response) { + this.subscriptionId = null; - if (isFunction(callback)) { - callback(true, false); - } + if (isFunction(callback)) { + callback(true, false); + } - return true; - } + return true; + } - if (isFunction(callback)) { - callback(false, true); - } + if (isFunction(callback)) { + callback(false, true); + } - return false; - }); + return false; + }); } } diff --git a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js index e4a0914a87c..348c7c8a5b2 100644 --- a/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js +++ b/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js @@ -28,7 +28,6 @@ import SyncingSubscriptionModel from '../models/subscriptions/eth/SyncingSubscri import MessagesSubscriptionModel from '../models/subscriptions/shh/MessagesSubscriptionModel'; export default class SubscriptionsFactory { - /** * @param {Object} utils * @param {Object} formatters @@ -54,13 +53,7 @@ export default class SubscriptionsFactory { */ createLogSubscription(moduleInstance, options, getPastLogsMethodModel, methodController) { return new Subscription( - new LogSubscriptionModel( - options, - this.utils, - this.formatters, - getPastLogsMethodModel, - methodController - ), + new LogSubscriptionModel(options, this.utils, this.formatters, getPastLogsMethodModel, methodController), moduleInstance ); } @@ -75,10 +68,7 @@ export default class SubscriptionsFactory { * @returns {Subscription} */ createNewHeadsSubscription(moduleInstance) { - return new Subscription( - new NewHeadsSubscriptionModel(this.utils, this.formatters), - moduleInstance - ); + return new Subscription(new NewHeadsSubscriptionModel(this.utils, this.formatters), moduleInstance); } /** @@ -107,10 +97,7 @@ export default class SubscriptionsFactory { * @returns {Subscription} */ createSyncingSubscriptionModel(moduleInstance) { - return new Subscription( - new SyncingSubscriptionModel(this.utils, this.formatters), - moduleInstance - ); + return new Subscription(new SyncingSubscriptionModel(this.utils, this.formatters), moduleInstance); } /** @@ -124,9 +111,6 @@ export default class SubscriptionsFactory { * @returns {Subscription} */ createShhMessagesSubscription(moduleInstance, options) { - return new Subscription( - new MessagesSubscriptionModel(options, this.utils, this.formatters), - moduleInstance - ); + return new Subscription(new MessagesSubscriptionModel(options, this.utils, this.formatters), moduleInstance); } } diff --git a/packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js b/packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js index a51fb67829c..79e20763fc1 100644 --- a/packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js +++ b/packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js @@ -23,7 +23,6 @@ import SubscriptionsFactory from './SubscriptionsFactory'; export default class SubscriptionsModuleFactory { - /** * Returns an object of type SubscriptionsFactory * diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js index ee07d2380f9..6948c8ff17c 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js @@ -23,7 +23,6 @@ import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class LogSubscriptionModel extends AbstractSubscriptionModel { - /** * @param {Object} options * @param {Object} utils @@ -34,13 +33,7 @@ export default class LogSubscriptionModel extends AbstractSubscriptionModel { * @constructor */ constructor(options, utils, formatters, getPastLogsMethodModel, methodController) { - super( - 'eth_subscribe', - 'logs', - options, - utils, - formatters - ); + super('eth_subscribe', 'logs', options, utils, formatters); this.getPastLogsMethodModel = getPastLogsMethodModel; this.methodController = methodController; } @@ -59,22 +52,20 @@ export default class LogSubscriptionModel extends AbstractSubscriptionModel { this.options = this.formatters.inputLogFormatter(this.options); this.getPastLogsMethodModel.parameters = [options]; - this.methodController.execute( - this.getPastLogsMethodModel, - moduleInstance.currentProvider, - null, - moduleInstance - ).then(logs => { - logs.forEach(log => { - callback(false, log); - subscription.emit('data', log); - }); + this.methodController + .execute(this.getPastLogsMethodModel, moduleInstance.currentProvider, null, moduleInstance) + .then((logs) => { + logs.forEach((log) => { + callback(false, log); + subscription.emit('data', log); + }); - delete self.options.fromBlock; - }).catch(error => { - subscription.emit('error', error); - callback(error, null); - }); + delete self.options.fromBlock; + }) + .catch((error) => { + subscription.emit('error', error); + callback(error, null); + }); } /** diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js index 08e71ad95fe..3faf4a55eb7 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js @@ -23,7 +23,6 @@ import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class NewHeadsSubscriptionModel extends AbstractSubscriptionModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,13 +30,7 @@ export default class NewHeadsSubscriptionModel extends AbstractSubscriptionModel * @constructor */ constructor(utils, formatters) { - super( - 'eth_subscribe', - 'newHeads', - null, - utils, - formatters - ); + super('eth_subscribe', 'newHeads', null, utils, formatters); } /** diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js index 66b24c40ff8..252f63f84a4 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js @@ -23,7 +23,6 @@ import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class NewPendingTransactionsSubscriptionModel extends AbstractSubscriptionModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,12 +30,6 @@ export default class NewPendingTransactionsSubscriptionModel extends AbstractSub * @constructor */ constructor(utils, formatters) { - super( - 'eth_subscribe', - 'newPendingTransactions', - null, - utils, - formatters - ); + super('eth_subscribe', 'newPendingTransactions', null, utils, formatters); } } diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js index 3e0dc41f201..6bbd000cd76 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js @@ -23,7 +23,6 @@ import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class SyncingSubscriptionModel extends AbstractSubscriptionModel { - /** * @param {Object} utils * @param {Object} formatters @@ -31,13 +30,7 @@ export default class SyncingSubscriptionModel extends AbstractSubscriptionModel * @constructor */ constructor(utils, formatters) { - super( - 'eth_subscribe', - 'syncing', - null, - utils, - formatters - ); + super('eth_subscribe', 'syncing', null, utils, formatters); this.isSyncing = null; } diff --git a/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js b/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js index 21efc4fd8fb..f4c79d74649 100644 --- a/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js +++ b/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js @@ -23,7 +23,6 @@ import AbstractSubscriptionModel from '../../../../lib/models/AbstractSubscriptionModel'; export default class MessagesSubscriptionModel extends AbstractSubscriptionModel { - /** * @param {Object} options * @param {Object} utils @@ -32,12 +31,6 @@ export default class MessagesSubscriptionModel extends AbstractSubscriptionModel * @constructor */ constructor(options, utils, formatters) { - super( - 'shh_subscribe', - 'messages', - options, - utils, - formatters - ); + super('shh_subscribe', 'messages', options, utils, formatters); } } diff --git a/packages/web3-core/src/AbstractWeb3Module.js b/packages/web3-core/src/AbstractWeb3Module.js index 6ffee5f33ab..900e1411fd2 100644 --- a/packages/web3-core/src/AbstractWeb3Module.js +++ b/packages/web3-core/src/AbstractWeb3Module.js @@ -24,7 +24,6 @@ import {isArray, isObject} from 'underscore'; import {AbstractMethodModel} from 'web3-core-method'; export default class AbstractWeb3Module { - /** * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProviderDetector} providerDetector @@ -61,11 +60,9 @@ export default class AbstractWeb3Module { this.methodModelFactory = methodModelFactory; this.extend.formatters = this.methodModelFactory.formatters; - return new Proxy(this, - { - get: this.proxyHandler - } - ); + return new Proxy(this, { + get: this.proxyHandler + }); } } @@ -106,7 +103,7 @@ export default class AbstractWeb3Module { var setExtendedPackagesProvider = true; if (this.extendedPackages.length > 0) { - setExtendedPackagesProvider = this.extendedPackages.every(extendedPackage => { + setExtendedPackagesProvider = this.extendedPackages.every((extendedPackage) => { return extendedPackage.setProvider(provider, net); }); } @@ -144,7 +141,8 @@ export default class AbstractWeb3Module { * @method clearSubscriptions */ clearSubscriptions() { - if (typeof this.currentProvider.clearSubscriptions !== 'undefined' && + if ( + typeof this.currentProvider.clearSubscriptions !== 'undefined' && this.currentProvider.subscriptions.length > 0 ) { this.currentProvider.clearSubscriptions(); @@ -180,7 +178,7 @@ export default class AbstractWeb3Module { } if (extension.methods) { - extension.methods.forEach(method => { + extension.methods.forEach((method) => { class ExtensionMethodModel extends AbstractMethodModel { constructor(utils, formatters) { super(method.call, method.params, utils, formatters); @@ -196,7 +194,7 @@ export default class AbstractWeb3Module { afterExecution(response) { if (isArray(response)) { - response = response.map(responseItem => { + response = response.map((responseItem) => { if (method.outputFormatter && responseItem) { return method.outputFormatter(responseItem); } @@ -243,7 +241,9 @@ export default class AbstractWeb3Module { if (methodModel.parameters.length !== methodModel.parametersAmount) { throw Error( - `Invalid parameters length the expected length would be ${methodModel.parametersAmount} and not ${methodModel.parameters.length}` + `Invalid parameters length the expected length would be ${ + methodModel.parametersAmount + } and not ${methodModel.parameters.length}` ); } diff --git a/packages/web3-eth-abi/src/ABICoder.js b/packages/web3-eth-abi/src/ABICoder.js index b97b254e93d..441bc5f7895 100644 --- a/packages/web3-eth-abi/src/ABICoder.js +++ b/packages/web3-eth-abi/src/ABICoder.js @@ -32,11 +32,9 @@ const ethersAbiCoder = new EthersAbi((type, value) => { }); // result method -function Result() { -} +function Result() {} export default class ABICoder { - /** * @param {Object} utils * @@ -119,16 +117,13 @@ export default class ABICoder { */ mapTypes(types) { const mappedTypes = []; - types.forEach(type => { + types.forEach((type) => { if (this.isSimplifiedStructFormat(type)) { const structName = Object.keys(type)[0]; mappedTypes.push( - Object.assign( - this.mapStructNameAndType(structName), - { - components: this.mapStructToCoderFormat(type[structName]) - } - ) + Object.assign(this.mapStructNameAndType(structName), { + components: this.mapStructToCoderFormat(type[structName]) + }) ); return; @@ -184,15 +179,12 @@ export default class ABICoder { */ mapStructToCoderFormat(struct) { const components = []; - Object.keys(struct).forEach(key => { + Object.keys(struct).forEach((key) => { if (typeof struct[key] === 'object') { components.push( - Object.assign( - this.mapStructNameAndType(key), - { - components: this.mapStructToCoderFormat(struct[key]) - } - ) + Object.assign(this.mapStructNameAndType(key), { + components: this.mapStructToCoderFormat(struct[key]) + }) ); return; @@ -218,7 +210,10 @@ export default class ABICoder { * @returns {String} The encoded ABI for this function call */ encodeFunctionCall(jsonInterface, params) { - return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface.inputs, params).replace('0x', ''); + return ( + this.encodeFunctionSignature(jsonInterface) + + this.encodeParameters(jsonInterface.inputs, params).replace('0x', '') + ); } /** @@ -247,7 +242,7 @@ export default class ABICoder { */ decodeParameters(outputs, bytes) { if (!bytes || bytes === '0x' || bytes === '0X') { - throw new Error('Returned values aren\'t valid, did it run Out of Gas?'); + throw new Error("Returned values aren't valid, did it run Out of Gas?"); } const res = ethersAbiCoder.decode(this.mapTypes(outputs), `0x${bytes.replace(/0x/i, '')}`); @@ -256,7 +251,7 @@ export default class ABICoder { outputs.forEach((output, i) => { let decodedValue = res[returnValue.__length__]; - decodedValue = (decodedValue === '0x') ? null : decodedValue; + decodedValue = decodedValue === '0x' ? null : decodedValue; returnValue[i] = decodedValue; @@ -295,25 +290,25 @@ export default class ABICoder { inputs.forEach((input, i) => { if (input.indexed) { - indexedParams[i] = (['bool', 'int', 'uint', 'address', 'fixed', 'ufixed'].find(staticType => { + indexedParams[i] = ['bool', 'int', 'uint', 'address', 'fixed', 'ufixed'].find((staticType) => { return input.type.indexOf(staticType) !== -1; - })) ? _this.decodeParameter(input.type, topics[topicCount]) : topics[topicCount]; + }) + ? _this.decodeParameter(input.type, topics[topicCount]) + : topics[topicCount]; topicCount++; } else { notIndexedInputs[i] = input; } }); - const nonIndexedData = data; - const notIndexedParams = (nonIndexedData) ? this.decodeParameters(notIndexedInputs, nonIndexedData) : []; + const notIndexedParams = nonIndexedData ? this.decodeParameters(notIndexedInputs, nonIndexedData) : []; const returnValue = new Result(); returnValue.__length__ = 0; - inputs.forEach((res, i) => { - returnValue[i] = (res.type === 'string') ? '' : null; + returnValue[i] = res.type === 'string' ? '' : null; if (typeof notIndexedParams[i] !== 'undefined') { returnValue[i] = notIndexedParams[i]; diff --git a/packages/web3-eth-abi/src/factories/ABIModuleFactory.js b/packages/web3-eth-abi/src/factories/ABIModuleFactory.js index 77f4b57353c..58e51249e89 100644 --- a/packages/web3-eth-abi/src/factories/ABIModuleFactory.js +++ b/packages/web3-eth-abi/src/factories/ABIModuleFactory.js @@ -23,7 +23,6 @@ import ABICoder from '../ABICoder'; export default class ABIModuleFactory { - /** * Returns an object of type ABICoder * diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js index d55f5d1d6bb..f076796119a 100644 --- a/packages/web3-eth-accounts/src/Accounts.js +++ b/packages/web3-eth-accounts/src/Accounts.js @@ -30,29 +30,27 @@ import scryptsy from 'scrypt.js'; import uuid from 'uuid'; import {AbstractWeb3Module} from 'web3-core'; -const cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto'); +const cryp = typeof global === 'undefined' ? require('crypto-browserify') : require('crypto'); -const isNot = value => { - return (isUndefined(value) || isNull(value)); +const isNot = (value) => { + return isUndefined(value) || isNull(value); }; -const trimLeadingZero = hex => { +const trimLeadingZero = (hex) => { while (hex && hex.startsWith('0x0')) { hex = `0x${hex.slice(3)}`; } return hex; }; -const makeEven = hex => { +const makeEven = (hex) => { if (hex.length % 2 === 1) { hex = hex.replace('0x', '0x0'); } return hex; }; - export default class Accounts extends AbstractWeb3Module { - /** * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProviderDetector} providerDetector @@ -116,7 +114,6 @@ export default class Accounts extends AbstractWeb3Module { return _this.encrypt(account.privateKey, password, options); }; - return account; } @@ -163,8 +160,7 @@ export default class Accounts extends AbstractWeb3Module { let error = false; let result; - callback = callback || (() => { - }); + callback = callback || (() => {}); if (!tx) { error = new Error('No transaction object given!'); @@ -174,15 +170,11 @@ export default class Accounts extends AbstractWeb3Module { } function signed(tx) { - if (!tx.gas && !tx.gasLimit) { error = new Error('gas is missing'); } - if (tx.nonce < 0 || - tx.gas < 0 || - tx.gasPrice < 0 || - tx.chainId < 0) { + if (tx.nonce < 0 || tx.gas < 0 || tx.gasPrice < 0 || tx.chainId < 0) { error = new Error('Gas, gasPrice, nonce or chainId is lower than 0'); } @@ -209,14 +201,19 @@ export default class Accounts extends AbstractWeb3Module { transaction.data, Bytes.fromNat(transaction.chainId || '0x1'), '0x', - '0x']); - + '0x' + ]); const hash = Hash.keccak256(rlpEncoded); - const signature = Account.makeSigner(Nat.toNumber(transaction.chainId || '0x1') * 2 + 35)(Hash.keccak256(rlpEncoded), privateKey); + const signature = Account.makeSigner(Nat.toNumber(transaction.chainId || '0x1') * 2 + 35)( + Hash.keccak256(rlpEncoded), + privateKey + ); - const rawTx = RLP.decode(rlpEncoded).slice(0, 6).concat(Account.decodeSignature(signature)); + const rawTx = RLP.decode(rlpEncoded) + .slice(0, 6) + .concat(Account.decodeSignature(signature)); rawTx[6] = makeEven(trimLeadingZero(rawTx[6])); rawTx[7] = makeEven(trimLeadingZero(rawTx[7])); @@ -232,7 +229,6 @@ export default class Accounts extends AbstractWeb3Module { s: trimLeadingZero(values[8]), rawTransaction }; - } catch (e) { callback(e); return Promise.reject(e); @@ -247,15 +243,16 @@ export default class Accounts extends AbstractWeb3Module { return Promise.resolve(signed(tx)); } - // Otherwise, get the missing info from the Ethereum Node return Promise.all([ isNot(tx.chainId) ? _this.getId() : tx.chainId, isNot(tx.gasPrice) ? _this.getGasPrice() : tx.gasPrice, isNot(tx.nonce) ? _this.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce - ]).then(args => { + ]).then((args) => { if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) { - throw new Error(`One of the values 'chainId', 'gasPrice', or 'nonce' couldn't be fetched: ${JSON.stringify(args)}`); + throw new Error( + `One of the values 'chainId', 'gasPrice', or 'nonce' couldn't be fetched: ${JSON.stringify(args)}` + ); } return signed(extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2]})); }); @@ -341,7 +338,6 @@ export default class Accounts extends AbstractWeb3Module { recover(message, signature, preFixed) { const args = [].slice.apply(arguments); - if (isObject(message)) { return this.recover(message.messageHash, Account.encodeSignature([message.v, message.r, message.s]), true); } @@ -379,7 +375,7 @@ export default class Accounts extends AbstractWeb3Module { throw new Error('No password given.'); } - const json = (isObject(v3Keystore)) ? v3Keystore : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore); + const json = isObject(v3Keystore) ? v3Keystore : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore); if (json.version !== 3) { throw new Error('Not a valid V3 wallet'); @@ -391,7 +387,14 @@ export default class Accounts extends AbstractWeb3Module { kdfparams = json.crypto.kdfparams; // FIXME: support progress reporting callback - derivedKey = scryptsy(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen); + derivedKey = scryptsy( + new Buffer(password), + new Buffer(kdfparams.salt, 'hex'), + kdfparams.n, + kdfparams.r, + kdfparams.p, + kdfparams.dklen + ); } else if (json.crypto.kdf === 'pbkdf2') { kdfparams = json.crypto.kdfparams; @@ -399,7 +402,13 @@ export default class Accounts extends AbstractWeb3Module { throw new Error('Unsupported parameters to PBKDF2'); } - derivedKey = cryp.pbkdf2Sync(new Buffer(password), new Buffer(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256'); + derivedKey = cryp.pbkdf2Sync( + new Buffer(password), + new Buffer(kdfparams.salt, 'hex'), + kdfparams.c, + kdfparams.dklen, + 'sha256' + ); } else { throw new Error('Unsupported key derivation scheme'); } @@ -411,7 +420,11 @@ export default class Accounts extends AbstractWeb3Module { throw new Error('Key derivation failed - possibly wrong password'); } - const decipher = cryp.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), new Buffer(json.crypto.cipherparams.iv, 'hex')); + const decipher = cryp.createDecipheriv( + json.crypto.cipher, + derivedKey.slice(0, 16), + new Buffer(json.crypto.cipherparams.iv, 'hex') + ); const seed = `0x${Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('hex')}`; return this.privateKeyToAccount(seed); @@ -462,9 +475,14 @@ export default class Accounts extends AbstractWeb3Module { throw new Error('Unsupported cipher'); } - const ciphertext = Buffer.concat([cipher.update(new Buffer(account.privateKey.replace('0x', ''), 'hex')), cipher.final()]); + const ciphertext = Buffer.concat([ + cipher.update(new Buffer(account.privateKey.replace('0x', ''), 'hex')), + cipher.final() + ]); - const mac = this.utils.sha3(Buffer.concat([derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex')])).replace('0x', ''); + const mac = this.utils + .sha3(Buffer.concat([derivedKey.slice(16, 32), new Buffer(ciphertext, 'hex')])) + .replace('0x', ''); return { version: 3, @@ -528,11 +546,11 @@ class Wallet { _currentIndexes() { const keys = Object.keys(this); const indexes = keys - .map(key => { + .map((key) => { return parseInt(key); }) - .filter(n => { - return (n < 9e20); + .filter((n) => { + return n < 9e20; }); return indexes; @@ -565,7 +583,6 @@ class Wallet { * @returns {Object} */ add(account) { - if (isString(account)) { account = this._accounts.privateKeyToAccount(account); } @@ -627,7 +644,7 @@ class Wallet { const _this = this; const indexes = this._currentIndexes(); - indexes.forEach(index => { + indexes.forEach((index) => { _this.remove(index); }); @@ -648,7 +665,7 @@ class Wallet { const _this = this; const indexes = this._currentIndexes(); - const accounts = indexes.map(index => { + const accounts = indexes.map((index) => { return _this[index].encrypt(password, options); }); @@ -668,13 +685,13 @@ class Wallet { decrypt(encryptedWallet, password) { const _this = this; - encryptedWallet.forEach(keystore => { + encryptedWallet.forEach((keystore) => { const account = _this._accounts.decrypt(keystore, password); if (account) { _this.add(account); } else { - throw new Error('Couldn\'t decrypt accounts. Password wrong?'); + throw new Error("Couldn't decrypt accounts. Password wrong?"); } }); @@ -713,9 +730,7 @@ class Wallet { if (keystore) { try { keystore = JSON.parse(keystore); - } catch (e) { - - } + } catch (e) {} } return this.decrypt(keystore || [], password); diff --git a/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js b/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js index 8d5b122c71e..318e8e5dab4 100644 --- a/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js +++ b/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js @@ -24,7 +24,6 @@ import MethodModelFactory from './MethodModelFactory'; import Accounts from '../Accounts'; export default class AccountsModuleFactory { - /** * @param {Object} utils * @param {Object} formatters diff --git a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js index 1d535aa38fa..2e3fdd4b7b9 100644 --- a/packages/web3-eth-accounts/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-accounts/src/factories/MethodModelFactory.js @@ -28,7 +28,6 @@ import { } from 'web3-core-method'; export default class MethodModelFactory extends AbstractMethodModelFactory { - /** * @param {Object} utils * @param {Object} formatters diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index 4e7aa4280eb..e27626fe372 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -24,7 +24,7 @@ import {MethodController} from 'web3-core-method'; import {ProvidersModuleFactory, providers} from 'web3-providers'; import Utils from 'web3-utils'; import {formatters} from 'web3-core-helpers'; -import AccountsModuleFactory from './factories/AccountsModuleFactory' +import AccountsModuleFactory from './factories/AccountsModuleFactory'; /** * Returns the Accounts object diff --git a/packages/web3-eth-contract/src/Contract.js b/packages/web3-eth-contract/src/Contract.js index 0afdf7da59b..e45ae43670f 100644 --- a/packages/web3-eth-contract/src/Contract.js +++ b/packages/web3-eth-contract/src/Contract.js @@ -23,7 +23,6 @@ import {AbstractWeb3Module} from 'web3-core'; export default class Contract extends AbstractWeb3Module { - /** * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProviderDetector} providerDetector @@ -62,7 +61,6 @@ export default class Contract extends AbstractWeb3Module { address, options ) { - super( provider, providerDetector, @@ -77,8 +75,10 @@ export default class Contract extends AbstractWeb3Module { throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!'); } - if (!abi || !(Array.isArray(abi))) { - throw new Error('You must provide the json interface of the contract when instantiating a contract object.'); + if (!abi || !Array.isArray(abi)) { + throw new Error( + 'You must provide the json interface of the contract when instantiating a contract object.' + ); } this.contractModuleFactory = contractModuleFactory; @@ -99,19 +99,19 @@ export default class Contract extends AbstractWeb3Module { get: () => { return this.abiModel; }, - set: (value) => { + set: (value) => { this.abiModel = this.abiMapper.map(value); this.methods.abiModel = this.abiModel; this.events.abiModel = this.abiModel; }, - enumerable: true + enumerable: true }); Object.defineProperty(this.options, 'address', { get: () => { return this._address; }, - set: (value) => { + set: (value) => { this._address = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(value)); }, enumerable: true @@ -124,11 +124,7 @@ export default class Contract extends AbstractWeb3Module { this.promiEvent ); - this.events = contractModuleFactory.createEventSubscriptionsProxy( - this, - this.abiModel, - this.methodController - ); + this.events = contractModuleFactory.createEventSubscriptionsProxy(this, this.abiModel, this.methodController); } /** @@ -225,11 +221,7 @@ export default class Contract extends AbstractWeb3Module { pastEventLogsMethodModel.parameters = [options]; pastEventLogsMethodModel.callback = callback; - return this.methodController.execute( - pastEventLogsMethodModel, - this.accounts, - this - ); + return this.methodController.execute(pastEventLogsMethodModel, this.accounts, this); } /** @@ -288,9 +280,6 @@ export default class Contract extends AbstractWeb3Module { * @returns {Boolean} */ setProvider(provider, net) { - return !!( - super.setProvider(provider, net) && - this.accounts.setProvider(provider, net) - ); + return !!(super.setProvider(provider, net) && this.accounts.setProvider(provider, net)); } } diff --git a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js index a08cdb8edcf..b3ab346c1b1 100644 --- a/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js @@ -23,7 +23,6 @@ import EventLogDecoder from './EventLogDecoder'; export default class AllEventsLogDecoder extends EventLogDecoder { - /** * @param {ABIModel} abiModel * @param {ABICoder} abiCoder @@ -32,10 +31,7 @@ export default class AllEventsLogDecoder extends EventLogDecoder { * @constructor */ constructor(abiModel, abiCoder, formatters) { - super( - abiCoder, - formatters - ); + super(abiCoder, formatters); this.abiModel = abiModel; } diff --git a/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js index 20f98018294..457e9f20126 100644 --- a/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js +++ b/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js @@ -21,7 +21,6 @@ */ export default class CallMethodResponseDecoder { - /** * @param {ABICoder} abiCoder * diff --git a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js index 662b83d890e..5bdbff7088d 100644 --- a/packages/web3-eth-contract/src/decoders/EventLogDecoder.js +++ b/packages/web3-eth-contract/src/decoders/EventLogDecoder.js @@ -21,7 +21,6 @@ */ class EventLogDecoder { - /** * @param {ABICoder} abiCoder * @param {Object} formatters diff --git a/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js index e9bad4d7c5f..83186e3dc31 100644 --- a/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js +++ b/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js @@ -23,7 +23,6 @@ import EventFilterEncoder from './EventFilterEncoder'; export default class AllEventsFilterEncoder extends EventFilterEncoder { - /** * @param {ABICoder} abiCoder * @@ -45,7 +44,7 @@ export default class AllEventsFilterEncoder extends EventFilterEncoder { const events = abiModel.getEvents(); let topics = []; - Object.keys(events).forEach(key => { + Object.keys(events).forEach((key) => { topics.push(super.encode(events[key], filter)); }); diff --git a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js index 965b547454f..834e2f05f18 100644 --- a/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js +++ b/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js @@ -21,7 +21,6 @@ */ export default class EventFilterEncoder { - /** * @param {ABICoder} abiCoder * @@ -41,14 +40,14 @@ export default class EventFilterEncoder { */ encode(abiItemModel, filter) { const indexedInputs = abiItemModel.getIndexedInputs(); - let topics = []; + let topics = []; - indexedInputs.forEach(indexedInput => { + indexedInputs.forEach((indexedInput) => { if (typeof filter[indexedInput.name] !== 'undefined') { const filterItem = filter[indexedInput.name]; if (_.isArray(filterItem)) { - filterItem.map(item => { + filterItem.map((item) => { return this.abiCoder.encodeParameter(indexedInput.type, item); }); diff --git a/packages/web3-eth-contract/src/encoders/MethodEncoder.js b/packages/web3-eth-contract/src/encoders/MethodEncoder.js index 654a25fcfee..27e4860c20e 100644 --- a/packages/web3-eth-contract/src/encoders/MethodEncoder.js +++ b/packages/web3-eth-contract/src/encoders/MethodEncoder.js @@ -21,7 +21,6 @@ */ export default class MethodEncoder { - /** * @param {ABICoder} abiCoder * @@ -45,10 +44,9 @@ export default class MethodEncoder { let encodedParameters; try { - encodedParameters = this.abiCoder.encodeParameters( - abiItemModel.getInputs(), - abiItemModel.contractMethodParameters - ).replace('0x', ''); + encodedParameters = this.abiCoder + .encodeParameters(abiItemModel.getInputs(), abiItemModel.contractMethodParameters) + .replace('0x', ''); } catch (error) { return error; } diff --git a/packages/web3-eth-contract/src/factories/ContractModuleFactory.js b/packages/web3-eth-contract/src/factories/ContractModuleFactory.js index e06f4dced9a..739dfb718d2 100644 --- a/packages/web3-eth-contract/src/factories/ContractModuleFactory.js +++ b/packages/web3-eth-contract/src/factories/ContractModuleFactory.js @@ -40,7 +40,6 @@ import EventSubscriptionFactory from '../factories/EventSubscriptionFactory'; import Contract from '../Contract'; export default class ContractModuleFactory { - /** * @param {Object} utils * @param {Object} formatters @@ -151,7 +150,7 @@ export default class ContractModuleFactory { * @returns {EventFilterEncoder} */ createEventFilterEncoder() { - return new EventFilterEncoder(this.abiCoder) + return new EventFilterEncoder(this.abiCoder); } /** @@ -162,7 +161,7 @@ export default class ContractModuleFactory { * @returns {AllEventsFilterEncoder} */ createAllEventsFilterEncoder() { - return new AllEventsFilterEncoder(this.abiCoder) + return new AllEventsFilterEncoder(this.abiCoder); } /** @@ -261,12 +260,7 @@ export default class ContractModuleFactory { * @returns {RpcMethodModelFactory} */ createRpcMethodModelFactory() { - return new RpcMethodFactory( - this.createCallMethodResponseDecoder(), - this.accounts, - this.utils, - this.formatters - ); + return new RpcMethodFactory(this.createCallMethodResponseDecoder(), this.accounts, this.utils, this.formatters); } /** @@ -327,10 +321,6 @@ export default class ContractModuleFactory { * @returns {EventSubscriptionFactory} */ createEventSubscriptionFactory(methodController) { - new EventSubscriptionFactory( - this.utils, - this.formatters, - methodController - ); + new EventSubscriptionFactory(this.utils, this.formatters, methodController); } } diff --git a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js index 52afb800e95..c448d8aa426 100644 --- a/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js +++ b/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js @@ -26,7 +26,6 @@ import EventLogSubscription from '../models/subscriptions/EventLogSubscription'; import AllEventsLogSubscription from '../models/subscriptions/AllEventsLogSubscription'; export default class EventSubscriptionFactory { - /** * @param {Object} utils * @param {Object} formatters @@ -49,7 +48,8 @@ export default class EventSubscriptionFactory { * @returns {Subscription} */ createEventLogSubscription(eventLogDecoder, abiItemModel, moduleInstance, options) { - return new Subscription(moduleInstance, + return new Subscription( + moduleInstance, new EventLogSubscription( abiItemModel, options, @@ -72,7 +72,8 @@ export default class EventSubscriptionFactory { * @returns {Subscription} */ createAllEventLogSubscription(allEventsLogDecoder, moduleInstance, options) { - return new Subscription(moduleInstance, + return new Subscription( + moduleInstance, new AllEventsLogSubscription( options, this.utils, diff --git a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js index 83693acc062..c9c88497dcb 100644 --- a/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js +++ b/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js @@ -27,7 +27,6 @@ import SendContractMethodModel from '../models/methods/SendContractMethodModel'; import {EstimateGasMethodModel} from 'web3-core-method'; export default class RpcMethodModelFactory { - /** * @param {CallMethodResponseDecoder} callMethodResponseDecoder * @param {Accounts} accounts @@ -60,7 +59,7 @@ export default class RpcMethodModelFactory { case 'call': rpcMethod = this.createCallContractMethodModel(abiItemModel); break; - case 'send' : + case 'send': rpcMethod = this.createSendContractMethodModel(abiItemModel); break; case 'estimate': @@ -101,12 +100,7 @@ export default class RpcMethodModelFactory { * @returns {CallContractMethodModel} */ createCallContractMethodModel(abiItemModel) { - return new CallContractMethodModel( - abiItemModel, - this.callMethodResponseDecoder, - this.utils, - this.formatters - ); + return new CallContractMethodModel(abiItemModel, this.callMethodResponseDecoder, this.utils, this.formatters); } /** @@ -149,6 +143,6 @@ export default class RpcMethodModelFactory { * @returns {EstimateGasMethodModel} */ createEstimateGasMethodModel() { - return new EstimateGasMethodModel(this.utils, this.formatters) + return new EstimateGasMethodModel(this.utils, this.formatters); } } diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index e73f4fd5a03..4385bc7b970 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -44,12 +44,7 @@ import ContractModuleFactory from './factories/ContractModuleFactory'; export const Contract = (provider, accounts, abi, address, options) => { const providersModuleFactory = new ProvidersModuleFactory(); - return new ContractModuleFactory( - Utils, - formatters, - new ABICoder(), - accounts - ).createContract( + return new ContractModuleFactory(Utils, formatters, new ABICoder(), accounts).createContract( provider, providersModuleFactory.createProviderDetector(), providersModuleFactory.createProviderAdapterResolver(), diff --git a/packages/web3-eth-contract/src/mappers/ABIMapper.js b/packages/web3-eth-contract/src/mappers/ABIMapper.js index 175f96645ca..9781b7adcc1 100644 --- a/packages/web3-eth-contract/src/mappers/ABIMapper.js +++ b/packages/web3-eth-contract/src/mappers/ABIMapper.js @@ -21,7 +21,6 @@ */ export default class ABIMapper { - /** * @param {ContractModuleFactory} contractPackageFactory * @param {ABICoder} abiCoder @@ -49,7 +48,7 @@ export default class ABIMapper { events: {} }; - abi.forEach(abiItem => { + abi.forEach((abiItem) => { abiItem.constant = self.isConstant(abiItem); abiItem.payable = self.isPayable(abiItem); @@ -72,10 +71,7 @@ export default class ABIMapper { if (_.isArray(mappedAbiItems.methods[abiItem.name])) { mappedAbiItems.methods[abiItem.name].push(abiItemModel); } else { - mappedAbiItems.methods[abiItem.name] = [ - mappedAbiItems.methods[abiItem.name], - abiItemModel - ]; + mappedAbiItems.methods[abiItem.name] = [mappedAbiItems.methods[abiItem.name], abiItemModel]; } } @@ -117,7 +113,7 @@ export default class ABIMapper { * @returns {Boolean} */ isConstant(abiItem) { - return (abiItem.stateMutability === "view" || abiItem.stateMutability === "pure" || abiItem.constant); + return abiItem.stateMutability === 'view' || abiItem.stateMutability === 'pure' || abiItem.constant; } /** @@ -130,6 +126,6 @@ export default class ABIMapper { * @returns {Boolean} */ isPayable(abiItem) { - return (abiItem.stateMutability === "payable" || abiItem.payable); + return abiItem.stateMutability === 'payable' || abiItem.payable; } } diff --git a/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js b/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js index 30d95fcf3fe..26ac2f7300c 100644 --- a/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js @@ -21,7 +21,6 @@ */ export default class AllEventsOptionsMapper { - /** * @param {Object} formatters * @param {AllEventsFilterEncoder} allEventsFilterEncoder diff --git a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js index ef460ed7580..acfda365b1a 100644 --- a/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js @@ -21,7 +21,6 @@ */ export default class EventOptionsMapper { - /** * @param {Object} formatters * @param {EventFilterEncoder} eventFilterEncoder diff --git a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js index 86729403cbd..31d1281a0f6 100644 --- a/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js +++ b/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js @@ -21,7 +21,6 @@ */ export default class RpcMethodOptionsMapper { - /** * @param {Object} utils * @param {Object} formatters @@ -49,7 +48,7 @@ export default class RpcMethodOptionsMapper { let from = null; if (options.from) { - from = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(options.from)) + from = this.utils.toChecksumAddress(this.formatters.inputAddressFormatter(options.from)); } options.data = options.data || contract.options.data; diff --git a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js index 64e77ea7259..22a4ac8773e 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIItemModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIItemModel.js @@ -23,7 +23,6 @@ import _ from 'underscore'; export default class ABIItemModel { - /** * @param {Object} abiItem * @@ -50,7 +49,7 @@ export default class ABIItemModel { return 'contract-deployment'; } } - }) + }); } /** @@ -110,7 +109,7 @@ export default class ABIItemModel { * @returns {Array} */ getIndexedInputs() { - return this.getInputs().filter(input => { + return this.getInputs().filter((input) => { return input.indexed === true; }); } diff --git a/packages/web3-eth-contract/src/models/abi/ABIModel.js b/packages/web3-eth-contract/src/models/abi/ABIModel.js index 939d7a7a663..5398f3fec0f 100644 --- a/packages/web3-eth-contract/src/models/abi/ABIModel.js +++ b/packages/web3-eth-contract/src/models/abi/ABIModel.js @@ -21,7 +21,6 @@ */ export default class ABIModel { - /** * @param {Object} mappedAbi * @@ -86,7 +85,7 @@ export default class ABIModel { * @returns {ABIItemModel} */ getEventBySignature(signature) { - return this.abi.events.find(event => { + return this.abi.events.find((event) => { return event.signature === signature; }); } diff --git a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js index cc6b069584c..dadfa82d981 100644 --- a/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js @@ -23,7 +23,6 @@ import {CallMethodModel} from 'web3-core-method'; export default class CallContractMethodModel extends CallMethodModel { - /** * @param {ABIItemModel} abiItemModel * @param {CallMethodResponseDecoder} callMethodResponseDecoder @@ -33,10 +32,7 @@ export default class CallContractMethodModel extends CallMethodModel { * @constructor */ constructor(abiItemModel, callMethodResponseDecoder, utils, formatters) { - super( - utils, - formatters - ); + super(utils, formatters); this.callMethodResponseDecoder = callMethodResponseDecoder; this.abiItemModel = abiItemModel; diff --git a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js index c97e983ddbb..fb59bf0a198 100644 --- a/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js @@ -23,7 +23,6 @@ import {SendTransactionMethodModel} from 'web3-core-method'; export default class ContractDeployMethodModel extends SendTransactionMethodModel { - /** * @param {Contract} contract * @param {Object} utils @@ -33,11 +32,7 @@ export default class ContractDeployMethodModel extends SendTransactionMethodMode * @constructor */ constructor(contract, utils, formatters, accounts) { - super( - utils, - formatters, - accounts - ); + super(utils, formatters, accounts); this.contract = contract; } diff --git a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js index 599e9141f7d..aaa02ece3f0 100644 --- a/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js @@ -23,7 +23,6 @@ import {GetPastLogsMethodModel} from 'web3-core-method'; export default class PastEventLogsMethodModel extends GetPastLogsMethodModel { - /** * @param {ABIItemModel} abiItemModel * @param {Object} utils @@ -32,10 +31,7 @@ export default class PastEventLogsMethodModel extends GetPastLogsMethodModel { * @constructor */ constructor(abiItemModel, utils, formatters) { - super( - utils, - formatters - ); + super(utils, formatters); this.abiItemModel = abiItemModel; } @@ -52,7 +48,7 @@ export default class PastEventLogsMethodModel extends GetPastLogsMethodModel { afterExecution(response) { const formattedLogs = super.afterExecution(response); - formattedLogs.map(logItem => { + formattedLogs.map((logItem) => { return this.eventLogDecoder.decode(self.abiItemModel, logItem); }); diff --git a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js index 7d58fac102e..b34800bd066 100644 --- a/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js +++ b/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js @@ -24,7 +24,6 @@ import _ from 'underscore'; import {SendTransactionMethodModel} from 'web3-core-method'; export default class SendContractMethodModel extends SendTransactionMethodModel { - /** * @param {ABIItemModel} abiItemModel * @param {AllEventsLogDecoder} allEventsLogDecoder @@ -35,11 +34,7 @@ export default class SendContractMethodModel extends SendTransactionMethodModel * @constructor */ constructor(abiItemModel, allEventsLogDecoder, utils, formatters, accounts) { - super( - utils, - formatters, - accounts - ); + super(utils, formatters, accounts); this.abiItemModel = abiItemModel; this.allEventsLogDecoder = allEventsLogDecoder; @@ -58,7 +53,7 @@ export default class SendContractMethodModel extends SendTransactionMethodModel if (_.isArray(response.logs)) { response.events = {}; - response.logs.map(function (log) { + response.logs.map(function(log) { return this.allEventsLogDecoder.decode(null, log); }); diff --git a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js index a51a1c1c644..7cd996c02f6 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js @@ -23,7 +23,6 @@ import {LogSubscriptionModel} from 'web3-core-subscriptions'; export default class AllEventsLogSubscription extends LogSubscriptionModel { - /** * @param {Object} options * @param {Object} utils @@ -34,21 +33,8 @@ export default class AllEventsLogSubscription extends LogSubscriptionModel { * * @constructor */ - constructor( - options, - utils, - formatters, - getPastLogsMethodModel, - methodController, - allEventsLogDecoder - ) { - super( - options, - utils, - formatters, - getPastLogsMethodModel, - methodController - ); + constructor(options, utils, formatters, getPastLogsMethodModel, methodController, allEventsLogDecoder) { + super(options, utils, formatters, getPastLogsMethodModel, methodController); this.allEventsLogDecoder = allEventsLogDecoder; } diff --git a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js index 5c7e55cfb6b..830131ac4d1 100644 --- a/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js +++ b/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js @@ -23,7 +23,6 @@ import {LogSubscriptionModel} from 'web3-core-subscriptions'; export default class EventLogSubscription extends LogSubscriptionModel { - /** * @param {ABIItemModel} abiItemModel * @param {Object} options @@ -35,22 +34,8 @@ export default class EventLogSubscription extends LogSubscriptionModel { * * @constructor */ - constructor( - abiItemModel, - options, - utils, - formatters, - getPastLogsMethodModel, - methodController, - eventLogDecoder - ) { - super( - options, - utils, - formatters, - getPastLogsMethodModel, - methodController - ); + constructor(abiItemModel, options, utils, formatters, getPastLogsMethodModel, methodController, eventLogDecoder) { + super(options, utils, formatters, getPastLogsMethodModel, methodController); this.eventLogDecoder = eventLogDecoder; this.abiItemModel = abiItemModel; diff --git a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js index 88b23c4ee88..39bf157d134 100644 --- a/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js +++ b/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js @@ -21,7 +21,6 @@ */ export default class EventSubscriptionsProxy { - /** * @param {Contract} contract * @param {ABIModel} abiModel @@ -102,12 +101,14 @@ export default class EventSubscriptionsProxy { ); } - return this.eventSubscriptionFactory.createEventLogSubscription( - this.eventLogDecoder, - abiItemModel, - this.contract, - this.eventOptionsMapper.map(abiItemModel, this.contract, options) - ).subscribe(callback); + return this.eventSubscriptionFactory + .createEventLogSubscription( + this.eventLogDecoder, + abiItemModel, + this.contract, + this.eventOptionsMapper.map(abiItemModel, this.contract, options) + ) + .subscribe(callback); } /** @@ -128,11 +129,13 @@ export default class EventSubscriptionsProxy { ); } - return this.eventSubscriptionFactory.createAllEventLogSubscription( - this.allEventsLogDecoder, - this.contract, - this.allEventsOptionsMapper.map(this.abiModel, this.contract, options) - ).subscribe(callback); + return this.eventSubscriptionFactory + .createAllEventLogSubscription( + this.allEventsLogDecoder, + this.contract, + this.allEventsOptionsMapper.map(this.abiModel, this.contract, options) + ) + .subscribe(callback); } /** diff --git a/packages/web3-eth-contract/src/proxies/MethodsProxy.js b/packages/web3-eth-contract/src/proxies/MethodsProxy.js index c580d967db6..aebb90ae72f 100644 --- a/packages/web3-eth-contract/src/proxies/MethodsProxy.js +++ b/packages/web3-eth-contract/src/proxies/MethodsProxy.js @@ -21,7 +21,6 @@ */ export default class MethodsProxy { - /** * @param {Contract} contract * @param {ABIModel} abiModel @@ -138,11 +137,7 @@ export default class MethodsProxy { return this.handleValidationError(rpcMethodModel.error, rpcMethodModel.callback); } - return this.methodController.execute( - rpcMethodModel, - this.contract.accounts, - this.contract - ); + return this.methodController.execute(rpcMethodModel, this.contract.accounts, this.contract); } /** @@ -162,7 +157,7 @@ export default class MethodsProxy { let isContractMethodParametersLengthValid = false; // Check if one of the AbiItemModel in this array does match the arguments length - abiItemModel.some(method => { + abiItemModel.some((method) => { // Get correct rpc method model rpcMethodModel = this.rpcMethodModelFactory.createRpcMethodByRequestType(method, this.contract); rpcMethodModel.methodArguments = methodArguments; @@ -184,7 +179,6 @@ export default class MethodsProxy { rpcMethodModel.methodArguments = methodArguments; } - // Validate contract method parameters length const contractMethodParametersLengthIsValid = abiItemModel.givenParametersLengthIsValid(); if (contractMethodParametersLengthIsValid instanceof Error) { diff --git a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js index c914cc18a54..f19b44b4aa1 100644 --- a/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js +++ b/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js @@ -21,7 +21,6 @@ */ export default class RpcMethodOptionsValidator { - /** * @param {Object} utils * @@ -43,7 +42,7 @@ export default class RpcMethodOptionsValidator { */ validate(abiItemModel, rpcMethodModel) { if (this.isToSet(abiItemModel, rpcMethodModel)) { - return new Error('This contract object doesn\'t have address set yet, please set an address first.'); + return new Error("This contract object doesn't have address set yet, please set an address first."); } if (this.isFromSet(rpcMethodModel)) { @@ -51,7 +50,7 @@ export default class RpcMethodOptionsValidator { } if (this.isValueValid(abiItemModel, rpcMethodModel)) { - return new Error('Can not send value to non-payable contract method or constructor') + return new Error('Can not send value to non-payable contract method or constructor'); } return true; diff --git a/packages/web3-eth-ens/ressources/ABI/Registry.js b/packages/web3-eth-ens/ressources/ABI/Registry.js index 5524362483e..50df3869364 100644 --- a/packages/web3-eth-ens/ressources/ABI/Registry.js +++ b/packages/web3-eth-ens/ressources/ABI/Registry.js @@ -1,204 +1,204 @@ -"use strict"; +'use strict'; var REGISTRY = [ { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' } ], - "name": "resolver", - "outputs": [ + name: 'resolver', + outputs: [ { - "name": "", - "type": "address" + name: '', + type: 'address' } ], - "payable": false, - "type": "function" + payable: false, + type: 'function' }, { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' } ], - "name": "owner", - "outputs": [ + name: 'owner', + outputs: [ { - "name": "", - "type": "address" + name: '', + type: 'address' } ], - "payable": false, - "type": "function" + payable: false, + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "label", - "type": "bytes32" + name: 'label', + type: 'bytes32' }, { - "name": "owner", - "type": "address" + name: 'owner', + type: 'address' } ], - "name": "setSubnodeOwner", - "outputs": [], - "payable": false, - "type": "function" + name: 'setSubnodeOwner', + outputs: [], + payable: false, + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "ttl", - "type": "uint64" + name: 'ttl', + type: 'uint64' } ], - "name": "setTTL", - "outputs": [], - "payable": false, - "type": "function" + name: 'setTTL', + outputs: [], + payable: false, + type: 'function' }, { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' } ], - "name": "ttl", - "outputs": [ + name: 'ttl', + outputs: [ { - "name": "", - "type": "uint64" + name: '', + type: 'uint64' } ], - "payable": false, - "type": "function" + payable: false, + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "resolver", - "type": "address" + name: 'resolver', + type: 'address' } ], - "name": "setResolver", - "outputs": [], - "payable": false, - "type": "function" + name: 'setResolver', + outputs: [], + payable: false, + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "owner", - "type": "address" + name: 'owner', + type: 'address' } ], - "name": "setOwner", - "outputs": [], - "payable": false, - "type": "function" + name: 'setOwner', + outputs: [], + payable: false, + type: 'function' }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "name": "node", - "type": "bytes32" + indexed: true, + name: 'node', + type: 'bytes32' }, { - "indexed": false, - "name": "owner", - "type": "address" + indexed: false, + name: 'owner', + type: 'address' } ], - "name": "Transfer", - "type": "event" + name: 'Transfer', + type: 'event' }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "name": "node", - "type": "bytes32" + indexed: true, + name: 'node', + type: 'bytes32' }, { - "indexed": true, - "name": "label", - "type": "bytes32" + indexed: true, + name: 'label', + type: 'bytes32' }, { - "indexed": false, - "name": "owner", - "type": "address" + indexed: false, + name: 'owner', + type: 'address' } ], - "name": "NewOwner", - "type": "event" + name: 'NewOwner', + type: 'event' }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "name": "node", - "type": "bytes32" + indexed: true, + name: 'node', + type: 'bytes32' }, { - "indexed": false, - "name": "resolver", - "type": "address" + indexed: false, + name: 'resolver', + type: 'address' } ], - "name": "NewResolver", - "type": "event" + name: 'NewResolver', + type: 'event' }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "name": "node", - "type": "bytes32" + indexed: true, + name: 'node', + type: 'bytes32' }, { - "indexed": false, - "name": "ttl", - "type": "uint64" + indexed: false, + name: 'ttl', + type: 'uint64' } ], - "name": "NewTTL", - "type": "event" + name: 'NewTTL', + type: 'event' } ]; diff --git a/packages/web3-eth-ens/ressources/ABI/Resolver.js b/packages/web3-eth-ens/ressources/ABI/Resolver.js index 9bd8da24603..c007d1676ac 100644 --- a/packages/web3-eth-ens/ressources/ABI/Resolver.js +++ b/packages/web3-eth-ens/ressources/ABI/Resolver.js @@ -1,355 +1,355 @@ -"use strict"; +'use strict'; var RESOLVER = [ { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "interfaceID", - "type": "bytes4" + name: 'interfaceID', + type: 'bytes4' } ], - "name": "supportsInterface", - "outputs": [ + name: 'supportsInterface', + outputs: [ { - "name": "", - "type": "bool" + name: '', + type: 'bool' } ], - "payable": false, - "type": "function" + payable: false, + type: 'function' }, { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "contentTypes", - "type": "uint256" + name: 'contentTypes', + type: 'uint256' } ], - "name": "ABI", - "outputs": [ + name: 'ABI', + outputs: [ { - "name": "contentType", - "type": "uint256" + name: 'contentType', + type: 'uint256' }, { - "name": "data", - "type": "bytes" + name: 'data', + type: 'bytes' } ], - "payable": false, - "type": "function" + payable: false, + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "hash", - "type": "bytes" + name: 'hash', + type: 'bytes' } ], - "name": "setMultihash", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" + name: 'setMultihash', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function' }, { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' } ], - "name": "multihash", - "outputs": [ + name: 'multihash', + outputs: [ { - "name": "", - "type": "bytes" + name: '', + type: 'bytes' } ], - "payable": false, - "stateMutability": "view", - "type": "function" + payable: false, + stateMutability: 'view', + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "x", - "type": "bytes32" + name: 'x', + type: 'bytes32' }, { - "name": "y", - "type": "bytes32" + name: 'y', + type: 'bytes32' } ], - "name": "setPubkey", - "outputs": [], - "payable": false, - "type": "function" + name: 'setPubkey', + outputs: [], + payable: false, + type: 'function' }, { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' } ], - "name": "content", - "outputs": [ + name: 'content', + outputs: [ { - "name": "ret", - "type": "bytes32" + name: 'ret', + type: 'bytes32' } ], - "payable": false, - "type": "function" + payable: false, + type: 'function' }, { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' } ], - "name": "addr", - "outputs": [ + name: 'addr', + outputs: [ { - "name": "ret", - "type": "address" + name: 'ret', + type: 'address' } ], - "payable": false, - "type": "function" + payable: false, + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "contentType", - "type": "uint256" + name: 'contentType', + type: 'uint256' }, { - "name": "data", - "type": "bytes" + name: 'data', + type: 'bytes' } ], - "name": "setABI", - "outputs": [], - "payable": false, - "type": "function" + name: 'setABI', + outputs: [], + payable: false, + type: 'function' }, { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' } ], - "name": "name", - "outputs": [ + name: 'name', + outputs: [ { - "name": "ret", - "type": "string" + name: 'ret', + type: 'string' } ], - "payable": false, - "type": "function" + payable: false, + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "name", - "type": "string" + name: 'name', + type: 'string' } ], - "name": "setName", - "outputs": [], - "payable": false, - "type": "function" + name: 'setName', + outputs: [], + payable: false, + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "hash", - "type": "bytes32" + name: 'hash', + type: 'bytes32' } ], - "name": "setContent", - "outputs": [], - "payable": false, - "type": "function" + name: 'setContent', + outputs: [], + payable: false, + type: 'function' }, { - "constant": true, - "inputs": [ + constant: true, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' } ], - "name": "pubkey", - "outputs": [ + name: 'pubkey', + outputs: [ { - "name": "x", - "type": "bytes32" + name: 'x', + type: 'bytes32' }, { - "name": "y", - "type": "bytes32" + name: 'y', + type: 'bytes32' } ], - "payable": false, - "type": "function" + payable: false, + type: 'function' }, { - "constant": false, - "inputs": [ + constant: false, + inputs: [ { - "name": "node", - "type": "bytes32" + name: 'node', + type: 'bytes32' }, { - "name": "addr", - "type": "address" + name: 'addr', + type: 'address' } ], - "name": "setAddr", - "outputs": [], - "payable": false, - "type": "function" + name: 'setAddr', + outputs: [], + payable: false, + type: 'function' }, { - "inputs": [ + inputs: [ { - "name": "ensAddr", - "type": "address" + name: 'ensAddr', + type: 'address' } ], - "payable": false, - "type": "constructor" + payable: false, + type: 'constructor' }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "name": "node", - "type": "bytes32" + indexed: true, + name: 'node', + type: 'bytes32' }, { - "indexed": false, - "name": "a", - "type": "address" + indexed: false, + name: 'a', + type: 'address' } ], - "name": "AddrChanged", - "type": "event" + name: 'AddrChanged', + type: 'event' }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "name": "node", - "type": "bytes32" + indexed: true, + name: 'node', + type: 'bytes32' }, { - "indexed": false, - "name": "hash", - "type": "bytes32" + indexed: false, + name: 'hash', + type: 'bytes32' } ], - "name": "ContentChanged", - "type": "event" + name: 'ContentChanged', + type: 'event' }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "name": "node", - "type": "bytes32" + indexed: true, + name: 'node', + type: 'bytes32' }, { - "indexed": false, - "name": "name", - "type": "string" + indexed: false, + name: 'name', + type: 'string' } ], - "name": "NameChanged", - "type": "event" + name: 'NameChanged', + type: 'event' }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "name": "node", - "type": "bytes32" + indexed: true, + name: 'node', + type: 'bytes32' }, { - "indexed": true, - "name": "contentType", - "type": "uint256" + indexed: true, + name: 'contentType', + type: 'uint256' } ], - "name": "ABIChanged", - "type": "event" + name: 'ABIChanged', + type: 'event' }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "name": "node", - "type": "bytes32" + indexed: true, + name: 'node', + type: 'bytes32' }, { - "indexed": false, - "name": "x", - "type": "bytes32" + indexed: false, + name: 'x', + type: 'bytes32' }, { - "indexed": false, - "name": "y", - "type": "bytes32" + indexed: false, + name: 'y', + type: 'bytes32' } ], - "name": "PubkeyChanged", - "type": "event" + name: 'PubkeyChanged', + type: 'event' } ]; diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index 69673baa9e0..0f5d9db7c43 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -18,7 +18,6 @@ */ export default class ENS { - /** * @param {Registry} registry * @param {ResolverMethodHandler} resolverMethodHandler diff --git a/packages/web3-eth-ens/src/contracts/Registry.js b/packages/web3-eth-ens/src/contracts/Registry.js index 6445fb06833..24c91e58d60 100644 --- a/packages/web3-eth-ens/src/contracts/Registry.js +++ b/packages/web3-eth-ens/src/contracts/Registry.js @@ -21,7 +21,6 @@ import {isFunction} from 'underscore'; import namehash from 'eth-ens-namehash'; export default class Registry { - /** * // TODO: Contract should be implemented over dependency inversion and not dependency injection * @param {AbstractProviderAdapter|EthereumProvider} provider @@ -40,13 +39,8 @@ export default class Registry { this.resolverABI = resolverABI; this.provider = provider; - this.contract = this.checkNetwork().then(address => { - return new this.contractObject( - this.provider, - this.accounts, - this.registryABI, - address - ); + this.contract = this.checkNetwork().then((address) => { + return new this.contractObject(this.provider, this.accounts, this.registryABI, address); }); } @@ -79,17 +73,18 @@ export default class Registry { */ owner(name, callback) { return new Promise((resolve, reject) => { - this.contract.then(contract => { - contract.methods.owner(namehash.hash(name)) + this.contract.then((contract) => { + contract.methods + .owner(namehash.hash(name)) .call() - .then(receipt => { + .then((receipt) => { resolve(receipt); if (isFunction(callback)) { callback(false, receipt); } }) - .catch(error => { + .catch((error) => { reject(error); if (isFunction(callback)) { @@ -110,16 +105,13 @@ export default class Registry { * @returns {Promise} */ resolver(name) { - return this.contract.then(contract => { - return contract.methods.resolver(namehash.hash(name)).call(); - }).then(address => { - return new this.Contract.Contract( - this.provider, - this.accounts, - this.resolverABI, - address - ); - }); + return this.contract + .then((contract) => { + return contract.methods.resolver(namehash.hash(name)).call(); + }) + .then((address) => { + return new this.Contract.Contract(this.provider, this.accounts, this.resolverABI, address); + }); } /** @@ -132,25 +124,28 @@ export default class Registry { */ checkNetwork() { const ensAddresses = { - main: "0x314159265dD8dbb310642f98f50C066173C1259b", - ropsten: "0x112234455c3a32fd11230c42e7bccd4a84e02010", - rinkeby: "0xe7410170f87102df0055eb195163a03b7f2bff4a" + main: '0x314159265dD8dbb310642f98f50C066173C1259b', + ropsten: '0x112234455c3a32fd11230c42e7bccd4a84e02010', + rinkeby: '0xe7410170f87102df0055eb195163a03b7f2bff4a' }; - return this.net.getBlock('latest', false).then(block => { - const headAge = new Date() / 1000 - block.timestamp; - if (headAge > 3600) { - throw new Error(`Network not synced; last block was ${headAge} seconds ago`); - } + return this.net + .getBlock('latest', false) + .then((block) => { + const headAge = new Date() / 1000 - block.timestamp; + if (headAge > 3600) { + throw new Error(`Network not synced; last block was ${headAge} seconds ago`); + } - return this.net.getNetworkType(); - }).then(networkType => { - const addr = ensAddresses[networkType]; - if (typeof addr === 'undefined') { - throw new Error(`ENS is not supported on network ${networkType}`); - } + return this.net.getNetworkType(); + }) + .then((networkType) => { + const addr = ensAddresses[networkType]; + if (typeof addr === 'undefined') { + throw new Error(`ENS is not supported on network ${networkType}`); + } - return addr; - }); + return addr; + }); } } diff --git a/packages/web3-eth-ens/src/factories/ENSModuleFactory.js b/packages/web3-eth-ens/src/factories/ENSModuleFactory.js index 011723d8e3c..e3a596869d9 100644 --- a/packages/web3-eth-ens/src/factories/ENSModuleFactory.js +++ b/packages/web3-eth-ens/src/factories/ENSModuleFactory.js @@ -22,7 +22,6 @@ import Registry from '../contracts/Registry'; import ResolverMethodHandler from '../handlers/ResolverMethodHandler'; export default class ENSModuleFactory { - /** * Returns an object of type ENS * @@ -38,15 +37,7 @@ export default class ENSModuleFactory { * * @returns {ENS} */ - createENS( - provider, - net, - accounts, - Contract, - registryAbi, - resolverAbi, - PromiEvent - ) { + createENS(provider, net, accounts, Contract, registryAbi, resolverAbi, PromiEvent) { const registry = this.createRegistry(provider, net, accounts, Contract, registryAbi, resolverAbi); return new ENS(registry, this.createResolverMethodHandler(registry, PromiEvent)); diff --git a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js index 217236a35f8..a4bafee85f0 100644 --- a/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js +++ b/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js @@ -21,7 +21,6 @@ import _ from 'underscore'; import namehash from 'eth-ens-namehash'; export default class ResolverMethodHandler { - /** * @param {Registry} registry * @param {PromiEventPackage} promiEventPackage @@ -72,13 +71,16 @@ export default class ResolverMethodHandler { */ call(callback) { const promiEvent = new this.promiEventPackage.PromiEvent(), - preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); + preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); - this.parent.registry.resolver(this.ensName).then(resolver => { - this.parent.handleCall(promiEvent, resolver.methods[this.methodName], preparedArguments, callback); - }).catch(error => { - promiEvent.reject(error); - }); + this.parent.registry + .resolver(this.ensName) + .then((resolver) => { + this.parent.handleCall(promiEvent, resolver.methods[this.methodName], preparedArguments, callback); + }) + .catch((error) => { + promiEvent.reject(error); + }); return promiEvent; } @@ -96,13 +98,22 @@ export default class ResolverMethodHandler { */ send(sendOptions, callback) { const promiEvent = new this.promiEventPackage.PromiEvent(), - preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); - - this.parent.registry.resolver(this.ensName).then(resolver => { - this.parent.handleSend(promiEvent, resolver.methods[this.methodName], preparedArguments, sendOptions, callback); - }).catch(error => { - promiEvent.reject(error); - }); + preparedArguments = this.parent.prepareArguments(this.ensName, this.methodArguments); + + this.parent.registry + .resolver(this.ensName) + .then((resolver) => { + this.parent.handleSend( + promiEvent, + resolver.methods[this.methodName], + preparedArguments, + sendOptions, + callback + ); + }) + .catch((error) => { + promiEvent.reject(error); + }); return promiEvent; } @@ -121,20 +132,23 @@ export default class ResolverMethodHandler { * @returns {PromiEvent} */ handleCall(promiEvent, method, preparedArguments, callback) { - method.apply(this, preparedArguments).call() - .then(receipt => { + method + .apply(this, preparedArguments) + .call() + .then((receipt) => { promiEvent.resolve(receipt); if (_.isFunction(callback)) { callback(receipt); } - }).catch(error => { - promiEvent.reject(error); + }) + .catch((error) => { + promiEvent.reject(error); - if (_.isFunction(callback)) { - callback(error); - } - }); + if (_.isFunction(callback)) { + callback(error); + } + }); return promiEvent; } @@ -154,14 +168,16 @@ export default class ResolverMethodHandler { * @returns {PromiEvent} */ handleSend(promiEvent, method, preparedArguments, sendOptions, callback) { - method.apply(this, preparedArguments).send(sendOptions) - .on('transactionHash', hash => { + method + .apply(this, preparedArguments) + .send(sendOptions) + .on('transactionHash', (hash) => { promiEvent.emit('transactionHash', hash); }) .on('confirmation', (confirmationNumber, receipt) => { promiEvent.emit('confirmation', confirmationNumber, receipt); }) - .on('receipt', receipt => { + .on('receipt', (receipt) => { promiEvent.emit('receipt', receipt); promiEvent.resolve(receipt); @@ -169,7 +185,7 @@ export default class ResolverMethodHandler { callback(receipt); } }) - .on('error', error => { + .on('error', (error) => { promiEvent.emit('error', error); promiEvent.reject(error); diff --git a/packages/web3-eth-ens/src/index.js b/packages/web3-eth-ens/src/index.js index ecb55601533..4093924643c 100644 --- a/packages/web3-eth-ens/src/index.js +++ b/packages/web3-eth-ens/src/index.js @@ -37,13 +37,5 @@ import ENSModuleFactory from './factories/ENSModuleFactory'; * @returns {ENS} */ export const ENS = (provider, net, accounts) => { - return new ENSModuleFactory().createENS( - provider, - net, - accounts, - Contract, - REGISTRY_ABI, - RESOLVER_ABI, - PromiEvent - ); + return new ENSModuleFactory().createENS(provider, net, accounts, Contract, REGISTRY_ABI, RESOLVER_ABI, PromiEvent); }; diff --git a/packages/web3-eth-iban/src/Iban.js b/packages/web3-eth-iban/src/Iban.js index d33cbe1a5fa..d7eba4701e9 100644 --- a/packages/web3-eth-iban/src/Iban.js +++ b/packages/web3-eth-iban/src/Iban.js @@ -23,7 +23,7 @@ * @date 2015 */ -"use strict"; +'use strict'; import Utils from 'web3-utils'; import BigNumber from 'bn.js'; @@ -44,22 +44,25 @@ const leftPad = (string, bytes) => { * @param {String} iban the IBAN * @returns {String} the prepared IBAN */ -const iso13616Prepare = iban => { +const iso13616Prepare = (iban) => { const A = 'A'.charCodeAt(0); const Z = 'Z'.charCodeAt(0); iban = iban.toUpperCase(); iban = iban.substr(4) + iban.substr(0, 4); - return iban.split('').map(n => { - const code = n.charCodeAt(0); - if (code >= A && code <= Z) { - // A = 10, B = 11, ... Z = 35 - return code - A + 10; - } else { - return n; - } - }).join(''); + return iban + .split('') + .map((n) => { + const code = n.charCodeAt(0); + if (code >= A && code <= Z) { + // A = 10, B = 11, ... Z = 35 + return code - A + 10; + } else { + return n; + } + }) + .join(''); }; /** @@ -69,19 +72,19 @@ const iso13616Prepare = iban => { * @param {String} iban * @returns {Number} */ -const mod9710 = iban => { - let remainder = iban, block; +const mod9710 = (iban) => { + let remainder = iban, + block; while (remainder.length > 2) { block = remainder.slice(0, 9); - remainder = parseInt(block, 10) % 97 + remainder.slice(block.length); + remainder = (parseInt(block, 10) % 97) + remainder.slice(block.length); } return parseInt(remainder, 10) % 97; }; export default class Iban { - /** * @param {String} iban * @@ -104,7 +107,7 @@ export default class Iban { ib = new Iban(ib); if (!ib.isDirect()) { - throw new Error('IBAN is indirect and can\'t be converted'); + throw new Error("IBAN is indirect and can't be converted"); } return ib.toAddress(); @@ -160,7 +163,7 @@ export default class Iban { const countryCode = 'XE'; const remainder = mod9710(iso13616Prepare(`${countryCode}00${bban}`)); - const checkDigit = (`0${98 - remainder}`).slice(-2); + const checkDigit = `0${98 - remainder}`.slice(-2); return new Iban(countryCode + checkDigit + bban); } @@ -200,8 +203,10 @@ export default class Iban { * @returns {Boolean} true if it is, otherwise false */ isValid() { - return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) && - mod9710(iso13616Prepare(this._iban)) === 1; + return ( + /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) && + mod9710(iso13616Prepare(this._iban)) === 1 + ); } /** diff --git a/packages/web3-eth-personal/src/Personal.js b/packages/web3-eth-personal/src/Personal.js index 7a11a941ea6..731dac32f8a 100644 --- a/packages/web3-eth-personal/src/Personal.js +++ b/packages/web3-eth-personal/src/Personal.js @@ -23,7 +23,6 @@ import {AbstractWeb3Module} from 'web3-core'; export default class Personal extends AbstractWeb3Module { - /** * TODO: Add missing documentation for getAccounts, lockAccount, importRawKey and sendTransaction! * diff --git a/packages/web3-eth-personal/src/factories/MethodModelFactory.js b/packages/web3-eth-personal/src/factories/MethodModelFactory.js index 56c85395857..5789959ee3f 100644 --- a/packages/web3-eth-personal/src/factories/MethodModelFactory.js +++ b/packages/web3-eth-personal/src/factories/MethodModelFactory.js @@ -34,7 +34,6 @@ import { } from 'web3-core-method'; export default class MethodModelFactory extends AbstractMethodModelFactory { - /** * @param {Object} utils * @param {Object} formatters diff --git a/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js b/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js index d5b0e6491ed..1ec293ad1cf 100644 --- a/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js +++ b/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js @@ -24,7 +24,6 @@ import Personal from '../Personal'; import MethodModelFactory from './MethodModelFactory'; export default class PersonalModuleFactory { - /** * @param {Object} utils * @param {Object} formatters diff --git a/packages/web3-eth/src/Eth.js b/packages/web3-eth/src/Eth.js index 3d2ac8cce85..f745aef0d70 100644 --- a/packages/web3-eth/src/Eth.js +++ b/packages/web3-eth/src/Eth.js @@ -23,7 +23,6 @@ import {AbstractWeb3Module} from 'web3-core'; export default class Eth extends AbstractWeb3Module { - /** * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProviderDetector} providerDetector @@ -84,7 +83,7 @@ export default class Eth extends AbstractWeb3Module { this.formatters = formatters; this.subscriptionsFactory = subscriptionsFactory; this.initiatedContracts = []; - this._defaultAccount = null ; + this._defaultAccount = null; this._defaultBlock = 'latest'; /** @@ -123,7 +122,7 @@ export default class Eth extends AbstractWeb3Module { * @property defaultAccount */ set defaultAccount(value) { - this.initiatedContracts.forEach(contract => { + this.initiatedContracts.forEach((contract) => { contract.defaultAccount = value; }); @@ -152,7 +151,7 @@ export default class Eth extends AbstractWeb3Module { set defaultBlock(value) { this._defaultBlock = value; - this.initiatedContracts.forEach(contract => { + this.initiatedContracts.forEach((contract) => { contract.defaultBlock = value; }); @@ -174,27 +173,23 @@ export default class Eth extends AbstractWeb3Module { subscribe(type, options, callback) { switch (type) { case 'logs': - return this.subscriptionsFactory.createLogSubscription( - this, - options, - this.methodModelFactory.createMethodModel('getPastLogs'), - this.methodController - ).subscribe(callback); + return this.subscriptionsFactory + .createLogSubscription( + this, + options, + this.methodModelFactory.createMethodModel('getPastLogs'), + this.methodController + ) + .subscribe(callback); case 'newBlockHeaders': - return this.subscriptionsFactory.createNewHeadsSubscription( - this - ).subscribe(callback); + return this.subscriptionsFactory.createNewHeadsSubscription(this).subscribe(callback); case 'pendingTransactions': - return this.subscriptionsFactory.createNewPendingTransactionsSubscription( - this - ).subscribe(callback); + return this.subscriptionsFactory.createNewPendingTransactionsSubscription(this).subscribe(callback); case 'syncing': - return this.subscriptionsFactory.createSyncingSubscriptionModel( - this - ).subscribe(callback); + return this.subscriptionsFactory.createSyncingSubscriptionModel(this).subscribe(callback); default: throw Error(`Unknown subscription: ${type}`); @@ -211,7 +206,7 @@ export default class Eth extends AbstractWeb3Module { * @returns {Boolean} */ setProvider(provider, net) { - const setContractProviders = this.initiatedContracts.every(contract => { + const setContractProviders = this.initiatedContracts.every((contract) => { return contract.setProvider(provider, net); }); diff --git a/packages/web3-eth/src/factories/EthModuleFactory.js b/packages/web3-eth/src/factories/EthModuleFactory.js index bb5b91e71fe..c07914aa9fd 100644 --- a/packages/web3-eth/src/factories/EthModuleFactory.js +++ b/packages/web3-eth/src/factories/EthModuleFactory.js @@ -24,7 +24,6 @@ import MethodModelFactory from './MethodModelFactory'; import Eth from '../Eth'; export default class EthModuleFactory { - /** * @param {Object} utils * @param {Object} formatters @@ -72,7 +71,7 @@ export default class EthModuleFactory { iban, abi, ens, - subscriptionsFactory, + subscriptionsFactory ) { return new Eth( provider, diff --git a/packages/web3-eth/src/factories/MethodModelFactory.js b/packages/web3-eth/src/factories/MethodModelFactory.js index 69bb54b3dee..76c3e0eb543 100644 --- a/packages/web3-eth/src/factories/MethodModelFactory.js +++ b/packages/web3-eth/src/factories/MethodModelFactory.js @@ -54,7 +54,6 @@ import { } from 'web3-core-method'; export default class MethodModelFactory extends AbstractMethodModelFactory { - /** * @param {Object} utils * @param {Object} formatters diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index c2327a8c3ab..be6c67de9a5 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -60,6 +60,6 @@ export const Eth = (provider) => { Iban, new ABICoder(Utils), new ENS(provider), - new SubscriptionsFactory(), + new SubscriptionsFactory() ); }; diff --git a/packages/web3-net/src/Network.js b/packages/web3-net/src/Network.js index 4b27d4161e8..605ae53af39 100644 --- a/packages/web3-net/src/Network.js +++ b/packages/web3-net/src/Network.js @@ -24,7 +24,6 @@ import {AbstractWeb3Module} from 'web3-core'; export default class Network extends AbstractWeb3Module { - /** * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProviderDetector} providerDetector @@ -76,43 +75,51 @@ export default class Network extends AbstractWeb3Module { getNetworkType(callback) { let id; - return this.getId().then(givenId => { - id = givenId; + return this.getId() + .then((givenId) => { + id = givenId; - return this.getBlock(0, false); - }).then(genesis => { - let returnValue = 'private'; - switch (genesis) { - case genesis.hash === '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' && id === 1: - returnValue = 'main'; - break; - case genesis.hash === '0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303' && id === 2: - returnValue = 'morden'; - break; - case genesis.hash === '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d' && id === 3: - returnValue = 'ropsten'; - break; - case genesis.hash === '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177' && id === 4: - returnValue = 'rinkeby'; - break; - case genesis.hash === '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9' && id === 42: - returnValue = 'kovan'; - break; - } + return this.getBlock(0, false); + }) + .then((genesis) => { + let returnValue = 'private'; + switch (genesis) { + case genesis.hash === '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' && + id === 1: + returnValue = 'main'; + break; + case genesis.hash === '0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303' && + id === 2: + returnValue = 'morden'; + break; + case genesis.hash === '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d' && + id === 3: + returnValue = 'ropsten'; + break; + case genesis.hash === '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177' && + id === 4: + returnValue = 'rinkeby'; + break; + case genesis.hash === '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9' && + id === 42: + returnValue = 'kovan'; + break; + } - if (_.isFunction(callback)) { - callback(null, returnValue); - } + if (_.isFunction(callback)) { + callback(null, returnValue); + } - return returnValue; - }).catch(err => { - if (_.isFunction(callback)) { - callback(err); + return returnValue; + }) + .catch((err) => { + if (_.isFunction(callback)) { + callback(err); - return; - } + return; + } - throw err; - }); + throw err; + }); } } diff --git a/packages/web3-net/src/factories/MethodModelFactory.js b/packages/web3-net/src/factories/MethodModelFactory.js index 3eab0b20d47..4ffbe2f25c9 100644 --- a/packages/web3-net/src/factories/MethodModelFactory.js +++ b/packages/web3-net/src/factories/MethodModelFactory.js @@ -29,7 +29,6 @@ import { } from 'web3-core-method'; export default class MethodModelFactory extends AbstractMethodModelFactory { - /** * @param {Object} utils * @param {Object} formatters @@ -42,7 +41,7 @@ export default class MethodModelFactory extends AbstractMethodModelFactory { getId: VersionMethodModel, getBlock: GetBlockMethodModel, isListening: ListeningMethodModel, - getPeerCount: PeerCountMethodModel, + getPeerCount: PeerCountMethodModel }, utils, formatters diff --git a/packages/web3-net/src/factories/NetworkModuleFactory.js b/packages/web3-net/src/factories/NetworkModuleFactory.js index 5b728dbb274..d79af0e6cfe 100644 --- a/packages/web3-net/src/factories/NetworkModuleFactory.js +++ b/packages/web3-net/src/factories/NetworkModuleFactory.js @@ -20,11 +20,10 @@ * @date 2018 */ -import Network from "../Network"; -import MethodModelFactory from "./MethodModelFactory"; +import Network from '../Network'; +import MethodModelFactory from './MethodModelFactory'; export default class NetworkModuleFactory { - /** * @param {Object} utils * @param {Object} formatters diff --git a/packages/web3-net/src/index.js b/packages/web3-net/src/index.js index cec58d1475e..a95788ea2af 100644 --- a/packages/web3-net/src/index.js +++ b/packages/web3-net/src/index.js @@ -25,7 +25,7 @@ import {ProvidersModuleFactory, providers} from 'web3-providers'; import {MethodController} from 'web3-core-method'; import {formatters} from 'web3-core-helpers'; import Utils from 'web3-utils'; -import NetworkModuleFactory from "./factories/NetworkModuleFactory"; +import NetworkModuleFactory from './factories/NetworkModuleFactory'; /** * Creates the Network Object @@ -45,6 +45,6 @@ export const Network = (provider) => { providersModuleFactory.createProviderAdapterResolver(), providersModuleFactory, providers, - new MethodController(), - ) + new MethodController() + ); }; diff --git a/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js b/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js index 6816936af91..c6a068b1299 100644 --- a/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js +++ b/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js @@ -26,7 +26,6 @@ import {errors} from 'web3-core-helpers'; import EventEmitter from 'eventemitter3'; export default class AbstractProviderAdapter extends EventEmitter { - /** * @param {Object} provider * @@ -52,9 +51,8 @@ export default class AbstractProviderAdapter extends EventEmitter { return new Promise((resolve, reject) => { this.provider.send(payload, (error, response) => { - this.handleResponse(reject, resolve, error, response) + this.handleResponse(reject, resolve, error, response); }); - }); } @@ -111,7 +109,9 @@ export default class AbstractProviderAdapter extends EventEmitter { handleResponse(reject, resolve, error, response) { if (response && response.id && payload.id !== response.id) { reject( - new Error(`Wrong response id "${response.id}" (expected: "${payload.id}") in ${JSON.stringify(payload)}`) + new Error( + `Wrong response id "${response.id}" (expected: "${payload.id}") in ${JSON.stringify(payload)}` + ) ); return; @@ -123,7 +123,6 @@ export default class AbstractProviderAdapter extends EventEmitter { return; } - if (!JSONRpcResponseValidator.isValid(response.result)) { reject(errors.InvalidResponse(response)); diff --git a/packages/web3-providers/src/adapters/HttpProviderAdapter.js b/packages/web3-providers/src/adapters/HttpProviderAdapter.js index fde3c449892..9215b9b31b6 100644 --- a/packages/web3-providers/src/adapters/HttpProviderAdapter.js +++ b/packages/web3-providers/src/adapters/HttpProviderAdapter.js @@ -23,7 +23,6 @@ import AbstractProviderAdapter from '../../lib/adapters/AbstractProviderAdapter'; export default class HttpProviderAdapter extends AbstractProviderAdapter { - /** * @param {HttpProvider} httpProvider * diff --git a/packages/web3-providers/src/adapters/InpageProviderAdapter.js b/packages/web3-providers/src/adapters/InpageProviderAdapter.js index d996d105bba..b011f1f1e3f 100644 --- a/packages/web3-providers/src/adapters/InpageProviderAdapter.js +++ b/packages/web3-providers/src/adapters/InpageProviderAdapter.js @@ -23,13 +23,13 @@ import AbstractProviderAdapter from '../../lib/adapters/AbstractProviderAdapter'; export default class InpageProviderAdapter extends AbstractProviderAdapter { - /** * @param {Object} inpageProvider * * @constructor */ - constructor(inpageProvider) {// TODO: Check if there is a way to set a host property (will be used on setProvider) + constructor(inpageProvider) { + // TODO: Check if there is a way to set a host property (will be used on setProvider) super(inpageProvider); this.provider.send = this.provider.sendAsync; delete this.provider.sendAsync; diff --git a/packages/web3-providers/src/adapters/SocketProviderAdapter.js b/packages/web3-providers/src/adapters/SocketProviderAdapter.js index 1a96744744c..c5476c21a90 100644 --- a/packages/web3-providers/src/adapters/SocketProviderAdapter.js +++ b/packages/web3-providers/src/adapters/SocketProviderAdapter.js @@ -23,7 +23,6 @@ import AbstractProviderAdapter from '../../lib/adapters/AbstractProviderAdapter'; export default class SocketProviderAdapter extends AbstractProviderAdapter { - /** * @param {Object} provider * @@ -70,9 +69,9 @@ export default class SocketProviderAdapter extends AbstractProviderAdapter { * @returns {Promise} */ unsubscribe(subscriptionId, subscriptionType) { - return this.send(subscriptionType, [subscriptionId]).then(function (result) { + return this.send(subscriptionType, [subscriptionId]).then(function(result) { if (result) { - this.subscriptions = this.subscriptions.filter(subscription => { + this.subscriptions = this.subscriptions.filter((subscription) => { return subscription !== subscriptionId; }); @@ -121,7 +120,7 @@ export default class SocketProviderAdapter extends AbstractProviderAdapter { clearSubscriptions() { const unsubscribePromises = []; - this.subscriptions.forEach(subscriptionId => { + this.subscriptions.forEach((subscriptionId) => { unsubscribePromises.push(this.unsubscribe(subscriptionId)); }); diff --git a/packages/web3-providers/src/batch-request/BatchRequest.js b/packages/web3-providers/src/batch-request/BatchRequest.js index 8cb3c8c4c23..998baaea140 100644 --- a/packages/web3-providers/src/batch-request/BatchRequest.js +++ b/packages/web3-providers/src/batch-request/BatchRequest.js @@ -24,7 +24,6 @@ import {errors} from 'web3-core-helpers'; import {isFunction, isObject, isArray} from 'underscore'; export default class BatchRequest { - /** * @param {AbstractProviderAdapter} provider * @param {JSONRpcMapper} jsonRpcMapper @@ -56,37 +55,34 @@ export default class BatchRequest { * @method execute */ execute() { - this.provider.sendBatch( - this.jsonRpcMapper.toBatchPayload(this.requests), - (err, results) => { - if (!isArray(results)) { - request.callback(errors.InvalidResponse(results)); + this.provider.sendBatch(this.jsonRpcMapper.toBatchPayload(this.requests), (err, results) => { + if (!isArray(results)) { + request.callback(errors.InvalidResponse(results)); - return; - } + return; + } - this.requests.forEach(function (request, index) { - const result = results[index] || null; + this.requests.forEach(function(request, index) { + const result = results[index] || null; - if (isFunction(request.callback)) { - if (isObject(result) && result.error) { - request.callback(errors.ErrorResponse(result)); - } + if (isFunction(request.callback)) { + if (isObject(result) && result.error) { + request.callback(errors.ErrorResponse(result)); + } - if (!this.jsonRpcResponseValidator.isValid(result)) { - request.callback(errors.InvalidResponse(result)); - } + if (!this.jsonRpcResponseValidator.isValid(result)) { + request.callback(errors.InvalidResponse(result)); + } - try { - const mappedResult = request.afterExecution(result.result); - request.callback(null, mappedResult); - } catch (err) { - request.callback(err, null); - } + try { + const mappedResult = request.afterExecution(result.result); + request.callback(null, mappedResult); + } catch (err) { + request.callback(err, null); } - }); - } - ); + } + }); + }); } /** diff --git a/packages/web3-providers/src/detectors/ProviderDetector.js b/packages/web3-providers/src/detectors/ProviderDetector.js index 76959210ece..aeb738d08a7 100644 --- a/packages/web3-providers/src/detectors/ProviderDetector.js +++ b/packages/web3-providers/src/detectors/ProviderDetector.js @@ -28,7 +28,6 @@ try { } export default class ProviderDetector { - /** * Detects which provider is given with web3.currentProvider * @@ -42,7 +41,6 @@ export default class ProviderDetector { } if (typeof global.web3 !== 'undefined' && global.web3.currentProvider) { - if (this.isIpcProviderWrapper(global.web3.currentProvider)) { global.web3.currentProvider = this.addSubscriptionsToIpcProviderWrapper(global.web3.currentProvider); } @@ -61,9 +59,11 @@ export default class ProviderDetector { * @returns {Boolean} */ isIpcProviderWrapper(currentProvider) { - return !currentProvider.on && - currentProvider.connection && - currentProvider.connection.constructor.name === 'ipcProviderWrapper'; + return ( + !currentProvider.on && + currentProvider.connection && + currentProvider.connection.constructor.name === 'ipcProviderWrapper' + ); } /** @@ -83,7 +83,7 @@ export default class ProviderDetector { switch (type) { case 'data': - this.connection.on('data', data => { + this.connection.on('data', (data) => { let result = ''; data = data.toString(); @@ -98,7 +98,6 @@ export default class ProviderDetector { if (!result.id && result.method.indexOf('_subscription') !== -1) { callback(null, result); } - }); break; default: diff --git a/packages/web3-providers/src/factories/ProvidersModuleFactory.js b/packages/web3-providers/src/factories/ProvidersModuleFactory.js index f55a84b3de0..ce4e873e293 100644 --- a/packages/web3-providers/src/factories/ProvidersModuleFactory.js +++ b/packages/web3-providers/src/factories/ProvidersModuleFactory.js @@ -33,7 +33,6 @@ import JSONRpcMapper from '../mappers/JSONRpcMapper'; import BatchRequest from '../batch-request/BatchRequest'; export default class ProvidersModuleFactory { - /** * Returns an BatchRequest object * @@ -132,7 +131,7 @@ export default class ProvidersModuleFactory { * @returns {SocketProviderAdapter} */ createSocketProviderAdapter(provider) { - return new SocketProviderAdapter(provider) + return new SocketProviderAdapter(provider); } /** @@ -145,7 +144,7 @@ export default class ProvidersModuleFactory { * @returns {InpageProviderAdapter} */ createInpageProviderAdapter(provider) { - return new InpageProviderAdapter(provider) + return new InpageProviderAdapter(provider); } /** diff --git a/packages/web3-providers/src/mappers/JSONRpcMapper.js b/packages/web3-providers/src/mappers/JSONRpcMapper.js index f9b7fe826b3..f50a94a1d36 100644 --- a/packages/web3-providers/src/mappers/JSONRpcMapper.js +++ b/packages/web3-providers/src/mappers/JSONRpcMapper.js @@ -23,7 +23,6 @@ let messageId = 0; export default class JSONRpcMapper { - /** * Creates a valid json payload object * @@ -47,7 +46,7 @@ export default class JSONRpcMapper { method, params: params || [] }; - }; + } /** * Creates a batch payload object @@ -59,10 +58,10 @@ export default class JSONRpcMapper { * @returns {Array} batch payload */ static toBatchPayload(requests) { - return requests.map(request => { + return requests.map((request) => { request.beforeExecution(); return JSONRpcMapper.toPayload(request.rpcMethod, request.parameters); }); - }; + } } diff --git a/packages/web3-providers/src/providers/HttpProvider.js b/packages/web3-providers/src/providers/HttpProvider.js index 51d7be3bfc5..6e02aaedf4b 100644 --- a/packages/web3-providers/src/providers/HttpProvider.js +++ b/packages/web3-providers/src/providers/HttpProvider.js @@ -29,7 +29,6 @@ import http from 'http'; import https from 'https'; export default class HttpProvider { - /** * @param {String} host * @param {Object} options @@ -39,10 +38,10 @@ export default class HttpProvider { constructor(host, options = {}) { this.host = host || 'http://localhost:8545'; - if (this.host.substring(0,5) === "https"){ - this.httpsAgent = new https.Agent({ keepAlive: true }); + if (this.host.substring(0, 5) === 'https') { + this.httpsAgent = new https.Agent({keepAlive: true}); } else { - this.httpAgent = new http.Agent({ keepAlive: true }); + this.httpAgent = new http.Agent({keepAlive: true}); } this.timeout = options.timeout || 0; @@ -61,17 +60,17 @@ export default class HttpProvider { _prepareRequest() { const request = new XHR2(); request.nodejsSet({ - httpsAgent:this.httpsAgent, - httpAgent:this.httpAgent + httpsAgent: this.httpsAgent, + httpAgent: this.httpAgent }); request.open('POST', this.host, true); - request.setRequestHeader('Content-Type','application/json'); + request.setRequestHeader('Content-Type', 'application/json'); request.timeout = this.timeout && this.timeout !== 1 ? this.timeout : 0; request.withCredentials = true; - if(this.headers) { - this.headers.forEach(header => { + if (this.headers) { + this.headers.forEach((header) => { request.setRequestHeader(header.name, header.value); }); } @@ -99,7 +98,7 @@ export default class HttpProvider { try { result = JSON.parse(result); - } catch(e) { + } catch (e) { error = errors.InvalidResponse(request.responseText); } @@ -115,7 +114,7 @@ export default class HttpProvider { try { request.send(JSON.stringify(payload)); - } catch(error) { + } catch (error) { this.connected = false; callback(errors.InvalidConnection(this.host)); } @@ -124,5 +123,5 @@ export default class HttpProvider { /** * If this method does not exist it will throw en error. */ - disconnect() { } + disconnect() {} } diff --git a/packages/web3-providers/src/providers/IpcProvider.js b/packages/web3-providers/src/providers/IpcProvider.js index 1c24a0174e1..67f4367bc11 100644 --- a/packages/web3-providers/src/providers/IpcProvider.js +++ b/packages/web3-providers/src/providers/IpcProvider.js @@ -25,7 +25,6 @@ import {errors} from 'web3-core-helpers'; import oboe from 'oboe'; export default class IpcProvider { - /** * @param {String} path * @param {Net} net @@ -43,16 +42,15 @@ export default class IpcProvider { this.addDefaultEvents(); // LISTEN FOR CONNECTION RESPONSES - const callback = result => { + const callback = (result) => { /*jshint maxcomplexity: 6 */ let id = null; // get the id which matches the returned id if (isArray(result)) { - result.forEach(load => { - if (this.responseCallbacks[load.id]) - id = load.id; + result.forEach((load) => { + if (this.responseCallbacks[load.id]) id = load.id; }); } else { id = result.id; @@ -60,9 +58,8 @@ export default class IpcProvider { // notification if (!id && result.method.indexOf('_subscription') !== -1) { - this.notificationCallbacks.forEach(callback => { - if (isFunction(callback)) - callback(result); + this.notificationCallbacks.forEach((callback) => { + if (isFunction(callback)) callback(result); }); // fire the callback @@ -74,10 +71,9 @@ export default class IpcProvider { // use oboe.js for Sockets if (net.constructor.name === 'Socket') { - oboe(this.connection) - .done(callback); + oboe(this.connection).done(callback); } else { - this.connection.on('data', data => { + this.connection.on('data', (data) => { this._parseResponse(data.toString()).forEach(callback); }); } @@ -131,7 +127,7 @@ export default class IpcProvider { .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ .split('|--|'); - dechunkedData.forEach(data => { + dechunkedData.forEach((data) => { let result = null; // prepend the last chunk @@ -139,7 +135,6 @@ export default class IpcProvider { data = this.lastChunk + data; } - try { result = JSON.parse(data); } catch (e) { @@ -286,8 +281,7 @@ export default class IpcProvider { switch (type) { case 'data': this.notificationCallbacks.forEach((cb, index) => { - if (cb === callback) - this.notificationCallbacks.splice(index, 1); + if (cb === callback) this.notificationCallbacks.splice(index, 1); }); break; diff --git a/packages/web3-providers/src/providers/WebsocketProvider.js b/packages/web3-providers/src/providers/WebsocketProvider.js index 654646206d7..c4e19b83764 100644 --- a/packages/web3-providers/src/providers/WebsocketProvider.js +++ b/packages/web3-providers/src/providers/WebsocketProvider.js @@ -31,30 +31,28 @@ if (typeof window !== 'undefined' && typeof window.WebSocket !== 'undefined') { return new window.WebSocket(url, protocols); }; _btoa = btoa; - parseURL = url => { + parseURL = (url) => { return new URL(url); }; } else { Ws = require('websocket').w3cwebsocket; - _btoa = str => { + _btoa = (str) => { return Buffer(str).toString('base64'); }; const url = require('url'); if (url.URL) { // Use the new Node 6+ API for parsing URLs that supports username/password const newURL = url.URL; - parseURL = url => { + parseURL = (url) => { return new newURL(url); }; - } - else { + } else { // Web3 supports Node.js 5, so fall back to the legacy URL API if necessary parseURL = require('url').parse; } } export default class WebsocketProvider { - /** * Default connection ws://localhost:8546 * @@ -93,21 +91,18 @@ export default class WebsocketProvider { this.addDefaultEvents(); - // LISTEN FOR CONNECTION RESPONSES - this.connection.onmessage = e => { + this.connection.onmessage = (e) => { /*jshint maxcomplexity: 6 */ - const data = (typeof e.data === 'string') ? e.data : ''; - - this._parseResponse(data).forEach(result => { + const data = typeof e.data === 'string' ? e.data : ''; + this._parseResponse(data).forEach((result) => { let id = null; // get the id which matches the returned id if (_.isArray(result)) { - result.forEach(load => { - if (this.responseCallbacks[load.id]) - id = load.id; + result.forEach((load) => { + if (this.responseCallbacks[load.id]) id = load.id; }); } else { id = result.id; @@ -115,9 +110,8 @@ export default class WebsocketProvider { // notification if (!id && result && result.method && result.method.indexOf('_subscription') !== -1) { - this.notificationCallbacks.forEach(callback => { - if (_.isFunction(callback)) - callback(result); + this.notificationCallbacks.forEach((callback) => { + if (_.isFunction(callback)) callback(result); }); // fire the callback @@ -133,7 +127,7 @@ export default class WebsocketProvider { get() { return this.connection && this.connection.readyState === this.connection.OPEN; }, - enumerable: true, + enumerable: true }); } @@ -177,19 +171,15 @@ export default class WebsocketProvider { .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ .split('|--|'); - dechunkedData.forEach(data => { - + dechunkedData.forEach((data) => { // prepend the last chunk - if (this.lastChunk) - data = this.lastChunk + data; + if (this.lastChunk) data = this.lastChunk + data; let result = null; try { result = JSON.parse(data); - } catch (e) { - this.lastChunk = data; // start timeout to cancel all requests @@ -206,8 +196,7 @@ export default class WebsocketProvider { clearTimeout(this.lastChunkTimeout); this.lastChunk = null; - if (result) - returnValues.push(result); + if (result) returnValues.push(result); }); return returnValues; @@ -303,9 +292,7 @@ export default class WebsocketProvider { * @callback callback callback(error, result) */ on(type, callback) { - - if (typeof callback !== 'function') - throw new Error('The second parameter callback must be a function.'); + if (typeof callback !== 'function') throw new Error('The second parameter callback must be a function.'); switch (type) { case 'data': @@ -346,8 +333,7 @@ export default class WebsocketProvider { switch (type) { case 'data': this.notificationCallbacks.forEach((cb, index) => { - if (cb === callback) - this.notificationCallbacks.splice(index, 1); + if (cb === callback) this.notificationCallbacks.splice(index, 1); }); break; diff --git a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js index e1c075a81a5..a9b7d869371 100644 --- a/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js +++ b/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js @@ -23,7 +23,6 @@ import {isObject, isFunction} from 'underscore'; export default class ProviderAdapterResolver { - /** * @param {ProvidersModuleFactory} providersPackageFactory * diff --git a/packages/web3-providers/src/validators/JSONRpcResponseValidator.js b/packages/web3-providers/src/validators/JSONRpcResponseValidator.js index 5bb1db21f3a..bb5fcab1ffa 100644 --- a/packages/web3-providers/src/validators/JSONRpcResponseValidator.js +++ b/packages/web3-providers/src/validators/JSONRpcResponseValidator.js @@ -21,7 +21,6 @@ */ export default class JSONRpcResponseValidator { - /** * Executes JSON-RPC response validation * @@ -33,7 +32,7 @@ export default class JSONRpcResponseValidator { */ static isValid(response) { if (Array.isArray(response)) { - return response.every(this.isResponseItemValid) + return response.every(this.isResponseItemValid); } return this.isResponseItemValid(response); @@ -49,10 +48,12 @@ export default class JSONRpcResponseValidator { * @returns {Boolean} */ static isResponseItemValid(response) { - return !!response && + return ( + !!response && !response.error && response.jsonrpc === '2.0' && (typeof response.id === 'number' || typeof response.id === 'string') && - response.result !== undefined; + response.result !== undefined + ); } } diff --git a/packages/web3-shh/src/Shh.js b/packages/web3-shh/src/Shh.js index e975b148d60..356ebef6266 100644 --- a/packages/web3-shh/src/Shh.js +++ b/packages/web3-shh/src/Shh.js @@ -23,7 +23,6 @@ import {AbstractWeb3Module} from 'web3-core'; export default class Shh extends AbstractWeb3Module { - /** * @param {AbstractProviderAdapter|EthereumProvider} provider * @param {ProviderDetector} providerDetector @@ -92,9 +91,6 @@ export default class Shh extends AbstractWeb3Module { * @returns {Boolean} */ setProvider(provider, net) { - return !!( - super.setProvider(provider, net) && - this.net.setProvider(provider, net) - ); + return !!(super.setProvider(provider, net) && this.net.setProvider(provider, net)); } } diff --git a/packages/web3-shh/src/factories/MethodModelFactory.js b/packages/web3-shh/src/factories/MethodModelFactory.js index d8acc535bef..93752abf10a 100644 --- a/packages/web3-shh/src/factories/MethodModelFactory.js +++ b/packages/web3-shh/src/factories/MethodModelFactory.js @@ -46,7 +46,6 @@ import { } from 'web3-core-method'; export default class MethodModelFactory extends AbstractMethodModelFactory { - /** * @param {Object} utils * @param {Object} formatters @@ -76,7 +75,7 @@ export default class MethodModelFactory extends AbstractMethodModelFactory { newMessageFilter: NewMessageFilterMethodModel, getFilterMessages: GetFilterMessagesMethodModel, deleteMessageFilter: DeleteMessageFilterMethodModel, - post: PostMethodModel, + post: PostMethodModel }, utils, formatters diff --git a/packages/web3-shh/src/factories/ShhModuleFactory.js b/packages/web3-shh/src/factories/ShhModuleFactory.js index 0c620f388b2..491b4d30741 100644 --- a/packages/web3-shh/src/factories/ShhModuleFactory.js +++ b/packages/web3-shh/src/factories/ShhModuleFactory.js @@ -21,10 +21,9 @@ */ import Shh from '../Shh'; -import MethodModelFactory from "./MethodModelFactory"; +import MethodModelFactory from './MethodModelFactory'; export default class ShhModuleFactory { - /** * @param {Object} utils * @param {Object} formatters @@ -60,7 +59,7 @@ export default class ShhModuleFactory { providers, methodController, subscriptionsFactory, - net, + net ) { return new Shh( provider, @@ -83,6 +82,6 @@ export default class ShhModuleFactory { * @returns {MethodModelFactory} */ createMethodModelFactory() { - return new MethodModelFactory(this.utils, this.formatters) + return new MethodModelFactory(this.utils, this.formatters); } } diff --git a/packages/web3-utils/src/bloomFilter.js b/packages/web3-utils/src/bloomFilter.js index de54ffd4bb3..b954b911031 100644 --- a/packages/web3-utils/src/bloomFilter.js +++ b/packages/web3-utils/src/bloomFilter.js @@ -29,22 +29,25 @@ * TODO UNDOCUMENTED */ -import utils from "./utils.js"; +import utils from './utils.js'; function codePointToInt(codePoint) { - if (codePoint >= 48 && codePoint <= 57) { /*['0'..'9'] -> [0..9]*/ + if (codePoint >= 48 && codePoint <= 57) { + /*['0'..'9'] -> [0..9]*/ return codePoint - 48; } - if (codePoint >= 65 && codePoint <= 70) { /*['A'..'F'] -> [10..15]*/ + if (codePoint >= 65 && codePoint <= 70) { + /*['A'..'F'] -> [10..15]*/ return codePoint - 55; } - if (codePoint >= 97 && codePoint <= 102) { /*['a'..'f'] -> [10..15]*/ + if (codePoint >= 97 && codePoint <= 102) { + /*['a'..'f'] -> [10..15]*/ return codePoint - 87; } - throw "invalid bloom"; + throw 'invalid bloom'; } function testBytes(bloom, bytes) { @@ -52,11 +55,11 @@ function testBytes(bloom, bytes) { for (let i = 0; i < 12; i += 4) { // calculate bit position in bloom filter that must be active - const bitpos = ((parseInt(hash.substr(i, 2), 16) << 8) + parseInt(hash.substr((i + 2), 2), 16)) & 2047; + const bitpos = ((parseInt(hash.substr(i, 2), 16) << 8) + parseInt(hash.substr(i + 2, 2), 16)) & 2047; // test if bitpos in bloom is active const code = codePointToInt(bloom.charCodeAt(bloom.length - 1 - Math.floor(bitpos / 4))); - const offset = 1 << (bitpos % 4); + const offset = 1 << bitpos % 4; if ((code & offset) !== offset) { return false; @@ -96,8 +99,8 @@ const testAddress = (bloom, address) => { * @returns {Boolean} topic is (probably) part of the block */ const testTopic = (bloom, topic) => { - if (!utils.isBloom(bloom)) throw "invalid bloom"; - if (!utils.isTopic(topic)) throw "invalid topic"; + if (!utils.isBloom(bloom)) throw 'invalid bloom'; + if (!utils.isTopic(topic)) throw 'invalid topic'; return testBytes(bloom, topic); }; diff --git a/packages/web3-utils/src/index.js b/packages/web3-utils/src/index.js index 2c5dd7f79be..c0491bd56cb 100644 --- a/packages/web3-utils/src/index.js +++ b/packages/web3-utils/src/index.js @@ -59,11 +59,8 @@ const _fireError = (error, emitter, reject, callback) => { if (isFunction(reject)) { // suppress uncatched error if an error listener is present // OR suppress uncatched error if an callback listener is present - if (emitter && - (isFunction(emitter.listeners) && - emitter.listeners('error').length) || isFunction(callback)) { - emitter.catch(() => { - }); + if ((emitter && (isFunction(emitter.listeners) && emitter.listeners('error').length)) || isFunction(callback)) { + emitter.catch(() => {}); } // reject later, to be able to return emitter setTimeout(() => { @@ -89,7 +86,7 @@ const _fireError = (error, emitter, reject, callback) => { * @param {Object} json * @return {String} full function/event name */ -const _jsonInterfaceMethodToString = json => { +const _jsonInterfaceMethodToString = (json) => { if (isObject(json) && json.name && json.name.indexOf('(') !== -1) { return json.name; } @@ -109,7 +106,7 @@ const _flattenTypes = (includeTuple, puts) => { // console.log("entered _flattenTypes. inputs/outputs: " + puts) const types = []; - puts.forEach(param => { + puts.forEach((param) => { if (typeof param.components === 'object') { if (param.type.substring(0, 5) !== 'tuple') { throw new Error('components found but type is not tuple; report on GitHub'); @@ -124,12 +121,10 @@ const _flattenTypes = (includeTuple, puts) => { if (isArray(result) && includeTuple) { // console.log("include tuple word, and its an array. joining...: " + result.types) types.push(`tuple(${result.join(',')})${suffix}`); - } - else if (!includeTuple) { + } else if (!includeTuple) { // console.log("don't include tuple, but its an array. joining...: " + result) types.push(`(${result.join(',')})${suffix}`); - } - else { + } else { // console.log("its a single type within a tuple: " + result.types) types.push(`(${result})`); } @@ -149,11 +144,11 @@ const _flattenTypes = (includeTuple, puts) => { * @param {String} hex * @returns {String} ascii string representation of hex value */ -const hexToAscii = hex => { - if (!utils.isHexStrict(hex)) - throw new Error('The parameter must be a valid HEX string.'); +const hexToAscii = (hex) => { + if (!utils.isHexStrict(hex)) throw new Error('The parameter must be a valid HEX string.'); - let str = "", i = 0; + let str = '', + i = 0; const l = hex.length; if (hex.substring(0, 2) === '0x') { @@ -174,10 +169,9 @@ const hexToAscii = hex => { * @param {String} str * @returns {String} hex representation of input string */ -const asciiToHex = str => { - if (!str) - return "0x00"; - let hex = ""; +const asciiToHex = (str) => { + if (!str) return '0x00'; + let hex = ''; for (let i = 0; i < str.length; i++) { const code = str.charCodeAt(i); const n = code.toString(16); @@ -195,10 +189,16 @@ const asciiToHex = str => { * @returns {BN} value of the unit (in Wei) * @throws error if the unit is not correct:w */ -const getUnitValue = unit => { +const getUnitValue = (unit) => { unit = unit ? unit.toLowerCase() : 'ether'; if (!ethjsUnit.unitMap[unit]) { - throw new Error(`This unit "${unit}" doesn't exist, please use the one of the following units${JSON.stringify(ethjsUnit.unitMap, null, 2)}`); + throw new Error( + `This unit "${unit}" doesn't exist, please use the one of the following units${JSON.stringify( + ethjsUnit.unitMap, + null, + 2 + )}` + ); } return unit; }; @@ -266,7 +266,6 @@ const toWei = (number, unit) => { return utils.isBN(number) ? ethjsUnit.toWei(number, unit) : ethjsUnit.toWei(number, unit).toString(10); }; - /** * Converts to a checksum address * @@ -274,13 +273,12 @@ const toWei = (number, unit) => { * @param {String} address the given HEX address * @return {String} */ -const toChecksumAddress = address => { +const toChecksumAddress = (address) => { if (typeof address === 'undefined') return ''; if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) throw new Error(`Given address "${address}" is not a valid Ethereum address.`); - address = address.toLowerCase().replace(/^0x/i, ''); const addressHash = utils.sha3(address).replace(/^0x/i, ''); let checksumAddress = '0x'; @@ -296,7 +294,6 @@ const toChecksumAddress = address => { return checksumAddress; }; - export default { _fireError, _jsonInterfaceMethodToString, @@ -353,4 +350,3 @@ export default { rightPad: utils.rightPad, toTwosComplement: utils.toTwosComplement }; - diff --git a/packages/web3-utils/src/soliditySha3.js b/packages/web3-utils/src/soliditySha3.js index 489de3a61ae..2bfec3fdc81 100644 --- a/packages/web3-utils/src/soliditySha3.js +++ b/packages/web3-utils/src/soliditySha3.js @@ -25,7 +25,7 @@ import {isArray, isObject, map} from 'underscore'; import BN from 'bn.js'; import utils from './utils.js'; -const _elementaryName = name => { +const _elementaryName = (name) => { /*jshint maxcomplexity:false */ if (name.startsWith('int[')) { @@ -49,18 +49,18 @@ const _elementaryName = name => { }; // Parse N from type -const _parseTypeN = type => { +const _parseTypeN = (type) => { const typesize = /^\D+(\d+).*$/.exec(type); return typesize ? parseInt(typesize[1], 10) : null; }; // Parse N from type[] -const _parseTypeNArray = type => { +const _parseTypeNArray = (type) => { const arraySize = /^\D+\d*\[(\d+)\]$/.exec(type); return arraySize ? parseInt(arraySize[1], 10) : null; }; -const _parseNumber = arg => { +const _parseNumber = (arg) => { const type = typeof arg; if (type === 'string') { if (utils.isHexStrict(arg)) { @@ -85,9 +85,7 @@ const _solidityPack = (type, value, arraySize) => { let size, num; type = _elementaryName(type); - if (type === 'bytes') { - if (value.replace(/^0x/i, '').length % 2 !== 0) { throw new Error(`Invalid bytes characters ${value.length}`); } @@ -114,7 +112,6 @@ const _solidityPack = (type, value, arraySize) => { size = _parseTypeN(type); if (type.startsWith('bytes')) { - if (!size) { throw new Error('bytes[] not yet supported in solidity'); } @@ -130,8 +127,7 @@ const _solidityPack = (type, value, arraySize) => { return utils.rightPad(value, size * 2); } else if (type.startsWith('uint')) { - - if ((size % 8) || (size < 8) || (size > 256)) { + if (size % 8 || size < 8 || size > 256) { throw new Error(`Invalid uint${size} size`); } @@ -144,10 +140,9 @@ const _solidityPack = (type, value, arraySize) => { throw new Error(`Supplied uint ${num.toString()} is negative`); } - return size ? utils.leftPad(num.toString('hex'), size / 8 * 2) : num; + return size ? utils.leftPad(num.toString('hex'), (size / 8) * 2) : num; } else if (type.startsWith('int')) { - - if ((size % 8) || (size < 8) || (size > 256)) { + if (size % 8 || size < 8 || size > 256) { throw new Error(`Invalid int${size} size`); } @@ -159,34 +154,38 @@ const _solidityPack = (type, value, arraySize) => { if (num.lt(new BN(0))) { return num.toTwos(size).toString('hex'); } else { - return size ? utils.leftPad(num.toString('hex'), size / 8 * 2) : num; + return size ? utils.leftPad(num.toString('hex'), (size / 8) * 2) : num; } - } else { // FIXME: support all other types throw new Error(`Unsupported or invalid type: ${type}`); } }; - -const _processSoliditySha3Args = arg => { +const _processSoliditySha3Args = (arg) => { /*jshint maxcomplexity:false */ if (isArray(arg)) { throw new Error('Autodetection of array types is not supported.'); } - let type, value = ''; + let type, + value = ''; let hexArg, arraySize; // if type is given - if (isObject(arg) && (arg.hasOwnProperty('v') || arg.hasOwnProperty('t') || arg.hasOwnProperty('value') || arg.hasOwnProperty('type'))) { + if ( + isObject(arg) && + (arg.hasOwnProperty('v') || + arg.hasOwnProperty('t') || + arg.hasOwnProperty('value') || + arg.hasOwnProperty('type')) + ) { type = arg.hasOwnProperty('t') ? arg.t : arg.type; value = arg.hasOwnProperty('v') ? arg.v : arg.value; // otherwise try to guess the type } else { - type = utils.toHex(arg, true); value = utils.toHex(arg); @@ -209,17 +208,17 @@ const _processSoliditySha3Args = arg => { } } - if (isArray(value)) { - hexArg = value.map(val => { - return _solidityPack(type, val, arraySize).toString('hex').replace('0x', ''); + hexArg = value.map((val) => { + return _solidityPack(type, val, arraySize) + .toString('hex') + .replace('0x', ''); }); return hexArg.join(''); } else { hexArg = _solidityPack(type, value, arraySize); return hexArg.toString('hex').replace('0x', ''); } - }; /** @@ -241,5 +240,4 @@ const soliditySha3 = () => { return utils.sha3(`0x${hexArgs.join('')}`); }; - export default soliditySha3; diff --git a/packages/web3-utils/src/utils.js b/packages/web3-utils/src/utils.js index 1ad571336db..5bbc005214e 100644 --- a/packages/web3-utils/src/utils.js +++ b/packages/web3-utils/src/utils.js @@ -25,8 +25,7 @@ import {isNull, isUndefined, isBoolean, isString, isNumber, isObject} from 'unde import BN from 'bn.js'; import numberToBN from 'number-to-bn'; import utf8 from 'utf8'; -import Hash from "eth-lib/lib/hash"; - +import Hash from 'eth-lib/lib/hash'; /** * Returns true if object is BN, otherwise false @@ -35,9 +34,8 @@ import Hash from "eth-lib/lib/hash"; * @param {Object} object * @return {Boolean} */ -const isBN = object => { - return object instanceof BN || - (object && object.constructor && object.constructor.name === 'BN'); +const isBN = (object) => { + return object instanceof BN || (object && object.constructor && object.constructor.name === 'BN'); }; /** @@ -47,7 +45,7 @@ const isBN = object => { * @param {Object} object * @return {Boolean} */ -const isBigNumber = object => { +const isBigNumber = (object) => { return object && object.constructor && object.constructor.name === 'BigNumber'; }; @@ -58,7 +56,7 @@ const isBigNumber = object => { * @param {Number|String|BN} number, string, HEX string or BN * @return {BN} BN */ -const toBN = number => { +const toBN = (number) => { try { return numberToBN.apply(null, arguments); } catch (e) { @@ -66,7 +64,6 @@ const toBN = number => { } }; - /** * Takes and input transforms it into BN and if it is negative value, into two's complement * @@ -74,8 +71,10 @@ const toBN = number => { * @param {Number|String|BN} number * @return {String} */ -const toTwosComplement = number => { - return `0x${toBN(number).toTwos(256).toString(16, 64)}`; +const toTwosComplement = (number) => { + return `0x${toBN(number) + .toTwos(256) + .toString(16, 64)}`; }; /** @@ -85,7 +84,7 @@ const toTwosComplement = number => { * @param {String} address the given HEX address * @return {Boolean} */ -const isAddress = address => { +const isAddress = (address) => { // check if it has the basic requirements of an address if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { return false; @@ -98,7 +97,6 @@ const isAddress = address => { } }; - /** * Checks if the given string is a checksummed address * @@ -106,14 +104,17 @@ const isAddress = address => { * @param {String} address the given HEX address * @return {Boolean} */ -const checkAddressChecksum = address => { +const checkAddressChecksum = (address) => { // Check each case address = address.replace(/^0x/i, ''); const addressHash = sha3(address.toLowerCase()).replace(/^0x/i, ''); for (let i = 0; i < 40; i++) { // the nth letter should be uppercase if the nth digit of casemap is 1 - if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i])) { + if ( + (parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || + (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i]) + ) { return false; } } @@ -133,9 +134,9 @@ const leftPad = (string, chars, sign) => { const hasPrefix = /^0x/i.test(string) || typeof string === 'number'; string = string.toString(16).replace(/^0x/i, ''); - const padding = (chars - string.length + 1 >= 0) ? chars - string.length + 1 : 0; + const padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0; - return (hasPrefix ? '0x' : '') + new Array(padding).join(sign ? sign : "0") + string; + return (hasPrefix ? '0x' : '') + new Array(padding).join(sign ? sign : '0') + string; }; /** @@ -151,12 +152,11 @@ const rightPad = (string, chars, sign) => { const hasPrefix = /^0x/i.test(string) || typeof string === 'number'; string = string.toString(16).replace(/^0x/i, ''); - const padding = (chars - string.length + 1 >= 0) ? chars - string.length + 1 : 0; + const padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0; - return (hasPrefix ? '0x' : '') + string + (new Array(padding).join(sign ? sign : "0")); + return (hasPrefix ? '0x' : '') + string + new Array(padding).join(sign ? sign : '0'); }; - /** * Should be called to get hex representation (prefixed by 0x) of utf8 string * @@ -164,15 +164,21 @@ const rightPad = (string, chars, sign) => { * @param {String} str * @returns {String} hex representation of input string */ -const utf8ToHex = str => { +const utf8ToHex = (str) => { str = utf8.encode(str); - let hex = ""; + let hex = ''; // remove \u0000 padding from either side str = str.replace(/^(?:\u0000)*/, ''); - str = str.split("").reverse().join(""); + str = str + .split('') + .reverse() + .join(''); str = str.replace(/^(?:\u0000)*/, ''); - str = str.split("").reverse().join(""); + str = str + .split('') + .reverse() + .join(''); for (let i = 0; i < str.length; i++) { const code = str.charCodeAt(i); @@ -192,19 +198,24 @@ const utf8ToHex = str => { * @param {String} hex * @returns {String} ascii string representation of hex value */ -const hexToUtf8 = hex => { - if (!isHexStrict(hex)) - throw new Error(`The parameter "${hex}" must be a valid HEX string.`); +const hexToUtf8 = (hex) => { + if (!isHexStrict(hex)) throw new Error(`The parameter "${hex}" must be a valid HEX string.`); - let str = ""; + let str = ''; let code = 0; hex = hex.replace(/^0x/i, ''); // remove 00 padding from either side hex = hex.replace(/^(?:00)*/, ''); - hex = hex.split("").reverse().join(""); + hex = hex + .split('') + .reverse() + .join(''); hex = hex.replace(/^(?:00)*/, ''); - hex = hex.split("").reverse().join(""); + hex = hex + .split('') + .reverse() + .join(''); const l = hex.length; @@ -218,7 +229,6 @@ const hexToUtf8 = hex => { return utf8.decode(str); }; - /** * Converts value to it's number representation * @@ -226,7 +236,7 @@ const hexToUtf8 = hex => { * @param {String|Number|BN} value * @return {String} */ -const hexToNumber = value => { +const hexToNumber = (value) => { if (!value) { return value; } @@ -241,13 +251,12 @@ const hexToNumber = value => { * @param {String|Number|BN} value * @return {String} */ -const hexToNumberString = value => { +const hexToNumberString = (value) => { if (!value) return value; return toBN(value).toString(10); }; - /** * Converts value to it's hex representation * @@ -255,7 +264,7 @@ const hexToNumberString = value => { * @param {String|Number|BN} value * @return {String} */ -const numberToHex = value => { +const numberToHex = (value) => { if (isNull(value) || isUndefined(value)) { return value; } @@ -270,7 +279,6 @@ const numberToHex = value => { return number.lt(new BN(0)) ? `-0x${result.substr(1)}` : `0x${result}`; }; - /** * Convert a byte array to a hex string * @@ -280,14 +288,14 @@ const numberToHex = value => { * @param {Array} bytes * @return {String} the hex string */ -const bytesToHex = bytes => { +const bytesToHex = (bytes) => { for (let hex = [], i = 0; i < bytes.length; i++) { /* jshint ignore:start */ hex.push((bytes[i] >>> 4).toString(16)); - hex.push((bytes[i] & 0xF).toString(16)); + hex.push((bytes[i] & 0xf).toString(16)); /* jshint ignore:end */ } - return `0x${hex.join("")}`; + return `0x${hex.join('')}`; }; /** @@ -299,7 +307,7 @@ const bytesToHex = bytes => { * @param {String} hex * @return {Array} the byte array */ -const hexToBytes = hex => { +const hexToBytes = (hex) => { hex = hex.toString(16); if (!isHexStrict(hex)) { @@ -308,8 +316,7 @@ const hexToBytes = hex => { hex = hex.replace(/^0x/i, ''); - for (let bytes = [], c = 0; c < hex.length; c += 2) - bytes.push(parseInt(hex.substr(c, 2), 16)); + for (let bytes = [], c = 0; c < hex.length; c += 2) bytes.push(parseInt(hex.substr(c, 2), 16)); return bytes; }; @@ -334,7 +341,6 @@ const toHex = (value, returnType) => { return returnType ? 'bool' : value ? '0x01' : '0x00'; } - if (isObject(value) && !isBigNumber(value) && !isBN(value)) { return returnType ? 'string' : utf8ToHex(JSON.stringify(value)); } @@ -353,7 +359,6 @@ const toHex = (value, returnType) => { return returnType ? (value < 0 ? 'int256' : 'uint256') : numberToHex(value); }; - /** * Check if string is HEX, requires a 0x in front * @@ -361,8 +366,8 @@ const toHex = (value, returnType) => { * @param {String} hex to be checked * @returns {Boolean} */ -const isHexStrict = hex => { - return ((isString(hex) || isNumber(hex)) && /^(-)?0x[0-9a-f]*$/i.test(hex)); +const isHexStrict = (hex) => { + return (isString(hex) || isNumber(hex)) && /^(-)?0x[0-9a-f]*$/i.test(hex); }; /** @@ -372,11 +377,10 @@ const isHexStrict = hex => { * @param {String} hex to be checked * @returns {Boolean} */ -const isHex = hex => { - return ((isString(hex) || isNumber(hex)) && /^(-0x|0x)?[0-9a-f]*$/i.test(hex)); +const isHex = (hex) => { + return (isString(hex) || isNumber(hex)) && /^(-0x|0x)?[0-9a-f]*$/i.test(hex); }; - /** * Returns true if given string is a valid Ethereum block header bloom. * @@ -386,7 +390,7 @@ const isHex = hex => { * @param {String} hex encoded bloom filter * @return {Boolean} */ -const isBloom = bloom => { +const isBloom = (bloom) => { if (!/^(0x)?[0-9a-f]{512}$/i.test(bloom)) { return false; } else if (/^(0x)?[0-9a-f]{512}$/.test(bloom) || /^(0x)?[0-9A-F]{512}$/.test(bloom)) { @@ -404,7 +408,7 @@ const isBloom = bloom => { * @param {String} hex encoded topic * @return {Boolean} */ -const isTopic = topic => { +const isTopic = (topic) => { if (!/^(0x)?[0-9a-f]{64}$/i.test(topic)) { return false; } else if (/^(0x)?[0-9a-f]{64}$/.test(topic) || /^(0x)?[0-9A-F]{64}$/.test(topic)) { @@ -413,7 +417,6 @@ const isTopic = topic => { return false; }; - /** * Hashes values to a sha3 hash using keccak 256 * @@ -424,8 +427,8 @@ const isTopic = topic => { */ const SHA3_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; -const sha3 = value => { - if (isHexStrict(value) && /^0x/i.test((value).toString())) { +const sha3 = (value) => { + if (isHexStrict(value) && /^0x/i.test(value.toString())) { value = hexToBytes(value); } @@ -440,7 +443,6 @@ const sha3 = value => { // expose the under the hood keccak256 sha3._Hash = Hash; - export default { BN, isBN, diff --git a/packages/web3/src/index.js b/packages/web3/src/index.js index 2f37ba105b8..04393375f99 100644 --- a/packages/web3/src/index.js +++ b/packages/web3/src/index.js @@ -33,7 +33,6 @@ import {Personal} from 'web3-eth-personal'; import {version} from '../package.json'; export default class Web3 extends AbstractWeb3Module { - /** * @param {Object|String} provider * @param {Net} net @@ -41,9 +40,9 @@ export default class Web3 extends AbstractWeb3Module { * @constructor */ constructor(provider, net) { - var providersModuleFactory = new ProvidersModuleFactory(); - var providerAdapterResolver = providersModuleFactory.createProviderAdapterResolver(); - var providerDetector = providersModuleFactory.createProviderDetector(); + const providersModuleFactory = new ProvidersModuleFactory(), + providerAdapterResolver = providersModuleFactory.createProviderAdapterResolver(), + providerDetector = providersModuleFactory.createProviderDetector(); provider = providerAdapterResolver.resolve(provider, net); @@ -73,7 +72,7 @@ export default class Web3 extends AbstractWeb3Module { * @returns {Boolean} */ setProvider(provider, net) { - return !!( + return ( super.setProvider(provider, net) && this.eth.setProvider(provider, net) && this.shh.setProvider(provider, net) && From c38ad129a0b1ad97089ca8cace8dfd7dc0847c52 Mon Sep 17 00:00:00 2001 From: Samuel Furter Date: Mon, 22 Oct 2018 14:28:16 +0200 Subject: [PATCH 0303/1045] basic setup eslint&prettier --- .eslintcache | 1 + .eslintignore | 7 + .eslintrc.json | 47 + .prettierignore | 5 - docs/_build/html/_static/doctools.js | 344 +- docs/_build/html/_static/jquery-1.11.1.js | 20640 ++++++++-------- docs/_build/html/_static/jquery.js | 6 +- docs/_build/html/_static/searchtools.js | 1104 +- docs/_build/html/_static/sidebar.js | 220 +- docs/_build/html/_static/underscore-1.3.1.js | 1940 +- docs/_build/html/_static/underscore.js | 48 +- docs/_build/html/_static/websupport.js | 1224 +- docs/_build/html/searchindex.js | 2 +- package-lock.json | 1283 +- package.js | 1 - package.json | 13 +- packages/web3-bzz/src/Bzz.js | 2 +- packages/web3-core-helpers/src/formatters.js | 2 +- .../lib/models/AbstractMethodModel.js | 9 +- .../src/controllers/MethodController.js | 10 +- .../tests/commands/SignMessageCommandTest.js | 2 +- .../web3-core-promievent/src/PromiEvent.js | 2 +- .../subscriptions/eth/LogSubscriptionModel.js | 2 +- packages/web3-core/src/AbstractWeb3Module.js | 10 +- packages/web3-eth-abi/src/ABICoder.js | 2 +- packages/web3-eth-accounts/src/Accounts.js | 35 +- packages/web3-eth-contract/src/Contract.js | 21 +- .../src/decoders/EventLogDecoder.js | 2 +- .../src/encoders/AllEventsFilterEncoder.js | 9 - .../src/encoders/EventFilterEncoder.js | 4 +- .../src/factories/ContractModuleFactory.js | 22 +- .../src/factories/RpcMethodModelFactory.js | 2 +- .../src/mappers/ABIMapper.js | 4 +- .../src/proxies/EventSubscriptionsProxy.js | 13 +- .../src/proxies/MethodsProxy.js | 16 +- .../validators/RpcMethodOptionsValidator.js | 2 +- .../web3-eth-ens/src/contracts/Registry.js | 11 +- .../src/handlers/ResolverMethodHandler.js | 10 +- packages/web3-eth-iban/src/Iban.js | 10 +- packages/web3-eth/src/Eth.js | 12 +- packages/web3-net/src/Network.js | 13 +- .../lib/adapters/AbstractProviderAdapter.js | 5 +- .../src/batch-request/BatchRequest.js | 44 +- .../src/detectors/ProviderDetector.js | 8 +- .../src/providers/HttpProvider.js | 4 +- .../src/providers/IpcProvider.js | 6 +- .../src/providers/WebsocketProvider.js | 20 +- .../src/resolvers/ProviderAdapterResolver.js | 6 +- packages/web3-shh/src/Shh.js | 2 +- packages/web3-utils/src/bloomFilter.js | 8 +- packages/web3-utils/src/index.js | 13 +- packages/web3-utils/src/soliditySha3.js | 13 +- packages/web3-utils/src/utils.js | 10 +- packages/web3/src/index.js | 8 +- test/1_givenProvider-ethereumProvider.js | 20 +- test/2_givenProvider-currentProvider.js | 15 +- test/abi.decodeParameter.js | 1491 +- test/abi.encodeParameter.js | 1430 +- test/async.js | 84 +- test/batch.js | 240 +- test/bloom.testAddress.js | 31 +- test/bloom.testTopic.js | 41 +- test/contract.encodeABI.js | 79 +- test/contract.js | 3184 +-- test/errors.js | 12 +- test/eth.Iban.js | 15 +- test/eth.abi.decodeLog.js | 355 +- test/eth.abi.decodeParameter.js | 26 +- test/eth.abi.decodeParameters.js | 194 +- test/eth.abi.encodeEventSignature.js | 90 +- test/eth.abi.encodeFunctionCall.js | 111 +- test/eth.abi.encodeFunctionSignature.js | 122 +- test/eth.abi.encodeParameter.js | 31 +- test/eth.abi.encodeParameters.js | 41 +- test/eth.accounts.create.js | 15 +- test/eth.accounts.encrypt-decrypt.js | 236 +- test/eth.accounts.sign.js | 44 +- test/eth.accounts.signTransaction.js | 316 +- test/eth.accounts.wallet.js | 80 +- test/eth.call.js | 81 +- test/eth.defaultAccount.js | 25 +- test/eth.defaultBlock.js | 9 +- test/eth.ens.js | 254 +- test/eth.estimateGas.js | 41 +- test/eth.gasPrice.js | 14 +- test/eth.getAccounts.js | 24 +- test/eth.getBalance.js | 159 +- test/eth.getBlock.js | 243 +- test/eth.getBlockNumber.js | 13 +- test/eth.getBlockTransactionCount.js | 57 +- test/eth.getBlockUncleCount.js | 42 +- test/eth.getCode.js | 50 +- test/eth.getCoinbase.js | 14 +- test/eth.getHashRate.js | 15 +- test/eth.getNodeVersion.js | 13 +- test/eth.getStorageAt.js | 63 +- test/eth.getTransaction.js | 61 +- test/eth.getTransactionFromBlock.js | 78 +- test/eth.getTransactionReceipt.js | 218 +- test/eth.getUncle.js | 242 +- test/eth.getWork.js | 17 +- test/eth.isMining.js | 13 +- test/eth.net.getNetworkType.js | 86 +- test/eth.net.getPeerCount.js | 17 +- test/eth.net.isListening.js | 17 +- test/eth.protocolVersion.js | 13 +- test/eth.sendTransaction.js | 506 +- test/eth.sign.js | 73 +- test/eth.submitWork.js | 24 +- test/eth.subscribe.js | 954 +- test/eth_methods.js | 2 - test/event.decode.js | 399 +- test/event.encode.js | 439 +- test/extend.js | 122 +- test/formatters.inputAddressFormatter.js | 48 +- test/formatters.inputDefaultBlockFormatter.js | 23 +- test/formatters.inputPostFormatter.js | 46 +- test/formatters.inputTransactionFormatter.js | 168 +- test/formatters.outputBlockFormatter.js | 149 +- test/formatters.outputLogFormatter.js | 92 +- test/formatters.outputPostFormatter.js | 42 +- test/formatters.outputTransactionFormatter.js | 108 +- test/helpers/FakeHttpProvider.js | 61 +- test/helpers/FakeIpcProvider.js | 73 +- test/helpers/FakeIpcProvider2.js | 9 +- test/helpers/FakeIpcRequest.js | 20 +- test/helpers/FakeXHR2.js | 8 +- test/helpers/test.method.js | 118 +- test/helpers/test.subscription.js | 52 +- test/helpers/test.utils.js | 11 +- test/httpprovider.js | 18 +- test/iban.createIndirect.js | 24 +- test/iban.fromAddress.js | 19 +- test/iban.isValid.js | 45 +- test/iban.toAddress.js | 19 +- test/iban.toIban.js | 19 +- test/ipcprovider.js | 9 +- test/jsonrpc.id.js | 8 +- test/jsonrpc.isValidResponse.js | 34 +- test/jsonrpc.toBatchPayload.js | 25 +- test/jsonrpc.toPayload.js | 10 +- test/method.buildCall.js | 460 +- test/method.extractCallback.js | 24 +- test/method.formatInput.js | 20 +- test/method.formatOutput.js | 36 +- test/method.getCall.js | 14 +- test/method.validateArgs.js | 29 +- test/personal.getAccounts.js | 17 +- test/personal.lockAccount.js | 32 +- test/personal.newAccount.js | 22 +- test/personal.sendTransaction.js | 190 +- test/personal.unlockAccount.js | 32 +- test/provider.js | 171 +- test/requestmanager.js | 26 +- test/setProvider.js | 143 +- test/shh.post.js | 57 +- test/shh.subscribe.js | 114 +- test/shh_methods.js | 1 - test/utils.fromAscii.js | 20 +- test/utils.fromNumber.js | 73 +- test/utils.fromWei.js | 21 +- test/utils.isAddress.js | 30 +- test/utils.isBN.js | 25 +- test/utils.isChecksumAddress.js | 29 +- test/utils.sha3.js | 36 +- test/utils.soliditySha3.js | 488 +- test/utils.toAscii.js | 20 +- test/utils.toBigNumber.js | 76 +- test/utils.toHex.js | 98 +- test/utils.toNumber.js | 9 +- test/utils.toNumberString.js | 9 +- test/utils.toTwosComplement.js | 76 +- test/utils.toUtf8.js | 24 +- test/utils.toWei.js | 47 +- test/utils.utf8ToHex.js | 32 +- test/utils_methods.js | 3 +- test/web3_methods.js | 3 +- webpack.config.js | 27 +- 178 files changed, 23457 insertions(+), 20295 deletions(-) create mode 100644 .eslintcache create mode 100644 .eslintignore create mode 100644 .eslintrc.json delete mode 100644 .prettierignore diff --git a/.eslintcache b/.eslintcache new file mode 100644 index 00000000000..87a4667bcda --- /dev/null +++ b/.eslintcache @@ -0,0 +1 @@ +{"/Users/sam/Development/foundation/web3.js/packages/web3-bzz/src/Bzz.js":{"size":3648,"mtime":1540207016026,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-bzz/src/Bzz.js","messages":[{"ruleId":"no-undef","severity":2,"message":"'ethereumProvider' is not defined.","line":153,"column":48,"nodeType":"Identifier","endLine":153,"endColumn":64},{"ruleId":"no-undef","severity":2,"message":"'ethereumProvider' is not defined.","line":154,"column":25,"nodeType":"Identifier","endLine":154,"endColumn":41}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-bzz/src/index.js":{"size":812,"mtime":1539958061146,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-bzz/src/index.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token Bzz","line":23,"column":8}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-helpers/src/errors.js":{"size":1844,"mtime":1540205159158,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-helpers/src/errors.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `Errors.js`.","line":24,"column":1,"nodeType":"Program","endLine":49,"endColumn":3}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-helpers/src/formatters.js":{"size":13086,"mtime":1540209101984},"/Users/sam/Development/foundation/web3.js/packages/web3-core-helpers/src/index.js":{"size":863,"mtime":1539865753371,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-helpers/src/index.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token errors","line":23,"column":8}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js":{"size":1624,"mtime":1539865753373,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/lib/factories/AbstractMethodModelFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/lib/models/AbstractMethodModel.js":{"size":4435,"mtime":1540207016027,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/lib/models/AbstractMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/lib/signers/AbstractSigner.js":{"size":1467,"mtime":1540205159551,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/lib/signers/AbstractSigner.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/commands/CallMethodCommand.js":{"size":1707,"mtime":1540205201985,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/commands/CallMethodCommand.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token execute","line":35,"column":11}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/commands/SendMethodCommand.js":{"size":3761,"mtime":1540205202012,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/commands/SendMethodCommand.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js":{"size":2420,"mtime":1540205202037,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/commands/SignAndSendMethodCommand.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/commands/SignMessageCommand.js":{"size":1899,"mtime":1540205202047,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/commands/SignMessageCommand.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/controllers/MethodController.js":{"size":2916,"mtime":1540211203907,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/controllers/MethodController.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/factories/MethodModuleFactory.js":{"size":5687,"mtime":1540205202094,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/factories/MethodModuleFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/index.js":{"size":6886,"mtime":1540205202118,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/index.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token AbstractMethodModelFactory","line":41,"column":8}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js":{"size":1472,"mtime":1540205202130,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/account/GetAccountsMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js":{"size":1902,"mtime":1540205202140,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/account/GetBalanceMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js":{"size":1853,"mtime":1540205202149,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/account/GetTransactionCountMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js":{"size":1946,"mtime":1540205202160,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetBlockMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js":{"size":1408,"mtime":1540205202173,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetBlockNumberMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js":{"size":1888,"mtime":1540205202192,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetBlockTransactionCountMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js":{"size":1858,"mtime":1540205202203,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetBlockUncleCountMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js":{"size":1931,"mtime":1540205202213,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/block/GetUncleMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/CallMethodModel.js":{"size":1603,"mtime":1540205202222,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/CallMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js":{"size":1779,"mtime":1540205202231,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/EstimateGasMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js":{"size":1599,"mtime":1540205202244,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/GetCodeMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js":{"size":1836,"mtime":1540205202256,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/GetPastLogsMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js":{"size":1687,"mtime":1540205202276,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/GetStorageAtMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js":{"size":1150,"mtime":1540205202286,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/network/GetProtocolVersionMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js":{"size":1126,"mtime":1540205202299,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/network/ListeningMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js":{"size":1396,"mtime":1540205202308,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/network/PeerCountMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js":{"size":1398,"mtime":1540205202319,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/network/VersionMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js":{"size":1129,"mtime":1540205202335,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetCoinbaseMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js":{"size":1420,"mtime":1540205202344,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetGasPriceMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js":{"size":1399,"mtime":1540205202354,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetHashrateMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js":{"size":1135,"mtime":1540205202370,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetNodeInfoMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js":{"size":1120,"mtime":1540205202380,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/GetWorkMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js":{"size":1121,"mtime":1540205202392,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/IsMiningMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js":{"size":1410,"mtime":1540205202409,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/IsSyncingMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js":{"size":1129,"mtime":1540205202423,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/node/SubmitWorkMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js":{"size":1583,"mtime":1540205202457,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/EcRecoverMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js":{"size":1140,"mtime":1540205202470,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/ImportRawKeyMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js":{"size":1483,"mtime":1540205202479,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/ListAccountsMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js":{"size":1504,"mtime":1540205202489,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/LockAccountMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js":{"size":1410,"mtime":1540205202505,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/NewAccountMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js":{"size":1552,"mtime":1540205202514,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/PersonalSendTransactionMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js":{"size":1584,"mtime":1540205202526,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/PersonalSignMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js":{"size":1552,"mtime":1540205202541,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/PersonalSignTransactionMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js":{"size":1510,"mtime":1540205202549,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/personal/UnlockAccountMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js":{"size":1138,"mtime":1540205202558,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/AddPrivateKeyMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js":{"size":1126,"mtime":1540205202569,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/AddSymKeyMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js":{"size":1138,"mtime":1540205202581,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/DeleteKeyPairMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js":{"size":1156,"mtime":1540205202595,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/DeleteMessageFilterMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js":{"size":1135,"mtime":1540205202619,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/DeleteSymKeyMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js":{"size":1177,"mtime":1540205202634,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GenerateSymKeyFromPasswordMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js":{"size":1150,"mtime":1540205202643,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetFilterMessagesMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js":{"size":1117,"mtime":1540205202652,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetInfoMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js":{"size":1138,"mtime":1540205202668,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetPrivateKeyMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js":{"size":1135,"mtime":1540205202681,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetPublicKeyMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js":{"size":1126,"mtime":1540205202690,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/GetSymKeyMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js":{"size":1129,"mtime":1540205202698,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/HasKeyPairMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js":{"size":1126,"mtime":1540205202705,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/HasSymKeyMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js":{"size":1144,"mtime":1540205202713,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/MarkTrustedPeerMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js":{"size":1129,"mtime":1540205202723,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/NewKeyPairMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js":{"size":1147,"mtime":1540205202736,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/NewMessageFilterMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js":{"size":1126,"mtime":1540205202747,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/NewSymKeyMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js":{"size":1111,"mtime":1540205202756,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/PostMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js":{"size":1150,"mtime":1540205202772,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/SetMaxMessageSizeMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js":{"size":1126,"mtime":1540205202780,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/SetMinPoWMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js":{"size":1126,"mtime":1540205202789,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/shh/ShhVersionMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/SignMethodModel.js":{"size":1638,"mtime":1540205202798,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/SignMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js":{"size":2042,"mtime":1540205202808,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/GetTransactionFromBlockMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js":{"size":1437,"mtime":1540205202817,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/GetTransactionMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js":{"size":1452,"mtime":1540205202826,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/GetTransactionReceiptMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js":{"size":1159,"mtime":1540205202834,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/SendSignedTransactionMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js":{"size":1609,"mtime":1540205202844,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/SendTransactionMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js":{"size":1515,"mtime":1540205202852,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/methods/transaction/SignTransactionMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/TransactionConfirmationModel.js":{"size":2332,"mtime":1540205202861,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/models/TransactionConfirmationModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/signers/MessageSigner.js":{"size":1393,"mtime":1540205202876,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/signers/MessageSigner.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/signers/TransactionSigner.js":{"size":1466,"mtime":1540205202887,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/signers/TransactionSigner.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token sign","line":36,"column":11}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/validators/TransactionReceiptValidator.js":{"size":2411,"mtime":1540205202897,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/validators/TransactionReceiptValidator.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/watchers/NewHeadsWatcher.js":{"size":2418,"mtime":1540205202914,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/watchers/NewHeadsWatcher.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js":{"size":7108,"mtime":1540205202939,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/src/workflows/TransactionConfirmationWorkflow.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/commands/CallMethodCommandTest.js":{"size":3032,"mtime":1540205202964,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/commands/CallMethodCommandTest.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token function","line":43,"column":31}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/commands/SendMethodCommandTest.js":{"size":5691,"mtime":1540205203004,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/commands/SendMethodCommandTest.js","messages":[{"ruleId":"no-unused-vars","severity":2,"message":"'providerMock' is assigned a value but never used.","line":18,"column":9,"nodeType":"Identifier","endLine":18,"endColumn":21},{"ruleId":"no-unused-vars","severity":2,"message":"'moduleInstanceMock' is assigned a value but never used.","line":22,"column":9,"nodeType":"Identifier","endLine":22,"endColumn":27},{"ruleId":"no-unused-vars","severity":2,"message":"'methodModelCallbackSpy' is defined but never used.","line":24,"column":9,"nodeType":"Identifier","endLine":24,"endColumn":31},{"ruleId":"prefer-promise-reject-errors","severity":2,"message":"Expected the Promise rejection reason to be an Error.","line":154,"column":21,"nodeType":"CallExpression","endLine":154,"endColumn":36}],"errorCount":4,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js":{"size":5845,"mtime":1540205203033,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/commands/SignAndSendMethodCommandTest.js","messages":[{"ruleId":"no-unused-vars","severity":2,"message":"'providerMock' is assigned a value but never used.","line":19,"column":9,"nodeType":"Identifier","endLine":19,"endColumn":21},{"ruleId":"no-unused-vars","severity":2,"message":"'moduleInstanceMock' is assigned a value but never used.","line":23,"column":9,"nodeType":"Identifier","endLine":23,"endColumn":27},{"ruleId":"no-unused-vars","severity":2,"message":"'promiEventMock' is assigned a value but never used.","line":28,"column":9,"nodeType":"Identifier","endLine":28,"endColumn":23},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":113,"column":13,"nodeType":"ExpressionStatement","endLine":113,"endColumn":61},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":113,"column":50,"nodeType":"Identifier","endLine":113,"endColumn":52},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":114,"column":13,"nodeType":"ExpressionStatement","endLine":114,"endColumn":92},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":114,"column":81,"nodeType":"Identifier","endLine":114,"endColumn":83},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":116,"column":13,"nodeType":"ExpressionStatement","endLine":116,"endColumn":66},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":116,"column":55,"nodeType":"Identifier","endLine":116,"endColumn":57},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":117,"column":13,"nodeType":"ExpressionStatement","endLine":117,"endColumn":85},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":117,"column":74,"nodeType":"Identifier","endLine":117,"endColumn":76},{"ruleId":"prefer-promise-reject-errors","severity":2,"message":"Expected the Promise rejection reason to be an Error.","line":141,"column":21,"nodeType":"CallExpression","endLine":141,"endColumn":36},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":151,"column":13,"nodeType":"ExpressionStatement","endLine":151,"endColumn":72},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":151,"column":61,"nodeType":"Identifier","endLine":151,"endColumn":63},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":152,"column":13,"nodeType":"ExpressionStatement","endLine":152,"endColumn":61},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":152,"column":50,"nodeType":"Identifier","endLine":152,"endColumn":52},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":153,"column":13,"nodeType":"ExpressionStatement","endLine":153,"endColumn":79},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":153,"column":68,"nodeType":"Identifier","endLine":153,"endColumn":70},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":155,"column":13,"nodeType":"ExpressionStatement","endLine":155,"endColumn":66},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":155,"column":55,"nodeType":"Identifier","endLine":155,"endColumn":57},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":156,"column":13,"nodeType":"ExpressionStatement","endLine":156,"endColumn":81},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":156,"column":70,"nodeType":"Identifier","endLine":156,"endColumn":72}],"errorCount":22,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/commands/SignMessageCommandTest.js":{"size":2752,"mtime":1540207016027,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/commands/SignMessageCommandTest.js","messages":[{"ruleId":"unicorn/catch-error-name","severity":2,"message":"The catch parameter should be named `error2`.","line":76,"column":18,"nodeType":"Identifier","endLine":76,"endColumn":23}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/controllers/MethodControllerTest.js":{"size":5458,"mtime":1540205203086,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/controllers/MethodControllerTest.js","messages":[{"ruleId":"no-unused-vars","severity":2,"message":"'promiEventPackageMock' is assigned a value but never used.","line":24,"column":9,"nodeType":"Identifier","endLine":24,"endColumn":30},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":58,"column":52,"nodeType":"Identifier","endLine":58,"endColumn":54},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":59,"column":52,"nodeType":"Identifier","endLine":59,"endColumn":54},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":60,"column":59,"nodeType":"Identifier","endLine":60,"endColumn":61},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":61,"column":53,"nodeType":"Identifier","endLine":61,"endColumn":55},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":62,"column":52,"nodeType":"Identifier","endLine":62,"endColumn":54},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":79,"column":9,"nodeType":"ExpressionStatement","endLine":79,"endColumn":80},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":79,"column":69,"nodeType":"Identifier","endLine":79,"endColumn":71},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":99,"column":9,"nodeType":"ExpressionStatement","endLine":99,"endColumn":80},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":99,"column":69,"nodeType":"Identifier","endLine":99,"endColumn":71},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":117,"column":9,"nodeType":"ExpressionStatement","endLine":117,"endColumn":76},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":117,"column":65,"nodeType":"Identifier","endLine":117,"endColumn":67},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":140,"column":9,"nodeType":"ExpressionStatement","endLine":140,"endColumn":76},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":140,"column":65,"nodeType":"Identifier","endLine":140,"endColumn":67},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":163,"column":9,"nodeType":"ExpressionStatement","endLine":163,"endColumn":76},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":163,"column":65,"nodeType":"Identifier","endLine":163,"endColumn":67}],"errorCount":16,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js":{"size":3866,"mtime":1540205203104,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/factories/MethodPackageFactoryTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":73,"nodeType":"Identifier","endLine":28,"endColumn":75},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":32,"column":64,"nodeType":"Identifier","endLine":32,"endColumn":66},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":36,"column":70,"nodeType":"Identifier","endLine":36,"endColumn":72},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":40,"column":77,"nodeType":"Identifier","endLine":40,"endColumn":79},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":46,"column":65,"nodeType":"Identifier","endLine":46,"endColumn":67},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":50,"column":84,"nodeType":"Identifier","endLine":50,"endColumn":86},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":56,"column":64,"nodeType":"Identifier","endLine":56,"endColumn":66},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":60,"column":60,"nodeType":"Identifier","endLine":60,"endColumn":62},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":64,"column":75,"nodeType":"Identifier","endLine":64,"endColumn":77},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":70,"column":74,"nodeType":"Identifier","endLine":70,"endColumn":76},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":76,"column":64,"nodeType":"Identifier","endLine":76,"endColumn":66}],"errorCount":11,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js":{"size":1306,"mtime":1540205203114,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/account/GetAccountsMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js":{"size":1932,"mtime":1540205203129,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/account/GetBalanceMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":63,"column":42,"nodeType":"Identifier","endLine":63,"endColumn":44}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js":{"size":1980,"mtime":1540205203142,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/account/GetTransactionCountMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":26,"column":33,"nodeType":"Identifier","endLine":26,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":30,"column":40,"nodeType":"Identifier","endLine":30,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js":{"size":2300,"mtime":1540205203156,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetBlockMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":43,"column":9,"nodeType":"ExpressionStatement","endLine":43,"endColumn":48},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":43,"column":37,"nodeType":"Identifier","endLine":43,"endColumn":39},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":62,"column":9,"nodeType":"ExpressionStatement","endLine":62,"endColumn":48},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":62,"column":37,"nodeType":"Identifier","endLine":62,"endColumn":39},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":76,"column":42,"nodeType":"Identifier","endLine":76,"endColumn":44}],"errorCount":7,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js":{"size":1307,"mtime":1540205203166,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetBlockNumberMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js":{"size":2418,"mtime":1540205203184,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetBlockTransactionCountMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":26,"column":33,"nodeType":"Identifier","endLine":26,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":30,"column":40,"nodeType":"Identifier","endLine":30,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js":{"size":2339,"mtime":1540205203196,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetBlockUncleCountMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":27,"column":33,"nodeType":"Identifier","endLine":27,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":31,"column":40,"nodeType":"Identifier","endLine":31,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js":{"size":2732,"mtime":1540205203212,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/block/GetUncleMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":26,"column":33,"nodeType":"Identifier","endLine":26,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":30,"column":40,"nodeType":"Identifier","endLine":30,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":90,"column":42,"nodeType":"Identifier","endLine":90,"endColumn":44}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js":{"size":1646,"mtime":1540205203227,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/CallMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":48,"column":37,"nodeType":"Identifier","endLine":48,"endColumn":39},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":57,"column":46,"nodeType":"Identifier","endLine":57,"endColumn":48}],"errorCount":4,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js":{"size":1655,"mtime":1540205203242,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/EstimateGasMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":26,"column":33,"nodeType":"Identifier","endLine":26,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":30,"column":40,"nodeType":"Identifier","endLine":30,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":44,"column":37,"nodeType":"Identifier","endLine":44,"endColumn":39}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js":{"size":1659,"mtime":1540205203256,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/GetCodeMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":57,"column":46,"nodeType":"Identifier","endLine":57,"endColumn":48}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js":{"size":1646,"mtime":1540205203271,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/GetPastLogsMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":42,"column":37,"nodeType":"Identifier","endLine":42,"endColumn":39},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":54,"column":47,"nodeType":"Identifier","endLine":54,"endColumn":49}],"errorCount":4,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js":{"size":2148,"mtime":1540205203285,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/GetStorageAtMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":26,"column":33,"nodeType":"Identifier","endLine":26,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":30,"column":40,"nodeType":"Identifier","endLine":30,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":70,"column":46,"nodeType":"Identifier","endLine":70,"endColumn":48}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js":{"size":1001,"mtime":1540205203305,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/network/GetProtocolVersionMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":17,"column":33,"nodeType":"Identifier","endLine":17,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":21,"column":40,"nodeType":"Identifier","endLine":21,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js":{"size":944,"mtime":1540205203325,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/network/ListeningMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":17,"column":33,"nodeType":"Identifier","endLine":17,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":21,"column":40,"nodeType":"Identifier","endLine":21,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js":{"size":1281,"mtime":1540205203359,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/network/PeerCountMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js":{"size":1283,"mtime":1540205203378,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/network/VersionMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js":{"size":1146,"mtime":1540205203394,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetCoinbaseMethodModelTest.js","messages":[{"ruleId":"no-unused-vars","severity":2,"message":"'utilsMock' is assigned a value but never used.","line":12,"column":16,"nodeType":"Identifier","endLine":12,"endColumn":25},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js":{"size":1391,"mtime":1540205203412,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetGasPriceMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":45,"column":46,"nodeType":"Identifier","endLine":45,"endColumn":48}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js":{"size":1286,"mtime":1540205203432,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetHashrateMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js":{"size":961,"mtime":1540205203455,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetNodeInfoMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":17,"column":33,"nodeType":"Identifier","endLine":17,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":21,"column":40,"nodeType":"Identifier","endLine":21,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js":{"size":927,"mtime":1540205203476,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/GetWorkMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":17,"column":33,"nodeType":"Identifier","endLine":17,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":21,"column":40,"nodeType":"Identifier","endLine":21,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js":{"size":930,"mtime":1540205203486,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/IsMiningMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":17,"column":33,"nodeType":"Identifier","endLine":17,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":21,"column":40,"nodeType":"Identifier","endLine":21,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js":{"size":1369,"mtime":1540205203497,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/IsSyncingMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":45,"column":42,"nodeType":"Identifier","endLine":45,"endColumn":44}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js":{"size":954,"mtime":1540205203506,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/node/SubmitWorkMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":17,"column":33,"nodeType":"Identifier","endLine":17,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":21,"column":40,"nodeType":"Identifier","endLine":21,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js":{"size":1633,"mtime":1540205203535,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/EcRecoverMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":48,"column":37,"nodeType":"Identifier","endLine":48,"endColumn":39}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js":{"size":976,"mtime":1540205203549,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/ImportRawKeyMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":17,"column":33,"nodeType":"Identifier","endLine":17,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":21,"column":40,"nodeType":"Identifier","endLine":21,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js":{"size":1336,"mtime":1540205203563,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/ListAccountsMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js":{"size":1395,"mtime":1540205203589,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/LockAccountMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js":{"size":1317,"mtime":1540205203601,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/NewAccountMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js":{"size":1496,"mtime":1540205203648,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/PersonalSendTransactionMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":44,"column":37,"nodeType":"Identifier","endLine":44,"endColumn":39}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js":{"size":1623,"mtime":1540205203681,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/PersonalSignMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js":{"size":1438,"mtime":1540205203707,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/personal/UnlockAccountMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js":{"size":3120,"mtime":1540205203724,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/shh/GenericShhMethodModelsTest.js","messages":[{"ruleId":"new-cap","severity":2,"message":"A constructor name should not start with a lowercase letter.","line":117,"column":25,"nodeType":"NewExpression"}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js":{"size":1739,"mtime":1540205203738,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/SignMethodModelTest.js","messages":[{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":24,"column":9,"nodeType":"ExpressionStatement","endLine":24,"endColumn":48},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":37,"nodeType":"Identifier","endLine":24,"endColumn":39},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":33,"nodeType":"Identifier","endLine":28,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":32,"column":40,"nodeType":"Identifier","endLine":32,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":61,"column":46,"nodeType":"Identifier","endLine":61,"endColumn":48}],"errorCount":5,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js":{"size":3184,"mtime":1540205203751,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/GetTransactionFromBlockMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":26,"column":33,"nodeType":"Identifier","endLine":26,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":30,"column":40,"nodeType":"Identifier","endLine":30,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":100,"column":42,"nodeType":"Identifier","endLine":100,"endColumn":44}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js":{"size":1428,"mtime":1540205203763,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/GetTransactionMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":46,"column":42,"nodeType":"Identifier","endLine":46,"endColumn":44}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js":{"size":1465,"mtime":1540205203774,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/GetTransactionReceiptMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":46,"column":42,"nodeType":"Identifier","endLine":46,"endColumn":44}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js":{"size":1055,"mtime":1540205203783,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/SendSignedTransactionMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":17,"column":33,"nodeType":"Identifier","endLine":17,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":21,"column":40,"nodeType":"Identifier","endLine":21,"endColumn":42}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js":{"size":1556,"mtime":1540205203797,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/SendTransactionMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":32,"nodeType":"Identifier","endLine":24,"endColumn":34},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":33,"nodeType":"Identifier","endLine":28,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":32,"column":40,"nodeType":"Identifier","endLine":32,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":46,"column":37,"nodeType":"Identifier","endLine":46,"endColumn":39}],"errorCount":4,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js":{"size":1425,"mtime":1540205203808,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/methods/transaction/SignTransactionMethodModelTest.js","messages":[{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":24,"column":33,"nodeType":"Identifier","endLine":24,"endColumn":35},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":28,"column":40,"nodeType":"Identifier","endLine":28,"endColumn":42},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":42,"column":37,"nodeType":"Identifier","endLine":42,"endColumn":39}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js":{"size":3133,"mtime":1540205203842,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/models/TransactionConfirmationModelTest.js","messages":[{"ruleId":"jest/no-identical-title","severity":2,"message":"Test title is used multiple times in the same describe block.","line":97,"column":5,"nodeType":"CallExpression","endLine":100,"endColumn":7}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/signers/MessageSignerTest.js":{"size":1602,"mtime":1540205203852,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/signers/MessageSignerTest.js","messages":[{"ruleId":"no-unused-vars","severity":2,"message":"'providerMock' is assigned a value but never used.","line":13,"column":34,"nodeType":"Identifier","endLine":13,"endColumn":46},{"ruleId":"no-unused-vars","severity":2,"message":"'providerAdapterMock' is assigned a value but never used.","line":13,"column":65,"nodeType":"Identifier","endLine":13,"endColumn":84}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/signers/TransactionSignerTest.js":{"size":1893,"mtime":1540205203863,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/signers/TransactionSignerTest.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token function","line":38,"column":59}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js":{"size":1874,"mtime":1540205203874,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/validators/TransactionReceiptValidatorTest.js","messages":[{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":17,"column":9,"nodeType":"ExpressionStatement","endLine":30,"endColumn":22},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":30,"column":11,"nodeType":"Identifier","endLine":30,"endColumn":13},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":47,"column":23,"nodeType":"Identifier","endLine":47,"endColumn":25},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":48,"column":31,"nodeType":"Identifier","endLine":48,"endColumn":33},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":65,"column":23,"nodeType":"Identifier","endLine":65,"endColumn":25},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":66,"column":31,"nodeType":"Identifier","endLine":66,"endColumn":33}],"errorCount":6,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js":{"size":3421,"mtime":1540205203892,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/watchers/NewHeadsWatcherTest.js","messages":[{"ruleId":"no-unused-vars","severity":2,"message":"'providerMock' is assigned a value but never used.","line":16,"column":9,"nodeType":"Identifier","endLine":16,"endColumn":21},{"ruleId":"no-unused-vars","severity":2,"message":"'providerAdapterMock' is assigned a value but never used.","line":18,"column":9,"nodeType":"Identifier","endLine":18,"endColumn":28},{"ruleId":"no-unused-vars","severity":2,"message":"'moduleInstanceMock' is assigned a value but never used.","line":20,"column":9,"nodeType":"Identifier","endLine":20,"endColumn":27},{"ruleId":"new-cap","severity":2,"message":"A constructor name should not start with a lowercase letter.","line":27,"column":57,"nodeType":"NewExpression"},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":38,"column":54,"nodeType":"Identifier","endLine":38,"endColumn":56},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":39,"column":9,"nodeType":"ExpressionStatement","endLine":39,"endColumn":69},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":39,"column":58,"nodeType":"Identifier","endLine":39,"endColumn":60},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":40,"column":9,"nodeType":"ExpressionStatement","endLine":40,"endColumn":55},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":40,"column":43,"nodeType":"Identifier","endLine":40,"endColumn":45},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":41,"column":9,"nodeType":"ExpressionStatement","endLine":41,"endColumn":65},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":41,"column":54,"nodeType":"Identifier","endLine":41,"endColumn":56},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":56,"column":9,"nodeType":"ExpressionStatement","endLine":56,"endColumn":60},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":56,"column":49,"nodeType":"Identifier","endLine":56,"endColumn":51},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":57,"column":60,"nodeType":"Identifier","endLine":57,"endColumn":62}],"errorCount":14,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js":{"size":4616,"mtime":1540205203921,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-method/tests/workflows/TransactionConfirmationWorkflowTest.js","messages":[{"ruleId":"no-unused-vars","severity":2,"message":"'transactionConfirmationModelMock' is assigned a value but never used.","line":21,"column":9,"nodeType":"Identifier","endLine":21,"endColumn":41},{"ruleId":"no-unused-vars","severity":2,"message":"'moduleInstanceMock' is assigned a value but never used.","line":35,"column":9,"nodeType":"Identifier","endLine":35,"endColumn":27},{"ruleId":"no-unused-vars","severity":2,"message":"'promiEventMock' is assigned a value but never used.","line":37,"column":9,"nodeType":"Identifier","endLine":37,"endColumn":23},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":115,"column":33,"nodeType":"Identifier","endLine":115,"endColumn":35},{"ruleId":"no-unused-expressions","severity":2,"message":"Expected an assignment or function call and instead saw an expression.","line":118,"column":17,"nodeType":"ExpressionStatement","endLine":118,"endColumn":70},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":118,"column":59,"nodeType":"Identifier","endLine":118,"endColumn":61},{"ruleId":"jest/valid-expect","severity":2,"message":"No assertion was called on expect().","line":119,"column":17,"nodeType":"CallExpression","endLine":119,"endColumn":86},{"ruleId":"jest/valid-expect","severity":2,"message":"\"to\" is not a valid property of expect.","line":120,"column":34,"nodeType":"Identifier","endLine":120,"endColumn":36}],"errorCount":8,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-promievent/src/index.js":{"size":827,"mtime":1539865753463,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-promievent/src/index.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token PromiEvent","line":23,"column":8}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-promievent/src/PromiEvent.js":{"size":1774,"mtime":1540207016027,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-promievent/src/PromiEvent.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js":{"size":2069,"mtime":1540205203965,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/lib/models/AbstractSubscriptionModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js":{"size":3856,"mtime":1540205204002,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/factories/SubscriptionsFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js":{"size":1269,"mtime":1540205204010,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/factories/SubscriptionsModuleFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/index.js":{"size":1346,"mtime":1539950065182,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/index.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token LogSubscriptionModel","line":38,"column":8}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js":{"size":2891,"mtime":1540211083633,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/eth/LogSubscriptionModel.js","messages":[{"ruleId":"standard/no-callback-literal","severity":2,"message":"Unexpected literal in error position of callback.","line":59,"column":21,"nodeType":"CallExpression","endLine":59,"endColumn":41}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js":{"size":1584,"mtime":1540205204042,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewHeadsSubscriptionModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js":{"size":1230,"mtime":1540205204050,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/eth/NewPendingTransactionsSubscriptionModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js":{"size":2164,"mtime":1540205204059,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/eth/SyncingSubscriptionModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js":{"size":1246,"mtime":1540205204068,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/models/subscriptions/shh/MessagesSubscriptionModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/Subscription.js":{"size":5362,"mtime":1540205204085,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core-subscriptions/src/Subscription.js","messages":[{"ruleId":"standard/no-callback-literal","severity":2,"message":"Unexpected literal in error position of callback.","line":104,"column":17,"nodeType":"CallExpression","endLine":104,"endColumn":49},{"ruleId":"standard/no-callback-literal","severity":2,"message":"Unexpected literal in error position of callback.","line":163,"column":25,"nodeType":"CallExpression","endLine":163,"endColumn":46},{"ruleId":"standard/no-callback-literal","severity":2,"message":"Unexpected literal in error position of callback.","line":170,"column":21,"nodeType":"CallExpression","endLine":170,"endColumn":42}],"errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core/src/AbstractWeb3Module.js":{"size":8866,"mtime":1540207016027,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core/src/AbstractWeb3Module.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-core/src/index.js":{"size":843,"mtime":1539960609003,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-core/src/index.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token AbstractWeb3Module","line":23,"column":8}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-abi/src/ABICoder.js":{"size":9066,"mtime":1540211007391},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-abi/src/factories/ABIModuleFactory.js":{"size":1079,"mtime":1540205205388,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-abi/src/factories/ABIModuleFactory.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `AbiModuleFactory.js`.","line":23,"column":1,"nodeType":"Program","endLine":38,"endColumn":2}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-abi/src/index.js":{"size":1027,"mtime":1539961986927,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-abi/src/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-accounts/src/Accounts.js":{"size":21042,"mtime":1540210984915},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js":{"size":2302,"mtime":1540205207330,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-accounts/src/factories/AccountsModuleFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-accounts/src/factories/MethodModelFactory.js":{"size":1413,"mtime":1540205207337,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-accounts/src/factories/MethodModelFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-accounts/src/index.js":{"size":1585,"mtime":1540205207345,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-accounts/src/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/Contract.js":{"size":8090,"mtime":1540210742546,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/Contract.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js":{"size":1537,"mtime":1540205208378,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js":{"size":1547,"mtime":1540205208387,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/decoders/CallMethodResponseDecoder.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/decoders/EventLogDecoder.js":{"size":2017,"mtime":1540210886854,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/decoders/EventLogDecoder.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js":{"size":1361,"mtime":1540210872110,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/encoders/AllEventsFilterEncoder.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js":{"size":1957,"mtime":1540210856588,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/encoders/EventFilterEncoder.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/encoders/MethodEncoder.js":{"size":1999,"mtime":1540205208438,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/encoders/MethodEncoder.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/factories/ContractModuleFactory.js":{"size":9352,"mtime":1540210835682,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/factories/ContractModuleFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js":{"size":2820,"mtime":1540205208472,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/factories/EventSubscriptionFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/factories/RpcMethodModelFactory.js":{"size":4637,"mtime":1540209101986},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/index.js":{"size":2029,"mtime":1540205208506,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/index.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token ContractDeployMethodModel","line":61,"column":8}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/mappers/ABIMapper.js":{"size":4477,"mtime":1540210785935,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/mappers/ABIMapper.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `AbiMapper.js`.","line":23,"column":1,"nodeType":"Program","endLine":133,"endColumn":2}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js":{"size":1975,"mtime":1540205208543,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/mappers/AllEventsOptionsMapper.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js":{"size":2136,"mtime":1540205208558,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/mappers/EventOptionsMapper.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js":{"size":1854,"mtime":1540205208571,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/mappers/RpcMethodOptionsMapper.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/abi/ABIItemModel.js":{"size":3180,"mtime":1540205208583,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/abi/ABIItemModel.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `AbiItemModel.js`.","line":23,"column":1,"nodeType":"Program","endLine":127,"endColumn":2}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/abi/ABIModel.js":{"size":2639,"mtime":1540205208592,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/abi/ABIModel.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `AbiModel.js`.","line":23,"column":1,"nodeType":"Program","endLine":118,"endColumn":2}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js":{"size":1673,"mtime":1540205208609,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/methods/CallContractMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js":{"size":1641,"mtime":1540205208626,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/methods/ContractDeployMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js":{"size":1670,"mtime":1540205208641,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/methods/PastEventLogsMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js":{"size":2587,"mtime":1540205208650,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/methods/SendContractMethodModel.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js":{"size":1926,"mtime":1540205208659,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/subscriptions/AllEventsLogSubscription.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js":{"size":2009,"mtime":1540205208669,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/models/subscriptions/EventLogSubscription.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js":{"size":5151,"mtime":1540210742537,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/proxies/EventSubscriptionsProxy.js","messages":[{"ruleId":"no-undef","severity":2,"message":"'error' is not defined.","line":162,"column":22,"nodeType":"Identifier","endLine":162,"endColumn":27}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/proxies/MethodsProxy.js":{"size":8786,"mtime":1540210500383,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/proxies/MethodsProxy.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-contract/src/validators/RpcMethodOptionsValidator.js":{"size":2992,"mtime":1540210410675},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/ressources/ABI/Registry.js":{"size":4142,"mtime":1540205210008,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/ressources/ABI/Registry.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/ressources/ABI/Resolver.js":{"size":7224,"mtime":1540205210040,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/ressources/ABI/Resolver.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/contracts/Registry.js":{"size":4918,"mtime":1540210384108,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/contracts/Registry.js","messages":[{"ruleId":"standard/no-callback-literal","severity":2,"message":"Unexpected literal in error position of callback.","line":85,"column":29,"nodeType":"CallExpression","endLine":85,"endColumn":53}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/ENS.js":{"size":5115,"mtime":1540205210064,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/ENS.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `Ens.js`.","line":20,"column":1,"nodeType":"Program","endLine":189,"endColumn":2}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/factories/ENSModuleFactory.js":{"size":2586,"mtime":1540205210072,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/factories/ENSModuleFactory.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `EnsModuleFactory.js`.","line":20,"column":1,"nodeType":"Program","endLine":77,"endColumn":2}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js":{"size":6192,"mtime":1540207016030,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/handlers/ResolverMethodHandler.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/index.js":{"size":1518,"mtime":1540205210092,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-ens/src/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-iban/src/Iban.js":{"size":7457,"mtime":1540210241704},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-iban/src/index.js":{"size":817,"mtime":1539865753519,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-iban/src/index.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token Iban","line":23,"column":8}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-personal/src/factories/MethodModelFactory.js":{"size":1940,"mtime":1540205211987,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-personal/src/factories/MethodModelFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js":{"size":2397,"mtime":1540205211997,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-personal/src/factories/PersonalModuleFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-personal/src/index.js":{"size":1687,"mtime":1539962150906,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-personal/src/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth-personal/src/Personal.js":{"size":3379,"mtime":1540205212025,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth-personal/src/Personal.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth/src/Eth.js":{"size":6431,"mtime":1540210202577},"/Users/sam/Development/foundation/web3.js/packages/web3-eth/src/factories/EthModuleFactory.js":{"size":2969,"mtime":1540205212063,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth/src/factories/EthModuleFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth/src/factories/MethodModelFactory.js":{"size":4005,"mtime":1540205212073,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth/src/factories/MethodModelFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-eth/src/index.js":{"size":2130,"mtime":1540205212090,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-eth/src/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-net/src/factories/MethodModelFactory.js":{"size":1454,"mtime":1540205213067,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-net/src/factories/MethodModelFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-net/src/factories/NetworkModuleFactory.js":{"size":2337,"mtime":1540205213076,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-net/src/factories/NetworkModuleFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-net/src/index.js":{"size":1585,"mtime":1540205213088,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-net/src/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-net/src/Network.js":{"size":3998,"mtime":1540210128359},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js":{"size":4024,"mtime":1540209964152,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/lib/adapters/AbstractProviderAdapter.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/adapters/HttpProviderAdapter.js":{"size":1154,"mtime":1540205213290,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/adapters/HttpProviderAdapter.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/adapters/InpageProviderAdapter.js":{"size":1504,"mtime":1540205213297,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/adapters/InpageProviderAdapter.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/adapters/SocketProviderAdapter.js":{"size":4531,"mtime":1540205213340,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/adapters/SocketProviderAdapter.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/batch-request/BatchRequest.js":{"size":3317,"mtime":1540209901630,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/batch-request/BatchRequest.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/detectors/ProviderDetector.js":{"size":3379,"mtime":1540209680072},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/factories/ProvidersModuleFactory.js":{"size":4329,"mtime":1540205213398,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/factories/ProvidersModuleFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/index.js":{"size":2142,"mtime":1539962534120,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/index.js","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: Unexpected token SocketProviderAdapter","line":22,"column":8}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/mappers/JSONRpcMapper.js":{"size":1952,"mtime":1540205213425,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/mappers/JSONRpcMapper.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `JsonRpcMapper.js`.","line":23,"column":1,"nodeType":"Program","endLine":67,"endColumn":2}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/providers/HttpProvider.js":{"size":3614,"mtime":1540209620664,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/providers/HttpProvider.js","messages":[{"ruleId":"no-unused-vars","severity":2,"message":"'error' is assigned a value but never used.","line":97,"column":21,"nodeType":"Identifier","endLine":97,"endColumn":26},{"ruleId":"no-ex-assign","severity":2,"message":"Do not assign to the exception parameter.","line":102,"column":21,"nodeType":"Identifier","messageId":"unexpected","endLine":102,"endColumn":26}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/providers/IpcProvider.js":{"size":9005,"mtime":1540209101991},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/providers/WebsocketProvider.js":{"size":12351,"mtime":1540209569556},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/resolvers/ProviderAdapterResolver.js":{"size":3011,"mtime":1540209415933},"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/validators/JSONRpcResponseValidator.js":{"size":1709,"mtime":1540205213541,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-providers/src/validators/JSONRpcResponseValidator.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `JsonRpcResponseValidator.js`.","line":23,"column":1,"nodeType":"Program","endLine":59,"endColumn":2}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-shh/src/factories/MethodModelFactory.js":{"size":2945,"mtime":1540205214520,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-shh/src/factories/MethodModelFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-shh/src/factories/ShhModuleFactory.js":{"size":2356,"mtime":1540205214528,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-shh/src/factories/ShhModuleFactory.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-shh/src/index.js":{"size":1745,"mtime":1539962585238,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-shh/src/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-shh/src/Shh.js":{"size":2944,"mtime":1540207016032,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-shh/src/Shh.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-utils/src/bloomFilter.js":{"size":2940,"mtime":1540207016032,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-utils/src/bloomFilter.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `BloomFilter.js`.","line":32,"column":1,"nodeType":"Program","endLine":111,"endColumn":3},{"ruleId":"no-throw-literal","severity":2,"message":"Expected an object to be thrown.","line":50,"column":5,"nodeType":"ThrowStatement","endLine":50,"endColumn":27},{"ruleId":"no-throw-literal","severity":2,"message":"Expected an object to be thrown.","line":83,"column":9,"nodeType":"ThrowStatement","endLine":83,"endColumn":37},{"ruleId":"no-throw-literal","severity":2,"message":"Expected an object to be thrown.","line":86,"column":9,"nodeType":"ThrowStatement","endLine":86,"endColumn":53},{"ruleId":"no-throw-literal","severity":2,"message":"Expected an object to be thrown.","line":102,"column":32,"nodeType":"ThrowStatement","endLine":102,"endColumn":54},{"ruleId":"no-throw-literal","severity":2,"message":"Expected an object to be thrown.","line":103,"column":32,"nodeType":"ThrowStatement","endLine":103,"endColumn":54}],"errorCount":6,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-utils/src/index.js":{"size":10772,"mtime":1540209383059,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-utils/src/index.js","messages":[{"ruleId":"unicorn/explicit-length-check","severity":2,"message":"`length` property should be compared to a value.","line":62,"column":59,"nodeType":"MemberExpression","endLine":62,"endColumn":92},{"ruleId":"no-undef","severity":2,"message":"'_' is not defined.","line":305,"column":5,"nodeType":"Identifier","endLine":305,"endColumn":6}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-utils/src/soliditySha3.js":{"size":7100,"mtime":1540207016033,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-utils/src/soliditySha3.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `SoliditySha3.js`.","line":23,"column":1,"nodeType":"Program","endLine":244,"endColumn":29},{"ruleId":"no-undef","severity":2,"message":"'arguments' is not defined.","line":234,"column":45,"nodeType":"Identifier","endLine":234,"endColumn":54}],"errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3-utils/src/utils.js":{"size":11890,"mtime":1540208829580,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3-utils/src/utils.js","messages":[{"ruleId":"unicorn/filename-case","severity":2,"message":"Filename is not in pascal case. Rename it to `Utils.js`.","line":23,"column":1,"nodeType":"Program","endLine":469,"endColumn":3},{"ruleId":"no-undef","severity":2,"message":"'arguments' is not defined.","line":61,"column":39,"nodeType":"Identifier","endLine":61,"endColumn":48},{"ruleId":"no-control-regex","severity":2,"message":"Unexpected control character(s) in regular expression: \\x00.","line":172,"column":23,"nodeType":"Literal","messageId":"unexpected","endLine":172,"endColumn":37},{"ruleId":"no-control-regex","severity":2,"message":"Unexpected control character(s) in regular expression: \\x00.","line":177,"column":23,"nodeType":"Literal","messageId":"unexpected","endLine":177,"endColumn":37},{"ruleId":"no-undef","severity":2,"message":"'hex' is not defined.","line":298,"column":17,"nodeType":"Identifier","endLine":298,"endColumn":20},{"ruleId":"no-undef","severity":2,"message":"'bytes' is not defined.","line":320,"column":12,"nodeType":"Identifier","endLine":320,"endColumn":17}],"errorCount":6,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"hashOfConfig":"trpxlu"},"/Users/sam/Development/foundation/web3.js/packages/web3/src/index.js":{"size":4210,"mtime":1540207016033,"results":{"filePath":"/Users/sam/Development/foundation/web3.js/packages/web3/src/index.js","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"hashOfConfig":"trpxlu"}} \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000000..90dc43194a7 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,7 @@ +node_modules +coverage +test +docs/_build +dist +package.js +webpack.config.js diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000000..b3132953eeb --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,47 @@ +{ + "env": { + "browser": true, + "commonjs": true, + "es6": true, + "node": true, + "jest/globals": true + }, + "extends": [ + "standard", + "plugin:unicorn/recommended", + "plugin:jest/recommended", + "prettier", + "prettier/standard", + "prettier/unicorn" + ], + "parserOptions": { + "ecmaVersion": 2015, + "sourceType": "module" + }, + "plugins": [ + "prettier", + "standard", + "unicorn", + "jest" + ], + "rules": { + "unicorn/filename-case": ["error", {"case": "pascalCase"}], + "prettier/prettier": "error", + "indent": [ + "error", + 4 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ] + } +} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 1895102c047..00000000000 --- a/.prettierignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -dist -_build -build -coverage diff --git a/docs/_build/html/_static/doctools.js b/docs/_build/html/_static/doctools.js index 81634956358..12ab43cb829 100644 --- a/docs/_build/html/_static/doctools.js +++ b/docs/_build/html/_static/doctools.js @@ -31,7 +31,7 @@ if (!window.console || !console.firebug) { * small helper function to urldecode strings */ jQuery.urldecode = function(x) { - return decodeURIComponent(x).replace(/\+/g, ' '); + return decodeURIComponent(x).replace(/\+/g, ' '); }; /** @@ -45,20 +45,20 @@ jQuery.urlencode = encodeURIComponent; * it will always return arrays of strings for the value parts. */ jQuery.getQueryParameters = function(s) { - if (typeof s == 'undefined') - s = document.location.search; - var parts = s.substr(s.indexOf('?') + 1).split('&'); - var result = {}; - for (var i = 0; i < parts.length; i++) { - var tmp = parts[i].split('=', 2); - var key = jQuery.urldecode(tmp[0]); - var value = jQuery.urldecode(tmp[1]); - if (key in result) - result[key].push(value); - else - result[key] = [value]; - } - return result; + if (typeof s === 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; }; /** @@ -66,29 +66,29 @@ jQuery.getQueryParameters = function(s) { * span elements with the given class name. */ jQuery.fn.highlightText = function(text, className) { - function highlight(node) { - if (node.nodeType == 3) { - var val = node.nodeValue; - var pos = val.toLowerCase().indexOf(text); - if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { - var span = document.createElement("span"); - span.className = className; - span.appendChild(document.createTextNode(val.substr(pos, text.length))); - node.parentNode.insertBefore(span, node.parentNode.insertBefore( - document.createTextNode(val.substr(pos + text.length)), - node.nextSibling)); - node.nodeValue = val.substr(0, pos); - } + function highlight(node) { + if (node.nodeType == 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { + var span = document.createElement('span'); + span.className = className; + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + } + } + else if (!jQuery(node).is('button, select, textarea')) { + jQuery.each(node.childNodes, function() { + highlight(this); + }); + } } - else if (!jQuery(node).is("button, select, textarea")) { - jQuery.each(node.childNodes, function() { + return this.each(function() { highlight(this); - }); - } - } - return this.each(function() { - highlight(this); - }); + }); }; /* @@ -96,23 +96,23 @@ jQuery.fn.highlightText = function(text, className) { * This will be supported until firefox bug is fixed. */ if (!jQuery.browser) { - jQuery.uaMatch = function(ua) { - ua = ua.toLowerCase(); + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); - var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || - ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; - return { - browser: match[ 1 ] || "", - version: match[ 2 ] || "0" + return { + browser: match[ 1 ] || '', + version: match[ 2 ] || '0' + }; }; - }; - jQuery.browser = {}; - jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; } /** @@ -120,168 +120,168 @@ if (!jQuery.browser) { */ var Documentation = { - init : function() { - this.fixFirefoxAnchorBug(); - this.highlightSearchWords(); - this.initIndexTable(); + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); - }, + }, - /** + /** * i18n support */ - TRANSLATIONS : {}, - PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, - LOCALE : 'unknown', + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, + LOCALE : 'unknown', - // gettext and ngettext don't access this so that the functions - // can safely bound to a different name (_ = Documentation.gettext) - gettext : function(string) { - var translated = Documentation.TRANSLATIONS[string]; - if (typeof translated == 'undefined') - return string; - return (typeof translated == 'string') ? translated : translated[0]; - }, + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated === 'undefined') + return string; + return (typeof translated === 'string') ? translated : translated[0]; + }, - ngettext : function(singular, plural, n) { - var translated = Documentation.TRANSLATIONS[singular]; - if (typeof translated == 'undefined') - return (n == 1) ? singular : plural; - return translated[Documentation.PLURALEXPR(n)]; - }, + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated === 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, - addTranslations : function(catalog) { - for (var key in catalog.messages) - this.TRANSLATIONS[key] = catalog.messages[key]; - this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); - this.LOCALE = catalog.locale; - }, + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, - /** + /** * add context elements like header anchor links */ - addContextElements : function() { - $('div[id] > :header:first').each(function() { - $('\u00B6'). - attr('href', '#' + this.id). - attr('title', _('Permalink to this headline')). - appendTo(this); - }); - $('dt[id]').each(function() { - $('\u00B6'). - attr('href', '#' + this.id). - attr('title', _('Permalink to this definition')). - appendTo(this); - }); - }, + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, - /** + /** * workaround a firefox stupidity * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 */ - fixFirefoxAnchorBug : function() { - if (document.location.hash) - window.setTimeout(function() { - document.location.href += ''; - }, 10); - }, + fixFirefoxAnchorBug : function() { + if (document.location.hash) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, - /** + /** * highlight the search words provided in the url in the text */ - highlightSearchWords : function() { - var params = $.getQueryParameters(); - var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; - if (terms.length) { - var body = $('div.body'); - if (!body.length) { - body = $('body'); - } - window.setTimeout(function() { - $.each(terms, function() { - body.highlightText(this.toLowerCase(), 'highlighted'); - }); - }, 10); - $('') - .appendTo($('#searchbox')); - } - }, + .appendTo($('#searchbox')); + } + }, - /** + /** * init the domain index toggle buttons */ - initIndexTable : function() { - var togglers = $('img.toggler').click(function() { - var src = $(this).attr('src'); - var idnum = $(this).attr('id').substr(7); - $('tr.cg-' + idnum).toggle(); - if (src.substr(-9) == 'minus.png') - $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); - else - $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); - }).css('display', ''); - if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { - togglers.click(); - } - }, + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) == 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, - /** + /** * helper function to hide the search marks again */ - hideSearchWords : function() { - $('#searchbox .highlight-link').fadeOut(300); - $('span.highlighted').removeClass('highlighted'); - }, + hideSearchWords : function() { + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, - /** + /** * make the url absolute */ - makeURL : function(relativeURL) { - return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; - }, + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, - /** + /** * get the current relative url */ - getCurrentURL : function() { - var path = document.location.pathname; - var parts = path.split(/\//); - $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { - if (this == '..') - parts.pop(); - }); - var url = parts.join('/'); - return path.substring(url.lastIndexOf('/') + 1, path.length - 1); - }, + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this == '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, - initOnKeyListeners: function() { - $(document).keyup(function(event) { - var activeElementType = document.activeElement.tagName; - // don't navigate when in search box or textarea - if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { - switch (event.keyCode) { - case 37: // left - var prevHref = $('link[rel="prev"]').prop('href'); - if (prevHref) { - window.location.href = prevHref; - return false; + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } } - case 39: // right - var nextHref = $('link[rel="next"]').prop('href'); - if (nextHref) { - window.location.href = nextHref; - return false; - } - } - } - }); - } + }); + } }; // quick alias for translations _ = Documentation.gettext; $(document).ready(function() { - Documentation.init(); + Documentation.init(); }); \ No newline at end of file diff --git a/docs/_build/html/_static/jquery-1.11.1.js b/docs/_build/html/_static/jquery-1.11.1.js index d4b67f7e6c1..0b0e7883653 100644 --- a/docs/_build/html/_static/jquery-1.11.1.js +++ b/docs/_build/html/_static/jquery-1.11.1.js @@ -14,575 +14,623 @@ (function( global, factory ) { - if ( typeof module === "object" && typeof module.exports === "object" ) { - // For CommonJS and CommonJS-like environments where a proper window is present, - // execute the factory and get jQuery - // For environments that do not inherently posses a window with a document - // (such as Node.js), expose a jQuery-making factory as module.exports - // This accentuates the need for the creation of a real window - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + // For CommonJS and CommonJS-like environments where a proper window is present, + // execute the factory and get jQuery + // For environments that do not inherently posses a window with a document + // (such as Node.js), expose a jQuery-making factory as module.exports + // This accentuates the need for the creation of a real window + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( 'jQuery requires a window with a document' ); + } + return factory( w ); + }; + } else { + factory( global ); + } // Pass this if window is not defined yet -}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { +}(typeof window !== 'undefined' ? window : this, function( window, noGlobal ) { -// Can't do this because several apps including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -// + // Can't do this because several apps including ASP.NET trace + // the stack via arguments.caller.callee and Firefox dies if + // you try to trace through "use strict" call chains. (#13335) + // Support: Firefox 18+ + // -var deletedIds = []; + var deletedIds = []; -var slice = deletedIds.slice; + var slice = deletedIds.slice; -var concat = deletedIds.concat; + var concat = deletedIds.concat; -var push = deletedIds.push; + var push = deletedIds.push; -var indexOf = deletedIds.indexOf; + var indexOf = deletedIds.indexOf; -var class2type = {}; + var class2type = {}; -var toString = class2type.toString; + var toString = class2type.toString; -var hasOwn = class2type.hasOwnProperty; + var hasOwn = class2type.hasOwnProperty; -var support = {}; + var support = {}; -var - version = "1.11.1", + var + version = '1.11.1'; - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }, - // Support: Android<4.1, IE<9 - // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + // Define a local copy of jQuery + + var jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }; - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }; + // Support: Android<4.1, IE<9 + // Make sure we trim BOM and NBSP + + var rtrim = /^[\s\uFEFF\u00A0]+|[\s\uFEFF\u00A0]+$/g; -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: version, - constructor: jQuery, + // Matches dashed string for camelizing + + var rmsPrefix = /^-ms-/; - // Start with an empty selector - selector: "", + + var rdashAlpha = /-([\da-z])/gi; - // The default length of a jQuery object is 0 - length: 0, - toArray: function() { - return slice.call( this ); - }, + // Used by jQuery.camelCase as callback to replace() + + var fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num != null ? + jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: version, - // Return just the one element from the set - ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + constructor: jQuery, - // Return all the elements in a clean array - slice.call( this ); - }, + // Start with an empty selector + selector: '', - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { + // The default length of a jQuery object is 0 + length: 0, - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); + toArray: function() { + return slice.call( this ); + }, - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num != null ? - // Return the newly-formed element set - return ret; - }, + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, + // Return all the elements in a clean array + slice.call( this ); + }, - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: deletedIds.sort, - splice: deletedIds.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - /* jshint eqeqeq: false */ - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - // parseFloat NaNs numeric-cast false positives (null|true|false|"") - // ...but misinterprets leading-number strings, particularly hex literals ("0x...") - // subtraction forces infinities to NaN - return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0; - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - isPlainObject: function( obj ) { - var key; - - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Support: IE<9 - // Handle iteration over inherited properties before own properties. - if ( support.ownLast ) { - for ( key in obj ) { - return hasOwn.call( obj, key ); - } - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - type: function( obj ) { - if ( obj == null ) { - return obj + ""; - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call(obj) ] || "object" : - typeof obj; - }, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Support: Android<4.1, IE<9 - trim: function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( indexOf ) { - return indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - while ( j < len ) { - first[ i++ ] = second[ j++ ]; - } - - // Support: IE<9 - // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) - if ( len !== len ) { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); - }; + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; - return proxy; - }, + // Return the newly-formed element set + return ret; + }, - now: function() { - return +( new Date() ); - }, + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -}); + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); + first: function() { + return this.eq( 0 ); + }, - if ( type === "function" || jQuery.isWindow( obj ) ) { - return false; - } + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length; + + + var j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: deletedIds.sort, + splice: deletedIds.splice + }; + + jQuery.extend = jQuery.fn.extend = function() { + var src; var copyIsArray; var copy; var name; var options; var clone; + + + var target = arguments[0] || {}; + + + var i = 1; + + + var length = arguments.length; + + + var deep = false; + + // Handle a deep copy situation + if ( typeof target === 'boolean' ) { + deep = target; + + // skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== 'object' && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; + }; + + jQuery.extend({ + // Unique for each copy of jQuery on the page + expando: 'jQuery' + ( version + Math.random() ).replace( /\D/g, '' ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === 'function'; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === 'array'; + }, + + isWindow: function( obj ) { + /* jshint eqeqeq: false */ + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + // parseFloat NaNs numeric-cast false positives (null|true|false|"") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0; + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + isPlainObject: function( obj ) { + var key; + + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== 'object' || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, 'constructor') && + !hasOwn.call(obj.constructor.prototype, 'isPrototypeOf') ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Support: IE<9 + // Handle iteration over inherited properties before own properties. + if ( support.ownLast ) { + for ( key in obj ) { + return hasOwn.call( obj, key ); + } + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + for ( key in obj ) {} + + return key === undefined || hasOwn.call( obj, key ); + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ''; + } + return typeof obj === 'object' || typeof obj === 'function' ? + class2type[ toString.call(obj) ] || 'object' : + typeof obj; + }, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && jQuery.trim( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ 'eval' ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, 'ms-' ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value; + + + var i = 0; + + + var length = obj.length; + + + var isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Support: Android<4.1, IE<9 + trim: function( text ) { + return text == null ? + '' : + ( text + '' ).replace( rtrim, '' ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( new Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === 'string' ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( indexOf ) { + return indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var len = +second.length; + + + var j = 0; + + + var i = first.length; + + while ( j < len ) { + first[ i++ ] = second[ j++ ]; + } + + // Support: IE<9 + // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) + if ( len !== len ) { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse; + + + var matches = []; + + + var i = 0; + + + var length = elems.length; + + + var callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value; + + + var i = 0; + + + var length = elems.length; + + + var isArray = isArraylike( elems ); + + + var ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, - if ( obj.nodeType === 1 && length ) { - return true; - } + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var args, proxy, tmp; + + if ( typeof context === 'string' ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: function() { + return +( new Date() ); + }, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support + }); + + // Populate the class2type map + jQuery.each('Boolean Number String Function Array Date RegExp Object Error'.split(' '), function(i, name) { + class2type[ '[object ' + name + ']' ] = name.toLowerCase(); + }); + + function isArraylike( obj ) { + var length = obj.length; + + + var type = jQuery.type( obj ); + + if ( type === 'function' || jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || length === 0 || + typeof length === 'number' && length > 0 && ( length - 1 ) in obj; + } + var Sizzle = /*! * Sizzle CSS Selector Engine v1.10.19 * http://sizzlejs.com/ @@ -595,988 +643,1148 @@ var Sizzle = */ (function( window ) { -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + + var i; + + + var support; + + + var Expr; + + + var getText; + + + var isXML; + + + var tokenize; + + + var compile; + + + var select; + + + var outermostContext; + + + var sortInput; + + + var hasDuplicate; + + + // Local document vars + + var setDocument; + + + var document; + + + var docElem; + + + var documentIsHTML; + + + var rbuggyQSA; + + + var rbuggyMatches; + + + var matches; + + + var contains; + + + // Instance-specific data + + var expando = 'sizzle' + -(new Date()); + + + var preferredDoc = window.document; + + + var dirruns = 0; + + + var done = 0; + + + var classCache = createCache(); + + + var tokenCache = createCache(); + + + var compilerCache = createCache(); + + + var sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }; + + + // General-purpose constants + + var strundefined = typeof undefined; + + + var MAX_NEGATIVE = 1 << 31; + + + // Instance methods + + var hasOwn = ({}).hasOwnProperty; + + + var arr = []; + + + var pop = arr.pop; + + + var push_native = arr.push; + + + var push = arr.push; + + + var slice = arr.slice; + + // Use a stripped-down indexOf if we can't use a native one + + var indexOf = arr.indexOf || function( elem ) { + var i = 0; + + + var len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }; + + + + var booleans = 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped'; + + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + + var whitespace = '[\\x20\\t\\r\\n\\f]'; + + // http://www.w3.org/TR/css3-syntax/#characters + + var characterEncoding = '(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+'; + + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + + var identifier = characterEncoding.replace( 'w', 'w#' ); + + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + + var attributes = '\\[' + whitespace + '*(' + characterEncoding + ')(?:' + whitespace + // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + + '*([*^$|!~]?=)' + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + - "*\\]", + '*(?:\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)"|(' + identifier + '))|)' + whitespace + + '*\\]'; + - pseudos = ":(" + characterEncoding + ")(?:\\((" + + + var pseudos = ':(' + characterEncoding + ')(?:\\((' + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + '(\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)")|' + // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + '((?:\\\\.|[^\\\\()[\\]]|' + attributes + ')*)|' + // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - rescape = /'|\\/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox<24 - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - high < 0 ? - // BMP codepoint - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( documentIsHTML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document (jQuery #6963) - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + '.*' + + ')\\)|)'; + + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + + var rtrim = new RegExp( '^' + whitespace + '+|((?:^|[^\\\\])(?:\\\\.)*)' + whitespace + '+$', 'g' ); + + + + var rcomma = new RegExp( '^' + whitespace + '*,' + whitespace + '*' ); + + + var rcombinators = new RegExp( '^' + whitespace + '*([>+~]|' + whitespace + ')' + whitespace + '*' ); + + + + var rattributeQuotes = new RegExp( '=' + whitespace + '*([^\\]\'"]*?)' + whitespace + '*\\]', 'g' ); + + + + var rpseudo = new RegExp( pseudos ); + + + var ridentifier = new RegExp( '^' + identifier + '$' ); + + + + var matchExpr = { + 'ID': new RegExp( '^#(' + characterEncoding + ')' ), + 'CLASS': new RegExp( '^\\.(' + characterEncoding + ')' ), + 'TAG': new RegExp( '^(' + characterEncoding.replace( 'w', 'w*' ) + ')' ), + 'ATTR': new RegExp( '^' + attributes ), + 'PSEUDO': new RegExp( '^' + pseudos ), + 'CHILD': new RegExp( '^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(' + whitespace + + '*(even|odd|(([+-]|)(\\d*)n|)' + whitespace + '*(?:([+-]|)' + whitespace + + '*(\\d+)|))' + whitespace + '*\\)|)', 'i' ), + 'bool': new RegExp( '^(?:' + booleans + ')$', 'i' ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + 'needsContext': new RegExp( '^' + whitespace + '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(' + + whitespace + '*((?:-\\d)?\\d*)' + whitespace + '*\\)|)(?=[^-]|$)', 'i' ) + }; + + + + var rinputs = /^(?:input|select|textarea|button)$/i; + + + var rheader = /^h\d$/i; + + + + var rnative = /^[^{]+\{\s*\[native \w/; + + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + + var rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/; + + + + var rsibling = /[+~]/; + + + var rescape = /'|\\/g; + + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + + var runescape = new RegExp( '\\\\([\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig' ); + + + var funescape = function( _, escaped, escapedWhitespace ) { + var high = '0x' + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + + // Optimize for push.apply( _, NodeList ) + try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; + } catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length; + + + var i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; + } + + function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== 'string' ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( documentIsHTML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document (jQuery #6963) + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // QSA path - if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - nid = old = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // QSA path + if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + nid = old = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== 'object' ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute('id')) ) { + nid = old.replace( rescape, '\\$&' ); + } else { + context.setAttribute( 'id', nid ); + } + nid = '[id=\'' + nid + '\'] '; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; + newSelector = groups.join(','); + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute('id'); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, '$1' ), context, results, seed ); + } + + /** * Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key + " " ] = value); - } - return cache; -} - -/** + function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + ' ' ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + ' ' ] = value); + } + return cache; + } + + /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} + function markFunction( fn ) { + fn[ expando ] = true; + return fn; + } -/** + /** * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - // release memory in IE - div = null; - } -} - -/** + function assert( fn ) { + var div = document.createElement('div'); + + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } + } + + /** * Adds the same handler for all of the specified attrs * @param {String} attrs Pipe-separated list of attributes * @param {Function} handler The method that will be applied */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = attrs.length; + function addHandle( attrs, handler ) { + var arr = attrs.split('|'); - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} + + var i = attrs.length; -/** + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } + } + + /** * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && + function siblingCheck( a, b ) { + var cur = b && a; + + + var diff = cur && a.nodeType === 1 && b.nodeType === 1 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } - return a ? 1 : -1; -} + return a ? 1 : -1; + } -/** + /** * Returns a function to use in pseudos for input types * @param {String} type */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** + function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === 'input' && elem.type === type; + }; + } + + /** * Returns a function to use in pseudos for buttons * @param {String} type */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** + function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === 'input' || name === 'button') && elem.type === type; + }; + } + + /** * Returns a function to use in pseudos for positionals * @param {Function} fn */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** + function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j; + + + var matchIndexes = fn( [], seed.length, argument ); + + + var i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); + } + + /** * Checks a node for validity as a Sizzle context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== strundefined && context; -} + function testContext( context ) { + return context && typeof context.getElementsByTagName !== strundefined && context; + } -// Expose support vars for convenience -support = Sizzle.support = {}; + // Expose support vars for convenience + support = Sizzle.support = {}; -/** + /** * Detects XML nodes * @param {Element|Object} elem An element or a document * @returns {Boolean} True iff elem is a non-HTML XML node */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** + isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== 'HTML' : false; + }; + + /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, - doc = node ? node.ownerDocument || node : preferredDoc, - parent = doc.defaultView; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsHTML = !isXML( doc ); - - // Support: IE>8 - // If iframe document is assigned to "document" variable and if iframe has been reloaded, - // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 - // IE6-8 do not support the defaultView property so parent will be undefined - if ( parent && parent !== parent.top ) { - // IE11 does not have attachEvent, so all must suffer - if ( parent.addEventListener ) { - parent.addEventListener( "unload", function() { - setDocument(); - }, false ); - } else if ( parent.attachEvent ) { - parent.attachEvent( "onunload", function() { - setDocument(); - }); - } - } - - /* Attributes + setDocument = Sizzle.setDocument = function( node ) { + var hasCompare; + + + var doc = node ? node.ownerDocument || node : preferredDoc; + + + var parent = doc.defaultView; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsHTML = !isXML( doc ); + + // Support: IE>8 + // If iframe document is assigned to "document" variable and if iframe has been reloaded, + // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 + // IE6-8 do not support the defaultView property so parent will be undefined + if ( parent && parent !== parent.top ) { + // IE11 does not have attachEvent, so all must suffer + if ( parent.addEventListener ) { + parent.addEventListener( 'unload', function() { + setDocument(); + }, false ); + } else if ( parent.attachEvent ) { + parent.attachEvent( 'onunload', function() { + setDocument(); + }); + } + } + + /* Attributes ---------------------------------------------------------------------- */ - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) - support.attributes = assert(function( div ) { - div.className = "i"; - return !div.getAttribute("className"); - }); + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) + support.attributes = assert(function( div ) { + div.className = 'i'; + return !div.getAttribute('className'); + }); - /* getElement(s)By* + /* getElement(s)By* ---------------------------------------------------------------------- */ - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if getElementsByClassName can be trusted - support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { - div.innerHTML = "
"; - - // Support: Safari<4 - // Catch class over-caching - div.firstChild.className = "i"; - // Support: Opera<10 - // Catch gEBCN failure to find non-leading classes - return div.getElementsByClassName("i").length === 2; - }); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; - return !doc.getElementsByName || !doc.getElementsByName( expando ).length; - }); - - // ID find and filter - if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [ m ] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - // Support: IE6/7 - // getElementById is not reliable as a find shortcut - delete Expr.find["ID"]; - - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment('') ); + return !div.getElementsByTagName('*').length; + }); + + // Check if getElementsByClassName can be trusted + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { + div.innerHTML = '
'; + + // Support: Safari<4 + // Catch class over-caching + div.firstChild.className = 'i'; + // Support: Opera<10 + // Catch gEBCN failure to find non-leading classes + return div.getElementsByClassName('i').length === 2; + }); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; + return !doc.getElementsByName || !doc.getElementsByName( expando ).length; + }); + + // ID find and filter + if ( support.getById ) { + Expr.find['ID'] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && documentIsHTML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [ m ] : []; + } + }; + Expr.filter['ID'] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute('id') === attrId; + }; + }; + } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find['ID']; + + Expr.filter['ID'] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode('id'); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find['TAG'] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem; + + + var tmp = []; + + + var i = 0; + + + var results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === '*' ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find['CLASS'] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector ---------------------------------------------------------------------- */ - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See http://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( div.querySelectorAll("[msallowclip^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = doc.createElement("input"); - input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( div.querySelectorAll("[name=d]").length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See http://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ''; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( div.querySelectorAll('[msallowclip^=\'\']').length ) { + rbuggyQSA.push( '[*^$]=' + whitespace + '*(?:\'\'|"")' ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !div.querySelectorAll('[selected]').length ) { + rbuggyQSA.push( '\\[' + whitespace + '*(?:value|' + booleans + ')' ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(':checked').length ) { + rbuggyQSA.push(':checked'); + } + }); + + assert(function( div ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = doc.createElement('input'); + input.setAttribute( 'type', 'hidden' ); + div.appendChild( input ).setAttribute( 'name', 'D' ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( div.querySelectorAll('[name=d]').length ) { + rbuggyQSA.push( 'name' + whitespace + '*[*^$|!~]?=' ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(':enabled').length ) { + rbuggyQSA.push( ':enabled', ':disabled' ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll('*,:x'); + rbuggyQSA.push(',.*:'); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, 'div' ); - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, '[s!=\'\']:x' ); + rbuggyMatches.push( '!=', pseudos ); + }); + } - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join('|') ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join('|') ); - /* Contains + /* Contains ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a; + + + var bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting ---------------------------------------------------------------------- */ - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } - // Calculate position if both inputs belong to the same document - compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : - // Otherwise we know they are disconnected - 1; + // Otherwise we know they are disconnected + 1; - // Disconnected nodes - if ( compare & 1 || + // Disconnected nodes + if ( compare & 1 || (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - // Choose the first element that is related to our preferred document - if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { - return -1; - } - if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return doc; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && + // Choose the first element that is related to our preferred document + if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur; + + + var i = 0; + + + var aup = a.parentNode; + + + var bup = b.parentNode; + + + var ap = [ a ]; + + + var bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return doc; + }; + + Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); + }; + + Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, '=\'$1\']' ); + + if ( support.matchesSelector && documentIsHTML && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - try { - var ret = matches.call( elem, expr ); + try { + var ret = matches.call( elem, expr ); - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; + }; + + Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); + }; + + Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ]; + + // Don't get fooled by Object.prototype properties (jQuery #13807) + + var val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; + }; + + Sizzle.error = function( msg ) { + throw new Error( 'Syntax error, unrecognized expression: ' + msg ); + }; + + /** * Document sorting and removing duplicates * @param {ArrayLike} results */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** + Sizzle.uniqueSort = function( results ) { + var elem; + + + var duplicates = []; + + + var j = 0; + + + var i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; + }; + + /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - while ( (node = elem[i++]) ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] + getText = Sizzle.getText = function( elem ) { + var node; + + + var ret = ''; + + + var i = 0; + + + var nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === 'string' ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; + }; + + Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + '>': { dir: 'parentNode', first: true }, + ' ': { dir: 'parentNode' }, + '+': { dir: 'previousSibling', first: true }, + '~': { dir: 'previousSibling' } + }, + + preFilter: { + 'ATTR': function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || '' ).replace( runescape, funescape ); + + if ( match[2] === '~=' ) { + match[3] = ' ' + match[3] + ' '; + } + + return match.slice( 0, 4 ); + }, + + 'CHILD': function( match ) { + /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) @@ -1586,894 +1794,998 @@ Expr = Sizzle.selectors = { 7 sign of y-component 8 y of y-component */ - match[1] = match[1].toLowerCase(); + match[1] = match[1].toLowerCase(); - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } + if ( match[1].slice( 0, 3 ) === 'nth' ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === 'even' || match[3] === 'odd' ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === 'odd' ); - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } - return match; - }, + return match; + }, - "PSEUDO": function( match ) { - var excess, - unquoted = !match[6] && match[2]; + 'PSEUDO': function( match ) { + var excess; - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } + + var unquoted = !match[6] && match[2]; - // Accept quoted arguments as-is - if ( match[3] ) { - match[2] = match[4] || match[5] || ""; + if ( matchExpr['CHILD'].test( match[0] ) ) { + return null; + } - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ''; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + (excess = unquoted.indexOf( ')', unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + 'TAG': function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === '*' ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + 'CLASS': function( className ) { + var pattern = classCache[ className + ' ' ]; + + return pattern || + (pattern = new RegExp( '(^|' + whitespace + ')' + className + '(' + whitespace + '|$)' )) && classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); + return pattern.test( typeof elem.className === 'string' && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute('class') || '' ); }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || + }, + + 'ATTR': function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === '!='; + } + if ( !operator ) { + return true; + } + + result += ''; + + return operator === '=' ? result === check : + operator === '!=' ? result !== check : + operator === '^=' ? check && result.indexOf( check ) === 0 : + operator === '*=' ? check && result.indexOf( check ) > -1 : + operator === '$=' ? check && result.slice( -check.length ) === check : + operator === '~=' ? ( ' ' + result + ' ' ).indexOf( check ) > -1 : + operator === '|=' ? result === check || result.slice( 0, check.length + 1 ) === check + '-' : + false; + }; + }, + + 'CHILD': function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== 'nth'; + + + var forward = type.slice( -4 ) !== 'last'; + + + var ofType = what === 'of-type'; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache; var outerCache; var node; var diff; var nodeIndex; var start; + + + var dir = simple !== forward ? 'nextSibling' : 'previousSibling'; + + + var parent = elem.parentNode; + + + var name = ofType && elem.nodeName.toLowerCase(); + + + var useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === 'only' && !start && 'nextSibling'; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + 'PSEUDO': function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args; + + + var fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( 'unsupported pseudo: ' + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, '', argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx; + + + var matched = fn( seed, argument ); + + + var i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + 'not': markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = []; + + + var results = []; + + + var matcher = compile( selector.replace( rtrim, '$1' ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem; + + + var unmatched = matcher( seed, null, xml, [] ); + + + var i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + 'has': markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + 'contains': markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + 'lang': markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || '') ) { + Sizzle.error( 'unsupported lang: ' + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute('xml:lang') || elem.getAttribute('lang')) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + '-' ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + 'target': function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + 'root': function( elem ) { + return elem === docElem; + }, + + 'focus': function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + 'enabled': function( elem ) { + return elem.disabled === false; + }, + + 'disabled': function( elem ) { + return elem.disabled === true; + }, + + 'checked': function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === 'input' && !!elem.checked) || (nodeName === 'option' && !!elem.selected); + }, + + 'selected': function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + 'empty': function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + 'parent': function( elem ) { + return !Expr.pseudos['empty']( elem ); + }, + + // Element/input types + 'header': function( elem ) { + return rheader.test( elem.nodeName ); + }, + + 'input': function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + 'button': function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === 'input' && elem.type === 'button' || name === 'button'; + }, + + 'text': function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === 'input' && + elem.type === 'text' && // Support: IE<8 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( (tokens = []) ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + ( (attr = elem.getAttribute('type')) == null || attr.toLowerCase() === 'text' ); + }, + + // Position-in-collection + 'first': createPositionalPseudo(function() { + return [ 0 ]; + }), + + 'last': createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + 'eq': createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + 'even': createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + 'odd': createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + 'lt': createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + 'gt': createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } + }; + + Expr.pseudos['nth'] = Expr.pseudos['eq']; + + // Add button/input type pseudos + for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); + } + for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); + } + + // Easy API for creating new setFilters + function setFilters() {} + setFilters.prototype = Expr.filters = Expr.pseudos; + Expr.setFilters = new setFilters(); + + tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched; var match; var tokens; var type; + + + var soFar; var groups; var preFilters; + + + var cached = tokenCache[ selector + ' ' ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, ' ' ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (oldCache = outerCache[ dir ]) && + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); + }; + + function toSelector( tokens ) { + var i = 0; + + + var len = tokens.length; + + + var selector = ''; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; + } + + function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir; + + + var checkNonElements = base && dir === 'parentNode'; + + + var doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache; var outerCache; + + + var newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (oldCache = outerCache[ dir ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - // Assign to newCache so results back-propagate to previous elements - return (newCache[ 2 ] = oldCache[ 2 ]); - } else { - // Reuse newcache so results back-propagate to previous elements - outerCache[ dir ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + outerCache[ dir ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + }; + } + + function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; + } + + function multipleContexts( selector, contexts, results ) { + var i = 0; + + + var len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; + } + + function condense( unmatched, map, filter, context, xml ) { + var elem; + + + var newUnmatched = []; + + + var i = 0; + + + var len = unmatched.length; + + + var mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; + } + + function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp; var i; var elem; + + + var preMap = []; + + + var postMap = []; + + + var preexisting = results.length; + + + // Get initial elements from seed or context + + var elems = seed || multipleContexts( selector || '*', context.nodeType ? [ context ] : context, [] ); + + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + + var matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems; + + + + var matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), - len = elems.length; - - if ( outermost ) { - outermostContext = context !== document && context; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); + } + + function matcherFromTokens( tokens ) { + var checkContext; var matcher; var j; + + + var len = tokens.length; + + + var leadingRelative = Expr.relative[ tokens[0].type ]; + + + var implicitRelative = leadingRelative || Expr.relative[' ']; + + + var i = leadingRelative ? 1 : 0; + + + // The foundational matcher ensures that elements are reachable from top-level context(s) + + var matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ); + + + var matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ); + + + var matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === ' ' ? '*' : '' }) + ).replace( rtrim, '$1' ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); + } + + function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0; + + + var byElement = elementMatchers.length > 0; + + + var superMatcher = function( seed, context, xml, results, outermost ) { + var elem; var j; var matcher; + + + var matchedCount = 0; + + + var i = '0'; + + + var unmatched = seed && []; + + + var setMatched = []; + + + var contextBackup = outermostContext; + + // We must always have either seed elements or outermost context + + var elems = seed || byElement && Expr.find['TAG']( '*', outermost ); + + // Use integer dirruns iff this is the outermost matcher + + var dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); + + + var len = elems.length; + + if ( outermost ) { + outermostContext = context !== document && context; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; + } + + compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i; + + + var setMatchers = []; + + + var elementMatchers = []; + + + var cached = compilerCache[ selector + ' ' ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; + }; + + /** * A low-level selection function that works with Sizzle's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled @@ -2482,586 +2794,618 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( (selector = compiled.selector || selector) ); + select = Sizzle.select = function( selector, context, results, seed ) { + var i; var tokens; var token; var type; var find; + + + var compiled = typeof selector === 'function' && selector; - results = results || []; + + var match = !seed && tokenize( (selector = compiled.selector || selector) ); - // Try to minimize operations if there is no seed and only one group - if ( match.length === 1 ) { + results = results || []; - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + // Try to minimize operations if there is no seed and only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === 'ID' && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Support: Chrome<14 -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( div1 ) { - // Should return 1, but returns 4 (following) - return div1.compareDocumentPosition( document.createElement("div") ) & 1; -}); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( div ) { - div.innerHTML = ""; - return div.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( div ) { - div.innerHTML = ""; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( div ) { - return div.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - null; - } - }); -} - -return Sizzle; + context = ( Expr.find['ID']( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr['needsContext'].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; + }; + + // One-time assignments + + // Sort stability + support.sortStable = expando.split('').sort( sortOrder ).join('') === expando; + + // Support: Chrome<14 + // Always assume duplicates if they aren't passed to the comparison function + support.detectDuplicates = !!hasDuplicate; + + // Initialize against the default document + setDocument(); + + // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) + // Detached nodes confoundingly follow *each other* + support.sortDetached = assert(function( div1 ) { + // Should return 1, but returns 4 (following) + return div1.compareDocumentPosition( document.createElement('div') ) & 1; + }); + + // Support: IE<8 + // Prevent attribute/property "interpolation" + // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx + if ( !assert(function( div ) { + div.innerHTML = ''; + return div.firstChild.getAttribute('href') === '#' ; + }) ) { + addHandle( 'type|href|height|width', function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === 'type' ? 1 : 2 ); + } + }); + } + + // Support: IE<9 + // Use defaultValue in place of getAttribute("value") + if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ''; + div.firstChild.setAttribute( 'value', '' ); + return div.firstChild.getAttribute( 'value' ) === ''; + }) ) { + addHandle( 'value', function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === 'input' ) { + return elem.defaultValue; + } + }); + } + + // Support: IE<9 + // Use getAttributeNode to fetch booleans when getAttribute lies + if ( !assert(function( div ) { + return div.getAttribute('disabled') == null; + }) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); + } + + return Sizzle; })( window ); -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - - -var rneedsContext = jQuery.expr.match.needsContext; + jQuery.find = Sizzle; + jQuery.expr = Sizzle.selectors; + jQuery.expr[':'] = jQuery.expr.pseudos; + jQuery.unique = Sizzle.uniqueSort; + jQuery.text = Sizzle.getText; + jQuery.isXMLDoc = Sizzle.isXML; + jQuery.contains = Sizzle.contains; + + + + var rneedsContext = jQuery.expr.match.needsContext; + + var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); + + + + var risSimple = /^.[^:#\[\.,]*$/; + + // Implement the identical functionality for filter and not + function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + /* jshint -W018 */ + return !!qualifier.call( elem, i, elem ) !== not; + }); + + } + + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + }); + + } -var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); + if ( typeof qualifier === 'string' ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + qualifier = jQuery.filter( qualifier, elements ); + } + return jQuery.grep( elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; + }); + } -var risSimple = /^.[^:#\[\.,]*$/; + jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ - return !!qualifier.call( elem, i, elem ) !== not; - }); + if ( not ) { + expr = ':not(' + expr + ')'; + } - } + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + })); + }; - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - }); + jQuery.fn.extend({ + find: function( selector ) { + var i; - } + + var ret = []; - if ( typeof qualifier === "string" ) { - if ( risSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } + + var self = this; - qualifier = jQuery.filter( qualifier, elements ); - } + + var len = self.length; - return jQuery.grep( elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; - }); -} + if ( typeof selector !== 'string' ) { + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - })); -}; - -jQuery.fn.extend({ - find: function( selector ) { - var i, - ret = [], - self = this, - len = self.length; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; - }, - filter: function( selector ) { - return this.pushStack( winnow(this, selector || [], false) ); - }, - not: function( selector ) { - return this.pushStack( winnow(this, selector || [], true) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -}); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - init = jQuery.fn.init = function( selector, context ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return typeof rootjQuery.ready !== "undefined" ? - rootjQuery.ready( selector ) : - // Execute immediately if ready is not present - selector( jQuery ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.extend({ - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -jQuery.fn.extend({ - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && (pos ? - pos.index(cur) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + ' ' + selector : selector; + return ret; + }, + filter: function( selector ) { + return this.pushStack( winnow(this, selector || [], false) ); + }, + not: function( selector ) { + return this.pushStack( winnow(this, selector || [], true) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === 'string' && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } + }); + + + // Initialize a jQuery object + + + // A central reference to the root jQuery(document) + var rootjQuery; + + + // Use the correct document accordingly with window argument (sandbox) + + var document = window.document; + + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + + var rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/; + + + + var init = jQuery.fn.init = function( selector, context ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === 'string' ) { + if ( selector.charAt(0) === '<' && selector.charAt( selector.length - 1 ) === '>' && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return typeof rootjQuery.ready !== 'undefined' ? + rootjQuery.ready( selector ) : + // Execute immediately if ready is not present + selector( jQuery ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }; + + // Give the init function the jQuery prototype for later instantiation + init.prototype = jQuery.fn; + + // Initialize central reference + rootjQuery = jQuery( document ); + + + var rparentsprev = /^(?:parents|prev(?:Until|All))/; + + // methods guaranteed to produce a unique set when starting from a unique set + + var guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + + jQuery.extend({ + dir: function( elem, dir, until ) { + var matched = []; + + + var cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } + }); + + jQuery.fn.extend({ + has: function( target ) { + var i; + + + var targets = jQuery( target, this ); + + + var len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + closest: function( selectors, context ) { + var cur; + + + var i = 0; + + + var l = this.length; + + + var matched = []; + + + var pos = rneedsContext.test( selectors ) || typeof selectors !== 'string' ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { + // Always skip document fragments + if ( cur.nodeType < 11 && (pos ? + pos.index(cur) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors)) ) { - matched.push( cur ); - break; - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.unique( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - if ( this.length > 1 ) { - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - ret = jQuery.unique( ret ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - } - - return this.pushStack( ret ); - }; -}); -var rnotwhite = (/\S+/g); - - - -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* + matched.push( cur ); + break; + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === 'string' ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.unique( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } + }); + + function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; + } + + jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, 'parentNode' ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, 'parentNode', until ); + }, + next: function( elem ) { + return sibling( elem, 'nextSibling' ); + }, + prev: function( elem ) { + return sibling( elem, 'previousSibling' ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, 'nextSibling' ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, 'previousSibling' ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, 'nextSibling', until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, 'previousSibling', until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, 'iframe' ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } + }, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== 'Until' ) { + selector = until; + } + + if ( selector && typeof selector === 'string' ) { + ret = jQuery.filter( selector, ret ); + } + + if ( this.length > 1 ) { + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + ret = jQuery.unique( ret ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + } + + return this.pushStack( ret ); + }; + }); + var rnotwhite = (/\S+/g); + + + + // String to Object options format cache + var optionsCache = {}; + + // Convert String-formatted options into Object-formatted ones and store in cache + function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; + } + + /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how @@ -3083,5480 +3427,5979 @@ function createOptions( options ) { * stopOnFalse: interrupt callings when a callback returns false * */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - firingLength = 0; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( list && ( !fired || stack ) ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( values === progressValues ) { - deferred.notifyWith( contexts, values ); - - } else if ( !(--remaining) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); - - -// The deferred used on DOM ready -var readyList; - -jQuery.fn.ready = function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; -}; - -jQuery.extend({ - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.triggerHandler ) { - jQuery( document ).triggerHandler( "ready" ); - jQuery( document ).off( "ready" ); - } - } -}); - -/** + jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === 'string' ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing; + + // Last fire value (for non-forgettable lists) + + var memory; + + // Flag to know if list was already fired + + var fired; + + // End of the loop when firing + + var firingLength; + + // Index of currently firing callback (modified by remove if needed) + + var firingIndex; + + // First callback to fire (used internally by add and fireWith) + + var firingStart; + + // Actual callback list + + var list = []; + + // Stack of fire calls for repeatable lists + + var stack = !options.once && []; + + // Fire callbacks + + var fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }; + + // Actual Callbacks object + + var self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === 'function' ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== 'string' ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); + }, + // Remove all callbacks from the list + empty: function() { + list = []; + firingLength = 0; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( list && ( !fired || stack ) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; + }; + + + jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ 'resolve', 'done', jQuery.Callbacks('once memory'), 'resolved' ], + [ 'reject', 'fail', jQuery.Callbacks('once memory'), 'rejected' ], + [ 'notify', 'progress', jQuery.Callbacks('memory') ] + ]; + + + var state = 'pending'; + + + var promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ tuple[ 0 ] + 'With' ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }; + + + var deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ]; + + + var stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + 'With' ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + 'With' ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0; + + + var resolveValues = slice.call( arguments ); + + + var length = resolveValues.length; + + + // the count of uncompleted subordinates + + var remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0; + + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + + var deferred = remaining === 1 ? subordinate : jQuery.Deferred(); + + + // Update function for both resolve and progress values + + var updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( values === progressValues ) { + deferred.notifyWith( contexts, values ); + + } else if ( !(--remaining) ) { + deferred.resolveWith( contexts, values ); + } + }; + }; + + + + var progressValues; var progressContexts; var resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } + }); + + + // The deferred used on DOM ready + var readyList; + + jQuery.fn.ready = function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }; + + jQuery.extend({ + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.triggerHandler ) { + jQuery( document ).triggerHandler( 'ready' ); + jQuery( document ).off( 'ready' ); + } + } + }); + + /** * Clean-up method for dom ready events */ -function detach() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } -} - -/** + function detach() { + if ( document.addEventListener ) { + document.removeEventListener( 'DOMContentLoaded', completed, false ); + window.removeEventListener( 'load', completed, false ); + + } else { + document.detachEvent( 'onreadystatechange', completed ); + window.detachEvent( 'onload', completed ); + } + } + + /** * The ready event handler and self cleanup method */ -function completed() { - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } -} - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - - -var strundefined = typeof undefined; - - - -// Support: IE<9 -// Iteration over object's inherited properties before its own -var i; -for ( i in jQuery( support ) ) { - break; -} -support.ownLast = i !== "0"; - -// Note: most support tests are defined in their respective modules. -// false until the test is run -support.inlineBlockNeedsLayout = false; - -// Execute ASAP in case we need to set body.style.zoom -jQuery(function() { - // Minified: var a,b,c,d - var val, div, body, container; - - body = document.getElementsByTagName( "body" )[ 0 ]; - if ( !body || !body.style ) { - // Return for frameset docs that don't have a body - return; - } - - // Setup - div = document.createElement( "div" ); - container = document.createElement( "div" ); - container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; - body.appendChild( container ).appendChild( div ); - - if ( typeof div.style.zoom !== strundefined ) { - // Support: IE<8 - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; - - support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; - if ( val ) { - // Prevent IE 6 from affecting layout for positioned elements #11048 - // Prevent IE from shrinking the body in IE 7 mode #12869 - // Support: IE<8 - body.style.zoom = 1; - } - } - - body.removeChild( container ); -}); - - - - -(function() { - var div = document.createElement( "div" ); - - // Execute the test only if not already executed in another module. - if (support.deleteExpando == null) { - // Support: IE<9 - support.deleteExpando = true; - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - } - - // Null elements to avoid leaks in IE. - div = null; -})(); - - -/** + function completed() { + // readyState === "complete" is good enough for us to call the dom ready in oldIE + if ( document.addEventListener || event.type === 'load' || document.readyState === 'complete' ) { + detach(); + jQuery.ready(); + } + } + + jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === 'complete' ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( 'DOMContentLoaded', completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( 'load', completed, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( 'onreadystatechange', completed ); + + // A fallback to window.onload, that will always work + window.attachEvent( 'onload', completed ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll('left'); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // detach all dom ready events + detach(); + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); + }; + + + var strundefined = typeof undefined; + + + + // Support: IE<9 + // Iteration over object's inherited properties before its own + var i; + for ( i in jQuery( support ) ) { + break; + } + support.ownLast = i !== '0'; + + // Note: most support tests are defined in their respective modules. + // false until the test is run + support.inlineBlockNeedsLayout = false; + + // Execute ASAP in case we need to set body.style.zoom + jQuery(function() { + // Minified: var a,b,c,d + var val, div, body, container; + + body = document.getElementsByTagName( 'body' )[ 0 ]; + if ( !body || !body.style ) { + // Return for frameset docs that don't have a body + return; + } + + // Setup + div = document.createElement( 'div' ); + container = document.createElement( 'div' ); + container.style.cssText = 'position:absolute;border:0;width:0;height:0;top:0;left:-9999px'; + body.appendChild( container ).appendChild( div ); + + if ( typeof div.style.zoom !== strundefined ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.style.cssText = 'display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1'; + + support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; + if ( val ) { + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + // Support: IE<8 + body.style.zoom = 1; + } + } + + body.removeChild( container ); + }); + + + + + (function() { + var div = document.createElement( 'div' ); + + // Execute the test only if not already executed in another module. + if (support.deleteExpando == null) { + // Support: IE<9 + support.deleteExpando = true; + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + } + + // Null elements to avoid leaks in IE. + div = null; + })(); + + + /** * Determines whether an object can have data */ -jQuery.acceptData = function( elem ) { - var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], - nodeType = +elem.nodeType || 1; - - // Do not set data on non-element DOM nodes because it will not be cleared (#8335). - return nodeType !== 1 && nodeType !== 9 ? - false : - - // Nodes accept data unless otherwise specified; rejection can be conditional - !noData || noData !== true && elem.getAttribute("classid") === noData; -}; - - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /([A-Z])/g; - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - -function internalData( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var ret, thisCache, - internalKey = jQuery.expando, - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - // Avoid exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( typeof name === "string" ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; -} - -function internalRemoveData( elem, name, pvt ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } else { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = name.concat( jQuery.map( name, jQuery.camelCase ) ); - } - - i = name.length; - while ( i-- ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - /* jshint eqeqeq: false */ - } else if ( support.deleteExpando || cache != cache.window ) { - /* jshint eqeqeq: true */ - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } -} - -jQuery.extend({ - cache: {}, - - // The following elements (space-suffixed to avoid Object.prototype collisions) - // throw uncatchable exceptions if you attempt to set expando properties - noData: { - "applet ": true, - "embed ": true, - // ...but Flash objects (which have this classid) *can* handle expandos - "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data ) { - return internalData( elem, name, data ); - }, - - removeData: function( elem, name ) { - return internalRemoveData( elem, name ); - }, - - // For internal use only. - _data: function( elem, name, data ) { - return internalData( elem, name, data, true ); - }, - - _removeData: function( elem, name ) { - return internalRemoveData( elem, name, true ); - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var i, name, data, - elem = this[0], - attrs = elem && elem.attributes; - - // Special expections of .data basically thwart jQuery.access, - // so implement the relevant behavior ourselves - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE11+ - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.slice(5) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - return arguments.length > 1 ? - - // Sets one value - this.each(function() { - jQuery.data( this, key, value ); - }) : - - // Gets one value - // Try to fetch any internally stored data first - elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - - -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery._removeData( elem, type + "queue" ); - jQuery._removeData( elem, key ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var isHidden = function( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); - }; - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; -}; -var rcheckableType = (/^(?:checkbox|radio)$/i); - - - -(function() { - // Minified: var a,b,c - var input = document.createElement( "input" ), - div = document.createElement( "div" ), - fragment = document.createDocumentFragment(); - - // Setup - div.innerHTML = "
a"; - - // IE strips leading whitespace when .innerHTML is used - support.leadingWhitespace = div.firstChild.nodeType === 3; - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - support.tbody = !div.getElementsByTagName( "tbody" ).length; - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - support.html5Clone = - document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav>"; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - input.type = "checkbox"; - input.checked = true; - fragment.appendChild( input ); - support.appendChecked = input.checked; - - // Make sure textarea (and checkbox) defaultValue is properly cloned - // Support: IE6-IE11+ - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // #11217 - WebKit loses check when the name is after the checked attribute - fragment.appendChild( div ); - div.innerHTML = ""; - - // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 - // old WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - support.noCloneEvent = true; - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Execute the test only if not already executed in another module. - if (support.deleteExpando == null) { - // Support: IE<9 - support.deleteExpando = true; - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - } -})(); - - -(function() { - var i, eventName, - div = document.createElement( "div" ); - - // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) - for ( i in { submit: true, change: true, focusin: true }) { - eventName = "on" + i; - - if ( !(support[ i + "Bubbles" ] = eventName in window) ) { - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) - div.setAttribute( eventName, "t" ); - support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; - } - } - - // Null elements to avoid leaks in IE. - div = null; -})(); - - -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -/* + jQuery.acceptData = function( elem ) { + var noData = jQuery.noData[ (elem.nodeName + ' ').toLowerCase() ]; + + + var nodeType = +elem.nodeType || 1; + + // Do not set data on non-element DOM nodes because it will not be cleared (#8335). + return nodeType !== 1 && nodeType !== 9 ? + false : + + // Nodes accept data unless otherwise specified; rejection can be conditional + !noData || noData !== true && elem.getAttribute('classid') === noData; + }; + + + var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/; + + + var rmultiDash = /([A-Z])/g; + + function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = 'data-' + key.replace( rmultiDash, '-$1' ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === 'string' ) { + try { + data = data === 'true' ? true : + data === 'false' ? false : + data === 'null' ? null : + // Only convert to a number if it doesn't change the string + +data + '' === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; + } + + // checks a cache object for emptiness + function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === 'data' && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== 'toJSON' ) { + return false; + } + } + + return true; + } + + function internalData( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var ret; var thisCache; + + + var internalKey = jQuery.expando; + + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + + var isNode = elem.nodeType; + + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + + var cache = isNode ? jQuery.cache : elem; + + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + + var id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === 'string' ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + // Avoid exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === 'object' || typeof name === 'function' ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( typeof name === 'string' ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; + } + + function internalRemoveData( elem, name, pvt ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache; var i; + + + var isNode = elem.nodeType; + + + // See jQuery.data for more information + + var cache = isNode ? jQuery.cache : elem; + + + var id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(' '); + } + } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } + + i = name.length; + while ( i-- ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + /* jshint eqeqeq: false */ + } else if ( support.deleteExpando || cache != cache.window ) { + /* jshint eqeqeq: true */ + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } + } + + jQuery.extend({ + cache: {}, + + // The following elements (space-suffixed to avoid Object.prototype collisions) + // throw uncatchable exceptions if you attempt to set expando properties + noData: { + 'applet ': true, + 'embed ': true, + // ...but Flash objects (which have this classid) *can* handle expandos + 'object ': 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data ) { + return internalData( elem, name, data ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); + } + }); + + jQuery.fn.extend({ + data: function( key, value ) { + var i; var name; var data; + + + var elem = this[0]; + + + var attrs = elem && elem.attributes; + + // Special expections of .data basically thwart jQuery.access, + // so implement the relevant behavior ourselves + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, 'parsedAttrs' ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE11+ + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( 'data-' ) === 0 ) { + name = jQuery.camelCase( name.slice(5) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + jQuery._data( elem, 'parsedAttrs', true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === 'object' ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return arguments.length > 1 ? + + // Sets one value + this.each(function() { + jQuery.data( this, key, value ); + }) : + + // Gets one value + // Try to fetch any internally stored data first + elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } + }); + + + jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || 'fx' ) + 'queue'; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || 'fx'; + + var queue = jQuery.queue( elem, type ); + + + var startLength = queue.length; + + + var fn = queue.shift(); + + + var hooks = jQuery._queueHooks( elem, type ); + + + var next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === 'inprogress' ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === 'fx' ) { + queue.unshift( 'inprogress' ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + 'queueHooks'; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks('once memory').add(function() { + jQuery._removeData( elem, type + 'queue' ); + jQuery._removeData( elem, key ); + }) + }); + } + }); + + jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== 'string' ) { + data = type; + type = 'fx'; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === 'fx' && queue[0] !== 'inprogress' ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + clearQueue: function( type ) { + return this.queue( type || 'fx', [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp; + + + var count = 1; + + + var defer = jQuery.Deferred(); + + + var elements = this; + + + var i = this.length; + + + var resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== 'string' ) { + obj = type; + type = undefined; + } + type = type || 'fx'; + + while ( i-- ) { + tmp = jQuery._data( elements[ i ], type + 'queueHooks' ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } + }); + var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; + + var cssExpand = [ 'Top', 'Right', 'Bottom', 'Left' ]; + + var isHidden = function( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, 'display' ) === 'none' || !jQuery.contains( elem.ownerDocument, elem ); + }; + + + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0; + + + var length = elems.length; + + + var bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === 'object' ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }; + var rcheckableType = (/^(?:checkbox|radio)$/i); + + + + (function() { + // Minified: var a,b,c + var input = document.createElement( 'input' ); + + + var div = document.createElement( 'div' ); + + + var fragment = document.createDocumentFragment(); + + // Setup + div.innerHTML = '
a'; + + // IE strips leading whitespace when .innerHTML is used + support.leadingWhitespace = div.firstChild.nodeType === 3; + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + support.tbody = !div.getElementsByTagName( 'tbody' ).length; + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + support.htmlSerialize = !!div.getElementsByTagName( 'link' ).length; + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + support.html5Clone = + document.createElement( 'nav' ).cloneNode( true ).outerHTML !== '<:nav>'; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + input.type = 'checkbox'; + input.checked = true; + fragment.appendChild( input ); + support.appendChecked = input.checked; + + // Make sure textarea (and checkbox) defaultValue is properly cloned + // Support: IE6-IE11+ + div.innerHTML = ''; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + + // #11217 - WebKit loses check when the name is after the checked attribute + fragment.appendChild( div ); + div.innerHTML = ''; + + // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 + // old WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + support.noCloneEvent = true; + if ( div.attachEvent ) { + div.attachEvent( 'onclick', function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Execute the test only if not already executed in another module. + if (support.deleteExpando == null) { + // Support: IE<9 + support.deleteExpando = true; + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + } + })(); + + + (function() { + var i; var eventName; + + + var div = document.createElement( 'div' ); + + // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) + for ( i in { submit: true, change: true, focusin: true }) { + eventName = 'on' + i; + + if ( !(support[ i + 'Bubbles' ] = eventName in window) ) { + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) + div.setAttribute( eventName, 't' ); + support[ i + 'Bubbles' ] = div.attributes[ eventName ].expando === false; + } + } + + // Null elements to avoid leaks in IE. + div = null; + })(); + + + var rformElems = /^(?:input|select|textarea)$/i; + + + var rkeyEvent = /^key/; + + + var rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/; + + + var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; + + + var rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + + function returnTrue() { + return true; + } + + function returnFalse() { + return false; + } + + function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } + } + + /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnotwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnotwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && + jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + var tmp; var events; var t; var handleObjIn; + + + var special; var eventHandle; var handleObj; + + + var handlers; var type; var namespaces; var origType; + + + var elemData = jQuery._data( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + types = ( types || '' ).match( rnotwhite ) || [ '' ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || '' ).split( '.' ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join('.') + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( 'on' + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + var j; var handleObj; var tmp; + + + var origCount; var t; var events; + + + var special; var handlers; var type; + + + var namespaces; var origType; + + + var elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || '' ).match( rnotwhite ) || [ '' ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || '' ).split( '.' ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( '(^|\\.)' + namespaces.join('\\.(?:.*\\.|)') + '(\\.|$)' ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && jQuery.acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && + ( !selector || selector === handleObj.selector || selector === '**' && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, 'events' ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + var handle; var ontype; var cur; + + + var bubbleType; var special; var tmp; var i; + + + var eventPath = [ elem || document ]; + + + var type = hasOwn.call( event, 'type' ) ? event.type : event; + + + var namespaces = hasOwn.call( event, 'namespace' ) ? event.namespace.split('.') : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf('.') >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split('.'); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(':') < 0 && 'on' + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === 'object' && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join('.'); + event.namespace_re = event.namespace ? + new RegExp( '(^|\\.)' + namespaces.join('\\.(?:.*\\.|)') + '(\\.|$)' ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, 'events' ) || {} )[ event.type ] && jQuery._data( cur, 'handle' ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && jQuery.acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && jQuery.acceptData( elem ) ) { - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - /* jshint eqeqeq: false */ - for ( ; cur != this; cur = cur.parentNode || this ) { - /* jshint eqeqeq: true */ - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i; var ret; var handleObj; var matched; var j; + + + var handlerQueue = []; + + + var args = slice.call( arguments ); + + + var handlers = ( jQuery._data( this, 'events' ) || {} )[ event.type ] || []; + + + var special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var sel; var handleObj; var matches; var i; + + + var handlerQueue = []; + + + var delegateCount = handlers.delegateCount; + + + var cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== 'click') ) { + + /* jshint eqeqeq: false */ + for ( ; cur != this; cur = cur.parentNode || this ) { + /* jshint eqeqeq: true */ + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== 'click') ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + ' '; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i; var prop; var copy; + + + var type = event.type; + + + var originalEvent = event; + + + var fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return jQuery.nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: 'altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which'.split(' '), + + fixHooks: {}, + + keyHooks: { + props: 'char charCode key keyCode'.split(' '), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: 'button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement'.split(' '), + filter: function( event, original ) { + var body; var eventDoc; var doc; + + + var button = original.button; + + + var fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: 'focusin' + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: 'focusout' + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, 'input' ) && this.type === 'checkbox' && this.click ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, 'a' ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } + }; + + jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = 'on' + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === strundefined ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + + jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && // Support: IE < 9, Android < 4.0 src.returnValue === false ? - returnTrue : - returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && e.stopImmediatePropagation ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - var doc = this.ownerDocument || this, - attaches = jQuery._data( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this, - attaches = jQuery._data( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - jQuery._removeData( doc, fix ); - } else { - jQuery._data( doc, fix, attaches ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
", "
" ], - area: [ 1, "", "" ], - param: [ 1, "", "" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - col: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -// Support: IE<8 -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!support.noCloneEvent || !support.noCloneChecked) && + returnTrue : + returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; + }; + + // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding + // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html + jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && e.stopImmediatePropagation ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } + }; + + // Create mouseenter/leave events using mouseover/out and event-time checks + jQuery.each({ + mouseenter: 'mouseover', + mouseleave: 'mouseout', + pointerenter: 'pointerover', + pointerleave: 'pointerout' + }, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret; + + + var target = this; + + + var related = event.relatedTarget; + + + var handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; + }); + + // IE submit delegation + if ( !support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, 'form' ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, 'click._submit keypress._submit', function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target; + + + var form = jQuery.nodeName( elem, 'input' ) || jQuery.nodeName( elem, 'button' ) ? elem.form : undefined; + if ( form && !jQuery._data( form, 'submitBubbles' ) ) { + jQuery.event.add( form, 'submit._submit', function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, 'submitBubbles', true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( 'submit', this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, 'form' ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, '._submit' ); + } + }; + } + + // IE change delegation and checkbox/radio fix + if ( !support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === 'checkbox' || this.type === 'radio' ) { + jQuery.event.add( this, 'propertychange._change', function( event ) { + if ( event.originalEvent.propertyName === 'checked' ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, 'click._change', function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( 'change', this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, 'beforeactivate._change', function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, 'changeBubbles' ) ) { + jQuery.event.add( elem, 'change._change', function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( 'change', this.parentNode, event, true ); + } + }); + jQuery._data( elem, 'changeBubbles', true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== 'radio' && elem.type !== 'checkbox') ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, '._change' ); + + return !rformElems.test( this.nodeName ); + } + }; + } + + // Create "bubbling" focus and blur events + if ( !support.focusinBubbles ) { + jQuery.each({ focus: 'focusin', blur: 'focusout' }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this; + + + var attaches = jQuery._data( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this; + + + var attaches = jQuery._data( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + jQuery._removeData( doc, fix ); + } else { + jQuery._data( doc, fix, attaches ); + } + } + }; + }); + } + + jQuery.fn.extend({ + + on: function( types, selector, data, fn, /* INTERNAL */ one ) { + var type, origFn; + + // Types can be a map of types/handlers + if ( typeof types === 'object' ) { + // ( types-Object, selector, data ) + if ( typeof selector !== 'string' ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === 'string' ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + '.' + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === 'object' ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === 'function' ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } + }); + + + function createSafeFragment( document ) { + var list = nodeNames.split( '|' ); + + + var safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; + } + + var nodeNames = 'abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|' + + 'header|hgroup|mark|meter|nav|output|progress|section|summary|time|video'; + + + var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g; + + + var rnoshimcache = new RegExp('<(?:' + nodeNames + ')[\\s/>]', 'i'); + + + var rleadingWhitespace = /^\s+/; + + + var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi; + + + var rtagName = /<([\w:]+)/; + + + var rtbody = /\s*$/g; + + + // We have to close these tags to support XHTML (#13200) + + var wrapMap = { + option: [ 1, '' ], + legend: [ 1, '
', '
' ], + area: [ 1, '', '' ], + param: [ 1, '', '' ], + thead: [ 1, '', '
' ], + tr: [ 2, '', '
' ], + col: [ 2, '', '
' ], + td: [ 3, '', '
' ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: support.htmlSerialize ? [ 0, '', '' ] : [ 1, 'X
', '
' ] + }; + + + var safeFragment = createSafeFragment( document ); + + + var fragmentDiv = safeFragment.appendChild( document.createElement('div') ); + + wrapMap.optgroup = wrapMap.option; + wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; + wrapMap.th = wrapMap.td; + + function getAll( context, tag ) { + var elems; var elem; + + + var i = 0; + + + var found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || '*' ) : + typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || '*' ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; + } + + // Used in buildFragment, fixes the defaultChecked property + function fixDefaultChecked( elem ) { + if ( rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } + } + + // Support: IE<8 + // Manipulating tables requires a tbody + function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, 'table' ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, 'tr' ) ? + + elem.getElementsByTagName('tbody')[0] || + elem.appendChild( elem.ownerDocument.createElement('tbody') ) : + elem; + } + + // Replace/restore the type attribute of script elements for safe DOM manipulation + function disableScript( elem ) { + elem.type = (jQuery.find.attr( elem, 'type' ) !== null) + '/' + elem.type; + return elem; + } + function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute('type'); + } + return elem; + } + + // Mark scripts as having already been evaluated + function setGlobalEval( elems, refElements ) { + var elem; + + + var i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, 'globalEval', !refElements || jQuery._data( refElements[i], 'globalEval' ) ); + } + } + + function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type; var i; var l; + + + var oldData = jQuery._data( src ); + + + var curData = jQuery._data( dest, oldData ); + + + var events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } + } + + function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === 'script' && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === 'object' ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === 'input' && rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === 'option' ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === 'input' || nodeName === 'textarea' ) { + dest.defaultValue = src.defaultValue; + } + } + + jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements; var node; var clone; var i; var srcElements; + + + var inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( '<' + elem.nodeName + '>' ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted from table fragments - if ( !support.tbody ) { - - // String was a , *may* have spurious - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare or - wrap[1] === "
" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - deletedIds.push( id ); - } - } - } - } - } -}); - -jQuery.fn.extend({ - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - remove: function( selector, keepData /* Internal Use Only */ ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map(function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, 'script' ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, 'script' ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var j; var elem; var contains; + + + var tmp; var tag; var tbody; var wrap; + + + var l = elems.length; + + + // Ensure a safe fragment + + var safe = createSafeFragment( context ); + + + + var nodes = []; + + + var i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === 'object' ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement('div') ); + + // Deserialize a standard representation + tag = (rtagName.exec( elem ) || [ '', '' ])[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, '<$1>' ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted from table fragments + if ( !support.tbody ) { + + // String was a
, *may* have spurious + elem = tag === 'table' && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[1] === '
' && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), 'tbody' ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ''; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !support.appendChecked ) { + jQuery.grep( getAll( nodes, 'input' ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), 'script' ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || '' ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var elem; var type; var id; var data; + + + var i = 0; + + + var internalKey = jQuery.expando; + + + var cache = jQuery.cache; + + + var deleteExpando = support.deleteExpando; + + + var special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + deletedIds.push( id ); + } + } + } + } + } + }); + + jQuery.fn.extend({ + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + append: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + remove: function( selector, keepData /* Internal Use Only */ ) { + var elem; + + + var elems = selector ? jQuery.filter( selector, this ) : this; + + + var i = 0; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, 'script' ) ); + } + elem.parentNode.removeChild( elem ); + } + } + + return this; + }, + + empty: function() { + var elem; + + + var i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, 'select' ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map(function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}; + + + var i = 0; + + + var l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, '' ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === 'string' && !rnoInnerhtml.test( value ) && ( support.htmlSerialize || !rnoshimcache.test( value ) ) && ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var arg = arguments[ 0 ]; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - arg = this.parentNode; - - jQuery.cleanData( getAll( this ) ); - - if ( arg ) { - arg.replaceChild( elem, this ); - } - }); - - // Force removal if there was no new content (e.g., from empty arguments) - return arg && (arg.length || arg.nodeType) ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback ) { - - // Flatten any nested arrays - args = concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || - ( l > 1 && typeof value === "string" && + !wrapMap[ (rtagName.exec( value ) || [ '', '' ])[ 1 ].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, '<$1>' ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var arg = arguments[ 0 ]; + + // Make the changes, replacing each context element with the new content + this.domManip( arguments, function( elem ) { + arg = this.parentNode; + + jQuery.cleanData( getAll( this ) ); + + if ( arg ) { + arg.replaceChild( elem, this ); + } + }); + + // Force removal if there was no new content (e.g., from empty arguments) + return arg && (arg.length || arg.nodeType) ? this : this.remove(); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, callback ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var first; var node; var hasScripts; + + + var scripts; var doc; var fragment; + + + var i = 0; + + + var l = this.length; + + + var set = this; + + + var iNoClone = l - 1; + + + var value = args[0]; + + + var isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === 'string' && !support.checkClone && rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, self.html() ); - } - self.domManip( args, callback ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[i], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl ) { - jQuery._evalUrl( node.src ); - } - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - - -var iframe, - elemdisplay = {}; - -/** + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, self.html() ); + } + self.domManip( args, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + scripts = jQuery.map( getAll( fragment, 'script' ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, 'script' ) ); + } + } + + callback.call( this[i], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || '' ) && + !jQuery._data( node, 'globalEval' ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || '' ).replace( rcleanScript, '' ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } + }); + + jQuery.each({ + appendTo: 'append', + prependTo: 'prepend', + insertBefore: 'before', + insertAfter: 'after', + replaceAll: 'replaceWith' + }, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems; + + + var i = 0; + + + var ret = []; + + + var insert = jQuery( selector ); + + + var last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; + }); + + + var iframe; + + + var elemdisplay = {}; + + /** * Retrieve the actual display of a element * @param {String} name nodeName of the element * @param {Object} doc Document object */ -// Called only from within defaultDisplay -function actualDisplay( name, doc ) { - var style, - elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + // Called only from within defaultDisplay + function actualDisplay( name, doc ) { + var style; + + + var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ); + - // getDefaultComputedStyle might be reliably used only on attached element - display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? + // getDefaultComputedStyle might be reliably used only on attached element + + var display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? - // Use of this method is a temporary fix (more like optmization) until something better comes along, - // since it was removed from specification and supported only in FF - style.display : jQuery.css( elem[ 0 ], "display" ); + // Use of this method is a temporary fix (more like optmization) until something better comes along, + // since it was removed from specification and supported only in FF + style.display : jQuery.css( elem[ 0 ], 'display' ); - // We don't have any data stored on the element, - // so use "detach" method as fast way to get rid of the element - elem.detach(); + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); - return display; -} + return display; + } -/** + /** * Try to determine the default display value of an element * @param {String} nodeName */ -function defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; + function defaultDisplay( nodeName ) { + var doc = document; - if ( !display ) { - display = actualDisplay( nodeName, doc ); + + var display = elemdisplay[ nodeName ]; - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { + if ( !display ) { + display = actualDisplay( nodeName, doc ); - // Use the already-created iframe if possible - iframe = (iframe || jQuery( "