@maci-protocol/coordinator 0.0.0-ci.a577366 → 0.0.0-ci.a73cfa9

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.
Files changed (232) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +71 -10
  3. package/build/hardhat.config.cjs +9 -3
  4. package/build/hardhat.config.cjs.map +1 -1
  5. package/build/hardhat.config.d.cts +9 -4
  6. package/build/scripts/generateKeypair.js +2 -2
  7. package/build/scripts/generateKeypair.js.map +1 -1
  8. package/build/scripts/generateMaciKeyPair.js +2 -2
  9. package/build/scripts/generateMaciKeyPair.js.map +1 -1
  10. package/build/tests/constants.d.ts +3 -4
  11. package/build/tests/constants.d.ts.map +1 -1
  12. package/build/tests/constants.js +5 -4
  13. package/build/tests/constants.js.map +1 -1
  14. package/build/tests/e2e.deploy.test.js +132 -102
  15. package/build/tests/e2e.deploy.test.js.map +1 -1
  16. package/build/tests/e2e.redis.test.d.ts +2 -0
  17. package/build/tests/e2e.redis.test.d.ts.map +1 -0
  18. package/build/tests/e2e.redis.test.js +118 -0
  19. package/build/tests/e2e.redis.test.js.map +1 -0
  20. package/build/tests/utils.d.ts +7 -1
  21. package/build/tests/utils.d.ts.map +1 -1
  22. package/build/tests/utils.js +17 -6
  23. package/build/tests/utils.js.map +1 -1
  24. package/build/ts/app.module.d.ts.map +1 -1
  25. package/build/ts/app.module.js +6 -0
  26. package/build/ts/app.module.js.map +1 -1
  27. package/build/ts/common/__tests__/common.test.js +44 -46
  28. package/build/ts/common/__tests__/common.test.js.map +1 -1
  29. package/build/ts/common/accountAbstraction.d.ts +7 -24
  30. package/build/ts/common/accountAbstraction.d.ts.map +1 -1
  31. package/build/ts/common/accountAbstraction.js +22 -49
  32. package/build/ts/common/accountAbstraction.js.map +1 -1
  33. package/build/ts/common/chain.d.ts +22 -0
  34. package/build/ts/common/chain.d.ts.map +1 -0
  35. package/build/ts/common/chain.js +37 -0
  36. package/build/ts/common/chain.js.map +1 -0
  37. package/build/ts/common/coordinatorKeypair.d.ts +7 -0
  38. package/build/ts/common/coordinatorKeypair.d.ts.map +1 -0
  39. package/build/ts/common/coordinatorKeypair.js +14 -0
  40. package/build/ts/common/coordinatorKeypair.js.map +1 -0
  41. package/build/ts/common/errors.d.ts +13 -10
  42. package/build/ts/common/errors.d.ts.map +1 -1
  43. package/build/ts/common/errors.js +12 -9
  44. package/build/ts/common/errors.js.map +1 -1
  45. package/build/ts/common/http.d.ts +6 -0
  46. package/build/ts/common/http.d.ts.map +1 -0
  47. package/build/ts/common/http.js +49 -0
  48. package/build/ts/common/http.js.map +1 -0
  49. package/build/ts/common/index.d.ts +3 -1
  50. package/build/ts/common/index.d.ts.map +1 -1
  51. package/build/ts/common/index.js +3 -1
  52. package/build/ts/common/index.js.map +1 -1
  53. package/build/ts/common/networks.d.ts +2 -21
  54. package/build/ts/common/networks.d.ts.map +1 -1
  55. package/build/ts/common/networks.js +39 -48
  56. package/build/ts/common/networks.js.map +1 -1
  57. package/build/ts/common/types.d.ts +3 -4
  58. package/build/ts/common/types.d.ts.map +1 -1
  59. package/build/ts/deployer/__tests__/deployer.controller.test.js +23 -25
  60. package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -1
  61. package/build/ts/deployer/__tests__/deployer.service.test.js +182 -337
  62. package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -1
  63. package/build/ts/deployer/__tests__/utils.d.ts +31 -6
  64. package/build/ts/deployer/__tests__/utils.d.ts.map +1 -1
  65. package/build/ts/deployer/__tests__/utils.js +47 -16
  66. package/build/ts/deployer/__tests__/utils.js.map +1 -1
  67. package/build/ts/deployer/deployer.controller.d.ts.map +1 -1
  68. package/build/ts/deployer/deployer.controller.js +19 -6
  69. package/build/ts/deployer/deployer.controller.js.map +1 -1
  70. package/build/ts/deployer/deployer.service.d.ts +26 -53
  71. package/build/ts/deployer/deployer.service.d.ts.map +1 -1
  72. package/build/ts/deployer/deployer.service.js +343 -468
  73. package/build/ts/deployer/deployer.service.js.map +1 -1
  74. package/build/ts/deployer/dto.d.ts +7 -7
  75. package/build/ts/deployer/dto.d.ts.map +1 -1
  76. package/build/ts/deployer/dto.js +14 -6
  77. package/build/ts/deployer/dto.js.map +1 -1
  78. package/build/ts/deployer/types.d.ts +83 -46
  79. package/build/ts/deployer/types.d.ts.map +1 -1
  80. package/build/ts/file/__tests__/file.service.test.js +12 -11
  81. package/build/ts/file/__tests__/file.service.test.js.map +1 -1
  82. package/build/ts/file/file.service.d.ts +4 -3
  83. package/build/ts/file/file.service.d.ts.map +1 -1
  84. package/build/ts/file/file.service.js +16 -10
  85. package/build/ts/file/file.service.js.map +1 -1
  86. package/build/ts/file/types.d.ts +2 -2
  87. package/build/ts/file/types.d.ts.map +1 -1
  88. package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
  89. package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
  90. package/build/ts/health/__tests__/health.controller.test.js +52 -0
  91. package/build/ts/health/__tests__/health.controller.test.js.map +1 -0
  92. package/build/ts/health/__tests__/health.service.test.d.ts +2 -0
  93. package/build/ts/health/__tests__/health.service.test.d.ts.map +1 -0
  94. package/build/ts/health/__tests__/health.service.test.js +101 -0
  95. package/build/ts/health/__tests__/health.service.test.js.map +1 -0
  96. package/build/ts/health/health.controller.d.ts +16 -0
  97. package/build/ts/health/health.controller.d.ts.map +1 -0
  98. package/build/ts/health/health.controller.js +43 -0
  99. package/build/ts/health/health.controller.js.map +1 -0
  100. package/build/ts/health/health.module.d.ts +3 -0
  101. package/build/ts/health/health.module.d.ts.map +1 -0
  102. package/build/ts/health/health.module.js +22 -0
  103. package/build/ts/health/health.module.js.map +1 -0
  104. package/build/ts/health/health.service.d.ts +42 -0
  105. package/build/ts/health/health.service.d.ts.map +1 -0
  106. package/build/ts/health/health.service.js +176 -0
  107. package/build/ts/health/health.service.js.map +1 -0
  108. package/build/ts/health/types.d.ts +87 -0
  109. package/build/ts/health/types.d.ts.map +1 -0
  110. package/build/ts/health/types.js +2 -0
  111. package/build/ts/health/types.js.map +1 -0
  112. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts +11 -0
  113. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts.map +1 -0
  114. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js +12 -0
  115. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js.map +1 -0
  116. package/build/ts/proof/__tests__/proof.controller.test.js +8 -7
  117. package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -1
  118. package/build/ts/proof/__tests__/proof.gateway.test.js +5 -3
  119. package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -1
  120. package/build/ts/proof/__tests__/proof.service.test.js +31 -75
  121. package/build/ts/proof/__tests__/proof.service.test.js.map +1 -1
  122. package/build/ts/proof/dto.d.ts +15 -18
  123. package/build/ts/proof/dto.d.ts.map +1 -1
  124. package/build/ts/proof/dto.js +55 -49
  125. package/build/ts/proof/dto.js.map +1 -1
  126. package/build/ts/proof/proof.controller.d.ts +3 -2
  127. package/build/ts/proof/proof.controller.d.ts.map +1 -1
  128. package/build/ts/proof/proof.controller.js +38 -15
  129. package/build/ts/proof/proof.controller.js.map +1 -1
  130. package/build/ts/proof/proof.module.d.ts.map +1 -1
  131. package/build/ts/proof/proof.module.js +1 -0
  132. package/build/ts/proof/proof.module.js.map +1 -1
  133. package/build/ts/proof/proof.service.d.ts +4 -6
  134. package/build/ts/proof/proof.service.d.ts.map +1 -1
  135. package/build/ts/proof/proof.service.js +48 -130
  136. package/build/ts/proof/proof.service.js.map +1 -1
  137. package/build/ts/proof/types.d.ts +21 -17
  138. package/build/ts/proof/types.d.ts.map +1 -1
  139. package/build/ts/proof/types.js.map +1 -1
  140. package/build/ts/redis/__tests__/redis.service.test.d.ts +2 -0
  141. package/build/ts/redis/__tests__/redis.service.test.d.ts.map +1 -0
  142. package/build/ts/redis/__tests__/redis.service.test.js +148 -0
  143. package/build/ts/redis/__tests__/redis.service.test.js.map +1 -0
  144. package/build/ts/redis/redis.module.d.ts +3 -0
  145. package/build/ts/redis/redis.module.d.ts.map +1 -0
  146. package/build/ts/redis/redis.module.js +18 -0
  147. package/build/ts/redis/redis.module.js.map +1 -0
  148. package/build/ts/redis/redis.service.d.ts +53 -0
  149. package/build/ts/redis/redis.service.d.ts.map +1 -0
  150. package/build/ts/redis/redis.service.js +99 -0
  151. package/build/ts/redis/redis.service.js.map +1 -0
  152. package/build/ts/redis/types.d.ts +66 -0
  153. package/build/ts/redis/types.d.ts.map +1 -0
  154. package/build/ts/redis/types.js +2 -0
  155. package/build/ts/redis/types.js.map +1 -0
  156. package/build/ts/redis/utils.d.ts +20 -0
  157. package/build/ts/redis/utils.d.ts.map +1 -0
  158. package/build/ts/redis/utils.js +27 -0
  159. package/build/ts/redis/utils.js.map +1 -0
  160. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts +2 -0
  161. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts.map +1 -0
  162. package/build/ts/scheduler/__tests__/scheduler.controller.test.js +62 -0
  163. package/build/ts/scheduler/__tests__/scheduler.controller.test.js.map +1 -0
  164. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts +2 -0
  165. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts.map +1 -0
  166. package/build/ts/scheduler/__tests__/scheduler.service.test.js +369 -0
  167. package/build/ts/scheduler/__tests__/scheduler.service.test.js.map +1 -0
  168. package/build/ts/scheduler/dto.d.ts +41 -0
  169. package/build/ts/scheduler/dto.d.ts.map +1 -0
  170. package/build/ts/scheduler/dto.js +115 -0
  171. package/build/ts/scheduler/dto.js.map +1 -0
  172. package/build/ts/scheduler/scheduler.controller.d.ts +32 -0
  173. package/build/ts/scheduler/scheduler.controller.d.ts.map +1 -0
  174. package/build/ts/scheduler/scheduler.controller.js +118 -0
  175. package/build/ts/scheduler/scheduler.controller.js.map +1 -0
  176. package/build/ts/scheduler/scheduler.module.d.ts +3 -0
  177. package/build/ts/scheduler/scheduler.module.d.ts.map +1 -0
  178. package/build/ts/scheduler/scheduler.module.js +24 -0
  179. package/build/ts/scheduler/scheduler.module.js.map +1 -0
  180. package/build/ts/scheduler/scheduler.service.d.ts +71 -0
  181. package/build/ts/scheduler/scheduler.service.d.ts.map +1 -0
  182. package/build/ts/scheduler/scheduler.service.js +297 -0
  183. package/build/ts/scheduler/scheduler.service.js.map +1 -0
  184. package/build/ts/scheduler/types.d.ts +65 -0
  185. package/build/ts/scheduler/types.d.ts.map +1 -0
  186. package/build/ts/scheduler/types.js +2 -0
  187. package/build/ts/scheduler/types.js.map +1 -0
  188. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +2 -2
  189. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -1
  190. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +34 -19
  191. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -1
  192. package/build/ts/sessionKeys/__tests__/utils.d.ts +1 -1
  193. package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -1
  194. package/build/ts/sessionKeys/__tests__/utils.js +7 -6
  195. package/build/ts/sessionKeys/__tests__/utils.js.map +1 -1
  196. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
  197. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
  198. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
  199. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
  200. package/build/ts/sessionKeys/sessionKeys.service.d.ts +16 -4
  201. package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -1
  202. package/build/ts/sessionKeys/sessionKeys.service.js +23 -6
  203. package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -1
  204. package/build/ts/subgraph/__tests__/subgraph.controller.test.js +3 -3
  205. package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -1
  206. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +2 -2
  207. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -1
  208. package/build/ts/subgraph/__tests__/subgraph.service.test.js +5 -5
  209. package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -1
  210. package/build/ts/subgraph/dto.d.ts +2 -2
  211. package/build/ts/subgraph/dto.d.ts.map +1 -1
  212. package/build/ts/subgraph/dto.js +3 -3
  213. package/build/ts/subgraph/dto.js.map +1 -1
  214. package/build/ts/subgraph/subgraph.controller.d.ts.map +1 -1
  215. package/build/ts/subgraph/subgraph.controller.js +8 -3
  216. package/build/ts/subgraph/subgraph.controller.js.map +1 -1
  217. package/build/ts/subgraph/subgraph.service.d.ts +4 -0
  218. package/build/ts/subgraph/subgraph.service.d.ts.map +1 -1
  219. package/build/ts/subgraph/subgraph.service.js +23 -10
  220. package/build/ts/subgraph/subgraph.service.js.map +1 -1
  221. package/build/ts/subgraph/types.d.ts +2 -2
  222. package/build/ts/subgraph/types.d.ts.map +1 -1
  223. package/build/tsconfig.build.tsbuildinfo +1 -1
  224. package/package.json +45 -38
  225. package/build/tests/e2e.aa.test.d.ts +0 -2
  226. package/build/tests/e2e.aa.test.d.ts.map +0 -1
  227. package/build/tests/e2e.aa.test.js +0 -103
  228. package/build/tests/e2e.aa.test.js.map +0 -1
  229. package/build/ts/deployer/utils.d.ts +0 -8
  230. package/build/ts/deployer/utils.d.ts.map +0 -1
  231. package/build/ts/deployer/utils.js +0 -9
  232. package/build/ts/deployer/utils.js.map +0 -1
