Skip to content

Commit

Permalink
Merge pull request #2631 from ethereum/issue/1204
Browse files Browse the repository at this point in the history
EthGetAccountsMethod implemented
  • Loading branch information
nivida authored Apr 3, 2019
2 parents dff9a01 + bfedd22 commit 9e3d016
Show file tree
Hide file tree
Showing 120 changed files with 6,119 additions and 5,751 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ node_js:
- "8"
- "9"
- "10"
- "11.10"
- "11"
env:
- CXX=g++-4.8
addons:
Expand Down
10 changes: 3 additions & 7 deletions docs/web3-eth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,9 @@ getAccounts
web3.eth.getAccounts([callback])
Returns a list of accounts the node controls by using the provider and calling
the RPC method ``eth_accounts``. Using :ref:`web3.eth.accounts.create() <accounts-create>`
will not add accounts into this list. For that use
:ref:`web3.eth.personal.newAccount() <personal-newaccount>`.

The results are the same as :ref:`web3.eth.personal.getAccounts() <personal-getaccounts>` except that calls
the RPC method ``personal_listAccounts``.
Returns a list of accounts the node controls by using the provider and calling the RPC method ``eth_accounts``.
If there are unlocked local accounts then it will return them instead of sending a request to the node.
This means you can add accounts with :ref:`web3.eth.accounts.create() <accounts-create>` and you will get them returned here.

-------
Returns
Expand Down
10 changes: 7 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TODO: Improve tests and add the branch property to the coverageThreshold config.
const config = {
notifyMode: 'success-change',
// notifyMode: 'success-change',
collectCoverage: true,
coverageDirectory: './coverage/',
coverageThreshold: {
Expand All @@ -10,15 +10,19 @@ const config = {
statements: 80
}
},
notify: true,
// notify: true,
clearMocks: true,
resetMocks: true,
resetModules: true,
testMatch: ['/**/**Test.js'],
transform: {
'^.+\\.js$': '<rootDir>/../../jest.preprocessor.js'
},
bail: true
bail: true,
coveragePathIgnorePatterns: [
'node_modules',
'dist',
]
};

