@xyo-network/xl1-protocol 1.18.2 → 1.18.4

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.
@@ -0,0 +1,100 @@
1
+ import { z } from 'zod';
2
+ export declare const BlockRateZod: z.ZodObject<{
3
+ range: z.ZodTuple<[z.ZodPipe<z.ZodNumber, z.ZodTransform<import("../model/index.ts").XL1BlockNumber, number>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<import("../model/index.ts").XL1BlockNumber, number>>], null>;
4
+ rate: z.ZodNumber;
5
+ span: z.ZodInt;
6
+ timeDifference: z.ZodNumber;
7
+ }, z.core.$strip>;
8
+ export type BlockRate = z.infer<typeof BlockRateZod>;
9
+ export declare const isBlockRate: <T>(value: T) => value is T & {
10
+ range: [import("../model/index.ts").XL1BlockNumber, import("../model/index.ts").XL1BlockNumber];
11
+ rate: number;
12
+ span: number;
13
+ timeDifference: number;
14
+ };
15
+ export declare const asBlockRate: {
16
+ <T>(value: T): (T & {
17
+ range: [import("../model/index.ts").XL1BlockNumber, import("../model/index.ts").XL1BlockNumber];
18
+ rate: number;
19
+ span: number;
20
+ timeDifference: number;
21
+ }) | undefined;
22
+ <T>(value: T, assert: import("@xylabs/zod").ZodFactoryConfig): T & {
23
+ range: [import("../model/index.ts").XL1BlockNumber, import("../model/index.ts").XL1BlockNumber];
24
+ rate: number;
25
+ span: number;
26
+ timeDifference: number;
27
+ };
28
+ };
29
+ export declare const toBlockRate: {
30
+ <T>(value: T): (T & {
31
+ range: [import("../model/index.ts").XL1BlockNumber, import("../model/index.ts").XL1BlockNumber];
32
+ rate: number;
33
+ span: number;
34
+ timeDifference: number;
35
+ }) | undefined;
36
+ <T>(value: T, assert: import("@xylabs/zod").ZodFactoryConfig): T & {
37
+ range: [import("../model/index.ts").XL1BlockNumber, import("../model/index.ts").XL1BlockNumber];
38
+ rate: number;
39
+ span: number;
40
+ timeDifference: number;
41
+ };
42
+ };
43
+ export declare const TimeDurationsZod: z.ZodObject<{
44
+ millis: z.ZodNumber;
45
+ seconds: z.ZodNumber;
46
+ minutes: z.ZodNumber;
47
+ hours: z.ZodNumber;
48
+ days: z.ZodNumber;
49
+ weeks: z.ZodNumber;
50
+ }, z.core.$strip>;
51
+ export declare const isTimeDurations: <T>(value: T) => value is T & {
52
+ millis: number;
53
+ seconds: number;
54
+ minutes: number;
55
+ hours: number;
56
+ days: number;
57
+ weeks: number;
58
+ };
59
+ export declare const asTimeDurations: {
60
+ <T>(value: T): (T & {
61
+ millis: number;
62
+ seconds: number;
63
+ minutes: number;
64
+ hours: number;
65
+ days: number;
66
+ weeks: number;
67
+ }) | undefined;
68
+ <T>(value: T, assert: import("@xylabs/zod").ZodFactoryConfig): T & {
69
+ millis: number;
70
+ seconds: number;
71
+ minutes: number;
72
+ hours: number;
73
+ days: number;
74
+ weeks: number;
75
+ };
76
+ };
77
+ export declare const toTimeDurations: {
78
+ <T>(value: T): (T & {
79
+ millis: number;
80
+ seconds: number;
81
+ minutes: number;
82
+ hours: number;
83
+ days: number;
84
+ weeks: number;
85
+ }) | undefined;
86
+ <T>(value: T, assert: import("@xylabs/zod").ZodFactoryConfig): T & {
87
+ millis: number;
88
+ seconds: number;
89
+ minutes: number;
90
+ hours: number;
91
+ days: number;
92
+ weeks: number;
93
+ };
94
+ };
95
+ export type TimeDurations = z.infer<typeof TimeDurationsZod>;
96
+ export declare const CountZod: z.ZodInt;
97
+ export type Count = z.infer<typeof CountZod>;
98
+ export declare const StepIndexZod: z.ZodInt;
99
+ export type StepIndex = z.infer<typeof StepIndexZod>;
100
+ //# sourceMappingURL=BlockRate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlockRate.d.ts","sourceRoot":"","sources":["../../../src/zod/BlockRate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,YAAY;;;;;iBAKvB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAEpD,eAAO,MAAM,WAAW;;;;;CAA6B,CAAA;AACrD,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAA4C,CAAA;AACpE,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAA4C,CAAA;AAEpE,eAAO,MAAM,gBAAgB;;;;;;;iBAO3B,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;CAAiC,CAAA;AAC7D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAAoD,CAAA;AAChF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAAoD,CAAA;AAEhF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE5D,eAAO,MAAM,QAAQ,UAAiE,CAAA;AACtF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE5C,eAAO,MAAM,YAAY,UAAqF,CAAA;AAC9G,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
@@ -1,5 +1,6 @@
1
1
  export * from './ArrayBuffer.ts';
