diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/scripts/lib/migrations.js | 11 | ||||
-rw-r--r-- | app/scripts/migrations/004.js | 22 | ||||
-rw-r--r-- | test/unit/migrations-test.js | 5 |
4 files changed, 31 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8062b38f5..267c13da7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Current Master - Fixed bug where send view would not load correctly the first time it was visited per account. +- Migrated all users to new scalable backend. ## 1.8.1 2016-05-10 diff --git a/app/scripts/lib/migrations.js b/app/scripts/lib/migrations.js index 0b8e6265c..f026cbe53 100644 --- a/app/scripts/lib/migrations.js +++ b/app/scripts/lib/migrations.js @@ -1,10 +1,5 @@ -var path = require('path') -var fs = require('fs') - -var migration2 = require('../migrations/002') -var migration3 = require('../migrations/003') - module.exports = [ - migration2, - migration3, + require('../migrations/002'), + require('../migrations/003'), + require('../migrations/004'), ] diff --git a/app/scripts/migrations/004.js b/app/scripts/migrations/004.js new file mode 100644 index 000000000..2e3164baf --- /dev/null +++ b/app/scripts/migrations/004.js @@ -0,0 +1,22 @@ +module.exports = { + version: 4, + + migrate: function(data) { + try { + if (data.config.provider.type !== 'rpc') return data + switch (data.config.provider.rpcTarget) { + case 'https://testrpc.metamask.io/': + data.config.provider = { + type: 'testnet' + } + break + case 'https://rpc.metamask.io/': + data.config.provider = { + type: 'mainnet' + } + break + } + } catch (_) {} + return data + } +} diff --git a/test/unit/migrations-test.js b/test/unit/migrations-test.js index 3b347530a..9ea8d5c5a 100644 --- a/test/unit/migrations-test.js +++ b/test/unit/migrations-test.js @@ -5,6 +5,7 @@ var wallet1 = require(path.join('..', 'lib', 'migrations', '001.json')) var migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002')) var migration3 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '003')) +var migration4 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '004')) describe('wallet1 is migrated successfully', function() { @@ -23,6 +24,10 @@ describe('wallet1 is migrated successfully', function() { var secondResult = migration3.migrate(firstResult) assert.equal(secondResult.config.provider.rpcTarget, newTestRpc) + var thirdResult = migration4.migrate(secondResult) + assert.equal(secondResult.config.provider.rpcTarget, null) + assert.equal(secondResult.config.provider.type, 'testnet') + done() }) }) |