Limiting accounts returned by parity_accountInfo (#3931)

* Limiting accountNames returned by parity_accountNames

* Fixing middleware

* Change RPC interface

* Enhance tests for RPC layer

* UI uses parity_allAccountsInfo

* Update dapps to use parity_accountsInfo

* Don't filter by uuid (deprecated)

* Consistency in calls

* Fix js tests (missed stub call)
This commit is contained in:
Tomasz Drwięga
2016-12-23 18:52:02 +01:00
committed by Gav Wood
parent 546246c56b
commit 27ba0e6922
26 changed files with 145 additions and 119 deletions

View File

@@ -24,7 +24,7 @@ import Signer from './signer';
const events = {
'logging': { module: 'logging' },
'eth_blockNumber': { module: 'eth' },
'parity_accountsInfo': { module: 'personal' },
'parity_allAccountsInfo': { module: 'personal' },
'eth_accounts': { module: 'personal' },
'signer_requestsToConfirm': { module: 'signer' }
};

View File

@@ -46,9 +46,9 @@ export default class Personal {
_accountsInfo = () => {
return this._api.parity
.accountsInfo()
.allAccountsInfo()
.then((info) => {
this._updateSubscriptions('parity_accountsInfo', null, info);
this._updateSubscriptions('parity_allAccountsInfo', null, info);
});
}

View File

@@ -28,16 +28,16 @@ const TEST_LIST = ['0xfa64203C044691aA57251aF95f4b48d85eC00Dd5'];
function stubApi (accounts, info) {
const _calls = {
accountsInfo: [],
allAccountsInfo: [],
listAccounts: []
};
return {
_calls,
parity: {
accountsInfo: () => {
allAccountsInfo: () => {
const stub = sinon.stub().resolves(info || TEST_INFO)();
_calls.accountsInfo.push(stub);
_calls.allAccountsInfo.push(stub);
return stub;
}
},
@@ -86,8 +86,8 @@ describe('api/subscriptions/personal', () => {
expect(personal.isStarted).to.be.true;
});
it('calls parity_accountsInfo', () => {
expect(api._calls.accountsInfo.length).to.be.ok;
it('calls parity_allAccountsInfo', () => {
expect(api._calls.allAccountsInfo.length).to.be.ok;
});
it('calls eth_accounts', () => {
@@ -96,7 +96,7 @@ describe('api/subscriptions/personal', () => {
it('updates subscribers', () => {
expect(cb.firstCall).to.have.been.calledWith('eth_accounts', null, TEST_LIST);
expect(cb.secondCall).to.have.been.calledWith('parity_accountsInfo', null, TEST_INFO);
expect(cb.secondCall).to.have.been.calledWith('parity_allAccountsInfo', null, TEST_INFO);
});
});
@@ -112,7 +112,7 @@ describe('api/subscriptions/personal', () => {
});
it('calls personal_accountsInfo', () => {
expect(api._calls.accountsInfo.length).to.be.ok;
expect(api._calls.allAccountsInfo.length).to.be.ok;
});
it('calls personal_listAccounts', () => {