@maci-protocol/sdk 0.0.0-ci.fd7cff6 → 0.0.0-ci.fdc9104

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 (227) hide show
  1. package/LICENSE +1 -2
  2. package/build/package.json +18 -9
  3. package/build/ts/browser/index.d.ts +8 -8
  4. package/build/ts/browser/index.d.ts.map +1 -1
  5. package/build/ts/browser/index.js +17 -20
  6. package/build/ts/browser/index.js.map +1 -1
  7. package/build/ts/browser/joinPoll.d.ts +10 -0
  8. package/build/ts/browser/joinPoll.d.ts.map +1 -0
  9. package/build/ts/browser/joinPoll.js +88 -0
  10. package/build/ts/browser/joinPoll.js.map +1 -0
  11. package/build/ts/browser/utils.d.ts +18 -0
  12. package/build/ts/browser/utils.d.ts.map +1 -0
  13. package/build/ts/browser/utils.js +37 -0
  14. package/build/ts/browser/utils.js.map +1 -0
  15. package/build/ts/deploy/index.d.ts +3 -2
  16. package/build/ts/deploy/index.d.ts.map +1 -1
  17. package/build/ts/deploy/index.js +5 -3
  18. package/build/ts/deploy/index.js.map +1 -1
  19. package/build/ts/deploy/maci.d.ts +1 -1
  20. package/build/ts/deploy/maci.d.ts.map +1 -1
  21. package/build/ts/deploy/maci.js +18 -8
  22. package/build/ts/deploy/maci.js.map +1 -1
  23. package/build/ts/deploy/poll.d.ts +1 -1
  24. package/build/ts/deploy/poll.d.ts.map +1 -1
  25. package/build/ts/deploy/poll.js +20 -15
  26. package/build/ts/deploy/poll.js.map +1 -1
  27. package/build/ts/deploy/types.d.ts +34 -13
  28. package/build/ts/deploy/types.d.ts.map +1 -1
  29. package/build/ts/deploy/utils.js +1 -1
  30. package/build/ts/deploy/utils.js.map +1 -1
  31. package/build/ts/deploy/verifyingKeysRegistry.d.ts +7 -0
  32. package/build/ts/deploy/verifyingKeysRegistry.d.ts.map +1 -0
  33. package/build/ts/deploy/verifyingKeysRegistry.js +14 -0
  34. package/build/ts/deploy/verifyingKeysRegistry.js.map +1 -0
  35. package/build/ts/index.d.ts +3 -2
  36. package/build/ts/index.d.ts.map +1 -1
  37. package/build/ts/index.js +30 -10
  38. package/build/ts/index.js.map +1 -1
  39. package/build/ts/maci/policy.d.ts +13 -1
  40. package/build/ts/maci/policy.d.ts.map +1 -1
  41. package/build/ts/maci/policy.js +41 -2
  42. package/build/ts/maci/policy.js.map +1 -1
  43. package/build/ts/maci/state.d.ts +1 -1
  44. package/build/ts/maci/state.js +11 -11
  45. package/build/ts/maci/state.js.map +1 -1
  46. package/build/ts/maci/types.d.ts +34 -2
  47. package/build/ts/maci/types.d.ts.map +1 -1
  48. package/build/ts/maci/types.js +2 -0
  49. package/build/ts/maci/types.js.map +1 -1
  50. package/build/ts/maciKeys/__tests__/keypair.test.js +7 -7
  51. package/build/ts/maciKeys/__tests__/keypair.test.js.map +1 -1
  52. package/build/ts/maciKeys/__tests__/publicKeys.test.js +7 -7
  53. package/build/ts/maciKeys/__tests__/publicKeys.test.js.map +1 -1
  54. package/build/ts/maciKeys/keypair.d.ts.map +1 -1
  55. package/build/ts/maciKeys/keypair.js +4 -3
  56. package/build/ts/maciKeys/keypair.js.map +1 -1
  57. package/build/ts/maciKeys/publicKeys.d.ts +2 -2
  58. package/build/ts/maciKeys/publicKeys.d.ts.map +1 -1
  59. package/build/ts/maciKeys/publicKeys.js +6 -6
  60. package/build/ts/maciKeys/publicKeys.js.map +1 -1
  61. package/build/ts/maciKeys/types.d.ts +5 -0
  62. package/build/ts/maciKeys/types.d.ts.map +1 -1
  63. package/build/ts/poll/poll.d.ts.map +1 -1
  64. package/build/ts/poll/poll.js +9 -9
  65. package/build/ts/poll/poll.js.map +1 -1
  66. package/build/ts/poll/types.d.ts +6 -7
  67. package/build/ts/poll/types.d.ts.map +1 -1
  68. package/build/ts/poll/utils.js +3 -3
  69. package/build/ts/poll/utils.js.map +1 -1
  70. package/build/ts/proof/__tests__/download.test.js +8 -5
  71. package/build/ts/proof/__tests__/download.test.js.map +1 -1
  72. package/build/ts/proof/download.d.ts +3 -3
  73. package/build/ts/proof/download.d.ts.map +1 -1
  74. package/build/ts/proof/download.js +5 -7
  75. package/build/ts/proof/download.js.map +1 -1
  76. package/build/ts/proof/generate.d.ts +2 -2
  77. package/build/ts/proof/generate.d.ts.map +1 -1
  78. package/build/ts/proof/generate.js +31 -25
  79. package/build/ts/proof/generate.js.map +1 -1
  80. package/build/ts/proof/prove.js +16 -16
  81. package/build/ts/proof/prove.js.map +1 -1
  82. package/build/ts/proof/types.d.ts +41 -15
  83. package/build/ts/proof/types.d.ts.map +1 -1
  84. package/build/ts/proof/utils.d.ts +10 -0
  85. package/build/ts/proof/utils.d.ts.map +1 -0
  86. package/build/ts/proof/utils.js +24 -0
  87. package/build/ts/proof/utils.js.map +1 -0
  88. package/build/ts/relayer/__tests__/messages.test.js +1 -1
  89. package/build/ts/relayer/__tests__/messages.test.js.map +1 -1
  90. package/build/ts/relayer/__tests__/utils.test.js +3 -3
  91. package/build/ts/relayer/__tests__/utils.test.js.map +1 -1
  92. package/build/ts/relayer/messages.js +1 -1
  93. package/build/ts/relayer/utils.js +4 -4
  94. package/build/ts/relayer/utils.js.map +1 -1
  95. package/build/ts/subgraph/index.d.ts +3 -0
  96. package/build/ts/subgraph/index.d.ts.map +1 -0
  97. package/build/ts/subgraph/index.js +18 -0
  98. package/build/ts/subgraph/index.js.map +1 -0
  99. package/build/ts/subgraph/maciSubgraph.d.ts +28 -0
  100. package/build/ts/subgraph/maciSubgraph.d.ts.map +1 -0
  101. package/build/ts/subgraph/maciSubgraph.js +64 -0
  102. package/build/ts/subgraph/maciSubgraph.js.map +1 -0
  103. package/build/ts/subgraph/types.d.ts +20 -0
  104. package/build/ts/subgraph/types.d.ts.map +1 -0
  105. package/build/ts/subgraph/types.js +3 -0
  106. package/build/ts/subgraph/types.js.map +1 -0
  107. package/build/ts/tally/commitments.d.ts.map +1 -1
  108. package/build/ts/tally/commitments.js +8 -7
  109. package/build/ts/tally/commitments.js.map +1 -1
  110. package/build/ts/tally/index.d.ts +2 -1
  111. package/build/ts/tally/index.d.ts.map +1 -1
  112. package/build/ts/tally/index.js +5 -1
  113. package/build/ts/tally/index.js.map +1 -1
  114. package/build/ts/tally/results.d.ts +20 -0
  115. package/build/ts/tally/results.d.ts.map +1 -0
  116. package/build/ts/tally/results.js +49 -0
  117. package/build/ts/tally/results.js.map +1 -0
  118. package/build/ts/tally/types.d.ts +55 -15
  119. package/build/ts/tally/types.d.ts.map +1 -1
  120. package/build/ts/tally/utils.d.ts +3 -3
  121. package/build/ts/tally/utils.d.ts.map +1 -1
  122. package/build/ts/tally/utils.js +10 -10
  123. package/build/ts/tally/utils.js.map +1 -1
  124. package/build/ts/tally/verification.d.ts +1 -1
  125. package/build/ts/tally/verification.d.ts.map +1 -1
  126. package/build/ts/tally/verification.js +10 -10
  127. package/build/ts/tally/verification.js.map +1 -1
  128. package/build/ts/trees/index.d.ts +2 -2
  129. package/build/ts/trees/index.d.ts.map +1 -1
  130. package/build/ts/trees/index.js +3 -1
  131. package/build/ts/trees/index.js.map +1 -1
  132. package/build/ts/trees/stateTree.d.ts +23 -1
  133. package/build/ts/trees/stateTree.d.ts.map +1 -1
  134. package/build/ts/trees/stateTree.js +76 -12
  135. package/build/ts/trees/stateTree.js.map +1 -1
  136. package/build/ts/trees/types.d.ts +11 -2
  137. package/build/ts/trees/types.d.ts.map +1 -1
  138. package/build/ts/user/index.d.ts +4 -2
  139. package/build/ts/user/index.d.ts.map +1 -1
  140. package/build/ts/user/index.js +14 -8
  141. package/build/ts/user/index.js.map +1 -1
  142. package/build/ts/user/joinPoll.d.ts +8 -0
  143. package/build/ts/user/joinPoll.d.ts.map +1 -0
  144. package/build/ts/user/joinPoll.js +84 -0
  145. package/build/ts/user/joinPoll.js.map +1 -0
  146. package/build/ts/user/signup.d.ts +20 -0
  147. package/build/ts/user/signup.d.ts.map +1 -0
  148. package/build/ts/user/signup.js +84 -0
  149. package/build/ts/user/signup.js.map +1 -0
  150. package/build/ts/user/types.d.ts +65 -29
  151. package/build/ts/user/types.d.ts.map +1 -1
  152. package/build/ts/user/utils.d.ts +50 -14
  153. package/build/ts/user/utils.d.ts.map +1 -1
  154. package/build/ts/user/utils.js +129 -57
  155. package/build/ts/user/utils.js.map +1 -1
  156. package/build/ts/utils/index.d.ts +1 -1
  157. package/build/ts/utils/index.d.ts.map +1 -1
  158. package/build/ts/utils/index.js +2 -1
  159. package/build/ts/utils/index.js.map +1 -1
  160. package/build/ts/utils/params.d.ts +1 -1
  161. package/build/ts/utils/params.d.ts.map +1 -1
  162. package/build/ts/utils/params.js +3 -3
  163. package/build/ts/utils/params.js.map +1 -1
  164. package/build/ts/utils/proofs.d.ts +2 -2
  165. package/build/ts/utils/proofs.d.ts.map +1 -1
  166. package/build/ts/utils/proofs.js +4 -4
  167. package/build/ts/utils/proofs.js.map +1 -1
  168. package/build/ts/utils/types.d.ts +2 -2
  169. package/build/ts/utils/types.d.ts.map +1 -1
  170. package/build/ts/utils/utils.d.ts +13 -0
  171. package/build/ts/utils/utils.d.ts.map +1 -1
  172. package/build/ts/utils/utils.js +26 -1
  173. package/build/ts/utils/utils.js.map +1 -1
  174. package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts +1 -1
  175. package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts.map +1 -1
  176. package/build/ts/verifyingKeys/checkVerifyingKeys.js +18 -19
  177. package/build/ts/verifyingKeys/checkVerifyingKeys.js.map +1 -1
  178. package/build/ts/verifyingKeys/index.d.ts +2 -2
  179. package/build/ts/verifyingKeys/index.d.ts.map +1 -1
  180. package/build/ts/verifyingKeys/index.js +5 -5
  181. package/build/ts/verifyingKeys/index.js.map +1 -1
  182. package/build/ts/verifyingKeys/setVerifyingKeys.d.ts +1 -1
  183. package/build/ts/verifyingKeys/setVerifyingKeys.d.ts.map +1 -1
  184. package/build/ts/verifyingKeys/setVerifyingKeys.js +76 -41
  185. package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -1
  186. package/build/ts/verifyingKeys/types.d.ts +56 -48
  187. package/build/ts/verifyingKeys/types.d.ts.map +1 -1
  188. package/build/ts/verifyingKeys/utils.d.ts +10 -10
  189. package/build/ts/verifyingKeys/utils.d.ts.map +1 -1
  190. package/build/ts/verifyingKeys/utils.js +76 -60
  191. package/build/ts/verifyingKeys/utils.js.map +1 -1
  192. package/build/ts/vote/generate.d.ts +1 -1
  193. package/build/ts/vote/generate.d.ts.map +1 -1
  194. package/build/ts/vote/generate.js +4 -4
  195. package/build/ts/vote/generate.js.map +1 -1
  196. package/build/ts/vote/index.d.ts +2 -1
  197. package/build/ts/vote/index.d.ts.map +1 -1
  198. package/build/ts/vote/index.js +4 -2
  199. package/build/ts/vote/index.js.map +1 -1
  200. package/build/ts/vote/invalidate.js +4 -4
  201. package/build/ts/vote/invalidate.js.map +1 -1
  202. package/build/ts/vote/publish.d.ts +1 -1
  203. package/build/ts/vote/publish.d.ts.map +1 -1
  204. package/build/ts/vote/publish.js +19 -19
  205. package/build/ts/vote/publish.js.map +1 -1
  206. package/build/ts/vote/submit.js +5 -5
  207. package/build/ts/vote/submit.js.map +1 -1
  208. package/build/ts/vote/types.d.ts +6 -6
  209. package/build/ts/vote/types.d.ts.map +1 -1
  210. package/build/ts/vote/utils.d.ts +2 -2
  211. package/build/ts/vote/utils.d.ts.map +1 -1
  212. package/build/ts/vote/utils.js +7 -7
  213. package/build/ts/vote/utils.js.map +1 -1
  214. package/build/tsconfig.build.tsbuildinfo +1 -1
  215. package/package.json +24 -15
  216. package/build/ts/deploy/vkRegistry.d.ts +0 -7
  217. package/build/ts/deploy/vkRegistry.d.ts.map +0 -1
  218. package/build/ts/deploy/vkRegistry.js +0 -14
  219. package/build/ts/deploy/vkRegistry.js.map +0 -1
  220. package/build/ts/proof/constants.d.ts +0 -17
  221. package/build/ts/proof/constants.d.ts.map +0 -1
  222. package/build/ts/proof/constants.js +0 -20
  223. package/build/ts/proof/constants.js.map +0 -1
  224. package/build/ts/user/user.d.ts +0 -42
  225. package/build/ts/user/user.d.ts.map +0 -1
  226. package/build/ts/user/user.js +0 -192
  227. package/build/ts/user/user.js.map +0 -1
