Ivan Folgueira Bande 2f6de9187f Squashed 'third-party/nwaku/' content from commit d94cb7c7
git-subtree-dir: third-party/nwaku
git-subtree-split: d94cb7c73631ffd4b934839ba58bc622d331a135
2025-10-02 11:52:12 +02:00

29 lines
816 B
Nim

{.used.}
import std/options, chronos, libp2p/crypto/crypto
import
waku/node/peer_manager,
waku/waku_lightpush_legacy,
waku/waku_lightpush_legacy/[client, common],
waku/common/rate_limit/setting,
../testlib/[common, wakucore]
proc newTestWakuLegacyLightpushNode*(
switch: Switch,
handler: PushMessageHandler,
rateLimitSetting: Option[RateLimitSetting] = none[RateLimitSetting](),
): Future[WakuLegacyLightPush] {.async.} =
let
peerManager = PeerManager.new(switch)
proto = WakuLegacyLightPush.new(peerManager, rng, handler, rateLimitSetting)
await proto.start()
switch.mount(proto)
return proto
proc newTestWakuLegacyLightpushClient*(switch: Switch): WakuLegacyLightPushClient =
let peerManager = PeerManager.new(switch)
WakuLegacyLightPushClient.new(peerManager, rng)