This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+ const mergeOptions = require ( 'merge-options' )
3
+
4
+ module . exports = ( blockService , options = { } ) => {
5
+ return mergeOptions ( {
6
+ blockService : blockService
7
+ } , options )
8
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+ const mergeOptions = require ( 'merge-options' )
3
+
4
+ // All known (non-default) IPLD formats
5
+ const IpldFormats = {
6
+ get 'bitcoin-block' ( ) {
7
+ return require ( 'ipld-bitcoin' )
8
+ } ,
9
+ get 'eth-account-snapshot' ( ) {
10
+ return require ( 'ipld-ethereum' ) . ethAccountSnapshot
11
+ } ,
12
+ get 'eth-block' ( ) {
13
+ return require ( 'ipld-ethereum' ) . ethBlock
14
+ } ,
15
+ get 'eth-block-list' ( ) {
16
+ return require ( 'ipld-ethereum' ) . ethBlockList
17
+ } ,
18
+ get 'eth-state-trie' ( ) {
19
+ return require ( 'ipld-ethereum' ) . ethStateTrie
20
+ } ,
21
+ get 'eth-storage-trie' ( ) {
22
+ return require ( 'ipld-ethereum' ) . ethStorageTrie
23
+ } ,
24
+ get 'eth-tx' ( ) {
25
+ return require ( 'ipld-ethereum' ) . ethTx
26
+ } ,
27
+ get 'eth-tx-trie' ( ) {
28
+ return require ( 'ipld-ethereum' ) . ethTxTrie
29
+ } ,
30
+ get 'git-raw' ( ) {
31
+ return require ( 'ipld-git' )
32
+ } ,
33
+ get 'zcash-block' ( ) {
34
+ return require ( 'ipld-zcash' )
35
+ }
36
+ }
37
+
38
+ module . exports = ( blockService , options = { } ) => {
39
+ return mergeOptions ( {
40
+ blockService : blockService ,
41
+ loadFormat : ( codec , callback ) => {
42
+ this . log ( 'Loading IPLD format' , codec )
43
+ if ( IpldFormats [ codec ] ) return callback ( null , IpldFormats [ codec ] )
44
+ callback ( new Error ( `Missing IPLD format "${ codec } "` ) )
45
+ }
46
+ } , options )
47
+ }
You can’t perform that action at this time.
0 commit comments