From e8dc1ac1e008b650f18f383fed724ef13b795b64 Mon Sep 17 00:00:00 2001 From: George Nicolaou Date: Sun, 4 Oct 2020 19:58:35 +0300 Subject: [PATCH] fix: add support for multiaddrs 8.0.0 --- package.json | 2 +- src/index.js | 2 +- test/index.spec.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ad1dbcb..7a30a9c 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "dependencies": { "debug": "^4.1.1", "emittery": "^0.6.0", - "multiaddr": "^7.4.3", + "multiaddr": "^8.0.0", "peer-id": "^0.13.11", "protons": "^1.0.2" }, diff --git a/src/index.js b/src/index.js index 2f64c2d..a938055 100644 --- a/src/index.js +++ b/src/index.js @@ -98,7 +98,7 @@ class PubsubPeerDiscovery extends Emittery { _broadcast () { const peer = { publicKey: this.libp2p.peerId.pubKey.bytes, - addrs: this.libp2p.multiaddrs.map(ma => ma.buffer) + addrs: this.libp2p.multiaddrs.map(ma => ma.bytes) } const encodedPeer = PB.Peer.encode(peer) diff --git a/test/index.spec.js b/test/index.spec.js index 7aa1d3a..7bdcd24 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -52,7 +52,7 @@ describe('Pubsub Peer Discovery', () => { expect(peerId.equals(mockLibp2p.peerId)).to.equal(true) expect(peer.addrs).to.have.length(1) peer.addrs.forEach((addr) => { - expect(addr).to.equalBytes(listeningMultiaddrs.buffer) + expect(addr).to.equalBytes(listeningMultiaddrs.bytes) }) expect(topic).to.equal(PubsubPeerDiscovery.TOPIC) @@ -76,7 +76,7 @@ describe('Pubsub Peer Discovery', () => { } const peer = { publicKey: peerId.pubKey.bytes, - addrs: expectedPeerData.multiaddrs.map(ma => multiaddr(ma).buffer) + addrs: expectedPeerData.multiaddrs.map(ma => multiaddr(ma).bytes) } const deferred = defer()