Fix slow balances (#6471)

* Update token updates

* Update token info fetching

* Update logger

* Minor fixes to updates and notifications for balances

* Use Pubsub

* Fix timeout.

* Use pubsub for status.

* Fix signer subscription.

* Process tokens in chunks.

* Fix tokens loaded by chunks

* Linting

* Dispatch tokens asap

* Fix chunks processing.

* Better filter options

* Parallel log fetching.

* Fix signer polling.

* Fix initial block query.

* Token balances updates : the right(er) way

* Better tokens info fetching

* Fixes in token data fetching

* Only fetch what's needed (tokens)

* Fix linting issues

* Revert "Transaction permissioning (#6441)"

This reverts commit eed0e8b03a.

* Revert "Revert "Transaction permissioning (#6441)""

This reverts commit 8f96415e58dde652e5828706eb2639d43416f448.

* Update wasm-tests.

* Fixing balances fetching

* Fix requests tracking in UI

* Fix request watching

* Update the Logger

* PR Grumbles Fixes

* PR Grumbles fixes

* Linting...
This commit is contained in:
Nicolas Gotchac
2017-09-10 18:03:35 +02:00
committed by Gav Wood
parent ee14a3fb31
commit f1a050366f
51 changed files with 1819 additions and 857 deletions

View File

@@ -31,6 +31,10 @@ export default class HardwareStore {
this._pollId = null;
this._pollScan();
this._subscribeParity();
this._api.transport.on('close', () => {
this._subscribeParity();
});
}
isConnected (address) {
@@ -78,26 +82,30 @@ export default class HardwareStore {
});
}
scanParity () {
return this._api.parity
.hardwareAccountsInfo()
.then((hwInfo) => {
Object
.keys(hwInfo)
.forEach((address) => {
const info = hwInfo[address];
_subscribeParity () {
const onError = error => {
console.warn('HardwareStore::scanParity', error);
info.address = address;
info.via = 'parity';
});
return {};
};
return hwInfo;
})
.catch((error) => {
console.warn('HardwareStore::scanParity', error);
return this._api.pubsub
.subscribeAndGetResult(
callback => this._api.pubsub.parity.hardwareAccountsInfo(callback),
hwInfo => {
Object
.keys(hwInfo)
.forEach((address) => {
const info = hwInfo[address];
return {};
});
info.address = address;
info.via = 'parity';
});
this.setWallets(hwInfo);
return hwInfo;
},
onError
).catch(onError);
}
scan () {
@@ -107,14 +115,10 @@ export default class HardwareStore {
// is done, different results will be retrieved via Parity vs. the browser APIs
// (latter is Chrome-only, needs the browser app enabled on a Ledger, former is
// not intended as a network call, i.e. hw wallet is with the user)
return Promise
.all([
this.scanParity(),
this.scanLedger()
])
.then(([hwAccounts, ledgerAccounts]) => {
return this.scanLedger()
.then((ledgerAccounts) => {
transaction(() => {
this.setWallets(Object.assign({}, hwAccounts, ledgerAccounts));
this.setWallets(Object.assign({}, ledgerAccounts));
this.setScanning(false);
});
});