@xyo-network/xl1-protocol 1.18.2 → 1.18.3
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/neutral/index.mjs +172 -155
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/zod/BlockRate.d.ts +43 -0
- package/dist/neutral/zod/BlockRate.d.ts.map +1 -0
- package/dist/neutral/zod/index.d.ts +1 -0
- package/dist/neutral/zod/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/zod/BlockRate.ts +17 -0
- package/src/zod/index.ts +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
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 BlockRateZod = 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
|
+
//# 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;AAIvB,eAAO,MAAM,YAAY;;;;;iBAKvB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAEvD,eAAO,MAAM,WAAW;;;;;CAA6B,CAAA;AACrD,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAA4C,CAAA;AACpE,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAA4C,CAAA"}
|
|
@@ -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.
|
|
4
|
+
"version": "1.18.3",
|
|
5
5
|
"description": "XYO Layer One Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -87,4 +87,4 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
}
|
|
90
|
-
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { zodAsFactory, zodIsFactory } from '@xylabs/zod'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { XL1BlockRangeZod } from '../model/index.ts'
|
|
5
|
+
|
|
6
|
+
export const BlockRateZod = z.object({
|
|
7
|
+
range: XL1BlockRangeZod.describe('the block range the rate was calculated over'),
|
|
8
|
+
rate: z.number().nonnegative().describe('time to make a block'),
|
|
9
|
+
span: z.int().nonnegative().describe('number of blocks the rate was calculated over'),
|
|
10
|
+
timeDifference: z.number().nonnegative().describe('time difference from start and end block'),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export type BlockRateZod = z.infer<typeof BlockRateZod>
|
|
14
|
+
|
|
15
|
+
export const isBlockRate = zodIsFactory(BlockRateZod)
|
|
16
|
+
export const asBlockRate = zodAsFactory(BlockRateZod, 'asBlockRate')
|
|
17
|
+
export const toBlockRate = zodAsFactory(BlockRateZod, 'toBlockRate')
|