diff options
author | kumavis <aaron@kumavis.me> | 2017-08-23 05:33:54 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2017-08-23 05:33:54 +0800 |
commit | fb2c6cc8acacfbdf134877beb68090a6fc127b94 (patch) | |
tree | 2ed7981e85a17a09f2a818eed06a79e1c40cdbb4 /app/scripts/lib | |
parent | dc3e8d60ef22b268b4146e28e9dcb262aaa63304 (diff) | |
download | tangerine-wallet-browser-fb2c6cc8acacfbdf134877beb68090a6fc127b94.tar.gz tangerine-wallet-browser-fb2c6cc8acacfbdf134877beb68090a6fc127b94.tar.zst tangerine-wallet-browser-fb2c6cc8acacfbdf134877beb68090a6fc127b94.zip |
nonce-tracker - use ethjs-query
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/nonce-tracker.js | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js index 13fdf27eb..427c09508 100644 --- a/app/scripts/lib/nonce-tracker.js +++ b/app/scripts/lib/nonce-tracker.js @@ -1,4 +1,4 @@ -const EthQuery = require('eth-query') +const EthQuery = require('ethjs-query') const assert = require('assert') const Mutex = require('await-semaphore').Mutex @@ -50,15 +50,6 @@ class NonceTracker { }) } - async _getTxCount (address, currentBlock) { - const blockNumber = currentBlock.number - return new Promise((resolve, reject) => { - this.ethQuery.getTransactionCount(address, blockNumber, (err, result) => { - err ? reject(err) : resolve(result) - }) - }) - } - async _globalMutexFree () { const globalMutex = this._lookupMutex('global') const release = await globalMutex.acquire() @@ -86,7 +77,7 @@ class NonceTracker { // and pending count are from the same block const currentBlock = await this._getCurrentBlock() const blockNumber = currentBlock.blockNumber - const baseCountHex = await this._getTxCount(address, currentBlock) + const baseCountHex = await this.ethQuery.getTransactionCount(address, blockNumber) const baseCount = parseInt(baseCountHex, 16) assert(Number.isInteger(baseCount), `nonce-tracker - baseCount is not an integer - got: (${typeof baseCount}) "${baseCount}"`) const nonceDetails = { blockNumber, baseCountHex, baseCount } |