@xyo-network/xl1-protocol 1.14.12 → 1.14.14
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/block/AllowedBlockPayload.d.ts +3 -3
- package/dist/neutral/block/AllowedBlockPayload.d.ts.map +1 -1
- package/dist/neutral/index.mjs +270 -182
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/model/BlockRange/Range.d.ts +1 -1
- package/dist/neutral/model/BlockRange/Range.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Time.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/TransferPayload.d.ts +0 -3
- package/dist/neutral/payload/elevatable/TransferPayload.d.ts.map +1 -1
- package/dist/neutral/zod/HydratedBlock.d.ts +214 -43
- package/dist/neutral/zod/HydratedBlock.d.ts.map +1 -1
- package/dist/neutral/zod/HydratedTransaction.d.ts +9 -9
- package/dist/neutral/zod/TransactionBoundWitness.d.ts +9 -9
- package/dist/neutral/zod/TransactionFees.d.ts +2 -2
- package/dist/neutral/zod/block/BlockBoundWitness.d.ts +345 -0
- package/dist/neutral/zod/block/BlockBoundWitness.d.ts.map +1 -0
- package/dist/neutral/zod/block/index.d.ts +4 -0
- package/dist/neutral/zod/block/index.d.ts.map +1 -0
- package/dist/neutral/zod/block/signed/SignedBlockBoundWitness.d.ts +103 -0
- package/dist/neutral/zod/block/signed/SignedBlockBoundWitness.d.ts.map +1 -0
- package/dist/neutral/zod/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts +179 -0
- package/dist/neutral/zod/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts.map +1 -0
- package/dist/neutral/zod/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts +216 -0
- package/dist/neutral/zod/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts.map +1 -0
- package/dist/neutral/zod/block/signed/index.d.ts +4 -0
- package/dist/neutral/zod/block/signed/index.d.ts.map +1 -0
- package/dist/neutral/zod/block/unsigned/UnsignedBlockBoundWitness.d.ts +103 -0
- package/dist/neutral/zod/block/unsigned/UnsignedBlockBoundWitness.d.ts.map +1 -0
- package/dist/neutral/zod/block/unsigned/index.d.ts +2 -0
- package/dist/neutral/zod/block/unsigned/index.d.ts.map +1 -0
- package/dist/neutral/zod/index.d.ts +2 -1
- package/dist/neutral/zod/index.d.ts.map +1 -1
- package/dist/neutral/zod/payload/WithHashMetaish.d.ts +27 -0
- package/dist/neutral/zod/payload/WithHashMetaish.d.ts.map +1 -0
- package/dist/neutral/zod/payload/WithStorageMetaish.d.ts +30 -0
- package/dist/neutral/zod/payload/WithStorageMetaish.d.ts.map +1 -0
- package/dist/neutral/zod/payload/index.d.ts +3 -0
- package/dist/neutral/zod/payload/index.d.ts.map +1 -0
- package/package.json +22 -21
- package/src/payload/elevatable/Time.ts +1 -3
- package/src/payload/elevatable/TransferPayload.ts +1 -3
- package/src/zod/HydratedBlock.ts +17 -1
- package/src/zod/block/BlockBoundWitness.ts +48 -0
- package/src/zod/block/index.ts +3 -0
- package/src/zod/block/signed/SignedBlockBoundWitness.ts +17 -0
- package/src/zod/block/signed/SignedBlockBoundWitnessWithHashMeta.ts +29 -0
- package/src/zod/block/signed/SignedBlockBoundWitnessWithStorageMeta.ts +35 -0
- package/src/zod/block/signed/index.ts +3 -0
- package/src/zod/block/unsigned/UnsignedBlockBoundWitness.ts +17 -0
- package/src/zod/block/unsigned/index.ts +1 -0
- package/src/zod/index.ts +2 -1
- package/src/zod/payload/WithHashMetaish.ts +23 -0
- package/src/zod/payload/WithStorageMetaish.ts +23 -0
- package/src/zod/payload/index.ts +2 -0
- package/dist/neutral/zod/BlockBoundWitness.d.ts +0 -1011
- package/dist/neutral/zod/BlockBoundWitness.d.ts.map +0 -1
- package/src/zod/BlockBoundWitness.ts +0 -114
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export * from './ArrayBuffer.ts';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './block/index.ts';
|
|
3
3
|
export * from './Chain.ts';
|
|
4
4
|
export * from './HydratedBlock.ts';
|
|
5
5
|
export * from './HydratedTransaction.ts';
|
|
6
|
+
export * from './payload/index.ts';
|
|
6
7
|
export * from './Permission.ts';
|
|
7
8
|
export * from './RewardsRangeOptions.ts';
|
|
8
9
|
export * from './Sequence.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/zod/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,
|
|
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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type z from 'zod';
|
|
2
|
+
export declare const WithHashMetaishZod: z.ZodPipe<z.ZodObject<{
|
|
3
|
+
schema: z.ZodString;
|
|
4
|
+
}, z.z.core.$strict>, z.ZodTransform<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
5
|
+
schema: string;
|
|
6
|
+
} & Partial<import("@xyo-network/payload-model").PayloadMetaFields> & {
|
|
7
|
+
_hash: import("@xylabs/hex").Hash;
|
|
8
|
+
_dataHash: import("@xylabs/hex").Hash;
|
|
9
|
+
}, {
|
|
10
|
+
schema: string;
|
|
11
|
+
}>>;
|
|
12
|
+
export type WithHashMetaish = z.input<typeof WithHashMetaishZod>;
|
|
13
|
+
export declare const toWithHashMeta: {
|
|
14
|
+
(value: unknown): Promise<(import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
15
|
+
schema: string;
|
|
16
|
+
} & Partial<import("@xyo-network/payload-model").PayloadMetaFields> & {
|
|
17
|
+
_hash: import("@xylabs/hex").Hash;
|
|
18
|
+
_dataHash: import("@xylabs/hex").Hash;
|
|
19
|
+
}) | undefined>;
|
|
20
|
+
(value: unknown, assert: import("@xylabs/zod").ZodFactoryConfig): Promise<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
21
|
+
schema: string;
|
|
22
|
+
} & Partial<import("@xyo-network/payload-model").PayloadMetaFields> & {
|
|
23
|
+
_hash: import("@xylabs/hex").Hash;
|
|
24
|
+
_dataHash: import("@xylabs/hex").Hash;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=WithHashMetaish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WithHashMetaish.d.ts","sourceRoot":"","sources":["../../../../src/zod/payload/WithHashMetaish.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,eAAO,MAAM,kBAAkB;;;;;;;;;GAQ7B,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEhE,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAG1B,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type z from 'zod';
|
|
2
|
+
export declare const WithStorageMetaishZod: z.ZodPipe<z.ZodObject<{
|
|
3
|
+
schema: z.ZodString;
|
|
4
|
+
}, z.z.core.$strict>, z.ZodTransform<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
5
|
+
schema: string;
|
|
6
|
+
} & Partial<import("@xyo-network/payload-model").PayloadMetaFields> & {
|
|
7
|
+
_hash: import("@xylabs/hex").Hash;
|
|
8
|
+
_dataHash: import("@xylabs/hex").Hash;
|
|
9
|
+
_sequence: import("@xyo-network/payload-model").LocalSequence | import("@xyo-network/payload-model").QualifiedSequence;
|
|
10
|
+
}, {
|
|
11
|
+
schema: string;
|
|
12
|
+
}>>;
|
|
13
|
+
export type WithStorageMetaish = z.input<typeof WithStorageMetaishZod>;
|
|
14
|
+
export declare const toWithStorageMeta: {
|
|
15
|
+
(value: unknown): Promise<(import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
16
|
+
schema: string;
|
|
17
|
+
} & Partial<import("@xyo-network/payload-model").PayloadMetaFields> & {
|
|
18
|
+
_hash: import("@xylabs/hex").Hash;
|
|
19
|
+
_dataHash: import("@xylabs/hex").Hash;
|
|
20
|
+
_sequence: import("@xyo-network/payload-model").LocalSequence | import("@xyo-network/payload-model").QualifiedSequence;
|
|
21
|
+
}) | undefined>;
|
|
22
|
+
(value: unknown, assert: import("@xylabs/zod").ZodFactoryConfig): Promise<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
23
|
+
schema: string;
|
|
24
|
+
} & Partial<import("@xyo-network/payload-model").PayloadMetaFields> & {
|
|
25
|
+
_hash: import("@xylabs/hex").Hash;
|
|
26
|
+
_dataHash: import("@xylabs/hex").Hash;
|
|
27
|
+
_sequence: import("@xyo-network/payload-model").LocalSequence | import("@xyo-network/payload-model").QualifiedSequence;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=WithStorageMetaish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WithStorageMetaish.d.ts","sourceRoot":"","sources":["../../../../src/zod/payload/WithStorageMetaish.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,eAAO,MAAM,qBAAqB;;;;;;;;;;GAQhC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEtE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;CAG7B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/zod/payload/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,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.14.
|
|
4
|
+
"version": "1.14.14",
|
|
5
5
|
"description": "XYO Layer One Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -40,39 +40,40 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@opentelemetry/api": "~1.9.0",
|
|
43
|
-
"@xylabs/assert": "~5.0.
|
|
44
|
-
"@xylabs/error": "~5.0.
|
|
45
|
-
"@xylabs/hex": "~5.0.
|
|
46
|
-
"@xylabs/logger": "~5.0.
|
|
47
|
-
"@xylabs/object": "~5.0.
|
|
48
|
-
"@xylabs/promise": "~5.0.
|
|
49
|
-
"@xylabs/sdk-js": "~5.0.
|
|
50
|
-
"@xylabs/typeof": "~5.0.
|
|
51
|
-
"@xylabs/zod": "~5.0.
|
|
52
|
-
"@xyo-network/archivist-model": "~5.2.
|
|
53
|
-
"@xyo-network/boundwitness-model": "~5.2.
|
|
54
|
-
"@xyo-network/payload-
|
|
55
|
-
"@xyo-network/
|
|
56
|
-
"
|
|
43
|
+
"@xylabs/assert": "~5.0.43",
|
|
44
|
+
"@xylabs/error": "~5.0.43",
|
|
45
|
+
"@xylabs/hex": "~5.0.43",
|
|
46
|
+
"@xylabs/logger": "~5.0.43",
|
|
47
|
+
"@xylabs/object": "~5.0.43",
|
|
48
|
+
"@xylabs/promise": "~5.0.43",
|
|
49
|
+
"@xylabs/sdk-js": "~5.0.43",
|
|
50
|
+
"@xylabs/typeof": "~5.0.43",
|
|
51
|
+
"@xylabs/zod": "~5.0.43",
|
|
52
|
+
"@xyo-network/archivist-model": "~5.2.10",
|
|
53
|
+
"@xyo-network/boundwitness-model": "~5.2.10",
|
|
54
|
+
"@xyo-network/payload-builder": "~5.2.10",
|
|
55
|
+
"@xyo-network/payload-model": "~5.2.10",
|
|
56
|
+
"@xyo-network/schema-payload-plugin": "~5.2.10",
|
|
57
|
+
"zod": "~4.1.13"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@types/node": "~24.10.1",
|
|
60
|
-
"@typescript-eslint/types": "~8.
|
|
61
|
-
"@xylabs/creatable": "~5.0.
|
|
61
|
+
"@typescript-eslint/types": "~8.48.0",
|
|
62
|
+
"@xylabs/creatable": "~5.0.43",
|
|
62
63
|
"@xylabs/eslint-config-flat": "~7.2.8",
|
|
63
64
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
64
65
|
"@xylabs/tsconfig": "~7.2.8",
|
|
65
|
-
"@xyo-network/account-model": "~5.2.
|
|
66
|
-
"@xyo-network/payload-builder": "~5.2.
|
|
66
|
+
"@xyo-network/account-model": "~5.2.10",
|
|
67
|
+
"@xyo-network/payload-builder": "~5.2.10",
|
|
67
68
|
"dependency-cruiser": "~17.3.1",
|
|
68
69
|
"dotenv": "~17.2.3",
|
|
69
70
|
"eslint": "~9.39.1",
|
|
70
71
|
"eslint-import-resolver-typescript": "~4.4.4",
|
|
71
|
-
"knip": "~5.70.
|
|
72
|
+
"knip": "~5.70.2",
|
|
72
73
|
"typescript": "~5.9.3",
|
|
73
74
|
"vite": "~7.2.4",
|
|
74
75
|
"vite-tsconfig-paths": "~5.1.4",
|
|
75
|
-
"vitest": "~4.0.
|
|
76
|
+
"vitest": "~4.0.13"
|
|
76
77
|
},
|
|
77
78
|
"packageManager": "yarn@4.10.3",
|
|
78
79
|
"engines": {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { HashZod } from '@xylabs/hex'
|
|
2
2
|
import { AsObjectFactory } from '@xylabs/object'
|
|
3
|
-
import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
|
|
3
|
+
import { isPayloadOfSchemaType, PayloadZodOfSchema } from '@xyo-network/payload-model'
|
|
4
4
|
import z from 'zod'
|
|
5
5
|
|
|
6
|
-
import { PayloadZodOfSchema } from './TransferPayload.ts'
|
|
7
|
-
|
|
8
6
|
// xl1 = xl1 block number, epoch = epoch number, ethereum = ethereum block number
|
|
9
7
|
export type TimeDomain = 'xl1' | 'epoch' | 'ethereum'
|
|
10
8
|
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
HexZod,
|
|
4
4
|
} from '@xylabs/hex'
|
|
5
5
|
import { AsObjectFactory, JsonObjectZod } from '@xylabs/object'
|
|
6
|
-
import { isPayloadOfSchemaType,
|
|
6
|
+
import { isPayloadOfSchemaType, PayloadZodOfSchema } from '@xyo-network/payload-model'
|
|
7
7
|
import z from 'zod'
|
|
8
8
|
|
|
9
9
|
export const TransferSchema = 'network.xyo.transfer' as const
|
|
@@ -17,8 +17,6 @@ export const TransferFieldsZod = z.object({
|
|
|
17
17
|
transfers: z.record(AddressZod, HexZod),
|
|
18
18
|
})
|
|
19
19
|
|
|
20
|
-
export const PayloadZodOfSchema = <S extends string>(schema: S) => PayloadZod.extend({ schema: z.literal(schema) })
|
|
21
|
-
|
|
22
20
|
export const TransferZod = PayloadZodOfSchema(TransferSchema).extend(TransferFieldsZod.shape)
|
|
23
21
|
|
|
24
22
|
export type Transfer = z.infer<typeof TransferZod>
|
package/src/zod/HydratedBlock.ts
CHANGED
|
@@ -9,7 +9,7 @@ import * as z from 'zod'
|
|
|
9
9
|
import {
|
|
10
10
|
BlockBoundWitnessZod,
|
|
11
11
|
SignedBlockBoundWitnessZod,
|
|
12
|
-
} from './
|
|
12
|
+
} from './block/index.ts'
|
|
13
13
|
|
|
14
14
|
export const HydratedBlockZod = z.tuple([
|
|
15
15
|
BlockBoundWitnessZod,
|
|
@@ -73,11 +73,27 @@ export const SignedHydratedBlockWithHashMetaZod = z.tuple([
|
|
|
73
73
|
|
|
74
74
|
export type SignedHydratedBlockWithHashMeta = z.infer<typeof SignedHydratedBlockWithHashMetaZod>
|
|
75
75
|
|
|
76
|
+
export const SignedHydratedBlockWithHashMetaishZod = z.tuple([
|
|
77
|
+
z.union([WithHashMetaZod(SignedBlockBoundWitnessZod)]),
|
|
78
|
+
z.array(WithHashMetaZod(PayloadZodLoose)),
|
|
79
|
+
])
|
|
80
|
+
|
|
76
81
|
export const isSignedHydratedBlockWithHashMeta = zodIsFactory(SignedHydratedBlockWithHashMetaZod)
|
|
77
82
|
export const asSignedHydratedBlockWithHashMeta = zodAsFactory(SignedHydratedBlockWithHashMetaZod, 'asSignedHydratedBlockWithHashMeta')
|
|
83
|
+
|
|
78
84
|
export const toSignedHydratedBlockWithHashMeta = zodToFactory(SignedHydratedBlockWithHashMetaZod, 'toSignedHydratedBlockWithHashMeta')
|
|
79
85
|
|
|
80
86
|
export const SignedHydratedBlockWithStorageMetaZod = z.tuple([
|
|
81
87
|
WithStorageMetaZod(SignedBlockBoundWitnessZod),
|
|
82
88
|
z.array(WithStorageMetaZod(PayloadZodLoose)),
|
|
83
89
|
])
|
|
90
|
+
export type SignedHydratedBlockWithStorageMeta = z.infer<typeof SignedHydratedBlockWithStorageMetaZod>
|
|
91
|
+
|
|
92
|
+
export const isSignedHydratedBlockWithStorageMeta = zodIsFactory(SignedHydratedBlockWithStorageMetaZod)
|
|
93
|
+
export const asSignedHydratedBlockWithStorageMeta = zodAsFactory(SignedHydratedBlockWithStorageMetaZod, 'asSignedHydratedBlockWithStorageMeta')
|
|
94
|
+
export const toSignedHydratedBlockWithStorageMeta = zodToFactory(SignedHydratedBlockWithStorageMetaZod, 'toSignedHydratedBlockWithStorageMeta')
|
|
95
|
+
|
|
96
|
+
export const SignedHydratedBlockWithStorageMetaishZod = z.tuple([
|
|
97
|
+
z.union([WithStorageMetaZod(SignedBlockBoundWitnessZod)]),
|
|
98
|
+
z.array(WithStorageMetaZod(PayloadZodLoose)),
|
|
99
|
+
])
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { HashZod } from '@xylabs/sdk-js'
|
|
2
|
+
import {
|
|
3
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
4
|
+
} from '@xylabs/zod'
|
|
5
|
+
import { BoundWitnessZod } from '@xyo-network/boundwitness-model'
|
|
6
|
+
import { HashMetaZod, StorageMetaZod } from '@xyo-network/payload-model'
|
|
7
|
+
import * as z from 'zod'
|
|
8
|
+
|
|
9
|
+
import { XL1BlockNumberZod } from '../../model/index.ts'
|
|
10
|
+
import { ChainZod } from '../Chain.ts'
|
|
11
|
+
|
|
12
|
+
export const BlockBoundWitnessFieldsZod = z.object({
|
|
13
|
+
block: XL1BlockNumberZod,
|
|
14
|
+
chain: ChainZod,
|
|
15
|
+
previous: HashZod.nullable(),
|
|
16
|
+
protocol: z.number().optional(),
|
|
17
|
+
step_hashes: z.array(HashZod).optional(),
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const BlockBoundWitnessMetaZod = z.object({ $epoch: z.number() })
|
|
21
|
+
|
|
22
|
+
export const BlockBoundWitnessZod = BoundWitnessZod
|
|
23
|
+
.safeExtend(BlockBoundWitnessFieldsZod.shape)
|
|
24
|
+
.safeExtend(BlockBoundWitnessMetaZod.shape)
|
|
25
|
+
|
|
26
|
+
export type BlockBoundWitness = z.infer<typeof BlockBoundWitnessZod>
|
|
27
|
+
|
|
28
|
+
export const isBlockBoundWitness = zodIsFactory(BlockBoundWitnessZod)
|
|
29
|
+
export const asBlockBoundWitness = zodAsFactory(BlockBoundWitnessZod, 'asBlockBoundWitness')
|
|
30
|
+
export const toBlockBoundWitness = zodToFactory(BlockBoundWitnessZod, 'toBlockBoundWitness')
|
|
31
|
+
|
|
32
|
+
export const BlockBoundWitnessWithHashMetaZod = BlockBoundWitnessZod
|
|
33
|
+
.safeExtend(HashMetaZod.shape)
|
|
34
|
+
|
|
35
|
+
export type BlockBoundWitnessWithHashMeta = z.infer<typeof BlockBoundWitnessWithHashMetaZod>
|
|
36
|
+
|
|
37
|
+
export const isBlockBoundWitnessWithHashMeta = zodIsFactory(BlockBoundWitnessWithHashMetaZod)
|
|
38
|
+
export const asBlockBoundWitnessWithHashMeta = zodAsFactory(BlockBoundWitnessWithHashMetaZod, 'asBlockBoundWitnessWithHashMeta')
|
|
39
|
+
export const toBlockBoundWitnessWithHashMeta = zodToFactory(BlockBoundWitnessWithHashMetaZod, 'toBlockBoundWitnessWithHashMeta')
|
|
40
|
+
|
|
41
|
+
export const BlockBoundWitnessWithStorageMetaZod = BlockBoundWitnessZod
|
|
42
|
+
.safeExtend(StorageMetaZod.shape)
|
|
43
|
+
|
|
44
|
+
export type BlockBoundWitnessWithStorageMeta = z.infer<typeof BlockBoundWitnessWithStorageMetaZod>
|
|
45
|
+
|
|
46
|
+
export const isBlockBoundWitnessWithStorageMeta = zodIsFactory(BlockBoundWitnessWithStorageMetaZod)
|
|
47
|
+
export const asBlockBoundWitnessWithStorageMeta = zodAsFactory(BlockBoundWitnessWithStorageMetaZod, 'asBlockBoundWitnessWithStorageMeta')
|
|
48
|
+
export const toBlockBoundWitnessWithStorageMeta = zodToFactory(BlockBoundWitnessWithStorageMetaZod, 'toBlockBoundWitnessWithStorageMeta')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
+
} from '@xylabs/zod'
|
|
4
|
+
import { SignedBoundWitnessZod } from '@xyo-network/boundwitness-model'
|
|
5
|
+
import type * as z from 'zod'
|
|
6
|
+
|
|
7
|
+
import { BlockBoundWitnessFieldsZod, BlockBoundWitnessMetaZod } from '../BlockBoundWitness.ts'
|
|
8
|
+
|
|
9
|
+
export const SignedBlockBoundWitnessZod = SignedBoundWitnessZod
|
|
10
|
+
.safeExtend(BlockBoundWitnessFieldsZod.shape)
|
|
11
|
+
.safeExtend(BlockBoundWitnessMetaZod.shape)
|
|
12
|
+
|
|
13
|
+
export type SignedBlockBoundWitness = z.infer<typeof SignedBlockBoundWitnessZod>
|
|
14
|
+
|
|
15
|
+
export const isSignedBlockBoundWitness = zodIsFactory(SignedBlockBoundWitnessZod)
|
|
16
|
+
export const asSignedBlockBoundWitness = zodAsFactory(SignedBlockBoundWitnessZod, 'asSignedBlockBoundWitness')
|
|
17
|
+
export const toSignedBlockBoundWitness = zodToFactory(SignedBlockBoundWitnessZod, 'toSignedBlockBoundWitness')
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
+
} from '@xylabs/zod'
|
|
4
|
+
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
5
|
+
import { HashMetaZod } from '@xyo-network/payload-model'
|
|
6
|
+
import type * as z from 'zod'
|
|
7
|
+
|
|
8
|
+
import { isSignedBlockBoundWitness, SignedBlockBoundWitnessZod } from './SignedBlockBoundWitness.ts'
|
|
9
|
+
|
|
10
|
+
export const SignedBlockBoundWitnessWithHashMetaZod = SignedBlockBoundWitnessZod.safeExtend(HashMetaZod.shape)
|
|
11
|
+
|
|
12
|
+
export type SignedBlockBoundWitnessWithHashMeta = z.infer<typeof SignedBlockBoundWitnessWithHashMetaZod>
|
|
13
|
+
|
|
14
|
+
export const isSignedBlockBoundWitnessWithHashMeta = zodIsFactory(SignedBlockBoundWitnessWithHashMetaZod)
|
|
15
|
+
export const asSignedBlockBoundWitnessWithHashMeta = zodAsFactory(SignedBlockBoundWitnessWithHashMetaZod, 'asSignedBlockBoundWitnessWithHashMeta')
|
|
16
|
+
|
|
17
|
+
export const SignedBlockBoundWitnessWithHashMetaishZod = SignedBlockBoundWitnessZod.transform(async (data) => {
|
|
18
|
+
if (isSignedBlockBoundWitnessWithHashMeta(data)) {
|
|
19
|
+
return data
|
|
20
|
+
}
|
|
21
|
+
if (isSignedBlockBoundWitness(data)) {
|
|
22
|
+
return await PayloadBuilder.addHashMeta(data)
|
|
23
|
+
}
|
|
24
|
+
throw new Error('Invalid SignedBlockBoundWitnessWithHashMetaish format')
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export type SignedBlockBoundWitnessWithHashMetaish = z.input<typeof SignedBlockBoundWitnessWithHashMetaishZod>
|
|
28
|
+
|
|
29
|
+
export const toSignedBlockBoundWitnessWithHashMeta = zodToFactory(SignedBlockBoundWitnessWithHashMetaZod, 'toSignedBlockBoundWitnessWithHashMeta')
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
+
} from '@xylabs/zod'
|
|
4
|
+
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
5
|
+
import { StorageMetaZod } from '@xyo-network/payload-model'
|
|
6
|
+
import type * as z from 'zod'
|
|
7
|
+
|
|
8
|
+
import { isSignedBlockBoundWitness, SignedBlockBoundWitnessZod } from './SignedBlockBoundWitness.ts'
|
|
9
|
+
|
|
10
|
+
export const SignedBlockBoundWitnessWithStorageMetaZod = SignedBlockBoundWitnessZod.safeExtend(StorageMetaZod.shape)
|
|
11
|
+
|
|
12
|
+
export type SignedBlockBoundWitnessWithStorageMeta = z.infer<typeof SignedBlockBoundWitnessWithStorageMetaZod>
|
|
13
|
+
|
|
14
|
+
export const isSignedBlockBoundWitnessWithStorageMeta = zodIsFactory(SignedBlockBoundWitnessWithStorageMetaZod)
|
|
15
|
+
export const asSignedBlockBoundWitnessWithStorageMeta = zodAsFactory(
|
|
16
|
+
SignedBlockBoundWitnessWithStorageMetaZod,
|
|
17
|
+
'asSignedBlockBoundWitnessWithStorageMeta',
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
export const SignedBlockBoundWitnessWithStorageMetaishZod = SignedBlockBoundWitnessZod.transform(async (data) => {
|
|
21
|
+
if (isSignedBlockBoundWitnessWithStorageMeta(data)) {
|
|
22
|
+
return data
|
|
23
|
+
}
|
|
24
|
+
if (isSignedBlockBoundWitness(data)) {
|
|
25
|
+
return await PayloadBuilder.addStorageMeta(data)
|
|
26
|
+
}
|
|
27
|
+
throw new Error('Invalid SignedBlockBoundWitnessWithStorageMetaish format')
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
export type SignedBlockBoundWitnessWithStorageMetaish = z.input<typeof SignedBlockBoundWitnessWithStorageMetaishZod>
|
|
31
|
+
|
|
32
|
+
export const toSignedBlockBoundWitnessWithStorageMeta = zodToFactory(
|
|
33
|
+
SignedBlockBoundWitnessWithStorageMetaishZod,
|
|
34
|
+
'toSignedBlockBoundWitnessWithStorageMeta',
|
|
35
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
+
} from '@xylabs/zod'
|
|
4
|
+
import { UnsignedBoundWitnessZod } from '@xyo-network/boundwitness-model'
|
|
5
|
+
import type * as z from 'zod'
|
|
6
|
+
|
|
7
|
+
import { BlockBoundWitnessFieldsZod, BlockBoundWitnessMetaZod } from '../BlockBoundWitness.ts'
|
|
8
|
+
|
|
9
|
+
export const UnsignedBlockBoundWitnessZod = UnsignedBoundWitnessZod
|
|
10
|
+
.safeExtend(BlockBoundWitnessFieldsZod.shape)
|
|
11
|
+
.safeExtend(BlockBoundWitnessMetaZod.shape)
|
|
12
|
+
|
|
13
|
+
export type UnsignedBlockBoundWitness = z.infer<typeof UnsignedBlockBoundWitnessZod>
|
|
14
|
+
|
|
15
|
+
export const isUnsignedBlockBoundWitness = zodIsFactory(UnsignedBlockBoundWitnessZod)
|
|
16
|
+
export const asUnsignedBlockBoundWitness = zodAsFactory(UnsignedBlockBoundWitnessZod, 'asUnsignedBlockBoundWitness')
|
|
17
|
+
export const toUnsignedBlockBoundWitness = zodToFactory(UnsignedBlockBoundWitnessZod, 'toUnsignedBlockBoundWitness')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './UnsignedBlockBoundWitness.ts'
|
package/src/zod/index.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export * from './ArrayBuffer.ts'
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './block/index.ts'
|
|
3
3
|
export * from './Chain.ts'
|
|
4
4
|
export * from './HydratedBlock.ts'
|
|
5
5
|
export * from './HydratedTransaction.ts'
|
|
6
|
+
export * from './payload/index.ts'
|
|
6
7
|
export * from './Permission.ts'
|
|
7
8
|
export * from './RewardsRangeOptions.ts'
|
|
8
9
|
export * from './Sequence.ts'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { zodToAsyncFactory } from '@xylabs/zod'
|
|
2
|
+
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
3
|
+
import {
|
|
4
|
+
isAnyPayload, isHashMeta, PayloadZodLoose,
|
|
5
|
+
} from '@xyo-network/payload-model'
|
|
6
|
+
import type z from 'zod'
|
|
7
|
+
|
|
8
|
+
export const WithHashMetaishZod = PayloadZodLoose.transform(async (data) => {
|
|
9
|
+
if (isAnyPayload(data)) {
|
|
10
|
+
if (isHashMeta(data)) {
|
|
11
|
+
return data
|
|
12
|
+
}
|
|
13
|
+
return await PayloadBuilder.addHashMeta(data)
|
|
14
|
+
}
|
|
15
|
+
throw new Error('Invalid WithHashMetaish format')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export type WithHashMetaish = z.input<typeof WithHashMetaishZod>
|
|
19
|
+
|
|
20
|
+
export const toWithHashMeta = zodToAsyncFactory(
|
|
21
|
+
WithHashMetaishZod,
|
|
22
|
+
'toWithHashMeta',
|
|
23
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { zodToAsyncFactory } from '@xylabs/zod'
|
|
2
|
+
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
3
|
+
import {
|
|
4
|
+
isAnyPayload, isStorageMeta, PayloadZodLoose,
|
|
5
|
+
} from '@xyo-network/payload-model'
|
|
6
|
+
import type z from 'zod'
|
|
7
|
+
|
|
8
|
+
export const WithStorageMetaishZod = PayloadZodLoose.transform(async (data) => {
|
|
9
|
+
if (isAnyPayload(data)) {
|
|
10
|
+
if (isStorageMeta(data)) {
|
|
11
|
+
return data
|
|
12
|
+
}
|
|
13
|
+
return await PayloadBuilder.addStorageMeta(data)
|
|
14
|
+
}
|
|
15
|
+
throw new Error('Invalid WithStorageMetaish format')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export type WithStorageMetaish = z.input<typeof WithStorageMetaishZod>
|
|
19
|
+
|
|
20
|
+
export const toWithStorageMeta = zodToAsyncFactory(
|
|
21
|
+
WithStorageMetaishZod,
|
|
22
|
+
'toWithStorageMeta',
|
|
23
|
+
)
|