Skip to content

Commit

Permalink
feat: support dag-json (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed May 16, 2022
1 parent e2788d9 commit b39886b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
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
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
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

0 comments on commit b39886b

Please sign in to comment.