@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.
- package/LICENSE +121 -0
- package/README.md +5 -0
- package/dist/class/index.d.ts +5 -0
- package/dist/class/index.js +5 -0
- package/dist/class/signer.d.ts +18 -0
- package/dist/class/signer.js +32 -0
- package/dist/class/tx.d.ts +38 -0
- package/dist/class/tx.js +73 -0
- package/dist/class/txin.d.ts +29 -0
- package/dist/class/txin.js +68 -0
- package/dist/class/txout.d.ts +18 -0
- package/dist/class/txout.js +38 -0
- package/dist/class/witness.d.ts +20 -0
- package/dist/class/witness.js +57 -0
- package/dist/const.d.ts +22 -0
- package/dist/const.js +36 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10 -0
- package/dist/lib/address/encode.d.ts +3 -0
- package/dist/lib/address/encode.js +79 -0
- package/dist/lib/address/index.d.ts +20 -0
- package/dist/lib/address/index.js +21 -0
- package/dist/lib/address/p2pkh.d.ts +10 -0
- package/dist/lib/address/p2pkh.js +33 -0
- package/dist/lib/address/p2sh.d.ts +10 -0
- package/dist/lib/address/p2sh.js +33 -0
- package/dist/lib/address/p2tr.d.ts +8 -0
- package/dist/lib/address/p2tr.js +26 -0
- package/dist/lib/address/p2wpkh.d.ts +10 -0
- package/dist/lib/address/p2wpkh.js +34 -0
- package/dist/lib/address/p2wsh.d.ts +10 -0
- package/dist/lib/address/p2wsh.js +33 -0
- package/dist/lib/address/script.d.ts +5 -0
- package/dist/lib/address/script.js +46 -0
- package/dist/lib/address/util.d.ts +4 -0
- package/dist/lib/address/util.js +57 -0
- package/dist/lib/meta/index.d.ts +2 -0
- package/dist/lib/meta/index.js +2 -0
- package/dist/lib/meta/pointer.d.ts +42 -0
- package/dist/lib/meta/pointer.js +69 -0
- package/dist/lib/meta/scribe.d.ts +7 -0
- package/dist/lib/meta/scribe.js +192 -0
- package/dist/lib/psbt/encoder.d.ts +5 -0
- package/dist/lib/psbt/encoder.js +21 -0
- package/dist/lib/psbt/index.d.ts +4 -0
- package/dist/lib/psbt/index.js +4 -0
- package/dist/lib/psbt/meta.d.ts +3 -0
- package/dist/lib/psbt/meta.js +11 -0
- package/dist/lib/psbt/util.d.ts +5 -0
- package/dist/lib/psbt/util.js +44 -0
- package/dist/lib/psbt/validate.d.ts +2 -0
- package/dist/lib/psbt/validate.js +11 -0
- package/dist/lib/script/decode.d.ts +2 -0
- package/dist/lib/script/decode.js +55 -0
- package/dist/lib/script/encode.d.ts +6 -0
- package/dist/lib/script/encode.js +80 -0
- package/dist/lib/script/index.d.ts +126 -0
- package/dist/lib/script/index.js +17 -0
- package/dist/lib/script/util.d.ts +2 -0
- package/dist/lib/script/util.js +10 -0
- package/dist/lib/script/words.d.ts +116 -0
- package/dist/lib/script/words.js +164 -0
- package/dist/lib/sighash/index.d.ts +5 -0
- package/dist/lib/sighash/index.js +5 -0
- package/dist/lib/sighash/segwit.d.ts +3 -0
- package/dist/lib/sighash/segwit.js +89 -0
- package/dist/lib/sighash/sign.d.ts +3 -0
- package/dist/lib/sighash/sign.js +20 -0
- package/dist/lib/sighash/taproot.d.ts +9 -0
- package/dist/lib/sighash/taproot.js +124 -0
- package/dist/lib/sighash/util.d.ts +3 -0
- package/dist/lib/sighash/util.js +16 -0
- package/dist/lib/sighash/verify.d.ts +1 -0
- package/dist/lib/sighash/verify.js +1 -0
- package/dist/lib/taproot/cblock.d.ts +3 -0
- package/dist/lib/taproot/cblock.js +55 -0
- package/dist/lib/taproot/encode.d.ts +6 -0
- package/dist/lib/taproot/encode.js +26 -0
- package/dist/lib/taproot/index.d.ts +4 -0
- package/dist/lib/taproot/index.js +4 -0
- package/dist/lib/taproot/parse.d.ts +11 -0
- package/dist/lib/taproot/parse.js +47 -0
- package/dist/lib/taproot/tree.d.ts +3 -0
- package/dist/lib/taproot/tree.js +49 -0
- package/dist/lib/tx/create.d.ts +6 -0
- package/dist/lib/tx/create.js +54 -0
- package/dist/lib/tx/decode.d.ts +9 -0
- package/dist/lib/tx/decode.js +109 -0
- package/dist/lib/tx/encode.d.ts +15 -0
- package/dist/lib/tx/encode.js +94 -0
- package/dist/lib/tx/index.d.ts +10 -0
- package/dist/lib/tx/index.js +10 -0
- package/dist/lib/tx/locktime.d.ts +7 -0
- package/dist/lib/tx/locktime.js +37 -0
- package/dist/lib/tx/meta.d.ts +8 -0
- package/dist/lib/tx/meta.js +48 -0
- package/dist/lib/tx/parse.d.ts +2 -0
- package/dist/lib/tx/parse.js +12 -0
- package/dist/lib/tx/sequence.d.ts +7 -0
- package/dist/lib/tx/sequence.js +65 -0
- package/dist/lib/tx/size.d.ts +10 -0
- package/dist/lib/tx/size.js +48 -0
- package/dist/lib/tx/validate.d.ts +7 -0
- package/dist/lib/tx/validate.js +21 -0
- package/dist/lib/tx/witness.d.ts +3 -0
- package/dist/lib/tx/witness.js +85 -0
- package/dist/main.cjs +14625 -0
- package/dist/main.cjs.map +1 -0
- package/dist/module.mjs +14610 -0
- package/dist/module.mjs.map +1 -0
- package/dist/package.json +106 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/taproot.d.ts +18 -0
- package/dist/schema/taproot.js +9 -0
- package/dist/schema/tx.d.ts +278 -0
- package/dist/schema/tx.js +35 -0
- package/dist/script.js +15 -0
- package/dist/script.js.map +1 -0
- package/dist/types/address.d.ts +34 -0
- package/dist/types/address.js +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +9 -0
- package/dist/types/meta.d.ts +10 -0
- package/dist/types/meta.js +1 -0
- package/dist/types/psbt.d.ts +9 -0
- package/dist/types/psbt.js +1 -0
- package/dist/types/sighash.d.ts +14 -0
- package/dist/types/sighash.js +1 -0
- package/dist/types/taproot.d.ts +35 -0
- package/dist/types/taproot.js +1 -0
- package/dist/types/transaction.d.ts +81 -0
- package/dist/types/transaction.js +1 -0
- package/dist/types/txdata.d.ts +45 -0
- package/dist/types/txdata.js +1 -0
- package/dist/types/txmeta.d.ts +19 -0
- package/dist/types/txmeta.js +1 -0
- package/dist/types/witness.d.ts +30 -0
- package/dist/types/witness.js +1 -0
- package/package.json +106 -0
- package/src/class/index.ts +5 -0
- package/src/class/signer.ts +47 -0
- package/src/class/tx.ts +118 -0
- package/src/class/txin.ts +95 -0
- package/src/class/txout.ts +57 -0
- package/src/class/witness.ts +85 -0
- package/src/const.ts +43 -0
- package/src/index.ts +14 -0
- package/src/lib/address/encode.ts +183 -0
- package/src/lib/address/index.ts +24 -0
- package/src/lib/address/p2pkh.ts +65 -0
- package/src/lib/address/p2sh.ts +65 -0
- package/src/lib/address/p2tr.ts +51 -0
- package/src/lib/address/p2wpkh.ts +67 -0
- package/src/lib/address/p2wsh.ts +65 -0
- package/src/lib/address/script.ts +63 -0
- package/src/lib/address/util.ts +102 -0
- package/src/lib/meta/index.ts +2 -0
- package/src/lib/meta/pointer.ts +107 -0
- package/src/lib/meta/scribe.ts +251 -0
- package/src/lib/psbt/encoder.ts +24 -0
- package/src/lib/psbt/index.ts +4 -0
- package/src/lib/psbt/meta.ts +15 -0
- package/src/lib/psbt/util.ts +62 -0
- package/src/lib/psbt/validate.ts +18 -0
- package/src/lib/script/decode.ts +75 -0
- package/src/lib/script/encode.ts +130 -0
- package/src/lib/script/index.ts +26 -0
- package/src/lib/script/util.ts +78 -0
- package/src/lib/script/words.ts +182 -0
- package/src/lib/sighash/index.ts +5 -0
- package/src/lib/sighash/segwit.ts +152 -0
- package/src/lib/sighash/sign.ts +35 -0
- package/src/lib/sighash/taproot.ts +236 -0
- package/src/lib/sighash/util.ts +29 -0
- package/src/lib/sighash/verify.ts +83 -0
- package/src/lib/taproot/cblock.ts +95 -0
- package/src/lib/taproot/encode.ts +49 -0
- package/src/lib/taproot/index.ts +4 -0
- package/src/lib/taproot/parse.ts +65 -0
- package/src/lib/taproot/tree.ts +94 -0
- package/src/lib/tx/create.ts +82 -0
- package/src/lib/tx/decode.ts +145 -0
- package/src/lib/tx/encode.ts +154 -0
- package/src/lib/tx/index.ts +10 -0
- package/src/lib/tx/locktime.ts +57 -0
- package/src/lib/tx/meta.ts +73 -0
- package/src/lib/tx/parse.ts +16 -0
- package/src/lib/tx/sequence.ts +146 -0
- package/src/lib/tx/size.ts +77 -0
- package/src/lib/tx/validate.ts +36 -0
- package/src/lib/tx/witness.ts +122 -0
- package/src/schema/index.ts +2 -0
- package/src/schema/taproot.ts +12 -0
- package/src/schema/tx.ts +42 -0
- package/src/types/address.ts +39 -0
- package/src/types/index.ts +9 -0
- package/src/types/meta.ts +10 -0
- package/src/types/psbt.ts +15 -0
- package/src/types/sighash.ts +16 -0
- package/src/types/taproot.ts +40 -0
- package/src/types/transaction.ts +98 -0
- package/src/types/txdata.ts +53 -0
- package/src/types/txmeta.ts +25 -0
- 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,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
|
+
});
|