mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 09:23:21 +01:00
added reset account feature
This commit is contained in:
parent
1a32690a12
commit
e6fda855a5
@ -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
|
||||
|
@ -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)
|
||||
|
@ -221,6 +221,10 @@ module.exports = class TransactionStateManger extends EventEmitter {
|
||||
this._setTxStatus(txId, 'failed')
|
||||
}
|
||||
|
||||
wipeTransactions(){
|
||||
this._saveTxList([]);
|
||||
}
|
||||
|
||||
//
|
||||
// PRIVATE METHODS
|
||||
//
|
||||
|
@ -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) => {
|
||||
|
@ -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())
|
||||
|
@ -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'),
|
||||
]),
|
||||
|
||||
]),
|
||||
]),
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user