@@ -1,42 +1,24 @@
1
+ import { ESupportedChains } from "@maci-protocol/sdk";
1
2
  import { deserializePermissionAccount } from "@zerodev/permissions";
2
3
  import { toECDSASigner } from "@zerodev/permissions/signers";
3
4
  import { createKernelAccountClient } from "@zerodev/sdk";
4
5
  import { getEntryPoint, KERNEL_V3_1 } from "@zerodev/sdk/constants";
5
6
  import dotenv from "dotenv";
6
- import { createBundlerClient, ENTRYPOINT_ADDRESS_V07 } from "permissionless";
7
7
  import { createPublicClient, http } from "viem";
8
+ import { createBundlerClient } from "viem/account-abstraction";
8
9
  import { privateKeyToAccount } from "viem/accounts";
10
+ import { getRpcUrl } from "./chain";
9
11
  import { ErrorCodes } from "./errors";
10
- import { ESupportedNetworks, viemChain } from "./networks";
12
+ import { viemChain } from "./networks";
11
13
  dotenv.config();
12
- /**
13
- * Generate the RPCUrl for Alchemy based on the chain we need to interact with
14
- *
15
- * @param network - the network we want to interact with
16
- * @returns the RPCUrl for the network
17
- */
18
- export const genAlchemyRPCUrl = (network) => {
19
- const rpcAPIKey = process.env.RPC_API_KEY;
20
- if (!rpcAPIKey) {
21
- throw new Error(ErrorCodes.RPC_API_KEY_NOT_SET.toString());
22
- }
23
- switch (network) {
24
- case ESupportedNetworks.OPTIMISM_SEPOLIA:
25
- return `https://opt-sepolia.g.alchemy.com/v2/${rpcAPIKey}`;
26
- case ESupportedNetworks.ETHEREUM_SEPOLIA:
27
- return `https://eth-sepolia.g.alchemy.com/v2/${rpcAPIKey}`;
28
- default:
29
- throw new Error(ErrorCodes.UNSUPPORTED_NETWORK.toString());
30
- }
31
- };
32
14
  /**
33
15
  * Get a public client
34
16
  *
35
17
  * @param chainName - the name of the chain to use
36
18
  * @returns the public client
37
19
  */
