mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-04 15:03:08 +00:00
* Change folder structure to {v1,v2,common}/...
Addresses https://github.com/status-im/nim-waku/issues/261
* Update waku.nimble paths
* Flatten paths
* Fix import paths
* Pull out utils folder for nat
* Pull out waku_types to top level for v2
* Fix test import paths
* Remove old READMEs and replace with one liner
* Update README and split v1 and v2
* Skeleton READMEs
* Update README.md
Co-authored-by: Kim De Mey <kim.demey@gmail.com>
* Update README.md
Co-authored-by: Kim De Mey <kim.demey@gmail.com>
Co-authored-by: Kim De Mey <kim.demey@gmail.com>
48 lines
1.2 KiB
Nim
48 lines
1.2 KiB
Nim
{.used.}
|
|
|
|
import
|
|
std/[unittest, options, os, strutils],
|
|
stew/shims/net as stewNet,
|
|
json_rpc/[rpcserver, rpcclient],
|
|
libp2p/crypto/crypto,
|
|
../../waku/v2/node/wakunode2,
|
|
../../waku/v2/node/rpc/wakurpc,
|
|
../../waku/v2/protocol/waku_relay,
|
|
../../waku/v2/waku_types,
|
|
../test_helpers
|
|
|
|
|
|
template sourceDir*: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
|
const sigPath = sourceDir / ParDir / ParDir / "waku" / "v2" / "node" / "rpc" / "wakucallsigs.nim"
|
|
createRpcSigs(RpcHttpClient, sigPath)
|
|
|
|
suite "Waku v2 Remote Procedure Calls":
|
|
# WakuNode setup
|
|
let
|
|
rng = crypto.newRng()
|
|
privkey = crypto.PrivateKey.random(Secp256k1, rng[]).tryGet()
|
|
bindIp = ValidIpAddress.init("0.0.0.0")
|
|
extIp = ValidIpAddress.init("127.0.0.1")
|
|
port = Port(9000)
|
|
node = WakuNode.init(privkey, bindIp, port, some(extIp), some(port))
|
|
|
|
waitFor node.start()
|
|
|
|
waitFor node.mountRelay(@["waku"])
|
|
|
|
# RPC server setup
|
|
let
|
|
rpcPort = Port(8545)
|
|
ta = initTAddress(bindIp, rpcPort)
|
|
server = newRpcHttpServer([ta])
|
|
|
|
setupWakuRPC(node, server)
|
|
server.start()
|
|
|
|
asyncTest "waku_info":
|
|
# RPC client setup
|
|
let client = newRpcHttpClient()
|
|
await client.connect("127.0.0.1", rpcPort)
|
|
|
|
check await(client.waku_version()) == WakuRelayCodec
|