2018-06-11 19:26:16 +01:00
|
|
|
include ../ eth-rpc / client
|
|
|
|
|
import chronicles
|
|
|
|
|
|
|
|
|
|
proc rawCall*(self: RpcClient, name: string,
|
|
|
|
|
msg: string): Future[Response] {.async.} =
|
|
|
|
|
# For debug purposes only
|
|
|
|
|
let id = $self.nextId
|
|
|
|
|
self.nextId.inc
|
2018-06-12 19:28:41 +01:00
|
|
|
|
2018-06-12 18:09:00 +01:00
|
|
|
var s = msg & "\c\l"
|
|
|
|
|
let res = await self.transp.write(s)
|
2018-06-12 19:28:41 +01:00
|
|
|
|
2018-06-11 19:26:16 +01:00
|
|
|
debug "Receiving length assert", value = res, length = len(msg), lengthDifferent = res != len(msg)
|
|
|
|
|
|
|
|
|
|
# completed by processMessage.
|
|
|
|
|
var newFut = newFuture[Response]()
|
|
|
|
|
# add to awaiting responses
|
|
|
|
|
self.awaiting[id] = newFut
|
2018-06-12 19:28:41 +01:00
|
|
|
|
2018-06-11 19:26:16 +01:00
|
|
|
result = await newFut
|