From d0020744b4870722783a7479992a942359eddfc2 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 4 May 2021 10:23:31 +1000 Subject: [PATCH] Use provided API --- src/lib/waku.ts | 2 +- src/lib/waku_relay/index.spec.ts | 5 ++++- web-chat/src/command.ts | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/waku.ts b/src/lib/waku.ts index cd1e15ebc3..0fba0e37ae 100644 --- a/src/lib/waku.ts +++ b/src/lib/waku.ts @@ -102,7 +102,7 @@ export default class Waku { await this.libp2p.dialProtocol(peer, [RelayCodec, StoreCodec]); } - async dialWithMultiAddr(peerId: PeerId, multiaddr: Multiaddr[]) { + addPeerToAddressBook(peerId: PeerId, multiaddr: Multiaddr[]) { this.libp2p.peerStore.addressBook.set(peerId, multiaddr); } diff --git a/src/lib/waku_relay/index.spec.ts b/src/lib/waku_relay/index.spec.ts index c091d08e19..ea69e41248 100644 --- a/src/lib/waku_relay/index.spec.ts +++ b/src/lib/waku_relay/index.spec.ts @@ -32,7 +32,10 @@ describe('Waku Relay', () => { }), ]); - await waku1.dialWithMultiAddr(waku2.libp2p.peerId, waku2.libp2p.multiaddrs); + await waku1.addPeerToAddressBook( + waku2.libp2p.peerId, + waku2.libp2p.multiaddrs + ); await Promise.all([ new Promise((resolve) => diff --git a/web-chat/src/command.ts b/web-chat/src/command.ts index 3034c686ec..1da11566d4 100644 --- a/web-chat/src/command.ts +++ b/web-chat/src/command.ts @@ -42,7 +42,7 @@ function connect(peer: string | undefined, waku: Waku | undefined): string[] { if (!peerId) { return ['Peer Id needed to dial']; } - waku.libp2p.peerStore.addressBook.add(PeerId.createFromB58String(peerId), [ + waku.addPeerToAddressBook(PeerId.createFromB58String(peerId), [ peerMultiaddr, ]); return [