Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ipfs error #42

Merged
merged 3 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
"cwd": "${fileDirname}"
}
]
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@
},
"devDependencies": {
"coveralls": "^3.1.0",
"eslint": "^7.6.0",
"eslint": "^7.7.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-jsdoc": "^30.2.1",
"eslint-plugin-jsdoc": "^30.3.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.2.5",
"istanbul": "^0.4.5",
"istanbul-merge": "^1.1.1",
"jest": "^26.3.0",
"jest": "^26.4.2",
"lerna": "^3.22.1",
"npm-check-updates": "^7.0.4",
"npm-check-updates": "^7.1.1",
"nyc": "^15.1.0"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/blockchain-substrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"dependencies": {
"@caelumlabs/blockchain": "^0.1.30",
"@caelumlabs/crypto": "^0.1.30",
"@polkadot/api": "^1.28.1",
"@polkadot/types": "^1.28.1"
"@polkadot/api": "^1.30.1",
"@polkadot/types": "^1.30.1"
},
"gitHead": "0340423a42d0ddd0ff2b3c69624012452d07c95e",
"devDependencies": {
"eslint-plugin-jsdoc": "^30.2.1"
"eslint-plugin-jsdoc": "^30.3.0"
}
}
2 changes: 1 addition & 1 deletion packages/comms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"@caelumlabs/crypto": "^0.1.30",
"axios": "^0.19.2",
"axios": "^0.20.0",
"axios-retry": "^3.1.8",
"debug": "^4.1.1",
"events": "^3.2.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"access": "public"
},
"dependencies": {
"@polkadot/keyring": "^3.1.1",
"@polkadot/util": "^3.1.1",
"@polkadot/util-crypto": "^3.1.1",
"@polkadot/keyring": "^3.3.1",
"@polkadot/util": "^3.3.1",
"@polkadot/util-crypto": "^3.3.1",
"@polkadot/wasm": "^0.2.1",
"@polkadot/wasm-crypto": "^1.3.1"
"@polkadot/wasm-crypto": "^1.4.1"
},
"scripts": {
"test": "jest --silent",
Expand Down
3 changes: 1 addition & 2 deletions packages/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
}
},
"dependencies": {
"cids": "^0.8.3",
"debug": "^4.1.1",
"ipfs-http-client": "^45.0.0"
"ipfs-http-client": "^46.0.1"
},
"gitHead": "0340423a42d0ddd0ff2b3c69624012452d07c95e"
}
11 changes: 2 additions & 9 deletions packages/storage/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict'
const IpfsClient = require('ipfs-http-client')
const CID = require('cids')

// Debug
var debug = require('debug')('did:debug:ipfs')
Expand Down Expand Up @@ -29,9 +28,8 @@ module.exports = class Storage {
return new Promise((resolve) => {
this.ipfs.dag.put(data, { format: 'dag-cbor', hashAlg: 'sha2-256' })
.then((cid) => {
const cids = new CID(1, 'dag-cbor', cid.multihash)
debug('CID = ' + cids.toBaseEncodedString())
resolve(cids.toBaseEncodedString())
debug('CID = ' + cid.toBaseEncodedString())
resolve(cid.toBaseEncodedString())
})
.catch((e) => {
error(e)
Expand All @@ -40,11 +38,6 @@ module.exports = class Storage {
})
}

cid (hash) {
const cids = new CID(hash)
return cids
}

/**
* Gets data (DAG) from IPFS.
*
Expand Down
11 changes: 0 additions & 11 deletions packages/storage/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,12 @@ test('Init Storage', async () => {
expect(storage).toBeDefined()
})

test('Storage put undefined', async () => {
const result = await storage.put(undefined)
expect(result).toEqual(undefinedCid)
})

test('Storage put new uuid', async () => {
newUuid = uuid()
newUuidCid = await storage.put(newUuid)
expect(newUuidCid).toBeDefined()
})

test('Storage cid', () => {
const result = storage.cid(newUuidCid)
expect(result.string).toEqual(newUuidCid)
expect(result.codec).toBeDefined()
})

test('Storage get undefined: ', async () => {
const result = await storage.get(undefinedCid)
expect(result.value).toBeNull()
Expand Down
2 changes: 1 addition & 1 deletion packages/terminal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@caelumlabs/wallet": "^0.1.30",
"debug": "^4.1.1",
"figlet": "^1.5.0",
"terminal-kit": "^1.42.0"
"terminal-kit": "^1.43.0"
},
"scripts": {
"test": "jest --silent",
Expand Down