liquidjs-lib
Advanced tools
Comparing version 6.0.2-liquid.6 to 6.0.2-liquid.7
{ | ||
"name": "liquidjs-lib", | ||
"version": "6.0.2-liquid.6", | ||
"version": "6.0.2-liquid.7", | ||
"description": "Client-side Liquid JavaScript library", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -31,3 +31,3 @@ /// <reference types="node" /> | ||
export declare function tapLeafHash(leaf: TaprootLeaf): Buffer; | ||
export declare function toHashTree(leaves: TaprootLeaf[]): HashTree; | ||
export declare function toHashTree(leaves: TaprootLeaf[], withScriptHex?: boolean): HashTree; | ||
/** | ||
@@ -34,0 +34,0 @@ * Given a MAST tree, it finds the path of a particular hash. |
@@ -29,3 +29,3 @@ 'use strict'; | ||
// recursively build the Taproot tree from a ScriptTree structure | ||
function toHashTree(leaves) { | ||
function toHashTree(leaves, withScriptHex = false) { | ||
switch (leaves.length) { | ||
@@ -42,2 +42,3 @@ case 0: | ||
hash: tapLeafHash(leaf), | ||
scriptHex: withScriptHex ? leaf.scriptHex : undefined, | ||
}; | ||
@@ -47,4 +48,4 @@ default: | ||
const middleIndex = Math.ceil(leaves.length / 2); | ||
const left = toHashTree(leaves.slice(0, middleIndex)); | ||
const right = toHashTree(leaves.slice(middleIndex)); | ||
const left = toHashTree(leaves.slice(0, middleIndex), withScriptHex); | ||
const right = toHashTree(leaves.slice(middleIndex), withScriptHex); | ||
let leftHash = left.hash; | ||
@@ -51,0 +52,0 @@ let rightHash = right.hash; |
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
283411
8266