mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-15 12:23:15 +00:00
* Add WakuMessage type * Add WakuMessage encoding and decoding Also clean up waku_types module and imports * Clean up waku_relay module Imports, remove old text test, make fields and functions public, format. * Publish WakuMessage Also fix type mismatch in RPC * Make publish work in examples, node and protocol * Parse protobuf content in examples * Update docs * Update waku/node/v2/waku_types.nim * Fix compilation error and disable out of date waku test Co-authored-by: Kim De Mey <kim.demey@gmail.com>
30 lines
782 B
Nim
30 lines
782 B
Nim
{.used.}
|
|
|
|
import
|
|
std/unittest,
|
|
chronicles, chronos, stew/shims/net as stewNet, stew/byteutils,
|
|
libp2p/crypto/crypto,
|
|
libp2p/crypto/secp,
|
|
eth/keys,
|
|
../../waku/node/v2/[wakunode2, waku_types],
|
|
../test_helpers
|
|
|
|
procSuite "WakuNode":
|
|
asyncTest "Message published with content filter is retrievable":
|
|
let
|
|
rng = keys.newRng()
|
|
nodeKey = crypto.PrivateKey.random(Secp256k1, rng[])[]
|
|
node = WakuNode.init(nodeKey, ValidIpAddress.init("0.0.0.0"),
|
|
Port(60000))
|
|
|
|
await node.start()
|
|
|
|
let
|
|
topic = "foo"
|
|
contentTopic = "foobar"
|
|
wakuMessage = WakuMessage(payload: ("hello world").toBytes,
|
|
contentTopic: contentTopic)
|
|
|
|
node.publish(topic, wakuMessage)
|
|
# TODO: Add actual subscribe part with receival of message
|