Added TypeScript declaration file
This commit is contained in:
parent
2815920acf
commit
f1f5d95e71
|
@ -0,0 +1,23 @@
|
|||
declare module 'merkletreejs' {
|
||||
interface IOptions {
|
||||
isBitcoinTree: boolean
|
||||
}
|
||||
|
||||
interface IProof {
|
||||
position: 'left' | 'right'
|
||||
data: Buffer
|
||||
}
|
||||
|
||||
export default class MerkleTree {
|
||||
getRoot: () => Buffer
|
||||
getLeaves: () => Buffer[]
|
||||
getLayers: () => Buffer[]
|
||||
getProof: (leaf: Buffer, index?: number) => IProof[]
|
||||
verify: (proof: IProof[], targetNode: Buffer, root: Buffer) => boolean
|
||||
constructor(
|
||||
leaves: Buffer[],
|
||||
hashAlgorithm: (data: any) => Buffer,
|
||||
options?: IOptions
|
||||
)
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
"version": "0.0.10",
|
||||
"description": "Construct Merkle Trees and verify proofs",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"test": "tape test/*.js",
|
||||
"docs:md": "node jsdoc.js"
|
||||
|
|
Loading…
Reference in New Issue