@xyo-network/xl1-protocol 1.25.1 → 1.25.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.
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  zodAsFactory, zodIsFactory, zodToFactory,
3
3
  } from '@xylabs/sdk-js'
4
- import { PayloadBuilder, StorageMetaZod } from '@xyo-network/sdk-js'
4
+ import { PayloadBuilder, WithStorageMetaZod } from '@xyo-network/sdk-js'
5
5
  import type { z } from 'zod'
6
6
 
7
7
  import { isSignedBlockBoundWitness, SignedBlockBoundWitnessZod } from './SignedBlockBoundWitness.ts'
8
8
 
9
- export const SignedBlockBoundWitnessWithStorageMetaZod = SignedBlockBoundWitnessZod.safeExtend(StorageMetaZod.shape)
9
+ export const SignedBlockBoundWitnessWithStorageMetaZod = WithStorageMetaZod(SignedBlockBoundWitnessZod)
10
10
 
11
11
  export type SignedBlockBoundWitnessWithStorageMeta = z.infer<typeof SignedBlockBoundWitnessWithStorageMetaZod>
12
12
 
@@ -1,18 +1,17 @@
1
- import type { Payload, WithStorageMeta } from '@xyo-network/sdk-js'
1
+ import type {
2
+ Payload,
3
+ ReadArchivist, WriteArchivist,
4
+ } from '@xyo-network/sdk-js'
2
5
  import z from 'zod'
3
6
 
4
- import type { PayloadMapRead, PayloadMapWrite } from '../PayloadMap.ts'
5
7
  import { CachingContextZod } from './CachingContext.zod.ts'
6
8
 
7
9
  export const BlockContextReadZod = CachingContextZod.extend(
8
- { chainMap: z.custom<PayloadMapRead<WithStorageMeta<Payload>>>(val => val && typeof val === 'object' && ('get' in val || 'set' in val)) },
10
+ { chainMap: z.custom<ReadArchivist<Payload>>(val => val && typeof val === 'object' && ('get' in val)) },
9
11
  )
10
12
 
11
13
  export const BlockContextWriteZod = CachingContextZod.extend(
12
- { chainMap: z.custom<PayloadMapWrite<WithStorageMeta<Payload>>>(val => val && typeof val === 'object' && ('get' in val || 'set' in val)) },
14
+ { chainMap: z.custom<WriteArchivist<Payload>>(val => val && typeof val === 'object' && ('get' in val && 'insert' in val)) },
13
15
  )
14
16
 
15
- export const BlockContextZod = z.intersection(
16
- BlockContextReadZod,
17
- BlockContextWriteZod,
18
- )
17
+ export const BlockContextZod = BlockContextWriteZod
@@ -1,19 +1,14 @@
1
- import z from 'zod'
2
-
3
- import { BlockContextReadZod, BlockContextWriteZod } from './BlockContext.zod.ts'
1
+ import {
2
+ BlockContextReadZod, BlockContextWriteZod, BlockContextZod,
3
+ } from './BlockContext.zod.ts'
4
4
  import { HeadContextBaseZod } from './HeadContext.zod.ts'
5
5
 
6
- export const ChainContextReadZod = z.intersection(
7
- HeadContextBaseZod,
8
- BlockContextReadZod,
9
- )
6
+ export const ChainContextReadZod = BlockContextReadZod.safeExtend(HeadContextBaseZod.shape)
10
7
 
11
- export const ChainContextWriteZod = z.intersection(
12
- HeadContextBaseZod,
13
- BlockContextWriteZod,
8
+ export const ChainContextWriteZod = BlockContextWriteZod.safeExtend(
9
+ HeadContextBaseZod.shape,
14
10
  )
15
11
 
16
- export const ChainContextZod = z.intersection(
17
- ChainContextReadZod,
18
- ChainContextWriteZod,
12
+ export const ChainContextZod = BlockContextZod.safeExtend(
13
+ HeadContextBaseZod.shape,
19
14
  )
@@ -8,4 +8,4 @@ export const HeadContextBaseZod = z.object(
8
8
  { head: WithHashMetaZod(BlockBoundWitnessZod) },
9
9
  )
10
10
 
11
- export const HeadContextZod = z.intersection(CachingContextZod, HeadContextBaseZod)
11
+ export const HeadContextZod = CachingContextZod.safeExtend(HeadContextBaseZod.shape)
@@ -2,6 +2,7 @@ import {
2
2
  zodAsFactory, zodIsFactory, zodToFactory,
3
3
  } from '@xylabs/sdk-js'
4
4
  import {
5
+ PayloadZod,
5
6
  PayloadZodLoose, WithHashMetaZod,
6
7
  WithStorageMetaZod,
7
8
  } from '@xyo-network/sdk-js'
@@ -96,7 +97,7 @@ export const toSignedHydratedTransaction = zodToFactory(SignedHydratedTransactio
96
97
 
97
98
  export const SignedHydratedTransactionWithHashMetaZod = z.tuple([
98
99
  WithHashMetaZod(SignedTransactionBoundWitnessZod),
99
- z.array(WithHashMetaZod(PayloadZodLoose)),
100
+ z.array(WithHashMetaZod(PayloadZod).loose()),
100
101
  ])
101
102
 
102
103
  export type SignedHydratedTransactionWithHashMeta = z.infer<typeof SignedHydratedTransactionWithHashMetaZod>
@@ -107,7 +108,7 @@ export const toSignedHydratedTransactionWithHashMeta = zodToFactory(SignedHydrat
107
108
 
108
109
  export const SignedHydratedTransactionWithStorageMetaZod = z.tuple([
109
110
  WithStorageMetaZod(SignedTransactionBoundWitnessZod),
110
- z.array(WithStorageMetaZod(PayloadZodLoose)),
111
+ z.array(WithStorageMetaZod(PayloadZod).loose()),
111
112
  ])
112
113
 
113
114
  export type SignedHydratedTransactionWithStorageMeta = z.infer<typeof SignedHydratedTransactionWithStorageMetaZod>