38
- export const getPublicClient = (chainName) => createPublicClient({
39
- transport: http(genAlchemyRPCUrl(chainName)),
20
+ export const getPublicClient = async (chainName) => createPublicClient({
21
+ transport: http(await getRpcUrl(chainName)),
40
22
  chain: viemChain(chainName),
41
23
  });
42
24
  /**
@@ -47,10 +29,12 @@ export const getPublicClient = (chainName) => createPublicClient({
47
29
  */
48
30
  export const getZeroDevBundlerRPCUrl = (network) => {
49
31
  switch (network) {
50
- case ESupportedNetworks.OPTIMISM_SEPOLIA:
32
+ case ESupportedChains.OptimismSepolia:
51
33
  return process.env.ZERODEV_BUNDLER_RPC_OP_SEPOLIA || "";
52
- case ESupportedNetworks.OPTIMISM:
34
+ case ESupportedChains.Optimism:
53
35
  return process.env.ZERODEV_BUNDLER_RPC_OP || "";
36
+ case ESupportedChains.Sepolia:
37
+ return process.env.ZERODEV_BUNDLER_RPC_SEPOLIA || "";
54
38
  default:
55
39
  throw new Error(ErrorCodes.UNSUPPORTED_NETWORK.toString());
56
40
  }
@@ -64,26 +48,11 @@ export const getZeroDevBundlerRPCUrl = (network) => {
64
48
  export const getBundlerClient = (chainName) => createBundlerClient({
65
49
  transport: http(getZeroDevBundlerRPCUrl(chainName)),
66
50
  chain: viemChain(chainName),
67
- entryPoint: ENTRYPOINT_ADDRESS_V07,
68
51
  });
69
- /**
70
- * The topic for the contract creation event
71
- */
72
- export const contractCreationEventTopic = "0x4db17dd5e4732fb6da34a148104a592783ca119a1e7bb8829eba6cbadef0b511";
73
52
  /**
74
53
  * The offset for the address in the contract creation event
75
54
  */
76
55
  export const addressOffset = 26;
77
- /**
78
- * Get the address of the newly deployed contract from a transaction receipt
79
- * @param receipt - The transaction receipt
80
- * @returns The address of the newly deployed contract
81
- */
82
- export const getDeployedContractAddress = (receipt) => {
83
- const addr = receipt.logs.find((log) => log.topics[0] === contractCreationEventTopic);
84
- const deployedAddress = addr ? `0x${addr.topics[1]?.slice(addressOffset)}` : undefined;
85
- return deployedAddress;
86
- };
87
56
  /**
88
57
  * Get a Kernel account handle given a session key
89
58
  *
@@ -94,17 +63,21 @@ export const getDeployedContractAddress = (receipt) => {
94
63
  */
95
64
  export const getKernelClient = async (sessionKey, approval, chain) => {
96
65
  const bundlerUrl = getZeroDevBundlerRPCUrl(chain);
97
- const publicClient = getPublicClient(chain);
66
+ const publicClient = await getPublicClient(chain);
98
67
  // Using a stored private key
99
68
  const sessionKeySigner = await toECDSASigner({
100
69
  signer: privateKeyToAccount(sessionKey),
101
70
  });
102
- const sessionKeyAccount = await deserializePermissionAccount(publicClient, getEntryPoint("0.7"), KERNEL_V3_1, approval, sessionKeySigner);
103
- const kernelClient = createKernelAccountClient({
104
- bundlerTransport: http(bundlerUrl),
105
- account: sessionKeyAccount,
106
- chain: viemChain(chain),
107
- });
108
- return kernelClient;
71
+ try {
72
+ const sessionKeyAccount = await deserializePermissionAccount(publicClient, getEntryPoint("0.7"), KERNEL_V3_1, approval, sessionKeySigner);
73
+ return createKernelAccountClient({
74
+ bundlerTransport: http(bundlerUrl),
75
+ account: sessionKeyAccount,
76
+ chain: viemChain(chain),
77
+ });
78
+ }
79
+ catch (error) {
80
+ throw new Error(ErrorCodes.INVALID_APPROVAL.toString());
81
+ }
109
82
  };
110
83
  //# sourceMappingURL=accountAbstraction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accountAbstraction.js","sourceRoot":"","sources":["../../../ts/common/accountAbstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAgC,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG3D,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAA2B,EAAU,EAAE;IACtE,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IAE1C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC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AC;SACxB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { ESupportedChains } from "@maci-protocol/sdk";
2
+ import { type HDNodeWallet, type Signer, Wallet } from "ethers";
3
+ /**
4
+ * Get the RPC url for the chain we need to interact with
5
+ *
6
+ * @param network - the network we want to interact with
7
+ * @returns the RPC url for the network
8
+ */
9
+ export declare const getRpcUrl: (network: ESupportedChains) => Promise<string>;
10
+ /**
11
+ * Get wallet from private key or mnemonic env variable
12
+ *
13
+ * @returns wallet
14
+ */
15
+ export declare const getWallet: () => Wallet | HDNodeWallet;
16
+ /**
17
+ * Get a Ethers Signer given a chain and private key
18
+ * @param chain
19
+ * @returns
20
+ */
21
+ export declare const getSigner: (chain: ESupportedChains) => Promise<Signer>;
22
+ //# sourceMappingURL=chain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../ts/common/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,MAAM,EAAmB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIjF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,MAAM,CAYzE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAO,MAAM,GAAG,YACoE,CAAC;AAE3G;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,OAAO,gBAAgB,KAAG,OAAO,CAAC,MAAM,CAOvE,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { ESupportedChains } from "@maci-protocol/sdk";
2
+ import { JsonRpcProvider, Wallet } from "ethers";
3
+ import { ErrorCodes } from "./errors";
4
+ /**
5
+ * Get the RPC url for the chain we need to interact with
6
+ *
7
+ * @param network - the network we want to interact with
8
+ * @returns the RPC url for the network
9
+ */
10
+ export const getRpcUrl = async (network) => {
11
+ const rpcUrl = process.env.COORDINATOR_RPC_URL;
12
+ if (!rpcUrl) {
13
+ return Promise.reject(new Error(ErrorCodes.COORDINATOR_RPC_URL_NOT_SET.toString()));
14
+ }
15
+ if (!Object.values(ESupportedChains).includes(network)) {
16
+ return Promise.reject(new Error(ErrorCodes.UNSUPPORTED_NETWORK.toString()));
17
+ }
18
+ return Promise.resolve(rpcUrl);
19
+ };
20
+ /**
21
+ * Get wallet from private key or mnemonic env variable
22
+ *
23
+ * @returns wallet
24
+ */
25
+ export const getWallet = () => process.env.PRIVATE_KEY ? new Wallet(process.env.PRIVATE_KEY) : Wallet.fromPhrase(process.env.MNEMONIC);
26
+ /**
27
+ * Get a Ethers Signer given a chain and private key
28
+ * @param chain
29
+ * @returns
30
+ */
31
+ export const getSigner = async (chain) => {
32
+ const wallet = getWallet();
33
+ const alchemyRpcUrl = await getRpcUrl(chain);
34
+ const provider = new JsonRpcProvider(alchemyRpcUrl);
35
+ return wallet.connect(provider);
36
+ };
37
+ //# sourceMappingURL=chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../ts/common/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAkC,eAAe,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,OAAyB,EAAmB,EAAE;IAC5E,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAE/C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,2BAA2B,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACtF,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAA0B,EAAE,CACnD,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,QAAS,CAAC,CAAC;AAE3G;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,KAAuB,EAAmB,EAAE;IAC1E,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,MAAM,aAAa,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Keypair } from "@maci-protocol/domainobjs";
2
+ /**
3
+ * Instantiate the MACI Coordinator keypair.
4
+ * @returns {Keypair} - The MACI Coordinator keypair.
5
+ */
6
+ export declare const getCoordinatorKeypair: () => Keypair;
7
+ //# sourceMappingURL=coordinatorKeypair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinatorKeypair.d.ts","sourceRoot":"","sources":["../../../ts/common/coordinatorKeypair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAO,OAUxC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Keypair, PrivateKey } from "@maci-protocol/domainobjs";
2
+ /**
3
+ * Instantiate the MACI Coordinator keypair.
4
+ * @returns {Keypair} - The MACI Coordinator keypair.
5
+ */
6
+ export const getCoordinatorKeypair = () => {
7
+ const privateKey = String(process.env.COORDINATOR_MACI_PRIVATE_KEY);
8
+ if (!privateKey) {
9
+ throw new Error("COORDINATOR_MACI_PRIVATE_KEY environment variable is not set.");
10
+ }
11
+ const maciPrivateKey = PrivateKey.deserialize(privateKey);
12
+ return new Keypair(maciPrivateKey);
13
+ };
14
+ //# sourceMappingURL=coordinatorKeypair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinatorKeypair.js","sourceRoot":"","sources":["../../../ts/common/coordinatorKeypair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAY,EAAE;IACjD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAEpE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE1D,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;AACrC,CAAC,CAAC"}
@@ -11,23 +11,26 @@ export declare enum ErrorCodes {
11
11
  SUBGRAPH_DEPLOY = 6,
12
12
  SUBGRAPH_DEPLOY_KEY_NOT_FOUND = 7,
13
13
  SESSION_KEY_NOT_FOUND = 8,
14
- PIMLICO_API_KEY_NOT_SET = 9,
15
- INVALID_APPROVAL = 10,
16
- UNSUPPORTED_NETWORK = 11,
17
- RPC_API_KEY_NOT_SET = 12,
18
- FAILED_TO_MERGE_STATE_TREE = 13,
19
- FAILED_TO_MERGE_MESSAGE_SUBTREES = 14,
20
- FAILED_TO_MERGE_MESSAGE_TREE = 15,
14
+ INVALID_APPROVAL = 9,
15
+ UNSUPPORTED_NETWORK = 10,
16
+ COORDINATOR_RPC_URL_NOT_SET = 11,
17
+ FAILED_TO_MERGE_STATE_TREE = 12,
18
+ FAILED_TO_MERGE_MESSAGE_SUBTREES = 13,
19
+ FAILED_TO_MERGE_MESSAGE_TREE = 14,
20
+ UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY = 15,
21
21
  UNSUPPORTED_VOICE_CREDIT_PROXY = 16,
22
22
  UNSUPPORTED_POLICY = 17,
23
23
  FAILED_TO_DEPLOY_CONTRACT = 18,
24
24
  FAILED_TO_SET_MACI_INSTANCE_ON_POLICY = 19,
25
25
  MACI_NOT_DEPLOYED = 20,
26
26
  VERIFIER_NOT_DEPLOYED = 21,
27
- VK_REGISTRY_NOT_DEPLOYED = 22,
28
- FAILED_TO_SET_VERIFYING_KEYS_ON_VK_REGISTRY = 23,
27
+ VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED = 22,
28
+ FAILED_TO_SET_VERIFYING_KEYS = 23,
29
29
  FAILED_TO_DEPLOY_MACI = 24,
30
30
  FAILED_TO_DEPLOY_POLL = 25,
31
- NOT_MERGED_MESSAGE_TREE = 26
31
+ NOT_MERGED_MESSAGE_TREE = 26,
32
+ FAILED_TO_UPDATE_SCHEDULED_POLL = 27,
33
+ POLL_ALREADY_SCHEDULED = 28,
34
+ POLL_ALREADY_TALLIED = 29
32
35
  }
33
36
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../ts/common/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB,qBAAqB,IAAA;IACrB,oBAAoB,IAAA;IACpB,cAAc,IAAA;IACd,UAAU,IAAA;IACV,UAAU,IAAA;IACV,cAAc,IAAA;IACd,eAAe,IAAA;IACf,6BAA6B,IAAA;IAC7B,qBAAqB,IAAA;IACrB,uBAAuB,IAAA;IACvB,gBAAgB,KAAA;IAChB,mBAAmB,KAAA;IACnB,mBAAmB,KAAA;IACnB,0BAA0B,KAAA;IAC1B,gCAAgC,KAAA;IAChC,4BAA4B,KAAA;IAC5B,8BAA8B,KAAA;IAC9B,kBAAkB,KAAA;IAClB,yBAAyB,KAAA;IACzB,qCAAqC,KAAA;IACrC,iBAAiB,KAAA;IACjB,qBAAqB,KAAA;IACrB,wBAAwB,KAAA;IACxB,2CAA2C,KAAA;IAC3C,qBAAqB,KAAA;IACrB,qBAAqB,KAAA;IACrB,uBAAuB,KAAA;CACxB"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../ts/common/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB,qBAAqB,IAAA;IACrB,oBAAoB,IAAA;IACpB,cAAc,IAAA;IACd,UAAU,IAAA;IACV,UAAU,IAAA;IACV,cAAc,IAAA;IACd,eAAe,IAAA;IACf,6BAA6B,IAAA;IAC7B,qBAAqB,IAAA;IACrB,gBAAgB,IAAA;IAChB,mBAAmB,KAAA;IACnB,2BAA2B,KAAA;IAC3B,0BAA0B,KAAA;IAC1B,gCAAgC,KAAA;IAChC,4BAA4B,KAAA;IAC5B,sCAAsC,KAAA;IACtC,8BAA8B,KAAA;IAC9B,kBAAkB,KAAA;IAClB,yBAAyB,KAAA;IACzB,qCAAqC,KAAA;IACrC,iBAAiB,KAAA;IACjB,qBAAqB,KAAA;IACrB,oCAAoC,KAAA;IACpC,4BAA4B,KAAA;IAC5B,qBAAqB,KAAA;IACrB,qBAAqB,KAAA;IACrB,uBAAuB,KAAA;IACvB,+BAA+B,KAAA;IAC/B,sBAAsB,KAAA;IACtB,oBAAoB,KAAA;CACrB"}
@@ -12,23 +12,26 @@ export var ErrorCodes;
12
12
  ErrorCodes[ErrorCodes["SUBGRAPH_DEPLOY"] = 6] = "SUBGRAPH_DEPLOY";
13
13
  ErrorCodes[ErrorCodes["SUBGRAPH_DEPLOY_KEY_NOT_FOUND"] = 7] = "SUBGRAPH_DEPLOY_KEY_NOT_FOUND";
14
14
  ErrorCodes[ErrorCodes["SESSION_KEY_NOT_FOUND"] = 8] = "SESSION_KEY_NOT_FOUND";
15
- ErrorCodes[ErrorCodes["PIMLICO_API_KEY_NOT_SET"] = 9] = "PIMLICO_API_KEY_NOT_SET";
16
- ErrorCodes[ErrorCodes["INVALID_APPROVAL"] = 10] = "INVALID_APPROVAL";
17
- ErrorCodes[ErrorCodes["UNSUPPORTED_NETWORK"] = 11] = "UNSUPPORTED_NETWORK";
18
- ErrorCodes[ErrorCodes["RPC_API_KEY_NOT_SET"] = 12] = "RPC_API_KEY_NOT_SET";
19
- ErrorCodes[ErrorCodes["FAILED_TO_MERGE_STATE_TREE"] = 13] = "FAILED_TO_MERGE_STATE_TREE";
20
- ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_SUBTREES"] = 14] = "FAILED_TO_MERGE_MESSAGE_SUBTREES";
21
- ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_TREE"] = 15] = "FAILED_TO_MERGE_MESSAGE_TREE";
15
+ ErrorCodes[ErrorCodes["INVALID_APPROVAL"] = 9] = "INVALID_APPROVAL";
16
+ ErrorCodes[ErrorCodes["UNSUPPORTED_NETWORK"] = 10] = "UNSUPPORTED_NETWORK";
17
+ ErrorCodes[ErrorCodes["COORDINATOR_RPC_URL_NOT_SET"] = 11] = "COORDINATOR_RPC_URL_NOT_SET";
18
+ ErrorCodes[ErrorCodes["FAILED_TO_MERGE_STATE_TREE"] = 12] = "FAILED_TO_MERGE_STATE_TREE";
19
+ ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_SUBTREES"] = 13] = "FAILED_TO_MERGE_MESSAGE_SUBTREES";
20
+ ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_TREE"] = 14] = "FAILED_TO_MERGE_MESSAGE_TREE";
21
+ ErrorCodes[ErrorCodes["UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY"] = 15] = "UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY";
22
22
  ErrorCodes[ErrorCodes["UNSUPPORTED_VOICE_CREDIT_PROXY"] = 16] = "UNSUPPORTED_VOICE_CREDIT_PROXY";
23
23
  ErrorCodes[ErrorCodes["UNSUPPORTED_POLICY"] = 17] = "UNSUPPORTED_POLICY";
24
24
  ErrorCodes[ErrorCodes["FAILED_TO_DEPLOY_CONTRACT"] = 18] = "FAILED_TO_DEPLOY_CONTRACT";
25
25
  ErrorCodes[ErrorCodes["FAILED_TO_SET_MACI_INSTANCE_ON_POLICY"] = 19] = "FAILED_TO_SET_MACI_INSTANCE_ON_POLICY";
26
26
  ErrorCodes[ErrorCodes["MACI_NOT_DEPLOYED"] = 20] = "MACI_NOT_DEPLOYED";
27
27
  ErrorCodes[ErrorCodes["VERIFIER_NOT_DEPLOYED"] = 21] = "VERIFIER_NOT_DEPLOYED";
28
- ErrorCodes[ErrorCodes["VK_REGISTRY_NOT_DEPLOYED"] = 22] = "VK_REGISTRY_NOT_DEPLOYED";
29
- ErrorCodes[ErrorCodes["FAILED_TO_SET_VERIFYING_KEYS_ON_VK_REGISTRY"] = 23] = "FAILED_TO_SET_VERIFYING_KEYS_ON_VK_REGISTRY";
28
+ ErrorCodes[ErrorCodes["VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED"] = 22] = "VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED";
29
+ ErrorCodes[ErrorCodes["FAILED_TO_SET_VERIFYING_KEYS"] = 23] = "FAILED_TO_SET_VERIFYING_KEYS";
30
30
  ErrorCodes[ErrorCodes["FAILED_TO_DEPLOY_MACI"] = 24] = "FAILED_TO_DEPLOY_MACI";
31
31
  ErrorCodes[ErrorCodes["FAILED_TO_DEPLOY_POLL"] = 25] = "FAILED_TO_DEPLOY_POLL";
32
32
  ErrorCodes[ErrorCodes["NOT_MERGED_MESSAGE_TREE"] = 26] = "NOT_MERGED_MESSAGE_TREE";
33
+ ErrorCodes[ErrorCodes["FAILED_TO_UPDATE_SCHEDULED_POLL"] = 27] = "FAILED_TO_UPDATE_SCHEDULED_POLL";
34
+ ErrorCodes[ErrorCodes["POLL_ALREADY_SCHEDULED"] = 28] = "POLL_ALREADY_SCHEDULED";
35
+ ErrorCodes[ErrorCodes["POLL_ALREADY_TALLIED"] = 29] = "POLL_ALREADY_TALLIED";
33
36
  })(ErrorCodes || (ErrorCodes = {}));
34
37
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../ts/common/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UA4BX;AA5BD,WAAY,UAAU;IACpB,6EAAqB,CAAA;IACrB,2EAAoB,CAAA;IACpB,+DAAc,CAAA;IACd,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,+DAAc,CAAA;IACd,iEAAe,CAAA;IACf,6FAA6B,CAAA;IAC7B,6EAAqB,CAAA;IACrB,iFAAuB,CAAA;IACvB,oEAAgB,CAAA;IAChB,0EAAmB,CAAA;IACnB,0EAAmB,CAAA;IACnB,wFAA0B,CAAA;IAC1B,oGAAgC,CAAA;IAChC,4FAA4B,CAAA;IAC5B,gGAA8B,CAAA;IAC9B,wEAAkB,CAAA;IAClB,sFAAyB,CAAA;IACzB,8GAAqC,CAAA;IACrC,sEAAiB,CAAA;IACjB,8EAAqB,CAAA;IACrB,oFAAwB,CAAA;IACxB,0HAA2C,CAAA;IAC3C,8EAAqB,CAAA;IACrB,8EAAqB,CAAA;IACrB,kFAAuB,CAAA;AACzB,CAAC,EA5BW,UAAU,KAAV,UAAU,QA4BrB"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../ts/common/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UA+BX;AA/BD,WAAY,UAAU;IACpB,6EAAqB,CAAA;IACrB,2EAAoB,CAAA;IACpB,+DAAc,CAAA;IACd,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,+DAAc,CAAA;IACd,iEAAe,CAAA;IACf,6FAA6B,CAAA;IAC7B,6EAAqB,CAAA;IACrB,mEAAgB,CAAA;IAChB,0EAAmB,CAAA;IACnB,0FAA2B,CAAA;IAC3B,wFAA0B,CAAA;IAC1B,oGAAgC,CAAA;IAChC,4FAA4B,CAAA;IAC5B,gHAAsC,CAAA;IACtC,gGAA8B,CAAA;IAC9B,wEAAkB,CAAA;IAClB,sFAAyB,CAAA;IACzB,8GAAqC,CAAA;IACrC,sEAAiB,CAAA;IACjB,8EAAqB,CAAA;IACrB,4GAAoC,CAAA;IACpC,4FAA4B,CAAA;IAC5B,8EAAqB,CAAA;IACrB,8EAAqB,CAAA;IACrB,kFAAuB,CAAA;IACvB,kGAA+B,CAAA;IAC/B,gFAAsB,CAAA;IACtB,4EAAoB,CAAA;AACtB,CAAC,EA/BW,UAAU,KAAV,UAAU,QA+BrB"}
@@ -0,0 +1,6 @@
1
+ import { HttpStatus } from "@nestjs/common";
2
+ /**
3
+ * Map a thrown error (usually containing ErrorCodes) to an appropriate HTTP status
4
+ */
5
+ export declare function mapErrorToHttpStatus(error: Error): HttpStatus;
6
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../ts/common/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAiD7D"}
@@ -0,0 +1,49 @@
1
+ import { HttpStatus } from "@nestjs/common";
2
+ import { ErrorCodes } from "./errors";
3
+ /**
4
+ * Map a thrown error (usually containing ErrorCodes) to an appropriate HTTP status
5
+ */
6
+ export function mapErrorToHttpStatus(error) {
7
+ const { message } = error;
8
+ switch (message) {
9
+ case ErrorCodes.UNSUPPORTED_NETWORK.toString():
10
+ case ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY.toString():
11
+ case ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY.toString():
12
+ case ErrorCodes.UNSUPPORTED_POLICY.toString():
13
+ return HttpStatus.BAD_REQUEST;
14
+ case ErrorCodes.INVALID_APPROVAL.toString():
15
+ return HttpStatus.FORBIDDEN;
16
+ case ErrorCodes.SESSION_KEY_NOT_FOUND.toString():
17
+ case ErrorCodes.POLL_NOT_FOUND.toString():
18
+ return HttpStatus.NOT_FOUND;
19
+ case ErrorCodes.POLL_ALREADY_SCHEDULED.toString():
20
+ case ErrorCodes.POLL_ALREADY_TALLIED.toString():
21
+ case ErrorCodes.NOT_MERGED_STATE_TREE.toString():
22
+ case ErrorCodes.NOT_MERGED_MESSAGE_TREE.toString():
23
+ return HttpStatus.CONFLICT;
24
+ case ErrorCodes.MACI_NOT_DEPLOYED.toString():
25
+ case ErrorCodes.VERIFIER_NOT_DEPLOYED.toString():
26
+ case ErrorCodes.VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED.toString():
27
+ return HttpStatus.PRECONDITION_FAILED;
28
+ case ErrorCodes.FILE_NOT_FOUND.toString():
29
+ case ErrorCodes.SUBGRAPH_DEPLOY_KEY_NOT_FOUND.toString():
30
+ case ErrorCodes.SUBGRAPH_DEPLOY.toString():
31
+ case ErrorCodes.PRIVATE_KEY_MISMATCH.toString():
32
+ case ErrorCodes.DECRYPTION.toString():
33
+ case ErrorCodes.ENCRYPTION.toString():
34
+ case ErrorCodes.COORDINATOR_RPC_URL_NOT_SET.toString():
35
+ case ErrorCodes.FAILED_TO_MERGE_STATE_TREE.toString():
36
+ case ErrorCodes.FAILED_TO_MERGE_MESSAGE_SUBTREES.toString():
37
+ case ErrorCodes.FAILED_TO_MERGE_MESSAGE_TREE.toString():
38
+ case ErrorCodes.FAILED_TO_SET_VERIFYING_KEYS.toString():
39
+ case ErrorCodes.FAILED_TO_DEPLOY_CONTRACT.toString():
40
+ case ErrorCodes.FAILED_TO_SET_MACI_INSTANCE_ON_POLICY.toString():
41
+ case ErrorCodes.FAILED_TO_DEPLOY_MACI.toString():
42
+ case ErrorCodes.FAILED_TO_DEPLOY_POLL.toString():
43
+ case ErrorCodes.FAILED_TO_UPDATE_SCHEDULED_POLL.toString():
44
+ return HttpStatus.INTERNAL_SERVER_ERROR;
45
+ default:
46
+ return HttpStatus.INTERNAL_SERVER_ERROR;
47
+ }
48
+ }
49
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../ts/common/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAY;IAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1B,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAC/C,KAAK,UAAU,CAAC,sCAAsC,CAAC,QAAQ,EAAE,CAAC;QAClE,KAAK,UAAU,CAAC,8BAA8B,CAAC,QAAQ,EAAE,CAAC;QAC1D,KAAK,UAAU,CAAC,kBAAkB,CAAC,QAAQ,EAAE;YAC3C,OAAO,UAAU,CAAC,WAAW,CAAC;QAEhC,KAAK,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE;YACzC,OAAO,UAAU,CAAC,SAAS,C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QAAQ,EAAE,CAAC;QACxD,KAAK,UAAU,CAAC,yBAAyB,CAAC,QAAQ,EAAE,CAAC;QACrD,KAAK,UAAU,CAAC,qCAAqC,CAAC,QAAQ,EAAE,CAAC;QACjE,KAAK,UAAU,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC;QACjD,KAAK,UAAU,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC;QACjD,KAAK,UAAU,CAAC,+BAA+B,CAAC,QAAQ,EAAE;YACxD,OAAO,UAAU,CAAC,qBAAqB,CAAC;QAE1C;YACE,OAAO,UAAU,CAAC,qBAAqB,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export { ErrorCodes } from "./errors";
2
- export { ESupportedNetworks } from "./networks";
2
+ export * from "./chain";
3
+ export * from "./accountAbstraction";
3
4
  export * from "./types";
