Proper default accounts RPCs (#4580)

* Default accounts setting - account provider

* RPC support for default accounts

* Updating JS code

* Rename whitelist to addresses
This commit is contained in:
Tomasz Drwięga
2017-02-20 16:33:12 +01:00
committed by Gav Wood
parent 1949d44d0c
commit 72998d3ce3
22 changed files with 511 additions and 161 deletions

View File

@@ -61,7 +61,7 @@ export default class AccountStore {
this.setDefaultAccount(address);
return this._api.parity
.setNewDappsWhitelist(accounts)
.setNewDappsAddresses(accounts)
.catch((error) => {
console.warn('makeDefaultAccount', error);
});
@@ -78,7 +78,7 @@ export default class AccountStore {
return Promise
.all([
this._api.parity.getNewDappsWhitelist(),
this._api.parity.getNewDappsAddresses(),
this._api.parity.allAccountsInfo()
])
.then(([whitelist, accounts]) => {

View File

@@ -76,8 +76,8 @@ describe('views/ParityBar/AccountStore', () => {
store.setAccounts.restore();
});
it('calls into parity_getNewDappsWhitelist', () => {
expect(api.parity.getNewDappsWhitelist).to.have.been.called;
it('calls into parity_getNewDappsAddresses', () => {
expect(api.parity.getNewDappsAddresses).to.have.been.called;
});
it('calls into parity_allAccountsInfo', () => {
@@ -104,8 +104,8 @@ describe('views/ParityBar/AccountStore', () => {
return store.makeDefaultAccount(ACCOUNT_NEW);
});
it('calls into parity_setNewDappsWhitelist (with ordering)', () => {
expect(api.parity.setNewDappsWhitelist).to.have.been.calledWith([
it('calls into parity_setNewDappsAddresses (with ordering)', () => {
expect(api.parity.setNewDappsAddresses).to.have.been.calledWith([
ACCOUNT_NEW, ACCOUNT_FIRST, ACCOUNT_DEFAULT
]);
});

View File

@@ -36,8 +36,8 @@ function createApi () {
parity: {
defaultAccount: sinon.stub().resolves(ACCOUNT_DEFAULT),
allAccountsInfo: sinon.stub().resolves(ACCOUNTS),
getNewDappsWhitelist: sinon.stub().resolves(null),
setNewDappsWhitelist: sinon.stub().resolves(true)
getNewDappsAddresses: sinon.stub().resolves(null),
setNewDappsAddresses: sinon.stub().resolves(true)
}
};