package/LICENSE CHANGED
@@ -1,7 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Barry WhiteHat, Kendrick Tan, Kobi Gurkan, Kirill Goncharov
4
- Cory Dickson, Han Jian, Chih-Cheng Liang, and Koh Wei Jie
3
+ Copyright (c) 2025 Ethereum Foundation
5
4
 
6
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
6
  of this software and associated documentation files (the "Software"), to deal
@@ -4,6 +4,7 @@
4
4
  "private": false,
5
5
  "description": "MACI's SDK",
6
6
  "main": "build/ts/index.js",
7
+ "types": "build/ts/index.d.ts",
7
8
  "exports": {
8
9
  ".": {
9
10
  "types": "./build/ts/index.d.ts",
@@ -14,6 +15,13 @@
14
15
  "default": "./build/ts/browser/index.js"
15
16
  }
16
17
  },
18
+ "typesVersions": {
19
+ "*": {
20
+ "browser": [
21
+ "./build/ts/browser/index.d.ts"
22
+ ]
23
+ }
24
+ },
17
25
  "bin": {
18
26
  "maci-sdk": "./build/ts/index.js"
19
27
  },
@@ -28,7 +36,7 @@
28
36
  "scripts": {
29
37
  "watch": "tsc --watch",
30
38
  "build": "tsc -p tsconfig.build.json",
31
- "postbuild": "cp package.json ./build && mkdir -p ./zkeys",
39
+ "postbuild": "cp package.json ./build",
32
40
  "types": "tsc -p tsconfig.json --noEmit",
33
41
  "test": "jest",
34
42
  "test:coverage": "pnpm run test --coverage",
@@ -36,21 +44,22 @@
36
44
  },
