Smarter balance fetching (#3605)

* Smarter dApps Manifest fetching...

* Fetching only visible accounts (and don't delete other balances) #3590

* Moved balances action into BalancesActions #3590

* Fetch balances for accounts and contracts #3590

* Add balances to contract/address/account views #3590

* Fix transaction not fetching on first load

* Remove console.warn

* Fix pending tokens not showing #3154

* Fix tokens image update

* Remove unused name in Header

* Separate Tokens and ETH fetching #3590

* Remove unused isTest

* Fetch Tokens Balance via Filter #3590

* Fix linting

* Fix updating tokens image (#3590)

* Fix contract balances

* Improved Status

* Fixing secureApi issues...

* Fetch all tokens every 2 minutes (for safety) #3590

* PR changes fix

* Fix Account error
This commit is contained in:
Nicolas Gotchac
2016-11-25 16:46:35 +01:00
committed by Jaco Greeff
parent 9fdab84305
commit 08c507daaa
27 changed files with 798 additions and 355 deletions

View File

@@ -32,6 +32,8 @@ export default class DappsStore {
@observable modalOpen = false;
@observable externalOverlayVisible = true;
_manifests = {};
constructor (api) {
this._api = api;
@@ -249,12 +251,27 @@ export default class DappsStore {
}
_fetchManifest (manifestHash) {
if (/^(0x)?0+/.test(manifestHash)) {
return Promise.resolve(null);
}
if (this._manifests[manifestHash]) {
return Promise.resolve(this._manifests[manifestHash]);
}
return fetch(`${this._getHost()}/api/content/${manifestHash}/`, { redirect: 'follow', mode: 'cors' })
.then((response) => {
return response.ok
? response.json()
: null;
})
.then((manifest) => {
if (manifest) {
this._manifests[manifestHash] = manifest;
}
return manifest;
})
.catch((error) => {
console.warn('DappsStore:fetchManifest', error);
return null;