Compare commits

...

2 Commits
main ... 0.7.3

Author SHA1 Message Date
Mark Spanbroek
4c7e351fd9 version 0.7.3 2024-02-27 09:19:41 +01:00
Ben Bierens
67ab667284 Adds isSyncing to provider (#62) 2024-02-27 09:17:45 +01:00
5 changed files with 14 additions and 2 deletions

View File

@ -14,7 +14,7 @@ Use the [Nimble][2] package manager to add `ethers` to an existing
project. Add the following to its .nimble file:
```nim
requires "ethers >= 0.7.1 & < 0.8.0"
requires "ethers >= 0.7.3 & < 0.8.0"
```
Usage

View File

@ -1,4 +1,4 @@
version = "0.7.1"
version = "0.7.3"
author = "Nim Ethers Authors"
description = "library for interacting with Ethereum"
license = "MIT"

View File

@ -157,6 +157,9 @@ method subscribe*(provider: Provider,
method unsubscribe*(subscription: Subscription) {.base, async.} =
doAssert false, "not implemented"
method isSyncing*(provider: Provider): Future[bool] {.base, async.} =
doAssert false, "not implemented"
proc replay*(provider: Provider, tx: Transaction, blockNumber: UInt256) {.async.} =
# Replay transaction at block. Useful for fetching revert reasons, which will
# be present in the raised error message. The replayed block number should

View File

@ -222,6 +222,10 @@ method unsubscribe(subscription: JsonRpcSubscription) {.async.} =
let id = subscription.id
await subscriptions.unsubscribe(id)
method isSyncing*(provider: JsonRpcProvider): Future[bool] {.async.} =
let response = await provider.send("eth_syncing")
return response.getBool()
method close*(provider: JsonRpcProvider) {.async.} =
convertError:
let client = await provider.client

View File

@ -99,3 +99,8 @@ for url in ["ws://localhost:8545", "http://localhost:8545"]:
discard await provider.subscribe(proc(_: Block) = discard)
expect JsonRpcProviderError:
discard await provider.getSigner().sendTransaction(Transaction.example)
test "syncing":
let isSyncing = await provider.isSyncing()
check not isSyncing