37
45
  "dependencies": {
38
46
  "@zk-kit/lean-imt": "^2.2.3",
39
- "ethers": "^6.13.4",
47
+ "ethers": "^6.15.0",
40
48
  "@maci-protocol/contracts": "^3.0.0",
41
49
  "@maci-protocol/core": "^3.0.0",
42
50
  "@maci-protocol/crypto": "^3.0.0",
43
51
  "@maci-protocol/domainobjs": "^3.0.0",
44
- "multiformats": "9.9.0"
52
+ "multiformats": "9.9.0",
53
+ "snarkjs": "^0.7.5"
45
54
  },
46
55
  "devDependencies": {
47
- "@types/jest": "^29.5.2",
48
- "@types/node": "^22.14.0",
56
+ "@types/jest": "^30.0.0",
57
+ "@types/node": "^24.2.0",
49
58
  "@types/snarkjs": "^0.7.9",
50
- "jest": "^29.5.0",
51
- "mocha": "^11.1.0",
59
+ "jest": "^30.2.0",
60
+ "mocha": "^11.7.2",
52
61
  "nyc": "^17.1.0",
53
- "ts-jest": "^29.3.0",
54
- "typescript": "^5.8.2"
62
+ "ts-jest": "^29.4.1",
63
+ "typescript": "^5.9.2"
55
64
  }
56
65
  }
@@ -1,15 +1,15 @@
1
- export * from "../verifyingKeys";
2
- export * from "../maci";
3
- export * from "../relayer";
4
1
  export * from "../poll";
5
- export * from "../proof";
2
+ export * from "../proof/download";
3
+ export * from "../proof/types";
6
4
  export * from "../tally";
7
5
  export * from "../trees";
8
6
  export * from "../vote";
9
- export * from "../utils";
10
- export * from "../user";
11
7
  export * from "../maciKeys";
12
- export { EMode, EContracts, EPolicies, EInitialVoiceCreditProxies, extractVk, genProofSnarkjs, formatProofForVerifierContract, verifyProof, cleanThreads, unlinkFile, getBlockTimestamp, genEmptyBallotRoots, } from "@maci-protocol/contracts";
13
- export type { FullProveResult, IDeployParams, IMergeParams, IProveParams, IVerifyingKeyStruct, SnarkProof, IIpfsMessage, } from "@maci-protocol/contracts";
8
+ export * from "../subgraph";
9
+ export * from "../user/types";
10
+ export { getSignedupUserData, signup, hasUserSignedUp } from "../user/signup";
11
+ export { getJoinedUserData, hasUserJoinedPoll, generateMaciStateTree, getPollJoiningCircuitEvents, joiningCircuitInputs, generateMaciStateTreeWithEndKey, } from "../user/utils";
12
+ export * from "./joinPoll";
13
+ export type { EMode, FullProveResult, IDeployParams, IMergeParams, IProveParams, IVerifyingKeyStruct, SnarkProof, IIpfsMessage, } from "@maci-protocol/contracts";
14
14
  export * from "@maci-protocol/contracts/typechain-types";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/browser/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,KAAK,EACL,UAAU,EACV,SAAS,EACT,0BAA0B,EAC1B,SAAS,EACT,eAAe,EACf,8BAA8B,EAC9B,WAAW,EACX,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,YAAY,GACb,MAAM,0BAA0B,CAAC;AAElC,cAAc,0CAA0C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/browser/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,EACpB,+BAA+B,GAChC,MAAM,eAAe,CAAC;AAEvB,cAAc,YAAY,CAAC;AAE3B,YAAY,EACV,KAAK,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,YAAY,GACb,MAAM,0BAA0B,CAAC;AAElC,cAAc,0CAA0C,CAAC"}
