aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/migrations
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-06-13 04:27:04 +0800
committerGitHub <noreply@github.com>2017-06-13 04:27:04 +0800
commit27220b7bcd5ea1ebdae3bc1b494d28d9c828918c (patch)
treec9385fba3d742ca9cbfb9f3b4c6c9ef29c4f4a1b /app/scripts/migrations
parent57d1a1f1860e50837104a10b7b9f86d398c795ec (diff)
parent8af41f1b0539e70cf4c6e1f4a9f4b10ad13656fc (diff)
downloadtangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.gz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.bz2
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.lz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.xz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.zst
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.zip
Merge branch 'master' into i#1203MainNetSwitch
Diffstat (limited to 'app/scripts/migrations')
-rw-r--r--app/scripts/migrations/002.js2
-rw-r--r--app/scripts/migrations/003.js2
-rw-r--r--app/scripts/migrations/004.js2
-rw-r--r--app/scripts/migrations/005.js2
-rw-r--r--app/scripts/migrations/006.js2
-rw-r--r--app/scripts/migrations/007.js2
-rw-r--r--app/scripts/migrations/008.js2
-rw-r--r--app/scripts/migrations/009.js2
-rw-r--r--app/scripts/migrations/010.js2
-rw-r--r--app/scripts/migrations/011.js2
-rw-r--r--app/scripts/migrations/012.js36
-rw-r--r--app/scripts/migrations/013.js34
-rw-r--r--app/scripts/migrations/014.js34
-rw-r--r--app/scripts/migrations/_multi-keyring.js11
-rw-r--r--app/scripts/migrations/index.js3
15 files changed, 122 insertions, 16 deletions
diff --git a/app/scripts/migrations/002.js b/app/scripts/migrations/002.js
index 36a870342..b1d88f2ef 100644
--- a/app/scripts/migrations/002.js
+++ b/app/scripts/migrations/002.js
@@ -7,7 +7,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
if (versionedData.data.config.provider.type === 'etherscan') {
diff --git a/app/scripts/migrations/003.js b/app/scripts/migrations/003.js
index 1893576ad..140f81d40 100644
--- a/app/scripts/migrations/003.js
+++ b/app/scripts/migrations/003.js
@@ -8,7 +8,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
if (versionedData.data.config.provider.rpcTarget === oldTestRpc) {
diff --git a/app/scripts/migrations/004.js b/app/scripts/migrations/004.js
index 405d932f8..cd558300c 100644
--- a/app/scripts/migrations/004.js
+++ b/app/scripts/migrations/004.js
@@ -6,7 +6,7 @@ module.exports = {
version,
migrate: function (versionedData) {
- let safeVersionedData = clone(versionedData)
+ const safeVersionedData = clone(versionedData)
safeVersionedData.meta.version = version
try {
if (safeVersionedData.data.config.provider.type !== 'rpc') return Promise.resolve(safeVersionedData)
diff --git a/app/scripts/migrations/005.js b/app/scripts/migrations/005.js
index e4b84f460..f7b68dfe4 100644
--- a/app/scripts/migrations/005.js
+++ b/app/scripts/migrations/005.js
@@ -14,7 +14,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/006.js b/app/scripts/migrations/006.js
index 94d1b6ecd..51ea6e3e7 100644
--- a/app/scripts/migrations/006.js
+++ b/app/scripts/migrations/006.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/007.js b/app/scripts/migrations/007.js
index 236e35224..d9887b9c8 100644
--- a/app/scripts/migrations/007.js
+++ b/app/scripts/migrations/007.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/008.js b/app/scripts/migrations/008.js
index cd5e95d22..da7cb2e60 100644
--- a/app/scripts/migrations/008.js
+++ b/app/scripts/migrations/008.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/009.js b/app/scripts/migrations/009.js
index 4612fefdc..f47db55ac 100644
--- a/app/scripts/migrations/009.js
+++ b/app/scripts/migrations/009.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/010.js b/app/scripts/migrations/010.js
index c0cc56ae4..e4b9ac07e 100644
--- a/app/scripts/migrations/010.js
+++ b/app/scripts/migrations/010.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/011.js b/app/scripts/migrations/011.js
index 0d5d6d307..782ec809d 100644
--- a/app/scripts/migrations/011.js
+++ b/app/scripts/migrations/011.js
@@ -12,7 +12,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/012.js b/app/scripts/migrations/012.js
new file mode 100644
index 000000000..f69ccbb02
--- /dev/null
+++ b/app/scripts/migrations/012.js
@@ -0,0 +1,36 @@
+const version = 12
+
+/*
+
+This migration modifies our notices to delete their body after being read.
+
+*/
+
+const clone = require('clone')
+
+module.exports = {
+ version,
+
+ migrate: function (originalVersionedData) {
+ const versionedData = clone(originalVersionedData)
+ versionedData.meta.version = version
+ try {
+ const state = versionedData.data
+ const newState = transformState(state)
+ versionedData.data = newState
+ } catch (err) {
+ console.warn(`MetaMask Migration #${version}` + err.stack)
+ }
+ return Promise.resolve(versionedData)
+ },
+}
+
+function transformState (state) {
+ const newState = state
+ newState.NoticeController.noticesList.forEach((notice) => {
+ if (notice.read) {
+ notice.body = ''
+ }
+ })
+ return newState
+}
diff --git a/app/scripts/migrations/013.js b/app/scripts/migrations/013.js
new file mode 100644
index 000000000..8f11e510e
--- /dev/null
+++ b/app/scripts/migrations/013.js
@@ -0,0 +1,34 @@
+const version = 13
+
+/*
+
+This migration modifies the network config from ambiguous 'testnet' to explicit 'ropsten'
+
+*/
+
+const clone = require('clone')
+
+module.exports = {
+ version,
+
+ migrate: function (originalVersionedData) {
+ const versionedData = clone(originalVersionedData)
+ versionedData.meta.version = version
+ try {
+ const state = versionedData.data
+ const newState = transformState(state)
+ versionedData.data = newState
+ } catch (err) {
+ console.warn(`MetaMask Migration #${version}` + err.stack)
+ }
+ return Promise.resolve(versionedData)
+ },
+}
+
+function transformState (state) {
+ const newState = state
+ if (newState.config.provider.type === 'testnet') {
+ newState.config.provider.type = 'ropsten'
+ }
+ return newState
+}
diff --git a/app/scripts/migrations/014.js b/app/scripts/migrations/014.js
new file mode 100644
index 000000000..0fe92125b
--- /dev/null
+++ b/app/scripts/migrations/014.js
@@ -0,0 +1,34 @@
+const version = 14
+
+/*
+
+This migration removes provider from config and moves it too NetworkController.
+
+*/
+
+const clone = require('clone')
+
+module.exports = {
+ version,
+
+ migrate: function (originalVersionedData) {
+ const versionedData = clone(originalVersionedData)
+ versionedData.meta.version = version
+ try {
+ const state = versionedData.data
+ const newState = transformState(state)
+ versionedData.data = newState
+ } catch (err) {
+ console.warn(`MetaMask Migration #${version}` + err.stack)
+ }
+ return Promise.resolve(versionedData)
+ },
+}
+
+function transformState (state) {
+ const newState = state
+ newState.NetworkController = {}
+ newState.NetworkController.provider = newState.config.provider
+ delete newState.config.provider
+ return newState
+}
diff --git a/app/scripts/migrations/_multi-keyring.js b/app/scripts/migrations/_multi-keyring.js
index 04c966d4d..253aa3d9d 100644
--- a/app/scripts/migrations/_multi-keyring.js
+++ b/app/scripts/migrations/_multi-keyring.js
@@ -15,15 +15,15 @@ const KeyringController = require('../../app/scripts/lib/keyring-controller')
const password = 'obviously not correct'
module.exports = {
- version,
+ version,
migrate: function (versionedData) {
versionedData.meta.version = version
- let store = new ObservableStore(versionedData.data)
- let configManager = new ConfigManager({ store })
- let idStoreMigrator = new IdentityStoreMigrator({ configManager })
- let keyringController = new KeyringController({
+ const store = new ObservableStore(versionedData.data)
+ const configManager = new ConfigManager({ store })
+ const idStoreMigrator = new IdentityStoreMigrator({ configManager })
+ const keyringController = new KeyringController({
configManager: configManager,
})
@@ -46,6 +46,5 @@ module.exports = {
return Promise.resolve(versionedData)
})
})
-
},
}
diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js
index a3dd48c17..fb1ad7863 100644
--- a/app/scripts/migrations/index.js
+++ b/app/scripts/migrations/index.js
@@ -22,4 +22,7 @@ module.exports = [
require('./009'),
require('./010'),
require('./011'),
+ require('./012'),
+ require('./013'),
+ require('./014'),
]