diff options
author | Dan J Miller <danjm.com@gmail.com> | 2018-02-08 23:50:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-08 23:50:04 +0800 |
commit | f39222c9afd9dcab4c6234940eb9a9cb06dbc6f0 (patch) | |
tree | 55840c5f6da9512b613aa289f8ba555fe8f7c290 /app | |
parent | e9c2c0eec19514468fd53087f974709d5df9c35b (diff) | |
parent | b0db68a281168a94316823387b1670839990dd63 (diff) | |
download | tangerine-wallet-browser-f39222c9afd9dcab4c6234940eb9a9cb06dbc6f0.tar tangerine-wallet-browser-f39222c9afd9dcab4c6234940eb9a9cb06dbc6f0.tar.gz tangerine-wallet-browser-f39222c9afd9dcab4c6234940eb9a9cb06dbc6f0.tar.bz2 tangerine-wallet-browser-f39222c9afd9dcab4c6234940eb9a9cb06dbc6f0.tar.lz tangerine-wallet-browser-f39222c9afd9dcab4c6234940eb9a9cb06dbc6f0.tar.xz tangerine-wallet-browser-f39222c9afd9dcab4c6234940eb9a9cb06dbc6f0.tar.zst tangerine-wallet-browser-f39222c9afd9dcab4c6234940eb9a9cb06dbc6f0.zip |
Merge pull request #3206 from danjm/merge-uat-to-uatnext-feb072019
[NewUI] Merge uat to uatnext feb072019
Diffstat (limited to 'app')
-rw-r--r-- | app/manifest.json | 2 | ||||
-rw-r--r-- | app/scripts/controllers/transactions.js | 4 | ||||
-rw-r--r-- | app/scripts/lib/tx-state-manager.js | 11 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 21 | ||||
-rw-r--r-- | app/scripts/migrations/021.js | 34 | ||||
-rw-r--r-- | app/scripts/migrations/index.js | 1 |
6 files changed, 63 insertions, 10 deletions
diff --git a/app/manifest.json b/app/manifest.json index d795a225a..a0bb5acf6 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "MetaMask", "short_name": "Metamask", - "version": "3.13.7", + "version": "3.14.1", "manifest_version": 2, "author": "https://metamask.io", "description": "Ethereum Browser Extension", diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 91ec42b69..ef5578d5a 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -152,6 +152,10 @@ module.exports = class TransactionController extends EventEmitter { } } + wipeTransactions (address) { + this.txStateManager.wipeTransactions(address) + } + // Adds a tx to the txlist addTx (txMeta) { this.txStateManager.addTx(txMeta) diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index a8ef39891..051efd247 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -221,6 +221,17 @@ module.exports = class TransactionStateManger extends EventEmitter { this._setTxStatus(txId, 'failed') } + wipeTransactions (address) { + // network only tx + const txs = this.getFullTxList() + const network = this.getNetwork() + + // Filter out the ones from the current account and network + const otherAccountTxs = txs.filter((txMeta) => !(txMeta.txParams.from === address && txMeta.metamaskNetworkId === network)) + + // Update state + this._saveTxList(otherAccountTxs) + } // // PRIVATE METHODS // diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index cb671ec3c..15a30458a 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -43,6 +43,8 @@ module.exports = class MetamaskController extends EventEmitter { constructor (opts) { super() + this.defaultMaxListeners = 20 + this.sendUpdate = debounce(this.privateSendUpdate.bind(this), 200) this.opts = opts @@ -84,9 +86,7 @@ module.exports = class MetamaskController extends EventEmitter { }) this.infuraController.scheduleInfuraNetworkCheck() - this.blacklistController = new BlacklistController({ - initState: initState.BlacklistController, - }) + this.blacklistController = new BlacklistController() this.blacklistController.scheduleUpdates() // rpc provider @@ -198,12 +198,7 @@ module.exports = class MetamaskController extends EventEmitter { this.networkController.store.subscribe((state) => { this.store.updateState({ NetworkController: state }) }) - this.blacklistController.store.subscribe((state) => { - this.store.updateState({ BlacklistController: state }) - }) - this.recentBlocksController.store.subscribe((state) => { - this.store.updateState({ RecentBlocks: state }) - }) + this.infuraController.store.subscribe((state) => { this.store.updateState({ InfuraController: state }) }) @@ -350,6 +345,7 @@ module.exports = class MetamaskController extends EventEmitter { addNewAccount: nodeify(this.addNewAccount, this), placeSeedWords: this.placeSeedWords.bind(this), clearSeedWordCache: this.clearSeedWordCache.bind(this), + resetAccount: this.resetAccount.bind(this), importAccountWithStrategy: this.importAccountWithStrategy.bind(this), // vault management @@ -610,6 +606,13 @@ module.exports = class MetamaskController extends EventEmitter { cb(null, this.preferencesController.getSelectedAddress()) } + resetAccount (cb) { + const selectedAddress = this.preferencesController.getSelectedAddress() + this.txController.wipeTransactions(selectedAddress) + cb(null, selectedAddress) + } + + importAccountWithStrategy (strategy, args, cb) { accountImporter.importAccount(strategy, args) .then((privateKey) => { diff --git a/app/scripts/migrations/021.js b/app/scripts/migrations/021.js new file mode 100644 index 000000000..d84e77b50 --- /dev/null +++ b/app/scripts/migrations/021.js @@ -0,0 +1,34 @@ +const version = 21 + +/* + +This migration removes the BlackListController from disk state + +*/ + +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 + delete newState.BlacklistController + delete newState.RecentBlocks + return newState +} + diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index 9d0631042..a0cf5f4d4 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -31,4 +31,5 @@ module.exports = [ require('./018'), require('./019'), require('./020'), + require('./021'), ] |