@vbyte/btc-dev 1.0.14 → 1.0.15
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/main.cjs +4 -4
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +4 -4
- package/dist/module.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/dist/schema/tx.d.ts +11 -11
- package/dist/schema/tx.js +4 -4
- package/dist/script.js +1 -1
- package/dist/script.js.map +1 -1
- package/package.json +1 -1
- package/src/schema/tx.ts +8 -6
package/package.json
CHANGED
package/src/schema/tx.ts
CHANGED
|
@@ -2,12 +2,14 @@ import { z } from 'zod'
|
|
|
2
2
|
|
|
3
3
|
import { hex, hex32, uint } from '@vbyte/micro-lib/schema'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import type { TxOutput, TxOutputTemplate } from '@/types/index.js'
|
|
6
|
+
|
|
7
|
+
const sats = z.bigint().min(0n).max(2_100_000_000_000_000n)
|
|
6
8
|
|
|
7
9
|
export const tx_output = z.object({
|
|
8
10
|
value : sats,
|
|
9
11
|
script_pk : hex,
|
|
10
|
-
})
|
|
12
|
+
}) satisfies z.ZodType<TxOutput>
|
|
11
13
|
|
|
12
14
|
export const tx_input = z.object({
|
|
13
15
|
coinbase : hex.nullable(),
|
|
@@ -28,7 +30,7 @@ export const tx_data = z.object({
|
|
|
28
30
|
|
|
29
31
|
export const vout_template = tx_output.extend({
|
|
30
32
|
value : z.union([ uint, sats ])
|
|
31
|
-
})
|
|
33
|
+
}) satisfies z.ZodType<TxOutputTemplate>
|
|
32
34
|
|
|
33
35
|
export const vin_template = tx_input.extend({
|
|
34
36
|
coinbase : hex.nullable().optional(),
|
|
@@ -39,8 +41,8 @@ export const vin_template = tx_input.extend({
|
|
|
39
41
|
})
|
|
40
42
|
|
|
41
43
|
export const tx_template = z.object({
|
|
42
|
-
version : uint.
|
|
43
|
-
vin : z.array(vin_template)
|
|
44
|
-
vout : z.array(vout_template)
|
|
44
|
+
version : uint.optional(),
|
|
45
|
+
vin : z.array(vin_template),
|
|
46
|
+
vout : z.array(vout_template),
|
|
45
47
|
locktime : uint.optional(),
|
|
46
48
|
})
|