aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-08-23 05:33:54 +0800
committerkumavis <aaron@kumavis.me>2017-08-23 05:33:54 +0800
commitfb2c6cc8acacfbdf134877beb68090a6fc127b94 (patch)
tree2ed7981e85a17a09f2a818eed06a79e1c40cdbb4 /app/scripts/lib
parentdc3e8d60ef22b268b4146e28e9dcb262aaa63304 (diff)
downloadtangerine-wallet-browser-fb2c6cc8acacfbdf134877beb68090a6fc127b94.tar
tangerine-wallet-browser-fb2c6cc8acacfbdf134877beb68090a6fc127b94.tar.gz
tangerine-wallet-browser-fb2c6cc8acacfbdf134877beb68090a6fc127b94.tar.bz2
tangerine-wallet-browser-fb2c6cc8acacfbdf134877beb68090a6fc127b94.tar.lz
tangerine-wallet-browser-fb2c6cc8acacfbdf134877beb68090a6fc127b94.tar.xz
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.js13
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 }