mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-05 23:43:07 +00:00
* properly pass userMessageLimit to OnchainGroupManager * waku.nimble 2.2.4 Nim compiler * rm stew/shims/net import * change ValidIpAddress.init with parseIpAddress * fix serialize for zerokit * group_manager: separate if statements * protocol_types: add encode UInt32 with zeros up to 32 bytes * windows build: skip libunwind build and rm libunwind.a inlcusion step * bump nph to overcome the compilation issues with 2.2.x * bump nim-libp2p to v1.10.1
36 lines
912 B
Nim
36 lines
912 B
Nim
import
|
|
std/options,
|
|
sequtils,
|
|
results,
|
|
chronos,
|
|
libp2p/crypto/crypto as libp2p_keys,
|
|
eth/keys as eth_keys
|
|
|
|
import waku/[waku_enr, discovery/waku_discv5, waku_enr/sharding], ../testlib/wakucore
|
|
|
|
proc newTestEnrRecord*(
|
|
privKey: libp2p_keys.PrivateKey,
|
|
extIp: string,
|
|
tcpPort: uint16,
|
|
udpPort: uint16,
|
|
indices: seq[uint64] = @[],
|
|
flags = none(CapabilitiesBitfield),
|
|
): waku_enr.Record =
|
|
var builder = EnrBuilder.init(privKey)
|
|
builder.withIpAddressAndPorts(
|
|
ipAddr = some(parseIpAddress(extIp)),
|
|
tcpPort = some(Port(tcpPort)),
|
|
udpPort = some(Port(udpPort)),
|
|
)
|
|
|
|
if indices.len > 0:
|
|
let
|
|
byteSeq: seq[byte] = indices.mapIt(cast[byte](it))
|
|
relayShards = fromIndicesList(byteSeq).get()
|
|
discard builder.withWakuRelayShardingIndicesList(relayShards)
|
|
|
|
if flags.isSome():
|
|
builder.withWakuCapabilities(flags.get())
|
|
|
|
builder.build().tryGet()
|