mirror of
https://github.com/logos-messaging/logos-messaging-go-bindings.git
synced 2026-02-21 22:13:09 +00:00
git-subtree-dir: third-party/nwaku git-subtree-split: d94cb7c73631ffd4b934839ba58bc622d331a135
34 lines
934 B
Nim
34 lines
934 B
Nim
{.used.}
|
|
|
|
import std/options, chronos, chronicles, libp2p/crypto/crypto
|
|
|
|
import
|
|
waku/node/peer_manager,
|
|
waku/waku_core,
|
|
waku/waku_core/topics/sharding,
|
|
waku/waku_lightpush,
|
|
waku/waku_lightpush/[client, common],
|
|
waku/common/rate_limit/setting,
|
|
../testlib/[common, wakucore]
|
|
|
|
proc newTestWakuLightpushNode*(
|
|
switch: Switch,
|
|
handler: PushMessageHandler,
|
|
rateLimitSetting: Option[RateLimitSetting] = none[RateLimitSetting](),
|
|
): Future[WakuLightPush] {.async.} =
|
|
let
|
|
peerManager = PeerManager.new(switch)
|
|
wakuAutoSharding = Sharding(clusterId: 1, shardCountGenZero: 8)
|
|
proto = WakuLightPush.new(
|
|
peerManager, rng, handler, some(wakuAutoSharding), rateLimitSetting
|
|
)
|
|
|
|
await proto.start()
|
|
switch.mount(proto)
|
|
|
|
return proto
|
|
|
|
proc newTestWakuLightpushClient*(switch: Switch): WakuLightPushClient =
|
|
let peerManager = PeerManager.new(switch)
|
|
WakuLightPushClient.new(peerManager, rng)
|