@vbyte/btc-dev 1.0.0

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.
Files changed (205) hide show
  1. package/LICENSE +121 -0
  2. package/README.md +5 -0
  3. package/dist/class/index.d.ts +5 -0
  4. package/dist/class/index.js +5 -0
  5. package/dist/class/signer.d.ts +18 -0
  6. package/dist/class/signer.js +32 -0
  7. package/dist/class/tx.d.ts +38 -0
  8. package/dist/class/tx.js +73 -0
  9. package/dist/class/txin.d.ts +29 -0
  10. package/dist/class/txin.js +68 -0
  11. package/dist/class/txout.d.ts +18 -0
  12. package/dist/class/txout.js +38 -0
  13. package/dist/class/witness.d.ts +20 -0
  14. package/dist/class/witness.js +57 -0
  15. package/dist/const.d.ts +22 -0
  16. package/dist/const.js +36 -0
  17. package/dist/index.d.ts +11 -0
  18. package/dist/index.js +10 -0
  19. package/dist/lib/address/encode.d.ts +3 -0
  20. package/dist/lib/address/encode.js +79 -0
  21. package/dist/lib/address/index.d.ts +20 -0
  22. package/dist/lib/address/index.js +21 -0
  23. package/dist/lib/address/p2pkh.d.ts +10 -0
  24. package/dist/lib/address/p2pkh.js +33 -0
  25. package/dist/lib/address/p2sh.d.ts +10 -0
  26. package/dist/lib/address/p2sh.js +33 -0
  27. package/dist/lib/address/p2tr.d.ts +8 -0
  28. package/dist/lib/address/p2tr.js +26 -0
  29. package/dist/lib/address/p2wpkh.d.ts +10 -0
  30. package/dist/lib/address/p2wpkh.js +34 -0
  31. package/dist/lib/address/p2wsh.d.ts +10 -0
  32. package/dist/lib/address/p2wsh.js +33 -0
  33. package/dist/lib/address/script.d.ts +5 -0
  34. package/dist/lib/address/script.js +46 -0
  35. package/dist/lib/address/util.d.ts +4 -0
  36. package/dist/lib/address/util.js +57 -0
  37. package/dist/lib/meta/index.d.ts +2 -0
  38. package/dist/lib/meta/index.js +2 -0
  39. package/dist/lib/meta/pointer.d.ts +42 -0
  40. package/dist/lib/meta/pointer.js +69 -0
  41. package/dist/lib/meta/scribe.d.ts +7 -0
  42. package/dist/lib/meta/scribe.js +192 -0
  43. package/dist/lib/psbt/encoder.d.ts +5 -0
  44. package/dist/lib/psbt/encoder.js +21 -0
  45. package/dist/lib/psbt/index.d.ts +4 -0
  46. package/dist/lib/psbt/index.js +4 -0
  47. package/dist/lib/psbt/meta.d.ts +3 -0
  48. package/dist/lib/psbt/meta.js +11 -0
  49. package/dist/lib/psbt/util.d.ts +5 -0
  50. package/dist/lib/psbt/util.js +44 -0
  51. package/dist/lib/psbt/validate.d.ts +2 -0
  52. package/dist/lib/psbt/validate.js +11 -0
  53. package/dist/lib/script/decode.d.ts +2 -0
  54. package/dist/lib/script/decode.js +55 -0
  55. package/dist/lib/script/encode.d.ts +6 -0
  56. package/dist/lib/script/encode.js +80 -0
  57. package/dist/lib/script/index.d.ts +126 -0
  58. package/dist/lib/script/index.js +17 -0
  59. package/dist/lib/script/util.d.ts +2 -0
  60. package/dist/lib/script/util.js +10 -0
  61. package/dist/lib/script/words.d.ts +116 -0
  62. package/dist/lib/script/words.js +164 -0
  63. package/dist/lib/sighash/index.d.ts +5 -0
  64. package/dist/lib/sighash/index.js +5 -0
  65. package/dist/lib/sighash/segwit.d.ts +3 -0
  66. package/dist/lib/sighash/segwit.js +89 -0
  67. package/dist/lib/sighash/sign.d.ts +3 -0
  68. package/dist/lib/sighash/sign.js +20 -0
  69. package/dist/lib/sighash/taproot.d.ts +9 -0
  70. package/dist/lib/sighash/taproot.js +124 -0
  71. package/dist/lib/sighash/util.d.ts +3 -0
  72. package/dist/lib/sighash/util.js +16 -0
  73. package/dist/lib/sighash/verify.d.ts +1 -0
  74. package/dist/lib/sighash/verify.js +1 -0
  75. package/dist/lib/taproot/cblock.d.ts +3 -0
  76. package/dist/lib/taproot/cblock.js +55 -0
  77. package/dist/lib/taproot/encode.d.ts +6 -0
  78. package/dist/lib/taproot/encode.js +26 -0
  79. package/dist/lib/taproot/index.d.ts +4 -0
  80. package/dist/lib/taproot/index.js +4 -0
  81. package/dist/lib/taproot/parse.d.ts +11 -0
  82. package/dist/lib/taproot/parse.js +47 -0
  83. package/dist/lib/taproot/tree.d.ts +3 -0
  84. package/dist/lib/taproot/tree.js +49 -0
  85. package/dist/lib/tx/create.d.ts +6 -0
  86. package/dist/lib/tx/create.js +54 -0
  87. package/dist/lib/tx/decode.d.ts +9 -0
  88. package/dist/lib/tx/decode.js +109 -0
  89. package/dist/lib/tx/encode.d.ts +15 -0
  90. package/dist/lib/tx/encode.js +94 -0
  91. package/dist/lib/tx/index.d.ts +10 -0
  92. package/dist/lib/tx/index.js +10 -0
  93. package/dist/lib/tx/locktime.d.ts +7 -0
  94. package/dist/lib/tx/locktime.js +37 -0
  95. package/dist/lib/tx/meta.d.ts +8 -0
  96. package/dist/lib/tx/meta.js +48 -0
  97. package/dist/lib/tx/parse.d.ts +2 -0
  98. package/dist/lib/tx/parse.js +12 -0
  99. package/dist/lib/tx/sequence.d.ts +7 -0
  100. package/dist/lib/tx/sequence.js +65 -0
  101. package/dist/lib/tx/size.d.ts +10 -0
  102. package/dist/lib/tx/size.js +48 -0
  103. package/dist/lib/tx/validate.d.ts +7 -0
  104. package/dist/lib/tx/validate.js +21 -0
  105. package/dist/lib/tx/witness.d.ts +3 -0
  106. package/dist/lib/tx/witness.js +85 -0
  107. package/dist/main.cjs +14625 -0
  108. package/dist/main.cjs.map +1 -0
  109. package/dist/module.mjs +14610 -0
  110. package/dist/module.mjs.map +1 -0
  111. package/dist/package.json +106 -0
  112. package/dist/schema/index.d.ts +2 -0
  113. package/dist/schema/index.js +2 -0
  114. package/dist/schema/taproot.d.ts +18 -0
  115. package/dist/schema/taproot.js +9 -0
  116. package/dist/schema/tx.d.ts +278 -0
  117. package/dist/schema/tx.js +35 -0
  118. package/dist/script.js +15 -0
  119. package/dist/script.js.map +1 -0
  120. package/dist/types/address.d.ts +34 -0
  121. package/dist/types/address.js +1 -0
  122. package/dist/types/index.d.ts +9 -0
  123. package/dist/types/index.js +9 -0
  124. package/dist/types/meta.d.ts +10 -0
  125. package/dist/types/meta.js +1 -0
  126. package/dist/types/psbt.d.ts +9 -0
  127. package/dist/types/psbt.js +1 -0
  128. package/dist/types/sighash.d.ts +14 -0
  129. package/dist/types/sighash.js +1 -0
  130. package/dist/types/taproot.d.ts +35 -0
  131. package/dist/types/taproot.js +1 -0
  132. package/dist/types/transaction.d.ts +81 -0
  133. package/dist/types/transaction.js +1 -0
  134. package/dist/types/txdata.d.ts +45 -0
  135. package/dist/types/txdata.js +1 -0
  136. package/dist/types/txmeta.d.ts +19 -0
  137. package/dist/types/txmeta.js +1 -0
  138. package/dist/types/witness.d.ts +30 -0
  139. package/dist/types/witness.js +1 -0
  140. package/package.json +106 -0
  141. package/src/class/index.ts +5 -0
  142. package/src/class/signer.ts +47 -0
  143. package/src/class/tx.ts +118 -0
  144. package/src/class/txin.ts +95 -0
  145. package/src/class/txout.ts +57 -0
  146. package/src/class/witness.ts +85 -0
  147. package/src/const.ts +43 -0
  148. package/src/index.ts +14 -0
  149. package/src/lib/address/encode.ts +183 -0
  150. package/src/lib/address/index.ts +24 -0
  151. package/src/lib/address/p2pkh.ts +65 -0
  152. package/src/lib/address/p2sh.ts +65 -0
  153. package/src/lib/address/p2tr.ts +51 -0
  154. package/src/lib/address/p2wpkh.ts +67 -0
  155. package/src/lib/address/p2wsh.ts +65 -0
  156. package/src/lib/address/script.ts +63 -0
  157. package/src/lib/address/util.ts +102 -0
  158. package/src/lib/meta/index.ts +2 -0
  159. package/src/lib/meta/pointer.ts +107 -0
  160. package/src/lib/meta/scribe.ts +251 -0
  161. package/src/lib/psbt/encoder.ts +24 -0
  162. package/src/lib/psbt/index.ts +4 -0
  163. package/src/lib/psbt/meta.ts +15 -0
  164. package/src/lib/psbt/util.ts +62 -0
  165. package/src/lib/psbt/validate.ts +18 -0
  166. package/src/lib/script/decode.ts +75 -0
  167. package/src/lib/script/encode.ts +130 -0
  168. package/src/lib/script/index.ts +26 -0
  169. package/src/lib/script/util.ts +78 -0
  170. package/src/lib/script/words.ts +182 -0
  171. package/src/lib/sighash/index.ts +5 -0
  172. package/src/lib/sighash/segwit.ts +152 -0
  173. package/src/lib/sighash/sign.ts +35 -0
  174. package/src/lib/sighash/taproot.ts +236 -0
  175. package/src/lib/sighash/util.ts +29 -0
  176. package/src/lib/sighash/verify.ts +83 -0
  177. package/src/lib/taproot/cblock.ts +95 -0
  178. package/src/lib/taproot/encode.ts +49 -0
  179. package/src/lib/taproot/index.ts +4 -0
  180. package/src/lib/taproot/parse.ts +65 -0
  181. package/src/lib/taproot/tree.ts +94 -0
  182. package/src/lib/tx/create.ts +82 -0
  183. package/src/lib/tx/decode.ts +145 -0
  184. package/src/lib/tx/encode.ts +154 -0
  185. package/src/lib/tx/index.ts +10 -0
  186. package/src/lib/tx/locktime.ts +57 -0
  187. package/src/lib/tx/meta.ts +73 -0
  188. package/src/lib/tx/parse.ts +16 -0
  189. package/src/lib/tx/sequence.ts +146 -0
  190. package/src/lib/tx/size.ts +77 -0
  191. package/src/lib/tx/validate.ts +36 -0
  192. package/src/lib/tx/witness.ts +122 -0
  193. package/src/schema/index.ts +2 -0
  194. package/src/schema/taproot.ts +12 -0
  195. package/src/schema/tx.ts +42 -0
  196. package/src/types/address.ts +39 -0
  197. package/src/types/index.ts +9 -0
  198. package/src/types/meta.ts +10 -0
  199. package/src/types/psbt.ts +15 -0
  200. package/src/types/sighash.ts +16 -0
  201. package/src/types/taproot.ts +40 -0
  202. package/src/types/transaction.ts +98 -0
  203. package/src/types/txdata.ts +53 -0
  204. package/src/types/txmeta.ts +25 -0
  205. package/src/types/witness.ts +36 -0
