@xyo-network/xl1-protocol-sdk 1.15.9 → 1.15.11
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/config/Config.d.ts +25 -0
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/RewardRedemptionApi.d.ts +8 -0
- package/dist/neutral/config/RewardRedemptionApi.d.ts.map +1 -0
- package/dist/neutral/config/Validation.d.ts +23 -0
- package/dist/neutral/config/Validation.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +2 -0
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +208 -70
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/multipliers.d.ts +2 -1
- package/dist/neutral/multipliers.d.ts.map +1 -1
- package/dist/neutral/primitives/index.d.ts +3 -0
- package/dist/neutral/primitives/index.d.ts.map +1 -0
- package/dist/neutral/primitives/step/completedStepRewardAddress.d.ts +4 -0
- package/dist/neutral/primitives/step/completedStepRewardAddress.d.ts.map +1 -0
- package/dist/neutral/primitives/step/derivedReceiveAddress.d.ts +3 -0
- package/dist/neutral/primitives/step/derivedReceiveAddress.d.ts.map +1 -0
- package/dist/neutral/primitives/step/index.d.ts +5 -0
- package/dist/neutral/primitives/step/index.d.ts.map +1 -0
- package/dist/neutral/primitives/step/spec/stepTransferIndex.spec.d.ts +2 -0
- package/dist/neutral/primitives/step/spec/stepTransferIndex.spec.d.ts.map +1 -0
- package/dist/neutral/primitives/step/stepBlockRange.d.ts +3 -0
- package/dist/neutral/primitives/step/stepBlockRange.d.ts.map +1 -0
- package/dist/neutral/primitives/step/stepTransferIndex.d.ts +2 -0
- package/dist/neutral/primitives/step/stepTransferIndex.d.ts.map +1 -0
- package/dist/neutral/primitives/transaction/elevatedPayloads.d.ts +4 -0
- package/dist/neutral/primitives/transaction/elevatedPayloads.d.ts.map +1 -0
- package/dist/neutral/primitives/transaction/index.d.ts +2 -0
- package/dist/neutral/primitives/transaction/index.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/config/Config.ts +4 -0
- package/src/config/RewardRedemptionApi.ts +26 -0
- package/src/config/Validation.ts +28 -0
- package/src/index.ts +2 -0
- package/src/multipliers.ts +6 -8
- package/src/primitives/index.ts +2 -0
- package/src/primitives/step/completedStepRewardAddress.ts +8 -0
- package/src/primitives/step/derivedReceiveAddress.ts +8 -0
- package/src/primitives/step/index.ts +4 -0
- package/src/primitives/step/spec/stepTransferIndex.spec.ts +23 -0
- package/src/primitives/step/stepBlockRange.ts +8 -0
- package/src/primitives/step/stepTransferIndex.ts +18 -0
- package/src/primitives/transaction/elevatedPayloads.ts +21 -0
- package/src/primitives/transaction/index.ts +1 -0
|
@@ -55,6 +55,11 @@ export declare const ConfigZod: z.ZodObject<{
|
|
|
55
55
|
port: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
56
56
|
rewardAddress: z.ZodOptional<z.ZodString>;
|
|
57
57
|
}, z.core.$strip>>;
|
|
58
|
+
rewardRedemptionApi: z.ZodDefault<z.ZodObject<{
|
|
59
|
+
host: z.ZodDefault<z.ZodString>;
|
|
60
|
+
mnemonic: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
61
|
+
port: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
58
63
|
storage: z.ZodDefault<z.ZodObject<{
|
|
59
64
|
mongo: z.ZodOptional<z.ZodObject<{
|
|
60
65
|
connectionString: z.ZodOptional<z.ZodString>;
|
|
@@ -70,6 +75,26 @@ export declare const ConfigZod: z.ZodObject<{
|
|
|
70
75
|
otlpEndpoint: z.ZodOptional<z.ZodURL>;
|
|
71
76
|
}, z.core.$strip>>;
|
|
72
77
|
}, z.core.$strip>>;
|
|
78
|
+
validation: z.ZodDefault<z.ZodObject<{
|
|
79
|
+
allowedRewardRedeemers: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodArray<z.ZodType<import("@xylabs/typeof").Brand<import("@xylabs/typeof").Brand<Lowercase<string>, {
|
|
80
|
+
readonly __hex: true;
|
|
81
|
+
}>, {
|
|
82
|
+
readonly __address: true;
|
|
83
|
+
}>, unknown, z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<import("@xylabs/typeof").Brand<Lowercase<string>, {
|
|
84
|
+
readonly __hex: true;
|
|
85
|
+
}>, {
|
|
86
|
+
readonly __address: true;
|
|
87
|
+
}>, unknown>>>>>;
|
|
88
|
+
allowedRewardEscrowAccountSigners: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodArray<z.ZodType<import("@xylabs/typeof").Brand<import("@xylabs/typeof").Brand<Lowercase<string>, {
|
|
89
|
+
readonly __hex: true;
|
|
90
|
+
}>, {
|
|
91
|
+
readonly __address: true;
|
|
92
|
+
}>, unknown, z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<import("@xylabs/typeof").Brand<Lowercase<string>, {
|
|
93
|
+
readonly __hex: true;
|
|
94
|
+
}>, {
|
|
95
|
+
readonly __address: true;
|
|
96
|
+
}>, unknown>>>>>;
|
|
97
|
+
}, z.core.$strip>>;
|
|
73
98
|
logLevel: z.ZodDefault<z.ZodEnum<{
|
|
74
99
|
error: "error";
|
|
75
100
|
warn: "warn";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../src/config/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../src/config/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAcxB,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAAmF,CAAA;AAErH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYpB,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAE9C,eAAO,MAAM,gBAAgB,QAAO,MAA6B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const RewardRedemptionApiConfigZod: z.ZodObject<{
|
|
3
|
+
host: z.ZodDefault<z.ZodString>;
|
|
4
|
+
mnemonic: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
5
|
+
port: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type RewardRedemptionApiConfig = z.infer<typeof RewardRedemptionApiConfigZod>;
|
|
8
|
+
//# sourceMappingURL=RewardRedemptionApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RewardRedemptionApi.d.ts","sourceRoot":"","sources":["../../../src/config/RewardRedemptionApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,eAAO,MAAM,4BAA4B;;;;iBAkBvC,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const ValidationConfigZod: z.ZodObject<{
|
|
3
|
+
allowedRewardRedeemers: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodArray<z.ZodType<import("@xylabs/typeof").Brand<import("@xylabs/typeof").Brand<Lowercase<string>, {
|
|
4
|
+
readonly __hex: true;
|
|
5
|
+
}>, {
|
|
6
|
+
readonly __address: true;
|
|
7
|
+
}>, unknown, z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<import("@xylabs/typeof").Brand<Lowercase<string>, {
|
|
8
|
+
readonly __hex: true;
|
|
9
|
+
}>, {
|
|
10
|
+
readonly __address: true;
|
|
11
|
+
}>, unknown>>>>>;
|
|
12
|
+
allowedRewardEscrowAccountSigners: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodArray<z.ZodType<import("@xylabs/typeof").Brand<import("@xylabs/typeof").Brand<Lowercase<string>, {
|
|
13
|
+
readonly __hex: true;
|
|
14
|
+
}>, {
|
|
15
|
+
readonly __address: true;
|
|
16
|
+
}>, unknown, z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<import("@xylabs/typeof").Brand<Lowercase<string>, {
|
|
17
|
+
readonly __hex: true;
|
|
18
|
+
}>, {
|
|
19
|
+
readonly __address: true;
|
|
20
|
+
}>, unknown>>>>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type ValidationConfig = z.infer<typeof ValidationConfigZod>;
|
|
23
|
+
//# sourceMappingURL=Validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Validation.d.ts","sourceRoot":"","sources":["../../../src/config/Validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;iBAqB9B,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export * from './map/index.ts';
|
|
|
8
8
|
export * from './model/index.ts';
|
|
9
9
|
export * from './multipliers.ts';
|
|
10
10
|
export * from './payload/index.ts';
|
|
11
|
+
export * from './primitives/index.ts';
|
|
12
|
+
export * from './primitives/index.ts';
|
|
11
13
|
export * from './SignedBigInt.ts';
|
|
12
14
|
export * from './time/index.ts';
|
|
13
15
|
export * from './transaction/index.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -556,7 +556,7 @@ var tryHydrateBlock = /* @__PURE__ */ __name(async (archivist, hash, maxDepth =
|
|
|
556
556
|
}, "tryHydrateBlock");
|
|
557
557
|
|
|
558
558
|
// src/config/Config.ts
|
|
559
|
-
import * as
|
|
559
|
+
import * as z14 from "zod";
|
|
560
560
|
|
|
561
561
|
// src/config/Api.ts
|
|
562
562
|
import { globalRegistry } from "zod";
|
|
@@ -765,37 +765,60 @@ var ProducerConfigZod = z8.object({
|
|
|
765
765
|
})
|
|
766
766
|
});
|
|
767
767
|
|
|
768
|
-
// src/config/
|
|
769
|
-
import { isDefined as isDefined4, isUndefined } from "@xylabs/typeof";
|
|
768
|
+
// src/config/RewardRedemptionApi.ts
|
|
770
769
|
import { globalRegistry as globalRegistry8 } from "zod";
|
|
771
770
|
import * as z9 from "zod";
|
|
771
|
+
var RewardRedemptionApiConfigZod = z9.object({
|
|
772
|
+
host: z9.string().default("localhost").register(globalRegistry8, {
|
|
773
|
+
default: "localhost",
|
|
774
|
+
description: "Host for the Redemption API",
|
|
775
|
+
title: "rewardRedemptionApi.host",
|
|
776
|
+
type: "string"
|
|
777
|
+
}),
|
|
778
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry8, {
|
|
779
|
+
description: "Mnemonic for the Redemption API wallet",
|
|
780
|
+
title: "rewardRedemptionApi.mnemonic",
|
|
781
|
+
type: "string"
|
|
782
|
+
}),
|
|
783
|
+
port: z9.coerce.number().default(8082).register(globalRegistry8, {
|
|
784
|
+
default: 8082,
|
|
785
|
+
description: "Port for the Redemption API",
|
|
786
|
+
title: "rewardRedemptionApi.port",
|
|
787
|
+
type: "number"
|
|
788
|
+
})
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
// src/config/storage/driver/Mongo.ts
|
|
792
|
+
import { isDefined as isDefined4, isUndefined } from "@xylabs/typeof";
|
|
793
|
+
import { globalRegistry as globalRegistry9 } from "zod";
|
|
794
|
+
import * as z10 from "zod";
|
|
772
795
|
var hasMongoConfig = /* @__PURE__ */ __name((config) => {
|
|
773
796
|
if (isUndefined(config)) return false;
|
|
774
797
|
return isDefined4(config.connectionString) && isDefined4(config.database) && isDefined4(config.domain) && isDefined4(config.password) && isDefined4(config.username);
|
|
775
798
|
}, "hasMongoConfig");
|
|
776
|
-
var MongoConfigZod =
|
|
799
|
+
var MongoConfigZod = z10.object({
|
|
777
800
|
// TODO: Create from other arguments
|
|
778
|
-
connectionString:
|
|
801
|
+
connectionString: z10.string().min(1).optional().register(globalRegistry9, {
|
|
779
802
|
description: "MongoDB connection string",
|
|
780
803
|
title: "storage.mongo.connectionString",
|
|
781
804
|
type: "string"
|
|
782
805
|
}),
|
|
783
|
-
database:
|
|
806
|
+
database: z10.string().min(1).optional().register(globalRegistry9, {
|
|
784
807
|
description: "MongoDB database name",
|
|
785
808
|
title: "storage.mongo.database",
|
|
786
809
|
type: "string"
|
|
787
810
|
}),
|
|
788
|
-
domain:
|
|
811
|
+
domain: z10.string().min(1).optional().register(globalRegistry9, {
|
|
789
812
|
description: "MongoDB domain",
|
|
790
813
|
title: "storage.mongo.domain",
|
|
791
814
|
type: "string"
|
|
792
815
|
}),
|
|
793
|
-
password:
|
|
816
|
+
password: z10.string().min(1).optional().register(globalRegistry9, {
|
|
794
817
|
description: "MongoDB password",
|
|
795
818
|
title: "storage.mongo.password",
|
|
796
819
|
type: "string"
|
|
797
820
|
}),
|
|
798
|
-
username:
|
|
821
|
+
username: z10.string().min(1).optional().register(globalRegistry9, {
|
|
799
822
|
description: "MongoDB username",
|
|
800
823
|
title: "storage.mongo.username",
|
|
801
824
|
type: "string"
|
|
@@ -803,11 +826,11 @@ var MongoConfigZod = z9.object({
|
|
|
803
826
|
});
|
|
804
827
|
|
|
805
828
|
// src/config/storage/Storage.ts
|
|
806
|
-
import { globalRegistry as
|
|
807
|
-
import * as
|
|
808
|
-
var StorageConfigZod =
|
|
829
|
+
import { globalRegistry as globalRegistry10 } from "zod";
|
|
830
|
+
import * as z11 from "zod";
|
|
831
|
+
var StorageConfigZod = z11.object({
|
|
809
832
|
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
810
|
-
root:
|
|
833
|
+
root: z11.string().optional().register(globalRegistry10, {
|
|
811
834
|
description: "Root directory for local storage",
|
|
812
835
|
title: "storage.root",
|
|
813
836
|
type: "string"
|
|
@@ -815,26 +838,53 @@ var StorageConfigZod = z10.object({
|
|
|
815
838
|
}).describe("Storage configuration options");
|
|
816
839
|
|
|
817
840
|
// src/config/Telemetry.ts
|
|
818
|
-
import { globalRegistry as
|
|
819
|
-
import * as
|
|
820
|
-
var OpenTelemetryConfigZod =
|
|
841
|
+
import { globalRegistry as globalRegistry11 } from "zod";
|
|
842
|
+
import * as z12 from "zod";
|
|
843
|
+
var OpenTelemetryConfigZod = z12.object({
|
|
821
844
|
// OpenTelemetry options
|
|
822
|
-
otlpEndpoint:
|
|
845
|
+
otlpEndpoint: z12.url().optional().register(globalRegistry11, {
|
|
823
846
|
description: "OTLP endpoint for exporting telemetry data",
|
|
824
847
|
title: "telemetry.otel.otlpEndpoint",
|
|
825
848
|
type: "string"
|
|
826
849
|
})
|
|
827
850
|
});
|
|
828
|
-
var TelemetryConfigZod =
|
|
851
|
+
var TelemetryConfigZod = z12.object({
|
|
829
852
|
// OpenTelemetry configuration
|
|
830
853
|
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
831
854
|
}).describe("Telemetry configuration options");
|
|
832
855
|
|
|
856
|
+
// src/config/Validation.ts
|
|
857
|
+
import { AddressZod as AddressZod2, asAddress as asAddress4 } from "@xylabs/hex";
|
|
858
|
+
import { globalRegistry as globalRegistry12 } from "zod";
|
|
859
|
+
import * as z13 from "zod";
|
|
860
|
+
var ValidationConfigZod = z13.object({
|
|
861
|
+
allowedRewardRedeemers: z13.preprocess((val) => {
|
|
862
|
+
if (typeof val === "string") {
|
|
863
|
+
return val.split(",").map((s) => asAddress4(s.trim()));
|
|
864
|
+
}
|
|
865
|
+
return val;
|
|
866
|
+
}, z13.array(AddressZod2).optional().register(globalRegistry12, {
|
|
867
|
+
description: "List of allowed reward redeemer addresses, if undefined anyone can participate",
|
|
868
|
+
title: "allowedRewardRedeemers",
|
|
869
|
+
type: "array"
|
|
870
|
+
})),
|
|
871
|
+
allowedRewardEscrowAccountSigners: z13.preprocess((val) => {
|
|
872
|
+
if (typeof val === "string") {
|
|
873
|
+
return val.split(",").map((s) => asAddress4(s.trim()));
|
|
874
|
+
}
|
|
875
|
+
return val;
|
|
876
|
+
}, z13.array(AddressZod2).optional().register(globalRegistry12, {
|
|
877
|
+
description: "List of allowed reward escrow account signer addresses, if undefined anyone can participate",
|
|
878
|
+
title: "allowedRewardEscrowAccountSigners",
|
|
879
|
+
type: "array"
|
|
880
|
+
}))
|
|
881
|
+
});
|
|
882
|
+
|
|
833
883
|
// src/config/Config.ts
|
|
834
|
-
var Xl1CommonConfigSchema =
|
|
884
|
+
var Xl1CommonConfigSchema = z14.object({
|
|
835
885
|
...LogConfigZod.shape
|
|
836
886
|
}).describe("XL1 common configuration options");
|
|
837
|
-
var ConfigZod =
|
|
887
|
+
var ConfigZod = z14.object({
|
|
838
888
|
...Xl1CommonConfigSchema.shape,
|
|
839
889
|
api: ApiConfigZod.default(ApiConfigZod.parse({})).describe("Configuration for the API node"),
|
|
840
890
|
app: AppConfigZod.default(AppConfigZod.parse({})).describe("Configuration for the application"),
|
|
@@ -842,41 +892,43 @@ var ConfigZod = z12.object({
|
|
|
842
892
|
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
843
893
|
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
844
894
|
producer: ProducerConfigZod.default(ProducerConfigZod.parse({})).describe("Configuration for the producer"),
|
|
895
|
+
rewardRedemptionApi: RewardRedemptionApiConfigZod.default(RewardRedemptionApiConfigZod.parse({})).describe("Configuration for the rewards redemption API"),
|
|
845
896
|
storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe("Configuration for the storage"),
|
|
846
|
-
telemetry: TelemetryConfigZod.default(TelemetryConfigZod.parse({})).describe("Configuration for telemetry")
|
|
897
|
+
telemetry: TelemetryConfigZod.default(TelemetryConfigZod.parse({})).describe("Configuration for telemetry"),
|
|
898
|
+
validation: ValidationConfigZod.default(ValidationConfigZod.parse({})).describe("Configuration for validation")
|
|
847
899
|
});
|
|
848
900
|
var getDefaultConfig = /* @__PURE__ */ __name(() => ConfigZod.parse({}), "getDefaultConfig");
|
|
849
901
|
|
|
850
902
|
// src/config/UsageMeta.ts
|
|
851
|
-
import * as
|
|
852
|
-
var DescriptionSchema =
|
|
853
|
-
var TitleSchema =
|
|
854
|
-
var JSONSchemaMetaSchema =
|
|
855
|
-
id:
|
|
903
|
+
import * as z15 from "zod";
|
|
904
|
+
var DescriptionSchema = z15.string();
|
|
905
|
+
var TitleSchema = z15.string();
|
|
906
|
+
var JSONSchemaMetaSchema = z15.object({
|
|
907
|
+
id: z15.string().optional(),
|
|
856
908
|
title: TitleSchema.optional(),
|
|
857
909
|
description: DescriptionSchema.optional(),
|
|
858
|
-
deprecated:
|
|
859
|
-
}).catchall(
|
|
910
|
+
deprecated: z15.boolean().optional()
|
|
911
|
+
}).catchall(z15.unknown());
|
|
860
912
|
var GlobalMetaSchema = JSONSchemaMetaSchema.extend({});
|
|
861
|
-
var ChoicesSchema =
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
913
|
+
var ChoicesSchema = z15.array(z15.union([
|
|
914
|
+
z15.string(),
|
|
915
|
+
z15.number(),
|
|
916
|
+
z15.literal(true),
|
|
917
|
+
z15.undefined()
|
|
866
918
|
])).readonly();
|
|
867
919
|
var UsageMetaSchema = GlobalMetaSchema.extend({
|
|
868
920
|
choices: ChoicesSchema.optional(),
|
|
869
|
-
default:
|
|
921
|
+
default: z15.unknown().optional(),
|
|
870
922
|
description: DescriptionSchema,
|
|
871
|
-
group:
|
|
872
|
-
hidden:
|
|
923
|
+
group: z15.string().optional(),
|
|
924
|
+
hidden: z15.boolean().optional(),
|
|
873
925
|
title: TitleSchema,
|
|
874
|
-
type:
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
926
|
+
type: z15.union([
|
|
927
|
+
z15.literal("array"),
|
|
928
|
+
z15.literal("count"),
|
|
929
|
+
z15.literal("boolean"),
|
|
930
|
+
z15.literal("number"),
|
|
931
|
+
z15.literal("string")
|
|
880
932
|
])
|
|
881
933
|
});
|
|
882
934
|
function isUsageMeta(v) {
|
|
@@ -896,18 +948,98 @@ var StakeEventNames = [
|
|
|
896
948
|
];
|
|
897
949
|
|
|
898
950
|
// src/multipliers.ts
|
|
899
|
-
import { asAttoXL1
|
|
900
|
-
var
|
|
901
|
-
var XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_BONUS_REWARDS =
|
|
951
|
+
import { asAttoXL1 } from "@xyo-network/xl1-protocol";
|
|
952
|
+
var XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_EARNED_REWARDS = asAttoXL1(1105508843867301885042548n);
|
|
953
|
+
var XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_BONUS_REWARDS = asAttoXL1(100000000000000000000000000n);
|
|
954
|
+
var XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_REWARDS = XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_EARNED_REWARDS + XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_BONUS_REWARDS;
|
|
902
955
|
var RewardMultipliers = {
|
|
903
956
|
[`0|${XL1_NETWORK_STAKING_GENESIS_PERIOD_END_XL1_BLOCK}`]: [
|
|
904
957
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_BONUS_REWARDS,
|
|
905
|
-
|
|
958
|
+
XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_EARNED_REWARDS
|
|
906
959
|
]
|
|
907
960
|
};
|
|
908
961
|
|
|
909
|
-
// src/
|
|
962
|
+
// src/primitives/step/completedStepRewardAddress.ts
|
|
963
|
+
import { toAddress as toAddress2 } from "@xylabs/hex";
|
|
964
|
+
import { keccak256 } from "ethers";
|
|
965
|
+
function completedStepRewardAddress({ block, step }) {
|
|
966
|
+
const addressKey = new TextEncoder().encode(`${block}|${step}`);
|
|
967
|
+
return toAddress2(keccak256(addressKey).slice(-40), {
|
|
968
|
+
prefix: false
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
__name(completedStepRewardAddress, "completedStepRewardAddress");
|
|
972
|
+
|
|
973
|
+
// src/primitives/step/derivedReceiveAddress.ts
|
|
974
|
+
import { toAddress as toAddress3 } from "@xylabs/hex";
|
|
975
|
+
import { isDefined as isDefined5 } from "@xylabs/typeof";
|
|
976
|
+
import { keccak256 as keccak2562 } from "ethers";
|
|
977
|
+
function derivedReceiveAddress(address, scope) {
|
|
978
|
+
const addressKey = new TextEncoder().encode(isDefined5(scope) ? `${scope}|${address}` : address);
|
|
979
|
+
return toAddress3(keccak2562(addressKey).slice(-40), {
|
|
980
|
+
prefix: false
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
__name(derivedReceiveAddress, "derivedReceiveAddress");
|
|
984
|
+
|
|
985
|
+
// src/primitives/step/stepBlockRange.ts
|
|
986
|
+
import { asXL1BlockRange, StepSizes as StepSizes5 } from "@xyo-network/xl1-protocol";
|
|
987
|
+
function stepBlockRange({ block, step }) {
|
|
988
|
+
const stepSize2 = StepSizes5[step];
|
|
989
|
+
const start = block - stepSize2;
|
|
990
|
+
return asXL1BlockRange([
|
|
991
|
+
start,
|
|
992
|
+
start + stepSize2 - 1
|
|
993
|
+
]);
|
|
994
|
+
}
|
|
995
|
+
__name(stepBlockRange, "stepBlockRange");
|
|
996
|
+
|
|
997
|
+
// src/primitives/step/stepTransferIndex.ts
|
|
910
998
|
import { assertEx as assertEx6 } from "@xylabs/assert";
|
|
999
|
+
import { StepSizes as StepSizes6 } from "@xyo-network/xl1-protocol";
|
|
1000
|
+
function stepTransferIndex(block, step) {
|
|
1001
|
+
let rewardTransferCount = 0;
|
|
1002
|
+
let rewardTransferIndex = -1;
|
|
1003
|
+
for (let i = 3; i < StepSizes6.length; i++) {
|
|
1004
|
+
const stepSize2 = StepSizes6[i];
|
|
1005
|
+
if (block % stepSize2 === 0) {
|
|
1006
|
+
if (stepSize2 === StepSizes6[step]) {
|
|
1007
|
+
rewardTransferIndex = rewardTransferCount;
|
|
1008
|
+
}
|
|
1009
|
+
rewardTransferCount++;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
assertEx6(rewardTransferIndex >= 0, () => `Error: Could not find step size for step ${step} at block ${block}`);
|
|
1013
|
+
return [
|
|
1014
|
+
rewardTransferIndex,
|
|
1015
|
+
rewardTransferCount
|
|
1016
|
+
];
|
|
1017
|
+
}
|
|
1018
|
+
__name(stepTransferIndex, "stepTransferIndex");
|
|
1019
|
+
|
|
1020
|
+
// src/primitives/transaction/elevatedPayloads.ts
|
|
1021
|
+
import { isAllowedBlockPayload } from "@xyo-network/xl1-protocol";
|
|
1022
|
+
function elevatedPayloads([tx, payloads]) {
|
|
1023
|
+
const opCodes = (tx.script ?? []).filter((operation) => operation.startsWith("elevate|"));
|
|
1024
|
+
const elevatedPayloads2 = [];
|
|
1025
|
+
for (const opCode of opCodes) {
|
|
1026
|
+
const [code, hash] = opCode.split("|");
|
|
1027
|
+
if (code === "elevated") {
|
|
1028
|
+
const elevatedPayload = payloads.find((payload) => payload._hash === hash);
|
|
1029
|
+
if (isAllowedBlockPayload(elevatedPayload)) {
|
|
1030
|
+
elevatedPayloads2.push(elevatedPayload);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
if (opCodes.length === elevatedPayloads2.length) {
|
|
1035
|
+
return elevatedPayloads2;
|
|
1036
|
+
}
|
|
1037
|
+
throw new Error("Not all elevated payloads could be found in the transaction payloads");
|
|
1038
|
+
}
|
|
1039
|
+
__name(elevatedPayloads, "elevatedPayloads");
|
|
1040
|
+
|
|
1041
|
+
// src/time/primitives/xl1BlockNumberToEthBlockNumber.ts
|
|
1042
|
+
import { assertEx as assertEx7 } from "@xylabs/assert";
|
|
911
1043
|
import { asTimePayload, TimeSchema } from "@xyo-network/xl1-protocol";
|
|
912
1044
|
async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
913
1045
|
const blockHash = await hashFromBlockNumber(context, xl1BlockNumber);
|
|
@@ -915,12 +1047,12 @@ async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
|
915
1047
|
const timePayload = asTimePayload(hydratedBlock[1].find((p) => p.schema === TimeSchema), {
|
|
916
1048
|
required: true
|
|
917
1049
|
});
|
|
918
|
-
return
|
|
1050
|
+
return assertEx7(timePayload.ethereum, () => "No ethereum timestamp found on block");
|
|
919
1051
|
}
|
|
920
1052
|
__name(xl1BlockNumberToEthBlockNumber, "xl1BlockNumberToEthBlockNumber");
|
|
921
1053
|
|
|
922
1054
|
// src/transaction/buildTransaction.ts
|
|
923
|
-
import { assertEx as
|
|
1055
|
+
import { assertEx as assertEx8 } from "@xylabs/assert";
|
|
924
1056
|
import { toHex as toHex2 } from "@xylabs/hex";
|
|
925
1057
|
import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
926
1058
|
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/payload-builder";
|
|
@@ -947,7 +1079,7 @@ async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer
|
|
|
947
1079
|
}
|
|
948
1080
|
const fields = {
|
|
949
1081
|
...txBoundWitnessFields,
|
|
950
|
-
from: from ?? (Array.isArray(signer) ?
|
|
1082
|
+
from: from ?? (Array.isArray(signer) ? assertEx8(signer.at(0)?.address) : signer.address)
|
|
951
1083
|
};
|
|
952
1084
|
if (script.length > 0) {
|
|
953
1085
|
fields.script = script;
|
|
@@ -1011,7 +1143,7 @@ __name(buildUnsignedTransaction, "buildUnsignedTransaction");
|
|
|
1011
1143
|
|
|
1012
1144
|
// src/transaction/confirmSubmittedTransaction.ts
|
|
1013
1145
|
import { delay } from "@xylabs/delay";
|
|
1014
|
-
import { isDefined as
|
|
1146
|
+
import { isDefined as isDefined6 } from "@xylabs/typeof";
|
|
1015
1147
|
import { PayloadBuilder as PayloadBuilder5 } from "@xyo-network/payload-builder";
|
|
1016
1148
|
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
1017
1149
|
var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
|
|
@@ -1022,7 +1154,7 @@ var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, transact
|
|
|
1022
1154
|
let attempts = 0;
|
|
1023
1155
|
while (true) {
|
|
1024
1156
|
const tx = await viewer.transactionByHash(txBWHash) ?? void 0;
|
|
1025
|
-
if (
|
|
1157
|
+
if (isDefined6(tx)) {
|
|
1026
1158
|
options?.logger?.log("\u2705 Transaction confirmed:", txBWHash, "\n");
|
|
1027
1159
|
return tx;
|
|
1028
1160
|
} else {
|
|
@@ -1039,9 +1171,9 @@ var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, transact
|
|
|
1039
1171
|
}, "confirmSubmittedTransaction");
|
|
1040
1172
|
|
|
1041
1173
|
// src/transaction/hydrateTransaction.ts
|
|
1042
|
-
import { assertEx as
|
|
1174
|
+
import { assertEx as assertEx9 } from "@xylabs/assert";
|
|
1043
1175
|
import { hydrateTypedBoundWitness, tryHydrateTypedBoundWitness } from "@xyo-network/archivist-model";
|
|
1044
|
-
import { isAllowedBlockPayload, isSignedTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
1176
|
+
import { isAllowedBlockPayload as isAllowedBlockPayload2, isSignedTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
1045
1177
|
var tryHydrateTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
1046
1178
|
return await tryHydrateTypedBoundWitness({
|
|
1047
1179
|
get(hashes) {
|
|
@@ -1079,26 +1211,26 @@ var tryHydrateElevatedTransaction = /* @__PURE__ */ __name(async ({ chainMap },
|
|
|
1079
1211
|
}
|
|
1080
1212
|
const [transaction, payloads] = hydratedTransaction;
|
|
1081
1213
|
const opCodes = (transaction.script ?? []).filter((operation) => operation.startsWith("elevate|"));
|
|
1082
|
-
const
|
|
1214
|
+
const elevatedPayloads2 = [];
|
|
1083
1215
|
for (const opCode of opCodes) {
|
|
1084
1216
|
const [code, hash2] = opCode.split("|");
|
|
1085
1217
|
if (code === "elevated") {
|
|
1086
1218
|
const elevatedPayload = payloads.find((payload) => payload._hash === hash2);
|
|
1087
|
-
if (
|
|
1088
|
-
|
|
1219
|
+
if (isAllowedBlockPayload2(elevatedPayload)) {
|
|
1220
|
+
elevatedPayloads2.push(elevatedPayload);
|
|
1089
1221
|
}
|
|
1090
1222
|
}
|
|
1091
1223
|
}
|
|
1092
|
-
if (opCodes.length ===
|
|
1224
|
+
if (opCodes.length === elevatedPayloads2.length) {
|
|
1093
1225
|
return [
|
|
1094
1226
|
transaction,
|
|
1095
|
-
|
|
1227
|
+
elevatedPayloads2
|
|
1096
1228
|
];
|
|
1097
1229
|
}
|
|
1098
1230
|
return void 0;
|
|
1099
1231
|
}, "tryHydrateElevatedTransaction");
|
|
1100
1232
|
var hydrateElevatedTransaction = /* @__PURE__ */ __name(async (context, hash) => {
|
|
1101
|
-
return
|
|
1233
|
+
return assertEx9(await tryHydrateElevatedTransaction(context, hash), () => "Hydration failed");
|
|
1102
1234
|
}, "hydrateElevatedTransaction");
|
|
1103
1235
|
|
|
1104
1236
|
// src/transaction/primitives/transactionBlockByteCount.ts
|
|
@@ -1139,8 +1271,8 @@ function transactionElevatedPayloadHashes(transaction) {
|
|
|
1139
1271
|
__name(transactionElevatedPayloadHashes, "transactionElevatedPayloadHashes");
|
|
1140
1272
|
function transactionElevatedPayloads([transaction, payloads]) {
|
|
1141
1273
|
const hashes = transactionElevatedPayloadHashes(transaction);
|
|
1142
|
-
const
|
|
1143
|
-
return
|
|
1274
|
+
const elevatedPayloads2 = payloads.filter((payload) => hashes.includes(payload._hash));
|
|
1275
|
+
return elevatedPayloads2;
|
|
1144
1276
|
}
|
|
1145
1277
|
__name(transactionElevatedPayloads, "transactionElevatedPayloads");
|
|
1146
1278
|
|
|
@@ -1155,16 +1287,16 @@ function transactionBytesRequiredGas([transaction, payloads]) {
|
|
|
1155
1287
|
}
|
|
1156
1288
|
__name(transactionBytesRequiredGas, "transactionBytesRequiredGas");
|
|
1157
1289
|
function transactionRequiredGas(hydratedTransaction) {
|
|
1158
|
-
const
|
|
1159
|
-
const hashes =
|
|
1290
|
+
const elevatedPayloads2 = transactionElevatedPayloads(hydratedTransaction);
|
|
1291
|
+
const hashes = elevatedPayloads2.length + 1;
|
|
1160
1292
|
const signatures = hydratedTransaction[0].addresses.length;
|
|
1161
|
-
return AttoXL1(transactionBytesRequiredGas(hydratedTransaction) + TransactionGasCosts.hashValidation * BigInt(hashes) + TransactionGasCosts.signatureValidation * BigInt(signatures) + TransactionGasCosts.payloadValidation * BigInt(
|
|
1293
|
+
return AttoXL1(transactionBytesRequiredGas(hydratedTransaction) + TransactionGasCosts.hashValidation * BigInt(hashes) + TransactionGasCosts.signatureValidation * BigInt(signatures) + TransactionGasCosts.payloadValidation * BigInt(elevatedPayloads2.length));
|
|
1162
1294
|
}
|
|
1163
1295
|
__name(transactionRequiredGas, "transactionRequiredGas");
|
|
1164
1296
|
|
|
1165
1297
|
// src/transaction/script.ts
|
|
1166
1298
|
import { filterAs as filterAs2 } from "@xylabs/array";
|
|
1167
|
-
import { assertEx as
|
|
1299
|
+
import { assertEx as assertEx10 } from "@xylabs/assert";
|
|
1168
1300
|
import { asHash as asHash3 } from "@xylabs/hex";
|
|
1169
1301
|
import { isAllowedBlockPayloadWithHashStorageMeta } from "@xyo-network/xl1-protocol";
|
|
1170
1302
|
var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
@@ -1174,7 +1306,7 @@ var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
|
1174
1306
|
var extractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
1175
1307
|
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
1176
1308
|
const filtered = filterAs2(hashes, (h) => asHash3(h));
|
|
1177
|
-
|
|
1309
|
+
assertEx10(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
1178
1310
|
return filtered;
|
|
1179
1311
|
}, "extractElevatedHashesFromScript");
|
|
1180
1312
|
var tryExtractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
@@ -1188,17 +1320,17 @@ var extractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
|
1188
1320
|
const { script } = bw;
|
|
1189
1321
|
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
1190
1322
|
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashStorageMeta);
|
|
1191
|
-
|
|
1323
|
+
assertEx10(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
1192
1324
|
return filtered;
|
|
1193
1325
|
}, "extractElevatedHashes");
|
|
1194
1326
|
|
|
1195
1327
|
// src/transaction/signTransaction.ts
|
|
1196
1328
|
import { toArrayBuffer } from "@xylabs/arraybuffer";
|
|
1197
|
-
import { assertEx as
|
|
1329
|
+
import { assertEx as assertEx11 } from "@xylabs/assert";
|
|
1198
1330
|
import { hexFromArrayBuffer } from "@xylabs/hex";
|
|
1199
1331
|
import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/payload-builder";
|
|
1200
1332
|
async function signTransaction(tx, account) {
|
|
1201
|
-
|
|
1333
|
+
assertEx11(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
1202
1334
|
const signedTx = structuredClone(tx);
|
|
1203
1335
|
signedTx.addresses = [
|
|
1204
1336
|
account.address
|
|
@@ -1264,6 +1396,7 @@ export {
|
|
|
1264
1396
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_END_EPOCH,
|
|
1265
1397
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_END_XL1_BLOCK,
|
|
1266
1398
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_BONUS_REWARDS,
|
|
1399
|
+
XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_EARNED_REWARDS,
|
|
1267
1400
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_REWARDS,
|
|
1268
1401
|
Xl1CommonConfigSchema,
|
|
1269
1402
|
allHashesPresent,
|
|
@@ -1278,10 +1411,13 @@ export {
|
|
|
1278
1411
|
buildTransaction,
|
|
1279
1412
|
buildUnsignedTransaction,
|
|
1280
1413
|
calculateFramesFromRange,
|
|
1414
|
+
completedStepRewardAddress,
|
|
1281
1415
|
confirmSubmittedTransaction,
|
|
1282
1416
|
crackOperation,
|
|
1283
1417
|
crackOperations,
|
|
1284
1418
|
deepCalculateFramesFromRange,
|
|
1419
|
+
derivedReceiveAddress,
|
|
1420
|
+
elevatedPayloads,
|
|
1285
1421
|
extractElevatedHashes,
|
|
1286
1422
|
extractElevatedHashesFromScript,
|
|
1287
1423
|
flattenHydratedBlock,
|
|
@@ -1310,6 +1446,8 @@ export {
|
|
|
1310
1446
|
parseSignedBigInt,
|
|
1311
1447
|
readPayloadMapFromStore,
|
|
1312
1448
|
signTransaction,
|
|
1449
|
+
stepBlockRange,
|
|
1450
|
+
stepTransferIndex,
|
|
1313
1451
|
toPositiveBigInt,
|
|
1314
1452
|
toSignedBigInt,
|
|
1315
1453
|
transactionBlockByteCount,
|