@maci-protocol/sdk 0.0.0-ci.fd7cff6 → 0.0.0-ci.ffabe48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -2
- package/build/package.json +15 -6
- package/build/ts/browser/index.d.ts +6 -7
- package/build/ts/browser/index.d.ts.map +1 -1
- package/build/ts/browser/index.js +16 -20
- package/build/ts/browser/index.js.map +1 -1
- package/build/ts/browser/joinPoll.d.ts +10 -0
- package/build/ts/browser/joinPoll.d.ts.map +1 -0
- package/build/ts/browser/joinPoll.js +88 -0
- package/build/ts/browser/joinPoll.js.map +1 -0
- package/build/ts/browser/utils.d.ts +18 -0
- package/build/ts/browser/utils.d.ts.map +1 -0
- package/build/ts/browser/utils.js +37 -0
- package/build/ts/browser/utils.js.map +1 -0
- package/build/ts/deploy/index.d.ts +3 -2
- package/build/ts/deploy/index.d.ts.map +1 -1
- package/build/ts/deploy/index.js +5 -3
- package/build/ts/deploy/index.js.map +1 -1
- package/build/ts/deploy/maci.js +1 -1
- package/build/ts/deploy/maci.js.map +1 -1
- package/build/ts/deploy/poll.d.ts +1 -1
- package/build/ts/deploy/poll.d.ts.map +1 -1
- package/build/ts/deploy/poll.js +20 -13
- package/build/ts/deploy/poll.js.map +1 -1
- package/build/ts/deploy/types.d.ts +21 -8
- package/build/ts/deploy/types.d.ts.map +1 -1
- package/build/ts/deploy/utils.js +1 -1
- package/build/ts/deploy/utils.js.map +1 -1
- package/build/ts/deploy/verifyingKeysRegistry.d.ts +7 -0
- package/build/ts/deploy/verifyingKeysRegistry.d.ts.map +1 -0
- package/build/ts/deploy/verifyingKeysRegistry.js +14 -0
- package/build/ts/deploy/verifyingKeysRegistry.js.map +1 -0
- package/build/ts/index.d.ts +2 -1
- package/build/ts/index.d.ts.map +1 -1
- package/build/ts/index.js +26 -8
- package/build/ts/index.js.map +1 -1
- package/build/ts/maci/policy.d.ts +13 -1
- package/build/ts/maci/policy.d.ts.map +1 -1
- package/build/ts/maci/policy.js +41 -2
- package/build/ts/maci/policy.js.map +1 -1
- package/build/ts/maci/state.d.ts +1 -1
- package/build/ts/maci/state.js +11 -11
- package/build/ts/maci/state.js.map +1 -1
- package/build/ts/maci/types.d.ts +34 -2
- package/build/ts/maci/types.d.ts.map +1 -1
- package/build/ts/maci/types.js +2 -0
- package/build/ts/maci/types.js.map +1 -1
- package/build/ts/maciKeys/__tests__/keypair.test.js +7 -7
- package/build/ts/maciKeys/__tests__/keypair.test.js.map +1 -1
- package/build/ts/maciKeys/__tests__/publicKeys.test.js +7 -7
- package/build/ts/maciKeys/__tests__/publicKeys.test.js.map +1 -1
- package/build/ts/maciKeys/keypair.js +3 -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/poll/poll.js +7 -7
- 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 +8 -8
- package/build/ts/proof/generate.js.map +1 -1
- package/build/ts/proof/prove.js +14 -14
- package/build/ts/proof/prove.js.map +1 -1
- package/build/ts/proof/types.d.ts +31 -5
- 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 +4 -1
- package/build/ts/tally/index.js.map +1 -1
- package/build/ts/tally/results.d.ts +14 -0
- package/build/ts/tally/results.d.ts.map +1 -0
- package/build/ts/tally/results.js +44 -0
- package/build/ts/tally/results.js.map +1 -0
- package/build/ts/tally/types.d.ts +40 -13
- package/build/ts/tally/types.d.ts.map +1 -1
- package/build/ts/tally/utils.d.ts +3 -3
- package/build/ts/tally/utils.d.ts.map +1 -1
- package/build/ts/tally/utils.js +10 -10
- package/build/ts/tally/utils.js.map +1 -1
- package/build/ts/tally/verification.d.ts +1 -1
- package/build/ts/tally/verification.d.ts.map +1 -1
- package/build/ts/tally/verification.js +10 -10
- package/build/ts/tally/verification.js.map +1 -1
- package/build/ts/trees/index.d.ts +2 -2
- package/build/ts/trees/index.d.ts.map +1 -1
- package/build/ts/trees/index.js +3 -1
- package/build/ts/trees/index.js.map +1 -1
- package/build/ts/trees/stateTree.d.ts +23 -1
- package/build/ts/trees/stateTree.d.ts.map +1 -1
- package/build/ts/trees/stateTree.js +76 -12
- package/build/ts/trees/stateTree.js.map +1 -1
- package/build/ts/trees/types.d.ts +11 -2
- package/build/ts/trees/types.d.ts.map +1 -1
- package/build/ts/user/index.d.ts +4 -2
- package/build/ts/user/index.d.ts.map +1 -1
- package/build/ts/user/index.js +14 -8
- package/build/ts/user/index.js.map +1 -1
- package/build/ts/user/joinPoll.d.ts +8 -0
- package/build/ts/user/joinPoll.d.ts.map +1 -0
- package/build/ts/user/joinPoll.js +84 -0
- package/build/ts/user/joinPoll.js.map +1 -0
- package/build/ts/user/signup.d.ts +20 -0
- package/build/ts/user/signup.d.ts.map +1 -0
- package/build/ts/user/signup.js +84 -0
- package/build/ts/user/signup.js.map +1 -0
- package/build/ts/user/types.d.ts +60 -20
- 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 +116 -49
- package/build/ts/user/utils.js.map +1 -1
- package/build/ts/utils/params.d.ts +1 -1
- package/build/ts/utils/params.d.ts.map +1 -1
- package/build/ts/utils/params.js +3 -3
- package/build/ts/utils/params.js.map +1 -1
- package/build/ts/utils/proofs.d.ts +2 -2
- package/build/ts/utils/proofs.d.ts.map +1 -1
- package/build/ts/utils/proofs.js +4 -4
- package/build/ts/utils/proofs.js.map +1 -1
- package/build/ts/utils/types.d.ts +2 -2
- package/build/ts/utils/types.d.ts.map +1 -1
- package/build/ts/utils/utils.d.ts +8 -0
- package/build/ts/utils/utils.d.ts.map +1 -1
- package/build/ts/utils/utils.js +14 -1
- package/build/ts/utils/utils.js.map +1 -1
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts +1 -1
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts.map +1 -1
- package/build/ts/verifyingKeys/checkVerifyingKeys.js +14 -15
- package/build/ts/verifyingKeys/checkVerifyingKeys.js.map +1 -1
- package/build/ts/verifyingKeys/index.d.ts +2 -2
- package/build/ts/verifyingKeys/index.d.ts.map +1 -1
- package/build/ts/verifyingKeys/index.js +5 -5
- package/build/ts/verifyingKeys/index.js.map +1 -1
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts +1 -1
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts.map +1 -1
- package/build/ts/verifyingKeys/setVerifyingKeys.js +46 -35
- package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -1
- package/build/ts/verifyingKeys/types.d.ts +45 -37
- package/build/ts/verifyingKeys/types.d.ts.map +1 -1
- package/build/ts/verifyingKeys/utils.d.ts +10 -10
- package/build/ts/verifyingKeys/utils.d.ts.map +1 -1
- package/build/ts/verifyingKeys/utils.js +76 -60
- package/build/ts/verifyingKeys/utils.js.map +1 -1
- package/build/ts/vote/generate.d.ts +1 -1
- package/build/ts/vote/generate.d.ts.map +1 -1
- package/build/ts/vote/generate.js +4 -4
- package/build/ts/vote/generate.js.map +1 -1
- package/build/ts/vote/index.d.ts +1 -1
- package/build/ts/vote/index.d.ts.map +1 -1
- package/build/ts/vote/index.js +2 -2
- package/build/ts/vote/index.js.map +1 -1
- package/build/ts/vote/invalidate.js +3 -3
- package/build/ts/vote/invalidate.js.map +1 -1
- package/build/ts/vote/publish.d.ts +1 -1
- package/build/ts/vote/publish.d.ts.map +1 -1
- package/build/ts/vote/publish.js +19 -19
- package/build/ts/vote/publish.js.map +1 -1
- package/build/ts/vote/submit.js +5 -5
- package/build/ts/vote/submit.js.map +1 -1
- package/build/ts/vote/types.d.ts +6 -6
- package/build/ts/vote/types.d.ts.map +1 -1
- package/build/ts/vote/utils.d.ts +2 -2
- package/build/ts/vote/utils.d.ts.map +1 -1
- package/build/ts/vote/utils.js +7 -7
- package/build/ts/vote/utils.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +21 -12
- package/build/ts/deploy/vkRegistry.d.ts +0 -7
- package/build/ts/deploy/vkRegistry.d.ts.map +0 -1
- package/build/ts/deploy/vkRegistry.js +0 -14
- package/build/ts/deploy/vkRegistry.js.map +0 -1
- package/build/ts/proof/constants.d.ts +0 -17
- package/build/ts/proof/constants.d.ts.map +0 -1
- package/build/ts/proof/constants.js +0 -20
- package/build/ts/proof/constants.js.map +0 -1
- package/build/ts/user/user.d.ts +0 -42
- package/build/ts/user/user.d.ts.map +0 -1
- package/build/ts/user/user.js +0 -192
- package/build/ts/user/user.js.map +0 -1
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseIpfsHashAddedEvents = void 0;
|
|
4
4
|
const contracts_1 = require("@maci-protocol/contracts");
|
|
5
5
|
const domainobjs_1 = require("@maci-protocol/domainobjs");
|
|
6
|
-
const
|
|
6
|
+
const constants_1 = require("../utils/constants");
|
|
7
7
|
/**
|
|
8
8
|
* Parse the ipfs hash events from the Poll contract
|
|
9
9
|
*
|
|
@@ -14,8 +14,8 @@ const parseIpfsHashAddedEvents = async ({ pollContract, startBlock, provider, pu
|
|
|
14
14
|
const ipfsService = contracts_1.IpfsService.getInstance();
|
|
15
15
|
const currentBlock = await provider.getBlockNumber();
|
|
16
16
|
const ipfsHashes = [];
|
|
17
|
-
for (let block = startBlock; block <= currentBlock; block +=
|
|
18
|
-
const toBlock = Math.min(block +
|
|
17
|
+
for (let block = startBlock; block <= currentBlock; block += constants_1.BLOCKS_STEP) {
|
|
18
|
+
const toBlock = Math.min(block + constants_1.BLOCKS_STEP - 1, currentBlock);
|
|
19
19
|
// eslint-disable-next-line no-await-in-loop
|
|
20
20
|
const events = await pollContract.queryFilter(pollContract.filters.IpfsHashAdded(), block, toBlock);
|
|
21
21
|
// eslint-disable-next-line no-underscore-dangle
|
|
@@ -24,7 +24,7 @@ const parseIpfsHashAddedEvents = async ({ pollContract, startBlock, provider, pu
|
|
|
24
24
|
const messages = await Promise.all(ipfsHashes.map((ipfsHash) => ipfsService.read(ipfsHash))).then((data) => data.reduce((acc, items) => {
|
|
25
25
|
acc?.push(...(items || [])
|
|
26
26
|
.filter((message) => publicKeys && publicKeys.length > 0
|
|
27
|
-
? publicKeys.some((publicKey) => domainobjs_1.
|
|
27
|
+
? publicKeys.some((publicKey) => domainobjs_1.PublicKey.deserialize(publicKey).equals(new domainobjs_1.PublicKey([BigInt(message.publicKey[0]), BigInt(message.publicKey[1])])))
|
|
28
28
|
: true)
|
|
29
29
|
.filter((message) => messageHashes && messageHashes.length > 0 ? messageHashes.some((hash) => message.hash === hash) : true));
|
|
30
30
|
return acc ?? [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/relayer/utils.ts"],"names":[],"mappings":";;;AAAA,wDAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/relayer/utils.ts"],"names":[],"mappings":";;;AAAA,wDAA0E;AAC1E,0DAAsD;AAItD,kDAAiD;AAEjD;;;;;GAKG;AACI,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAC7C,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,UAAU,EACV,aAAa,GACiB,EAAyC,EAAE;IACzE,MAAM,WAAW,GAAG,uBAAW,CAAC,WAAW,EAAE,CAAC;IAC9C,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,cAAc,EAAE,CAAC;IACrD,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,KAAK,IAAI,KAAK,GAAG,UAAU,EAAE,KAAK,IAAI,YAAY,EAAE,KAAK,IAAI,uBAAW,EAAE,CAAC;QACzE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,uBAAW,GAAG,CAAC,EAAE,YAAY,CAA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IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CACvG,CACJ,CAAC;QAEF,OAAO,GAAG,IAAI,EAAE,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CACT,CAAC;IAEF,OAAO;QACL,QAAQ,EAAE,QAAQ,IAAI,EAAE;KACzB,CAAC;AACJ,CAAC,CAAC;AA9CW,QAAA,wBAAwB,4BA8CnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./maciSubgraph"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/subgraph/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PublicKey } from "@maci-protocol/domainobjs";
|
|
2
|
+
/**
|
|
3
|
+
* A class that can be used to interact with MACI's subgraph
|
|
4
|
+
* @dev refer to apps/subgraph for subgraph deployment and configuration
|
|
5
|
+
*/
|
|
6
|
+
export declare class MaciSubgraph {
|
|
7
|
+
/**
|
|
8
|
+
* The URL of the subgraph
|
|
9
|
+
*/
|
|
10
|
+
private url;
|
|
11
|
+
/**
|
|
12
|
+
* The query to get all MACIs public keys signed up
|
|
13
|
+
*/
|
|
14
|
+
private userQuery;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new instance of the MaciSubgraph class
|
|
17
|
+
*
|
|
18
|
+
* @param url - The URL of the subgraph
|
|
19
|
+
*/
|
|
20
|
+
constructor(url: string);
|
|
21
|
+
/**
|
|
22
|
+
* Get the public keys of all MACIs signed up
|
|
23
|
+
*
|
|
24
|
+
* @returns Array of public keys
|
|
25
|
+
*/
|
|
26
|
+
getKeys(): Promise<PublicKey[]>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=maciSubgraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maciSubgraph.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/maciSubgraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAItD;;;GAGG;AACH,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO,CAAC,GAAG,CAAS;IAEpB;;OAEG;IACH,OAAO,CAAC,SAAS,CAMb;IAEJ;;;;OAIG;gBACS,GAAG,EAAE,MAAM;IAIvB;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;CAgCtC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MaciSubgraph = void 0;
|
|
4
|
+
const domainobjs_1 = require("@maci-protocol/domainobjs");
|
|
5
|
+
/**
|
|
6
|
+
* A class that can be used to interact with MACI's subgraph
|
|
7
|
+
* @dev refer to apps/subgraph for subgraph deployment and configuration
|
|
8
|
+
*/
|
|
9
|
+
class MaciSubgraph {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new instance of the MaciSubgraph class
|
|
12
|
+
*
|
|
13
|
+
* @param url - The URL of the subgraph
|
|
14
|
+
*/
|
|
15
|
+
constructor(url) {
|
|
16
|
+
/**
|
|
17
|
+
* The query to get all MACIs public keys signed up
|
|
18
|
+
*/
|
|
19
|
+
this.userQuery = `
|
|
20
|
+
query {
|
|
21
|
+
users {
|
|
22
|
+
id
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
this.url = url;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the public keys of all MACIs signed up
|
|
30
|
+
*
|
|
31
|
+
* @returns Array of public keys
|
|
32
|
+
*/
|
|
33
|
+
async getKeys() {
|
|
34
|
+
const res = await fetch(this.url, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: JSON.stringify({
|
|
37
|
+
query: this.userQuery,
|
|
38
|
+
}),
|
|
39
|
+
headers: {
|
|
40
|
+
"Content-Type": "application/json",
|
|
41
|
+
Accept: "application/json",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
if (!res.ok) {
|
|
45
|
+
throw new Error(`GraphQL query failed: ${res.statusText}`);
|
|
46
|
+
}
|
|
47
|
+
const json = (await res.json());
|
|
48
|
+
if (json.errors) {
|
|
49
|
+
throw new Error(`GraphQL errors: ${JSON.stringify(json.errors)}`);
|
|
50
|
+
}
|
|
51
|
+
if (!json.data?.users) {
|
|
52
|
+
throw new Error("No users data in response");
|
|
53
|
+
}
|
|
54
|
+
return json.data.users.map((user) => {
|
|
55
|
+
// Split the id into x and y coordinates and convert to BigInt
|
|
56
|
+
const [x, y] = user.id.split(" ");
|
|
57
|
+
return new domainobjs_1.PublicKey([BigInt(x), BigInt(y)]);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.MaciSubgraph = MaciSubgraph;
|
|
62
|
+
//# sourceMappingURL=maciSubgraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maciSubgraph.js","sourceRoot":"","sources":["../../../ts/subgraph/maciSubgraph.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AAItD;;;GAGG;AACH,MAAa,YAAY;IAiBvB;;;;OAIG;IACH,YAAY,GAAW;QAhBvB;;WAEG;QACK,cAAS,GAAG;;;;;;KAMjB,CAAC;QAQF,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,KAAK,EAAE,IAAI,CAAC,SAAS;aACtB,CAAC;YACF,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,MAAM,EAAE,kBAAkB;aAC3B;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAoB,CAAC;QAEnD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAClC,8DAA8D;YAC9D,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,IAAI,sBAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA/DD,oCA+DC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The response from the GraphQL query
|
|
3
|
+
*/
|
|
4
|
+
export interface GraphQLResponse {
|
|
5
|
+
/**
|
|
6
|
+
* The data from the query
|
|
7
|
+
*/
|
|
8
|
+
data?: {
|
|
9
|
+
users: {
|
|
10
|
+
id: string;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The errors from the query
|
|
15
|
+
*/
|
|
16
|
+
errors?: {
|
|
17
|
+
message: string;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,CAAC,EAAE;QACL,KAAK,EAAE;YACL,EAAE,EAAE,MAAM,CAAC;SACZ,EAAE,CAAC;KACL,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../ts/subgraph/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commitments.d.ts","sourceRoot":"","sources":["../../../ts/tally/commitments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commitments.d.ts","sourceRoot":"","sources":["../../../ts/tally/commitments.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,qCAGtC,6BAA6B,KAAG,iBAyClC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateTallyCommitments = void 0;
|
|
4
|
+
const core_1 = require("@maci-protocol/core");
|
|
4
5
|
const crypto_1 = require("@maci-protocol/crypto");
|
|
5
6
|
/**
|
|
6
7
|
* Generate the tally commitments for this current batch of proving
|
|
@@ -10,22 +11,22 @@ const crypto_1 = require("@maci-protocol/crypto");
|
|
|
10
11
|
*/
|
|
11
12
|
const generateTallyCommitments = ({ tallyData, voteOptionTreeDepth, }) => {
|
|
12
13
|
// compute newResultsCommitment
|
|
13
|
-
const newResultsCommitment = (0, crypto_1.
|
|
14
|
+
const newResultsCommitment = (0, crypto_1.generateTreeCommitment)(tallyData.results.tally.map((x) => BigInt(x)), BigInt(tallyData.results.salt), voteOptionTreeDepth);
|
|
14
15
|
// compute newSpentVoiceCreditsCommitment
|
|
15
16
|
const newSpentVoiceCreditsCommitment = (0, crypto_1.hash2)([
|
|
16
17
|
BigInt(tallyData.totalSpentVoiceCredits.spent),
|
|
17
18
|
BigInt(tallyData.totalSpentVoiceCredits.salt),
|
|
18
19
|
]);
|
|
19
20
|
let newTallyCommitment;
|
|
20
|
-
let
|
|
21
|
-
if (tallyData.
|
|
22
|
-
// compute
|
|
23
|
-
|
|
21
|
+
let newPerVoteOptionSpentVoiceCreditsCommitment;
|
|
22
|
+
if (tallyData.mode === core_1.EMode.QV) {
|
|
23
|
+
// compute newPerVoteOptionSpentVoiceCreditsCommitment
|
|
24
|
+
newPerVoteOptionSpentVoiceCreditsCommitment = (0, crypto_1.generateTreeCommitment)(tallyData.perVoteOptionSpentVoiceCredits.tally.map((x) => BigInt(x)), BigInt(tallyData.perVoteOptionSpentVoiceCredits.salt), voteOptionTreeDepth);
|
|
24
25
|
// compute newTallyCommitment
|
|
25
26
|
newTallyCommitment = (0, crypto_1.hash3)([
|
|
26
27
|
newResultsCommitment,
|
|
27
28
|
newSpentVoiceCreditsCommitment,
|
|
28
|
-
|
|
29
|
+
newPerVoteOptionSpentVoiceCreditsCommitment,
|
|
29
30
|
]);
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
@@ -34,7 +35,7 @@ const generateTallyCommitments = ({ tallyData, voteOptionTreeDepth, }) => {
|
|
|
34
35
|
return {
|
|
35
36
|
newTallyCommitment,
|
|
36
37
|
newSpentVoiceCreditsCommitment,
|
|
37
|
-
|
|
38
|
+
newPerVoteOptionSpentVoiceCreditsCommitment,
|
|
38
39
|
newResultsCommitment,
|
|
39
40
|
};
|
|
40
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commitments.js","sourceRoot":"","sources":["../../../ts/tally/commitments.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"commitments.js","sourceRoot":"","sources":["../../../ts/tally/commitments.ts"],"names":[],"mappings":";;;AAAA,8CAA4C;AAC5C,kDAA4F;AAI5F;;;;;GAKG;AACI,MAAM,wBAAwB,GAAG,CAAC,EACvC,SAAS,EACT,mBAAmB,GACW,EAAqB,EAAE;IACrD,+BAA+B;IAC/B,MAAM,oBAAoB,GAAG,IAAA,+BAAsB,EACjD,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAC7C,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAC9B,mBAAmB,CACpB,CAAC;IAEF,yCAAyC;IACzC,MAAM,8BAA8B,GAAG,IAAA,cAAK,EAAC;QAC3C,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK,CAAC;QAC9C,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,IAAI,CAAC;KAC9C,CAAC,CAAC;IAEH,IAAI,kBAA0B,CAAC;IAC/B,IAAI,2CAA+D,CAAC;IAEpE,IAAI,SAAS,CAAC,IAAI,KAAK,YAAK,CAAC,EAAE,EAAE,CAAC;QAChC,sDAAsD;QACtD,2CAA2C,GAAG,IAAA,+BAAsB,EAClE,SAAS,CAAC,8BAA+B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EACrE,MAAM,CAAC,SAAS,CAAC,8BAA+B,CAAC,IAAI,CAAC,EACtD,mBAAmB,CACpB,CAAC;QAEF,6BAA6B;QAC7B,kBAAkB,GAAG,IAAA,cAAK,EAAC;YACzB,oBAAoB;YACpB,8BAA8B;YAC9B,2CAA2C;SAC5C,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,kBAAkB,GAAG,IAAA,sBAAa,EAAC,oBAAoB,EAAE,8BAA8B,CAAC,CAAC;IAC3F,CAAC;IAED,OAAO;QACL,kBAAkB;QAClB,8BAA8B;QAC9B,2CAA2C;QAC3C,oBAAoB;KACrB,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,wBAAwB,4BA4CnC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { generateTallyCommitments } from "./commitments";
|
|
2
2
|
export { verify } from "./verification";
|
|
3
|
-
export type { ITallyData, IVerifyArgs, IGenerateTallyCommitmentsArgs, ITallyCommitments, ITallyVotesInputs, } from "./types";
|
|
3
|
+
export type { ITallyData, IVerifyArgs, IGenerateTallyCommitmentsArgs, ITallyCommitments, ITallyVotesInputs, IGetResultPerOptionArgs, IGetResultsArgs, } from "./types";
|
|
4
|
+
export { getResultPerOption, getResults } from "./results";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/tally/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,YAAY,EACV,UAAU,EACV,WAAW,EACX,6BAA6B,EAC7B,iBAAiB,EACjB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/tally/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,YAAY,EACV,UAAU,EACV,WAAW,EACX,6BAA6B,EAC7B,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
package/build/ts/tally/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verify = exports.generateTallyCommitments = void 0;
|
|
3
|
+
exports.getResults = exports.getResultPerOption = exports.verify = exports.generateTallyCommitments = void 0;
|
|
4
4
|
var commitments_1 = require("./commitments");
|
|
5
5
|
Object.defineProperty(exports, "generateTallyCommitments", { enumerable: true, get: function () { return commitments_1.generateTallyCommitments; } });
|
|
6
6
|
var verification_1 = require("./verification");
|
|
7
7
|
Object.defineProperty(exports, "verify", { enumerable: true, get: function () { return verification_1.verify; } });
|
|
8
|
+
var results_1 = require("./results");
|
|
9
|
+
Object.defineProperty(exports, "getResultPerOption", { enumerable: true, get: function () { return results_1.getResultPerOption; } });
|
|
10
|
+
Object.defineProperty(exports, "getResults", { enumerable: true, get: function () { return results_1.getResults; } });
|
|
8
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/tally/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAAhD,uHAAA,wBAAwB,OAAA;AACjC,+CAAwC;AAA/B,sGAAA,MAAM,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/tally/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAAhD,uHAAA,wBAAwB,OAAA;AACjC,+CAAwC;AAA/B,sGAAA,MAAM,OAAA;AAUf,qCAA2D;AAAlD,6GAAA,kBAAkB,OAAA;AAAE,qGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IGetResultPerOptionArgs, IGetResultsArgs } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Get result per option
|
|
4
|
+
* @param {IGetResultPerOptionsArgs} - The arguments to get result per option
|
|
5
|
+
* @returns The result per option
|
|
6
|
+
*/
|
|
7
|
+
export declare const getResultPerOption: ({ maciAddress, pollId, index, signer, }: IGetResultPerOptionArgs) => Promise<bigint>;
|
|
8
|
+
/**
|
|
9
|
+
* Get all results from the Tally contract
|
|
10
|
+
* @param {IGetResultsArgs} - The arguments to get all the results
|
|
11
|
+
* @returns The results array (The final result of vote option n is in index n-1)
|
|
12
|
+
*/
|
|
13
|
+
export declare const getResults: ({ maciAddress, pollId, signer }: IGetResultsArgs) => Promise<bigint[]>;
|
|
14
|
+
//# sourceMappingURL=results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../ts/tally/results.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAU,yCAKtC,uBAAuB,KAAG,OAAO,CAAC,MAAM,CAc1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,iCAAiC,eAAe,KAAG,OAAO,CAAC,MAAM,EAAE,CAwBnG,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResults = exports.getResultPerOption = void 0;
|
|
4
|
+
const typechain_types_1 = require("@maci-protocol/contracts/typechain-types");
|
|
5
|
+
/**
|
|
6
|
+
* Get result per option
|
|
7
|
+
* @param {IGetResultPerOptionsArgs} - The arguments to get result per option
|
|
8
|
+
* @returns The result per option
|
|
9
|
+
*/
|
|
10
|
+
const getResultPerOption = async ({ maciAddress, pollId, index, signer, }) => {
|
|
11
|
+
const maciContract = typechain_types_1.MACI__factory.connect(maciAddress, signer);
|
|
12
|
+
const pollContracts = await maciContract.getPoll(pollId);
|
|
13
|
+
const tallyContract = typechain_types_1.Tally__factory.connect(pollContracts.tally, signer);
|
|
14
|
+
const result = await tallyContract.tallyResults(index);
|
|
15
|
+
if (!result.flag) {
|
|
16
|
+
throw new Error("Tally result is not set");
|
|
17
|
+
}
|
|
18
|
+
return result.value;
|
|
19
|
+
};
|
|
20
|
+
exports.getResultPerOption = getResultPerOption;
|
|
21
|
+
/**
|
|
22
|
+
* Get all results from the Tally contract
|
|
23
|
+
* @param {IGetResultsArgs} - The arguments to get all the results
|
|
24
|
+
* @returns The results array (The final result of vote option n is in index n-1)
|
|
25
|
+
*/
|
|
26
|
+
const getResults = async ({ maciAddress, pollId, signer }) => {
|
|
27
|
+
const maciContract = typechain_types_1.MACI__factory.connect(maciAddress, signer);
|
|
28
|
+
const pollContracts = await maciContract.getPoll(pollId);
|
|
29
|
+
const pollContract = typechain_types_1.Poll__factory.connect(pollContracts.poll, signer);
|
|
30
|
+
const numberOfVoteOptions = await pollContract.voteOptions();
|
|
31
|
+
const tallyContract = typechain_types_1.Tally__factory.connect(pollContracts.tally, signer);
|
|
32
|
+
const results = [];
|
|
33
|
+
for (let i = 0; i < numberOfVoteOptions; i += 1) {
|
|
34
|
+
// eslint-disable-next-line no-await-in-loop
|
|
35
|
+
const result = await tallyContract.tallyResults(i);
|
|
36
|
+
if (!result.flag) {
|
|
37
|
+
throw new Error(`Tally result for option ${i} is not set`);
|
|
38
|
+
}
|
|
39
|
+
results.push(result.value);
|
|
40
|
+
}
|
|
41
|
+
return results;
|
|
42
|
+
};
|
|
43
|
+
exports.getResults = getResults;
|
|
44
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../../ts/tally/results.ts"],"names":[],"mappings":";;;AAAA,8EAIkD;AAIlD;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,WAAW,EACX,MAAM,EACN,KAAK,EACL,MAAM,GACkB,EAAmB,EAAE;IAC7C,MAAM,YAAY,GAAG,+BAAW,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE9D,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzD,MAAM,aAAa,GAAG,gCAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAExE,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAEvD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC,CAAC;AAnBW,QAAA,kBAAkB,sBAmB7B;AAEF;;;;GAIG;AACI,MAAM,UAAU,GAAG,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAmB,EAAqB,EAAE;IACtG,MAAM,YAAY,GAAG,+BAAW,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE9D,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,+BAAW,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrE,MAAM,mBAAmB,GAAG,MAAM,YAAY,CAAC,WAAW,EAAE,CAAC;IAE7D,MAAM,aAAa,GAAG,gCAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAExE,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,4CAA4C;QAC5C,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAEnD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAxBW,QAAA,UAAU,cAwBrB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EMode } from "@maci-protocol/core";
|
|
1
2
|
import type { Signer } from "ethers";
|
|
2
3
|
/**
|
|
3
4
|
* Interface for the tally file data.
|
|
@@ -21,9 +22,9 @@ export interface ITallyData {
|
|
|
21
22
|
*/
|
|
22
23
|
chainId?: string;
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
+
* Voting mode
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
+
mode: EMode;
|
|
27
28
|
/**
|
|
28
29
|
* The address of the Tally contract.
|
|
29
30
|
*/
|
|
@@ -67,19 +68,19 @@ export interface ITallyData {
|
|
|
67
68
|
commitment: string;
|
|
68
69
|
};
|
|
69
70
|
/**
|
|
70
|
-
* The per
|
|
71
|
+
* The per vote option spent voice credits.
|
|
71
72
|
*/
|
|
72
|
-
|
|
73
|
+
perVoteOptionSpentVoiceCredits?: {
|
|
73
74
|
/**
|
|
74
|
-
* The tally of the per
|
|
75
|
+
* The tally of the per vote option spent voice credits.
|
|
75
76
|
*/
|
|
76
77
|
tally: string[];
|
|
77
78
|
/**
|
|
78
|
-
* The salt of the per
|
|
79
|
+
* The salt of the per vote option spent voice credits.
|
|
79
80
|
*/
|
|
80
81
|
salt: string;
|
|
81
82
|
/**
|
|
82
|
-
* The commitment of the per
|
|
83
|
+
* The commitment of the per vote option spent voice credits.
|
|
83
84
|
*/
|
|
84
85
|
commitment: string;
|
|
85
86
|
};
|
|
@@ -111,7 +112,7 @@ export interface IVerifyArgs {
|
|
|
111
112
|
/**
|
|
112
113
|
* The number of vote options
|
|
113
114
|
*/
|
|
114
|
-
|
|
115
|
+
totalVoteOptions: number;
|
|
115
116
|
/**
|
|
116
117
|
* The vote option tree depth
|
|
117
118
|
*/
|
|
@@ -145,7 +146,7 @@ export interface ITallyCommitments {
|
|
|
145
146
|
/**
|
|
146
147
|
* The new per vote option spent voice credits commitment
|
|
147
148
|
*/
|
|
148
|
-
|
|
149
|
+
newPerVoteOptionSpentVoiceCreditsCommitment?: bigint;
|
|
149
150
|
/**
|
|
150
151
|
* The commitment to the results tree root
|
|
151
152
|
*/
|
|
@@ -159,7 +160,7 @@ export interface ITallyVotesInputs {
|
|
|
159
160
|
ballotRoot: bigint;
|
|
160
161
|
sbSalt: bigint;
|
|
161
162
|
index: bigint;
|
|
162
|
-
|
|
163
|
+
totalSignups: bigint;
|
|
163
164
|
sbCommitment: bigint;
|
|
164
165
|
currentTallyCommitment: bigint;
|
|
165
166
|
newTallyCommitment: bigint;
|
|
@@ -170,10 +171,36 @@ export interface ITallyVotesInputs {
|
|
|
170
171
|
currentResultsRootSalt: bigint;
|
|
171
172
|
currentSpentVoiceCreditSubtotal: bigint;
|
|
172
173
|
currentSpentVoiceCreditSubtotalSalt: bigint;
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
currentPerVoteOptionSpentVoiceCredits: bigint[];
|
|
175
|
+
currentPerVoteOptionSpentVoiceCreditsRootSalt: bigint;
|
|
175
176
|
newResultsRootSalt: bigint;
|
|
176
|
-
|
|
177
|
+
newPerVoteOptionSpentVoiceCreditsRootSalt: bigint;
|
|
177
178
|
newSpentVoiceCreditSubtotalSalt: bigint;
|
|
178
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Get results args
|
|
182
|
+
*/
|
|
183
|
+
export interface IGetResultsArgs {
|
|
184
|
+
/**
|
|
185
|
+
* The address of the MACI contract
|
|
186
|
+
*/
|
|
187
|
+
maciAddress: string;
|
|
188
|
+
/**
|
|
189
|
+
* The ID of the poll
|
|
190
|
+
*/
|
|
191
|
+
pollId: string;
|
|
192
|
+
/**
|
|
193
|
+
* The signer
|
|
194
|
+
*/
|
|
195
|
+
signer: Signer;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Get result per option args
|
|
199
|
+
*/
|
|
200
|
+
export interface IGetResultPerOptionArgs extends IGetResultsArgs {
|
|
201
|
+
/**
|
|
202
|
+
* The index of the vote option
|
|
203
|
+
*/
|
|
204
|
+
index: number;
|
|
205
|
+
}
|
|
179
206
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/tally/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EA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Ac,EAAE,MAAM,EAAE,CAAC;IACzB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,+BAA+B,EAAE,MAAM,CAAC;IACxC,mCAAmC,EAAE,MAAM,CAAC;IAC5C,qCAAqC,EAAE,MAAM,EAAE,CAAC;IAChD,6CAA6C,EAAE,MAAM,CAAC;IACtD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yCAAyC,EAAE,MAAM,CAAC;IAClD,+BAA+B,EAAE,MAAM,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -10,15 +10,15 @@ import type { Tally } from "@maci-protocol/contracts";
|
|
|
10
10
|
* @param newResultsCommitment The tally result commitment
|
|
11
11
|
* @returns list of the indexes of the tally result that failed on-chain verification
|
|
12
12
|
*/
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const verifyPerVoteOptionSpentVoiceCredits: (tallyContract: Tally, tallyData: ITallyData, voteOptionTreeDepth: number, newSpentVoiceCreditsCommitment: bigint, newResultsCommitment: bigint) => Promise<number[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Loop through each tally result and verify it on-chain
|
|
16
16
|
* @param tallyContract The tally contract
|
|
17
17
|
* @param tallyData The tally.json file data
|
|
18
18
|
* @param voteOptionTreeDepth The vote option tree depth
|
|
19
19
|
* @param newSpentVoiceCreditsCommitment The total spent voice credits commitment
|
|
20
|
-
* @param
|
|
20
|
+
* @param newPerVoteOptionSpentVoiceCreditsCommitment The per vote option voice credits commitment
|
|
21
21
|
* @returns list of the indexes of the tally result that failed on-chain verification
|
|
22
22
|
*/
|
|
23
|
-
export declare const verifyTallyResults: (tallyContract: Tally, tallyData: ITallyData, voteOptionTreeDepth: number, newSpentVoiceCreditsCommitment: bigint,
|
|
23
|
+
export declare const verifyTallyResults: (tallyContract: Tally, tallyData: ITallyData, voteOptionTreeDepth: number, newSpentVoiceCreditsCommitment: bigint, newPerVoteOptionSpentVoiceCreditsCommitment?: bigint) => Promise<number[]>;
|
|
24
24
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/tally/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD;;;;;;;;;GASG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/tally/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD;;;;;;;;;GASG;AACH,eAAO,MAAM,oCAAoC,GAC/C,eAAe,KAAK,EACpB,WAAW,UAAU,EACrB,qBAAqB,MAAM,EAC3B,gCAAgC,MAAM,EACtC,sBAAsB,MAAM,KAC3B,OAAO,CAAC,MAAM,EAAE,CA2BlB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAC7B,eAAe,KAAK,EACpB,WAAW,UAAU,EACrB,qBAAqB,MAAM,EAC3B,gCAAgC,MAAM,EACtC,8CAA8C,MAAM,KACnD,OAAO,CAAC,MAAM,EAAE,CA2BlB,CAAC"}
|
package/build/ts/tally/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyTallyResults = exports.
|
|
3
|
+
exports.verifyTallyResults = exports.verifyPerVoteOptionSpentVoiceCredits = void 0;
|
|
4
4
|
const crypto_1 = require("@maci-protocol/crypto");
|
|
5
5
|
/**
|
|
6
6
|
* Loop through each per vote option spent voice credits and verify it on-chain
|
|
@@ -12,34 +12,34 @@ const crypto_1 = require("@maci-protocol/crypto");
|
|
|
12
12
|
* @param newResultsCommitment The tally result commitment
|
|
13
13
|
* @returns list of the indexes of the tally result that failed on-chain verification
|
|
14
14
|
*/
|
|
15
|
-
const
|
|
15
|
+
const verifyPerVoteOptionSpentVoiceCredits = async (tallyContract, tallyData, voteOptionTreeDepth, newSpentVoiceCreditsCommitment, newResultsCommitment) => {
|
|
16
16
|
const failedIndices = [];
|
|
17
|
-
for (let i = 0; i < tallyData.
|
|
18
|
-
const proof = (0, crypto_1.
|
|
17
|
+
for (let i = 0; i < tallyData.perVoteOptionSpentVoiceCredits.tally.length; i += 1) {
|
|
18
|
+
const proof = (0, crypto_1.generateTreeProof)(i, tallyData.perVoteOptionSpentVoiceCredits.tally.map((x) => BigInt(x)), voteOptionTreeDepth);
|
|
19
19
|
// eslint-disable-next-line no-await-in-loop
|
|
20
|
-
const isValid = await tallyContract.
|
|
20
|
+
const isValid = await tallyContract.verifyPerVoteOptionSpentVoiceCredits(i, tallyData.perVoteOptionSpentVoiceCredits.tally[i], proof, tallyData.perVoteOptionSpentVoiceCredits.salt, voteOptionTreeDepth, newSpentVoiceCreditsCommitment, newResultsCommitment);
|
|
21
21
|
if (!isValid) {
|
|
22
22
|
failedIndices.push(i);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
return failedIndices;
|
|
26
26
|
};
|
|
27
|
-
exports.
|
|
27
|
+
exports.verifyPerVoteOptionSpentVoiceCredits = verifyPerVoteOptionSpentVoiceCredits;
|
|
28
28
|
/**
|
|
29
29
|
* Loop through each tally result and verify it on-chain
|
|
30
30
|
* @param tallyContract The tally contract
|
|
31
31
|
* @param tallyData The tally.json file data
|
|
32
32
|
* @param voteOptionTreeDepth The vote option tree depth
|
|
33
33
|
* @param newSpentVoiceCreditsCommitment The total spent voice credits commitment
|
|
34
|
-
* @param
|
|
34
|
+
* @param newPerVoteOptionSpentVoiceCreditsCommitment The per vote option voice credits commitment
|
|
35
35
|
* @returns list of the indexes of the tally result that failed on-chain verification
|
|
36
36
|
*/
|
|
37
|
-
const verifyTallyResults = async (tallyContract, tallyData, voteOptionTreeDepth, newSpentVoiceCreditsCommitment,
|
|
37
|
+
const verifyTallyResults = async (tallyContract, tallyData, voteOptionTreeDepth, newSpentVoiceCreditsCommitment, newPerVoteOptionSpentVoiceCreditsCommitment) => {
|
|
38
38
|
const failedIndices = [];
|
|
39
39
|
for (let i = 0; i < tallyData.results.tally.length; i += 1) {
|
|
40
|
-
const proof = (0, crypto_1.
|
|
40
|
+
const proof = (0, crypto_1.generateTreeProof)(i, tallyData.results.tally.map((x) => BigInt(x)), voteOptionTreeDepth);
|
|
41
41
|
// eslint-disable-next-line no-await-in-loop
|
|
42
|
-
const isValid = await tallyContract.verifyTallyResult(i, tallyData.results.tally[i], proof, tallyData.results.salt, voteOptionTreeDepth, newSpentVoiceCreditsCommitment,
|
|
42
|
+
const isValid = await tallyContract.verifyTallyResult(i, tallyData.results.tally[i], proof, tallyData.results.salt, voteOptionTreeDepth, newSpentVoiceCreditsCommitment, newPerVoteOptionSpentVoiceCreditsCommitment ?? 0n);
|
|
43
43
|
if (!isValid) {
|
|
44
44
|
failedIndices.push(i);
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/tally/utils.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/tally/utils.ts"],"names":[],"mappings":";;;AAAA,kDAA0D;AAK1D;;;;;;;;;GASG;AACI,MAAM,oCAAoC,GAAG,KAAK,EACvD,aAAoB,EACpB,SAAqB,EACrB,mBAA2B,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AC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAC7C,mBAAmB,CACpB,CAAC;QAEF,4CAA4C;QAC5C,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,iBAAiB,CACnD,CAAC,EACD,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAC1B,KAAK,EACL,SAAS,CAAC,OAAO,CAAC,IAAI,EACtB,mBAAmB,EACnB,8BAA8B,EAC9B,2CAA2C,IAAI,EAAE,CAClD,CAAC;QAEF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAjCW,QAAA,kBAAkB,sBAiC7B"}
|
|
@@ -3,5 +3,5 @@ import type { IVerifyArgs } from "./types";
|
|
|
3
3
|
* Verify the results of a poll on-chain
|
|
4
4
|
* @param VerifyArgs - The arguments for the verify command
|
|
5
5
|
*/
|
|
6
|
-
export declare const verify: ({ pollId, tallyData, signer, tallyCommitments,
|
|
6
|
+
export declare const verify: ({ pollId, tallyData, signer, tallyCommitments, totalVoteOptions, voteOptionTreeDepth, }: IVerifyArgs) => Promise<boolean>;
|
|
7
7
|
//# sourceMappingURL=verification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../../ts/tally/verification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../../ts/tally/verification.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAU,yFAO1B,WAAW,KAAG,OAAO,CAAC,OAAO,CAgG/B,CAAC"}
|