aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/migrations
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-01-12 17:17:05 +0800
committerkumavis <aaron@kumavis.me>2017-01-12 17:17:05 +0800
commitb33c51c0a6c7c8a7b0c0a9a6ca101f874f2db3d1 (patch)
tree7707ff23ae225ee2dd4eef17bfd67c688a817b43 /app/scripts/migrations
parent3bc996878b467e1fa5fd63656bd465377daa137d (diff)
downloadtangerine-wallet-browser-b33c51c0a6c7c8a7b0c0a9a6ca101f874f2db3d1.tar.gz
tangerine-wallet-browser-b33c51c0a6c7c8a7b0c0a9a6ca101f874f2db3d1.tar.zst
tangerine-wallet-browser-b33c51c0a6c7c8a7b0c0a9a6ca101f874f2db3d1.zip
migrations - introduce promise-based migrator
Diffstat (limited to 'app/scripts/migrations')
-rw-r--r--app/scripts/migrations/002.js15
-rw-r--r--app/scripts/migrations/003.js16
-rw-r--r--app/scripts/migrations/004.js17
3 files changed, 28 insertions, 20 deletions
diff --git a/app/scripts/migrations/002.js b/app/scripts/migrations/002.js
index 0b654f825..97f427d3a 100644
--- a/app/scripts/migrations/002.js
+++ b/app/scripts/migrations/002.js
@@ -1,13 +1,16 @@
+const version = 2
+
module.exports = {
- version: 2,
+ version,
- migrate: function (data) {
+ migrate: function (meta) {
+ meta.version = version
try {
- if (data.config.provider.type === 'etherscan') {
- data.config.provider.type = 'rpc'
- data.config.provider.rpcTarget = 'https://rpc.metamask.io/'
+ if (meta.data.config.provider.type === 'etherscan') {
+ meta.data.config.provider.type = 'rpc'
+ meta.data.config.provider.rpcTarget = 'https://rpc.metamask.io/'
}
} catch (e) {}
- return data
+ return Promise.resolve(meta)
},
}
diff --git a/app/scripts/migrations/003.js b/app/scripts/migrations/003.js
index 617c55c09..b25e26e01 100644
--- a/app/scripts/migrations/003.js
+++ b/app/scripts/migrations/003.js
@@ -1,15 +1,17 @@
-var oldTestRpc = 'https://rawtestrpc.metamask.io/'
-var newTestRpc = 'https://testrpc.metamask.io/'
+const version = 3
+const oldTestRpc = 'https://rawtestrpc.metamask.io/'
+const newTestRpc = 'https://testrpc.metamask.io/'
module.exports = {
- version: 3,
+ version,
- migrate: function (data) {
+ migrate: function (meta) {
+ meta.version = version
try {
- if (data.config.provider.rpcTarget === oldTestRpc) {
- data.config.provider.rpcTarget = newTestRpc
+ if (meta.data.config.provider.rpcTarget === oldTestRpc) {
+ meta.data.config.provider.rpcTarget = newTestRpc
}
} catch (e) {}
- return data
+ return Promise.resolve(meta)
},
}
diff --git a/app/scripts/migrations/004.js b/app/scripts/migrations/004.js
index 1329a1eed..e72eef2b7 100644
--- a/app/scripts/migrations/004.js
+++ b/app/scripts/migrations/004.js
@@ -1,22 +1,25 @@
+const version = 4
+
module.exports = {
- version: 4,
+ version,
- migrate: function (data) {
+ migrate: function (meta) {
+ meta.version = version
try {
- if (data.config.provider.type !== 'rpc') return data
- switch (data.config.provider.rpcTarget) {
+ if (meta.data.config.provider.type !== 'rpc') return Promise.resolve(meta)
+ switch (meta.data.config.provider.rpcTarget) {
case 'https://testrpc.metamask.io/':
- data.config.provider = {
+ meta.data.config.provider = {
type: 'testnet',
}
break
case 'https://rpc.metamask.io/':
- data.config.provider = {
+ meta.data.config.provider = {
type: 'mainnet',
}
break
}
} catch (_) {}
- return data
+ return Promise.resolve(meta)
},
}