@maci-protocol/sdk 0.0.0-ci.9342f07 → 0.0.0-ci.9819a21
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.js +1 -1
- package/build/ts/deploy/maci.js.map +1 -1
- package/build/ts/deploy/poll.d.ts +1 -1
- package/build/ts/deploy/poll.d.ts.map +1 -1
- package/build/ts/deploy/poll.js +13 -9
- package/build/ts/deploy/poll.js.map +1 -1
- package/build/ts/deploy/types.d.ts +19 -10
- 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 +7 -7
- package/build/ts/maciKeys/__tests__/keypair.test.js.map +1 -1
- package/build/ts/maciKeys/__tests__/publicKeys.test.js +7 -7
- package/build/ts/maciKeys/__tests__/publicKeys.test.js.map +1 -1
- package/build/ts/maciKeys/keypair.d.ts.map +1 -1
- package/build/ts/maciKeys/keypair.js +4 -3
- package/build/ts/maciKeys/keypair.js.map +1 -1
- package/build/ts/maciKeys/publicKeys.d.ts +2 -2
- package/build/ts/maciKeys/publicKeys.d.ts.map +1 -1
- package/build/ts/maciKeys/publicKeys.js +6 -6
- package/build/ts/maciKeys/publicKeys.js.map +1 -1
- package/build/ts/maciKeys/types.d.ts +5 -0
- package/build/ts/maciKeys/types.d.ts.map +1 -1
- package/build/ts/poll/poll.d.ts.map +1 -1
- package/build/ts/poll/poll.js +9 -9
- package/build/ts/poll/poll.js.map +1 -1
- package/build/ts/poll/types.d.ts +6 -6
- package/build/ts/poll/types.d.ts.map +1 -1
- package/build/ts/proof/__tests__/download.test.js +8 -5
- 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 +29 -23
- package/build/ts/proof/generate.js.map +1 -1
- package/build/ts/proof/prove.js +13 -13
- package/build/ts/proof/prove.js.map +1 -1
- package/build/ts/proof/types.d.ts +40 -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/__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 +1 -1
- 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 +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 +11 -2
- 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 +3 -3
- package/build/ts/user/signup.d.ts.map +1 -1
- package/build/ts/user/signup.js +26 -21
- package/build/ts/user/signup.js.map +1 -1
- package/build/ts/user/types.d.ts +63 -19
- package/build/ts/user/types.d.ts.map +1 -1
- package/build/ts/user/utils.d.ts +34 -14
- package/build/ts/user/utils.d.ts.map +1 -1
- package/build/ts/user/utils.js +91 -57
- 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 +75 -41
- package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -1
- package/build/ts/verifyingKeys/types.d.ts +56 -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 +1 -1
- package/build/ts/vote/generate.d.ts.map +1 -1
- package/build/ts/vote/generate.js +4 -4
- package/build/ts/vote/generate.js.map +1 -1
- package/build/ts/vote/index.d.ts +2 -1
- package/build/ts/vote/index.d.ts.map +1 -1
- package/build/ts/vote/index.js +4 -2
- package/build/ts/vote/index.js.map +1 -1
- package/build/ts/vote/invalidate.js +4 -4
- package/build/ts/vote/invalidate.js.map +1 -1
- package/build/ts/vote/publish.d.ts +1 -1
- package/build/ts/vote/publish.d.ts.map +1 -1
- package/build/ts/vote/publish.js +19 -19
- package/build/ts/vote/publish.js.map +1 -1
- package/build/ts/vote/submit.js +2 -2
- package/build/ts/vote/submit.js.map +1 -1
- package/build/ts/vote/types.d.ts +6 -6
- package/build/ts/vote/types.d.ts.map +1 -1
- package/build/ts/vote/utils.d.ts +2 -2
- package/build/ts/vote/utils.d.ts.map +1 -1
- package/build/ts/vote/utils.js +5 -5
- package/build/ts/vote/utils.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +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/build/ts/index.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export * from "./utils";
|
|
|
10
10
|
export * from "./user";
|
|
11
11
|
export * from "./deploy";
|
|
12
12
|
export * from "./maciKeys";
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export * from "./subgraph";
|
|
14
|
+
export { EMode, EContracts, ECheckerFactories, ECheckers, EPolicies, EPolicyFactories, EInitialVoiceCreditProxies, EInitialVoiceCreditProxiesFactories, EDeploySteps, ESupportedChains, EChainId, Deployment, ContractStorage, ProofGenerator, TreeMerger, Prover, extractVerifyingKey, generateProofRapidSnark, generateProofSnarkjs, formatProofForVerifierContract, verifyProof, linkPoseidonLibraries, deployConstantInitialVoiceCreditProxyFactory, deployConstantInitialVoiceCreditProxy, deployMockVerifier, deployVerifyingKeysRegistry, deployVerifier, generateMaciStateFromContract, deployPoseidonContracts, deployERC20VotesPolicy, deployAnonAadhaarPolicy, deployEASSignUpPolicy, deployGitcoinPassportPolicy, deployMerkleProofPolicy, deploySemaphoreSignupPolicy, deployZupassSignUpPolicy, deployFreeForAllSignUpPolicy, deploySignupTokenPolicy, deployHatsSignupPolicy, deployContract, deployContractWithLinkedLibraries, getDeployedPolicyProxyFactories, getDefaultSigner, cleanThreads, unlinkFile, getBlockTimestamp, logGreen, logMagenta, logRed, logYellow, info, success, warning, error, generateEmptyBallotRoots, } from "@maci-protocol/contracts";
|
|
15
|
+
export type { FullProveResult, IGenerateProofsOptions, IGenerateProofsBatchData, IDeployParams, IMergeParams, IProveParams, IVerifyingKeyStruct, SnarkProof, IIpfsMessage, IDeployCloneArgs, } from "@maci-protocol/contracts";
|
|
15
16
|
export * from "@maci-protocol/contracts/typechain-types";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/build/ts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,KAAK,EACL,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,0BAA0B,EAC1B,mCAAmC,EACnC,YAAY,EACZ,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,KAAK,EACL,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,0BAA0B,EAC1B,mCAAmC,EACnC,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,8BAA8B,EAC9B,WAAW,EACX,qBAAqB,EACrB,4CAA4C,EAC5C,qCAAqC,EACrC,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,EACd,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,iCAAiC,EACjC,+BAA+B,EAC/B,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV,MAAM,EACN,SAAS,EACT,IAAI,EACJ,OAAO,EACP,OAAO,EACP,KAAK,EACL,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,cAAc,0CAA0C,CAAC"}
|
package/build/ts/index.js
CHANGED
|
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.logYellow = exports.logRed = exports.logMagenta = exports.logGreen = exports.getBlockTimestamp = exports.unlinkFile = exports.cleanThreads = exports.getDefaultSigner = exports.getDeployedPolicyProxyFactories = exports.deployContractWithLinkedLibraries = exports.deployContract = exports.deployHatsSignupPolicy = exports.deploySignupTokenPolicy = exports.deployFreeForAllSignUpPolicy = exports.deployZupassSignUpPolicy = exports.deploySemaphoreSignupPolicy = exports.deployMerkleProofPolicy = exports.deployGitcoinPassportPolicy = exports.deployEASSignUpPolicy = exports.deployAnonAadhaarPolicy = exports.deployERC20VotesPolicy = exports.deployPoseidonContracts = exports.generateMaciStateFromContract = exports.deployVerifier = exports.deployVerifyingKeysRegistry = exports.deployMockVerifier = exports.deployConstantInitialVoiceCreditProxy = exports.deployConstantInitialVoiceCreditProxyFactory = exports.linkPoseidonLibraries = exports.verifyProof = exports.formatProofForVerifierContract = exports.generateProofSnarkjs = exports.generateProofRapidSnark = exports.extractVerifyingKey = exports.Prover = exports.TreeMerger = exports.ProofGenerator = exports.ContractStorage = exports.Deployment = exports.EChainId = exports.ESupportedChains = exports.EDeploySteps = exports.EInitialVoiceCreditProxiesFactories = exports.EInitialVoiceCreditProxies = exports.EPolicyFactories = exports.EPolicies = exports.ECheckers = exports.ECheckerFactories = exports.EContracts = exports.EMode = void 0;
|
|
18
|
+
exports.generateEmptyBallotRoots = exports.error = exports.warning = exports.success = exports.info = void 0;
|
|
18
19
|
__exportStar(require("./verifyingKeys"), exports);
|
|
19
20
|
__exportStar(require("./maci"), exports);
|
|
20
21
|
__exportStar(require("./relayer"), exports);
|
|
@@ -27,6 +28,7 @@ __exportStar(require("./utils"), exports);
|
|
|
27
28
|
__exportStar(require("./user"), exports);
|
|
28
29
|
__exportStar(require("./deploy"), exports);
|
|
29
30
|
__exportStar(require("./maciKeys"), exports);
|
|
31
|
+
__exportStar(require("./subgraph"), exports);
|
|
30
32
|
var contracts_1 = require("@maci-protocol/contracts");
|
|
31
33
|
Object.defineProperty(exports, "EMode", { enumerable: true, get: function () { return contracts_1.EMode; } });
|
|
32
34
|
Object.defineProperty(exports, "EContracts", { enumerable: true, get: function () { return contracts_1.EContracts; } });
|
|
@@ -37,23 +39,27 @@ Object.defineProperty(exports, "EPolicyFactories", { enumerable: true, get: func
|
|
|
37
39
|
Object.defineProperty(exports, "EInitialVoiceCreditProxies", { enumerable: true, get: function () { return contracts_1.EInitialVoiceCreditProxies; } });
|
|
38
40
|
Object.defineProperty(exports, "EInitialVoiceCreditProxiesFactories", { enumerable: true, get: function () { return contracts_1.EInitialVoiceCreditProxiesFactories; } });
|
|
39
41
|
Object.defineProperty(exports, "EDeploySteps", { enumerable: true, get: function () { return contracts_1.EDeploySteps; } });
|
|
42
|
+
Object.defineProperty(exports, "ESupportedChains", { enumerable: true, get: function () { return contracts_1.ESupportedChains; } });
|
|
43
|
+
Object.defineProperty(exports, "EChainId", { enumerable: true, get: function () { return contracts_1.EChainId; } });
|
|
40
44
|
Object.defineProperty(exports, "Deployment", { enumerable: true, get: function () { return contracts_1.Deployment; } });
|
|
41
45
|
Object.defineProperty(exports, "ContractStorage", { enumerable: true, get: function () { return contracts_1.ContractStorage; } });
|
|
42
46
|
Object.defineProperty(exports, "ProofGenerator", { enumerable: true, get: function () { return contracts_1.ProofGenerator; } });
|
|
43
47
|
Object.defineProperty(exports, "TreeMerger", { enumerable: true, get: function () { return contracts_1.TreeMerger; } });
|
|
44
48
|
Object.defineProperty(exports, "Prover", { enumerable: true, get: function () { return contracts_1.Prover; } });
|
|
45
|
-
Object.defineProperty(exports, "
|
|
46
|
-
Object.defineProperty(exports, "
|
|
47
|
-
Object.defineProperty(exports, "
|
|
49
|
+
Object.defineProperty(exports, "extractVerifyingKey", { enumerable: true, get: function () { return contracts_1.extractVerifyingKey; } });
|
|
50
|
+
Object.defineProperty(exports, "generateProofRapidSnark", { enumerable: true, get: function () { return contracts_1.generateProofRapidSnark; } });
|
|
51
|
+
Object.defineProperty(exports, "generateProofSnarkjs", { enumerable: true, get: function () { return contracts_1.generateProofSnarkjs; } });
|
|
48
52
|
Object.defineProperty(exports, "formatProofForVerifierContract", { enumerable: true, get: function () { return contracts_1.formatProofForVerifierContract; } });
|
|
49
53
|
Object.defineProperty(exports, "verifyProof", { enumerable: true, get: function () { return contracts_1.verifyProof; } });
|
|
50
54
|
Object.defineProperty(exports, "linkPoseidonLibraries", { enumerable: true, get: function () { return contracts_1.linkPoseidonLibraries; } });
|
|
55
|
+
Object.defineProperty(exports, "deployConstantInitialVoiceCreditProxyFactory", { enumerable: true, get: function () { return contracts_1.deployConstantInitialVoiceCreditProxyFactory; } });
|
|
51
56
|
Object.defineProperty(exports, "deployConstantInitialVoiceCreditProxy", { enumerable: true, get: function () { return contracts_1.deployConstantInitialVoiceCreditProxy; } });
|
|
52
57
|
Object.defineProperty(exports, "deployMockVerifier", { enumerable: true, get: function () { return contracts_1.deployMockVerifier; } });
|
|
53
|
-
Object.defineProperty(exports, "
|
|
58
|
+
Object.defineProperty(exports, "deployVerifyingKeysRegistry", { enumerable: true, get: function () { return contracts_1.deployVerifyingKeysRegistry; } });
|
|
54
59
|
Object.defineProperty(exports, "deployVerifier", { enumerable: true, get: function () { return contracts_1.deployVerifier; } });
|
|
55
|
-
Object.defineProperty(exports, "
|
|
60
|
+
Object.defineProperty(exports, "generateMaciStateFromContract", { enumerable: true, get: function () { return contracts_1.generateMaciStateFromContract; } });
|
|
56
61
|
Object.defineProperty(exports, "deployPoseidonContracts", { enumerable: true, get: function () { return contracts_1.deployPoseidonContracts; } });
|
|
62
|
+
Object.defineProperty(exports, "deployERC20VotesPolicy", { enumerable: true, get: function () { return contracts_1.deployERC20VotesPolicy; } });
|
|
57
63
|
Object.defineProperty(exports, "deployAnonAadhaarPolicy", { enumerable: true, get: function () { return contracts_1.deployAnonAadhaarPolicy; } });
|
|
58
64
|
Object.defineProperty(exports, "deployEASSignUpPolicy", { enumerable: true, get: function () { return contracts_1.deployEASSignUpPolicy; } });
|
|
59
65
|
Object.defineProperty(exports, "deployGitcoinPassportPolicy", { enumerable: true, get: function () { return contracts_1.deployGitcoinPassportPolicy; } });
|
|
@@ -61,8 +67,11 @@ Object.defineProperty(exports, "deployMerkleProofPolicy", { enumerable: true, ge
|
|
|
61
67
|
Object.defineProperty(exports, "deploySemaphoreSignupPolicy", { enumerable: true, get: function () { return contracts_1.deploySemaphoreSignupPolicy; } });
|
|
62
68
|
Object.defineProperty(exports, "deployZupassSignUpPolicy", { enumerable: true, get: function () { return contracts_1.deployZupassSignUpPolicy; } });
|
|
63
69
|
Object.defineProperty(exports, "deployFreeForAllSignUpPolicy", { enumerable: true, get: function () { return contracts_1.deployFreeForAllSignUpPolicy; } });
|
|
70
|
+
Object.defineProperty(exports, "deploySignupTokenPolicy", { enumerable: true, get: function () { return contracts_1.deploySignupTokenPolicy; } });
|
|
71
|
+
Object.defineProperty(exports, "deployHatsSignupPolicy", { enumerable: true, get: function () { return contracts_1.deployHatsSignupPolicy; } });
|
|
64
72
|
Object.defineProperty(exports, "deployContract", { enumerable: true, get: function () { return contracts_1.deployContract; } });
|
|
65
73
|
Object.defineProperty(exports, "deployContractWithLinkedLibraries", { enumerable: true, get: function () { return contracts_1.deployContractWithLinkedLibraries; } });
|
|
74
|
+
Object.defineProperty(exports, "getDeployedPolicyProxyFactories", { enumerable: true, get: function () { return contracts_1.getDeployedPolicyProxyFactories; } });
|
|
66
75
|
Object.defineProperty(exports, "getDefaultSigner", { enumerable: true, get: function () { return contracts_1.getDefaultSigner; } });
|
|
67
76
|
Object.defineProperty(exports, "cleanThreads", { enumerable: true, get: function () { return contracts_1.cleanThreads; } });
|
|
68
77
|
Object.defineProperty(exports, "unlinkFile", { enumerable: true, get: function () { return contracts_1.unlinkFile; } });
|
|
@@ -75,8 +84,6 @@ Object.defineProperty(exports, "info", { enumerable: true, get: function () { re
|
|
|
75
84
|
Object.defineProperty(exports, "success", { enumerable: true, get: function () { return contracts_1.success; } });
|
|
76
85
|
Object.defineProperty(exports, "warning", { enumerable: true, get: function () { return contracts_1.warning; } });
|
|
77
86
|
Object.defineProperty(exports, "error", { enumerable: true, get: function () { return contracts_1.error; } });
|
|
78
|
-
Object.defineProperty(exports, "
|
|
79
|
-
Object.defineProperty(exports, "getProxyContract", { enumerable: true, get: function () { return contracts_1.getProxyContract; } });
|
|
80
|
-
Object.defineProperty(exports, "deployProxyClone", { enumerable: true, get: function () { return contracts_1.deployProxyClone; } });
|
|
87
|
+
Object.defineProperty(exports, "generateEmptyBallotRoots", { enumerable: true, get: function () { return contracts_1.generateEmptyBallotRoots; } });
|
|
81
88
|
__exportStar(require("@maci-protocol/contracts/typechain-types"), exports);
|
|
82
89
|
//# sourceMappingURL=index.js.map
|
package/build/ts/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,yCAAuB;AACvB,4CAA0B;AAC1B,yCAAuB;AACvB,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB;AACxB,yCAAuB;AACvB,0CAAwB;AACxB,yCAAuB;AACvB,2CAAyB;AACzB,6CAA2B;AAC3B,6CAA2B;AAC3B,sDAwDkC;AAvDhC,kGAAA,KAAK,OAAA;AACL,uGAAA,UAAU,OAAA;AACV,8GAAA,iBAAiB,OAAA;AACjB,sGAAA,SAAS,OAAA;AACT,sGAAA,SAAS,OAAA;AACT,6GAAA,gBAAgB,OAAA;AAChB,uHAAA,0BAA0B,OAAA;AAC1B,gIAAA,mCAAmC,OAAA;AACnC,yGAAA,YAAY,OAAA;AACZ,6GAAA,gBAAgB,OAAA;AAChB,qGAAA,QAAQ,OAAA;AACR,uGAAA,UAAU,OAAA;AACV,4GAAA,eAAe,OAAA;AACf,2GAAA,cAAc,OAAA;AACd,uGAAA,UAAU,OAAA;AACV,mGAAA,MAAM,OAAA;AACN,gHAAA,mBAAmB,OAAA;AACnB,oHAAA,uBAAuB,OAAA;AACvB,iHAAA,oBAAoB,OAAA;AACpB,2HAAA,8BAA8B,OAAA;AAC9B,wGAAA,WAAW,OAAA;AACX,kHAAA,qBAAqB,OAAA;AACrB,yIAAA,4CAA4C,OAAA;AAC5C,kIAAA,qCAAqC,OAAA;AACrC,+GAAA,kBAAkB,OAAA;AAClB,wHAAA,2BAA2B,OAAA;AAC3B,2GAAA,cAAc,OAAA;AACd,0HAAA,6BAA6B,OAAA;AAC7B,oHAAA,uBAAuB,OAAA;AACvB,mHAAA,sBAAsB,OAAA;AACtB,oHAAA,uBAAuB,OAAA;AACvB,kHAAA,qBAAqB,OAAA;AACrB,wHAAA,2BAA2B,OAAA;AAC3B,oHAAA,uBAAuB,OAAA;AACvB,wHAAA,2BAA2B,OAAA;AAC3B,qHAAA,wBAAwB,OAAA;AACxB,yHAAA,4BAA4B,OAAA;AAC5B,oHAAA,uBAAuB,OAAA;AACvB,mHAAA,sBAAsB,OAAA;AACtB,2GAAA,cAAc,OAAA;AACd,8HAAA,iCAAiC,OAAA;AACjC,4HAAA,+BAA+B,OAAA;AAC/B,6GAAA,gBAAgB,OAAA;AAChB,yGAAA,YAAY,OAAA;AACZ,uGAAA,UAAU,OAAA;AACV,8GAAA,iBAAiB,OAAA;AACjB,qGAAA,QAAQ,OAAA;AACR,uGAAA,UAAU,OAAA;AACV,mGAAA,MAAM,OAAA;AACN,sGAAA,SAAS,OAAA;AACT,iGAAA,IAAI,OAAA;AACJ,oGAAA,OAAO,OAAA;AACP,oGAAA,OAAO,OAAA;AACP,kGAAA,KAAK,OAAA;AACL,qHAAA,wBAAwB,OAAA;AAgB1B,2EAAyD"}
|
package/build/ts/maci/state.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { IGenerateMaciStateArgs } from "./types";
|
|
|
2
2
|
import type { MaciState } from "@maci-protocol/core";
|
|
3
3
|
/**
|
|
4
4
|
* Generate a local MACI state from the smart contracts events
|
|
5
|
-
* @param args The arguments for the
|
|
5
|
+
* @param args The arguments for the generateLocalState command
|
|
6
6
|
*/
|
|
7
7
|
export declare const generateMaciState: ({ outputPath, pollId, maciAddress, coordinatorPrivateKey, provider, endBlock, startBlock, blockPerBatch, transactionHash, sleep, signer, ipfsMessageBackupFiles, logsOutputPath, }: IGenerateMaciStateArgs) => Promise<MaciState>;
|
|
8
8
|
//# sourceMappingURL=state.d.ts.map
|
package/build/ts/maci/state.js
CHANGED
|
@@ -11,7 +11,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
11
11
|
const contracts_2 = require("../utils/contracts");
|
|
12
12
|
/**
|
|
13
13
|
* Generate a local MACI state from the smart contracts events
|
|
14
|
-
* @param args The arguments for the
|
|
14
|
+
* @param args The arguments for the generateLocalState command
|
|
15
15
|
*/
|
|
16
16
|
const generateMaciState = async ({ outputPath, pollId, maciAddress, coordinatorPrivateKey, provider, endBlock, startBlock, blockPerBatch, transactionHash, sleep, signer, ipfsMessageBackupFiles, logsOutputPath, }) => {
|
|
17
17
|
if (!maciAddress) {
|
|
@@ -22,11 +22,11 @@ const generateMaciState = async ({ outputPath, pollId, maciAddress, coordinatorP
|
|
|
22
22
|
throw new Error("MACI contract does not exist");
|
|
23
23
|
}
|
|
24
24
|
// if no private key is passed we ask it securely
|
|
25
|
-
if (!domainobjs_1.
|
|
25
|
+
if (!domainobjs_1.PrivateKey.isValidSerialized(coordinatorPrivateKey)) {
|
|
26
26
|
throw new Error("Invalid MACI private key");
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
const coordinatorKeypair = new domainobjs_1.Keypair(
|
|
28
|
+
const coordinatorMaciPrivateKey = domainobjs_1.PrivateKey.deserialize(coordinatorPrivateKey);
|
|
29
|
+
const coordinatorKeypair = new domainobjs_1.Keypair(coordinatorMaciPrivateKey);
|
|
30
30
|
const maciContract = contracts_1.MACI__factory.connect(maciAddress, signer);
|
|
31
31
|
const pollContracts = await maciContract.polls(pollId);
|
|
32
32
|
const isPollExists = await (0, contracts_2.contractExists)(signer.provider, pollContracts.poll);
|
|
@@ -34,19 +34,19 @@ const generateMaciState = async ({ outputPath, pollId, maciAddress, coordinatorP
|
|
|
34
34
|
throw new Error("Poll contract does not exist");
|
|
35
35
|
}
|
|
36
36
|
const pollContract = contracts_1.Poll__factory.connect(pollContracts.poll, signer);
|
|
37
|
-
const [defaultStartBlockSignup, defaultStartBlockPoll, stateRoot,
|
|
37
|
+
const [defaultStartBlockSignup, defaultStartBlockPoll, stateRoot, totalSignups] = await Promise.all([
|
|
38
38
|
maciContract.queryFilter(maciContract.filters.SignUp(), startBlock).then((events) => events[0]?.blockNumber ?? 0),
|
|
39
39
|
maciContract
|
|
40
40
|
.queryFilter(maciContract.filters.DeployPoll(), startBlock)
|
|
41
41
|
.then((events) => events[0]?.blockNumber ?? 0),
|
|
42
42
|
maciContract.getStateTreeRoot(),
|
|
43
|
-
maciContract.
|
|
43
|
+
maciContract.totalSignups(),
|
|
44
44
|
]);
|
|
45
45
|
const defaultStartBlock = Math.min(defaultStartBlockPoll, defaultStartBlockSignup);
|
|
46
46
|
let fromBlock = startBlock ? Number(startBlock) : defaultStartBlock;
|
|
47
47
|
const defaultEndBlock = await Promise.all([
|
|
48
48
|
pollContract
|
|
49
|
-
.queryFilter(pollContract.filters.MergeState(stateRoot,
|
|
49
|
+
.queryFilter(pollContract.filters.MergeState(stateRoot, totalSignups), fromBlock)
|
|
50
50
|
.then((events) => events[events.length - 1]?.blockNumber),
|
|
51
51
|
]).then((blocks) => Math.max(...blocks));
|
|
52
52
|
if (transactionHash) {
|
|
@@ -59,7 +59,7 @@ const generateMaciState = async ({ outputPath, pollId, maciAddress, coordinatorP
|
|
|
59
59
|
const tx = await signer.provider.getTransaction(transactionHash);
|
|
60
60
|
fromBlock = tx?.blockNumber ?? defaultStartBlock;
|
|
61
61
|
}
|
|
62
|
-
const maciState = await (0, contracts_1.
|
|
62
|
+
const maciState = await (0, contracts_1.generateMaciStateFromContract)({
|
|
63
63
|
provider: provider ? new ethers_1.JsonRpcProvider(provider) : signer.provider,
|
|
64
64
|
address: maciAddress,
|
|
65
65
|
coordinatorKeypair,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../ts/maci/state.ts"],"names":[],"mappings":";;;;;;AAAA,wDAIkC;AAClC,
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../ts/maci/state.ts"],"names":[],"mappings":";;;;;;AAAA,wDAIkC;AAClC,0DAAgE;AAChE,mCAAyC;AAEzC,4CAAoB;AAKpB,kDAAoD;AAEpD;;;GAGG;AACI,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,UAAU,EACV,MAAM,EACN,WAAW,EACX,qBAAqB,EACrB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,aAAa,EACb,eAAe,EACf,KAAK,EACL,MAAM,EACN,sBAAsB,EACtB,cAAc,GACS,EAAsB,EAAE;IAC/C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,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,iDAAiD;IACjD,IAAI,CAAC,uBAAU,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,yBAAyB,GAAG,uBAAU,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAChF,MAAM,kBAAkB,GAAG,IAAI,oBAAO,CAAC,yBAAyB,CAAC,CAAC;IAElE,MAAM,YAAY,GAAG,yBAAW,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC9D,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,KAA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,CAAC,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AA9FW,QAAA,iBAAiB,qBA8F5B"}
|
package/build/ts/maci/types.d.ts
CHANGED
|
@@ -148,7 +148,7 @@ export interface IMergeSignupsArgs {
|
|
|
148
148
|
numQueueOps?: string;
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
|
-
* Interface for the arguments to the
|
|
151
|
+
* Interface for the arguments to the generateLocalState command
|
|
152
152
|
* Generate a local MACI state from the smart contracts events
|
|
153
153
|
*/
|
|
154
154
|
export interface IGenerateMaciStateArgs {
|
|
@@ -12,13 +12,13 @@ describe("generateKeypair", () => {
|
|
|
12
12
|
// Invoking the same command twice should result in different private keys
|
|
13
13
|
expect(keypair1.privateKey).not.toBe(keypair2.privateKey);
|
|
14
14
|
expect(keypair1.publicKey).not.toBe(keypair2.publicKey);
|
|
15
|
-
expect(domainobjs_1.
|
|
16
|
-
expect(domainobjs_1.
|
|
17
|
-
expect(domainobjs_1.
|
|
18
|
-
expect(domainobjs_1.
|
|
19
|
-
const publicKey2 = (0, crypto_1.
|
|
20
|
-
expect(domainobjs_1.
|
|
21
|
-
expect(domainobjs_1.
|
|
15
|
+
expect(domainobjs_1.PrivateKey.deserialize(keypair1.privateKey)).toBeInstanceOf(domainobjs_1.PrivateKey);
|
|
16
|
+
expect(domainobjs_1.PublicKey.deserialize(keypair1.publicKey)).toBeInstanceOf(domainobjs_1.PublicKey);
|
|
17
|
+
expect(domainobjs_1.PrivateKey.deserialize(keypair2.privateKey)).toBeInstanceOf(domainobjs_1.PrivateKey);
|
|
18
|
+
expect(domainobjs_1.PublicKey.deserialize(keypair2.publicKey)).toBeInstanceOf(domainobjs_1.PublicKey);
|
|
19
|
+
const publicKey2 = (0, crypto_1.generatePublicKey)(domainobjs_1.PrivateKey.deserialize(keypair2.privateKey).raw);
|
|
20
|
+
expect(domainobjs_1.PublicKey.deserialize(keypair2.publicKey).raw[0].toString()).toBe(publicKey2[0].toString());
|
|
21
|
+
expect(domainobjs_1.PublicKey.deserialize(keypair2.publicKey).raw[1].toString()).toBe(publicKey2[1].toString());
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
//# sourceMappingURL=keypair.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keypair.test.js","sourceRoot":"","sources":["../../../../ts/maciKeys/__tests__/keypair.test.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"keypair.test.js","sourceRoot":"","sources":["../../../../ts/maciKeys/__tests__/keypair.test.ts"],"names":[],"mappings":";;AAAA,kDAA0D;AAC1D,0DAAkE;AAElE,wCAA6C;AAE7C,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,QAAQ,GAAG,IAAA,yBAAe,GAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAA,yBAAe,EAAC;YAC/B,IAAI,EAAE,8JAA8J;SACrK,CAAC,CAAC;QAEH,0EAA0E;QAC1E,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC1D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACxD,MAAM,CAAC,uBAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,uBAAU,CAAC,CAAC;QAC/E,MAAM,CAAC,sBAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,sBAAS,CAAC,CAAC;QAC5E,MAAM,CAAC,uBAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,uBAAU,CAAC,CAAC;QAC/E,MAAM,CAAC,sBAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,sBAAS,CAAC,CAAC;QAE5E,MAAM,UAAU,GAAG,IAAA,0BAAiB,EAAC,uBAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC;QACtF,MAAM,CAAC,sBAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnG,MAAM,CAAC,sBAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -7,13 +7,13 @@ const publicKeys_1 = require("../publicKeys");
|
|
|
7
7
|
describe("generateMaciPublicKey", () => {
|
|
8
8
|
test("should output a valid public key", () => {
|
|
9
9
|
const keypair = (0, keypair_1.generateKeypair)();
|
|
10
|
-
const
|
|
11
|
-
expect(
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
expect(
|
|
16
|
-
expect(
|
|
10
|
+
const publicKey = (0, publicKeys_1.generateMaciPublicKey)(keypair.privateKey);
|
|
11
|
+
expect(publicKey).toBe(keypair.publicKey);
|
|
12
|
+
const unserialisedPrivate = domainobjs_1.PrivateKey.deserialize(keypair.privateKey);
|
|
13
|
+
const publicKey2 = (0, crypto_1.generatePublicKey)(unserialisedPrivate.raw);
|
|
14
|
+
const unserializedPublicKey = domainobjs_1.PublicKey.deserialize(keypair.publicKey);
|
|
15
|
+
expect(unserializedPublicKey.raw[0].toString()).toBe(publicKey2[0].toString());
|
|
16
|
+
expect(unserializedPublicKey.raw[1].toString()).toBe(publicKey2[1].toString());
|
|
17
17
|
});
|
|
18
18
|
test("should throw when given an invalid private key", () => {
|
|
19
19
|
expect(() => (0, publicKeys_1.generateMaciPublicKey)("invalid")).toThrow("Invalid private key");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicKeys.test.js","sourceRoot":"","sources":["../../../../ts/maciKeys/__tests__/publicKeys.test.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"publicKeys.test.js","sourceRoot":"","sources":["../../../../ts/maciKeys/__tests__/publicKeys.test.ts"],"names":[],"mappings":";;AAAA,kDAA0D;AAC1D,0DAAkE;AAElE,wCAA6C;AAC7C,8CAAsD;AAEtD,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC5C,MAAM,OAAO,GAAG,IAAA,yBAAe,GAAE,CAAC;QAClC,MAAM,SAAS,GAAG,IAAA,kCAAqB,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE5D,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE1C,MAAM,mBAAmB,GAAG,uBAAU,CAAC,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACvE,MAAM,UAAU,GAAG,IAAA,0BAAiB,EAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAC9D,MAAM,qBAAqB,GAAG,sBAAS,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACvE,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/E,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,gDAAgD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,kCAAqB,EAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keypair.d.ts","sourceRoot":"","sources":["../../../ts/maciKeys/keypair.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,WAAU,oBAAyB,KAAG,
|
|
1
|
+
{"version":3,"file":"keypair.d.ts","sourceRoot":"","sources":["../../../ts/maciKeys/keypair.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,WAAU,oBAAyB,KAAG,oBASrE,CAAC"}
|
|
@@ -10,10 +10,11 @@ const domainobjs_1 = require("@maci-protocol/domainobjs");
|
|
|
10
10
|
*/
|
|
11
11
|
const generateKeypair = ({ seed } = {}) => {
|
|
12
12
|
// create the new random keypair if there is no seed value
|
|
13
|
-
const keypair = new domainobjs_1.Keypair(seed ? new domainobjs_1.
|
|
13
|
+
const keypair = new domainobjs_1.Keypair(seed ? new domainobjs_1.PrivateKey(seed) : undefined);
|
|
14
14
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
publicKeyAsContractParam: keypair.publicKey.asContractParam(),
|
|
16
|
+
publicKey: keypair.publicKey.serialize(),
|
|
17
|
+
privateKey: keypair.privateKey.serialize(),
|
|
17
18
|
};
|
|
18
19
|
};
|
|
19
20
|
exports.generateKeypair = generateKeypair;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keypair.js","sourceRoot":"","sources":["../../../ts/maciKeys/keypair.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"keypair.js","sourceRoot":"","sources":["../../../ts/maciKeys/keypair.ts"],"names":[],"mappings":";;;AAAA,0DAAgE;AAIhE;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,EAAE,IAAI,KAA2B,EAAE,EAAwB,EAAE;IAC3F,0DAA0D;IAC1D,MAAM,OAAO,GAAG,IAAI,oBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,uBAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAErE,OAAO;QACL,wBAAwB,EAAE,OAAO,CAAC,SAAS,CAAC,eAAe,EAAE;QAC7D,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,SAAS,EAAE;QACxC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE;KAC3C,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate a new Maci Public key from a private key
|
|
3
|
-
* @param
|
|
3
|
+
* @param privateKey - the user private key
|
|
4
4
|
* @param quiet - whether to log the output
|
|
5
5
|
* @return the public key serialized
|
|
6
6
|
*/
|
|
7
|
-
export declare const generateMaciPublicKey: (
|
|
7
|
+
export declare const generateMaciPublicKey: (privateKey: string) => string;
|
|
8
8
|
//# sourceMappingURL=publicKeys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicKeys.d.ts","sourceRoot":"","sources":["../../../ts/maciKeys/publicKeys.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,
|
|
1
|
+
{"version":3,"file":"publicKeys.d.ts","sourceRoot":"","sources":["../../../ts/maciKeys/publicKeys.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,YAAY,MAAM,KAAG,MAW1D,CAAC"}
|
|
@@ -5,19 +5,19 @@ const crypto_1 = require("@maci-protocol/crypto");
|
|
|
5
5
|
const domainobjs_1 = require("@maci-protocol/domainobjs");
|
|
6
6
|
/**
|
|
7
7
|
* Generate a new Maci Public key from a private key
|
|
8
|
-
* @param
|
|
8
|
+
* @param privateKey - the user private key
|
|
9
9
|
* @param quiet - whether to log the output
|
|
10
10
|
* @return the public key serialized
|
|
11
11
|
*/
|
|
12
|
-
const generateMaciPublicKey = (
|
|
12
|
+
const generateMaciPublicKey = (privateKey) => {
|
|
13
13
|
// we check that the provided private key is valid
|
|
14
|
-
if (!domainobjs_1.
|
|
14
|
+
if (!domainobjs_1.PrivateKey.isValidSerialized(privateKey)) {
|
|
15
15
|
throw new Error("Invalid private key");
|
|
16
16
|
}
|
|
17
|
-
const unserializedKey = domainobjs_1.
|
|
18
|
-
const
|
|
17
|
+
const unserializedKey = domainobjs_1.PrivateKey.deserialize(privateKey);
|
|
18
|
+
const publicKey = new domainobjs_1.PublicKey((0, crypto_1.generatePublicKey)(unserializedKey.raw));
|
|
19
19
|
// we give back the serialized public key
|
|
20
|
-
return
|
|
20
|
+
return publicKey.serialize();
|
|
21
21
|
};
|
|
22
22
|
exports.generateMaciPublicKey = generateMaciPublicKey;
|
|
23
23
|
//# sourceMappingURL=publicKeys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicKeys.js","sourceRoot":"","sources":["../../../ts/maciKeys/publicKeys.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"publicKeys.js","sourceRoot":"","sources":["../../../ts/maciKeys/publicKeys.ts"],"names":[],"mappings":";;;AAAA,kDAA0D;AAC1D,0DAAkE;AAElE;;;;;GAKG;AACI,MAAM,qBAAqB,GAAG,CAAC,UAAkB,EAAU,EAAE;IAClE,kDAAkD;IAClD,IAAI,CAAC,uBAAU,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,eAAe,GAAG,uBAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,IAAA,0BAAiB,EAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;IAExE,yCAAyC;IACzC,OAAO,SAAS,CAAC,SAAS,EAAE,CAAC;AAC/B,CAAC,CAAC;AAXW,QAAA,qBAAqB,yBAWhC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type IG1ContractParams } from "@maci-protocol/domainobjs";
|
|
1
2
|
/**
|
|
2
3
|
* Interface for the arguments for generate keypair command
|
|
3
4
|
*/
|
|
@@ -11,6 +12,10 @@ export interface IGenerateKeypairArgs {
|
|
|
11
12
|
* Interface for the return data type for generate keypair command
|
|
12
13
|
*/
|
|
13
14
|
export interface IGenerateKeypairData {
|
|
15
|
+
/**
|
|
16
|
+
* Serialized public key as contract parameter
|
|
17
|
+
*/
|
|
18
|
+
publicKeyAsContractParam: IG1ContractParams;
|
|
14
19
|
/**
|
|
15
20
|
* Serialized public key
|
|
16
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/maciKeys/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/maciKeys/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,wBAAwB,EAAE,iBAAiB,CAAC;IAE5C;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../../ts/poll/poll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3F;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAU,2CAA2C,YAAY,KAAG,OAAO,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../../ts/poll/poll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3F;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAU,2CAA2C,YAAY,KAAG,OAAO,CAAC,YAAY,CA+B3G,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAU,0CAIjC,kBAAkB,KAAG,OAAO,CAAC,WAAW,CAwB1C,CAAC"}
|
package/build/ts/poll/poll.js
CHANGED
|
@@ -11,14 +11,14 @@ const getPoll = async ({ maciAddress, signer, provider, pollId }) => {
|
|
|
11
11
|
if (!signer && !provider) {
|
|
12
12
|
throw new Error("No signer and provider are provided");
|
|
13
13
|
}
|
|
14
|
-
const { id, poll: pollContract,
|
|
14
|
+
const { id, poll: pollContract, tally: tallyContract, } = await (0, utils_1.getPollContracts)({ maciAddress, pollId, signer, provider });
|
|
15
15
|
const [[startDate, endDate], mergedStateRoot, pollAddress] = await Promise.all([
|
|
16
16
|
pollContract.getStartAndEndDate(),
|
|
17
17
|
pollContract.mergedStateRoot(),
|
|
18
18
|
pollContract.getAddress(),
|
|
19
19
|
]);
|
|
20
|
-
const isMerged = mergedStateRoot !==
|
|
21
|
-
const
|
|
20
|
+
const isMerged = mergedStateRoot !== 0n;
|
|
21
|
+
const totalSignups = await pollContract.totalSignups();
|
|
22
22
|
// get the poll mode
|
|
23
23
|
const mode = await tallyContract.mode();
|
|
24
24
|
return {
|
|
@@ -26,7 +26,7 @@ const getPoll = async ({ maciAddress, signer, provider, pollId }) => {
|
|
|
26
26
|
address: pollAddress,
|
|
27
27
|
startDate,
|
|
28
28
|
endDate,
|
|
29
|
-
|
|
29
|
+
totalSignups,
|
|
30
30
|
isMerged,
|
|
31
31
|
mode,
|
|
32
32
|
};
|
|
@@ -46,16 +46,16 @@ const getPollParams = async ({ pollId, signer, maciContractAddress, }) => {
|
|
|
46
46
|
});
|
|
47
47
|
const treeDepths = await pollContract.treeDepths();
|
|
48
48
|
const voteOptionTreeDepth = Number(treeDepths.voteOptionTreeDepth);
|
|
49
|
-
const
|
|
49
|
+
const totalVoteOptions = 5 ** voteOptionTreeDepth;
|
|
50
50
|
const messageBatchSize = Number.parseInt((await pollContract.messageBatchSize()).toString(), 10);
|
|
51
|
-
const
|
|
52
|
-
const tallyBatchSize = 5 **
|
|
51
|
+
const tallyProcessingStateTreeDepth = Number(treeDepths.tallyProcessingStateTreeDepth);
|
|
52
|
+
const tallyBatchSize = 5 ** tallyProcessingStateTreeDepth;
|
|
53
53
|
return {
|
|
54
54
|
messageBatchSize,
|
|
55
|
-
|
|
55
|
+
totalVoteOptions,
|
|
56
56
|
tallyBatchSize,
|
|
57
57
|
voteOptionTreeDepth,
|
|
58
|
-
|
|
58
|
+
tallyProcessingStateTreeDepth,
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
exports.getPollParams = getPollParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll.js","sourceRoot":"","sources":["../../../ts/poll/poll.ts"],"names":[],"mappings":";;;AAEA,mCAA2C;AAE3C;;;;GAIG;AACI,MAAM,OAAO,GAAG,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAgB,EAAyB,EAAE;IAC9G,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,EACJ,EAAE,EACF,IAAI,EAAE,YAAY,EAClB,
|
|
1
|
+
{"version":3,"file":"poll.js","sourceRoot":"","sources":["../../../ts/poll/poll.ts"],"names":[],"mappings":";;;AAEA,mCAA2C;AAE3C;;;;GAIG;AACI,MAAM,OAAO,GAAG,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAgB,EAAyB,EAAE;IAC9G,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,EACJ,EAAE,EACF,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,aAAa,GACrB,GAAG,MAAM,IAAA,wBAAgB,EAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEtE,MAAM,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,eAAe,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC7E,YAAY,CAAC,kBAAkB,EAAE;QACjC,YAAY,CAAC,eAAe,EAAE;QAC9B,YA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B"}
|
package/build/ts/poll/types.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface IGetPollData {
|
|
|
69
69
|
/**
|
|
70
70
|
* The poll number of signups
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
totalSignups: BigNumberish;
|
|
73
73
|
/**
|
|
74
74
|
* Whether the MACI contract's state root has been merged
|
|
75
75
|
*/
|
|
@@ -107,7 +107,7 @@ export interface IPollParams {
|
|
|
107
107
|
/**
|
|
108
108
|
* The number of vote options
|
|
109
109
|
*/
|
|
110
|
-
|
|
110
|
+
totalVoteOptions: number;
|
|
111
111
|
/**
|
|
112
112
|
* Tally Batch Size
|
|
113
113
|
*/
|
|
@@ -119,14 +119,14 @@ export interface IPollParams {
|
|
|
119
119
|
/**
|
|
120
120
|
* The depth of the tree holding the user ballots
|
|
121
121
|
*/
|
|
122
|
-
|
|
122
|
+
tallyProcessingStateTreeDepth: number;
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Inputs for circuit PollJoining
|
|
126
126
|
*/
|
|
127
127
|
export interface IPollJoiningInputs {
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
privateKey: bigint;
|
|
129
|
+
pollPublicKey: bigint[][];
|
|
130
130
|
stateLeaf: bigint[];
|
|
131
131
|
siblings: bigint[][];
|
|
132
132
|
indices: bigint[];
|
|
@@ -140,7 +140,7 @@ export interface IPollJoiningInputs {
|
|
|
140
140
|
* Inputs for circuit PollJoined
|
|
141
141
|
*/
|
|
142
142
|
export interface IPollJoinedInputs {
|
|
143
|
-
|
|
143
|
+
privateKey: bigint;
|
|
144
144
|
voiceCreditsBalance: bigint;
|
|
145
145
|
stateLeaf: bigint[];
|
|
146
146
|
pathElements: bigint[][];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/poll/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,I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AAE,CAAC;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -6,8 +6,8 @@ const download_1 = require("../download");
|
|
|
6
6
|
* The inputs for the proof generation
|
|
7
7
|
*/
|
|
8
8
|
const inputs = {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
privateKey: "1259082279488355278660453796037744749156697484507442909424227073450806091599",
|
|
10
|
+
pollPublicKey: [
|
|
11
11
|
"4604149953291977424931588219098726306922992659857425248363017596008978179462",
|
|
12
12
|
"1911350329545195833133079763781611226710101140694516439580176096139978229522",
|
|
13
13
|
],
|
|
@@ -23,7 +23,7 @@ const inputs = {
|
|
|
23
23
|
["0"],
|
|
24
24
|
["0"],
|
|
25
25
|
],
|
|
26
|
-
|
|
26
|
+
index: 1,
|
|
27
27
|
nullifier: "5960968591926285526739882209300764345427591192846309606519433839944864771425",
|
|
28
28
|
stateRoot: "19853258600018552129206808764461795697997153860385513081821578400505176714352",
|
|
29
29
|
actualStateTreeDepth: "1",
|
|
@@ -31,10 +31,13 @@ const inputs = {
|
|
|
31
31
|
};
|
|
32
32
|
describe("downloadPollJoiningArtifactsBrowser", () => {
|
|
33
33
|
it("should allow to generate a proof using the downloaded artifacts", async () => {
|
|
34
|
-
const { zKey, wasm } = await (0, download_1.downloadPollJoiningArtifactsBrowser)(
|
|
34
|
+
const { zKey, wasm } = await (0, download_1.downloadPollJoiningArtifactsBrowser)({
|
|
35
|
+
testing: true,
|
|
36
|
+
stateTreeDepth: 10,
|
|
37
|
+
});
|
|
35
38
|
expect(zKey).toBeDefined();
|
|
36
39
|
expect(wasm).toBeDefined();
|
|
37
|
-
const { proof } = await (0, contracts_1.
|
|
40
|
+
const { proof } = await (0, contracts_1.generateProofSnarkjs)({
|
|
38
41
|
inputs: inputs,
|
|
39
42
|
zkeyPath: zKey,
|
|
40
43
|
wasmPath: wasm,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.test.js","sourceRoot":"","sources":["../../../../ts/proof/__tests__/download.test.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"download.test.js","sourceRoot":"","sources":["../../../../ts/proof/__tests__/download.test.ts"],"names":[],"mappings":";;AAAA,wDAAgE;AAGhE,0CAAkE;AAElE;;GAEG;AACH,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,8EAA8E;IAC1F,aAAa,EAAE;QACb,8EAA8E;QAC9E,8EAA8E;KAC/E;IACD,QAAQ,EAAE;QACR,CAAC,8EAA8E,CAAC;QAChF,CAAC,GAAG,CAAC;QACL,CAAC,GAAG,CAAC;QACL,CAAC,GAAG,CAAC;QACL,CAAC,GAAG,CAAC;QACL,CAAC,GAAG,CAAC;QACL,CAAC,GAAG,CAAC;QACL,CAAC,GAAG,CAAC;QACL,CAAC,GAAG,CAAC;QACL,CAAC,GAAG,CAAC;KACN;IACD,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,8EAA8E;IACzF,SAAS,EAAE,+EAA+E;IAC1F,oBAAoB,EAAE,GAAG;IACzB,MAAM,EAAE,GAAG;CACZ,CAAC;AAEF,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,EAAE,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;QAC/E,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,8CAAmC,EAAC;YAC/D,OAAO,EAAE,IAAI;YACb,cAAc,EAAE,EAAE;SACnB,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QAE3B,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAA,gCAAoB,EAAC;YAC3C,MAAM,EAAE,MAAmC;YAC3C,QAAQ,EAAE,IAAyB;YACnC,QAAQ,EAAE,IAAyB;SACpC,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5B,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { IPollJoiningArtifacts } from "./types";
|
|
1
|
+
import type { IDownloadPollJoiningArtifactsBrowserArgs, IPollJoiningArtifacts } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Download the poll joining artifacts for the browser
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
5
|
+
* @param args - The arguments to download the poll joining artifacts for the browser
|
|
6
6
|
* @returns The poll joining artifacts
|
|
7
7
|
*/
|
|
8
|
-
export declare const downloadPollJoiningArtifactsBrowser: (testing
|
|
8
|
+
export declare const downloadPollJoiningArtifactsBrowser: ({ testing, stateTreeDepth, }: IDownloadPollJoiningArtifactsBrowserArgs) => Promise<IPollJoiningArtifacts>;
|
|
9
9
|
//# sourceMappingURL=download.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../ts/proof/download.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../ts/proof/download.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wCAAwC,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAuC/F;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,GAAU,8BAGvD,wCAAwC,KAAG,OAAO,CAAC,qBAAqB,CAe1E,CAAC"}
|