Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Simplifying transactions polling
Browse files Browse the repository at this point in the history
  • Loading branch information
ngotchac committed Oct 25, 2016
1 parent 62a7264 commit a7bc759
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions js/src/redux/providers/personal.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export default class Personal {
constructor (store, api) {
this._api = api;
this._store = store;

this._addresses = [];
}

start () {
Expand All @@ -45,16 +43,23 @@ export default class Personal {

this._api
.subscribe('eth_blockNumber', () => {
const addresses = this._addresses;
const { accounts } = this._store.getState().personal;
const addresses = Object.keys(accounts);

if (!addresses || addresses.length === 0) {
return;
}

Promise
.all([
this._api.trace.filter({ fromAddress: addresses }),
this._api.trace.filter({ toAddress: addresses })
this._api.trace.filter({
fromAddress: addresses,
toBlock: 'pending'
}),
this._api.trace.filter({
toAddress: addresses,
toBlock: 'pending'
})
])
.then(([ fromTraces, toTraces ]) => {
const traces = Object.values([]
Expand Down Expand Up @@ -91,14 +96,6 @@ export default class Personal {
return;
}

if (accountsInfo) {
const addresses = Object.keys(accountsInfo).sort();

if (!isEqual(addresses, this._addresses)) {
this._addresses = addresses;
}
}

this._store.dispatch(personalAccountsInfo(accountsInfo));
})
.then((subscriptionId) => {
Expand Down

0 comments on commit a7bc759

Please sign in to comment.