@btc-vision/bitcoin 6.4.2 → 6.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.js +1 -1
- package/browser/payments/embed.d.ts +2 -2
- package/browser/payments/index.d.ts +58 -13
- package/browser/payments/lazy.d.ts +1 -1
- package/browser/payments/p2ms.d.ts +2 -2
- package/browser/payments/p2op.d.ts +25 -2
- package/browser/payments/p2pk.d.ts +2 -2
- package/browser/payments/p2pkh.d.ts +2 -2
- package/browser/payments/p2sh.d.ts +2 -2
- package/browser/payments/p2tr.d.ts +2 -2
- package/browser/payments/p2wpkh.d.ts +2 -2
- package/browser/payments/p2wsh.d.ts +2 -2
- package/build/address.js +0 -1
- package/build/payments/embed.d.ts +2 -2
- package/build/payments/embed.js +6 -2
- package/build/payments/index.d.ts +58 -13
- package/build/payments/lazy.d.ts +1 -1
- package/build/payments/p2ms.d.ts +2 -2
- package/build/payments/p2ms.js +8 -2
- package/build/payments/p2op.d.ts +25 -2
- package/build/payments/p2op.js +5 -1
- package/build/payments/p2pk.d.ts +2 -2
- package/build/payments/p2pk.js +5 -1
- package/build/payments/p2pkh.d.ts +2 -2
- package/build/payments/p2pkh.js +5 -1
- package/build/payments/p2sh.d.ts +2 -2
- package/build/payments/p2sh.js +5 -1
- package/build/payments/p2tr.d.ts +2 -2
- package/build/payments/p2tr.js +5 -2
- package/build/payments/p2wpkh.d.ts +2 -2
- package/build/payments/p2wpkh.js +5 -1
- package/build/payments/p2wsh.d.ts +2 -2
- package/build/payments/p2wsh.js +5 -1
- package/build/psbt.js +3 -1
- package/package.json +1 -1
- package/src/address.ts +283 -284
- package/src/payments/embed.ts +61 -55
- package/src/payments/index.ts +159 -68
- package/src/payments/lazy.ts +28 -28
- package/src/payments/p2ms.ts +11 -5
- package/src/payments/p2op.ts +170 -136
- package/src/payments/p2pk.ts +93 -85
- package/src/payments/p2pkh.ts +214 -210
- package/src/payments/p2sh.ts +211 -206
- package/src/payments/p2tr.ts +9 -4
- package/src/payments/p2wpkh.ts +7 -3
- package/src/payments/p2wsh.ts +7 -3
- package/src/psbt.ts +5 -3
- package/test/payments.spec.ts +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2data(a:
|
|
1
|
+
import { EmbedPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2data(a: Omit<EmbedPayment, 'name'>, opts?: PaymentOpts): EmbedPayment;
|
|
@@ -11,33 +11,78 @@ export * from './p2tr.js';
|
|
|
11
11
|
export * from './p2wpkh.js';
|
|
12
12
|
export * from './p2wsh.js';
|
|
13
13
|
export * from './p2op.js';
|
|
14
|
-
export interface
|
|
14
|
+
export interface BasePayment {
|
|
15
15
|
name?: string;
|
|
16
16
|
network?: Network;
|
|
17
17
|
output?: Buffer;
|
|
18
|
-
|
|
18
|
+
input?: Buffer;
|
|
19
|
+
address?: string;
|
|
20
|
+
witness?: Buffer[];
|
|
21
|
+
redeem?: ScriptRedeem;
|
|
22
|
+
useHybrid?: boolean;
|
|
23
|
+
useUncompressed?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ScriptRedeem extends BasePayment {
|
|
26
|
+
output?: Buffer;
|
|
27
|
+
redeemVersion?: number;
|
|
28
|
+
network?: Network;
|
|
29
|
+
}
|
|
30
|
+
export interface P2PKPayment extends BasePayment {
|
|
31
|
+
name: 'p2pk';
|
|
32
|
+
pubkey?: Buffer;
|
|
33
|
+
signature?: Buffer;
|
|
34
|
+
}
|
|
35
|
+
export interface P2PKHPayment extends BasePayment {
|
|
36
|
+
name: 'p2pkh';
|
|
37
|
+
hash?: Buffer;
|
|
38
|
+
pubkey?: Buffer;
|
|
39
|
+
signature?: Buffer;
|
|
40
|
+
}
|
|
41
|
+
export interface P2SHPayment extends BasePayment {
|
|
42
|
+
name: 'p2sh';
|
|
43
|
+
hash?: Buffer;
|
|
44
|
+
signatures?: Buffer[];
|
|
45
|
+
}
|
|
46
|
+
export interface P2MSPayment extends BasePayment {
|
|
47
|
+
name: 'p2ms';
|
|
19
48
|
m?: number;
|
|
20
49
|
n?: number;
|
|
21
50
|
pubkeys?: Buffer[];
|
|
22
|
-
input?: Buffer;
|
|
23
51
|
signatures?: Buffer[];
|
|
24
|
-
|
|
52
|
+
}
|
|
53
|
+
export interface P2WPKHPayment extends BasePayment {
|
|
54
|
+
name: 'p2wpkh';
|
|
55
|
+
hash?: Buffer;
|
|
25
56
|
pubkey?: Buffer;
|
|
26
57
|
signature?: Buffer;
|
|
27
|
-
|
|
58
|
+
}
|
|
59
|
+
export interface P2WSHPayment extends BasePayment {
|
|
60
|
+
name: 'p2wsh';
|
|
61
|
+
hash?: Buffer;
|
|
62
|
+
redeem?: ScriptRedeem;
|
|
63
|
+
}
|
|
64
|
+
export interface P2TRPayment extends BasePayment {
|
|
65
|
+
name: 'p2tr';
|
|
66
|
+
pubkey?: Buffer;
|
|
67
|
+
internalPubkey?: Buffer;
|
|
28
68
|
hash?: Buffer;
|
|
29
|
-
redeem?: Payment;
|
|
30
|
-
redeemVersion?: number;
|
|
31
69
|
scriptTree?: Taptree;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
70
|
+
signature?: Buffer;
|
|
71
|
+
redeemVersion?: number;
|
|
72
|
+
redeem?: ScriptRedeem;
|
|
73
|
+
}
|
|
74
|
+
export interface P2OPPayment extends BasePayment {
|
|
75
|
+
name: 'p2op';
|
|
35
76
|
program?: Buffer;
|
|
36
|
-
deploymentVersion
|
|
77
|
+
deploymentVersion: number | undefined;
|
|
37
78
|
hash160?: Buffer;
|
|
38
79
|
}
|
|
39
|
-
export
|
|
40
|
-
|
|
80
|
+
export interface EmbedPayment extends BasePayment {
|
|
81
|
+
name: 'embed';
|
|
82
|
+
data: Buffer[];
|
|
83
|
+
}
|
|
84
|
+
export type Payment = P2PKPayment | P2PKHPayment | P2SHPayment | P2MSPayment | P2WPKHPayment | P2WSHPayment | P2TRPayment | P2OPPayment | EmbedPayment | ScriptRedeem;
|
|
85
|
+
export type PaymentCreator = <T extends BasePayment>(a: T, opts?: PaymentOpts) => T;
|
|
41
86
|
export interface PaymentOpts {
|
|
42
87
|
validate?: boolean;
|
|
43
88
|
allowIncomplete?: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function prop(object:
|
|
1
|
+
export declare function prop<T extends {}>(object: T, name: string, f: () => T[keyof T]): void;
|
|
2
2
|
export declare function value<T>(f: () => T): () => T;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2ms(a:
|
|
1
|
+
import { P2MSPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2ms(a: Omit<P2MSPayment, 'name'>, opts?: PaymentOpts): P2MSPayment;
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { BasePayment, P2OPPayment, PaymentOpts } from './index.js';
|
|
2
|
+
interface P2OPBase extends BasePayment {
|
|
3
|
+
name: 'p2op';
|
|
4
|
+
}
|
|
5
|
+
interface P2OP_fromOutput extends P2OPBase {
|
|
6
|
+
output: Buffer;
|
|
7
|
+
program?: undefined;
|
|
8
|
+
deploymentVersion?: undefined;
|
|
9
|
+
hash160?: undefined;
|
|
10
|
+
}
|
|
11
|
+
interface P2OP_fromProgram extends P2OPBase {
|
|
12
|
+
program: Buffer;
|
|
13
|
+
output?: undefined;
|
|
14
|
+
deploymentVersion?: never;
|
|
15
|
+
hash160?: never;
|
|
16
|
+
}
|
|
17
|
+
interface P2OP_fromParts extends P2OPBase {
|
|
18
|
+
deploymentVersion: number;
|
|
19
|
+
hash160: Buffer;
|
|
20
|
+
output?: undefined;
|
|
21
|
+
program?: undefined;
|
|
22
|
+
}
|
|
23
|
+
export type P2OPPaymentParams = P2OP_fromOutput | P2OP_fromProgram | P2OP_fromParts;
|
|
24
|
+
export declare function p2op(a: Omit<P2OPPaymentParams, 'name'>, opts?: PaymentOpts): P2OPPayment;
|
|
25
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2pk(a:
|
|
1
|
+
import { P2PKPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2pk(a: Omit<P2PKPayment, 'name'>, opts?: PaymentOpts): P2PKPayment;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2pkh(a:
|
|
1
|
+
import { P2PKHPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2pkh(a: Omit<P2PKHPayment, 'name'>, opts?: PaymentOpts): P2PKHPayment;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2sh(a:
|
|
1
|
+
import { P2SHPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2sh(a: Omit<P2SHPayment, 'name'>, opts?: PaymentOpts): P2SHPayment;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2tr(a:
|
|
1
|
+
import { P2TRPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2tr(a: Omit<P2TRPayment, 'name'>, opts?: PaymentOpts): P2TRPayment;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2wpkh(a:
|
|
1
|
+
import { P2WPKHPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2wpkh(a: Omit<P2WPKHPayment, 'name'>, opts?: PaymentOpts): P2WPKHPayment;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2wsh(a:
|
|
1
|
+
import { P2WSHPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2wsh(a: Omit<P2WSHPayment, 'name'>, opts?: PaymentOpts): P2WSHPayment;
|
package/build/address.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2data(a:
|
|
1
|
+
import { EmbedPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2data(a: Omit<EmbedPayment, 'name'>, opts?: PaymentOpts): EmbedPayment;
|
package/build/payments/embed.js
CHANGED
|
@@ -13,7 +13,7 @@ export function p2data(a, opts) {
|
|
|
13
13
|
data: typef.maybe(typef.arrayOf(typef.Buffer)),
|
|
14
14
|
}, a);
|
|
15
15
|
const network = a.network || BITCOIN_NETWORK;
|
|
16
|
-
const o = { name: 'embed', network };
|
|
16
|
+
const o = { name: 'embed', network, data: [] };
|
|
17
17
|
lazy.prop(o, 'output', () => {
|
|
18
18
|
if (!a.data)
|
|
19
19
|
return;
|
|
@@ -22,7 +22,11 @@ export function p2data(a, opts) {
|
|
|
22
22
|
lazy.prop(o, 'data', () => {
|
|
23
23
|
if (!a.output)
|
|
24
24
|
return;
|
|
25
|
-
|
|
25
|
+
const script = bscript.decompile(a.output);
|
|
26
|
+
if (script === null || script === undefined) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
return script.slice(1);
|
|
26
30
|
});
|
|
27
31
|
if (opts.validate) {
|
|
28
32
|
if (a.output) {
|
|
@@ -11,33 +11,78 @@ export * from './p2tr.js';
|
|
|
11
11
|
export * from './p2wpkh.js';
|
|
12
12
|
export * from './p2wsh.js';
|
|
13
13
|
export * from './p2op.js';
|
|
14
|
-
export interface
|
|
14
|
+
export interface BasePayment {
|
|
15
15
|
name?: string;
|
|
16
16
|
network?: Network;
|
|
17
17
|
output?: Buffer;
|
|
18
|
-
|
|
18
|
+
input?: Buffer;
|
|
19
|
+
address?: string;
|
|
20
|
+
witness?: Buffer[];
|
|
21
|
+
redeem?: ScriptRedeem;
|
|
22
|
+
useHybrid?: boolean;
|
|
23
|
+
useUncompressed?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ScriptRedeem extends BasePayment {
|
|
26
|
+
output?: Buffer;
|
|
27
|
+
redeemVersion?: number;
|
|
28
|
+
network?: Network;
|
|
29
|
+
}
|
|
30
|
+
export interface P2PKPayment extends BasePayment {
|
|
31
|
+
name: 'p2pk';
|
|
32
|
+
pubkey?: Buffer;
|
|
33
|
+
signature?: Buffer;
|
|
34
|
+
}
|
|
35
|
+
export interface P2PKHPayment extends BasePayment {
|
|
36
|
+
name: 'p2pkh';
|
|
37
|
+
hash?: Buffer;
|
|
38
|
+
pubkey?: Buffer;
|
|
39
|
+
signature?: Buffer;
|
|
40
|
+
}
|
|
41
|
+
export interface P2SHPayment extends BasePayment {
|
|
42
|
+
name: 'p2sh';
|
|
43
|
+
hash?: Buffer;
|
|
44
|
+
signatures?: Buffer[];
|
|
45
|
+
}
|
|
46
|
+
export interface P2MSPayment extends BasePayment {
|
|
47
|
+
name: 'p2ms';
|
|
19
48
|
m?: number;
|
|
20
49
|
n?: number;
|
|
21
50
|
pubkeys?: Buffer[];
|
|
22
|
-
input?: Buffer;
|
|
23
51
|
signatures?: Buffer[];
|
|
24
|
-
|
|
52
|
+
}
|
|
53
|
+
export interface P2WPKHPayment extends BasePayment {
|
|
54
|
+
name: 'p2wpkh';
|
|
55
|
+
hash?: Buffer;
|
|
25
56
|
pubkey?: Buffer;
|
|
26
57
|
signature?: Buffer;
|
|
27
|
-
|
|
58
|
+
}
|
|
59
|
+
export interface P2WSHPayment extends BasePayment {
|
|
60
|
+
name: 'p2wsh';
|
|
61
|
+
hash?: Buffer;
|
|
62
|
+
redeem?: ScriptRedeem;
|
|
63
|
+
}
|
|
64
|
+
export interface P2TRPayment extends BasePayment {
|
|
65
|
+
name: 'p2tr';
|
|
66
|
+
pubkey?: Buffer;
|
|
67
|
+
internalPubkey?: Buffer;
|
|
28
68
|
hash?: Buffer;
|
|
29
|
-
redeem?: Payment;
|
|
30
|
-
redeemVersion?: number;
|
|
31
69
|
scriptTree?: Taptree;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
70
|
+
signature?: Buffer;
|
|
71
|
+
redeemVersion?: number;
|
|
72
|
+
redeem?: ScriptRedeem;
|
|
73
|
+
}
|
|
74
|
+
export interface P2OPPayment extends BasePayment {
|
|
75
|
+
name: 'p2op';
|
|
35
76
|
program?: Buffer;
|
|
36
|
-
deploymentVersion
|
|
77
|
+
deploymentVersion: number | undefined;
|
|
37
78
|
hash160?: Buffer;
|
|
38
79
|
}
|
|
39
|
-
export
|
|
40
|
-
|
|
80
|
+
export interface EmbedPayment extends BasePayment {
|
|
81
|
+
name: 'embed';
|
|
82
|
+
data: Buffer[];
|
|
83
|
+
}
|
|
84
|
+
export type Payment = P2PKPayment | P2PKHPayment | P2SHPayment | P2MSPayment | P2WPKHPayment | P2WSHPayment | P2TRPayment | P2OPPayment | EmbedPayment | ScriptRedeem;
|
|
85
|
+
export type PaymentCreator = <T extends BasePayment>(a: T, opts?: PaymentOpts) => T;
|
|
41
86
|
export interface PaymentOpts {
|
|
42
87
|
validate?: boolean;
|
|
43
88
|
allowIncomplete?: boolean;
|
package/build/payments/lazy.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function prop(object:
|
|
1
|
+
export declare function prop<T extends {}>(object: T, name: string, f: () => T[keyof T]): void;
|
|
2
2
|
export declare function value<T>(f: () => T): () => T;
|
package/build/payments/p2ms.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2ms(a:
|
|
1
|
+
import { P2MSPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2ms(a: Omit<P2MSPayment, 'name'>, opts?: PaymentOpts): P2MSPayment;
|
package/build/payments/p2ms.js
CHANGED
|
@@ -22,7 +22,10 @@ export function p2ms(a, opts) {
|
|
|
22
22
|
input: typef.maybe(typef.Buffer),
|
|
23
23
|
}, a);
|
|
24
24
|
const network = a.network || BITCOIN_NETWORK;
|
|
25
|
-
const o = {
|
|
25
|
+
const o = {
|
|
26
|
+
network,
|
|
27
|
+
name: 'p2ms',
|
|
28
|
+
};
|
|
26
29
|
let chunks = [];
|
|
27
30
|
let decoded = false;
|
|
28
31
|
function decode(output) {
|
|
@@ -63,7 +66,10 @@ export function p2ms(a, opts) {
|
|
|
63
66
|
lazy.prop(o, 'signatures', () => {
|
|
64
67
|
if (!a.input)
|
|
65
68
|
return;
|
|
66
|
-
|
|
69
|
+
const decompiled = bscript.decompile(a.input);
|
|
70
|
+
if (decompiled === null || decompiled === undefined)
|
|
71
|
+
return;
|
|
72
|
+
return decompiled.slice(1);
|
|
67
73
|
});
|
|
68
74
|
lazy.prop(o, 'input', () => {
|
|
69
75
|
if (!a.signatures)
|
package/build/payments/p2op.d.ts
CHANGED
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { BasePayment, P2OPPayment, PaymentOpts } from './index.js';
|
|
2
|
+
interface P2OPBase extends BasePayment {
|
|
3
|
+
name: 'p2op';
|
|
4
|
+
}
|
|
5
|
+
interface P2OP_fromOutput extends P2OPBase {
|
|
6
|
+
output: Buffer;
|
|
7
|
+
program?: undefined;
|
|
8
|
+
deploymentVersion?: undefined;
|
|
9
|
+
hash160?: undefined;
|
|
10
|
+
}
|
|
11
|
+
interface P2OP_fromProgram extends P2OPBase {
|
|
12
|
+
program: Buffer;
|
|
13
|
+
output?: undefined;
|
|
14
|
+
deploymentVersion?: never;
|
|
15
|
+
hash160?: never;
|
|
16
|
+
}
|
|
17
|
+
interface P2OP_fromParts extends P2OPBase {
|
|
18
|
+
deploymentVersion: number;
|
|
19
|
+
hash160: Buffer;
|
|
20
|
+
output?: undefined;
|
|
21
|
+
program?: undefined;
|
|
22
|
+
}
|
|
23
|
+
export type P2OPPaymentParams = P2OP_fromOutput | P2OP_fromProgram | P2OP_fromParts;
|
|
24
|
+
export declare function p2op(a: Omit<P2OPPaymentParams, 'name'>, opts?: PaymentOpts): P2OPPayment;
|
|
25
|
+
export {};
|
package/build/payments/p2op.js
CHANGED
|
@@ -23,7 +23,11 @@ export function p2op(a, opts) {
|
|
|
23
23
|
}, a);
|
|
24
24
|
const _address = lazy.value(() => fromBech32(a.address));
|
|
25
25
|
const network = a.network || BITCOIN_NETWORK;
|
|
26
|
-
const o = {
|
|
26
|
+
const o = {
|
|
27
|
+
name: 'p2op',
|
|
28
|
+
network,
|
|
29
|
+
deploymentVersion: 0,
|
|
30
|
+
};
|
|
27
31
|
lazy.prop(o, 'program', () => {
|
|
28
32
|
if (a.program)
|
|
29
33
|
return a.program;
|
package/build/payments/p2pk.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2pk(a:
|
|
1
|
+
import { P2PKPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2pk(a: Omit<P2PKPayment, 'name'>, opts?: PaymentOpts): P2PKPayment;
|
package/build/payments/p2pk.js
CHANGED
|
@@ -18,7 +18,11 @@ export function p2pk(a, opts) {
|
|
|
18
18
|
return bscript.decompile(a.input);
|
|
19
19
|
});
|
|
20
20
|
const network = a.network || BITCOIN_NETWORK;
|
|
21
|
-
const o = {
|
|
21
|
+
const o = {
|
|
22
|
+
name: 'p2pk',
|
|
23
|
+
network,
|
|
24
|
+
pubkey: undefined,
|
|
25
|
+
};
|
|
22
26
|
lazy.prop(o, 'output', () => {
|
|
23
27
|
if (!a.pubkey)
|
|
24
28
|
return;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2pkh(a:
|
|
1
|
+
import { P2PKHPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2pkh(a: Omit<P2PKHPayment, 'name'>, opts?: PaymentOpts): P2PKHPayment;
|
package/build/payments/p2pkh.js
CHANGED
|
@@ -30,7 +30,11 @@ export function p2pkh(a, opts) {
|
|
|
30
30
|
return bscript.decompile(a.input);
|
|
31
31
|
});
|
|
32
32
|
const network = a.network || BITCOIN_NETWORK;
|
|
33
|
-
const o = {
|
|
33
|
+
const o = {
|
|
34
|
+
name: 'p2pkh',
|
|
35
|
+
network,
|
|
36
|
+
hash: undefined,
|
|
37
|
+
};
|
|
34
38
|
lazy.prop(o, 'address', () => {
|
|
35
39
|
if (!o.hash)
|
|
36
40
|
return;
|
package/build/payments/p2sh.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2sh(a:
|
|
1
|
+
import { P2SHPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2sh(a: Omit<P2SHPayment, 'name'>, opts?: PaymentOpts): P2SHPayment;
|
package/build/payments/p2sh.js
CHANGED
|
@@ -28,7 +28,11 @@ export function p2sh(a, opts) {
|
|
|
28
28
|
if (!network) {
|
|
29
29
|
network = (a.redeem && a.redeem.network) || BITCOIN_NETWORK;
|
|
30
30
|
}
|
|
31
|
-
const o = {
|
|
31
|
+
const o = {
|
|
32
|
+
network,
|
|
33
|
+
name: 'p2sh',
|
|
34
|
+
hash: undefined,
|
|
35
|
+
};
|
|
32
36
|
const _address = lazy.value(() => {
|
|
33
37
|
const payload = Buffer.from(bs58check.default.decode(a.address));
|
|
34
38
|
const version = payload.readUInt8(0);
|
package/build/payments/p2tr.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2tr(a:
|
|
1
|
+
import { P2TRPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2tr(a: Omit<P2TRPayment, 'name'>, opts?: PaymentOpts): P2TRPayment;
|
package/build/payments/p2tr.js
CHANGED
|
@@ -55,7 +55,10 @@ export function p2tr(a, opts) {
|
|
|
55
55
|
return;
|
|
56
56
|
});
|
|
57
57
|
const network = a.network || BITCOIN_NETWORK;
|
|
58
|
-
const o = {
|
|
58
|
+
const o = {
|
|
59
|
+
name: 'p2tr',
|
|
60
|
+
network,
|
|
61
|
+
};
|
|
59
62
|
lazy.prop(o, 'address', () => {
|
|
60
63
|
if (!o.pubkey)
|
|
61
64
|
return;
|
|
@@ -78,7 +81,7 @@ export function p2tr(a, opts) {
|
|
|
78
81
|
});
|
|
79
82
|
return rootHashFromPath(controlBlock, leafHash);
|
|
80
83
|
}
|
|
81
|
-
return
|
|
84
|
+
return undefined;
|
|
82
85
|
});
|
|
83
86
|
lazy.prop(o, 'output', () => {
|
|
84
87
|
if (!o.pubkey)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2wpkh(a:
|
|
1
|
+
import { P2WPKHPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2wpkh(a: Omit<P2WPKHPayment, 'name'>, opts?: PaymentOpts): P2WPKHPayment;
|
package/build/payments/p2wpkh.js
CHANGED
|
@@ -31,7 +31,11 @@ export function p2wpkh(a, opts) {
|
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
33
|
const network = a.network || BITCOIN_NETWORK;
|
|
34
|
-
const o = {
|
|
34
|
+
const o = {
|
|
35
|
+
name: 'p2wpkh',
|
|
36
|
+
network,
|
|
37
|
+
hash: undefined,
|
|
38
|
+
};
|
|
35
39
|
lazy.prop(o, 'address', () => {
|
|
36
40
|
if (!o.hash)
|
|
37
41
|
return;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function p2wsh(a:
|
|
1
|
+
import { P2WSHPayment, PaymentOpts } from './index.js';
|
|
2
|
+
export declare function p2wsh(a: Omit<P2WSHPayment, 'name'>, opts?: PaymentOpts): P2WSHPayment;
|
package/build/payments/p2wsh.js
CHANGED
|
@@ -49,7 +49,11 @@ export function p2wsh(a, opts) {
|
|
|
49
49
|
if (!network) {
|
|
50
50
|
network = (a.redeem && a.redeem.network) || BITCOIN_NETWORK;
|
|
51
51
|
}
|
|
52
|
-
const o = {
|
|
52
|
+
const o = {
|
|
53
|
+
network,
|
|
54
|
+
name: 'p2wsh',
|
|
55
|
+
hash: undefined,
|
|
56
|
+
};
|
|
53
57
|
lazy.prop(o, 'address', () => {
|
|
54
58
|
if (!o.hash)
|
|
55
59
|
return;
|
package/build/psbt.js
CHANGED
|
@@ -676,7 +676,9 @@ function canFinalize(input, script, scriptType) {
|
|
|
676
676
|
case 'witnesspubkeyhash':
|
|
677
677
|
return hasSigs(1, input.partialSig);
|
|
678
678
|
case 'multisig':
|
|
679
|
-
const p2ms = payments.p2ms({
|
|
679
|
+
const p2ms = payments.p2ms({
|
|
680
|
+
output: script,
|
|
681
|
+
});
|
|
680
682
|
return hasSigs(p2ms.m, input.partialSig, p2ms.pubkeys);
|
|
681
683
|
case 'nonstandard':
|
|
682
684
|
return true;
|