@maci-protocol/sdk 0.0.0-ci.2df0337 → 0.0.0-ci.2ff3d96
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 +16 -8
- package/build/ts/browser/index.d.ts +4 -2
- package/build/ts/browser/index.d.ts.map +1 -1
- package/build/ts/browser/index.js +7 -1
- 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 +21 -17
- 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.d.ts +1 -1
- package/build/ts/deploy/maci.d.ts.map +1 -1
- package/build/ts/deploy/maci.js +18 -8
- 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 +8 -10
- package/build/ts/deploy/poll.js.map +1 -1
- package/build/ts/deploy/types.d.ts +24 -15
- 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 +3 -2
- package/build/ts/index.d.ts.map +1 -1
- package/build/ts/index.js +16 -9
- package/build/ts/index.js.map +1 -1
- package/build/ts/maci/state.d.ts +1 -1
- package/build/ts/maci/state.js +8 -8
- package/build/ts/maci/state.js.map +1 -1
- package/build/ts/maci/types.d.ts +1 -1
- package/build/ts/maciKeys/__tests__/keypair.test.js +3 -3
- package/build/ts/maciKeys/__tests__/keypair.test.js.map +1 -1
- package/build/ts/maciKeys/__tests__/publicKeys.test.js +5 -5
- 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 +1 -0
- package/build/ts/maciKeys/keypair.js.map +1 -1
- package/build/ts/maciKeys/publicKeys.js +2 -2
- 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 +9 -9
- package/build/ts/poll/poll.js.map +1 -1
- package/build/ts/poll/types.d.ts +3 -3
- package/build/ts/poll/types.d.ts.map +1 -1
- package/build/ts/proof/__tests__/download.test.js +6 -3
- 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 +28 -22
- package/build/ts/proof/generate.js.map +1 -1
- package/build/ts/proof/prove.d.ts +1 -1
- package/build/ts/proof/prove.d.ts.map +1 -1
- package/build/ts/proof/prove.js +26 -16
- package/build/ts/proof/prove.js.map +1 -1
- package/build/ts/proof/types.d.ts +44 -14
- 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/messages.js +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 +64 -0
- package/build/ts/subgraph/maciSubgraph.js.map +1 -0
- package/build/ts/subgraph/types.d.ts +20 -0
- package/build/ts/subgraph/types.d.ts.map +1 -0
- package/build/ts/subgraph/types.js +3 -0
- package/build/ts/subgraph/types.js.map +1 -0
- package/build/ts/tally/commitments.d.ts.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 -13
- package/build/ts/trees/stateTree.js.map +1 -1
- package/build/ts/trees/types.d.ts +10 -1
- package/build/ts/trees/types.d.ts.map +1 -1
- package/build/ts/user/index.d.ts +2 -2
- package/build/ts/user/index.d.ts.map +1 -1
- package/build/ts/user/index.js +5 -1
- package/build/ts/user/index.js.map +1 -1
- package/build/ts/user/joinPoll.d.ts +1 -1
- package/build/ts/user/joinPoll.d.ts.map +1 -1
- package/build/ts/user/joinPoll.js +11 -11
- package/build/ts/user/joinPoll.js.map +1 -1
- package/build/ts/user/signup.d.ts +1 -1
- package/build/ts/user/signup.d.ts.map +1 -1
- package/build/ts/user/signup.js +22 -17
- package/build/ts/user/signup.js.map +1 -1
- package/build/ts/user/types.d.ts +55 -11
- package/build/ts/user/types.d.ts.map +1 -1
- package/build/ts/user/utils.d.ts +32 -12
- package/build/ts/user/utils.d.ts.map +1 -1
- package/build/ts/user/utils.js +85 -51
- package/build/ts/user/utils.js.map +1 -1
- package/build/ts/utils/index.d.ts +1 -1
- package/build/ts/utils/index.d.ts.map +1 -1
- package/build/ts/utils/index.js +2 -1
- package/build/ts/utils/index.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 +5 -0
- package/build/ts/utils/utils.d.ts.map +1 -1
- package/build/ts/utils/utils.js +13 -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 +70 -47
- package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -1
- package/build/ts/verifyingKeys/types.d.ts +52 -48
- 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.map +1 -1
- package/build/ts/vote/generate.js +3 -3
- 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 +2 -2
- package/build/ts/vote/invalidate.js.map +1 -1
- package/build/ts/vote/publish.js +12 -12
- package/build/ts/vote/publish.js.map +1 -1
- package/build/ts/vote/utils.d.ts +1 -1
- package/build/ts/vote/utils.d.ts.map +1 -1
- package/build/ts/vote/utils.js +3 -3
- package/build/ts/vote/utils.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +22 -14
- 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/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
|
},
|
|
@@ -28,7 +36,7 @@
|
|
|
28
36
|
"scripts": {
|
|
29
37
|
"watch": "tsc --watch",
|
|
30
38
|
"build": "tsc -p tsconfig.build.json",
|
|
31
|
-
"postbuild": "cp package.json ./build
|
|
39
|
+
"postbuild": "cp package.json ./build",
|
|
32
40
|
"types": "tsc -p tsconfig.json --noEmit",
|
|
33
41
|
"test": "jest",
|
|
34
42
|
"test:coverage": "pnpm run test --coverage",
|
|
@@ -36,7 +44,7 @@
|
|
|
36
44
|
},
|
|
37
45
|
"dependencies": {
|
|
38
46
|
"@zk-kit/lean-imt": "^2.2.3",
|
|
39
|
-
"ethers": "^6.
|
|
47
|
+
"ethers": "^6.15.0",
|
|
40
48
|
"@maci-protocol/contracts": "^3.0.0",
|
|
41
49
|
"@maci-protocol/core": "^3.0.0",
|
|
42
50
|
"@maci-protocol/crypto": "^3.0.0",
|
|
@@ -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.2.0",
|
|
50
58
|
"@types/snarkjs": "^0.7.9",
|
|
51
|
-
"jest": "^
|
|
52
|
-
"mocha": "^11.
|
|
59
|
+
"jest": "^30.2.0",
|
|
60
|
+
"mocha": "^11.7.2",
|
|
53
61
|
"nyc": "^17.1.0",
|
|
54
|
-
"ts-jest": "^29.
|
|
55
|
-
"typescript": "^5.
|
|
62
|
+
"ts-jest": "^29.4.1",
|
|
63
|
+
"typescript": "^5.9.2"
|
|
56
64
|
}
|
|
57
65
|
}
|
|
@@ -5,9 +5,11 @@ export * from "../tally";
|
|
|
5
5
|
export * from "../trees";
|
|
6
6
|
export * from "../vote";
|
|
7
7
|
export * from "../maciKeys";
|
|
8
|
+
export * from "../subgraph";
|
|
9
|
+
export * from "../user/types";
|
|
8
10
|
export { getSignedupUserData, signup, hasUserSignedUp } from "../user/signup";
|
|
9
|
-
export { getJoinedUserData, hasUserJoinedPoll } from "../user/utils";
|
|
11
|
+
export { getJoinedUserData, hasUserJoinedPoll, generateMaciStateTree, getPollJoiningCircuitEvents, joiningCircuitInputs, generateMaciStateTreeWithEndKey, } from "../user/utils";
|
|
10
12
|
export * from "./joinPoll";
|
|
11
|
-
export type { FullProveResult, IDeployParams, IMergeParams, IProveParams, IVerifyingKeyStruct, SnarkProof, IIpfsMessage, } from "@maci-protocol/contracts";
|
|
13
|
+
export type { EMode, FullProveResult, IDeployParams, IMergeParams, IProveParams, IVerifyingKeyStruct, SnarkProof, IIpfsMessage, } from "@maci-protocol/contracts";
|
|
12
14
|
export * from "@maci-protocol/contracts/typechain-types";
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/browser/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/browser/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,EACpB,+BAA+B,GAChC,MAAM,eAAe,CAAC;AAEvB,cAAc,YAAY,CAAC;AAE3B,YAAY,EACV,KAAK,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,YAAY,GACb,MAAM,0BAA0B,CAAC;AAElC,cAAc,0CAA0C,CAAC"}
|
|
@@ -14,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.hasUserJoinedPoll = exports.getJoinedUserData = exports.hasUserSignedUp = exports.signup = exports.getSignedupUserData = void 0;
|
|
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,6 +22,8 @@ __exportStar(require("../tally"), exports);
|
|
|
22
22
|
__exportStar(require("../trees"), exports);
|
|
23
23
|
__exportStar(require("../vote"), exports);
|
|
24
24
|
__exportStar(require("../maciKeys"), exports);
|
|
25
|
+
__exportStar(require("../subgraph"), exports);
|
|
26
|
+
__exportStar(require("../user/types"), exports);
|
|
25
27
|
var signup_1 = require("../user/signup");
|
|
26
28
|
Object.defineProperty(exports, "getSignedupUserData", { enumerable: true, get: function () { return signup_1.getSignedupUserData; } });
|
|
27
29
|
Object.defineProperty(exports, "signup", { enumerable: true, get: function () { return signup_1.signup; } });
|
|
@@ -29,6 +31,10 @@ Object.defineProperty(exports, "hasUserSignedUp", { enumerable: true, get: funct
|
|
|
29
31
|
var utils_1 = require("../user/utils");
|
|
30
32
|
Object.defineProperty(exports, "getJoinedUserData", { enumerable: true, get: function () { return utils_1.getJoinedUserData; } });
|
|
31
33
|
Object.defineProperty(exports, "hasUserJoinedPoll", { enumerable: true, get: function () { return utils_1.hasUserJoinedPoll; } });
|
|
34
|
+
Object.defineProperty(exports, "generateMaciStateTree", { enumerable: true, get: function () { return utils_1.generateMaciStateTree; } });
|
|
35
|
+
Object.defineProperty(exports, "getPollJoiningCircuitEvents", { enumerable: true, get: function () { return utils_1.getPollJoiningCircuitEvents; } });
|
|
36
|
+
Object.defineProperty(exports, "joiningCircuitInputs", { enumerable: true, get: function () { return utils_1.joiningCircuitInputs; } });
|
|
37
|
+
Object.defineProperty(exports, "generateMaciStateTreeWithEndKey", { enumerable: true, get: function () { return utils_1.generateMaciStateTreeWithEndKey; } });
|
|
32
38
|
__exportStar(require("./joinPoll"), exports);
|
|
33
39
|
__exportStar(require("@maci-protocol/contracts/typechain-types"), exports);
|
|
34
40
|
//# 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,yCAA8E;AAArE,6GAAA,mBAAmB,OAAA;AAAE,gGAAA,MAAM,OAAA;AAAE,yGAAA,eAAe,OAAA;AACrD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/browser/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,oDAAkC;AAClC,iDAA+B;AAC/B,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,8CAA4B;AAC5B,gDAA8B;AAC9B,yCAA8E;AAArE,6GAAA,mBAAmB,OAAA;AAAE,gGAAA,MAAM,OAAA;AAAE,yGAAA,eAAe,OAAA;AACrD,uCAOuB;AANrB,0GAAA,iBAAiB,OAAA;AACjB,0GAAA,iBAAiB,OAAA;AACjB,8GAAA,qBAAqB,OAAA;AACrB,oHAAA,2BAA2B,OAAA;AAC3B,6GAAA,oBAAoB,OAAA;AACpB,wHAAA,+BAA+B,OAAA;AAGjC,6CAA2B;AAa3B,2EAAyD"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
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, pollJoiningWasm, 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,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"joinPoll.d.ts","sourceRoot":"","sources":["../../../ts/browser/joinPoll.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQzE;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAU,mLAc5B,oBAAoB,KAAG,OAAO,CAAC,aAAa,CA+F9C,CAAC"}
|
|
@@ -10,23 +10,25 @@ const contracts_1 = require("../utils/contracts");
|
|
|
10
10
|
const utils_2 = require("./utils");
|
|
11
11
|
/**
|
|
12
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
|
|
13
15
|
* @param {IJoinPollArgs} args - The arguments for the join poll command
|
|
14
16
|
* @returns {IJoinPollData} The poll state index of the joined user and transaction hash
|
|
15
17
|
*/
|
|
16
|
-
const joinPoll = async ({ maciAddress, privateKey,
|
|
18
|
+
const joinPoll = async ({ maciAddress, privateKey, pollId, signer, startBlock, endBlock, blocksPerBatch, pollJoiningZkey, pollJoiningWasm, sgDataArg, ivcpDataArg, inclusionProof, useLatestStateIndex, }) => {
|
|
17
19
|
const validContract = await (0, contracts_1.contractExists)(signer.provider, maciAddress);
|
|
18
20
|
if (!validContract) {
|
|
19
21
|
throw new Error("MACI contract does not exist");
|
|
20
22
|
}
|
|
21
|
-
if (!domainobjs_1.PrivateKey.
|
|
23
|
+
if (!domainobjs_1.PrivateKey.isValidSerialized(privateKey)) {
|
|
22
24
|
throw new Error("Invalid MACI private key");
|
|
23
25
|
}
|
|
24
26
|
if (pollId < 0) {
|
|
25
27
|
throw new Error("Invalid poll id");
|
|
26
28
|
}
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
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]);
|
|
30
32
|
// check if the user has already joined the poll based on the nullifier
|
|
31
33
|
const hasUserJoinedAlready = await (0, utils_1.hasUserJoinedPoll)({
|
|
32
34
|
maciAddress,
|
|
@@ -41,33 +43,35 @@ const joinPoll = async ({ maciAddress, privateKey, stateFile, pollId, signer, st
|
|
|
41
43
|
const pollContracts = await maciContract.getPoll(pollId);
|
|
42
44
|
const pollContract = typechain_types_1.Poll__factory.connect(pollContracts.poll, signer);
|
|
43
45
|
// get the state index from the MACI contract
|
|
44
|
-
const stateIndex = await maciContract.getStateIndex(
|
|
46
|
+
const stateIndex = await maciContract.getStateIndex(userMaciPublicKey.hash()).catch(() => -1n);
|
|
47
|
+
const stateTreeDepth = await maciContract.stateTreeDepth();
|
|
45
48
|
let circuitInputs;
|
|
46
|
-
if (
|
|
47
|
-
circuitInputs =
|
|
48
|
-
stateFile,
|
|
49
|
-
pollId,
|
|
50
|
-
stateIndex,
|
|
51
|
-
userMaciPrivKey,
|
|
52
|
-
});
|
|
49
|
+
if (inclusionProof) {
|
|
50
|
+
circuitInputs = (0, utils_1.joiningCircuitInputs)(inclusionProof, stateTreeDepth, userMaciPrivateKey, userMaciPublicKey, pollId);
|
|
53
51
|
}
|
|
54
52
|
else {
|
|
55
53
|
circuitInputs = await (0, utils_1.getPollJoiningCircuitEvents)({
|
|
56
54
|
maciContract,
|
|
57
55
|
stateIndex,
|
|
58
56
|
pollId,
|
|
59
|
-
|
|
57
|
+
userMaciPrivateKey,
|
|
60
58
|
signer,
|
|
61
59
|
startBlock,
|
|
62
60
|
endBlock,
|
|
63
61
|
blocksPerBatch,
|
|
64
62
|
});
|
|
65
63
|
}
|
|
66
|
-
const
|
|
64
|
+
const stateRootIndex = useLatestStateIndex
|
|
65
|
+
? Number.parseInt((await maciContract.totalSignups()).toString(), 10) - 1
|
|
66
|
+
: stateIndex;
|
|
67
67
|
// generate the proof for this batch
|
|
68
|
-
const { proof } = await (0, utils_2.
|
|
68
|
+
const { proof } = await (0, utils_2.generateProofSnarkjs)({
|
|
69
|
+
inputs: circuitInputs,
|
|
70
|
+
zkeyPath: pollJoiningZkey,
|
|
71
|
+
wasmPath: pollJoiningWasm,
|
|
72
|
+
});
|
|
69
73
|
// submit the message onchain as well as the encryption public key
|
|
70
|
-
const tx = await pollContract.joinPoll(nullifier,
|
|
74
|
+
const tx = await pollContract.joinPoll(nullifier, userMaciPublicKey.asContractParam(), stateRootIndex, (0, utils_2.formatProofForVerifierContract)(proof), sgDataArg, ivcpDataArg);
|
|
71
75
|
const receipt = await tx.wait();
|
|
72
76
|
if (receipt?.status !== 1) {
|
|
73
77
|
throw new Error("Transaction failed");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joinPoll.js","sourceRoot":"","sources":["../../../ts/browser/joinPoll.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,8EAAsH;AACtH,kDAAiD;AACjD,0DAAgE;
|
|
1
|
+
{"version":3,"file":"joinPoll.js","sourceRoot":"","sources":["../../../ts/browser/joinPoll.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,8EAAsH;AACtH,kDAAiD;AACjD,0DAAgE;AAKhE,yCAAqG;AACrG,kDAAoD;AAEpD,mCAA+E;AAE/E;;;;;;GAMG;AACI,MAAM,QAAQ,GAAG,KAAK,EAAE,EAC7B,WAAW,EACX,UAAU,EACV,MAAM,EACN,MAAM,EACN,UAAU,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,eAAe,EACf,SAAS,EACT,WAAW,EACX,cAAc,EACd,mBAAmB,GACE,EAA0B,EAAE;IACjD,MAAM,aAAa,GAAG,MAAM,IAAA,0BAAc,EAAC,MAAM,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,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,kBAAkB,GAAG,uBAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC9D,MAAM,iBAAiB,GAAG,IAAI,oBAAO,CAAC,kBAAkB,CAAC,CAAC,SAAS,CAAC;IACpE,MAAM,SAAS,GAAG,IAAA,iBAAQ,EAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAEnF,uEAAuE;IACvE,MAAM,oBAAoB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AM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAA,4BAAoB,EAAC;QAC3C,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;KAC1B,CAAC,CAAC;IAEH,kEAAkE;IAClE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,QAAQ,CACpC,SAAS,EACT,iBAAiB,CAAC,eAAe,EAAE,EACnC,cAAc,EACd,IAAA,sCAA8B,EAAC,KAAK,CAAC,EACrC,SAAS,EACT,WAAW,CACZ,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IAEhC,IAAI,OAAO,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,YAAY,CAAC,WAAW,CAC/C,YAAY,CAAC,OAAO,CAAC,UAAU,EAC/B,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,WAAW,CACpB,CAAC;IAEF,OAAO;QACL,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE;QAC/C,YAAY,EAAE,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE;QACjD,SAAS,EAAE,SAAS,CAAC,QAAQ,EAAE;QAC/B,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC;AACJ,CAAC,CAAC;AA7GW,QAAA,QAAQ,YA6GnB"}
|
|
@@ -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,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,
|
|
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,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"}
|
|
@@ -4,5 +4,5 @@ import type { IDeployMaciArgs, IMaciContracts } from "./types";
|
|
|
4
4
|
* @param args - The arguments for the MACI contracts deployment
|
|
5
5
|
* @returns The deployed MACI contracts
|
|
6
6
|
*/
|
|
7
|
-
export declare const deployMaci: ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, }: IDeployMaciArgs) => Promise<IMaciContracts>;
|
|
7
|
+
export declare const deployMaci: ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, verifier, }: IDeployMaciArgs) => Promise<IMaciContracts>;
|
|
8
8
|
//# sourceMappingURL=maci.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maci.d.ts","sourceRoot":"","sources":["../../../ts/deploy/maci.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"maci.d.ts","sourceRoot":"","sources":["../../../ts/deploy/maci.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK/D;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,wJAS9B,eAAe,KAAG,OAAO,CAAC,cAAc,CA8F1C,CAAC"}
|
package/build/ts/deploy/maci.js
CHANGED
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deployMaci = void 0;
|
|
4
4
|
const contracts_1 = require("@maci-protocol/contracts");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
|
+
const verifyingKeysRegistry_1 = require("./verifyingKeysRegistry");
|
|
6
7
|
/**
|
|
7
8
|
* Deploy the MACI contracts
|
|
8
9
|
* @param args - The arguments for the MACI contracts deployment
|
|
9
10
|
* @returns The deployed MACI contracts
|
|
10
11
|
*/
|
|
11
|
-
const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, }) => {
|
|
12
|
-
const emptyBallotRoots = (0, contracts_1.
|
|
12
|
+
const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddress, messageProcessorFactoryAddress, tallyFactoryAddress, signer, poseidonAddresses, verifier, }) => {
|
|
13
|
+
const emptyBallotRoots = (0, contracts_1.generateEmptyBallotRoots)(stateTreeDepth);
|
|
13
14
|
const { PoseidonT3Contract, PoseidonT4Contract, PoseidonT5Contract, PoseidonT6Contract } = await (0, contracts_1.deployPoseidonContracts)(signer, poseidonAddresses, true);
|
|
14
15
|
const poseidonAddrs = await Promise.all([
|
|
15
16
|
PoseidonT3Contract.getAddress(),
|
|
@@ -55,6 +56,9 @@ const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddr
|
|
|
55
56
|
}),
|
|
56
57
|
signer,
|
|
57
58
|
});
|
|
59
|
+
const verifierContract = verifier || (await (0, contracts_1.deployVerifier)(signer, true));
|
|
60
|
+
const verifierContractAddress = await verifierContract.getAddress();
|
|
61
|
+
const verifyingKeysRegistryContractAddress = await (0, verifyingKeysRegistry_1.deployVerifyingKeysRegistryContract)({ signer });
|
|
58
62
|
const maciContractAddress = await (0, utils_1.deployFactoryWithLinkedLibraries)({
|
|
59
63
|
abi: contracts_1.MACI__factory.abi,
|
|
60
64
|
bytecode: contracts_1.MACI__factory.linkBytecode({
|
|
@@ -65,12 +69,16 @@ const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddr
|
|
|
65
69
|
}),
|
|
66
70
|
signer,
|
|
67
71
|
args: [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
{
|
|
73
|
+
pollFactory: pollFactoryContractAddress,
|
|
74
|
+
messageProcessorFactory: messageProcessorFactoryContractAddress,
|
|
75
|
+
tallyFactory: tallyFactoryContractAddress,
|
|
76
|
+
signUpPolicy: signupPolicyAddress,
|
|
77
|
+
verifier: verifierContractAddress,
|
|
78
|
+
verifyingKeysRegistry: verifyingKeysRegistryContractAddress,
|
|
79
|
+
stateTreeDepth,
|
|
80
|
+
emptyBallotRoots,
|
|
81
|
+
},
|
|
74
82
|
],
|
|
75
83
|
});
|
|
76
84
|
const policy = contracts_1.IBasePolicy__factory.connect(signupPolicyAddress, signer);
|
|
@@ -81,6 +89,8 @@ const deployMaci = async ({ stateTreeDepth, signupPolicyAddress, pollFactoryAddr
|
|
|
81
89
|
messageProcessorFactoryContractAddress,
|
|
82
90
|
tallyFactoryContractAddress,
|
|
83
91
|
poseidonAddresses: poseidonAddrs,
|
|
92
|
+
verifierContractAddress,
|
|
93
|
+
verifyingKeysRegistryContractAddress,
|
|
84
94
|
};
|
|
85
95
|
};
|
|
86
96
|
exports.deployMaci = deployMaci;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maci.js","sourceRoot":"","sources":["../../../ts/deploy/maci.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"maci.js","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A4C,EAAE,aAAa,CAAC,UAAU;SACvE,CAAC;QACF,MAAM;QACN,IAAI,EAAE;YACJ;gBACE,WAAW,EAAE,0BAA0B;gBACvC,uBAAuB,EAAE,sCAAsC;gBAC/D,YAAY,EAAE,2BAA2B;gBACzC,YAAY,EAAE,mBAAmB;gBACjC,QAAQ,EAAE,uBAAuB;gBACjC,qBAAqB,EAAE,oCAAoC;gBAC3D,cAAc;gBACd,gBAAgB;aACjB;SACF;KACF,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,gCAAmB,CAAC,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IACxE,MAAM,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAEpE,OAAO;QACL,mBAAmB;QACnB,0BAA0B;QAC1B,sCAAsC;QACtC,2BAA2B;QAC3B,iBAAiB,EAAE,aAAa;QAChC,uBAAuB;QACvB,oCAAoC;KACrC,CAAC;AACJ,CAAC,CAAC;AAvGW,QAAA,UAAU,cAuGrB"}
|
|
@@ -4,5 +4,5 @@ import type { IDeployPollArgs, IPollContractsData } from "./types";
|
|
|
4
4
|
* @param args - The arguments for the deploy poll command
|
|
5
5
|
* @returns The addresses of the deployed contracts
|
|
6
6
|
*/
|
|
7
|
-
export declare const deployPoll: ({ maciAddress, pollStartTimestamp, pollEndTimestamp,
|
|
7
|
+
export declare const deployPoll: ({ maciAddress, pollStartTimestamp, pollEndTimestamp, tallyProcessingStateTreeDepth, voteOptionTreeDepth, messageBatchSize, stateTreeDepth, coordinatorPublicKey, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, freeForAllCheckerFactoryAddress, freeForAllPolicyFactoryAddress, initialVoiceCreditProxyFactoryAddress, signer, }: IDeployPollArgs) => Promise<IPollContractsData>;
|
|
8
8
|
//# sourceMappingURL=poll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../../ts/deploy/poll.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAMnE;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,qYAmB9B,eAAe,KAAG,OAAO,CAAC,kBAAkB,CAkI9C,CAAC"}
|
package/build/ts/deploy/poll.js
CHANGED
|
@@ -11,10 +11,7 @@ const utils_1 = require("./utils");
|
|
|
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 (!vkRegistryContractAddress) {
|
|
16
|
-
throw new Error("Please provide a VkRegistry contract address");
|
|
17
|
-
}
|
|
14
|
+
const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, tallyProcessingStateTreeDepth, voteOptionTreeDepth, messageBatchSize, stateTreeDepth, coordinatorPublicKey, mode, policyContractAddress, initialVoiceCreditProxyContractAddress, relayers, voteOptions, initialVoiceCredits, freeForAllCheckerFactoryAddress, freeForAllPolicyFactoryAddress, initialVoiceCreditProxyFactoryAddress, signer, }) => {
|
|
18
15
|
if (!maciAddress) {
|
|
19
16
|
throw new Error("Please provide a MACI contract address");
|
|
20
17
|
}
|
|
@@ -37,7 +34,10 @@ const deployPoll = async ({ maciAddress, pollStartTimestamp, pollEndTimestamp, i
|
|
|
37
34
|
}
|
|
38
35
|
let initialVoiceCreditProxyAddress = initialVoiceCreditProxyContractAddress;
|
|
39
36
|
if (!initialVoiceCreditProxyAddress) {
|
|
40
|
-
const
|
|
37
|
+
const constantInitialVoiceCreditProxyFactory = initialVoiceCreditProxyFactoryAddress
|
|
38
|
+
? contracts_1.ConstantInitialVoiceCreditProxyFactory__factory.connect(initialVoiceCreditProxyFactoryAddress, signer)
|
|
39
|
+
: await (0, contracts_1.deployConstantInitialVoiceCreditProxyFactory)(signer, true);
|
|
40
|
+
const contract = await (0, contracts_1.deployConstantInitialVoiceCreditProxy)({ amount: initialVoiceCredits ?? utils_1.DEFAULT_INITIAL_VOICE_CREDITS }, constantInitialVoiceCreditProxyFactory, signer);
|
|
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.PublicKey.
|
|
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,14 +72,12 @@ 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
77
|
stateTreeDepth,
|
|
78
78
|
},
|
|
79
79
|
messageBatchSize,
|
|
80
80
|
coordinatorPublicKey: coordinatorPublicKey.asContractParam(),
|
|
81
|
-
verifier: verifierContractAddress,
|
|
82
|
-
vkRegistry: vkRegistryContractAddress,
|
|
83
81
|
mode,
|
|
84
82
|
policy: signupPolicyContractAddress,
|
|
85
83
|
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,wDASkC;AAClC,8CAA6D;AAC7D,0DAAsD;AAItD,kDAAoD;AAEpD,mCAAwD;AAExD;;;;GAIG;AACI,MAAM,UAAU,GAAG,KAAK,EAAE,EAC/B,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,6BAA6B,EAC7B,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,IAAI,EACJ,qBAAqB,EACrB,sCAAsC,EACtC,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,+BAA+B,EAC/B,8BAA8B,EAC9B,qCAAqC,EACrC,MAAM,GACU,EAA+B,EAAE;IACjD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,IAAA,0BAAc,EAAC,MAAM,CAAC,QAAS,EAAE,WAAW,CAAC,CAAC;IAEzE,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,YAAY,GAAG,yBAAW,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE9D,oEAAoE;IAC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,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAED,uBAAuB;IACvB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,WAAW,CAC3C,YAAY,CAAC,OAAO,CAAC,UAAU,EAC/B,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,WAAW,CACpB,CAAC;IACF,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEtC,gDAAgD;IAChD,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IAChC,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,MAAM,mBAAmB,GAAG,aAAa,CAAC,IAAI,CAAC;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;AArJW,QAAA,UAAU,cAqJrB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type Verifier, type TAbi } from "@maci-protocol/contracts";
|
|
2
|
+
import { type EMode } from "@maci-protocol/core";
|
|
3
|
+
import { type 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
|
*/
|
|
@@ -37,14 +38,6 @@ export interface IDeployPollArgs {
|
|
|
37
38
|
* The coordinator public key
|
|
38
39
|
*/
|
|
39
40
|
coordinatorPublicKey: PublicKey;
|
|
40
|
-
/**
|
|
41
|
-
* The address of the verifier contract
|
|
42
|
-
*/
|
|
43
|
-
verifierContractAddress: string;
|
|
44
|
-
/**
|
|
45
|
-
* The address of the VK registry contract
|
|
46
|
-
*/
|
|
47
|
-
vkRegistryContractAddress: string;
|
|
48
41
|
/**
|
|
49
42
|
* The mode of the poll
|
|
50
43
|
*/
|
|
@@ -70,13 +63,17 @@ export interface IDeployPollArgs {
|
|
|
70
63
|
*/
|
|
71
64
|
initialVoiceCredits?: number;
|
|
72
65
|
/**
|
|
73
|
-
* Free for all checker factory address (
|
|
66
|
+
* Free for all checker factory address (use for deployment optimization if there is no signup policy)
|
|
74
67
|
*/
|
|
75
68
|
freeForAllCheckerFactoryAddress?: string;
|
|
76
69
|
/**
|
|
77
|
-
* Free for all policy factory address (
|
|
70
|
+
* Free for all policy factory address (use for deployment optimization if there is no signup policy)
|
|
78
71
|
*/
|
|
79
72
|
freeForAllPolicyFactoryAddress?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The address of the initial voice credit proxy factory contract (use for deployment optimization if there is no initial voice credit proxy)
|
|
75
|
+
*/
|
|
76
|
+
initialVoiceCreditProxyFactoryAddress?: string;
|
|
80
77
|
/**
|
|
81
78
|
* The signer
|
|
82
79
|
*/
|
|
@@ -148,6 +145,10 @@ export interface IDeployMaciArgs {
|
|
|
148
145
|
poseidonT5: string;
|
|
149
146
|
poseidonT6: string;
|
|
150
147
|
}>;
|
|
148
|
+
/**
|
|
149
|
+
* Verifier address if is already deployed
|
|
150
|
+
*/
|
|
151
|
+
verifier?: Verifier;
|
|
151
152
|
}
|
|
152
153
|
/**
|
|
153
154
|
* An interface that represents the deployed MACI contracts.
|
|
@@ -178,11 +179,19 @@ export interface IMaciContracts {
|
|
|
178
179
|
poseidonT5: string;
|
|
179
180
|
poseidonT6: string;
|
|
180
181
|
};
|
|
182
|
+
/**
|
|
183
|
+
* The address of the Verifier contract
|
|
184
|
+
*/
|
|
185
|
+
verifierContractAddress: string;
|
|
186
|
+
/**
|
|
187
|
+
* The address of the VerifyingKeysRegistry contract
|
|
188
|
+
*/
|
|
189
|
+
verifyingKeysRegistryContractAddress: string;
|
|
181
190
|
}
|
|
182
191
|
/**
|
|
183
|
-
* Interface for the arguments to the
|
|
192
|
+
* Interface for the arguments to the DeployVerifyingKeyRegistry command
|
|
184
193
|
*/
|
|
185
|
-
export interface
|
|
194
|
+
export interface IDeployVerifyingKeyRegistryArgs {
|
|
186
195
|
/**
|
|
187
196
|
* A signer object
|
|
188
197
|
*/
|