diff options
author | kumavis <aaron@kumavis.me> | 2018-05-17 11:46:34 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-05-17 11:46:34 +0800 |
commit | 088d7930e0895ef1802823c5fc843dd1c19b9661 (patch) | |
tree | a2aed8b980fa44254121021d0529169369d77992 /app/scripts/controllers/transactions/nonce-tracker.js | |
parent | 708422432c634ffbd4c73388f980c43f766b3355 (diff) | |
download | tangerine-wallet-browser-088d7930e0895ef1802823c5fc843dd1c19b9661.tar.gz tangerine-wallet-browser-088d7930e0895ef1802823c5fc843dd1c19b9661.tar.zst tangerine-wallet-browser-088d7930e0895ef1802823c5fc843dd1c19b9661.zip |
network - create provider and block-tracker via json-rpc-engine
Diffstat (limited to 'app/scripts/controllers/transactions/nonce-tracker.js')
-rw-r--r-- | app/scripts/controllers/transactions/nonce-tracker.js | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/app/scripts/controllers/transactions/nonce-tracker.js b/app/scripts/controllers/transactions/nonce-tracker.js index f8cdc5523..490118c89 100644 --- a/app/scripts/controllers/transactions/nonce-tracker.js +++ b/app/scripts/controllers/transactions/nonce-tracker.js @@ -12,8 +12,9 @@ const Mutex = require('await-semaphore').Mutex */ class NonceTracker { - constructor ({ provider, getPendingTransactions, getConfirmedTransactions }) { + constructor ({ provider, blockTracker, getPendingTransactions, getConfirmedTransactions }) { this.provider = provider + this.blockTracker = blockTracker this.ethQuery = new EthQuery(provider) this.getPendingTransactions = getPendingTransactions this.getConfirmedTransactions = getConfirmedTransactions @@ -75,11 +76,10 @@ class NonceTracker { } async _getCurrentBlock () { - const blockTracker = this._getBlockTracker() - const currentBlock = blockTracker.getCurrentBlock() + const currentBlock = this.blockTracker.getCurrentBlock() if (currentBlock) return currentBlock return await new Promise((reject, resolve) => { - blockTracker.once('latest', resolve) + this.blockTracker.once('latest', resolve) }) } @@ -171,16 +171,6 @@ class NonceTracker { return { name: 'local', nonce: highest, details: { startPoint, highest } } } - - // this is a hotfix for the fact that the blockTracker will - // change when the network changes - - /** - @returns {Object} the current blockTracker - */ - _getBlockTracker () { - return this.provider._blockTracker - } } module.exports = NonceTracker |