mirror of
https://github.com/logos-storage/nim-json-rpc.git
synced 2026-05-28 13:29:29 +00:00
WIP dummy async RPC calls
This commit is contained in:
parent
af45820594
commit
7e679f1aab
@ -1,10 +1,13 @@
|
|||||||
import ../eth-rpc / rpcclient, ../eth-rpc / rpcserver, asyncdispatch, json, unittest
|
import ../eth-rpc / rpcclient, ../eth-rpc / rpcserver, asyncdispatch, json, unittest, ../eth-rpc/server/ethprocs
|
||||||
|
|
||||||
# REVIEW: I'd like to see some dummy implementations of RPC calls handled in async fashion.
|
# REVIEW: I'd like to see some dummy implementations of RPC calls handled in async fashion.
|
||||||
|
proc myProc {.rpc.} =
|
||||||
|
return %"hello"
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
# create on localhost, default port
|
# create on localhost, default port
|
||||||
var srv = newRpcServer("")
|
var srv = newRpcServer("")
|
||||||
|
registerEthereumRpcs(srv)
|
||||||
asyncCheck srv.serve()
|
asyncCheck srv.serve()
|
||||||
|
|
||||||
suite "RPC":
|
suite "RPC":
|
||||||
@ -19,5 +22,8 @@ when isMainModule:
|
|||||||
test "SHA3":
|
test "SHA3":
|
||||||
response = waitFor client.web3_sha3(%"abc")
|
response = waitFor client.web3_sha3(%"abc")
|
||||||
check response.result.getStr == "3A985DA74FE225B2045C172D6BD390BD855F086E3E9D525B46BFE24511431532"
|
check response.result.getStr == "3A985DA74FE225B2045C172D6BD390BD855F086E3E9D525B46BFE24511431532"
|
||||||
|
response = waitFor client.call("myProc", %"abc")
|
||||||
|
echo response.result.getStr
|
||||||
|
|
||||||
|
|
||||||
waitFor main()
|
waitFor main()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user