@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,50 @@
1
+ import { HttpException, HttpStatus } from "@nestjs/common";
2
+ import { Test } from "@nestjs/testing";
3
+ import { ESupportedNetworks } from "../../common";
4
+ import { SubgraphController } from "../subgraph.controller";
5
+ import { SubgraphService } from "../subgraph.service";
6
+ describe("SubgraphController", () => {
7
+ let subgraphController;
8
+ const defaultSubgraphDeployArgs = {
9
+ maciContractAddress: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
10
+ startBlock: 0,
11
+ network: ESupportedNetworks.OPTIMISM_SEPOLIA,
12
+ name: "subgraph",
13
+ tag: "v0.0.1",
14
+ };
15
+ const defaultSubgraphDeployData = {
16
+ url: "url",
17
+ };
18
+ const mockSubgraphService = {
19
+ deploy: jest.fn(),
20
+ };
21
+ beforeEach(async () => {
22
+ const app = await Test.createTestingModule({
23
+ controllers: [SubgraphController],
24
+ })
25
+ .useMocker((token) => {
26
+ if (token === SubgraphService) {
27
+ mockSubgraphService.deploy.mockResolvedValue(defaultSubgraphDeployData);
28
+ return mockSubgraphService;
29
+ }
30
+ return jest.fn();
31
+ })
32
+ .compile();
33
+ subgraphController = app.get(SubgraphController);
34
+ });
35
+ afterEach(() => {
36
+ jest.clearAllMocks();
37
+ });
38
+ describe("v1/subgraph/deploy", () => {
39
+ test("should return deployed subgraph url properly", async () => {
40
+ const data = await subgraphController.deploy(defaultSubgraphDeployArgs);
41
+ expect(data).toStrictEqual(defaultSubgraphDeployData);
42
+ });
43
+ test("should throw an error if proof generation is failed", async () => {
44
+ const error = new Error("error");
45
+ mockSubgraphService.deploy.mockRejectedValue(error);
46
+ await expect(subgraphController.deploy(defaultSubgraphDeployArgs)).rejects.toThrow(new HttpException(error.message, HttpStatus.BAD_REQUEST));
47
+ });
48
+ });
49
+ });
50
+ //# sourceMappingURL=subgraph.controller.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.controller.test.js","sourceRoot":"","sources":["../../../../ts/subgraph/__tests__/subgraph.controller.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAIvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAI,kBAAsC,CAAC;IAE3C,MAAM,yBAAyB,GAAwB;QACrD,mBAAmB,EAAE,4CAA4C;QACjE,UAAU,EAAE,CAAC;QACb,OAAO,EAAE,kBAAkB,CA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B,CAAC,KAAK,CAAC,CAAC;YAEpD,MAAM,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAChF,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CACzD,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=subgraph.gateway.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.gateway.test.d.ts","sourceRoot":"","sources":["../../../../ts/subgraph/__tests__/subgraph.gateway.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,83 @@
1
+ import { Test } from "@nestjs/testing";
2
+ import { ESupportedNetworks } from "../../common";
3
+ import { SubgraphGateway } from "../subgraph.gateway";
4
+ import { SubgraphService } from "../subgraph.service";
5
+ import { EProgressStep, ESubgraphEvents, TOTAL_STEPS, } from "../types";
6
+ describe("SubgraphGateway", () => {
7
+ let gateway;
8
+ const defaultSubgraphDeployArgs = {
9
+ maciContractAddress: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
10
+ startBlock: 0,
11
+ network: ESupportedNetworks.OPTIMISM_SEPOLIA,
12
+ name: "subgraph",
13
+ tag: "v0.0.1",
14
+ };
15
+ const defaultSubgraphDeployData = {
16
+ url: "https://localhost:3000",
17
+ };
18
+ const mockSubgraphService = {
19
+ deploy: jest.fn(),
20
+ };
21
+ const mockEmit = jest.fn();
22
+ beforeEach(async () => {
23
+ const testModule = await Test.createTestingModule({ providers: [SubgraphGateway] })
24
+ .useMocker((token) => {
25
+ if (token === SubgraphService) {
26
+ mockSubgraphService.deploy.mockImplementation((_, options) => {
27
+ options?.onProgress({ current: EProgressStep.SCHEMA, total: TOTAL_STEPS });
28
+ options?.onProgress({ current: EProgressStep.NETWORK, total: TOTAL_STEPS });
29
+ options?.onProgress({ current: EProgressStep.TEMPLATE, total: TOTAL_STEPS });
30
+ options?.onProgress({ current: EProgressStep.CODEGEN, total: TOTAL_STEPS });
31
+ options?.onProgress({ current: EProgressStep.BUILD, total: TOTAL_STEPS });
32
+ options?.onProgress({ current: EProgressStep.DEPLOY, total: TOTAL_STEPS });
33
+ options?.onSuccess(defaultSubgraphDeployData.url);
34
+ options?.onFail(new Error("error"));
35
+ });
36
+ return mockSubgraphService;
37
+ }
38
+ return jest.fn();
39
+ })
40
+ .compile();
41
+ gateway = testModule.get(SubgraphGateway);
42
+ gateway.server = { emit: mockEmit };
43
+ });
44
+ afterEach(() => {
45
+ jest.clearAllMocks();
46
+ });
47
+ test("should be defined", () => {
48
+ expect(gateway).toBeDefined();
49
+ });
50
+ test("should start subgraph deployment properly", async () => {
51
+ await gateway.deploy(defaultSubgraphDeployArgs);
52
+ expect(mockEmit).toHaveBeenCalledTimes(8);
53
+ expect(mockEmit).toHaveBeenNthCalledWith(1, ESubgraphEvents.PROGRESS, {
54
+ current: EProgressStep.SCHEMA,
55
+ total: TOTAL_STEPS,
56
+ });
57
+ expect(mockEmit).toHaveBeenNthCalledWith(2, ESubgraphEvents.PROGRESS, {
58
+ current: EProgressStep.NETWORK,
59
+ total: TOTAL_STEPS,
60
+ });
61
+ expect(mockEmit).toHaveBeenNthCalledWith(3, ESubgraphEvents.PROGRESS, {
62
+ current: EProgressStep.TEMPLATE,
63
+ total: TOTAL_STEPS,
64
+ });
65
+ expect(mockEmit).toHaveBeenNthCalledWith(4, ESubgraphEvents.PROGRESS, {
66
+ current: EProgressStep.CODEGEN,
67
+ total: TOTAL_STEPS,
68
+ });
69
+ expect(mockEmit).toHaveBeenNthCalledWith(5, ESubgraphEvents.PROGRESS, {
70
+ current: EProgressStep.BUILD,
71
+ total: TOTAL_STEPS,
72
+ });
73
+ expect(mockEmit).toHaveBeenNthCalledWith(6, ESubgraphEvents.PROGRESS, {
74
+ current: EProgressStep.DEPLOY,
75
+ total: TOTAL_STEPS,
76
+ });
77
+ expect(mockEmit).toHaveBeenNthCalledWith(7, ESubgraphEvents.FINISH, {
78
+ url: defaultSubgraphDeployData.url,
79
+ });
80
+ expect(mockEmit).toHaveBeenNthCalledWith(8, ESubgraphEvents.ERROR, { message: "error" });
81
+ });
82
+ });
83
+ //# sourceMappingURL=subgraph.gateway.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.gateway.test.js","sourceRoot":"","sources":["../../../../ts/subgraph/__tests__/subgraph.gateway.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,aAAa,EACb,eAAe,EACf,WAAW,GAIZ,MAAM,UAAU,CAAC;AAElB,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,OAAwB,CAAC;IAE7B,MAAM,yBAAyB,GAAwB;QACrD,mBAAmB,EAAE,4CAA4C;QACjE,UAAU,EAAE,CAAC;QACb,OAAO,EAAE,kBAAkB,CAAC,gBAAgB;QAC5C,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,QAAQ;KACd,CAAC;IAEF,MAAM,yBAAyB,GAA0B;QACvD,GAAG,EAAE,wBAAwB;KAC9B,CAAC;IAEF,MAAM,mBAAmB,GAAG;QAC1B,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;KAClB,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAE3B,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,EAAE,SAAS,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;aAChF,SAAS,CAAC,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AAE,WAAW;SACnB,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,eAAe,CAAC,QAAQ,EAAE;YACpE,OAAO,EAAE,aAAa,CAAC,MAAM;YAC7B,KAAK,EAAE,WAAW;SACnB,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,eAAe,CAAC,MAAM,EAAE;YAClE,GAAG,EAAE,yBAAyB,CAAC,GAAG;SACnC,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,eAAe,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=subgraph.service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.service.test.d.ts","sourceRoot":"","sources":["../../../../ts/subgraph/__tests__/subgraph.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ import dotenv from "dotenv";
2
+ import childProcess from "child_process";
3
+ import fs from "fs";
4
+ import { ErrorCodes, ESupportedNetworks } from "../../common";
5
+ import { SubgraphService } from "../subgraph.service";
6
+ dotenv.config();
7
+ jest.mock("child_process", () => ({
8
+ ...jest.requireActual("child_process"),
9
+ execFile: jest.fn(),
10
+ }));
11
+ jest.mock("fs", () => ({
12
+ ...jest.requireActual("fs"),
13
+ promises: {
14
+ writeFile: jest.fn(),
15
+ },
16
+ }));
17
+ jest.mock("util", () => ({
18
+ promisify: jest.fn((func) => func),
19
+ }));
20
+ describe("SubgraphService", () => {
21
+ const defaultArgs = {
22
+ maciContractAddress: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
23
+ startBlock: 0,
24
+ network: ESupportedNetworks.OPTIMISM_SEPOLIA,
25
+ name: "subgraph",
26
+ tag: "v0.0.1",
27
+ };
28
+ beforeEach(() => {
29
+ childProcess.execFile.mockResolvedValue({
30
+ stdout: "https://subgraph.com https://test.com",
31
+ });
32
+ fs.promises.writeFile.mockResolvedValue(undefined);
33
+ });
34
+ afterEach(() => {
35
+ jest.clearAllMocks();
36
+ });
37
+ test("should throw error if deploy is failed", async () => {
38
+ childProcess.execFile.mockRejectedValue(new Error());
39
+ const service = new SubgraphService();
40
+ await expect(service.deploy(defaultArgs)).rejects.toThrow(ErrorCodes.SUBGRAPH_DEPLOY.toString());
41
+ });
42
+ test("should throw error if network is invalid", async () => {
43
+ childProcess.execFile.mockRejectedValue(new Error());
44
+ const service = new SubgraphService();
45
+ await expect(service.deploy({ ...defaultArgs, network: "unknown" })).rejects.toThrow(ErrorCodes.SUBGRAPH_DEPLOY.toString());
46
+ });
47
+ test("should throw error if there is no subgraph url", async () => {
48
+ childProcess.execFile.mockResolvedValue({ stdout: "" });
49
+ const service = new SubgraphService();
50
+ await expect(service.deploy(defaultArgs)).rejects.toThrow(ErrorCodes.SUBGRAPH_DEPLOY.toString());
51
+ });
52
+ test("should return deployed subgraph url properly", async () => {
53
+ const service = new SubgraphService();
54
+ const { url } = await service.deploy(defaultArgs);
55
+ expect(url).toBe("https://test.com");
56
+ });
57
+ });
58
+ //# sourceMappingURL=subgraph.service.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.service.test.js","sourceRoot":"","sources":["../../../../ts/subgraph/__tests__/subgraph.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,IAAI,CAAC;AAIpB,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,IAAI,CA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,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { ESupportedNetworks } from "../common";
2
+ /**
3
+ * Data transfer object for deploying subgraph
4
+ */
5
+ export declare class DeploySubgraphDto {
6
+ /**
7
+ * MACI contract address
8
+ */
9
+ maciContractAddress: string;
10
+ /**
11
+ * Start block for event processing
12
+ */
13
+ startBlock: number;
14
+ /**
15
+ * Network CLI name
16
+ */
17
+ network: ESupportedNetworks;
18
+ /**
19
+ * Subgraph name
20
+ */
21
+ name: string;
22
+ /**
23
+ * Version tag (ex: v0.0.1)
24
+ */
25
+ tag: string;
26
+ }
27
+ //# sourceMappingURL=dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;OAEG;IAMH,mBAAmB,EAAG,MAAM,CAAC;IAE7B;;OAEG;IAQH,UAAU,EAAG,MAAM,CAAC;IAEpB;;OAEG;IAMH,OAAO,EAAG,kBAAkB,CAAC;IAE7B;;OAEG;IAQH,IAAI,EAAG,MAAM,CAAC;IAEd;;OAEG;IAOH,GAAG,EAAG,MAAM,CAAC;CACd"}
@@ -0,0 +1,83 @@
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, IsEthereumAddress, IsInt, IsString, Matches, MaxLength, Min, MinLength } from "class-validator";
12
+ import { ESupportedNetworks } from "../common";
13
+ /**
14
+ * Data transfer object for deploying subgraph
15
+ */
16
+ export class DeploySubgraphDto {
17
+ /**
18
+ * MACI contract address
19
+ */
20
+ maciContractAddress;
21
+ /**
22
+ * Start block for event processing
23
+ */
24
+ startBlock;
25
+ /**
26
+ * Network CLI name
27
+ */
28
+ network;
29
+ /**
30
+ * Subgraph name
31
+ */
32
+ name;
33
+ /**
34
+ * Version tag (ex: v0.0.1)
35
+ */
36
+ tag;
37
+ }
38
+ __decorate([
39
+ ApiProperty({
40
+ description: "MACI contract address",
41
+ type: String,
42
+ }),
43
+ IsEthereumAddress(),
44
+ __metadata("design:type", String)
45
+ ], DeploySubgraphDto.prototype, "maciContractAddress", void 0);
46
+ __decorate([
47
+ ApiProperty({
48
+ description: "Start block for event parsing",
49
+ minimum: 0,
50
+ type: Number,
51
+ }),
52
+ IsInt(),
53
+ Min(0),
54
+ __metadata("design:type", Number)
55
+ ], DeploySubgraphDto.prototype, "startBlock", void 0);
56
+ __decorate([
57
+ ApiProperty({
58
+ description: "Network CLI name (https://thegraph.com/docs/en/developing/supported-networks/)",
59
+ enum: ESupportedNetworks,
60
+ }),
61
+ IsEnum(ESupportedNetworks),
62
+ __metadata("design:type", String)
63
+ ], DeploySubgraphDto.prototype, "network", void 0);
64
+ __decorate([
65
+ ApiProperty({
66
+ description: "Subgraph name",
67
+ type: String,
68
+ }),
69
+ IsString(),
70
+ MinLength(3),
71
+ MaxLength(50),
72
+ __metadata("design:type", String)
73
+ ], DeploySubgraphDto.prototype, "name", void 0);
74
+ __decorate([
75
+ ApiProperty({
76
+ description: "Version tag (ex: v0.0.1)",
77
+ type: String,
78
+ }),
79
+ IsString(),
80
+ Matches(/^v\d+\.\d+\.\d+$/),
81
+ __metadata("design:type", String)
82
+ ], DeploySubgraphDto.prototype, "tag", void 0);
83
+ //# sourceMappingURL=dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.js","sourceRoot":"","sources":["../../../ts/subgraph/dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;OAEG;IAMH,mBAAmB,CAAU;IAE7B;;OAEG;IAQH,UAAU,CAAU;IAEpB;;OAEG;IAMH,OAAO,CAAsB;IAE7B;;OAEG;IAQH,IAAI,CAAU;IAEd;;OAEG;IAOH,GAAG,CAAU;CACd;AA9CC;IALC,WAAW,CAAC;QACX,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,MAAM;KACb,CAAC;IACD,iBAAiB,EAAE;;8DACS;AAY7B;IAPC,WAAW,CAAC;QACX,WAAW,EAAE,+BAA+B;QAC5C,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,MAAM;KACb,CAAC;IACD,KAAK,EAAE;IACP,GAAG,CAAC,CAAC,CAAC;;qDACa;AAUpB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,gFAAgF;QAC7F,IAAI,EAAE,kBAAkB;KACzB,CAAC;IACD,MAAM,CAAC,kBAAkB,CAAC;;kDACE;AAY7B;IAPC,WAAW,CAAC;QACX,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,MAAM;KACb,CAAC;IACD,QAAQ,EAAE;IACV,SAAS,CAAC,CAAC,CAAC;IACZ,SAAS,CAAC,EAAE,CAAC;;+CACA;AAWd;IANC,WAAW,CAAC;QACX,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE,MAAM;KACb,CAAC;IACD,QAAQ,EAAE;IACV,OAAO,CAAC,kBAAkB,CAAC;;8CACf"}
@@ -0,0 +1,24 @@
1
+ import type { IDeploySubgraphReturn } from "./types";
2
+ import { DeploySubgraphDto } from "./dto";
3
+ import { SubgraphService } from "./subgraph.service";
4
+ export declare class SubgraphController {
5
+ private readonly subgraphService;
6
+ /**
7
+ * Logger
8
+ */
9
+ private readonly logger;
10
+ /**
11
+ * Initialize SubgraphController
12
+ *
13
+ * @param subgraphService - subgraph service
14
+ */
15
+ constructor(subgraphService: SubgraphService);
16
+ /**
17
+ * Generate proofs api method
18
+ *
19
+ * @param args - generate proof dto
20
+ * @returns generated proofs and tally data
21
+ */
22
+ deploy(args: DeploySubgraphDto): Promise<IDeploySubgraphReturn>;
23
+ }
24
+ //# sourceMappingURL=subgraph.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.controller.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/subgraph.controller.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAIa,kBAAkB;IAWjB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAV5C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuC;IAE9D;;;;OAIG;gBAC0B,eAAe,EAAE,eAAe;IAE7D;;;;;OAKG;IAMG,MAAM,CAAS,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAM9E"}
@@ -0,0 +1,66 @@
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
+ var SubgraphController_1;
14
+ /* eslint-disable @typescript-eslint/no-shadow */
15
+ import { Body, Controller, HttpException, HttpStatus, Logger, Post, UseGuards } from "@nestjs/common";
16
+ import { ApiBearerAuth, ApiBody, ApiResponse, ApiTags } from "@nestjs/swagger";
17
+ import { AccountSignatureGuard } from "../auth/AccountSignatureGuard.service";
18
+ import { DeploySubgraphDto } from "./dto";
19
+ import { SubgraphService } from "./subgraph.service";
20
+ let SubgraphController = SubgraphController_1 = class SubgraphController {
21
+ subgraphService;
22
+ /**
23
+ * Logger
24
+ */
25
+ logger = new Logger(SubgraphController_1.name);
26
+ /**
27
+ * Initialize SubgraphController
28
+ *
29
+ * @param subgraphService - subgraph service
30
+ */
31
+ constructor(subgraphService) {
32
+ this.subgraphService = subgraphService;
33
+ }
34
+ /**
35
+ * Generate proofs api method
36
+ *
37
+ * @param args - generate proof dto
38
+ * @returns generated proofs and tally data
39
+ */
40
+ async deploy(args) {
41
+ return this.subgraphService.deploy(args).catch((error) => {
42
+ this.logger.error(`Error:`, error);
43
+ throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
44
+ });
45
+ }
46
+ };
47
+ __decorate([
48
+ ApiBody({ type: DeploySubgraphDto }),
49
+ ApiResponse({ status: HttpStatus.CREATED, description: "The subgraph was successfully deployed" }),
50
+ ApiResponse({ status: HttpStatus.FORBIDDEN, description: "Forbidden" }),
51
+ ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "BadRequest" }),
52
+ Post("deploy"),
53
+ __param(0, Body()),
54
+ __metadata("design:type", Function),
55
+ __metadata("design:paramtypes", [DeploySubgraphDto]),
56
+ __metadata("design:returntype", Promise)
57
+ ], SubgraphController.prototype, "deploy", null);
58
+ SubgraphController = SubgraphController_1 = __decorate([
59
+ ApiTags("v1/subgraph"),
60
+ ApiBearerAuth(),
61
+ Controller("v1/subgraph"),
62
+ UseGuards(AccountSignatureGuard),
63
+ __metadata("design:paramtypes", [SubgraphService])
64
+ ], SubgraphController);
65
+ export { SubgraphController };
66
+ //# sourceMappingURL=subgraph.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.controller.js","sourceRoot":"","sources":["../../../ts/subgraph/subgraph.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iDAAiD;AACjD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAI/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAM9C,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAWA;IAV7B;;OAEG;IACc,MAAM,GAAG,IAAI,MAAM,CAAC,oBAAkB,CAAC,IAAI,CAAC,CAAC;IAE9D;;;;OAIG;IACH,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE;;;;;OAKG;IAMG,AAAN,KAAK,CAAC,MAAM,CAAS,IAAuB;QAC1C,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;YAC9D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YACnC,MAAM,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AANO;IALL,OAAO,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAClG,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,IAAI,CAAC,QAAQ,CAAC;IACD,WAAA,IAAI,EAAE,CAAA;;qCAAO,iBAAiB;;gDAK3C;AA7BU,kBAAkB;IAJ9B,OAAO,CAAC,aAAa,CAAC;IACtB,aAAa,EAAE;IACf,UAAU,CAAC,aAAa,CAAC;IACzB,SAAS,CAAC,qBAAqB,CAAC;qCAYe,eAAe;GAXlD,kBAAkB,CA8B9B"}
@@ -0,0 +1,35 @@
1
+ import type { Server } from "socket.io";
2
+ import { DeploySubgraphDto } from "./dto";
3
+ import { SubgraphService } from "./subgraph.service";
4
+ /**
5
+ * SubgraphGateway is responsible for websockets integration between client and SubgraphService.
6
+ */
7
+ export declare class SubgraphGateway {
8
+ private readonly subgraphService;
9
+ /**
10
+ * Logger
11
+ */
12
+ private readonly logger;
13
+ /**
14
+ * Websocket server
15
+ */
16
+ server: Server;
17
+ /**
18
+ * Initialize SubgraphGateway
19
+ *
20
+ * @param subgraphService - subgraph service
21
+ */
22
+ constructor(subgraphService: SubgraphService);
23
+ /**
24
+ * Generate proofs api method.
25
+ * Events:
26
+ * 1. ESubgraphEvents.START - trigger method call
27
+ * 2. ESubgraphEvents.PROGRESS - returns deployed steps info
28
+ * 3. ESubgraphEvents.FINISH - returns result of deploy operation
29
+ * 4. ESubgraphEvents.ERROR - triggered when exception is thrown
30
+ *
31
+ * @param args - generate proof dto
32
+ */
33
+ deploy(data: DeploySubgraphDto): Promise<void>;
34
+ }
35
+ //# sourceMappingURL=subgraph.gateway.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.gateway.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/subgraph.gateway.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD;;GAEG;AACH,qBAMa,eAAe;IAiBd,OAAO,CAAC,QAAQ,CAAC,eAAe;IAhB5C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE3D;;OAEG;IAEH,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;OAIG;gBAC0B,eAAe,EAAE,eAAe;IAE7D;;;;;;;;;OASG;IAUG,MAAM,CAEV,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,IAAI,CAAC;CAcjB"}
@@ -0,0 +1,93 @@
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
+ var SubgraphGateway_1;
14
+ import { Logger, UseGuards, UsePipes, ValidationPipe } from "@nestjs/common";
15
+ import { MessageBody, SubscribeMessage, WebSocketGateway, WebSocketServer, WsException } from "@nestjs/websockets";
16
+ import { AccountSignatureGuard } from "../auth/AccountSignatureGuard.service";
17
+ import { DeploySubgraphDto } from "./dto";
18
+ import { SubgraphService } from "./subgraph.service";
19
+ import { ESubgraphEvents } from "./types";
20
+ /**
21
+ * SubgraphGateway is responsible for websockets integration between client and SubgraphService.
22
+ */
23
+ let SubgraphGateway = SubgraphGateway_1 = class SubgraphGateway {
24
+ subgraphService;
25
+ /**
26
+ * Logger
27
+ */
28
+ logger = new Logger(SubgraphGateway_1.name);
29
+ /**
30
+ * Websocket server
31
+ */
32
+ server;
33
+ /**
34
+ * Initialize SubgraphGateway
35
+ *
36
+ * @param subgraphService - subgraph service
37
+ */
38
+ constructor(subgraphService) {
39
+ this.subgraphService = subgraphService;
40
+ }
41
+ /**
42
+ * Generate proofs api method.
43
+ * Events:
44
+ * 1. ESubgraphEvents.START - trigger method call
45
+ * 2. ESubgraphEvents.PROGRESS - returns deployed steps info
46
+ * 3. ESubgraphEvents.FINISH - returns result of deploy operation
47
+ * 4. ESubgraphEvents.ERROR - triggered when exception is thrown
48
+ *
49
+ * @param args - generate proof dto
50
+ */
51
+ async deploy(data) {
52
+ await this.subgraphService.deploy(data, {
53
+ onProgress: (result) => {
54
+ this.server.emit(ESubgraphEvents.PROGRESS, result);
55
+ },
56
+ onSuccess: (url) => {
57
+ this.server.emit(ESubgraphEvents.FINISH, { url });
58
+ },
59
+ onFail: (error) => {
60
+ this.logger.error(`Error:`, error);
61
+ this.server.emit(ESubgraphEvents.ERROR, { message: error.message });
62
+ },
63
+ });
64
+ }
65
+ };
66
+ __decorate([
67
+ WebSocketServer(),
68
+ __metadata("design:type", Function)
69
+ ], SubgraphGateway.prototype, "server", void 0);
70
+ __decorate([
71
+ SubscribeMessage(ESubgraphEvents.START),
72
+ UsePipes(new ValidationPipe({
73
+ transform: true,
74
+ exceptionFactory(validationErrors) {
75
+ return new WsException(validationErrors);
76
+ },
77
+ })),
78
+ __param(0, MessageBody()),
79
+ __metadata("design:type", Function),
80
+ __metadata("design:paramtypes", [DeploySubgraphDto]),
81
+ __metadata("design:returntype", Promise)
82
+ ], SubgraphGateway.prototype, "deploy", null);
83
+ SubgraphGateway = SubgraphGateway_1 = __decorate([
84
+ WebSocketGateway({
85
+ cors: {
86
+ origin: process.env.COORDINATOR_ALLOWED_ORIGINS?.split(","),
87
+ },
88
+ }),
89
+ UseGuards(AccountSignatureGuard),
90
+ __metadata("design:paramtypes", [SubgraphService])
91
+ ], SubgraphGateway);
92
+ export { SubgraphGateway };
93
+ //# sourceMappingURL=subgraph.gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.gateway.js","sourceRoot":"","sources":["../../../ts/subgraph/subgraph.gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAInH,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAsB,MAAM,SAAS,CAAC;AAE9D;;GAEG;AAOI,IAAM,eAAe,uBAArB,MAAM,eAAe;IAiBG;IAhB7B;;OAEG;IACc,MA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EAAE;YACJ,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,KAAK,CAAC,GAAG,CAAC;SAC5D;KACF,CAAC;IACD,SAAS,CAAC,qBAAqB,CAAC;qCAkBe,eAAe;GAjBlD,eAAe,CAuD3B"}
@@ -0,0 +1,3 @@
1
+ export declare class SubgraphModule {
2
+ }
3
+ //# sourceMappingURL=subgraph.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.module.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/subgraph.module.ts"],"names":[],"mappings":"AASA,qBAKa,cAAc;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 { CryptoModule } from "../crypto/crypto.module";
9
+ import { FileModule } from "../file/file.module";
10
+ import { SubgraphController } from "./subgraph.controller";
11
+ import { SubgraphGateway } from "./subgraph.gateway";
12
+ import { SubgraphService } from "./subgraph.service";
13
+ let SubgraphModule = class SubgraphModule {
14
+ };
15
+ SubgraphModule = __decorate([
16
+ Module({
17
+ imports: [FileModule, CryptoModule],
18
+ controllers: [SubgraphController],
19
+ providers: [SubgraphService, SubgraphGateway],
20
+ })
21
+ ], SubgraphModule);
22
+ export { SubgraphModule };
23
+ //# sourceMappingURL=subgraph.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.module.js","sourceRoot":"","sources":["../../../ts/subgraph/subgraph.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAO9C,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,cAAc;IAL1B,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;QACnC,WAAW,EAAE,CAAC,kBAAkB,CAAC;QACjC,SAAS,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;KAC9C,CAAC;GACW,cAAc,CAAG"}
@@ -0,0 +1,20 @@
1
+ import { type IDeploySubgraphArgs, type IDeploySubgraphReturn, type ISubgraphWsHooks } from "./types";
2
+ /**
3
+ * SubgraphService is responsible for deploying subgraph.
4
+ */
5
+ export declare class SubgraphService {
6
+ /**
7
+ * Logger
8
+ */
9
+ private readonly logger;
10
+ /**
11
+ * Generate proofs for message processing and tally
12
+ *
13
+ * @param args - deploy subgraph arguments
14
+ * @param options - ws hooks
15
+ * @returns - deployed subgraph url
16
+ * @throws error if deploy is not successful
17
+ */
18
+ deploy(args: IDeploySubgraphArgs, options?: ISubgraphWsHooks): Promise<IDeploySubgraphReturn>;
19
+ }
20
+ //# sourceMappingURL=subgraph.service.d.ts.map