@@ -0,0 +1,106 @@
1
+ {
2
+ "name": "@vbyte/btc-dev",
3
+ "version": "1.0.0",
4
+ "description": "Batteries-included toolset for plebian bitcoin development",
5
+ "type": "module",
6
+ "keywords": [
7
+ "bitcoin",
8
+ "blockchain",
9
+ "psbt",
10
+ "transaction",
11
+ "segwit",
12
+ "taproot"
13
+ ],
14
+ "author": "Christopher Scott",
15
+ "license": "CC-BY-1.0",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/cmdruid/btc-dev.git"
19
+ },
20
+ "publishConfig": {
21
+ "registry": "https://registry.npmjs.org",
22
+ "access": "public"
23
+ },
24
+ "files": [
25
+ "README.md",
26
+ "LICENSE",
27
+ "dist",
28
+ "src"
29
+ ],
30
+ "main": "./main.cjs",
31
+ "module": "./index.js",
32
+ "unpkg": "./script.js",
33
+ "types": "./types/index.d.ts",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./types/index.d.ts",
37
+ "import": "./index.js",
38
+ "require": "./main.cjs",
39
+ "default": "./index.js"
40
+ },
41
+ "./address": {
42
+ "types": "./lib/address/index.d.ts",
43
+ "import": "./lib/address/index.js"
44
+ },
45
+ "./class": {
46
+ "types": "./class/index.d.ts",
47
+ "import": "./class/index.js"
48
+ },
49
+ "./meta": {
50
+ "types": "./lib/meta.d.ts",
51
+ "import": "./lib/meta.js"
52
+ },
53
+ "./psbt": {
54
+ "types": "./lib/psbt/index.d.ts",
55
+ "import": "./lib/psbt/index.js"
56
+ },
57
+ "./script": {
58
+ "types": "./lib/script/index.d.ts",
59
+ "import": "./lib/script/index.js"
60
+ },
61
+ "./sighash": {
62
+ "types": "./lib/sighash/index.d.ts",
63
+ "import": "./lib/sighash/index.js"
64
+ },
65
+ "./taproot": {
66
+ "types": "./lib/taproot/index.d.ts",
67
+ "import": "./lib/taproot/index.js"
68
+ },
69
+ "./tx": {
70
+ "types": "./lib/tx/index.d.ts",
71
+ "import": "./lib/tx/index.js"
72
+ }
73
+ },
74
+ "scripts": {
75
+ "build": "./scripts/build.sh",
76
+ "package": "npm test | faucet && npm run build",
77
+ "release": "./scripts/release.sh",
78
+ "scratch": "npm run script test/scratch.ts",
79
+ "script": "tsx --tsconfig ./test/tsconfig.json",
80
+ "test": "npm run script test/src/tape.ts"
81
+ },
82
+ "dependencies": {
83
+ "@noble/curves": "^1.9.2",
84
+ "@noble/hashes": "^1.8.0",
85
+ "@scure/btc-signer": "^1.8.1",
86
+ "@vbyte/buff": "^1.0.2",
87
+ "@vbyte/micro-lib": "^1.0.11",
88
+ "zod": "^3.25.69"
89
+ },
90
+ "devDependencies": {
91
+ "@cmdcode/core-cmd": "^1.6.5",
92
+ "@rollup/plugin-commonjs": "^28.0.6",
93
+ "@rollup/plugin-json": "^6.1.0",
94
+ "@rollup/plugin-node-resolve": "^16.0.1",
95
+ "@rollup/plugin-terser": "^0.4.4",
96
+ "@rollup/plugin-typescript": "^12.1.4",
97
+ "@types/node": "^24.0.10",
98
+ "@types/tape": "^5.8.1",
99
+ "faucet": "^0.0.4",
100
+ "rollup": "^4.44.1",
101
+ "tape": "^5.9.0",
102
+ "tslib": "^2.8.1",
103
+ "tsx": "^4.20.3",
104
+ "typescript": "^5.8.3"
105
+ }
106
+ }
@@ -0,0 +1,2 @@
1
+ export * as taproot from './taproot.js';
2
+ export * as tx from './tx.js';
@@ -0,0 +1,2 @@
1
+ export * as taproot from './taproot.js';
2
+ export * as tx from './tx.js';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const taptree: z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>, "many">, z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>]>;
3
+ export declare const config: z.ZodObject<{
4
+ pubkey: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
5
+ leaves: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>, "many">, z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>]>, "many">>;
6
+ target: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>>;
7
+ version: z.ZodOptional<z.ZodNumber>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ pubkey: string | Uint8Array<ArrayBuffer>;
10
+ leaves?: (string | Uint8Array<ArrayBuffer> | (string | Uint8Array<ArrayBuffer>)[])[] | undefined;
11
+ target?: string | Uint8Array<ArrayBuffer> | undefined;
12
+ version?: number | undefined;
13
+ }, {
14
+ pubkey: string | Uint8Array<ArrayBuffer>;
15
+ leaves?: (string | Uint8Array<ArrayBuffer> | (string | Uint8Array<ArrayBuffer>)[])[] | undefined;
16
+ target?: string | Uint8Array<ArrayBuffer> | undefined;
17
+ version?: number | undefined;
18
+ }>;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { byte32, uint } from '@vbyte/micro-lib/schema';
3
+ export const taptree = z.union([z.array(byte32), byte32]);
4
+ export const config = z.object({
5
+ pubkey: byte32,
6
+ leaves: taptree.array().optional(),
7
+ target: byte32.optional(),
8
+ version: uint.optional(),
9
+ });
@@ -0,0 +1,278 @@
1
+ import { z } from 'zod';
2
+ export declare const sats: z.ZodBigInt;
3
+ export declare const tx_output: z.ZodObject<{
4
+ value: z.ZodBigInt;
5
+ script_pk: z.ZodEffects<z.ZodString, string, string>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ value: bigint;
8
+ script_pk: string;
9
+ }, {
10
+ value: bigint;
11
+ script_pk: string;
12
+ }>;
13
+ export declare const tx_input: z.ZodObject<{
14
+ coinbase: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
15
+ txid: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
16
+ vout: z.ZodNumber;
17
+ prevout: z.ZodNullable<z.ZodObject<{
18
+ value: z.ZodBigInt;
19
+ script_pk: z.ZodEffects<z.ZodString, string, string>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ value: bigint;
22
+ script_pk: string;
23
+ }, {
24
+ value: bigint;
25
+ script_pk: string;
26
+ }>>;
27
+ script_sig: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
28
+ sequence: z.ZodNumber;
29
+ witness: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
30
+ }, "strip", z.ZodTypeAny, {
31
+ coinbase: string | null;
32
+ txid: string;
33
+ vout: number;
34
+ prevout: {
35
+ value: bigint;
36
+ script_pk: string;
37
+ } | null;
38
+ script_sig: string | null;
39
+ sequence: number;
40
+ witness: string[];
41
+ }, {
42
+ coinbase: string | null;
43
+ txid: string;
44
+ vout: number;
45
+ prevout: {
46
+ value: bigint;
47
+ script_pk: string;
48
+ } | null;
49
+ script_sig: string | null;
50
+ sequence: number;
51
+ witness: string[];
52
+ }>;
53
+ export declare const tx_data: z.ZodObject<{
54
+ version: z.ZodNumber;
55
+ vin: z.ZodArray<z.ZodObject<{
56
+ coinbase: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
57
+ txid: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
58
+ vout: z.ZodNumber;
59
+ prevout: z.ZodNullable<z.ZodObject<{
60
+ value: z.ZodBigInt;
61
+ script_pk: z.ZodEffects<z.ZodString, string, string>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ value: bigint;
64
+ script_pk: string;
65
+ }, {
66
+ value: bigint;
67
+ script_pk: string;
68
+ }>>;
69
+ script_sig: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
70
+ sequence: z.ZodNumber;
71
+ witness: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
72
+ }, "strip", z.ZodTypeAny, {
73
+ coinbase: string | null;
74
+ txid: string;
75
+ vout: number;
76
+ prevout: {
77
+ value: bigint;
78
+ script_pk: string;
79
+ } | null;
80
+ script_sig: string | null;
81
+ sequence: number;
82
+ witness: string[];
83
+ }, {
84
+ coinbase: string | null;
85
+ txid: string;
86
+ vout: number;
87
+ prevout: {
88
+ value: bigint;
89
+ script_pk: string;
90
+ } | null;
91
+ script_sig: string | null;
92
+ sequence: number;
93
+ witness: string[];
94
+ }>, "many">;
95
+ vout: z.ZodArray<z.ZodObject<{
96
+ value: z.ZodBigInt;
97
+ script_pk: z.ZodEffects<z.ZodString, string, string>;
98
+ }, "strip", z.ZodTypeAny, {
99
+ value: bigint;
100
+ script_pk: string;
101
+ }, {
102
+ value: bigint;
103
+ script_pk: string;
104
+ }>, "many">;
105
+ locktime: z.ZodNumber;
106
+ }, "strip", z.ZodTypeAny, {
107
+ version: number;
108
+ vout: {
109
+ value: bigint;
110
+ script_pk: string;
111
+ }[];
112
+ vin: {
113
+ coinbase: string | null;
114
+ txid: string;
115
+ vout: number;
116
+ prevout: {
117
+ value: bigint;
118
+ script_pk: string;
119
+ } | null;
120
+ script_sig: string | null;
121
+ sequence: number;
122
+ witness: string[];
123
+ }[];
124
+ locktime: number;
125
+ }, {
126
+ version: number;
127
+ vout: {
128
+ value: bigint;
129
+ script_pk: string;
130
+ }[];
131
+ vin: {
132
+ coinbase: string | null;
133
+ txid: string;
134
+ vout: number;
135
+ prevout: {
136
+ value: bigint;
137
+ script_pk: string;
138
+ } | null;
139
+ script_sig: string | null;
140
+ sequence: number;
141
+ witness: string[];
142
+ }[];
143
+ locktime: number;
144
+ }>;
145
+ export declare const vin_template: z.ZodObject<{
146
+ txid: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
147
+ vout: z.ZodNumber;
148
+ } & {
149
+ coinbase: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
150
+ prevout: z.ZodOptional<z.ZodNullable<z.ZodObject<{
151
+ value: z.ZodBigInt;
152
+ script_pk: z.ZodEffects<z.ZodString, string, string>;
153
+ }, "strip", z.ZodTypeAny, {
154
+ value: bigint;
155
+ script_pk: string;
156
+ }, {
157
+ value: bigint;
158
+ script_pk: string;
159
+ }>>>;
160
+ script_sig: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
161
+ sequence: z.ZodOptional<z.ZodNumber>;
162
+ witness: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ txid: string;
165
+ vout: number;
166
+ coinbase?: string | null | undefined;
167
+ prevout?: {
168
+ value: bigint;
169
+ script_pk: string;
170
+ } | null | undefined;
171
+ script_sig?: string | null | undefined;
172
+ sequence?: number | undefined;
173
+ witness?: string[] | undefined;
174
+ }, {
175
+ txid: string;
176
+ vout: number;
177
+ coinbase?: string | null | undefined;
178
+ prevout?: {
179
+ value: bigint;
180
+ script_pk: string;
181
+ } | null | undefined;
182
+ script_sig?: string | null | undefined;
183
+ sequence?: number | undefined;
184
+ witness?: string[] | undefined;
185
+ }>;
186
+ export declare const tx_template: z.ZodObject<{
187
+ version: z.ZodOptional<z.ZodNumber>;
188
+ vin: z.ZodDefault<z.ZodArray<z.ZodObject<{
189
+ txid: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
190
+ vout: z.ZodNumber;
191
+ } & {
192
+ coinbase: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
193
+ prevout: z.ZodOptional<z.ZodNullable<z.ZodObject<{
194
+ value: z.ZodBigInt;
195
+ script_pk: z.ZodEffects<z.ZodString, string, string>;
196
+ }, "strip", z.ZodTypeAny, {
197
+ value: bigint;
198
+ script_pk: string;
199
+ }, {
200
+ value: bigint;
201
+ script_pk: string;
202
+ }>>>;
203
+ script_sig: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
204
+ sequence: z.ZodOptional<z.ZodNumber>;
205
+ witness: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
206
+ }, "strip", z.ZodTypeAny, {
207
+ txid: string;
208
+ vout: number;
209
+ coinbase?: string | null | undefined;
210
+ prevout?: {
211
+ value: bigint;
212
+ script_pk: string;
213
+ } | null | undefined;
214
+ script_sig?: string | null | undefined;
215
+ sequence?: number | undefined;
216
+ witness?: string[] | undefined;
217
+ }, {
218
+ txid: string;
219
+ vout: number;
220
+ coinbase?: string | null | undefined;
221
+ prevout?: {
222
+ value: bigint;
223
+ script_pk: string;
224
+ } | null | undefined;
225
+ script_sig?: string | null | undefined;
226
+ sequence?: number | undefined;
227
+ witness?: string[] | undefined;
228
+ }>, "many">>;
229
+ vout: z.ZodDefault<z.ZodArray<z.ZodObject<{
230
+ value: z.ZodBigInt;
231
+ script_pk: z.ZodEffects<z.ZodString, string, string>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ value: bigint;
234
+ script_pk: string;
235
+ }, {
236
+ value: bigint;
237
+ script_pk: string;
238
+ }>, "many">>;
239
+ locktime: z.ZodOptional<z.ZodNumber>;
240
+ }, "strip", z.ZodTypeAny, {
241
+ vout: {
242
+ value: bigint;
243
+ script_pk: string;
244
+ }[];
245
+ vin: {
246
+ txid: string;
247
+ vout: number;
248
+ coinbase?: string | null | undefined;
249
+ prevout?: {
250
+ value: bigint;
251
+ script_pk: string;
252
+ } | null | undefined;
253
+ script_sig?: string | null | undefined;
254
+ sequence?: number | undefined;
255
+ witness?: string[] | undefined;
256
+ }[];
257
+ version?: number | undefined;
258
+ locktime?: number | undefined;
259
+ }, {
260
+ version?: number | undefined;
261
+ vout?: {
262
+ value: bigint;
263
+ script_pk: string;
264
+ }[] | undefined;
265
+ vin?: {
266
+ txid: string;
267
+ vout: number;
268
+ coinbase?: string | null | undefined;
269
+ prevout?: {
270
+ value: bigint;
271
+ script_pk: string;
272
+ } | null | undefined;
273
+ script_sig?: string | null | undefined;
274
+ sequence?: number | undefined;
275
+ witness?: string[] | undefined;
276
+ }[] | undefined;
277
+ locktime?: number | undefined;
278
+ }>;
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ import { big, hex, hex32, uint } from '@vbyte/micro-lib/schema';
3
+ export const sats = big.max(2100000000000000n);
4
+ export const tx_output = z.object({
5
+ value: sats,
6
+ script_pk: hex,
7
+ });
8
+ export const tx_input = z.object({
9
+ coinbase: hex.nullable(),
10
+ txid: hex32,
11
+ vout: uint,
12
+ prevout: tx_output.nullable(),
13
+ script_sig: hex.nullable(),
14
+ sequence: uint,
15
+ witness: z.array(hex)
16
+ });
17
+ export const tx_data = z.object({
18
+ version: uint,
19
+ vin: z.array(tx_input),
20
+ vout: z.array(tx_output),
21
+ locktime: uint,
22
+ });
23
+ export const vin_template = tx_input.extend({
24
+ coinbase: hex.nullable().optional(),
25
+ prevout: tx_output.nullable().optional(),
26
+ script_sig: hex.nullable().optional(),
27
+ sequence: uint.optional(),
28
+ witness: z.array(hex).optional(),
29
+ });
30
+ export const tx_template = z.object({
31
+ version: uint.optional(),
32
+ vin: z.array(vin_template).default([]),
33
+ vout: z.array(tx_output).default([]),
34
+ locktime: uint.optional(),
35
+ });