@xyo-network/xl1-protocol 1.13.8 → 1.13.10
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/index.mjs +57 -13
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/payload/elevatable/Bridge/BridgeDestinationObservation.d.ts +9 -45
- package/dist/neutral/payload/elevatable/Bridge/BridgeDestinationObservation.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Bridge/BridgeDetails.d.ts +16 -80
- package/dist/neutral/payload/elevatable/Bridge/BridgeDetails.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Bridge/BridgeIntent.d.ts +8 -40
- package/dist/neutral/payload/elevatable/Bridge/BridgeIntent.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Bridge/BridgeSourceObservation.d.ts +9 -45
- package/dist/neutral/payload/elevatable/Bridge/BridgeSourceObservation.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Time.d.ts +44 -16
- package/dist/neutral/payload/elevatable/Time.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/TransferPayload.d.ts +37 -5
- package/dist/neutral/payload/elevatable/TransferPayload.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/payload/elevatable/Time.ts +20 -14
- package/src/payload/elevatable/TransferPayload.ts +20 -7
|
@@ -4,7 +4,7 @@ import z from 'zod';
|
|
|
4
4
|
import type { BridgeDestinationObservation, BridgeIntent, BridgeSourceObservation, ChainStakeIntent, HashPayload, StepComplete, TimePayload, Transfer } from '../payload/index.ts';
|
|
5
5
|
import { type TransactionBoundWitness } from '../transaction/index.ts';
|
|
6
6
|
export type AllowedBlockPayload = Transfer | BridgeDestinationObservation | BridgeIntent | BridgeSourceObservation | ChainStakeIntent | HashPayload | SchemaPayload | StepComplete | TimePayload | TransactionBoundWitness;
|
|
7
|
-
export declare const AllowedBlockPayloadSchemas: ("network.xyo.chain.bridge.observation.destination" | "network.xyo.chain.bridge.intent" | "network.xyo.chain.bridge.observation.source" | "network.xyo.chain.stake.intent" | "network.xyo.hash" | "network.xyo.chain.step.complete" | "network.xyo.
|
|
7
|
+
export declare const AllowedBlockPayloadSchemas: ("network.xyo.chain.bridge.observation.destination" | "network.xyo.chain.bridge.intent" | "network.xyo.chain.bridge.observation.source" | "network.xyo.chain.stake.intent" | "network.xyo.hash" | "network.xyo.chain.step.complete" | "network.xyo.transfer" | "network.xyo.time" | "network.xyo.boundwitness" | "network.xyo.schema")[];
|
|
8
8
|
export declare const AllowedBlockPayloadSchemaZod: z.ZodEnum<{
|
|
9
9
|
"network.xyo.chain.bridge.observation.destination": "network.xyo.chain.bridge.observation.destination";
|
|
10
10
|
"network.xyo.chain.bridge.intent": "network.xyo.chain.bridge.intent";
|
|
@@ -12,13 +12,13 @@ export declare const AllowedBlockPayloadSchemaZod: z.ZodEnum<{
|
|
|
12
12
|
"network.xyo.chain.stake.intent": "network.xyo.chain.stake.intent";
|
|
13
13
|
"network.xyo.hash": "network.xyo.hash";
|
|
14
14
|
"network.xyo.chain.step.complete": "network.xyo.chain.step.complete";
|
|
15
|
-
"network.xyo.time": "network.xyo.time";
|
|
16
15
|
"network.xyo.transfer": "network.xyo.transfer";
|
|
16
|
+
"network.xyo.time": "network.xyo.time";
|
|
17
17
|
"network.xyo.boundwitness": "network.xyo.boundwitness";
|
|
18
18
|
"network.xyo.schema": "network.xyo.schema";
|
|
19
19
|
}>;
|
|
20
20
|
export type AllowedBlockPayloadSchema = z.infer<typeof AllowedBlockPayloadSchemaZod>;
|
|
21
|
-
export declare const isAllowedBlockPayloadSchema: (value: unknown) => value is "network.xyo.chain.bridge.observation.destination" | "network.xyo.chain.bridge.intent" | "network.xyo.chain.bridge.observation.source" | "network.xyo.chain.stake.intent" | "network.xyo.hash" | "network.xyo.chain.step.complete" | "network.xyo.
|
|
21
|
+
export declare const isAllowedBlockPayloadSchema: (value: unknown) => value is "network.xyo.chain.bridge.observation.destination" | "network.xyo.chain.bridge.intent" | "network.xyo.chain.bridge.observation.source" | "network.xyo.chain.stake.intent" | "network.xyo.hash" | "network.xyo.chain.step.complete" | "network.xyo.transfer" | "network.xyo.time" | "network.xyo.boundwitness" | "network.xyo.schema";
|
|
22
22
|
export declare const isAllowedBlockPayload: (value: unknown) => value is AllowedBlockPayload;
|
|
23
23
|
export declare const isAllowedBlockPayloadWithHashMeta: (value: unknown) => value is WithStorageMeta<AllowedBlockPayload>;
|
|
24
24
|
//# sourceMappingURL=AllowedBlockPayload.d.ts.map
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -287,7 +287,7 @@ var XL1Amount = class _XL1Amount {
|
|
|
287
287
|
import { BoundWitnessSchema } from "@xyo-network/boundwitness-model";
|
|
288
288
|
import { isHashMeta as isHashMeta3 } from "@xyo-network/payload-model";
|
|
289
289
|
import { isSchemaPayload, SchemaSchema } from "@xyo-network/schema-payload-plugin";
|
|
290
|
-
import
|
|
290
|
+
import z15 from "zod";
|
|
291
291
|
|
|
292
292
|
// src/model/BlockNumber/BlockNumber.ts
|
|
293
293
|
import z3 from "zod";
|
|
@@ -586,24 +586,60 @@ var isStepComplete = isPayloadOfSchemaType3(StepCompleteSchema);
|
|
|
586
586
|
var asStepComplete = AsObjectFactory6.create(isStepComplete);
|
|
587
587
|
|
|
588
588
|
// src/payload/elevatable/Time.ts
|
|
589
|
+
import { HashZod } from "@xylabs/hex";
|
|
590
|
+
import { AsObjectFactory as AsObjectFactory8 } from "@xylabs/object";
|
|
591
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType5 } from "@xyo-network/payload-model";
|
|
592
|
+
import z14 from "zod";
|
|
593
|
+
|
|
594
|
+
// src/payload/elevatable/TransferPayload.ts
|
|
595
|
+
import {
|
|
596
|
+
AddressZod,
|
|
597
|
+
HexZod as HexZod4
|
|
598
|
+
} from "@xylabs/hex";
|
|
589
599
|
import { AsObjectFactory as AsObjectFactory7 } from "@xylabs/object";
|
|
590
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType4 } from "@xyo-network/payload-model";
|
|
600
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType4, PayloadZod } from "@xyo-network/payload-model";
|
|
601
|
+
import z13 from "zod";
|
|
602
|
+
var TransferSchema = "network.xyo.transfer";
|
|
603
|
+
var TransferFieldsZod = z13.object({
|
|
604
|
+
$opCodes: z13.array(z13.string()).optional(),
|
|
605
|
+
context: z13.record(z13.string(), z13.json()).optional(),
|
|
606
|
+
epoch: z13.number(),
|
|
607
|
+
from: AddressZod,
|
|
608
|
+
transfers: z13.record(AddressZod, HexZod4)
|
|
609
|
+
});
|
|
610
|
+
var PayloadZodOfSchema = (schema) => PayloadZod.extend({ schema: z13.literal(schema) });
|
|
611
|
+
var TransferZod = PayloadZodOfSchema(TransferSchema).extend(TransferFieldsZod.shape);
|
|
612
|
+
var isTransfer = isPayloadOfSchemaType4(TransferSchema);
|
|
613
|
+
var asTransfer = AsObjectFactory7.create(isTransfer);
|
|
614
|
+
|
|
615
|
+
// src/payload/elevatable/Time.ts
|
|
591
616
|
var TimeSchema = "network.xyo.time";
|
|
617
|
+
var XL1TimeFieldsZod = z14.object({
|
|
618
|
+
// block number
|
|
619
|
+
xl1: z14.number().optional(),
|
|
620
|
+
// block hash
|
|
621
|
+
xl1Hash: HashZod.optional()
|
|
622
|
+
});
|
|
623
|
+
var EthereumTimeFieldsZod = z14.object({
|
|
624
|
+
// block number
|
|
625
|
+
ethereum: z14.number().optional(),
|
|
626
|
+
// block hash
|
|
627
|
+
ethereumHash: HashZod.optional()
|
|
628
|
+
});
|
|
629
|
+
var EpochTimeFieldsZod = z14.object({
|
|
630
|
+
// in milliseconds
|
|
631
|
+
epoch: z14.number()
|
|
632
|
+
});
|
|
633
|
+
var TimeFieldsZod = XL1TimeFieldsZod.extend(XL1TimeFieldsZod.shape).extend(EthereumTimeFieldsZod.shape).extend(EpochTimeFieldsZod.shape);
|
|
634
|
+
var TimePayloadZod = PayloadZodOfSchema(TimeSchema).extend(TimeFieldsZod.shape);
|
|
592
635
|
var isSafeEpoch = (value) => {
|
|
593
636
|
return typeof value === "number" && value < 2 * Date.now();
|
|
594
637
|
};
|
|
595
638
|
var isTimePayload = (value) => {
|
|
596
|
-
return
|
|
639
|
+
return isPayloadOfSchemaType5(TimeSchema)(value) && isSafeEpoch(value.epoch);
|
|
597
640
|
};
|
|
598
|
-
var asTimePayload =
|
|
599
|
-
var asTimePayloadWithStorageMeta =
|
|
600
|
-
|
|
601
|
-
// src/payload/elevatable/TransferPayload.ts
|
|
602
|
-
import { AsObjectFactory as AsObjectFactory8 } from "@xylabs/object";
|
|
603
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType5 } from "@xyo-network/payload-model";
|
|
604
|
-
var TransferSchema = "network.xyo.transfer";
|
|
605
|
-
var isTransfer = isPayloadOfSchemaType5(TransferSchema);
|
|
606
|
-
var asTransfer = AsObjectFactory8.create(isTransfer);
|
|
641
|
+
var asTimePayload = AsObjectFactory8.create(isTimePayload);
|
|
642
|
+
var asTimePayloadWithStorageMeta = AsObjectFactory8.create(isTimePayload);
|
|
607
643
|
|
|
608
644
|
// src/payload/StepIdentityPayload.ts
|
|
609
645
|
import { AsObjectFactory as AsObjectFactory9 } from "@xylabs/object";
|
|
@@ -804,7 +840,7 @@ var AllowedBlockPayloadSchemas = [
|
|
|
804
840
|
TimeSchema,
|
|
805
841
|
TransferSchema
|
|
806
842
|
];
|
|
807
|
-
var AllowedBlockPayloadSchemaZod =
|
|
843
|
+
var AllowedBlockPayloadSchemaZod = z15.enum(AllowedBlockPayloadSchemas);
|
|
808
844
|
var isAllowedBlockPayloadSchema = zodIsFactory(AllowedBlockPayloadSchemaZod);
|
|
809
845
|
var isAllowedBlockPayload = (value) => {
|
|
810
846
|
return isTransfer(value) || isBridgeDestinationObservation(value) || isBridgeIntent(value) || isBridgeSourceObservation(value) || isChainStakeIntent(value) || isHashPayload(value) || isSchemaPayload(value) || isTimePayload(value) || isTransactionBoundWitness(value);
|
|
@@ -1043,8 +1079,10 @@ export {
|
|
|
1043
1079
|
ChainStakeIntentSchema,
|
|
1044
1080
|
ELEVATE_OPCODE,
|
|
1045
1081
|
ETH_BLOCK_NUMBER_ZERO,
|
|
1082
|
+
EpochTimeFieldsZod,
|
|
1046
1083
|
EthBlockNumberZod,
|
|
1047
1084
|
EthBlockRangeZod,
|
|
1085
|
+
EthereumTimeFieldsZod,
|
|
1048
1086
|
FemtoXL1,
|
|
1049
1087
|
FemtoXL1MaxValue,
|
|
1050
1088
|
HashSchema,
|
|
@@ -1065,6 +1103,7 @@ export {
|
|
|
1065
1103
|
NumberishXL1BlockNumberZod,
|
|
1066
1104
|
NumberishXL1BlockRangeZod,
|
|
1067
1105
|
NumberishZod,
|
|
1106
|
+
PayloadZodOfSchema,
|
|
1068
1107
|
PicoXL1,
|
|
1069
1108
|
PicoXL1MaxValue,
|
|
1070
1109
|
RangeZod,
|
|
@@ -1074,9 +1113,13 @@ export {
|
|
|
1074
1113
|
StepIdentityZod,
|
|
1075
1114
|
StepRewardFractions,
|
|
1076
1115
|
StepSizes,
|
|
1116
|
+
TimeFieldsZod,
|
|
1117
|
+
TimePayloadZod,
|
|
1077
1118
|
TimeSchema,
|
|
1078
1119
|
TransactionGasCosts,
|
|
1120
|
+
TransferFieldsZod,
|
|
1079
1121
|
TransferSchema,
|
|
1122
|
+
TransferZod,
|
|
1080
1123
|
ValidationError,
|
|
1081
1124
|
XL1,
|
|
1082
1125
|
XL1Amount,
|
|
@@ -1084,6 +1127,7 @@ export {
|
|
|
1084
1127
|
XL1BlockRangeZod,
|
|
1085
1128
|
XL1MaxValue,
|
|
1086
1129
|
XL1Places,
|
|
1130
|
+
XL1TimeFieldsZod,
|
|
1087
1131
|
XL1_BLOCK_NUMBER_ZERO,
|
|
1088
1132
|
XL1_ETH_MAIN_ERC20_CONTRACT_ADDRESS,
|
|
1089
1133
|
XL1_ETH_MAIN_GOVERNANCE_ADDRESS,
|