2023-11-27 18:33:27 +01:00
|
|
|
{.used.}
|
|
|
|
|
2024-03-16 00:08:47 +01:00
|
|
|
import std/options, chronos, chronicles, libp2p/crypto/crypto
|
2023-11-27 18:33:27 +01:00
|
|
|
|
|
|
|
import
|
2024-03-16 00:08:47 +01:00
|
|
|
../../../waku/[node/peer_manager, waku_core, waku_store, waku_store/client],
|
|
|
|
../testlib/[common, wakucore]
|
2023-11-27 18:33:27 +01:00
|
|
|
|
2024-03-16 00:08:47 +01:00
|
|
|
proc newTestWakuStore*(
|
2024-04-25 09:09:52 -04:00
|
|
|
switch: Switch, handler: StoreQueryRequestHandler
|
2024-03-16 00:08:47 +01:00
|
|
|
): Future[WakuStore] {.async.} =
|
2023-11-27 18:33:27 +01:00
|
|
|
let
|
|
|
|
peerManager = PeerManager.new(switch)
|
|
|
|
proto = WakuStore.new(peerManager, rng, handler)
|
|
|
|
|
|
|
|
await proto.start()
|
|
|
|
switch.mount(proto)
|
|
|
|
|
|
|
|
return proto
|
|
|
|
|
|
|
|
proc newTestWakuStoreClient*(switch: Switch): WakuStoreClient =
|
|
|
|
let peerManager = PeerManager.new(switch)
|
|
|
|
WakuStoreClient.new(peerManager, rng)
|