1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Merge branch 'master' into i1419-rinkebydefaultnetwork

This commit is contained in:
Thomas Huang 2017-05-15 18:06:48 -07:00
commit 62ee038889
3 changed files with 20 additions and 26 deletions

View File

@ -3,6 +3,7 @@
## Current Master ## Current Master
- Trim currency list. - Trim currency list.
- Fix event filter bug introduced by newer versions of Geth.
## 3.6.4 2017-5-8 ## 3.6.4 2017-5-8

View File

@ -1,6 +1,5 @@
const urlUtil = require('url') const urlUtil = require('url')
const endOfStream = require('end-of-stream') const endOfStream = require('end-of-stream')
const asyncQ = require('async-q')
const pipe = require('pump') const pipe = require('pump')
const LocalStorageStore = require('obs-store/lib/localStorage') const LocalStorageStore = require('obs-store/lib/localStorage')
const storeTransform = require('obs-store/lib/transform') const storeTransform = require('obs-store/lib/transform')
@ -30,34 +29,29 @@ let popupIsOpen = false
const diskStore = new LocalStorageStore({ storageKey: STORAGE_KEY }) const diskStore = new LocalStorageStore({ storageKey: STORAGE_KEY })
// initialization flow // initialization flow
asyncQ.waterfall([ initialize().catch(console.error)
() => loadStateFromPersistence(),
(initState) => setupController(initState), async function initialize() {
]) const initState = await loadStateFromPersistence()
.then(() => console.log('MetaMask initialization complete.')) await setupController(initState)
.catch((err) => { console.error(err) }) console.log('MetaMask initialization complete.')
}
// //
// State and Persistence // State and Persistence
// //
function loadStateFromPersistence () { async function loadStateFromPersistence () {
// migrations // migrations
const migrator = new Migrator({ migrations }) const migrator = new Migrator({ migrations })
const initialState = migrator.generateInitialState(firstTimeState) // read from disk
return asyncQ.waterfall([ let versionedData = diskStore.getState() || migrator.generateInitialState(firstTimeState)
// read from disk // migrate data
() => Promise.resolve(diskStore.getState() || initialState), versionedData = await migrator.migrateData(versionedData)
// migrate data // write to disk
(versionedData) => migrator.migrateData(versionedData), diskStore.putState(versionedData)
// write to disk // return just the data
(versionedData) => { return versionedData.data
diskStore.putState(versionedData)
return Promise.resolve(versionedData)
},
// resolve to just data
(versionedData) => Promise.resolve(versionedData.data),
])
} }
function setupController (initState) { function setupController (initState) {

View File

@ -35,7 +35,7 @@
{ {
"presets": [ "presets": [
"es2015", "es2015",
"stage-3" "stage-0"
] ]
} }
], ],
@ -45,7 +45,6 @@
}, },
"dependencies": { "dependencies": {
"async": "^1.5.2", "async": "^1.5.2",
"async-q": "^0.3.1",
"babel-runtime": "^6.23.0", "babel-runtime": "^6.23.0",
"bip39": "^2.2.0", "bip39": "^2.2.0",
"bluebird": "^3.5.0", "bluebird": "^3.5.0",
@ -121,14 +120,14 @@
"valid-url": "^1.0.9", "valid-url": "^1.0.9",
"vreme": "^3.0.2", "vreme": "^3.0.2",
"web3": "0.18.2", "web3": "0.18.2",
"web3-provider-engine": "^12.0.3", "web3-provider-engine": "^12.0.6",
"web3-stream-provider": "^2.0.6", "web3-stream-provider": "^2.0.6",
"xtend": "^4.0.1" "xtend": "^4.0.1"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "^6.0.5", "babel-eslint": "^6.0.5",
"babel-plugin-transform-runtime": "^6.23.0", "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", "babel-register": "^6.7.2",
"babelify": "^7.2.0", "babelify": "^7.2.0",
"beefy": "^2.1.5", "beefy": "^2.1.5",