5
+ export * from "./http";
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export { ErrorCodes } from "./errors";
2
- export { ESupportedNetworks } from "./networks";
2
+ export * from "./chain";
3
+ export * from "./accountAbstraction";
3
4
  export * from "./types";
5
+ export * from "./http";
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -1,29 +1,10 @@
1
+ import { ESupportedChains } from "@maci-protocol/sdk";
1
2
  import { type Chain } from "viem/chains";
2
- export declare enum ESupportedNetworks {
3
- ETHEREUM = "mainnet",
4
- OPTIMISM = "optimism",
5
- OPTIMISM_SEPOLIA = "optimism-sepolia",
6
- BSC = "bsc",
7
- BSC_CHAPEL = "chapel",
8
- GNOSIS_CHAIN = "gnosis",
9
- POLYGON = "matic",
10
- ARBITRUM_ONE = "arbitrum-one",
11
- HOLESKY = "holesky",
12
- LINEA_SEPOLIA = "linea-sepolia",
13
- BASE_SEPOLIA = "base-sepolia",
14
- ETHEREUM_SEPOLIA = "sepolia",
15
- ARBITRUM_SEPOLIA = "arbitrum-sepolia",
16
- LINEA = "linea",
17
- BASE = "base",
18
- SCROLL_SEPOLIA = "scroll-sepolia",
19
- SCROLL = "scroll",
20
- LOCALHOST = "localhost"
21
- }
22
3
  /**
23
4
  * Get the Viem chain for a given network
24
5
  *
25
6
  * @param network - the network to get the chain for
26
7
  * @returns the Viem chain
27
8
  */
