Intro
Installable via npm install --save ipld-zcash
, it can also be used directly in the browser.
Download
The source is available for download from GitHub. Alternatively, you can install using npm:
$ npm install --save ipld-zcash
You can then require()
ipld-zcash as normal:
const ipldZcash = require('ipld-zcash')
In the Browser
Ipld-zcash should work in any ES2015 environment out of the box.
Usage:
<script type="text/javascript" src="index.js"></script>
The portable versions of ipld-zcash, including index.js
and index.min.js
, are included in the /dist
folder. Ipld-zcash can also be found on unkpkg.com under
ResolveCallback
Parameters
error: Error?
:Error if path can't be resolved
resolve
Resolves a path in a Zcash block.
Returns the value or a link and the partial mising path. This way the IPLD Resolver can fetch the link and continue to resolve.
Parameters
binaryBlob: Buffer
:Binary representation of a Zcash blockpath: string (='/')
:Path that should be resolvedcallback: ResolveCallback
:Callback that handles the return value
Returns
void
tree
Return all available paths of a block.
Parameters
binaryBlob: Buffer
:Binary representation of a Zcash blockoptions: Object?
:Possible optionsoptions.values: boolean (=false)
:Retun only the paths by default. If it istrue
also return the valuescallback: TreeCallback
:Callback that handles the return value
Returns
void
serialize
Serialize internal representation into a binary Zcash block.
Parameters
dagNode: ZcashBlock
:Internal representation of a Zcash blockcallback: SerializeCallback
:Callback that handles the return value
Returns
void
DeserializeCallback
Parameters
error: Error?
:Error if deserialization faileddagNode: ZcashBlock?
:Internal representation of a Zcash block if deserialization was successful
deserialize
Deserialize Zcash block into the internal representation,
Parameters
binaryBlob: Buffer
:Binary representation of a Zcash blockcallback: DeserializeCallback
:Callback that handles the return value
Returns
void
CidCallback
Parameters
error: Error?
:Error if getting the CID failedcid: CID?
:CID if call was successful
cid
Get the CID of the DAG-Node.
Parameters
dagNode: ZcashBlock
:Internal representation of a Zcash blockoptions: Object?
:Options to create the CIDoptions.version: number (=1)
:CID version numberoptions.hashAlg: string (='dbl-sha2-256')
:Hashing algorithmcallback: CidCallback
:Callback that handles the return value
Returns
void