nwaku/tests/waku_store/store_utils.nim

24 lines
616 B
Nim
Raw Normal View History

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