@maci-protocol/sdk 0.0.0-ci.ec84efe → 0.0.0-ci.efbbb42
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/LICENSE +1 -2
- package/build/package.json +15 -6
- package/build/ts/browser/index.d.ts +6 -7
- package/build/ts/browser/index.d.ts.map +1 -1
- package/build/ts/browser/index.js +16 -20
- package/build/ts/browser/index.js.map +1 -1
- 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 +3 -2
- package/build/ts/deploy/index.d.ts.map +1 -1
- package/build/ts/deploy/index.js +5 -3
- package/build/ts/deploy/index.js.map +1 -1
- package/build/ts/deploy/maci.js +1 -1
- package/build/ts/deploy/maci.js.map +1 -1
- package/build/ts/deploy/poll.d.ts +1 -1
- package/build/ts/deploy/poll.d.ts.map +1 -1
- package/build/ts/deploy/poll.js +20 -13
- package/build/ts/deploy/poll.js.map +1 -1
- package/build/ts/deploy/types.d.ts +21 -8
- package/build/ts/deploy/types.d.ts.map +1 -1
- package/build/ts/deploy/utils.js +1 -1
- package/build/ts/deploy/utils.js.map +1 -1
- 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 +2 -1
- package/build/ts/index.d.ts.map +1 -1
- package/build/ts/index.js +26 -8
- package/build/ts/index.js.map +1 -1
- package/build/ts/maci/policy.d.ts +13 -1
- package/build/ts/maci/policy.d.ts.map +1 -1
- package/build/ts/maci/policy.js +41 -2
- package/build/ts/maci/policy.js.map +1 -1
- package/build/ts/maci/state.d.ts +1 -1
- package/build/ts/maci/state.js +11 -11
- package/build/ts/maci/state.js.map +1 -1
- package/build/ts/maci/types.d.ts +34 -2
- package/build/ts/maci/types.d.ts.map +1 -1
- package/build/ts/maci/types.js +2 -0
- package/build/ts/maci/types.js.map +1 -1
- package/build/ts/maciKeys/__tests__/keypair.test.js +7 -7
- package/build/ts/maciKeys/__tests__/keypair.test.js.map +1 -1
- package/build/ts/maciKeys/__tests__/publicKeys.test.js +7 -7
- package/build/ts/maciKeys/__tests__/publicKeys.test.js.map +1 -1
- package/build/ts/maciKeys/keypair.d.ts.map +1 -1
- package/build/ts/maciKeys/keypair.js +4 -3
- package/build/ts/maciKeys/keypair.js.map +1 -1
- package/build/ts/maciKeys/publicKeys.d.ts +2 -2
- package/build/ts/maciKeys/publicKeys.d.ts.map +1 -1
- package/build/ts/maciKeys/publicKeys.js +6 -6
- package/build/ts/maciKeys/publicKeys.js.map +1 -1
- package/build/ts/maciKeys/types.d.ts +5 -0
- package/build/ts/maciKeys/types.d.ts.map +1 -1
- package/build/ts/poll/poll.d.ts.map +1 -1
- package/build/ts/poll/poll.js +8 -8
- package/build/ts/poll/poll.js.map +1 -1
- package/build/ts/poll/types.d.ts +6 -7
- package/build/ts/poll/types.d.ts.map +1 -1
- package/build/ts/poll/utils.js +3 -3
- package/build/ts/poll/utils.js.map +1 -1
- package/build/ts/proof/__tests__/download.test.js +7 -4
- package/build/ts/proof/__tests__/download.test.js.map +1 -1
- package/build/ts/proof/download.d.ts +3 -3
- package/build/ts/proof/download.d.ts.map +1 -1
- package/build/ts/proof/download.js +5 -7
- package/build/ts/proof/download.js.map +1 -1
- package/build/ts/proof/generate.d.ts +2 -2
- package/build/ts/proof/generate.d.ts.map +1 -1
- package/build/ts/proof/generate.js +31 -25
- package/build/ts/proof/generate.js.map +1 -1
- package/build/ts/proof/prove.js +16 -16
- package/build/ts/proof/prove.js.map +1 -1
- package/build/ts/proof/types.d.ts +41 -15
- package/build/ts/proof/types.d.ts.map +1 -1
- 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.js +1 -1
- package/build/ts/relayer/__tests__/messages.test.js.map +1 -1
- package/build/ts/relayer/__tests__/utils.test.js +3 -3
- package/build/ts/relayer/__tests__/utils.test.js.map +1 -1
- package/build/ts/relayer/messages.js +1 -1
- package/build/ts/relayer/utils.js +4 -4
- package/build/ts/relayer/utils.js.map +1 -1
- 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 +62 -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.map +1 -1
- package/build/ts/tally/commitments.js +8 -7
- package/build/ts/tally/commitments.js.map +1 -1
- package/build/ts/tally/index.d.ts +2 -1
- package/build/ts/tally/index.d.ts.map +1 -1
- package/build/ts/tally/index.js +5 -1
- package/build/ts/tally/index.js.map +1 -1
- 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 +55 -15
- package/build/ts/tally/types.d.ts.map +1 -1
- package/build/ts/tally/utils.d.ts +3 -3
- package/build/ts/tally/utils.d.ts.map +1 -1
- package/build/ts/tally/utils.js +10 -10
- package/build/ts/tally/utils.js.map +1 -1
- package/build/ts/tally/verification.d.ts +1 -1
- package/build/ts/tally/verification.d.ts.map +1 -1
- package/build/ts/tally/verification.js +10 -10
- package/build/ts/tally/verification.js.map +1 -1
- package/build/ts/trees/index.d.ts +2 -2
- package/build/ts/trees/index.d.ts.map +1 -1
- package/build/ts/trees/index.js +3 -1
- package/build/ts/trees/index.js.map +1 -1
- package/build/ts/trees/stateTree.d.ts +23 -1
- package/build/ts/trees/stateTree.d.ts.map +1 -1
- package/build/ts/trees/stateTree.js +76 -12
- package/build/ts/trees/stateTree.js.map +1 -1
- package/build/ts/trees/types.d.ts +11 -2
- package/build/ts/trees/types.d.ts.map +1 -1
- package/build/ts/user/index.d.ts +4 -2
- package/build/ts/user/index.d.ts.map +1 -1
- package/build/ts/user/index.js +14 -8
- package/build/ts/user/index.js.map +1 -1
- 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 +63 -27
- package/build/ts/user/types.d.ts.map +1 -1
- package/build/ts/user/utils.d.ts +42 -14
- package/build/ts/user/utils.d.ts.map +1 -1
- package/build/ts/user/utils.js +121 -49
- package/build/ts/user/utils.js.map +1 -1
- package/build/ts/utils/params.d.ts +1 -1
- package/build/ts/utils/params.d.ts.map +1 -1
- package/build/ts/utils/params.js +3 -3
- package/build/ts/utils/params.js.map +1 -1
- package/build/ts/utils/proofs.d.ts +2 -2
- package/build/ts/utils/proofs.d.ts.map +1 -1
- package/build/ts/utils/proofs.js +4 -4
- package/build/ts/utils/proofs.js.map +1 -1
- package/build/ts/utils/types.d.ts +2 -2
- package/build/ts/utils/types.d.ts.map +1 -1
- package/build/ts/utils/utils.d.ts +8 -0
- package/build/ts/utils/utils.d.ts.map +1 -1
- package/build/ts/utils/utils.js +14 -1
- package/build/ts/utils/utils.js.map +1 -1
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts +1 -1
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts.map +1 -1
- package/build/ts/verifyingKeys/checkVerifyingKeys.js +18 -19
- package/build/ts/verifyingKeys/checkVerifyingKeys.js.map +1 -1
- package/build/ts/verifyingKeys/index.d.ts +2 -2
- package/build/ts/verifyingKeys/index.d.ts.map +1 -1
- package/build/ts/verifyingKeys/index.js +5 -5
- package/build/ts/verifyingKeys/index.js.map +1 -1
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts +1 -1
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts.map +1 -1
- package/build/ts/verifyingKeys/setVerifyingKeys.js +46 -35
- package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -1
- package/build/ts/verifyingKeys/types.d.ts +54 -46
- package/build/ts/verifyingKeys/types.d.ts.map +1 -1
- package/build/ts/verifyingKeys/utils.d.ts +10 -10
- package/build/ts/verifyingKeys/utils.d.ts.map +1 -1
- package/build/ts/verifyingKeys/utils.js +76 -60
- package/build/ts/verifyingKeys/utils.js.map +1 -1
- package/build/ts/vote/generate.d.ts +1 -1
- package/build/ts/vote/generate.d.ts.map +1 -1
- package/build/ts/vote/generate.js +4 -4
- package/build/ts/vote/generate.js.map +1 -1
- package/build/ts/vote/index.d.ts +2 -1
- package/build/ts/vote/index.d.ts.map +1 -1
- package/build/ts/vote/index.js +4 -2
- package/build/ts/vote/index.js.map +1 -1
- package/build/ts/vote/invalidate.js +4 -4
- package/build/ts/vote/invalidate.js.map +1 -1
- package/build/ts/vote/publish.d.ts +1 -1
- package/build/ts/vote/publish.d.ts.map +1 -1
- package/build/ts/vote/publish.js +19 -19
- package/build/ts/vote/publish.js.map +1 -1
- package/build/ts/vote/submit.js +5 -5
- package/build/ts/vote/submit.js.map +1 -1
- package/build/ts/vote/types.d.ts +6 -6
- package/build/ts/vote/types.d.ts.map +1 -1
- package/build/ts/vote/utils.d.ts +2 -2
- package/build/ts/vote/utils.d.ts.map +1 -1
- package/build/ts/vote/utils.js +7 -7
- package/build/ts/vote/utils.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +21 -12
- package/build/ts/deploy/vkRegistry.d.ts +0 -7
- package/build/ts/deploy/vkRegistry.d.ts.map +0 -1
- package/build/ts/deploy/vkRegistry.js +0 -14
- package/build/ts/deploy/vkRegistry.js.map +0 -1
- package/build/ts/proof/constants.d.ts +0 -17
- package/build/ts/proof/constants.d.ts.map +0 -1
- package/build/ts/proof/constants.js +0 -20
- package/build/ts/proof/constants.js.map +0 -1
- package/build/ts/user/user.d.ts +0 -42
- package/build/ts/user/user.d.ts.map +0 -1
- package/build/ts/user/user.js +0 -192
- 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)
|
|
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
|
package/build/package.json
CHANGED
|
@@ -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
|
},
|
|
@@ -36,21 +44,22 @@
|
|
|
36
44
|
},
|
|
37
45
|
"dependencies": {
|
|
38
46
|
"@zk-kit/lean-imt": "^2.2.3",
|
|
39
|
-
"ethers": "^6.
|
|
47
|
+
"ethers": "^6.14.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
56
|
"@types/jest": "^29.5.2",
|
|
48
|
-
"@types/node": "^22.
|
|
57
|
+
"@types/node": "^22.15.17",
|
|
49
58
|
"@types/snarkjs": "^0.7.9",
|
|
50
59
|
"jest": "^29.5.0",
|
|
51
|
-
"mocha": "^11.
|
|
60
|
+
"mocha": "^11.4.0",
|
|
52
61
|
"nyc": "^17.1.0",
|
|
53
|
-
"ts-jest": "^29.3.
|
|
54
|
-
"typescript": "^5.8.
|
|
62
|
+
"ts-jest": "^29.3.2",
|
|
63
|
+
"typescript": "^5.8.3"
|
|
55
64
|
}
|
|
56
65
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
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
|
|
8
|
+
export * from "../subgraph";
|
|
9
|
+
export { getSignedupUserData, signup, hasUserSignedUp } from "../user/signup";
|
|
10
|
+
export { getJoinedUserData, hasUserJoinedPoll, generateMaciStateTree, getPollJoiningCircuitEvents, joiningCircuitInputs, generateMaciStateTreeWithEndKey, } from "../user/utils";
|
|
11
|
+
export * from "./joinPoll";
|
|
13
12
|
export type { FullProveResult, IDeployParams, IMergeParams, IProveParams, IVerifyingKeyStruct, SnarkProof, IIpfsMessage, } from "@maci-protocol/contracts";
|
|
14
13
|
export * from "@maci-protocol/contracts/typechain-types";
|
|
15
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/browser/index.ts"],"names":[],"mappings":"AAAA,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,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,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,YAAY,GACb,MAAM,0BAA0B,CAAC;AAElC,cAAc,0CAA0C,CAAC"}
|
|
@@ -14,30 +14,26 @@ 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.
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
Object.defineProperty(exports, "
|
|
32
|
-
Object.defineProperty(exports, "
|
|
33
|
-
Object.defineProperty(exports, "
|
|
34
|
-
|
|
35
|
-
Object.defineProperty(exports, "
|
|
36
|
-
Object.defineProperty(exports, "
|
|
37
|
-
Object.defineProperty(exports, "
|
|
38
|
-
Object.defineProperty(exports, "
|
|
39
|
-
Object.defineProperty(exports, "
|
|
40
|
-
Object.defineProperty(exports, "
|
|
41
|
-
|
|
25
|
+
__exportStar(require("../subgraph"), exports);
|
|
26
|
+
var signup_1 = require("../user/signup");
|
|
27
|
+
Object.defineProperty(exports, "getSignedupUserData", { enumerable: true, get: function () { return signup_1.getSignedupUserData; } });
|
|
28
|
+
Object.defineProperty(exports, "signup", { enumerable: true, get: function () { return signup_1.signup; } });
|
|
29
|
+
Object.defineProperty(exports, "hasUserSignedUp", { enumerable: true, get: function () { return signup_1.hasUserSignedUp; } });
|
|
30
|
+
var utils_1 = require("../user/utils");
|
|
31
|
+
Object.defineProperty(exports, "getJoinedUserData", { enumerable: true, get: function () { return utils_1.getJoinedUserData; } });
|
|
32
|
+
Object.defineProperty(exports, "hasUserJoinedPoll", { enumerable: true, get: function () { return utils_1.hasUserJoinedPoll; } });
|
|
33
|
+
Object.defineProperty(exports, "generateMaciStateTree", { enumerable: true, get: function () { return utils_1.generateMaciStateTree; } });
|
|
34
|
+
Object.defineProperty(exports, "getPollJoiningCircuitEvents", { enumerable: true, get: function () { return utils_1.getPollJoiningCircuitEvents; } });
|
|
35
|
+
Object.defineProperty(exports, "joiningCircuitInputs", { enumerable: true, get: function () { return utils_1.joiningCircuitInputs; } });
|
|
36
|
+
Object.defineProperty(exports, "generateMaciStateTreeWithEndKey", { enumerable: true, get: function () { return utils_1.generateMaciStateTreeWithEndKey; } });
|
|
37
|
+
__exportStar(require("./joinPoll"), exports);
|
|
42
38
|
__exportStar(require("@maci-protocol/contracts/typechain-types"), exports);
|
|
43
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/browser/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,
|
|
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,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;AAY3B,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, pollWasm, 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,4KAc5B,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, pollWasm, 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: pollWasm,
|
|
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,QAAQ,EACR,SAAS,EACT,WAAW,EACX,cAAc,EACd,mBAAmB,GACE,EAA0B,EAAE;IACjD,MAAM,aAAa,GAAG,MAAM,IAAA,0BAAc,EAAC,MAAM,CAAC,QAAS,EAAE,WAAW,CAAC,CAAC;IAE1E,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,CAAC,uBAAU,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iBAA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nB,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 {
|
|
2
|
+
export { deployVerifyingKeysRegistryContract } from "./verifyingKeysRegistry";
|
|
3
3
|
export { deployMaci } from "./maci";
|
|
4
|
-
export
|
|
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,
|
|
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"}
|
package/build/ts/deploy/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deployMaci = exports.
|
|
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
|
|
7
|
-
Object.defineProperty(exports, "
|
|
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,
|
|
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"}
|
package/build/ts/deploy/maci.js
CHANGED
|
@@ -9,7 +9,7 @@ const utils_1 = require("./utils");
|
|
|
9
9
|
* @returns The deployed MACI contracts
|
|
10
10
|
*/
|
|
11
11
|
const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, }) => {
|
|
12
|
-
const emptyBallotRoots = (0, contracts_1.
|
|
12
|
+
const emptyBallotRoots = (0, contracts_1.generateEmptyBallotRoots)(stateTreeDepth);
|
|
13
13
|
const { PoseidonT3Contract, PoseidonT4Contract, PoseidonT5Contract, PoseidonT6Contract } = await (0, contracts_1.deployPoseidonContracts)(signer, poseidonAddresses, true);
|
|
14
14
|
const poseidonAddrs = await Promise.all([
|
|
15
15
|
PoseidonT3Contract.getAddress(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maci.js","sourceRoot":"","sources":["../../../ts/de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A4C,EAAE,aAAa,CAAC,UAAU;SACvE,CAAC;QACF,MAAM;QACN,IAAI,EAAE;YACJ,0BAA0B;YAC1B,sCAAsC;YACtC,2BAA2B;YAC3B,mBAAmB;YACnB,cAAc;YACd,gBAAgB;SACjB;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;KACjC,CAAC;AACJ,CAAC,CAAC;AA3FW,QAAA,UAAU,cA2FrB"}
|
|
@@ -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,
|
|
7
|
+
export declare const deployPoll: ({ maciAddress, pollStartTimestamp, pollEndTimestamp, tallyProcessingStateTreeDepth, voteOptionTreeDepth, messageBatchSize, stateTreeDepth, coordinatorPublicKey, verifierContractAddress, verifyingKeysRegistryContractAddress, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, freeForAllCheckerFactoryAddress, freeForAllPolicyFactoryAddress, 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":"
|
|
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,6ZAoB9B,eAAe,KAAG,OAAO,CAAC,kBAAkB,CAqI9C,CAAC"}
|
package/build/ts/deploy/poll.js
CHANGED
|
@@ -4,21 +4,21 @@ 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
|
|
8
|
-
const
|
|
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,
|
|
15
|
-
if (!
|
|
16
|
-
throw new Error("Please provide a
|
|
14
|
+
const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, tallyProcessingStateTreeDepth, voteOptionTreeDepth, messageBatchSize, stateTreeDepth, coordinatorPublicKey, verifierContractAddress, verifyingKeysRegistryContractAddress, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, freeForAllCheckerFactoryAddress, freeForAllPolicyFactoryAddress, signer, }) => {
|
|
15
|
+
if (!verifyingKeysRegistryContractAddress) {
|
|
16
|
+
throw new Error("Please provide a VerifyingKeysRegistry contract address");
|
|
17
17
|
}
|
|
18
18
|
if (!maciAddress) {
|
|
19
19
|
throw new Error("Please provide a MACI contract address");
|
|
20
20
|
}
|
|
21
|
-
const isMaciExists = await (0,
|
|
21
|
+
const isMaciExists = await (0, contracts_2.contractExists)(signer.provider, maciAddress);
|
|
22
22
|
if (!isMaciExists) {
|
|
23
23
|
throw new Error("MACI contract does not exist");
|
|
24
24
|
}
|
|
@@ -26,12 +26,18 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
|
|
|
26
26
|
// check if we have a signupPolicy already deployed or passed as arg
|
|
27
27
|
let signupPolicyContractAddress = policyContractAddress;
|
|
28
28
|
if (!signupPolicyContractAddress) {
|
|
29
|
-
const
|
|
29
|
+
const checkerFactory = freeForAllCheckerFactoryAddress
|
|
30
|
+
? contracts_1.FreeForAllCheckerFactory__factory.connect(freeForAllCheckerFactoryAddress, signer)
|
|
31
|
+
: undefined;
|
|
32
|
+
const policyFactory = freeForAllPolicyFactoryAddress
|
|
33
|
+
? contracts_1.FreeForAllPolicyFactory__factory.connect(freeForAllPolicyFactoryAddress, signer)
|
|
34
|
+
: undefined;
|
|
35
|
+
const [contract] = await (0, contracts_1.deployFreeForAllSignUpPolicy)({ checker: checkerFactory, policy: policyFactory }, signer, true);
|
|
30
36
|
signupPolicyContractAddress = await contract.getAddress();
|
|
31
37
|
}
|
|
32
38
|
let initialVoiceCreditProxyAddress = initialVoiceCreditProxyContractAddress;
|
|
33
39
|
if (!initialVoiceCreditProxyAddress) {
|
|
34
|
-
const [contract] = await (0, contracts_1.deployConstantInitialVoiceCreditProxy)({ amount: initialVoiceCredits ??
|
|
40
|
+
const [contract] = await (0, contracts_1.deployConstantInitialVoiceCreditProxy)({ amount: initialVoiceCredits ?? utils_1.DEFAULT_INITIAL_VOICE_CREDITS }, signer, undefined, true);
|
|
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 (
|
|
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.
|
|
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,14 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
|
|
|
66
72
|
startDate: pollStartTimestamp,
|
|
67
73
|
endDate: pollEndTimestamp,
|
|
68
74
|
treeDepths: {
|
|
69
|
-
|
|
75
|
+
tallyProcessingStateTreeDepth,
|
|
70
76
|
voteOptionTreeDepth,
|
|
77
|
+
stateTreeDepth,
|
|
71
78
|
},
|
|
72
79
|
messageBatchSize,
|
|
73
|
-
|
|
80
|
+
coordinatorPublicKey: coordinatorPublicKey.asContractParam(),
|
|
74
81
|
verifier: verifierContractAddress,
|
|
75
|
-
|
|
82
|
+
verifyingKeysRegistry: verifyingKeysRegistryContractAddress,
|
|
76
83
|
mode,
|
|
77
84
|
policy: signupPolicyContractAddress,
|
|
78
85
|
initialVoiceCreditProxy: initialVoiceCreditProxyAddress,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll.js","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"poll.js","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":";;;AAAA,wDAOkC;AAClC,8CAA6D;AAC7D,0DAAsD;AAItD,kDAAoD;AAEpD,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AC;IAC/C,MAAM,+BAA+B,GAAG,aAAa,CAAC,gBAAgB,CAAC;IACvE,MAAM,oBAAoB,GAAG,aAAa,CAAC,KAAK,CAAC;IAEjD,MAAM,cAAc,GAAG,gCAAmB,CAAC,OAAO,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;IACxF,MAAM,cAAc,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAE5E,OAAO;QACL,MAAM;QACN,mBAAmB;QACnB,+BAA+B;QAC/B,oBAAoB;QACpB,qBAAqB,EAAE,2BAA2B;QAClD,sCAAsC,EAAE,8BAA8B;KACvE,CAAC;AACJ,CAAC,CAAC;AAzJW,QAAA,UAAU,cAyJrB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { TAbi } from "@maci-protocol/contracts";
|
|
2
|
+
import { EMode } from "@maci-protocol/core";
|
|
3
|
+
import { PublicKey } from "@maci-protocol/domainobjs";
|
|
3
4
|
import type { Signer } from "ethers";
|
|
4
5
|
/**
|
|
5
6
|
* The arguments for the deploy poll command
|
|
@@ -20,7 +21,7 @@ export interface IDeployPollArgs {
|
|
|
20
21
|
/**
|
|
21
22
|
* The depth of the integer state tree
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
+
tallyProcessingStateTreeDepth: number;
|
|
24
25
|
/**
|
|
25
26
|
* The depth of the vote option tree
|
|
26
27
|
*/
|
|
@@ -29,18 +30,22 @@ export interface IDeployPollArgs {
|
|
|
29
30
|
* The batch size of the messages
|
|
30
31
|
*/
|
|
31
32
|
messageBatchSize: number;
|
|
33
|
+
/**
|
|
34
|
+
* The poll state tree depth
|
|
35
|
+
*/
|
|
36
|
+
stateTreeDepth: number;
|
|
32
37
|
/**
|
|
33
38
|
* The coordinator public key
|
|
34
39
|
*/
|
|
35
|
-
|
|
40
|
+
coordinatorPublicKey: PublicKey;
|
|
36
41
|
/**
|
|
37
42
|
* The address of the verifier contract
|
|
38
43
|
*/
|
|
39
44
|
verifierContractAddress: string;
|
|
40
45
|
/**
|
|
41
|
-
* The address of the
|
|
46
|
+
* The address of the verifying keys registry contract
|
|
42
47
|
*/
|
|
43
|
-
|
|
48
|
+
verifyingKeysRegistryContractAddress: string;
|
|
44
49
|
/**
|
|
45
50
|
* The mode of the poll
|
|
46
51
|
*/
|
|
@@ -65,6 +70,14 @@ export interface IDeployPollArgs {
|
|
|
65
70
|
* The initial voice credits to be minted
|
|
66
71
|
*/
|
|
67
72
|
initialVoiceCredits?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Free for all checker factory address (using for deployment optimization if there is no signup policy)
|
|
75
|
+
*/
|
|
76
|
+
freeForAllCheckerFactoryAddress?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Free for all policy factory address (using for deployment optimization if there is no signup policy)
|
|
79
|
+
*/
|
|
80
|
+
freeForAllPolicyFactoryAddress?: string;
|
|
68
81
|
/**
|
|
69
82
|
* The signer
|
|
70
83
|
*/
|
|
@@ -168,9 +181,9 @@ export interface IMaciContracts {
|
|
|
168
181
|
};
|
|
169
182
|
}
|
|
170
183
|
/**
|
|
171
|
-
* Interface for the arguments to the
|
|
184
|
+
* Interface for the arguments to the DeployVerifyingKeyRegistry command
|
|
172
185
|
*/
|
|
173
|
-
export interface
|
|
186
|
+
export interface IDeployVerifyingKeyRegistryArgs {
|
|
174
187
|
/**
|
|
175
188
|
* A signer object
|
|
176
189
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/deploy/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/deploy/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,E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AEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/build/ts/deploy/utils.js
CHANGED
|
@@ -15,7 +15,7 @@ const deployFactoryWithLinkedLibraries = async ({ abi, bytecode, signer, args, a
|
|
|
15
15
|
return address;
|
|
16
16
|
}
|
|
17
17
|
const contractFactory = await (0, contracts_1.createContractFactory)(abi, bytecode, signer);
|
|
18
|
-
const contractFactoryContract = await (0, contracts_1.deployContractWithLinkedLibraries)(contractFactory, ...(args ?? []));
|
|
18
|
+
const contractFactoryContract = await (0, contracts_1.deployContractWithLinkedLibraries)(contractFactory, signer, ...(args ?? []));
|
|
19
19
|
return contractFactoryContract.getAddress();
|
|
20
20
|
};
|
|
21
21
|
exports.deployFactoryWithLinkedLibraries = deployFactoryWithLinkedLibraries;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/deploy/utils.ts"],"names":[],"mappings":";;;AAAA,wDAAoG;AAIvF,QAAA,6BAA6B,GAAG,GAAG,CAAC;AAEjD;;;;;;GAMG;AACI,MAAM,gCAAgC,GAAG,KAAK,EAAE,EACrD,GAAG,EACH,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,OAAO,GACY,EAAmB,EAAE;IACxC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,IAAA,iCAAqB,EAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE3E,MAAM,uBAAuB,GAAG,MAAM,IAAA,6CAAiC,EAAC,eAAe,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/deploy/utils.ts"],"names":[],"mappings":";;;AAAA,wDAAoG;AAIvF,QAAA,6BAA6B,GAAG,GAAG,CAAC;AAEjD;;;;;;GAMG;AACI,MAAM,gCAAgC,GAAG,KAAK,EAAE,EACrD,GAAG,EACH,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,OAAO,GACY,EAAmB,EAAE;IACxC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,IAAA,iCAAqB,EAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE3E,MAAM,uBAAuB,GAAG,MAAM,IAAA,6CAAiC,EAAC,eAAe,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IAClH,OAAO,uBAAuB,CAAC,UAAU,EAAE,CAAC;AAC9C,CAAC,CAAC;AAfW,QAAA,gCAAgC,oCAe3C"}
|