diff --git a/README.md b/README.md index 5d301df..4233173 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ const DelegatedContentRouting = require('libp2p-delegated-content-routing') const ipfsHttpClient = require('ipfs-http-client') // default is to use ipfs.io -const routing = new DelegatedContentRouting(peerId, ipfsHttpClient({ +const routing = new DelegatedContentRouting(peerId, ipfsHttpClient.create({ // use default api settings protocol: 'https', port: 443, diff --git a/package.json b/package.json index ef30aaf..d442b86 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "private": false, "scripts": { "lint": "aegir lint", + "prepare": "npm run build", "build": "aegir build", "test": "aegir test", "test:node": "aegir test --target node", @@ -20,18 +21,18 @@ "devDependencies": { "aegir": "^33.0.0", "go-ipfs": "^0.8.0", - "ipfs-http-client": "^49.0.4", - "ipfs-utils": "^6.0.6", - "ipfsd-ctl": "^7.2.0", + "ipfs-http-client": "^50.1.0", + "ipfs-utils": "^8.1.2", + "ipfsd-ctl": "^8.0.2", "it-all": "^1.0.0", "it-drain": "^1.0.0", - "peer-id": "^0.14.0", + "peer-id": "^0.15.0", "uint8arrays": "^2.1.4" }, "dependencies": { "debug": "^4.1.1", "it-drain": "^1.0.3", - "multiaddr": "^9.0.1", + "multiaddr": "^10.0.0", "p-defer": "^3.0.0", "p-queue": "^6.2.1" }, diff --git a/src/index.js b/src/index.js index c176e6c..a953663 100644 --- a/src/index.js +++ b/src/index.js @@ -92,7 +92,7 @@ class DelegatedContentRouting { timeout: options.timeout })) { yield { - id: PeerId.createFromCID(id), + id: PeerId.parse(id), multiaddrs: addrs } providers++ diff --git a/test/index.spec.js b/test/index.spec.js index 9869aa1..5f3d6fb 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -61,7 +61,7 @@ describe('DelegatedContentRouting', function () { // Spawn our local node and bootstrap the bootstrapper node const self = await spawnNode(bootstrapId.addresses) selfNode = self.node - selfId = PeerId.createFromB58String(self.id.id) + selfId = PeerId.parse(self.id.id) // Spawn the delegate node and bootstrap the bootstrapper node const delegate = await spawnNode(bootstrapId.addresses) @@ -82,7 +82,7 @@ describe('DelegatedContentRouting', function () { }) it('should accept an http api client instance at construction time', () => { - const client = ipfsHttpClient({ + const client = ipfsHttpClient.create({ protocol: 'http', port: 8000, host: 'localhost' @@ -118,7 +118,7 @@ describe('DelegatedContentRouting', function () { it('should be able to find providers through the delegate node', async function () { const opts = delegateNode.apiAddr.toOptions() - const routing = new DelegatedContentRouting(selfId, ipfsHttpClient({ + const routing = new DelegatedContentRouting(selfId, ipfsHttpClient.create({ protocol: 'http', port: opts.port, host: opts.host @@ -134,7 +134,7 @@ describe('DelegatedContentRouting', function () { it('should be able to specify a timeout', async () => { const opts = delegateNode.apiAddr.toOptions() - const routing = new DelegatedContentRouting(selfId, ipfsHttpClient({ + const routing = new DelegatedContentRouting(selfId, ipfsHttpClient.create({ protocol: 'http', port: opts.port, host: opts.host @@ -149,7 +149,7 @@ describe('DelegatedContentRouting', function () { describe('provide', () => { it('should be able to register as a content provider to the delegate node', async () => { const opts = delegateNode.apiAddr.toOptions() - const contentRouter = new DelegatedContentRouting(selfId, ipfsHttpClient({ + const contentRouter = new DelegatedContentRouting(selfId, ipfsHttpClient.create({ protocol: 'http', port: opts.port, host: opts.host @@ -167,7 +167,7 @@ describe('DelegatedContentRouting', function () { it('should provide non-dag-pb nodes via the delegate node', async () => { const opts = delegateNode.apiAddr.toOptions() - const contentRouter = new DelegatedContentRouting(selfId, ipfsHttpClient({ + const contentRouter = new DelegatedContentRouting(selfId, ipfsHttpClient.create({ protocol: 'http', port: opts.port, host: opts.host