@@ -14,30 +14,27 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.genEmptyBallotRoots = exports.getBlockTimestamp = exports.unlinkFile = exports.cleanThreads = exports.verifyProof = exports.formatProofForVerifierContract = exports.genProofSnarkjs = exports.extractVk = exports.EInitialVoiceCreditProxies = exports.EPolicies = exports.EContracts = exports.EMode = void 0;
18
- __exportStar(require("../verifyingKeys"), exports);
19
- __exportStar(require("../maci"), exports);
20
- __exportStar(require("../relayer"), exports);
17
+ exports.generateMaciStateTreeWithEndKey = exports.joiningCircuitInputs = exports.getPollJoiningCircuitEvents = exports.generateMaciStateTree = exports.hasUserJoinedPoll = exports.getJoinedUserData = exports.hasUserSignedUp = exports.signup = exports.getSignedupUserData = void 0;
21
18
  __exportStar(require("../poll"), exports);
22
- __exportStar(require("../proof"), exports);
19
+ __exportStar(require("../proof/download"), exports);
20
+ __exportStar(require("../proof/types"), exports);
23
21
  __exportStar(require("../tally"), exports);
24
22
  __exportStar(require("../trees"), exports);
25
23
  __exportStar(require("../vote"), exports);
26
- __exportStar(require("../utils"), exports);
27
- __exportStar(require("../user"), exports);
28
24
  __exportStar(require("../maciKeys"), exports);
29
- var contracts_1 = require("@maci-protocol/contracts");
30
- Object.defineProperty(exports, "EMode", { enumerable: true, get: function () { return contracts_1.EMode; } });
31
- Object.defineProperty(exports, "EContracts", { enumerable: true, get: function () { return contracts_1.EContracts; } });
32
- Object.defineProperty(exports, "EPolicies", { enumerable: true, get: function () { return contracts_1.EPolicies; } });
33
- Object.defineProperty(exports, "EInitialVoiceCreditProxies", { enumerable: true, get: function () { return contracts_1.EInitialVoiceCreditProxies; } });
34
- Object.defineProperty(exports, "extractVk", { enumerable: true, get: function () { return contracts_1.extractVk; } });
35
- Object.defineProperty(exports, "genProofSnarkjs", { enumerable: true, get: function () { return contracts_1.genProofSnarkjs; } });
36
- Object.defineProperty(exports, "formatProofForVerifierContract", { enumerable: true, get: function () { return contracts_1.formatProofForVerifierContract; } });
37
- Object.defineProperty(exports, "verifyProof", { enumerable: true, get: function () { return contracts_1.verifyProof; } });
38
- Object.defineProperty(exports, "cleanThreads", { enumerable: true, get: function () { return contracts_1.cleanThreads; } });
39
- Object.defineProperty(exports, "unlinkFile", { enumerable: true, get: function () { return contracts_1.unlinkFile; } });
40
- Object.defineProperty(exports, "getBlockTimestamp", { enumerable: true, get: function () { return contracts_1.getBlockTimestamp; } });
41
- Object.defineProperty(exports, "genEmptyBallotRoots", { enumerable: true, get: function () { return contracts_1.genEmptyBallotRoots; } });
25
+ __exportStar(require("../subgraph"), exports);
26
+ __exportStar(require("../user/types"), exports);
27
+ var signup_1 = require("../user/signup");
28
+ Object.defineProperty(exports, "getSignedupUserData", { enumerable: true, get: function () { return signup_1.getSignedupUserData; } });
29
+ Object.defineProperty(exports, "signup", { enumerable: true, get: function () { return signup_1.signup; } });
30
+ Object.defineProperty(exports, "hasUserSignedUp", { enumerable: true, get: function () { return signup_1.hasUserSignedUp; } });
31
+ var utils_1 = require("../user/utils");
32
+ Object.defineProperty(exports, "getJoinedUserData", { enumerable: true, get: function () { return utils_1.getJoinedUserData; } });
33
+ Object.defineProperty(exports, "hasUserJoinedPoll", { enumerable: true, get: function () { return utils_1.hasUserJoinedPoll; } });
34
+ Object.defineProperty(exports, "generateMaciStateTree", { enumerable: true, get: function () { return utils_1.generateMaciStateTree; } });
35
+ Object.defineProperty(exports, "getPollJoiningCircuitEvents", { enumerable: true, get: function () { return utils_1.getPollJoiningCircuitEvents; } });
36
+ Object.defineProperty(exports, "joiningCircuitInputs", { enumerable: true, get: function () { return utils_1.joiningCircuitInputs; } });
37
+ Object.defineProperty(exports, "generateMaciStateTreeWithEndKey", { enumerable: true, get: function () { return utils_1.generateMaciStateTreeWithEndKey; } });
38
+ __exportStar(require("./joinPoll"), exports);
42
39
  __exportStar(require("@maci-protocol/contracts/typechain-types"), exports);
