Skip to content

Commit f34c7d2

Browse files
authoredJul 7, 2021
chore: update to new multiformats (#52)
* chore: update to new multiformats BREAKING CHANGE: uses the CID class from the new multiformats module
1 parent a5aa25a commit f34c7d2

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const DelegatedContentRouting = require('libp2p-delegated-content-routing')
3131
const ipfsHttpClient = require('ipfs-http-client')
3232

3333
// default is to use ipfs.io
34-
const routing = new DelegatedContentRouting(peerId, ipfsHttpClient({
34+
const routing = new DelegatedContentRouting(peerId, ipfsHttpClient.create({
3535
// use default api settings
3636
protocol: 'https',
3737
port: 443,

‎package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"private": false,
1010
"scripts": {
1111
"lint": "aegir lint",
12+
"prepare": "npm run build",
1213
"build": "aegir build",
1314
"test": "aegir test",
1415
"test:node": "aegir test --target node",
@@ -20,18 +21,18 @@
2021
"devDependencies": {
2122
"aegir": "^33.0.0",
2223
"go-ipfs": "^0.8.0",
23-
"ipfs-http-client": "^49.0.4",
24-
"ipfs-utils": "^6.0.6",
25-
"ipfsd-ctl": "^7.2.0",
24+
"ipfs-http-client": "^50.1.0",
25+
"ipfs-utils": "^8.1.2",
26+
"ipfsd-ctl": "^8.0.2",
2627
"it-all": "^1.0.0",
2728
"it-drain": "^1.0.0",
28-
"peer-id": "^0.14.0",
29+
"peer-id": "^0.15.0",
2930
"uint8arrays": "^2.1.4"
3031
},
3132
"dependencies": {
3233
"debug": "^4.1.1",
3334
"it-drain": "^1.0.3",
34-
"multiaddr": "^9.0.1",
35+
"multiaddr": "^10.0.0",
3536
"p-defer": "^3.0.0",
3637
"p-queue": "^6.2.1"
3738
},

‎src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class DelegatedContentRouting {
9292
timeout: options.timeout
9393
})) {
9494
yield {
95-
id: PeerId.createFromCID(id),
95+
id: PeerId.parse(id),
9696
multiaddrs: addrs
9797
}
9898
providers++

‎test/index.spec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('DelegatedContentRouting', function () {
6161
// Spawn our local node and bootstrap the bootstrapper node
6262
const self = await spawnNode(bootstrapId.addresses)
6363
selfNode = self.node
64-
selfId = PeerId.createFromB58String(self.id.id)
64+
selfId = PeerId.parse(self.id.id)
6565

6666
// Spawn the delegate node and bootstrap the bootstrapper node
6767
const delegate = await spawnNode(bootstrapId.addresses)
@@ -82,7 +82,7 @@ describe('DelegatedContentRouting', function () {
8282
})
8383

8484
it('should accept an http api client instance at construction time', () => {
85-
const client = ipfsHttpClient({
85+
const client = ipfsHttpClient.create({
8686
protocol: 'http',
8787
port: 8000,
8888
host: 'localhost'
@@ -118,7 +118,7 @@ describe('DelegatedContentRouting', function () {
118118

119119
it('should be able to find providers through the delegate node', async function () {
120120
const opts = delegateNode.apiAddr.toOptions()
121-
const routing = new DelegatedContentRouting(selfId, ipfsHttpClient({
121+
const routing = new DelegatedContentRouting(selfId, ipfsHttpClient.create({
122122
protocol: 'http',
123123
port: opts.port,
124124
host: opts.host
@@ -134,7 +134,7 @@ describe('DelegatedContentRouting', function () {
134134

135135
it('should be able to specify a timeout', async () => {
136136
const opts = delegateNode.apiAddr.toOptions()
137-
const routing = new DelegatedContentRouting(selfId, ipfsHttpClient({
137+
const routing = new DelegatedContentRouting(selfId, ipfsHttpClient.create({
138138
protocol: 'http',
139139
port: opts.port,
140140
host: opts.host
@@ -149,7 +149,7 @@ describe('DelegatedContentRouting', function () {
149149
describe('provide', () => {
150150
it('should be able to register as a content provider to the delegate node', async () => {
151151
const opts = delegateNode.apiAddr.toOptions()
152-
const contentRouter = new DelegatedContentRouting(selfId, ipfsHttpClient({
152+
const contentRouter = new DelegatedContentRouting(selfId, ipfsHttpClient.create({
153153
protocol: 'http',
154154
port: opts.port,
155155
host: opts.host
@@ -167,7 +167,7 @@ describe('DelegatedContentRouting', function () {
167167

168168
it('should provide non-dag-pb nodes via the delegate node', async () => {
169169
const opts = delegateNode.apiAddr.toOptions()
170-
const contentRouter = new DelegatedContentRouting(selfId, ipfsHttpClient({
170+
const contentRouter = new DelegatedContentRouting(selfId, ipfsHttpClient.create({
171171
protocol: 'http',
172172
port: opts.port,
173173
host: opts.host

0 commit comments

Comments
 (0)
Please sign in to comment.