@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 @@
1
+ {"version":3,"file":"subgraph.service.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/subgraph.service.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,qBACa,eAAe;IAC1B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE3D;;;;;;;OAOG;IACG,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CA0FpG"}
@@ -0,0 +1,106 @@
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 SubgraphService_1;
8
+ import { Injectable, Logger } from "@nestjs/common";
9
+ import childProcess from "child_process";
10
+ import fs from "fs";
11
+ import path from "path";
12
+ import { promisify } from "util";
13
+ import { ErrorCodes, ESupportedNetworks } from "../common";
14
+ import { EProgressStep, TOTAL_STEPS, } from "./types";
15
+ const execFile = promisify(childProcess.execFile);
16
+ const URL_REGEX = /(https?:\/\/[^\s]+)/g;
17
+ /**
18
+ * SubgraphService is responsible for deploying subgraph.
19
+ */
20
+ let SubgraphService = SubgraphService_1 = class SubgraphService {
21
+ /**
22
+ * Logger
23
+ */
24
+ logger = new Logger(SubgraphService_1.name);
25
+ /**
26
+ * Generate proofs for message processing and tally
27
+ *
28
+ * @param args - deploy subgraph arguments
29
+ * @param options - ws hooks
30
+ * @returns - deployed subgraph url
31
+ * @throws error if deploy is not successful
32
+ */
33
+ async deploy(args, options) {
34
+ try {
35
+ if (!Object.values(ESupportedNetworks).includes(args.network)) {
36
+ throw new Error("Invalid network");
37
+ }
38
+ const subgraphManifestPath = path.resolve(process.env.SUBGRAPH_FOLDER, "subgraph.yaml");
39
+ await execFile("cp", [
40
+ path.resolve(process.env.SUBGRAPH_FOLDER, "schemas/schema.v1.graphql"),
41
+ path.resolve(process.env.SUBGRAPH_FOLDER, "schema.graphql"),
42
+ ]);
43
+ options?.onProgress({ current: EProgressStep.SCHEMA, total: TOTAL_STEPS });
44
+ await fs.promises.writeFile(path.resolve(process.env.SUBGRAPH_FOLDER, `config/${args.network}.json`), `${JSON.stringify({
45
+ network: args.network,
46
+ maciContractAddress: args.maciContractAddress,
47
+ maciContractStartBlock: args.startBlock,
48
+ }, null, 2)}\n`, { flag: "w+" });
49
+ options?.onProgress({ current: EProgressStep.NETWORK, total: TOTAL_STEPS });
50
+ const mustacheOutput = await execFile("mustache", [
51
+ path.resolve(process.env.SUBGRAPH_FOLDER, `config/${args.network}.json`),
52
+ path.resolve(process.env.SUBGRAPH_FOLDER, "templates/subgraph.template.yaml"),
53
+ ]);
54
+ await fs.promises.writeFile(subgraphManifestPath, mustacheOutput.stdout, { flag: "w+" });
55
+ options?.onProgress({ current: EProgressStep.TEMPLATE, total: TOTAL_STEPS });
56
+ await execFile("graph", [
57
+ "codegen",
58
+ subgraphManifestPath,
59
+ "--output-dir",
60
+ path.resolve(process.env.SUBGRAPH_FOLDER, "generated"),
61
+ ]);
62
+ options?.onProgress({ current: EProgressStep.CODEGEN, total: TOTAL_STEPS });
63
+ await execFile("graph", [
64
+ "build",
65
+ subgraphManifestPath,
66
+ "--output-dir",
67
+ path.resolve(process.env.SUBGRAPH_FOLDER, "build"),
68
+ ]);
69
+ options?.onProgress({ current: EProgressStep.BUILD, total: TOTAL_STEPS });
70
+ const deployOutput = await execFile("graph", [
71
+ "deploy",
72
+ args.name,
73
+ subgraphManifestPath,
74
+ "--node",
75
+ process.env.SUBGRAPH_PROVIDER_URL,
76
+ "--deploy-key",
77
+ process.env.SUBGRAPH_DEPLOY_KEY,
78
+ "--version-label",
79
+ args.tag,
80
+ ]);
81
+ options?.onProgress({ current: EProgressStep.DEPLOY, total: TOTAL_STEPS });
82
+ this.logger.log(deployOutput.stdout);
83
+ const url = deployOutput.stdout.match(URL_REGEX)?.[1]?.trim().replace("\u001b[0m", "");
84
+ if (!url) {
85
+ if (deployOutput.stderr.includes("Deploy key not found.")) {
86
+ throw new Error(ErrorCodes.SUBGRAPH_DEPLOY_KEY_NOT_FOUND.toString());
87
+ }
88
+ else {
89
+ throw new Error(ErrorCodes.SUBGRAPH_DEPLOY.toString());
90
+ }
91
+ }
92
+ options?.onSuccess(url);
93
+ return { url };
94
+ }
95
+ catch (error) {
96
+ this.logger.error("Error: ", error);
97
+ options?.onFail(error);
98
+ throw new Error(error.message);
99
+ }
100
+ }
101
+ };
102
+ SubgraphService = SubgraphService_1 = __decorate([
103
+ Injectable()
104
+ ], SubgraphService);
105
+ export { SubgraphService };
106
+ //# sourceMappingURL=subgraph.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.service.js","sourceRoot":"","sources":["../../../ts/subgraph/subgraph.service.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE3D,OAAO,EACL,aAAa,EACb,WAAW,GAIZ,MAAM,SAAS,CAAC;AAEjB,MAAM,QAAQ,GAAG,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;AAElD,MAAM,SAAS,GAAG,sBAAsB,CAAC;AAEzC;;GAEG;AAEI,IAAM,eAAe,uBAArB,MAAM,eAAe;IAC1B;;OAEG;IACc,MAAM,GAAG,IAAI,MAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAE3D;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,CAAC,IAAyB,EAAE,OAA0B;QAChE,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACrC,CAAC;YAED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AM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAEvF,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,IAAI,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;oBAC1D,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,6BAA6B,CAAC,QAAQ,EAAE,CAAC,CAAC;gBACvE,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;YAED,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;YAExB,OAAO,EAAE,GAAG,EAAE,CAAC;QACjB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACpC,OAAO,EAAE,MAAM,CAAC,KAAc,CAAC,CAAC;YAChC,MAAM,IAAI,KAAK,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;CACF,CAAA;AAxGY,eAAe;IAD3B,UAAU,EAAE;GACA,eAAe,CAwG3B"}
@@ -0,0 +1,93 @@
1
+ import type { ESupportedNetworks } from "../common";
2
+ /**
3
+ * WS events for subgraph
4
+ */
5
+ export declare enum ESubgraphEvents {
6
+ START = "start-deploy",
7
+ PROGRESS = "progress-deploy",
8
+ FINISH = "finish-deploy",
9
+ ERROR = "exception"
10
+ }
11
+ /**
12
+ * Interface that represents deploy subgraph args
13
+ */
14
+ export interface IDeploySubgraphArgs {
15
+ /**
16
+ * MACI contract address
17
+ */
18
+ maciContractAddress: string;
19
+ /**
20
+ * Start block
21
+ */
22
+ startBlock: number;
23
+ /**
24
+ * Network
25
+ */
26
+ network: ESupportedNetworks;
27
+ /**
28
+ * Subgraph name
29
+ */
30
+ name: string;
31
+ /**
32
+ * Version tag
33
+ */
34
+ tag: string;
35
+ }
36
+ /**
37
+ * Interface that represents deploy subgraph return data
38
+ */
39
+ export interface IDeploySubgraphReturn {
40
+ /**
41
+ * Deployed subgraph url
42
+ */
43
+ url: string;
44
+ }
45
+ /**
46
+ * Interface that represents progress data
47
+ */
48
+ export interface IProgressArgs {
49
+ /**
50
+ * Current step
51
+ */
52
+ current: EProgressStep;
53
+ /**
54
+ * Total steps
55
+ */
56
+ total: number;
57
+ }
58
+ /**
59
+ * Progress step
60
+ */
61
+ export declare enum EProgressStep {
62
+ SCHEMA = 0,
63
+ NETWORK = 1,
64
+ TEMPLATE = 2,
65
+ CODEGEN = 3,
66
+ BUILD = 4,
67
+ DEPLOY = 5
68
+ }
69
+ export declare const TOTAL_STEPS: number;
70
+ /**
71
+ * Interface that represents websocket hooks for subgraph service
72
+ */
73
+ export interface ISubgraphWsHooks {
74
+ /**
75
+ * Websockets progress hook
76
+ *
77
+ * @param params - progress params
78
+ */
79
+ onProgress: ({ current, total }: IProgressArgs) => void;
80
+ /**
81
+ * Websockets error hook
82
+ *
83
+ * @param error - error
84
+ */
85
+ onFail: (error: Error) => void;
86
+ /**
87
+ * Websockets success hook
88
+ *
89
+ * @param url - subgraph url
90
+ */
91
+ onSuccess: (url: string) => void;
92
+ }
93
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD;;GAEG;AACH,oBAAY,eAAe;IACzB,KAAK,iBAAiB;IACtB,QAAQ,oBAAoB;IAC5B,MAAM,kBAAkB;IACxB,KAAK,cAAc;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,kBAAkB,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC;IAEvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,oBAAY,aAAa;IACvB,MAAM,IAAA;IACN,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,OAAO,IAAA;IACP,KAAK,IAAA;IACL,MAAM,IAAA;CACP;AAED,eAAO,MAAM,WAAW,QAAwC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,aAAa,KAAK,IAAI,CAAC;IAExD;;;;OAIG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAE/B;;;;OAIG;IACH,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * WS events for subgraph
3
+ */
4
+ export var ESubgraphEvents;
5
+ (function (ESubgraphEvents) {
6
+ ESubgraphEvents["START"] = "start-deploy";
7
+ ESubgraphEvents["PROGRESS"] = "progress-deploy";
8
+ ESubgraphEvents["FINISH"] = "finish-deploy";
9
+ ESubgraphEvents["ERROR"] = "exception";
10
+ })(ESubgraphEvents || (ESubgraphEvents = {}));
11
+ /**
12
+ * Progress step
13
+ */
14
+ export var EProgressStep;
15
+ (function (EProgressStep) {
16
+ EProgressStep[EProgressStep["SCHEMA"] = 0] = "SCHEMA";
17
+ EProgressStep[EProgressStep["NETWORK"] = 1] = "NETWORK";
18
+ EProgressStep[EProgressStep["TEMPLATE"] = 2] = "TEMPLATE";
19
+ EProgressStep[EProgressStep["CODEGEN"] = 3] = "CODEGEN";
20
+ EProgressStep[EProgressStep["BUILD"] = 4] = "BUILD";
21
+ EProgressStep[EProgressStep["DEPLOY"] = 5] = "DEPLOY";
22
+ })(EProgressStep || (EProgressStep = {}));
23
+ export const TOTAL_STEPS = Object.keys(EProgressStep).length / 2;
24
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../ts/subgraph/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,yCAAsB,CAAA;IACtB,+CAA4B,CAAA;IAC5B,2CAAwB,CAAA;IACxB,sCAAmB,CAAA;AACrB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAyDD;;GAEG;AACH,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,qDAAM,CAAA;IACN,uDAAO,CAAA;IACP,yDAAQ,CAAA;IACR,uDAAO,CAAA;IACP,mDAAK,CAAA;IACL,qDAAM,CAAA;AACR,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC"}