43
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/browser/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,0CAAwB;AACxB,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,sDAakC;AAZhC,kGAAA,KAAK,OAAA;AACL,uGAAA,UAAU,OAAA;AACV,sGAAA,SAAS,OAAA;AACT,uHAAA,0BAA0B,OAAA;AAC1B,sGAAA,SAAS,OAAA;AACT,4GAAA,eAAe,OAAA;AACf,2HAAA,8BAA8B,OAAA;AAC9B,wGAAA,WAAW,OAAA;AACX,yGAAA,YAAY,OAAA;AACZ,uGAAA,UAAU,OAAA;AACV,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AAarB,2EAAyD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/browser/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,oDAAkC;AAClC,iDAA+B;AAC/B,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,8CAA4B;AAC5B,gDAA8B;AAC9B,yCAA8E;AAArE,6GAAA,mBAAmB,OAAA;AAAE,gGAAA,MAAM,OAAA;AAAE,yGAAA,eAAe,OAAA;AACrD,uCAOuB;AANrB,0GAAA,iBAAiB,OAAA;AACjB,0GAAA,iBAAiB,OAAA;AACjB,8GAAA,qBAAqB,OAAA;AACrB,oHAAA,2BAA2B,OAAA;AAC3B,6GAAA,oBAAoB,OAAA;AACpB,wHAAA,+BAA+B,OAAA;AAGjC,6CAA2B;AAa3B,2EAAyD"}
@@ -0,0 +1,10 @@
1
+ import type { IJoinPollBrowserArgs, IJoinPollData } from "../user/types";
2
+ /**
3
+ * Join Poll user to the Poll contract
4
+ * @dev This version is optimised to work on browsers
5
+ * @dev It uses WASM + accepts already created inclusion proofs
6
+ * @param {IJoinPollArgs} args - The arguments for the join poll command
7
+ * @returns {IJoinPollData} The poll state index of the joined user and transaction hash
8
+ */
9
+ export declare const joinPoll: ({ maciAddress, privateKey, pollId, signer, startBlock, endBlock, blocksPerBatch, pollJoiningZkey, pollJoiningWasm, sgDataArg, ivcpDataArg, inclusionProof, useLatestStateIndex, }: IJoinPollBrowserArgs) => Promise<IJoinPollData>;
10
+ //# sourceMappingURL=joinPoll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joinPoll.d.ts","sourceRoot":"","sources":["../../../ts/browser/joinPoll.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQzE;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAU,mLAc5B,oBAAoB,KAAG,OAAO,CAAC,aAAa,CA+F9C,CAAC"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.joinPoll = void 0;
4
+ /* eslint-disable no-underscore-dangle */
5
+ const typechain_types_1 = require("@maci-protocol/contracts/typechain-types");
6
+ const crypto_1 = require("@maci-protocol/crypto");
7
+ const domainobjs_1 = require("@maci-protocol/domainobjs");
8
+ const utils_1 = require("../user/utils");
9
+ const contracts_1 = require("../utils/contracts");
10
+ const utils_2 = require("./utils");
11
+ /**
12
+ * Join Poll user to the Poll contract
13
+ * @dev This version is optimised to work on browsers
14
+ * @dev It uses WASM + accepts already created inclusion proofs
15
+ * @param {IJoinPollArgs} args - The arguments for the join poll command
16
+ * @returns {IJoinPollData} The poll state index of the joined user and transaction hash
17
+ */
18
+ const joinPoll = async ({ maciAddress, privateKey, pollId, signer, startBlock, endBlock, blocksPerBatch, pollJoiningZkey, pollJoiningWasm, sgDataArg, ivcpDataArg, inclusionProof, useLatestStateIndex, }) => {
19
+ const validContract = await (0, contracts_1.contractExists)(signer.provider, maciAddress);
20
+ if (!validContract) {
21
+ throw new Error("MACI contract does not exist");
22
+ }
23
+ if (!domainobjs_1.PrivateKey.isValidSerialized(privateKey)) {
24
+ throw new Error("Invalid MACI private key");
25
+ }
26
+ if (pollId < 0) {
27
+ throw new Error("Invalid poll id");
28
+ }
29
+ const userMaciPrivateKey = domainobjs_1.PrivateKey.deserialize(privateKey);
30
+ const userMaciPublicKey = new domainobjs_1.Keypair(userMaciPrivateKey).publicKey;
31
+ const nullifier = (0, crypto_1.poseidon)([BigInt(userMaciPrivateKey.asCircuitInputs()), pollId]);
32
+ // check if the user has already joined the poll based on the nullifier
33
+ const hasUserJoinedAlready = await (0, utils_1.hasUserJoinedPoll)({
34
+ maciAddress,
35
+ pollId,
36
+ nullifier,
37
+ signer,
38
+ });
39
+ if (hasUserJoinedAlready) {
40
+ throw new Error("User has already joined");
41
+ }
42
+ const maciContract = typechain_types_1.MACI__factory.connect(maciAddress, signer);
43
+ const pollContracts = await maciContract.getPoll(pollId);
44
+ const pollContract = typechain_types_1.Poll__factory.connect(pollContracts.poll, signer);
45
+ // get the state index from the MACI contract
46
+ const stateIndex = await maciContract.getStateIndex(userMaciPublicKey.hash()).catch(() => -1n);
47
+ const stateTreeDepth = await maciContract.stateTreeDepth();
48
+ let circuitInputs;
49
+ if (inclusionProof) {
50
+ circuitInputs = (0, utils_1.joiningCircuitInputs)(inclusionProof, stateTreeDepth, userMaciPrivateKey, userMaciPublicKey, pollId);
51
+ }
52
+ else {
53
+ circuitInputs = await (0, utils_1.getPollJoiningCircuitEvents)({
54
+ maciContract,
55
+ stateIndex,
56
+ pollId,
57
+ userMaciPrivateKey,
58
+ signer,
59
+ startBlock,
60
+ endBlock,
61
+ blocksPerBatch,
62
+ });
63
+ }
64
+ const stateRootIndex = useLatestStateIndex
65
+ ? Number.parseInt((await maciContract.totalSignups()).toString(), 10) - 1
66
+ : stateIndex;
67
+ // generate the proof for this batch
68
+ const { proof } = await (0, utils_2.generateProofSnarkjs)({
69
+ inputs: circuitInputs,
70
+ zkeyPath: pollJoiningZkey,
71
+ wasmPath: pollJoiningWasm,
72
+ });
73
+ // submit the message onchain as well as the encryption public key
74
+ const tx = await pollContract.joinPoll(nullifier, userMaciPublicKey.asContractParam(), stateRootIndex, (0, utils_2.formatProofForVerifierContract)(proof), sgDataArg, ivcpDataArg);
75
+ const receipt = await tx.wait();
76
+ if (receipt?.status !== 1) {
77
+ throw new Error("Transaction failed");
78
+ }
79
+ const [{ args }] = await pollContract.queryFilter(pollContract.filters.PollJoined, receipt.blockNumber, receipt.blockNumber);
80
+ return {
81
+ pollStateIndex: args._pollStateIndex.toString(),
82
+ voiceCredits: args._voiceCreditBalance.toString(),
83
+ nullifier: nullifier.toString(),
84
+ hash: receipt.hash,
85
+ };
86
+ };
87
+ exports.joinPoll = joinPoll;
88
+ //# sourceMappingURL=joinPoll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joinPoll.js","sourceRoot":"","sources":["../../../ts/browser/joinPoll.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,8EAAsH;AACtH,kDAAiD;AACjD,0DAAgE;AAKhE,yCAAqG;AACrG,kDAAoD;AAEpD,mCAA+E;AAE/E;;;;;;GAMG;AACI,MAAM,QAAQ,GAAG,KAAK,EAAE,EAC7B,WAAW,EACX,UAAU,EACV,MAAM,EACN,MAAM,EACN,UAAU,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,eAAe,EACf,SAAS,EACT,WAAW,EACX,cAAc,EACd,mBAAmB,GACE,EAA0B,EAAE;IACjD,MAAM,aAAa,GAAG,MAAM,IAAA,0BAAc,EAAC,MAAM,CA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AAC,GAAG,MAAM,YAAY,CAAC,WAAW,CAC/C,YAAY,CAAC,OAAO,CAAC,UAAU,EAC/B,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,WAAW,CACpB,CAAC;IAEF,OAAO;QACL,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE;QAC/C,YAAY,EAAE,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE;QACjD,SAAS,EAAE,SAAS,CAAC,QAAQ,EAAE;QAC/B,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC;AACJ,CAAC,CAAC;AA7GW,QAAA,QAAQ,YA6GnB"}
@@ -0,0 +1,18 @@
1
+ import { type Groth16Proof } from "snarkjs";
2
+ import type { IGenerateProofOptions, FullProveResult, SnarkProof } from "@maci-protocol/contracts";
3
+ /**
4
+ * Format a SnarkProof type to an array of strings
5
+ * which can be passed to the Groth16 verifier contract.
6
+ * @param proof the SnarkProof to format
7
+ * @returns an array of strings
8
+ */
9
+ export declare const formatProofForVerifierContract: (proof: SnarkProof | Groth16Proof) => string[];
10
+ /**
11
+ * Generate a zk-SNARK proof using snarkjs
12
+ * @param inputs - the inputs to the circuit
13
+ * @param zkeyPath - the path to the zkey
14
+ * @param wasmPath - the path to the wasm witness
15
+ * @returns the zk-SNARK proof and public signals
16
+ */
17
+ export declare const generateProofSnarkjs: ({ inputs, zkeyPath, wasmPath, }: IGenerateProofOptions) => Promise<FullProveResult>;
18
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/browser/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEnG;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,GAAI,OAAO,UAAU,GAAG,YAAY,KAAG,MAAM,EAY5D,CAAC;AAE7B;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAU,iCAIxC,qBAAqB,KAAG,OAAO,CAAC,eAAe,CAOjD,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateProofSnarkjs = exports.formatProofForVerifierContract = void 0;
4
+ const snarkjs_1 = require("snarkjs");
5
+ /**
6
+ * Format a SnarkProof type to an array of strings
7
+ * which can be passed to the Groth16 verifier contract.
8
+ * @param proof the SnarkProof to format
9
+ * @returns an array of strings
10
+ */
11
+ const formatProofForVerifierContract = (proof) => [
12
+ proof.pi_a[0],
13
+ proof.pi_a[1],
14
+ proof.pi_b[0][1],
15
+ proof.pi_b[0][0],
16
+ proof.pi_b[1][1],
17
+ proof.pi_b[1][0],
18
+ proof.pi_c[0],
19
+ proof.pi_c[1],
20
+ ].map((x) => x.toString());
21
+ exports.formatProofForVerifierContract = formatProofForVerifierContract;
22
+ /**
23
+ * Generate a zk-SNARK proof using snarkjs
24
+ * @param inputs - the inputs to the circuit
25
+ * @param zkeyPath - the path to the zkey
26
+ * @param wasmPath - the path to the wasm witness
27
+ * @returns the zk-SNARK proof and public signals
28
+ */
29
+ const generateProofSnarkjs = async ({ inputs, zkeyPath, wasmPath, }) => {
30
+ if (!wasmPath) {
31
+ throw new Error("wasmPath must be specified");
32
+ }
33
+ const { proof, publicSignals } = await snarkjs_1.groth16.fullProve(inputs, wasmPath, zkeyPath);
34
+ return { proof, publicSignals };
35
+ };
36
+ exports.generateProofSnarkjs = generateProofSnarkjs;
37
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/browser/utils.ts"],"names":[],"mappings":";;;AAAA,qCAAqD;AAIrD;;;;;GAKG;AACI,MAAM,8BAA8B,GAAG,CAAC,KAAgC,EAAY,EAAE,CAC3F;IACE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACb,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAEb,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACb,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;CACd,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAZhB,QAAA,8BAA8B,kCAYd;AAE7B;;;;;;GAMG;AACI,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,GACc,EAA4B,EAAE;IACpD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,iBAAO,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAClC,CAAC,CAAC;AAXW,QAAA,oBAAoB,wBAW/B"}
@@ -1,5 +1,6 @@
1
1
  export { deployPoll } from "./poll";
