@xyo-network/xl1-rpc 1.11.0 → 1.12.0
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/engine/requestSchemas.d.ts +2 -2
- package/dist/neutral/engine/requestSchemas.d.ts.map +1 -1
- package/dist/neutral/index.mjs +433 -312
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/connection/XyoConnection.d.ts +2 -2
- package/dist/neutral/provider/connection/XyoConnection.d.ts.map +1 -1
- package/dist/neutral/provider/runner/JsonRpcXyoRunner.d.ts +2 -2
- package/dist/neutral/provider/runner/JsonRpcXyoRunner.d.ts.map +1 -1
- package/dist/neutral/provider/runner/MemoryXyoRunner.d.ts +2 -2
- package/dist/neutral/provider/runner/MemoryXyoRunner.d.ts.map +1 -1
- package/dist/neutral/provider/runner/NodeXyoRunner.d.ts +2 -2
- package/dist/neutral/provider/runner/NodeXyoRunner.d.ts.map +1 -1
- package/dist/neutral/provider/signer/JsonRpcXyoSigner.d.ts +5 -5
- package/dist/neutral/provider/signer/JsonRpcXyoSigner.d.ts.map +1 -1
- package/dist/neutral/provider/signer/MemoryXyoSigner.d.ts +2 -2
- package/dist/neutral/provider/signer/MemoryXyoSigner.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts +5 -5
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/neutral/transport/HttpRpcTransport.d.ts +1 -1
- package/dist/neutral/transport/HttpRpcTransport.d.ts.map +1 -1
- package/dist/neutral/transport/MemoryRpcTransport.d.ts +4 -4
- package/dist/neutral/transport/MemoryRpcTransport.d.ts.map +1 -1
- package/dist/neutral/transport/RpcTransport.d.ts +1 -1
- package/dist/neutral/transport/RpcTransport.d.ts.map +1 -1
- package/dist/neutral/transport/post-message/LegacyPostMessageRpcTransport.d.ts +5 -5
- package/dist/neutral/transport/post-message/LegacyPostMessageRpcTransport.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoGatewayRpcSchemas.d.ts +422 -76
- package/dist/neutral/types/schema/XyoGatewayRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoProviderRpcSchemas.d.ts +297 -3
- package/dist/neutral/types/schema/XyoProviderRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoRunnerRpcSchemas.d.ts +231 -3
- package/dist/neutral/types/schema/XyoRunnerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoSignerRpcSchemas.d.ts +838 -3
- package/dist/neutral/types/schema/XyoSignerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts +1611 -3
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/common/Address.d.ts +7 -0
- package/dist/neutral/types/schema/common/Address.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/AllowedBlockPayload.d.ts +11 -0
- package/dist/neutral/types/schema/common/AllowedBlockPayload.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/BlockBoundWitness.d.ts +324 -0
- package/dist/neutral/types/schema/common/BlockBoundWitness.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/BoundWitness.d.ts +420 -0
- package/dist/neutral/types/schema/common/BoundWitness.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/Chain.d.ts +4 -0
- package/dist/neutral/types/schema/common/Chain.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/HydratedBlock.d.ts +474 -0
- package/dist/neutral/types/schema/common/HydratedBlock.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/HydratedTransaction.d.ts +624 -0
- package/dist/neutral/types/schema/common/HydratedTransaction.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/Json.d.ts +7 -0
- package/dist/neutral/types/schema/common/Json.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/Payload.d.ts +134 -0
- package/dist/neutral/types/schema/common/Payload.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/Sequence.d.ts +9 -0
- package/dist/neutral/types/schema/common/Sequence.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/TransactionBoundWitness.d.ts +239 -0
- package/dist/neutral/types/schema/common/TransactionBoundWitness.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/TransactionFees.d.ts +93 -24
- package/dist/neutral/types/schema/common/TransactionFees.d.ts.map +1 -1
- package/dist/neutral/types/schema/common/index.d.ts +11 -13
- package/dist/neutral/types/schema/common/index.d.ts.map +1 -1
- package/dist/neutral/types/schema/common/spec/BigIntZod.spec.d.ts +2 -0
- package/dist/neutral/types/schema/common/spec/BigIntZod.spec.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/spec/HydratedTransaction.spec.d.ts +2 -0
- package/dist/neutral/types/schema/common/spec/HydratedTransaction.spec.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/spec/Payload.spec.d.ts +2 -0
- package/dist/neutral/types/schema/common/spec/Payload.spec.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/spec/TransactionBoundWitnessZod.spec.d.ts +2 -0
- package/dist/neutral/types/schema/common/spec/TransactionBoundWitnessZod.spec.d.ts.map +1 -0
- package/dist/neutral/types/schema/common/spec/UnsignedHydratedTransactionSchema.spec copy.d.ts +2 -0
- package/dist/neutral/types/schema/common/spec/UnsignedHydratedTransactionSchema.spec copy.d.ts.map +1 -0
- package/dist/neutral/types/schema/createRequestSchema.d.ts +2 -22
- package/dist/neutral/types/schema/createRequestSchema.d.ts.map +1 -1
- package/dist/neutral/types/schema/createResponseSchema.d.ts +2 -18
- package/dist/neutral/types/schema/createResponseSchema.d.ts.map +1 -1
- package/dist/neutral/types/schema/index.d.ts +1 -0
- package/dist/neutral/types/schema/index.d.ts.map +1 -1
- package/dist/node/engine/requestSchemas.d.ts +2 -2
- package/dist/node/engine/requestSchemas.d.ts.map +1 -1
- package/dist/node/index-node.mjs +433 -312
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/provider/connection/XyoConnection.d.ts +2 -2
- package/dist/node/provider/connection/XyoConnection.d.ts.map +1 -1
- package/dist/node/provider/runner/JsonRpcXyoRunner.d.ts +2 -2
- package/dist/node/provider/runner/JsonRpcXyoRunner.d.ts.map +1 -1
- package/dist/node/provider/runner/MemoryXyoRunner.d.ts +2 -2
- package/dist/node/provider/runner/MemoryXyoRunner.d.ts.map +1 -1
- package/dist/node/provider/runner/NodeXyoRunner.d.ts +2 -2
- package/dist/node/provider/runner/NodeXyoRunner.d.ts.map +1 -1
- package/dist/node/provider/signer/JsonRpcXyoSigner.d.ts +5 -5
- package/dist/node/provider/signer/JsonRpcXyoSigner.d.ts.map +1 -1
- package/dist/node/provider/signer/MemoryXyoSigner.d.ts +2 -2
- package/dist/node/provider/signer/MemoryXyoSigner.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts +5 -5
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/node/transport/HttpRpcTransport.d.ts +1 -1
- package/dist/node/transport/HttpRpcTransport.d.ts.map +1 -1
- package/dist/node/transport/MemoryRpcTransport.d.ts +4 -4
- package/dist/node/transport/MemoryRpcTransport.d.ts.map +1 -1
- package/dist/node/transport/RpcTransport.d.ts +1 -1
- package/dist/node/transport/RpcTransport.d.ts.map +1 -1
- package/dist/node/transport/post-message/LegacyPostMessageRpcTransport.d.ts +5 -5
- package/dist/node/transport/post-message/LegacyPostMessageRpcTransport.d.ts.map +1 -1
- package/dist/node/types/schema/XyoGatewayRpcSchemas.d.ts +422 -76
- package/dist/node/types/schema/XyoGatewayRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoProviderRpcSchemas.d.ts +297 -3
- package/dist/node/types/schema/XyoProviderRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoRunnerRpcSchemas.d.ts +231 -3
- package/dist/node/types/schema/XyoRunnerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoSignerRpcSchemas.d.ts +838 -3
- package/dist/node/types/schema/XyoSignerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts +1611 -3
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/common/Address.d.ts +7 -0
- package/dist/node/types/schema/common/Address.d.ts.map +1 -0
- package/dist/node/types/schema/common/AllowedBlockPayload.d.ts +11 -0
- package/dist/node/types/schema/common/AllowedBlockPayload.d.ts.map +1 -0
- package/dist/node/types/schema/common/BlockBoundWitness.d.ts +324 -0
- package/dist/node/types/schema/common/BlockBoundWitness.d.ts.map +1 -0
- package/dist/node/types/schema/common/BoundWitness.d.ts +420 -0
- package/dist/node/types/schema/common/BoundWitness.d.ts.map +1 -0
- package/dist/node/types/schema/common/Chain.d.ts +4 -0
- package/dist/node/types/schema/common/Chain.d.ts.map +1 -0
- package/dist/node/types/schema/common/HydratedBlock.d.ts +474 -0
- package/dist/node/types/schema/common/HydratedBlock.d.ts.map +1 -0
- package/dist/node/types/schema/common/HydratedTransaction.d.ts +624 -0
- package/dist/node/types/schema/common/HydratedTransaction.d.ts.map +1 -0
- package/dist/node/types/schema/common/Json.d.ts +7 -0
- package/dist/node/types/schema/common/Json.d.ts.map +1 -0
- package/dist/node/types/schema/common/Payload.d.ts +134 -0
- package/dist/node/types/schema/common/Payload.d.ts.map +1 -0
- package/dist/node/types/schema/common/Sequence.d.ts +9 -0
- package/dist/node/types/schema/common/Sequence.d.ts.map +1 -0
- package/dist/node/types/schema/common/TransactionBoundWitness.d.ts +239 -0
- package/dist/node/types/schema/common/TransactionBoundWitness.d.ts.map +1 -0
- package/dist/node/types/schema/common/TransactionFees.d.ts +93 -24
- package/dist/node/types/schema/common/TransactionFees.d.ts.map +1 -1
- package/dist/node/types/schema/common/index.d.ts +11 -13
- package/dist/node/types/schema/common/index.d.ts.map +1 -1
- package/dist/node/types/schema/common/spec/BigIntZod.spec.d.ts +2 -0
- package/dist/node/types/schema/common/spec/BigIntZod.spec.d.ts.map +1 -0
- package/dist/node/types/schema/common/spec/HydratedTransaction.spec.d.ts +2 -0
- package/dist/node/types/schema/common/spec/HydratedTransaction.spec.d.ts.map +1 -0
- package/dist/node/types/schema/common/spec/Payload.spec.d.ts +2 -0
- package/dist/node/types/schema/common/spec/Payload.spec.d.ts.map +1 -0
- package/dist/node/types/schema/common/spec/TransactionBoundWitnessZod.spec.d.ts +2 -0
- package/dist/node/types/schema/common/spec/TransactionBoundWitnessZod.spec.d.ts.map +1 -0
- package/dist/node/types/schema/common/spec/UnsignedHydratedTransactionSchema.spec copy.d.ts +2 -0
- package/dist/node/types/schema/common/spec/UnsignedHydratedTransactionSchema.spec copy.d.ts.map +1 -0
- package/dist/node/types/schema/createRequestSchema.d.ts +2 -22
- package/dist/node/types/schema/createRequestSchema.d.ts.map +1 -1
- package/dist/node/types/schema/createResponseSchema.d.ts +2 -18
- package/dist/node/types/schema/createResponseSchema.d.ts.map +1 -1
- package/dist/node/types/schema/index.d.ts +1 -0
- package/dist/node/types/schema/index.d.ts.map +1 -1
- package/package.json +17 -15
- package/src/engine/requestSchemas.ts +2 -2
- package/src/provider/connection/XyoConnection.ts +3 -3
- package/src/provider/connection/spec/XyoConnection.ts +2 -2
- package/src/provider/runner/JsonRpcXyoRunner.ts +2 -2
- package/src/provider/runner/MemoryXyoRunner.ts +2 -2
- package/src/provider/runner/NodeXyoRunner.ts +2 -2
- package/src/provider/signer/JsonRpcXyoSigner.ts +11 -8
- package/src/provider/signer/MemoryXyoSigner.ts +2 -2
- package/src/provider/signer/spec/RpcEngineXyoSigner.spec.ts +5 -4
- package/src/provider/viewer/JsonRpcXyoViewer.ts +15 -16
- package/src/transport/HttpRpcTransport.ts +7 -7
- package/src/transport/MemoryRpcTransport.ts +15 -13
- package/src/transport/RpcTransport.ts +3 -3
- package/src/transport/post-message/LegacyPostMessageRpcTransport.ts +12 -12
- package/src/types/schema/XyoGatewayRpcSchemas.ts +17 -17
- package/src/types/schema/XyoProviderRpcSchemas.ts +16 -16
- package/src/types/schema/XyoRunnerRpcSchemas.ts +8 -11
- package/src/types/schema/XyoSignerRpcSchemas.ts +30 -25
- package/src/types/schema/XyoViewerRpcSchemas.ts +55 -52
- package/src/types/schema/common/{AddressSchema.ts → Address.ts} +1 -2
- package/src/types/schema/common/AllowedBlockPayload.ts +16 -0
- package/src/types/schema/common/BlockBoundWitness.ts +49 -0
- package/src/types/schema/common/BoundWitness.ts +53 -0
- package/src/types/schema/common/Chain.ts +8 -0
- package/src/types/schema/common/HydratedBlock.ts +32 -0
- package/src/types/schema/common/HydratedTransaction.ts +38 -0
- package/src/types/schema/common/Json.ts +19 -0
- package/src/types/schema/common/Payload.ts +31 -0
- package/src/types/schema/common/Sequence.ts +19 -0
- package/src/types/schema/common/TransactionBoundWitness.ts +42 -0
- package/src/types/schema/common/TransactionFees.ts +37 -11
- package/src/types/schema/common/index.ts +11 -13
- package/src/types/schema/common/spec/{BigIntSchema.spec.ts → BigIntZod.spec.ts} +6 -7
- package/src/types/schema/common/spec/HydratedBlockSchema.spec.ts +9 -83
- package/src/types/schema/common/spec/HydratedTransaction.spec.ts +18 -0
- package/src/types/schema/common/spec/Payload.spec.ts +29 -0
- package/src/types/schema/common/spec/TransactionBoundWitnessZod.spec.ts +18 -0
- package/src/types/schema/common/spec/UnsignedHydratedTransactionSchema.spec copy.ts +53 -0
- package/src/types/schema/index.ts +1 -0
- package/dist/neutral/types/schema/common/AddressSchema.d.ts +0 -5
- package/dist/neutral/types/schema/common/AddressSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/BigIntSchema.d.ts +0 -4
- package/dist/neutral/types/schema/common/BigIntSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/BlockBoundWitnessSchema.d.ts +0 -235
- package/dist/neutral/types/schema/common/BlockBoundWitnessSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/BoundWitnessSchema.d.ts +0 -163
- package/dist/neutral/types/schema/common/BoundWitnessSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/HashSchema.d.ts +0 -5
- package/dist/neutral/types/schema/common/HashSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/HexSchema.d.ts +0 -5
- package/dist/neutral/types/schema/common/HexSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/HydratedBlockSchema.d.ts +0 -282
- package/dist/neutral/types/schema/common/HydratedBlockSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/HydratedTransactionSchema.d.ts +0 -214
- package/dist/neutral/types/schema/common/HydratedTransactionSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/JsonSchema.d.ts +0 -7
- package/dist/neutral/types/schema/common/JsonSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/PayloadSchema.d.ts +0 -28
- package/dist/neutral/types/schema/common/PayloadSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/SequenceSchema.d.ts +0 -9
- package/dist/neutral/types/schema/common/SequenceSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/StorageMetaSchema.d.ts +0 -46
- package/dist/neutral/types/schema/common/StorageMetaSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/TransactionBoundWitnessSchema.d.ts +0 -258
- package/dist/neutral/types/schema/common/TransactionBoundWitnessSchema.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/spec/BigIntSchema.spec.d.ts +0 -2
- package/dist/neutral/types/schema/common/spec/BigIntSchema.spec.d.ts.map +0 -1
- package/dist/node/types/schema/common/AddressSchema.d.ts +0 -5
- package/dist/node/types/schema/common/AddressSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/BigIntSchema.d.ts +0 -4
- package/dist/node/types/schema/common/BigIntSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/BlockBoundWitnessSchema.d.ts +0 -235
- package/dist/node/types/schema/common/BlockBoundWitnessSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/BoundWitnessSchema.d.ts +0 -163
- package/dist/node/types/schema/common/BoundWitnessSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/HashSchema.d.ts +0 -5
- package/dist/node/types/schema/common/HashSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/HexSchema.d.ts +0 -5
- package/dist/node/types/schema/common/HexSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/HydratedBlockSchema.d.ts +0 -282
- package/dist/node/types/schema/common/HydratedBlockSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/HydratedTransactionSchema.d.ts +0 -214
- package/dist/node/types/schema/common/HydratedTransactionSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/JsonSchema.d.ts +0 -7
- package/dist/node/types/schema/common/JsonSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/PayloadSchema.d.ts +0 -28
- package/dist/node/types/schema/common/PayloadSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/SequenceSchema.d.ts +0 -9
- package/dist/node/types/schema/common/SequenceSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/StorageMetaSchema.d.ts +0 -46
- package/dist/node/types/schema/common/StorageMetaSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/TransactionBoundWitnessSchema.d.ts +0 -258
- package/dist/node/types/schema/common/TransactionBoundWitnessSchema.d.ts.map +0 -1
- package/dist/node/types/schema/common/spec/BigIntSchema.spec.d.ts +0 -2
- package/dist/node/types/schema/common/spec/BigIntSchema.spec.d.ts.map +0 -1
- package/src/types/schema/common/BigIntSchema.ts +0 -10
- package/src/types/schema/common/BlockBoundWitnessSchema.ts +0 -30
- package/src/types/schema/common/BoundWitnessSchema.ts +0 -45
- package/src/types/schema/common/HashSchema.ts +0 -7
- package/src/types/schema/common/HexSchema.ts +0 -7
- package/src/types/schema/common/HydratedBlockSchema.ts +0 -26
- package/src/types/schema/common/HydratedTransactionSchema.ts +0 -14
- package/src/types/schema/common/JsonSchema.ts +0 -19
- package/src/types/schema/common/PayloadSchema.ts +0 -6
- package/src/types/schema/common/SequenceSchema.ts +0 -19
- package/src/types/schema/common/StorageMetaSchema.ts +0 -14
- package/src/types/schema/common/TransactionBoundWitnessSchema.ts +0 -33
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Chain } from '@xyo-network/xl1-protocol'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
4
|
import type { XyoGatewayRpcMethodName } from '../XyoGatewayRpc.ts'
|
|
5
|
-
import {
|
|
5
|
+
import { BlockBoundWitnessZod, HydratedTransactionZod } from './common/index.ts'
|
|
6
6
|
import type { RpcSchemaMap } from './RpcSchemaMap.ts'
|
|
7
7
|
|
|
8
|
-
export const
|
|
9
|
-
chainId: z.union([z.string(), z.custom<
|
|
8
|
+
export const ChainConnectionZod = z.object({
|
|
9
|
+
chainId: z.union([z.string(), z.custom<Chain>()]).optional(),
|
|
10
10
|
name: z.string(),
|
|
11
11
|
url: z.string(),
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
export const
|
|
14
|
+
export const CaveatTypesZod = z.enum(['chain', 'expiration', 'filteredResponse', 'rateLimit'])
|
|
15
15
|
|
|
16
|
-
export const
|
|
17
|
-
type:
|
|
16
|
+
export const CaveatsZod = z.object({
|
|
17
|
+
type: CaveatTypesZod,
|
|
18
18
|
value: z.unknown(), // JsonValue is usually unknown, adjust if you have a stricter type
|
|
19
19
|
})
|
|
20
20
|
|
|
21
|
-
export const
|
|
21
|
+
export const PermissionZod = z.object({
|
|
22
22
|
capability: z.string(),
|
|
23
|
-
caveats:
|
|
23
|
+
caveats: CaveatsZod.array().optional(),
|
|
24
24
|
invoker: z.string(),
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
export const
|
|
27
|
+
export const InvokerPermissionZod = PermissionZod.extend({ date: z.number().optional() })
|
|
28
28
|
|
|
29
|
-
export type ChainConnection = z.infer<typeof
|
|
29
|
+
export type ChainConnection = z.infer<typeof ChainConnectionZod>
|
|
30
30
|
|
|
31
|
-
export const XyoGatewayRpcSchemas
|
|
31
|
+
export const XyoGatewayRpcSchemas = {
|
|
32
32
|
/*
|
|
33
33
|
xyoGateway_addConnection: {
|
|
34
34
|
params: {
|
|
@@ -94,15 +94,15 @@ export const XyoGatewayRpcSchemas: RpcSchemaMap<XyoGatewayRpcMethodName> = {
|
|
|
94
94
|
xyoGateway_submitTransaction: {
|
|
95
95
|
params: {
|
|
96
96
|
from: z.array(
|
|
97
|
-
|
|
97
|
+
HydratedTransactionZod,
|
|
98
98
|
),
|
|
99
99
|
to: z.array(
|
|
100
|
-
|
|
100
|
+
HydratedTransactionZod,
|
|
101
101
|
),
|
|
102
102
|
},
|
|
103
103
|
result: {
|
|
104
|
-
from:
|
|
105
|
-
to:
|
|
104
|
+
from: BlockBoundWitnessZod,
|
|
105
|
+
to: BlockBoundWitnessZod,
|
|
106
106
|
},
|
|
107
107
|
},
|
|
108
|
-
}
|
|
108
|
+
} satisfies RpcSchemaMap<XyoGatewayRpcMethodName>
|
|
@@ -2,36 +2,36 @@ import { z } from 'zod'
|
|
|
2
2
|
|
|
3
3
|
import type { XyoProviderRpcMethodName } from '../XyoProviderRpc.ts'
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
AddressZod, PayloadZod, SignedTransactionBoundWitnessZod, TransactionFeesBigIntToJsonZod,
|
|
6
|
+
TransactionFeesJsonToBigIntZod,
|
|
7
7
|
} from './common/index.ts'
|
|
8
8
|
import type { RpcSchemaMap } from './RpcSchemaMap.ts'
|
|
9
9
|
|
|
10
|
-
export const XyoProviderRpcSchemas
|
|
10
|
+
export const XyoProviderRpcSchemas = {
|
|
11
11
|
xyoProvider_send: {
|
|
12
12
|
params: {
|
|
13
13
|
to: z.tuple([
|
|
14
|
-
|
|
15
|
-
z.array(
|
|
16
|
-
z.array(
|
|
14
|
+
AddressZod,
|
|
15
|
+
z.array(PayloadZod),
|
|
16
|
+
z.array(PayloadZod),
|
|
17
17
|
z.number().nonnegative(),
|
|
18
18
|
z.number().nonnegative(),
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
TransactionFeesBigIntToJsonZod,
|
|
20
|
+
AddressZod.optional(),
|
|
21
21
|
]),
|
|
22
22
|
from: z.tuple([
|
|
23
|
-
|
|
24
|
-
z.array(
|
|
25
|
-
z.array(
|
|
23
|
+
AddressZod,
|
|
24
|
+
z.array(PayloadZod),
|
|
25
|
+
z.array(PayloadZod),
|
|
26
26
|
z.number().nonnegative(),
|
|
27
27
|
z.number().nonnegative(),
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
TransactionFeesJsonToBigIntZod,
|
|
29
|
+
AddressZod.optional(),
|
|
30
30
|
]),
|
|
31
31
|
},
|
|
32
32
|
result: {
|
|
33
|
-
to:
|
|
34
|
-
from:
|
|
33
|
+
to: SignedTransactionBoundWitnessZod,
|
|
34
|
+
from: SignedTransactionBoundWitnessZod,
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
-
}
|
|
37
|
+
} satisfies RpcSchemaMap<XyoProviderRpcMethodName>
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
+
import { HashToJsonZod, JsonToHashZod } from '@xylabs/hex'
|
|
1
2
|
import { z } from 'zod'
|
|
2
3
|
|
|
3
4
|
import type { XyoRunnerRpcMethodName } from '../XyoRunnerRpc.ts'
|
|
4
|
-
import {
|
|
5
|
-
HashFromStringSchema,
|
|
6
|
-
HashToStringSchema,
|
|
7
|
-
SignedHydratedTransactionSchema,
|
|
8
|
-
} from './common/index.ts'
|
|
5
|
+
import { SignedHydratedTransactionZod } from './common/index.ts'
|
|
9
6
|
import type { RpcSchemaMap } from './RpcSchemaMap.ts'
|
|
10
7
|
|
|
11
|
-
export const XyoRunnerRpcSchemas
|
|
8
|
+
export const XyoRunnerRpcSchemas = {
|
|
12
9
|
xyoRunner_broadcastTransaction: {
|
|
13
10
|
params: {
|
|
14
|
-
to: z.tuple([
|
|
15
|
-
from: z.tuple([
|
|
11
|
+
to: z.tuple([SignedHydratedTransactionZod]),
|
|
12
|
+
from: z.tuple([SignedHydratedTransactionZod]),
|
|
16
13
|
},
|
|
17
14
|
result: {
|
|
18
|
-
to:
|
|
19
|
-
from:
|
|
15
|
+
to: HashToJsonZod,
|
|
16
|
+
from: JsonToHashZod,
|
|
20
17
|
},
|
|
21
18
|
},
|
|
22
|
-
}
|
|
19
|
+
} satisfies RpcSchemaMap<XyoRunnerRpcMethodName>
|
|
@@ -1,60 +1,65 @@
|
|
|
1
|
+
import type { Signed } from '@xyo-network/boundwitness-model'
|
|
2
|
+
import type { SignedHydratedTransaction, TransactionBoundWitness } from '@xyo-network/xl1-protocol'
|
|
1
3
|
import { z } from 'zod'
|
|
2
4
|
|
|
3
5
|
import type { XyoSignerRpcMethodName } from '../XyoSignerRpc.ts'
|
|
4
6
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
AddressZod,
|
|
8
|
+
AllowedBlockPayloadZod,
|
|
9
|
+
ChainZod,
|
|
10
|
+
PayloadZod, SignedHydratedTransactionZod, SignedTransactionBoundWitnessZod,
|
|
11
|
+
TransactionFeesBigIntToJsonZod,
|
|
12
|
+
TransactionFeesJsonToBigIntZod,
|
|
13
|
+
UnsignedHydratedTransactionZod,
|
|
10
14
|
} from './common/index.ts'
|
|
11
15
|
import type { RpcSchemaMap } from './RpcSchemaMap.ts'
|
|
12
16
|
|
|
13
|
-
export const XyoSignerRpcSchemas
|
|
17
|
+
export const XyoSignerRpcSchemas = {
|
|
14
18
|
xyoSigner_address: {
|
|
15
19
|
params: {
|
|
16
20
|
to: z.array(z.any()).length(0).optional(),
|
|
17
21
|
from: z.array(z.any()).length(0).optional(),
|
|
18
22
|
},
|
|
19
23
|
result: {
|
|
20
|
-
to:
|
|
21
|
-
from:
|
|
24
|
+
to: AddressZod,
|
|
25
|
+
from: AddressZod,
|
|
22
26
|
},
|
|
23
27
|
},
|
|
28
|
+
// NOTE: method is deprecated which is why it uses deprecated types
|
|
24
29
|
xyoSigner_createSignedTransaction: {
|
|
25
30
|
params: {
|
|
26
31
|
to: z.tuple([
|
|
27
|
-
|
|
28
|
-
z.array(
|
|
29
|
-
z.array(
|
|
32
|
+
ChainZod,
|
|
33
|
+
z.array(AllowedBlockPayloadZod),
|
|
34
|
+
z.array(PayloadZod),
|
|
30
35
|
z.number().nonnegative(),
|
|
31
36
|
z.number().nonnegative(),
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
TransactionFeesBigIntToJsonZod,
|
|
38
|
+
AddressZod.optional(),
|
|
34
39
|
]),
|
|
35
40
|
from: z.tuple([
|
|
36
|
-
|
|
37
|
-
z.array(
|
|
38
|
-
z.array(
|
|
41
|
+
ChainZod,
|
|
42
|
+
z.array(PayloadZod),
|
|
43
|
+
z.array(PayloadZod),
|
|
39
44
|
z.number().nonnegative(),
|
|
40
45
|
z.number().nonnegative(),
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
TransactionFeesJsonToBigIntZod,
|
|
47
|
+
AddressZod.optional(),
|
|
43
48
|
]),
|
|
44
49
|
},
|
|
45
50
|
result: {
|
|
46
|
-
to:
|
|
47
|
-
from:
|
|
51
|
+
to: SignedTransactionBoundWitnessZod,
|
|
52
|
+
from: SignedTransactionBoundWitnessZod.transform(data => data as Signed<TransactionBoundWitness>),
|
|
48
53
|
},
|
|
49
54
|
},
|
|
50
55
|
xyoSigner_signTransaction: {
|
|
51
56
|
params: {
|
|
52
|
-
to: z.tuple([
|
|
53
|
-
from: z.tuple([
|
|
57
|
+
to: z.tuple([UnsignedHydratedTransactionZod]),
|
|
58
|
+
from: z.tuple([UnsignedHydratedTransactionZod]),
|
|
54
59
|
},
|
|
55
60
|
result: {
|
|
56
|
-
to:
|
|
57
|
-
from:
|
|
61
|
+
to: SignedHydratedTransactionZod,
|
|
62
|
+
from: SignedHydratedTransactionZod.transform(data => data as SignedHydratedTransaction),
|
|
58
63
|
},
|
|
59
64
|
},
|
|
60
|
-
}
|
|
65
|
+
} as const satisfies RpcSchemaMap<XyoSignerRpcMethodName>
|
|
@@ -1,61 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BigIntToJsonZod, HashToJsonZod, HashZod, JsonToBigIntZod,
|
|
3
|
+
JsonToHashZod,
|
|
4
|
+
} from '@xylabs/hex'
|
|
1
5
|
import { z } from 'zod'
|
|
2
6
|
|
|
3
7
|
import type { XyoViewerRpcMethodName } from '../XyoViewerRpc.ts'
|
|
4
8
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
SignedHydratedTransactionSchema,
|
|
9
|
+
AddressZod,
|
|
10
|
+
BlockNumberZod,
|
|
11
|
+
PayloadZod,
|
|
12
|
+
SignedHydratedBlockZod,
|
|
13
|
+
SignedHydratedTransactionZod,
|
|
11
14
|
} from './common/index.ts'
|
|
12
15
|
import type { RpcSchemaMap } from './RpcSchemaMap.ts'
|
|
13
16
|
|
|
14
|
-
export const XyoViewerRpcSchemas
|
|
17
|
+
export const XyoViewerRpcSchemas = {
|
|
15
18
|
xyoViewer_accountBalance: {
|
|
16
19
|
params: {
|
|
17
20
|
to: z.union([
|
|
18
|
-
z.tuple([
|
|
19
|
-
z.tuple([
|
|
20
|
-
z.tuple([
|
|
21
|
+
z.tuple([AddressZod]),
|
|
22
|
+
z.tuple([AddressZod, z.number()]),
|
|
23
|
+
z.tuple([AddressZod, z.number(), z.boolean()]),
|
|
21
24
|
]),
|
|
22
25
|
from: z.union([
|
|
23
|
-
z.tuple([
|
|
24
|
-
z.tuple([
|
|
25
|
-
z.tuple([
|
|
26
|
+
z.tuple([AddressZod]),
|
|
27
|
+
z.tuple([AddressZod, z.number()]),
|
|
28
|
+
z.tuple([AddressZod, z.number(), z.boolean()]),
|
|
26
29
|
]),
|
|
27
30
|
},
|
|
28
31
|
result: {
|
|
29
|
-
to:
|
|
30
|
-
from:
|
|
32
|
+
to: BigIntToJsonZod,
|
|
33
|
+
from: JsonToBigIntZod,
|
|
31
34
|
},
|
|
32
35
|
},
|
|
33
36
|
xyoViewer_accountHistory: {
|
|
34
37
|
params: {
|
|
35
38
|
to: z.union([
|
|
36
|
-
z.tuple([
|
|
37
|
-
z.tuple([
|
|
38
|
-
z.tuple([
|
|
39
|
+
z.tuple([AddressZod]),
|
|
40
|
+
z.tuple([AddressZod, z.number()]),
|
|
41
|
+
z.tuple([AddressZod, z.number(), z.boolean()]),
|
|
39
42
|
]),
|
|
40
43
|
from: z.union([
|
|
41
|
-
z.tuple([
|
|
42
|
-
z.tuple([
|
|
43
|
-
z.tuple([
|
|
44
|
+
z.tuple([AddressZod]),
|
|
45
|
+
z.tuple([AddressZod, z.number()]),
|
|
46
|
+
z.tuple([AddressZod, z.number(), z.boolean()]),
|
|
44
47
|
]),
|
|
45
48
|
},
|
|
46
49
|
result: {
|
|
47
|
-
to: z.array(z.
|
|
48
|
-
from: z.array(z.
|
|
50
|
+
to: z.array(z.tuple([HashZod, HashZod, PayloadZod])),
|
|
51
|
+
from: z.array(z.tuple([HashZod, HashZod, PayloadZod])),
|
|
49
52
|
},
|
|
50
53
|
},
|
|
51
54
|
xyoViewer_blockByHash: {
|
|
52
55
|
params: {
|
|
53
|
-
to: z.tuple([
|
|
54
|
-
from: z.tuple([
|
|
56
|
+
to: z.tuple([HashToJsonZod]),
|
|
57
|
+
from: z.tuple([JsonToHashZod]),
|
|
55
58
|
},
|
|
56
59
|
result: {
|
|
57
|
-
to:
|
|
58
|
-
from:
|
|
60
|
+
to: SignedHydratedBlockZod,
|
|
61
|
+
from: SignedHydratedBlockZod,
|
|
59
62
|
},
|
|
60
63
|
},
|
|
61
64
|
xyoViewer_blockByNumber: {
|
|
@@ -64,18 +67,18 @@ export const XyoViewerRpcSchemas: RpcSchemaMap<XyoViewerRpcMethodName> = {
|
|
|
64
67
|
from: z.tuple([z.number()]),
|
|
65
68
|
},
|
|
66
69
|
result: {
|
|
67
|
-
to:
|
|
68
|
-
from:
|
|
70
|
+
to: SignedHydratedBlockZod,
|
|
71
|
+
from: SignedHydratedBlockZod,
|
|
69
72
|
},
|
|
70
73
|
},
|
|
71
74
|
xyoViewer_blocksByHash: {
|
|
72
75
|
params: {
|
|
73
|
-
to: z.tuple([
|
|
74
|
-
from: z.tuple([
|
|
76
|
+
to: z.tuple([HashZod, z.number().optional()]),
|
|
77
|
+
from: z.tuple([HashZod, z.number().optional()]),
|
|
75
78
|
},
|
|
76
79
|
result: {
|
|
77
|
-
to: z.array(
|
|
78
|
-
from: z.array(
|
|
80
|
+
to: z.array(SignedHydratedBlockZod),
|
|
81
|
+
from: z.array(SignedHydratedBlockZod),
|
|
79
82
|
},
|
|
80
83
|
},
|
|
81
84
|
xyoViewer_chainId: {
|
|
@@ -84,8 +87,8 @@ export const XyoViewerRpcSchemas: RpcSchemaMap<XyoViewerRpcMethodName> = {
|
|
|
84
87
|
from: z.array(z.any()).length(0).optional(),
|
|
85
88
|
},
|
|
86
89
|
result: {
|
|
87
|
-
to:
|
|
88
|
-
from:
|
|
90
|
+
to: AddressZod,
|
|
91
|
+
from: AddressZod,
|
|
89
92
|
},
|
|
90
93
|
},
|
|
91
94
|
xyoViewer_currentBlock: {
|
|
@@ -94,8 +97,8 @@ export const XyoViewerRpcSchemas: RpcSchemaMap<XyoViewerRpcMethodName> = {
|
|
|
94
97
|
from: z.array(z.any()).length(0).optional(),
|
|
95
98
|
},
|
|
96
99
|
result: {
|
|
97
|
-
to:
|
|
98
|
-
from:
|
|
100
|
+
to: SignedHydratedBlockZod,
|
|
101
|
+
from: SignedHydratedBlockZod,
|
|
99
102
|
},
|
|
100
103
|
},
|
|
101
104
|
xyoViewer_currentBlockHash: {
|
|
@@ -104,8 +107,8 @@ export const XyoViewerRpcSchemas: RpcSchemaMap<XyoViewerRpcMethodName> = {
|
|
|
104
107
|
from: z.array(z.any()).length(0).optional(),
|
|
105
108
|
},
|
|
106
109
|
result: {
|
|
107
|
-
to:
|
|
108
|
-
from:
|
|
110
|
+
to: HashZod,
|
|
111
|
+
from: HashZod,
|
|
109
112
|
},
|
|
110
113
|
},
|
|
111
114
|
xyoViewer_currentBlockNumber: {
|
|
@@ -114,18 +117,18 @@ export const XyoViewerRpcSchemas: RpcSchemaMap<XyoViewerRpcMethodName> = {
|
|
|
114
117
|
from: z.array(z.any()).length(0).optional(),
|
|
115
118
|
},
|
|
116
119
|
result: {
|
|
117
|
-
to:
|
|
118
|
-
from:
|
|
120
|
+
to: BlockNumberZod,
|
|
121
|
+
from: BlockNumberZod,
|
|
119
122
|
},
|
|
120
123
|
},
|
|
121
124
|
xyoViewer_transactionByBlockHashAndIndex: {
|
|
122
125
|
params: {
|
|
123
|
-
to: z.tuple([
|
|
124
|
-
from: z.tuple([
|
|
126
|
+
to: z.tuple([HashZod, z.number()]),
|
|
127
|
+
from: z.tuple([HashZod, z.number()]),
|
|
125
128
|
},
|
|
126
129
|
result: {
|
|
127
|
-
to:
|
|
128
|
-
from:
|
|
130
|
+
to: SignedHydratedTransactionZod.nullable(),
|
|
131
|
+
from: SignedHydratedTransactionZod.nullable(),
|
|
129
132
|
},
|
|
130
133
|
},
|
|
131
134
|
xyoViewer_transactionByBlockNumberAndIndex: {
|
|
@@ -134,18 +137,18 @@ export const XyoViewerRpcSchemas: RpcSchemaMap<XyoViewerRpcMethodName> = {
|
|
|
134
137
|
from: z.tuple([z.number(), z.number()]),
|
|
135
138
|
},
|
|
136
139
|
result: {
|
|
137
|
-
to:
|
|
138
|
-
from:
|
|
140
|
+
to: SignedHydratedTransactionZod.nullable(),
|
|
141
|
+
from: SignedHydratedTransactionZod.nullable(),
|
|
139
142
|
},
|
|
140
143
|
},
|
|
141
144
|
xyoViewer_transactionByHash: {
|
|
142
145
|
params: {
|
|
143
|
-
to: z.tuple([
|
|
144
|
-
from: z.tuple([
|
|
146
|
+
to: z.tuple([HashZod]),
|
|
147
|
+
from: z.tuple([HashZod]),
|
|
145
148
|
},
|
|
146
149
|
result: {
|
|
147
|
-
to:
|
|
148
|
-
from:
|
|
150
|
+
to: SignedHydratedTransactionZod.nullable(),
|
|
151
|
+
from: SignedHydratedTransactionZod.nullable(),
|
|
149
152
|
},
|
|
150
153
|
},
|
|
151
|
-
}
|
|
154
|
+
} satisfies RpcSchemaMap<XyoViewerRpcMethodName>
|
|
@@ -5,5 +5,4 @@ import { z } from 'zod'
|
|
|
5
5
|
|
|
6
6
|
const CompiledAddressRegEx = new RegExp(AddressRegEx)
|
|
7
7
|
|
|
8
|
-
export const
|
|
9
|
-
export const AddressFromStringSchema = z.string().toLowerCase().regex(CompiledAddressRegEx).transform<Address>(v => toAddress(v))
|
|
8
|
+
export const AddressZod = z.string().toLowerCase().regex(CompiledAddressRegEx).transform<Address>(v => toAddress(v))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
2
|
+
import { SchemaSchema } from '@xyo-network/core-payload-plugins'
|
|
3
|
+
import {
|
|
4
|
+
ChainStakeIntentSchema, HashSchema, TransferSchema,
|
|
5
|
+
} from '@xyo-network/xl1-protocol'
|
|
6
|
+
import z from 'zod'
|
|
7
|
+
|
|
8
|
+
const AllowedBlockPayloadSchemas = [
|
|
9
|
+
BoundWitnessSchema,
|
|
10
|
+
ChainStakeIntentSchema,
|
|
11
|
+
HashSchema,
|
|
12
|
+
SchemaSchema,
|
|
13
|
+
TransferSchema,
|
|
14
|
+
] as const
|
|
15
|
+
|
|
16
|
+
export const AllowedBlockPayloadZod = z.object({ schema: z.enum(AllowedBlockPayloadSchemas) })
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { HexZod } from '@xylabs/hex'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
SignedBoundWitnessWithStorageMetaZod, SignedBoundWitnessZod, UnsignedBoundWitnessWithStorageMetaZod,
|
|
6
|
+
UnsignedBoundWitnessZod,
|
|
7
|
+
} from './BoundWitness.ts'
|
|
8
|
+
import { ChainZod } from './Chain.ts'
|
|
9
|
+
import { StorageMetaZod } from './Payload.ts'
|
|
10
|
+
|
|
11
|
+
export const BlockNumberZod = z.number().int().nonnegative()
|
|
12
|
+
|
|
13
|
+
const BlockBoundWitnessFieldsZod = z.object({
|
|
14
|
+
block: BlockNumberZod,
|
|
15
|
+
chain: ChainZod,
|
|
16
|
+
previous: HexZod.nullable(),
|
|
17
|
+
protocol: z.number().optional(),
|
|
18
|
+
step_hashes: z.array(HexZod).optional(),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const BlockBoundWitnessMetaZod = z.object({ $epoch: z.number() })
|
|
22
|
+
|
|
23
|
+
export const BlockBoundWitnessZod = UnsignedBoundWitnessZod
|
|
24
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
25
|
+
.merge(StorageMetaZod.partial())
|
|
26
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
27
|
+
.merge(BlockBoundWitnessFieldsZod)
|
|
28
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
29
|
+
.merge(BlockBoundWitnessMetaZod)
|
|
30
|
+
export const BlockBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessWithStorageMetaZod
|
|
31
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
32
|
+
.merge(BlockBoundWitnessFieldsZod)
|
|
33
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
34
|
+
.merge(BlockBoundWitnessMetaZod)
|
|
35
|
+
|
|
36
|
+
export const SignedBlockBoundWitnessZod = SignedBoundWitnessZod
|
|
37
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
38
|
+
.merge(StorageMetaZod.partial())
|
|
39
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
40
|
+
.merge(BlockBoundWitnessFieldsZod)
|
|
41
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
42
|
+
.merge(BlockBoundWitnessMetaZod)
|
|
43
|
+
export const SignedBlockBoundWitnessWithStorageMetaZod = SignedBoundWitnessWithStorageMetaZod
|
|
44
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
45
|
+
.merge(StorageMetaZod.partial())
|
|
46
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
47
|
+
.merge(BlockBoundWitnessFieldsZod)
|
|
48
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
49
|
+
.merge(BlockBoundWitnessMetaZod)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { HashZod, HexZod } from '@xylabs/hex'
|
|
2
|
+
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
|
|
5
|
+
import { AddressZod } from './Address.ts'
|
|
6
|
+
import { PayloadZod, SchemaZod } from './Payload.ts'
|
|
7
|
+
|
|
8
|
+
const BoundWitnessRequiredFieldsZod = z.object({
|
|
9
|
+
addresses: z.array(AddressZod),
|
|
10
|
+
payload_hashes: z.array(HashZod),
|
|
11
|
+
payload_schemas: z.array(SchemaZod),
|
|
12
|
+
previous_hashes: z.array(HashZod.nullable()),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const BoundWitnessMetaZod = z.object({
|
|
16
|
+
$destination: AddressZod.optional(),
|
|
17
|
+
$sourceQuery: HashZod.optional(),
|
|
18
|
+
$signatures: z.array(z.union([HexZod, z.null()])),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const BoundWitnessZod = PayloadZod
|
|
22
|
+
.extend({ schema: z.literal(BoundWitnessSchema) })
|
|
23
|
+
.extend(BoundWitnessRequiredFieldsZod.shape)
|
|
24
|
+
.extend(BoundWitnessMetaZod.shape)
|
|
25
|
+
.refine(data => data.$signatures.length === data.addresses.length, { message: '$signatures length must equal addresses length' })
|
|
26
|
+
|
|
27
|
+
export type BoundWitness = z.infer<typeof BoundWitnessZod>
|
|
28
|
+
|
|
29
|
+
export const AnyBoundWitnessZod = BoundWitnessZod
|
|
30
|
+
.catchall(z.any())
|
|
31
|
+
|
|
32
|
+
export type AnyBoundWitness = z.infer<typeof AnyBoundWitnessZod>
|
|
33
|
+
|
|
34
|
+
export const UnsignedBoundWitnessZod = BoundWitnessZod.refine(data => data.$signatures.includes(null), { message: 'all $signatures must be null' })
|
|
35
|
+
|
|
36
|
+
export type UnsignedBoundWitness = z.infer<typeof UnsignedBoundWitnessZod>
|
|
37
|
+
|
|
38
|
+
export const AnyUnsignedBoundWitnessZod = UnsignedBoundWitnessZod
|
|
39
|
+
.catchall(z.any())
|
|
40
|
+
|
|
41
|
+
export type AnyUnsignedBoundWitness = z.infer<typeof AnyUnsignedBoundWitnessZod>
|
|
42
|
+
|
|
43
|
+
export const UnsignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessZod
|
|
44
|
+
.extend(BoundWitnessRequiredFieldsZod.shape)
|
|
45
|
+
.extend(BoundWitnessMetaZod.shape)
|
|
46
|
+
|
|
47
|
+
export const SignedBoundWitnessZod = BoundWitnessZod.refine(data => !data.$signatures.includes(null), { message: 'all $signatures must not be null' })
|
|
48
|
+
|
|
49
|
+
export const SignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessWithStorageMetaZod
|
|
50
|
+
|
|
51
|
+
export const AnySignedBoundWitnessZod = UnsignedBoundWitnessZod.catchall(z.any())
|
|
52
|
+
|
|
53
|
+
export const AnySignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessWithStorageMetaZod.catchall(z.any())
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { toAddress } from '@xylabs/hex'
|
|
2
|
+
import { AddressRegEx } from '@xyo-network/payload-wrapper'
|
|
3
|
+
import type { Chain } from '@xyo-network/xl1-protocol'
|
|
4
|
+
import { z } from 'zod'
|
|
5
|
+
|
|
6
|
+
const CompiledAddressRegEx = new RegExp(AddressRegEx)
|
|
7
|
+
|
|
8
|
+
export const ChainZod = z.string().toLowerCase().regex(CompiledAddressRegEx).transform<Chain>(v => toAddress(v) as Chain)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BlockBoundWitnessWithStorageMetaZod, BlockBoundWitnessZod, SignedBlockBoundWitnessWithStorageMetaZod,
|
|
5
|
+
SignedBlockBoundWitnessZod,
|
|
6
|
+
} from './BlockBoundWitness.ts'
|
|
7
|
+
import { PayloadWithStorageMetaZod, PayloadZod } from './Payload.ts'
|
|
8
|
+
|
|
9
|
+
export const HydratedBlockZod = z.tuple([
|
|
10
|
+
BlockBoundWitnessZod,
|
|
11
|
+
z.array(PayloadZod),
|
|
12
|
+
])
|
|
13
|
+
|
|
14
|
+
export const HydratedBlockWithStorageMetaZod = z.tuple([
|
|
15
|
+
BlockBoundWitnessWithStorageMetaZod,
|
|
16
|
+
z.array(PayloadWithStorageMetaZod),
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
export const SignedHydratedBlockZod = z.tuple([
|
|
20
|
+
SignedBlockBoundWitnessZod,
|
|
21
|
+
z.array(PayloadZod),
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
export const SignedHydratedBlockToJsonZod = z.tuple([
|
|
25
|
+
SignedBlockBoundWitnessZod,
|
|
26
|
+
z.array(PayloadZod),
|
|
27
|
+
])
|
|
28
|
+
|
|
29
|
+
export const SignedHydratedBlockWithStorageMetaZod = z.tuple([
|
|
30
|
+
SignedBlockBoundWitnessWithStorageMetaZod,
|
|
31
|
+
z.array(PayloadWithStorageMetaZod),
|
|
32
|
+
])
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { JsonObject } from '@xylabs/object'
|
|
2
|
+
import { asAnyPayload } from '@xyo-network/payload-model'
|
|
3
|
+
import { asSignedHydratedTransaction } from '@xyo-network/xl1-protocol'
|
|
4
|
+
import { z } from 'zod'
|
|
5
|
+
|
|
6
|
+
import { PayloadZod } from './Payload.ts'
|
|
7
|
+
import { SignedTransactionBoundWitnessZod, TransactionBoundWitnessZod } from './TransactionBoundWitness.ts'
|
|
8
|
+
|
|
9
|
+
export const HydratedTransactionZod = z.tuple([
|
|
10
|
+
TransactionBoundWitnessZod,
|
|
11
|
+
z.array(PayloadZod),
|
|
12
|
+
])
|
|
13
|
+
|
|
14
|
+
export const UnsignedHydratedTransactionZod = z.tuple([
|
|
15
|
+
TransactionBoundWitnessZod,
|
|
16
|
+
z.array(PayloadZod),
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
export const SignedHydratedTransactionZod = z.tuple([
|
|
20
|
+
SignedTransactionBoundWitnessZod,
|
|
21
|
+
z.array(PayloadZod),
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
export const SignedHydratedTransactionToJsonZod = SignedHydratedTransactionZod.transform(([
|
|
25
|
+
tx,
|
|
26
|
+
payloads,
|
|
27
|
+
]) => asSignedHydratedTransaction([
|
|
28
|
+
tx as JsonObject,
|
|
29
|
+
payloads.map(payload => payload as JsonObject),
|
|
30
|
+
]))
|
|
31
|
+
|
|
32
|
+
export const JsonToSignedHydratedTransactionZod = SignedHydratedTransactionZod.transform(([
|
|
33
|
+
tx,
|
|
34
|
+
payloads,
|
|
35
|
+
]) => ([
|
|
36
|
+
asSignedHydratedTransaction(tx),
|
|
37
|
+
payloads.map(p => asAnyPayload(p)),
|
|
38
|
+
]))
|