@vbyte/btc-dev 1.1.5 → 1.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vbyte/btc-dev",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Batteries-included toolset for plebian bitcoin development",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -79,12 +79,12 @@
79
79
  "test": "npm run script test/src/tape.ts"
80
80
  },
81
81
  "dependencies": {
82
- "@noble/curves": "^1.9.3",
83
- "@noble/hashes": "^1.8.0",
84
- "@scure/btc-signer": "^1.8.1",
82
+ "@noble/curves": "1.9.7",
83
+ "@noble/hashes": "1.8.0",
84
+ "@scure/btc-signer": "1.8.1",
85
85
  "@vbyte/buff": "^1.0.2",
86
- "@vbyte/micro-lib": "^1.1.1",
87
- "zod": "^4.0.5"
86
+ "@vbyte/micro-lib": "^1.1.2",
87
+ "zod": "^4.1.5"
88
88
  },
89
89
  "devDependencies": {
90
90
  "@cmdcode/core-cmd": "^1.6.5",
@@ -93,13 +93,13 @@
93
93
  "@rollup/plugin-node-resolve": "^16.0.1",
94
94
  "@rollup/plugin-terser": "^0.4.4",
95
95
  "@rollup/plugin-typescript": "^12.1.4",
96
- "@types/node": "^24.0.14",
96
+ "@types/node": "^24.3.1",
97
97
  "@types/tape": "^5.8.1",
98
98
  "faucet": "^0.0.4",
99
- "rollup": "^4.45.1",
99
+ "rollup": "^4.50.1",
100
100
  "tape": "^5.9.0",
101
101
  "tslib": "^2.8.1",
102
- "tsx": "^4.20.3",
103
- "typescript": "^5.8.3"
102
+ "tsx": "^4.20.5",
103
+ "typescript": "^5.9.2"
104
104
  }
105
105
  }
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ type Literal = z.infer<typeof literal>;
3
+ type Json = Literal | {
4
+ [key: string]: Json;
5
+ } | Json[];
6
+ export declare const big: z.ZodBigInt;
7
+ export declare const bool: z.ZodBoolean;
8
+ export declare const date: z.ZodDate;
9
+ export declare const num: z.ZodNumber;
10
+ export declare const int: z.ZodNumber;
11
+ export declare const u8a: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
12
+ export declare const str: z.ZodString;
13
+ export declare const stamp: z.ZodNumber;
14
+ export declare const any: z.ZodAny;
15
+ export declare const zod: typeof z;
16
+ export declare const char: z.ZodNumber;
17
+ export declare const short: z.ZodNumber;
18
+ export declare const uint: z.ZodNumber;
19
+ export declare const float: z.ZodNumber;
20
+ export declare const float2: z.ZodNumber;
21
+ export declare const hex: z.ZodString;
22
+ export declare const literal: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
23
+ export declare const json: z.ZodType<Json>;
24
+ export declare const u8a20: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
25
+ export declare const u8a32: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
26
+ export declare const u8a33: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
27
+ export declare const u8a64: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
28
+ export declare const hex20: z.ZodString;
29
+ export declare const hex32: z.ZodString;
30
+ export declare const hex33: z.ZodString;
31
+ export declare const hex64: z.ZodString;
32
+ export declare const bytes: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
33
+ export declare const byte32: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
34
+ export declare const byte33: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
35
+ export declare const byte64: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
36
+ export declare const base58: z.ZodString;
37
+ export declare const base64: z.ZodString;
38
+ export declare const base64url: z.ZodString;
39
+ export declare const bech32: z.ZodString;
40
+ export {};
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ export const big = z.bigint();
3
+ export const bool = z.boolean();
4
+ export const date = z.date();
5
+ export const num = z.number().min(Number.MIN_SAFE_INTEGER).max(Number.MAX_SAFE_INTEGER);
6
+ export const int = num.int();
7
+ export const u8a = z.instanceof(Uint8Array);
8
+ export const str = z.string();
9
+ export const stamp = int.min(500_000_000);
10
+ export const any = z.any();
11
+ export const zod = z;
12
+ export const char = int.min(0).max(0xFF);
13
+ export const short = int.min(0).max(0xFFFF);
14
+ export const uint = int.min(0).max(0xFFFFFFFF);
15
+ export const float = z.number().refine((e) => String(e).includes('.'));
16
+ export const float2 = float.refine((e) => {
17
+ const parts = String(e).split('.').at(1);
18
+ return parts !== undefined && parts.length <= 2;
19
+ });
20
+ export const hex = z.string()
21
+ .regex(/^[0-9a-fA-F]*$/)
22
+ .refine(e => e.length % 2 === 0);
23
+ export const literal = z.union([
24
+ z.string(), z.number(), z.boolean(), z.null()
25
+ ]);
26
+ export const json = z.lazy(() => z.union([literal, z.array(json), z.record(str, json)]));
27
+ export const u8a20 = u8a.refine((e) => e.length === 20);
28
+ export const u8a32 = u8a.refine((e) => e.length === 32);
29
+ export const u8a33 = u8a.refine((e) => e.length === 33);
30
+ export const u8a64 = u8a.refine((e) => e.length === 64);
31
+ export const hex20 = hex.refine((e) => e.length === 40);
32
+ export const hex32 = hex.refine((e) => e.length === 64);
33
+ export const hex33 = hex.refine((e) => e.length === 66);
34
+ export const hex64 = hex.refine((e) => e.length === 128);
35
+ export const bytes = z.union([hex, u8a]);
36
+ export const byte32 = z.union([hex32, u8a32]);
37
+ export const byte33 = z.union([hex33, u8a33]);
38
+ export const byte64 = z.union([hex64, u8a64]);
39
+ export const base58 = z.string().regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
40
+ export const base64 = z.string().regex(/^[a-zA-Z0-9+/]+={0,2}$/);
41
+ export const base64url = z.string().regex(/^[a-zA-Z0-9\-_]+={0,2}$/);
42
+ export const bech32 = z.string().regex(/^[a-z]+1[023456789acdefghjklmnpqrstuvwxyz]+$/);
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { byte32, uint } from '@vbyte/micro-lib/schema';
2
+ import { byte32, uint } from './base.js';
3
3
  export const taptree = z.union([z.array(byte32), byte32]);
4
4
  export const config = z.object({
5
5
  pubkey: byte32,
package/dist/schema/tx.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { hex, hex32, uint } from '@vbyte/micro-lib/schema';
2
+ import { hex, hex32, uint } from './base.js';
3
3
  const sats = z.bigint().min(0n).max(2100000000000000n);
4
4
  export const tx_output = z.object({
5
5
  value: sats,