2
- export { deployVkRegistryContract } from "./vkRegistry";
2
+ export { deployVerifyingKeysRegistryContract } from "./verifyingKeysRegistry";
3
3
  export { deployMaci } from "./maci";
4
- export type { IDeployPollArgs, IPollContractsData, IDeployMaciArgs, IMaciContracts, IDeployVkRegistryArgs, } from "./types";
4
+ export { deployFactoryWithLinkedLibraries } from "./utils";
5
+ export type { IDeployPollArgs, IPollContractsData, IDeployMaciArgs, IMaciContracts, IDeployVerifyingKeyRegistryArgs, } from "./types";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/deploy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,qBAAqB,GACtB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/deploy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC;AAE3D,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,+BAA+B,GAChC,MAAM,SAAS,CAAC"}
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deployMaci = exports.deployVkRegistryContract = exports.deployPoll = void 0;
3
+ exports.deployFactoryWithLinkedLibraries = exports.deployMaci = exports.deployVerifyingKeysRegistryContract = exports.deployPoll = void 0;
4
4
  var poll_1 = require("./poll");
5
5
  Object.defineProperty(exports, "deployPoll", { enumerable: true, get: function () { return poll_1.deployPoll; } });
6
- var vkRegistry_1 = require("./vkRegistry");
7
- Object.defineProperty(exports, "deployVkRegistryContract", { enumerable: true, get: function () { return vkRegistry_1.deployVkRegistryContract; } });
6
+ var verifyingKeysRegistry_1 = require("./verifyingKeysRegistry");
7
+ Object.defineProperty(exports, "deployVerifyingKeysRegistryContract", { enumerable: true, get: function () { return verifyingKeysRegistry_1.deployVerifyingKeysRegistryContract; } });
8
8
  var maci_1 = require("./maci");
9
9
  Object.defineProperty(exports, "deployMaci", { enumerable: true, get: function () { return maci_1.deployMaci; } });
10
+ var utils_1 = require("./utils");
11
+ Object.defineProperty(exports, "deployFactoryWithLinkedLibraries", { enumerable: true, get: function () { return utils_1.deployFactoryWithLinkedLibraries; } });
10
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/deploy/index.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,2CAAwD;AAA/C,sHAAA,wBAAwB,OAAA;AACjC,+BAAoC;AAA3B,kGAAA,UAAU,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/deploy/index.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,iEAA8E;AAArE,4IAAA,mCAAmC,OAAA;AAC5C,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,iCAA2D;AAAlD,yHAAA,gCAAgC,OAAA"}
@@ -4,5 +4,5 @@ import type { IDeployMaciArgs, IMaciContracts } from "./types";
4
4
  * @param args - The arguments for the MACI contracts deployment
5
5
  * @returns The deployed MACI contracts
6
6
  */
