wipe only transactions for current account

feature/default_network_editable
Bruno Barbieri 7 years ago
parent 5f39844382
commit 03d17c75ae
  1. 4
      app/scripts/controllers/transactions.js
  2. 12
      app/scripts/lib/tx-state-manager.js
  3. 6
      app/scripts/metamask-controller.js

@ -152,8 +152,8 @@ module.exports = class TransactionController extends EventEmitter {
}
}
wipeTransactions(){
this.txStateManager.wipeTransactions();
wipeTransactions (address) {
this.txStateManager.wipeTransactions(address)
}
// Adds a tx to the txlist

@ -221,10 +221,16 @@ module.exports = class TransactionStateManger extends EventEmitter {
this._setTxStatus(txId, 'failed')
}
wipeTransactions () {
this._saveTxList([]);
}
wipeTransactions (address) {
// network only tx
const txs = this.getTxList()
// Filter out the ones from the current account
const otherAccountTxs = txs.filter((txMeta) => txMeta.from !== address)
// Update state
this._saveTxList(otherAccountTxs)
}
//
// PRIVATE METHODS
//

@ -605,10 +605,10 @@ module.exports = class MetamaskController extends EventEmitter {
cb(null, this.preferencesController.getSelectedAddress())
}
resetAccount (cb) {
this.txController.wipeTransactions();
cb(null, this.preferencesController.getSelectedAddress())
const selectedAddress = this.preferencesController.getSelectedAddress()
this.txController.wipeTransactions(selectedAddress)
cb(null, selectedAddress)
}

Loading…
Cancel
Save