2020-09-25 11:35:32 +00:00
|
|
|
import
|
|
|
|
os, strutils, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
|
|
|
|
libp2p/protobuf/minprotobuf,
|
|
|
|
libp2p/[peerinfo, multiaddress],
|
|
|
|
eth/common as eth_common, eth/keys,
|
|
|
|
system,
|
|
|
|
options
|
|
|
|
|
|
|
|
from strutils import rsplit
|
|
|
|
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
|
|
|
|
|
|
|
const sigWakuPath = sourceDir / "wakucallsigs.nim"
|
|
|
|
createRpcSigs(RpcHttpClient, sigWakuPath)
|
|
|
|
|
|
|
|
if paramCount() < 1:
|
|
|
|
echo "Please provide rpcPort as argument."
|
|
|
|
quit(1)
|
|
|
|
|
|
|
|
let rpcPort = Port(parseInt(paramStr(1)))
|
|
|
|
|
|
|
|
echo "Please enter your topic:"
|
|
|
|
let raw_input = readLine(stdin)
|
|
|
|
let input = fmt"{raw_input}"
|
|
|
|
echo "Input is:", input
|
|
|
|
|
|
|
|
var node = newRpcHttpClient()
|
|
|
|
waitfor node.connect("localhost", rpcPort)
|
|
|
|
|
2020-10-06 03:33:28 +00:00
|
|
|
var res = waitfor node.wakuQuery(@[input])
|
2020-09-25 11:35:32 +00:00
|
|
|
echo "Waku query response: ", res
|