@maci-protocol/sdk 0.0.0-ci.cac737b → 0.0.0-ci.cd47f67
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 +14 -6
- package/build/ts/browser/index.d.ts +3 -1
- package/build/ts/browser/index.d.ts.map +1 -1
- package/build/ts/browser/index.js +13 -7
- package/build/ts/browser/index.js.map +1 -1
- package/build/ts/browser/joinPoll.d.ts +4 -2
- package/build/ts/browser/joinPoll.d.ts.map +1 -1
- package/build/ts/browser/joinPoll.js +25 -23
- package/build/ts/browser/joinPoll.js.map +1 -1
- package/build/ts/browser/utils.d.ts +2 -2
- package/build/ts/browser/utils.d.ts.map +1 -1
- package/build/ts/browser/utils.js +3 -3
- package/build/ts/browser/utils.js.map +1 -1
- package/build/ts/deploy/index.d.ts +2 -2
- package/build/ts/deploy/index.d.ts.map +1 -1
- package/build/ts/deploy/index.js +3 -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 +13 -12
- package/build/ts/deploy/poll.js.map +1 -1
- package/build/ts/deploy/types.d.ts +13 -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 +12 -7
- 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 +40 -1
- 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 +74 -10
- 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/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 +45 -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 +75 -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 +2 -2
- 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 +5 -5
- package/build/ts/vote/utils.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +20 -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,7 +44,7 @@
|
|
|
36
44
|
},
|
|
37
45
|
"dependencies": {
|
|
38
46
|
"@zk-kit/lean-imt": "^2.2.3",
|
|
39
|
-
"ethers": "^6.
|
|
47
|
+
"ethers": "^6.14.4",
|
|
40
48
|
"@maci-protocol/contracts": "^3.0.0",
|
|
41
49
|
"@maci-protocol/core": "^3.0.0",
|
|
42
50
|
"@maci-protocol/crypto": "^3.0.0",
|
|
@@ -45,13 +53,13 @@
|
|
|
45
53
|
"snarkjs": "^0.7.5"
|
|
46
54
|
},
|
|
47
55
|
"devDependencies": {
|
|
48
|
-
"@types/jest": "^
|
|
49
|
-
"@types/node": "^
|
|
56
|
+
"@types/jest": "^30.0.0",
|
|
57
|
+
"@types/node": "^24.0.7",
|
|
50
58
|
"@types/snarkjs": "^0.7.9",
|
|
51
|
-
"jest": "^
|
|
52
|
-
"mocha": "^11.1
|
|
59
|
+
"jest": "^30.0.3",
|
|
60
|
+
"mocha": "^11.7.1",
|
|
53
61
|
"nyc": "^17.1.0",
|
|
54
|
-
"ts-jest": "^29.
|
|
62
|
+
"ts-jest": "^29.4.0",
|
|
55
63
|
"typescript": "^5.8.3"
|
|
56
64
|
}
|
|
57
65
|
}
|
|
@@ -5,7 +5,9 @@ export * from "../tally";
|
|
|
5
5
|
export * from "../trees";
|
|
6
6
|
export * from "../vote";
|
|
7
7
|
export * from "../maciKeys";
|
|
8
|
-
export
|
|
8
|
+
export * from "../subgraph";
|
|
9
|
+
export { getSignedupUserData, signup, hasUserSignedUp } from "../user/signup";
|
|
10
|
+
export { getJoinedUserData, hasUserJoinedPoll, generateMaciStateTree, getPollJoiningCircuitEvents, joiningCircuitInputs, generateMaciStateTreeWithEndKey, } from "../user/utils";
|
|
9
11
|
export * from "./joinPoll";
|
|
10
12
|
export type { FullProveResult, IDeployParams, IMergeParams, IProveParams, IVerifyingKeyStruct, SnarkProof, IIpfsMessage, } from "@maci-protocol/contracts";
|
|
11
13
|
export * from "@maci-protocol/contracts/typechain-types";
|
|
@@ -1 +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,
|
|
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,7 +14,7 @@ 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.
|
|
17
|
+
exports.generateMaciStateTreeWithEndKey = exports.joiningCircuitInputs = exports.getPollJoiningCircuitEvents = exports.generateMaciStateTree = exports.hasUserJoinedPoll = exports.getJoinedUserData = exports.hasUserSignedUp = exports.signup = exports.getSignedupUserData = void 0;
|
|
18
18
|
__exportStar(require("../poll"), exports);
|
|
19
19
|
__exportStar(require("../proof/download"), exports);
|
|
20
20
|
__exportStar(require("../proof/types"), exports);
|
|
@@ -22,12 +22,18 @@ __exportStar(require("../tally"), exports);
|
|
|
22
22
|
__exportStar(require("../trees"), exports);
|
|
23
23
|
__exportStar(require("../vote"), exports);
|
|
24
24
|
__exportStar(require("../maciKeys"), exports);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Object.defineProperty(exports, "
|
|
28
|
-
Object.defineProperty(exports, "
|
|
29
|
-
Object.defineProperty(exports, "
|
|
30
|
-
|
|
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; } });
|
|
31
37
|
__exportStar(require("./joinPoll"), exports);
|
|
32
38
|
__exportStar(require("@maci-protocol/contracts/typechain-types"), exports);
|
|
33
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IJoinPollBrowserArgs, IJoinPollData } from "../user/types";
|
|
2
2
|
/**
|
|
3
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
|
|
4
6
|
* @param {IJoinPollArgs} args - The arguments for the join poll command
|
|
5
7
|
* @returns {IJoinPollData} The poll state index of the joined user and transaction hash
|
|
6
8
|
*/
|
|
7
|
-
export declare const joinPoll: ({ maciAddress, privateKey,
|
|
9
|
+
export declare const joinPoll: ({ maciAddress, privateKey, pollId, signer, startBlock, endBlock, blocksPerBatch, pollJoiningZkey, pollWasm, sgDataArg, ivcpDataArg, inclusionProof, useLatestStateIndex, }: IJoinPollBrowserArgs) => Promise<IJoinPollData>;
|
|
8
10
|
//# sourceMappingURL=joinPoll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joinPoll.d.ts","sourceRoot":"","sources":["../../../ts/browser/joinPoll.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
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"}
|
|
@@ -5,31 +5,32 @@ exports.joinPoll = void 0;
|
|
|
5
5
|
const typechain_types_1 = require("@maci-protocol/contracts/typechain-types");
|
|
6
6
|
const crypto_1 = require("@maci-protocol/crypto");
|
|
7
7
|
const domainobjs_1 = require("@maci-protocol/domainobjs");
|
|
8
|
-
const user_1 = require("../user");
|
|
9
8
|
const utils_1 = require("../user/utils");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
9
|
+
const contracts_1 = require("../utils/contracts");
|
|
10
|
+
const utils_2 = require("./utils");
|
|
12
11
|
/**
|
|
13
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
|
|
14
15
|
* @param {IJoinPollArgs} args - The arguments for the join poll command
|
|
15
16
|
* @returns {IJoinPollData} The poll state index of the joined user and transaction hash
|
|
16
17
|
*/
|
|
17
|
-
const joinPoll = async ({ maciAddress, privateKey,
|
|
18
|
-
const validContract = await (0,
|
|
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);
|
|
19
20
|
if (!validContract) {
|
|
20
21
|
throw new Error("MACI contract does not exist");
|
|
21
22
|
}
|
|
22
|
-
if (!domainobjs_1.
|
|
23
|
+
if (!domainobjs_1.PrivateKey.isValidSerialized(privateKey)) {
|
|
23
24
|
throw new Error("Invalid MACI private key");
|
|
24
25
|
}
|
|
25
26
|
if (pollId < 0) {
|
|
26
27
|
throw new Error("Invalid poll id");
|
|
27
28
|
}
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const nullifier = (0, crypto_1.poseidon)([BigInt(
|
|
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]);
|
|
31
32
|
// check if the user has already joined the poll based on the nullifier
|
|
32
|
-
const hasUserJoinedAlready = await (0,
|
|
33
|
+
const hasUserJoinedAlready = await (0, utils_1.hasUserJoinedPoll)({
|
|
33
34
|
maciAddress,
|
|
34
35
|
pollId,
|
|
35
36
|
nullifier,
|
|
@@ -42,33 +43,35 @@ const joinPoll = async ({ maciAddress, privateKey, stateFile, pollId, signer, st
|
|
|
42
43
|
const pollContracts = await maciContract.getPoll(pollId);
|
|
43
44
|
const pollContract = typechain_types_1.Poll__factory.connect(pollContracts.poll, signer);
|
|
44
45
|
// get the state index from the MACI contract
|
|
45
|
-
const stateIndex = await maciContract.getStateIndex(
|
|
46
|
+
const stateIndex = await maciContract.getStateIndex(userMaciPublicKey.hash()).catch(() => -1n);
|
|
47
|
+
const stateTreeDepth = await maciContract.stateTreeDepth();
|
|
46
48
|
let circuitInputs;
|
|
47
|
-
if (
|
|
48
|
-
circuitInputs =
|
|
49
|
-
stateFile,
|
|
50
|
-
pollId,
|
|
51
|
-
stateIndex,
|
|
52
|
-
userMaciPrivKey,
|
|
53
|
-
});
|
|
49
|
+
if (inclusionProof) {
|
|
50
|
+
circuitInputs = (0, utils_1.joiningCircuitInputs)(inclusionProof, stateTreeDepth, userMaciPrivateKey, userMaciPublicKey, pollId);
|
|
54
51
|
}
|
|
55
52
|
else {
|
|
56
53
|
circuitInputs = await (0, utils_1.getPollJoiningCircuitEvents)({
|
|
57
54
|
maciContract,
|
|
58
55
|
stateIndex,
|
|
59
56
|
pollId,
|
|
60
|
-
|
|
57
|
+
userMaciPrivateKey,
|
|
61
58
|
signer,
|
|
62
59
|
startBlock,
|
|
63
60
|
endBlock,
|
|
64
61
|
blocksPerBatch,
|
|
65
62
|
});
|
|
66
63
|
}
|
|
67
|
-
const
|
|
64
|
+
const stateRootIndex = useLatestStateIndex
|
|
65
|
+
? Number.parseInt((await maciContract.totalSignups()).toString(), 10) - 1
|
|
66
|
+
: stateIndex;
|
|
68
67
|
// generate the proof for this batch
|
|
69
|
-
const { proof } = await (0,
|
|
68
|
+
const { proof } = await (0, utils_2.generateProofSnarkjs)({
|
|
69
|
+
inputs: circuitInputs,
|
|
70
|
+
zkeyPath: pollJoiningZkey,
|
|
71
|
+
wasmPath: pollWasm,
|
|
72
|
+
});
|
|
70
73
|
// submit the message onchain as well as the encryption public key
|
|
71
|
-
const tx = await pollContract.joinPoll(nullifier,
|
|
74
|
+
const tx = await pollContract.joinPoll(nullifier, userMaciPublicKey.asContractParam(), stateRootIndex, (0, utils_2.formatProofForVerifierContract)(proof), sgDataArg, ivcpDataArg);
|
|
72
75
|
const receipt = await tx.wait();
|
|
73
76
|
if (receipt?.status !== 1) {
|
|
74
77
|
throw new Error("Transaction failed");
|
|
@@ -77,7 +80,6 @@ const joinPoll = async ({ maciAddress, privateKey, stateFile, pollId, signer, st
|
|
|
77
80
|
return {
|
|
78
81
|
pollStateIndex: args._pollStateIndex.toString(),
|
|
79
82
|
voiceCredits: args._voiceCreditBalance.toString(),
|
|
80
|
-
timestamp: args._timestamp.toString(),
|
|
81
83
|
nullifier: nullifier.toString(),
|
|
82
84
|
hash: receipt.hash,
|
|
83
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joinPoll.js","sourceRoot":"","sources":["../../../ts/browser/joinPoll.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,8EAAsH;AACtH,kDAAiD;AACjD,
|
|
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,EA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AE;QAC/B,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC;AACJ,CAAC,CAAC;AA7GW,QAAA,QAAQ,YA6GnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Groth16Proof } from "snarkjs";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IGenerateProofOptions, FullProveResult, SnarkProof } from "@maci-protocol/contracts";
|
|
3
3
|
/**
|
|
4
4
|
* Format a SnarkProof type to an array of strings
|
|
5
5
|
* which can be passed to the Groth16 verifier contract.
|
|
@@ -14,5 +14,5 @@ export declare const formatProofForVerifierContract: (proof: SnarkProof | Groth1
|
|
|
14
14
|
* @param wasmPath - the path to the wasm witness
|
|
15
15
|
* @returns the zk-SNARK proof and public signals
|
|
16
16
|
*/
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const generateProofSnarkjs: ({ inputs, zkeyPath, wasmPath, }: IGenerateProofOptions) => Promise<FullProveResult>;
|
|
18
18
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.generateProofSnarkjs = exports.formatProofForVerifierContract = void 0;
|
|
4
4
|
const snarkjs_1 = require("snarkjs");
|
|
5
5
|
/**
|
|
6
6
|
* Format a SnarkProof type to an array of strings
|
|
@@ -26,12 +26,12 @@ exports.formatProofForVerifierContract = formatProofForVerifierContract;
|
|
|
26
26
|
* @param wasmPath - the path to the wasm witness
|
|
27
27
|
* @returns the zk-SNARK proof and public signals
|
|
28
28
|
*/
|
|
29
|
-
const
|
|
29
|
+
const generateProofSnarkjs = async ({ inputs, zkeyPath, wasmPath, }) => {
|
|
30
30
|
if (!wasmPath) {
|
|
31
31
|
throw new Error("wasmPath must be specified");
|
|
32
32
|
}
|
|
33
33
|
const { proof, publicSignals } = await snarkjs_1.groth16.fullProve(inputs, wasmPath, zkeyPath);
|
|
34
34
|
return { proof, publicSignals };
|
|
35
35
|
};
|
|
36
|
-
exports.
|
|
36
|
+
exports.generateProofSnarkjs = generateProofSnarkjs;
|
|
37
37
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +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,C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AC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAClC,CAAC,CAAC;AAXW,QAAA,oBAAoB,wBAW/B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { deployPoll } from "./poll";
|
|
2
|
-
export {
|
|
2
|
+
export { deployVerifyingKeysRegistryContract } from "./verifyingKeysRegistry";
|
|
3
3
|
export { deployMaci } from "./maci";
|
|
4
4
|
export { deployFactoryWithLinkedLibraries } from "./utils";
|
|
5
|
-
export type { IDeployPollArgs, IPollContractsData, IDeployMaciArgs, IMaciContracts,
|
|
5
|
+
export type { IDeployPollArgs, IPollContractsData, IDeployMaciArgs, IMaciContracts, IDeployVerifyingKeyRegistryArgs, } from "./types";
|
|
6
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,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deployFactoryWithLinkedLibraries = 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
10
|
var utils_1 = require("./utils");
|
|
@@ -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/deploy/maci.ts"],"names":[],"mappings":";;;AAAA,wDAQkC;AAIlC,mCAA2D;AAE3D;;;;GAIG;AACI,MAAM,UAAU,GAAG,KAAK,EAAE,EAC/B,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,8BAA8B,EAC9B,mBAAmB,EACnB,MAAM,EACN,iBAAiB,GACD,EAA2B,EAAE;IAC7C,MAAM,gBAAgB,GAAG,IAAA
|
|
1
|
+
{"version":3,"file":"maci.js","sourceRoot":"","sources":["../../../ts/deploy/maci.ts"],"names":[],"mappings":";;;AAAA,wDAQkC;AAIlC,mCAA2D;AAE3D;;;;GAIG;AACI,MAAM,UAAU,GAAG,KAAK,EAAE,EAC/B,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,8BAA8B,EAC9B,mBAAmB,EACnB,MAAM,EACN,iBAAiB,GACD,EAA2B,EAAE;IAC7C,MAAM,gBAAgB,GAAG,IAAA,oCAAwB,EAAC,cAAc,CAAC,CAAC;IAElE,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,GACtF,MAAM,IAAA,mCAAuB,EAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;IAEjE,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACtC,kBAAkB,CAAC,UAAU,EAAE;QAC/B,kBAAkB,CAAC,UAAU,EAAE;QAC/B,kBAAkB,CAAC,UAAU,EAAE;QAC/B,kBAAkB,CAAC,UAAU,EAAE;KACh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F,MAAM;KACP,CAAC,CAAC;IAEH,MAAM,mBAAmB,GAAG,MAAM,IAAA,wCAAgC,EAAC;QACjE,GAAG,EAAE,yBAAW,CAAC,GAAG;QACpB,QAAQ,EAAE,yBAAW,CAAC,YAAY,CAAC;YACjC,4CAA4C,EAAE,aAAa,CAAC,UAAU;YACtE,4CAA4C,EAAE,aAAa,CAAC,UAAU;YACtE,4CAA4C,EAAE,aAAa,CAAC,UAAU;YACtE,4CAA4C,EAAE,aAAa,CAAC,UAAU;SACvE,CAAC;QACF,MAAM;QACN,IAAI,EAAE;YACJ,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":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAMnE;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,
|
|
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
|
}
|
|
@@ -37,7 +37,7 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
|
|
|
37
37
|
}
|
|
38
38
|
let initialVoiceCreditProxyAddress = initialVoiceCreditProxyContractAddress;
|
|
39
39
|
if (!initialVoiceCreditProxyAddress) {
|
|
40
|
-
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);
|
|
41
41
|
initialVoiceCreditProxyAddress = await contract.getAddress();
|
|
42
42
|
}
|
|
43
43
|
// required arg -> poll duration
|
|
@@ -48,7 +48,7 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
|
|
|
48
48
|
throw new Error("End date cannot be before start date");
|
|
49
49
|
}
|
|
50
50
|
// required arg -> int state tree depth
|
|
51
|
-
if (
|
|
51
|
+
if (tallyProcessingStateTreeDepth <= 0) {
|
|
52
52
|
throw new Error("Int state tree depth cannot be <= 0");
|
|
53
53
|
}
|
|
54
54
|
// required arg -> message tree depth
|
|
@@ -64,7 +64,7 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
|
|
|
64
64
|
throw new Error("Vote options cannot be greater than the number of leaves in the vote option tree");
|
|
65
65
|
}
|
|
66
66
|
// we check that the coordinator's public key is valid
|
|
67
|
-
if (!domainobjs_1.
|
|
67
|
+
if (!domainobjs_1.PublicKey.isValidSerialized(coordinatorPublicKey.serialize())) {
|
|
68
68
|
throw new Error("Invalid MACI public key");
|
|
69
69
|
}
|
|
70
70
|
const receipt = await maciContract
|
|
@@ -72,13 +72,14 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
|
|
|
72
72
|
startDate: pollStartTimestamp,
|
|
73
73
|
endDate: pollEndTimestamp,
|
|
74
74
|
treeDepths: {
|
|
75
|
-
|
|
75
|
+
tallyProcessingStateTreeDepth,
|
|
76
76
|
voteOptionTreeDepth,
|
|
77
|
+
stateTreeDepth,
|
|
77
78
|
},
|
|
78
79
|
messageBatchSize,
|
|
79
|
-
|
|
80
|
+
coordinatorPublicKey: coordinatorPublicKey.asContractParam(),
|
|
80
81
|
verifier: verifierContractAddress,
|
|
81
|
-
|
|
82
|
+
verifyingKeysRegistry: verifyingKeysRegistryContractAddress,
|
|
82
83
|
mode,
|
|
83
84
|
policy: signupPolicyContractAddress,
|
|
84
85
|
initialVoiceCreditProxy: initialVoiceCreditProxyAddress,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll.js","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":";;;AAAA,wDAOkC;AAClC,8CAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"poll.js","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":";;;AAAA,wDAOkC;AAClC,8CAA6D;AAC7D,0DAAsD;AAItD,kDAAoD;AAEpD,mCAAwD;AAExD;;;;GAIG;AACI,MAAM,UAAU,GAAG,KAAK,EAAE,EAC/B,WAAW,EACX,kBA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AG,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
|
*/
|
|
@@ -176,9 +181,9 @@ export interface IMaciContracts {
|
|
|
176
181
|
};
|
|
177
182
|
}
|
|
178
183
|
/**
|
|
179
|
-
* Interface for the arguments to the
|
|
184
|
+
* Interface for the arguments to the DeployVerifyingKeyRegistry command
|
|
180
185
|
*/
|
|
181
|
-
export interface
|
|
186
|
+
export interface IDeployVerifyingKeyRegistryArgs {
|
|
182
187
|
/**
|
|
183
188
|
* A signer object
|
|
184
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,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,6BAA6B,EAAE,MAAM,CAAC;IAEtC;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,cAA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B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC1B,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,0BAA0B,EAAE,MAAM,CAAC;IAEnC;;OAEG;IACH,sCAAsC,EAAE,MAAM,CAAC;IAE/C;;OAEG;IACH,2BAA2B,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,iBAAiB,EAAE;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,GAAG,EAAE,IAAI,CAAC;IAEV;;OAEG;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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IDeployVerifyingKeyRegistryArgs } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Deploy the verifyingKeysRegistry contract
|
|
4
|
+
* @param args deploy VerifyingKeysRegistry arguments
|
|
5
|
+
*/
|
|
6
|
+
export declare const deployVerifyingKeysRegistryContract: ({ signer, }: IDeployVerifyingKeyRegistryArgs) => Promise<string>;
|
|
7
|
+
//# sourceMappingURL=verifyingKeysRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyingKeysRegistry.d.ts","sourceRoot":"","sources":["../../../ts/deploy/verifyingKeysRegistry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,mCAAmC,GAAU,aAEvD,+BAA+B,KAAG,OAAO,CAAC,MAAM,CAIlD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deployVerifyingKeysRegistryContract = void 0;
|
|
4
|
+
const contracts_1 = require("@maci-protocol/contracts");
|
|
5
|
+
/**
|
|
6
|
+
* Deploy the verifyingKeysRegistry contract
|
|
7
|
+
* @param args deploy VerifyingKeysRegistry arguments
|
|
8
|
+
*/
|
|
9
|
+
const deployVerifyingKeysRegistryContract = async ({ signer, }) => {
|
|
10
|
+
const verifyingKeysRegistry = await (0, contracts_1.deployVerifyingKeysRegistry)(signer, true);
|
|
11
|
+
return verifyingKeysRegistry.getAddress();
|
|
12
|
+
};
|
|
13
|
+
exports.deployVerifyingKeysRegistryContract = deployVerifyingKeysRegistryContract;
|
|
14
|
+
//# sourceMappingURL=verifyingKeysRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyingKeysRegistry.js","sourceRoot":"","sources":["../../../ts/deploy/verifyingKeysRegistry.ts"],"names":[],"mappings":";;;AAAA,wDAAuE;AAIvE;;;GAGG;AACI,MAAM,mCAAmC,GAAG,KAAK,EAAE,EACxD,MAAM,GAC0B,EAAmB,EAAE;IACrD,MAAM,qBAAqB,GAAG,MAAM,IAAA,uCAA2B,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAE9E,OAAO,qBAAqB,CAAC,UAAU,EAAE,CAAC;AAC5C,CAAC,CAAC;AANW,QAAA,mCAAmC,uCAM9C"}
|