@xyo-network/xl1-rpc 1.10.2 → 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 +438 -314
- 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/gateway/Abstract.d.ts +4 -4
- package/dist/neutral/provider/gateway/Abstract.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 -6
- package/dist/neutral/provider/signer/JsonRpcXyoSigner.d.ts.map +1 -1
- package/dist/neutral/provider/signer/MemoryXyoSigner.d.ts +3 -4
- 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 +438 -314
- 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/gateway/Abstract.d.ts +4 -4
- package/dist/node/provider/gateway/Abstract.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 -6
- package/dist/node/provider/signer/JsonRpcXyoSigner.d.ts.map +1 -1
- package/dist/node/provider/signer/MemoryXyoSigner.d.ts +3 -4
- 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 +29 -27
- 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/gateway/Abstract.ts +7 -6
- 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 -7
- package/src/provider/signer/MemoryXyoSigner.ts +6 -6
- 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
|
@@ -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
|
+
]))
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
// Define recursive JSON value schema
|
|
4
|
+
const JsonValueZod: z.ZodType<unknown> = z.lazy(() =>
|
|
5
|
+
z.union([
|
|
6
|
+
z.string(),
|
|
7
|
+
z.number(),
|
|
8
|
+
z.boolean(),
|
|
9
|
+
z.null(),
|
|
10
|
+
z.array(JsonValueZod),
|
|
11
|
+
z.record(z.string(), JsonValueZod), // object with string keys and JSON values
|
|
12
|
+
]))
|
|
13
|
+
|
|
14
|
+
// JSON object schema — top-level must be an object
|
|
15
|
+
export const JsonObjectZod = z.record(z.string(), JsonValueZod)
|
|
16
|
+
|
|
17
|
+
// TypeScript type for reference
|
|
18
|
+
export type JsonValue = z.infer<typeof JsonValueZod>
|
|
19
|
+
export type JsonObject = z.infer<typeof JsonObjectZod>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HashToJsonZod } from '@xylabs/hex'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { SequenceToStringZod } from './Sequence.ts'
|
|
5
|
+
|
|
6
|
+
export const StorageMetaZod = z.object({
|
|
7
|
+
_hash: HashToJsonZod,
|
|
8
|
+
_dataHash: HashToJsonZod,
|
|
9
|
+
_sequence: SequenceToStringZod,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const SchemaZod = z.string()
|
|
13
|
+
export type Schema = z.infer<typeof SchemaZod>
|
|
14
|
+
|
|
15
|
+
export const PayloadZod = z.object({ schema: SchemaZod }).catchall(z.any())
|
|
16
|
+
export const PayloadWithStorageMetaZod = PayloadZod.extend(StorageMetaZod.shape)
|
|
17
|
+
|
|
18
|
+
export const AnyPayloadZod = PayloadZod.catchall(z.json())
|
|
19
|
+
export const AnyPayloadWithStorageMetaZod = AnyPayloadZod.extend(StorageMetaZod.shape)
|
|
20
|
+
|
|
21
|
+
export type PayloadZodType = z.infer<typeof PayloadZod>
|
|
22
|
+
export type PayloadWithStorageMetaZodType = z.infer<typeof PayloadWithStorageMetaZod>
|
|
23
|
+
|
|
24
|
+
export type AnyPayloadZodType = z.infer<typeof AnyPayloadZod>
|
|
25
|
+
export type AnyPayloadWithStorageMetaZodType = z.infer<typeof AnyPayloadWithStorageMetaZod>
|
|
26
|
+
|
|
27
|
+
export function WithStorageMetaZod<T extends typeof PayloadZod>(valueZod: T) {
|
|
28
|
+
return StorageMetaZod.extend(valueZod.shape)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type WithStorageMetaZodType = z.infer<typeof WithStorageMetaZod>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { toHex } from '@xylabs/hex'
|
|
2
|
+
import type {
|
|
3
|
+
LocalSequence,
|
|
4
|
+
QualifiedSequence,
|
|
5
|
+
} from '@xyo-network/payload-model'
|
|
6
|
+
import { SequenceConstants } from '@xyo-network/payload-model'
|
|
7
|
+
import { HexRegExMinMax } from '@xyo-network/payload-wrapper'
|
|
8
|
+
import { z } from 'zod'
|
|
9
|
+
|
|
10
|
+
const LocalSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.localSequenceBytes, SequenceConstants.localSequenceBytes))
|
|
11
|
+
export const LocalSequenceToStringZod = z.string().regex(LocalSequenceRegex)
|
|
12
|
+
export const LocalSequenceFromStringZod = z.string().regex(LocalSequenceRegex).transform<LocalSequence>(v => toHex(v) as LocalSequence)
|
|
13
|
+
|
|
14
|
+
const QualifiedSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.qualifiedSequenceBytes, SequenceConstants.qualifiedSequenceBytes))
|
|
15
|
+
export const QualifiedSequenceToStringZod = z.string().regex(QualifiedSequenceRegex)
|
|
16
|
+
export const QualifiedSequenceFromStringZod = z.string().regex(QualifiedSequenceRegex).transform<QualifiedSequence>(v => toHex(v) as QualifiedSequence)
|
|
17
|
+
|
|
18
|
+
export const SequenceToStringZod = z.union([LocalSequenceToStringZod, QualifiedSequenceToStringZod])
|
|
19
|
+
export const SequenceFromStringZod = z.union([LocalSequenceFromStringZod, QualifiedSequenceFromStringZod])
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
import { BlockNumberZod } from './BlockBoundWitness.ts'
|
|
4
|
+
import { SignedBoundWitnessZod, UnsignedBoundWitnessZod } from './BoundWitness.ts'
|
|
5
|
+
import { ChainZod } from './Chain.ts'
|
|
6
|
+
import { StorageMetaZod } from './Payload.ts'
|
|
7
|
+
import { TransactionFeesHexZod } from './TransactionFees.ts'
|
|
8
|
+
|
|
9
|
+
export const BlockStartZod = z.object({ nbf: BlockNumberZod })
|
|
10
|
+
export const BlockEndZod = z.object({ exp: BlockNumberZod })
|
|
11
|
+
export const BlockDurationZod = z.object({ nbf: BlockNumberZod, exp: BlockNumberZod })
|
|
12
|
+
export const BlockScriptsZod = z.object({ script: z.array(z.string()).optional() })
|
|
13
|
+
|
|
14
|
+
export const WithTransactionFeesZod = z.object({ fees: TransactionFeesHexZod })
|
|
15
|
+
|
|
16
|
+
const TransactionBoundWitnessFields = z.object({ chain: ChainZod, from: ChainZod })
|
|
17
|
+
|
|
18
|
+
// Note: It seems like zod marked all of merge as deprecated even though just multiple merges should have been deprecated
|
|
19
|
+
|
|
20
|
+
export const TransactionBoundWitnessZod = UnsignedBoundWitnessZod
|
|
21
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
22
|
+
.merge(StorageMetaZod.partial())
|
|
23
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
24
|
+
.merge(BlockDurationZod)
|
|
25
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
26
|
+
.merge(WithTransactionFeesZod)
|
|
27
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
28
|
+
.merge(TransactionBoundWitnessFields)
|
|
29
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
30
|
+
.merge(BlockScriptsZod)
|
|
31
|
+
|
|
32
|
+
export const SignedTransactionBoundWitnessZod = SignedBoundWitnessZod
|
|
33
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
34
|
+
.merge(StorageMetaZod.partial())
|
|
35
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
36
|
+
.merge(BlockDurationZod)
|
|
37
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
38
|
+
.merge(WithTransactionFeesZod)
|
|
39
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
40
|
+
.merge(TransactionBoundWitnessFields)
|
|
41
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
42
|
+
.merge(BlockScriptsZod.partial())
|
|
@@ -1,17 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BigIntToJsonZod, HexZod, JsonToBigIntZod,
|
|
3
|
+
} from '@xylabs/hex'
|
|
4
|
+
import { asAttoXL1 } from '@xyo-network/xl1-protocol'
|
|
1
5
|
import { z } from 'zod'
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
const AttoZod = z.bigint()
|
|
8
|
+
export const AttoFromStringZod = JsonToBigIntZod.transform(v => asAttoXL1(v))
|
|
4
9
|
|
|
5
|
-
export const
|
|
6
|
-
base:
|
|
7
|
-
gasLimit:
|
|
8
|
-
gasPrice:
|
|
9
|
-
priority:
|
|
10
|
+
export const TransactionFeesHexZod = z.object({
|
|
11
|
+
base: HexZod,
|
|
12
|
+
gasLimit: HexZod,
|
|
13
|
+
gasPrice: HexZod,
|
|
14
|
+
priority: HexZod,
|
|
10
15
|
})
|
|
11
16
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
export type TransactionFeesHexZodType = z.infer<typeof TransactionFeesHexZod>
|
|
18
|
+
|
|
19
|
+
export const TransactionFeesBigIntZod = z.object({
|
|
20
|
+
base: AttoZod,
|
|
21
|
+
gasLimit: AttoZod,
|
|
22
|
+
gasPrice: AttoZod,
|
|
23
|
+
priority: AttoZod,
|
|
17
24
|
})
|
|
25
|
+
|
|
26
|
+
export type TransactionFeesBigIntZodType = z.infer<typeof TransactionFeesBigIntZod>
|
|
27
|
+
|
|
28
|
+
export const TransactionFeesJsonToBigIntZod = TransactionFeesHexZod.transform(val => ({
|
|
29
|
+
base: JsonToBigIntZod.parse(val.base),
|
|
30
|
+
gasLimit: JsonToBigIntZod.parse(val.gasLimit),
|
|
31
|
+
gasPrice: JsonToBigIntZod.parse(val.gasPrice),
|
|
32
|
+
priority: JsonToBigIntZod.parse(val.priority),
|
|
33
|
+
}))
|
|
34
|
+
|
|
35
|
+
export const TransactionFeesBigIntToJsonZod = TransactionFeesBigIntZod.transform(val => ({
|
|
36
|
+
base: BigIntToJsonZod.parse(val.base),
|
|
37
|
+
gasLimit: BigIntToJsonZod.parse(val.gasLimit),
|
|
38
|
+
gasPrice: BigIntToJsonZod.parse(val.gasPrice),
|
|
39
|
+
priority: BigIntToJsonZod.parse(val.priority),
|
|
40
|
+
}))
|
|
41
|
+
|
|
42
|
+
export type TransactionFeesJsonToBigIntZodType = z.infer<typeof TransactionFeesJsonToBigIntZod>
|
|
43
|
+
export type TransactionFeesBigIntToJsonZodType = z.infer<typeof TransactionFeesBigIntToJsonZod>
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './StorageMetaSchema.ts'
|
|
13
|
-
export * from './TransactionBoundWitnessSchema.ts'
|
|
1
|
+
export * from './Address.ts'
|
|
2
|
+
export * from './AllowedBlockPayload.ts'
|
|
3
|
+
export * from './BlockBoundWitness.ts'
|
|
4
|
+
export * from './BoundWitness.ts'
|
|
5
|
+
export * from './Chain.ts'
|
|
6
|
+
export * from './HydratedBlock.ts'
|
|
7
|
+
export * from './HydratedTransaction.ts'
|
|
8
|
+
export * from './Json.ts'
|
|
9
|
+
export * from './Payload.ts'
|
|
10
|
+
export * from './Sequence.ts'
|
|
11
|
+
export * from './TransactionBoundWitness.ts'
|
|
14
12
|
export * from './TransactionFees.ts'
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
import { BigIntToJsonZod, JsonToBigIntZod } from '@xylabs/hex'
|
|
1
2
|
import {
|
|
2
3
|
describe, expect, it,
|
|
3
4
|
} from 'vitest'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
describe('BigIntSchema', () => {
|
|
8
|
-
describe('BigIntFromStringSchema', () => {
|
|
6
|
+
describe('BigIntZod', () => {
|
|
7
|
+
describe('JsonToBigIntZod', () => {
|
|
9
8
|
it.each(['0', '00', '01010101', '0308'])('should bigint from string', (input) => {
|
|
10
|
-
const result =
|
|
9
|
+
const result = JsonToBigIntZod.safeParse(input)
|
|
11
10
|
expect(result.success).toBe(true)
|
|
12
11
|
})
|
|
13
12
|
})
|
|
14
|
-
describe('
|
|
13
|
+
describe('BigIntToJsonZod', () => {
|
|
15
14
|
it.each([0n, 1n, 100n, 1000n, 1_000_000n])('should parse bigint to string', (input) => {
|
|
16
|
-
const result =
|
|
15
|
+
const result = BigIntToJsonZod.safeParse(input)
|
|
17
16
|
expect(result.success).toBe(true)
|
|
18
17
|
})
|
|
19
18
|
})
|
|
@@ -1,93 +1,19 @@
|
|
|
1
|
+
import { Account } from '@xyo-network/account'
|
|
2
|
+
import { buildRandomChain } from '@xyo-network/chain-protocol'
|
|
1
3
|
import {
|
|
2
4
|
describe, expect, it,
|
|
3
5
|
} from 'vitest'
|
|
4
6
|
|
|
5
|
-
import {
|
|
7
|
+
import { SignedBlockBoundWitnessWithStorageMetaZod } from '../BlockBoundWitness.ts'
|
|
8
|
+
import { SignedHydratedBlockWithStorageMetaZod, SignedHydratedBlockZod } from '../HydratedBlock.ts'
|
|
6
9
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
$epoch: 1_741_246_328_448,
|
|
10
|
-
$signatures: [
|
|
11
|
-
'5a9e1452a6df4c988d799ee863f6241e67bc8ce8900ee0c188273589b9bd28f311c735332c41aca2c612ff2d124d554fc5dde551371534e1f6bb64f50163f9c7',
|
|
12
|
-
],
|
|
13
|
-
addresses: ['3e86dac7546202156c4620d3cf36fb0ac30404a3'],
|
|
14
|
-
block: 3,
|
|
15
|
-
chain: 'a82920051db4fcbb804463440dd45e03f72442fd',
|
|
16
|
-
payload_hashes: [
|
|
17
|
-
'78258d4329d81d92289aaf6992e4a9116ff41b353e03e4d3c47cd5f92cc13018',
|
|
18
|
-
'42f527118bbe24d0b2349c3a7359629ad4dda90d4add9a4dfc1eb76e88dc4ae9',
|
|
19
|
-
],
|
|
20
|
-
payload_schemas: ['network.xyo.boundwitness', 'network.xyo.transfer'],
|
|
21
|
-
previous:
|
|
22
|
-
'03d4d932f968eec3859490015f17c8126cedf54932f4e0504ece0636b8e75d4b',
|
|
23
|
-
previous_hashes: [
|
|
24
|
-
'17f878826b65a933d1edc5d7eceedc6ddf74d130853d310f5936eb85b3c90af6',
|
|
25
|
-
],
|
|
26
|
-
schema: 'network.xyo.boundwitness',
|
|
27
|
-
step_hashes: [],
|
|
28
|
-
_dataHash:
|
|
29
|
-
'23d100415ad2fb024f48f009005477b49e2fdf426ae22e012983ad78b3e39668',
|
|
30
|
-
_hash: '7568ef974e1cc369d1b453a0697e53d9267b316515a5c0068f327a71da49ce62',
|
|
31
|
-
_sequence: '000001956a5e7d0e00000002da49ce62',
|
|
32
|
-
},
|
|
33
|
-
[
|
|
34
|
-
{
|
|
35
|
-
$signatures: [
|
|
36
|
-
'9fc9a87ed545f2031459a3c2fc740ad8dd08368f2bf4e159e7cc96d656e8c4d96a9ed1c0f3ba5eee2a67d9213beafca4d7f63f0f0052ec6907dbf12018db8e56',
|
|
37
|
-
],
|
|
38
|
-
addresses: ['796c74fb1c23dc2dcc4e40b8c4284f05da51210f'],
|
|
39
|
-
chain: 'a82920051db4fcbb804463440dd45e03f72442fd',
|
|
40
|
-
exp: 9_007_199_254_740_991,
|
|
41
|
-
from: '796c74fb1c23dc2dcc4e40b8c4284f05da51210f',
|
|
42
|
-
gas: '00',
|
|
43
|
-
nbf: 2,
|
|
44
|
-
payload_hashes: [
|
|
45
|
-
'42f527118bbe24d0b2349c3a7359629ad4dda90d4add9a4dfc1eb76e88dc4ae9',
|
|
46
|
-
],
|
|
47
|
-
payload_schemas: ['network.xyo.transfer'],
|
|
48
|
-
previous_hashes: [
|
|
49
|
-
'24a2020ea9745fd13c96feded8c27ecd8c49119ba125a785689e6a5cf6a25ebf',
|
|
50
|
-
],
|
|
51
|
-
schema: 'network.xyo.boundwitness',
|
|
52
|
-
_dataHash:
|
|
53
|
-
'f9d88ad5b1c808cbfe7f62be23c952ccdbe9446e2822199bf4308fe2a1a2e64d',
|
|
54
|
-
_hash: '78258d4329d81d92289aaf6992e4a9116ff41b353e03e4d3c47cd5f92cc13018',
|
|
55
|
-
_sequence: '000001956a5e7d0e000000002cc13018',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
epoch: 1_741_246_328_089,
|
|
59
|
-
from: '796c74fb1c23dc2dcc4e40b8c4284f05da51210f',
|
|
60
|
-
schema: 'network.xyo.transfer',
|
|
61
|
-
transfers: {
|
|
62
|
-
'020e62d50dc65b1f4235e4d4618d3affb8929dca': 'a56fa5b99019a5c8000000',
|
|
63
|
-
'053fdc8544a91b10796e8663ae111ec3b842492d': '52b7d2dcc80cd2e4000000',
|
|
64
|
-
'0b84190b1b77563c63626af13610836e248d980a': '52b7d2dcc80cd2e4000000',
|
|
65
|
-
'24c24b12570a1f3bbba0573c9c6803376d9b8877': '0813f3978f89409844000000',
|
|
66
|
-
'29e2b25fbe21e6fb6054bbd5e249e18d29406395': '52b7d2dcc80cd2e4000000',
|
|
67
|
-
'40d31fae702907a54f024ba9cdacff7c54723d81': '014adf4b7320334b90000000',
|
|
68
|
-
'577230966ace8f833d315d8fb2412b8290b5d2a3': '52b7d2dcc80cd2e4000000',
|
|
69
|
-
'7f1730193cbf0a127b8ead7a4c0569f41c609b69': 'a56fa5b99019a5c8000000',
|
|
70
|
-
'980ec742d478a191078479e0e3e6e7fc65cc3b07': '08b9633d49195a3e0c000000',
|
|
71
|
-
'a13b93678144466e9eab4033ad80005e60f7e8e3': '014adf4b7320334b90000000',
|
|
72
|
-
'b144db32b91bac6eb8f00cfc474ac422eb486380': '52b7d2dcc80cd2e4000000',
|
|
73
|
-
'cd5c88bc408096a1a167ad6ce4b2803c0502f112': '01f04ef12cb04cf158000000',
|
|
74
|
-
'd31534845e11346541c5f62b9a024c0fe42d9189': 'a56fa5b99019a5c8000000',
|
|
75
|
-
'dc19d16406ab960ae1cbb96c555eea58b6fdf006': '014adf4b7320334b90000000',
|
|
76
|
-
'ef9691605c885836e7562a1814f13bac3c58bc6e': '52b7d2dcc80cd2e4000000',
|
|
77
|
-
'f0c1856426a8ab1363ffb3b06747ea96ec734bbe': '014adf4b7320334b90000000',
|
|
78
|
-
'ffa79144d8b3fb6b4e6b379ffe288c6e0a2b068a': '033b2e3c9fd0803ce8000000',
|
|
79
|
-
},
|
|
80
|
-
_dataHash:
|
|
81
|
-
'2a49d1edea14e6d3feb1919325b3fa721849f38fb1dc9ff73ef9fc4a2e351608',
|
|
82
|
-
_hash: '42f527118bbe24d0b2349c3a7359629ad4dda90d4add9a4dfc1eb76e88dc4ae9',
|
|
83
|
-
_sequence: '000001956a5e7d0e0000000188dc4ae9',
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
]
|
|
10
|
+
const account = await Account.random()
|
|
11
|
+
const signedHydratedBlock = (await buildRandomChain(account, 3))[1]
|
|
87
12
|
|
|
88
|
-
describe('
|
|
13
|
+
describe('SignedHydratedBlockZod', () => {
|
|
89
14
|
it('should parse a signed hydrated block', () => {
|
|
90
|
-
const result =
|
|
15
|
+
const result = SignedHydratedBlockWithStorageMetaZod.safeParse(signedHydratedBlock)
|
|
16
|
+
expect(result.data).toEqual(signedHydratedBlock)
|
|
91
17
|
expect(result.success).toBe(true)
|
|
92
18
|
})
|
|
93
19
|
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ZERO_ADDRESS } from '@xylabs/hex'
|
|
2
|
+
import { buildRandomTransaction } from '@xyo-network/chain-protocol'
|
|
3
|
+
import { asHydratedTransactionWithStorageMeta } from '@xyo-network/xl1-protocol'
|
|
4
|
+
import {
|
|
5
|
+
describe, expect, it,
|
|
6
|
+
} from 'vitest'
|
|
7
|
+
|
|
8
|
+
import { HydratedTransactionZod } from '../HydratedTransaction.ts'
|
|
9
|
+
|
|
10
|
+
const hydratedTransaction = await buildRandomTransaction(ZERO_ADDRESS)
|
|
11
|
+
|
|
12
|
+
describe('HydratedTransaction', () => {
|
|
13
|
+
it('should parse a HydratedTransaction', () => {
|
|
14
|
+
const result = HydratedTransactionZod.safeParse(hydratedTransaction)
|
|
15
|
+
expect(result.success).toBe(true)
|
|
16
|
+
expect(result.data).toEqual(asHydratedTransactionWithStorageMeta(hydratedTransaction))
|
|
17
|
+
})
|
|
18
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { asHash } from '@xylabs/hex'
|
|
2
|
+
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
3
|
+
import type { HashPayload } from '@xyo-network/xl1-protocol'
|
|
4
|
+
import { HashSchema } from '@xyo-network/xl1-protocol'
|
|
5
|
+
import {
|
|
6
|
+
describe, expect, it,
|
|
7
|
+
} from 'vitest'
|
|
8
|
+
|
|
9
|
+
import { PayloadWithStorageMetaZod, PayloadZod } from '../Payload.ts'
|
|
10
|
+
|
|
11
|
+
const hashPayload: HashPayload = {
|
|
12
|
+
schema: HashSchema,
|
|
13
|
+
hash: asHash('e70f82c755ac75847f9d1c6b45d96099b343571d724e5383569724c85cc9d303', true),
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const hashPayloadWithMeta = await PayloadBuilder.addStorageMeta(hashPayload)
|
|
17
|
+
|
|
18
|
+
describe('Payload', () => {
|
|
19
|
+
it('should parse a HashPayload', () => {
|
|
20
|
+
const result = PayloadZod.safeParse(hashPayload)
|
|
21
|
+
expect(result.success).toBe(true)
|
|
22
|
+
expect(result.data).toEqual(hashPayload)
|
|
23
|
+
})
|
|
24
|
+
it('should parse a HashPayload with storage Meta', () => {
|
|
25
|
+
const result = PayloadWithStorageMetaZod.safeParse(hashPayloadWithMeta)
|
|
26
|
+
expect(result.success).toBe(true)
|
|
27
|
+
expect(result.data).toEqual(hashPayloadWithMeta)
|
|
28
|
+
})
|
|
29
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ZERO_ADDRESS } from '@xylabs/hex'
|
|
2
|
+
import { buildRandomTransaction } from '@xyo-network/chain-protocol'
|
|
3
|
+
import { asTransactionBoundWitness } from '@xyo-network/xl1-protocol'
|
|
4
|
+
import {
|
|
5
|
+
describe, expect, it,
|
|
6
|
+
} from 'vitest'
|
|
7
|
+
|
|
8
|
+
import { TransactionBoundWitnessZod } from '../TransactionBoundWitness.ts'
|
|
9
|
+
|
|
10
|
+
const txBoundWitness = (await buildRandomTransaction(ZERO_ADDRESS))[0]
|
|
11
|
+
|
|
12
|
+
describe('TransactionBoundWitness', () => {
|
|
13
|
+
it('should parse a TransactionBoundWitness', () => {
|
|
14
|
+
const result = TransactionBoundWitnessZod.safeParse(txBoundWitness)
|
|
15
|
+
expect(result.success).toEqual(true)
|
|
16
|
+
expect(asTransactionBoundWitness(result.data)).toEqual(txBoundWitness)
|
|
17
|
+
})
|
|
18
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
describe, expect, it,
|
|
3
|
+
} from 'vitest'
|
|
4
|
+
|
|
5
|
+
import { UnsignedHydratedTransactionZod } from '../HydratedTransaction.ts'
|
|
6
|
+
|
|
7
|
+
const unsignedHydratedTransaction = [
|
|
8
|
+
{
|
|
9
|
+
$signatures: [],
|
|
10
|
+
chain: '0000000000000000000000000000000000000000',
|
|
11
|
+
fees: {
|
|
12
|
+
base: 'e8d4a51000',
|
|
13
|
+
gasLimit: '038d7ea4c68000',
|
|
14
|
+
gasPrice: '02540be400',
|
|
15
|
+
priority: '00',
|
|
16
|
+
},
|
|
17
|
+
nbf: 1,
|
|
18
|
+
exp: 1001,
|
|
19
|
+
from: 'ce544b3bab3131c8c68954873e281fda3ede8f3b',
|
|
20
|
+
script: [
|
|
21
|
+
'elevate|e70f82c755ac75847f9d1c6b45d96099b343571d724e5383569724c85cc9d303',
|
|
22
|
+
],
|
|
23
|
+
addresses: [],
|
|
24
|
+
payload_hashes: [
|
|
25
|
+
'e70f82c755ac75847f9d1c6b45d96099b343571d724e5383569724c85cc9d303',
|
|
26
|
+
'd5ab1ca9dba010cfe626b8e6a75df0665005dfe4b85c16a30d4c9520cc021970',
|
|
27
|
+
],
|
|
28
|
+
payload_schemas: [
|
|
29
|
+
'network.xyo.hash',
|
|
30
|
+
'network.xyo.id',
|
|
31
|
+
],
|
|
32
|
+
previous_hashes: [],
|
|
33
|
+
schema: 'network.xyo.boundwitness',
|
|
34
|
+
},
|
|
35
|
+
[
|
|
36
|
+
{
|
|
37
|
+
hash: 'd5ab1ca9dba010cfe626b8e6a75df0665005dfe4b85c16a30d4c9520cc021970',
|
|
38
|
+
schema: 'network.xyo.hash',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
salt: 'Hello from Sample - 2025-08-08T17:47:51.106Z',
|
|
42
|
+
schema: 'network.xyo.id',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
describe('UnsignedHydratedTransaction', () => {
|
|
48
|
+
it('should parse an UnsignedHydratedTransaction', () => {
|
|
49
|
+
const result = UnsignedHydratedTransactionZod.safeParse(unsignedHydratedTransaction)
|
|
50
|
+
expect(result.success).toBe(true)
|
|
51
|
+
expect(result.data).toEqual(unsignedHydratedTransaction)
|
|
52
|
+
})
|
|
53
|
+
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddressSchema.d.ts","sourceRoot":"","sources":["../../../../../src/types/schema/common/AddressSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,qBAAqB,aAAuD,CAAA;AACzF,eAAO,MAAM,uBAAuB,4CAA6F,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const BigIntToStringSchema: z.ZodEffects<z.ZodBigInt, import("@xylabs/hex").Hex | undefined, bigint>;
|
|
3
|
-
export declare const BigIntFromStringSchema: z.ZodEffects<z.ZodString, bigint, string>;
|
|
4
|
-
//# sourceMappingURL=BigIntSchema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BigIntSchema.d.ts","sourceRoot":"","sources":["../../../../../src/types/schema/common/BigIntSchema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,oBAAoB,0EAA2D,CAAA;AAC5F,eAAO,MAAM,sBAAsB,2CAAwF,CAAA"}
|