@maci-protocol/sdk 0.0.0-ci.00107eb
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 +21 -0
- package/README.md +12 -0
- package/build/package.json +65 -0
- package/build/ts/browser/index.d.ts +15 -0
- package/build/ts/browser/index.d.ts.map +1 -0
- package/build/ts/browser/index.js +40 -0
- package/build/ts/browser/index.js.map +1 -0
- package/build/ts/browser/joinPoll.d.ts +10 -0
- package/build/ts/browser/joinPoll.d.ts.map +1 -0
- package/build/ts/browser/joinPoll.js +88 -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 +97 -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 +112 -0
- package/build/ts/deploy/poll.js.map +1 -0
- package/build/ts/deploy/types.d.ts +225 -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/verifyingKeysRegistry.d.ts +7 -0
- package/build/ts/deploy/verifyingKeysRegistry.d.ts.map +1 -0
- package/build/ts/deploy/verifyingKeysRegistry.js +14 -0
- package/build/ts/deploy/verifyingKeysRegistry.js.map +1 -0
- package/build/ts/index.d.ts +17 -0
- package/build/ts/index.d.ts.map +1 -0
- package/build/ts/index.js +89 -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 +21 -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 +28 -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 +53 -0
- package/build/ts/proof/__tests__/download.test.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 +47 -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 +133 -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 +91 -0
- package/build/ts/proof/prove.js.map +1 -0
- package/build/ts/proof/types.d.ts +205 -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/proof/utils.d.ts +10 -0
- package/build/ts/proof/utils.d.ts.map +1 -0
- package/build/ts/proof/utils.js +24 -0
- package/build/ts/proof/utils.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/subgraph/index.d.ts +3 -0
- package/build/ts/subgraph/index.d.ts.map +1 -0
- package/build/ts/subgraph/index.js +18 -0
- package/build/ts/subgraph/index.js.map +1 -0
- package/build/ts/subgraph/maciSubgraph.d.ts +28 -0
- package/build/ts/subgraph/maciSubgraph.d.ts.map +1 -0
- package/build/ts/subgraph/maciSubgraph.js +64 -0
- package/build/ts/subgraph/maciSubgraph.js.map +1 -0
- package/build/ts/subgraph/types.d.ts +20 -0
- package/build/ts/subgraph/types.d.ts.map +1 -0
- package/build/ts/subgraph/types.js +3 -0
- package/build/ts/subgraph/types.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 +43 -0
- package/build/ts/tally/commitments.js.map +1 -0
- package/build/ts/tally/index.d.ts +5 -0
- package/build/ts/tally/index.d.ts.map +1 -0
- package/build/ts/tally/index.js +12 -0
- package/build/ts/tally/index.js.map +1 -0
- package/build/ts/tally/results.d.ts +20 -0
- package/build/ts/tally/results.d.ts.map +1 -0
- package/build/ts/tally/results.js +49 -0
- package/build/ts/tally/results.js.map +1 -0
- package/build/ts/tally/types.d.ts +219 -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 +8 -0
- package/build/ts/trees/index.js.map +1 -0
- package/build/ts/trees/stateTree.d.ts +35 -0
- package/build/ts/trees/stateTree.d.ts.map +1 -0
- package/build/ts/trees/stateTree.js +117 -0
- package/build/ts/trees/stateTree.js.map +1 -0
- package/build/ts/trees/types.d.ts +55 -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 +17 -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 +84 -0
- package/build/ts/user/signup.js.map +1 -0
- package/build/ts/user/types.d.ts +460 -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 +88 -0
- package/build/ts/user/utils.d.ts.map +1 -0
- package/build/ts/user/utils.js +258 -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 +29 -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 +29 -0
- package/build/ts/utils/utils.d.ts.map +1 -0
- package/build/ts/utils/utils.js +61 -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 +66 -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 +108 -0
- package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -0
- package/build/ts/verifyingKeys/types.d.ts +239 -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 +118 -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 +7 -0
- package/build/ts/vote/index.d.ts.map +1 -0
- package/build/ts/vote/index.js +17 -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 +66 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { type LeanIMTMerkleProof } from "@zk-kit/lean-imt";
|
|
2
|
+
import type { MACI, Poll } from "@maci-protocol/contracts/typechain-types";
|
|
3
|
+
import type { PrivateKey, PublicKey } from "@maci-protocol/domainobjs";
|
|
4
|
+
import type { Signer } from "ethers";
|
|
5
|
+
/**
|
|
6
|
+
* Interface for the arguments to the isJoinedUser command
|
|
7
|
+
*/
|
|
8
|
+
export interface IJoinedUserArgs {
|
|
9
|
+
/**
|
|
10
|
+
* The address of the MACI contract
|
|
11
|
+
*/
|
|
12
|
+
maciAddress: string;
|
|
13
|
+
/**
|
|
14
|
+
* The id of the poll
|
|
15
|
+
*/
|
|
16
|
+
pollId: bigint;
|
|
17
|
+
/**
|
|
18
|
+
* Poll public key for the poll
|
|
19
|
+
*/
|
|
20
|
+
pollPublicKey: string;
|
|
21
|
+
/**
|
|
22
|
+
* A signer object
|
|
23
|
+
*/
|
|
24
|
+
signer: Signer;
|
|
25
|
+
/**
|
|
26
|
+
* The start block number
|
|
27
|
+
*/
|
|
28
|
+
startBlock: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Interface for the return data to the isRegisteredUser function
|
|
32
|
+
*/
|
|
33
|
+
export interface IIsRegisteredUser {
|
|
34
|
+
/**
|
|
35
|
+
* Whether the user is registered
|
|
36
|
+
*/
|
|
37
|
+
isRegistered: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The state index of the user
|
|
40
|
+
*/
|
|
41
|
+
stateIndex?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Interface for the return data to the isJoinedUser function
|
|
45
|
+
*/
|
|
46
|
+
export interface IIsJoinedUser {
|
|
47
|
+
/**
|
|
48
|
+
* Whether the user joined the poll
|
|
49
|
+
*/
|
|
50
|
+
isJoined: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The state index of the user
|
|
53
|
+
*/
|
|
54
|
+
pollStateIndex?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The voice credits of the user
|
|
57
|
+
*/
|
|
58
|
+
voiceCredits?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Interface for the arguments to the signup command
|
|
62
|
+
*/
|
|
63
|
+
export interface ISignupArgs {
|
|
64
|
+
/**
|
|
65
|
+
* The public key of the user
|
|
66
|
+
*/
|
|
67
|
+
maciPublicKey: string;
|
|
68
|
+
/**
|
|
69
|
+
* A signer object
|
|
70
|
+
*/
|
|
71
|
+
signer: Signer;
|
|
72
|
+
/**
|
|
73
|
+
* The address of the MACI contract
|
|
74
|
+
*/
|
|
75
|
+
maciAddress: string;
|
|
76
|
+
/**
|
|
77
|
+
* The signup policy data
|
|
78
|
+
*/
|
|
79
|
+
sgData: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Interface for the return data to the signup command
|
|
83
|
+
*/
|
|
84
|
+
export interface ISignupData {
|
|
85
|
+
/**
|
|
86
|
+
* The state index of the user
|
|
87
|
+
*/
|
|
88
|
+
stateIndex: string;
|
|
89
|
+
/**
|
|
90
|
+
* The signup transaction hash
|
|
91
|
+
*/
|
|
92
|
+
transactionHash: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Interface for the arguments to the register check command
|
|
96
|
+
*/
|
|
97
|
+
export interface IRegisteredUserArgs {
|
|
98
|
+
/**
|
|
99
|
+
* A signer object
|
|
100
|
+
*/
|
|
101
|
+
signer: Signer;
|
|
102
|
+
/**
|
|
103
|
+
* The public key of the user
|
|
104
|
+
*/
|
|
105
|
+
maciPublicKey: string;
|
|
106
|
+
/**
|
|
107
|
+
* The address of the MACI contract
|
|
108
|
+
*/
|
|
109
|
+
maciAddress: string;
|
|
110
|
+
/**
|
|
111
|
+
* Start block for event parsing
|
|
112
|
+
*/
|
|
113
|
+
startBlock?: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Interface for the arguments to the parsePollJoinEvents function
|
|
117
|
+
*/
|
|
118
|
+
export interface IParsePollJoinEventsArgs {
|
|
119
|
+
/**
|
|
120
|
+
* The MACI contract
|
|
121
|
+
*/
|
|
122
|
+
pollContract: Poll;
|
|
123
|
+
/**
|
|
124
|
+
* The start block
|
|
125
|
+
*/
|
|
126
|
+
startBlock: number;
|
|
127
|
+
/**
|
|
128
|
+
* The current block
|
|
129
|
+
*/
|
|
130
|
+
currentBlock: number;
|
|
131
|
+
/**
|
|
132
|
+
* The public key
|
|
133
|
+
*/
|
|
134
|
+
pollPublicKey: PublicKey;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Interface for the arguments to the parseSignupEvents function
|
|
138
|
+
*/
|
|
139
|
+
export interface IParseSignupEventsArgs {
|
|
140
|
+
/**
|
|
141
|
+
* The MACI contract
|
|
142
|
+
*/
|
|
143
|
+
maciContract: MACI;
|
|
144
|
+
/**
|
|
145
|
+
* The start block
|
|
146
|
+
*/
|
|
147
|
+
startBlock: number;
|
|
148
|
+
/**
|
|
149
|
+
* The current block
|
|
150
|
+
*/
|
|
151
|
+
currentBlock: number;
|
|
152
|
+
/**
|
|
153
|
+
* The public key
|
|
154
|
+
*/
|
|
155
|
+
publicKey: PublicKey;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* An interface describing the circuit inputs to the PollJoining circuit
|
|
159
|
+
*/
|
|
160
|
+
export interface IPollJoiningCircuitInputs {
|
|
161
|
+
/**
|
|
162
|
+
* The private key
|
|
163
|
+
*/
|
|
164
|
+
privateKey: string;
|
|
165
|
+
/**
|
|
166
|
+
* The poll public key
|
|
167
|
+
*/
|
|
168
|
+
pollPublicKey: string[];
|
|
169
|
+
/**
|
|
170
|
+
* The state leaf
|
|
171
|
+
*/
|
|
172
|
+
stateLeaf: string[];
|
|
173
|
+
/**
|
|
174
|
+
* The siblings for the merkle proof
|
|
175
|
+
*/
|
|
176
|
+
siblings: string[][];
|
|
177
|
+
/**
|
|
178
|
+
* The path indices
|
|
179
|
+
*/
|
|
180
|
+
indices: string[];
|
|
181
|
+
/**
|
|
182
|
+
* The nullifier
|
|
183
|
+
*/
|
|
184
|
+
nullifier: string;
|
|
185
|
+
/**
|
|
186
|
+
* The state root
|
|
187
|
+
*/
|
|
188
|
+
stateRoot: string;
|
|
189
|
+
/**
|
|
190
|
+
* The actual state tree depth
|
|
191
|
+
*/
|
|
192
|
+
actualStateTreeDepth: string;
|
|
193
|
+
/**
|
|
194
|
+
* The poll id
|
|
195
|
+
*/
|
|
196
|
+
pollId: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* An interface describing the circuit inputs to the PollJoined circuit
|
|
200
|
+
*/
|
|
201
|
+
export interface IPollJoinedCircuitInputs {
|
|
202
|
+
/**
|
|
203
|
+
* The private key
|
|
204
|
+
*/
|
|
205
|
+
privateKey: string;
|
|
206
|
+
/**
|
|
207
|
+
* The voice credits balance
|
|
208
|
+
*/
|
|
209
|
+
voiceCreditsBalance: string;
|
|
210
|
+
/**
|
|
211
|
+
* The state leaf
|
|
212
|
+
*/
|
|
213
|
+
stateLeaf: string[];
|
|
214
|
+
/**
|
|
215
|
+
* The path elements
|
|
216
|
+
*/
|
|
217
|
+
pathElements: string[][];
|
|
218
|
+
/**
|
|
219
|
+
* The path indices
|
|
220
|
+
*/
|
|
221
|
+
pathIndices: string[];
|
|
222
|
+
/**
|
|
223
|
+
* The state root
|
|
224
|
+
*/
|
|
225
|
+
stateRoot: string;
|
|
226
|
+
/**
|
|
227
|
+
* The actual state tree depth
|
|
228
|
+
*/
|
|
229
|
+
actualStateTreeDepth: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Interface for the arguments to the joinPoll command
|
|
233
|
+
*/
|
|
234
|
+
export interface IJoinPollArgs {
|
|
235
|
+
/**
|
|
236
|
+
* A signer object
|
|
237
|
+
*/
|
|
238
|
+
signer: Signer;
|
|
239
|
+
/**
|
|
240
|
+
* The private key of the user
|
|
241
|
+
*/
|
|
242
|
+
privateKey: string;
|
|
243
|
+
/**
|
|
244
|
+
* The id of the poll
|
|
245
|
+
*/
|
|
246
|
+
pollId: bigint;
|
|
247
|
+
/**
|
|
248
|
+
* Path to the state file with MACI state. Not available in the browser's SDK
|
|
249
|
+
*/
|
|
250
|
+
stateFile?: string;
|
|
251
|
+
/**
|
|
252
|
+
* The address of the MACI contract
|
|
253
|
+
*/
|
|
254
|
+
maciAddress: string;
|
|
255
|
+
/**
|
|
256
|
+
* The end block number
|
|
257
|
+
*/
|
|
258
|
+
endBlock?: number;
|
|
259
|
+
/**
|
|
260
|
+
* The start block number
|
|
261
|
+
*/
|
|
262
|
+
startBlock?: number;
|
|
263
|
+
/**
|
|
264
|
+
* The number of blocks to fetch per batch
|
|
265
|
+
*/
|
|
266
|
+
blocksPerBatch?: number;
|
|
267
|
+
/**
|
|
268
|
+
* The path to the poll zkey file
|
|
269
|
+
*/
|
|
270
|
+
pollJoiningZkey: string;
|
|
271
|
+
/**
|
|
272
|
+
* Whether to use wasm or rapidsnark
|
|
273
|
+
*/
|
|
274
|
+
useWasm?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* The path to the rapidsnark binary
|
|
277
|
+
*/
|
|
278
|
+
rapidsnark?: string;
|
|
279
|
+
/**
|
|
280
|
+
* The path to the poll witness generator binary
|
|
281
|
+
*/
|
|
282
|
+
pollWitnessGenerator?: string;
|
|
283
|
+
/**
|
|
284
|
+
* The path to the poll joining wasm file
|
|
285
|
+
*/
|
|
286
|
+
pollJoiningWasm?: string;
|
|
287
|
+
/**
|
|
288
|
+
* The signup policy data
|
|
289
|
+
*/
|
|
290
|
+
sgDataArg: string;
|
|
291
|
+
/**
|
|
292
|
+
* The initial voice credit proxy data
|
|
293
|
+
*/
|
|
294
|
+
ivcpDataArg: string;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Interface for the arguments to the joinPoll command for the browser
|
|
298
|
+
*/
|
|
299
|
+
export interface IJoinPollBrowserArgs extends IJoinPollArgs {
|
|
300
|
+
/**
|
|
301
|
+
* Whether to use of not the latest state index
|
|
302
|
+
*/
|
|
303
|
+
useLatestStateIndex?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* The inclusion proof
|
|
306
|
+
*/
|
|
307
|
+
inclusionProof?: LeanIMTMerkleProof;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Interface for the return data to the joinPoll command
|
|
311
|
+
*/
|
|
312
|
+
export interface IJoinPollData {
|
|
313
|
+
/**
|
|
314
|
+
* The poll state index of the joined user
|
|
315
|
+
*/
|
|
316
|
+
pollStateIndex: string;
|
|
317
|
+
/**
|
|
318
|
+
* Voice credits balance
|
|
319
|
+
*/
|
|
320
|
+
voiceCredits: string;
|
|
321
|
+
/**
|
|
322
|
+
* Private key nullifier
|
|
323
|
+
*/
|
|
324
|
+
nullifier: string;
|
|
325
|
+
/**
|
|
326
|
+
* The join poll transaction hash
|
|
327
|
+
*/
|
|
328
|
+
hash: string;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* The arguments to check if a nullifier is on chain
|
|
332
|
+
*/
|
|
333
|
+
export interface IIsNullifierOnChainArgs {
|
|
334
|
+
/**
|
|
335
|
+
* The address of the MACI contract
|
|
336
|
+
*/
|
|
337
|
+
maciAddress: string;
|
|
338
|
+
/**
|
|
339
|
+
* The id of the poll
|
|
340
|
+
*/
|
|
341
|
+
pollId: bigint;
|
|
342
|
+
/**
|
|
343
|
+
* The nullifier to check
|
|
344
|
+
*/
|
|
345
|
+
nullifier: bigint;
|
|
346
|
+
/**
|
|
347
|
+
* The signer to use
|
|
348
|
+
*/
|
|
349
|
+
signer: Signer;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Arguments for IGenerateMaciStateTreeArgs
|
|
353
|
+
*/
|
|
354
|
+
export interface IGenerateMaciStateTreeArgs {
|
|
355
|
+
/**
|
|
356
|
+
* The MACI contract address
|
|
357
|
+
*/
|
|
358
|
+
maciContractAddress: string;
|
|
359
|
+
/**
|
|
360
|
+
* The signer
|
|
361
|
+
*/
|
|
362
|
+
signer: Signer;
|
|
363
|
+
/**
|
|
364
|
+
* The start block
|
|
365
|
+
*/
|
|
366
|
+
startBlock?: number;
|
|
367
|
+
/**
|
|
368
|
+
* The end block
|
|
369
|
+
*/
|
|
370
|
+
endBlock?: number;
|
|
371
|
+
/**
|
|
372
|
+
* The blocks per batch
|
|
373
|
+
*/
|
|
374
|
+
blocksPerBatch?: number;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Arguments for IGenerateMaciStateTreeWithEndKeyArgs
|
|
378
|
+
*/
|
|
379
|
+
export interface IGenerateMaciStateTreeWithEndKeyArgs extends IGenerateMaciStateTreeArgs {
|
|
380
|
+
/**
|
|
381
|
+
* The public key of the user
|
|
382
|
+
*/
|
|
383
|
+
userPublicKey: PublicKey;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Arguments for getPollJoiningCircuitEvents
|
|
387
|
+
*/
|
|
388
|
+
export interface IGetPollJoiningCircuitEventsArgs {
|
|
389
|
+
/**
|
|
390
|
+
* The MACI contract
|
|
391
|
+
*/
|
|
392
|
+
maciContract: MACI;
|
|
393
|
+
/**
|
|
394
|
+
* The state index
|
|
395
|
+
*/
|
|
396
|
+
stateIndex: bigint;
|
|
397
|
+
/**
|
|
398
|
+
* The poll id
|
|
399
|
+
*/
|
|
400
|
+
pollId: bigint;
|
|
401
|
+
/**
|
|
402
|
+
* The user's maci private key
|
|
403
|
+
*/
|
|
404
|
+
userMaciPrivateKey: PrivateKey;
|
|
405
|
+
/**
|
|
406
|
+
* The signer
|
|
407
|
+
*/
|
|
408
|
+
signer: Signer;
|
|
409
|
+
/**
|
|
410
|
+
* The start block
|
|
411
|
+
*/
|
|
412
|
+
startBlock?: number;
|
|
413
|
+
/**
|
|
414
|
+
* The end block
|
|
415
|
+
*/
|
|
416
|
+
endBlock?: number;
|
|
417
|
+
/**
|
|
418
|
+
* The blocks per batch
|
|
419
|
+
*/
|
|
420
|
+
blocksPerBatch?: number;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Arguments for getPollJoiningCircuitInputsFromStateFile
|
|
424
|
+
*/
|
|
425
|
+
export interface IGetPollJoiningCircuitInputsFromStateFileArgs {
|
|
426
|
+
/**
|
|
427
|
+
* The path to the file containing the serialized MACI state
|
|
428
|
+
*/
|
|
429
|
+
stateFile: string;
|
|
430
|
+
/**
|
|
431
|
+
* The poll id
|
|
432
|
+
*/
|
|
433
|
+
pollId: bigint;
|
|
434
|
+
/**
|
|
435
|
+
* The state index
|
|
436
|
+
*/
|
|
437
|
+
stateIndex: bigint;
|
|
438
|
+
/**
|
|
439
|
+
* The user's maci private key
|
|
440
|
+
*/
|
|
441
|
+
userMaciPrivateKey: PrivateKey;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Interface for the arguments for the is signed up command
|
|
445
|
+
*/
|
|
446
|
+
export interface IHasUserSignedUpArgs {
|
|
447
|
+
/**
|
|
448
|
+
* The address of the MACI contract
|
|
449
|
+
*/
|
|
450
|
+
maciAddress: string;
|
|
451
|
+
/**
|
|
452
|
+
* The public key of the user
|
|
453
|
+
*/
|
|
454
|
+
maciPublicKey: string;
|
|
455
|
+
/**
|
|
456
|
+
* The signer to use for the transaction
|
|
457
|
+
*/
|
|
458
|
+
signer: Signer;
|
|
459
|
+
}
|
|
460
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/user/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,eAAe;IA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types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type MACI } from "@maci-protocol/contracts/typechain-types";
|
|
2
|
+
import { type PrivateKey, PublicKey } from "@maci-protocol/domainobjs";
|
|
3
|
+
import type { IGetPollJoiningCircuitEventsArgs, IGetPollJoiningCircuitInputsFromStateFileArgs, IParsePollJoinEventsArgs, IParseSignupEventsArgs, IJoinedUserArgs, IIsNullifierOnChainArgs, IGenerateMaciStateTreeArgs, IGenerateMaciStateTreeWithEndKeyArgs } from "./types";
|
|
4
|
+
import type { IGenerateSignUpTree } from "../trees/types";
|
|
5
|
+
import type { TCircuitInputs } from "../utils/types";
|
|
6
|
+
import type { LeanIMTMerkleProof } from "@zk-kit/lean-imt";
|
|
7
|
+
/**
|
|
8
|
+
* Parse the poll joining events from the Poll contract
|
|
9
|
+
*/
|
|
10
|
+
export declare const parsePollJoinEvents: ({ pollContract, startBlock, currentBlock, pollPublicKey, }: IParsePollJoinEventsArgs) => Promise<{
|
|
11
|
+
pollStateIndex?: string;
|
|
12
|
+
voiceCredits?: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if user is joined to a poll with their public key and get its data
|
|
16
|
+
* @param {IJoinedUserArgs} - The arguments for the join check command
|
|
17
|
+
* @returns user joined or not and poll state index, voice credit balance
|
|
18
|
+
*/
|
|
19
|
+
export declare const getJoinedUserData: ({ maciAddress, pollId, pollPublicKey: serializedPollPublicKey, signer, startBlock, }: IJoinedUserArgs) => Promise<{
|
|
20
|
+
isJoined: boolean;
|
|
21
|
+
pollStateIndex?: string;
|
|
22
|
+
voiceCredits?: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a user joined a poll with a given nullifier
|
|
26
|
+
* @param {IIsNullifierOnChainArgs} args - The arguments for the is nullifier on chain command
|
|
27
|
+
* @returns whether the nullifier is on chain or not
|
|
28
|
+
*/
|
|
29
|
+
export declare const hasUserJoinedPoll: ({ maciAddress, pollId, nullifier, signer, }: IIsNullifierOnChainArgs) => Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Parse the signup events from the MACI contract
|
|
32
|
+
*/
|
|
33
|
+
export declare const parseSignupEvents: ({ maciContract, startBlock, currentBlock, publicKey, }: IParseSignupEventsArgs) => Promise<{
|
|
34
|
+
stateIndex?: string;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Get state index from maci state leaves or from sign up leaves
|
|
38
|
+
* @param publicKeys Public keys from maci state or sign up tree
|
|
39
|
+
* @param userMaciPublicKey Public key of the maci user
|
|
40
|
+
* @param stateIndex State index from the command
|
|
41
|
+
* @returns State index
|
|
42
|
+
*/
|
|
43
|
+
export declare const getStateIndex: (publicKeys: PublicKey[], userMaciPublicKey: PublicKey, stateIndex?: bigint) => bigint | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Create circuit input for pollJoining
|
|
46
|
+
* @param signUpData Sign up tree and state leaves
|
|
47
|
+
* @param stateTreeDepth Maci state tree depth
|
|
48
|
+
* @param maciPrivateKey User's private key for signing up
|
|
49
|
+
* @param pollPrivateKey Poll's private key for the poll joining
|
|
50
|
+
* @param pollPublicKey Poll's public key for the poll joining
|
|
51
|
+
* @param pollId Poll's id
|
|
52
|
+
* @returns stringified circuit inputs
|
|
53
|
+
*/
|
|
54
|
+
export declare const joiningCircuitInputs: (inclusionProof: LeanIMTMerkleProof, stateTreeDepth: bigint, maciPrivateKey: PrivateKey, pollPublicKey: PublicKey, pollId: bigint) => TCircuitInputs;
|
|
55
|
+
/**
|
|
56
|
+
* Get the poll joining circuit inputs from a state file
|
|
57
|
+
* @param stateFile - The path to the state file
|
|
58
|
+
* @returns The poll joining circuit inputs
|
|
59
|
+
*/
|
|
60
|
+
export declare const getPollJoiningCircuitInputsFromStateFile: ({ stateFile, pollId, stateIndex, userMaciPrivateKey, }: IGetPollJoiningCircuitInputsFromStateFileArgs) => Promise<TCircuitInputs>;
|
|
61
|
+
/**
|
|
62
|
+
* Get the block number when the first SignUp event was emitted
|
|
63
|
+
* @param maciContract - The MACI contract to fetch events from
|
|
64
|
+
* @param startBlock - The block number to start searching from (optional)
|
|
65
|
+
* @returns The block number when the first SignUp event was emitted
|
|
66
|
+
*/
|
|
67
|
+
export declare const getFirstSignUpBlockNumber: (maciContract: MACI, startBlock?: number) => Promise<number>;
|
|
68
|
+
/**
|
|
69
|
+
* Generate MACI's state tree from the MACI contract
|
|
70
|
+
* @param {IGenerateMaciStateTreeArgs} args - The arguments for the generate maci state tree command
|
|
71
|
+
* @returns The MACI's state tree
|
|
72
|
+
*/
|
|
73
|
+
export declare const generateMaciStateTree: ({ maciContractAddress, signer, startBlock, endBlock, blocksPerBatch, }: IGenerateMaciStateTreeArgs) => Promise<IGenerateSignUpTree>;
|
|
74
|
+
/**
|
|
75
|
+
* Generate MACI's state tree from the MACI contract with a given end key
|
|
76
|
+
* @param {IGenerateMaciStateTreeWithEndKeyArgs} args - The arguments for the generate maci state tree command
|
|
77
|
+
* @returns The MACI's state tree
|
|
78
|
+
*/
|
|
79
|
+
export declare const generateMaciStateTreeWithEndKey: ({ maciContractAddress, signer, startBlock, endBlock, blocksPerBatch, userPublicKey, }: IGenerateMaciStateTreeWithEndKeyArgs) => Promise<IGenerateSignUpTree>;
|
|
80
|
+
/**
|
|
81
|
+
* Get the poll joining circuit events from a state file
|
|
82
|
+
* @param maciContract - The MACI contract
|
|
83
|
+
* @param startBlock - The start block
|
|
84
|
+
* @param signer - The signer
|
|
85
|
+
* @returns The poll joining circuit events
|
|
86
|
+
*/
|
|
87
|
+
export declare const getPollJoiningCircuitEvents: ({ maciContract, stateIndex, pollId, userMaciPrivateKey, signer, startBlock, endBlock, blocksPerBatch, }: IGetPollJoiningCircuitEventsArgs) => Promise<TCircuitInputs>;
|
|
88
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/user/ut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