This repository has been archived by the owner on Aug 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: pass in IPLD Formats into the constructor
Instead of having IPLD using all currently available [IPLD Format] implementations automatically, pass the Formats that should be used into the constructor as options. This will also decrease the bundle size as every user of IPLD can decide which IPLD Formats should be used. By default [ipld-dag-cbor] and [ipld-dag-pb] are used as those are the ones also heavily used within the IPFS ecosystem. BREAKING CHANGE: Not all IPLD Formats are included by default By default only the [ipld-dag-cbor], [ipld-dag-pb] and [raw] [IPLD Format]s are included. If you want to use other IPLD Formats you need to pass them into the constructor. The code to restore the old behaviour could look like this: ```js const ipldBitcoin = require('ipld-bitcoin') const ipldDagCbor = require('ipld-dag-cbor') const ipldDagPb = require('ipld-dag-pb') const ipldEthAccountSnapshot = require('ipld-ethereum').ethAccountSnapshot const ipldEthBlock = require('ipld-ethereum').ethBlock const ipldEthBlockList = require('ipld-ethereum').ethBlockList const ipldEthStateTrie = require('ipld-ethereum').ethStateTrie const ipldEthStorageTrie = require('ipld-ethereum').ethStorageTrie const ipldEthTrie = require('ipld-ethereum').ethTxTrie const ipldEthTx = require('ipld-ethereum').ethTx const ipldGit = require('ipld-git') const ipldRaw = require('ipld-raw') const ipldZcash = require('ipld-zcash') … const ipld = new Ipld({ blockService: blockService, formats: [ ipldBitcoin, ipldDagCbor, ipldDagPb, ipldEthAccountSnapshot, ipldEthBlock, ipldEthBlockList, ipldEthStateTrie, ipldEthStorageTrie, ipldEthTrie, ipldEthTx, ipldGit, ipldRaw, ipldZcash ] }) ``` [ipld-dag-cbor]: https://github.com/ipld/js-ipld-dag-cbor [ipld-dag-pb]: https://github.com/ipld/js-ipld-dag-pb [ipld-raw]: https://github.com/ipld/js-ipld-raw [IPLD Format]: https://github.com/ipld/interface-ipld-format
- Loading branch information
Showing
8 changed files
with
80 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters