@btc-vision/bitcoin 6.4.6 → 6.4.8
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/psbt/psbtutils.d.ts +1 -0
- package/browser/psbt.d.ts +3 -0
- package/browser/transaction.d.ts +3 -0
- package/build/psbt/psbtutils.d.ts +1 -0
- package/build/psbt/psbtutils.js +7 -0
- package/build/psbt.d.ts +3 -0
- package/build/psbt.js +7 -1
- package/build/transaction.d.ts +3 -0
- package/build/transaction.js +3 -0
- package/package.json +1 -1
- package/src/psbt/psbtutils.ts +9 -0
- package/src/psbt.ts +2229 -2219
- package/src/transaction.ts +5 -0
|
@@ -7,6 +7,7 @@ export declare const isP2WSHScript: (script: Buffer) => boolean;
|
|
|
7
7
|
export declare const isP2SHScript: (script: Buffer) => boolean;
|
|
8
8
|
export declare const isP2TR: (script: Buffer) => boolean;
|
|
9
9
|
export declare const isP2OP: (script: Buffer) => boolean;
|
|
10
|
+
export declare const isP2A: (script: Buffer) => boolean;
|
|
10
11
|
export declare function witnessStackToScriptWitness(witness: Buffer[]): Buffer;
|
|
11
12
|
export interface UncompressedPublicKey {
|
|
12
13
|
hybrid: Buffer;
|
package/browser/psbt.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare class Psbt {
|
|
|
43
43
|
clone(): Psbt;
|
|
44
44
|
setMaximumFeeRate(satoshiPerByte: number): void;
|
|
45
45
|
setVersion(version: number): this;
|
|
46
|
+
setVersionTRUC(): this;
|
|
46
47
|
setLocktime(locktime: number): this;
|
|
47
48
|
setInputSequence(inputIndex: number, sequence: number): this;
|
|
48
49
|
addInputs(inputDatas: PsbtInputExtended[], checkPartialSigs?: boolean): this;
|
|
@@ -98,12 +99,14 @@ export declare class Psbt {
|
|
|
98
99
|
export interface PsbtOptsOptional {
|
|
99
100
|
network?: Network;
|
|
100
101
|
maximumFeeRate?: number;
|
|
102
|
+
version?: 1 | 2 | 3;
|
|
101
103
|
}
|
|
102
104
|
export interface PsbtOpts {
|
|
103
105
|
network: Network;
|
|
104
106
|
maximumFeeRate: number;
|
|
105
107
|
}
|
|
106
108
|
export interface PsbtInputExtended extends PsbtInput, TransactionInput {
|
|
109
|
+
isPayToAnchor?: boolean;
|
|
107
110
|
}
|
|
108
111
|
export type PsbtOutputExtended = PsbtOutputExtendedAddress | PsbtOutputExtendedScript;
|
|
109
112
|
export interface PsbtOutputExtendedAddress extends PsbtOutput {
|
package/browser/transaction.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ export declare class Transaction {
|
|
|
20
20
|
static readonly SIGHASH_INPUT_MASK = 128;
|
|
21
21
|
static readonly ADVANCED_TRANSACTION_MARKER = 0;
|
|
22
22
|
static readonly ADVANCED_TRANSACTION_FLAG = 1;
|
|
23
|
+
static readonly TRUC_VERSION = 3;
|
|
24
|
+
static readonly TRUC_MAX_VSIZE = 10000;
|
|
25
|
+
static readonly TRUC_CHILD_MAX_VSIZE = 1000;
|
|
23
26
|
version: number;
|
|
24
27
|
locktime: number;
|
|
25
28
|
ins: Input[];
|
|
@@ -7,6 +7,7 @@ export declare const isP2WSHScript: (script: Buffer) => boolean;
|
|
|
7
7
|
export declare const isP2SHScript: (script: Buffer) => boolean;
|
|
8
8
|
export declare const isP2TR: (script: Buffer) => boolean;
|
|
9
9
|
export declare const isP2OP: (script: Buffer) => boolean;
|
|
10
|
+
export declare const isP2A: (script: Buffer) => boolean;
|
|
10
11
|
export declare function witnessStackToScriptWitness(witness: Buffer[]): Buffer;
|
|
11
12
|
export interface UncompressedPublicKey {
|
|
12
13
|
hybrid: Buffer;
|
package/build/psbt/psbtutils.js
CHANGED
|
@@ -31,6 +31,13 @@ export const isP2WSHScript = isPaymentFactory(p2wsh);
|
|
|
31
31
|
export const isP2SHScript = isPaymentFactory(p2sh);
|
|
32
32
|
export const isP2TR = isPaymentFactory(p2tr);
|
|
33
33
|
export const isP2OP = isPaymentFactory(p2op);
|
|
34
|
+
export const isP2A = (script) => {
|
|
35
|
+
return (script.length === 4 &&
|
|
36
|
+
script[0] === 0x51 &&
|
|
37
|
+
script[1] === 0x02 &&
|
|
38
|
+
script[2] === 0x4e &&
|
|
39
|
+
script[3] === 0x73);
|
|
40
|
+
};
|
|
34
41
|
export function witnessStackToScriptWitness(witness) {
|
|
35
42
|
let buffer = Buffer.allocUnsafe(0);
|
|
36
43
|
function writeSlice(slice) {
|
package/build/psbt.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare class Psbt {
|
|
|
43
43
|
clone(): Psbt;
|
|
44
44
|
setMaximumFeeRate(satoshiPerByte: number): void;
|
|
45
45
|
setVersion(version: number): this;
|
|
46
|
+
setVersionTRUC(): this;
|
|
46
47
|
setLocktime(locktime: number): this;
|
|
47
48
|
setInputSequence(inputIndex: number, sequence: number): this;
|
|
48
49
|
addInputs(inputDatas: PsbtInputExtended[], checkPartialSigs?: boolean): this;
|
|
@@ -98,12 +99,14 @@ export declare class Psbt {
|
|
|
98
99
|
export interface PsbtOptsOptional {
|
|
99
100
|
network?: Network;
|
|
100
101
|
maximumFeeRate?: number;
|
|
102
|
+
version?: 1 | 2 | 3;
|
|
101
103
|
}
|
|
102
104
|
export interface PsbtOpts {
|
|
103
105
|
network: Network;
|
|
104
106
|
maximumFeeRate: number;
|
|
105
107
|
}
|
|
106
108
|
export interface PsbtInputExtended extends PsbtInput, TransactionInput {
|
|
109
|
+
isPayToAnchor?: boolean;
|
|
107
110
|
}
|
|
108
111
|
export type PsbtOutputExtended = PsbtOutputExtendedAddress | PsbtOutputExtendedScript;
|
|
109
112
|
export interface PsbtOutputExtendedAddress extends PsbtOutput {
|
package/build/psbt.js
CHANGED
|
@@ -25,7 +25,10 @@ export class Psbt {
|
|
|
25
25
|
__TX: this.data.globalMap.unsignedTx.tx,
|
|
26
26
|
__UNSAFE_SIGN_NONSEGWIT: false,
|
|
27
27
|
};
|
|
28
|
-
if (
|
|
28
|
+
if (opts.version === 3) {
|
|
29
|
+
this.setVersionTRUC();
|
|
30
|
+
}
|
|
31
|
+
else if (this.data.inputs.length === 0)
|
|
29
32
|
this.setVersion(2);
|
|
30
33
|
const dpew = (obj, attr, enumerable, writable) => {
|
|
31
34
|
Object.defineProperty(obj, attr, {
|
|
@@ -105,6 +108,9 @@ export class Psbt {
|
|
|
105
108
|
c.__EXTRACTED_TX = undefined;
|
|
106
109
|
return this;
|
|
107
110
|
}
|
|
111
|
+
setVersionTRUC() {
|
|
112
|
+
return this.setVersion(Transaction.TRUC_VERSION);
|
|
113
|
+
}
|
|
108
114
|
setLocktime(locktime) {
|
|
109
115
|
check32Bit(locktime);
|
|
110
116
|
checkInputsForPartialSig(this.data.inputs, 'setLocktime');
|
package/build/transaction.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ export declare class Transaction {
|
|
|
20
20
|
static readonly SIGHASH_INPUT_MASK = 128;
|
|
21
21
|
static readonly ADVANCED_TRANSACTION_MARKER = 0;
|
|
22
22
|
static readonly ADVANCED_TRANSACTION_FLAG = 1;
|
|
23
|
+
static readonly TRUC_VERSION = 3;
|
|
24
|
+
static readonly TRUC_MAX_VSIZE = 10000;
|
|
25
|
+
static readonly TRUC_CHILD_MAX_VSIZE = 1000;
|
|
23
26
|
version: number;
|
|
24
27
|
locktime: number;
|
|
25
28
|
ins: Input[];
|
package/build/transaction.js
CHANGED
|
@@ -443,3 +443,6 @@ Transaction.SIGHASH_OUTPUT_MASK = 0x03;
|
|
|
443
443
|
Transaction.SIGHASH_INPUT_MASK = 0x80;
|
|
444
444
|
Transaction.ADVANCED_TRANSACTION_MARKER = 0x00;
|
|
445
445
|
Transaction.ADVANCED_TRANSACTION_FLAG = 0x01;
|
|
446
|
+
Transaction.TRUC_VERSION = 3;
|
|
447
|
+
Transaction.TRUC_MAX_VSIZE = 10000;
|
|
448
|
+
Transaction.TRUC_CHILD_MAX_VSIZE = 1000;
|
package/package.json
CHANGED
package/src/psbt/psbtutils.ts
CHANGED
|
@@ -33,6 +33,15 @@ export const isP2WSHScript = isPaymentFactory(p2wsh);
|
|
|
33
33
|
export const isP2SHScript = isPaymentFactory(p2sh);
|
|
34
34
|
export const isP2TR = isPaymentFactory(p2tr);
|
|
35
35
|
export const isP2OP = isPaymentFactory(p2op);
|
|
36
|
+
export const isP2A = (script: Buffer): boolean => {
|
|
37
|
+
return (
|
|
38
|
+
script.length === 4 &&
|
|
39
|
+
script[0] === 0x51 && // OP_1
|
|
40
|
+
script[1] === 0x02 && // push 2 bytes
|
|
41
|
+
script[2] === 0x4e &&
|
|
42
|
+
script[3] === 0x73
|
|
43
|
+
);
|
|
44
|
+
};
|
|
36
45
|
|
|
37
46
|
/**
|
|
38
47
|
* Converts a witness stack to a script witness.
|