From 728b3c5f2dfaa0d412005dc59b12af076405cb3e Mon Sep 17 00:00:00 2001 From: Danish Arora Date: Thu, 24 Oct 2024 19:32:55 +0530 Subject: [PATCH] chore: dial provided now --- packages/sdk/src/waku/waku.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/sdk/src/waku/waku.ts b/packages/sdk/src/waku/waku.ts index eea596d7a9..03a30e54aa 100644 --- a/packages/sdk/src/waku/waku.ts +++ b/packages/sdk/src/waku/waku.ts @@ -108,6 +108,15 @@ export class WakuNode implements IWaku { if (protocolsEnabled.store) { const store = wakuStore(this.connectionManager); this.store = store(libp2p); + + if (options.nodesToUse?.store) { + this.dialMultiaddr( + options.nodesToUse.store[0], + this.store.protocol.multicodec + ).catch((e) => { + log.error("Failed to dial store peer", e); + }); + } } if (protocolsEnabled.lightpush) { @@ -224,6 +233,14 @@ export class WakuNode implements IWaku { return this.connectionManager.isConnected(); } + private async dialMultiaddr( + multiaddrStr: string, + protocol: string + ): Promise { + const ma = multiaddr(multiaddrStr); + await this.libp2p.dialProtocol(ma, [protocol]); + } + private mapToPeerIdOrMultiaddr( peerId: PeerId | MultiaddrInput ): PeerId | Multiaddr {