@xyo-network/xl1-protocol-sdk 1.26.35 → 1.26.36
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/Actor.d.ts +17 -6
- package/dist/neutral/config/Actor.d.ts.map +1 -1
- package/dist/neutral/config/Actors.d.ts +1 -1
- package/dist/neutral/config/Config.d.ts +2 -2
- package/dist/neutral/config/HostActor.d.ts +6 -6
- package/dist/neutral/context/Actor.d.ts +6 -6
- package/dist/neutral/context/HostActor.d.ts +6 -6
- package/dist/neutral/getFileConfig.d.ts +1 -1
- package/dist/neutral/getFileConfig.mjs +82 -85
- package/dist/neutral/getFileConfig.mjs.map +1 -1
- package/dist/neutral/index.mjs +152 -147
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/test/index.mjs +82 -85
- package/dist/neutral/test/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/neutral/index.mjs
CHANGED
|
@@ -699,36 +699,15 @@ import {
|
|
|
699
699
|
zodIsFactory as zodIsFactory2,
|
|
700
700
|
zodToFactory as zodToFactory2
|
|
701
701
|
} from "@xylabs/sdk-js";
|
|
702
|
-
import { globalRegistry as globalRegistry12, z as
|
|
703
|
-
|
|
704
|
-
// src/validation/lib/isLocalhost.ts
|
|
705
|
-
var isLocalhost = (hostname) => {
|
|
706
|
-
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost");
|
|
707
|
-
};
|
|
708
|
-
|
|
709
|
-
// src/validation/lib/getUrl.ts
|
|
710
|
-
var getUrl = (host, port) => {
|
|
711
|
-
const scheme = isLocalhost(host) ? "http" : "https";
|
|
712
|
-
return `${scheme}://${host}:${port}`;
|
|
713
|
-
};
|
|
714
|
-
|
|
715
|
-
// src/validation/schema/Address.ts
|
|
716
|
-
var TODO = true;
|
|
717
|
-
|
|
718
|
-
// src/validation/schema/Mnemonic.ts
|
|
719
|
-
import { z as z2 } from "zod";
|
|
720
|
-
var MnemonicStringZod = z2.string().transform((s) => s.trim().replaceAll(/\s+/g, " ")).refine(
|
|
721
|
-
(s) => [12, 15, 18, 21, 24].includes(s.split(" ").length),
|
|
722
|
-
{ message: "Mnemonic must contain 12, 15, 18, 21, or 24 words." }
|
|
723
|
-
).describe("BIP-39 mnemonic string");
|
|
702
|
+
import { globalRegistry as globalRegistry12, z as z17 } from "zod";
|
|
724
703
|
|
|
725
704
|
// src/config/Base.ts
|
|
726
|
-
import { z as
|
|
705
|
+
import { z as z16 } from "zod";
|
|
727
706
|
|
|
728
707
|
// src/config/Chain.ts
|
|
729
708
|
import { AddressZod, HexZod } from "@xylabs/sdk-js";
|
|
730
|
-
import { globalRegistry, z as
|
|
731
|
-
var ChainConfigZod =
|
|
709
|
+
import { globalRegistry, z as z2 } from "zod";
|
|
710
|
+
var ChainConfigZod = z2.object({
|
|
732
711
|
id: HexZod.optional().register(globalRegistry, {
|
|
733
712
|
description: "The unique identifier for the chain. Should be the staking contract address for contract-backed chains.",
|
|
734
713
|
title: "chain.id",
|
|
@@ -742,15 +721,15 @@ var ChainConfigZod = z3.object({
|
|
|
742
721
|
});
|
|
743
722
|
|
|
744
723
|
// src/config/DataLake/DataLake.ts
|
|
745
|
-
import { z as
|
|
724
|
+
import { z as z6 } from "zod";
|
|
746
725
|
|
|
747
726
|
// src/config/DataLake/RestDataLakeConfig.ts
|
|
748
|
-
import { globalRegistry as globalRegistry3, z as
|
|
727
|
+
import { globalRegistry as globalRegistry3, z as z4 } from "zod";
|
|
749
728
|
|
|
750
729
|
// src/config/DataLake/DataLakeRemoteConfig.ts
|
|
751
|
-
import { globalRegistry as globalRegistry2, z as
|
|
752
|
-
var DataLakeDriverConfigBaseZod =
|
|
753
|
-
driver:
|
|
730
|
+
import { globalRegistry as globalRegistry2, z as z3 } from "zod";
|
|
731
|
+
var DataLakeDriverConfigBaseZod = z3.object({
|
|
732
|
+
driver: z3.string().register(globalRegistry2, {
|
|
754
733
|
description: "Driver for the data lake",
|
|
755
734
|
type: "string"
|
|
756
735
|
})
|
|
@@ -758,55 +737,55 @@ var DataLakeDriverConfigBaseZod = z4.object({
|
|
|
758
737
|
|
|
759
738
|
// src/config/DataLake/RestDataLakeConfig.ts
|
|
760
739
|
var RestDataLakeConfigZod = DataLakeDriverConfigBaseZod.extend({
|
|
761
|
-
driver:
|
|
740
|
+
driver: z4.literal("rest").register(globalRegistry3, {
|
|
762
741
|
description: "Driver for the REST data lake",
|
|
763
742
|
type: "string"
|
|
764
743
|
}),
|
|
765
|
-
url:
|
|
744
|
+
url: z4.string().register(globalRegistry3, {
|
|
766
745
|
description: "URL for the REST data lake",
|
|
767
746
|
type: "string"
|
|
768
747
|
})
|
|
769
748
|
}).describe("Configuration for the REST data lake driver");
|
|
770
749
|
|
|
771
750
|
// src/config/DataLake/RouterDataLakeConfig.ts
|
|
772
|
-
import { globalRegistry as globalRegistry4, z as
|
|
773
|
-
var RouterDataLakeConfigZod =
|
|
774
|
-
driver:
|
|
751
|
+
import { globalRegistry as globalRegistry4, z as z5 } from "zod";
|
|
752
|
+
var RouterDataLakeConfigZod = z5.object({
|
|
753
|
+
driver: z5.literal("router").register(globalRegistry4, {
|
|
775
754
|
description: "Driver for the router data lake",
|
|
776
755
|
type: "string"
|
|
777
756
|
}),
|
|
778
|
-
children:
|
|
757
|
+
children: z5.array(z5.lazy(() => DataLakeConfigZod)).register(globalRegistry4, {
|
|
779
758
|
description: "Child data lake drivers",
|
|
780
759
|
type: "array"
|
|
781
760
|
})
|
|
782
761
|
}).describe("Configuration for the router data lake driver");
|
|
783
762
|
|
|
784
763
|
// src/config/DataLake/DataLake.ts
|
|
785
|
-
var DataLakeConfigZod =
|
|
764
|
+
var DataLakeConfigZod = z6.lazy(() => z6.union([RestDataLakeConfigZod, RouterDataLakeConfigZod])).describe("Configuration for a data lake");
|
|
786
765
|
|
|
787
766
|
// src/config/Evm.ts
|
|
788
|
-
import { globalRegistry as globalRegistry5, z as
|
|
789
|
-
var EvmInfuraConfigZod =
|
|
790
|
-
projectId:
|
|
767
|
+
import { globalRegistry as globalRegistry5, z as z7 } from "zod";
|
|
768
|
+
var EvmInfuraConfigZod = z7.object({
|
|
769
|
+
projectId: z7.string().optional().register(globalRegistry5, {
|
|
791
770
|
description: "Infura project ID",
|
|
792
771
|
title: "evm.infura.projectId",
|
|
793
772
|
type: "string"
|
|
794
773
|
}),
|
|
795
|
-
projectSecret:
|
|
774
|
+
projectSecret: z7.string().optional().register(globalRegistry5, {
|
|
796
775
|
description: "Infura project secret",
|
|
797
776
|
title: "evm.infura.projectSecret",
|
|
798
777
|
type: "string"
|
|
799
778
|
})
|
|
800
779
|
});
|
|
801
|
-
var EvmJsonRpcConfigZod =
|
|
802
|
-
url:
|
|
780
|
+
var EvmJsonRpcConfigZod = z7.object({
|
|
781
|
+
url: z7.url().optional().register(globalRegistry5, {
|
|
803
782
|
description: "JSON-RPC URL",
|
|
804
783
|
title: "evm.jsonRpc.url",
|
|
805
784
|
type: "string"
|
|
806
785
|
})
|
|
807
786
|
});
|
|
808
|
-
var EvmConfigZod =
|
|
809
|
-
chainId:
|
|
787
|
+
var EvmConfigZod = z7.object({
|
|
788
|
+
chainId: z7.string().optional().register(globalRegistry5, {
|
|
810
789
|
description: "EVM chain ID",
|
|
811
790
|
title: "evm.chainId",
|
|
812
791
|
type: "string"
|
|
@@ -817,17 +796,17 @@ var EvmConfigZod = z8.object({
|
|
|
817
796
|
|
|
818
797
|
// src/config/Log.ts
|
|
819
798
|
import { LogLevel } from "@xylabs/sdk-js";
|
|
820
|
-
import { globalRegistry as globalRegistry6, z as
|
|
799
|
+
import { globalRegistry as globalRegistry6, z as z8 } from "zod";
|
|
821
800
|
var LogLevelNames = Object.keys(LogLevel);
|
|
822
|
-
var LogConfigZod =
|
|
823
|
-
logLevel:
|
|
801
|
+
var LogConfigZod = z8.object({
|
|
802
|
+
logLevel: z8.enum(LogLevelNames).default("info").register(globalRegistry6, {
|
|
824
803
|
choices: LogLevelNames,
|
|
825
804
|
default: "info",
|
|
826
805
|
description: "Desired process verbosity",
|
|
827
806
|
title: "logLevel",
|
|
828
807
|
type: "string"
|
|
829
808
|
}),
|
|
830
|
-
silent:
|
|
809
|
+
silent: z8.boolean().default(false).register(globalRegistry6, {
|
|
831
810
|
default: false,
|
|
832
811
|
description: "Whether to run in silent mode",
|
|
833
812
|
title: "silent",
|
|
@@ -836,7 +815,7 @@ var LogConfigZod = z9.object({
|
|
|
836
815
|
});
|
|
837
816
|
|
|
838
817
|
// src/config/Providers.ts
|
|
839
|
-
import
|
|
818
|
+
import z10 from "zod";
|
|
840
819
|
|
|
841
820
|
// src/config/Provider.ts
|
|
842
821
|
import {
|
|
@@ -844,83 +823,83 @@ import {
|
|
|
844
823
|
zodIsFactory,
|
|
845
824
|
zodToFactory
|
|
846
825
|
} from "@xylabs/sdk-js";
|
|
847
|
-
import { z as
|
|
848
|
-
var ProviderConfigZod =
|
|
849
|
-
moniker:
|
|
850
|
-
labels:
|
|
826
|
+
import { z as z9 } from "zod";
|
|
827
|
+
var ProviderConfigZod = z9.object({
|
|
828
|
+
moniker: z9.string(),
|
|
829
|
+
labels: z9.array(z9.string()).optional()
|
|
851
830
|
}).describe("Configuration for a Provider");
|
|
852
831
|
var isProviderConfig = zodIsFactory(ProviderConfigZod);
|
|
853
832
|
var asProviderConfig = zodAsFactory(ProviderConfigZod, "asProviderConfig");
|
|
854
833
|
var toProviderConfig = zodToFactory(ProviderConfigZod, "toProviderConfig");
|
|
855
834
|
|
|
856
835
|
// src/config/Providers.ts
|
|
857
|
-
var ProvidersConfigZod =
|
|
836
|
+
var ProvidersConfigZod = z10.array(ProviderConfigZod.loose()).describe("Configuration for providers").default([]);
|
|
858
837
|
|
|
859
838
|
// src/config/Remote.ts
|
|
860
|
-
import { globalRegistry as globalRegistry7, z as
|
|
861
|
-
var RpcRemoteConfigBaseZod =
|
|
862
|
-
protocol:
|
|
839
|
+
import { globalRegistry as globalRegistry7, z as z11 } from "zod";
|
|
840
|
+
var RpcRemoteConfigBaseZod = z11.object({
|
|
841
|
+
protocol: z11.string("http").register(globalRegistry7, {
|
|
863
842
|
description: "Protocol for the RPC connection",
|
|
864
843
|
type: "string"
|
|
865
844
|
})
|
|
866
845
|
}).describe("Base configuration for the remote RPC");
|
|
867
846
|
var HttpRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
868
|
-
protocol:
|
|
847
|
+
protocol: z11.string("http").register(globalRegistry7, {
|
|
869
848
|
description: "Protocol for the RPC connection",
|
|
870
849
|
type: "string"
|
|
871
850
|
}).default("http"),
|
|
872
|
-
url:
|
|
851
|
+
url: z11.string().register(globalRegistry7, {
|
|
873
852
|
description: "URL for the Chain RPC API",
|
|
874
853
|
type: "string"
|
|
875
854
|
})
|
|
876
855
|
}).describe("Configuration for the remote RPC using Http");
|
|
877
856
|
var PostMessageRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
878
|
-
protocol:
|
|
857
|
+
protocol: z11.string().register(globalRegistry7, {
|
|
879
858
|
description: "Protocol for the RPC connection",
|
|
880
859
|
type: "string"
|
|
881
860
|
}).default("postMessage"),
|
|
882
|
-
networkId:
|
|
861
|
+
networkId: z11.string().register(globalRegistry7, {
|
|
883
862
|
description: "Network ID to use for the postMessage RPC connection",
|
|
884
863
|
type: "string"
|
|
885
864
|
}),
|
|
886
|
-
sessionId:
|
|
865
|
+
sessionId: z11.string().register(globalRegistry7, {
|
|
887
866
|
description: "Session ID to use for the postMessage RPC connection",
|
|
888
867
|
type: "string"
|
|
889
868
|
})
|
|
890
869
|
}).describe("Configuration for the remote RPC using postMessage");
|
|
891
|
-
var RpcRemoteConfigZod =
|
|
892
|
-
var RemoteConfigZod =
|
|
870
|
+
var RpcRemoteConfigZod = z11.union([HttpRpcRemoteConfigZod, PostMessageRpcRemoteConfigZod]).describe("Configuration for a remote RPC connection, either Http or postMessage");
|
|
871
|
+
var RemoteConfigZod = z11.object({ rpc: RpcRemoteConfigZod.optional() }).describe("Configuration for remote connections, including RPC");
|
|
893
872
|
|
|
894
873
|
// src/config/storage/driver/Mongo.ts
|
|
895
874
|
import { isDefined as isDefined4, isUndefined as isUndefined2 } from "@xylabs/sdk-js";
|
|
896
|
-
import { globalRegistry as globalRegistry8, z as
|
|
875
|
+
import { globalRegistry as globalRegistry8, z as z12 } from "zod";
|
|
897
876
|
var hasMongoConfig = (config) => {
|
|
898
877
|
if (isUndefined2(config)) return false;
|
|
899
878
|
return isDefined4(config.connectionString) && isDefined4(config.database) && isDefined4(config.domain) && isDefined4(config.password) && isDefined4(config.username);
|
|
900
879
|
};
|
|
901
|
-
var MongoConfigZod =
|
|
880
|
+
var MongoConfigZod = z12.object({
|
|
902
881
|
// TODO: Create from other arguments
|
|
903
|
-
connectionString:
|
|
882
|
+
connectionString: z12.string().nonempty().optional().register(globalRegistry8, {
|
|
904
883
|
description: "MongoDB connection string",
|
|
905
884
|
title: "storage.mongo.connectionString",
|
|
906
885
|
type: "string"
|
|
907
886
|
}),
|
|
908
|
-
database:
|
|
887
|
+
database: z12.string().nonempty().optional().register(globalRegistry8, {
|
|
909
888
|
description: "MongoDB database name",
|
|
910
889
|
title: "storage.mongo.database",
|
|
911
890
|
type: "string"
|
|
912
891
|
}),
|
|
913
|
-
domain:
|
|
892
|
+
domain: z12.string().nonempty().optional().register(globalRegistry8, {
|
|
914
893
|
description: "MongoDB domain",
|
|
915
894
|
title: "storage.mongo.domain",
|
|
916
895
|
type: "string"
|
|
917
896
|
}),
|
|
918
|
-
password:
|
|
897
|
+
password: z12.string().nonempty().optional().register(globalRegistry8, {
|
|
919
898
|
description: "MongoDB password",
|
|
920
899
|
title: "storage.mongo.password",
|
|
921
900
|
type: "string"
|
|
922
901
|
}),
|
|
923
|
-
username:
|
|
902
|
+
username: z12.string().nonempty().optional().register(globalRegistry8, {
|
|
924
903
|
description: "MongoDB username",
|
|
925
904
|
title: "storage.mongo.username",
|
|
926
905
|
type: "string"
|
|
@@ -928,10 +907,10 @@ var MongoConfigZod = z13.object({
|
|
|
928
907
|
});
|
|
929
908
|
|
|
930
909
|
// src/config/storage/Storage.ts
|
|
931
|
-
import { globalRegistry as globalRegistry9, z as
|
|
932
|
-
var StorageConfigZod =
|
|
910
|
+
import { globalRegistry as globalRegistry9, z as z13 } from "zod";
|
|
911
|
+
var StorageConfigZod = z13.object({
|
|
933
912
|
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
934
|
-
root:
|
|
913
|
+
root: z13.string().optional().register(globalRegistry9, {
|
|
935
914
|
description: "Root directory for local storage",
|
|
936
915
|
title: "storage.root",
|
|
937
916
|
type: "string"
|
|
@@ -939,7 +918,7 @@ var StorageConfigZod = z14.object({
|
|
|
939
918
|
}).describe("Storage configuration options");
|
|
940
919
|
|
|
941
920
|
// src/config/Telemetry.ts
|
|
942
|
-
import { globalRegistry as globalRegistry10, z as
|
|
921
|
+
import { globalRegistry as globalRegistry10, z as z14 } from "zod";
|
|
943
922
|
var DefaultMetricsScrapePorts = {
|
|
944
923
|
api: 9465,
|
|
945
924
|
bridge: 9468,
|
|
@@ -947,29 +926,29 @@ var DefaultMetricsScrapePorts = {
|
|
|
947
926
|
producer: 9464,
|
|
948
927
|
rewardRedemptionApi: 9467
|
|
949
928
|
};
|
|
950
|
-
var MetricsScrapeConfigZod =
|
|
951
|
-
path:
|
|
929
|
+
var MetricsScrapeConfigZod = z14.object({
|
|
930
|
+
path: z14.string().default("/metrics").register(globalRegistry10, {
|
|
952
931
|
default: "/metrics",
|
|
953
932
|
description: "Path for the metrics scrape endpoint",
|
|
954
933
|
title: "telemetry.metrics.scrape.path",
|
|
955
934
|
type: "string"
|
|
956
935
|
}),
|
|
957
|
-
port:
|
|
936
|
+
port: z14.coerce.number().int().positive().optional().register(globalRegistry10, {
|
|
958
937
|
description: "Port for the metrics scrape endpoint",
|
|
959
938
|
title: "telemetry.metrics.scrape.port",
|
|
960
939
|
type: "number"
|
|
961
940
|
})
|
|
962
941
|
}).describe("Metrics scrape configuration");
|
|
963
|
-
var MetricsConfigZod =
|
|
964
|
-
var OpenTelemetryConfigZod =
|
|
942
|
+
var MetricsConfigZod = z14.object({ scrape: MetricsScrapeConfigZod }).describe("Metrics configuration options");
|
|
943
|
+
var OpenTelemetryConfigZod = z14.object({
|
|
965
944
|
// OpenTelemetry options
|
|
966
|
-
otlpEndpoint:
|
|
945
|
+
otlpEndpoint: z14.url().optional().register(globalRegistry10, {
|
|
967
946
|
description: "OTLP endpoint for exporting telemetry data",
|
|
968
947
|
title: "telemetry.otel.otlpEndpoint",
|
|
969
948
|
type: "string"
|
|
970
949
|
})
|
|
971
950
|
});
|
|
972
|
-
var TelemetryConfigZod =
|
|
951
|
+
var TelemetryConfigZod = z14.object({
|
|
973
952
|
// Metrics configuration
|
|
974
953
|
metrics: MetricsConfigZod.optional().describe("Metrics configuration"),
|
|
975
954
|
// OpenTelemetry configuration
|
|
@@ -978,7 +957,7 @@ var TelemetryConfigZod = z15.object({
|
|
|
978
957
|
|
|
979
958
|
// src/config/Validation.ts
|
|
980
959
|
import { AddressZod as AddressZod2, asAddress } from "@xylabs/sdk-js";
|
|
981
|
-
import { globalRegistry as globalRegistry11, z as
|
|
960
|
+
import { globalRegistry as globalRegistry11, z as z15 } from "zod";
|
|
982
961
|
|
|
983
962
|
// src/primitives/block/range/blockRangeSteps.ts
|
|
984
963
|
import { asXL1BlockNumber as asXL1BlockNumber2, StepSizes as StepSizes3 } from "@xyo-network/xl1-protocol-lib";
|
|
@@ -1911,34 +1890,34 @@ function findUncles(context, finalizedWindowedChain, blocks) {
|
|
|
1911
1890
|
}
|
|
1912
1891
|
|
|
1913
1892
|
// src/config/Validation.ts
|
|
1914
|
-
var ValidationConfigZod =
|
|
1915
|
-
allowedRewardRedeemers:
|
|
1893
|
+
var ValidationConfigZod = z15.object({
|
|
1894
|
+
allowedRewardRedeemers: z15.preprocess((val) => {
|
|
1916
1895
|
if (typeof val === "string") {
|
|
1917
1896
|
return val.split(",").map((s) => asAddress(s.trim()));
|
|
1918
1897
|
}
|
|
1919
1898
|
return val;
|
|
1920
|
-
},
|
|
1899
|
+
}, z15.array(AddressZod2).optional().register(globalRegistry11, {
|
|
1921
1900
|
description: "List of allowed reward redeemer addresses, if undefined anyone can participate",
|
|
1922
1901
|
title: "allowedRewardRedeemers",
|
|
1923
1902
|
type: "array"
|
|
1924
1903
|
})),
|
|
1925
|
-
allowedRewardEscrowAccountSigners:
|
|
1904
|
+
allowedRewardEscrowAccountSigners: z15.preprocess((val) => {
|
|
1926
1905
|
if (typeof val === "string") {
|
|
1927
1906
|
return val.split(",").map((s) => asAddress(s.trim()));
|
|
1928
1907
|
}
|
|
1929
1908
|
return val;
|
|
1930
|
-
},
|
|
1909
|
+
}, z15.array(AddressZod2).optional().register(globalRegistry11, {
|
|
1931
1910
|
description: "List of allowed reward escrow account signer addresses, if undefined anyone can participate",
|
|
1932
1911
|
title: "allowedRewardEscrowAccountSigners",
|
|
1933
1912
|
type: "array"
|
|
1934
1913
|
})),
|
|
1935
|
-
minCandidates:
|
|
1914
|
+
minCandidates: z15.coerce.number().default(DEFAULT_MIN_CANDIDATES).register(globalRegistry11, {
|
|
1936
1915
|
default: DEFAULT_MIN_CANDIDATES,
|
|
1937
1916
|
description: "Minimum number of uncle candidates before selecting the best uncle",
|
|
1938
1917
|
title: "validation.minCandidates",
|
|
1939
1918
|
type: "number"
|
|
1940
1919
|
}),
|
|
1941
|
-
backoffMs:
|
|
1920
|
+
backoffMs: z15.coerce.number().default(DEFAULT_BACKOFF_MS).register(globalRegistry11, {
|
|
1942
1921
|
default: DEFAULT_BACKOFF_MS,
|
|
1943
1922
|
description: "Back-off timeout in ms. If head age exceeds this, minCandidates is ignored",
|
|
1944
1923
|
title: "validation.backoffMs",
|
|
@@ -1947,7 +1926,7 @@ var ValidationConfigZod = z16.object({
|
|
|
1947
1926
|
});
|
|
1948
1927
|
|
|
1949
1928
|
// src/config/Base.ts
|
|
1950
|
-
var BaseConfigZod =
|
|
1929
|
+
var BaseConfigZod = z16.object({
|
|
1951
1930
|
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
1952
1931
|
dataLake: DataLakeConfigZod.optional().describe("Configuration for data lakes"),
|
|
1953
1932
|
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
@@ -1960,14 +1939,18 @@ var BaseConfigZod = z17.object({
|
|
|
1960
1939
|
});
|
|
1961
1940
|
|
|
1962
1941
|
// src/config/Actor.ts
|
|
1942
|
+
var AccountPathZod = z17.string().regex(
|
|
1943
|
+
/^(m(\/\d+'?)+|\d+'?(\/\d+'?)*)$/,
|
|
1944
|
+
`Invalid BIP-32 derivation path. Use either an absolute path like "m/44'/60'/0'/0/0" or a relative path like "0", "0/1", or "44'/60'/0'/0/0".`
|
|
1945
|
+
);
|
|
1963
1946
|
var ActorConfigZod = BaseConfigZod.extend({
|
|
1964
|
-
name:
|
|
1965
|
-
|
|
1966
|
-
description:
|
|
1967
|
-
title: "
|
|
1947
|
+
name: z17.string(),
|
|
1948
|
+
accountPath: AccountPathZod.optional().register(globalRegistry12, {
|
|
1949
|
+
description: 'BIP-32 derivation path for the actor wallet. Absolute when it starts with "m/"; otherwise relative to the root wallet base path. Each actor must derive to a distinct path.',
|
|
1950
|
+
title: "accountPath",
|
|
1968
1951
|
type: "string"
|
|
1969
1952
|
}),
|
|
1970
|
-
healthCheckPort:
|
|
1953
|
+
healthCheckPort: z17.coerce.number().optional().register(globalRegistry12, {
|
|
1971
1954
|
description: "Port for the Producer health checks",
|
|
1972
1955
|
title: "producer.healthCheckPort",
|
|
1973
1956
|
type: "number"
|
|
@@ -1978,8 +1961,8 @@ var asActorConfig = zodAsFactory2(ActorConfigZod, "asActorConfig");
|
|
|
1978
1961
|
var toActorConfig = zodToFactory2(ActorConfigZod, "toActorConfig");
|
|
1979
1962
|
|
|
1980
1963
|
// src/config/Actors.ts
|
|
1981
|
-
import
|
|
1982
|
-
var ActorsConfigZod =
|
|
1964
|
+
import z18 from "zod";
|
|
1965
|
+
var ActorsConfigZod = z18.array(ActorConfigZod.loose()).describe("Actor-specific configurations that override the base configuration when the actor is running").default([]);
|
|
1983
1966
|
|
|
1984
1967
|
// src/config/Config.ts
|
|
1985
1968
|
var ConfigZod = BaseConfigZod.extend({ actors: ActorsConfigZod }).describe("The complete configuration for the protocol, including global settings and actor-specific overrides");
|
|
@@ -1998,15 +1981,15 @@ import {
|
|
|
1998
1981
|
zodIsFactory as zodIsFactory3,
|
|
1999
1982
|
zodToFactory as zodToFactory3
|
|
2000
1983
|
} from "@xylabs/sdk-js";
|
|
2001
|
-
import { globalRegistry as globalRegistry13, z as
|
|
1984
|
+
import { globalRegistry as globalRegistry13, z as z19 } from "zod";
|
|
2002
1985
|
var HostActorConfigZod = ActorConfigZod.extend({
|
|
2003
|
-
host:
|
|
1986
|
+
host: z19.string().default("localhost").register(globalRegistry13, {
|
|
2004
1987
|
default: "localhost",
|
|
2005
1988
|
description: "Host for the Actor",
|
|
2006
1989
|
title: "host",
|
|
2007
1990
|
type: "string"
|
|
2008
1991
|
}),
|
|
2009
|
-
port:
|
|
1992
|
+
port: z19.coerce.number().default(8080).register(globalRegistry13, {
|
|
2010
1993
|
default: 8080,
|
|
2011
1994
|
description: "Port for the Actor",
|
|
2012
1995
|
title: "port",
|
|
@@ -2018,30 +2001,30 @@ var asHostActorConfig = zodAsFactory3(HostActorConfigZod, "asHostActorConfig");
|
|
|
2018
2001
|
var toHostActorConfig = zodToFactory3(HostActorConfigZod, "toHostActorConfig");
|
|
2019
2002
|
|
|
2020
2003
|
// src/config/UsageMeta.ts
|
|
2021
|
-
import { z as
|
|
2022
|
-
var DescriptionSchema =
|
|
2023
|
-
var TitleSchema =
|
|
2024
|
-
var JSONSchemaMetaSchema =
|
|
2025
|
-
id:
|
|
2004
|
+
import { z as z20 } from "zod";
|
|
2005
|
+
var DescriptionSchema = z20.string();
|
|
2006
|
+
var TitleSchema = z20.string();
|
|
2007
|
+
var JSONSchemaMetaSchema = z20.object({
|
|
2008
|
+
id: z20.string().optional(),
|
|
2026
2009
|
title: TitleSchema.optional(),
|
|
2027
2010
|
description: DescriptionSchema.optional(),
|
|
2028
|
-
deprecated:
|
|
2029
|
-
}).catchall(
|
|
2011
|
+
deprecated: z20.boolean().optional()
|
|
2012
|
+
}).catchall(z20.unknown());
|
|
2030
2013
|
var GlobalMetaSchema = JSONSchemaMetaSchema.extend({});
|
|
2031
|
-
var ChoicesSchema =
|
|
2014
|
+
var ChoicesSchema = z20.array(z20.union([z20.string(), z20.number(), z20.literal(true), z20.undefined()])).readonly();
|
|
2032
2015
|
var UsageMetaSchema = GlobalMetaSchema.extend({
|
|
2033
2016
|
choices: ChoicesSchema.optional(),
|
|
2034
|
-
default:
|
|
2017
|
+
default: z20.unknown().optional(),
|
|
2035
2018
|
description: DescriptionSchema,
|
|
2036
|
-
group:
|
|
2037
|
-
hidden:
|
|
2019
|
+
group: z20.string().optional(),
|
|
2020
|
+
hidden: z20.boolean().optional(),
|
|
2038
2021
|
title: TitleSchema,
|
|
2039
|
-
type:
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2022
|
+
type: z20.union([
|
|
2023
|
+
z20.literal("array"),
|
|
2024
|
+
z20.literal("count"),
|
|
2025
|
+
z20.literal("boolean"),
|
|
2026
|
+
z20.literal("number"),
|
|
2027
|
+
z20.literal("string")
|
|
2045
2028
|
])
|
|
2046
2029
|
});
|
|
2047
2030
|
function isUsageMeta(v) {
|
|
@@ -2062,15 +2045,15 @@ import {
|
|
|
2062
2045
|
zodToFactory as zodToFactory4
|
|
2063
2046
|
} from "@xylabs/sdk-js";
|
|
2064
2047
|
import { CachingContextZod } from "@xyo-network/xl1-protocol-lib";
|
|
2065
|
-
import { z as
|
|
2066
|
-
var RuntimeStatusMonitorZod =
|
|
2067
|
-
var ProviderFactoryLocatorZod =
|
|
2048
|
+
import { z as z21 } from "zod";
|
|
2049
|
+
var RuntimeStatusMonitorZod = z21.custom((val) => val && typeof val === "object");
|
|
2050
|
+
var ProviderFactoryLocatorZod = z21.lazy(() => z21.custom((val) => val && typeof val === "object" && "context" in val && "registry" in val));
|
|
2068
2051
|
var BaseConfigContextZod = CachingContextZod.extend({
|
|
2069
2052
|
config: BaseConfigZod.loose(),
|
|
2070
2053
|
locator: ProviderFactoryLocatorZod.optional()
|
|
2071
2054
|
});
|
|
2072
|
-
var CreatableProviderContextZod =
|
|
2073
|
-
_id:
|
|
2055
|
+
var CreatableProviderContextZod = z21.lazy(() => BaseConfigContextZod.extend({
|
|
2056
|
+
_id: z21.string().optional(),
|
|
2074
2057
|
locator: ProviderFactoryLocatorZod,
|
|
2075
2058
|
statusReporter: RuntimeStatusMonitorZod.optional()
|
|
2076
2059
|
}));
|
|
@@ -2942,26 +2925,26 @@ import {
|
|
|
2942
2925
|
asSchema as asSchema2,
|
|
2943
2926
|
isPayloadOfZodType
|
|
2944
2927
|
} from "@xyo-network/sdk-js";
|
|
2945
|
-
import { z as
|
|
2928
|
+
import { z as z23 } from "zod";
|
|
2946
2929
|
|
|
2947
2930
|
// src/eip-712/Types.ts
|
|
2948
|
-
import { z as
|
|
2949
|
-
var TypedDataDomainZod =
|
|
2950
|
-
name:
|
|
2951
|
-
version:
|
|
2952
|
-
chainId:
|
|
2953
|
-
verifyingContract:
|
|
2954
|
-
salt:
|
|
2931
|
+
import { z as z22 } from "zod";
|
|
2932
|
+
var TypedDataDomainZod = z22.object({
|
|
2933
|
+
name: z22.string().nullable().optional(),
|
|
2934
|
+
version: z22.string().nullable().optional(),
|
|
2935
|
+
chainId: z22.union([z22.string(), z22.number(), z22.bigint()]).nullable().optional(),
|
|
2936
|
+
verifyingContract: z22.string().nullable().optional(),
|
|
2937
|
+
salt: z22.union([z22.string(), z22.instanceof(Uint8Array)]).nullable().optional()
|
|
2955
2938
|
});
|
|
2956
|
-
var TypedDataFieldZod =
|
|
2957
|
-
name:
|
|
2958
|
-
type:
|
|
2939
|
+
var TypedDataFieldZod = z22.object({
|
|
2940
|
+
name: z22.string(),
|
|
2941
|
+
type: z22.string()
|
|
2959
2942
|
});
|
|
2960
|
-
var TypedDataTypesZod =
|
|
2961
|
-
var TypedDataValueZod =
|
|
2943
|
+
var TypedDataTypesZod = z22.record(z22.string(), z22.array(TypedDataFieldZod));
|
|
2944
|
+
var TypedDataValueZod = z22.record(z22.string(), z22.any());
|
|
2962
2945
|
|
|
2963
2946
|
// src/eip-712/Payloads/EIP712Data.ts
|
|
2964
|
-
var EIP712DataPayloadFieldsZod =
|
|
2947
|
+
var EIP712DataPayloadFieldsZod = z23.object({
|
|
2965
2948
|
domain: TypedDataDomainZod,
|
|
2966
2949
|
types: TypedDataTypesZod,
|
|
2967
2950
|
values: TypedDataValueZod
|
|
@@ -2979,11 +2962,11 @@ import {
|
|
|
2979
2962
|
asSchema as asSchema3,
|
|
2980
2963
|
isPayloadOfZodType as isPayloadOfZodType2
|
|
2981
2964
|
} from "@xyo-network/sdk-js";
|
|
2982
|
-
import { z as
|
|
2983
|
-
var EIP712SignaturePayloadFieldsZod =
|
|
2984
|
-
address:
|
|
2965
|
+
import { z as z24 } from "zod";
|
|
2966
|
+
var EIP712SignaturePayloadFieldsZod = z24.object({
|
|
2967
|
+
address: z24.string(),
|
|
2985
2968
|
hash: HashZod,
|
|
2986
|
-
signature:
|
|
2969
|
+
signature: z24.string()
|
|
2987
2970
|
});
|
|
2988
2971
|
var EIP712SignaturePayloadSchema = asSchema3("network.xyo.chains.ethereum.eip712.signature", true);
|
|
2989
2972
|
var isEIP712SignaturePayload = isPayloadOfZodType2(
|
|
@@ -3722,12 +3705,12 @@ var HydratedCache = class {
|
|
|
3722
3705
|
};
|
|
3723
3706
|
|
|
3724
3707
|
// src/utils/isZodError.ts
|
|
3725
|
-
import { z as
|
|
3708
|
+
import { z as z25 } from "zod";
|
|
3726
3709
|
var isZodError = (error) => {
|
|
3727
|
-
return error instanceof
|
|
3710
|
+
return error instanceof z25.ZodError;
|
|
3728
3711
|
};
|
|
3729
3712
|
var prettifyZodError = (error) => {
|
|
3730
|
-
return
|
|
3713
|
+
return z25.prettifyError(error);
|
|
3731
3714
|
};
|
|
3732
3715
|
|
|
3733
3716
|
// src/simple/block/SimpleBlockViewer.ts
|
|
@@ -4181,7 +4164,7 @@ import { isAnyPayload as isAnyPayload6, PayloadZodLoose } from "@xyo-network/sdk
|
|
|
4181
4164
|
import {
|
|
4182
4165
|
DataLakeRunnerMoniker
|
|
4183
4166
|
} from "@xyo-network/xl1-protocol-lib";
|
|
4184
|
-
import
|
|
4167
|
+
import z26 from "zod";
|
|
4185
4168
|
|
|
4186
4169
|
// src/simple/datalake/AbstractRestDataLake.ts
|
|
4187
4170
|
import { axiosJsonConfig } from "@xylabs/sdk-js";
|
|
@@ -4248,7 +4231,7 @@ var RestDataLakeRunner = class extends AbstractRestDataLake {
|
|
|
4248
4231
|
}).filter(exists6);
|
|
4249
4232
|
if (allowedItems.length > 0) {
|
|
4250
4233
|
const result = await this.axios.post(`${this.params.endpoint}/insert`, allowedItems);
|
|
4251
|
-
return
|
|
4234
|
+
return z26.array(PayloadZodLoose).parse(result.data);
|
|
4252
4235
|
} else {
|
|
4253
4236
|
return [];
|
|
4254
4237
|
}
|
|
@@ -6199,6 +6182,27 @@ async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
|
6199
6182
|
return assertEx47(timePayload.ethereum, () => "No ethereum timestamp found on block");
|
|
6200
6183
|
}
|
|
6201
6184
|
|
|
6185
|
+
// src/validation/lib/isLocalhost.ts
|
|
6186
|
+
var isLocalhost = (hostname) => {
|
|
6187
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost");
|
|
6188
|
+
};
|
|
6189
|
+
|
|
6190
|
+
// src/validation/lib/getUrl.ts
|
|
6191
|
+
var getUrl = (host, port) => {
|
|
6192
|
+
const scheme = isLocalhost(host) ? "http" : "https";
|
|
6193
|
+
return `${scheme}://${host}:${port}`;
|
|
6194
|
+
};
|
|
6195
|
+
|
|
6196
|
+
// src/validation/schema/Address.ts
|
|
6197
|
+
var TODO = true;
|
|
6198
|
+
|
|
6199
|
+
// src/validation/schema/Mnemonic.ts
|
|
6200
|
+
import { z as z27 } from "zod";
|
|
6201
|
+
var MnemonicStringZod = z27.string().transform((s) => s.trim().replaceAll(/\s+/g, " ")).refine(
|
|
6202
|
+
(s) => [12, 15, 18, 21, 24].includes(s.split(" ").length),
|
|
6203
|
+
{ message: "Mnemonic must contain 12, 15, 18, 21, or 24 words." }
|
|
6204
|
+
).describe("BIP-39 mnemonic string");
|
|
6205
|
+
|
|
6202
6206
|
// src/wallet/generateXyoBaseWalletFromPhrase.ts
|
|
6203
6207
|
import { HDWallet } from "@xyo-network/sdk-js";
|
|
6204
6208
|
|
|
@@ -6219,6 +6223,7 @@ export {
|
|
|
6219
6223
|
ACCOUNT_TYPE,
|
|
6220
6224
|
ADDRESS_INDEX,
|
|
6221
6225
|
AbstractCreatableProvider,
|
|
6226
|
+
AccountPathZod,
|
|
6222
6227
|
Actor,
|
|
6223
6228
|
ActorConfigContext,
|
|
6224
6229
|
ActorConfigZod,
|