@maci-protocol/coordinator 0.0.0-ci.533e19d

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 (257) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/LICENSE +22 -0
  3. package/README.md +42 -0
  4. package/build/hardhat.config.cjs +31 -0
  5. package/build/hardhat.config.cjs.map +1 -0
  6. package/build/hardhat.config.d.cts +24 -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 +8 -0
  21. package/build/tests/constants.d.ts.map +1 -0
  22. package/build/tests/constants.js +10 -0
  23. package/build/tests/constants.js.map +1 -0
  24. package/build/tests/e2e.aa.test.d.ts +2 -0
  25. package/build/tests/e2e.aa.test.d.ts.map +1 -0
  26. package/build/tests/e2e.aa.test.js +103 -0
  27. package/build/tests/e2e.aa.test.js.map +1 -0
  28. package/build/tests/e2e.deploy.test.d.ts +2 -0
  29. package/build/tests/e2e.deploy.test.d.ts.map +1 -0
  30. package/build/tests/e2e.deploy.test.js +234 -0
  31. package/build/tests/e2e.deploy.test.js.map +1 -0
  32. package/build/tests/utils.d.ts +14 -0
  33. package/build/tests/utils.d.ts.map +1 -0
  34. package/build/tests/utils.js +44 -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 +36 -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 +79 -0
  51. package/build/ts/common/__tests__/common.test.js.map +1 -0
  52. package/build/ts/common/accountAbstraction.d.ts +55 -0
  53. package/build/ts/common/accountAbstraction.d.ts.map +1 -0
  54. package/build/ts/common/accountAbstraction.js +110 -0
  55. package/build/ts/common/accountAbstraction.js.map +1 -0
  56. package/build/ts/common/errors.d.ts +33 -0
  57. package/build/ts/common/errors.d.ts.map +1 -0
  58. package/build/ts/common/errors.js +34 -0
  59. package/build/ts/common/errors.js.map +1 -0
  60. package/build/ts/common/index.d.ts +4 -0
  61. package/build/ts/common/index.d.ts.map +1 -0
  62. package/build/ts/common/index.js +4 -0
  63. package/build/ts/common/index.js.map +1 -0
  64. package/build/ts/common/networks.d.ts +29 -0
  65. package/build/ts/common/networks.d.ts.map +1 -0
  66. package/build/ts/common/networks.js +70 -0
  67. package/build/ts/common/networks.js.map +1 -0
  68. package/build/ts/common/types.d.ts +9 -0
  69. package/build/ts/common/types.d.ts.map +1 -0
  70. package/build/ts/common/types.js +2 -0
  71. package/build/ts/common/types.js.map +1 -0
  72. package/build/ts/crypto/__tests__/crypto.service.test.d.ts +2 -0
  73. package/build/ts/crypto/__tests__/crypto.service.test.d.ts.map +1 -0
  74. package/build/ts/crypto/__tests__/crypto.service.test.js +26 -0
  75. package/build/ts/crypto/__tests__/crypto.service.test.js.map +1 -0
  76. package/build/ts/crypto/crypto.module.d.ts +3 -0
  77. package/build/ts/crypto/crypto.module.d.ts.map +1 -0
  78. package/build/ts/crypto/crypto.module.js +18 -0
  79. package/build/ts/crypto/crypto.module.js.map +1 -0
  80. package/build/ts/crypto/crypto.service.d.ts +31 -0
  81. package/build/ts/crypto/crypto.service.d.ts.map +1 -0
  82. package/build/ts/crypto/crypto.service.js +68 -0
  83. package/build/ts/crypto/crypto.service.js.map +1 -0
  84. package/build/ts/deployer/__tests__/deployer.controller.test.d.ts +2 -0
  85. package/build/ts/deployer/__tests__/deployer.controller.test.d.ts.map +1 -0
  86. package/build/ts/deployer/__tests__/deployer.controller.test.js +84 -0
  87. package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -0
  88. package/build/ts/deployer/__tests__/deployer.service.test.d.ts +2 -0
  89. package/build/ts/deployer/__tests__/deployer.service.test.d.ts.map +1 -0
  90. package/build/ts/deployer/__tests__/deployer.service.test.js +425 -0
  91. package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -0
  92. package/build/ts/deployer/__tests__/utils.d.ts +36 -0
  93. package/build/ts/deployer/__tests__/utils.d.ts.map +1 -0
  94. package/build/ts/deployer/__tests__/utils.js +96 -0
  95. package/build/ts/deployer/__tests__/utils.js.map +1 -0
  96. package/build/ts/deployer/constants.d.ts +13 -0
  97. package/build/ts/deployer/constants.d.ts.map +1 -0
  98. package/build/ts/deployer/constants.js +13 -0
  99. package/build/ts/deployer/constants.js.map +1 -0
  100. package/build/ts/deployer/deployer.controller.d.ts +34 -0
  101. package/build/ts/deployer/deployer.controller.d.ts.map +1 -0
  102. package/build/ts/deployer/deployer.controller.js +89 -0
  103. package/build/ts/deployer/deployer.controller.js.map +1 -0
  104. package/build/ts/deployer/deployer.module.d.ts +3 -0
  105. package/build/ts/deployer/deployer.module.d.ts.map +1 -0
  106. package/build/ts/deployer/deployer.module.js +23 -0
  107. package/build/ts/deployer/deployer.module.js.map +1 -0
  108. package/build/ts/deployer/deployer.service.d.ts +112 -0
  109. package/build/ts/deployer/deployer.service.d.ts.map +1 -0
  110. package/build/ts/deployer/deployer.service.js +614 -0
  111. package/build/ts/deployer/deployer.service.js.map +1 -0
  112. package/build/ts/deployer/dto.d.ts +46 -0
  113. package/build/ts/deployer/dto.d.ts.map +1 -0
  114. package/build/ts/deployer/dto.js +117 -0
  115. package/build/ts/deployer/dto.js.map +1 -0
  116. package/build/ts/deployer/types.d.ts +293 -0
  117. package/build/ts/deployer/types.d.ts.map +1 -0
  118. package/build/ts/deployer/types.js +2 -0
  119. package/build/ts/deployer/types.js.map +1 -0
  120. package/build/ts/deployer/utils.d.ts +8 -0
  121. package/build/ts/deployer/utils.d.ts.map +1 -0
  122. package/build/ts/deployer/utils.js +9 -0
  123. package/build/ts/deployer/utils.js.map +1 -0
  124. package/build/ts/file/__tests__/file.service.test.d.ts +2 -0
  125. package/build/ts/file/__tests__/file.service.test.d.ts.map +1 -0
  126. package/build/ts/file/__tests__/file.service.test.js +76 -0
  127. package/build/ts/file/__tests__/file.service.test.js.map +1 -0
  128. package/build/ts/file/file.module.d.ts +3 -0
  129. package/build/ts/file/file.module.d.ts.map +1 -0
  130. package/build/ts/file/file.module.js +18 -0
  131. package/build/ts/file/file.module.js.map +1 -0
  132. package/build/ts/file/file.service.d.ts +62 -0
  133. package/build/ts/file/file.service.d.ts.map +1 -0
  134. package/build/ts/file/file.service.js +115 -0
  135. package/build/ts/file/file.service.js.map +1 -0
  136. package/build/ts/file/types.d.ts +36 -0
  137. package/build/ts/file/types.d.ts.map +1 -0
  138. package/build/ts/file/types.js +2 -0
  139. package/build/ts/file/types.js.map +1 -0
  140. package/build/ts/jest/setup.d.ts +8 -0
  141. package/build/ts/jest/setup.d.ts.map +1 -0
  142. package/build/ts/jest/setup.js +2 -0
  143. package/build/ts/jest/setup.js.map +1 -0
  144. package/build/ts/jest/transform.d.ts +8 -0
  145. package/build/ts/jest/transform.d.ts.map +1 -0
  146. package/build/ts/jest/transform.js +10 -0
  147. package/build/ts/jest/transform.js.map +1 -0
  148. package/build/ts/main.d.ts +2 -0
  149. package/build/ts/main.d.ts.map +1 -0
  150. package/build/ts/main.js +46 -0
  151. package/build/ts/main.js.map +1 -0
  152. package/build/ts/proof/__tests__/proof.controller.test.d.ts +2 -0
  153. package/build/ts/proof/__tests__/proof.controller.test.d.ts.map +1 -0
  154. package/build/ts/proof/__tests__/proof.controller.test.js +89 -0
  155. package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -0
  156. package/build/ts/proof/__tests__/proof.gateway.test.d.ts +2 -0
  157. package/build/ts/proof/__tests__/proof.gateway.test.d.ts.map +1 -0
  158. package/build/ts/proof/__tests__/proof.gateway.test.js +61 -0
  159. package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -0
  160. package/build/ts/proof/__tests__/proof.service.test.d.ts +2 -0
  161. package/build/ts/proof/__tests__/proof.service.test.d.ts.map +1 -0
  162. package/build/ts/proof/__tests__/proof.service.test.js +128 -0
  163. package/build/ts/proof/__tests__/proof.service.test.js.map +1 -0
  164. package/build/ts/proof/dto.d.ts +73 -0
  165. package/build/ts/proof/dto.d.ts.map +1 -0
  166. package/build/ts/proof/dto.js +255 -0
  167. package/build/ts/proof/dto.js.map +1 -0
  168. package/build/ts/proof/proof.controller.d.ts +46 -0
  169. package/build/ts/proof/proof.controller.d.ts.map +1 -0
  170. package/build/ts/proof/proof.controller.js +135 -0
  171. package/build/ts/proof/proof.controller.js.map +1 -0
  172. package/build/ts/proof/proof.gateway.d.ts +35 -0
  173. package/build/ts/proof/proof.gateway.d.ts.map +1 -0
  174. package/build/ts/proof/proof.gateway.js +93 -0
  175. package/build/ts/proof/proof.gateway.js.map +1 -0
  176. package/build/ts/proof/proof.module.d.ts +3 -0
  177. package/build/ts/proof/proof.module.d.ts.map +1 -0
  178. package/build/ts/proof/proof.module.js +24 -0
  179. package/build/ts/proof/proof.module.js.map +1 -0
  180. package/build/ts/proof/proof.service.d.ts +54 -0
  181. package/build/ts/proof/proof.service.d.ts.map +1 -0
  182. package/build/ts/proof/proof.service.js +246 -0
  183. package/build/ts/proof/proof.service.js.map +1 -0
  184. package/build/ts/proof/types.d.ts +140 -0
  185. package/build/ts/proof/types.d.ts.map +1 -0
  186. package/build/ts/proof/types.js +11 -0
  187. package/build/ts/proof/types.js.map +1 -0
  188. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts +2 -0
  189. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts.map +1 -0
  190. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +44 -0
  191. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -0
  192. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts +2 -0
  193. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts.map +1 -0
  194. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +61 -0
  195. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -0
  196. package/build/ts/sessionKeys/__tests__/utils.d.ts +25 -0
  197. package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -0
  198. package/build/ts/sessionKeys/__tests__/utils.js +64 -0
  199. package/build/ts/sessionKeys/__tests__/utils.js.map +1 -0
  200. package/build/ts/sessionKeys/dto.d.ts +11 -0
  201. package/build/ts/sessionKeys/dto.d.ts.map +1 -0
  202. package/build/ts/sessionKeys/dto.js +29 -0
  203. package/build/ts/sessionKeys/dto.js.map +1 -0
  204. package/build/ts/sessionKeys/sessionKeys.controller.d.ts +26 -0
  205. package/build/ts/sessionKeys/sessionKeys.controller.d.ts.map +1 -0
  206. package/build/ts/sessionKeys/sessionKeys.controller.js +74 -0
  207. package/build/ts/sessionKeys/sessionKeys.controller.js.map +1 -0
  208. package/build/ts/sessionKeys/sessionKeys.module.d.ts +3 -0
  209. package/build/ts/sessionKeys/sessionKeys.module.d.ts.map +1 -0
  210. package/build/ts/sessionKeys/sessionKeys.module.js +23 -0
  211. package/build/ts/sessionKeys/sessionKeys.module.js.map +1 -0
  212. package/build/ts/sessionKeys/sessionKeys.service.d.ts +50 -0
  213. package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -0
  214. package/build/ts/sessionKeys/sessionKeys.service.js +104 -0
  215. package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -0
  216. package/build/ts/sessionKeys/types.d.ts +11 -0
  217. package/build/ts/sessionKeys/types.d.ts.map +1 -0
  218. package/build/ts/sessionKeys/types.js +2 -0
  219. package/build/ts/sessionKeys/types.js.map +1 -0
  220. package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts +2 -0
  221. package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts.map +1 -0
  222. package/build/ts/subgraph/__tests__/subgraph.controller.test.js +50 -0
  223. package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -0
  224. package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts +2 -0
  225. package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts.map +1 -0
  226. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +83 -0
  227. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -0
  228. package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts +2 -0
  229. package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts.map +1 -0
  230. package/build/ts/subgraph/__tests__/subgraph.service.test.js +58 -0
  231. package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -0
  232. package/build/ts/subgraph/dto.d.ts +27 -0
  233. package/build/ts/subgraph/dto.d.ts.map +1 -0
  234. package/build/ts/subgraph/dto.js +83 -0
  235. package/build/ts/subgraph/dto.js.map +1 -0
  236. package/build/ts/subgraph/subgraph.controller.d.ts +24 -0
  237. package/build/ts/subgraph/subgraph.controller.d.ts.map +1 -0
  238. package/build/ts/subgraph/subgraph.controller.js +66 -0
  239. package/build/ts/subgraph/subgraph.controller.js.map +1 -0
  240. package/build/ts/subgraph/subgraph.gateway.d.ts +35 -0
  241. package/build/ts/subgraph/subgraph.gateway.d.ts.map +1 -0
  242. package/build/ts/subgraph/subgraph.gateway.js +93 -0
  243. package/build/ts/subgraph/subgraph.gateway.js.map +1 -0
  244. package/build/ts/subgraph/subgraph.module.d.ts +3 -0
  245. package/build/ts/subgraph/subgraph.module.d.ts.map +1 -0
  246. package/build/ts/subgraph/subgraph.module.js +23 -0
  247. package/build/ts/subgraph/subgraph.module.js.map +1 -0
  248. package/build/ts/subgraph/subgraph.service.d.ts +20 -0
  249. package/build/ts/subgraph/subgraph.service.d.ts.map +1 -0
  250. package/build/ts/subgraph/subgraph.service.js +106 -0
  251. package/build/ts/subgraph/subgraph.service.js.map +1 -0
  252. package/build/ts/subgraph/types.d.ts +93 -0
  253. package/build/ts/subgraph/types.d.ts.map +1 -0
  254. package/build/ts/subgraph/types.js +24 -0
  255. package/build/ts/subgraph/types.js.map +1 -0
  256. package/build/tsconfig.build.tsbuildinfo +1 -0
  257. package/package.json +124 -0
