@maci-protocol/coordinator 0.0.0-ci.4c6d4e8 → 0.0.0-ci.4d0e3a3

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 (235) hide show
  1. package/CHANGELOG.md +224 -0
  2. package/LICENSE +1 -2
  3. package/README.md +71 -10
  4. package/build/hardhat.config.cjs +17 -9
  5. package/build/hardhat.config.cjs.map +1 -1
  6. package/build/hardhat.config.d.cts +15 -12
  7. package/build/hardhat.config.d.cts.map +1 -1
  8. package/build/scripts/generateKeypair.js +2 -2
  9. package/build/scripts/generateKeypair.js.map +1 -1
  10. package/build/scripts/generateMaciKeyPair.js +2 -2
  11. package/build/scripts/generateMaciKeyPair.js.map +1 -1
  12. package/build/tests/constants.d.ts +3 -4
  13. package/build/tests/constants.d.ts.map +1 -1
  14. package/build/tests/constants.js +5 -4
  15. package/build/tests/constants.js.map +1 -1
  16. package/build/tests/e2e.deploy.test.js +133 -103
  17. package/build/tests/e2e.deploy.test.js.map +1 -1
  18. package/build/tests/e2e.redis.test.d.ts +2 -0
  19. package/build/tests/e2e.redis.test.d.ts.map +1 -0
  20. package/build/tests/e2e.redis.test.js +118 -0
  21. package/build/tests/e2e.redis.test.js.map +1 -0
  22. package/build/tests/utils.d.ts +7 -1
  23. package/build/tests/utils.d.ts.map +1 -1
  24. package/build/tests/utils.js +17 -6
  25. package/build/tests/utils.js.map +1 -1
  26. package/build/ts/app.module.d.ts.map +1 -1
  27. package/build/ts/app.module.js +6 -0
  28. package/build/ts/app.module.js.map +1 -1
  29. package/build/ts/common/__tests__/common.test.js +44 -46
  30. package/build/ts/common/__tests__/common.test.js.map +1 -1
  31. package/build/ts/common/accountAbstraction.d.ts +7 -24
  32. package/build/ts/common/accountAbstraction.d.ts.map +1 -1
  33. package/build/ts/common/accountAbstraction.js +22 -49
  34. package/build/ts/common/accountAbstraction.js.map +1 -1
  35. package/build/ts/common/chain.d.ts +22 -0
  36. package/build/ts/common/chain.d.ts.map +1 -0
  37. package/build/ts/common/chain.js +37 -0
  38. package/build/ts/common/chain.js.map +1 -0
  39. package/build/ts/common/coordinatorKeypair.d.ts +7 -0
  40. package/build/ts/common/coordinatorKeypair.d.ts.map +1 -0
  41. package/build/ts/common/coordinatorKeypair.js +14 -0
  42. package/build/ts/common/coordinatorKeypair.js.map +1 -0
  43. package/build/ts/common/errors.d.ts +13 -10
  44. package/build/ts/common/errors.d.ts.map +1 -1
  45. package/build/ts/common/errors.js +12 -9
  46. package/build/ts/common/errors.js.map +1 -1
  47. package/build/ts/common/http.d.ts +6 -0
  48. package/build/ts/common/http.d.ts.map +1 -0
  49. package/build/ts/common/http.js +49 -0
  50. package/build/ts/common/http.js.map +1 -0
  51. package/build/ts/common/index.d.ts +3 -1
  52. package/build/ts/common/index.d.ts.map +1 -1
  53. package/build/ts/common/index.js +3 -1
  54. package/build/ts/common/index.js.map +1 -1
  55. package/build/ts/common/networks.d.ts +2 -21
  56. package/build/ts/common/networks.d.ts.map +1 -1
  57. package/build/ts/common/networks.js +39 -48
  58. package/build/ts/common/networks.js.map +1 -1
  59. package/build/ts/common/types.d.ts +3 -4
  60. package/build/ts/common/types.d.ts.map +1 -1
  61. package/build/ts/deployer/__tests__/deployer.controller.test.js +23 -25
  62. package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -1
  63. package/build/ts/deployer/__tests__/deployer.service.test.js +184 -337
  64. package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -1
  65. package/build/ts/deployer/__tests__/utils.d.ts +31 -6
  66. package/build/ts/deployer/__tests__/utils.d.ts.map +1 -1
  67. package/build/ts/deployer/__tests__/utils.js +48 -24
  68. package/build/ts/deployer/__tests__/utils.js.map +1 -1
  69. package/build/ts/deployer/deployer.controller.d.ts.map +1 -1
  70. package/build/ts/deployer/deployer.controller.js +19 -6
  71. package/build/ts/deployer/deployer.controller.js.map +1 -1
  72. package/build/ts/deployer/deployer.service.d.ts +26 -53
  73. package/build/ts/deployer/deployer.service.d.ts.map +1 -1
  74. package/build/ts/deployer/deployer.service.js +343 -469
  75. package/build/ts/deployer/deployer.service.js.map +1 -1
  76. package/build/ts/deployer/dto.d.ts +7 -7
  77. package/build/ts/deployer/dto.d.ts.map +1 -1
  78. package/build/ts/deployer/dto.js +14 -6
  79. package/build/ts/deployer/dto.js.map +1 -1
  80. package/build/ts/deployer/types.d.ts +84 -47
  81. package/build/ts/deployer/types.d.ts.map +1 -1
  82. package/build/ts/file/__tests__/file.service.test.js +12 -11
  83. package/build/ts/file/__tests__/file.service.test.js.map +1 -1
  84. package/build/ts/file/file.service.d.ts +4 -3
  85. package/build/ts/file/file.service.d.ts.map +1 -1
  86. package/build/ts/file/file.service.js +16 -10
  87. package/build/ts/file/file.service.js.map +1 -1
  88. package/build/ts/file/types.d.ts +2 -2
  89. package/build/ts/file/types.d.ts.map +1 -1
  90. package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
  91. package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
  92. package/build/ts/health/__tests__/health.controller.test.js +52 -0
  93. package/build/ts/health/__tests__/health.controller.test.js.map +1 -0
  94. package/build/ts/health/__tests__/health.service.test.d.ts +2 -0
  95. package/build/ts/health/__tests__/health.service.test.d.ts.map +1 -0
  96. package/build/ts/health/__tests__/health.service.test.js +101 -0
  97. package/build/ts/health/__tests__/health.service.test.js.map +1 -0
  98. package/build/ts/health/health.controller.d.ts +16 -0
  99. package/build/ts/health/health.controller.d.ts.map +1 -0
  100. package/build/ts/health/health.controller.js +43 -0
  101. package/build/ts/health/health.controller.js.map +1 -0
  102. package/build/ts/health/health.module.d.ts +3 -0
  103. package/build/ts/health/health.module.d.ts.map +1 -0
  104. package/build/ts/health/health.module.js +22 -0
  105. package/build/ts/health/health.module.js.map +1 -0
  106. package/build/ts/health/health.service.d.ts +42 -0
  107. package/build/ts/health/health.service.d.ts.map +1 -0
  108. package/build/ts/health/health.service.js +176 -0
  109. package/build/ts/health/health.service.js.map +1 -0
  110. package/build/ts/health/types.d.ts +87 -0
  111. package/build/ts/health/types.d.ts.map +1 -0
  112. package/build/ts/health/types.js +2 -0
  113. package/build/ts/health/types.js.map +1 -0
  114. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts +11 -0
  115. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts.map +1 -0
  116. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js +12 -0
  117. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js.map +1 -0
  118. package/build/ts/main.js +1 -1
  119. package/build/ts/proof/__tests__/proof.controller.test.js +8 -7
  120. package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -1
  121. package/build/ts/proof/__tests__/proof.gateway.test.js +5 -3
  122. package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -1
  123. package/build/ts/proof/__tests__/proof.service.test.js +31 -75
  124. package/build/ts/proof/__tests__/proof.service.test.js.map +1 -1
  125. package/build/ts/proof/dto.d.ts +15 -18
  126. package/build/ts/proof/dto.d.ts.map +1 -1
  127. package/build/ts/proof/dto.js +55 -49
  128. package/build/ts/proof/dto.js.map +1 -1
  129. package/build/ts/proof/proof.controller.d.ts +3 -2
  130. package/build/ts/proof/proof.controller.d.ts.map +1 -1
  131. package/build/ts/proof/proof.controller.js +38 -15
  132. package/build/ts/proof/proof.controller.js.map +1 -1
  133. package/build/ts/proof/proof.module.d.ts.map +1 -1
  134. package/build/ts/proof/proof.module.js +1 -0
  135. package/build/ts/proof/proof.module.js.map +1 -1
  136. package/build/ts/proof/proof.service.d.ts +4 -6
  137. package/build/ts/proof/proof.service.d.ts.map +1 -1
  138. package/build/ts/proof/proof.service.js +48 -130
  139. package/build/ts/proof/proof.service.js.map +1 -1
  140. package/build/ts/proof/types.d.ts +21 -17
  141. package/build/ts/proof/types.d.ts.map +1 -1
  142. package/build/ts/proof/types.js.map +1 -1
  143. package/build/ts/redis/__tests__/redis.service.test.d.ts +2 -0
  144. package/build/ts/redis/__tests__/redis.service.test.d.ts.map +1 -0
  145. package/build/ts/redis/__tests__/redis.service.test.js +148 -0
  146. package/build/ts/redis/__tests__/redis.service.test.js.map +1 -0
  147. package/build/ts/redis/redis.module.d.ts +3 -0
  148. package/build/ts/redis/redis.module.d.ts.map +1 -0
  149. package/build/ts/redis/redis.module.js +18 -0
  150. package/build/ts/redis/redis.module.js.map +1 -0
  151. package/build/ts/redis/redis.service.d.ts +53 -0
  152. package/build/ts/redis/redis.service.d.ts.map +1 -0
  153. package/build/ts/redis/redis.service.js +99 -0
  154. package/build/ts/redis/redis.service.js.map +1 -0
  155. package/build/ts/redis/types.d.ts +66 -0
  156. package/build/ts/redis/types.d.ts.map +1 -0
  157. package/build/ts/redis/types.js +2 -0
  158. package/build/ts/redis/types.js.map +1 -0
  159. package/build/ts/redis/utils.d.ts +20 -0
  160. package/build/ts/redis/utils.d.ts.map +1 -0
  161. package/build/ts/redis/utils.js +27 -0
  162. package/build/ts/redis/utils.js.map +1 -0
  163. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts +2 -0
  164. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts.map +1 -0
  165. package/build/ts/scheduler/__tests__/scheduler.controller.test.js +62 -0
  166. package/build/ts/scheduler/__tests__/scheduler.controller.test.js.map +1 -0
  167. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts +2 -0
  168. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts.map +1 -0
  169. package/build/ts/scheduler/__tests__/scheduler.service.test.js +369 -0
  170. package/build/ts/scheduler/__tests__/scheduler.service.test.js.map +1 -0
  171. package/build/ts/scheduler/dto.d.ts +41 -0
  172. package/build/ts/scheduler/dto.d.ts.map +1 -0
  173. package/build/ts/scheduler/dto.js +115 -0
  174. package/build/ts/scheduler/dto.js.map +1 -0
  175. package/build/ts/scheduler/scheduler.controller.d.ts +32 -0
  176. package/build/ts/scheduler/scheduler.controller.d.ts.map +1 -0
  177. package/build/ts/scheduler/scheduler.controller.js +118 -0
  178. package/build/ts/scheduler/scheduler.controller.js.map +1 -0
  179. package/build/ts/scheduler/scheduler.module.d.ts +3 -0
  180. package/build/ts/scheduler/scheduler.module.d.ts.map +1 -0
  181. package/build/ts/scheduler/scheduler.module.js +24 -0
  182. package/build/ts/scheduler/scheduler.module.js.map +1 -0
  183. package/build/ts/scheduler/scheduler.service.d.ts +71 -0
  184. package/build/ts/scheduler/scheduler.service.d.ts.map +1 -0
  185. package/build/ts/scheduler/scheduler.service.js +297 -0
  186. package/build/ts/scheduler/scheduler.service.js.map +1 -0
  187. package/build/ts/scheduler/types.d.ts +65 -0
  188. package/build/ts/scheduler/types.d.ts.map +1 -0
  189. package/build/ts/scheduler/types.js +2 -0
  190. package/build/ts/scheduler/types.js.map +1 -0
  191. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +2 -2
  192. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -1
  193. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +34 -19
  194. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -1
  195. package/build/ts/sessionKeys/__tests__/utils.d.ts +1 -1
  196. package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -1
  197. package/build/ts/sessionKeys/__tests__/utils.js +7 -6
  198. package/build/ts/sessionKeys/__tests__/utils.js.map +1 -1
  199. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
  200. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
  201. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
  202. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
  203. package/build/ts/sessionKeys/sessionKeys.service.d.ts +16 -4
  204. package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -1
  205. package/build/ts/sessionKeys/sessionKeys.service.js +23 -6
  206. package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -1
  207. package/build/ts/subgraph/__tests__/subgraph.controller.test.js +3 -3
  208. package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -1
  209. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +2 -2
  210. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -1
  211. package/build/ts/subgraph/__tests__/subgraph.service.test.js +5 -5
  212. package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -1
  213. package/build/ts/subgraph/dto.d.ts +2 -2
  214. package/build/ts/subgraph/dto.d.ts.map +1 -1
  215. package/build/ts/subgraph/dto.js +3 -3
  216. package/build/ts/subgraph/dto.js.map +1 -1
  217. package/build/ts/subgraph/subgraph.controller.d.ts.map +1 -1
  218. package/build/ts/subgraph/subgraph.controller.js +8 -3
  219. package/build/ts/subgraph/subgraph.controller.js.map +1 -1
  220. package/build/ts/subgraph/subgraph.service.d.ts +4 -0
  221. package/build/ts/subgraph/subgraph.service.d.ts.map +1 -1
  222. package/build/ts/subgraph/subgraph.service.js +23 -10
  223. package/build/ts/subgraph/subgraph.service.js.map +1 -1
  224. package/build/ts/subgraph/types.d.ts +2 -2
  225. package/build/ts/subgraph/types.d.ts.map +1 -1
  226. package/build/tsconfig.build.tsbuildinfo +1 -1
  227. package/package.json +46 -39
  228. package/build/tests/e2e.aa.test.d.ts +0 -2
  229. package/build/tests/e2e.aa.test.d.ts.map +0 -1
  230. package/build/tests/e2e.aa.test.js +0 -103
  231. package/build/tests/e2e.aa.test.js.map +0 -1
  232. package/build/ts/deployer/utils.d.ts +0 -8
  233. package/build/ts/deployer/utils.d.ts.map +0 -1
  234. package/build/ts/deployer/utils.js +0 -9
  235. package/build/ts/deployer/utils.js.map +0 -1