2
2
  export * from './block/index.ts';
3
+ export * from './BlockRate.ts';
3
4
  export * from './Chain.ts';
4
5
  export * from './HydratedBlock.ts';
5
6
  export * from './HydratedTransaction.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/zod/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/zod/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/xl1-protocol",
4
- "version": "1.18.2",
4
+ "version": "1.18.4",
5
5
  "description": "XYO Layer One Protocol",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -69,7 +69,7 @@
69
69
  "dotenv": "~17.2.3",
70
70
  "eslint": "~9.39.2",
71
71
  "eslint-import-resolver-typescript": "~4.4.4",
72
- "knip": "~5.76.3",
72
+ "knip": "~5.77.1",
73
73
  "typescript": "~5.9.3",
74
74
  "vite": "~7.3.0",
75
75
  "vite-tsconfig-paths": "~6.0.3",
@@ -87,4 +87,4 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  }
90
- }
90
+ }
@@ -0,0 +1,39 @@
1
+ import { zodAsFactory, zodIsFactory } from '@xylabs/zod'
2
+ import { z } from 'zod'
3
+
4
+ import { StepSizes } from '../constants/index.ts'
5
+ import { XL1BlockRangeZod } from '../model/index.ts'
6
+
7
+ export const BlockRateZod = z.object({
8
+ range: XL1BlockRangeZod.describe('the block range the rate was calculated over'),
9
+ rate: z.number().nonnegative().describe('time to make a block'),
10
+ span: z.int().nonnegative().describe('number of blocks the rate was calculated over'),
11
+ timeDifference: z.number().nonnegative().describe('time difference from start and end block'),
12
+ })
13
+
14
+ export type BlockRate = z.infer<typeof BlockRateZod>
15
+
16
+ export const isBlockRate = zodIsFactory(BlockRateZod)
17
+ export const asBlockRate = zodAsFactory(BlockRateZod, 'asBlockRate')
18
+ export const toBlockRate = zodAsFactory(BlockRateZod, 'toBlockRate')
19
+
20
+ export const TimeDurationsZod = z.object({
21
+ millis: z.number().nonnegative(),
22
+ seconds: z.number().nonnegative(),
23
+ minutes: z.number().nonnegative(),
24
+ hours: z.number().nonnegative(),
25
+ days: z.number().nonnegative(),
26
+ weeks: z.number().nonnegative(),
27
+ })
28
+
29
+ export const isTimeDurations = zodIsFactory(TimeDurationsZod)
30
+ export const asTimeDurations = zodAsFactory(TimeDurationsZod, 'asTimeDurations')
31
+ export const toTimeDurations = zodAsFactory(TimeDurationsZod, 'toTimeDurations')
32
+
33
+ export type TimeDurations = z.infer<typeof TimeDurationsZod>
34
+
35
+ export const CountZod = z.int().nonnegative().describe('A non-negative integer count')
36
+ export type Count = z.infer<typeof CountZod>
37
+
38
+ export const StepIndexZod = z.int().min(0).max(StepSizes.length).describe('A non-negative integer step index')
39
+ export type StepIndex = z.infer<typeof StepIndexZod>
package/src/zod/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './ArrayBuffer.ts'
2
2
  export * from './block/index.ts'
3
+ export * from './BlockRate.ts'
3
4
  export * from './Chain.ts'
4
5
  export * from './HydratedBlock.ts'
5
6
  export * from './HydratedTransaction.ts'