28
- export declare const viemChain: (network: ESupportedNetworks) => Chain;
9
+ export declare const viemChain: (network: ESupportedChains) => Chain;
29
10
  //# sourceMappingURL=networks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../../ts/common/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,KAAK,EAaX,MAAM,aAAa,CAAC;AAIrB,oBAAY,kBAAkB;IAC5B,QAAQ,YAAY;IACpB,QAAQ,aAAa;IACrB,gBAAgB,qBAAqB;IACrC,GAAG,QAAQ;IACX,UAAU,WAAW;IACrB,YAAY,WAAW;IACvB,OAAO,UAAU;IACjB,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,aAAa,kBAAkB;IAC/B,YAAY,iBAAiB;IAC7B,gBAAgB,YAAY;IAC5B,gBAAgB,qBAAqB;IACrC,KAAK,UAAU;IACf,IAAI,SAAS;IACb,cAAc,mBAAmB;IACjC,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,SAAS,kBAAkB,KAAG,KAuCvD,CAAC"}
1
+ {"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../../ts/common/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAKL,KAAK,KAAK,EAmBX,MAAM,aAAa,CAAC;AAIrB;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,SAAS,gBAAgB,KAAG,KAkDrD,CAAC"}
@@ -1,26 +1,6 @@
1
- import { arbitrum, arbitrumSepolia, base, baseSepolia, bsc, gnosis, holesky, linea, lineaSepolia, localhost, mainnet, optimism, optimismSepolia, polygon, scroll, scrollSepolia, sepolia, } from "viem/chains";
1
+ import { ESupportedChains } from "@maci-protocol/sdk";
2
+ import { arbitrum, arbitrumSepolia, base, baseSepolia, gnosis, gnosisChiado, hardhat, linea, lineaSepolia, localhost, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, polygonZkEvm, polygonZkEvmCardona, scroll, scrollSepolia, sepolia, zksync, zksyncSepoliaTestnet, } from "viem/chains";
2
3
  import { ErrorCodes } from "./errors";