@@ -9,7 +9,10 @@ import { ThrottlerModule } from "@nestjs/throttler";
9
9
  import { CryptoModule } from "./crypto/crypto.module";
10
10
  import { DeployerModule } from "./deployer/deployer.module";
11
11
  import { FileModule } from "./file/file.module";
12
+ import { HealthModule } from "./health/health.module";
12
13
  import { ProofModule } from "./proof/proof.module";
14
+ import { RedisModule } from "./redis/redis.module";
15
+ import { SchedulerModule } from "./scheduler/scheduler.module";
13
16
  import { SessionKeysModule } from "./sessionKeys/sessionKeys.module";
14
17
  import { SubgraphModule } from "./subgraph/subgraph.module";
15
18
  let AppModule = class AppModule {
@@ -23,12 +26,15 @@ AppModule = __decorate([
23
26
  limit: Number(process.env.LIMIT),
24
27
  },
25
28
  ]),
29
+ HealthModule,
26
30
  FileModule,
27
31
  CryptoModule,
28
32
  SubgraphModule,
29
33
  ProofModule,
30
34
  SessionKeysModule,
31
35
  DeployerModule,
36
+ RedisModule,
37
+ SchedulerModule,
32
38
  ],
33
39
  })
34
40
  ], AppModule);
@@ -1 +1 @@
1
- {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../ts/app.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAkBrD,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,SAAS;IAhBrB,MAAM,CAAC;QACN,OAAO,EAAE;YACP,eAAe,CAAC,OAAO,CAAC;gBACtB;oBACE,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;oBAC5B,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;iBACjC;aACF,CAAC;YACF,UAAU;YACV,YAAY;YACZ,cAAc;YACd,WAAW;YACX,iBAAiB;YACjB,cAAc;SACf;KACF,CAAC;GACW,SAAS,CAAG"}
1
+ {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../ts/app.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAqBrD,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,SAAS;IAnBrB,MAAM,CAAC;QACN,OAAO,EAAE;YACP,eAAe,CAAC,OAAO,CAAC;gBACtB;oBACE,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;oBAC5B,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;iBACjC;aACF,CAAC;YACF,YAAY;YACZ,UAAU;YACV,YAAY;YACZ,cAAc;YACd,WAAW;YACX,iBAAiB;YACjB,cAAc;YACd,WAAW;YACX,eAAe;SAChB;KACF,CAAC;GACW,SAAS,CAAG"}
@@ -1,15 +1,17 @@
1
- import { mainnet, sepolia, arbitrum, arbitrumSepolia, baseSepolia, lineaSepolia, scrollSepolia, scroll, base, holesky, linea, bsc, gnosis, polygon, optimism, optimismSepolia, } from "viem/chains";
2
- import { genAlchemyRPCUrl, getBundlerClient, getDeployedContractAddress, getPublicClient, getZeroDevBundlerRPCUrl, } from "../accountAbstraction";
1
+ import { ESupportedChains } from "@maci-protocol/sdk";
2
+ import { mainnet, sepolia, arbitrum, localhost, arbitrumSepolia, baseSepolia, lineaSepolia, scrollSepolia, scroll, base, linea, gnosis, polygon, optimism, optimismSepolia, hardhat, polygonAmoy, polygonZkEvm, polygonZkEvmCardona, zksyncSepoliaTestnet, zksync, gnosisChiado, } from "viem/chains";
3
+ import { getBundlerClient, getPublicClient, getZeroDevBundlerRPCUrl } from "../accountAbstraction";
4
+ import { getRpcUrl } from "../chain";
3
5
  import { ErrorCodes } from "../errors";
4
- import { ESupportedNetworks, viemChain } from "../networks";
6
+ import { viemChain } from "../networks";
5
7
  describe("common", () => {
6
8
  describe("getPublicClient", () => {
7
- test("should return a public client", () => {
8
- const publicClient = getPublicClient(ESupportedNetworks.OPTIMISM_SEPOLIA);
9
+ test("should return a public client", async () => {
10
+ const publicClient = await getPublicClient(ESupportedChains.Sepolia);
9
11
  expect(publicClient).toBeDefined();
10
12
  });
11
- test("should throw when given an unsupported network", () => {
12
- expect(() => getPublicClient("Unsupported")).toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
13
+ test("should throw when given an unsupported network", async () => {
14
+ await expect(() => getPublicClient("Unsupported")).rejects.toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
13
15
  });
14
16
  });
15
17
  describe("getZeroDevBundlerRPCUrl", () => {
@@ -17,59 +19,55 @@ describe("common", () => {
17
19
  expect(() => getZeroDevBundlerRPCUrl("Unsupported")).toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
18
20
  });
19
21
  test("should return an RPCUrl for a supported network", () => {
20
- const rpcUrlOPS = getZeroDevBundlerRPCUrl(ESupportedNetworks.OPTIMISM_SEPOLIA);
22
+ const rpcUrlOPS = getZeroDevBundlerRPCUrl(ESupportedChains.OptimismSepolia);
21
23
  expect(rpcUrlOPS).toBeDefined();
22
- const rpcUrlOP = getZeroDevBundlerRPCUrl(ESupportedNetworks.OPTIMISM);
24
+ const rpcUrlSepolia = getZeroDevBundlerRPCUrl(ESupportedChains.Sepolia);
25
+ expect(rpcUrlSepolia).toBeDefined();
26
+ const rpcUrlOP = getZeroDevBundlerRPCUrl(ESupportedChains.Optimism);
23
27
  expect(rpcUrlOP).toBeDefined();
24
28
  });
29
+ test("should throw when a unsupported zero dev network is given", () => {
30
+ expect(() => getZeroDevBundlerRPCUrl(ESupportedChains.Base)).toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
31
+ });
25
32
  });
26
33
  describe("getBundlerClient", () => {
27
34
  test("should throw when the network is not supported", () => {
28
35
  expect(() => getBundlerClient("Unsupported")).toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
29
36
  });
30
37
  });
31
- describe("genAlchemyRPCUrl", () => {
32
- test("should return the correct RPCUrl for optimism-sepolia", () => {
33
- const rpcUrl = genAlchemyRPCUrl(ESupportedNetworks.OPTIMISM_SEPOLIA);
34
- expect(rpcUrl).toBeDefined();
35
- expect(rpcUrl).toContain("https://opt-sepolia.g.alchemy.com/v2/");
36
- });
37
- test("should return the correct RPCUrl for sepolia", () => {
38
- const rpcUrl = genAlchemyRPCUrl(ESupportedNetworks.ETHEREUM_SEPOLIA);
39
- expect(rpcUrl).toBeDefined();
40
- expect(rpcUrl).toContain("https://eth-sepolia.g.alchemy.com/v2/");
41
- });
42
- test("should throw when given an unsupported network", () => {
43
- expect(() => genAlchemyRPCUrl(ESupportedNetworks.GNOSIS_CHAIN)).toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
38
+ describe("getRpcUrl", () => {
39
+ test("should throw when given an unsupported network", async () => {
40
+ await expect(() => getRpcUrl("Unsupported")).rejects.toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
44
41
  });
45
- test("should throw when ALCHEMY_API_KEY is not set", () => {
46
- delete process.env.RPC_API_KEY;
47
- expect(() => genAlchemyRPCUrl(ESupportedNetworks.OPTIMISM_SEPOLIA)).toThrow(ErrorCodes.RPC_API_KEY_NOT_SET.toString());
48
- });
49
- });
50
- describe("getDeployedContractAddress", () => {
51
- test("should throw when the log is undefined", () => {
52
- expect(() => getDeployedContractAddress({})).toThrow();
42
+ test("should throw when COORDINATOR_RPC_URL is not set", async () => {
43
+ delete process.env.COORDINATOR_RPC_URL;
44
+ await expect(() => getRpcUrl(ESupportedChains.OptimismSepolia)).rejects.toThrow(ErrorCodes.COORDINATOR_RPC_URL_NOT_SET.toString());
53
45
  });
54
46
  });
55
47
  describe("viemChain", () => {
56
48
  test("should return correct chain for all supported networks", () => {
57
- expect(viemChain(ESupportedNetworks.ETHEREUM)).toBe(mainnet);
58
- expect(viemChain(ESupportedNetworks.ETHEREUM_SEPOLIA)).toBe(sepolia);
59
- expect(viemChain(ESupportedNetworks.ARBITRUM_ONE)).toBe(arbitrum);
60
- expect(viemChain(ESupportedNetworks.ARBITRUM_SEPOLIA)).toBe(arbitrumSepolia);
61
- expect(viemChain(ESupportedNetworks.BASE_SEPOLIA)).toBe(baseSepolia);
62
- expect(viemChain(ESupportedNetworks.LINEA_SEPOLIA)).toBe(lineaSepolia);
63
- expect(viemChain(ESupportedNetworks.SCROLL_SEPOLIA)).toBe(scrollSepolia);
64
- expect(viemChain(ESupportedNetworks.SCROLL)).toBe(scroll);
65
- expect(viemChain(ESupportedNetworks.BASE)).toBe(base);
66
- expect(viemChain(ESupportedNetworks.HOLESKY)).toBe(holesky);
67
- expect(viemChain(ESupportedNetworks.LINEA)).toBe(linea);
68
- expect(viemChain(ESupportedNetworks.BSC)).toBe(bsc);
69
- expect(viemChain(ESupportedNetworks.GNOSIS_CHAIN)).toBe(gnosis);
70
- expect(viemChain(ESupportedNetworks.POLYGON)).toBe(polygon);
71
- expect(viemChain(ESupportedNetworks.OPTIMISM)).toBe(optimism);
72
- expect(viemChain(ESupportedNetworks.OPTIMISM_SEPOLIA)).toBe(optimismSepolia);
49
+ expect(viemChain(ESupportedChains.Mainnet)).toBe(mainnet);
50
+ expect(viemChain(ESupportedChains.Sepolia)).toBe(sepolia);
51
+ expect(viemChain(ESupportedChains.Optimism)).toBe(optimism);
52
+ expect(viemChain(ESupportedChains.OptimismSepolia)).toBe(optimismSepolia);
53
+ expect(viemChain(ESupportedChains.Scroll)).toBe(scroll);
54
+ expect(viemChain(ESupportedChains.ScrollSepolia)).toBe(scrollSepolia);
55
+ expect(viemChain(ESupportedChains.Arbitrum)).toBe(arbitrum);
56
+ expect(viemChain(ESupportedChains.ArbitrumSepolia)).toBe(arbitrumSepolia);
57
+ expect(viemChain(ESupportedChains.Base)).toBe(base);
58
+ expect(viemChain(ESupportedChains.BaseSepolia)).toBe(baseSepolia);
59
+ expect(viemChain(ESupportedChains.Gnosis)).toBe(gnosis);
60
+ expect(viemChain(ESupportedChains.GnosisChiado)).toBe(gnosisChiado);
61
+ expect(viemChain(ESupportedChains.Polygon)).toBe(polygon);
62
+ expect(viemChain(ESupportedChains.PolygonAmoy)).toBe(polygonAmoy);
63
+ expect(viemChain(ESupportedChains.Linea)).toBe(linea);
64
+ expect(viemChain(ESupportedChains.LineaSepolia)).toBe(lineaSepolia);
65
+ expect(viemChain(ESupportedChains.ZkSyncEra)).toBe(zksync);
66
+ expect(viemChain(ESupportedChains.ZkSyncSepolia)).toBe(zksyncSepoliaTestnet);
67
+ expect(viemChain(ESupportedChains.PolygonZkEvm)).toBe(polygonZkEvm);
68
+ expect(viemChain(ESupportedChains.PolygonCardonaZkEvm)).toBe(polygonZkEvmCardona);
69
+ expect(viemChain(ESupportedChains.Hardhat)).toBe(hardhat);
70
+ expect(viemChain(ESupportedChains.Localhost)).toBe(localhost);
73
71
  });
74
72
  test("should throw error for unsupported network", () => {
75
73
  expect(() => viemChain("UNSUPPORTED_NETWORK")).toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
@@ -1 +1 @@
1
- {"version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AAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACpE,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3D,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAC7E,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACpE,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YAClF,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC1D,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;YACtD,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,qBAAyC,CAAC,CAAC,CAAC,OAAO,CACxE,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAC1C,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,48 +1,31 @@
1
- import { type Hex, TransactionReceipt } from "viem";
2
- import { ESupportedNetworks } from "./networks";
3
- import { KernelClientType, BundlerClientType, PublicClientHTTPType } from "./types";
4
- /**
5
- * Generate the RPCUrl for Alchemy based on the chain we need to interact with
6
- *
7
- * @param network - the network we want to interact with
8
- * @returns the RPCUrl for the network
9
- */
10
- export declare const genAlchemyRPCUrl: (network: ESupportedNetworks) => string;
1
+ import { ESupportedChains } from "@maci-protocol/sdk";
2
+ import { type Hex } from "viem";
3
+ import type { BundlerClientType, KernelClientType, PublicClientHTTPType } from "./types";
11
4
  /**
12
5
  * Get a public client
13
6
  *
14
7
  * @param chainName - the name of the chain to use
15
8
  * @returns the public client
16
9
  */
17
- export declare const getPublicClient: (chainName: ESupportedNetworks) => PublicClientHTTPType;
10
+ export declare const getPublicClient: (chainName: ESupportedChains) => Promise<PublicClientHTTPType>;
18
11
  /**
19
12
  * Get the ZeroDev bundler RPC URL based on the network
20
13
  *
21
14
  * @param network - the network we are on
22
15
  * @returns the ZeroDev bundler RPC URL
23
16
  */
24
- export declare const getZeroDevBundlerRPCUrl: (network: ESupportedNetworks) => string;
17
+ export declare const getZeroDevBundlerRPCUrl: (network: ESupportedChains) => string;
25
18
  /**
26
19
  * Get a bundler client
27
20
  *
28
21
  * @param chainName - the chain name
29
22
  * @returns the bundler client
30
23
  */
31
- export declare const getBundlerClient: (chainName: ESupportedNetworks) => BundlerClientType;
32
- /**
33
- * The topic for the contract creation event
34
- */
35
- export declare const contractCreationEventTopic = "0x4db17dd5e4732fb6da34a148104a592783ca119a1e7bb8829eba6cbadef0b511";
24
+ export declare const getBundlerClient: (chainName: ESupportedChains) => BundlerClientType;
36
25
  /**
37
26
  * The offset for the address in the contract creation event
38
27
  */
39
28
  export declare const addressOffset = 26;
40
- /**
41
- * Get the address of the newly deployed contract from a transaction receipt
42
- * @param receipt - The transaction receipt
43
- * @returns The address of the newly deployed contract
44
- */
45
- export declare const getDeployedContractAddress: (receipt: TransactionReceipt) => string | undefined;
46
29
  /**
47
30
  * Get a Kernel account handle given a session key
48
31
  *
@@ -51,5 +34,5 @@ export declare const getDeployedContractAddress: (receipt: TransactionReceipt) =
51
34
  * @param chain - the chain to use
52
35
  * @returns the kernel client
53
36
  */
54
- export declare const getKernelClient: (sessionKey: Hex, approval: string, chain: ESupportedNetworks) => Promise<KernelClientType>;
37
+ export declare const getKernelClient: (sessionKey: Hex, approval: string, chain: ESupportedChains) => Promise<KernelClientType>;
55
38
  //# sourceMappingURL=accountAbstraction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accountAbstraction.d.ts","sourceRoot":"","sources":["../../../ts/common/accountAbstraction.ts"],"names":[],"mappings":"AAMA,OAAO,EAA4B,KAAK,GAAG,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAI9E,OAAO,EAAE,kBAAkB,EAAa,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAIpF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,kBAAkB,KAAG,MAe9D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,kBAAkB,KAAG,oBAI5D,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,kBAAkB,KAAG,MASrE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,WAAW,kBAAkB,KAAG,iBAK7D,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,0BAA0B,uEAAuE,CAAC;AAE/G;;GAEG;AACH,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS,kBAAkB,KAAG,MAAM,GAAG,SAMjF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,YAAY,GAAG,EACf,UAAU,MAAM,EAChB,OAAO,kBAAkB,KACxB,OAAO,CAAC,gBAAgB,CAwB1B,CAAC"}
1
+ {"version":3,"file":"accountAbstraction.d.ts","sourceRoot":"","sources":["../../../ts/common/accountAbstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,OAAO,EAA4B,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAI1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAQzF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAU,WAAW,gBAAgB,KAAG,OAAO,CAAC,oBAAoB,CAI5F,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,gBAAgB,KAAG,MAWnE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,WAAW,gBAAgB,KAAG,iBAI3D,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,YAAY,GAAG,EACf,UAAU,MAAM,EAChB,OAAO,gBAAgB,KACtB,OAAO,CAAC,gBAAgB,CA0B1B,CAAC"}
@@ -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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C,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACnD,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC;CAC5B,CAAC,CAAC;AAEL;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,UAAe,EACf,QAAgB,EAChB,KAAuB,EACI,EAAE;IAC7B,MAAM,UAAU,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,KAAK,CAAC,CAAC;IAElD,6BAA6B;IAC7B,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC;QAC3C,MAAM,EAAE,mBAAmB,CAAC,UAAU,CAAC;KACxC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,iBAAiB,GAAG,MAAM,4BAA4B,CAC1D,YAAY,EACZ,aAAa,CAAC,KAAK,CAAC,EACpB,WAAW,EACX,QAAQ,EACR,gBAAgB,CACjB,CAAC;QAEF,OAAO,yBAAyB,CAAC;YAC/B,gBAAgB,EAAE,IAAI,CAAC,UAAU,CAAC;YAClC,OAAO,EAAE,iBAAiB;YAC1B,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;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"}