diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-07-27 03:10:42 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-07-27 03:27:16 +0800 |
commit | 3d8ebf2265d167923f3b913bac3b9cc4d37fa052 (patch) | |
tree | 7e8701eac32f1d5c72d0e516cd0af52aa358df8a /app/scripts/controllers/infura.js | |
parent | 0deb617d8f879b9a05c4581f16f5790cafa9789a (diff) | |
download | tangerine-wallet-browser-3d8ebf2265d167923f3b913bac3b9cc4d37fa052.tar.gz tangerine-wallet-browser-3d8ebf2265d167923f3b913bac3b9cc4d37fa052.tar.zst tangerine-wallet-browser-3d8ebf2265d167923f3b913bac3b9cc4d37fa052.zip |
Begin implementing live-updating blacklist, not working yet
Diffstat (limited to 'app/scripts/controllers/infura.js')
-rw-r--r-- | app/scripts/controllers/infura.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/scripts/controllers/infura.js b/app/scripts/controllers/infura.js index b34b0bc03..97b2ab7e3 100644 --- a/app/scripts/controllers/infura.js +++ b/app/scripts/controllers/infura.js @@ -1,5 +1,6 @@ const ObservableStore = require('obs-store') const extend = require('xtend') +const recentBlacklist = require('etheraddresslookup/blacklists/domains.json') // every ten minutes const POLLING_INTERVAL = 300000 @@ -9,6 +10,7 @@ class InfuraController { constructor (opts = {}) { const initState = extend({ infuraNetworkStatus: {}, + blacklist: recentBlacklist, }, opts.initState) this.store = new ObservableStore(initState) } @@ -30,12 +32,24 @@ class InfuraController { }) } + updateLocalBlacklist () { + return fetch('https://api.infura.io/v1/blacklist') + .then(response => response.json()) + .then((parsedResponse) => { + this.store.updateState({ + blacklist: parsedResponse, + }) + return parsedResponse + }) + } + scheduleInfuraNetworkCheck () { if (this.conversionInterval) { clearInterval(this.conversionInterval) } this.conversionInterval = setInterval(() => { this.checkInfuraNetworkStatus() + this.updateLocalBlacklist() }, POLLING_INTERVAL) } } |