aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/migrations
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-02-06 08:27:45 +0800
committerGitHub <noreply@github.com>2017-02-06 08:27:45 +0800
commit15ae20033c22a3958ad7ff6ac74f74b1c0d2dbf5 (patch)
tree0008a579764bc5fad04568e2b3eea2dc90a7629d /app/scripts/migrations
parent24ff38e97386eafe0cd9c8e4e77dbed856b2464e (diff)
parentc0637f8d6ad969f16b7e8b582f462a7f9c480537 (diff)
downloadtangerine-wallet-browser-15ae20033c22a3958ad7ff6ac74f74b1c0d2dbf5.tar.gz
tangerine-wallet-browser-15ae20033c22a3958ad7ff6ac74f74b1c0d2dbf5.tar.zst
tangerine-wallet-browser-15ae20033c22a3958ad7ff6ac74f74b1c0d2dbf5.zip
Merge pull request #1088 from MetaMask/CreateShapeshiftController
Create shapeshift controller
Diffstat (limited to 'app/scripts/migrations')
-rw-r--r--app/scripts/migrations/010.js36
-rw-r--r--app/scripts/migrations/index.js3
2 files changed, 38 insertions, 1 deletions
diff --git a/app/scripts/migrations/010.js b/app/scripts/migrations/010.js
new file mode 100644
index 000000000..d41c63fcd
--- /dev/null
+++ b/app/scripts/migrations/010.js
@@ -0,0 +1,36 @@
+const version = 10
+
+/*
+
+This migration breaks out the CurrencyController substate
+
+*/
+
+const merge = require('deep-extend')
+
+module.exports = {
+ version,
+
+ migrate: function (versionedData) {
+ 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 = merge({}, state, {
+ ShapeShiftController: {
+ shapeShiftTxList: state.shapeShiftTxList || [],
+ },
+ })
+ delete newState.shapeShiftTxList
+
+ return newState
+}
diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js
index 22bf008ba..2db8646b0 100644
--- a/app/scripts/migrations/index.js
+++ b/app/scripts/migrations/index.js
@@ -1,5 +1,5 @@
/* The migrator has two methods the user should be concerned with:
- *
+ *
* getData(), which returns the app-consumable data object
* saveData(), which persists the app-consumable data object.
*/
@@ -20,4 +20,5 @@ module.exports = [
require('./007'),
require('./008'),
require('./009'),
+ require('./010'),
]