[chore] bump nim-ethers to 0.1.7 (#107)
* [chore] bump nim-ethers to 0.1.7 * [chore] make block handler callback async nim-ethers 0.1.7 makes the subscription callbacks async.
This commit is contained in:
parent
6ce7e23767
commit
3b0e93eab4
|
@ -13,7 +13,7 @@ requires "nim >= 1.2.0",
|
||||||
"chronicles >= 0.7.2",
|
"chronicles >= 0.7.2",
|
||||||
"chronos >= 2.5.2",
|
"chronos >= 2.5.2",
|
||||||
"confutils",
|
"confutils",
|
||||||
"ethers >= 0.1.6 & < 0.2.0",
|
"ethers >= 0.1.7 & < 0.2.0",
|
||||||
"libbacktrace",
|
"libbacktrace",
|
||||||
"libp2p",
|
"libp2p",
|
||||||
"metrics",
|
"metrics",
|
||||||
|
|
|
@ -21,13 +21,13 @@ proc start*(clock: OnChainClock) {.async.} =
|
||||||
return
|
return
|
||||||
clock.started = true
|
clock.started = true
|
||||||
|
|
||||||
proc onBlock(blck: Block) {.gcsafe, upraises:[].} =
|
proc onBlock(blck: Block) {.async, upraises:[].} =
|
||||||
let blockTime = blck.timestamp.truncate(int64)
|
let blockTime = blck.timestamp.truncate(int64)
|
||||||
let computerTime = getTime().toUnix
|
let computerTime = getTime().toUnix
|
||||||
clock.offset = blockTime - computerTime
|
clock.offset = blockTime - computerTime
|
||||||
|
|
||||||
if latestBlock =? (await clock.provider.getBlock(BlockTag.latest)):
|
if latestBlock =? (await clock.provider.getBlock(BlockTag.latest)):
|
||||||
onBlock(latestBlock)
|
await onBlock(latestBlock)
|
||||||
|
|
||||||
clock.subscription = await clock.provider.subscribe(onBlock)
|
clock.subscription = await clock.provider.subscribe(onBlock)
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0549800af6551525cbca2998ce51d0a66f25a3ec
|
Subproject commit 270d358b869d02a4c625dde971f799db336670fb
|
Loading…
Reference in New Issue