7
- export declare const deployMaci: ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, }: IDeployMaciArgs) => Promise<IMaciContracts>;
7
+ export declare const deployMaci: ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, verifier, }: IDeployMaciArgs) => Promise<IMaciContracts>;
8
8
  //# sourceMappingURL=maci.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"maci.d.ts","sourceRoot":"","sources":["../../../ts/deploy/maci.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI/D;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,8IAQ9B,eAAe,KAAG,OAAO,CAAC,cAAc,CAmF1C,CAAC"}
1
+ {"version":3,"file":"maci.d.ts","sourceRoot":"","sources":["../../../ts/deploy/maci.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK/D;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,wJAS9B,eAAe,KAAG,OAAO,CAAC,cAAc,CA8F1C,CAAC"}
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deployMaci = void 0;
4
4
  const contracts_1 = require("@maci-protocol/contracts");
5
5
  const utils_1 = require("./utils");
6
+ const verifyingKeysRegistry_1 = require("./verifyingKeysRegistry");
6
7
  /**
7
8
  * Deploy the MACI contracts
8
9
  * @param args - The arguments for the MACI contracts deployment
9
10
  * @returns The deployed MACI contracts
10
11
  */
11
- const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, }) => {
12
- const emptyBallotRoots = (0, contracts_1.genEmptyBallotRoots)(stateTreeDepth);
12
+ const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, verifier, }) => {
13
+ const emptyBallotRoots = (0, contracts_1.generateEmptyBallotRoots)(stateTreeDepth);
13
14
  const { PoseidonT3Contract, PoseidonT4Contract, PoseidonT5Contract, PoseidonT6Contract } = await (0, contracts_1.deployPoseidonContracts)(signer, poseidonAddresses, true);
14
15
  const poseidonAddrs = await Promise.all([
15
16
  PoseidonT3Contract.getAddress(),
@@ -55,6 +56,9 @@ const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddr
55
56
  }),
56
57
  signer,
57
58
  });
59
+ const verifierContract = verifier || (await (0, contracts_1.deployVerifier)(signer, true));
60
+ const verifierContractAddress = await verifierContract.getAddress();
61
+ const verifyingKeysRegistryContractAddress = await (0, verifyingKeysRegistry_1.deployVerifyingKeysRegistryContract)({ signer });
58
62
  const maciContractAddress = await (0, utils_1.deployFactoryWithLinkedLibraries)({
59
63
  abi: contracts_1.MACI__factory.abi,
60
64
  bytecode: contracts_1.MACI__factory.linkBytecode({
@@ -65,12 +69,16 @@ const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddr
65
69
  }),
66
70
  signer,
67
71
  args: [
68
- pollFactoryContractAddress,
69
- messageProcessorFactoryContractAddress,
70
- tallyFactoryContractAddress,
71
- signupPolicyAddress,
72
- stateTreeDepth,
73
- emptyBallotRoots,
72
+ {
73
+ pollFactory: pollFactoryContractAddress,
74
+ messageProcessorFactory: messageProcessorFactoryContractAddress,
75
+ tallyFactory: tallyFactoryContractAddress,
76
+ signUpPolicy: signupPolicyAddress,
77
+ verifier: verifierContractAddress,
78
+ verifyingKeysRegistry: verifyingKeysRegistryContractAddress,
79
+ stateTreeDepth,
80
+ emptyBallotRoots,
81
+ },
74
82
  ],
75
83
  });
76
84
  const policy = contracts_1.IBasePolicy__factory.connect(signupPolicyAddress, signer);
@@ -81,6 +89,8 @@ const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddr
81
89
  messageProcessorFactoryContractAddress,
82
90
  tallyFactoryContractAddress,
83
91
  poseidonAddresses: poseidonAddrs,
92
+ verifierContractAddress,
93
+ verifyingKeysRegistryContractAddress,
84
94
  };
85
95
  };
86
96
  exports.deployMaci = deployMaci;
@@ -1 +1 @@
1
- {"version":3,"file":"maci.js","sourceRoot":"","sources":["../../../ts/deploy/maci.ts"],"names":[],"mappings":";;;AAAA,wDAQkC;AAIlC,mCAA2D;AAE3D;;;;GAIG;AACI,MA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W,CAAC,GAAG;QACpB,QAAQ,EAAE,yBAAW,CAAC,YAAY,CAAC;YACjC,4CAA4C,EAAE,aAAa,CAAC,UAAU;YACtE,4CAA4C,EAAE,aAAa,CAAC,UAAU;YACtE,4CAA4C,EAAE,aAAa,CAAC,UAAU;YACtE,4CAA4C,EAAE,aAAa,CAAC,UAAU;SACvE,CAAC;QACF,MAAM;QACN,IAAI,EAAE;YACJ;gBACE,WAAW,EAAE,0BAA0B;gBACvC,uBAAuB,EAAE,sCAAsC;gBAC/D,YAAY,EAAE,2BAA2B;gBACzC,YAAY,EAAE,mBAAmB;gBACjC,QAAQ,EAAE,uBAAuB;gBACjC,qBAAqB,EAAE,oCAAoC;gBAC3D,cAAc;gBACd,gBAAgB;aACjB;SACF;KACF,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,gCAAmB,CAAC,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IACxE,MAAM,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAEpE,OAAO;QACL,mBAAmB;QACnB,0BAA0B;QAC1B,sCAAsC;QACtC,2BAA2B;QAC3B,iBAAiB,EAAE,aAAa;QAChC,uBAAuB;QACvB,oCAAoC;KACrC,CAAC;AACJ,CAAC,CAAC;AAvGW,QAAA,UAAU,cAuGrB"}
@@ -4,5 +4,5 @@ import type { IDeployPollArgs, IPollContractsData } from "./types";
4
4
  * @param args - The arguments for the deploy poll command
5
5
  * @returns The addresses of the deployed contracts
6
6
  */
7
- export declare const deployPoll: ({ maciAddress, pollStartTimestamp, pollEndTimestamp, intStateTreeDepth, voteOptionTreeDepth, messageBatchSize, coordinatorPubKey, verifierContractAddress, vkRegistryContractAddress, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, signer, }: IDeployPollArgs) => Promise<IPollContractsData>;
7
+ export declare const deployPoll: ({ maciAddress, pollStartTimestamp, pollEndTimestamp, tallyProcessingStateTreeDepth, voteOptionTreeDepth, messageBatchSize, stateTreeDepth, coordinatorPublicKey, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, freeForAllCheckerFactoryAddress, freeForAllPolicyFactoryAddress, initialVoiceCreditProxyFactoryAddress, signer, }: IDeployPollArgs) => Promise<IPollContractsData>;
8
8
  //# sourceMappingURL=poll.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAMnE;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,kTAiB9B,eAAe,KAAG,OAAO,CAAC,kBAAkB,CAwH9C,CAAC"}
