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

feat: ipfs-http-client -> kubo-rpc-client #2098

Merged
merged 19 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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,898 changes: 1,140 additions & 1,758 deletions package-lock.json

Large diffs are not rendered by default.

31 changes: 26 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@
"i18next-browser-languagedetector": "^6.1.3",
"i18next-chained-backend": "^3.0.2",
"i18next-http-backend": "^1.3.2",
"i18next-icu": "^2.0.3",
"i18next-icu": "2.0.3",
SgtPooki marked this conversation as resolved.
Show resolved Hide resolved
"i18next-localstorage-backend": "^3.1.3",
"internal-nav-helper": "^3.1.0",
"intl-messageformat": "^9.11.3",
"intl-messageformat": "9.12.0",
"ip": "^1.1.5",
"ipfs-css": "^1.4.0",
"ipfs-geoip": "9.0.1",
"ipfs-http-client": "^49.0.2",
"ipfs-provider": "^2.1.0",
"ipld-explorer-components": "^2.4.1",
"ipld-explorer-components": "^3.0.3",
"is-ipfs": "^3.0.0",
"istextorbinary": "^6.0.0",
"it-all": "^1.0.5",
"it-first": "^1.0.6",
"it-last": "^1.0.5",
"it-map": "^1.0.5",
"kubo-rpc-client": "^3.0.0",
"milliseconds": "^1.0.3",
"money-clip": "^3.0.5",
"multiaddr": "^8.1.2",
Expand Down Expand Up @@ -173,7 +173,7 @@
"esm": "^3.2.25",
"fake-indexeddb": "^3.1.8",
"get-port": "^5.1.1",
"go-ipfs": "0.16.0",
"go-ipfs": "^0.18.1",
"http-proxy": "^1.18.1",
"http-server": "^0.12.3",
"ipfs": "0.58.3",
Expand All @@ -187,6 +187,7 @@
"os-browserify": "^0.3.0",
"patch-package": "^6.4.7",
"path-browserify": "^1.0.1",
"peer-id": "^0.16.0",
"playwright-chromium": "^1.27.1",
"postcss-flexbugs-fixes": "^5.0.2",
"run-script-os": "^1.1.6",
Expand Down Expand Up @@ -343,6 +344,26 @@
"overrides": [
{
"multiaddr": "8.1.2"
},
{
"ipld-explorer-components": {
"ipfs-unixfs": "^4.0.1",
"ipld": "0.29.0",
"ipld-ethereum": "6.0.0",
"ipld-git": "0.6.4",
"ipld-raw": "7.0.0",
"@ipld/dag-pb": "^2.1.17",
"milliseconds": "^1.0.3",
"multibase": "4.0.2",
"multiformats": "^9.7.0",
"multihashes": "^4.0.3",
"react-joyride": "^2.3.0",
"stream-to-it": "^0.2.4",
"@ipld/car": "^4.1.0",
"@ipld/dag-cbor": "^7.0.2",
"@ipld/dag-json": "^8.0.10",
"blockcodec-to-ipld-format": "^2.0.0"
}
}
]
}
48 changes: 48 additions & 0 deletions patches/ipld+0.29.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/node_modules/ipld/src/index.js b/node_modules/ipld/src/index.js
index 12b046f..1ae185b 100644
--- a/node_modules/ipld/src/index.js
+++ b/node_modules/ipld/src/index.js
@@ -2,6 +2,7 @@

const Block = require('ipld-block')
const CID = require('cids')
+const {CID: newCID} = require('multiformats/cid')
const mergeOptions = require('merge-options')
const ipldDagCbor = require('ipld-dag-cbor')
const ipldDagPb = require('ipld-dag-pb')
@@ -96,7 +97,7 @@ class IPLDResolver {
* @param {ResolveOptions} [options]
*/
resolve (cid, path, options) {
- if (!CID.isCID(cid)) {
+ if (!CID.isCID(cid) && newCID.asCID(cid) == null) {
throw new Error('`cid` argument must be a CID')
}
if (typeof path !== 'string') {
@@ -108,7 +109,7 @@ class IPLDResolver {
const generator = async function * () {
// End iteration if there isn't a CID to follow any more
while (true) {
- const format = await ipld.getFormat(multicodec.getCodeFromName(cid.codec))
+ const format = await ipld.getFormat(cid.code ?? multicodec.getCodeFromName(cid.codec))

// get block
// use local resolver
@@ -153,7 +154,7 @@ class IPLDResolver {
*/
async get (cid, options) {
const block = await this.bs.get(cid, options)
- const format = await this.getFormat(block.cid.codec)
+ const format = await this.getFormat(block.cid.code ?? block.cid.codec)
const node = format.util.deserialize(block.data)

return node
@@ -332,7 +333,7 @@ class IPLDResolver {
*/
const maybeRecurse = async (block, treePath) => {
// A treepath we might want to follow recursively
- const format = await this.getFormat(multicodec.getCodeFromName(block.cid.codec))
+ const format = await this.getFormat(multicodec.getCodeFromName(block.cid.code ?? block.cid.codec))
const result = format.resolver.resolve(block.data, treePath)
// Something to follow recursively, hence push it into the queue
if (CID.isCID(result.value)) {
Loading