/**
Expand Down
9 changes: 1 addition & 8 deletions jest.preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ module.exports = require('babel-jest').createTransformer({
plugins: [
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-transform-runtime',
['istanbul', {
'exclude': [
'dist',
'tests',
'node_modules'
]
}]
'@babel/plugin-transform-runtime'
]
}
}
Expand Down
10,796 changes: 5,603 additions & 5,193 deletions package-lock.json

Large diffs are not rendered by default.

41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,39 +73,40 @@
}
],
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/core": "^7.4.0",
"@babel/plugin-proposal-export-default-from": "^7.2.0",
"@babel/plugin-proposal-export-namespace-from": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.3.4",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.3.4",
"@babel/runtime": "^7.3.4",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.30",
"@babel/plugin-transform-runtime": "^7.4.0",
"@babel/polyfill": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"@babel/runtime": "^7.4.2",
"@types/bn.js": "^4.11.5",
"@types/node": "^11.13.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-jest": "^24.6.0",
"babel-plugin-istanbul": "^5.1.1",
"coveralls": "^3.0.3",
"eslint": "^5.15.1",
"eslint-config-prettier": "^3.6.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.1.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^21.27.2",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-jest": "^22.4.1",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-unicorn": "^6.0.1",
"eslint-plugin-unicorn": "^8.0.1",
"istanbul-combine": "^0.3.0",
"jest": "^23.6.0",
"jest": "^24.6.0",
"lerna": "^3.13.1",
"prettier": "1.14.3",
"regenerator-runtime": "^0.13.1",
"rollup": "^0.67.4",
"prettier": "^1.16.4",
"regenerator-runtime": "^0.13.2",
"rollup": "^1.8.0",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-json": "^3.1.0",
"typescript": "^3.3.3333"
"rollup-plugin-json": "^4.0.0",
"typescript": "^3.4.1"
}
}
10 changes: 1 addition & 9 deletions packages/web3-core-method/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
const jestConfig = require('../../jest.config');

module.exports = jestConfig({
'WebsocketProvider': 'web3-providers',
'HttpProvider': 'web3-providers',
'AbstractWeb3Module': 'web3-core',
'Utils': 'web3-utils',
'formatters': 'web3-core-helpers',
'AbstractSubscription': 'web3-core-subscriptions',
'NewHeadsSubscription': 'web3-core-subscriptions'
});
module.exports = jestConfig();
4 changes: 2 additions & 2 deletions packages/web3-core-method/lib/methods/AbstractMethod.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ export default class AbstractMethod {
*
* @param {IArguments} args
*/
setArguments(args) {
let parameters = cloneDeep([...args]);
setArguments(arguments_) {
let parameters = cloneDeep([...arguments_]);
let callback = null;

if (parameters.length > this.parametersAmount) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {AbstractWeb3Module} from 'web3-core';
import {NewHeadsSubscription} from 'web3-core-subscriptions';
import AbstractMethod from '../../../lib/methods/AbstractMethod';
import AbstractMethodFactory from '../../../lib/factories/AbstractMethodFactory';
import AbstractObservedTransactionMethod from '../../../lib/methods/transaction/AbstractObservedTransactionMethod';
import EthSendTransactionMethod from '../../../src/methods/transaction/EthSendTransactionMethod';
import TransactionObserver from '../../../src/observers/TransactionObserver';
import GetTransactionReceiptMethod from '../../../src/methods/transaction/GetTransactionReceiptMethod';
import GetBlockByNumberMethod from '../../../src/methods/block/GetBlockByNumberMethod';
import {NewHeadsSubscription} from 'web3-core-subscriptions';
import ChainIdMethod from '../../../src/methods/network/ChainIdMethod';
import GetTransactionCountMethod from '../../../src/methods/account/GetTransactionCountMethod';

// Mocks
jest.mock('AbstractWeb3Module');
jest.mock('NewHeadsSubscription');
jest.mock('web3-core');
jest.mock('web3-core-subscriptions');
jest.mock('../../../lib/methods/AbstractMethod');
jest.mock('../../../src/methods/block/GetBlockByNumberMethod');
jest.mock('../../../src/methods/transaction/GetTransactionReceiptMethod');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {formatters} from 'web3-core-helpers';
import AbstractMethod from '../../../lib/methods/AbstractMethod';

// Mocks
jest.mock('Utils');
jest.mock('formatters');
jest.mock('WebsocketProvider');
jest.mock('web3-utils');
jest.mock('web3-core-helpers');
jest.mock('web3-providers');

/**
* AbstractMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import AbstractGetBlockMethod from '../../../../lib/methods/block/AbstractGetBlockMethod';

// Mocks
jest.mock('formatters');
jest.mock('web3-core-helpers');

/**
* AbstractGetBlockMethodTest test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import AbstractGetBlockTransactionCountMethod from '../../../../lib/methods/block/AbstractGetBlockTransactionCountMethod';

// Mocks
jest.mock('Utils');
jest.mock('formatters');
jest.mock('web3-utils');
jest.mock('web3-core-helpers');

/**
* AbstractGetBlockTransactionCountMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import AbstractGetBlockUncleCountMethod from '../../../../lib/methods/block/AbstractGetBlockUncleCountMethod';

// Mocks
jest.mock('Utils');
jest.mock('formatters');
jest.mock('web3-utils');
jest.mock('web3-core-helpers');

/**
* AbstractGetBlockUncleCountMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import AbstractGetUncleMethod from '../../../../lib/methods/block/AbstractGetUncleMethod';

// Mocks
jest.mock('Utils');
jest.mock('formatters');
jest.mock('web3-utils');
jest.mock('web3-core-helpers');

/**
* AbstractGetUncleMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {formatters} from 'web3-core-helpers';
import AbstractGetTransactionFromBlockMethod from '../../../../lib/methods/transaction/AbstractGetTransactionFromBlockMethod';

// Mocks
jest.mock('Utils');
jest.mock('formatters');
jest.mock('web3-utils');
jest.mock('web3-core-helpers');

/**
* AbstractGetTransactionFromBlockMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../lib/methods/AbstractMethod';
import CallMethod from '../../../src/methods/CallMethod';

// Mocks
jest.mock('formatters');
jest.mock('web3-core-helpers');

/**
* CallMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import AbstractMethod from '../../../lib/methods/AbstractMethod';
import EstimateGasMethod from '../../../src/methods/EstimateGasMethod';

// Mocks
jest.mock('Utils');
jest.mock('formatters');
jest.mock('web3-utils');
jest.mock('web3-core-helpers');

/**
* EstimateGasMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../lib/methods/AbstractMethod';
import GetCodeMethod from '../../../src/methods/GetCodeMethod';

// Mocks
jest.mock('formatters');
jest.mock('web3-core-helpers');

/**
* GetCodeMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../lib/methods/AbstractMethod';
import GetPastLogsMethod from '../../../src/methods/GetPastLogsMethod';

// Mocks
jest.mock('formatters');
jest.mock('web3-core-helpers');

/**
* GetPastLogsMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import AbstractMethod from '../../../lib/methods/AbstractMethod';
import GetStorageAtMethod from '../../../src/methods/GetStorageAtMethod';

// Mocks
jest.mock('formatters');
jest.mock('Utils');
jest.mock('web3-core-helpers');
jest.mock('web3-utils');

/**
* GetStorageAtMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SignMethod from '../../../src/methods/SignMethod';
import AbstractMethod from '../../../lib/methods/AbstractMethod';

// Mocks
jest.mock('formatters');
jest.mock('web3-core-helpers');

/**
* SignMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import GetAccountsMethod from '../../../../src/methods/account/GetAccountsMethod';

// Mocks
jest.mock('Utils');
jest.mock('web3-utils');

/**
* GetAccountsMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import GetBalanceMethod from '../../../../src/methods/account/GetBalanceMethod';

// Mocks
jest.mock('formatters');
jest.mock('web3-core-helpers');

/**
* GetBalanceMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import GetTransactionCountMethod from '../../../../src/methods/account/GetTransactionCountMethod';

// Mocks
jest.mock('formatters');
jest.mock('Utils');
jest.mock('web3-core-helpers');
jest.mock('web3-utils');

/**
* GetTransactionCountMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import GetBlockNumberMethod from '../../../../src/methods/block/GetBlockNumberMethod';

// Mocks
jest.mock('Utils');
jest.mock('web3-utils');

/**
* GetBlockNumberMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import ChainIdMethod from '../../../../src/methods/network/ChainIdMethod';

// Mocks
jest.mock('Utils');
jest.mock('web3-utils');

/**
* ChainIdMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import GetProtocolVersionMethod from '../../../../src/methods/network/GetProtocolVersionMethod';

// Mocks
jest.mock('Utils');
jest.mock('web3-utils');

/**
* GetProtocolVersionMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import PeerCountMethod from '../../../../src/methods/network/PeerCountMethod';

// Mocks
jest.mock('Utils');
jest.mock('web3-utils');

/**
* PeerCountMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import VersionMethod from '../../../../src/methods/network/VersionMethod';

// Mocks
jest.mock('Utils');
jest.mock('web3-utils');

/**
* VersionMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import GetCoinbaseMethod from '../../../../src/methods/node/GetCoinbaseMethod';

// Mocks
jest.mock('Utils');
jest.mock('web3-utils');

/**
* GetCoinbaseMethod test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import GetGasPriceMethod from '../../../../src/methods/node/GetGasPriceMethod';

// Mocks
jest.mock('formatters');
jest.mock('web3-core-helpers');

/**
* GetGasPriceMethod test
Expand Down
Loading

0 comments on commit 9e3d016

Please sign in to comment.