Fix detecting hardware wallets. (#6509)

This commit is contained in:
Tomasz Drwięga 2017-09-15 14:55:20 +02:00 committed by Arkadiy Paronyan
parent 3e60b221c8
commit b24bb103f7

View File

@ -29,6 +29,8 @@ export default class HardwareStore {
this._api = api; this._api = api;
this._ledger = Ledger.create(api); this._ledger = Ledger.create(api);
this._pollId = null; this._pollId = null;
this.hwAccounts = {};
this.ledgerAccounts = {};
this._pollScan(); this._pollScan();
this._subscribeParity(); this._subscribeParity();
@ -101,7 +103,8 @@ export default class HardwareStore {
info.address = address; info.address = address;
info.via = 'parity'; info.via = 'parity';
}); });
this.setWallets(hwInfo); this.hwAccounts = hwInfo;
this.updateWallets();
return hwInfo; return hwInfo;
}, },
onError onError
@ -117,13 +120,18 @@ export default class HardwareStore {
// not intended as a network call, i.e. hw wallet is with the user) // not intended as a network call, i.e. hw wallet is with the user)
return this.scanLedger() return this.scanLedger()
.then((ledgerAccounts) => { .then((ledgerAccounts) => {
this.ledgerAccounts = ledgerAccounts;
transaction(() => { transaction(() => {
this.setWallets(Object.assign({}, ledgerAccounts)); this.updateWallets();
this.setScanning(false); this.setScanning(false);
}); });
}); });
} }
updateWallets () {
this.setWallets(Object.assign({}, this.hwAccounts, this.ledgerAccounts));
}
createAccountInfo (entry, original = {}) { createAccountInfo (entry, original = {}) {
const { address, manufacturer, name } = entry; const { address, manufacturer, name } = entry;