@prosopo/types 0.3.41 → 0.3.42

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.
@@ -31,7 +31,7 @@ const BatchCommitConfigSchema = z.object({
31
31
  const ProsopoBaseConfigSchema = z.object({
32
32
  logLevel: LogLevel.optional().default(LogLevel.enum.info),
33
33
  defaultEnvironment: EnvironmentTypesSchema.default(EnvironmentTypesSchema.Values.production),
34
- defaultNetwork: network.NetworkNamesSchema.default(network.NetworkNamesSchema.Values.rococo),
34
+ defaultNetwork: network.NetworkNamesSchema.default(network.NetworkNamesSchema.Values.astar),
35
35
  // The account with which to query the contract.merge sign transactions
36
36
  account: z.object({
37
37
  address: z.string().optional(),
@@ -39,9 +39,23 @@ const ProsopoBaseConfigSchema = z.object({
39
39
  password: z.string().optional()
40
40
  })
41
41
  });
42
+ const PolkadotSecretJSONSpec = z.object({
43
+ encoded: z.string(),
44
+ encoding: z.object({
45
+ content: z.array(z.string()),
46
+ type: z.array(z.string()),
47
+ version: z.string()
48
+ }),
49
+ address: z.string(),
50
+ meta: z.object({
51
+ genesisHash: z.string(),
52
+ name: z.string(),
53
+ whenCreated: z.number()
54
+ })
55
+ });
42
56
  const ProsopoBasicConfigSchema = ProsopoBaseConfigSchema.merge(
43
57
  z.object({
44
- networks: network.ProsopoNetworksSchema.default(index),
58
+ networks: network.ProsopoNetworkSchema.default(index),
45
59
  database: DatabaseConfigSchema.optional(),
46
60
  devOnlyWatchEvents: z.boolean().optional()
47
61
  })
@@ -168,6 +182,7 @@ exports.DEFAULT_POW_CAPTCHA_VERIFIED_TIMEOUT = DEFAULT_POW_CAPTCHA_VERIFIED_TIME
168
182
  exports.DatabaseConfigSchema = DatabaseConfigSchema;
169
183
  exports.DatabaseTypes = DatabaseTypes;
170
184
  exports.EnvironmentTypesSchema = EnvironmentTypesSchema;
185
+ exports.PolkadotSecretJSONSpec = PolkadotSecretJSONSpec;
171
186
  exports.ProcaptchaConfigSchema = ProcaptchaConfigSchema;
172
187
  exports.ProsopoBaseConfigSchema = ProsopoBaseConfigSchema;
173
188
  exports.ProsopoBasicConfigSchema = ProsopoBasicConfigSchema;
@@ -16,6 +16,7 @@ exports.DEFAULT_POW_CAPTCHA_VERIFIED_TIMEOUT = config.DEFAULT_POW_CAPTCHA_VERIFI
16
16
  exports.DatabaseConfigSchema = config.DatabaseConfigSchema;
17
17
  exports.DatabaseTypes = config.DatabaseTypes;
18
18
  exports.EnvironmentTypesSchema = config.EnvironmentTypesSchema;
19
+ exports.PolkadotSecretJSONSpec = config.PolkadotSecretJSONSpec;
19
20
  exports.ProcaptchaConfigSchema = config.ProcaptchaConfigSchema;
20
21
  exports.ProsopoBaseConfigSchema = config.ProsopoBaseConfigSchema;
21
22
  exports.ProsopoBasicConfigSchema = config.ProsopoBasicConfigSchema;
@@ -28,4 +29,4 @@ exports.ProsopoServerConfigSchema = config.ProsopoServerConfigSchema;
28
29
  exports.NetworkConfigSchema = network.NetworkConfigSchema;
29
30
  exports.NetworkNamesSchema = network.NetworkNamesSchema;
30
31
  exports.NetworkPairTypeSchema = network.NetworkPairTypeSchema;
31
- exports.ProsopoNetworksSchema = network.ProsopoNetworksSchema;
32
+ exports.ProsopoNetworkSchema = network.ProsopoNetworkSchema;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const enumMap = require("./enumMap.cjs");
4
3
  const z = require("zod");
5
- const NetworkNamesSchema = z.enum(["development", "rococo", "shiden"]);
4
+ const enumMap = require("./enumMap.cjs");
5
+ const NetworkNamesSchema = z.enum(["development", "rococo", "shiden", "astar"]);
6
6
  const NetworkPairTypeSchema = z.union([
7
7
  z.literal("sr25519"),
8
8
  z.literal("ed25519"),
@@ -10,7 +10,7 @@ const NetworkPairTypeSchema = z.union([
10
10
  z.literal("ethereum")
11
11
  ]);
12
12
  const NetworkConfigSchema = z.object({
13
- endpoint: z.string().url(),
13
+ endpoint: z.array(z.string().url()),
14
14
  contract: z.object({
15
15
  address: z.string(),
16
16
  name: z.string()
@@ -18,7 +18,7 @@ const NetworkConfigSchema = z.object({
18
18
  pairType: NetworkPairTypeSchema,
19
19
  ss58Format: z.number().positive().default(42)
20
20
  });
21
- const ProsopoNetworksSchema = enumMap.enumMap(
21
+ const ProsopoNetworkSchema = enumMap.enumMap(
22
22
  NetworkNamesSchema,
23
23
  NetworkConfigSchema.required({
24
24
  endpoint: true,
@@ -29,4 +29,4 @@ const ProsopoNetworksSchema = enumMap.enumMap(
29
29
  exports.NetworkConfigSchema = NetworkConfigSchema;
30
30
  exports.NetworkNamesSchema = NetworkNamesSchema;
31
31
  exports.NetworkPairTypeSchema = NetworkPairTypeSchema;
32
- exports.ProsopoNetworksSchema = ProsopoNetworksSchema;
32
+ exports.ProsopoNetworkSchema = ProsopoNetworkSchema;
@@ -34,6 +34,7 @@ exports.DEFAULT_POW_CAPTCHA_VERIFIED_TIMEOUT = config.DEFAULT_POW_CAPTCHA_VERIFI
34
34
  exports.DatabaseConfigSchema = config.DatabaseConfigSchema;
35
35
  exports.DatabaseTypes = config.DatabaseTypes;
36
36
  exports.EnvironmentTypesSchema = config.EnvironmentTypesSchema;
37
+ exports.PolkadotSecretJSONSpec = config.PolkadotSecretJSONSpec;
37
38
  exports.ProcaptchaConfigSchema = config.ProcaptchaConfigSchema;
38
39
  exports.ProsopoBaseConfigSchema = config.ProsopoBaseConfigSchema;
39
40
  exports.ProsopoBasicConfigSchema = config.ProsopoBasicConfigSchema;
@@ -46,7 +47,7 @@ exports.ProsopoServerConfigSchema = config.ProsopoServerConfigSchema;
46
47
  exports.NetworkConfigSchema = network.NetworkConfigSchema;
47
48
  exports.NetworkNamesSchema = network.NetworkNamesSchema;
48
49
  exports.NetworkPairTypeSchema = network.NetworkPairTypeSchema;
49
- exports.ProsopoNetworksSchema = network.ProsopoNetworksSchema;
50
+ exports.ProsopoNetworkSchema = network.ProsopoNetworkSchema;
50
51
  exports.AbiCellSpec = artifacts.AbiCellSpec;
51
52
  exports.AbiDetailsSpec = artifacts.AbiDetailsSpec;
52
53
  exports.AbiEnumSpec = artifacts.AbiEnumSpec;
@@ -7,7 +7,7 @@ const getContractAddress = (defaultAddress) => {
7
7
  const networks = () => {
8
8
  return {
9
9
  [network.NetworkNamesSchema.Values.development]: {
10
- endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT || "ws://127.0.0.1:9944",
10
+ endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT ? [process.env.PROSOPO_SUBSTRATE_ENDPOINT] : ["ws://127.0.0.1:9944"],
11
11
  contract: {
12
12
  name: "captcha",
13
13
  address: getContractAddress("CONTRACT_NOT_DEPLOYED")
@@ -16,7 +16,7 @@ const networks = () => {
16
16
  ss58Format: 42
17
17
  },
18
18
  [network.NetworkNamesSchema.Values.rococo]: {
19
- endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT || "wss://rococo-contracts-rpc.polkadot.io:443",
19
+ endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT ? [process.env.PROSOPO_SUBSTRATE_ENDPOINT] : ["wss://rococo-contracts-rpc.polkadot.io:443"],
20
20
  contract: {
21
21
  name: "captcha",
22
22
  address: getContractAddress("5HiVWQhJrysNcFNEWf2crArKht16zrhro3FcekVWocyQjx5u")
@@ -25,13 +25,27 @@ const networks = () => {
25
25
  ss58Format: 42
26
26
  },
27
27
  [network.NetworkNamesSchema.Values.shiden]: {
28
- endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT || "wss://shiden.public.blastapi.io",
28
+ endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT ? [process.env.PROSOPO_SUBSTRATE_ENDPOINT] : ["wss://shiden.public.blastapi.io"],
29
29
  contract: {
30
30
  address: getContractAddress("XpRox5bNg6YV8BHafsuHQ3b8i7gSq3GKPeYLA1b8EZwrDb3"),
31
31
  name: "captcha"
32
32
  },
33
33
  pairType: pairTypeSr25519,
34
34
  ss58Format: 5
35
+ },
36
+ [network.NetworkNamesSchema.Values.astar]: {
37
+ endpoint: process.env.PROSOPO_SUBSTRATE_ENDPOINT ? [process.env.PROSOPO_SUBSTRATE_ENDPOINT] : [
38
+ "wss://rpc.astar.network",
39
+ "wss://1rpc.io/astr",
40
+ "wss://astar.public.blastapi.io",
41
+ "wss://astar.public.curie.radiumblock.co/ws"
42
+ ],
43
+ contract: {
44
+ address: getContractAddress("X2NLPj49L4UKWAzX8tS1LHTwioMHNyVurCsvTyUNYxcPuWA"),
45
+ name: "captcha"
46
+ },
47
+ pairType: pairTypeSr25519,
48
+ ss58Format: 5
35
49
  }
36
50
  };
37
51
  };