parent
bc9464fcbd
commit
dd529575f6
@ -74,28 +74,27 @@ export default class AccountStore {
|
|||||||
this._api.parity.getNewDappsAddresses(),
|
this._api.parity.getNewDappsAddresses(),
|
||||||
this._api.parity.allAccountsInfo()
|
this._api.parity.allAccountsInfo()
|
||||||
])
|
])
|
||||||
.then(([whitelist, accounts]) => {
|
.then(([whitelist, allAccounts]) => {
|
||||||
transaction(() => {
|
transaction(() => {
|
||||||
this.setLoading(false);
|
const accounts = Object
|
||||||
this.setAccounts(
|
.keys(allAccounts)
|
||||||
Object
|
|
||||||
.keys(accounts)
|
|
||||||
.filter((address) => {
|
.filter((address) => {
|
||||||
const account = accounts[address];
|
const account = allAccounts[address];
|
||||||
const isAccount = account.uuid || (account.meta && account.meta.hardware);
|
const isAccount = account.uuid || (account.meta && account.meta.hardware);
|
||||||
const isWhitelisted = !whitelist || whitelist.includes(address);
|
const isWhitelisted = !whitelist || whitelist.includes(address);
|
||||||
|
|
||||||
return isAccount && isWhitelisted;
|
return isAccount && isWhitelisted;
|
||||||
})
|
})
|
||||||
.map((address) => {
|
.map((address) => {
|
||||||
const account = accounts[address];
|
return {
|
||||||
|
...allAccounts[address],
|
||||||
|
checked: address === this.defaultAccount,
|
||||||
|
address
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
account.address = address;
|
this.setLoading(false);
|
||||||
account.checked = address === this.defaultAccount;
|
this.setAccounts(accounts);
|
||||||
|
|
||||||
return account;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@ -117,6 +116,13 @@ export default class AccountStore {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return Promise.all([ promiseDefaultAccount, promiseEthAccounts ]);
|
const promiseAccountsInfo = this._api
|
||||||
|
.subscribe('parity_allAccountsInfo', (error, accountsInfo) => {
|
||||||
|
if (!error) {
|
||||||
|
this.loadAccounts();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return Promise.all([ promiseDefaultAccount, promiseEthAccounts, promiseAccountsInfo ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user