@maci-protocol/sdk 0.0.0-ci.185b643

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 (310) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/LICENSE +22 -0
  3. package/README.md +12 -0
  4. package/build/package.json +57 -0
  5. package/build/ts/browser/index.d.ts +13 -0
  6. package/build/ts/browser/index.d.ts.map +1 -0
  7. package/build/ts/browser/index.js +34 -0
  8. package/build/ts/browser/index.js.map +1 -0
  9. package/build/ts/browser/joinPoll.d.ts +8 -0
  10. package/build/ts/browser/joinPoll.d.ts.map +1 -0
  11. package/build/ts/browser/joinPoll.js +84 -0
  12. package/build/ts/browser/joinPoll.js.map +1 -0
  13. package/build/ts/browser/utils.d.ts +18 -0
  14. package/build/ts/browser/utils.d.ts.map +1 -0
  15. package/build/ts/browser/utils.js +37 -0
  16. package/build/ts/browser/utils.js.map +1 -0
  17. package/build/ts/deploy/index.d.ts +6 -0
  18. package/build/ts/deploy/index.d.ts.map +1 -0
  19. package/build/ts/deploy/index.js +12 -0
  20. package/build/ts/deploy/index.js.map +1 -0
  21. package/build/ts/deploy/maci.d.ts +8 -0
  22. package/build/ts/deploy/maci.d.ts.map +1 -0
  23. package/build/ts/deploy/maci.js +87 -0
  24. package/build/ts/deploy/maci.js.map +1 -0
  25. package/build/ts/deploy/poll.d.ts +8 -0
  26. package/build/ts/deploy/poll.d.ts.map +1 -0
  27. package/build/ts/deploy/poll.js +114 -0
  28. package/build/ts/deploy/poll.js.map +1 -0
  29. package/build/ts/deploy/types.d.ts +216 -0
  30. package/build/ts/deploy/types.d.ts.map +1 -0
  31. package/build/ts/deploy/types.js +3 -0
  32. package/build/ts/deploy/types.js.map +1 -0
  33. package/build/ts/deploy/utils.d.ts +11 -0
  34. package/build/ts/deploy/utils.d.ts.map +1 -0
  35. package/build/ts/deploy/utils.js +22 -0
  36. package/build/ts/deploy/utils.js.map +1 -0
  37. package/build/ts/deploy/vkRegistry.d.ts +7 -0
  38. package/build/ts/deploy/vkRegistry.d.ts.map +1 -0
  39. package/build/ts/deploy/vkRegistry.js +14 -0
  40. package/build/ts/deploy/vkRegistry.js.map +1 -0
  41. package/build/ts/index.d.ts +16 -0
  42. package/build/ts/index.d.ts.map +1 -0
  43. package/build/ts/index.js +82 -0
  44. package/build/ts/index.js.map +1 -0
  45. package/build/ts/maci/index.d.ts +6 -0
  46. package/build/ts/maci/index.d.ts.map +1 -0
  47. package/build/ts/maci/index.js +17 -0
  48. package/build/ts/maci/index.js.map +1 -0
  49. package/build/ts/maci/merge.d.ts +9 -0
  50. package/build/ts/maci/merge.d.ts.map +1 -0
  51. package/build/ts/maci/merge.js +29 -0
  52. package/build/ts/maci/merge.js.map +1 -0
  53. package/build/ts/maci/policy.d.ts +53 -0
  54. package/build/ts/maci/policy.d.ts.map +1 -0
  55. package/build/ts/maci/policy.js +166 -0
  56. package/build/ts/maci/policy.js.map +1 -0
  57. package/build/ts/maci/state.d.ts +8 -0
  58. package/build/ts/maci/state.d.ts.map +1 -0
  59. package/build/ts/maci/state.js +82 -0
  60. package/build/ts/maci/state.js.map +1 -0
  61. package/build/ts/maci/types.d.ts +208 -0
  62. package/build/ts/maci/types.d.ts.map +1 -0
  63. package/build/ts/maci/types.js +20 -0
  64. package/build/ts/maci/types.js.map +1 -0
  65. package/build/ts/maciKeys/__tests__/keypair.test.d.ts +2 -0
  66. package/build/ts/maciKeys/__tests__/keypair.test.d.ts.map +1 -0
  67. package/build/ts/maciKeys/__tests__/keypair.test.js +24 -0
  68. package/build/ts/maciKeys/__tests__/keypair.test.js.map +1 -0
  69. package/build/ts/maciKeys/__tests__/publicKeys.test.d.ts +2 -0
  70. package/build/ts/maciKeys/__tests__/publicKeys.test.d.ts.map +1 -0
  71. package/build/ts/maciKeys/__tests__/publicKeys.test.js +22 -0
  72. package/build/ts/maciKeys/__tests__/publicKeys.test.js.map +1 -0
  73. package/build/ts/maciKeys/index.d.ts +4 -0
  74. package/build/ts/maciKeys/index.d.ts.map +1 -0
  75. package/build/ts/maciKeys/index.js +8 -0
  76. package/build/ts/maciKeys/index.js.map +1 -0
  77. package/build/ts/maciKeys/keypair.d.ts +9 -0
  78. package/build/ts/maciKeys/keypair.d.ts.map +1 -0
  79. package/build/ts/maciKeys/keypair.js +20 -0
  80. package/build/ts/maciKeys/keypair.js.map +1 -0
  81. package/build/ts/maciKeys/publicKeys.d.ts +8 -0
  82. package/build/ts/maciKeys/publicKeys.d.ts.map +1 -0
  83. package/build/ts/maciKeys/publicKeys.js +23 -0
  84. package/build/ts/maciKeys/publicKeys.js.map +1 -0
  85. package/build/ts/maciKeys/types.d.ts +23 -0
  86. package/build/ts/maciKeys/types.d.ts.map +1 -0
  87. package/build/ts/maciKeys/types.js +3 -0
  88. package/build/ts/maciKeys/types.js.map +1 -0
  89. package/build/ts/poll/index.d.ts +4 -0
  90. package/build/ts/poll/index.d.ts.map +1 -0
  91. package/build/ts/poll/index.js +9 -0
  92. package/build/ts/poll/index.js.map +1 -0
  93. package/build/ts/poll/poll.d.ts +14 -0
  94. package/build/ts/poll/poll.d.ts.map +1 -0
  95. package/build/ts/poll/poll.js +62 -0
  96. package/build/ts/poll/poll.js.map +1 -0
  97. package/build/ts/poll/types.d.ts +151 -0
  98. package/build/ts/poll/types.d.ts.map +1 -0
  99. package/build/ts/poll/types.js +3 -0
  100. package/build/ts/poll/types.js.map +1 -0
  101. package/build/ts/poll/utils.d.ts +9 -0
  102. package/build/ts/poll/utils.d.ts.map +1 -0
  103. package/build/ts/poll/utils.js +43 -0
  104. package/build/ts/poll/utils.js.map +1 -0
  105. package/build/ts/proof/__tests__/download.test.d.ts +2 -0
  106. package/build/ts/proof/__tests__/download.test.d.ts.map +1 -0
  107. package/build/ts/proof/__tests__/download.test.js +50 -0
  108. package/build/ts/proof/__tests__/download.test.js.map +1 -0
  109. package/build/ts/proof/constants.d.ts +17 -0
  110. package/build/ts/proof/constants.d.ts.map +1 -0
  111. package/build/ts/proof/constants.js +20 -0
  112. package/build/ts/proof/constants.js.map +1 -0
  113. package/build/ts/proof/download.d.ts +9 -0
  114. package/build/ts/proof/download.d.ts.map +1 -0
  115. package/build/ts/proof/download.js +49 -0
  116. package/build/ts/proof/download.js.map +1 -0
  117. package/build/ts/proof/generate.d.ts +8 -0
  118. package/build/ts/proof/generate.d.ts.map +1 -0
  119. package/build/ts/proof/generate.js +127 -0
  120. package/build/ts/proof/generate.js.map +1 -0
  121. package/build/ts/proof/index.d.ts +4 -0
  122. package/build/ts/proof/index.d.ts.map +1 -0
  123. package/build/ts/proof/index.js +8 -0
  124. package/build/ts/proof/index.js.map +1 -0
  125. package/build/ts/proof/prove.d.ts +8 -0
  126. package/build/ts/proof/prove.d.ts.map +1 -0
  127. package/build/ts/proof/prove.js +81 -0
  128. package/build/ts/proof/prove.js.map +1 -0
  129. package/build/ts/proof/types.d.ts +175 -0
  130. package/build/ts/proof/types.d.ts.map +1 -0
  131. package/build/ts/proof/types.js +3 -0
  132. package/build/ts/proof/types.js.map +1 -0
  133. package/build/ts/relayer/__tests__/messages.test.d.ts +2 -0
  134. package/build/ts/relayer/__tests__/messages.test.d.ts.map +1 -0
  135. package/build/ts/relayer/__tests__/messages.test.js +76 -0
  136. package/build/ts/relayer/__tests__/messages.test.js.map +1 -0
  137. package/build/ts/relayer/__tests__/utils.test.d.ts +2 -0
  138. package/build/ts/relayer/__tests__/utils.test.d.ts.map +1 -0
  139. package/build/ts/relayer/__tests__/utils.test.js +73 -0
  140. package/build/ts/relayer/__tests__/utils.test.js.map +1 -0
  141. package/build/ts/relayer/index.d.ts +3 -0
  142. package/build/ts/relayer/index.d.ts.map +1 -0
  143. package/build/ts/relayer/index.js +8 -0
  144. package/build/ts/relayer/index.js.map +1 -0
  145. package/build/ts/relayer/messages.d.ts +23 -0
  146. package/build/ts/relayer/messages.d.ts.map +1 -0
  147. package/build/ts/relayer/messages.js +66 -0
  148. package/build/ts/relayer/messages.js.map +1 -0
  149. package/build/ts/relayer/types.d.ts +168 -0
  150. package/build/ts/relayer/types.d.ts.map +1 -0
  151. package/build/ts/relayer/types.js +3 -0
  152. package/build/ts/relayer/types.js.map +1 -0
  153. package/build/ts/relayer/utils.d.ts +12 -0
  154. package/build/ts/relayer/utils.d.ts.map +1 -0
  155. package/build/ts/relayer/utils.js +37 -0
  156. package/build/ts/relayer/utils.js.map +1 -0
  157. package/build/ts/tally/commitments.d.ts +9 -0
  158. package/build/ts/tally/commitments.d.ts.map +1 -0
  159. package/build/ts/tally/commitments.js +42 -0
  160. package/build/ts/tally/commitments.js.map +1 -0
  161. package/build/ts/tally/index.d.ts +4 -0
  162. package/build/ts/tally/index.d.ts.map +1 -0
  163. package/build/ts/tally/index.js +8 -0
  164. package/build/ts/tally/index.js.map +1 -0
  165. package/build/ts/tally/types.d.ts +179 -0
  166. package/build/ts/tally/types.d.ts.map +1 -0
  167. package/build/ts/tally/types.js +3 -0
  168. package/build/ts/tally/types.js.map +1 -0
  169. package/build/ts/tally/utils.d.ts +24 -0
  170. package/build/ts/tally/utils.d.ts.map +1 -0
  171. package/build/ts/tally/utils.js +50 -0
  172. package/build/ts/tally/utils.js.map +1 -0
  173. package/build/ts/tally/verification.d.ts +7 -0
  174. package/build/ts/tally/verification.d.ts.map +1 -0
  175. package/build/ts/tally/verification.js +62 -0
  176. package/build/ts/tally/verification.js.map +1 -0
  177. package/build/ts/trees/index.d.ts +3 -0
  178. package/build/ts/trees/index.d.ts.map +1 -0
  179. package/build/ts/trees/index.js +6 -0
  180. package/build/ts/trees/index.js.map +1 -0
  181. package/build/ts/trees/stateTree.d.ts +13 -0
  182. package/build/ts/trees/stateTree.d.ts.map +1 -0
  183. package/build/ts/trees/stateTree.js +56 -0
  184. package/build/ts/trees/stateTree.js.map +1 -0
  185. package/build/ts/trees/types.d.ts +46 -0
  186. package/build/ts/trees/types.d.ts.map +1 -0
  187. package/build/ts/trees/types.js +3 -0
  188. package/build/ts/trees/types.js.map +1 -0
  189. package/build/ts/user/index.d.ts +5 -0
  190. package/build/ts/user/index.d.ts.map +1 -0
  191. package/build/ts/user/index.js +13 -0
  192. package/build/ts/user/index.js.map +1 -0
  193. package/build/ts/user/joinPoll.d.ts +8 -0
  194. package/build/ts/user/joinPoll.d.ts.map +1 -0
  195. package/build/ts/user/joinPoll.js +84 -0
  196. package/build/ts/user/joinPoll.js.map +1 -0
  197. package/build/ts/user/signup.d.ts +20 -0
  198. package/build/ts/user/signup.d.ts.map +1 -0
  199. package/build/ts/user/signup.js +79 -0
  200. package/build/ts/user/signup.js.map +1 -0
  201. package/build/ts/user/types.d.ts +416 -0
  202. package/build/ts/user/types.d.ts.map +1 -0
  203. package/build/ts/user/types.js +3 -0
  204. package/build/ts/user/types.js.map +1 -0
  205. package/build/ts/user/utils.d.ts +68 -0
  206. package/build/ts/user/utils.d.ts.map +1 -0
  207. package/build/ts/user/utils.js +224 -0
  208. package/build/ts/user/utils.js.map +1 -0
  209. package/build/ts/utils/cid.d.ts +23 -0
  210. package/build/ts/utils/cid.d.ts.map +1 -0
  211. package/build/ts/utils/cid.js +72 -0
  212. package/build/ts/utils/cid.js.map +1 -0
  213. package/build/ts/utils/constants.d.ts +2 -0
  214. package/build/ts/utils/constants.d.ts.map +1 -0
  215. package/build/ts/utils/constants.js +5 -0
  216. package/build/ts/utils/constants.js.map +1 -0
  217. package/build/ts/utils/contracts.d.ts +15 -0
  218. package/build/ts/utils/contracts.d.ts.map +1 -0
  219. package/build/ts/utils/contracts.js +26 -0
  220. package/build/ts/utils/contracts.js.map +1 -0
  221. package/build/ts/utils/files.d.ts +9 -0
  222. package/build/ts/utils/files.d.ts.map +1 -0
  223. package/build/ts/utils/files.js +20 -0
  224. package/build/ts/utils/files.js.map +1 -0
  225. package/build/ts/utils/formatting.d.ts +8 -0
  226. package/build/ts/utils/formatting.d.ts.map +1 -0
  227. package/build/ts/utils/formatting.js +11 -0
  228. package/build/ts/utils/formatting.js.map +1 -0
  229. package/build/ts/utils/fundWallet.d.ts +7 -0
  230. package/build/ts/utils/fundWallet.d.ts.map +1 -0
  231. package/build/ts/utils/fundWallet.js +20 -0
  232. package/build/ts/utils/fundWallet.js.map +1 -0
  233. package/build/ts/utils/index.d.ts +12 -0
  234. package/build/ts/utils/index.d.ts.map +1 -0
  235. package/build/ts/utils/index.js +28 -0
  236. package/build/ts/utils/index.js.map +1 -0
  237. package/build/ts/utils/params.d.ts +7 -0
  238. package/build/ts/utils/params.d.ts.map +1 -0
  239. package/build/ts/utils/params.js +19 -0
  240. package/build/ts/utils/params.js.map +1 -0
  241. package/build/ts/utils/proofs.d.ts +13 -0
  242. package/build/ts/utils/proofs.d.ts.map +1 -0
  243. package/build/ts/utils/proofs.js +41 -0
  244. package/build/ts/utils/proofs.js.map +1 -0
  245. package/build/ts/utils/timeTravel.d.ts +7 -0
  246. package/build/ts/utils/timeTravel.d.ts.map +1 -0
  247. package/build/ts/utils/timeTravel.js +14 -0
  248. package/build/ts/utils/timeTravel.js.map +1 -0
  249. package/build/ts/utils/trees.d.ts +13 -0
  250. package/build/ts/utils/trees.d.ts.map +1 -0
  251. package/build/ts/utils/trees.js +30 -0
  252. package/build/ts/utils/trees.js.map +1 -0
  253. package/build/ts/utils/types.d.ts +71 -0
  254. package/build/ts/utils/types.d.ts.map +1 -0
  255. package/build/ts/utils/types.js +3 -0
  256. package/build/ts/utils/types.js.map +1 -0
  257. package/build/ts/utils/utils.d.ts +24 -0
  258. package/build/ts/utils/utils.d.ts.map +1 -0
  259. package/build/ts/utils/utils.js +49 -0
  260. package/build/ts/utils/utils.js.map +1 -0
  261. package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts +10 -0
  262. package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts.map +1 -0
  263. package/build/ts/verifyingKeys/checkVerifyingKeys.js +67 -0
  264. package/build/ts/verifyingKeys/checkVerifyingKeys.js.map +1 -0
  265. package/build/ts/verifyingKeys/index.d.ts +5 -0
  266. package/build/ts/verifyingKeys/index.d.ts.map +1 -0
  267. package/build/ts/verifyingKeys/index.js +13 -0
  268. package/build/ts/verifyingKeys/index.js.map +1 -0
  269. package/build/ts/verifyingKeys/setVerifyingKeys.d.ts +7 -0
  270. package/build/ts/verifyingKeys/setVerifyingKeys.d.ts.map +1 -0
  271. package/build/ts/verifyingKeys/setVerifyingKeys.js +85 -0
  272. package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -0
  273. package/build/ts/verifyingKeys/types.d.ts +235 -0
  274. package/build/ts/verifyingKeys/types.d.ts.map +1 -0
  275. package/build/ts/verifyingKeys/types.js +3 -0
  276. package/build/ts/verifyingKeys/types.js.map +1 -0
  277. package/build/ts/verifyingKeys/utils.d.ts +29 -0
  278. package/build/ts/verifyingKeys/utils.d.ts.map +1 -0
  279. package/build/ts/verifyingKeys/utils.js +103 -0
  280. package/build/ts/verifyingKeys/utils.js.map +1 -0
  281. package/build/ts/vote/generate.d.ts +8 -0
  282. package/build/ts/vote/generate.d.ts.map +1 -0
  283. package/build/ts/vote/generate.js +46 -0
  284. package/build/ts/vote/generate.js.map +1 -0
  285. package/build/ts/vote/index.d.ts +6 -0
  286. package/build/ts/vote/index.d.ts.map +1 -0
  287. package/build/ts/vote/index.js +15 -0
  288. package/build/ts/vote/index.js.map +1 -0
  289. package/build/ts/vote/invalidate.d.ts +13 -0
  290. package/build/ts/vote/invalidate.d.ts.map +1 -0
  291. package/build/ts/vote/invalidate.js +44 -0
  292. package/build/ts/vote/invalidate.js.map +1 -0
  293. package/build/ts/vote/publish.d.ts +14 -0
  294. package/build/ts/vote/publish.d.ts.map +1 -0
  295. package/build/ts/vote/publish.js +88 -0
  296. package/build/ts/vote/publish.js.map +1 -0
  297. package/build/ts/vote/submit.d.ts +13 -0
  298. package/build/ts/vote/submit.d.ts.map +1 -0
  299. package/build/ts/vote/submit.js +36 -0
  300. package/build/ts/vote/submit.js.map +1 -0
  301. package/build/ts/vote/types.d.ts +238 -0
  302. package/build/ts/vote/types.d.ts.map +1 -0
  303. package/build/ts/vote/types.js +3 -0
  304. package/build/ts/vote/types.js.map +1 -0
  305. package/build/ts/vote/utils.d.ts +16 -0
  306. package/build/ts/vote/utils.d.ts.map +1 -0
  307. package/build/ts/vote/utils.js +26 -0
  308. package/build/ts/vote/utils.js.map +1 -0
  309. package/build/tsconfig.build.tsbuildinfo +1 -0
  310. package/package.json +58 -0
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deployPoll = void 0;
4
+ const contracts_1 = require("@maci-protocol/contracts");
5
+ const core_1 = require("@maci-protocol/core");
6
+ const domainobjs_1 = require("@maci-protocol/domainobjs");
7
+ const contracts_2 = require("../utils/contracts");
8
+ const utils_1 = require("./utils");
9
+ /**
10
+ * Deploy a poll
11
+ * @param args - The arguments for the deploy poll command
12
+ * @returns The addresses of the deployed contracts
13
+ */
14
+ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, intStateTreeDepth, voteOptionTreeDepth, messageBatchSize, stateTreeDepth, coordinatorPubKey, verifierContractAddress, vkRegistryContractAddress, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, freeForAllCheckerFactoryAddress, freeForAllPolicyFactoryAddress, signer, }) => {
15
+ if (!vkRegistryContractAddress) {
16
+ throw new Error("Please provide a VkRegistry contract address");
17
+ }
18
+ if (!maciAddress) {
19
+ throw new Error("Please provide a MACI contract address");
20
+ }
21
+ const isMaciExists = await (0, contracts_2.contractExists)(signer.provider, maciAddress);
22
+ if (!isMaciExists) {
23
+ throw new Error("MACI contract does not exist");
24
+ }
25
+ const maciContract = contracts_1.MACI__factory.connect(maciAddress, signer);
26
+ // check if we have a signupPolicy already deployed or passed as arg
27
+ let signupPolicyContractAddress = policyContractAddress;
28
+ if (!signupPolicyContractAddress) {
29
+ const checkerFactory = freeForAllCheckerFactoryAddress
30
+ ? contracts_1.FreeForAllCheckerFactory__factory.connect(freeForAllCheckerFactoryAddress, signer)
31
+ : undefined;
32
+ const policyFactory = freeForAllPolicyFactoryAddress
33
+ ? contracts_1.FreeForAllPolicyFactory__factory.connect(freeForAllPolicyFactoryAddress, signer)
34
+ : undefined;
35
+ const [contract] = await (0, contracts_1.deployFreeForAllSignUpPolicy)({ checker: checkerFactory, policy: policyFactory }, signer, true);
36
+ signupPolicyContractAddress = await contract.getAddress();
37
+ }
38
+ let initialVoiceCreditProxyAddress = initialVoiceCreditProxyContractAddress;
39
+ if (!initialVoiceCreditProxyAddress) {
40
+ const [contract] = await (0, contracts_1.deployConstantInitialVoiceCreditProxy)({ amount: initialVoiceCredits ?? utils_1.DEFAULT_INITIAL_VOICE_CREDITS }, signer, undefined, true);
41
+ initialVoiceCreditProxyAddress = await contract.getAddress();
42
+ }
43
+ // required arg -> poll duration
44
+ if (pollStartTimestamp < Math.floor(Date.now() / 1000)) {
45
+ throw new Error("Start date cannot be in the past");
46
+ }
47
+ if (pollEndTimestamp <= pollStartTimestamp) {
48
+ throw new Error("End date cannot be before start date");
49
+ }
50
+ // required arg -> int state tree depth
51
+ if (intStateTreeDepth <= 0) {
52
+ throw new Error("Int state tree depth cannot be <= 0");
53
+ }
54
+ // required arg -> message tree depth
55
+ if (messageBatchSize <= 0) {
56
+ throw new Error("Message batch size cannot be <= 0");
57
+ }
58
+ // required arg -> vote option tree depth
59
+ if (voteOptionTreeDepth <= 0) {
60
+ throw new Error("Vote option tree depth cannot be <= 0");
61
+ }
62
+ // ensure the vote option parameter is valid (if passed)
63
+ if (voteOptions && voteOptions > core_1.VOTE_OPTION_TREE_ARITY ** voteOptionTreeDepth) {
64
+ throw new Error("Vote options cannot be greater than the number of leaves in the vote option tree");
65
+ }
66
+ // we check that the coordinator's public key is valid
67
+ if (!domainobjs_1.PubKey.isValidSerializedPubKey(coordinatorPubKey.serialize())) {
68
+ throw new Error("Invalid MACI public key");
69
+ }
70
+ const receipt = await maciContract
71
+ .deployPoll({
72
+ startDate: pollStartTimestamp,
73
+ endDate: pollEndTimestamp,
74
+ treeDepths: {
75
+ intStateTreeDepth,
76
+ voteOptionTreeDepth,
77
+ stateTreeDepth,
78
+ },
79
+ messageBatchSize,
80
+ coordinatorPubKey: coordinatorPubKey.asContractParam(),
81
+ verifier: verifierContractAddress,
82
+ vkRegistry: vkRegistryContractAddress,
83
+ mode,
84
+ policy: signupPolicyContractAddress,
85
+ initialVoiceCreditProxy: initialVoiceCreditProxyAddress,
86
+ relayers,
87
+ voteOptions,
88
+ })
89
+ .then((tx) => tx.wait());
90
+ if (receipt?.status !== 1) {
91
+ throw new Error("Deploy poll transaction is failed");
92
+ }
93
+ // parse DeployPoll log
94
+ const events = await maciContract.queryFilter(maciContract.filters.DeployPoll, receipt.blockNumber, receipt.blockNumber);
95
+ const log = events[events.length - 1];
96
+ // eslint-disable-next-line no-underscore-dangle
97
+ const pollId = log.args._pollId;
98
+ const pollContracts = await maciContract.getPoll(pollId);
99
+ const pollContractAddress = pollContracts.poll;
100
+ const messageProcessorContractAddress = pollContracts.messageProcessor;
101
+ const tallyContractAddress = pollContracts.tally;
102
+ const policyContract = contracts_1.IBasePolicy__factory.connect(signupPolicyContractAddress, signer);
103
+ await policyContract.setTarget(pollContractAddress).then((tx) => tx.wait());
104
+ return {
105
+ pollId,
106
+ pollContractAddress,
107
+ messageProcessorContractAddress,
108
+ tallyContractAddress,
109
+ policyContractAddress: signupPolicyContractAddress,
110
+ initialVoiceCreditProxyContractAddress: initialVoiceCreditProxyAddress,
111
+ };
112
+ };
113
+ exports.deployPoll = deployPoll;
114
+ //# sourceMappingURL=poll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll.js","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":";;;AAAA,wDAOkC;AAClC,8CAA6D;AAC7D,0DAAmD;AAInD,kDAAoD;AAEpD,mCAAwD;AAExD;;;;GAIG;AACI,MAAM,UAAU,GAAG,KAAK,EAAE,EAC/B,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EAC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mB,CAAC,OAAO,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;IACxF,MAAM,cAAc,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAE5E,OAAO;QACL,MAAM;QACN,mBAAmB;QACnB,+BAA+B;QAC/B,oBAAoB;QACpB,qBAAqB,EAAE,2BAA2B;QAClD,sCAAsC,EAAE,8BAA8B;KACvE,CAAC;AACJ,CAAC,CAAC;AAzJW,QAAA,UAAU,cAyJrB"}
@@ -0,0 +1,216 @@
1
+ import { EMode, TAbi } from "@maci-protocol/contracts";
2
+ import { PubKey } from "@maci-protocol/domainobjs";
3
+ import type { Signer } from "ethers";
4
+ /**
5
+ * The arguments for the deploy poll command
6
+ */
7
+ export interface IDeployPollArgs {
8
+ /**
9
+ * The address of the MACI contract
10
+ */
11
+ maciAddress: string;
12
+ /**
13
+ * The start timestamp of the poll
14
+ */
15
+ pollStartTimestamp: number;
16
+ /**
17
+ * The end timestamp of the poll
18
+ */
19
+ pollEndTimestamp: number;
20
+ /**
21
+ * The depth of the integer state tree
22
+ */
23
+ intStateTreeDepth: number;
24
+ /**
25
+ * The depth of the vote option tree
26
+ */
27
+ voteOptionTreeDepth: number;
28
+ /**
29
+ * The batch size of the messages
30
+ */
31
+ messageBatchSize: number;
32
+ /**
33
+ * The poll state tree depth
34
+ */
35
+ stateTreeDepth: number;
36
+ /**
37
+ * The coordinator public key
38
+ */
39
+ coordinatorPubKey: PubKey;
40
+ /**
41
+ * The address of the verifier contract
42
+ */
43
+ verifierContractAddress: string;
44
+ /**
45
+ * The address of the VK registry contract
46
+ */
47
+ vkRegistryContractAddress: string;
48
+ /**
49
+ * The mode of the poll
50
+ */
51
+ mode: EMode;
52
+ /**
53
+ * The address of the policy contract
54
+ */
55
+ policyContractAddress: string;
56
+ /**
57
+ * The address of the initial voice credit proxy contract
58
+ */
59
+ initialVoiceCreditProxyContractAddress?: string;
60
+ /**
61
+ * The addresses of the relayers
62
+ */
63
+ relayers: string[];
64
+ /**
65
+ * The number of vote options
66
+ */
67
+ voteOptions: number;
68
+ /**
69
+ * The initial voice credits to be minted
70
+ */
71
+ initialVoiceCredits?: number;
72
+ /**
73
+ * Free for all checker factory address (using for deployment optimization if there is no signup policy)
74
+ */
75
+ freeForAllCheckerFactoryAddress?: string;
76
+ /**
77
+ * Free for all policy factory address (using for deployment optimization if there is no signup policy)
78
+ */
79
+ freeForAllPolicyFactoryAddress?: string;
80
+ /**
81
+ * The signer
82
+ */
83
+ signer: Signer;
84
+ }
85
+ /**
86
+ * The addresses of the deployed poll contracts
87
+ */
88
+ export interface IPollContractsData {
89
+ /**
90
+ * The address of the poll contract
91
+ */
92
+ pollContractAddress: string;
93
+ /**
94
+ * The address of the message processor contract
95
+ */
96
+ messageProcessorContractAddress: string;
97
+ /**
98
+ * The address of the tally contract
99
+ */
100
+ tallyContractAddress: string;
101
+ /**
102
+ * The poll id
103
+ */
104
+ pollId: bigint;
105
+ /**
106
+ * The address of the policy contract
107
+ */
108
+ policyContractAddress: string;
109
+ /**
110
+ * The address of the initial voice credit proxy contract
111
+ */
112
+ initialVoiceCreditProxyContractAddress: string;
113
+ }
114
+ /**
115
+ * An interface that represents the arguments for MACI contracts deployment.
116
+ */
117
+ export interface IDeployMaciArgs {
118
+ /**
119
+ * The depth of the state tree
120
+ */
121
+ stateTreeDepth: number;
122
+ /**
123
+ * The address of the policy contract
124
+ */
125
+ signupPolicyAddress: string;
126
+ /**
127
+ * The signer to use to deploy the contract
128
+ */
129
+ signer: Signer;
130
+ /**
131
+ * The address of the PollFactory contract
132
+ */
133
+ pollFactoryAddress?: string;
134
+ /**
135
+ * The address of the MessageProcessorFactory contract
136
+ */
137
+ messageProcessorFactoryAddress?: string;
138
+ /**
139
+ * The address of the TallyFactory contract
140
+ */
141
+ tallyFactoryAddress?: string;
142
+ /**
143
+ * Poseidon contract addresses (if not provided, they will be deployed automatically)
144
+ */
145
+ poseidonAddresses?: Partial<{
146
+ poseidonT3: string;
147
+ poseidonT4: string;
148
+ poseidonT5: string;
149
+ poseidonT6: string;
150
+ }>;
151
+ }
152
+ /**
153
+ * An interface that represents the deployed MACI contracts.
154
+ */
155
+ export interface IMaciContracts {
156
+ /**
157
+ * The address of the MACI contract
158
+ */
159
+ maciContractAddress: string;
160
+ /**
161
+ * The address of the PollFactory contract
162
+ */
163
+ pollFactoryContractAddress: string;
164
+ /**
165
+ * The address of the MessageProcessorFactory contract
166
+ */
167
+ messageProcessorFactoryContractAddress: string;
168
+ /**
169
+ * The address of the TallyFactory contract
170
+ */
171
+ tallyFactoryContractAddress: string;
172
+ /**
173
+ * The addresses of the Poseidon contracts
174
+ */
175
+ poseidonAddresses: {
176
+ poseidonT3: string;
177
+ poseidonT4: string;
178
+ poseidonT5: string;
179
+ poseidonT6: string;
180
+ };
181
+ }
182
+ /**
183
+ * Interface for the arguments to the DeployVkRegistry command
184
+ */
185
+ export interface IDeployVkRegistryArgs {
186
+ /**
187
+ * A signer object
188
+ */
189
+ signer: Signer;
190
+ }
191
+ /**
192
+ * Arguments for deploying a factory
193
+ */
194
+ export interface IDeployFactoryArgs {
195
+ /**
196
+ * The abi of the factory
197
+ */
198
+ abi: TAbi;
199
+ /**
200
+ * The bytecode of the factory
201
+ */
202
+ bytecode: string;
203
+ /**
204
+ * The signer to use
205
+ */
206
+ signer: Signer;
207
+ /**
208
+ * The arguments
209
+ */
210
+ args?: unknown[];
211
+ /**
212
+ * The address of the factory
213
+ */
214
+ address?: string;
215
+ }
216
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/deploy/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,OAAO,KA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,EAAE,OAAO,EAAE,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../ts/deploy/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { IDeployFactoryArgs } from "./types";
2
+ export declare const DEFAULT_INITIAL_VOICE_CREDITS = 100;
3
+ /**
4
+ * Deploy a factory
5
+ * @param factory - Factory to deploy
6
+ * @param signer - Signer to use
7
+ * @param args - Arguments to pass to the factory
8
+ * @returns Deployed factory
9
+ */
10
+ export declare const deployFactoryWithLinkedLibraries: ({ abi, bytecode, signer, args, address, }: IDeployFactoryArgs) => Promise<string>;
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/deploy/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,GAAU,2CAMpD,kBAAkB,KAAG,OAAO,CAAC,MAAM,CASrC,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deployFactoryWithLinkedLibraries = exports.DEFAULT_INITIAL_VOICE_CREDITS = void 0;
4
+ const contracts_1 = require("@maci-protocol/contracts");
5
+ exports.DEFAULT_INITIAL_VOICE_CREDITS = 100;
6
+ /**
7
+ * Deploy a factory
8
+ * @param factory - Factory to deploy
9
+ * @param signer - Signer to use
10
+ * @param args - Arguments to pass to the factory
11
+ * @returns Deployed factory
12
+ */
13
+ const deployFactoryWithLinkedLibraries = async ({ abi, bytecode, signer, args, address, }) => {
14
+ if (address) {
15
+ return address;
16
+ }
17
+ const contractFactory = await (0, contracts_1.createContractFactory)(abi, bytecode, signer);
18
+ const contractFactoryContract = await (0, contracts_1.deployContractWithLinkedLibraries)(contractFactory, ...(args ?? []));
19
+ return contractFactoryContract.getAddress();
20
+ };
21
+ exports.deployFactoryWithLinkedLibraries = deployFactoryWithLinkedLibraries;
22
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/deploy/utils.ts"],"names":[],"mappings":";;;AAAA,wDAAoG;AAIvF,QAAA,6BAA6B,GAAG,GAAG,CAAC;AAEjD;;;;;;GAMG;AACI,MAAM,gCAAgC,GAAG,KAAK,EAAE,EACrD,GAAG,EACH,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,OAAO,GACY,EAAmB,EAAE;IACxC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,IAAA,iCAAqB,EAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE3E,MAAM,uBAAuB,GAAG,MAAM,IAAA,6CAAiC,EAAC,eAAe,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1G,OAAO,uBAAuB,CAAC,UAAU,EAAE,CAAC;AAC9C,CAAC,CAAC;AAfW,QAAA,gCAAgC,oCAe3C"}
@@ -0,0 +1,7 @@
1
+ import type { IDeployVkRegistryArgs } from "./types";
2
+ /**
3
+ * Deploy the vkRegistry contract
4
+ * @param args deploy VkRegistry arguments
5
+ */
6
+ export declare const deployVkRegistryContract: ({ signer }: IDeployVkRegistryArgs) => Promise<string>;
7
+ //# sourceMappingURL=vkRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vkRegistry.d.ts","sourceRoot":"","sources":["../../../ts/deploy/vkRegistry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAU,YAAY,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAIhG,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deployVkRegistryContract = void 0;
4
+ const contracts_1 = require("@maci-protocol/contracts");
5
+ /**
6
+ * Deploy the vkRegistry contract
7
+ * @param args deploy VkRegistry arguments
8
+ */
9
+ const deployVkRegistryContract = async ({ signer }) => {
10
+ const vkRegistry = await (0, contracts_1.deployVkRegistry)(signer, true);
11
+ return vkRegistry.getAddress();
12
+ };
13
+ exports.deployVkRegistryContract = deployVkRegistryContract;
14
+ //# sourceMappingURL=vkRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vkRegistry.js","sourceRoot":"","sources":["../../../ts/deploy/vkRegistry.ts"],"names":[],"mappings":";;;AAAA,wDAA4D;AAI5D;;;GAGG;AACI,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAAE,MAAM,EAAyB,EAAmB,EAAE;IACnG,MAAM,UAAU,GAAG,MAAM,IAAA,4BAAgB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAExD,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AACjC,CAAC,CAAC;AAJW,QAAA,wBAAwB,4BAInC"}
@@ -0,0 +1,16 @@
1
+ export * from "./verifyingKeys";
2
+ export * from "./maci";
3
+ export * from "./relayer";
4
+ export * from "./poll";
5
+ export * from "./proof";
6
+ export * from "./tally";
7
+ export * from "./trees";
8
+ export * from "./vote";
9
+ export * from "./utils";
10
+ export * from "./user";
11
+ export * from "./deploy";
12
+ export * from "./maciKeys";
13
+ export { EMode, EContracts, ECheckerFactories, ECheckers, EPolicies, EPolicyFactories, EInitialVoiceCreditProxies, EInitialVoiceCreditProxiesFactories, EDeploySteps, Deployment, ContractStorage, ProofGenerator, TreeMerger, Prover, extractVk, genProofRapidSnark, genProofSnarkjs, formatProofForVerifierContract, verifyProof, linkPoseidonLibraries, deployConstantInitialVoiceCreditProxy, deployMockVerifier, deployVkRegistry, deployVerifier, genMaciStateFromContract, deployPoseidonContracts, deployAnonAadhaarPolicy, deployEASSignUpPolicy, deployGitcoinPassportPolicy, deployMerkleProofPolicy, deploySemaphoreSignupPolicy, deployZupassSignUpPolicy, deployFreeForAllSignUpPolicy, deployContract, deployContractWithLinkedLibraries, getDefaultSigner, cleanThreads, unlinkFile, getBlockTimestamp, logGreen, logMagenta, logRed, logYellow, info, success, warning, error, genEmptyBallotRoots, getProxyContract, deployProxyClone, } from "@maci-protocol/contracts";
14
+ export type { FullProveResult, IGenerateProofsOptions, IGenerateProofsBatchData, IDeployParams, IMergeParams, IProveParams, IVerifyingKeyStruct, SnarkProof, IIpfsMessage, IDeployCloneArgs, IGetProxyContractArgs, } from "@maci-protocol/contracts";
15
+ export * from "@maci-protocol/contracts/typechain-types";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,KAAK,EACL,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,0BAA0B,EAC1B,mCAAmC,EACnC,YAAY,EACZ,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,8BAA8B,EAC9B,WAAW,EACX,qBAAqB,EACrB,qCAAqC,EACrC,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,cAAc,EACd,iCAAiC,EACjC,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV,MAAM,EACN,SAAS,EACT,IAAI,EACJ,OAAO,EACP,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAElC,cAAc,0CAA0C,CAAC"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.deployProxyClone = exports.getProxyContract = exports.genEmptyBallotRoots = exports.error = exports.warning = exports.success = exports.info = exports.logYellow = exports.logRed = exports.logMagenta = exports.logGreen = exports.getBlockTimestamp = exports.unlinkFile = exports.cleanThreads = exports.getDefaultSigner = exports.deployContractWithLinkedLibraries = exports.deployContract = exports.deployFreeForAllSignUpPolicy = exports.deployZupassSignUpPolicy = exports.deploySemaphoreSignupPolicy = exports.deployMerkleProofPolicy = exports.deployGitcoinPassportPolicy = exports.deployEASSignUpPolicy = exports.deployAnonAadhaarPolicy = exports.deployPoseidonContracts = exports.genMaciStateFromContract = exports.deployVerifier = exports.deployVkRegistry = exports.deployMockVerifier = exports.deployConstantInitialVoiceCreditProxy = exports.linkPoseidonLibraries = exports.verifyProof = exports.formatProofForVerifierContract = exports.genProofSnarkjs = exports.genProofRapidSnark = exports.extractVk = exports.Prover = exports.TreeMerger = exports.ProofGenerator = exports.ContractStorage = exports.Deployment = exports.EDeploySteps = exports.EInitialVoiceCreditProxiesFactories = exports.EInitialVoiceCreditProxies = exports.EPolicyFactories = exports.EPolicies = exports.ECheckers = exports.ECheckerFactories = exports.EContracts = exports.EMode = void 0;
18
+ __exportStar(require("./verifyingKeys"), exports);
19
+ __exportStar(require("./maci"), exports);
20
+ __exportStar(require("./relayer"), exports);
21
+ __exportStar(require("./poll"), exports);
22
+ __exportStar(require("./proof"), exports);
23
+ __exportStar(require("./tally"), exports);
24
+ __exportStar(require("./trees"), exports);
25
+ __exportStar(require("./vote"), exports);
26
+ __exportStar(require("./utils"), exports);
27
+ __exportStar(require("./user"), exports);
28
+ __exportStar(require("./deploy"), exports);
29
+ __exportStar(require("./maciKeys"), exports);
30
+ var contracts_1 = require("@maci-protocol/contracts");
31
+ Object.defineProperty(exports, "EMode", { enumerable: true, get: function () { return contracts_1.EMode; } });
32
+ Object.defineProperty(exports, "EContracts", { enumerable: true, get: function () { return contracts_1.EContracts; } });
33
+ Object.defineProperty(exports, "ECheckerFactories", { enumerable: true, get: function () { return contracts_1.ECheckerFactories; } });
34
+ Object.defineProperty(exports, "ECheckers", { enumerable: true, get: function () { return contracts_1.ECheckers; } });
35
+ Object.defineProperty(exports, "EPolicies", { enumerable: true, get: function () { return contracts_1.EPolicies; } });
36
+ Object.defineProperty(exports, "EPolicyFactories", { enumerable: true, get: function () { return contracts_1.EPolicyFactories; } });
37
+ Object.defineProperty(exports, "EInitialVoiceCreditProxies", { enumerable: true, get: function () { return contracts_1.EInitialVoiceCreditProxies; } });
38
+ Object.defineProperty(exports, "EInitialVoiceCreditProxiesFactories", { enumerable: true, get: function () { return contracts_1.EInitialVoiceCreditProxiesFactories; } });
39
+ Object.defineProperty(exports, "EDeploySteps", { enumerable: true, get: function () { return contracts_1.EDeploySteps; } });
40
+ Object.defineProperty(exports, "Deployment", { enumerable: true, get: function () { return contracts_1.Deployment; } });
41
+ Object.defineProperty(exports, "ContractStorage", { enumerable: true, get: function () { return contracts_1.ContractStorage; } });
42
+ Object.defineProperty(exports, "ProofGenerator", { enumerable: true, get: function () { return contracts_1.ProofGenerator; } });
43
+ Object.defineProperty(exports, "TreeMerger", { enumerable: true, get: function () { return contracts_1.TreeMerger; } });
44
+ Object.defineProperty(exports, "Prover", { enumerable: true, get: function () { return contracts_1.Prover; } });
45
+ Object.defineProperty(exports, "extractVk", { enumerable: true, get: function () { return contracts_1.extractVk; } });
46
+ Object.defineProperty(exports, "genProofRapidSnark", { enumerable: true, get: function () { return contracts_1.genProofRapidSnark; } });
47
+ Object.defineProperty(exports, "genProofSnarkjs", { enumerable: true, get: function () { return contracts_1.genProofSnarkjs; } });
48
+ Object.defineProperty(exports, "formatProofForVerifierContract", { enumerable: true, get: function () { return contracts_1.formatProofForVerifierContract; } });
49
+ Object.defineProperty(exports, "verifyProof", { enumerable: true, get: function () { return contracts_1.verifyProof; } });
50
+ Object.defineProperty(exports, "linkPoseidonLibraries", { enumerable: true, get: function () { return contracts_1.linkPoseidonLibraries; } });
51
+ Object.defineProperty(exports, "deployConstantInitialVoiceCreditProxy", { enumerable: true, get: function () { return contracts_1.deployConstantInitialVoiceCreditProxy; } });
52
+ Object.defineProperty(exports, "deployMockVerifier", { enumerable: true, get: function () { return contracts_1.deployMockVerifier; } });
53
+ Object.defineProperty(exports, "deployVkRegistry", { enumerable: true, get: function () { return contracts_1.deployVkRegistry; } });
54
+ Object.defineProperty(exports, "deployVerifier", { enumerable: true, get: function () { return contracts_1.deployVerifier; } });
55
+ Object.defineProperty(exports, "genMaciStateFromContract", { enumerable: true, get: function () { return contracts_1.genMaciStateFromContract; } });
56
+ Object.defineProperty(exports, "deployPoseidonContracts", { enumerable: true, get: function () { return contracts_1.deployPoseidonContracts; } });
57
+ Object.defineProperty(exports, "deployAnonAadhaarPolicy", { enumerable: true, get: function () { return contracts_1.deployAnonAadhaarPolicy; } });
58
+ Object.defineProperty(exports, "deployEASSignUpPolicy", { enumerable: true, get: function () { return contracts_1.deployEASSignUpPolicy; } });
59
+ Object.defineProperty(exports, "deployGitcoinPassportPolicy", { enumerable: true, get: function () { return contracts_1.deployGitcoinPassportPolicy; } });
60
+ Object.defineProperty(exports, "deployMerkleProofPolicy", { enumerable: true, get: function () { return contracts_1.deployMerkleProofPolicy; } });
61
+ Object.defineProperty(exports, "deploySemaphoreSignupPolicy", { enumerable: true, get: function () { return contracts_1.deploySemaphoreSignupPolicy; } });
62
+ Object.defineProperty(exports, "deployZupassSignUpPolicy", { enumerable: true, get: function () { return contracts_1.deployZupassSignUpPolicy; } });
63
+ Object.defineProperty(exports, "deployFreeForAllSignUpPolicy", { enumerable: true, get: function () { return contracts_1.deployFreeForAllSignUpPolicy; } });
64
+ Object.defineProperty(exports, "deployContract", { enumerable: true, get: function () { return contracts_1.deployContract; } });
65
+ Object.defineProperty(exports, "deployContractWithLinkedLibraries", { enumerable: true, get: function () { return contracts_1.deployContractWithLinkedLibraries; } });
66
+ Object.defineProperty(exports, "getDefaultSigner", { enumerable: true, get: function () { return contracts_1.getDefaultSigner; } });
67
+ Object.defineProperty(exports, "cleanThreads", { enumerable: true, get: function () { return contracts_1.cleanThreads; } });
68
+ Object.defineProperty(exports, "unlinkFile", { enumerable: true, get: function () { return contracts_1.unlinkFile; } });
69
+ Object.defineProperty(exports, "getBlockTimestamp", { enumerable: true, get: function () { return contracts_1.getBlockTimestamp; } });
70
+ Object.defineProperty(exports, "logGreen", { enumerable: true, get: function () { return contracts_1.logGreen; } });
71
+ Object.defineProperty(exports, "logMagenta", { enumerable: true, get: function () { return contracts_1.logMagenta; } });
72
+ Object.defineProperty(exports, "logRed", { enumerable: true, get: function () { return contracts_1.logRed; } });
73
+ Object.defineProperty(exports, "logYellow", { enumerable: true, get: function () { return contracts_1.logYellow; } });
74
+ Object.defineProperty(exports, "info", { enumerable: true, get: function () { return contracts_1.info; } });
75
+ Object.defineProperty(exports, "success", { enumerable: true, get: function () { return contracts_1.success; } });
76
+ Object.defineProperty(exports, "warning", { enumerable: true, get: function () { return contracts_1.warning; } });
77
+ Object.defineProperty(exports, "error", { enumerable: true, get: function () { return contracts_1.error; } });
78
+ Object.defineProperty(exports, "genEmptyBallotRoots", { enumerable: true, get: function () { return contracts_1.genEmptyBallotRoots; } });
79
+ Object.defineProperty(exports, "getProxyContract", { enumerable: true, get: function () { return contracts_1.getProxyContract; } });
80
+ Object.defineProperty(exports, "deployProxyClone", { enumerable: true, get: function () { return contracts_1.deployProxyClone; } });
81
+ __exportStar(require("@maci-protocol/contracts/typechain-types"), exports);
82
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,yCAAuB;AACvB,4CAA0B;AAC1B,yCAAuB;AACvB,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB;AACxB,yCAAuB;AACvB,0CAAwB;AACxB,yCAAuB;AACvB,2CAAyB;AACzB,6CAA2B;AAC3B,sDAmDkC;AAlDhC,kGAAA,KAAK,OAAA;AACL,uGAAA,UAAU,OAAA;AACV,8GAAA,iBA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,OAAA;AAiBlB,2EAAyD"}
@@ -0,0 +1,6 @@
1
+ export { getPolicyTrait, getPolicyContractNamesByTrait, getSemaphorePolicyData, getZupassPolicyData, getEASPolicyData, getMerkleProofPolicyData, } from "./policy";
2
+ export { mergeSignups } from "./merge";
3
+ export { generateMaciState } from "./state";
4
+ export { EPolicyTrait } from "./types";
5
+ export type { IGetPolicyTraitArgs, IGetPolicyDataArgs, ISemaphorePolicyData, IZupassPolicyData, IEASPolicyData, IMerkleProofPolicyData, IMergeSignupsArgs, IGenerateMaciStateArgs, } from "./types";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/maci/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,6BAA6B,EAC7B,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EPolicyTrait = exports.generateMaciState = exports.mergeSignups = exports.getMerkleProofPolicyData = exports.getEASPolicyData = exports.getZupassPolicyData = exports.getSemaphorePolicyData = exports.getPolicyContractNamesByTrait = exports.getPolicyTrait = void 0;
4
+ var policy_1 = require("./policy");
5
+ Object.defineProperty(exports, "getPolicyTrait", { enumerable: true, get: function () { return policy_1.getPolicyTrait; } });
6
+ Object.defineProperty(exports, "getPolicyContractNamesByTrait", { enumerable: true, get: function () { return policy_1.getPolicyContractNamesByTrait; } });
7
+ Object.defineProperty(exports, "getSemaphorePolicyData", { enumerable: true, get: function () { return policy_1.getSemaphorePolicyData; } });
8
+ Object.defineProperty(exports, "getZupassPolicyData", { enumerable: true, get: function () { return policy_1.getZupassPolicyData; } });
9
+ Object.defineProperty(exports, "getEASPolicyData", { enumerable: true, get: function () { return policy_1.getEASPolicyData; } });
10
+ Object.defineProperty(exports, "getMerkleProofPolicyData", { enumerable: true, get: function () { return policy_1.getMerkleProofPolicyData; } });
11
+ var merge_1 = require("./merge");
12
+ Object.defineProperty(exports, "mergeSignups", { enumerable: true, get: function () { return merge_1.mergeSignups; } });
13
+ var state_1 = require("./state");
14
+ Object.defineProperty(exports, "generateMaciState", { enumerable: true, get: function () { return state_1.generateMaciState; } });
15
+ var types_1 = require("./types");
16
+ Object.defineProperty(exports, "EPolicyTrait", { enumerable: true, get: function () { return types_1.EPolicyTrait; } });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/maci/index.ts"],"names":[],"mappings":";;;AAAA,mCAOkB;AANhB,wGAAA,cAAc,OAAA;AACd,uHAAA,6BAA6B,OAAA;AAC7B,gHAAA,sBAAsB,OAAA;AACtB,6GAAA,mBAAmB,OAAA;AACnB,0GAAA,gBAAgB,OAAA;AAChB,kHAAA,wBAAwB,OAAA;AAE1B,iCAAuC;AAA9B,qGAAA,YAAY,OAAA;AACrB,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA;AAC1B,iCAAuC;AAA9B,qGAAA,YAAY,OAAA"}
@@ -0,0 +1,9 @@
1
+ import type { IMergeSignupsArgs } from "./types";
2
+ import type { TransactionReceipt } from "ethers";
3
+ /**
4
+ * Command to merge the signups of a MACI contract
5
+ * @param args the arguments for the mergeSignups command
6
+ * @return transaction receipt
7
+ */
8
+ export declare const mergeSignups: ({ pollId, maciAddress, signer }: IMergeSignupsArgs) => Promise<TransactionReceipt>;
9
+ //# sourceMappingURL=merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../ts/maci/merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAKjD;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAU,iCAAiC,iBAAiB,KAAG,OAAO,CAAC,kBAAkB,CAuBjH,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeSignups = void 0;
4
+ const poll_1 = require("../poll");
5
+ const contracts_1 = require("../utils/contracts");
6
+ /**
7
+ * Command to merge the signups of a MACI contract
8
+ * @param args the arguments for the mergeSignups command
9
+ * @return transaction receipt
10
+ */
11
+ const mergeSignups = async ({ pollId, maciAddress, signer }) => {
12
+ const { poll: pollContract } = await (0, poll_1.getPollContracts)({ maciAddress, pollId, signer });
13
+ // check if it's time to merge the signups
14
+ const [endDate, now] = await Promise.all([pollContract.endDate(), (0, contracts_1.currentBlockTimestamp)(signer.provider)]);
15
+ if (now < endDate) {
16
+ throw new Error("Voting period is not over");
17
+ }
18
+ const isMerged = await pollContract.stateMerged();
19
+ if (isMerged) {
20
+ throw new Error("The state tree has already been merged");
21
+ }
22
+ const receipt = await pollContract.mergeState().then((tx) => tx.wait());
23
+ if (receipt?.status !== 1) {
24
+ throw new Error("Error merging state subroots");
25
+ }
26
+ return receipt;
27
+ };
28
+ exports.mergeSignups = mergeSignups;
29
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../ts/maci/merge.ts"],"names":[],"mappings":";;;AAGA,kCAA2C;AAC3C,kDAA2D;AAE3D;;;;GAIG;AACI,MAAM,YAAY,GAAG,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAqB,EAA+B,EAAE;IACpH,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,uBAAgB,EAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAEvF,0CAA0C;IAC1C,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,IAAA,iCAAqB,EAAC,MAAM,CAAC,QAAS,CAAC,CAAC,CAAC,CAAC;IAE5G,IAAI,GAAG,GAAG,OAAO,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,WAAW,EAAE,CAAC;IAElD,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAExE,IAAI,OAAO,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAvBW,QAAA,YAAY,gBAuBvB"}