3
- export var ESupportedNetworks;
4
- (function (ESupportedNetworks) {
5
- ESupportedNetworks["ETHEREUM"] = "mainnet";
6
- ESupportedNetworks["OPTIMISM"] = "optimism";
7
- ESupportedNetworks["OPTIMISM_SEPOLIA"] = "optimism-sepolia";
8
- ESupportedNetworks["BSC"] = "bsc";
9
- ESupportedNetworks["BSC_CHAPEL"] = "chapel";
10
- ESupportedNetworks["GNOSIS_CHAIN"] = "gnosis";
11
- ESupportedNetworks["POLYGON"] = "matic";
12
- ESupportedNetworks["ARBITRUM_ONE"] = "arbitrum-one";
13
- ESupportedNetworks["HOLESKY"] = "holesky";
14
- ESupportedNetworks["LINEA_SEPOLIA"] = "linea-sepolia";
15
- ESupportedNetworks["BASE_SEPOLIA"] = "base-sepolia";
16
- ESupportedNetworks["ETHEREUM_SEPOLIA"] = "sepolia";
17
- ESupportedNetworks["ARBITRUM_SEPOLIA"] = "arbitrum-sepolia";
18
- ESupportedNetworks["LINEA"] = "linea";
19
- ESupportedNetworks["BASE"] = "base";
20
- ESupportedNetworks["SCROLL_SEPOLIA"] = "scroll-sepolia";
21
- ESupportedNetworks["SCROLL"] = "scroll";
22
- ESupportedNetworks["LOCALHOST"] = "localhost";
23
- })(ESupportedNetworks || (ESupportedNetworks = {}));
24
4
  /**
25
5
  * Get the Viem chain for a given network
26
6
  *
@@ -29,39 +9,50 @@ export var ESupportedNetworks;
29
9
  */
