@maci-protocol/coordinator 0.0.0-ci.00107eb

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 (345) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/LICENSE +21 -0
  3. package/README.md +103 -0
  4. package/build/hardhat.config.cjs +39 -0
  5. package/build/hardhat.config.cjs.map +1 -0
  6. package/build/hardhat.config.d.cts +27 -0
  7. package/build/hardhat.config.d.cts.map +1 -0
  8. package/build/scripts/generateKeypair.d.ts +2 -0
  9. package/build/scripts/generateKeypair.d.ts.map +1 -0
  10. package/build/scripts/generateKeypair.js +25 -0
  11. package/build/scripts/generateKeypair.js.map +1 -0
  12. package/build/scripts/generateMaciKeyPair.d.ts +2 -0
  13. package/build/scripts/generateMaciKeyPair.d.ts.map +1 -0
  14. package/build/scripts/generateMaciKeyPair.js +3 -0
  15. package/build/scripts/generateMaciKeyPair.js.map +1 -0
  16. package/build/scripts/getAuthHeader.d.ts +2 -0
  17. package/build/scripts/getAuthHeader.d.ts.map +1 -0
  18. package/build/scripts/getAuthHeader.js +31 -0
  19. package/build/scripts/getAuthHeader.js.map +1 -0
  20. package/build/tests/constants.d.ts +7 -0
  21. package/build/tests/constants.d.ts.map +1 -0
  22. package/build/tests/constants.js +11 -0
  23. package/build/tests/constants.js.map +1 -0
  24. package/build/tests/e2e.deploy.test.d.ts +2 -0
  25. package/build/tests/e2e.deploy.test.d.ts.map +1 -0
  26. package/build/tests/e2e.deploy.test.js +264 -0
  27. package/build/tests/e2e.deploy.test.js.map +1 -0
  28. package/build/tests/e2e.redis.test.d.ts +2 -0
  29. package/build/tests/e2e.redis.test.d.ts.map +1 -0
  30. package/build/tests/e2e.redis.test.js +118 -0
  31. package/build/tests/e2e.redis.test.js.map +1 -0
  32. package/build/tests/utils.d.ts +20 -0
  33. package/build/tests/utils.d.ts.map +1 -0
  34. package/build/tests/utils.js +55 -0
  35. package/build/tests/utils.js.map +1 -0
  36. package/build/ts/app.module.d.ts +3 -0
  37. package/build/ts/app.module.d.ts.map +1 -0
  38. package/build/ts/app.module.js +42 -0
  39. package/build/ts/app.module.js.map +1 -0
  40. package/build/ts/auth/AccountSignatureGuard.service.d.ts +44 -0
  41. package/build/ts/auth/AccountSignatureGuard.service.d.ts.map +1 -0
  42. package/build/ts/auth/AccountSignatureGuard.service.js +96 -0
  43. package/build/ts/auth/AccountSignatureGuard.service.js.map +1 -0
  44. package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts +2 -0
  45. package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts.map +1 -0
  46. package/build/ts/auth/__tests__/AccountSignatureGuard.test.js +113 -0
  47. package/build/ts/auth/__tests__/AccountSignatureGuard.test.js.map +1 -0
  48. package/build/ts/common/__tests__/common.test.d.ts +2 -0
  49. package/build/ts/common/__tests__/common.test.d.ts.map +1 -0
  50. package/build/ts/common/__tests__/common.test.js +77 -0
  51. package/build/ts/common/__tests__/common.test.js.map +1 -0
  52. package/build/ts/common/accountAbstraction.d.ts +38 -0
  53. package/build/ts/common/accountAbstraction.d.ts.map +1 -0
  54. package/build/ts/common/accountAbstraction.js +83 -0
  55. package/build/ts/common/accountAbstraction.js.map +1 -0
  56. package/build/ts/common/chain.d.ts +22 -0
  57. package/build/ts/common/chain.d.ts.map +1 -0
  58. package/build/ts/common/chain.js +37 -0
  59. package/build/ts/common/chain.js.map +1 -0
  60. package/build/ts/common/coordinatorKeypair.d.ts +7 -0
  61. package/build/ts/common/coordinatorKeypair.d.ts.map +1 -0
  62. package/build/ts/common/coordinatorKeypair.js +14 -0
  63. package/build/ts/common/coordinatorKeypair.js.map +1 -0
  64. package/build/ts/common/errors.d.ts +36 -0
  65. package/build/ts/common/errors.d.ts.map +1 -0
  66. package/build/ts/common/errors.js +37 -0
  67. package/build/ts/common/errors.js.map +1 -0
  68. package/build/ts/common/http.d.ts +6 -0
  69. package/build/ts/common/http.d.ts.map +1 -0
  70. package/build/ts/common/http.js +49 -0
  71. package/build/ts/common/http.js.map +1 -0
  72. package/build/ts/common/index.d.ts +6 -0
  73. package/build/ts/common/index.d.ts.map +1 -0
  74. package/build/ts/common/index.js +6 -0
  75. package/build/ts/common/index.js.map +1 -0
  76. package/build/ts/common/networks.d.ts +10 -0
  77. package/build/ts/common/networks.d.ts.map +1 -0
  78. package/build/ts/common/networks.js +61 -0
  79. package/build/ts/common/networks.js.map +1 -0
  80. package/build/ts/common/types.d.ts +8 -0
  81. package/build/ts/common/types.d.ts.map +1 -0
  82. package/build/ts/common/types.js +2 -0
  83. package/build/ts/common/types.js.map +1 -0
  84. package/build/ts/crypto/__tests__/crypto.service.test.d.ts +2 -0
  85. package/build/ts/crypto/__tests__/crypto.service.test.d.ts.map +1 -0
  86. package/build/ts/crypto/__tests__/crypto.service.test.js +26 -0
  87. package/build/ts/crypto/__tests__/crypto.service.test.js.map +1 -0
  88. package/build/ts/crypto/crypto.module.d.ts +3 -0
  89. package/build/ts/crypto/crypto.module.d.ts.map +1 -0
  90. package/build/ts/crypto/crypto.module.js +18 -0
  91. package/build/ts/crypto/crypto.module.js.map +1 -0
  92. package/build/ts/crypto/crypto.service.d.ts +31 -0
  93. package/build/ts/crypto/crypto.service.d.ts.map +1 -0
  94. package/build/ts/crypto/crypto.service.js +68 -0
  95. package/build/ts/crypto/crypto.service.js.map +1 -0
  96. package/build/ts/deployer/__tests__/deployer.controller.test.d.ts +2 -0
  97. package/build/ts/deployer/__tests__/deployer.controller.test.d.ts.map +1 -0
  98. package/build/ts/deployer/__tests__/deployer.controller.test.js +82 -0
  99. package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -0
  100. package/build/ts/deployer/__tests__/deployer.service.test.d.ts +2 -0
  101. package/build/ts/deployer/__tests__/deployer.service.test.d.ts.map +1 -0
  102. package/build/ts/deployer/__tests__/deployer.service.test.js +272 -0
  103. package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -0
  104. package/build/ts/deployer/__tests__/utils.d.ts +61 -0
  105. package/build/ts/deployer/__tests__/utils.d.ts.map +1 -0
  106. package/build/ts/deployer/__tests__/utils.js +122 -0
  107. package/build/ts/deployer/__tests__/utils.js.map +1 -0
  108. package/build/ts/deployer/constants.d.ts +13 -0
  109. package/build/ts/deployer/constants.d.ts.map +1 -0
  110. package/build/ts/deployer/constants.js +13 -0
  111. package/build/ts/deployer/constants.js.map +1 -0
  112. package/build/ts/deployer/deployer.controller.d.ts +34 -0
  113. package/build/ts/deployer/deployer.controller.d.ts.map +1 -0
  114. package/build/ts/deployer/deployer.controller.js +102 -0
  115. package/build/ts/deployer/deployer.controller.js.map +1 -0
  116. package/build/ts/deployer/deployer.module.d.ts +3 -0
  117. package/build/ts/deployer/deployer.module.d.ts.map +1 -0
  118. package/build/ts/deployer/deployer.module.js +23 -0
  119. package/build/ts/deployer/deployer.module.js.map +1 -0
  120. package/build/ts/deployer/deployer.service.d.ts +85 -0
  121. package/build/ts/deployer/deployer.service.d.ts.map +1 -0
  122. package/build/ts/deployer/deployer.service.js +505 -0
  123. package/build/ts/deployer/deployer.service.js.map +1 -0
  124. package/build/ts/deployer/dto.d.ts +46 -0
  125. package/build/ts/deployer/dto.d.ts.map +1 -0
  126. package/build/ts/deployer/dto.js +125 -0
  127. package/build/ts/deployer/dto.js.map +1 -0
  128. package/build/ts/deployer/types.d.ts +351 -0
  129. package/build/ts/deployer/types.d.ts.map +1 -0
  130. package/build/ts/deployer/types.js +2 -0
  131. package/build/ts/deployer/types.js.map +1 -0
  132. package/build/ts/file/__tests__/file.service.test.d.ts +2 -0
  133. package/build/ts/file/__tests__/file.service.test.d.ts.map +1 -0
  134. package/build/ts/file/__tests__/file.service.test.js +77 -0
  135. package/build/ts/file/__tests__/file.service.test.js.map +1 -0
  136. package/build/ts/file/file.module.d.ts +3 -0
  137. package/build/ts/file/file.module.d.ts.map +1 -0
  138. package/build/ts/file/file.module.js +18 -0
  139. package/build/ts/file/file.module.js.map +1 -0
  140. package/build/ts/file/file.service.d.ts +63 -0
  141. package/build/ts/file/file.service.d.ts.map +1 -0
  142. package/build/ts/file/file.service.js +121 -0
  143. package/build/ts/file/file.service.js.map +1 -0
  144. package/build/ts/file/types.d.ts +36 -0
  145. package/build/ts/file/types.d.ts.map +1 -0
  146. package/build/ts/file/types.js +2 -0
  147. package/build/ts/file/types.js.map +1 -0
  148. package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
  149. package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
  150. package/build/ts/health/__tests__/health.controller.test.js +52 -0
  151. package/build/ts/health/__tests__/health.controller.test.js.map +1 -0
  152. package/build/ts/health/__tests__/health.service.test.d.ts +2 -0
  153. package/build/ts/health/__tests__/health.service.test.d.ts.map +1 -0
  154. package/build/ts/health/__tests__/health.service.test.js +101 -0
  155. package/build/ts/health/__tests__/health.service.test.js.map +1 -0
  156. package/build/ts/health/health.controller.d.ts +16 -0
  157. package/build/ts/health/health.controller.d.ts.map +1 -0
  158. package/build/ts/health/health.controller.js +43 -0
  159. package/build/ts/health/health.controller.js.map +1 -0
  160. package/build/ts/health/health.module.d.ts +3 -0
  161. package/build/ts/health/health.module.d.ts.map +1 -0
  162. package/build/ts/health/health.module.js +22 -0
  163. package/build/ts/health/health.module.js.map +1 -0
  164. package/build/ts/health/health.service.d.ts +42 -0
  165. package/build/ts/health/health.service.d.ts.map +1 -0
  166. package/build/ts/health/health.service.js +176 -0
  167. package/build/ts/health/health.service.js.map +1 -0
  168. package/build/ts/health/types.d.ts +87 -0
  169. package/build/ts/health/types.d.ts.map +1 -0
  170. package/build/ts/health/types.js +2 -0
  171. package/build/ts/health/types.js.map +1 -0
  172. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts +11 -0
  173. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts.map +1 -0
  174. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js +12 -0
  175. package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js.map +1 -0
  176. package/build/ts/jest/setup.d.ts +8 -0
  177. package/build/ts/jest/setup.d.ts.map +1 -0
  178. package/build/ts/jest/setup.js +2 -0
  179. package/build/ts/jest/setup.js.map +1 -0
  180. package/build/ts/jest/transform.d.ts +8 -0
  181. package/build/ts/jest/transform.d.ts.map +1 -0
  182. package/build/ts/jest/transform.js +10 -0
  183. package/build/ts/jest/transform.js.map +1 -0
  184. package/build/ts/main.d.ts +2 -0
  185. package/build/ts/main.d.ts.map +1 -0
  186. package/build/ts/main.js +46 -0
  187. package/build/ts/main.js.map +1 -0
  188. package/build/ts/proof/__tests__/proof.controller.test.d.ts +2 -0
  189. package/build/ts/proof/__tests__/proof.controller.test.d.ts.map +1 -0
  190. package/build/ts/proof/__tests__/proof.controller.test.js +90 -0
  191. package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -0
  192. package/build/ts/proof/__tests__/proof.gateway.test.d.ts +2 -0
  193. package/build/ts/proof/__tests__/proof.gateway.test.d.ts.map +1 -0
  194. package/build/ts/proof/__tests__/proof.gateway.test.js +63 -0
  195. package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -0
  196. package/build/ts/proof/__tests__/proof.service.test.d.ts +2 -0
  197. package/build/ts/proof/__tests__/proof.service.test.d.ts.map +1 -0
  198. package/build/ts/proof/__tests__/proof.service.test.js +84 -0
  199. package/build/ts/proof/__tests__/proof.service.test.js.map +1 -0
  200. package/build/ts/proof/dto.d.ts +70 -0
  201. package/build/ts/proof/dto.d.ts.map +1 -0
  202. package/build/ts/proof/dto.js +261 -0
  203. package/build/ts/proof/dto.js.map +1 -0
  204. package/build/ts/proof/proof.controller.d.ts +47 -0
  205. package/build/ts/proof/proof.controller.d.ts.map +1 -0
  206. package/build/ts/proof/proof.controller.js +158 -0
  207. package/build/ts/proof/proof.controller.js.map +1 -0
  208. package/build/ts/proof/proof.gateway.d.ts +35 -0
  209. package/build/ts/proof/proof.gateway.d.ts.map +1 -0
  210. package/build/ts/proof/proof.gateway.js +93 -0
  211. package/build/ts/proof/proof.gateway.js.map +1 -0
  212. package/build/ts/proof/proof.module.d.ts +3 -0
  213. package/build/ts/proof/proof.module.d.ts.map +1 -0
  214. package/build/ts/proof/proof.module.js +25 -0
  215. package/build/ts/proof/proof.module.js.map +1 -0
  216. package/build/ts/proof/proof.service.d.ts +52 -0
  217. package/build/ts/proof/proof.service.d.ts.map +1 -0
  218. package/build/ts/proof/proof.service.js +164 -0
  219. package/build/ts/proof/proof.service.js.map +1 -0
  220. package/build/ts/proof/types.d.ts +144 -0
  221. package/build/ts/proof/types.d.ts.map +1 -0
  222. package/build/ts/proof/types.js +11 -0
  223. package/build/ts/proof/types.js.map +1 -0
  224. package/build/ts/redis/__tests__/redis.service.test.d.ts +2 -0
  225. package/build/ts/redis/__tests__/redis.service.test.d.ts.map +1 -0
  226. package/build/ts/redis/__tests__/redis.service.test.js +148 -0
  227. package/build/ts/redis/__tests__/redis.service.test.js.map +1 -0
  228. package/build/ts/redis/redis.module.d.ts +3 -0
  229. package/build/ts/redis/redis.module.d.ts.map +1 -0
  230. package/build/ts/redis/redis.module.js +18 -0
  231. package/build/ts/redis/redis.module.js.map +1 -0
  232. package/build/ts/redis/redis.service.d.ts +53 -0
  233. package/build/ts/redis/redis.service.d.ts.map +1 -0
  234. package/build/ts/redis/redis.service.js +99 -0
  235. package/build/ts/redis/redis.service.js.map +1 -0
  236. package/build/ts/redis/types.d.ts +66 -0
  237. package/build/ts/redis/types.d.ts.map +1 -0
  238. package/build/ts/redis/types.js +2 -0
  239. package/build/ts/redis/types.js.map +1 -0
  240. package/build/ts/redis/utils.d.ts +20 -0
  241. package/build/ts/redis/utils.d.ts.map +1 -0
  242. package/build/ts/redis/utils.js +27 -0
  243. package/build/ts/redis/utils.js.map +1 -0
  244. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts +2 -0
  245. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts.map +1 -0
  246. package/build/ts/scheduler/__tests__/scheduler.controller.test.js +62 -0
  247. package/build/ts/scheduler/__tests__/scheduler.controller.test.js.map +1 -0
  248. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts +2 -0
  249. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts.map +1 -0
  250. package/build/ts/scheduler/__tests__/scheduler.service.test.js +369 -0
  251. package/build/ts/scheduler/__tests__/scheduler.service.test.js.map +1 -0
  252. package/build/ts/scheduler/dto.d.ts +41 -0
  253. package/build/ts/scheduler/dto.d.ts.map +1 -0
  254. package/build/ts/scheduler/dto.js +115 -0
  255. package/build/ts/scheduler/dto.js.map +1 -0
  256. package/build/ts/scheduler/scheduler.controller.d.ts +32 -0
  257. package/build/ts/scheduler/scheduler.controller.d.ts.map +1 -0
  258. package/build/ts/scheduler/scheduler.controller.js +118 -0
  259. package/build/ts/scheduler/scheduler.controller.js.map +1 -0
  260. package/build/ts/scheduler/scheduler.module.d.ts +3 -0
  261. package/build/ts/scheduler/scheduler.module.d.ts.map +1 -0
  262. package/build/ts/scheduler/scheduler.module.js +24 -0
  263. package/build/ts/scheduler/scheduler.module.js.map +1 -0
  264. package/build/ts/scheduler/scheduler.service.d.ts +71 -0
  265. package/build/ts/scheduler/scheduler.service.d.ts.map +1 -0
  266. package/build/ts/scheduler/scheduler.service.js +297 -0
  267. package/build/ts/scheduler/scheduler.service.js.map +1 -0
  268. package/build/ts/scheduler/types.d.ts +65 -0
  269. package/build/ts/scheduler/types.d.ts.map +1 -0
  270. package/build/ts/scheduler/types.js +2 -0
  271. package/build/ts/scheduler/types.js.map +1 -0
  272. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts +2 -0
  273. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts.map +1 -0
  274. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +44 -0
  275. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -0
  276. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts +2 -0
  277. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts.map +1 -0
  278. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +76 -0
  279. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -0
  280. package/build/ts/sessionKeys/__tests__/utils.d.ts +25 -0
  281. package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -0
  282. package/build/ts/sessionKeys/__tests__/utils.js +65 -0
  283. package/build/ts/sessionKeys/__tests__/utils.js.map +1 -0
  284. package/build/ts/sessionKeys/dto.d.ts +11 -0
  285. package/build/ts/sessionKeys/dto.d.ts.map +1 -0
  286. package/build/ts/sessionKeys/dto.js +29 -0
  287. package/build/ts/sessionKeys/dto.js.map +1 -0
  288. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
  289. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
  290. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
  291. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
  292. package/build/ts/sessionKeys/sessionKeys.controller.d.ts +26 -0
  293. package/build/ts/sessionKeys/sessionKeys.controller.d.ts.map +1 -0
  294. package/build/ts/sessionKeys/sessionKeys.controller.js +74 -0
  295. package/build/ts/sessionKeys/sessionKeys.controller.js.map +1 -0
  296. package/build/ts/sessionKeys/sessionKeys.module.d.ts +3 -0
  297. package/build/ts/sessionKeys/sessionKeys.module.d.ts.map +1 -0
  298. package/build/ts/sessionKeys/sessionKeys.module.js +23 -0
  299. package/build/ts/sessionKeys/sessionKeys.module.js.map +1 -0
  300. package/build/ts/sessionKeys/sessionKeys.service.d.ts +62 -0
  301. package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -0
  302. package/build/ts/sessionKeys/sessionKeys.service.js +121 -0
  303. package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -0
  304. package/build/ts/sessionKeys/types.d.ts +11 -0
  305. package/build/ts/sessionKeys/types.d.ts.map +1 -0
  306. package/build/ts/sessionKeys/types.js +2 -0
  307. package/build/ts/sessionKeys/types.js.map +1 -0
  308. package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts +2 -0
  309. package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts.map +1 -0
  310. package/build/ts/subgraph/__tests__/subgraph.controller.test.js +50 -0
  311. package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -0
  312. package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts +2 -0
  313. package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts.map +1 -0
  314. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +83 -0
  315. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -0
  316. package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts +2 -0
  317. package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts.map +1 -0
  318. package/build/ts/subgraph/__tests__/subgraph.service.test.js +58 -0
  319. package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -0
  320. package/build/ts/subgraph/dto.d.ts +27 -0
  321. package/build/ts/subgraph/dto.d.ts.map +1 -0
  322. package/build/ts/subgraph/dto.js +83 -0
  323. package/build/ts/subgraph/dto.js.map +1 -0
  324. package/build/ts/subgraph/subgraph.controller.d.ts +24 -0
  325. package/build/ts/subgraph/subgraph.controller.d.ts.map +1 -0
  326. package/build/ts/subgraph/subgraph.controller.js +71 -0
  327. package/build/ts/subgraph/subgraph.controller.js.map +1 -0
  328. package/build/ts/subgraph/subgraph.gateway.d.ts +35 -0
  329. package/build/ts/subgraph/subgraph.gateway.d.ts.map +1 -0
  330. package/build/ts/subgraph/subgraph.gateway.js +93 -0
  331. package/build/ts/subgraph/subgraph.gateway.js.map +1 -0
  332. package/build/ts/subgraph/subgraph.module.d.ts +3 -0
  333. package/build/ts/subgraph/subgraph.module.d.ts.map +1 -0
  334. package/build/ts/subgraph/subgraph.module.js +23 -0
  335. package/build/ts/subgraph/subgraph.module.js.map +1 -0
  336. package/build/ts/subgraph/subgraph.service.d.ts +24 -0
  337. package/build/ts/subgraph/subgraph.service.d.ts.map +1 -0
  338. package/build/ts/subgraph/subgraph.service.js +119 -0
  339. package/build/ts/subgraph/subgraph.service.js.map +1 -0
  340. package/build/ts/subgraph/types.d.ts +93 -0
  341. package/build/ts/subgraph/types.d.ts.map +1 -0
  342. package/build/ts/subgraph/types.js +24 -0
  343. package/build/ts/subgraph/types.js.map +1 -0
  344. package/build/tsconfig.build.tsbuildinfo +1 -0
  345. package/package.json +131 -0
