mirror of
https://github.com/status-im/nim-ethers.git
synced 2025-01-15 18:14:35 +00:00
Adds isSyncing to provider (#62)
This commit is contained in:
parent
43500c63d7
commit
e8196b3c82
@ -182,6 +182,9 @@ method unsubscribe*(
|
||||
|
||||
doAssert false, "not implemented"
|
||||
|
||||
method isSyncing*(provider: Provider): Future[bool] {.base, async.} =
|
||||
doAssert false, "not implemented"
|
||||
|
||||
proc replay*(
|
||||
provider: Provider,
|
||||
tx: Transaction,
|
||||
|
@ -268,6 +268,10 @@ method unsubscribe*(
|
||||
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: (raises:[ProviderError]).} =
|
||||
|
||||
|
@ -98,3 +98,8 @@ for url in ["ws://localhost:8545", "http://localhost:8545"]:
|
||||
discard await provider.subscribe(proc(_: Block) = discard)
|
||||
expect JsonRpcSignerError:
|
||||
discard await provider.getSigner().sendTransaction(Transaction.example)
|
||||
|
||||
test "syncing":
|
||||
let isSyncing = await provider.isSyncing()
|
||||
check not isSyncing
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user