Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
chore: update multiaddr to 9
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Apr 8, 2021
1 parent 8e5c200 commit daa4f95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@
"libp2p": "^0.30.0",
"libp2p-mplex": "^0.10.1",
"libp2p-noise": "^2.0.1",
"libp2p-websockets": "^0.14.0",
"multiaddr": "^8.1.1",
"libp2p-websockets": "^0.15.4",
"multiaddr": "^9.0.1",
"os": "^0.1.1",
"p-wait-for": "^3.1.0",
"peer-id": "^0.14.2",
"sinon": "^10.0.0",
"url": "^0.11.0"
"sinon": "^10.0.0"
},
"dependencies": {
"debug": "^4.2.0",
Expand Down
14 changes: 11 additions & 3 deletions test/utils/create-peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
*/

const Libp2p = require('libp2p')
const multiaddr = require('multiaddr')
const { Multiaddr } = require('multiaddr')
const PeerId = require('peer-id')

const WS = require('libp2p-websockets')
const filters = require('libp2p-websockets/src/filters')
const MPLEX = require('libp2p-mplex')
const { NOISE } = require('libp2p-noise')

Expand All @@ -21,6 +22,8 @@ const { isNode } = require('ipfs-utils/src/env')
const Peers = require('../fixtures/peers')
const RelayPeer = require('../fixtures/relay')

const transportKey = WS.prototype[Symbol.toStringTag]

const defaultConfig = {
modules: {
transport: [WS],
Expand All @@ -33,6 +36,11 @@ const defaultConfig = {
},
peerDiscovery: {
autoDial: false
},
transport: {
[transportKey]: {
filter: filters.all
}
}
}
}
Expand Down Expand Up @@ -109,10 +117,10 @@ async function createPeers ({ number = 1, started = true, seedAddressBook = true
function getListenAddress (peerId) {
if (isNode) {
// node
return multiaddr('/ip4/127.0.0.1/tcp/0/ws')
return new Multiaddr('/ip4/127.0.0.1/tcp/0/ws')
} else {
// browser
return multiaddr(`${RelayPeer.multiaddr}/p2p-circuit/p2p/${peerId.toB58String()}`)
return new Multiaddr(`${RelayPeer.multiaddr}/p2p-circuit/p2p/${peerId.toB58String()}`)
}
}

Expand Down

0 comments on commit daa4f95

Please sign in to comment.