1
+ {"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAMnE;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,qYAmB9B,eAAe,KAAG,OAAO,CAAC,kBAAkB,CAkI9C,CAAC"}
@@ -4,21 +4,18 @@ exports.deployPoll = void 0;
4
4
  const contracts_1 = require("@maci-protocol/contracts");
5
5
  const core_1 = require("@maci-protocol/core");
6
6
  const domainobjs_1 = require("@maci-protocol/domainobjs");
7
- const utils_1 = require("../utils");
8
- const utils_2 = require("./utils");
7
+ const contracts_2 = require("../utils/contracts");
8
+ const utils_1 = require("./utils");
9
9
  /**
10
10
  * Deploy a poll
11
11
  * @param args - The arguments for the deploy poll command
12
12
  * @returns The addresses of the deployed contracts
13
13
  */
14
- const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, intStateTreeDepth, voteOptionTreeDepth, messageBatchSize, coordinatorPubKey, verifierContractAddress, vkRegistryContractAddress, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, signer, }) => {
15
- if (!vkRegistryContractAddress) {
16
- throw new Error("Please provide a VkRegistry contract address");
17
- }
14
+ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, tallyProcessingStateTreeDepth, voteOptionTreeDepth, messageBatchSize, stateTreeDepth, coordinatorPublicKey, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, freeForAllCheckerFactoryAddress, freeForAllPolicyFactoryAddress, initialVoiceCreditProxyFactoryAddress, signer, }) => {
18
15
  if (!maciAddress) {
19
16
  throw new Error("Please provide a MACI contract address");
20
17
  }
21
- const isMaciExists = await (0, utils_1.contractExists)(signer.provider, maciAddress);
18
+ const isMaciExists = await (0, contracts_2.contractExists)(signer.provider, maciAddress);
22
19
  if (!isMaciExists) {
23
20
  throw new Error("MACI contract does not exist");
24
21
  }
@@ -26,12 +23,21 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
26
23
  // check if we have a signupPolicy already deployed or passed as arg
27
24
  let signupPolicyContractAddress = policyContractAddress;
28
25
  if (!signupPolicyContractAddress) {
29
- const [contract] = await (0, contracts_1.deployFreeForAllSignUpPolicy)(signer, true);
26
+ const checkerFactory = freeForAllCheckerFactoryAddress
27
+ ? contracts_1.FreeForAllCheckerFactory__factory.connect(freeForAllCheckerFactoryAddress, signer)
28
+ : undefined;
29
+ const policyFactory = freeForAllPolicyFactoryAddress
30
+ ? contracts_1.FreeForAllPolicyFactory__factory.connect(freeForAllPolicyFactoryAddress, signer)
31
+ : undefined;
32
+ const [contract] = await (0, contracts_1.deployFreeForAllSignUpPolicy)({ checker: checkerFactory, policy: policyFactory }, signer, true);
30
33
  signupPolicyContractAddress = await contract.getAddress();
31
34
  }
32
35
  let initialVoiceCreditProxyAddress = initialVoiceCreditProxyContractAddress;
33
36
  if (!initialVoiceCreditProxyAddress) {
34
- const [contract] = await (0, contracts_1.deployConstantInitialVoiceCreditProxy)({ amount: initialVoiceCredits ?? utils_2.DEFAULT_INITIAL_VOICE_CREDITS }, signer, undefined, true);
37
+ const constantInitialVoiceCreditProxyFactory = initialVoiceCreditProxyFactoryAddress
38
+ ? contracts_1.ConstantInitialVoiceCreditProxyFactory__factory.connect(initialVoiceCreditProxyFactoryAddress, signer)
39
+ : await (0, contracts_1.deployConstantInitialVoiceCreditProxyFactory)(signer, true);
40
+ const contract = await (0, contracts_1.deployConstantInitialVoiceCreditProxy)({ amount: initialVoiceCredits ?? utils_1.DEFAULT_INITIAL_VOICE_CREDITS }, constantInitialVoiceCreditProxyFactory, signer);
35
41
  initialVoiceCreditProxyAddress = await contract.getAddress();
36
42
  }
37
43
  // required arg -> poll duration
@@ -42,7 +48,7 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
42
48
  throw new Error("End date cannot be before start date");
43
49
  }
44
50
  // required arg -> int state tree depth
45
- if (intStateTreeDepth <= 0) {
51
+ if (tallyProcessingStateTreeDepth <= 0) {
46
52
  throw new Error("Int state tree depth cannot be <= 0");
47
53
  }
48
54
  // required arg -> message tree depth
@@ -58,7 +64,7 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
58
64
  throw new Error("Vote options cannot be greater than the number of leaves in the vote option tree");
59
65
  }
60
66
  // we check that the coordinator's public key is valid
61
- if (!domainobjs_1.PubKey.isValidSerializedPubKey(coordinatorPubKey.serialize())) {
67
+ if (!domainobjs_1.PublicKey.isValidSerialized(coordinatorPublicKey.serialize())) {
62
68
  throw new Error("Invalid MACI public key");
63
69
  }
64
70
  const receipt = await maciContract
@@ -66,13 +72,12 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
66
72
  startDate: pollStartTimestamp,
67
73
  endDate: pollEndTimestamp,
68
74
  treeDepths: {
69
- intStateTreeDepth,
75
+ tallyProcessingStateTreeDepth,
70
76
  voteOptionTreeDepth,
77
+ stateTreeDepth,
71
78
  },
72
79
  messageBatchSize,
73
- coordinatorPubKey: coordinatorPubKey.asContractParam(),
74
- verifier: verifierContractAddress,
75
- vkRegistry: vkRegistryContractAddress,
80
+ coordinatorPublicKey: coordinatorPublicKey.asContractParam(),
76
81
  mode,
77
82
  policy: signupPolicyContractAddress,
78
83
  initialVoiceCreditProxy: initialVoiceCreditProxyAddress,
@@ -1 +1 @@
1
- {"version":3,"file":"poll.js","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":";;;AAAA,wDAKkC;AAClC,8CAA6D;AAC7D,0DAAmD;AAInD,oCAA0C;AAE1C,mCAAwD;AAExD;;;;GAIG;AACI,MAAM,UAAU,GAAG,KAAK,EAAE,EAC/B,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,IAAI,EACJ,qBAAqB,EACrB,sCAAsC,EACtC,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,MAAM,GACU,EAA+B,EAAE;IACjD,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,IAAA,sBAAc,EAAC,MAAM,CAAC,QAAS,EAAE,WAAW,CAAC,CAAC;IAEzE,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,YAAY,GAAG,yBAAW,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE9D,oEAAoE;IACpE,IAAI,2BAA2B,GAAG,qBAAqB,CA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