diff options
author | Thomas Huang <thomas.b.huang@gmail.com> | 2017-05-16 09:06:48 +0800 |
---|---|---|
committer | Thomas Huang <thomas.b.huang@gmail.com> | 2017-05-16 09:06:48 +0800 |
commit | 62ee03888944e0795be81b01a8bb9021db40402b (patch) | |
tree | b606631da0fb29eb67054b6d33790c3abbc7711f | |
parent | 4c10e2021aa0cdc4f34a22368a37c76e0e1fea22 (diff) | |
parent | 85ca8b4539782fca143602afb4216dd3d2338b28 (diff) | |
download | tangerine-wallet-browser-62ee03888944e0795be81b01a8bb9021db40402b.tar tangerine-wallet-browser-62ee03888944e0795be81b01a8bb9021db40402b.tar.gz tangerine-wallet-browser-62ee03888944e0795be81b01a8bb9021db40402b.tar.bz2 tangerine-wallet-browser-62ee03888944e0795be81b01a8bb9021db40402b.tar.lz tangerine-wallet-browser-62ee03888944e0795be81b01a8bb9021db40402b.tar.xz tangerine-wallet-browser-62ee03888944e0795be81b01a8bb9021db40402b.tar.zst tangerine-wallet-browser-62ee03888944e0795be81b01a8bb9021db40402b.zip |
Merge branch 'master' into i1419-rinkebydefaultnetwork
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/scripts/background.js | 38 | ||||
-rw-r--r-- | package.json | 7 |
3 files changed, 20 insertions, 26 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 422639f70..3653e5018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Current Master - Trim currency list. +- Fix event filter bug introduced by newer versions of Geth. ## 3.6.4 2017-5-8 diff --git a/app/scripts/background.js b/app/scripts/background.js index 58f8e7556..e738a9712 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -1,6 +1,5 @@ const urlUtil = require('url') const endOfStream = require('end-of-stream') -const asyncQ = require('async-q') const pipe = require('pump') const LocalStorageStore = require('obs-store/lib/localStorage') const storeTransform = require('obs-store/lib/transform') @@ -30,34 +29,29 @@ let popupIsOpen = false const diskStore = new LocalStorageStore({ storageKey: STORAGE_KEY }) // initialization flow -asyncQ.waterfall([ - () => loadStateFromPersistence(), - (initState) => setupController(initState), -]) -.then(() => console.log('MetaMask initialization complete.')) -.catch((err) => { console.error(err) }) +initialize().catch(console.error) + +async function initialize() { + const initState = await loadStateFromPersistence() + await setupController(initState) + console.log('MetaMask initialization complete.') +} // // State and Persistence // -function loadStateFromPersistence () { +async function loadStateFromPersistence () { // migrations const migrator = new Migrator({ migrations }) - const initialState = migrator.generateInitialState(firstTimeState) - return asyncQ.waterfall([ - // read from disk - () => Promise.resolve(diskStore.getState() || initialState), - // migrate data - (versionedData) => migrator.migrateData(versionedData), - // write to disk - (versionedData) => { - diskStore.putState(versionedData) - return Promise.resolve(versionedData) - }, - // resolve to just data - (versionedData) => Promise.resolve(versionedData.data), - ]) + // read from disk + let versionedData = diskStore.getState() || migrator.generateInitialState(firstTimeState) + // migrate data + versionedData = await migrator.migrateData(versionedData) + // write to disk + diskStore.putState(versionedData) + // return just the data + return versionedData.data } function setupController (initState) { diff --git a/package.json b/package.json index f4bdbd998..9d7e216c2 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ { "presets": [ "es2015", - "stage-3" + "stage-0" ] } ], @@ -45,7 +45,6 @@ }, "dependencies": { "async": "^1.5.2", - "async-q": "^0.3.1", "babel-runtime": "^6.23.0", "bip39": "^2.2.0", "bluebird": "^3.5.0", @@ -121,14 +120,14 @@ "valid-url": "^1.0.9", "vreme": "^3.0.2", "web3": "0.18.2", - "web3-provider-engine": "^12.0.3", + "web3-provider-engine": "^12.0.6", "web3-stream-provider": "^2.0.6", "xtend": "^4.0.1" }, "devDependencies": { "babel-eslint": "^6.0.5", "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-stage-3": "^6.24.1", + "babel-preset-stage-0": "^6.24.1", "babel-register": "^6.7.2", "babelify": "^7.2.0", "beefy": "^2.1.5", |