2024-02-06 17:37:42 +01:00
|
|
|
{.used.}
|
|
|
|
|
|
2025-04-17 13:03:56 +02:00
|
|
|
import std/options, chronos, chronicles, libp2p/crypto/crypto
|
2024-02-06 17:37:42 +01:00
|
|
|
|
|
|
|
|
import
|
2026-06-08 13:37:53 +02:00
|
|
|
logos_delivery/waku/node/peer_manager,
|
|
|
|
|
logos_delivery/waku/waku_core,
|
|
|
|
|
logos_delivery/waku/waku_core/topics/sharding,
|
|
|
|
|
logos_delivery/waku/waku_lightpush,
|
|
|
|
|
logos_delivery/waku/waku_lightpush/[client, common],
|
|
|
|
|
logos_delivery/waku/common/rate_limit/setting,
|
2024-03-16 00:08:47 +01:00
|
|
|
../testlib/[common, wakucore]
|
2024-02-06 17:37:42 +01:00
|
|
|
|
2024-03-16 00:08:47 +01:00
|
|
|
proc newTestWakuLightpushNode*(
|
2024-04-15 15:28:35 +02:00
|
|
|
switch: Switch,
|
|
|
|
|
handler: PushMessageHandler,
|
|
|
|
|
rateLimitSetting: Option[RateLimitSetting] = none[RateLimitSetting](),
|
2024-03-16 00:08:47 +01:00
|
|
|
): Future[WakuLightPush] {.async.} =
|
2024-02-06 17:37:42 +01:00
|
|
|
let
|
|
|
|
|
peerManager = PeerManager.new(switch)
|
2025-07-04 17:10:53 +10:00
|
|
|
wakuAutoSharding = Sharding(clusterId: 1, shardCountGenZero: 8)
|
|
|
|
|
proto = WakuLightPush.new(
|
2026-06-15 09:56:15 -03:00
|
|
|
peerManager, crypto.newRng(), handler, some(wakuAutoSharding), rateLimitSetting
|
2025-07-04 17:10:53 +10:00
|
|
|
)
|
2024-02-06 17:37:42 +01:00
|
|
|
|
|
|
|
|
await proto.start()
|
|
|
|
|
switch.mount(proto)
|
|
|
|
|
|
|
|
|
|
return proto
|
|
|
|
|
|
|
|
|
|
proc newTestWakuLightpushClient*(switch: Switch): WakuLightPushClient =
|
|
|
|
|
let peerManager = PeerManager.new(switch)
|
2026-06-15 09:56:15 -03:00
|
|
|
WakuLightPushClient.new(peerManager, crypto.newRng())
|