@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,235 @@
1
+ import type { EMode } from "@maci-protocol/contracts";
2
+ import type { IVkContractParams, VerifyingKey } from "@maci-protocol/domainobjs";
3
+ import type { Signer } from "ethers";
4
+ /**
5
+ * Arguments for the getAllVks function
6
+ */
7
+ export interface IGetAllVksArgs {
8
+ /**
9
+ * The address of the VkRegistry contract
10
+ */
11
+ vkRegistryAddress: string;
12
+ /**
13
+ * The signer to use for the contract calls
14
+ */
15
+ signer: Signer;
16
+ /**
17
+ * The depth of the state tree
18
+ */
19
+ stateTreeDepth: number;
20
+ /**
21
+ * The depth of the vote option tree
22
+ */
23
+ voteOptionTreeDepth: number;
24
+ /**
25
+ * The batch size for the process messages
26
+ */
27
+ messageBatchSize: number;
28
+ /**
29
+ * The depth of the ballot tree
30
+ */
31
+ intStateTreeDepth: number;
32
+ /**
33
+ * The mode to use for the contract calls
34
+ */
35
+ mode: EMode;
36
+ }
37
+ /**
38
+ * MACI's verifying keys
39
+ */
40
+ export interface IMaciVerifyingKeys {
41
+ /**
42
+ * The verifying key for the poll joining circuit
43
+ */
44
+ pollJoiningVkOnChain: IVkContractParams;
45
+ /**
46
+ * The verifying key for the poll joined circuit
47
+ */
48
+ pollJoinedVkOnChain: IVkContractParams;
49
+ /**
50
+ * The verifying key for the process messages circuit
51
+ */
52
+ processVkOnChain: IVkContractParams;
53
+ /**
54
+ * The verifying key for the tally votes circuit
55
+ */
56
+ tallyVkOnChain: IVkContractParams;
57
+ }
58
+ /**
59
+ * Arguments for the extractAllVks function
60
+ */
61
+ export interface IExtractAllVksArgs {
62
+ /**
63
+ * The path to the poll joining zkey
64
+ */
65
+ pollJoiningZkeyPath?: string;
66
+ /**
67
+ * The path to the poll joined zkey
68
+ */
69
+ pollJoinedZkeyPath?: string;
70
+ /**
71
+ * The path to the process messages zkey
72
+ */
73
+ processMessagesZkeyPath?: string;
74
+ /**
75
+ * The path to the tally votes zkey
76
+ */
77
+ tallyVotesZkeyPath?: string;
78
+ }
79
+ /**
80
+ * Maci verifying keys
81
+ */
82
+ export interface IMaciVks {
83
+ /**
84
+ * The poll joining verifying key
85
+ */
86
+ pollJoiningVk?: VerifyingKey;
87
+ /**
88
+ * The poll joined verifying key
89
+ */
90
+ pollJoinedVk?: VerifyingKey;
91
+ /**
92
+ * The message processing verifying key
93
+ */
94
+ processVk?: VerifyingKey;
95
+ /**
96
+ * The tally verifying key
97
+ */
98
+ tallyVk?: VerifyingKey;
99
+ }
100
+ /**
101
+ * The arguments for the setVerifyingKeys function
102
+ */
103
+ export interface ISetVerifyingKeysArgs {
104
+ /**
105
+ * The polll joining Vk object
106
+ */
107
+ pollJoiningVk: VerifyingKey;
108
+ /**
109
+ * The poll joined Vk object
110
+ */
111
+ pollJoinedVk: VerifyingKey;
112
+ /**
113
+ * The process messages Vk object
114
+ */
115
+ processMessagesVk: VerifyingKey;
116
+ /**
117
+ * The tally votes Vk object
118
+ */
119
+ tallyVotesVk: VerifyingKey;
120
+ /**
121
+ * The state tree depth
122
+ */
123
+ stateTreeDepth: number;
124
+ /**
125
+ * The poll state tree depth
126
+ */
127
+ pollStateTreeDepth: number;
128
+ /**
129
+ * The intermediate state tree depth (ballot tree)
130
+ */
131
+ intStateTreeDepth: number;
132
+ /**
133
+ * The vote option tree depth
134
+ */
135
+ voteOptionTreeDepth: number;
136
+ /**
137
+ * The message batch size
138
+ */
139
+ messageBatchSize: number;
140
+ /**
141
+ * The VkRegistry contract address
142
+ */
143
+ vkRegistryAddress: string;
144
+ /**
145
+ * The signer
146
+ */
147
+ signer: Signer;
148
+ /**
149
+ * QV or NON_QV
150
+ */
151
+ mode: EMode;
152
+ }
153
+ /**
154
+ * Interface for the arguments to the checkVerifyingKeys command
155
+ */
156
+ export interface ICheckVerifyingKeysArgs {
157
+ /**
158
+ * The depth of the state tree
159
+ */
160
+ stateTreeDepth: number;
161
+ /**
162
+ * The depth of the state subtree
163
+ */
164
+ intStateTreeDepth: number;
165
+ /**
166
+ * The depth of the vote option tree
167
+ */
168
+ voteOptionTreeDepth: number;
169
+ /**
170
+ * The size of the message batch
171
+ */
172
+ messageBatchSize: number;
173
+ /**
174
+ * The path to the poll joining zkey
175
+ */
176
+ pollJoiningZkeyPath: string;
177
+ /**
178
+ * The path to the poll joined zkey
179
+ */
180
+ pollJoinedZkeyPath: string;
181
+ /**
182
+ * The path to the process messages zkey
183
+ */
184
+ processMessagesZkeyPath: string;
185
+ /**
186
+ * The path to the tally votes zkey
187
+ */
188
+ tallyVotesZkeyPath: string;
189
+ /**
190
+ * A signer object
191
+ */
192
+ signer: Signer;
193
+ /**
194
+ * The address of the VkRegistry contract
195
+ */
196
+ vkRegistry: string;
197
+ /**
198
+ * Whether to use quadratic voting or not
199
+ */
200
+ useQuadraticVoting?: boolean;
201
+ }
202
+ /**
203
+ * Interface for the arguments to the extractVkToFile command
204
+ */
205
+ export interface IExtractVkToFileArgs {
206
+ /**
207
+ * File path for poll joining zkey
208
+ */
209
+ pollJoiningZkeyPath: string;
210
+ /**
211
+ * File path for poll joined zkey
212
+ */
213
+ pollJoinedZkeyPath: string;
214
+ /**
215
+ * File path for processMessagesQv zkey
216
+ */
217
+ processMessagesZkeyPathQv: string;
218
+ /**
219
+ * File path for tallyVotesQv zkey
220
+ */
221
+ tallyVotesZkeyPathQv: string;
222
+ /**
223
+ * File path for processMessagesNonQv zkey
224
+ */
225
+ processMessagesZkeyPathNonQv: string;
226
+ /**
227
+ * File path for tallyVotes zkey
228
+ */
229
+ tallyVotesZkeyPathNonQv: string;
230
+ /**
231
+ * Output file path of extracted vkeys
232
+ */
233
+ outputFilePath: string;
234
+ }
235
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":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BAAoB;IACnC;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,yBAAyB,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,4BAA4B,EAAE,MAAM,CAAC;IAErC;;OAEG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB"}
@@ -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/verifyingKeys/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import { type IVkContractParams, VerifyingKey } from "@maci-protocol/domainobjs";
2
+ import type { IGetAllVksArgs, IExtractAllVksArgs, IMaciVks, IMaciVerifyingKeys, IExtractVkToFileArgs } from "./types";
3
+ /**
4
+ * Get all the verifying keys from the contract
5
+ * @param args - The arguments for the getAllVks function
6
+ * @returns The verifying keys
7
+ */
8
+ export declare const getAllOnChainVks: ({ vkRegistryAddress, signer, stateTreeDepth, voteOptionTreeDepth, messageBatchSize, intStateTreeDepth, mode, }: IGetAllVksArgs) => Promise<IMaciVerifyingKeys>;
9
+ /**
10
+ * Compare two verifying keys
11
+ * @param vkOnChain - the verifying key on chain
12
+ * @param vk - the local verifying key
13
+ * @returns whether they are equal or not
14
+ */
15
+ export declare const compareVks: (vkOnChain: VerifyingKey | IVkContractParams, vk?: VerifyingKey | IVkContractParams) => boolean;
16
+ /**
17
+ * Extract all the verifying keys
18
+ * @param args - The arguments for the extractAllVks function
19
+ * @returns The verifying keys
20
+ */
21
+ export declare const extractAllVks: ({ pollJoiningZkeyPath, pollJoinedZkeyPath, processMessagesZkeyPath, tallyVotesZkeyPath, }: IExtractAllVksArgs) => Promise<IMaciVks>;
22
+ /**
23
+ * Command to confirm that the verifying keys in the contract match the local ones
24
+ * @note see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing
25
+ * @param args The arguments for the checkVerifyingKeys command
26
+ * @returns Whether the verifying keys match or not
27
+ */
28
+ export declare const extractVkToFile: ({ processMessagesZkeyPathQv, tallyVotesZkeyPathQv, processMessagesZkeyPathNonQv, pollJoinedZkeyPath, pollJoiningZkeyPath, tallyVotesZkeyPathNonQv, outputFilePath, }: IExtractVkToFileArgs) => Promise<void>;
29
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/verifyingKeys/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIjF,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEtH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAU,gHAQpC,cAAc,KAAG,OAAO,CAAC,kBAAkB,CAgB7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACrB,WAAW,YAAY,GAAG,iBAAiB,EAC3C,KAAK,YAAY,GAAG,iBAAiB,KACpC,OA2BF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAU,2FAKjC,kBAAkB,KAAG,OAAO,CAAC,QAAQ,CAgBvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAU,sKAQnC,oBAAoB,KAAG,OAAO,CAAC,IAAI,CAcrC,CAAC"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.extractVkToFile = exports.extractAllVks = exports.compareVks = exports.getAllOnChainVks = void 0;
7
+ const contracts_1 = require("@maci-protocol/contracts");
8
+ const typechain_types_1 = require("@maci-protocol/contracts/typechain-types");
9
+ const domainobjs_1 = require("@maci-protocol/domainobjs");
10
+ const fs_1 = __importDefault(require("fs"));
11
+ /**
12
+ * Get all the verifying keys from the contract
13
+ * @param args - The arguments for the getAllVks function
14
+ * @returns The verifying keys
15
+ */
16
+ const getAllOnChainVks = async ({ vkRegistryAddress, signer, stateTreeDepth, voteOptionTreeDepth, messageBatchSize, intStateTreeDepth, mode, }) => {
17
+ const vkRegistryContractInstance = typechain_types_1.VkRegistry__factory.connect(vkRegistryAddress, signer);
18
+ const [pollJoiningVkOnChain, pollJoinedVkOnChain, processVkOnChain, tallyVkOnChain] = await Promise.all([
19
+ vkRegistryContractInstance.getPollJoiningVk(stateTreeDepth),
20
+ vkRegistryContractInstance.getPollJoinedVk(stateTreeDepth),
21
+ vkRegistryContractInstance.getProcessVk(stateTreeDepth, voteOptionTreeDepth, messageBatchSize, mode),
22
+ vkRegistryContractInstance.getTallyVk(stateTreeDepth, intStateTreeDepth, voteOptionTreeDepth, mode),
23
+ ]);
24
+ return {
25
+ pollJoiningVkOnChain,
26
+ pollJoinedVkOnChain,
27
+ processVkOnChain,
28
+ tallyVkOnChain,
29
+ };
30
+ };
31
+ exports.getAllOnChainVks = getAllOnChainVks;
32
+ /**
33
+ * Compare two verifying keys
34
+ * @param vkOnChain - the verifying key on chain
35
+ * @param vk - the local verifying key
36
+ * @returns whether they are equal or not
37
+ */
38
+ const compareVks = (vkOnChain, vk) => {
39
+ if (!vk) {
40
+ throw new Error("Verifying key is not provided");
41
+ }
42
+ let isEqual = vk.ic.length === vkOnChain.ic.length;
43
+ for (let i = 0; i < vk.ic.length; i += 1) {
44
+ isEqual = isEqual && vk.ic[i].x.toString() === vkOnChain.ic[i].x.toString();
45
+ isEqual = isEqual && vk.ic[i].y.toString() === vkOnChain.ic[i].y.toString();
46
+ }
47
+ isEqual = isEqual && vk.alpha1.x.toString() === vkOnChain.alpha1.x.toString();
48
+ isEqual = isEqual && vk.alpha1.y.toString() === vkOnChain.alpha1.y.toString();
49
+ isEqual = isEqual && vk.beta2.x[0].toString() === vkOnChain.beta2.x[0].toString();
50
+ isEqual = isEqual && vk.beta2.x[1].toString() === vkOnChain.beta2.x[1].toString();
51
+ isEqual = isEqual && vk.beta2.y[0].toString() === vkOnChain.beta2.y[0].toString();
52
+ isEqual = isEqual && vk.beta2.y[1].toString() === vkOnChain.beta2.y[1].toString();
53
+ isEqual = isEqual && vk.delta2.x[0].toString() === vkOnChain.delta2.x[0].toString();
54
+ isEqual = isEqual && vk.delta2.x[1].toString() === vkOnChain.delta2.x[1].toString();
55
+ isEqual = isEqual && vk.delta2.y[0].toString() === vkOnChain.delta2.y[0].toString();
56
+ isEqual = isEqual && vk.delta2.y[1].toString() === vkOnChain.delta2.y[1].toString();
57
+ isEqual = isEqual && vk.gamma2.x[0].toString() === vkOnChain.gamma2.x[0].toString();
58
+ isEqual = isEqual && vk.gamma2.x[1].toString() === vkOnChain.gamma2.x[1].toString();
59
+ isEqual = isEqual && vk.gamma2.y[0].toString() === vkOnChain.gamma2.y[0].toString();
60
+ isEqual = isEqual && vk.gamma2.y[1].toString() === vkOnChain.gamma2.y[1].toString();
61
+ return isEqual;
62
+ };
63
+ exports.compareVks = compareVks;
64
+ /**
65
+ * Extract all the verifying keys
66
+ * @param args - The arguments for the extractAllVks function
67
+ * @returns The verifying keys
68
+ */
69
+ const extractAllVks = async ({ pollJoiningZkeyPath, pollJoinedZkeyPath, processMessagesZkeyPath, tallyVotesZkeyPath, }) => {
70
+ // extract the vks
71
+ const pollJoiningVk = pollJoiningZkeyPath ? domainobjs_1.VerifyingKey.fromObj(await (0, contracts_1.extractVk)(pollJoiningZkeyPath)) : undefined;
72
+ const pollJoinedVk = pollJoinedZkeyPath ? domainobjs_1.VerifyingKey.fromObj(await (0, contracts_1.extractVk)(pollJoinedZkeyPath)) : undefined;
73
+ const processVk = processMessagesZkeyPath
74
+ ? domainobjs_1.VerifyingKey.fromObj(await (0, contracts_1.extractVk)(processMessagesZkeyPath))
75
+ : undefined;
76
+ const tallyVk = tallyVotesZkeyPath ? domainobjs_1.VerifyingKey.fromObj(await (0, contracts_1.extractVk)(tallyVotesZkeyPath)) : undefined;
77
+ return {
78
+ pollJoiningVk,
79
+ pollJoinedVk,
80
+ processVk,
81
+ tallyVk,
82
+ };
83
+ };
84
+ exports.extractAllVks = extractAllVks;
85
+ /**
86
+ * Command to confirm that the verifying keys in the contract match the local ones
87
+ * @note see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing
88
+ * @param args The arguments for the checkVerifyingKeys command
89
+ * @returns Whether the verifying keys match or not
90
+ */
91
+ const extractVkToFile = async ({ processMessagesZkeyPathQv, tallyVotesZkeyPathQv, processMessagesZkeyPathNonQv, pollJoinedZkeyPath, pollJoiningZkeyPath, tallyVotesZkeyPathNonQv, outputFilePath, }) => {
92
+ const [processVkQv, tallyVkQv, processVkNonQv, tallyVkNonQv, pollJoiningVk, pollJoinedVk] = await Promise.all([
93
+ (0, contracts_1.extractVk)(processMessagesZkeyPathQv),
94
+ (0, contracts_1.extractVk)(tallyVotesZkeyPathQv),
95
+ (0, contracts_1.extractVk)(processMessagesZkeyPathNonQv),
96
+ (0, contracts_1.extractVk)(tallyVotesZkeyPathNonQv),
97
+ (0, contracts_1.extractVk)(pollJoiningZkeyPath),
98
+ (0, contracts_1.extractVk)(pollJoinedZkeyPath),
99
+ ]);
100
+ await fs_1.default.promises.writeFile(outputFilePath, JSON.stringify({ processVkQv, tallyVkQv, processVkNonQv, tallyVkNonQv, pollJoiningVk, pollJoinedVk }));
101
+ };
102
+ exports.extractVkToFile = extractVkToFile;
103
+ //# sourceMappingURL=utils.js.map
@@ -0,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QACb,YAAY;QACZ,SAAS;QACT,OAAO;KACR,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,aAAa,iBAqBxB;AAEF;;;;;GAKG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,yBAAyB,EACzB,oBAAoB,EACpB,4BAA4B,EAC5B,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,GACO,EAAiB,EAAE;IACxC,MAAM,CAAC,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5G,IAAA,qBAAS,EAAC,yBAAyB,CAAC;QACpC,IAAA,qBAAS,EAAC,oBAAoB,CAAC;QAC/B,IAAA,qBAAS,EAAC,4BAA4B,CAAC;QACvC,IAAA,qBAAS,EAAC,uBAAuB,CAAC;QAClC,IAAA,qBAAS,EAAC,mBAAmB,CAAC;QAC9B,IAAA,qBAAS,EAAC,kBAAkB,CAAC;KAC9B,CAAC,CAAC;IAEH,MAAM,YAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,cAAc,EACd,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CACtG,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,eAAe,mBAsB1B"}
@@ -0,0 +1,8 @@
1
+ import type { IGenerateVoteArgs, IVote } from "./types";
2
+ /**
3
+ * Generate a vote
4
+ * @param args - The arguments for the vote
5
+ * @returns The vote object
6
+ */
7
+ export declare const generateVote: ({ pollId, voteOptionIndex, salt, nonce, privateKey, stateIndex, voteWeight, coordinatorPubKey, maxVoteOption, ephemeralKeypair, newPubKey, }: IGenerateVoteArgs) => IVote;
8
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../ts/vote/generate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIxD;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,8IAY1B,iBAAiB,KAAG,KAmDtB,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateVote = void 0;
4
+ const crypto_1 = require("@maci-protocol/crypto");
5
+ const domainobjs_1 = require("@maci-protocol/domainobjs");
6
+ const utils_1 = require("./utils");
7
+ /**
8
+ * Generate a vote
9
+ * @param args - The arguments for the vote
10
+ * @returns The vote object
11
+ */
12
+ const generateVote = ({ pollId, voteOptionIndex, salt, nonce, privateKey, stateIndex, voteWeight, coordinatorPubKey, maxVoteOption, ephemeralKeypair, newPubKey, }) => {
13
+ const keypair = new domainobjs_1.Keypair(privateKey);
14
+ // validate args
15
+ if (voteOptionIndex < 0 || voteOptionIndex > maxVoteOption) {
16
+ throw new Error("Invalid vote option index");
17
+ }
18
+ // check < 1 cause index zero is a blank state leaf
19
+ if (stateIndex < 1) {
20
+ throw new Error("Invalid state index");
21
+ }
22
+ if (nonce < 0) {
23
+ throw new Error("Invalid nonce");
24
+ }
25
+ if (salt && !(0, utils_1.validateSalt)(salt)) {
26
+ throw new Error("Invalid salt");
27
+ }
28
+ const userSalt = salt ? BigInt(salt) : (0, crypto_1.genRandomSalt)();
29
+ if (pollId < 0) {
30
+ throw new Error("Invalid poll id");
31
+ }
32
+ // if no ephemeral keypair is provided, generate a new one
33
+ const encKeypair = ephemeralKeypair ?? new domainobjs_1.Keypair();
34
+ // create the command object
35
+ const command = new domainobjs_1.PCommand(stateIndex, newPubKey ?? keypair.pubKey, voteOptionIndex, voteWeight, nonce, pollId, userSalt);
36
+ // sign the command with the poll private key
37
+ const signature = command.sign(privateKey);
38
+ // encrypt the command using a shared key between the user and the coordinator
39
+ const message = command.encrypt(signature, domainobjs_1.Keypair.genEcdhSharedKey(encKeypair.privKey, coordinatorPubKey));
40
+ return {
41
+ message,
42
+ ephemeralKeypair: encKeypair,
43
+ };
44
+ };
45
+ exports.generateVote = generateVote;
46
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../ts/vote/generate.ts"],"names":[],"mappings":";;;AAAA,kDAAsD;AACtD,0DAA8D;AAI9D,mCAAuC;AAEvC;;;;GAIG;AACI,MAAM,YAAY,GAAG,CAAC,EAC3B,MAAM,EACN,eAAe,EACf,IAAI,EACJ,KAAK,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,SAAS,GACS,EAAS,EAAE;IAC7B,MAAM,OAAO,GAAG,IAAI,oBAAO,CAAC,UAAU,CAAC,CAAC;IAExC,gBAAgB;IAChB,IAAI,eAAe,GAAG,CAAC,IAAI,eAAe,GAAG,aAAa,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,mDAAmD;IACnD,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,IAAI,IAAI,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,sBAAa,GAAE,CAAC;IAEvD,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,0DAA0D;IAC1D,MAAM,UAAU,GAAG,gBAAgB,IAAI,IAAI,oBAAO,EAAE,CAAC;IAErD,4BAA4B;IAC5B,MAAM,OAAO,GAAG,IAAI,qBAAQ,CAC1B,UAAU,EACV,SAAS,IAAI,OAAO,CAAC,MAAM,EAC3B,eAAe,EACf,UAAU,EACV,KAAK,EACL,MAAM,EACN,QAAQ,CACT,CAAC;IAEF,6CAA6C;IAC7C,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAE3C,8EAA8E;IAC9E,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE5G,OAAO;QACL,OAAO;QACP,gBAAgB,EAAE,UAAU;KAC7B,CAAC;AACJ,CAAC,CAAC;AA/DW,QAAA,YAAY,gBA+DvB"}
@@ -0,0 +1,6 @@
1
+ export type { IVote, IGenerateVoteArgs, IPublishArgs, IPublishBatchArgs, IPublishBatchData, IPublishData, IPublishMessage, ISubmitVoteArgs, ISubmitVoteBatchArgs, } from "./types";
2
+ export { generateVote } from "./generate";
3
+ export { publish, publishBatch } from "./publish";
4
+ export { submitVote, submitVoteBatch } from "./submit";
5
+ export { getCoordinatorPubKey, validateSalt } from "./utils";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/vote/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateSalt = exports.getCoordinatorPubKey = exports.submitVoteBatch = exports.submitVote = exports.publishBatch = exports.publish = exports.generateVote = void 0;
4
+ var generate_1 = require("./generate");
5
+ Object.defineProperty(exports, "generateVote", { enumerable: true, get: function () { return generate_1.generateVote; } });
6
+ var publish_1 = require("./publish");
7
+ Object.defineProperty(exports, "publish", { enumerable: true, get: function () { return publish_1.publish; } });
8
+ Object.defineProperty(exports, "publishBatch", { enumerable: true, get: function () { return publish_1.publishBatch; } });
9
+ var submit_1 = require("./submit");
10
+ Object.defineProperty(exports, "submitVote", { enumerable: true, get: function () { return submit_1.submitVote; } });
11
+ Object.defineProperty(exports, "submitVoteBatch", { enumerable: true, get: function () { return submit_1.submitVoteBatch; } });
12
+ var utils_1 = require("./utils");
13
+ Object.defineProperty(exports, "getCoordinatorPubKey", { enumerable: true, get: function () { return utils_1.getCoordinatorPubKey; } });
14
+ Object.defineProperty(exports, "validateSalt", { enumerable: true, get: function () { return utils_1.validateSalt; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/vote/index.ts"],"names":[],"mappings":";;;AAWA,uCAA0C;AAAjC,wGAAA,YAAY,OAAA;AACrB,qCAAkD;AAAzC,kGAAA,OAAO,OAAA;AAAE,uGAAA,YAAY,OAAA;AAC9B,mCAAuD;AAA9C,oGAAA,UAAU,OAAA;AAAE,yGAAA,eAAe,OAAA;AACpC,iCAA6D;AAApD,6GAAA,oBAAoB,OAAA;AAAE,qGAAA,YAAY,OAAA"}
@@ -0,0 +1,13 @@
1
+ import type { IInvalidateVotesArgs } from "./types";
2
+ /**
3
+ * Invalidate votes
4
+ * @dev This function is used to invalidate votes for a given poll
5
+ * by sending a key change command with a new random key
6
+ * Given messages are processed in reverse order, this will be processed before
7
+ * previous votes and would require previous votes to have been casted with this
8
+ * new key, which is impossible.
9
+ * @param args invalidate votes args
10
+ * @returns transaction hash
11
+ */
12
+ export declare const invalidateVotes: ({ maciAddress, pollId, signer, maciPrivateKey, stateIndex, }: IInvalidateVotesArgs) => Promise<string | undefined>;
13
+ //# sourceMappingURL=invalidate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalidate.d.ts","sourceRoot":"","sources":["../../../ts/vote/invalidate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAQpD;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAU,8DAMnC,oBAAoB,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CA2BnD,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.invalidateVotes = void 0;
4
+ const domainobjs_1 = require("@maci-protocol/domainobjs");
5
+ const poll_1 = require("../poll");
6
+ const generate_1 = require("./generate");
7
+ const submit_1 = require("./submit");
8
+ const utils_1 = require("./utils");
9
+ /**
10
+ * Invalidate votes
11
+ * @dev This function is used to invalidate votes for a given poll
12
+ * by sending a key change command with a new random key
13
+ * Given messages are processed in reverse order, this will be processed before
14
+ * previous votes and would require previous votes to have been casted with this
15
+ * new key, which is impossible.
16
+ * @param args invalidate votes args
17
+ * @returns transaction hash
18
+ */
19
+ const invalidateVotes = async ({ maciAddress, pollId, signer, maciPrivateKey, stateIndex, }) => {
20
+ const { poll: pollContract } = await (0, poll_1.getPollContracts)({ maciAddress, pollId, signer });
21
+ const [maxVoteOption, pollAddress] = await Promise.all([pollContract.voteOptions(), pollContract.getAddress()]);
22
+ const coordinatorPubKey = await (0, utils_1.getCoordinatorPubKey)(pollAddress, signer);
23
+ // generate the key change message
24
+ const message = (0, generate_1.generateVote)({
25
+ pollId,
26
+ voteOptionIndex: 0n,
27
+ nonce: 0n,
28
+ privateKey: maciPrivateKey,
29
+ stateIndex,
30
+ // use a random key to invalidate the previous votes
31
+ newPubKey: new domainobjs_1.Keypair().pubKey,
32
+ voteWeight: 0n,
33
+ coordinatorPubKey,
34
+ maxVoteOption,
35
+ });
36
+ const receipt = await (0, submit_1.submitVote)({
37
+ pollAddress,
38
+ vote: message,
39
+ signer,
40
+ });
41
+ return receipt;
42
+ };
43
+ exports.invalidateVotes = invalidateVotes;
44
+ //# sourceMappingURL=invalidate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalidate.js","sourceRoot":"","sources":["../../../ts/vote/invalidate.ts"],"names":[],"mappings":";;;AAAA,0DAAoD;AAIpD,kCAA2C;AAE3C,yCAA0C;AAC1C,qCAAsC;AACtC,mCAA+C;AAE/C;;;;;;;;;GASG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,WAAW,EACX,MAAM,EACN,MAAM,EACN,cAAc,EACd,UAAU,GACW,EAA+B,EAAE;IACtD,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,uBAAgB,EAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAEvF,MAAM,CAAC,aAAa,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAChH,MAAM,iBAAiB,GAAG,MAAM,IAAA,4BAAoB,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE1E,kCAAkC;IAClC,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC;QAC3B,MAAM;QACN,eAAe,EAAE,EAAE;QACnB,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,cAAc;QAC1B,UAAU;QACV,oDAAoD;QACpD,SAAS,EAAE,IAAI,oBAAO,EAAE,CAAC,MAAM;QAC/B,UAAU,EAAE,EAAE;QACd,iBAAiB;QACjB,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,IAAA,mBAAU,EAAC;QAC/B,WAAW;QACX,IAAI,EAAE,OAAO;QACb,MAAM;KACP,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAjCW,QAAA,eAAe,mBAiC1B"}
@@ -0,0 +1,14 @@
1
+ import type { IPublishBatchArgs, IPublishBatchData, IPublishArgs, IPublishData } from "./types";
2
+ /**
3
+ * Publish a new message to a MACI Poll contract
4
+ * @param {IPublishArgs} args - The arguments for the publish command
5
+ * @returns {IPublishData} The ephemeral private key used to encrypt the message, transaction hash
6
+ */
7
+ export declare const publish: ({ pubkey, stateIndex, voteOptionIndex, nonce, pollId, newVoteWeight, maciAddress, salt, privateKey, signer, }: IPublishArgs) => Promise<IPublishData>;
8
+ /**
9
+ * Batch publish new messages to a MACI Poll contract
10
+ * @param {IPublishBatchArgs} args - The arguments for the publish command
11
+ * @returns {IPublishBatchData} The ephemeral private key used to encrypt the message, transaction hash
12
+ */
13
+ export declare const publishBatch: ({ messages, pollId, maciAddress, publicKey, privateKey, signer, }: IPublishBatchArgs) => Promise<IPublishBatchData>;
14
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../ts/vote/publish.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQhG;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAU,+GAW3B,YAAY,KAAG,OAAO,CAAC,YAAY,CAqCrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAU,mEAOhC,iBAAiB,KAAG,OAAO,CAAC,iBAAiB,CA4C/C,CAAC"}