Skip to content

Commit 1b96e6d

Browse files
committed
feat: add scriptsTree field to Payment interface; export p2tr
1 parent 583174d commit 1b96e6d

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/payments/index.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { p2pkh } from './p2pkh';
77
import { p2sh } from './p2sh';
88
import { p2wpkh } from './p2wpkh';
99
import { p2wsh } from './p2wsh';
10+
import { p2tr } from './p2tr';
1011
export interface Payment {
1112
name?: string;
1213
network?: Network;
@@ -23,7 +24,7 @@ export interface Payment {
2324
address?: string;
2425
hash?: Buffer;
2526
redeem?: Payment;
26-
redeems?: Payment;
27+
scriptsTree?: any;
2728
witness?: Buffer[];
2829
}
2930
export declare type PaymentCreator = (a: Payment, opts?: PaymentOpts) => Payment;
@@ -35,4 +36,4 @@ export interface PaymentOpts {
3536
export declare type StackElement = Buffer | number;
3637
export declare type Stack = StackElement[];
3738
export declare type StackFunction = () => Stack;
38-
export { embed, p2ms, p2pk, p2pkh, p2sh, p2wpkh, p2wsh };
39+
export { embed, p2ms, p2pk, p2pkh, p2sh, p2wpkh, p2wsh, p2tr };

src/payments/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
Object.defineProperty(exports, '__esModule', { value: true });
3-
exports.p2wsh = exports.p2wpkh = exports.p2sh = exports.p2pkh = exports.p2pk = exports.p2ms = exports.embed = void 0;
3+
exports.p2tr = exports.p2wsh = exports.p2wpkh = exports.p2sh = exports.p2pkh = exports.p2pk = exports.p2ms = exports.embed = void 0;
44
const embed_1 = require('./embed');
55
Object.defineProperty(exports, 'embed', {
66
enumerable: true,
@@ -50,5 +50,12 @@ Object.defineProperty(exports, 'p2wsh', {
5050
return p2wsh_1.p2wsh;
5151
},
5252
});
53+
const p2tr_1 = require('./p2tr');
54+
Object.defineProperty(exports, 'p2tr', {
55+
enumerable: true,
56+
get: function() {
57+
return p2tr_1.p2tr;
58+
},
59+
});
5360
// TODO
5461
// witness commitment

ts_src/payments/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { p2pkh } from './p2pkh';
66
import { p2sh } from './p2sh';
77
import { p2wpkh } from './p2wpkh';
88
import { p2wsh } from './p2wsh';
9+
import { p2tr } from './p2tr';
910

1011
export interface Payment {
1112
name?: string;
@@ -23,7 +24,7 @@ export interface Payment {
2324
address?: string; // taproot: betch32m
2425
hash?: Buffer; // taproot: MAST root
2526
redeem?: Payment; // taproot: when script path spending is used spending
26-
redeems?: Payment; // taproot can have more than one redeem script
27+
scriptsTree?: any // todo: solve
2728
witness?: Buffer[];
2829
}
2930

@@ -40,7 +41,7 @@ export type StackElement = Buffer | number;
4041
export type Stack = StackElement[];
4142
export type StackFunction = () => Stack;
4243

43-
export { embed, p2ms, p2pk, p2pkh, p2sh, p2wpkh, p2wsh };
44+
export { embed, p2ms, p2pk, p2pkh, p2sh, p2wpkh, p2wsh, p2tr };
4445

4546
// TODO
4647
// witness commitment

0 commit comments

Comments
 (0)