mirror of
https://github.com/waku-org/js-waku.git
synced 2025-01-12 05:24:43 +00:00
feat!: Do not start libp2p automatically with createWaku
Reduce the number of actions `createWaku` does.
This commit is contained in:
parent
b7b6a11f43
commit
98d14e08b0
@ -44,6 +44,8 @@ export async function waitForRemotePeer(
|
||||
): Promise<void> {
|
||||
protocols = protocols ?? [Protocols.Relay];
|
||||
|
||||
if (!waku.isStarted()) return Promise.reject("Waku node is not started");
|
||||
|
||||
const promises = [];
|
||||
|
||||
if (protocols.includes(Protocols.Relay)) {
|
||||
|
@ -107,8 +107,6 @@ export async function createWaku(options?: CreateOptions): Promise<Waku> {
|
||||
const wakuLightPush = new WakuLightPush(libp2p, options);
|
||||
const wakuFilter = new WakuFilter(libp2p, options);
|
||||
|
||||
await libp2p.start();
|
||||
|
||||
return new Waku(options ?? {}, libp2p, wakuStore, wakuLightPush, wakuFilter);
|
||||
}
|
||||
|
||||
@ -233,6 +231,10 @@ export class Waku {
|
||||
await this.libp2p.stop();
|
||||
}
|
||||
|
||||
isStarted(): boolean {
|
||||
return this.libp2p.isStarted();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a decryption key to attempt decryption of messages received via
|
||||
* [[WakuRelay]] and [[WakuStore]]. This can either be a private key for
|
||||
|
Loading…
x
Reference in New Issue
Block a user