mirror of https://github.com/waku-org/js-waku.git
Use provided API
This commit is contained in:
parent
689f439948
commit
d0020744b4
|
@ -102,7 +102,7 @@ export default class Waku {
|
||||||
await this.libp2p.dialProtocol(peer, [RelayCodec, StoreCodec]);
|
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);
|
this.libp2p.peerStore.addressBook.set(peerId, multiaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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([
|
await Promise.all([
|
||||||
new Promise((resolve) =>
|
new Promise((resolve) =>
|
||||||
|
|
|
@ -42,7 +42,7 @@ function connect(peer: string | undefined, waku: Waku | undefined): string[] {
|
||||||
if (!peerId) {
|
if (!peerId) {
|
||||||
return ['Peer Id needed to dial'];
|
return ['Peer Id needed to dial'];
|
||||||
}
|
}
|
||||||
waku.libp2p.peerStore.addressBook.add(PeerId.createFromB58String(peerId), [
|
waku.addPeerToAddressBook(PeerId.createFromB58String(peerId), [
|
||||||
peerMultiaddr,
|
peerMultiaddr,
|
||||||
]);
|
]);
|
||||||
return [
|
return [
|
||||||
|
|
Loading…
Reference in New Issue