@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.
- package/CHANGELOG.md +80 -0
- package/LICENSE +22 -0
- package/README.md +12 -0
- package/build/package.json +57 -0
- package/build/ts/browser/index.d.ts +13 -0
- package/build/ts/browser/index.d.ts.map +1 -0
- package/build/ts/browser/index.js +34 -0
- package/build/ts/browser/index.js.map +1 -0
- package/build/ts/browser/joinPoll.d.ts +8 -0
- package/build/ts/browser/joinPoll.d.ts.map +1 -0
- package/build/ts/browser/joinPoll.js +84 -0
- package/build/ts/browser/joinPoll.js.map +1 -0
- package/build/ts/browser/utils.d.ts +18 -0
- package/build/ts/browser/utils.d.ts.map +1 -0
- package/build/ts/browser/utils.js +37 -0
- package/build/ts/browser/utils.js.map +1 -0
- package/build/ts/deploy/index.d.ts +6 -0
- package/build/ts/deploy/index.d.ts.map +1 -0
- package/build/ts/deploy/index.js +12 -0
- package/build/ts/deploy/index.js.map +1 -0
- package/build/ts/deploy/maci.d.ts +8 -0
- package/build/ts/deploy/maci.d.ts.map +1 -0
- package/build/ts/deploy/maci.js +87 -0
- package/build/ts/deploy/maci.js.map +1 -0
- package/build/ts/deploy/poll.d.ts +8 -0
- package/build/ts/deploy/poll.d.ts.map +1 -0
- package/build/ts/deploy/poll.js +114 -0
- package/build/ts/deploy/poll.js.map +1 -0
- package/build/ts/deploy/types.d.ts +216 -0
- package/build/ts/deploy/types.d.ts.map +1 -0
- package/build/ts/deploy/types.js +3 -0
- package/build/ts/deploy/types.js.map +1 -0
- package/build/ts/deploy/utils.d.ts +11 -0
- package/build/ts/deploy/utils.d.ts.map +1 -0
- package/build/ts/deploy/utils.js +22 -0
- package/build/ts/deploy/utils.js.map +1 -0
- package/build/ts/deploy/vkRegistry.d.ts +7 -0
- package/build/ts/deploy/vkRegistry.d.ts.map +1 -0
- package/build/ts/deploy/vkRegistry.js +14 -0
- package/build/ts/deploy/vkRegistry.js.map +1 -0
- package/build/ts/index.d.ts +16 -0
- package/build/ts/index.d.ts.map +1 -0
- package/build/ts/index.js +82 -0
- package/build/ts/index.js.map +1 -0
- package/build/ts/maci/index.d.ts +6 -0
- package/build/ts/maci/index.d.ts.map +1 -0
- package/build/ts/maci/index.js +17 -0
- package/build/ts/maci/index.js.map +1 -0
- package/build/ts/maci/merge.d.ts +9 -0
- package/build/ts/maci/merge.d.ts.map +1 -0
- package/build/ts/maci/merge.js +29 -0
- package/build/ts/maci/merge.js.map +1 -0
- package/build/ts/maci/policy.d.ts +53 -0
- package/build/ts/maci/policy.d.ts.map +1 -0
- package/build/ts/maci/policy.js +166 -0
- package/build/ts/maci/policy.js.map +1 -0
- package/build/ts/maci/state.d.ts +8 -0
- package/build/ts/maci/state.d.ts.map +1 -0
- package/build/ts/maci/state.js +82 -0
- package/build/ts/maci/state.js.map +1 -0
- package/build/ts/maci/types.d.ts +208 -0
- package/build/ts/maci/types.d.ts.map +1 -0
- package/build/ts/maci/types.js +20 -0
- package/build/ts/maci/types.js.map +1 -0
- package/build/ts/maciKeys/__tests__/keypair.test.d.ts +2 -0
- package/build/ts/maciKeys/__tests__/keypair.test.d.ts.map +1 -0
- package/build/ts/maciKeys/__tests__/keypair.test.js +24 -0
- package/build/ts/maciKeys/__tests__/keypair.test.js.map +1 -0
- package/build/ts/maciKeys/__tests__/publicKeys.test.d.ts +2 -0
- package/build/ts/maciKeys/__tests__/publicKeys.test.d.ts.map +1 -0
- package/build/ts/maciKeys/__tests__/publicKeys.test.js +22 -0
- package/build/ts/maciKeys/__tests__/publicKeys.test.js.map +1 -0
- package/build/ts/maciKeys/index.d.ts +4 -0
- package/build/ts/maciKeys/index.d.ts.map +1 -0
- package/build/ts/maciKeys/index.js +8 -0
- package/build/ts/maciKeys/index.js.map +1 -0
- package/build/ts/maciKeys/keypair.d.ts +9 -0
- package/build/ts/maciKeys/keypair.d.ts.map +1 -0
- package/build/ts/maciKeys/keypair.js +20 -0
- package/build/ts/maciKeys/keypair.js.map +1 -0
- package/build/ts/maciKeys/publicKeys.d.ts +8 -0
- package/build/ts/maciKeys/publicKeys.d.ts.map +1 -0
- package/build/ts/maciKeys/publicKeys.js +23 -0
- package/build/ts/maciKeys/publicKeys.js.map +1 -0
- package/build/ts/maciKeys/types.d.ts +23 -0
- package/build/ts/maciKeys/types.d.ts.map +1 -0
- package/build/ts/maciKeys/types.js +3 -0
- package/build/ts/maciKeys/types.js.map +1 -0
- package/build/ts/poll/index.d.ts +4 -0
- package/build/ts/poll/index.d.ts.map +1 -0
- package/build/ts/poll/index.js +9 -0
- package/build/ts/poll/index.js.map +1 -0
- package/build/ts/poll/poll.d.ts +14 -0
- package/build/ts/poll/poll.d.ts.map +1 -0
- package/build/ts/poll/poll.js +62 -0
- package/build/ts/poll/poll.js.map +1 -0
- package/build/ts/poll/types.d.ts +151 -0
- package/build/ts/poll/types.d.ts.map +1 -0
- package/build/ts/poll/types.js +3 -0
- package/build/ts/poll/types.js.map +1 -0
- package/build/ts/poll/utils.d.ts +9 -0
- package/build/ts/poll/utils.d.ts.map +1 -0
- package/build/ts/poll/utils.js +43 -0
- package/build/ts/poll/utils.js.map +1 -0
- package/build/ts/proof/__tests__/download.test.d.ts +2 -0
- package/build/ts/proof/__tests__/download.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/download.test.js +50 -0
- package/build/ts/proof/__tests__/download.test.js.map +1 -0
- package/build/ts/proof/constants.d.ts +17 -0
- package/build/ts/proof/constants.d.ts.map +1 -0
- package/build/ts/proof/constants.js +20 -0
- package/build/ts/proof/constants.js.map +1 -0
- package/build/ts/proof/download.d.ts +9 -0
- package/build/ts/proof/download.d.ts.map +1 -0
- package/build/ts/proof/download.js +49 -0
- package/build/ts/proof/download.js.map +1 -0
- package/build/ts/proof/generate.d.ts +8 -0
- package/build/ts/proof/generate.d.ts.map +1 -0
- package/build/ts/proof/generate.js +127 -0
- package/build/ts/proof/generate.js.map +1 -0
- package/build/ts/proof/index.d.ts +4 -0
- package/build/ts/proof/index.d.ts.map +1 -0
- package/build/ts/proof/index.js +8 -0
- package/build/ts/proof/index.js.map +1 -0
- package/build/ts/proof/prove.d.ts +8 -0
- package/build/ts/proof/prove.d.ts.map +1 -0
- package/build/ts/proof/prove.js +81 -0
- package/build/ts/proof/prove.js.map +1 -0
- package/build/ts/proof/types.d.ts +175 -0
- package/build/ts/proof/types.d.ts.map +1 -0
- package/build/ts/proof/types.js +3 -0
- package/build/ts/proof/types.js.map +1 -0
- package/build/ts/relayer/__tests__/messages.test.d.ts +2 -0
- package/build/ts/relayer/__tests__/messages.test.d.ts.map +1 -0
- package/build/ts/relayer/__tests__/messages.test.js +76 -0
- package/build/ts/relayer/__tests__/messages.test.js.map +1 -0
- package/build/ts/relayer/__tests__/utils.test.d.ts +2 -0
- package/build/ts/relayer/__tests__/utils.test.d.ts.map +1 -0
- package/build/ts/relayer/__tests__/utils.test.js +73 -0
- package/build/ts/relayer/__tests__/utils.test.js.map +1 -0
- package/build/ts/relayer/index.d.ts +3 -0
- package/build/ts/relayer/index.d.ts.map +1 -0
- package/build/ts/relayer/index.js +8 -0
- package/build/ts/relayer/index.js.map +1 -0
- package/build/ts/relayer/messages.d.ts +23 -0
- package/build/ts/relayer/messages.d.ts.map +1 -0
- package/build/ts/relayer/messages.js +66 -0
- package/build/ts/relayer/messages.js.map +1 -0
- package/build/ts/relayer/types.d.ts +168 -0
- package/build/ts/relayer/types.d.ts.map +1 -0
- package/build/ts/relayer/types.js +3 -0
- package/build/ts/relayer/types.js.map +1 -0
- package/build/ts/relayer/utils.d.ts +12 -0
- package/build/ts/relayer/utils.d.ts.map +1 -0
- package/build/ts/relayer/utils.js +37 -0
- package/build/ts/relayer/utils.js.map +1 -0
- package/build/ts/tally/commitments.d.ts +9 -0
- package/build/ts/tally/commitments.d.ts.map +1 -0
- package/build/ts/tally/commitments.js +42 -0
- package/build/ts/tally/commitments.js.map +1 -0
- package/build/ts/tally/index.d.ts +4 -0
- package/build/ts/tally/index.d.ts.map +1 -0
- package/build/ts/tally/index.js +8 -0
- package/build/ts/tally/index.js.map +1 -0
- package/build/ts/tally/types.d.ts +179 -0
- package/build/ts/tally/types.d.ts.map +1 -0
- package/build/ts/tally/types.js +3 -0
- package/build/ts/tally/types.js.map +1 -0
- package/build/ts/tally/utils.d.ts +24 -0
- package/build/ts/tally/utils.d.ts.map +1 -0
- package/build/ts/tally/utils.js +50 -0
- package/build/ts/tally/utils.js.map +1 -0
- package/build/ts/tally/verification.d.ts +7 -0
- package/build/ts/tally/verification.d.ts.map +1 -0
- package/build/ts/tally/verification.js +62 -0
- package/build/ts/tally/verification.js.map +1 -0
- package/build/ts/trees/index.d.ts +3 -0
- package/build/ts/trees/index.d.ts.map +1 -0
- package/build/ts/trees/index.js +6 -0
- package/build/ts/trees/index.js.map +1 -0
- package/build/ts/trees/stateTree.d.ts +13 -0
- package/build/ts/trees/stateTree.d.ts.map +1 -0
- package/build/ts/trees/stateTree.js +56 -0
- package/build/ts/trees/stateTree.js.map +1 -0
- package/build/ts/trees/types.d.ts +46 -0
- package/build/ts/trees/types.d.ts.map +1 -0
- package/build/ts/trees/types.js +3 -0
- package/build/ts/trees/types.js.map +1 -0
- package/build/ts/user/index.d.ts +5 -0
- package/build/ts/user/index.d.ts.map +1 -0
- package/build/ts/user/index.js +13 -0
- package/build/ts/user/index.js.map +1 -0
- package/build/ts/user/joinPoll.d.ts +8 -0
- package/build/ts/user/joinPoll.d.ts.map +1 -0
- package/build/ts/user/joinPoll.js +84 -0
- package/build/ts/user/joinPoll.js.map +1 -0
- package/build/ts/user/signup.d.ts +20 -0
- package/build/ts/user/signup.d.ts.map +1 -0
- package/build/ts/user/signup.js +79 -0
- package/build/ts/user/signup.js.map +1 -0
- package/build/ts/user/types.d.ts +416 -0
- package/build/ts/user/types.d.ts.map +1 -0
- package/build/ts/user/types.js +3 -0
- package/build/ts/user/types.js.map +1 -0
- package/build/ts/user/utils.d.ts +68 -0
- package/build/ts/user/utils.d.ts.map +1 -0
- package/build/ts/user/utils.js +224 -0
- package/build/ts/user/utils.js.map +1 -0
- package/build/ts/utils/cid.d.ts +23 -0
- package/build/ts/utils/cid.d.ts.map +1 -0
- package/build/ts/utils/cid.js +72 -0
- package/build/ts/utils/cid.js.map +1 -0
- package/build/ts/utils/constants.d.ts +2 -0
- package/build/ts/utils/constants.d.ts.map +1 -0
- package/build/ts/utils/constants.js +5 -0
- package/build/ts/utils/constants.js.map +1 -0
- package/build/ts/utils/contracts.d.ts +15 -0
- package/build/ts/utils/contracts.d.ts.map +1 -0
- package/build/ts/utils/contracts.js +26 -0
- package/build/ts/utils/contracts.js.map +1 -0
- package/build/ts/utils/files.d.ts +9 -0
- package/build/ts/utils/files.d.ts.map +1 -0
- package/build/ts/utils/files.js +20 -0
- package/build/ts/utils/files.js.map +1 -0
- package/build/ts/utils/formatting.d.ts +8 -0
- package/build/ts/utils/formatting.d.ts.map +1 -0
- package/build/ts/utils/formatting.js +11 -0
- package/build/ts/utils/formatting.js.map +1 -0
- package/build/ts/utils/fundWallet.d.ts +7 -0
- package/build/ts/utils/fundWallet.d.ts.map +1 -0
- package/build/ts/utils/fundWallet.js +20 -0
- package/build/ts/utils/fundWallet.js.map +1 -0
- package/build/ts/utils/index.d.ts +12 -0
- package/build/ts/utils/index.d.ts.map +1 -0
- package/build/ts/utils/index.js +28 -0
- package/build/ts/utils/index.js.map +1 -0
- package/build/ts/utils/params.d.ts +7 -0
- package/build/ts/utils/params.d.ts.map +1 -0
- package/build/ts/utils/params.js +19 -0
- package/build/ts/utils/params.js.map +1 -0
- package/build/ts/utils/proofs.d.ts +13 -0
- package/build/ts/utils/proofs.d.ts.map +1 -0
- package/build/ts/utils/proofs.js +41 -0
- package/build/ts/utils/proofs.js.map +1 -0
- package/build/ts/utils/timeTravel.d.ts +7 -0
- package/build/ts/utils/timeTravel.d.ts.map +1 -0
- package/build/ts/utils/timeTravel.js +14 -0
- package/build/ts/utils/timeTravel.js.map +1 -0
- package/build/ts/utils/trees.d.ts +13 -0
- package/build/ts/utils/trees.d.ts.map +1 -0
- package/build/ts/utils/trees.js +30 -0
- package/build/ts/utils/trees.js.map +1 -0
- package/build/ts/utils/types.d.ts +71 -0
- package/build/ts/utils/types.d.ts.map +1 -0
- package/build/ts/utils/types.js +3 -0
- package/build/ts/utils/types.js.map +1 -0
- package/build/ts/utils/utils.d.ts +24 -0
- package/build/ts/utils/utils.d.ts.map +1 -0
- package/build/ts/utils/utils.js +49 -0
- package/build/ts/utils/utils.js.map +1 -0
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts +10 -0
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts.map +1 -0
- package/build/ts/verifyingKeys/checkVerifyingKeys.js +67 -0
- package/build/ts/verifyingKeys/checkVerifyingKeys.js.map +1 -0
- package/build/ts/verifyingKeys/index.d.ts +5 -0
- package/build/ts/verifyingKeys/index.d.ts.map +1 -0
- package/build/ts/verifyingKeys/index.js +13 -0
- package/build/ts/verifyingKeys/index.js.map +1 -0
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts +7 -0
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts.map +1 -0
- package/build/ts/verifyingKeys/setVerifyingKeys.js +85 -0
- package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -0
- package/build/ts/verifyingKeys/types.d.ts +235 -0
- package/build/ts/verifyingKeys/types.d.ts.map +1 -0
- package/build/ts/verifyingKeys/types.js +3 -0
- package/build/ts/verifyingKeys/types.js.map +1 -0
- package/build/ts/verifyingKeys/utils.d.ts +29 -0
- package/build/ts/verifyingKeys/utils.d.ts.map +1 -0
- package/build/ts/verifyingKeys/utils.js +103 -0
- package/build/ts/verifyingKeys/utils.js.map +1 -0
- package/build/ts/vote/generate.d.ts +8 -0
- package/build/ts/vote/generate.d.ts.map +1 -0
- package/build/ts/vote/generate.js +46 -0
- package/build/ts/vote/generate.js.map +1 -0
- package/build/ts/vote/index.d.ts +6 -0
- package/build/ts/vote/index.d.ts.map +1 -0
- package/build/ts/vote/index.js +15 -0
- package/build/ts/vote/index.js.map +1 -0
- package/build/ts/vote/invalidate.d.ts +13 -0
- package/build/ts/vote/invalidate.d.ts.map +1 -0
- package/build/ts/vote/invalidate.js +44 -0
- package/build/ts/vote/invalidate.js.map +1 -0
- package/build/ts/vote/publish.d.ts +14 -0
- package/build/ts/vote/publish.d.ts.map +1 -0
- package/build/ts/vote/publish.js +88 -0
- package/build/ts/vote/publish.js.map +1 -0
- package/build/ts/vote/submit.d.ts +13 -0
- package/build/ts/vote/submit.d.ts.map +1 -0
- package/build/ts/vote/submit.js +36 -0
- package/build/ts/vote/submit.js.map +1 -0
- package/build/ts/vote/types.d.ts +238 -0
- package/build/ts/vote/types.d.ts.map +1 -0
- package/build/ts/vote/types.js +3 -0
- package/build/ts/vote/types.js.map +1 -0
- package/build/ts/vote/utils.d.ts +16 -0
- package/build/ts/vote/utils.d.ts.map +1 -0
- package/build/ts/vote/utils.js +26 -0
- package/build/ts/vote/utils.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +58 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [3.0.0](https://github.com/privacy-scaling-explorations/maci/compare/v2.5.0...v3.0.0) (2025-03-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add invalidate votes function ([#2219](https://github.com/privacy-scaling-explorations/maci/issues/2219)) ([6531fee](https://github.com/privacy-scaling-explorations/maci/commit/6531feef1b2384180736c69a3b7bb307b922d085))
|
|
12
|
+
* add logs output option for debugging and auditing ([d638fb6](https://github.com/privacy-scaling-explorations/maci/commit/d638fb67348ce34c2f93222911b0c29c14a6b9b2))
|
|
13
|
+
* add start and end timestmap for poll ([cf67b53](https://github.com/privacy-scaling-explorations/maci/commit/cf67b539d7d5dfd8b83ba3e0becaa20d0292b410))
|
|
14
|
+
* allow to download artifacts on browser ([58a163f](https://github.com/privacy-scaling-explorations/maci/commit/58a163f82c65d440c05200ae3f00e22790d70a4e))
|
|
15
|
+
* check if a user is registered ([#2278](https://github.com/privacy-scaling-explorations/maci/issues/2278)) ([6c0a2d9](https://github.com/privacy-scaling-explorations/maci/commit/6c0a2d9829639fc2af6e8f2efcb1aa33af5037ce))
|
|
16
|
+
* **contracts:** add anon aadhaar gatekeeper checker ([13f14b0](https://github.com/privacy-scaling-explorations/maci/commit/13f14b07fd5fe8433d46b6fc6bab94216b06c97d))
|
|
17
|
+
* **contracts:** add checker and deployment for proxy gatekeepers ([87f6d3b](https://github.com/privacy-scaling-explorations/maci/commit/87f6d3b7f32bf8dddcbf99b855dbe4b7b6c2a58e))
|
|
18
|
+
* **contracts:** add eas gatekeeper checker ([6e90591](https://github.com/privacy-scaling-explorations/maci/commit/6e90591923f8104c06558a8c8a4a5f26d16e63c1))
|
|
19
|
+
* **contracts:** add hats gatekeeper checker ([8ba97ae](https://github.com/privacy-scaling-explorations/maci/commit/8ba97ae09de1cc738df04a7b868d97c74027de3c))
|
|
20
|
+
* **contracts:** add merkle proof gatekeeper checker ([e386f91](https://github.com/privacy-scaling-explorations/maci/commit/e386f914807a0d82140ae077cdcb866a4f9dc053))
|
|
21
|
+
* **contracts:** add semaphore gatekeeper checker ([b7419c9](https://github.com/privacy-scaling-explorations/maci/commit/b7419c9b53da2ca043696ef25f8902d8c0a736e2))
|
|
22
|
+
* **contracts:** add zupass gatekeeper checker ([d69702b](https://github.com/privacy-scaling-explorations/maci/commit/d69702b7962617aef6b48b7de1c9a2fe4c857676))
|
|
23
|
+
* **contracts:** integrate excubiae for gatekeepers ([fae260b](https://github.com/privacy-scaling-explorations/maci/commit/fae260bbdd4d6b7a8749f61c0310526448a6c030))
|
|
24
|
+
* **sdk:** add relayer functions ([6273ef8](https://github.com/privacy-scaling-explorations/maci/commit/6273ef8c07675aaebe6d1d73d2c1e51de1ccfc56))
|
|
25
|
+
* **sdk:** return processProofs, tallyProofs and tallyData in generateProofs ([#2193](https://github.com/privacy-scaling-explorations/maci/issues/2193)) ([dfbc410](https://github.com/privacy-scaling-explorations/maci/commit/dfbc410d4267fb6e3d327aa3b645792d7380aff7))
|
|
26
|
+
* use excubiae policies instead of gatekeepers ([a2319b1](https://github.com/privacy-scaling-explorations/maci/commit/a2319b19e473e683a301bd79b3ab2b06e83f9452))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* add export without deploy functions ([#2284](https://github.com/privacy-scaling-explorations/maci/issues/2284)) ([2252806](https://github.com/privacy-scaling-explorations/maci/commit/2252806497eb10d0e57f5d081dd446d47ff29b73))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Code Refactoring
|
|
35
|
+
|
|
36
|
+
* **cli:** cleanup signup command ([601269c](https://github.com/privacy-scaling-explorations/maci/commit/601269c8c5c508289e3f95ac6b55603c73d19779))
|
|
37
|
+
* **cli:** move deploy vk registry and testing commands to sdk ([bcd8d12](https://github.com/privacy-scaling-explorations/maci/commit/bcd8d12980067a5d1618fe43c8d3a9b5c5d5be84))
|
|
38
|
+
* **cli:** move key generation commands to sdk ([08634a1](https://github.com/privacy-scaling-explorations/maci/commit/08634a150bc8ca2428069a741a5ebda7a197dc8d))
|
|
39
|
+
* **cli:** move maci state generation to sdk ([f922298](https://github.com/privacy-scaling-explorations/maci/commit/f92229850ad4c6416274dcab64fd981de070a491))
|
|
40
|
+
* **cli:** move proof generation and poll deploy to sdk ([31922b2](https://github.com/privacy-scaling-explorations/maci/commit/31922b2f816ecdd254d761e49b25081f5c9fa9a3))
|
|
41
|
+
* **cli:** move prove onchain to sdk ([452a68a](https://github.com/privacy-scaling-explorations/maci/commit/452a68a452ac33f9186ecf735e8d5df852a5c5e1))
|
|
42
|
+
* **cli:** move publish commands to sdk ([aa16343](https://github.com/privacy-scaling-explorations/maci/commit/aa1634325c2617f3a8a95e3013adc60758b996ae))
|
|
43
|
+
* **cli:** move signups merging to sdk ([36a8d6d](https://github.com/privacy-scaling-explorations/maci/commit/36a8d6de45ae2dc8e9fb49fb2a1092b31216ed66))
|
|
44
|
+
* **cli:** move vk commands to sdk ([1f2a81e](https://github.com/privacy-scaling-explorations/maci/commit/1f2a81e67ccdea1ca6136dd71005cb7f91ae02fb))
|
|
45
|
+
* **cli:** use contract storage for cli ([b417ee7](https://github.com/privacy-scaling-explorations/maci/commit/b417ee7de9c54fb875c363ca38c1c41eb34d8e8e))
|
|
46
|
+
* contract imports and proofs ([#2074](https://github.com/privacy-scaling-explorations/maci/issues/2074)) ([66dfab7](https://github.com/privacy-scaling-explorations/maci/commit/66dfab7e0916f5891f47ae1448b89f7b0fd0ed27))
|
|
47
|
+
* deploy maci command ([3eb6915](https://github.com/privacy-scaling-explorations/maci/commit/3eb691568a01e94cbbdb2f4f806efae002b19328))
|
|
48
|
+
* gen proofs ([7bba1c5](https://github.com/privacy-scaling-explorations/maci/commit/7bba1c5ab0abfb0d518400cefbc00a3cd75dadd2))
|
|
49
|
+
* join poll sdk ([52607a7](https://github.com/privacy-scaling-explorations/maci/commit/52607a7df7c73f1b8371035f19fbd2433beab8b5))
|
|
50
|
+
* make separate testing package ([#2229](https://github.com/privacy-scaling-explorations/maci/issues/2229)) ([bd07a7f](https://github.com/privacy-scaling-explorations/maci/commit/bd07a7f0783b2efe2659bc18255f8f4ed2e3c0d3))
|
|
51
|
+
* poll deploy sdk ([#2189](https://github.com/privacy-scaling-explorations/maci/issues/2189)) ([da1b785](https://github.com/privacy-scaling-explorations/maci/commit/da1b7852cea94663a97ef7ceef1c3e9b8ca3eda8))
|
|
52
|
+
* remove redundant param ([#2161](https://github.com/privacy-scaling-explorations/maci/issues/2161)) ([2cc986f](https://github.com/privacy-scaling-explorations/maci/commit/2cc986fadd91283cd78f3f90bc8825d2aa44e2a5))
|
|
53
|
+
* **sdk:** change sdk package structure ([3255909](https://github.com/privacy-scaling-explorations/maci/commit/3255909f685e613446d2a499f3fb9caa89dc4f24))
|
|
54
|
+
* **sdk:** separate keys functions ([e22cb16](https://github.com/privacy-scaling-explorations/maci/commit/e22cb1657ee46477d6abb649d77bde07ea97bad0))
|
|
55
|
+
* setVerifyingKeys ([8ce195b](https://github.com/privacy-scaling-explorations/maci/commit/8ce195baa5191bce63fd807cd75f3f75e2ad0d76))
|
|
56
|
+
* test suite cleanup ([#2233](https://github.com/privacy-scaling-explorations/maci/issues/2233)) ([#2232](https://github.com/privacy-scaling-explorations/maci/issues/2232)) ([0d42bb0](https://github.com/privacy-scaling-explorations/maci/commit/0d42bb09da9025d0481c45def982d155fda79b76))
|
|
57
|
+
* user sdk ([#2064](https://github.com/privacy-scaling-explorations/maci/issues/2064)) ([aac1ce7](https://github.com/privacy-scaling-explorations/maci/commit/aac1ce7d4db7141a6d57bf9c940751d0886b5d9e))
|
|
58
|
+
* verifying keys sdk ([#2070](https://github.com/privacy-scaling-explorations/maci/issues/2070)) ([44c9e1e](https://github.com/privacy-scaling-explorations/maci/commit/44c9e1e79f4d4c34c95fd46c33e4008be8cf4a07))
|
|
59
|
+
* vote sdk ([#2089](https://github.com/privacy-scaling-explorations/maci/issues/2089)) ([fed0e25](https://github.com/privacy-scaling-explorations/maci/commit/fed0e251bf09e1e34ec0a43ba58d89d3a95aa02c))
|
|
60
|
+
* vote submission ([a66da9e](https://github.com/privacy-scaling-explorations/maci/commit/a66da9e1725f9f458341c5f6f269bca0d2d6aa37))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Miscellaneous
|
|
64
|
+
|
|
65
|
+
* add logger for contract helpers ([a688400](https://github.com/privacy-scaling-explorations/maci/commit/a6884006427f91f46ee2804fc75bd7a51533cdd6))
|
|
66
|
+
* **deps-dev:** bump @types/node from 20.17.19 to 22.13.9 ([aa7c356](https://github.com/privacy-scaling-explorations/maci/commit/aa7c356469592547f3d60c05077268267d7ea186))
|
|
67
|
+
* **deps-dev:** bump @types/node from 22.10.7 to 22.12.0 ([#2073](https://github.com/privacy-scaling-explorations/maci/issues/2073)) ([1dcb28e](https://github.com/privacy-scaling-explorations/maci/commit/1dcb28e33699ee91f9691c1073d4da0293e406c0))
|
|
68
|
+
* **deps-dev:** bump @types/node from 22.12.0 to 22.13.1 ([5f06af0](https://github.com/privacy-scaling-explorations/maci/commit/5f06af0180f522f552519529c07d2bb660fdd586))
|
|
69
|
+
* **deps-dev:** bump @types/node from 22.13.1 to 22.13.4 ([dba94f4](https://github.com/privacy-scaling-explorations/maci/commit/dba94f4fe6d405eaca655dfdc8ca01d57664b99b))
|
|
70
|
+
* **deps-dev:** bump @types/node from 22.13.9 to 22.13.10 ([#2241](https://github.com/privacy-scaling-explorations/maci/issues/2241)) ([3f50bb6](https://github.com/privacy-scaling-explorations/maci/commit/3f50bb65db4cd83b5ebe9d4fb1b7a6d650bb1c51))
|
|
71
|
+
* **deps-dev:** bump mocha from 10.8.2 to 11.1.0 ([f524a07](https://github.com/privacy-scaling-explorations/maci/commit/f524a07f5a3b1e94eaf6f230ecf16476f4c6810d))
|
|
72
|
+
* **deps-dev:** bump ts-jest from 29.2.5 to 29.2.6 ([aaf7978](https://github.com/privacy-scaling-explorations/maci/commit/aaf797861177b92cb1395048e32898367cd65bd5))
|
|
73
|
+
* **deps-dev:** bump typescript from 5.7.3 to 5.8.2 ([e37f1bf](https://github.com/privacy-scaling-explorations/maci/commit/e37f1bffd8193de316e748d0406cfb606455cb46))
|
|
74
|
+
* **deps:** bump @zk-kit/lean-imt from 2.2.2 to 2.2.3 ([a269d5c](https://github.com/privacy-scaling-explorations/maci/commit/a269d5ce4e47145e02a58b30c793672ab43a9c30))
|
|
75
|
+
* **deps:** bump multiformats from 9.9.0 to 13.3.2 ([4a9853f](https://github.com/privacy-scaling-explorations/maci/commit/4a9853f0b72fdd54fb608864620a421a027ee255))
|
|
76
|
+
* fix multiformat version for sdk ([b765391](https://github.com/privacy-scaling-explorations/maci/commit/b765391dc3b3a52a0b20bfe8645ae15998323dfc))
|
|
77
|
+
* move tests over to testing package ([fad40c3](https://github.com/privacy-scaling-explorations/maci/commit/fad40c30323135483244cc6e3c89ffba51d5120b))
|
|
78
|
+
* **relayer:** add checks for onchain publishing ([a25f4bd](https://github.com/privacy-scaling-explorations/maci/commit/a25f4bdd4c106920f429a4dc0deb09fb3275b57e))
|
|
79
|
+
* **relayer:** add more e2e tests ([0cbfc40](https://github.com/privacy-scaling-explorations/maci/commit/0cbfc40b2915924cdc6b6fc7db4392868f6f8845))
|
|
80
|
+
* update the readme ([#2242](https://github.com/privacy-scaling-explorations/maci/issues/2242)) ([ffdceee](https://github.com/privacy-scaling-explorations/maci/commit/ffdceee3074446f81deae5ef4e3df67f98aaada7))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
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
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# maci-sdk
|
|
2
|
+
|
|
3
|
+
[![NPM Package][sdk-npm-badge]][sdk-npm-link]
|
|
4
|
+
[![Actions Status][sdk-actions-badge]][sdk-actions-link]
|
|
5
|
+
|
|
6
|
+
Please refer to the [documentation for the
|
|
7
|
+
SDK](https://maci.pse.dev/docs/developers-references/typescript-code/sdk).
|
|
8
|
+
|
|
9
|
+
[sdk-npm-badge]: https://img.shields.io/npm/v/maci-sdk.svg
|
|
10
|
+
[sdk-actions-badge]: https://github.com/privacy-scaling-explorations/maci/actions/workflows/e2e.yml/badge.svg
|
|
11
|
+
[sdk-npm-link]: https://www.npmjs.com/package/maci-sdk
|
|
12
|
+
[sdk-actions-link]: https://github.com/privacy-scaling-explorations/maci/actions?query=workflow%3ACI
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maci-protocol/sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "MACI's SDK",
|
|
6
|
+
"main": "build/ts/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./build/ts/index.d.ts",
|
|
10
|
+
"default": "./build/ts/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./browser": {
|
|
13
|
+
"types": "./build/ts/browser/index.d.ts",
|
|
14
|
+
"default": "./build/ts/browser/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"maci-sdk": "./build/ts/index.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"build",
|
|
22
|
+
"CHANGELOG.md",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"watch": "tsc --watch",
|
|
30
|
+
"build": "tsc -p tsconfig.build.json",
|
|
31
|
+
"postbuild": "cp package.json ./build && mkdir -p ./zkeys",
|
|
32
|
+
"types": "tsc -p tsconfig.json --noEmit",
|
|
33
|
+
"test": "jest",
|
|
34
|
+
"test:coverage": "pnpm run test --coverage",
|
|
35
|
+
"docs": "typedoc --plugin typedoc-plugin-markdown --options ./typedoc.json"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@zk-kit/lean-imt": "^2.2.3",
|
|
39
|
+
"ethers": "^6.13.4",
|
|
40
|
+
"@maci-protocol/contracts": "^3.0.0",
|
|
41
|
+
"@maci-protocol/core": "^3.0.0",
|
|
42
|
+
"@maci-protocol/crypto": "^3.0.0",
|
|
43
|
+
"@maci-protocol/domainobjs": "^3.0.0",
|
|
44
|
+
"multiformats": "9.9.0",
|
|
45
|
+
"snarkjs": "^0.7.5"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/jest": "^29.5.2",
|
|
49
|
+
"@types/node": "^22.14.0",
|
|
50
|
+
"@types/snarkjs": "^0.7.9",
|
|
51
|
+
"jest": "^29.5.0",
|
|
52
|
+
"mocha": "^11.1.0",
|
|
53
|
+
"nyc": "^17.1.0",
|
|
54
|
+
"ts-jest": "^29.3.0",
|
|
55
|
+
"typescript": "^5.8.3"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "../poll";
|
|
2
|
+
export * from "../proof/download";
|
|
3
|
+
export * from "../proof/types";
|
|
4
|
+
export * from "../tally";
|
|
5
|
+
export * from "../trees";
|
|
6
|
+
export * from "../vote";
|
|
7
|
+
export * from "../maciKeys";
|
|
8
|
+
export { getSignedupUserData, signup, hasUserSignedUp } from "../user/signup";
|
|
9
|
+
export { getJoinedUserData, hasUserJoinedPoll } from "../user/utils";
|
|
10
|
+
export * from "./joinPoll";
|
|
11
|
+
export type { FullProveResult, IDeployParams, IMergeParams, IProveParams, IVerifyingKeyStruct, SnarkProof, IIpfsMessage, } from "@maci-protocol/contracts";
|
|
12
|
+
export * from "@maci-protocol/contracts/typechain-types";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAErE,cAAc,YAAY,CAAC;AAE3B,YAAY,EACV,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,YAAY,GACb,MAAM,0BAA0B,CAAC;AAElC,cAAc,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.hasUserJoinedPoll = exports.getJoinedUserData = exports.hasUserSignedUp = exports.signup = exports.getSignedupUserData = void 0;
|
|
18
|
+
__exportStar(require("../poll"), exports);
|
|
19
|
+
__exportStar(require("../proof/download"), exports);
|
|
20
|
+
__exportStar(require("../proof/types"), exports);
|
|
21
|
+
__exportStar(require("../tally"), exports);
|
|
22
|
+
__exportStar(require("../trees"), exports);
|
|
23
|
+
__exportStar(require("../vote"), exports);
|
|
24
|
+
__exportStar(require("../maciKeys"), exports);
|
|
25
|
+
var signup_1 = require("../user/signup");
|
|
26
|
+
Object.defineProperty(exports, "getSignedupUserData", { enumerable: true, get: function () { return signup_1.getSignedupUserData; } });
|
|
27
|
+
Object.defineProperty(exports, "signup", { enumerable: true, get: function () { return signup_1.signup; } });
|
|
28
|
+
Object.defineProperty(exports, "hasUserSignedUp", { enumerable: true, get: function () { return signup_1.hasUserSignedUp; } });
|
|
29
|
+
var utils_1 = require("../user/utils");
|
|
30
|
+
Object.defineProperty(exports, "getJoinedUserData", { enumerable: true, get: function () { return utils_1.getJoinedUserData; } });
|
|
31
|
+
Object.defineProperty(exports, "hasUserJoinedPoll", { enumerable: true, get: function () { return utils_1.hasUserJoinedPoll; } });
|
|
32
|
+
__exportStar(require("./joinPoll"), exports);
|
|
33
|
+
__exportStar(require("@maci-protocol/contracts/typechain-types"), exports);
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,yCAA8E;AAArE,6GAAA,mBAAmB,OAAA;AAAE,gGAAA,MAAM,OAAA;AAAE,yGAAA,eAAe,OAAA;AACrD,uCAAqE;AAA5D,0GAAA,iBAAiB,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAE7C,6CAA2B;AAY3B,2EAAyD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IJoinPollArgs, IJoinPollData } from "../user/types";
|
|
2
|
+
/**
|
|
3
|
+
* Join Poll user to the Poll contract
|
|
4
|
+
* @param {IJoinPollArgs} args - The arguments for the join poll command
|
|
5
|
+
* @returns {IJoinPollData} The poll state index of the joined user and transaction hash
|
|
6
|
+
*/
|
|
7
|
+
export declare const joinPoll: ({ maciAddress, privateKey, stateFile, pollId, signer, startBlock, endBlock, blocksPerBatch, pollJoiningZkey, pollWasm, sgDataArg, ivcpDataArg, }: IJoinPollArgs) => Promise<IJoinPollData>;
|
|
8
|
+
//# 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,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAYlE;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAU,kJAa5B,aAAa,KAAG,OAAO,CAAC,aAAa,CA4FvC,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
* @param {IJoinPollArgs} args - The arguments for the join poll command
|
|
14
|
+
* @returns {IJoinPollData} The poll state index of the joined user and transaction hash
|
|
15
|
+
*/
|
|
16
|
+
const joinPoll = async ({ maciAddress, privateKey, stateFile, pollId, signer, startBlock, endBlock, blocksPerBatch, pollJoiningZkey, pollWasm, sgDataArg, ivcpDataArg, }) => {
|
|
17
|
+
const validContract = await (0, contracts_1.contractExists)(signer.provider, maciAddress);
|
|
18
|
+
if (!validContract) {
|
|
19
|
+
throw new Error("MACI contract does not exist");
|
|
20
|
+
}
|
|
21
|
+
if (!domainobjs_1.PrivKey.isValidSerializedPrivKey(privateKey)) {
|
|
22
|
+
throw new Error("Invalid MACI private key");
|
|
23
|
+
}
|
|
24
|
+
if (pollId < 0) {
|
|
25
|
+
throw new Error("Invalid poll id");
|
|
26
|
+
}
|
|
27
|
+
const userMaciPrivKey = domainobjs_1.PrivKey.deserialize(privateKey);
|
|
28
|
+
const userMaciPubKey = new domainobjs_1.Keypair(userMaciPrivKey).pubKey;
|
|
29
|
+
const nullifier = (0, crypto_1.poseidon)([BigInt(userMaciPrivKey.asCircuitInputs()), pollId]);
|
|
30
|
+
// check if the user has already joined the poll based on the nullifier
|
|
31
|
+
const hasUserJoinedAlready = await (0, utils_1.hasUserJoinedPoll)({
|
|
32
|
+
maciAddress,
|
|
33
|
+
pollId,
|
|
34
|
+
nullifier,
|
|
35
|
+
signer,
|
|
36
|
+
});
|
|
37
|
+
if (hasUserJoinedAlready) {
|
|
38
|
+
throw new Error("User has already joined");
|
|
39
|
+
}
|
|
40
|
+
const maciContract = typechain_types_1.MACI__factory.connect(maciAddress, signer);
|
|
41
|
+
const pollContracts = await maciContract.getPoll(pollId);
|
|
42
|
+
const pollContract = typechain_types_1.Poll__factory.connect(pollContracts.poll, signer);
|
|
43
|
+
// get the state index from the MACI contract
|
|
44
|
+
const stateIndex = await maciContract.getStateIndex(userMaciPubKey.hash()).catch(() => -1n);
|
|
45
|
+
let circuitInputs;
|
|
46
|
+
if (stateFile) {
|
|
47
|
+
circuitInputs = await (0, utils_1.getPollJoiningCircuitInputsFromStateFile)({
|
|
48
|
+
stateFile,
|
|
49
|
+
pollId,
|
|
50
|
+
stateIndex,
|
|
51
|
+
userMaciPrivKey,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
circuitInputs = await (0, utils_1.getPollJoiningCircuitEvents)({
|
|
56
|
+
maciContract,
|
|
57
|
+
stateIndex,
|
|
58
|
+
pollId,
|
|
59
|
+
userMaciPrivKey,
|
|
60
|
+
signer,
|
|
61
|
+
startBlock,
|
|
62
|
+
endBlock,
|
|
63
|
+
blocksPerBatch,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const currentStateRootIndex = Number.parseInt((await maciContract.numSignUps()).toString(), 10) - 1;
|
|
67
|
+
// generate the proof for this batch
|
|
68
|
+
const { proof } = await (0, utils_2.genProofSnarkjs)({ inputs: circuitInputs, zkeyPath: pollJoiningZkey, wasmPath: pollWasm });
|
|
69
|
+
// submit the message onchain as well as the encryption public key
|
|
70
|
+
const tx = await pollContract.joinPoll(nullifier, userMaciPubKey.asContractParam(), currentStateRootIndex, (0, utils_2.formatProofForVerifierContract)(proof), sgDataArg, ivcpDataArg);
|
|
71
|
+
const receipt = await tx.wait();
|
|
72
|
+
if (receipt?.status !== 1) {
|
|
73
|
+
throw new Error("Transaction failed");
|
|
74
|
+
}
|
|
75
|
+
const [{ args }] = await pollContract.queryFilter(pollContract.filters.PollJoined, receipt.blockNumber, receipt.blockNumber);
|
|
76
|
+
return {
|
|
77
|
+
pollStateIndex: args._pollStateIndex.toString(),
|
|
78
|
+
voiceCredits: args._voiceCreditBalance.toString(),
|
|
79
|
+
nullifier: nullifier.toString(),
|
|
80
|
+
hash: receipt.hash,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
exports.joinPoll = joinPoll;
|
|
84
|
+
//# sourceMappingURL=joinPoll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joinPoll.js","sourceRoot":"","sources":["../../../ts/browser/joinPoll.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Groth16Proof } from "snarkjs";
|
|
2
|
+
import type { IGenProofOptions, 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 genProofSnarkjs: ({ inputs, zkeyPath, wasmPath }: IGenProofOptions) => 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,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE9F;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,GAAI,OAAO,UAAU,GAAG,YAAY,KAAG,MAAM,EAY5D,CAAC;AAE7B;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAU,gCAAgC,gBAAgB,KAAG,OAAO,CAAC,eAAe,CAO/G,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genProofSnarkjs = 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 genProofSnarkjs = 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.genProofSnarkjs = genProofSnarkjs;
|
|
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,eAAe,GAAG,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAoB,EAA4B,EAAE;IAClH,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;AAPW,QAAA,eAAe,mBAO1B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { deployPoll } from "./poll";
|
|
2
|
+
export { deployVkRegistryContract } from "./vkRegistry";
|
|
3
|
+
export { deployMaci } from "./maci";
|
|
4
|
+
export { deployFactoryWithLinkedLibraries } from "./utils";
|
|
5
|
+
export type { IDeployPollArgs, IPollContractsData, IDeployMaciArgs, IMaciContracts, IDeployVkRegistryArgs, } from "./types";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AACpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC;AAE3D,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,qBAAqB,GACtB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deployFactoryWithLinkedLibraries = exports.deployMaci = exports.deployVkRegistryContract = exports.deployPoll = void 0;
|
|
4
|
+
var poll_1 = require("./poll");
|
|
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; } });
|
|
8
|
+
var maci_1 = require("./maci");
|
|
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; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;AACnB,iCAA2D;AAAlD,yHAAA,gCAAgC,OAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IDeployMaciArgs, IMaciContracts } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Deploy the MACI contracts
|
|
4
|
+
* @param args - The arguments for the MACI contracts deployment
|
|
5
|
+
* @returns The deployed MACI contracts
|
|
6
|
+
*/
|
|
7
|
+
export declare const deployMaci: ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, }: IDeployMaciArgs) => Promise<IMaciContracts>;
|
|
8
|
+
//# sourceMappingURL=maci.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deployMaci = void 0;
|
|
4
|
+
const contracts_1 = require("@maci-protocol/contracts");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
/**
|
|
7
|
+
* Deploy the MACI contracts
|
|
8
|
+
* @param args - The arguments for the MACI contracts deployment
|
|
9
|
+
* @returns The deployed MACI contracts
|
|
10
|
+
*/
|
|
11
|
+
const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, }) => {
|
|
12
|
+
const emptyBallotRoots = (0, contracts_1.genEmptyBallotRoots)(stateTreeDepth);
|
|
13
|
+
const { PoseidonT3Contract, PoseidonT4Contract, PoseidonT5Contract, PoseidonT6Contract } = await (0, contracts_1.deployPoseidonContracts)(signer, poseidonAddresses, true);
|
|
14
|
+
const poseidonAddrs = await Promise.all([
|
|
15
|
+
PoseidonT3Contract.getAddress(),
|
|
16
|
+
PoseidonT4Contract.getAddress(),
|
|
17
|
+
PoseidonT5Contract.getAddress(),
|
|
18
|
+
PoseidonT6Contract.getAddress(),
|
|
19
|
+
]).then(([poseidonT3, poseidonT4, poseidonT5, poseidonT6]) => ({
|
|
20
|
+
poseidonT3,
|
|
21
|
+
poseidonT4,
|
|
22
|
+
poseidonT5,
|
|
23
|
+
poseidonT6,
|
|
24
|
+
}));
|
|
25
|
+
const pollFactoryContractAddress = await (0, utils_1.deployFactoryWithLinkedLibraries)({
|
|
26
|
+
address: pollFactoryAddress,
|
|
27
|
+
abi: contracts_1.PollFactory__factory.abi,
|
|
28
|
+
bytecode: contracts_1.PollFactory__factory.linkBytecode({
|
|
29
|
+
"contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonAddrs.poseidonT3,
|
|
30
|
+
"contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonAddrs.poseidonT4,
|
|
31
|
+
"contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonAddrs.poseidonT5,
|
|
32
|
+
"contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonAddrs.poseidonT6,
|
|
33
|
+
}),
|
|
34
|
+
signer,
|
|
35
|
+
});
|
|
36
|
+
const messageProcessorFactoryContractAddress = await (0, utils_1.deployFactoryWithLinkedLibraries)({
|
|
37
|
+
address: messageProcessorFactoryAddress,
|
|
38
|
+
abi: contracts_1.MessageProcessorFactory__factory.abi,
|
|
39
|
+
bytecode: contracts_1.MessageProcessorFactory__factory.linkBytecode({
|
|
40
|
+
"contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonAddrs.poseidonT3,
|
|
41
|
+
"contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonAddrs.poseidonT4,
|
|
42
|
+
"contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonAddrs.poseidonT5,
|
|
43
|
+
"contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonAddrs.poseidonT6,
|
|
44
|
+
}),
|
|
45
|
+
signer,
|
|
46
|
+
});
|
|
47
|
+
const tallyFactoryContractAddress = await (0, utils_1.deployFactoryWithLinkedLibraries)({
|
|
48
|
+
address: tallyFactoryAddress,
|
|
49
|
+
abi: contracts_1.TallyFactory__factory.abi,
|
|
50
|
+
bytecode: contracts_1.TallyFactory__factory.linkBytecode({
|
|
51
|
+
"contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonAddrs.poseidonT3,
|
|
52
|
+
"contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonAddrs.poseidonT4,
|
|
53
|
+
"contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonAddrs.poseidonT5,
|
|
54
|
+
"contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonAddrs.poseidonT6,
|
|
55
|
+
}),
|
|
56
|
+
signer,
|
|
57
|
+
});
|
|
58
|
+
const maciContractAddress = await (0, utils_1.deployFactoryWithLinkedLibraries)({
|
|
59
|
+
abi: contracts_1.MACI__factory.abi,
|
|
60
|
+
bytecode: contracts_1.MACI__factory.linkBytecode({
|
|
61
|
+
"contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonAddrs.poseidonT3,
|
|
62
|
+
"contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonAddrs.poseidonT4,
|
|
63
|
+
"contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonAddrs.poseidonT5,
|
|
64
|
+
"contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonAddrs.poseidonT6,
|
|
65
|
+
}),
|
|
66
|
+
signer,
|
|
67
|
+
args: [
|
|
68
|
+
pollFactoryContractAddress,
|
|
69
|
+
messageProcessorFactoryContractAddress,
|
|
70
|
+
tallyFactoryContractAddress,
|
|
71
|
+
signupPolicyAddress,
|
|
72
|
+
stateTreeDepth,
|
|
73
|
+
emptyBallotRoots,
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
const policy = contracts_1.IBasePolicy__factory.connect(signupPolicyAddress, signer);
|
|
77
|
+
await policy.setTarget(maciContractAddress).then((tx) => tx.wait());
|
|
78
|
+
return {
|
|
79
|
+
maciContractAddress,
|
|
80
|
+
pollFactoryContractAddress,
|
|
81
|
+
messageProcessorFactoryContractAddress,
|
|
82
|
+
tallyFactoryContractAddress,
|
|
83
|
+
poseidonAddresses: poseidonAddrs,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
exports.deployMaci = deployMaci;
|
|
87
|
+
//# sourceMappingURL=maci.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maci.js","sourceRoot":"","sources":["../../../ts/deploy/maci.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IDeployPollArgs, IPollContractsData } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Deploy a poll
|
|
4
|
+
* @param args - The arguments for the deploy poll command
|
|
5
|
+
* @returns The addresses of the deployed contracts
|
|
6
|
+
*/
|
|
7
|
+
export declare const deployPoll: ({ maciAddress, pollStartTimestamp, pollEndTimestamp, intStateTreeDepth, voteOptionTreeDepth, messageBatchSize, stateTreeDepth, coordinatorPubKey, verifierContractAddress, vkRegistryContractAddress, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, freeForAllCheckerFactoryAddress, freeForAllPolicyFactoryAddress, signer, }: IDeployPollArgs) => Promise<IPollContractsData>;
|
|
8
|
+
//# sourceMappingURL=poll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAMnE;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,mYAoB9B,eAAe,KAAG,OAAO,CAAC,kBAAkB,CAqI9C,CAAC"}
|