From fbca18e394f48acf5ee69ae2f551a861f13822a9 Mon Sep 17 00:00:00 2001 From: Fabian Vogelsteller Date: Fri, 10 Mar 2017 11:44:00 +0100 Subject: [PATCH] moved personal to eth.personal --- docs/getting-started.rst | 1 - ...kage-core.rst => include_package-core.rst} | 0 docs/include_package-net.rst | 104 ++++++++++++++++++ docs/index.rst | 4 +- docs/web3-bzz.rst | 8 +- docs/web3-eth-net.rst | 94 +--------------- docs/web3-eth-personal.rst | 75 +++++++++++++ docs/web3-eth.rst | 11 +- docs/web3-net.rst | 42 +++++++ docs/web3-shh.rst | 8 +- docs/web3.rst | 1 - gulpfile.js | 24 ++-- packages/web3-bzz/package.json | 3 +- packages/web3-bzz/src/index.js | 3 + packages/web3-eth-net/package.json | 13 --- packages/web3-eth-net/src/index.js | 80 -------------- packages/web3-eth/package.json | 3 +- packages/web3-eth/src/index.js | 10 +- packages/web3-personal/package.json | 14 --- packages/web3-personal/src/index.js | 99 ----------------- packages/web3-shh/package.json | 3 +- packages/web3-shh/src/index.js | 4 +- src/index.js | 13 ++- test/eth_methods.js | 10 ++ test/personal.getAccounts.js | 2 +- test/personal.lockAccount.js | 2 +- test/personal.newAccount.js | 2 +- test/personal.sendTransaction.js | 2 +- test/personal.unlockAccount.js | 2 +- test/personal_methods.js | 7 +- test/shh_methods.js | 4 + test/web3_methods.js | 1 - 32 files changed, 315 insertions(+), 334 deletions(-) rename docs/{package-core.rst => include_package-core.rst} (100%) create mode 100644 docs/include_package-net.rst create mode 100644 docs/web3-eth-personal.rst create mode 100644 docs/web3-net.rst delete mode 100755 packages/web3-eth-net/package.json delete mode 100755 packages/web3-eth-net/src/index.js delete mode 100644 packages/web3-personal/package.json delete mode 100644 packages/web3-personal/src/index.js diff --git a/docs/getting-started.rst b/docs/getting-started.rst index 52e03d8..6390db4 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -7,7 +7,6 @@ The web3.js library is a collection of modules which contain specific functional - The ``web3-eth`` is for the ethereum blockchain and smart contracts - The ``web3-shh`` is for the whisper protocol to communicate p2p and broadcast - The ``web3-bzz`` is for the swarm protocol, the decentralized file storage -- The ``web3-personal`` is for ethereum account management The following page will describe how to install and add web3.js to your project. You can find some extra examples in the :ref:`API-reference ` and the `examples here `_. diff --git a/docs/package-core.rst b/docs/include_package-core.rst similarity index 100% rename from docs/package-core.rst rename to docs/include_package-core.rst diff --git a/docs/include_package-net.rst b/docs/include_package-net.rst new file mode 100644 index 0000000..f315c34 --- /dev/null +++ b/docs/include_package-net.rst @@ -0,0 +1,104 @@ + +net.id +========= + +.. code-block:: javascript + + web3.eth.net.getId([callback]) + web3.bzz.net.getId([callback]) + web3.shh.net.getId([callback]) + +Gets the current network ID. + +---------- +Parameters +---------- + +none + +------- +Returns +------- + +``Promise`` returns ``Number``: The network ID. + +------- +Example +------- + +.. code-block:: javascript + + web3.eth.getId() + .then(console.log); + > 1 + +------------------------------------------------------------------------------ + + +net.isListening +========= + +.. code-block:: javascript + + web3.eth.net.isListening([callback]) + web3.bzz.net.isListening([callback]) + web3.shh.net.isListening([callback]) + +Checks if the node is listening for peers. + +---------- +Parameters +---------- + +none + +------- +Returns +------- + +``Promise`` returns ``Boolean`` + +------- +Example +------- + +.. code-block:: javascript + + web3.eth.isListening() + .then(console.log); + > true + +------------------------------------------------------------------------------ + +net.getPeerCount +========= + +.. code-block:: javascript + + web3.eth.net.getPeerCount([callback]) + web3.bzz.net.getPeerCount([callback]) + web3.shh.net.getPeerCount([callback]) + +Get the number of peers connected to. + +---------- +Parameters +---------- + +none + +------- +Returns +------- + +``Promise`` returns ``Number`` + +------- +Example +------- + +.. code-block:: javascript + + web3.eth.getPeerCount() + .then(console.log); + > 25 diff --git a/docs/index.rst b/docs/index.rst index bdbd1ea..6ac76d2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -31,11 +31,9 @@ Contents: web3-eth-subscribe web3-eth-contract web3-eth-iban - web3-eth-net web3-shh web3-bzz + web3-net web3-personal web3-admin - .. contract-object.rst - diff --git a/docs/web3-bzz.rst b/docs/web3-bzz.rst index c068068..790994d 100644 --- a/docs/web3-bzz.rst +++ b/docs/web3-bzz.rst @@ -28,7 +28,13 @@ For more see the `Swarm Docs `_. ------------------------------------------------------------------------------ -.. include:: package-core.rst +.. include:: include_package-core.rst + + +------------------------------------------------------------------------------ + + +.. include:: include_package-net.rst ------------------------------------------------------------------------------ diff --git a/docs/web3-eth-net.rst b/docs/web3-eth-net.rst index 07c3370..5ae50ba 100644 --- a/docs/web3-eth-net.rst +++ b/docs/web3-eth-net.rst @@ -10,36 +10,9 @@ Contains functions to receive information about the current network. ------------------------------------------------------------------------------ -id -========= -.. code-block:: javascript +.. include:: include_package-net.rst - web3.eth.net.getId([callback]) - -Gets the current network ID. - ----------- -Parameters ----------- - -none - -------- -Returns -------- - -``Promise`` returns ``Number``: The network ID. - -------- -Example -------- - -.. code-block:: javascript - - web3.eth.getId() - .then(console.log); - > 1 ------------------------------------------------------------------------------ @@ -76,68 +49,3 @@ Example > "main" ------------------------------------------------------------------------------- - -isListening -========= - -.. code-block:: javascript - - web3.eth.net.isListening([callback]) - -Checks if the node is listening for peers. - ----------- -Parameters ----------- - -none - -------- -Returns -------- - -``Promise`` returns ``Boolean`` - -------- -Example -------- - -.. code-block:: javascript - - web3.eth.isListening() - .then(console.log); - > true - ------------------------------------------------------------------------------- - -getPeerCount -========= - -.. code-block:: javascript - - web3.eth.net.getPeerCount([callback]) - -Get the number of peers connected to. - ----------- -Parameters ----------- - -none - -------- -Returns -------- - -``Promise`` returns ``Number`` - -------- -Example -------- - -.. code-block:: javascript - - web3.eth.getPeerCount() - .then(console.log); - > 25 diff --git a/docs/web3-eth-personal.rst b/docs/web3-eth-personal.rst new file mode 100644 index 0000000..7ce6ba3 --- /dev/null +++ b/docs/web3-eth-personal.rst @@ -0,0 +1,75 @@ +.. _eth-personal: + +======== +web3.eth.personal +======== + + +The ``web3-eth-personal`` package allows you to interact with the Ethereum node's accounts. + +.. note:: Many of these functions send sensitive information, like password. Never call these functions over a unsecured Websocket or HTTP provider, as your password will be send in plain text! + + +.. code-block:: javascript + + var Personal = require('web3-eth-personal'); + + // "Personal.providers.givenProvider" will be set if in an Ethereum supported browser. + var personal = new Personal(Personal.givenProvider || new Personal.providers.WebsocketProvider('ws://some.local-or-remote.node:8546')); + + + // or using the web3 umbrella package + + var Web3 = require('web3'); + var web3 = new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider('ws://some.local-or-remote.node:8546')); + + // -> web3.eth.personal + + +------------------------------------------------------------------------------ + + +.. include:: include_package-core.rst + + + +------------------------------------------------------------------------------ + + + +newAccount +========= + +.. code-block:: javascript + + web3.eth.personal.newAccount(password, [callback]) + +Creates a new account. + +.. note:: Never call this function over a unsecured Websocket or HTTP provider, as your password will be send in plain text! + +---------- +Parameters +---------- + +1. ``password`` - ``String``: The password to encrypt this account with. + +------- +Returns +------- + +``Promise`` returns ``Boolean``: ``true`` if the account was created, otherwise ``false``. + +------- +Example +------- + +.. code-block:: javascript + + web3.eth.personal.newAccount('!@superpassword') + .then(console.log); + > true + +------------------------------------------------------------------------------ + +// TODO diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index 98ba3e2..3203098 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -73,6 +73,15 @@ For ``web3.eth.Iban`` see the :ref:`Iban reference documentation ` ------------------------------------------------------------------------------ +personal +===================== + +For ``web3.eth.personal`` see the :ref:`personal reference documentation ` + + +------------------------------------------------------------------------------ + + net ===================== @@ -82,7 +91,7 @@ For ``web3.eth.net`` see the :ref:`net reference documentation ` ------------------------------------------------------------------------------ -.. include:: package-core.rst +.. include:: include_package-core.rst ------------------------------------------------------------------------------ diff --git a/docs/web3-net.rst b/docs/web3-net.rst new file mode 100644 index 0000000..dcbda4f --- /dev/null +++ b/docs/web3-net.rst @@ -0,0 +1,42 @@ +.. _shh: + +======== +web3.*.net +======== + + +The ``web3-net`` package allows you to interact with the Ethereum nodes network properties. + + +.. code-block:: javascript + + var Net = require('web3-net'); + + // "Personal.providers.givenProvider" will be set if in an Ethereum supported browser. + var net = new Net(Net.givenProvider || new Net.providers.WebsocketProvider('ws://some.local-or-remote.node:8546')); + + + // or using the web3 umbrella package + + var Web3 = require('web3'); + var web3 = new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider('ws://some.local-or-remote.node:8546')); + + // -> web3.eth.net + // -> web3.bzz.net + // -> web3.shh.net + + +------------------------------------------------------------------------------ + + +.. include:: include_package-core.rst + + + +------------------------------------------------------------------------------ + + +.. include:: include_package-net.rst + + +------------------------------------------------------------------------------ diff --git a/docs/web3-shh.rst b/docs/web3-shh.rst index f3f1faa..f2bcb65 100644 --- a/docs/web3-shh.rst +++ b/docs/web3-shh.rst @@ -30,10 +30,16 @@ For more see `Whisper Overview web3.eth - > web3.personal > web3.shh > web3.bzz > web3.utils diff --git a/gulpfile.js b/gulpfile.js index 913f09f..750ceef 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -49,17 +49,9 @@ var packages = [{ expose: 'Eth', src: './packages/web3-eth/src/index.js' },{ - fileName: 'web3-personal', + fileName: 'web3-eth-personal', expose: 'Personal', - src: './packages/web3-personal/src/index.js' -},{ - fileName: 'web3-shh', - expose: 'Shh', - src: './packages/web3-shh/src/index.js' -},{ - fileName: 'web3-bzz', - expose: 'Bzz', - src: './packages/web3-bzz/src/index.js' + src: './packages/web3-eth-personal/src/index.js' },{ fileName: 'web3-eth-iban', expose: 'EthIban', @@ -68,6 +60,18 @@ var packages = [{ fileName: 'web3-eth-abi', expose: 'EthAbi', src: './packages/web3-eth-abi/src/index.js' +},{ + fileName: 'web3-net', + expose: 'Net', + src: './packages/web3-net/src/index.js' +},{ + fileName: 'web3-shh', + expose: 'Shh', + src: './packages/web3-shh/src/index.js' +},{ + fileName: 'web3-bzz', + expose: 'Bzz', + src: './packages/web3-bzz/src/index.js' }]; var browserifyOptions = { diff --git a/packages/web3-bzz/package.json b/packages/web3-bzz/package.json index 3aa6036..b8d52a5 100644 --- a/packages/web3-bzz/package.json +++ b/packages/web3-bzz/package.json @@ -7,6 +7,7 @@ "main": "src/index.js", "dependencies": { "web3-core": "^1.0.0", - "web3-core-method": "^1.0.0" + "web3-core-method": "^1.0.0", + "web3-net": "^1.0.0" } } diff --git a/packages/web3-bzz/src/index.js b/packages/web3-bzz/src/index.js index bb3bb29..7c5b577 100644 --- a/packages/web3-bzz/src/index.js +++ b/packages/web3-bzz/src/index.js @@ -24,6 +24,7 @@ var core = require('web3-core'); var Method = require('web3-core-method'); +var Net = require('web3-net'); var Bzz = function Bzz() { @@ -37,6 +38,8 @@ var Bzz = function Bzz() { method.attachToObject(_this); method.setRequestManager(_this._requestManager); }); + + this.net = new Net(this.currentProvider); }; core.addProviders(Bzz); diff --git a/packages/web3-eth-net/package.json b/packages/web3-eth-net/package.json deleted file mode 100755 index 5a53947..0000000 --- a/packages/web3-eth-net/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "web3-eth-net", - "version": "1.0.0", - "description": "Web3 module to interact with the Ethereum nodes networking properties.", - "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-net", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "web3-core": "^1.0.0", - "web3-core-method": "^1.0.0", - "web3-utils": "^1.0.0" - } -} diff --git a/packages/web3-eth-net/src/index.js b/packages/web3-eth-net/src/index.js deleted file mode 100755 index e2ead75..0000000 --- a/packages/web3-eth-net/src/index.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 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); - - - methods().forEach(function(method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - }); - -}; - -core.addProviders(Net); - - -var methods = function () { - - var getId = new Method({ - name: 'getId', - call: 'net_version', - params: 0, - outputFormatter: utils.toNumber - }); - - var isListening = new Method({ - name: 'isListening', - call: 'net_listening', - params: 0 - }); - - var getPeerCount = new Method({ - name: 'getPeerCount', - call: 'net_peerCount', - params: 0, - outputFormatter: utils.toNumber - }); - - - return [ - getId, - isListening, - getPeerCount - ]; -}; - - -module.exports = Net; - - diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index 79319d9..f348ebe 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -10,10 +10,11 @@ "web3-core-helpers": "^1.0.0", "web3-core-subscriptions": "^1.0.0", "web3-core-method": "^1.0.0", - "web3-eth-net": "^1.0.0", "web3-eth-iban": "^1.0.0", "web3-eth-abi": "^1.0.0", "web3-eth-contract": "^1.0.0", + "web3-eth-personal": "^1.0.0", + "web3-net": "^1.0.0", "web3-utils": "^1.0.0", "underscore": "^1.8.3" } diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index 0cdf22d..0d616ac 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -26,9 +26,11 @@ var _ = require('underscore'); var core = require('web3-core'); var helpers = require('web3-core-helpers'); var Subscriptions = require('web3-core-subscriptions').subscriptions; -var utils = require('web3-utils'); var Method = require('web3-core-method'); -var Net = require('web3-eth-net'); +var utils = require('web3-utils'); +var Net = require('web3-net'); + +var Personal = require('web3-eth-personal'); var abi = require('web3-eth-abi'); var Contract = require('web3-eth-contract'); var Iban = require('web3-eth-iban'); @@ -73,8 +75,12 @@ var Eth = function Eth() { method.setRequestManager(_this._requestManager, _this); // second param means is Eth (necessary for promiEvent) }); + // add net this.net = new Net(this.currentProvider); + // add personal + this.personal = new Personal(this.currentProvider); + // add contract this.Contract = Contract; this.Contract.prototype._eth = this; diff --git a/packages/web3-personal/package.json b/packages/web3-personal/package.json deleted file mode 100644 index 0be3343..0000000 --- a/packages/web3-personal/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "web3-personal", - "version": "1.0.0", - "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-personal", - "license": "LGPL-3.0", - "main": "src/index.js", - "dependencies": { - "web3-core": "^1.0.0", - "web3-core-helpers": "^1.0.0", - "web3-core-method": "^1.0.0", - "web3-utils": "^1.0.0" - } -} diff --git a/packages/web3-personal/src/index.js b/packages/web3-personal/src/index.js deleted file mode 100644 index 1e206cc..0000000 --- a/packages/web3-personal/src/index.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 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 formatters = require('web3-core-helpers').formatters; - - -var Personal = function Personal() { - var _this = this; - - // sets _requestmanager - core.packageInit(this, arguments); - - - methods().forEach(function(method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - }); -}; - -core.addProviders(Personal); - - -var methods = function () { - - var getAccounts = new Method({ - name: 'getAccounts', - call: 'personal_listAccounts', - params: 0, - outputFormatter: utils.toChecksumAddress - }); - - var newAccount = new Method({ - name: 'newAccount', - call: 'personal_newAccount', - params: 1, - inputFormatter: [null], - outputFormatter: utils.toChecksumAddress - }); - - var unlockAccount = new Method({ - name: 'unlockAccount', - call: 'personal_unlockAccount', - params: 3, - inputFormatter: [formatters.inputAddressFormatter, null, null] - }); - - var sendTransaction = new Method({ - name: 'sendTransaction', - call: 'personal_sendTransaction', - params: 2, - inputFormatter: [formatters.inputTransactionFormatter, null] - }); - - var lockAccount = new Method({ - name: 'lockAccount', - call: 'personal_lockAccount', - params: 1, - inputFormatter: [formatters.inputAddressFormatter] - }); - - - return [ - getAccounts, - newAccount, - unlockAccount, - sendTransaction, - lockAccount - ]; -}; - - -module.exports = Personal; - - diff --git a/packages/web3-shh/package.json b/packages/web3-shh/package.json index b82265b..e26de44 100644 --- a/packages/web3-shh/package.json +++ b/packages/web3-shh/package.json @@ -9,6 +9,7 @@ "web3-core": "^1.0.0", "web3-core-helpers": "^1.0.0", "web3-core-method": "^1.0.0", - "web3-core-subscriptions": "^1.0.0" + "web3-core-subscriptions": "^1.0.0", + "web3-net": "^1.0.0" } } diff --git a/packages/web3-shh/src/index.js b/packages/web3-shh/src/index.js index fdd939d..01096e8 100644 --- a/packages/web3-shh/src/index.js +++ b/packages/web3-shh/src/index.js @@ -25,8 +25,8 @@ 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() { @@ -41,6 +41,8 @@ var Shh = function Shh() { method.attachToObject(_this); method.setRequestManager(_this._requestManager); }); + + this.net = new Net(this.currentProvider); }; core.addProviders(Shh); diff --git a/src/index.js b/src/index.js index cf274b8..1770969 100644 --- a/src/index.js +++ b/src/index.js @@ -32,8 +32,8 @@ var version = require('../lerna.json'); var core = require('../packages/web3-core'); var Eth = require('../packages/web3-eth'); -var Net = require('../packages/web3-eth-net'); -var Personal = require('../packages/web3-personal'); +var Net = require('../packages/web3-net'); +var Personal = require('../packages/web3-eth-personal'); var Shh = require('../packages/web3-shh'); var Bzz = require('../packages/web3-bzz'); @@ -59,7 +59,6 @@ var Web3 = function Web3() { this.eth = new Eth(this); - this.personal = new Personal(this); // move to -> web3.eth.accounts this.shh = new Shh(this); this.bzz = new Bzz(this); @@ -67,10 +66,16 @@ var Web3 = function Web3() { this.setProvider = function (provider) { this._requestManager.setProvider(provider); + this.eth.setProvider(provider); + this.eth.net.setProvider(provider); + this.eth.personal.setProvider(provider); + this.shh.setProvider(provider); + this.shh.net.setProvider(provider); + this.bzz.setProvider(provider); - this.personal.setProvider(provider); + this.bzz.net.setProvider(provider); return true; }; }; diff --git a/test/eth_methods.js b/test/eth_methods.js index ef78d2a..87a5abd 100644 --- a/test/eth_methods.js +++ b/test/eth_methods.js @@ -41,6 +41,16 @@ describe('eth', function() { u.propertyExists(eth, 'givenProvider'); u.propertyExists(eth, 'defaultBlock'); u.propertyExists(eth, 'defaultAccount'); + + u.propertyExists(eth, 'net'); + u.methodExists(eth.net, 'getId'); + u.methodExists(eth.net, 'isListening'); + u.methodExists(eth.net, 'getPeerCount'); + + u.propertyExists(eth, 'personal'); + u.methodExists(eth.personal, 'sendTransaction'); + u.methodExists(eth.personal, 'newAccount'); + u.methodExists(eth.personal, 'unlockAccount'); }); }); diff --git a/test/personal.getAccounts.js b/test/personal.getAccounts.js index e187fb6..7f342fb 100644 --- a/test/personal.getAccounts.js +++ b/test/personal.getAccounts.js @@ -9,4 +9,4 @@ var tests = [{ call: 'personal_listAccounts' }]; -testMethod.runTests('personal', method, tests); +testMethod.runTests(['eth','personal'], method, tests); diff --git a/test/personal.lockAccount.js b/test/personal.lockAccount.js index 942ad95..14b838c 100644 --- a/test/personal.lockAccount.js +++ b/test/personal.lockAccount.js @@ -17,4 +17,4 @@ var tests = [{ call: 'personal_'+ method }]; -testMethod.runTests('personal', method, tests); +testMethod.runTests(['eth','personal'], method, tests); diff --git a/test/personal.newAccount.js b/test/personal.newAccount.js index cd9bf21..f7cbac3 100644 --- a/test/personal.newAccount.js +++ b/test/personal.newAccount.js @@ -11,5 +11,5 @@ var tests = [{ call: 'personal_newAccount' }]; -testMethod.runTests('personal', method, tests); +testMethod.runTests(['eth','personal'], method, tests); diff --git a/test/personal.sendTransaction.js b/test/personal.sendTransaction.js index 45b00eb..93a4819 100644 --- a/test/personal.sendTransaction.js +++ b/test/personal.sendTransaction.js @@ -57,5 +57,5 @@ var tests = [{ call: 'personal_'+ method }]; -testMethod.runTests('personal', method, tests); +testMethod.runTests(['eth','personal'], method, tests); diff --git a/test/personal.unlockAccount.js b/test/personal.unlockAccount.js index 26d53e0..0bbdf85 100644 --- a/test/personal.unlockAccount.js +++ b/test/personal.unlockAccount.js @@ -17,4 +17,4 @@ var tests = [{ call: 'personal_'+ method }]; -testMethod.runTests('personal', method, tests); +testMethod.runTests(['eth','personal'], method, tests); diff --git a/test/personal_methods.js b/test/personal_methods.js index adf2573..7fb7258 100644 --- a/test/personal_methods.js +++ b/test/personal_methods.js @@ -1,7 +1,7 @@ var chai = require('chai'); var assert = chai.assert; var u = require('./helpers/test.utils.js'); -var Personal = require('../packages/web3-personal'); +var Personal = require('../packages/web3-eth-personal'); var personal = new Personal(); describe('web3.net', function() { @@ -11,5 +11,10 @@ describe('web3.net', function() { u.methodExists(personal, 'unlockAccount'); u.methodExists(personal, 'lockAccount'); u.methodExists(personal, 'sendTransaction'); + + u.propertyExists(personal, 'net'); + u.methodExists(personal.net, 'getId'); + u.methodExists(personal.net, 'isListening'); + u.methodExists(personal.net, 'getPeerCount'); }); }); diff --git a/test/shh_methods.js b/test/shh_methods.js index 507cd4d..96e50d4 100644 --- a/test/shh_methods.js +++ b/test/shh_methods.js @@ -10,6 +10,10 @@ describe('shh', function() { u.methodExists(shh, 'newGroup'); u.methodExists(shh, 'addToGroup'); u.methodExists(shh, 'subscribe'); + u.propertyExists(shh, 'net'); + u.methodExists(shh.net, 'getId'); + u.methodExists(shh.net, 'isListening'); + u.methodExists(shh.net, 'getPeerCount'); }); }); diff --git a/test/web3_methods.js b/test/web3_methods.js index 7ffae59..93ae681 100644 --- a/test/web3_methods.js +++ b/test/web3_methods.js @@ -11,7 +11,6 @@ describe('web3', function() { u.propertyExists(web3, 'eth'); u.propertyExists(web3, 'bzz'); u.propertyExists(web3, 'shh'); - u.propertyExists(web3, 'personal'); u.propertyExists(web3, 'utils'); });