aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-09-09 05:24:40 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-09-09 05:24:40 +0800
commit9b9df417246dbf332f0a7d8afadb664544ceb484 (patch)
tree4459d9272defce22c54e301d518bc1d4efab7f2f /app
parent50075c6df5af4441db78b47f3bc2036a65228224 (diff)
downloadtangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.gz
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.bz2
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.lz
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.xz
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.tar.zst
tangerine-wallet-browser-9b9df417246dbf332f0a7d8afadb664544ceb484.zip
more tests and craete a getPendingTransactions function
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/transactions.js15
-rw-r--r--app/scripts/lib/tx-state-manager.js6
2 files changed, 10 insertions, 11 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index d71be37d8..636424c64 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -49,12 +49,7 @@ module.exports = class TransactionController extends EventEmitter {
this.nonceTracker = new NonceTracker({
provider: this.provider,
- getPendingTransactions: (address) => {
- return this.txStateManager.getFilteredTxList({
- from: address,
- status: 'submitted',
- })
- },
+ getPendingTransactions: this.txStateManager.getPendingTransactions.bind(this.txStateManager),
getConfirmedTransactions: (address) => {
return this.txStateManager.getFilteredTxList({
from: address,
@@ -73,9 +68,7 @@ module.exports = class TransactionController extends EventEmitter {
return account.balance
},
publishTransaction: this.query.sendRawTransaction,
- getPendingTransactions: () => {
- return this.txStateManager.getFilteredTxList({ status: 'submitted' })
- },
+ getPendingTransactions: this.txStateManager.getPendingTransactions.bind(this.txStateManager),
giveUpOnTransaction: (txId) => {
const msg = `Gave up submitting after 3500 blocks un-mined.`
this.setTxStatusFailed(txId, msg)
@@ -122,8 +115,8 @@ module.exports = class TransactionController extends EventEmitter {
return Object.keys(this.txStateManager.getUnapprovedTxList()).length
}
- getPendingTxCount () {
- return this.txStateManager.getTxsByMetaData('status', 'signed').length
+ getPendingTxCount (account) {
+ return this.txStateManager.getPendingTransactions(account).length
}
getChainId () {
diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js
index eb2a187db..05fbba612 100644
--- a/app/scripts/lib/tx-state-manager.js
+++ b/app/scripts/lib/tx-state-manager.js
@@ -33,6 +33,12 @@ module.exports = class TransactionStateManger extends ObservableStore {
}, {})
}
+ getPendingTransactions (address) {
+ const opts = { status: 'submitted' }
+ if (address) opts.from = address
+ return this.txStateManager.getFilteredTxList(opts)
+ }
+
addTx (txMeta) {
this.once(`${txMeta.id}:signed`, function (txId) {
this.removeAllListeners(`${txMeta.id}:rejected`)