eth-block-tracker
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -171,5 +171,4 @@ 'use strict'; | ||
previous = this._trackingBlockTimestamp; | ||
now = Date.now | ||
now = Date.now(); | ||
// check for desynchronization (computer sleep or no internet) | ||
(); | ||
@@ -350,7 +349,6 @@ if (!(previous && now - previous > this._syncingTimeout)) { | ||
_context6.next = 13; | ||
return this._setTrackingBlock(newBlock | ||
// ask for next block | ||
); | ||
return this._setTrackingBlock(newBlock); | ||
case 13: | ||
// ask for next block | ||
this._performSync(); | ||
@@ -362,7 +360,6 @@ _context6.next = 19; | ||
_context6.next = 18; | ||
return this._setCurrentBlock(trackingBlock | ||
// setup poll for next block | ||
); | ||
return this._setCurrentBlock(trackingBlock); | ||
case 18: | ||
// setup poll for next block | ||
this._pollForNextBlock(); | ||
@@ -384,7 +381,6 @@ | ||
_context6.next = 26; | ||
return this._setCurrentBlock(trackingBlock | ||
// setup poll for next block | ||
); | ||
return this._setCurrentBlock(trackingBlock); | ||
case 26: | ||
// setup poll for next block | ||
this._pollForNextBlock(); | ||
@@ -391,0 +387,0 @@ _context6.next = 31; |
{ | ||
"name": "eth-block-tracker", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "This module walks the Ethereum blockchain, keeping track of the latest block. It uses a web3 provider as a data source and will continuously poll for the next block.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -26,3 +26,3 @@ const incrementHexNumber = require('../../lib/hexUtils').incrementHexNumber | ||
// defaults | ||
address: randomHash(), | ||
address: randomAddress(), | ||
topics: [ | ||
@@ -37,3 +37,3 @@ randomHash(), | ||
blockHash: '0x7c337eac9e3ec7bc99a1d911d326389558c9086afca7480a19698a16e40b2e0a', | ||
transactionHash: '0xd81da851bd3f4094d52cb86929e2ea3732a60ba7c184b853795fc5710a68b5fa', | ||
hash: randomHash(), | ||
transactionIndex: '0x0' | ||
@@ -94,8 +94,12 @@ // provided | ||
function randomAddress() { | ||
return '0x' + randomBuffer(20).toString('hex') | ||
} | ||
function randomBuffer(len) { | ||
return Buffer.from(Array(len).fill().map(() => Math.floor(256*Math.random()))) | ||
} | ||
function randomHash(){ | ||
return intToHex(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)) | ||
return '0x' + randomBuffer(32).toString('hex') | ||
} | ||
function intToHex(int){ | ||
return '0x'+int.toString(16) | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71925
21
1167