@@ -0,0 +1,44 @@
1
+ import { Test } from "@nestjs/testing";
2
+ import { zeroAddress } from "viem";
3
+ import { SessionKeysController } from "../sessionKeys.controller";
4
+ import { SessionKeysService } from "../sessionKeys.service";
5
+ describe("SessionKeysController", () => {
6
+ let sessionKeysController;
7
+ const mockSessionKeysService = {
8
+ generateSessionKey: jest.fn(),
9
+ deactivateSessionKey: jest.fn(),
10
+ };
11
+ const defaultGenerateSessionKeyReturn = {
12
+ sessionKeyAddress: zeroAddress,
13
+ };
14
+ beforeEach(async () => {
15
+ const app = await Test.createTestingModule({
16
+ controllers: [SessionKeysController],
17
+ })
18
+ .useMocker((token) => {
19
+ if (token === SessionKeysService) {
20
+ mockSessionKeysService.generateSessionKey.mockResolvedValue(defaultGenerateSessionKeyReturn);
21
+ return mockSessionKeysService;
22
+ }
23
+ return jest.fn();
24
+ })
25
+ .compile();
26
+ sessionKeysController = app.get(SessionKeysController);
27
+ });
28
+ afterEach(() => {
29
+ jest.clearAllMocks();
30
+ });
31
+ describe("v1/session-keys/generate", () => {
32
+ test("should return a session key address", async () => {
33
+ const data = await sessionKeysController.generateSessionKey();
34
+ expect(data).toStrictEqual(defaultGenerateSessionKeyReturn);
35
+ });
36
+ });
37
+ describe("v1/session-keys/delete", () => {
38
+ test("should delete a session key", () => {
39
+ sessionKeysController.deactivateSessionKey({ sessionKeyAddress: zeroAddress });
40
+ expect(mockSessionKeysService.deactivateSessionKey).toHaveBeenCalledWith(zeroAddress);
41
+ });
42
+ });
43
+ });
44
+ //# sourceMappingURL=sessionKeys.controller.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionKeys.controller.test.js","sourceRoot":"","sources":["../../../../ts/sessionKeys/__tests__/sessionKeys.controller.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAInC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,IAAI,qBAA4C,CAAC;IAEjD,MAAM,sBAAsB,GAAG;QAC7B,kBAAkB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC7B,oBAAoB,EAAE,IAAI,CAAC,EAAE,EAAE;KAChC,CAAC;IAEF,MAAM,+BAA+B,GAA8B;QACjE,iBAAiB,EAAE,WAAW;KAC/B,CAAC;IAEF,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC;YACzC,WAAW,EAAE,CAAC,qBAAqB,CAAC;SACrC,CAAC;aACC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YACnB,IAAI,KAAK,KAAK,kBAAkB,EAAE,CAAC;gBACjC,sBAAsB,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,+BAA+B,CAAC,CAAC;gBAC7F,OAAO,sBAAsB,CAAC;YAChC,CAAC;YAED,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC;QACnB,CAAC,CAAC;aACD,OAAO,EAAE,CAAC;QAEb,qBAAqB,GAAG,GAAG,CAAC,GAAG,CAAwB,qBAAqB,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACxC,IAAI,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;YACrD,MAAM,IAAI,GAAG,MAAM,qBAAqB,CAAC,kBAAkB,EAAE,CAAC;YAC9D,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,+BAA+B,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACvC,qBAAqB,CAAC,oBAAoB,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC,CAAC;YAC/E,MAAM,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;QACxF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sessionKeys.service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionKeys.service.test.d.ts","sourceRoot":"","sources":["../../../../ts/sessionKeys/__tests__/sessionKeys.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,76 @@
1
+ import { ESupportedChains } from "@maci-protocol/sdk";
2
+ import { createKernelAccount, createKernelAccountClient } from "@zerodev/sdk";
3
+ import dotenv from "dotenv";
4
+ import { zeroAddress } from "viem";
5
+ import { ErrorCodes } from "../../common";
6
+ import { FileService } from "../../file/file.service";
7
+ import { SessionKeysService } from "../sessionKeys.service";
8
+ import { generateApproval } from "./utils";
9
+ dotenv.config();
10
+ jest.mock("@zerodev/sdk", () => ({
11
+ ...jest.requireActual("@zerodev/sdk"),
12
+ createKernelAccount: jest.fn(),
13
+ createKernelAccountClient: jest.fn(),
14
+ }));
15
+ jest.mock("@zerodev/permissions", () => ({
16
+ ...jest.requireActual("@zerodev/permissions"),
17
+ serializePermissionAccount: jest.fn().mockResolvedValue("approval"),
18
+ deserializePermissionAccount: jest.fn().mockResolvedValue({}),
19
+ }));
20
+ describe("SessionKeysService", () => {
21
+ const fileService = new FileService();
22
+ const mockedKernelAccount = { mockedAccount: true };
23
+ const mockedKernelAccountClient = { mockedAccountClient: true };
24
+ beforeEach(() => {
25
+ createKernelAccount.mockResolvedValue(mockedKernelAccount);
26
+ createKernelAccountClient.mockResolvedValue(mockedKernelAccountClient);
27
+ });
28
+ afterEach(() => {
29
+ jest.clearAllMocks();
30
+ });
31
+ describe("generateSessionKey", () => {
32
+ test("should generate and store a session key", async () => {
33
+ const sessionKeysService = new SessionKeysService(fileService);
34
+ const sessionKeyAddress = await sessionKeysService.generateSessionKey();
35
+ expect(sessionKeyAddress).toBeDefined();
36
+ expect(sessionKeyAddress).not.toEqual(zeroAddress);
37
+ const sessionKey = fileService.getSessionKey(sessionKeyAddress.sessionKeyAddress);
38
+ expect(sessionKey).toBeDefined();
39
+ });
40
+ });
41
+ describe("deactivateSessionKey", () => {
42
+ test("should delete a session key", async () => {
43
+ const sessionKeysService = new SessionKeysService(fileService);
44
+ const sessionKeyAddress = await sessionKeysService.generateSessionKey();
45
+ expect(sessionKeyAddress).toBeDefined();
46
+ expect(sessionKeyAddress).not.toEqual(zeroAddress);
47
+ const sessionKey = fileService.getSessionKey(sessionKeyAddress.sessionKeyAddress);
48
+ expect(sessionKey).toBeDefined();
49
+ sessionKeysService.deactivateSessionKey(sessionKeyAddress.sessionKeyAddress);
50
+ const sessionKeyDeleted = fileService.getSessionKey(sessionKeyAddress.sessionKeyAddress);
51
+ expect(sessionKeyDeleted).toBeUndefined();
52
+ });
53
+ });
54
+ describe("generateClientFromSessionKey", () => {
55
+ test("should fail to generate a client with an invalid approval", async () => {
56
+ createKernelAccountClient.mockRejectedValue(new Error());
57
+ const sessionKeysService = new SessionKeysService(fileService);
58
+ const sessionKeyAddress = await sessionKeysService.generateSessionKey();
59
+ await expect(sessionKeysService.generateClientFromSessionKey(sessionKeyAddress.sessionKeyAddress, "0xinvalid", ESupportedChains.OptimismSepolia)).rejects.toThrow(ErrorCodes.INVALID_APPROVAL.toString());
60
+ });
61
+ test("should throw when given a non existent session key address", async () => {
62
+ const sessionKeysService = new SessionKeysService(fileService);
63
+ const approval = await generateApproval(zeroAddress);
64
+ await expect(sessionKeysService.generateClientFromSessionKey(zeroAddress, approval, ESupportedChains.OptimismSepolia)).rejects.toThrow(ErrorCodes.SESSION_KEY_NOT_FOUND.toString());
65
+ });
66
+ test("should generate a client from a session key", async () => {
67
+ const sessionKeysService = new SessionKeysService(fileService);
68
+ const { sessionKeyAddress } = await sessionKeysService.generateSessionKey();
69
+ const approval = await generateApproval(sessionKeyAddress);
70
+ const client = await sessionKeysService.generateClientFromSessionKey(sessionKeyAddress, approval, ESupportedChains.OptimismSepolia);
71
+ expect(createKernelAccountClient).toHaveBeenCalledTimes(1);
72
+ expect(client).toEqual(mockedKernelAccountClient);
73
+ });
74
+ });
75
+ });
76
+ //# sourceMappingURL=sessionKeys.service.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionKeys.service.test.js","sourceRoot":"","sources":["../../../../ts/sessionKeys/__tests__/sessionKeys.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,C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AC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YAC3D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type Policy } from "@zerodev/permissions";
2
+ import { type CreateKernelAccountReturnType } from "@zerodev/sdk";
3
+ import { type Hex } from "viem";
4
+ export declare const ENTRY_POINT: import("@zerodev/sdk/types").EntryPointType<"0.7">;
5
+ export declare const KERNEL_VERSION: import("@zerodev/sdk/types").KERNEL_V3_VERSION_TYPE;
6
+ /**
7
+ * Generate a timestamp policy
8
+ * @param endTime - The end time of the policy
9
+ * @param start - The start time of the policy
10
+ * @returns The timestamp policy
11
+ */
12
+ export declare const generateTimestampPolicy: (endTime: number, start?: number) => Policy;
13
+ /**
14
+ * Get smart contract kernel account
15
+ * @param sessionKeyAddress - the session key address
16
+ * @returns - the kernel account
17
+ */
18
+ export declare const getKernelAccount: (sessionKeyAddress: Hex) => Promise<CreateKernelAccountReturnType>;
19
+ /**
20
+ * Generate an approval for a session key
21
+ * @param sessionKeyAddress - the session key address
22
+ * @returns - the approval
23
+ */
24
+ export declare const generateApproval: (sessionKeyAddress: Hex) => Promise<string>;
25
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../ts/sessionKeys/__tests__/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAqD,MAAM,sBAAsB,CAAC;AAGtG,OAAO,EAA8C,KAAK,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAG9G,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAQhC,eAAO,MAAM,WAAW,oDAAuB,CAAC;AAChD,eAAO,MAAM,cAAc,qDAAc,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,MAAM,EAAE,QAAQ,MAAM,KAAG,MAItE,CAAC;AAEL;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAU,mBAAmB,GAAG,KAAG,OAAO,CAAC,6BAA6B,CA6BpG,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAU,mBAAmB,GAAG,KAAG,OAAO,CAAC,MAAM,CAG7E,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { ESupportedChains } from "@maci-protocol/sdk";
2
+ import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator";
3
+ import { serializePermissionAccount, toPermissionValidator } from "@zerodev/permissions";
4
+ import { toSudoPolicy, toTimestampPolicy } from "@zerodev/permissions/policies";
5
+ import { toECDSASigner } from "@zerodev/permissions/signers";
6
+ import { addressToEmptyAccount, createKernelAccount } from "@zerodev/sdk";
7
+ import { getEntryPoint, KERNEL_V3_1 } from "@zerodev/sdk/constants";
8
+ import dotenv from "dotenv";
9
+ import { privateKeyToAccount } from "viem/accounts";
10
+ import { getPublicClient } from "../../common/accountAbstraction";
11
+ import { getWallet } from "../../common/chain";
12
+ dotenv.config();
13
+ export const ENTRY_POINT = getEntryPoint("0.7");
14
+ export const KERNEL_VERSION = KERNEL_V3_1;
15
+ /**
16
+ * Generate a timestamp policy
17
+ * @param endTime - The end time of the policy
18
+ * @param start - The start time of the policy
19
+ * @returns The timestamp policy
20
+ */
21
+ export const generateTimestampPolicy = (endTime, start) => toTimestampPolicy({
22
+ validAfter: start,
23
+ validUntil: endTime,
24
+ });
25
+ /**
26
+ * Get smart contract kernel account
27
+ * @param sessionKeyAddress - the session key address
28
+ * @returns - the kernel account
29
+ */
30
+ export const getKernelAccount = async (sessionKeyAddress) => {
31
+ const publicClient = await getPublicClient(ESupportedChains.Localhost);
32
+ const wallet = getWallet();
33
+ const sessionKeySigner = privateKeyToAccount(wallet.privateKey);
34
+ const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
35
+ signer: sessionKeySigner,
36
+ entryPoint: ENTRY_POINT,
37
+ kernelVersion: KERNEL_VERSION,
38
+ });
39
+ const emptyAccount = addressToEmptyAccount(sessionKeyAddress);
40
+ const emptySessionKeySigner = await toECDSASigner({ signer: emptyAccount });
41
+ const permissionPlugin = await toPermissionValidator(publicClient, {
42
+ entryPoint: ENTRY_POINT,
43
+ kernelVersion: KERNEL_VERSION,
44
+ signer: emptySessionKeySigner,
45
+ policies: [toSudoPolicy({})],
46
+ });
47
+ return await createKernelAccount(publicClient, {
48
+ entryPoint: ENTRY_POINT,
49
+ kernelVersion: KERNEL_VERSION,
50
+ plugins: {
51
+ sudo: ecdsaValidator,
52
+ regular: permissionPlugin,
53
+ },
54
+ });
55
+ };
56
+ /**
57
+ * Generate an approval for a session key
58
+ * @param sessionKeyAddress - the session key address
59
+ * @returns - the approval
60
+ */
61
+ export const generateApproval = async (sessionKeyAddress) => {
62
+ const sessionKeyAccount = await getKernelAccount(sessionKeyAddress);
63
+ return await serializePermissionAccount(sessionKeyAccount);
64
+ };
65
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../ts/sessionKeys/__tests__/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAe,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACtG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAsC,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OA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AC,CAAC;KAC7B,CAAC,CAAC;IAEH,OAAO,MAAM,mBAAmB,CAAC,YAAY,EAAE;QAC7C,UAAU,EAAE,WAAW;QACvB,aAAa,EAAE,cAAc;QAC7B,OAAO,EAAE;YACP,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,gBAAgB;SAC1B;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,iBAAsB,EAAmB,EAAE;IAChF,MAAM,iBAAiB,GAAG,MAAM,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IACpE,OAAO,MAAM,0BAA0B,CAAC,iBAAiB,CAAC,CAAC;AAC7D,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Hex } from "viem";
2
+ /**
3
+ * Data transfer object for Deactivate session key
4
+ */
5
+ export declare class DeactivateSessionKeyDto {
6
+ /**
7
+ * Session key address
8
+ */
9
+ sessionKeyAddress: Hex;
10
+ }
11
+ //# sourceMappingURL=dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.d.ts","sourceRoot":"","sources":["../../../ts/sessionKeys/dto.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC;;GAEG;AACH,qBAAa,uBAAuB;IAClC;;OAEG;IAMH,iBAAiB,EAAG,GAAG,CAAC;CACzB"}
@@ -0,0 +1,29 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { ApiProperty } from "@nestjs/swagger";
11
+ import { IsEthereumAddress } from "class-validator";
12
+ /**
13
+ * Data transfer object for Deactivate session key
14
+ */
15
+ export class DeactivateSessionKeyDto {
16
+ /**
17
+ * Session key address
18
+ */
19
+ sessionKeyAddress;
20
+ }
21
+ __decorate([
22
+ ApiProperty({
23
+ description: "Session key address",
24
+ type: String,
25
+ }),
26
+ IsEthereumAddress(),
27
+ __metadata("design:type", String)
28
+ ], DeactivateSessionKeyDto.prototype, "sessionKeyAddress", void 0);
29
+ //# sourceMappingURL=dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.js","sourceRoot":"","sources":["../../../ts/sessionKeys/dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIpD;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAClC;;OAEG;IAMH,iBAAiB,CAAO;CACzB;AADC;IALC,WAAW,CAAC;QACX,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,MAAM;KACb,CAAC;IACD,iBAAiB,EAAE;;kEACI"}
@@ -0,0 +1,53 @@
1
+ import { type KernelAccountClient } from "@zerodev/sdk";
2
+ import { encodeFunctionData } from "viem";
3
+ import { EventEmitter } from "events";
4
+ import type { EIP1193Parameters, EIP1193RequestFn, Hex } from "viem";
5
+ export declare const SafeCreateCallAbi: readonly [{
6
+ readonly name: "performCreate";
7
+ readonly type: "function";
8
+ readonly stateMutability: "nonpayable";
9
+ readonly inputs: readonly [{
10
+ readonly type: "uint256";
11
+ readonly name: "value";
12
+ }, {
13
+ readonly type: "bytes";
14
+ readonly name: "deploymentData";
15
+ }];
16
+ readonly outputs: readonly [{
17
+ readonly type: "address";
18
+ readonly name: "newContract";
19
+ }];
20
+ }, {
21
+ readonly name: "performCreate2";
22
+ readonly type: "function";
23
+ readonly stateMutability: "nonpayable";
24
+ readonly inputs: readonly [{
25
+ readonly type: "uint256";
26
+ readonly name: "value";
27
+ }, {
28
+ readonly type: "bytes";
29
+ readonly name: "deploymentData";
30
+ }, {
31
+ readonly type: "bytes32";
32
+ readonly name: "salt";
33
+ }];
34
+ readonly outputs: readonly [{
35
+ readonly type: "address";
36
+ readonly name: "newContract";
37
+ }];
38
+ }];
39
+ type EncodeExecuteDelegateCallArgs = Parameters<typeof encodeFunctionData<typeof SafeCreateCallAbi, "performCreate">>[0]["args"];
40
+ export declare const encodeSafeCreateCall: (args: EncodeExecuteDelegateCallArgs) => Hex;
41
+ export declare class KernelEIP1193Provider extends EventEmitter {
42
+ private kernelClient;
43
+ constructor(kernelClient: KernelAccountClient);
44
+ request({ method, params }: EIP1193Parameters): ReturnType<EIP1193RequestFn>;
45
+ private handleEthRequestAccounts;
46
+ private handleEthAccounts;
47
+ private handleEthSendTransaction;
48
+ private handleEthSign;
49
+ private handlePersonalSign;
50
+ private handleEthSignTypedDataV4;
51
+ }
52
+ export {};
53
+ //# sourceMappingURL=KernelEIP1193Provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KernelEIP1193Provider.d.ts","sourceRoot":"","sources":["../../../../ts/sessionKeys/provider/KernelEIP1193Provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAY,MAAM,MAAM,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAQ,GAAG,EAA8C,MAAM,MAAM,CAAC;AAEvH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG5B,CAAC;AAEH,KAAK,6BAA6B,GAAG,UAAU,CAC7C,OAAO,kBAAkB,CAAC,OAAO,iBAAiB,EAAE,eAAe,CAAC,CACrE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEb,eAAO,MAAM,oBAAoB,GAAI,MAAM,6BAA6B,KAAG,GAKvE,CAAC;AAEL,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,OAAO,CAAC,YAAY,CAAsB;gBAE9B,YAAY,EAAE,mBAAmB;IAKvC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAW,EAAE,EAAE,iBAAiB,GAAG,UAAU,CAAC,gBAAgB,CAAC;IAoBvF,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,iBAAiB;YAQX,wBAAwB;YAexB,aAAa;YAiBb,kBAAkB;YAiBlB,wBAAwB;CA0BvC"}
@@ -0,0 +1,105 @@
1
+ import { safeCreateCallAddress } from "@zerodev/sdk/constants";
2
+ import { encodeFunctionData, parseAbi } from "viem";
3
+ import { EventEmitter } from "events";
4
+ export const SafeCreateCallAbi = parseAbi([
5
+ "function performCreate(uint256 value, bytes memory deploymentData) public returns (address newContract)",
6
+ "function performCreate2(uint256 value, bytes memory deploymentData, bytes32 salt) public returns (address newContract)",
7
+ ]);
8
+ export const encodeSafeCreateCall = (args) => encodeFunctionData({
9
+ abi: SafeCreateCallAbi,
10
+ functionName: "performCreate",
11
+ args,
12
+ });
13
+ export class KernelEIP1193Provider extends EventEmitter {
14
+ kernelClient;
15
+ constructor(kernelClient) {
16
+ super();
17
+ this.kernelClient = kernelClient;
18
+ }
19
+ async request({ method, params = [] }) {
20
+ switch (method) {
21
+ case "eth_requestAccounts":
22
+ return this.handleEthRequestAccounts();
23
+ case "eth_accounts":
24
+ return this.handleEthAccounts();
25
+ case "eth_sendTransaction":
26
+ return this.handleEthSendTransaction(params);
27
+ case "eth_sign":
28
+ return this.handleEthSign(params);
29
+ case "personal_sign":
30
+ return this.handlePersonalSign(params);
31
+ case "eth_signTypedData":
32
+ case "eth_signTypedData_v4":
33
+ return this.handleEthSignTypedDataV4(params);
34
+ default:
35
+ return this.kernelClient.transport.request({ method, params });
36
+ }
37
+ }
38
+ handleEthRequestAccounts() {
39
+ if (!this.kernelClient.account) {
40
+ return [];
41
+ }
42
+ return [this.kernelClient.account.address];
43
+ }
44
+ handleEthAccounts() {
45
+ if (!this.kernelClient.account) {
46
+ return [];
47
+ }
48
+ return [this.kernelClient.account.address];
49
+ }
50
+ async handleEthSendTransaction(params) {
51
+ const [tx] = params;
52
+ if (!("to" in tx) && tx.data) {
53
+ // contract deployment
54
+ tx.data = encodeSafeCreateCall([0n, tx.data]);
55
+ tx.to = safeCreateCallAddress;
56
+ return this.kernelClient.sendTransaction(tx);
57
+ }
58
+ // eth transaction (function call or eth transfer)
59
+ return this.kernelClient.sendTransaction(tx);
60
+ }
61
+ async handleEthSign(params) {
62
+ if (!this.kernelClient.account) {
63
+ throw new Error("account not connected!");
64
+ }
65
+ const [address, message] = params;
66
+ if (address.toLowerCase() !== this.kernelClient.account.address.toLowerCase()) {
67
+ throw new Error("cannot sign for address that is not the current account");
68
+ }
69
+ return this.kernelClient.signMessage({
70
+ message,
71
+ account: this.kernelClient.account,
72
+ });
73
+ }
74
+ async handlePersonalSign(params) {
75
+ if (!this.kernelClient.account) {
76
+ throw new Error("account not connected!");
77
+ }
78
+ const [message, address] = params;
79
+ if (address.toLowerCase() !== this.kernelClient.account.address.toLowerCase()) {
80
+ throw new Error("cannot sign for address that is not the current account");
81
+ }
82
+ return this.kernelClient.signMessage({
83
+ message,
84
+ account: this.kernelClient.account,
85
+ });
86
+ }
87
+ async handleEthSignTypedDataV4(params) {
88
+ if (!this.kernelClient.account) {
89
+ throw new Error("account not connected!");
90
+ }
91
+ const [address, typedDataJSON] = params;
92
+ const typedData = JSON.parse(typedDataJSON);
93
+ if (address.toLowerCase() !== this.kernelClient.account.address.toLowerCase()) {
94
+ throw new Error("cannot sign for address that is not the current account");
95
+ }
96
+ return this.kernelClient.signTypedData({
97
+ account: this.kernelClient.account,
98
+ domain: typedData.domain,
99
+ types: typedData.types,
100
+ message: typedData.message,
101
+ primaryType: typedData.primaryType,
102
+ });
103
+ }
104
+ }
105
+ //# sourceMappingURL=KernelEIP1193Provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KernelEIP1193Provider.js","sourceRoot":"","sources":["../../../../ts/sessionKeys/provider/KernelEIP1193Provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACxC,yGAAyG;IACzG,wHAAwH;CACzH,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAmC,EAAO,EAAE,CAC/E,kBAAkB,CAAC;IACjB,GAAG,EAAE,iBAAiB;IACtB,YAAY,EAAE,eAAe;IAC7B,IAAI;CACL,CAAC,CAAC;AAEL,MAAM,OAAO,qBAAsB,SAAQ,YAAY;IAC7C,YAAY,CAAsB;IAE1C,YAAY,YAAiC;QAC3C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,EAAqB;QACtD,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,qBAAqB;gBACxB,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC;YACzC,KAAK,cAAc;gBACjB,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAClC,KAAK,qBAAqB;gBACxB,OAAO,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;YAC/C,KAAK,UAAU;gBACb,OAAO,IAAI,CAAC,aAAa,CAA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AC5C,CAAC;QAED,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,MAAM,CAAC;QAExC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAKzC,CAAC;QAEF,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;YAC9E,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;YACrC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;YAClC,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,WAAW,EAAE,SAAS,CAAC,WAAW;SACnC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,26 @@
1
+ import type { IGenerateSessionKeyReturn } from "./types";
2
+ import { DeactivateSessionKeyDto } from "./dto";
3
+ import { SessionKeysService } from "./sessionKeys.service";
4
+ export declare class SessionKeysController {
5
+ private readonly sessionKeysService;
6
+ /**
7
+ * Initialize SessionKeysController
8
+ *
9
+ * @param sessionKeysService - session keys service
10
+ */
11
+ constructor(sessionKeysService: SessionKeysService);
12
+ /**
13
+ * Generate a session key api method
14
+ *
15
+ * @returns generated session key address
16
+ */
17
+ generateSessionKey(): Promise<IGenerateSessionKeyReturn>;
18
+ /**
19
+ * Delete a session key api method
20
+ *
21
+ * @param args - delete session key dto
22
+ * @returns deleted session key address
23
+ */
24
+ deactivateSessionKey(args: DeactivateSessionKeyDto): void;
25
+ }
26
+ //# sourceMappingURL=sessionKeys.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionKeys.controller.d.ts","sourceRoot":"","sources":["../../../ts/sessionKeys/sessionKeys.controller.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAIzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,qBAIa,qBAAqB;IAMpB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAL/C;;;;OAIG;gBAC0B,kBAAkB,EAAE,kBAAkB;IAEnE;;;;OAIG;IAKG,kBAAkB,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAI9D;;;;;OAKG;IAMH,oBAAoB,CAAS,IAAI,EAAE,uBAAuB,GAAG,IAAI;CAGlE"}
@@ -0,0 +1,74 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Body, Controller, Delete, Get, HttpStatus, UseGuards } from "@nestjs/common";
14
+ import { ApiBearerAuth, ApiBody, ApiResponse, ApiTags } from "@nestjs/swagger";
15
+ import { AccountSignatureGuard } from "../auth/AccountSignatureGuard.service";
16
+ import { DeactivateSessionKeyDto } from "./dto";
17
+ import { SessionKeysService } from "./sessionKeys.service";
18
+ let SessionKeysController = class SessionKeysController {
19
+ sessionKeysService;
20
+ /**
21
+ * Initialize SessionKeysController
22
+ *
23
+ * @param sessionKeysService - session keys service
24
+ */
25
+ constructor(sessionKeysService) {
26
+ this.sessionKeysService = sessionKeysService;
27
+ }
28
+ /**
29
+ * Generate a session key api method
30
+ *
31
+ * @returns generated session key address
32
+ */
33
+ async generateSessionKey() {
34
+ return this.sessionKeysService.generateSessionKey();
35
+ }
36
+ /**
37
+ * Delete a session key api method
38
+ *
39
+ * @param args - delete session key dto
40
+ * @returns deleted session key address
41
+ */
42
+ deactivateSessionKey(args) {
43
+ this.sessionKeysService.deactivateSessionKey(args.sessionKeyAddress);
44
+ }
45
+ };
46
+ __decorate([
47
+ ApiResponse({ status: HttpStatus.OK, description: "The session key was successfully generated" }),
48
+ ApiResponse({ status: HttpStatus.FORBIDDEN, description: "Forbidden" }),
49
+ ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "BadRequest" }),
50
+ Get("generate"),
51
+ __metadata("design:type", Function),
52
+ __metadata("design:paramtypes", []),
53
+ __metadata("design:returntype", Promise)
54
+ ], SessionKeysController.prototype, "generateSessionKey", null);
55
+ __decorate([
56
+ ApiBody({ type: DeactivateSessionKeyDto }),
57
+ ApiResponse({ status: HttpStatus.CREATED, description: "The session key was successfully deactivated" }),
58
+ ApiResponse({ status: HttpStatus.FORBIDDEN, description: "Forbidden" }),
59
+ ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "BadRequest" }),
60
+ Delete("delete"),
61
+ __param(0, Body()),
62
+ __metadata("design:type", Function),
63
+ __metadata("design:paramtypes", [DeactivateSessionKeyDto]),
64
+ __metadata("design:returntype", void 0)
65
+ ], SessionKeysController.prototype, "deactivateSessionKey", null);
66
+ SessionKeysController = __decorate([
67
+ ApiTags("v1/session-keys"),
68
+ ApiBearerAuth(),
69
+ Controller("v1/session-keys"),
70
+ UseGuards(AccountSignatureGuard),
71
+ __metadata("design:paramtypes", [SessionKeysService])
72
+ ], SessionKeysController);
73
+ export { SessionKeysController };
74
+ //# sourceMappingURL=sessionKeys.controller.js.map
@@ -0,0 +1 @@
1
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B,EAAE,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;IACxG,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IACvE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;IAC1E,MAAM,CAAC,QAAQ,CAAC;IACK,WAAA,IAAI,EAAE,CAAA;;qCAAO,uBAAuB;;iEAEzD;AAlCU,qBAAqB;IAJjC,OAAO,CAAC,iBAAiB,CAAC;IAC1B,aAAa,EAAE;IACf,UAAU,CAAC,iBAAiB,CAAC;IAC7B,SAAS,CAAC,qBAAqB,CAAC;qCAOkB,kBAAkB;GANxD,qBAAqB,CAmCjC"}
@@ -0,0 +1,3 @@
1
+ export declare class SessionKeysModule {
2
+ }
3
+ //# sourceMappingURL=sessionKeys.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionKeys.module.d.ts","sourceRoot":"","sources":["../../../ts/sessionKeys/sessionKeys.module.ts"],"names":[],"mappings":"AAQA,qBAMa,iBAAiB;CAAG"}
@@ -0,0 +1,23 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Module } from "@nestjs/common";
8
+ import { CryptoService } from "../crypto/crypto.service";
9
+ import { FileModule } from "../file/file.module";
10
+ import { SessionKeysController } from "./sessionKeys.controller";
11
+ import { SessionKeysService } from "./sessionKeys.service";
12
+ let SessionKeysModule = class SessionKeysModule {
13
+ };
14
+ SessionKeysModule = __decorate([
15
+ Module({
16
+ imports: [FileModule],
17
+ controllers: [SessionKeysController],
18
+ providers: [SessionKeysService, CryptoService],
19
+ exports: [SessionKeysService],
20
+ })
21
+ ], SessionKeysModule);
22
+ export { SessionKeysModule };
23
+ //# sourceMappingURL=sessionKeys.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionKeys.module.js","sourceRoot":"","sources":["../../../ts/sessionKeys/sessionKeys.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQpD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,iBAAiB;IAN7B,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,UAAU,CAAC;QACrB,WAAW,EAAE,CAAC,qBAAqB,CAAC;QACpC,SAAS,EAAE,CAAC,kBAAkB,EAAE,aAAa,CAAC;QAC9C,OAAO,EAAE,CAAC,kBAAkB,CAAC;KAC9B,CAAC;GACW,iBAAiB,CAAG"}