This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 2 files changed +6
-14
lines changed
examples/traverse-ipld-graphs
2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change 3
3
const createNode = require ( './create-node' )
4
4
const path = require ( 'path' )
5
5
const { CID } = require ( 'multiformats/cid' )
6
- const MultihashDigest = require ( 'multiformats/hashes/digest' )
7
6
const fs = require ( 'fs' ) . promises
8
7
const uint8ArrayToString = require ( 'uint8arrays/to-string' )
9
8
const { convert } = require ( 'ipld-format-to-blockcodec' )
10
- const sha3 = require ( 'js- sha3' )
9
+ const { keccak256 } = require ( '@multiformats/ sha3' )
11
10
12
11
async function main ( ) {
13
12
const ipfs = await createNode ( {
14
13
ipld : {
15
14
codecs : [
16
15
...Object . values ( require ( 'ipld-ethereum' ) ) . map ( format => convert ( format ) )
17
16
] ,
18
- hashers : [ {
19
- name : 'keccak-256' ,
20
- code : 0x1b ,
21
- digest : async ( buf ) => {
22
- return MultihashDigest . create (
23
- 0x1b ,
24
- new Uint8Array ( sha3 . keccak256 . arrayBuffer ( buf ) )
25
- )
26
- }
27
- } ]
17
+ hashers : [
18
+ keccak256
19
+ ]
28
20
}
29
21
} )
30
22
Original file line number Diff line number Diff line change 13
13
"test-ipfs-example" : " ^3.0.0"
14
14
},
15
15
"dependencies" : {
16
+ "@multiformats/sha3" : " ^2.0.0" ,
16
17
"ipfs" : " ^0.56.0" ,
17
18
"ipld-ethereum" : " ^6.0.0" ,
18
19
"ipld-format-to-blockcodec" : " 0.0.1" ,
19
- "ipld-git" : " ^0.6.1" ,
20
- "js-sha3" : " ^0.8.0"
20
+ "ipld-git" : " ^0.6.1"
21
21
}
22
22
}
You can’t perform that action at this time.
0 commit comments