Skip to content

Commit 508dc6a

Browse files
committed
Add HuffmanTapTreeNode interface
1 parent b87d9bc commit 508dc6a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/types.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ export declare function isTapleaf(o: any): o is Tapleaf;
2626
* The tree has no balancing requirements.
2727
*/
2828
export type Taptree = [Taptree | Tapleaf, Taptree | Tapleaf] | Tapleaf;
29+
export interface HuffmanTapTreeNode {
30+
/**
31+
* weight is the sum of the weight of all children under this node
32+
*/
33+
weight: number;
34+
node: Taptree;
35+
}
2936
export declare function isTaptree(scriptTree: any): scriptTree is Taptree;
3037
export interface TinySecp256k1Interface {
3138
isXOnlyPoint(p: Uint8Array): boolean;

ts_src/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ export function isTapleaf(o: any): o is Tapleaf {
9393
*/
9494
export type Taptree = [Taptree | Tapleaf, Taptree | Tapleaf] | Tapleaf;
9595

96+
export interface HuffmanTapTreeNode {
97+
/**
98+
* weight is the sum of the weight of all children under this node
99+
*/
100+
weight: number;
101+
node: Taptree;
102+
}
103+
96104
export function isTaptree(scriptTree: any): scriptTree is Taptree {
97105
if (!Array(scriptTree)) return isTapleaf(scriptTree);
98106
if (scriptTree.length !== 2) return false;

0 commit comments

Comments
 (0)