@vbyte/btc-dev 1.1.2 → 1.1.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/dist/lib/signer/sign.js +2 -2
- package/dist/lib/tx/util.d.ts +3 -3
- package/dist/lib/tx/util.js +15 -8
- package/dist/main.cjs +4125 -4309
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +4125 -4309
- package/dist/module.mjs.map +1 -1
- package/dist/package.json +2 -2
- package/dist/schema/taproot.d.ts +5 -15
- package/dist/schema/tx.d.ts +44 -262
- package/dist/script.js +8 -9
- package/dist/script.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/signer/sign.ts +2 -2
- package/src/lib/tx/util.ts +38 -23
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vbyte/btc-dev",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Batteries-included toolset for plebian bitcoin development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"test": "npm run script test/src/tape.ts"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@noble/curves": "^1.9.
|
|
82
|
+
"@noble/curves": "^1.9.3",
|
|
83
83
|
"@noble/hashes": "^1.8.0",
|
|
84
84
|
"@scure/btc-signer": "^1.8.1",
|
|
85
85
|
"@vbyte/buff": "^1.0.2",
|
package/dist/schema/taproot.d.ts
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const taptree: z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.
|
|
2
|
+
export declare const taptree: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>>, z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>]>;
|
|
3
3
|
export declare const config: z.ZodObject<{
|
|
4
|
-
pubkey: z.ZodUnion<[z.
|
|
5
|
-
leaves: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.
|
|
6
|
-
target: z.ZodOptional<z.ZodUnion<[z.
|
|
4
|
+
pubkey: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
|
|
5
|
+
leaves: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>>, z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>]>>>;
|
|
6
|
+
target: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>>;
|
|
7
7
|
version: z.ZodOptional<z.ZodNumber>;
|
|
8
|
-
},
|
|
9
|
-
pubkey: string | Uint8Array<ArrayBuffer>;
|
|
10
|
-
version?: number | undefined;
|
|
11
|
-
leaves?: (string | Uint8Array<ArrayBuffer> | (string | Uint8Array<ArrayBuffer>)[])[] | undefined;
|
|
12
|
-
target?: string | Uint8Array<ArrayBuffer> | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
pubkey: string | Uint8Array<ArrayBuffer>;
|
|
15
|
-
version?: number | undefined;
|
|
16
|
-
leaves?: (string | Uint8Array<ArrayBuffer> | (string | Uint8Array<ArrayBuffer>)[])[] | undefined;
|
|
17
|
-
target?: string | Uint8Array<ArrayBuffer> | undefined;
|
|
18
|
-
}>;
|
|
8
|
+
}, z.core.$strip>;
|
package/dist/schema/tx.d.ts
CHANGED
|
@@ -1,291 +1,73 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const tx_output: z.ZodObject<{
|
|
3
3
|
value: z.ZodBigInt;
|
|
4
|
-
script_pk: z.
|
|
5
|
-
},
|
|
6
|
-
value: bigint;
|
|
7
|
-
script_pk: string;
|
|
8
|
-
}, {
|
|
9
|
-
value: bigint;
|
|
10
|
-
script_pk: string;
|
|
11
|
-
}>;
|
|
4
|
+
script_pk: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
12
6
|
export declare const tx_input: z.ZodObject<{
|
|
13
|
-
coinbase: z.ZodNullable<z.
|
|
14
|
-
txid: z.
|
|
7
|
+
coinbase: z.ZodNullable<z.ZodString>;
|
|
8
|
+
txid: z.ZodString;
|
|
15
9
|
vout: z.ZodNumber;
|
|
16
10
|
prevout: z.ZodNullable<z.ZodObject<{
|
|
17
11
|
value: z.ZodBigInt;
|
|
18
|
-
script_pk: z.
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
script_pk: string;
|
|
22
|
-
}, {
|
|
23
|
-
value: bigint;
|
|
24
|
-
script_pk: string;
|
|
25
|
-
}>>;
|
|
26
|
-
script_sig: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
|
|
12
|
+
script_pk: z.ZodString;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
script_sig: z.ZodNullable<z.ZodString>;
|
|
27
15
|
sequence: z.ZodNumber;
|
|
28
|
-
witness: z.ZodArray<z.
|
|
29
|
-
},
|
|
30
|
-
txid: string;
|
|
31
|
-
vout: number;
|
|
32
|
-
coinbase: string | null;
|
|
33
|
-
prevout: {
|
|
34
|
-
value: bigint;
|
|
35
|
-
script_pk: string;
|
|
36
|
-
} | null;
|
|
37
|
-
script_sig: string | null;
|
|
38
|
-
sequence: number;
|
|
39
|
-
witness: string[];
|
|
40
|
-
}, {
|
|
41
|
-
txid: string;
|
|
42
|
-
vout: number;
|
|
43
|
-
coinbase: string | null;
|
|
44
|
-
prevout: {
|
|
45
|
-
value: bigint;
|
|
46
|
-
script_pk: string;
|
|
47
|
-
} | null;
|
|
48
|
-
script_sig: string | null;
|
|
49
|
-
sequence: number;
|
|
50
|
-
witness: string[];
|
|
51
|
-
}>;
|
|
16
|
+
witness: z.ZodArray<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
52
18
|
export declare const tx_data: z.ZodObject<{
|
|
53
19
|
version: z.ZodNumber;
|
|
54
20
|
vin: z.ZodArray<z.ZodObject<{
|
|
55
|
-
coinbase: z.ZodNullable<z.
|
|
56
|
-
txid: z.
|
|
21
|
+
coinbase: z.ZodNullable<z.ZodString>;
|
|
22
|
+
txid: z.ZodString;
|
|
57
23
|
vout: z.ZodNumber;
|
|
58
24
|
prevout: z.ZodNullable<z.ZodObject<{
|
|
59
25
|
value: z.ZodBigInt;
|
|
60
|
-
script_pk: z.
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
script_pk: string;
|
|
64
|
-
}, {
|
|
65
|
-
value: bigint;
|
|
66
|
-
script_pk: string;
|
|
67
|
-
}>>;
|
|
68
|
-
script_sig: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
|
|
26
|
+
script_pk: z.ZodString;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
script_sig: z.ZodNullable<z.ZodString>;
|
|
69
29
|
sequence: z.ZodNumber;
|
|
70
|
-
witness: z.ZodArray<z.
|
|
71
|
-
},
|
|
72
|
-
txid: string;
|
|
73
|
-
vout: number;
|
|
74
|
-
coinbase: string | null;
|
|
75
|
-
prevout: {
|
|
76
|
-
value: bigint;
|
|
77
|
-
script_pk: string;
|
|
78
|
-
} | null;
|
|
79
|
-
script_sig: string | null;
|
|
80
|
-
sequence: number;
|
|
81
|
-
witness: string[];
|
|
82
|
-
}, {
|
|
83
|
-
txid: string;
|
|
84
|
-
vout: number;
|
|
85
|
-
coinbase: string | null;
|
|
86
|
-
prevout: {
|
|
87
|
-
value: bigint;
|
|
88
|
-
script_pk: string;
|
|
89
|
-
} | null;
|
|
90
|
-
script_sig: string | null;
|
|
91
|
-
sequence: number;
|
|
92
|
-
witness: string[];
|
|
93
|
-
}>, "many">;
|
|
30
|
+
witness: z.ZodArray<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
94
32
|
vout: z.ZodArray<z.ZodObject<{
|
|
95
33
|
value: z.ZodBigInt;
|
|
96
|
-
script_pk: z.
|
|
97
|
-
},
|
|
98
|
-
value: bigint;
|
|
99
|
-
script_pk: string;
|
|
100
|
-
}, {
|
|
101
|
-
value: bigint;
|
|
102
|
-
script_pk: string;
|
|
103
|
-
}>, "many">;
|
|
34
|
+
script_pk: z.ZodString;
|
|
35
|
+
}, z.core.$strip>>;
|
|
104
36
|
locktime: z.ZodNumber;
|
|
105
|
-
},
|
|
106
|
-
version: number;
|
|
107
|
-
vout: {
|
|
108
|
-
value: bigint;
|
|
109
|
-
script_pk: string;
|
|
110
|
-
}[];
|
|
111
|
-
vin: {
|
|
112
|
-
txid: string;
|
|
113
|
-
vout: number;
|
|
114
|
-
coinbase: string | null;
|
|
115
|
-
prevout: {
|
|
116
|
-
value: bigint;
|
|
117
|
-
script_pk: string;
|
|
118
|
-
} | null;
|
|
119
|
-
script_sig: string | null;
|
|
120
|
-
sequence: number;
|
|
121
|
-
witness: string[];
|
|
122
|
-
}[];
|
|
123
|
-
locktime: number;
|
|
124
|
-
}, {
|
|
125
|
-
version: number;
|
|
126
|
-
vout: {
|
|
127
|
-
value: bigint;
|
|
128
|
-
script_pk: string;
|
|
129
|
-
}[];
|
|
130
|
-
vin: {
|
|
131
|
-
txid: string;
|
|
132
|
-
vout: number;
|
|
133
|
-
coinbase: string | null;
|
|
134
|
-
prevout: {
|
|
135
|
-
value: bigint;
|
|
136
|
-
script_pk: string;
|
|
137
|
-
} | null;
|
|
138
|
-
script_sig: string | null;
|
|
139
|
-
sequence: number;
|
|
140
|
-
witness: string[];
|
|
141
|
-
}[];
|
|
142
|
-
locktime: number;
|
|
143
|
-
}>;
|
|
37
|
+
}, z.core.$strip>;
|
|
144
38
|
export declare const vout_template: z.ZodObject<{
|
|
145
|
-
script_pk: z.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}, "strip", z.ZodTypeAny, {
|
|
149
|
-
value: number | bigint;
|
|
150
|
-
script_pk: string;
|
|
151
|
-
}, {
|
|
152
|
-
value: number | bigint;
|
|
153
|
-
script_pk: string;
|
|
154
|
-
}>;
|
|
39
|
+
script_pk: z.ZodString;
|
|
40
|
+
value: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>;
|
|
41
|
+
}, z.core.$strip>;
|
|
155
42
|
export declare const vin_template: z.ZodObject<{
|
|
156
|
-
txid: z.
|
|
43
|
+
txid: z.ZodString;
|
|
157
44
|
vout: z.ZodNumber;
|
|
158
|
-
|
|
159
|
-
coinbase: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
|
|
45
|
+
coinbase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
160
46
|
prevout: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
161
|
-
script_pk: z.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
value: number | bigint;
|
|
169
|
-
script_pk: string;
|
|
170
|
-
}>>>;
|
|
171
|
-
script_sig: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
|
|
172
|
-
sequence: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>>;
|
|
173
|
-
witness: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
174
|
-
}, "strip", z.ZodTypeAny, {
|
|
175
|
-
txid: string;
|
|
176
|
-
vout: number;
|
|
177
|
-
coinbase?: string | null | undefined;
|
|
178
|
-
prevout?: {
|
|
179
|
-
value: number | bigint;
|
|
180
|
-
script_pk: string;
|
|
181
|
-
} | null | undefined;
|
|
182
|
-
script_sig?: string | null | undefined;
|
|
183
|
-
sequence?: string | number | undefined;
|
|
184
|
-
witness?: string[] | undefined;
|
|
185
|
-
}, {
|
|
186
|
-
txid: string;
|
|
187
|
-
vout: number;
|
|
188
|
-
coinbase?: string | null | undefined;
|
|
189
|
-
prevout?: {
|
|
190
|
-
value: number | bigint;
|
|
191
|
-
script_pk: string;
|
|
192
|
-
} | null | undefined;
|
|
193
|
-
script_sig?: string | null | undefined;
|
|
194
|
-
sequence?: string | number | undefined;
|
|
195
|
-
witness?: string[] | undefined;
|
|
196
|
-
}>;
|
|
47
|
+
script_pk: z.ZodString;
|
|
48
|
+
value: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
50
|
+
script_sig: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
sequence: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
52
|
+
witness: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
197
54
|
export declare const tx_template: z.ZodObject<{
|
|
198
55
|
version: z.ZodOptional<z.ZodNumber>;
|
|
199
56
|
vin: z.ZodArray<z.ZodObject<{
|
|
200
|
-
txid: z.
|
|
57
|
+
txid: z.ZodString;
|
|
201
58
|
vout: z.ZodNumber;
|
|
202
|
-
|
|
203
|
-
coinbase: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
|
|
59
|
+
coinbase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
204
60
|
prevout: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
205
|
-
script_pk: z.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
value: number | bigint;
|
|
213
|
-
script_pk: string;
|
|
214
|
-
}>>>;
|
|
215
|
-
script_sig: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
|
|
216
|
-
sequence: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>>;
|
|
217
|
-
witness: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
218
|
-
}, "strip", z.ZodTypeAny, {
|
|
219
|
-
txid: string;
|
|
220
|
-
vout: number;
|
|
221
|
-
coinbase?: string | null | undefined;
|
|
222
|
-
prevout?: {
|
|
223
|
-
value: number | bigint;
|
|
224
|
-
script_pk: string;
|
|
225
|
-
} | null | undefined;
|
|
226
|
-
script_sig?: string | null | undefined;
|
|
227
|
-
sequence?: string | number | undefined;
|
|
228
|
-
witness?: string[] | undefined;
|
|
229
|
-
}, {
|
|
230
|
-
txid: string;
|
|
231
|
-
vout: number;
|
|
232
|
-
coinbase?: string | null | undefined;
|
|
233
|
-
prevout?: {
|
|
234
|
-
value: number | bigint;
|
|
235
|
-
script_pk: string;
|
|
236
|
-
} | null | undefined;
|
|
237
|
-
script_sig?: string | null | undefined;
|
|
238
|
-
sequence?: string | number | undefined;
|
|
239
|
-
witness?: string[] | undefined;
|
|
240
|
-
}>, "many">;
|
|
61
|
+
script_pk: z.ZodString;
|
|
62
|
+
value: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>;
|
|
63
|
+
}, z.core.$strip>>>;
|
|
64
|
+
script_sig: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
|
+
sequence: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
66
|
+
witness: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
241
68
|
vout: z.ZodArray<z.ZodObject<{
|
|
242
|
-
script_pk: z.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}, "strip", z.ZodTypeAny, {
|
|
246
|
-
value: number | bigint;
|
|
247
|
-
script_pk: string;
|
|
248
|
-
}, {
|
|
249
|
-
value: number | bigint;
|
|
250
|
-
script_pk: string;
|
|
251
|
-
}>, "many">;
|
|
69
|
+
script_pk: z.ZodString;
|
|
70
|
+
value: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>;
|
|
71
|
+
}, z.core.$strip>>;
|
|
252
72
|
locktime: z.ZodOptional<z.ZodNumber>;
|
|
253
|
-
},
|
|
254
|
-
vout: {
|
|
255
|
-
value: number | bigint;
|
|
256
|
-
script_pk: string;
|
|
257
|
-
}[];
|
|
258
|
-
vin: {
|
|
259
|
-
txid: string;
|
|
260
|
-
vout: number;
|
|
261
|
-
coinbase?: string | null | undefined;
|
|
262
|
-
prevout?: {
|
|
263
|
-
value: number | bigint;
|
|
264
|
-
script_pk: string;
|
|
265
|
-
} | null | undefined;
|
|
266
|
-
script_sig?: string | null | undefined;
|
|
267
|
-
sequence?: string | number | undefined;
|
|
268
|
-
witness?: string[] | undefined;
|
|
269
|
-
}[];
|
|
270
|
-
version?: number | undefined;
|
|
271
|
-
locktime?: number | undefined;
|
|
272
|
-
}, {
|
|
273
|
-
vout: {
|
|
274
|
-
value: number | bigint;
|
|
275
|
-
script_pk: string;
|
|
276
|
-
}[];
|
|
277
|
-
vin: {
|
|
278
|
-
txid: string;
|
|
279
|
-
vout: number;
|
|
280
|
-
coinbase?: string | null | undefined;
|
|
281
|
-
prevout?: {
|
|
282
|
-
value: number | bigint;
|
|
283
|
-
script_pk: string;
|
|
284
|
-
} | null | undefined;
|
|
285
|
-
script_sig?: string | null | undefined;
|
|
286
|
-
sequence?: string | number | undefined;
|
|
287
|
-
witness?: string[] | undefined;
|
|
288
|
-
}[];
|
|
289
|
-
version?: number | undefined;
|
|
290
|
-
locktime?: number | undefined;
|
|
291
|
-
}>;
|
|
73
|
+
}, z.core.$strip>;
|