From e6fda855a556a6aa0325556b074612ff76925e5d Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 03:33:15 -0500 Subject: added reset account feature --- app/scripts/lib/tx-state-manager.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/scripts/lib/tx-state-manager.js') 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 // -- cgit From 5f39844382fb3106b883efb81f55a6e909f28b01 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 03:36:04 -0500 Subject: clean up --- app/scripts/lib/tx-state-manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/scripts/lib/tx-state-manager.js') diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index 61ce2024a..6b4a196f2 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -221,10 +221,10 @@ module.exports = class TransactionStateManger extends EventEmitter { this._setTxStatus(txId, 'failed') } - wipeTransactions(){ - this._saveTxList([]); + wipeTransactions () { + this._saveTxList([]); } - + // // PRIVATE METHODS // -- cgit From 03d17c75ae47806e9afa562cf664819b83a2b926 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 04:25:32 -0500 Subject: wipe only transactions for current account --- app/scripts/lib/tx-state-manager.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'app/scripts/lib/tx-state-manager.js') diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index 6b4a196f2..13e645a28 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -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 // -- cgit From 7dc1b09f94003fdac4ed9ea36ecf1c1a14d972a1 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 04:40:32 -0500 Subject: use txMeta.txParams --- app/scripts/lib/tx-state-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib/tx-state-manager.js') diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index 13e645a28..f488130a2 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -226,7 +226,7 @@ module.exports = class TransactionStateManger extends EventEmitter { const txs = this.getTxList() // Filter out the ones from the current account - const otherAccountTxs = txs.filter((txMeta) => txMeta.from !== address) + const otherAccountTxs = txs.filter((txMeta) => txMeta.txParams.from !== address) // Update state this._saveTxList(otherAccountTxs) -- cgit From c1b7cfe91d803c0085afe59d058f2422a0e8dc30 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 13:29:02 -0500 Subject: preserve other networks TXs --- app/scripts/lib/tx-state-manager.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/scripts/lib/tx-state-manager.js') diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index f488130a2..051efd247 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -223,10 +223,11 @@ module.exports = class TransactionStateManger extends EventEmitter { wipeTransactions (address) { // network only tx - const txs = this.getTxList() + const txs = this.getFullTxList() + const network = this.getNetwork() - // Filter out the ones from the current account - const otherAccountTxs = txs.filter((txMeta) => txMeta.txParams.from !== address) + // 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) -- cgit