diff options
author | Jacob Evans <jacob@dekz.net> | 2018-02-07 03:28:40 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-02-07 03:34:22 +0800 |
commit | df8de7ff517ba1386671c658d402fa7436ff4f74 (patch) | |
tree | 99d9b9ef315d876dc1ae3e7bddc530767ea3c6f4 /packages/subproviders/src | |
parent | 67d7540907b6467c4cdc6a23815ad152517b3328 (diff) | |
download | dexon-sol-tools-df8de7ff517ba1386671c658d402fa7436ff4f74.tar.gz dexon-sol-tools-df8de7ff517ba1386671c658d402fa7436ff4f74.tar.zst dexon-sol-tools-df8de7ff517ba1386671c658d402fa7436ff4f74.zip |
Fixes
Rename to isFirstGetTransactionCount
assign nextPrefixedHexNonce as a const
Diffstat (limited to 'packages/subproviders/src')
-rw-r--r-- | packages/subproviders/src/subproviders/nonce_tracker.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/subproviders/src/subproviders/nonce_tracker.ts b/packages/subproviders/src/subproviders/nonce_tracker.ts index 4b5c34f69..6c1d54882 100644 --- a/packages/subproviders/src/subproviders/nonce_tracker.ts +++ b/packages/subproviders/src/subproviders/nonce_tracker.ts @@ -13,9 +13,9 @@ import { OptionalNextCallback, } from '../types'; - import { Subprovider } from './subprovider'; +// We do not export this since this is not our error, and we do not throw this error const NONCE_TOO_LOW_ERROR_MESSAGE = 'Transaction nonce is too low'; export class NonceTrackerSubprovider extends Subprovider { private _nonceCache: { [address: string]: string } = {}; @@ -36,7 +36,8 @@ export class NonceTrackerSubprovider extends Subprovider { return address; case 'eth_sendRawTransaction': const transaction = NonceTrackerSubprovider._reconstructTransaction(payload); - address = `0x${transaction.getSenderAddress().toString('hex')}`.toLowerCase(); + const addressRaw = transaction.getSenderAddress().toString('hex').toLowerCase(); + address = `0x${addressRaw}`; return address; default: throw new Error(NonceSubproviderErrors.CannotDetermineAddressFromPayload); @@ -87,8 +88,8 @@ export class NonceTrackerSubprovider extends Subprovider { if (nextHexNonce.length % 2) { nextHexNonce = `0${nextHexNonce}`; } - nextHexNonce = `0x${nextHexNonce}`; - this._nonceCache[address] = nextHexNonce; + const nextPrefixedHexNonce = `0x${nextHexNonce}`; + this._nonceCache[address] = nextPrefixedHexNonce; } private _handleSendTransactionError(payload: JSONRPCPayload, err: Error): void { const address = NonceTrackerSubprovider._determineAddress(payload); |