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: support dag-json #319

Merged
merged 3 commits into from
May 16, 2022
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
44 changes: 44 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@
"dependencies": {
"@babel/cli": "^7.13.14",
"@ipld/car": "^4.1.0",
"@ipld/dag-json": "^8.0.9",
"@loadable/component": "^5.14.1",
"@tableflip/react-inspector": "^2.3.0",
"blockcodec-to-ipld-format": "^2.0.0",
"cytoscape": "^3.18.1",
"cytoscape-dagre": "^2.3.2",
"filesize": "^6.1.0",
Expand Down
6 changes: 6 additions & 0 deletions src/bundles/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import resolveIpldPath from '../lib/resolve-ipld-path'
import parseIpldPath from '../lib/parse-ipld-path'
import { CID } from 'multiformats/cid'
import Cid from 'cids'
import { convert } from 'blockcodec-to-ipld-format'

// Find all the nodes and path boundaries traversed along a given path
const makeBundle = () => {
Expand Down Expand Up @@ -194,6 +195,11 @@ async function getIpld () {
// ipldEthereum is an Object, each key points to a ipld format impl
const ipldEthereum = formats.pop()
formats.push(...Object.values(ipldEthereum))

// ipldJson uses the new format, use the conversion tool
const ipldJson = await import(/* webpackChunkName: "ipld" */ '@ipld/dag-json')
formats.push(convert(ipldJson))

return { ipld, formats }
}

Expand Down