@dorafactory/maci-sdk 0.0.41 → 0.0.51
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/README.md +5 -1
- package/dist/index.js +233 -147
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +232 -146
- package/dist/index.mjs.map +1 -1
- package/dist/libs/crypto/keys.d.ts +3 -3
- package/dist/libs/maci/maci.d.ts +37 -2
- package/dist/maci.d.ts +38 -3
- package/package.json +3 -1
- package/src/libs/contract/ts/Maci.types.ts +1 -1
- package/src/libs/contract/ts/OracleMaci.types.ts +1 -1
- package/src/libs/crypto/babyjub.ts +22 -13
- package/src/libs/crypto/keys.ts +6 -4
- package/src/libs/errors/index.ts +5 -1
- package/src/libs/maci/maci.ts +212 -141
- package/src/maci.ts +69 -5
- package/src/utils/index.ts +2 -4
package/README.md
CHANGED
|
@@ -217,10 +217,12 @@ const voteResponse = await client.maci.vote({
|
|
|
217
217
|
**Voting Rules:**
|
|
218
218
|
|
|
219
219
|
MACI supports two voting rules:
|
|
220
|
+
|
|
220
221
|
1. 1P1V (One Person One Vote): Each voting weight (vc) directly counts as votes
|
|
221
222
|
2. QV (Quadratic Voting): The sum of squares of voting weights (vc) is consumed as total voting power
|
|
222
223
|
|
|
223
224
|
Vote options format:
|
|
225
|
+
|
|
224
226
|
```typescript
|
|
225
227
|
selectedOptions: [
|
|
226
228
|
{ idx: number, vc: number }, // idx: option index, vc: voting weight
|
|
@@ -229,13 +231,14 @@ selectedOptions: [
|
|
|
229
231
|
```
|
|
230
232
|
|
|
231
233
|
Examples:
|
|
234
|
+
|
|
232
235
|
```typescript
|
|
233
236
|
// 1P1V mode example (total voting power: 4)
|
|
234
237
|
const options1p1v = [
|
|
235
238
|
{ idx: 0, vc: 2 }, // 2 votes for option 0
|
|
236
239
|
{ idx: 1, vc: 1 }, // 1 vote for option 1
|
|
237
240
|
{ idx: 4, vc: 1 }, // 1 vote for option 4
|
|
238
|
-
];
|
|
241
|
+
];
|
|
239
242
|
// Total voting power consumed = 2 + 1 + 1 = 4
|
|
240
243
|
|
|
241
244
|
// QV mode example (total voting power: 6)
|
|
@@ -248,6 +251,7 @@ const optionsQv = [
|
|
|
248
251
|
```
|
|
249
252
|
|
|
250
253
|
**Important Notes:**
|
|
254
|
+
|
|
251
255
|
- Option indices (idx) must be unique
|
|
252
256
|
- Voting weights (vc) must be positive integers
|
|
253
257
|
- In QV mode, total voting power consumed is the sum of squares of voting weights
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ __export(index_exports, {
|
|
|
51
51
|
bigInt2Buffer: () => bigInt2Buffer,
|
|
52
52
|
circuits: () => circuits,
|
|
53
53
|
formatPrivKeyForBabyJub: () => formatPrivKeyForBabyJub,
|
|
54
|
-
|
|
54
|
+
genAddKeyInput: () => genAddKeyInput,
|
|
55
55
|
genEcdhSharedKey: () => genEcdhSharedKey,
|
|
56
56
|
genKeypair: () => genKeypair,
|
|
57
57
|
genKeypairFromSign: () => genKeypairFromSign,
|
|
@@ -534,7 +534,7 @@ var Circuit = class {
|
|
|
534
534
|
var import_bech32 = require("bech32");
|
|
535
535
|
|
|
536
536
|
// src/libs/crypto/keys.ts
|
|
537
|
-
var
|
|
537
|
+
var import_crypto_js2 = __toESM(require("crypto-js"));
|
|
538
538
|
|
|
539
539
|
// src/libs/crypto/bigintUtils.ts
|
|
540
540
|
var stringizing = (o, path = []) => {
|
|
@@ -572,7 +572,7 @@ var import_eddsa_poseidon2 = require("@zk-kit/eddsa-poseidon");
|
|
|
572
572
|
|
|
573
573
|
// src/libs/crypto/babyjub.ts
|
|
574
574
|
var import_assert2 = __toESM(require("assert"));
|
|
575
|
-
var
|
|
575
|
+
var import_crypto_js = __toESM(require("crypto-js"));
|
|
576
576
|
|
|
577
577
|
// src/libs/crypto/constants.ts
|
|
578
578
|
var import_baby_jubjub = require("@zk-kit/baby-jubjub");
|
|
@@ -664,10 +664,14 @@ var G2Point = class {
|
|
|
664
664
|
}
|
|
665
665
|
};
|
|
666
666
|
var genRandomBabyJubValue = () => {
|
|
667
|
-
const min = BigInt(
|
|
667
|
+
const min = BigInt(
|
|
668
|
+
"6350874878119819312338956282401532410528162663560392320966563075034087161851"
|
|
669
|
+
);
|
|
668
670
|
let privKey = SNARK_FIELD_SIZE;
|
|
669
671
|
do {
|
|
670
|
-
const rand = BigInt(
|
|
672
|
+
const rand = BigInt(
|
|
673
|
+
`0x${import_crypto_js.default.lib.WordArray.random(32).toString(import_crypto_js.default.enc.Hex)}`
|
|
674
|
+
);
|
|
671
675
|
if (rand >= min) {
|
|
672
676
|
privKey = rand % SNARK_FIELD_SIZE;
|
|
673
677
|
}
|
|
@@ -896,7 +900,7 @@ var tree_default = Tree;
|
|
|
896
900
|
|
|
897
901
|
// src/libs/crypto/keys.ts
|
|
898
902
|
var SNARK_FIELD_SIZE2 = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
|
|
899
|
-
var genPrivKey = () => BigInt(`0x${
|
|
903
|
+
var genPrivKey = () => BigInt(`0x${import_crypto_js2.default.lib.WordArray.random(32).toString(import_crypto_js2.default.enc.Hex)}`);
|
|
900
904
|
var genRandomSalt = () => genRandomBabyJubValue();
|
|
901
905
|
var formatPrivKeyForBabyJub = (privKey) => BigInt((0, import_eddsa_poseidon.deriveSecretScalar)(bigInt2Buffer(privKey)));
|
|
902
906
|
var packPubKey = (pubKey) => BigInt((0, import_eddsa_poseidon2.packPublicKey)(pubKey));
|
|
@@ -918,7 +922,9 @@ var genKeypair = (pkey) => {
|
|
|
918
922
|
var genEcdhSharedKey = (privKey, pubKey) => (0, import_baby_jubjub2.mulPointEscalar)(pubKey, formatPrivKeyForBabyJub(privKey));
|
|
919
923
|
var genMessageFactory = (stateIdx, signPriKey, signPubKey, coordPubKey) => (encPriKey, nonce, voIdx, newVotes, isLastCmd, salt) => {
|
|
920
924
|
if (!salt) {
|
|
921
|
-
salt = BigInt(
|
|
925
|
+
salt = BigInt(
|
|
926
|
+
`0x${import_crypto_js2.default.lib.WordArray.random(7).toString(import_crypto_js2.default.enc.Hex)}`
|
|
927
|
+
);
|
|
922
928
|
}
|
|
923
929
|
const packaged = BigInt(nonce) + (BigInt(stateIdx) << 32n) + (BigInt(voIdx) << 64n) + (BigInt(newVotes) << 96n) + (BigInt(salt) << 192n);
|
|
924
930
|
let newPubKey = [...signPubKey];
|
|
@@ -989,7 +995,7 @@ var rerandomize = (pubKey, ciphertext, randomVal = genRandomSalt()) => {
|
|
|
989
995
|
d2
|
|
990
996
|
};
|
|
991
997
|
};
|
|
992
|
-
var
|
|
998
|
+
var genAddKeyInput = (depth, {
|
|
993
999
|
coordPubKey,
|
|
994
1000
|
oldKey,
|
|
995
1001
|
deactivates
|
|
@@ -5215,31 +5221,39 @@ var MACI = class {
|
|
|
5215
5221
|
signer,
|
|
5216
5222
|
address,
|
|
5217
5223
|
contractAddress,
|
|
5218
|
-
certificate
|
|
5219
|
-
mode = "maci"
|
|
5224
|
+
certificate
|
|
5220
5225
|
}) {
|
|
5221
5226
|
if (!address) {
|
|
5222
5227
|
address = (await signer.getAccounts())[0].address;
|
|
5223
5228
|
}
|
|
5224
|
-
|
|
5229
|
+
const round = await this.indexer.getRoundWithFields(contractAddress, [
|
|
5230
|
+
"maciType",
|
|
5231
|
+
"voiceCreditAmount"
|
|
5232
|
+
]);
|
|
5233
|
+
if (isErrorResponse(round)) {
|
|
5234
|
+
throw new Error(
|
|
5235
|
+
`Failed to get round info: ${round.error.type} ${round.error.message}`
|
|
5236
|
+
);
|
|
5237
|
+
}
|
|
5238
|
+
if (round.data.round.maciType === "aMACI") {
|
|
5225
5239
|
const isWhiteListed = await this.isWhitelisted({
|
|
5226
5240
|
signer,
|
|
5227
5241
|
address,
|
|
5228
5242
|
contractAddress
|
|
5229
5243
|
});
|
|
5230
5244
|
if (isWhiteListed) {
|
|
5231
|
-
const
|
|
5245
|
+
const round2 = await this.indexer.getRoundWithFields(contractAddress, [
|
|
5232
5246
|
"voiceCreditAmount"
|
|
5233
5247
|
]);
|
|
5234
|
-
if (!isErrorResponse(
|
|
5235
|
-
if (
|
|
5236
|
-
return
|
|
5248
|
+
if (!isErrorResponse(round2)) {
|
|
5249
|
+
if (round2.data.round.voiceCreditAmount) {
|
|
5250
|
+
return round2.data.round.voiceCreditAmount;
|
|
5237
5251
|
} else {
|
|
5238
5252
|
return "0";
|
|
5239
5253
|
}
|
|
5240
5254
|
} else {
|
|
5241
5255
|
throw new Error(
|
|
5242
|
-
`Failed to query amaci voice credit: ${
|
|
5256
|
+
`Failed to query amaci voice credit: ${round2.error.type} ${round2.error.message}`
|
|
5243
5257
|
);
|
|
5244
5258
|
}
|
|
5245
5259
|
} else {
|
|
@@ -5499,11 +5513,47 @@ var MACI = class {
|
|
|
5499
5513
|
throw new Error("State index is not set, Please signup first");
|
|
5500
5514
|
}
|
|
5501
5515
|
try {
|
|
5502
|
-
const
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5516
|
+
const round = await this.indexer.getRoundWithFields(contractAddress, [
|
|
5517
|
+
"maciType",
|
|
5518
|
+
"voiceCreditAmount"
|
|
5519
|
+
]);
|
|
5520
|
+
if (isErrorResponse(round)) {
|
|
5521
|
+
throw new Error(
|
|
5522
|
+
`Failed to get round info: ${round.error.type} ${round.error.message}`
|
|
5523
|
+
);
|
|
5524
|
+
}
|
|
5525
|
+
let voiceCreditBalance;
|
|
5526
|
+
if (round.data.round.maciType === "aMACI") {
|
|
5527
|
+
const isWhiteListed = await this.isWhitelisted({
|
|
5528
|
+
signer,
|
|
5529
|
+
address,
|
|
5530
|
+
contractAddress
|
|
5531
|
+
});
|
|
5532
|
+
if (isWhiteListed) {
|
|
5533
|
+
const round2 = await this.indexer.getRoundWithFields(contractAddress, [
|
|
5534
|
+
"voiceCreditAmount"
|
|
5535
|
+
]);
|
|
5536
|
+
if (!isErrorResponse(round2)) {
|
|
5537
|
+
if (round2.data.round.voiceCreditAmount) {
|
|
5538
|
+
voiceCreditBalance = round2.data.round.voiceCreditAmount;
|
|
5539
|
+
} else {
|
|
5540
|
+
voiceCreditBalance = "0";
|
|
5541
|
+
}
|
|
5542
|
+
} else {
|
|
5543
|
+
throw new Error(
|
|
5544
|
+
`Failed to query amaci voice credit: ${round2.error.type} ${round2.error.message}`
|
|
5545
|
+
);
|
|
5546
|
+
}
|
|
5547
|
+
} else {
|
|
5548
|
+
voiceCreditBalance = "0";
|
|
5549
|
+
}
|
|
5550
|
+
} else {
|
|
5551
|
+
voiceCreditBalance = await this.getVoiceCreditBalance({
|
|
5552
|
+
signer,
|
|
5553
|
+
stateIdx,
|
|
5554
|
+
contractAddress
|
|
5555
|
+
});
|
|
5556
|
+
}
|
|
5507
5557
|
const options = await this.processVoteOptions({
|
|
5508
5558
|
selectedOptions,
|
|
5509
5559
|
contractAddress,
|
|
@@ -5636,28 +5686,6 @@ var MACI = class {
|
|
|
5636
5686
|
}) {
|
|
5637
5687
|
const gasPrice = import_stargate2.GasPrice.fromString("100000000000peaka");
|
|
5638
5688
|
fee = fee || (0, import_stargate2.calculateFee)(6e7, gasPrice);
|
|
5639
|
-
if (gasStation === true) {
|
|
5640
|
-
const grantFee = {
|
|
5641
|
-
amount: fee.amount,
|
|
5642
|
-
gas: fee.gas,
|
|
5643
|
-
granter: contractAddress
|
|
5644
|
-
};
|
|
5645
|
-
return client.execute(
|
|
5646
|
-
address,
|
|
5647
|
-
contractAddress,
|
|
5648
|
-
{
|
|
5649
|
-
sign_up: {
|
|
5650
|
-
pubkey: {
|
|
5651
|
-
x: pubKey[0].toString(),
|
|
5652
|
-
y: pubKey[1].toString()
|
|
5653
|
-
},
|
|
5654
|
-
amount: oracleCertificate.amount,
|
|
5655
|
-
certificate: oracleCertificate.signature
|
|
5656
|
-
}
|
|
5657
|
-
},
|
|
5658
|
-
grantFee
|
|
5659
|
-
);
|
|
5660
|
-
}
|
|
5661
5689
|
return client.execute(
|
|
5662
5690
|
address,
|
|
5663
5691
|
contractAddress,
|
|
@@ -5671,112 +5699,127 @@ var MACI = class {
|
|
|
5671
5699
|
certificate: oracleCertificate.signature
|
|
5672
5700
|
}
|
|
5673
5701
|
},
|
|
5674
|
-
|
|
5702
|
+
gasStation === true ? {
|
|
5703
|
+
amount: fee.amount,
|
|
5704
|
+
gas: fee.gas,
|
|
5705
|
+
granter: contractAddress
|
|
5706
|
+
} : fee
|
|
5675
5707
|
);
|
|
5676
5708
|
}
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
// );
|
|
5738
|
-
// } catch (error) {
|
|
5739
|
-
// throw Error(`Submit deactivate failed! ${error}`);
|
|
5740
|
-
// }
|
|
5741
|
-
// }
|
|
5709
|
+
async deactivate({
|
|
5710
|
+
signer,
|
|
5711
|
+
address,
|
|
5712
|
+
maciKeypair,
|
|
5713
|
+
contractAddress,
|
|
5714
|
+
gasStation,
|
|
5715
|
+
fee
|
|
5716
|
+
}) {
|
|
5717
|
+
try {
|
|
5718
|
+
address = address || (await signer.getAccounts())[0].address;
|
|
5719
|
+
if (maciKeypair === void 0) {
|
|
5720
|
+
maciKeypair = this.maciKeypair;
|
|
5721
|
+
}
|
|
5722
|
+
const client = await this.contract.contractClient({
|
|
5723
|
+
signer
|
|
5724
|
+
});
|
|
5725
|
+
const stateIdx = await this.getStateIdxInc({
|
|
5726
|
+
signer,
|
|
5727
|
+
address,
|
|
5728
|
+
contractAddress
|
|
5729
|
+
});
|
|
5730
|
+
const operatorCoordPubKey = await this.getRoundInfo({
|
|
5731
|
+
contractAddress
|
|
5732
|
+
});
|
|
5733
|
+
const payload = batchGenMessage(
|
|
5734
|
+
Number(stateIdx),
|
|
5735
|
+
maciKeypair,
|
|
5736
|
+
[
|
|
5737
|
+
BigInt(operatorCoordPubKey.coordinatorPubkeyX),
|
|
5738
|
+
BigInt(operatorCoordPubKey.coordinatorPubkeyY)
|
|
5739
|
+
],
|
|
5740
|
+
[[0, 0]]
|
|
5741
|
+
);
|
|
5742
|
+
const { msg, encPubkeys } = payload[0];
|
|
5743
|
+
const gasPrice = import_stargate2.GasPrice.fromString("100000000000peaka");
|
|
5744
|
+
fee = fee || (0, import_stargate2.calculateFee)(2e7, gasPrice);
|
|
5745
|
+
return client.execute(
|
|
5746
|
+
address,
|
|
5747
|
+
contractAddress,
|
|
5748
|
+
stringizing({
|
|
5749
|
+
publish_deactivate_message: {
|
|
5750
|
+
enc_pub_key: {
|
|
5751
|
+
x: encPubkeys[0],
|
|
5752
|
+
y: encPubkeys[1]
|
|
5753
|
+
},
|
|
5754
|
+
message: {
|
|
5755
|
+
data: msg
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
}),
|
|
5759
|
+
gasStation === true ? {
|
|
5760
|
+
amount: fee.amount,
|
|
5761
|
+
gas: fee.gas,
|
|
5762
|
+
granter: contractAddress
|
|
5763
|
+
} : fee
|
|
5764
|
+
);
|
|
5765
|
+
} catch (error) {
|
|
5766
|
+
throw Error(`Submit deactivate failed! ${error}`);
|
|
5767
|
+
}
|
|
5768
|
+
}
|
|
5742
5769
|
async fetchAllDeactivateLogs({
|
|
5743
5770
|
contractAddress
|
|
5744
5771
|
}) {
|
|
5745
5772
|
const deactivates = await this.indexer.fetchAllDeactivateLogs(contractAddress);
|
|
5746
5773
|
return deactivates;
|
|
5747
5774
|
}
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5775
|
+
async genAddKeyInput({
|
|
5776
|
+
maciKeypair,
|
|
5777
|
+
contractAddress
|
|
5778
|
+
}) {
|
|
5779
|
+
const deactivates = await this.fetchAllDeactivateLogs({
|
|
5780
|
+
contractAddress
|
|
5781
|
+
});
|
|
5782
|
+
const roundInfo = await this.getRoundInfo({
|
|
5783
|
+
contractAddress
|
|
5784
|
+
});
|
|
5785
|
+
const circuitPower = roundInfo.circuitPower;
|
|
5786
|
+
const stateTreeDepth = Number(circuitPower.split("-")[0]);
|
|
5787
|
+
const inputObj = genAddKeyInput(stateTreeDepth + 2, {
|
|
5788
|
+
coordPubKey: [
|
|
5789
|
+
BigInt(roundInfo.coordinatorPubkeyX),
|
|
5790
|
+
BigInt(roundInfo.coordinatorPubkeyY)
|
|
5791
|
+
],
|
|
5792
|
+
oldKey: maciKeypair,
|
|
5793
|
+
deactivates: deactivates.map((d) => d.map(BigInt))
|
|
5794
|
+
});
|
|
5795
|
+
return inputObj;
|
|
5796
|
+
}
|
|
5797
|
+
async addNewKey({
|
|
5798
|
+
signer,
|
|
5799
|
+
contractAddress,
|
|
5800
|
+
d,
|
|
5801
|
+
proof,
|
|
5802
|
+
nullifier,
|
|
5803
|
+
newMaciKeypair,
|
|
5804
|
+
fee = "auto"
|
|
5805
|
+
}) {
|
|
5806
|
+
const client = await this.contract.amaciClient({
|
|
5807
|
+
signer,
|
|
5808
|
+
contractAddress
|
|
5809
|
+
});
|
|
5810
|
+
return await client.addNewKey(
|
|
5811
|
+
{
|
|
5812
|
+
d,
|
|
5813
|
+
groth16Proof: proof,
|
|
5814
|
+
nullifier: nullifier.toString(),
|
|
5815
|
+
pubkey: {
|
|
5816
|
+
x: newMaciKeypair.pubKey[0].toString(),
|
|
5817
|
+
y: newMaciKeypair.pubKey[1].toString()
|
|
5818
|
+
}
|
|
5819
|
+
},
|
|
5820
|
+
fee
|
|
5821
|
+
);
|
|
5822
|
+
}
|
|
5780
5823
|
async claimAMaciRound({
|
|
5781
5824
|
signer,
|
|
5782
5825
|
contractAddress,
|
|
@@ -6094,7 +6137,7 @@ var MaciClient2 = class {
|
|
|
6094
6137
|
}) {
|
|
6095
6138
|
return await this.maci.getStateIdxByPubKey({
|
|
6096
6139
|
contractAddress,
|
|
6097
|
-
pubKey
|
|
6140
|
+
pubKey: pubKey || this.maciKeypair.pubKey
|
|
6098
6141
|
});
|
|
6099
6142
|
}
|
|
6100
6143
|
async feegrantAllowance({
|
|
@@ -6123,8 +6166,7 @@ var MaciClient2 = class {
|
|
|
6123
6166
|
signer,
|
|
6124
6167
|
address,
|
|
6125
6168
|
contractAddress,
|
|
6126
|
-
certificate
|
|
6127
|
-
mode = "maci"
|
|
6169
|
+
certificate
|
|
6128
6170
|
}) {
|
|
6129
6171
|
signer = this.getSigner(signer);
|
|
6130
6172
|
if (!address) {
|
|
@@ -6134,8 +6176,7 @@ var MaciClient2 = class {
|
|
|
6134
6176
|
signer,
|
|
6135
6177
|
address,
|
|
6136
6178
|
contractAddress,
|
|
6137
|
-
certificate
|
|
6138
|
-
mode
|
|
6179
|
+
certificate
|
|
6139
6180
|
});
|
|
6140
6181
|
}
|
|
6141
6182
|
async isWhitelisted({
|
|
@@ -6252,6 +6293,51 @@ var MaciClient2 = class {
|
|
|
6252
6293
|
gasStation
|
|
6253
6294
|
});
|
|
6254
6295
|
}
|
|
6296
|
+
async deactivate({
|
|
6297
|
+
signer,
|
|
6298
|
+
address,
|
|
6299
|
+
contractAddress,
|
|
6300
|
+
gasStation = false,
|
|
6301
|
+
maciKeypair,
|
|
6302
|
+
fee
|
|
6303
|
+
}) {
|
|
6304
|
+
return await this.maci.deactivate({
|
|
6305
|
+
signer: this.getSigner(signer),
|
|
6306
|
+
address,
|
|
6307
|
+
maciKeypair,
|
|
6308
|
+
contractAddress,
|
|
6309
|
+
gasStation,
|
|
6310
|
+
fee
|
|
6311
|
+
});
|
|
6312
|
+
}
|
|
6313
|
+
async genAddKeyInput({
|
|
6314
|
+
contractAddress,
|
|
6315
|
+
maciKeypair
|
|
6316
|
+
}) {
|
|
6317
|
+
return await this.maci.genAddKeyInput({
|
|
6318
|
+
maciKeypair: maciKeypair || this.maciKeypair,
|
|
6319
|
+
contractAddress
|
|
6320
|
+
});
|
|
6321
|
+
}
|
|
6322
|
+
async addNewKey({
|
|
6323
|
+
signer,
|
|
6324
|
+
contractAddress,
|
|
6325
|
+
d,
|
|
6326
|
+
proof,
|
|
6327
|
+
nullifier,
|
|
6328
|
+
newMaciKeypair,
|
|
6329
|
+
fee = "auto"
|
|
6330
|
+
}) {
|
|
6331
|
+
return await this.maci.addNewKey({
|
|
6332
|
+
signer: this.getSigner(signer),
|
|
6333
|
+
contractAddress,
|
|
6334
|
+
d,
|
|
6335
|
+
proof,
|
|
6336
|
+
nullifier,
|
|
6337
|
+
newMaciKeypair,
|
|
6338
|
+
fee
|
|
6339
|
+
});
|
|
6340
|
+
}
|
|
6255
6341
|
async claimAMaciRound({
|
|
6256
6342
|
signer,
|
|
6257
6343
|
contractAddress,
|
|
@@ -6324,7 +6410,7 @@ var MaciClient2 = class {
|
|
|
6324
6410
|
bigInt2Buffer,
|
|
6325
6411
|
circuits,
|
|
6326
6412
|
formatPrivKeyForBabyJub,
|
|
6327
|
-
|
|
6413
|
+
genAddKeyInput,
|
|
6328
6414
|
genEcdhSharedKey,
|
|
6329
6415
|
genKeypair,
|
|
6330
6416
|
genKeypairFromSign,
|