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
|
2024-07-06 03:33:38 +05:30
|
|
|
waku/node/peer_manager,
|
|
|
|
|
waku/waku_core,
|
2025-03-05 12:07:56 +01:00
|
|
|
waku/waku_core/topics/sharding,
|
2024-07-06 03:33:38 +05:30
|
|
|
waku/waku_lightpush,
|
|
|
|
|
waku/waku_lightpush/[client, common],
|
2024-07-16 15:46:21 +02:00
|
|
|
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(
|
|
|
|
|
peerManager, rng, handler, some(wakuAutoSharding), rateLimitSetting
|
|
|
|
|
)
|
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)
|
|
|
|
|
WakuLightPushClient.new(peerManager, rng)
|