30
10
  export const viemChain = (network) => {
31
11
  switch (network) {
32
- case ESupportedNetworks.ETHEREUM:
12
+ case ESupportedChains.Mainnet:
33
13
  return mainnet;
34
- case ESupportedNetworks.ETHEREUM_SEPOLIA:
14
+ case ESupportedChains.Sepolia:
35
15
  return sepolia;
36
- case ESupportedNetworks.ARBITRUM_ONE:
16
+ case ESupportedChains.Optimism:
17
+ return optimism;
18
+ case ESupportedChains.OptimismSepolia:
19
+ return optimismSepolia;
20
+ case ESupportedChains.Scroll:
21
+ return scroll;
22
+ case ESupportedChains.ScrollSepolia:
23
+ return scrollSepolia;
24
+ case ESupportedChains.Arbitrum:
37
25
  return arbitrum;
38
- case ESupportedNetworks.ARBITRUM_SEPOLIA:
26
+ case ESupportedChains.ArbitrumSepolia:
39
27
  return arbitrumSepolia;
40
- case ESupportedNetworks.BASE_SEPOLIA:
41
- return baseSepolia;
42
- case ESupportedNetworks.LINEA_SEPOLIA:
43
- return lineaSepolia;
44
- case ESupportedNetworks.SCROLL_SEPOLIA:
45
- return scrollSepolia;
46
- case ESupportedNetworks.SCROLL:
47
- return scroll;
48
- case ESupportedNetworks.BASE:
28
+ case ESupportedChains.Base:
49
29
  return base;
50
- case ESupportedNetworks.HOLESKY:
51
- return holesky;
52
- case ESupportedNetworks.LINEA:
53
- return linea;
54
- case ESupportedNetworks.BSC:
55
- return bsc;
56
- case ESupportedNetworks.GNOSIS_CHAIN:
30
+ case ESupportedChains.BaseSepolia:
31
+ return baseSepolia;
32
+ case ESupportedChains.Gnosis:
57
33
  return gnosis;
58
- case ESupportedNetworks.POLYGON:
34
+ case ESupportedChains.GnosisChiado:
35
+ return gnosisChiado;
36
+ case ESupportedChains.Polygon:
59
37
  return polygon;
60
- case ESupportedNetworks.OPTIMISM:
61
- return optimism;
62
- case ESupportedNetworks.OPTIMISM_SEPOLIA:
63
- return optimismSepolia;
64
- case ESupportedNetworks.LOCALHOST:
38
+ case ESupportedChains.PolygonAmoy:
39
+ return polygonAmoy;
40
+ case ESupportedChains.Linea:
41
+ return linea;
42
+ case ESupportedChains.LineaSepolia:
43
+ return lineaSepolia;
44
+ case ESupportedChains.ZkSyncEra:
45
+ return zksync;
46
+ case ESupportedChains.ZkSyncSepolia:
47
+ return zksyncSepoliaTestnet;
48
+ case ESupportedChains.PolygonZkEvm:
49
+ return polygonZkEvm;
50
+ case ESupportedChains.PolygonCardonaZkEvm:
51
+ return polygonZkEvmCardona;
52
+ // coverage is not supported by viem and it wont be used in the coordinator
53
+ case ESupportedChains.Hardhat:
54
+ return hardhat;
55
+ case ESupportedChains.Localhost:
65
56
  return localhost;
66
57
  default:
67
58
  throw new Error(ErrorCodes.UNSUPPORTED_NETWORK.toString());
@@ -1 +1 @@
1
- {"version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B,CAAC,mBAAmB;YACvC,OAAO,mBAAmB,CAAC;QAC7B,2EAA2E;QAC3E,KAAK,gBAAgB,CAAC,OAAO;YAC3B,OAAO,OAAO,CAAC;QACjB,KAAK,gBAAgB,CAAC,SAAS;YAC7B,OAAO,SAAS,CAAC;QACnB;YACE,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC"}
@@ -1,9 +1,8 @@
1
- import { CreateKernelAccountReturnType, KernelAccountClient } from "@zerodev/sdk";
2
- import { BundlerClient } from "permissionless";
3
- import { ENTRYPOINT_ADDRESS_V07_TYPE } from "permissionless/types";
1
+ import { type CreateKernelAccountReturnType, type KernelAccountClient } from "@zerodev/sdk";
2
+ import { type BundlerClient } from "viem/account-abstraction";
4
3
  import type { Chain, HttpTransport, PublicClient, Transport } from "viem";
5
4
  export type KernelClientType = KernelAccountClient<Transport, Chain, CreateKernelAccountReturnType>;
6
- export type BundlerClientType = BundlerClient<ENTRYPOINT_ADDRESS_V07_TYPE>;
5
+ export type BundlerClientType = BundlerClient;
7
6
  export type PublicClientType = PublicClient<Transport, Chain>;
8
7
  export type PublicClientHTTPType = PublicClient<HttpTransport, Chain>;
9
8
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1E,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,SAAS,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC;AAEpG,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,2BAA2B,CAAC,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,6BAA6B,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1E,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,SAAS,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC;AAEpG,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC"}