merkletreejs
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -80,2 +80,3 @@ interface Options { | ||
getRoot(): any; | ||
getHexRoot(): string; | ||
/** | ||
@@ -102,2 +103,3 @@ * getProof | ||
getProof(leaf: any, index?: any): any[]; | ||
getHexProof(leaf: any, index?: any): string[]; | ||
/** | ||
@@ -104,0 +106,0 @@ * verify |
@@ -138,2 +138,6 @@ "use strict"; | ||
}; | ||
// TODO: documentation | ||
MerkleTree.prototype.getHexRoot = function () { | ||
return bufferToHex(this.getRoot()); | ||
}; | ||
/** | ||
@@ -208,2 +212,6 @@ * getProof | ||
}; | ||
// TODO: documentation | ||
MerkleTree.prototype.getHexProof = function (leaf, index) { | ||
return this.getProof(leaf, index).map(function (x) { return bufferToHex(x.data); }); | ||
}; | ||
/** | ||
@@ -314,2 +322,5 @@ * verify | ||
exports.MerkleTree = MerkleTree; | ||
function bufferToHex(value) { | ||
return '0x' + value.toString('hex'); | ||
} | ||
function bufferify(x) { | ||
@@ -316,0 +327,0 @@ if (!Buffer.isBuffer(x)) { |
14
index.ts
@@ -179,2 +179,7 @@ import * as reverse from 'buffer-reverse' | ||
// TODO: documentation | ||
getHexRoot() { | ||
return bufferToHex(this.getRoot()) | ||
} | ||
/** | ||
@@ -263,2 +268,7 @@ * getProof | ||
// TODO: documentation | ||
getHexProof(leaf, index?) { | ||
return this.getProof(leaf, index).map(x => bufferToHex(x.data)) | ||
} | ||
/** | ||
@@ -380,2 +390,6 @@ * verify | ||
function bufferToHex(value:Buffer) { | ||
return '0x'+value.toString('hex') | ||
} | ||
function bufferify(x) { | ||
@@ -382,0 +396,0 @@ if (!Buffer.isBuffer(x)) { |
{ | ||
"name": "merkletreejs", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Construct Merkle Trees and verify proofs", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63599
881