@dorafactory/maci-sdk 0.0.36 → 0.0.38
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/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -1
- package/dist/index.mjs.map +1 -1
- package/dist/libs/contract/index.d.ts +1 -0
- package/dist/libs/contract/utils.d.ts +0 -5
- package/dist/maci.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/libs/contract/index.ts +1 -0
- package/src/libs/contract/utils.ts +0 -24
- package/src/maci.ts +8 -2
- package/src/types/index.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -66,6 +66,9 @@ __export(index_exports, {
|
|
|
66
66
|
genPubKey: () => genPubKey,
|
|
67
67
|
genRandomBabyJubValue: () => genRandomBabyJubValue,
|
|
68
68
|
genRandomSalt: () => genRandomSalt,
|
|
69
|
+
getAMaciRoundCircuitFee: () => getAMaciRoundCircuitFee,
|
|
70
|
+
getCircuitType: () => getCircuitType,
|
|
71
|
+
getContractParams: () => getContractParams,
|
|
69
72
|
getDefaultParams: () => getDefaultParams,
|
|
70
73
|
hash12: () => hash12,
|
|
71
74
|
hash2: () => hash2,
|
|
@@ -4131,6 +4134,22 @@ var QTR_LIB = {
|
|
|
4131
4134
|
};
|
|
4132
4135
|
|
|
4133
4136
|
// src/libs/contract/utils.ts
|
|
4137
|
+
function getCircuitType(circuitType) {
|
|
4138
|
+
let maciVoteType = null;
|
|
4139
|
+
switch (circuitType) {
|
|
4140
|
+
case "0" /* IP1V */:
|
|
4141
|
+
maciVoteType = "0";
|
|
4142
|
+
break;
|
|
4143
|
+
case "1" /* QV */:
|
|
4144
|
+
maciVoteType = "1";
|
|
4145
|
+
break;
|
|
4146
|
+
default:
|
|
4147
|
+
throw new Error(
|
|
4148
|
+
`Invalid circuit type ${circuitType}, only support 1P1V and QV`
|
|
4149
|
+
);
|
|
4150
|
+
}
|
|
4151
|
+
return maciVoteType;
|
|
4152
|
+
}
|
|
4134
4153
|
function getContractParams(type, circuitType, proofSystem, maxVoter, maxOption) {
|
|
4135
4154
|
let parameters;
|
|
4136
4155
|
let groth16ProcessVkey = null;
|
|
@@ -5894,7 +5913,13 @@ var MaciClient2 = class {
|
|
|
5894
5913
|
});
|
|
5895
5914
|
}
|
|
5896
5915
|
getSigner(signer) {
|
|
5897
|
-
|
|
5916
|
+
if (signer) {
|
|
5917
|
+
return signer;
|
|
5918
|
+
}
|
|
5919
|
+
if (this.signer) {
|
|
5920
|
+
return this.signer;
|
|
5921
|
+
}
|
|
5922
|
+
throw new Error("No signer provided, please provide a signer");
|
|
5898
5923
|
}
|
|
5899
5924
|
getMaciKeypair() {
|
|
5900
5925
|
return this.maciKeypair;
|
|
@@ -6237,6 +6262,9 @@ var MaciClient2 = class {
|
|
|
6237
6262
|
genPubKey,
|
|
6238
6263
|
genRandomBabyJubValue,
|
|
6239
6264
|
genRandomSalt,
|
|
6265
|
+
getAMaciRoundCircuitFee,
|
|
6266
|
+
getCircuitType,
|
|
6267
|
+
getContractParams,
|
|
6240
6268
|
getDefaultParams,
|
|
6241
6269
|
hash12,
|
|
6242
6270
|
hash2,
|