Skip to content

Commit

Permalink
chore: dial provided now
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Oct 24, 2024
1 parent c01da40 commit 728b3c5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/sdk/src/waku/waku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -224,6 +233,14 @@ export class WakuNode implements IWaku {
return this.connectionManager.isConnected();
}

private async dialMultiaddr(
multiaddrStr: string,
protocol: string
): Promise<void> {
const ma = multiaddr(multiaddrStr);
await this.libp2p.dialProtocol(ma, [protocol]);
}

private mapToPeerIdOrMultiaddr(
peerId: PeerId | MultiaddrInput
): PeerId | Multiaddr {
Expand Down

0 comments on commit 728b3c5

Please sign in to comment.