@@ -0,0 +1,46 @@
1
+ import type { IDeployMaciConfig, IDeployPollConfig } from "./types";
2
+ import type { Hex } from "viem";
3
+ import { ESupportedNetworks } from "../common";
4
+ /**
5
+ * Data transfer object for MACI contracts deployment
6
+ */
7
+ export declare class DeployerServiceDeployMaciDto {
8
+ /**
9
+ * Session Key Approval string
10
+ */
11
+ approval: string;
12
+ /**
13
+ * Address of the session key
14
+ */
15
+ sessionKeyAddress: Hex;
16
+ /**
17
+ * Chain Name
18
+ */
19
+ chain: ESupportedNetworks;
20
+ /**
21
+ * Config
22
+ */
23
+ config: IDeployMaciConfig;
24
+ }
25
+ /**
26
+ * Data transfer object for Poll contract deployment
27
+ */
28
+ export declare class DeployerServiceDeployPollDto {
29
+ /**
30
+ * Session Key Approval string
31
+ */
32
+ approval: string;
33
+ /**
34
+ * Address of the session key
35
+ */
36
+ sessionKeyAddress: Hex;
37
+ /**
38
+ * Chain Name
39
+ */
40
+ chain: ESupportedNetworks;
41
+ /**
42
+ * Config
43
+ */
44
+ config: IDeployPollConfig;
45
+ }
46
+ //# sourceMappingURL=dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.d.ts","sourceRoot":"","sources":["../../../ts/deployer/dto.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,qBAAa,4BAA4B;IACvC;;OAEG;IAMH,QAAQ,EAAG,MAAM,CAAC;IAElB;;OAEG;IAMH,iBAAiB,EAAG,GAAG,CAAC;IAExB;;OAEG;IAMH,KAAK,EAAG,kBAAkB,CAAC;IAE3B;;OAEG;IAKH,MAAM,EAAG,iBAAiB,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,4BAA4B;IACvC;;OAEG;IAMH,QAAQ,EAAG,MAAM,CAAC;IAElB;;OAEG;IAMH,iBAAiB,EAAG,GAAG,CAAC;IAExB;;OAEG;IAMH,KAAK,EAAG,kBAAkB,CAAC;IAE3B;;OAEG;IAKH,MAAM,EAAG,iBAAiB,CAAC;CAC5B"}
@@ -0,0 +1,117 @@
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 { IsEnum, IsString } from "class-validator";
12
+ import { ESupportedNetworks } from "../common";
13
+ /**
14
+ * Data transfer object for MACI contracts deployment
15
+ */
16
+ export class DeployerServiceDeployMaciDto {
17
+ /**
18
+ * Session Key Approval string
19
+ */
20
+ approval;
21
+ /**
22
+ * Address of the session key
23
+ */
24
+ sessionKeyAddress;
25
+ /**
26
+ * Chain Name
27
+ */
28
+ chain;
29
+ /**
30
+ * Config
31
+ */
32
+ config;
33
+ }
34
+ __decorate([
35
+ ApiProperty({
36
+ description: "Session Key Approval string",
37
+ type: String,
38
+ }),
39
+ IsString(),
40
+ __metadata("design:type", String)
41
+ ], DeployerServiceDeployMaciDto.prototype, "approval", void 0);
42
+ __decorate([
43
+ ApiProperty({
44
+ description: "Address of the session key",
45
+ type: String,
46
+ }),
47
+ IsString(),
48
+ __metadata("design:type", String)
49
+ ], DeployerServiceDeployMaciDto.prototype, "sessionKeyAddress", void 0);
50
+ __decorate([
51
+ ApiProperty({
52
+ description: "Chain to which to deploy the contract(s)",
53
+ enum: ESupportedNetworks,
54
+ }),
55
+ IsEnum(ESupportedNetworks),
56
+ __metadata("design:type", String)
57
+ ], DeployerServiceDeployMaciDto.prototype, "chain", void 0);
58
+ __decorate([
59
+ ApiProperty({
60
+ description: "Deployment configuration",
61
+ type: Object,
62
+ }),
63
+ __metadata("design:type", Object)
64
+ ], DeployerServiceDeployMaciDto.prototype, "config", void 0);
65
+ /**
66
+ * Data transfer object for Poll contract deployment
67
+ */
68
+ export class DeployerServiceDeployPollDto {
69
+ /**
70
+ * Session Key Approval string
71
+ */
72
+ approval;
73
+ /**
74
+ * Address of the session key
75
+ */
76
+ sessionKeyAddress;
77
+ /**
78
+ * Chain Name
79
+ */
80
+ chain;
81
+ /**
82
+ * Config
83
+ */
84
+ config;
85
+ }
86
+ __decorate([
87
+ ApiProperty({
88
+ description: "Session Key Approval string",
89
+ type: String,
90
+ }),
91
+ IsString(),
92
+ __metadata("design:type", String)
93
+ ], DeployerServiceDeployPollDto.prototype, "approval", void 0);
94
+ __decorate([
95
+ ApiProperty({
96
+ description: "Address of the session key",
97
+ type: String,
98
+ }),
99
+ IsString(),
100
+ __metadata("design:type", String)
101
+ ], DeployerServiceDeployPollDto.prototype, "sessionKeyAddress", void 0);
102
+ __decorate([
103
+ ApiProperty({
104
+ description: "Chain to which to deploy the contract(s)",
105
+ enum: ESupportedNetworks,
106
+ }),
107
+ IsEnum(ESupportedNetworks),
108
+ __metadata("design:type", String)
109
+ ], DeployerServiceDeployPollDto.prototype, "chain", void 0);
110
+ __decorate([
111
+ ApiProperty({
112
+ description: "Deployment configuration",
113
+ type: Object,
114
+ }),
115
+ __metadata("design:type", Object)
116
+ ], DeployerServiceDeployPollDto.prototype, "config", void 0);
117
+ //# sourceMappingURL=dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.js","sourceRoot":"","sources":["../../../ts/deployer/dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAKnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,4BAA4B;IACvC;;OAEG;IAMH,QAAQ,CAAU;IAElB;;OAEG;IAMH,iBAAiB,CAAO;IAExB;;OAEG;IAMH,KAAK,CAAsB;IAE3B;;OAEG;IAKH,MAAM,CAAqB;CAC5B;AA9BC;IALC,WAAW,CAAC;QACX,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE,MAAM;KACb,CAAC;IACD,QAAQ,EAAE;;8DACO;AAUlB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,4BAA4B;QACzC,IAAI,EAAE,MAAM;KACb,CAAC;IACD,QAAQ,EAAE;;uEACa;AAUxB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,0CAA0C;QACvD,IAAI,EAAE,kBAAkB;KACzB,CAAC;IACD,MAAM,CAAC,kBAAkB,CAAC;;2DACA;AAS3B;IAJC,WAAW,CAAC;QACX,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE,MAAM;KACb,CAAC;;4DACyB;AAG7B;;GAEG;AACH,MAAM,OAAO,4BAA4B;IACvC;;OAEG;IAMH,QAAQ,CAAU;IAElB;;OAEG;IAMH,iBAAiB,CAAO;IAExB;;OAEG;IAMH,KAAK,CAAsB;IAE3B;;OAEG;IAKH,MAAM,CAAqB;CAC5B;AA9BC;IALC,WAAW,CAAC;QACX,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE,MAAM;KACb,CAAC;IACD,QAAQ,EAAE;;8DACO;AAUlB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,4BAA4B;QACzC,IAAI,EAAE,MAAM;KACb,CAAC;IACD,QAAQ,EAAE;;uEACa;AAUxB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,0CAA0C;QACvD,IAAI,EAAE,kBAAkB;KACzB,CAAC;IACD,MAAM,CAAC,kBAAkB,CAAC;;2DACA;AAS3B;IAJC,WAAW,CAAC;QACX,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE,MAAM;KACb,CAAC;;4DACyB"}
@@ -0,0 +1,293 @@
1
+ import { EPolicies, EInitialVoiceCreditProxies } from "@maci-protocol/sdk";
2
+ import { PrepareUserOperationRequestParameters } from "permissionless/actions/smartAccount";
3
+ import { ENTRYPOINT_ADDRESS_V07_TYPE } from "permissionless/types";
4
+ import type { Abi, Hex } from "viem";
5
+ import { ESupportedNetworks } from "../common";
6
+ /**
7
+ * IDeployMACIArgs represents the arguments for deploying MACI
8
+ */
9
+ export interface IDeployMaciArgs {
10
+ /**
11
+ * The address of the session key
12
+ */
13
+ sessionKeyAddress: Hex;
14
+ /**
15
+ * The approval for the session key
16
+ */
17
+ approval: string;
18
+ /**
19
+ * The chain name
20
+ */
21
+ chain: ESupportedNetworks;
22
+ /**
23
+ * The configuration for deploying MACI
24
+ */
25
+ config: IDeployMaciConfig;
26
+ }
27
+ /**
28
+ * IDeployPollArgs represents the arguments for deploying a poll
29
+ */
30
+ export interface IDeployPollArgs {
31
+ /**
32
+ * The address of the session key
33
+ */
34
+ sessionKeyAddress: Hex;
35
+ /**
36
+ * The approval for the session key
37
+ */
38
+ approval: string;
39
+ /**
40
+ * The chain name
41
+ */
42
+ chain: ESupportedNetworks;
43
+ /**
44
+ * The configuration for deploying a poll
45
+ */
46
+ config: IDeployPollConfig;
47
+ }
48
+ /**
49
+ * IConstantInitialVoiceCreditProxyArgs represents the arguments for deploying a constant initial voice credit proxy
50
+ */
51
+ export interface IConstantInitialVoiceCreditProxyArgs {
52
+ /**
53
+ * The amount of initial voice credits to deploy
54
+ */
55
+ amount: string;
56
+ }
57
+ /**
58
+ * IEASPolicyArgs represents the arguments for deploying an EAS policy
59
+ */
60
+ export interface IEASPolicyArgs {
61
+ /**
62
+ * The address of the EAS contract
63
+ */
64
+ easAddress: string;
65
+ /**
66
+ * The attestation schema to be used
67
+ */
68
+ schema: string;
69
+ /**
70
+ * The trusted attester
71
+ */
72
+ attester: string;
73
+ }
74
+ /**
75
+ * IZupassPolicyArgs represents the arguments for deploying a Zupass policy
76
+ */
77
+ export interface IZupassPolicyArgs {
78
+ /**
79
+ * The first signer
80
+ */
81
+ signer1: string;
82
+ /**
83
+ * The second signer
84
+ */
85
+ signer2: string;
86
+ /**
87
+ * The event ID
88
+ */
89
+ eventId: string;
90
+ /**
91
+ * The Zupass verifier address
92
+ */
93
+ zupassVerifier: string;
94
+ }
95
+ /**
96
+ * IHatsPolicyArgs represents the arguments for deploying a Hats policy
97
+ */
98
+ export interface IHatsPolicyArgs {
99
+ /**
100
+ * The hats protocol address
101
+ */
102
+ hatsProtocolAddress: string;
103
+ /**
104
+ * The criterion hats
105
+ */
106
+ critrionHats: string[];
107
+ }
108
+ /**
109
+ * ISemaphorePolicyArgs represents the arguments for deploying a semaphore policy
110
+ */
111
+ export interface ISemaphorePolicyArgs {
112
+ /**
113
+ * The semaphore contract address
114
+ */
115
+ semaphoreContract: string;
116
+ /**
117
+ * The group ID
118
+ */
119
+ groupId: string;
120
+ }
121
+ /**
122
+ * IGitcoinPassportPolicyArgs represents the arguments for deploying a gitcoin passport policy
123
+ */
124
+ export interface IGitcoinPassportPolicyArgs {
125
+ /**
126
+ * The decoder address
127
+ */
128
+ decoderAddress: string;
129
+ /**
130
+ * The passing score
131
+ */
132
+ passingScore: string;
133
+ }
134
+ /**
135
+ * IERC20VotesPolicyArgs represents the arguments for deploying an ERC20 votes policy
136
+ */
137
+ export interface IERC20VotesPolicyArgs {
138
+ /**
139
+ * The token address
140
+ */
141
+ token: string;
142
+ /**
143
+ * The factor
144
+ */
145
+ factor: string;
146
+ /**
147
+ * The snapshot block
148
+ */
149
+ snapshotBlock: string;
150
+ }
151
+ /**
152
+ * IVkRegistryArgs represents the arguments for deploying a VkRegistry
153
+ */
154
+ export interface IVkRegistryArgs {
155
+ /**
156
+ * The state tree depth
157
+ */
158
+ stateTreeDepth: bigint | string;
159
+ /**
160
+ * The int state tree depth determines the tally batch size
161
+ */
162
+ intStateTreeDepth: bigint | string;
163
+ /**
164
+ * The vote option tree depth
165
+ */
166
+ voteOptionTreeDepth: bigint | string;
167
+ /**
168
+ * The message batch size
169
+ */
170
+ messageBatchSize: number;
171
+ }
172
+ /**
173
+ * IPolicyArgs represents the arguments for deploying a policy
174
+ */
175
+ export type IPolicyArgs = IEASPolicyArgs | IZupassPolicyArgs | IHatsPolicyArgs | ISemaphorePolicyArgs | IGitcoinPassportPolicyArgs | IERC20VotesPolicyArgs;
176
+ export type IInitialVoiceCreditProxyArgs = IConstantInitialVoiceCreditProxyArgs;
177
+ /**
178
+ * DeployMaciConfig is the configuration for deploying MACI
179
+ */
180
+ export interface IDeployMaciConfig {
181
+ /**
182
+ * The policy configuration
183
+ */
184
+ policy: {
185
+ type: EPolicies;
186
+ args?: IPolicyArgs;
187
+ };
188
+ /**
189
+ * The MACI configuration
190
+ */
191
+ MACI: {
192
+ stateTreeDepth: number;
193
+ policy: EPolicies;
194
+ };
195
+ /**
196
+ * The VkRegistry configuration
197
+ */
198
+ VkRegistry: {
199
+ args: IVkRegistryArgs;
200
+ };
201
+ /**
202
+ * Poseidon configuration
203
+ */
204
+ Poseidon?: {
205
+ poseidonT3: Hex;
206
+ poseidonT4: Hex;
207
+ poseidonT5: Hex;
208
+ poseidonT6: Hex;
209
+ };
210
+ }
211
+ /**
212
+ * DeployPollConfig is the configuration for deploying a poll
213
+ */
214
+ export interface IDeployPollConfig {
215
+ /**
216
+ * The poll's start date
217
+ */
218
+ startDate: number;
219
+ /**
220
+ * The poll's end date
221
+ */
222
+ endDate: number;
223
+ /**
224
+ * The coordinator pubkey
225
+ */
226
+ coordinatorPubkey: string;
227
+ /**
228
+ * Whether to use quadratic voting
229
+ */
230
+ useQuadraticVoting: boolean;
231
+ /**
232
+ * Determines the tally batch size
233
+ */
234
+ intStateTreeDepth: number;
235
+ /**
236
+ * Message batch size
237
+ */
238
+ messageBatchSize: number;
239
+ /**
240
+ * Vote option tree depth
241
+ */
242
+ voteOptionTreeDepth: number;
243
+ /**
244
+ * The policy configuration
245
+ */
246
+ policy: {
247
+ type: EPolicies;
248
+ args?: IPolicyArgs;
249
+ address?: Hex;
250
+ };
251
+ /**
252
+ * The initial voice credits proxy configuration
253
+ */
254
+ initialVoiceCreditsProxy: {
255
+ type: EInitialVoiceCreditProxies;
256
+ args: IInitialVoiceCreditProxyArgs;
257
+ address?: Hex;
258
+ };
259
+ /**
260
+ * The relayer addresses
261
+ */
262
+ relayers?: string[];
263
+ /**
264
+ * Number of valid vote options
265
+ */
266
+ voteOptions: bigint | string;
267
+ }
268
+ /**
269
+ * IContractData represents the data for a contract
270
+ */
271
+ export interface IContractData {
272
+ /**
273
+ * The contract's address
274
+ */
275
+ address: string | undefined;
276
+ /**
277
+ * The ABI of the contract
278
+ */
279
+ abi: Abi;
280
+ /**
281
+ * The bytecode of the contract
282
+ */
283
+ bytecode: Hex;
284
+ /**
285
+ * Whether the contract is already deployed
286
+ */
287
+ alreadyDeployed: boolean;
288
+ }
289
+ /**
290
+ * IUserOperation represents the data send for a user operation
291
+ */
292
+ export type IUserOperation = PrepareUserOperationRequestParameters<ENTRYPOINT_ADDRESS_V07_TYPE>["userOperation"];
293
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/deployer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,EAAE,kBAAkB,CAAC;IAE1B;;OAEG;IACH,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,EAAE,kBAAkB,CAAC;IAE1B;;OAEG;IACH,MAAM,EAAE,iBAAiB,CA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F;;OAEG;IACH,wBAAwB,EAAE;QACxB,IAAI,EAAE,0BAA0B,CAAC;QACjC,IAAI,EAAE,4BAA4B,CAAC;QACnC,OAAO,CAAC,EAAE,GAAG,CAAC;KACf,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC;IAET;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC;IAEd;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,qCAAqC,CAAC,2BAA2B,CAAC,CAAC,eAAe,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../ts/deployer/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Estimate the extra gas limit
3
+ *
4
+ * @param callGasLimit The gas limit of the call
5
+ * @returns The extra gas limit
6
+ */
7
+ export declare const estimateExtraGasLimit: (callGasLimit: bigint) => bigint;
8
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/deployer/utils.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,cAAc,MAAM,KAAG,MACN,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { DIVISOR, EXTRA_GAS_LIMIT_PERCENTAGE } from "./constants";
2
+ /**
3
+ * Estimate the extra gas limit
4
+ *
5
+ * @param callGasLimit The gas limit of the call
6
+ * @returns The extra gas limit
7
+ */
8
+ export const estimateExtraGasLimit = (callGasLimit) => (callGasLimit * EXTRA_GAS_LIMIT_PERCENTAGE) / DIVISOR;
9
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/deployer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAoB,EAAU,EAAE,CACpE,CAAC,YAAY,GAAG,0BAA0B,CAAC,GAAG,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=file.service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.service.test.d.ts","sourceRoot":"","sources":["../../../../ts/file/__tests__/file.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,76 @@
1
+ import dotenv from "dotenv";
2
+ import fs from "fs";
3
+ import { ErrorCodes } from "../../common";
4
+ import { FileService } from "../file.service";
5
+ dotenv.config();
6
+ describe("FileService", () => {
7
+ afterEach(() => {
8
+ jest.clearAllMocks();
9
+ });
10
+ test("should save session key properly", () => {
11
+ const service = new FileService();
12
+ const sessionKeyAddress = "0x123";
13
+ const sessionKey = "0x456";
14
+ service.storeSessionKey(sessionKey, sessionKeyAddress);
15
+ const storedSessionKey = service.getSessionKey(sessionKeyAddress);
16
+ expect(storedSessionKey).toEqual(sessionKey);
17
+ });
18
+ test("should delete session key properly", () => {
19
+ const service = new FileService();
20
+ const sessionKeyAddress = "0x123";
21
+ const sessionKey = "0x456";
22
+ service.storeSessionKey(sessionKey, sessionKeyAddress);
23
+ service.deleteSessionKey(sessionKeyAddress);
24
+ const deletedSessionKey = service.getSessionKey(sessionKeyAddress);
25
+ expect(deletedSessionKey).toBeUndefined();
26
+ });
27
+ test("should return public key properly", async () => {
28
+ const service = new FileService();
29
+ const { publicKey } = await service.getPublicKey();
30
+ expect(publicKey).toBeDefined();
31
+ });
32
+ test("should return private key properly", async () => {
33
+ const service = new FileService();
34
+ const { privateKey } = await service.getPrivateKey();
35
+ expect(privateKey).toBeDefined();
36
+ });
37
+ test("should return zkey filepaths for tally qv properly", () => {
38
+ const service = new FileService();
39
+ const { zkey, wasm, witgen } = service.getZkeyFilePaths(process.env.COORDINATOR_TALLY_ZKEY_NAME, true);
40
+ expect(zkey).toBeDefined();
41
+ expect(wasm).toBeDefined();
42
+ expect(witgen).toBeDefined();
43
+ });
44
+ test("should return zkey filepaths for tally non-qv properly", () => {
45
+ const service = new FileService();
46
+ const { zkey, wasm, witgen } = service.getZkeyFilePaths(process.env.COORDINATOR_TALLY_ZKEY_NAME, false);
47
+ expect(zkey).toBeDefined();
48
+ expect(wasm).toBeDefined();
49
+ expect(witgen).toBeDefined();
50
+ });
51
+ test("should return zkey filepaths for message process qv properly", () => {
52
+ const service = new FileService();
53
+ const { zkey, wasm, witgen } = service.getZkeyFilePaths(process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME, true);
54
+ expect(zkey).toBeDefined();
55
+ expect(wasm).toBeDefined();
56
+ expect(witgen).toBeDefined();
57
+ });
58
+ test("should return zkey filepaths for message process non-qv properly", () => {
59
+ const service = new FileService();
60
+ const { zkey, wasm, witgen } = service.getZkeyFilePaths(process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME, false);
61
+ expect(zkey).toBeDefined();
62
+ expect(wasm).toBeDefined();
63
+ expect(witgen).toBeDefined();
64
+ });
65
+ test("should throw an error if there are no zkey filepaths", () => {
66
+ const service = new FileService();
67
+ expect(() => service.getZkeyFilePaths("unknown", false)).toThrow(ErrorCodes.FILE_NOT_FOUND.toString());
68
+ });
69
+ test("should throw an error if there are no wasm and witgen filepaths", () => {
70
+ const spyExistsSync = jest.spyOn(fs, "existsSync");
71
+ spyExistsSync.mockReturnValueOnce(true).mockReturnValue(false);
72
+ const service = new FileService();
73
+ expect(() => service.getZkeyFilePaths(process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME, false)).toThrow(ErrorCodes.FILE_NOT_FOUND.toString());
74
+ });
75
+ });
76
+ //# sourceMappingURL=file.service.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.service.test.js","sourceRoot":"","sources":["../../../../ts/file/__tests__/file.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC5C,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAElC,MAAM,iBAAiB,GAAG,OAAO,CAAC;QAClC,MAAM,UAAU,GAAG,OAAO,CAAC;QAE3B,OAAO,CAAC,eAAe,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAEvD,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;QAElE,MAAM,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC9C,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAElC,MAAM,iBAAiB,GAAG,OAAO,CAAC;QAClC,MAAM,UAAU,GAAG,OAAO,CAAC;QAE3B,OAAO,CAAC,eAAe,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAEvD,O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,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAElC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;IACzG,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,iEAAiE,EAAE,GAAG,EAAE;QAC3E,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;QACnD,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAE/D,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAElC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,qCAAsC,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CACvG,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE,CACrC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare class FileModule {
2
+ }
3
+ //# sourceMappingURL=file.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.module.d.ts","sourceRoot":"","sources":["../../../ts/file/file.module.ts"],"names":[],"mappings":"AAIA,qBAIa,UAAU;CAAG"}
@@ -0,0 +1,18 @@
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 { FileService } from "./file.service";
9
+ let FileModule = class FileModule {
10
+ };
11
+ FileModule = __decorate([
12
+ Module({
13
+ exports: [FileService],
14
+ providers: [FileService],
15
+ })
16
+ ], FileModule);
17
+ export { FileModule };
18
+ //# sourceMappingURL=file.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.module.js","sourceRoot":"","sources":["../../../ts/file/file.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMtC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,UAAU;IAJtB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,WAAW,CAAC;QACtB,SAAS,EAAE,CAAC,WAAW,CAAC;KACzB,CAAC;GACW,UAAU,CAAG"}