diff options
author | Bruno Barbieri <brunobar79@gmail.com> | 2018-01-31 16:33:15 +0800 |
---|---|---|
committer | Bruno Barbieri <brunobar79@gmail.com> | 2018-01-31 16:33:15 +0800 |
commit | e6fda855a556a6aa0325556b074612ff76925e5d (patch) | |
tree | 8f90ac4834fbd2ab5c6e9db591f4e2fa9676297c | |
parent | 1a32690a12e053a99396b2f2da1dc08eb03517f2 (diff) | |
download | tangerine-wallet-browser-e6fda855a556a6aa0325556b074612ff76925e5d.tar tangerine-wallet-browser-e6fda855a556a6aa0325556b074612ff76925e5d.tar.gz tangerine-wallet-browser-e6fda855a556a6aa0325556b074612ff76925e5d.tar.bz2 tangerine-wallet-browser-e6fda855a556a6aa0325556b074612ff76925e5d.tar.lz tangerine-wallet-browser-e6fda855a556a6aa0325556b074612ff76925e5d.tar.xz tangerine-wallet-browser-e6fda855a556a6aa0325556b074612ff76925e5d.tar.zst tangerine-wallet-browser-e6fda855a556a6aa0325556b074612ff76925e5d.zip |
added reset account feature
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/scripts/controllers/transactions.js | 4 | ||||
-rw-r--r-- | app/scripts/lib/tx-state-manager.js | 4 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 8 | ||||
-rw-r--r-- | ui/app/actions.js | 16 | ||||
-rw-r--r-- | ui/app/config.js | 19 |
6 files changed, 52 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index bab6d4062..a415b7359 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Current Master +- Add a "reset account" feature to Settings - Add warning for importing some kinds of files. ## 3.13.8 2018-1-29 diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 9c3618e60..7ca04caf1 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -152,6 +152,10 @@ module.exports = class TransactionController extends EventEmitter { } } + wipeTransactions(){ + this.txStateManager.wipeTransactions(); + } + // 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..61ce2024a 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -221,6 +221,10 @@ module.exports = class TransactionStateManger extends EventEmitter { this._setTxStatus(txId, 'failed') } + wipeTransactions(){ + this._saveTxList([]); + } + // // PRIVATE METHODS // diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 672ec7403..79e3de4cc 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -348,6 +348,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 @@ -604,6 +605,13 @@ module.exports = class MetamaskController extends EventEmitter { cb(null, this.preferencesController.getSelectedAddress()) } + + resetAccount(cb){ + this.txController.wipeTransactions(); + cb(null, this.preferencesController.getSelectedAddress()) + } + + importAccountWithStrategy (strategy, args, cb) { accountImporter.importAccount(strategy, args) .then((privateKey) => { diff --git a/ui/app/actions.js b/ui/app/actions.js index 52ea899aa..90acdc821 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -47,12 +47,14 @@ var actions = { addNewAccount, NEW_ACCOUNT_SCREEN: 'NEW_ACCOUNT_SCREEN', navigateToNewAccountScreen, + resetAccount, showNewVaultSeed: showNewVaultSeed, showInfoPage: showInfoPage, // seed recovery actions REVEAL_SEED_CONFIRMATION: 'REVEAL_SEED_CONFIRMATION', revealSeedConfirmation: revealSeedConfirmation, requestRevealSeed: requestRevealSeed, + // unlock screen UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS', UNLOCK_FAILED: 'UNLOCK_FAILED', @@ -308,6 +310,20 @@ function requestRevealSeed (password) { } } +function resetAccount () { + return (dispatch) => { + background.resetAccount((err, account) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + dispatch(actions.displayWarning(err.message)) + } + + log.info('Transaction history reset for ' + account) + dispatch(actions.showAccountsPage()) + }) + } +} + function addNewKeyring (type, opts) { return (dispatch) => { dispatch(actions.showLoadingIndication()) diff --git a/ui/app/config.js b/ui/app/config.js index 9cb2a0aad..9b9cac4bf 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -55,6 +55,7 @@ ConfigScreen.prototype.render = function () { h('.flex-space-around', { style: { padding: '20px', + overflow: 'auto', }, }, [ @@ -142,6 +143,24 @@ ConfigScreen.prototype.render = function () { }, 'Reveal Seed Words'), ]), + h('hr.horizontal-line'), + + h('div', { + style: { + marginTop: '20px', + }, + }, [ + h('button', { + style: { + alignSelf: 'center', + }, + onClick (event) { + event.preventDefault() + state.dispatch(actions.resetAccount()) + }, + }, 'Reset Account'), + ]), + ]), ]), ]) |