@dorafactory/maci-sdk 0.1.2-pre.9 → 0.1.3-pre.1

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 CHANGED
@@ -427,16 +427,15 @@ function getDefaultParams(network = "mainnet") {
427
427
  apiEndpoint: "https://vota-api.dorafactory.org",
428
428
  certificateApiEndpoint: "https://vota-certificate-api.dorafactory.org/api/v1",
429
429
  registryAddress: "dora1smg5qp5trjdkcekdjssqpjehdjf6n4cjss0clyvqcud3t3u3948s8rmgg4",
430
- saasAddress: "dora1dgnszrwnwxgr5djprrr6w4q45z8s3ghsew869g6tlp4ruqah39nqnemjya",
430
+ saasAddress: "dora1ksxvvve2nsw5uyvg7y6lnnxcqxadjepc78z0qa8enm5zhayxaqgqpsewf8",
431
+ apiSaasAddress: "dora1ksxvvve2nsw5uyvg7y6lnnxcqxadjepc78z0qa8enm5zhayxaqgqpsewf8",
431
432
  maciCodeId: 106,
432
433
  // oracleCodeId: 116,// 9-4-3-625
433
434
  oracleCodeId: 119,
434
435
  // 6-3-3-125
435
- saasCodeId: 152,
436
436
  oracleWhitelistBackendPubkey: "A61YtCv2ibMZmDeM02nEElil8wlHx1tLKogBk5dPgf/Q",
437
437
  oracleFeegrantOperator: "dora16s9tljk8dy9ae335yvyzlm8gvkypx9228q8pq8",
438
- oracleCodeIds: ["101", "116", "117", "119"],
439
- saasCodeIds: ["152"]
438
+ oracleCodeIds: ["101", "116", "117", "119"]
440
439
  };
441
440
  case "testnet":
442
441
  return {
@@ -448,15 +447,14 @@ function getDefaultParams(network = "mainnet") {
448
447
  certificateApiEndpoint: "https://vota-testnet-certificate-api.dorafactory.org/api/v1",
449
448
  registryAddress: "dora13c8aecstyxrhax9znvvh5zey89edrmd2k5va57pxvpe3fxtfsfeqlhsjnd",
450
449
  saasAddress: "dora1dgnszrwnwxgr5djprrr6w4q45z8s3ghsew869g6tlp4ruqah39nqnemjya",
450
+ apiSaasAddress: "dora16xj2yrh3snq8f2qvma9uzjd5m2qgvzaqjcqmeuweh73t29c4rhusxm9hq6",
451
451
  maciCodeId: 134,
452
452
  // oracleCodeId: 113, // 9-4-3-625
453
453
  oracleCodeId: 123,
454
454
  // 6-3-3-125
455
- saasCodeId: 152,
456
455
  oracleWhitelistBackendPubkey: "AoYo/zENN/JquagPdG0/NMbWBBYxOM8BVN677mBXJKJQ",
457
456
  oracleFeegrantOperator: "dora1xp0twdzsdeq4qg3c64v66552deax8zmvq4zw78",
458
- oracleCodeIds: ["102", "105", "108", "110", "113", "115", "123"],
459
- saasCodeIds: ["152"]
457
+ oracleCodeIds: ["102", "105", "108", "110", "113", "115", "123"]
460
458
  };
461
459
  }
462
460
  }
@@ -4567,106 +4565,595 @@ var SaasClient = class extends SaasQueryClient {
4567
4565
  }
4568
4566
  };
4569
4567
 
4570
- // src/libs/contract/config.ts
4571
- var defaultSigningClientOptions = {
4572
- broadcastPollIntervalMs: 8e3,
4573
- broadcastTimeoutMs: 64e3,
4574
- gasPrice: import_stargate.GasPrice.fromString("10000000000peaka")
4568
+ // src/libs/contract/ts/ApiMaci.client.ts
4569
+ var ApiMaciQueryClient = class {
4570
+ constructor(client, contractAddress) {
4571
+ this.getRoundInfo = async () => {
4572
+ return this.client.queryContractSmart(this.contractAddress, {
4573
+ get_round_info: {}
4574
+ });
4575
+ };
4576
+ this.getVotingTime = async () => {
4577
+ return this.client.queryContractSmart(this.contractAddress, {
4578
+ get_voting_time: {}
4579
+ });
4580
+ };
4581
+ this.getPeriod = async () => {
4582
+ return this.client.queryContractSmart(this.contractAddress, {
4583
+ get_period: {}
4584
+ });
4585
+ };
4586
+ this.getNumSignUp = async () => {
4587
+ return this.client.queryContractSmart(this.contractAddress, {
4588
+ get_num_sign_up: {}
4589
+ });
4590
+ };
4591
+ this.getMsgChainLength = async () => {
4592
+ return this.client.queryContractSmart(this.contractAddress, {
4593
+ get_msg_chain_length: {}
4594
+ });
4595
+ };
4596
+ this.getProcessedMsgCount = async () => {
4597
+ return this.client.queryContractSmart(this.contractAddress, {
4598
+ get_processed_msg_count: {}
4599
+ });
4600
+ };
4601
+ this.getProcessedUserCount = async () => {
4602
+ return this.client.queryContractSmart(this.contractAddress, {
4603
+ get_processed_user_count: {}
4604
+ });
4605
+ };
4606
+ this.getResult = async ({
4607
+ index
4608
+ }) => {
4609
+ return this.client.queryContractSmart(this.contractAddress, {
4610
+ get_result: {
4611
+ index
4612
+ }
4613
+ });
4614
+ };
4615
+ this.getAllResult = async () => {
4616
+ return this.client.queryContractSmart(this.contractAddress, {
4617
+ get_all_result: {}
4618
+ });
4619
+ };
4620
+ this.getStateIdxInc = async ({
4621
+ address
4622
+ }) => {
4623
+ return this.client.queryContractSmart(this.contractAddress, {
4624
+ get_state_idx_inc: {
4625
+ address
4626
+ }
4627
+ });
4628
+ };
4629
+ this.getVoiceCreditBalance = async ({
4630
+ index
4631
+ }) => {
4632
+ return this.client.queryContractSmart(this.contractAddress, {
4633
+ get_voice_credit_balance: {
4634
+ index
4635
+ }
4636
+ });
4637
+ };
4638
+ this.isWhiteList = async ({
4639
+ amount,
4640
+ certificate,
4641
+ pubkey
4642
+ }) => {
4643
+ return this.client.queryContractSmart(this.contractAddress, {
4644
+ is_white_list: {
4645
+ amount,
4646
+ certificate,
4647
+ pubkey
4648
+ }
4649
+ });
4650
+ };
4651
+ this.whiteBalanceOf = async ({
4652
+ amount,
4653
+ certificate,
4654
+ pubkey
4655
+ }) => {
4656
+ return this.client.queryContractSmart(this.contractAddress, {
4657
+ white_balance_of: {
4658
+ amount,
4659
+ certificate,
4660
+ pubkey
4661
+ }
4662
+ });
4663
+ };
4664
+ this.whiteInfo = async ({
4665
+ pubkey
4666
+ }) => {
4667
+ return this.client.queryContractSmart(this.contractAddress, {
4668
+ white_info: {
4669
+ pubkey
4670
+ }
4671
+ });
4672
+ };
4673
+ this.maxWhitelistNum = async () => {
4674
+ return this.client.queryContractSmart(this.contractAddress, {
4675
+ max_whitelist_num: {}
4676
+ });
4677
+ };
4678
+ this.voteOptionMap = async () => {
4679
+ return this.client.queryContractSmart(this.contractAddress, {
4680
+ vote_option_map: {}
4681
+ });
4682
+ };
4683
+ this.maxVoteOptions = async () => {
4684
+ return this.client.queryContractSmart(this.contractAddress, {
4685
+ max_vote_options: {}
4686
+ });
4687
+ };
4688
+ this.queryTotalFeeGrant = async () => {
4689
+ return this.client.queryContractSmart(this.contractAddress, {
4690
+ query_total_fee_grant: {}
4691
+ });
4692
+ };
4693
+ this.queryCircuitType = async () => {
4694
+ return this.client.queryContractSmart(this.contractAddress, {
4695
+ query_circuit_type: {}
4696
+ });
4697
+ };
4698
+ this.queryCertSystem = async () => {
4699
+ return this.client.queryContractSmart(this.contractAddress, {
4700
+ query_cert_system: {}
4701
+ });
4702
+ };
4703
+ this.queryOracleWhitelistConfig = async () => {
4704
+ return this.client.queryContractSmart(this.contractAddress, {
4705
+ query_oracle_whitelist_config: {}
4706
+ });
4707
+ };
4708
+ this.client = client;
4709
+ this.contractAddress = contractAddress;
4710
+ this.getRoundInfo = this.getRoundInfo.bind(this);
4711
+ this.getVotingTime = this.getVotingTime.bind(this);
4712
+ this.getPeriod = this.getPeriod.bind(this);
4713
+ this.getNumSignUp = this.getNumSignUp.bind(this);
4714
+ this.getMsgChainLength = this.getMsgChainLength.bind(this);
4715
+ this.getProcessedMsgCount = this.getProcessedMsgCount.bind(this);
4716
+ this.getProcessedUserCount = this.getProcessedUserCount.bind(this);
4717
+ this.getResult = this.getResult.bind(this);
4718
+ this.getAllResult = this.getAllResult.bind(this);
4719
+ this.getStateIdxInc = this.getStateIdxInc.bind(this);
4720
+ this.getVoiceCreditBalance = this.getVoiceCreditBalance.bind(this);
4721
+ this.isWhiteList = this.isWhiteList.bind(this);
4722
+ this.whiteBalanceOf = this.whiteBalanceOf.bind(this);
4723
+ this.whiteInfo = this.whiteInfo.bind(this);
4724
+ this.maxWhitelistNum = this.maxWhitelistNum.bind(this);
4725
+ this.voteOptionMap = this.voteOptionMap.bind(this);
4726
+ this.maxVoteOptions = this.maxVoteOptions.bind(this);
4727
+ this.queryTotalFeeGrant = this.queryTotalFeeGrant.bind(this);
4728
+ this.queryCircuitType = this.queryCircuitType.bind(this);
4729
+ this.queryCertSystem = this.queryCertSystem.bind(this);
4730
+ this.queryOracleWhitelistConfig = this.queryOracleWhitelistConfig.bind(this);
4731
+ }
4575
4732
  };
4576
- async function createMaciClientBy({
4577
- rpcEndpoint,
4578
- wallet,
4579
- contractAddress
4580
- }) {
4581
- const signingCosmWasmClient = await createContractClientByWallet(
4582
- rpcEndpoint,
4583
- wallet
4584
- );
4585
- const [{ address }] = await wallet.getAccounts();
4586
- return new MaciClient(signingCosmWasmClient, address, contractAddress);
4587
- }
4588
- async function createAMaciClientBy({
4589
- rpcEndpoint,
4590
- wallet,
4591
- contractAddress
4592
- }) {
4593
- const signingCosmWasmClient = await createContractClientByWallet(
4594
- rpcEndpoint,
4595
- wallet
4596
- );
4597
- const [{ address }] = await wallet.getAccounts();
4598
- return new AMaciClient(signingCosmWasmClient, address, contractAddress);
4599
- }
4600
- async function createRegistryClientBy({
4601
- rpcEndpoint,
4602
- wallet,
4603
- contractAddress
4604
- }) {
4605
- const signingCosmWasmClient = await createContractClientByWallet(
4606
- rpcEndpoint,
4607
- wallet
4608
- );
4609
- const [{ address }] = await wallet.getAccounts();
4610
- return new RegistryClient(signingCosmWasmClient, address, contractAddress);
4611
- }
4612
- async function createSaasClientBy({
4613
- rpcEndpoint,
4614
- wallet,
4615
- contractAddress
4616
- }) {
4617
- const signingCosmWasmClient = await createContractClientByWallet(
4618
- rpcEndpoint,
4619
- wallet
4620
- );
4621
- const [{ address }] = await wallet.getAccounts();
4622
- return new SaasClient(signingCosmWasmClient, address, contractAddress);
4623
- }
4624
- async function createOracleMaciClientBy({
4625
- rpcEndpoint,
4626
- wallet,
4627
- contractAddress
4628
- }) {
4629
- const signingCosmWasmClient = await createContractClientByWallet(
4630
- rpcEndpoint,
4631
- wallet
4632
- );
4633
- const [{ address }] = await wallet.getAccounts();
4634
- return new OracleMaciClient(signingCosmWasmClient, address, contractAddress);
4635
- }
4636
- async function createContractClientByWallet(rpcEndpoint, wallet) {
4637
- const client = await import_cosmwasm_stargate.SigningCosmWasmClient.connectWithSigner(
4638
- rpcEndpoint,
4639
- wallet,
4640
- {
4641
- ...defaultSigningClientOptions
4642
- }
4643
- );
4644
- return client;
4645
- }
4646
-
4647
- // src/types/index.ts
4648
- var MaciCircuitType = /* @__PURE__ */ ((MaciCircuitType2) => {
4649
- MaciCircuitType2["IP1V"] = "0";
4650
- MaciCircuitType2["QV"] = "1";
4651
- return MaciCircuitType2;
4652
- })(MaciCircuitType || {});
4653
- var MaciCertSystemType = /* @__PURE__ */ ((MaciCertSystemType2) => {
4654
- MaciCertSystemType2["GROTH16"] = "groth16";
4655
- MaciCertSystemType2["PLONK"] = "plonk";
4656
- return MaciCertSystemType2;
4657
- })(MaciCertSystemType || {});
4658
- var MaciRoundType = /* @__PURE__ */ ((MaciRoundType2) => {
4659
- MaciRoundType2["MACI"] = "0";
4660
- MaciRoundType2["AMACI"] = "1";
4661
- MaciRoundType2["ORACLE_MACI"] = "2";
4662
- return MaciRoundType2;
4663
- })(MaciRoundType || {});
4664
-
4665
- // src/libs/contract/vars.ts
4666
- var CIRCUIT_INFO = {
4667
- "2-1-1-5": {
4668
- parameter: {
4669
- state_tree_depth: "2",
4733
+ var ApiMaciClient = class extends ApiMaciQueryClient {
4734
+ constructor(client, sender, contractAddress) {
4735
+ super(client, contractAddress);
4736
+ this.setRoundInfo = async ({
4737
+ roundInfo
4738
+ }, fee = "auto", memo, _funds) => {
4739
+ return await this.client.execute(this.sender, this.contractAddress, {
4740
+ set_round_info: {
4741
+ round_info: roundInfo
4742
+ }
4743
+ }, fee, memo, _funds);
4744
+ };
4745
+ this.setVoteOptionsMap = async ({
4746
+ voteOptionMap
4747
+ }, fee = "auto", memo, _funds) => {
4748
+ return await this.client.execute(this.sender, this.contractAddress, {
4749
+ set_vote_options_map: {
4750
+ vote_option_map: voteOptionMap
4751
+ }
4752
+ }, fee, memo, _funds);
4753
+ };
4754
+ this.signUp = async ({
4755
+ amount,
4756
+ certificate,
4757
+ pubkey
4758
+ }, fee = "auto", memo, _funds) => {
4759
+ return await this.client.execute(this.sender, this.contractAddress, {
4760
+ sign_up: {
4761
+ amount,
4762
+ certificate,
4763
+ pubkey
4764
+ }
4765
+ }, fee, memo, _funds);
4766
+ };
4767
+ this.startProcessPeriod = async (fee = "auto", memo, _funds) => {
4768
+ return await this.client.execute(this.sender, this.contractAddress, {
4769
+ start_process_period: {}
4770
+ }, fee, memo, _funds);
4771
+ };
4772
+ this.publishMessage = async ({
4773
+ encPubKey,
4774
+ message
4775
+ }, fee = "auto", memo, _funds) => {
4776
+ return await this.client.execute(this.sender, this.contractAddress, {
4777
+ publish_message: {
4778
+ enc_pub_key: encPubKey,
4779
+ message
4780
+ }
4781
+ }, fee, memo, _funds);
4782
+ };
4783
+ this.processMessage = async ({
4784
+ groth16Proof,
4785
+ newStateCommitment,
4786
+ plonkProof
4787
+ }, fee = "auto", memo, _funds) => {
4788
+ return await this.client.execute(this.sender, this.contractAddress, {
4789
+ process_message: {
4790
+ groth16_proof: groth16Proof,
4791
+ new_state_commitment: newStateCommitment,
4792
+ plonk_proof: plonkProof
4793
+ }
4794
+ }, fee, memo, _funds);
4795
+ };
4796
+ this.stopProcessingPeriod = async (fee = "auto", memo, _funds) => {
4797
+ return await this.client.execute(this.sender, this.contractAddress, {
4798
+ stop_processing_period: {}
4799
+ }, fee, memo, _funds);
4800
+ };
4801
+ this.processTally = async ({
4802
+ groth16Proof,
4803
+ newTallyCommitment,
4804
+ plonkProof
4805
+ }, fee = "auto", memo, _funds) => {
4806
+ return await this.client.execute(this.sender, this.contractAddress, {
4807
+ process_tally: {
4808
+ groth16_proof: groth16Proof,
4809
+ new_tally_commitment: newTallyCommitment,
4810
+ plonk_proof: plonkProof
4811
+ }
4812
+ }, fee, memo, _funds);
4813
+ };
4814
+ this.stopTallyingPeriod = async ({
4815
+ results,
4816
+ salt
4817
+ }, fee = "auto", memo, _funds) => {
4818
+ return await this.client.execute(this.sender, this.contractAddress, {
4819
+ stop_tallying_period: {
4820
+ results,
4821
+ salt
4822
+ }
4823
+ }, fee, memo, _funds);
4824
+ };
4825
+ this.bond = async (fee = "auto", memo, _funds) => {
4826
+ return await this.client.execute(this.sender, this.contractAddress, {
4827
+ bond: {}
4828
+ }, fee, memo, _funds);
4829
+ };
4830
+ this.withdraw = async ({
4831
+ amount
4832
+ }, fee = "auto", memo, _funds) => {
4833
+ return await this.client.execute(this.sender, this.contractAddress, {
4834
+ withdraw: {
4835
+ amount
4836
+ }
4837
+ }, fee, memo, _funds);
4838
+ };
4839
+ this.client = client;
4840
+ this.sender = sender;
4841
+ this.contractAddress = contractAddress;
4842
+ this.setRoundInfo = this.setRoundInfo.bind(this);
4843
+ this.setVoteOptionsMap = this.setVoteOptionsMap.bind(this);
4844
+ this.signUp = this.signUp.bind(this);
4845
+ this.startProcessPeriod = this.startProcessPeriod.bind(this);
4846
+ this.publishMessage = this.publishMessage.bind(this);
4847
+ this.processMessage = this.processMessage.bind(this);
4848
+ this.stopProcessingPeriod = this.stopProcessingPeriod.bind(this);
4849
+ this.processTally = this.processTally.bind(this);
4850
+ this.stopTallyingPeriod = this.stopTallyingPeriod.bind(this);
4851
+ this.bond = this.bond.bind(this);
4852
+ this.withdraw = this.withdraw.bind(this);
4853
+ }
4854
+ };
4855
+
4856
+ // src/libs/contract/ts/ApiSaas.client.ts
4857
+ var ApiSaasQueryClient = class {
4858
+ constructor(client, contractAddress) {
4859
+ this.config = async () => {
4860
+ return this.client.queryContractSmart(this.contractAddress, {
4861
+ config: {}
4862
+ });
4863
+ };
4864
+ this.operators = async () => {
4865
+ return this.client.queryContractSmart(this.contractAddress, {
4866
+ operators: {}
4867
+ });
4868
+ };
4869
+ this.isOperator = async ({
4870
+ address
4871
+ }) => {
4872
+ return this.client.queryContractSmart(this.contractAddress, {
4873
+ is_operator: {
4874
+ address
4875
+ }
4876
+ });
4877
+ };
4878
+ this.balance = async () => {
4879
+ return this.client.queryContractSmart(this.contractAddress, {
4880
+ balance: {}
4881
+ });
4882
+ };
4883
+ this.maciCodeId = async () => {
4884
+ return this.client.queryContractSmart(this.contractAddress, {
4885
+ maci_code_id: {}
4886
+ });
4887
+ };
4888
+ this.treasuryManager = async () => {
4889
+ return this.client.queryContractSmart(this.contractAddress, {
4890
+ treasury_manager: {}
4891
+ });
4892
+ };
4893
+ this.client = client;
4894
+ this.contractAddress = contractAddress;
4895
+ this.config = this.config.bind(this);
4896
+ this.operators = this.operators.bind(this);
4897
+ this.isOperator = this.isOperator.bind(this);
4898
+ this.balance = this.balance.bind(this);
4899
+ this.maciCodeId = this.maciCodeId.bind(this);
4900
+ this.treasuryManager = this.treasuryManager.bind(this);
4901
+ }
4902
+ };
4903
+ var ApiSaasClient = class extends ApiSaasQueryClient {
4904
+ constructor(client, sender, contractAddress) {
4905
+ super(client, contractAddress);
4906
+ this.updateConfig = async ({
4907
+ admin,
4908
+ denom
4909
+ }, fee = "auto", memo, _funds) => {
4910
+ return await this.client.execute(this.sender, this.contractAddress, {
4911
+ update_config: {
4912
+ admin,
4913
+ denom
4914
+ }
4915
+ }, fee, memo, _funds);
4916
+ };
4917
+ this.updateMaciCodeId = async ({
4918
+ codeId
4919
+ }, fee = "auto", memo, _funds) => {
4920
+ return await this.client.execute(this.sender, this.contractAddress, {
4921
+ update_maci_code_id: {
4922
+ code_id: codeId
4923
+ }
4924
+ }, fee, memo, _funds);
4925
+ };
4926
+ this.updateAmaciRegistryContract = async ({
4927
+ registryContract
4928
+ }, fee = "auto", memo, _funds) => {
4929
+ return await this.client.execute(this.sender, this.contractAddress, {
4930
+ update_amaci_registry_contract: {
4931
+ registry_contract: registryContract
4932
+ }
4933
+ }, fee, memo, _funds);
4934
+ };
4935
+ this.addOperator = async ({
4936
+ operator
4937
+ }, fee = "auto", memo, _funds) => {
4938
+ return await this.client.execute(this.sender, this.contractAddress, {
4939
+ add_operator: {
4940
+ operator
4941
+ }
4942
+ }, fee, memo, _funds);
4943
+ };
4944
+ this.removeOperator = async ({
4945
+ operator
4946
+ }, fee = "auto", memo, _funds) => {
4947
+ return await this.client.execute(this.sender, this.contractAddress, {
4948
+ remove_operator: {
4949
+ operator
4950
+ }
4951
+ }, fee, memo, _funds);
4952
+ };
4953
+ this.deposit = async (fee = "auto", memo, _funds) => {
4954
+ return await this.client.execute(this.sender, this.contractAddress, {
4955
+ deposit: {}
4956
+ }, fee, memo, _funds);
4957
+ };
4958
+ this.withdraw = async ({
4959
+ amount,
4960
+ recipient
4961
+ }, fee = "auto", memo, _funds) => {
4962
+ return await this.client.execute(this.sender, this.contractAddress, {
4963
+ withdraw: {
4964
+ amount,
4965
+ recipient
4966
+ }
4967
+ }, fee, memo, _funds);
4968
+ };
4969
+ this.createApiMaciRound = async ({
4970
+ certificationSystem,
4971
+ circuitType,
4972
+ coordinator,
4973
+ endTime,
4974
+ maxVoters,
4975
+ roundInfo,
4976
+ startTime,
4977
+ voteOptionMap,
4978
+ whitelistBackendPubkey
4979
+ }, fee = "auto", memo, _funds) => {
4980
+ return await this.client.execute(this.sender, this.contractAddress, {
4981
+ create_api_maci_round: {
4982
+ certification_system: certificationSystem,
4983
+ circuit_type: circuitType,
4984
+ coordinator,
4985
+ end_time: endTime,
4986
+ max_voters: maxVoters,
4987
+ round_info: roundInfo,
4988
+ start_time: startTime,
4989
+ vote_option_map: voteOptionMap,
4990
+ whitelist_backend_pubkey: whitelistBackendPubkey
4991
+ }
4992
+ }, fee, memo, _funds);
4993
+ };
4994
+ this.setRoundInfo = async ({
4995
+ contractAddr,
4996
+ roundInfo
4997
+ }, fee = "auto", memo, _funds) => {
4998
+ return await this.client.execute(this.sender, this.contractAddress, {
4999
+ set_round_info: {
5000
+ contract_addr: contractAddr,
5001
+ round_info: roundInfo
5002
+ }
5003
+ }, fee, memo, _funds);
5004
+ };
5005
+ this.setVoteOptionsMap = async ({
5006
+ contractAddr,
5007
+ voteOptionMap
5008
+ }, fee = "auto", memo, _funds) => {
5009
+ return await this.client.execute(this.sender, this.contractAddress, {
5010
+ set_vote_options_map: {
5011
+ contract_addr: contractAddr,
5012
+ vote_option_map: voteOptionMap
5013
+ }
5014
+ }, fee, memo, _funds);
5015
+ };
5016
+ this.client = client;
5017
+ this.sender = sender;
5018
+ this.contractAddress = contractAddress;
5019
+ this.updateConfig = this.updateConfig.bind(this);
5020
+ this.updateMaciCodeId = this.updateMaciCodeId.bind(this);
5021
+ this.updateAmaciRegistryContract = this.updateAmaciRegistryContract.bind(this);
5022
+ this.addOperator = this.addOperator.bind(this);
5023
+ this.removeOperator = this.removeOperator.bind(this);
5024
+ this.deposit = this.deposit.bind(this);
5025
+ this.withdraw = this.withdraw.bind(this);
5026
+ this.createApiMaciRound = this.createApiMaciRound.bind(this);
5027
+ this.setRoundInfo = this.setRoundInfo.bind(this);
5028
+ this.setVoteOptionsMap = this.setVoteOptionsMap.bind(this);
5029
+ }
5030
+ };
5031
+
5032
+ // src/libs/contract/config.ts
5033
+ var defaultSigningClientOptions = {
5034
+ broadcastPollIntervalMs: 8e3,
5035
+ broadcastTimeoutMs: 15e4,
5036
+ // 2min30s for the tx to be confirmed
5037
+ gasPrice: import_stargate.GasPrice.fromString("10000000000peaka")
5038
+ };
5039
+ async function createMaciClientBy({
5040
+ rpcEndpoint,
5041
+ wallet,
5042
+ contractAddress
5043
+ }) {
5044
+ const signingCosmWasmClient = await createContractClientByWallet(
5045
+ rpcEndpoint,
5046
+ wallet
5047
+ );
5048
+ const [{ address }] = await wallet.getAccounts();
5049
+ return new MaciClient(signingCosmWasmClient, address, contractAddress);
5050
+ }
5051
+ async function createAMaciClientBy({
5052
+ rpcEndpoint,
5053
+ wallet,
5054
+ contractAddress
5055
+ }) {
5056
+ const signingCosmWasmClient = await createContractClientByWallet(
5057
+ rpcEndpoint,
5058
+ wallet
5059
+ );
5060
+ const [{ address }] = await wallet.getAccounts();
5061
+ return new AMaciClient(signingCosmWasmClient, address, contractAddress);
5062
+ }
5063
+ async function createApiMaciClientBy({
5064
+ rpcEndpoint,
5065
+ wallet,
5066
+ contractAddress
5067
+ }) {
5068
+ const signingCosmWasmClient = await createContractClientByWallet(
5069
+ rpcEndpoint,
5070
+ wallet
5071
+ );
5072
+ const [{ address }] = await wallet.getAccounts();
5073
+ return new ApiMaciClient(signingCosmWasmClient, address, contractAddress);
5074
+ }
5075
+ async function createRegistryClientBy({
5076
+ rpcEndpoint,
5077
+ wallet,
5078
+ contractAddress
5079
+ }) {
5080
+ const signingCosmWasmClient = await createContractClientByWallet(
5081
+ rpcEndpoint,
5082
+ wallet
5083
+ );
5084
+ const [{ address }] = await wallet.getAccounts();
5085
+ return new RegistryClient(signingCosmWasmClient, address, contractAddress);
5086
+ }
5087
+ async function createSaasClientBy({
5088
+ rpcEndpoint,
5089
+ wallet,
5090
+ contractAddress
5091
+ }) {
5092
+ const signingCosmWasmClient = await createContractClientByWallet(
5093
+ rpcEndpoint,
5094
+ wallet
5095
+ );
5096
+ const [{ address }] = await wallet.getAccounts();
5097
+ return new SaasClient(signingCosmWasmClient, address, contractAddress);
5098
+ }
5099
+ async function createApiSaasClientBy({
5100
+ rpcEndpoint,
5101
+ wallet,
5102
+ contractAddress
5103
+ }) {
5104
+ const signingCosmWasmClient = await createContractClientByWallet(
5105
+ rpcEndpoint,
5106
+ wallet
5107
+ );
5108
+ const [{ address }] = await wallet.getAccounts();
5109
+ return new ApiSaasClient(signingCosmWasmClient, address, contractAddress);
5110
+ }
5111
+ async function createOracleMaciClientBy({
5112
+ rpcEndpoint,
5113
+ wallet,
5114
+ contractAddress
5115
+ }) {
5116
+ const signingCosmWasmClient = await createContractClientByWallet(
5117
+ rpcEndpoint,
5118
+ wallet
5119
+ );
5120
+ const [{ address }] = await wallet.getAccounts();
5121
+ return new OracleMaciClient(signingCosmWasmClient, address, contractAddress);
5122
+ }
5123
+ async function createContractClientByWallet(rpcEndpoint, wallet) {
5124
+ const client = await import_cosmwasm_stargate.SigningCosmWasmClient.connectWithSigner(
5125
+ rpcEndpoint,
5126
+ wallet,
5127
+ {
5128
+ ...defaultSigningClientOptions
5129
+ }
5130
+ );
5131
+ return client;
5132
+ }
5133
+
5134
+ // src/types/index.ts
5135
+ var MaciCircuitType = /* @__PURE__ */ ((MaciCircuitType2) => {
5136
+ MaciCircuitType2["IP1V"] = "0";
5137
+ MaciCircuitType2["QV"] = "1";
5138
+ return MaciCircuitType2;
5139
+ })(MaciCircuitType || {});
5140
+ var MaciCertSystemType = /* @__PURE__ */ ((MaciCertSystemType2) => {
5141
+ MaciCertSystemType2["GROTH16"] = "groth16";
5142
+ MaciCertSystemType2["PLONK"] = "plonk";
5143
+ return MaciCertSystemType2;
5144
+ })(MaciCertSystemType || {});
5145
+ var MaciRoundType = /* @__PURE__ */ ((MaciRoundType2) => {
5146
+ MaciRoundType2["MACI"] = "0";
5147
+ MaciRoundType2["AMACI"] = "1";
5148
+ MaciRoundType2["ORACLE_MACI"] = "2";
5149
+ return MaciRoundType2;
5150
+ })(MaciRoundType || {});
5151
+
5152
+ // src/libs/contract/vars.ts
5153
+ var CIRCUIT_INFO = {
5154
+ "2-1-1-5": {
5155
+ parameter: {
5156
+ state_tree_depth: "2",
4670
5157
  int_state_tree_depth: "1",
4671
5158
  vote_option_tree_depth: "1",
4672
5159
  message_batch_size: "5"
@@ -4676,668 +5163,1336 @@ var CIRCUIT_INFO = {
4676
5163
  vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4677
5164
  vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4678
5165
  vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4679
- vk_delta_2: "2178a9c3805dd82071b2b28bb4c0ffc8178cad913c8c990b98b4863284dc3a5d175c0be554fc060c27c551e5e32effef015b918a0f5a2dc1b92909b8272719301c521d5f6542db5ea4775a42d32159c356a696599c1a3df011ec00559ae1c2b60d860f7e6513a7d20feaeaca401863e35a0f691dd7d30ce06d07946840de1ec8",
4680
- vk_ic0: "19126a54a9b6d0d415f892c246485cb2889487cf9c4a8cd88dab5e1140e1d0630d1d76ef4652df8887c9dc557aa57f25e221db7e5b2e4cf618a362bece107f5c",
4681
- vk_ic1: "0632e625fefc7172e8aec1070c4d32b90b6c482f6f3806773a4c55a03877c2d716cfd935eb3e3883f580c93f56adbf3a253ce3c208c52fb784f9d8fec139c617"
5166
+ vk_delta_2: "2178a9c3805dd82071b2b28bb4c0ffc8178cad913c8c990b98b4863284dc3a5d175c0be554fc060c27c551e5e32effef015b918a0f5a2dc1b92909b8272719301c521d5f6542db5ea4775a42d32159c356a696599c1a3df011ec00559ae1c2b60d860f7e6513a7d20feaeaca401863e35a0f691dd7d30ce06d07946840de1ec8",
5167
+ vk_ic0: "19126a54a9b6d0d415f892c246485cb2889487cf9c4a8cd88dab5e1140e1d0630d1d76ef4652df8887c9dc557aa57f25e221db7e5b2e4cf618a362bece107f5c",
5168
+ vk_ic1: "0632e625fefc7172e8aec1070c4d32b90b6c482f6f3806773a4c55a03877c2d716cfd935eb3e3883f580c93f56adbf3a253ce3c208c52fb784f9d8fec139c617"
5169
+ },
5170
+ tally_vkey: {
5171
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5172
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5173
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5174
+ vk_delta_2: "2e9fad39728c543c5213599111e1a44b01720c999a6785e8136c3e3b3bf8e07e248e1933d477969ca6e27cb7a74bca18cac7e3bbdf9371be5c54fe151f6376a30955609ec69b89329322a2f435b706ca248d1312c7513853a50ef37ed0f7826c25a5c57bf07789d89e538bc24017cf2722811f21480b0bb8030ed0028ecb7cd8",
5175
+ vk_ic0: "1bc1a1a3444256469c07cd6f4d1cfd9f7c9ddce596a306e0af077ca9e9c0fe9602db2a9aecef76a9dc4c19bf88c0099b04fc75410cc9004f0966440825e3790a",
5176
+ vk_ic1: "05b8b475f2bfedba4fa04ab1972006da9764c2c3e6fb65d6dd0aac938fd298112a560e13770b06a3f709a49fddf016331ea205fa125026993f6666eff69f4def"
5177
+ }
5178
+ },
5179
+ plonk: {
5180
+ process_vkey: {
5181
+ n: 1048575,
5182
+ num_inputs: 1,
5183
+ selector_commitments: [
5184
+ "29b0f4a90bea69583a8fca1e74d23adf739d605af605a0e0971fac548df976fb2e10a42dfca2325684c1bca5fabbf9d7022fc8b997ea478f1052dd8808d99e44",
5185
+ "119002055b6c2f98314ef408e4a917a6678f114ca991185749289f171f61efc32b3a931c700271b82d22c2073af9b7fffcb7bfa644ea09102d9ef8482410a991",
5186
+ "10c5f32870d26f8e26d2eaae2705557b18210b2355677172e1bef5fe684120891f8317185390ddbb22ecb922d37e03c3cc524c84f65c8045f2324b0f164cfbdb",
5187
+ "115a5f9af5d438d3261cfa31b7050b931b7d22647f628a43af41a41dcd44cb8d2e99368eb15cdc6d1f16faf9db0db4825613d6893c776aef456705bdc76eb728",
5188
+ "1a61cc5f0fbe92fbc8c9bd58928ce467f63e4771e4d517966afbaf220ea069a91cec3231c370be07fee8d9ec01660d054c549b034715855ffa652ad5b67ced86",
5189
+ "19e0d095a343115f6e7ad7ae1f51e375cd648fb35451cb2d5a8cf3bafbb25d0525efdc2cc5b5600ee0ae954dca3bf67c8277d470161fe23b4be7a5bcdf641e68"
5190
+ ],
5191
+ next_step_selector_commitments: [
5192
+ "246ce82e01ed312e81492f132da2ee16bc13cc0024fbcc668de30173ad59067f0f072a892451cc495f5d9b8b99c8dc29be1d42d3004aed45fd5b2cd32a420016"
5193
+ ],
5194
+ permutation_commitments: [
5195
+ "19c4143f41738480adc5ae49922d31b8a5afaa1d25ced5c20b869c0e1ccad91920c267c53d33907318cd194ba2ea08a85f250779765ba4121f7a0edfe1afe22b",
5196
+ "114bda14aa702a0815e3f91318a08a2798244420fd6675c8fc3cc2b0232298890d2eb3c1f27a83f4a3be777524d6cc65aa435e0a472fae8d1158e0a6ded685d0",
5197
+ "289f0b046968d2c095d05350e43996756fc85d2deb0e267a069615f0889a249413bdbe6f09edb4db956b8f3fc4488c4681cd52469dc0d419dab99a65b88309f7",
5198
+ "16dd74a2089960aac0d68309d5e81c6b45c29fafe4d42c922c06eb633ed48d551d347d1f43ee9b137772eefc43a6dcdf5ac35ee1615bc8f7c243bce071c410a9"
5199
+ ],
5200
+ non_residues: [
5201
+ "0000000000000000000000000000000000000000000000000000000000000005",
5202
+ "0000000000000000000000000000000000000000000000000000000000000007",
5203
+ "000000000000000000000000000000000000000000000000000000000000000a"
5204
+ ],
5205
+ g2_elements: [
5206
+ "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5207
+ "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
5208
+ ]
5209
+ },
5210
+ tally_vkey: {
5211
+ n: 524287,
5212
+ num_inputs: 1,
5213
+ selector_commitments: [
5214
+ "18c2bb75c8ed53a5d15a56cc91c56f14c832419994ce7187c7c98b5e622cac0808b773f05e09822d8d267646198a78359ea2aa6fbaeb01317142f99fd11da6c0",
5215
+ "181499098243a5968f5490b7759aa15f0f769f24f3f4219b69f96913cf4fb23c1cd7b3f109196d7577390fd2e6d3930a71b0559aff756f3ca43eef66ce7333f4",
5216
+ "07ba2bdd452503fb16b56ea2940e95a98118c9dd120ae192680fe2b80bdb26f10ac6cdc7cb12b581a8c64d45b5af3d253c4282405eed3fd4d091ae05aac45cb6",
5217
+ "1caf01f1775eeafa78a11202e926ee92be997ce040f9c6fbce161348a40aeda70d9f15738cccf538083784e566ceef651d000223ae810c980e2d5d98b91b4665",
5218
+ "2c377c69cae1d591af413da2fd986ef3dca595d0c5817ee4932b92169d37c52d1218ce63dde705ebd1dc66d9b62daca287e4fdf6800b69204e5b78bfe84365a1",
5219
+ "175dd4ff280e39f0e080c181f853845e40c4b91709a93e4398d24befc9cf556903675361817e031e86bd896ff1dd7bc1cc31ca920a101499db0c58d77f0730ec"
5220
+ ],
5221
+ next_step_selector_commitments: [
5222
+ "12d76999d26137d433f7119ab34f3fc63cfedb9172052cfb34acfc3cdc570f511aba802ebe92b87f913496314b938cf526078280a68826c90b686b90420c7742"
5223
+ ],
5224
+ permutation_commitments: [
5225
+ "167b05c0132399e7126e8d16efb224b1c6729942048fc7e730fd1451116e0a6e05acaf2a6d2c88cc25610474b651c8cdcb7e8e14e59ddfad819123e888c4b1b6",
5226
+ "25aed62de4b701dc645e076543e2553c306010f2776c74edae55ea5253d9540403d042c4cb699cc04b2bb63d3c3edc0c85b049a84dc2fd44369f957d81363563",
5227
+ "0e77fb0b0e84da1d955da3d66dbb8fa3988f22e999a34bc4ac537a0f9187ac40156f8d7cb6d005fd85a0178d794f941b4e84832fd389a37c2a78112dac09b758",
5228
+ "051d3d906d457eaa9eff77a296dfa1760fd9ea379eec60487be38de91545ca2c1fcf457d6ac31afee10951245b0cc1e2c7674596f65955d189d48b6938fb3594"
5229
+ ],
5230
+ non_residues: [
5231
+ "0000000000000000000000000000000000000000000000000000000000000005",
5232
+ "0000000000000000000000000000000000000000000000000000000000000007",
5233
+ "000000000000000000000000000000000000000000000000000000000000000a"
5234
+ ],
5235
+ g2_elements: [
5236
+ "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5237
+ "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
5238
+ ]
5239
+ }
5240
+ }
5241
+ },
5242
+ "4-2-2-25": {
5243
+ parameter: {
5244
+ state_tree_depth: "4",
5245
+ int_state_tree_depth: "2",
5246
+ vote_option_tree_depth: "2",
5247
+ message_batch_size: "25"
5248
+ },
5249
+ groth16: {
5250
+ process_vkey: {
5251
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5252
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5253
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5254
+ vk_delta_2: "0d0fe390b9dd4d1d0f486787b6ea96765cbeaa8f00310fecc3429673c5866c081a27998596ba296f66f3f7b5e2450d1ce1bcc535c133b2e8b577ba07dc1ccb4c1895f7afb9b3168a6d628c9173157cd56ca51948cc66c129a25f80e3b665e4b12c9c50f0cc0d070978ed2fb8ce15956d67c5dc6c07c7f45f1facfb5522d7b656",
5255
+ vk_ic0: "0ff2b22774da5c0ba94db4d759827b8c962aaf44db2649eb10407de02a40463a26497581d6d0979ad7f9057f26e048109158b0872700e2ad8447ffc9b4bf146b",
5256
+ vk_ic1: "0a47be101a59d20641e1369c0b2b9fb839cd35ecbfbeac3866df43723b70c78d17e96303c417743d93b7726805b736f364d305036b50e4ad1b885fc41284daf5"
5257
+ },
5258
+ tally_vkey: {
5259
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5260
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5261
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5262
+ vk_delta_2: "08e44e0876bd574d8a3411e374884eb61da7292ca52903fa96553c37311b66ce0f2f529e59b1d37e55794a575d0f87548ca0d03331c19689bc203a68c1c4bae20e9fd25a7bffaa9b7409e694a48bc0d57f42df164d4a01bd5deecffedd2d3a3125eff290efb93eaf9c578cc7ee9d00406137607b9602de02424ff413ac948690",
5263
+ vk_ic0: "295c8e84b4b6b8de44b24f80eb5cae1df65e4877c4af8da2dbadfbfc3586dc790661b9e636f2c2a83028d11cbb7c753675481b65a5dfe32fff7a558231b3c9ef",
5264
+ vk_ic1: "299cfb28054cde0470bd7ff280349089350226d1ca154dcf6544b2680bf3bea925026e6644668273d6066ef6766c2f561c3607c523fbbd1379c5002376ef69c3"
5265
+ }
5266
+ },
5267
+ plonk: {
5268
+ process_vkey: {
5269
+ n: 2097151,
5270
+ num_inputs: 1,
5271
+ selector_commitments: [
5272
+ "126cbf10e0b68a56d45614be16c5bb48bd1374478e17b9fe1a78b726ea70f9b21f3cd20fd178d89e5923c422ef050ccc7134fbd76c9efdbb90f677ee41e01edb",
5273
+ "12813166f206c95eddd998a40d8d2e54e29dd393f543e3583a7999b18d674832024cdd935540bd3b96207ec0609c6718ad8b14e2ef315594454c57d606494485",
5274
+ "05da9eea3ee7151355067ced11a8e8ff57a56c758493afc9cbb6cfbacfc42e7b08993dfa25c85f20aeb7f64e87fe56ac8066cf6b8479dc96294e302ef5d55372",
5275
+ "2e446e540bacde7daea23c93a67bc6b1424b7c16b33fd2cee251b0d093cd78300030b8e340f01f320639d60b77724e58fc8a2d778b7b2a5df2c953ce34debeea",
5276
+ "1cf8c75b18071ede19d196b46a8776efc29ac514458a698d9f2e50b7bc692f6e06f7ff96897240eca31058fe330e8cbcd911324b79a3a34d03340a3cfed85fd5",
5277
+ "17101fb5c293438a695075b221219679e278e4bd147239c9fc69081b19cacefe218eb895f1456ca81e29731967588aee4b0758ea51aa28e5fefc81fed4a11513"
5278
+ ],
5279
+ next_step_selector_commitments: [
5280
+ "0cebff4fe8cd70325f986088a1e17ae129a025481137bd80aef9c1f1c2e52f1e265a4ccae1ed89cb2fba527165f007898e70f988311ee4e4e87e41376cfeed03"
5281
+ ],
5282
+ permutation_commitments: [
5283
+ "025b5db167721133693f0b6d9d7cfadce68ad15365ef1605dda4a6c809edeea61927b27ca11713fc683c88f6330e9621837b05e5db74d5994d1cf04bc3d529b3",
5284
+ "1fac93999f33b145613901846e6403d7f4237d582b51ccc4fb5c70038284c6e21cc804cc3cf7170b96da74fcbb30c81cd8c3405a629327c657025db7332f169a",
5285
+ "0b6d7d383de73dbfc16f2c0f3af763135ff05a12ec937548008cfee944c195f902336a68a50f62f595953e44401e872fb41abb66a733684b079ffe550d09c233",
5286
+ "225a1f5e92d105d3be026ae68904826f89b786faad75a846ef966ed714568bba28d1388786fde71dea206cdef16faa7a589e90863e6245d271e3f154c75c5531"
5287
+ ],
5288
+ non_residues: [
5289
+ "0000000000000000000000000000000000000000000000000000000000000005",
5290
+ "0000000000000000000000000000000000000000000000000000000000000007",
5291
+ "000000000000000000000000000000000000000000000000000000000000000a"
5292
+ ],
5293
+ g2_elements: [
5294
+ "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5295
+ "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
5296
+ ]
5297
+ },
5298
+ tally_vkey: {
5299
+ n: 1048575,
5300
+ num_inputs: 1,
5301
+ selector_commitments: [
5302
+ "1588fb667b3f0e4d0970b8208e4b6b4c729c4926b936f8d877017cf42d07ca15069643791d98abcd6b7d0b0546e7560ab9011e069f2ee48ede581fc72d8b5e04",
5303
+ "09c5480b103c44a81850ffd9a61ec21f7db41bc89996d8df075c3e029290eb5b083cb2b184d95c0761e585547be33250c8939929b87fdc39775ccea17d51b481",
5304
+ "278e239bcac0a945a17572a6d61ba59f705746e6893a10a44841933a8c8310e712e4ee913af9b77c8fdcdc365316aa9f1b8dc081eb99ad80265768ec9f484beb",
5305
+ "12532585ea307c5559b18a4d01db59b544a88088f61a5b5ed0431393e6f675af1309bf0dcaa7a552849e5f28d0300c8c61b18393fb638aed3b7d70e27bb91c35",
5306
+ "172e7ecb8e485aaee801fd78b8fd7c0b862baef65e39e6832cffa2170b6f981928d86ab5887e8c3210e34e03cada468bd501f60ec3a8fa35b4c7067d6fb8c6ae",
5307
+ "0c27211d046735fc681228b8366be2c8cf9a256cbd03dcd4af65152e94f95a6f1af151a5311b195b0f4acffeec4952cc52edbb7045aab61bbd3be9cd322ab99e"
5308
+ ],
5309
+ next_step_selector_commitments: [
5310
+ "25ee15301d562e6c630946b3fbe36b9fbd8dfbd44ddf70cc825fb1fa1ebd966229081f6b9297da671c69064e10b8f5dd0f69b69d1bf79122c6197f119087ebe1"
5311
+ ],
5312
+ permutation_commitments: [
5313
+ "194849a6ec5cb37e09d20801d387abbab04e453f630c5fbbf5c4819c5569480c0c8bf0ce2b4955cc4c891840da1d9e99feb81e8d43251dffbe4d6167639b9f9b",
5314
+ "17717d2638632d406b3c8aa69550c8aeed1b79def3ab55e9d0c4bdf21cc339ad07d3bd3a331145fc96f34c85469a34a8c93b53b7aa36bb5a94c31e3b4d47713e",
5315
+ "277b0c99b63c79bb9ed2f677c3987cf00acb293933dfced82b5afcb8bf0c34570d3187ce5c7e892582ddda4322cf7c50d41105fe98503fb60e41f4a08da5916d",
5316
+ "0489f6dec0f27a8c21d147ebb9781b68b4b73db065a6017924c543f6d9fadbe922d24c0946bd8b19df7659810296d063b557cdf7aba510b11e08fbf2e9d37931"
5317
+ ],
5318
+ non_residues: [
5319
+ "0000000000000000000000000000000000000000000000000000000000000005",
5320
+ "0000000000000000000000000000000000000000000000000000000000000007",
5321
+ "000000000000000000000000000000000000000000000000000000000000000a"
5322
+ ],
5323
+ g2_elements: [
5324
+ "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5325
+ "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
5326
+ ]
5327
+ }
5328
+ }
5329
+ },
5330
+ "6-3-3-125": {
5331
+ parameter: {
5332
+ state_tree_depth: "6",
5333
+ int_state_tree_depth: "3",
5334
+ vote_option_tree_depth: "3",
5335
+ message_batch_size: "125"
5336
+ },
5337
+ groth16: {
5338
+ process_vkey: {
5339
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5340
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5341
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5342
+ vk_delta_2: "057f25675851ef5a79a6d8706a43a6cd8e494cfb12c241ede46991d9174cf30605b081ff44f3ede774dab68ea9324c12308c13cb09cbb129adf94401b9134f5b16137d952fd32ab2d4243ebff4cb15d17206948ef17909ea8606886a8109bdad082f7d27e1cbf98925f055b39d1c89f9bcc4f6d92fdb920934ff5e37ba4d9b49",
5343
+ vk_ic0: "27c937c032a18a320566e934448a0ffceea7050492a509c45a3bcb7e8ff8905d20789ada31729a833a4f595ff9f49f88adb66f2ab987de15a15deccb0e785bf4",
5344
+ vk_ic1: "0ed2cefc103a2234dbc6bbd8634812d65332218b7589f4079b2c08eb5a4f5f63113a7f3cb53797a7f5819d7de7e3f0b2197d1c34790685a4a59af4314810420b"
5345
+ },
5346
+ tally_vkey: {
5347
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5348
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5349
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5350
+ vk_delta_2: "2065e91c00fcc5cbc3d974cf52e24de972bdb1b4d8ded629dec20b5c904c3fa327ffe02402094795ff4d02588c8268fcad738f69eb4c732a0c98b485035e1f4913ede11b074ff143a929673e581a547717c58ce01af87d9d8b28f65f506093a61013e367b93e6782129362065840a0af9b77d7d9659a84577176e64a918d8d4c",
5351
+ vk_ic0: "11db4a022aab89a265f06ff62aa18c74b21e913a8b23e7fce9cb46f76d1c4d9f2a7475b1eeb7be0a0dc457e6d52536ba351b621b63a7d77da75d4e773048537e",
5352
+ vk_ic1: "0f298d235d0822ad281386abdf511853529af4c864b0cd54140facebfc1356a3059cd6d0d4b27b39e5683548fe12025e2a6b2e2724c2ca87d2008ef932ed3801"
5353
+ }
5354
+ },
5355
+ plonk: {
5356
+ process_vkey: {
5357
+ n: 8388607,
5358
+ num_inputs: 1,
5359
+ selector_commitments: [
5360
+ "216533ab27390f98812429524326ac08736d636d2891fb81446796cc1771a3230642f49db115acc15a186a1013f91a08efcd05640eb137d700276e80fd05bc90",
5361
+ "11747f6f378e26dbdacff464ce7eb6a8869750d0fa7e508e263ac77b582c1e9b24ba3d208650b0c28943915c563cc94cc3f98cdb5fd8adc4f4d3e2a60eda3302",
5362
+ "09239eb768d8d47b91c7e08e2ec6a374571964ed16be293cdc35e112393c4fd1182a0794be7f1441418664e9f718b67ed392a7da3e2868375bcf629131bb2680",
5363
+ "2020f7db24940bbf38d097ea5d7ef7253e38b154d7eb0ff1782ea18ce215dd7b0e8475197b071b118adc6418b7b7fb42fea19b6272d1bb460cc47deacb299ec7",
5364
+ "298923db1618185064bbab5df30ee03a3c9cbc7ce8f096d76cbd2a5ab3df86cd05bbedb938e6e0ff35cce23609458aff8081cdf3163655672074d1b18b0007bd",
5365
+ "0effaabe8c6e8a076aedd36d10f2926f9871f552d93e22bfbe69e3c828a546fa2d0cd163b49a6de219ac2c048a8459ae448047748ba078b9d5d07b290c946b08"
5366
+ ],
5367
+ next_step_selector_commitments: [
5368
+ "13e3d7299e30e6142699469d620df721eca35bbb807a8f4298f165260fdc24f823e7bd9bcb6506a094a5ebef44434c62e4bcb5d3dd7e092c49d5cb80b8ae0757"
5369
+ ],
5370
+ permutation_commitments: [
5371
+ "03d94ab8fdc681523a8eec10f1ce5552937c268d1d970f9e75ee8657cd4c12a81e03476f83ef5c14db2f4d931b833a3b65b8d5689b37cc7f183914c90d3d065d",
5372
+ "1b9c6ef20e68355c535bda6ff04a8a61d7552a594bb8e88d69a6f8840ddab04d2884824cc356d0d90cc278c247fc531de62efca4b19ed1be6f071144474d2037",
5373
+ "1ff82de8312481e1591d2d1c2698fa3944b3f0afa0dd702be8a1a944a5a8997323ffbd0ab39a2e13608a8e76803c33ffda7317bb7101e335ce5552ed62dcd09d",
5374
+ "2cb2bbdd51d22b79957b0401ecb6fe089f05426ba092b1205fa92f39b36cc5fc0c36c3934e47b7d407d4cda0c78c2b3fb23162cb0d295e8a8cce1a274956c34a"
5375
+ ],
5376
+ non_residues: [
5377
+ "0000000000000000000000000000000000000000000000000000000000000005",
5378
+ "0000000000000000000000000000000000000000000000000000000000000007",
5379
+ "000000000000000000000000000000000000000000000000000000000000000a"
5380
+ ],
5381
+ g2_elements: [
5382
+ "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5383
+ "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
5384
+ ]
5385
+ },
5386
+ tally_vkey: {
5387
+ n: 8388607,
5388
+ num_inputs: 1,
5389
+ selector_commitments: [
5390
+ "258d101f9499e81c0d0da8986c659ef33da19d4955a142e56b4854d1327c902c1996baecd81432717a9cbf92ccf651e4217a788c1a2ed855f749480f8ce8203c",
5391
+ "1892a17c9c01389e3149b0663069a1ad4fd3c8e2db5ce99795b781c47b55acf9001cf5f0b4c1d088fa2058ca19cd2f1e9559ebe059897bb0aadcb540ce5f468a",
5392
+ "09912d6eaa4a22802451135d9a221ebf97c2ce8ad5bbb2942d5a860482e8e4202573995072c4b014cd0e9d09a1fd53ee7d602070b404288a7fd0d97b57d8f07d",
5393
+ "0c62ef7ad01b05b2c01fca6188de269d63d725348a07a99bbc50f24c1518aa871fdc61bbf42399433a0917c919dcfe9e851b206e1c37dec0908f69ad89bb1f8e",
5394
+ "07d181c1026ef4a6732bff3dffbc5ae0e3746e4860f478c6c2e8e258df2ed7671efe073fb31cf5a61c0eedceccb5e968220b9ff7e2b055b11d7c456a57fe7ac9",
5395
+ "1bbd7ad96893df675c811e5a2be184e2e3bc9af0ce30a7b26e53a916a10a777a01ffa70dbe585201ac09778429c04c71229392608095d220c7d82631a0caedd6"
5396
+ ],
5397
+ next_step_selector_commitments: [
5398
+ "2ae6c5c98d4c384e8e645d85a4ca362de4c4e75efe3c79d5bcbd126a9e305b831618df99300c7327f1eac6a498c8feac6013d4ba09b7ea046340f99b0598a832"
5399
+ ],
5400
+ permutation_commitments: [
5401
+ "2458c5fb474ab3e7ae9c6b82cc432a111954d8be5e7e9b4fc58c14e1aed77f3207426dbe08272aa69ba8b73809f27f9ff083641b5c3c896c386a74bbed3083dd",
5402
+ "0879ac4885674b1af0ab67c7b505bce6234f32a0335bdfd229023fea5f303ece0973ba8abc9ade8edcfb68c7d4b8b98272c7bf33eff841fec78d21c0c2e82aa6",
5403
+ "07b74f37fcbcb2d9962a529fbc254d54925aeb1be1a49517affeb3571ef3e31e3033f7900ff5bb5759cbb98b64ca7f42967278c328d00e60c042aa65f2178ded",
5404
+ "203c948fdc386e7bfbdc37363ab489e9ce3264f4ccd23c33dd8f2337fb9007a621cabf740aa26e522dcb7af6c0de9f93cbc69595b29b02e75c2f3507e97664ec"
5405
+ ],
5406
+ non_residues: [
5407
+ "0000000000000000000000000000000000000000000000000000000000000005",
5408
+ "0000000000000000000000000000000000000000000000000000000000000007",
5409
+ "000000000000000000000000000000000000000000000000000000000000000a"
5410
+ ],
5411
+ g2_elements: [
5412
+ "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5413
+ "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
5414
+ ]
5415
+ }
5416
+ }
5417
+ },
5418
+ "9-4-3-625": {
5419
+ parameter: {
5420
+ state_tree_depth: "9",
5421
+ int_state_tree_depth: "4",
5422
+ message_batch_size: "625",
5423
+ vote_option_tree_depth: "3"
5424
+ },
5425
+ groth16: {
5426
+ process_1p1v_vkey: {
5427
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5428
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5429
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5430
+ vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5431
+ vk_ic0: "1195be678487bbc8c0ae726c0985a5caf6f75e3f8327926926c4f89e498ad733043e46e10b506d194b27275f402bc3fb208a2f5be69662e7c9898d1c0ece4f04",
5432
+ vk_ic1: "10c34362189a7ee44b1c5e57755d7e0d672dba552e614d5cd9a53081bee2333425879fa4e4a9e3fff287824cce35f94725ca0edb60a4ffcbf50becb2fd96cb0b"
5433
+ },
5434
+ tally_1p1v_vkey: {
5435
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5436
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5437
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5438
+ vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5439
+ vk_ic0: "2ec191d51bd4ac7cd65cb3dd2decfa4e56c4f167bbc40e2c9e1ca728f9bc5b0e2ed1c82319dc554aea5ff2ca05d6f4d4d61e8f059a8c05d4b4faabae5128a437",
5440
+ vk_ic1: "2f19db8f03b6b5896abc6989273371b14833356f45c12685e57bc292eccc53570cb629e551df179f73b9f3391946bad29739af8b808c80b0f057af45aea59849"
5441
+ },
5442
+ process_qv_vkey: {
5443
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5444
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5445
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5446
+ vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5447
+ vk_ic0: "1832600210a459fe61d971081d4baa1a1add23f87c8a8dc4042cd5cf6c6fdf8e3018489aec30d9deb26629e05965a3a7e038be58ce10c854cb7e1071f2708aad",
5448
+ vk_ic1: "0274a24117a799333754d646e35f37292e7ca9984fb8781211504b158d69d2c422aa99651ca207c77084988b16ef363664b9cf36071f7131dcc10b98ea27d7f6"
5449
+ },
5450
+ tally_qv_vkey: {
5451
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5452
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5453
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5454
+ vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
5455
+ vk_ic0: "2ec191d51bd4ac7cd65cb3dd2decfa4e56c4f167bbc40e2c9e1ca728f9bc5b0e2ed1c82319dc554aea5ff2ca05d6f4d4d61e8f059a8c05d4b4faabae5128a437",
5456
+ vk_ic1: "2f19db8f03b6b5896abc6989273371b14833356f45c12685e57bc292eccc53570cb629e551df179f73b9f3391946bad29739af8b808c80b0f057af45aea59849"
5457
+ }
5458
+ }
5459
+ }
5460
+ };
5461
+ var QTR_LIB = {
5462
+ zeros: [
5463
+ "0",
5464
+ "14655542659562014735865511769057053982292279840403315552050801315682099828156",
5465
+ "19261153649140605024552417994922546473530072875902678653210025980873274131905",
5466
+ "21526503558325068664033192388586640128492121680588893182274749683522508994597",
5467
+ "20017764101928005973906869479218555869286328459998999367935018992260318153770",
5468
+ "16998355316577652097112514691750893516081130026395813155204269482715045879598",
5469
+ "2612442706402737973181840577010736087708621987282725873936541279764292204086",
5470
+ "17716535433480122581515618850811568065658392066947958324371350481921422579201",
5471
+ "17437916409890180001398333108882255895598851862997171508841759030332444017770"
5472
+ ]
5473
+ };
5474
+
5475
+ // src/libs/contract/utils.ts
5476
+ function getContractParams(type, circuitType, proofSystem, maxVoter, maxOption) {
5477
+ let parameters;
5478
+ let groth16ProcessVkey = null;
5479
+ let groth16TallyVkey = null;
5480
+ let plonkProcessVkey = null;
5481
+ let plonkTallyVkey = null;
5482
+ let maciVoteType = null;
5483
+ let maciCertSystem = null;
5484
+ switch (circuitType) {
5485
+ case "0" /* IP1V */:
5486
+ maciVoteType = "0";
5487
+ break;
5488
+ case "1" /* QV */:
5489
+ maciVoteType = "1";
5490
+ break;
5491
+ default:
5492
+ throw new Error(
5493
+ `Invalid circuit type ${circuitType}, only support 1P1V and QV`
5494
+ );
5495
+ }
5496
+ switch (proofSystem) {
5497
+ case "groth16" /* GROTH16 */:
5498
+ maciCertSystem = "0";
5499
+ break;
5500
+ case "plonk" /* PLONK */:
5501
+ maciCertSystem = "1";
5502
+ break;
5503
+ default:
5504
+ throw new Error(
5505
+ `Invalid proof system ${proofSystem}, only support GROTH16 and PLONK`
5506
+ );
5507
+ }
5508
+ if (maxVoter <= 25 && maxOption <= 5) {
5509
+ parameters = CIRCUIT_INFO["2-1-1-5"].parameter;
5510
+ if (proofSystem === "groth16" /* GROTH16 */) {
5511
+ groth16ProcessVkey = CIRCUIT_INFO["2-1-1-5"]["groth16"].process_vkey;
5512
+ groth16TallyVkey = CIRCUIT_INFO["2-1-1-5"]["groth16"].tally_vkey;
5513
+ } else if (proofSystem === "plonk" /* PLONK */) {
5514
+ plonkProcessVkey = CIRCUIT_INFO["2-1-1-5"]["plonk"]?.process_vkey;
5515
+ plonkTallyVkey = CIRCUIT_INFO["2-1-1-5"]["plonk"]?.tally_vkey;
5516
+ }
5517
+ } else if (maxVoter <= 625 && maxOption <= 25) {
5518
+ parameters = CIRCUIT_INFO["4-2-2-25"].parameter;
5519
+ if (proofSystem === "groth16" /* GROTH16 */) {
5520
+ groth16ProcessVkey = CIRCUIT_INFO["4-2-2-25"]["groth16"].process_vkey;
5521
+ groth16TallyVkey = CIRCUIT_INFO["4-2-2-25"]["groth16"].tally_vkey;
5522
+ } else if (proofSystem === "plonk" /* PLONK */) {
5523
+ plonkProcessVkey = CIRCUIT_INFO["4-2-2-25"]["plonk"]?.process_vkey;
5524
+ plonkTallyVkey = CIRCUIT_INFO["4-2-2-25"]["plonk"]?.tally_vkey;
5525
+ }
5526
+ } else if (maxVoter <= 15625 && maxOption <= 125) {
5527
+ parameters = CIRCUIT_INFO["6-3-3-125"].parameter;
5528
+ if (proofSystem === "groth16" /* GROTH16 */) {
5529
+ groth16ProcessVkey = CIRCUIT_INFO["6-3-3-125"]["groth16"].process_vkey;
5530
+ groth16TallyVkey = CIRCUIT_INFO["6-3-3-125"]["groth16"].tally_vkey;
5531
+ } else if (proofSystem === "plonk" /* PLONK */) {
5532
+ plonkProcessVkey = CIRCUIT_INFO["6-3-3-125"]["plonk"]?.process_vkey;
5533
+ plonkTallyVkey = CIRCUIT_INFO["6-3-3-125"]["plonk"]?.tally_vkey;
5534
+ }
5535
+ } else if (maxVoter <= 1953125 && maxOption <= 125) {
5536
+ parameters = CIRCUIT_INFO["9-4-3-625"].parameter;
5537
+ if (proofSystem === "groth16" /* GROTH16 */) {
5538
+ if (circuitType === "0" /* IP1V */) {
5539
+ groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_1p1v_vkey;
5540
+ groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_1p1v_vkey;
5541
+ } else if (circuitType === "1" /* QV */) {
5542
+ groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_qv_vkey;
5543
+ groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_qv_vkey;
5544
+ }
5545
+ } else if (proofSystem === "plonk" /* PLONK */) {
5546
+ throw new Error("PLONK is not supported for MACI-9");
5547
+ }
5548
+ } else {
5549
+ throw new Error("Number of voters or options is too large.");
5550
+ }
5551
+ switch (type) {
5552
+ case "0" /* MACI */:
5553
+ return {
5554
+ parameters,
5555
+ groth16ProcessVkey,
5556
+ groth16TallyVkey,
5557
+ plonkProcessVkey,
5558
+ plonkTallyVkey,
5559
+ maciVoteType,
5560
+ maciCertSystem
5561
+ };
5562
+ case "1" /* AMACI */:
5563
+ return {
5564
+ // parameters,
5565
+ // groth16ProcessVkey,
5566
+ // groth16TallyVkey,
5567
+ // plonkProcessVkey,
5568
+ // plonkTallyVkey,
5569
+ };
5570
+ case "2" /* ORACLE_MACI */:
5571
+ if (circuitType === "0" /* IP1V */) {
5572
+ groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_1p1v_vkey;
5573
+ groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_1p1v_vkey;
5574
+ } else if (circuitType === "1" /* QV */) {
5575
+ groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_qv_vkey;
5576
+ groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_qv_vkey;
5577
+ }
5578
+ return {
5579
+ parameters: CIRCUIT_INFO["9-4-3-625"].parameter,
5580
+ groth16ProcessVkey,
5581
+ groth16TallyVkey,
5582
+ plonkProcessVkey: null,
5583
+ plonkTallyVkey: null,
5584
+ maciVoteType,
5585
+ maciCertSystem: "0"
5586
+ };
5587
+ }
5588
+ }
5589
+ function getAMaciRoundCircuitFee(network, maxVoter, maxOption) {
5590
+ let requiredFee = {
5591
+ denom: "peaka",
5592
+ amount: "0"
5593
+ };
5594
+ if (maxVoter <= 25 && maxOption <= 5) {
5595
+ if (network === "mainnet") {
5596
+ requiredFee.amount = "20000000000000000000";
5597
+ } else {
5598
+ requiredFee.amount = "20000000000000000000";
5599
+ }
5600
+ } else if (maxVoter <= 625 && maxOption <= 25) {
5601
+ if (network === "mainnet") {
5602
+ requiredFee.amount = "750000000000000000000";
5603
+ } else {
5604
+ requiredFee.amount = "750000000000000000000";
5605
+ }
5606
+ } else {
5607
+ throw new Error("Number of voters or options is too large.");
5608
+ }
5609
+ return requiredFee;
5610
+ }
5611
+
5612
+ // src/libs/contract/contract.ts
5613
+ var import_stargate2 = require("@cosmjs/stargate");
5614
+ var Contract = class {
5615
+ constructor({
5616
+ network,
5617
+ rpcEndpoint,
5618
+ registryAddress,
5619
+ saasAddress,
5620
+ apiSaasAddress,
5621
+ maciCodeId,
5622
+ oracleCodeId,
5623
+ feegrantOperator,
5624
+ whitelistBackendPubkey
5625
+ }) {
5626
+ this.network = network;
5627
+ this.rpcEndpoint = rpcEndpoint;
5628
+ this.registryAddress = registryAddress;
5629
+ this.saasAddress = saasAddress;
5630
+ this.apiSaasAddress = apiSaasAddress;
5631
+ this.maciCodeId = maciCodeId;
5632
+ this.oracleCodeId = oracleCodeId;
5633
+ this.feegrantOperator = feegrantOperator;
5634
+ this.whitelistBackendPubkey = whitelistBackendPubkey;
5635
+ }
5636
+ async createAMaciRound({
5637
+ signer,
5638
+ startVoting,
5639
+ endVoting,
5640
+ operator,
5641
+ whitelist,
5642
+ title,
5643
+ description,
5644
+ link,
5645
+ maxVoter,
5646
+ maxOption,
5647
+ voiceCreditAmount,
5648
+ circuitType,
5649
+ preDeactivateRoot,
5650
+ fee = "auto"
5651
+ }) {
5652
+ const start_time = (startVoting.getTime() * 10 ** 6).toString();
5653
+ const end_time = (endVoting.getTime() * 10 ** 6).toString();
5654
+ const client = await createRegistryClientBy({
5655
+ rpcEndpoint: this.rpcEndpoint,
5656
+ wallet: signer,
5657
+ contractAddress: this.registryAddress
5658
+ });
5659
+ const requiredFee = getAMaciRoundCircuitFee(
5660
+ this.network,
5661
+ maxVoter,
5662
+ maxOption
5663
+ );
5664
+ preDeactivateRoot = preDeactivateRoot || "0";
5665
+ const res = await client.createRound(
5666
+ {
5667
+ operator,
5668
+ preDeactivateRoot,
5669
+ voiceCreditAmount,
5670
+ whitelist,
5671
+ roundInfo: {
5672
+ title,
5673
+ description: description || "",
5674
+ link: link || ""
5675
+ },
5676
+ votingTime: {
5677
+ start_time,
5678
+ end_time
5679
+ },
5680
+ maxVoter: maxVoter.toString(),
5681
+ maxOption: maxOption.toString(),
5682
+ certificationSystem: "0",
5683
+ circuitType
5684
+ },
5685
+ fee,
5686
+ void 0,
5687
+ [requiredFee]
5688
+ );
5689
+ let contractAddress = "";
5690
+ res.events.map((event) => {
5691
+ if (event.type === "wasm") {
5692
+ let actionEvent = event.attributes.find(
5693
+ (attr) => attr.key === "action"
5694
+ );
5695
+ if (actionEvent.value === "created_round") {
5696
+ contractAddress = event.attributes.find((attr) => attr.key === "round_addr").value.toString();
5697
+ }
5698
+ }
5699
+ });
5700
+ return {
5701
+ ...res,
5702
+ contractAddress
5703
+ };
5704
+ }
5705
+ async createMaciRound({
5706
+ signer,
5707
+ operatorPubkey,
5708
+ startVoting,
5709
+ endVoting,
5710
+ whitelist,
5711
+ title,
5712
+ description,
5713
+ link,
5714
+ maxVoter,
5715
+ maxOption,
5716
+ circuitType,
5717
+ certSystemType,
5718
+ fee = "auto"
5719
+ }) {
5720
+ const start_time = (startVoting.getTime() * 10 ** 6).toString();
5721
+ const end_time = (endVoting.getTime() * 10 ** 6).toString();
5722
+ const [{ address }] = await signer.getAccounts();
5723
+ const client = await createContractClientByWallet(this.rpcEndpoint, signer);
5724
+ const [operatorPubkeyX, operatorPubkeyY] = unpackPubKey(
5725
+ BigInt(operatorPubkey)
5726
+ );
5727
+ const {
5728
+ parameters,
5729
+ groth16ProcessVkey,
5730
+ groth16TallyVkey,
5731
+ plonkProcessVkey,
5732
+ plonkTallyVkey,
5733
+ maciVoteType,
5734
+ maciCertSystem
5735
+ } = getContractParams(
5736
+ "0" /* MACI */,
5737
+ circuitType,
5738
+ certSystemType,
5739
+ maxVoter,
5740
+ maxOption
5741
+ );
5742
+ const instantiateResponse = await client.instantiate(
5743
+ address,
5744
+ this.maciCodeId,
5745
+ {
5746
+ round_info: { title, description: description || "", link: link || "" },
5747
+ voting_time: {
5748
+ start_time,
5749
+ end_time
5750
+ },
5751
+ parameters,
5752
+ coordinator: {
5753
+ x: operatorPubkeyX.toString(),
5754
+ y: operatorPubkeyY.toString()
5755
+ },
5756
+ groth16_process_vkey: groth16ProcessVkey,
5757
+ groth16_tally_vkey: groth16TallyVkey,
5758
+ plonk_process_vkey: plonkProcessVkey,
5759
+ plonk_tally_vkey: plonkTallyVkey,
5760
+ max_vote_options: maxOption.toString(),
5761
+ whitelist,
5762
+ circuit_type: maciVoteType,
5763
+ certification_system: maciCertSystem,
5764
+ qtr_lib: QTR_LIB
4682
5765
  },
4683
- tally_vkey: {
4684
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4685
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4686
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4687
- vk_delta_2: "2e9fad39728c543c5213599111e1a44b01720c999a6785e8136c3e3b3bf8e07e248e1933d477969ca6e27cb7a74bca18cac7e3bbdf9371be5c54fe151f6376a30955609ec69b89329322a2f435b706ca248d1312c7513853a50ef37ed0f7826c25a5c57bf07789d89e538bc24017cf2722811f21480b0bb8030ed0028ecb7cd8",
4688
- vk_ic0: "1bc1a1a3444256469c07cd6f4d1cfd9f7c9ddce596a306e0af077ca9e9c0fe9602db2a9aecef76a9dc4c19bf88c0099b04fc75410cc9004f0966440825e3790a",
4689
- vk_ic1: "05b8b475f2bfedba4fa04ab1972006da9764c2c3e6fb65d6dd0aac938fd298112a560e13770b06a3f709a49fddf016331ea205fa125026993f6666eff69f4def"
4690
- }
4691
- },
4692
- plonk: {
4693
- process_vkey: {
4694
- n: 1048575,
4695
- num_inputs: 1,
4696
- selector_commitments: [
4697
- "29b0f4a90bea69583a8fca1e74d23adf739d605af605a0e0971fac548df976fb2e10a42dfca2325684c1bca5fabbf9d7022fc8b997ea478f1052dd8808d99e44",
4698
- "119002055b6c2f98314ef408e4a917a6678f114ca991185749289f171f61efc32b3a931c700271b82d22c2073af9b7fffcb7bfa644ea09102d9ef8482410a991",
4699
- "10c5f32870d26f8e26d2eaae2705557b18210b2355677172e1bef5fe684120891f8317185390ddbb22ecb922d37e03c3cc524c84f65c8045f2324b0f164cfbdb",
4700
- "115a5f9af5d438d3261cfa31b7050b931b7d22647f628a43af41a41dcd44cb8d2e99368eb15cdc6d1f16faf9db0db4825613d6893c776aef456705bdc76eb728",
4701
- "1a61cc5f0fbe92fbc8c9bd58928ce467f63e4771e4d517966afbaf220ea069a91cec3231c370be07fee8d9ec01660d054c549b034715855ffa652ad5b67ced86",
4702
- "19e0d095a343115f6e7ad7ae1f51e375cd648fb35451cb2d5a8cf3bafbb25d0525efdc2cc5b5600ee0ae954dca3bf67c8277d470161fe23b4be7a5bcdf641e68"
4703
- ],
4704
- next_step_selector_commitments: [
4705
- "246ce82e01ed312e81492f132da2ee16bc13cc0024fbcc668de30173ad59067f0f072a892451cc495f5d9b8b99c8dc29be1d42d3004aed45fd5b2cd32a420016"
4706
- ],
4707
- permutation_commitments: [
4708
- "19c4143f41738480adc5ae49922d31b8a5afaa1d25ced5c20b869c0e1ccad91920c267c53d33907318cd194ba2ea08a85f250779765ba4121f7a0edfe1afe22b",
4709
- "114bda14aa702a0815e3f91318a08a2798244420fd6675c8fc3cc2b0232298890d2eb3c1f27a83f4a3be777524d6cc65aa435e0a472fae8d1158e0a6ded685d0",
4710
- "289f0b046968d2c095d05350e43996756fc85d2deb0e267a069615f0889a249413bdbe6f09edb4db956b8f3fc4488c4681cd52469dc0d419dab99a65b88309f7",
4711
- "16dd74a2089960aac0d68309d5e81c6b45c29fafe4d42c922c06eb633ed48d551d347d1f43ee9b137772eefc43a6dcdf5ac35ee1615bc8f7c243bce071c410a9"
4712
- ],
4713
- non_residues: [
4714
- "0000000000000000000000000000000000000000000000000000000000000005",
4715
- "0000000000000000000000000000000000000000000000000000000000000007",
4716
- "000000000000000000000000000000000000000000000000000000000000000a"
4717
- ],
4718
- g2_elements: [
4719
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4720
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4721
- ]
5766
+ `[MACI] ${title}`,
5767
+ fee
5768
+ );
5769
+ return instantiateResponse;
5770
+ }
5771
+ async createOracleMaciRound({
5772
+ signer,
5773
+ operatorPubkey,
5774
+ startVoting,
5775
+ endVoting,
5776
+ title,
5777
+ description,
5778
+ link,
5779
+ voteOptionMap,
5780
+ circuitType,
5781
+ whitelistEcosystem,
5782
+ whitelistSnapshotHeight,
5783
+ whitelistVotingPowerArgs,
5784
+ fee = "auto"
5785
+ }) {
5786
+ const start_time = (startVoting.getTime() * 1e6).toString();
5787
+ const end_time = (endVoting.getTime() * 1e6).toString();
5788
+ const [{ address }] = await signer.getAccounts();
5789
+ const client = await createContractClientByWallet(this.rpcEndpoint, signer);
5790
+ const [operatorPubkeyX, operatorPubkeyY] = unpackPubKey(
5791
+ BigInt(operatorPubkey)
5792
+ );
5793
+ const { maciVoteType, maciCertSystem } = getContractParams(
5794
+ "2" /* ORACLE_MACI */,
5795
+ circuitType,
5796
+ "groth16" /* GROTH16 */,
5797
+ 0,
5798
+ 0
5799
+ );
5800
+ const instantiateResponse = await client.instantiate(
5801
+ address,
5802
+ this.oracleCodeId,
5803
+ {
5804
+ round_info: { title, description: description || "", link: link || "" },
5805
+ voting_time: {
5806
+ start_time,
5807
+ end_time
5808
+ },
5809
+ coordinator: {
5810
+ x: operatorPubkeyX.toString(),
5811
+ y: operatorPubkeyY.toString()
5812
+ },
5813
+ vote_option_map: voteOptionMap,
5814
+ whitelist_backend_pubkey: this.whitelistBackendPubkey,
5815
+ whitelist_ecosystem: whitelistEcosystem,
5816
+ whitelist_snapshot_height: whitelistSnapshotHeight,
5817
+ whitelist_voting_power_args: whitelistVotingPowerArgs,
5818
+ circuit_type: maciVoteType,
5819
+ certification_system: maciCertSystem,
5820
+ feegrant_operator: this.feegrantOperator
4722
5821
  },
4723
- tally_vkey: {
4724
- n: 524287,
4725
- num_inputs: 1,
4726
- selector_commitments: [
4727
- "18c2bb75c8ed53a5d15a56cc91c56f14c832419994ce7187c7c98b5e622cac0808b773f05e09822d8d267646198a78359ea2aa6fbaeb01317142f99fd11da6c0",
4728
- "181499098243a5968f5490b7759aa15f0f769f24f3f4219b69f96913cf4fb23c1cd7b3f109196d7577390fd2e6d3930a71b0559aff756f3ca43eef66ce7333f4",
4729
- "07ba2bdd452503fb16b56ea2940e95a98118c9dd120ae192680fe2b80bdb26f10ac6cdc7cb12b581a8c64d45b5af3d253c4282405eed3fd4d091ae05aac45cb6",
4730
- "1caf01f1775eeafa78a11202e926ee92be997ce040f9c6fbce161348a40aeda70d9f15738cccf538083784e566ceef651d000223ae810c980e2d5d98b91b4665",
4731
- "2c377c69cae1d591af413da2fd986ef3dca595d0c5817ee4932b92169d37c52d1218ce63dde705ebd1dc66d9b62daca287e4fdf6800b69204e5b78bfe84365a1",
4732
- "175dd4ff280e39f0e080c181f853845e40c4b91709a93e4398d24befc9cf556903675361817e031e86bd896ff1dd7bc1cc31ca920a101499db0c58d77f0730ec"
4733
- ],
4734
- next_step_selector_commitments: [
4735
- "12d76999d26137d433f7119ab34f3fc63cfedb9172052cfb34acfc3cdc570f511aba802ebe92b87f913496314b938cf526078280a68826c90b686b90420c7742"
4736
- ],
4737
- permutation_commitments: [
4738
- "167b05c0132399e7126e8d16efb224b1c6729942048fc7e730fd1451116e0a6e05acaf2a6d2c88cc25610474b651c8cdcb7e8e14e59ddfad819123e888c4b1b6",
4739
- "25aed62de4b701dc645e076543e2553c306010f2776c74edae55ea5253d9540403d042c4cb699cc04b2bb63d3c3edc0c85b049a84dc2fd44369f957d81363563",
4740
- "0e77fb0b0e84da1d955da3d66dbb8fa3988f22e999a34bc4ac537a0f9187ac40156f8d7cb6d005fd85a0178d794f941b4e84832fd389a37c2a78112dac09b758",
4741
- "051d3d906d457eaa9eff77a296dfa1760fd9ea379eec60487be38de91545ca2c1fcf457d6ac31afee10951245b0cc1e2c7674596f65955d189d48b6938fb3594"
4742
- ],
4743
- non_residues: [
4744
- "0000000000000000000000000000000000000000000000000000000000000005",
4745
- "0000000000000000000000000000000000000000000000000000000000000007",
4746
- "000000000000000000000000000000000000000000000000000000000000000a"
4747
- ],
4748
- g2_elements: [
4749
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4750
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4751
- ]
4752
- }
4753
- }
4754
- },
4755
- "4-2-2-25": {
4756
- parameter: {
4757
- state_tree_depth: "4",
4758
- int_state_tree_depth: "2",
4759
- vote_option_tree_depth: "2",
4760
- message_batch_size: "25"
4761
- },
4762
- groth16: {
4763
- process_vkey: {
4764
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4765
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4766
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4767
- vk_delta_2: "0d0fe390b9dd4d1d0f486787b6ea96765cbeaa8f00310fecc3429673c5866c081a27998596ba296f66f3f7b5e2450d1ce1bcc535c133b2e8b577ba07dc1ccb4c1895f7afb9b3168a6d628c9173157cd56ca51948cc66c129a25f80e3b665e4b12c9c50f0cc0d070978ed2fb8ce15956d67c5dc6c07c7f45f1facfb5522d7b656",
4768
- vk_ic0: "0ff2b22774da5c0ba94db4d759827b8c962aaf44db2649eb10407de02a40463a26497581d6d0979ad7f9057f26e048109158b0872700e2ad8447ffc9b4bf146b",
4769
- vk_ic1: "0a47be101a59d20641e1369c0b2b9fb839cd35ecbfbeac3866df43723b70c78d17e96303c417743d93b7726805b736f364d305036b50e4ad1b885fc41284daf5"
5822
+ `[Oracle MACI] ${title}`,
5823
+ fee
5824
+ );
5825
+ return instantiateResponse;
5826
+ }
5827
+ async createSaasOracleMaciRound({
5828
+ signer,
5829
+ operatorPubkey,
5830
+ startVoting,
5831
+ endVoting,
5832
+ title,
5833
+ description,
5834
+ link,
5835
+ maxVoter,
5836
+ voteOptionMap,
5837
+ whitelistBackendPubkey,
5838
+ gasStation = false,
5839
+ fee = 1.8
5840
+ }) {
5841
+ const startTime = (startVoting.getTime() * 1e6).toString();
5842
+ const endTime = (endVoting.getTime() * 1e6).toString();
5843
+ const client = await createSaasClientBy({
5844
+ rpcEndpoint: this.rpcEndpoint,
5845
+ wallet: signer,
5846
+ contractAddress: this.saasAddress
5847
+ });
5848
+ const [operatorPubkeyX, operatorPubkeyY] = unpackPubKey(
5849
+ BigInt(operatorPubkey)
5850
+ );
5851
+ const roundParams = {
5852
+ certificationSystem: "0",
5853
+ circuitType: "0",
5854
+ coordinator: {
5855
+ x: operatorPubkeyX.toString(),
5856
+ y: operatorPubkeyY.toString()
4770
5857
  },
4771
- tally_vkey: {
4772
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4773
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4774
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4775
- vk_delta_2: "08e44e0876bd574d8a3411e374884eb61da7292ca52903fa96553c37311b66ce0f2f529e59b1d37e55794a575d0f87548ca0d03331c19689bc203a68c1c4bae20e9fd25a7bffaa9b7409e694a48bc0d57f42df164d4a01bd5deecffedd2d3a3125eff290efb93eaf9c578cc7ee9d00406137607b9602de02424ff413ac948690",
4776
- vk_ic0: "295c8e84b4b6b8de44b24f80eb5cae1df65e4877c4af8da2dbadfbfc3586dc790661b9e636f2c2a83028d11cbb7c753675481b65a5dfe32fff7a558231b3c9ef",
4777
- vk_ic1: "299cfb28054cde0470bd7ff280349089350226d1ca154dcf6544b2680bf3bea925026e6644668273d6066ef6766c2f561c3607c523fbbd1379c5002376ef69c3"
4778
- }
4779
- },
4780
- plonk: {
4781
- process_vkey: {
4782
- n: 2097151,
4783
- num_inputs: 1,
4784
- selector_commitments: [
4785
- "126cbf10e0b68a56d45614be16c5bb48bd1374478e17b9fe1a78b726ea70f9b21f3cd20fd178d89e5923c422ef050ccc7134fbd76c9efdbb90f677ee41e01edb",
4786
- "12813166f206c95eddd998a40d8d2e54e29dd393f543e3583a7999b18d674832024cdd935540bd3b96207ec0609c6718ad8b14e2ef315594454c57d606494485",
4787
- "05da9eea3ee7151355067ced11a8e8ff57a56c758493afc9cbb6cfbacfc42e7b08993dfa25c85f20aeb7f64e87fe56ac8066cf6b8479dc96294e302ef5d55372",
4788
- "2e446e540bacde7daea23c93a67bc6b1424b7c16b33fd2cee251b0d093cd78300030b8e340f01f320639d60b77724e58fc8a2d778b7b2a5df2c953ce34debeea",
4789
- "1cf8c75b18071ede19d196b46a8776efc29ac514458a698d9f2e50b7bc692f6e06f7ff96897240eca31058fe330e8cbcd911324b79a3a34d03340a3cfed85fd5",
4790
- "17101fb5c293438a695075b221219679e278e4bd147239c9fc69081b19cacefe218eb895f1456ca81e29731967588aee4b0758ea51aa28e5fefc81fed4a11513"
4791
- ],
4792
- next_step_selector_commitments: [
4793
- "0cebff4fe8cd70325f986088a1e17ae129a025481137bd80aef9c1f1c2e52f1e265a4ccae1ed89cb2fba527165f007898e70f988311ee4e4e87e41376cfeed03"
4794
- ],
4795
- permutation_commitments: [
4796
- "025b5db167721133693f0b6d9d7cfadce68ad15365ef1605dda4a6c809edeea61927b27ca11713fc683c88f6330e9621837b05e5db74d5994d1cf04bc3d529b3",
4797
- "1fac93999f33b145613901846e6403d7f4237d582b51ccc4fb5c70038284c6e21cc804cc3cf7170b96da74fcbb30c81cd8c3405a629327c657025db7332f169a",
4798
- "0b6d7d383de73dbfc16f2c0f3af763135ff05a12ec937548008cfee944c195f902336a68a50f62f595953e44401e872fb41abb66a733684b079ffe550d09c233",
4799
- "225a1f5e92d105d3be026ae68904826f89b786faad75a846ef966ed714568bba28d1388786fde71dea206cdef16faa7a589e90863e6245d271e3f154c75c5531"
4800
- ],
4801
- non_residues: [
4802
- "0000000000000000000000000000000000000000000000000000000000000005",
4803
- "0000000000000000000000000000000000000000000000000000000000000007",
4804
- "000000000000000000000000000000000000000000000000000000000000000a"
4805
- ],
4806
- g2_elements: [
4807
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4808
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4809
- ]
5858
+ maxVoters: maxVoter,
5859
+ roundInfo: {
5860
+ title,
5861
+ description: description || "",
5862
+ link: link || ""
4810
5863
  },
4811
- tally_vkey: {
4812
- n: 1048575,
4813
- num_inputs: 1,
4814
- selector_commitments: [
4815
- "1588fb667b3f0e4d0970b8208e4b6b4c729c4926b936f8d877017cf42d07ca15069643791d98abcd6b7d0b0546e7560ab9011e069f2ee48ede581fc72d8b5e04",
4816
- "09c5480b103c44a81850ffd9a61ec21f7db41bc89996d8df075c3e029290eb5b083cb2b184d95c0761e585547be33250c8939929b87fdc39775ccea17d51b481",
4817
- "278e239bcac0a945a17572a6d61ba59f705746e6893a10a44841933a8c8310e712e4ee913af9b77c8fdcdc365316aa9f1b8dc081eb99ad80265768ec9f484beb",
4818
- "12532585ea307c5559b18a4d01db59b544a88088f61a5b5ed0431393e6f675af1309bf0dcaa7a552849e5f28d0300c8c61b18393fb638aed3b7d70e27bb91c35",
4819
- "172e7ecb8e485aaee801fd78b8fd7c0b862baef65e39e6832cffa2170b6f981928d86ab5887e8c3210e34e03cada468bd501f60ec3a8fa35b4c7067d6fb8c6ae",
4820
- "0c27211d046735fc681228b8366be2c8cf9a256cbd03dcd4af65152e94f95a6f1af151a5311b195b0f4acffeec4952cc52edbb7045aab61bbd3be9cd322ab99e"
4821
- ],
4822
- next_step_selector_commitments: [
4823
- "25ee15301d562e6c630946b3fbe36b9fbd8dfbd44ddf70cc825fb1fa1ebd966229081f6b9297da671c69064e10b8f5dd0f69b69d1bf79122c6197f119087ebe1"
4824
- ],
4825
- permutation_commitments: [
4826
- "194849a6ec5cb37e09d20801d387abbab04e453f630c5fbbf5c4819c5569480c0c8bf0ce2b4955cc4c891840da1d9e99feb81e8d43251dffbe4d6167639b9f9b",
4827
- "17717d2638632d406b3c8aa69550c8aeed1b79def3ab55e9d0c4bdf21cc339ad07d3bd3a331145fc96f34c85469a34a8c93b53b7aa36bb5a94c31e3b4d47713e",
4828
- "277b0c99b63c79bb9ed2f677c3987cf00acb293933dfced82b5afcb8bf0c34570d3187ce5c7e892582ddda4322cf7c50d41105fe98503fb60e41f4a08da5916d",
4829
- "0489f6dec0f27a8c21d147ebb9781b68b4b73db065a6017924c543f6d9fadbe922d24c0946bd8b19df7659810296d063b557cdf7aba510b11e08fbf2e9d37931"
4830
- ],
4831
- non_residues: [
4832
- "0000000000000000000000000000000000000000000000000000000000000005",
4833
- "0000000000000000000000000000000000000000000000000000000000000007",
4834
- "000000000000000000000000000000000000000000000000000000000000000a"
5864
+ startTime,
5865
+ endTime,
5866
+ voteOptionMap,
5867
+ whitelistBackendPubkey: whitelistBackendPubkey || this.whitelistBackendPubkey
5868
+ };
5869
+ let createResponse;
5870
+ if (gasStation && typeof fee !== "object") {
5871
+ const [{ address }] = await signer.getAccounts();
5872
+ const contractClient = await this.contractClient({ signer });
5873
+ const msg = {
5874
+ create_oracle_maci_round: {
5875
+ certification_system: "0",
5876
+ circuit_type: "0",
5877
+ coordinator: roundParams.coordinator,
5878
+ max_voters: roundParams.maxVoters.toString(),
5879
+ round_info: roundParams.roundInfo,
5880
+ start_time: roundParams.startTime,
5881
+ end_time: roundParams.endTime,
5882
+ vote_option_map: roundParams.voteOptionMap,
5883
+ whitelist_backend_pubkey: roundParams.whitelistBackendPubkey
5884
+ }
5885
+ };
5886
+ const gasEstimation = await contractClient.simulate(
5887
+ address,
5888
+ [
5889
+ {
5890
+ typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
5891
+ value: {
5892
+ sender: address,
5893
+ contract: this.saasAddress,
5894
+ msg: new TextEncoder().encode(JSON.stringify(msg))
5895
+ }
5896
+ }
4835
5897
  ],
4836
- g2_elements: [
4837
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4838
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4839
- ]
4840
- }
5898
+ ""
5899
+ );
5900
+ const multiplier = typeof fee === "number" ? fee : 1.8;
5901
+ const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
5902
+ const calculatedFee = (0, import_stargate2.calculateFee)(
5903
+ Math.round(gasEstimation * multiplier),
5904
+ gasPrice
5905
+ );
5906
+ const grantFee = {
5907
+ amount: calculatedFee.amount,
5908
+ gas: calculatedFee.gas,
5909
+ granter: this.saasAddress
5910
+ };
5911
+ createResponse = await client.createOracleMaciRound(
5912
+ roundParams,
5913
+ grantFee
5914
+ );
5915
+ } else if (gasStation && typeof fee === "object") {
5916
+ const grantFee = {
5917
+ ...fee,
5918
+ granter: this.saasAddress
5919
+ };
5920
+ createResponse = await client.createOracleMaciRound(
5921
+ roundParams,
5922
+ grantFee
5923
+ );
5924
+ } else {
5925
+ createResponse = await client.createOracleMaciRound(roundParams, fee);
4841
5926
  }
4842
- },
4843
- "6-3-3-125": {
4844
- parameter: {
4845
- state_tree_depth: "6",
4846
- int_state_tree_depth: "3",
4847
- vote_option_tree_depth: "3",
4848
- message_batch_size: "125"
4849
- },
4850
- groth16: {
4851
- process_vkey: {
4852
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4853
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4854
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4855
- vk_delta_2: "057f25675851ef5a79a6d8706a43a6cd8e494cfb12c241ede46991d9174cf30605b081ff44f3ede774dab68ea9324c12308c13cb09cbb129adf94401b9134f5b16137d952fd32ab2d4243ebff4cb15d17206948ef17909ea8606886a8109bdad082f7d27e1cbf98925f055b39d1c89f9bcc4f6d92fdb920934ff5e37ba4d9b49",
4856
- vk_ic0: "27c937c032a18a320566e934448a0ffceea7050492a509c45a3bcb7e8ff8905d20789ada31729a833a4f595ff9f49f88adb66f2ab987de15a15deccb0e785bf4",
4857
- vk_ic1: "0ed2cefc103a2234dbc6bbd8634812d65332218b7589f4079b2c08eb5a4f5f63113a7f3cb53797a7f5819d7de7e3f0b2197d1c34790685a4a59af4314810420b"
4858
- },
4859
- tally_vkey: {
4860
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4861
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4862
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4863
- vk_delta_2: "2065e91c00fcc5cbc3d974cf52e24de972bdb1b4d8ded629dec20b5c904c3fa327ffe02402094795ff4d02588c8268fcad738f69eb4c732a0c98b485035e1f4913ede11b074ff143a929673e581a547717c58ce01af87d9d8b28f65f506093a61013e367b93e6782129362065840a0af9b77d7d9659a84577176e64a918d8d4c",
4864
- vk_ic0: "11db4a022aab89a265f06ff62aa18c74b21e913a8b23e7fce9cb46f76d1c4d9f2a7475b1eeb7be0a0dc457e6d52536ba351b621b63a7d77da75d4e773048537e",
4865
- vk_ic1: "0f298d235d0822ad281386abdf511853529af4c864b0cd54140facebfc1356a3059cd6d0d4b27b39e5683548fe12025e2a6b2e2724c2ca87d2008ef932ed3801"
5927
+ let contractAddress = "";
5928
+ createResponse.events.map((event) => {
5929
+ if (event.type === "wasm") {
5930
+ let actionEvent = event.attributes.find(
5931
+ (attr) => attr.key === "action"
5932
+ );
5933
+ if (actionEvent.value === "created_oracle_maci_round") {
5934
+ contractAddress = event.attributes.find((attr) => attr.key === "round_addr").value.toString();
5935
+ }
4866
5936
  }
4867
- },
4868
- plonk: {
4869
- process_vkey: {
4870
- n: 8388607,
4871
- num_inputs: 1,
4872
- selector_commitments: [
4873
- "216533ab27390f98812429524326ac08736d636d2891fb81446796cc1771a3230642f49db115acc15a186a1013f91a08efcd05640eb137d700276e80fd05bc90",
4874
- "11747f6f378e26dbdacff464ce7eb6a8869750d0fa7e508e263ac77b582c1e9b24ba3d208650b0c28943915c563cc94cc3f98cdb5fd8adc4f4d3e2a60eda3302",
4875
- "09239eb768d8d47b91c7e08e2ec6a374571964ed16be293cdc35e112393c4fd1182a0794be7f1441418664e9f718b67ed392a7da3e2868375bcf629131bb2680",
4876
- "2020f7db24940bbf38d097ea5d7ef7253e38b154d7eb0ff1782ea18ce215dd7b0e8475197b071b118adc6418b7b7fb42fea19b6272d1bb460cc47deacb299ec7",
4877
- "298923db1618185064bbab5df30ee03a3c9cbc7ce8f096d76cbd2a5ab3df86cd05bbedb938e6e0ff35cce23609458aff8081cdf3163655672074d1b18b0007bd",
4878
- "0effaabe8c6e8a076aedd36d10f2926f9871f552d93e22bfbe69e3c828a546fa2d0cd163b49a6de219ac2c048a8459ae448047748ba078b9d5d07b290c946b08"
4879
- ],
4880
- next_step_selector_commitments: [
4881
- "13e3d7299e30e6142699469d620df721eca35bbb807a8f4298f165260fdc24f823e7bd9bcb6506a094a5ebef44434c62e4bcb5d3dd7e092c49d5cb80b8ae0757"
4882
- ],
4883
- permutation_commitments: [
4884
- "03d94ab8fdc681523a8eec10f1ce5552937c268d1d970f9e75ee8657cd4c12a81e03476f83ef5c14db2f4d931b833a3b65b8d5689b37cc7f183914c90d3d065d",
4885
- "1b9c6ef20e68355c535bda6ff04a8a61d7552a594bb8e88d69a6f8840ddab04d2884824cc356d0d90cc278c247fc531de62efca4b19ed1be6f071144474d2037",
4886
- "1ff82de8312481e1591d2d1c2698fa3944b3f0afa0dd702be8a1a944a5a8997323ffbd0ab39a2e13608a8e76803c33ffda7317bb7101e335ce5552ed62dcd09d",
4887
- "2cb2bbdd51d22b79957b0401ecb6fe089f05426ba092b1205fa92f39b36cc5fc0c36c3934e47b7d407d4cda0c78c2b3fb23162cb0d295e8a8cce1a274956c34a"
4888
- ],
4889
- non_residues: [
4890
- "0000000000000000000000000000000000000000000000000000000000000005",
4891
- "0000000000000000000000000000000000000000000000000000000000000007",
4892
- "000000000000000000000000000000000000000000000000000000000000000a"
5937
+ });
5938
+ return {
5939
+ ...createResponse,
5940
+ contractAddress
5941
+ };
5942
+ }
5943
+ async setSaasOracleMaciRoundInfo({
5944
+ signer,
5945
+ contractAddress,
5946
+ title,
5947
+ description,
5948
+ link,
5949
+ gasStation = false,
5950
+ fee = 1.8
5951
+ }) {
5952
+ const client = await createSaasClientBy({
5953
+ rpcEndpoint: this.rpcEndpoint,
5954
+ wallet: signer,
5955
+ contractAddress: this.saasAddress
5956
+ });
5957
+ const roundInfo = {
5958
+ title,
5959
+ description,
5960
+ link
5961
+ };
5962
+ if (gasStation && typeof fee !== "object") {
5963
+ const [{ address }] = await signer.getAccounts();
5964
+ const contractClient = await this.contractClient({ signer });
5965
+ const msg = {
5966
+ set_round_info: {
5967
+ contract_addr: contractAddress,
5968
+ round_info: roundInfo
5969
+ }
5970
+ };
5971
+ const gasEstimation = await contractClient.simulate(
5972
+ address,
5973
+ [
5974
+ {
5975
+ typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
5976
+ value: {
5977
+ sender: address,
5978
+ contract: this.saasAddress,
5979
+ msg: new TextEncoder().encode(JSON.stringify(msg))
5980
+ }
5981
+ }
4893
5982
  ],
4894
- g2_elements: [
4895
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4896
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4897
- ]
5983
+ ""
5984
+ );
5985
+ const multiplier = typeof fee === "number" ? fee : 1.8;
5986
+ const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
5987
+ const calculatedFee = (0, import_stargate2.calculateFee)(
5988
+ Math.round(gasEstimation * multiplier),
5989
+ gasPrice
5990
+ );
5991
+ const grantFee = {
5992
+ amount: calculatedFee.amount,
5993
+ gas: calculatedFee.gas,
5994
+ granter: this.saasAddress
5995
+ };
5996
+ return client.setRoundInfo(
5997
+ {
5998
+ contractAddr: contractAddress,
5999
+ roundInfo
6000
+ },
6001
+ grantFee
6002
+ );
6003
+ } else if (gasStation && typeof fee === "object") {
6004
+ const grantFee = {
6005
+ ...fee,
6006
+ granter: this.saasAddress
6007
+ };
6008
+ return client.setRoundInfo(
6009
+ {
6010
+ contractAddr: contractAddress,
6011
+ roundInfo
6012
+ },
6013
+ grantFee
6014
+ );
6015
+ }
6016
+ return client.setRoundInfo(
6017
+ {
6018
+ contractAddr: contractAddress,
6019
+ roundInfo
4898
6020
  },
4899
- tally_vkey: {
4900
- n: 8388607,
4901
- num_inputs: 1,
4902
- selector_commitments: [
4903
- "258d101f9499e81c0d0da8986c659ef33da19d4955a142e56b4854d1327c902c1996baecd81432717a9cbf92ccf651e4217a788c1a2ed855f749480f8ce8203c",
4904
- "1892a17c9c01389e3149b0663069a1ad4fd3c8e2db5ce99795b781c47b55acf9001cf5f0b4c1d088fa2058ca19cd2f1e9559ebe059897bb0aadcb540ce5f468a",
4905
- "09912d6eaa4a22802451135d9a221ebf97c2ce8ad5bbb2942d5a860482e8e4202573995072c4b014cd0e9d09a1fd53ee7d602070b404288a7fd0d97b57d8f07d",
4906
- "0c62ef7ad01b05b2c01fca6188de269d63d725348a07a99bbc50f24c1518aa871fdc61bbf42399433a0917c919dcfe9e851b206e1c37dec0908f69ad89bb1f8e",
4907
- "07d181c1026ef4a6732bff3dffbc5ae0e3746e4860f478c6c2e8e258df2ed7671efe073fb31cf5a61c0eedceccb5e968220b9ff7e2b055b11d7c456a57fe7ac9",
4908
- "1bbd7ad96893df675c811e5a2be184e2e3bc9af0ce30a7b26e53a916a10a777a01ffa70dbe585201ac09778429c04c71229392608095d220c7d82631a0caedd6"
4909
- ],
4910
- next_step_selector_commitments: [
4911
- "2ae6c5c98d4c384e8e645d85a4ca362de4c4e75efe3c79d5bcbd126a9e305b831618df99300c7327f1eac6a498c8feac6013d4ba09b7ea046340f99b0598a832"
4912
- ],
4913
- permutation_commitments: [
4914
- "2458c5fb474ab3e7ae9c6b82cc432a111954d8be5e7e9b4fc58c14e1aed77f3207426dbe08272aa69ba8b73809f27f9ff083641b5c3c896c386a74bbed3083dd",
4915
- "0879ac4885674b1af0ab67c7b505bce6234f32a0335bdfd229023fea5f303ece0973ba8abc9ade8edcfb68c7d4b8b98272c7bf33eff841fec78d21c0c2e82aa6",
4916
- "07b74f37fcbcb2d9962a529fbc254d54925aeb1be1a49517affeb3571ef3e31e3033f7900ff5bb5759cbb98b64ca7f42967278c328d00e60c042aa65f2178ded",
4917
- "203c948fdc386e7bfbdc37363ab489e9ce3264f4ccd23c33dd8f2337fb9007a621cabf740aa26e522dcb7af6c0de9f93cbc69595b29b02e75c2f3507e97664ec"
4918
- ],
4919
- non_residues: [
4920
- "0000000000000000000000000000000000000000000000000000000000000005",
4921
- "0000000000000000000000000000000000000000000000000000000000000007",
4922
- "000000000000000000000000000000000000000000000000000000000000000a"
6021
+ fee
6022
+ );
6023
+ }
6024
+ async setSaasOracleMaciRoundVoteOptions({
6025
+ signer,
6026
+ contractAddress,
6027
+ voteOptionMap,
6028
+ gasStation = false,
6029
+ fee = 1.8
6030
+ }) {
6031
+ const client = await createSaasClientBy({
6032
+ rpcEndpoint: this.rpcEndpoint,
6033
+ wallet: signer,
6034
+ contractAddress: this.saasAddress
6035
+ });
6036
+ if (gasStation && typeof fee !== "object") {
6037
+ const [{ address }] = await signer.getAccounts();
6038
+ const contractClient = await this.contractClient({ signer });
6039
+ const msg = {
6040
+ set_vote_options_map: {
6041
+ contract_addr: contractAddress,
6042
+ vote_option_map: voteOptionMap
6043
+ }
6044
+ };
6045
+ const gasEstimation = await contractClient.simulate(
6046
+ address,
6047
+ [
6048
+ {
6049
+ typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
6050
+ value: {
6051
+ sender: address,
6052
+ contract: this.saasAddress,
6053
+ msg: new TextEncoder().encode(JSON.stringify(msg))
6054
+ }
6055
+ }
4923
6056
  ],
4924
- g2_elements: [
4925
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4926
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4927
- ]
4928
- }
6057
+ ""
6058
+ );
6059
+ const multiplier = typeof fee === "number" ? fee : 1.8;
6060
+ const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
6061
+ const calculatedFee = (0, import_stargate2.calculateFee)(
6062
+ Math.round(gasEstimation * multiplier),
6063
+ gasPrice
6064
+ );
6065
+ const grantFee = {
6066
+ amount: calculatedFee.amount,
6067
+ gas: calculatedFee.gas,
6068
+ granter: this.saasAddress
6069
+ };
6070
+ return client.setVoteOptionsMap(
6071
+ {
6072
+ contractAddr: contractAddress,
6073
+ voteOptionMap
6074
+ },
6075
+ grantFee
6076
+ );
6077
+ } else if (gasStation && typeof fee === "object") {
6078
+ const grantFee = {
6079
+ ...fee,
6080
+ granter: this.saasAddress
6081
+ };
6082
+ return client.setVoteOptionsMap(
6083
+ {
6084
+ contractAddr: contractAddress,
6085
+ voteOptionMap
6086
+ },
6087
+ grantFee
6088
+ );
4929
6089
  }
4930
- },
4931
- "9-4-3-625": {
4932
- parameter: {
4933
- state_tree_depth: "9",
4934
- int_state_tree_depth: "4",
4935
- message_batch_size: "625",
4936
- vote_option_tree_depth: "3"
4937
- },
4938
- groth16: {
4939
- process_1p1v_vkey: {
4940
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4941
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4942
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4943
- vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4944
- vk_ic0: "1195be678487bbc8c0ae726c0985a5caf6f75e3f8327926926c4f89e498ad733043e46e10b506d194b27275f402bc3fb208a2f5be69662e7c9898d1c0ece4f04",
4945
- vk_ic1: "10c34362189a7ee44b1c5e57755d7e0d672dba552e614d5cd9a53081bee2333425879fa4e4a9e3fff287824cce35f94725ca0edb60a4ffcbf50becb2fd96cb0b"
4946
- },
4947
- tally_1p1v_vkey: {
4948
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4949
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4950
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4951
- vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4952
- vk_ic0: "2ec191d51bd4ac7cd65cb3dd2decfa4e56c4f167bbc40e2c9e1ca728f9bc5b0e2ed1c82319dc554aea5ff2ca05d6f4d4d61e8f059a8c05d4b4faabae5128a437",
4953
- vk_ic1: "2f19db8f03b6b5896abc6989273371b14833356f45c12685e57bc292eccc53570cb629e551df179f73b9f3391946bad29739af8b808c80b0f057af45aea59849"
4954
- },
4955
- process_qv_vkey: {
4956
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4957
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4958
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4959
- vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4960
- vk_ic0: "1832600210a459fe61d971081d4baa1a1add23f87c8a8dc4042cd5cf6c6fdf8e3018489aec30d9deb26629e05965a3a7e038be58ce10c854cb7e1071f2708aad",
4961
- vk_ic1: "0274a24117a799333754d646e35f37292e7ca9984fb8781211504b158d69d2c422aa99651ca207c77084988b16ef363664b9cf36071f7131dcc10b98ea27d7f6"
6090
+ return client.setVoteOptionsMap(
6091
+ {
6092
+ contractAddr: contractAddress,
6093
+ voteOptionMap
4962
6094
  },
4963
- tally_qv_vkey: {
4964
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4965
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4966
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4967
- vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4968
- vk_ic0: "2ec191d51bd4ac7cd65cb3dd2decfa4e56c4f167bbc40e2c9e1ca728f9bc5b0e2ed1c82319dc554aea5ff2ca05d6f4d4d61e8f059a8c05d4b4faabae5128a437",
4969
- vk_ic1: "2f19db8f03b6b5896abc6989273371b14833356f45c12685e57bc292eccc53570cb629e551df179f73b9f3391946bad29739af8b808c80b0f057af45aea59849"
4970
- }
6095
+ fee
6096
+ );
6097
+ }
6098
+ async saasGrantToVoter({
6099
+ signer,
6100
+ baseAmount,
6101
+ contractAddress,
6102
+ grantee,
6103
+ gasStation = false,
6104
+ fee = 1.8
6105
+ }) {
6106
+ const client = await createSaasClientBy({
6107
+ rpcEndpoint: this.rpcEndpoint,
6108
+ wallet: signer,
6109
+ contractAddress: this.saasAddress
6110
+ });
6111
+ if (gasStation && typeof fee !== "object") {
6112
+ const [{ address }] = await signer.getAccounts();
6113
+ const contractClient = await this.contractClient({ signer });
6114
+ const msg = {
6115
+ grant_to_voter: {
6116
+ base_amount: baseAmount,
6117
+ contract_addr: contractAddress,
6118
+ grantee
6119
+ }
6120
+ };
6121
+ const gasEstimation = await contractClient.simulate(
6122
+ address,
6123
+ [
6124
+ {
6125
+ typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
6126
+ value: {
6127
+ sender: address,
6128
+ contract: this.saasAddress,
6129
+ msg: new TextEncoder().encode(JSON.stringify(msg))
6130
+ }
6131
+ }
6132
+ ],
6133
+ ""
6134
+ );
6135
+ const multiplier = typeof fee === "number" ? fee : 1.8;
6136
+ const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
6137
+ const calculatedFee = (0, import_stargate2.calculateFee)(
6138
+ Math.round(gasEstimation * multiplier),
6139
+ gasPrice
6140
+ );
6141
+ const grantFee = {
6142
+ amount: calculatedFee.amount,
6143
+ gas: calculatedFee.gas,
6144
+ granter: this.saasAddress
6145
+ };
6146
+ return client.grantToVoter(
6147
+ {
6148
+ baseAmount,
6149
+ contractAddr: contractAddress,
6150
+ grantee
6151
+ },
6152
+ grantFee
6153
+ );
6154
+ } else if (gasStation && typeof fee === "object") {
6155
+ const grantFee = {
6156
+ ...fee,
6157
+ granter: this.saasAddress
6158
+ };
6159
+ return client.grantToVoter(
6160
+ {
6161
+ baseAmount,
6162
+ contractAddr: contractAddress,
6163
+ grantee
6164
+ },
6165
+ grantFee
6166
+ );
4971
6167
  }
6168
+ return client.grantToVoter(
6169
+ {
6170
+ baseAmount,
6171
+ contractAddr: contractAddress,
6172
+ grantee
6173
+ },
6174
+ fee
6175
+ );
4972
6176
  }
4973
- };
4974
- var QTR_LIB = {
4975
- zeros: [
4976
- "0",
4977
- "14655542659562014735865511769057053982292279840403315552050801315682099828156",
4978
- "19261153649140605024552417994922546473530072875902678653210025980873274131905",
4979
- "21526503558325068664033192388586640128492121680588893182274749683522508994597",
4980
- "20017764101928005973906869479218555869286328459998999367935018992260318153770",
4981
- "16998355316577652097112514691750893516081130026395813155204269482715045879598",
4982
- "2612442706402737973181840577010736087708621987282725873936541279764292204086",
4983
- "17716535433480122581515618850811568065658392066947958324371350481921422579201",
4984
- "17437916409890180001398333108882255895598851862997171508841759030332444017770"
4985
- ]
4986
- };
4987
-
4988
- // src/libs/contract/utils.ts
4989
- function getContractParams(type, circuitType, proofSystem, maxVoter, maxOption) {
4990
- let parameters;
4991
- let groth16ProcessVkey = null;
4992
- let groth16TallyVkey = null;
4993
- let plonkProcessVkey = null;
4994
- let plonkTallyVkey = null;
4995
- let maciVoteType = null;
4996
- let maciCertSystem = null;
4997
- switch (circuitType) {
4998
- case "0" /* IP1V */:
4999
- maciVoteType = "0";
5000
- break;
5001
- case "1" /* QV */:
5002
- maciVoteType = "1";
5003
- break;
5004
- default:
5005
- throw new Error(
5006
- `Invalid circuit type ${circuitType}, only support 1P1V and QV`
6177
+ async addSaasOperator({
6178
+ signer,
6179
+ operator,
6180
+ gasStation = false,
6181
+ fee = 1.8
6182
+ }) {
6183
+ const client = await createSaasClientBy({
6184
+ rpcEndpoint: this.rpcEndpoint,
6185
+ wallet: signer,
6186
+ contractAddress: this.saasAddress
6187
+ });
6188
+ if (gasStation && typeof fee !== "object") {
6189
+ const [{ address }] = await signer.getAccounts();
6190
+ const contractClient = await this.contractClient({ signer });
6191
+ const msg = {
6192
+ add_operator: {
6193
+ operator
6194
+ }
6195
+ };
6196
+ const gasEstimation = await contractClient.simulate(
6197
+ address,
6198
+ [
6199
+ {
6200
+ typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
6201
+ value: {
6202
+ sender: address,
6203
+ contract: this.saasAddress,
6204
+ msg: new TextEncoder().encode(JSON.stringify(msg))
6205
+ }
6206
+ }
6207
+ ],
6208
+ ""
6209
+ );
6210
+ const multiplier = typeof fee === "number" ? fee : 1.8;
6211
+ const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
6212
+ const calculatedFee = (0, import_stargate2.calculateFee)(
6213
+ Math.round(gasEstimation * multiplier),
6214
+ gasPrice
5007
6215
  );
6216
+ const grantFee = {
6217
+ amount: calculatedFee.amount,
6218
+ gas: calculatedFee.gas,
6219
+ granter: this.saasAddress
6220
+ };
6221
+ return client.addOperator({ operator }, grantFee);
6222
+ } else if (gasStation && typeof fee === "object") {
6223
+ const grantFee = {
6224
+ ...fee,
6225
+ granter: this.saasAddress
6226
+ };
6227
+ return client.addOperator({ operator }, grantFee);
6228
+ }
6229
+ return client.addOperator({ operator }, fee);
5008
6230
  }
5009
- switch (proofSystem) {
5010
- case "groth16" /* GROTH16 */:
5011
- maciCertSystem = "0";
5012
- break;
5013
- case "plonk" /* PLONK */:
5014
- maciCertSystem = "1";
5015
- break;
5016
- default:
5017
- throw new Error(
5018
- `Invalid proof system ${proofSystem}, only support GROTH16 and PLONK`
6231
+ async removeSaasOperator({
6232
+ signer,
6233
+ operator,
6234
+ gasStation = false,
6235
+ fee = 1.8
6236
+ }) {
6237
+ const client = await createSaasClientBy({
6238
+ rpcEndpoint: this.rpcEndpoint,
6239
+ wallet: signer,
6240
+ contractAddress: this.saasAddress
6241
+ });
6242
+ if (gasStation && typeof fee !== "object") {
6243
+ const [{ address }] = await signer.getAccounts();
6244
+ const contractClient = await this.contractClient({ signer });
6245
+ const msg = {
6246
+ remove_operator: {
6247
+ operator
6248
+ }
6249
+ };
6250
+ const gasEstimation = await contractClient.simulate(
6251
+ address,
6252
+ [
6253
+ {
6254
+ typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
6255
+ value: {
6256
+ sender: address,
6257
+ contract: this.saasAddress,
6258
+ msg: new TextEncoder().encode(JSON.stringify(msg))
6259
+ }
6260
+ }
6261
+ ],
6262
+ ""
5019
6263
  );
5020
- }
5021
- if (maxVoter <= 25 && maxOption <= 5) {
5022
- parameters = CIRCUIT_INFO["2-1-1-5"].parameter;
5023
- if (proofSystem === "groth16" /* GROTH16 */) {
5024
- groth16ProcessVkey = CIRCUIT_INFO["2-1-1-5"]["groth16"].process_vkey;
5025
- groth16TallyVkey = CIRCUIT_INFO["2-1-1-5"]["groth16"].tally_vkey;
5026
- } else if (proofSystem === "plonk" /* PLONK */) {
5027
- plonkProcessVkey = CIRCUIT_INFO["2-1-1-5"]["plonk"]?.process_vkey;
5028
- plonkTallyVkey = CIRCUIT_INFO["2-1-1-5"]["plonk"]?.tally_vkey;
5029
- }
5030
- } else if (maxVoter <= 625 && maxOption <= 25) {
5031
- parameters = CIRCUIT_INFO["4-2-2-25"].parameter;
5032
- if (proofSystem === "groth16" /* GROTH16 */) {
5033
- groth16ProcessVkey = CIRCUIT_INFO["4-2-2-25"]["groth16"].process_vkey;
5034
- groth16TallyVkey = CIRCUIT_INFO["4-2-2-25"]["groth16"].tally_vkey;
5035
- } else if (proofSystem === "plonk" /* PLONK */) {
5036
- plonkProcessVkey = CIRCUIT_INFO["4-2-2-25"]["plonk"]?.process_vkey;
5037
- plonkTallyVkey = CIRCUIT_INFO["4-2-2-25"]["plonk"]?.tally_vkey;
5038
- }
5039
- } else if (maxVoter <= 15625 && maxOption <= 125) {
5040
- parameters = CIRCUIT_INFO["6-3-3-125"].parameter;
5041
- if (proofSystem === "groth16" /* GROTH16 */) {
5042
- groth16ProcessVkey = CIRCUIT_INFO["6-3-3-125"]["groth16"].process_vkey;
5043
- groth16TallyVkey = CIRCUIT_INFO["6-3-3-125"]["groth16"].tally_vkey;
5044
- } else if (proofSystem === "plonk" /* PLONK */) {
5045
- plonkProcessVkey = CIRCUIT_INFO["6-3-3-125"]["plonk"]?.process_vkey;
5046
- plonkTallyVkey = CIRCUIT_INFO["6-3-3-125"]["plonk"]?.tally_vkey;
5047
- }
5048
- } else if (maxVoter <= 1953125 && maxOption <= 125) {
5049
- parameters = CIRCUIT_INFO["9-4-3-625"].parameter;
5050
- if (proofSystem === "groth16" /* GROTH16 */) {
5051
- if (circuitType === "0" /* IP1V */) {
5052
- groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_1p1v_vkey;
5053
- groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_1p1v_vkey;
5054
- } else if (circuitType === "1" /* QV */) {
5055
- groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_qv_vkey;
5056
- groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_qv_vkey;
5057
- }
5058
- } else if (proofSystem === "plonk" /* PLONK */) {
5059
- throw new Error("PLONK is not supported for MACI-9");
6264
+ const multiplier = typeof fee === "number" ? fee : 1.8;
6265
+ const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
6266
+ const calculatedFee = (0, import_stargate2.calculateFee)(
6267
+ Math.round(gasEstimation * multiplier),
6268
+ gasPrice
6269
+ );
6270
+ const grantFee = {
6271
+ amount: calculatedFee.amount,
6272
+ gas: calculatedFee.gas,
6273
+ granter: this.saasAddress
6274
+ };
6275
+ return client.removeOperator({ operator }, grantFee);
6276
+ } else if (gasStation && typeof fee === "object") {
6277
+ const grantFee = {
6278
+ ...fee,
6279
+ granter: this.saasAddress
6280
+ };
6281
+ return client.removeOperator({ operator }, grantFee);
5060
6282
  }
5061
- } else {
5062
- throw new Error("Number of voters or options is too large.");
6283
+ return client.removeOperator({ operator }, fee);
5063
6284
  }
5064
- switch (type) {
5065
- case "0" /* MACI */:
5066
- return {
5067
- parameters,
5068
- groth16ProcessVkey,
5069
- groth16TallyVkey,
5070
- plonkProcessVkey,
5071
- plonkTallyVkey,
5072
- maciVoteType,
5073
- maciCertSystem
6285
+ async isSaasOperator({
6286
+ signer,
6287
+ operator
6288
+ }) {
6289
+ const client = await createSaasClientBy({
6290
+ rpcEndpoint: this.rpcEndpoint,
6291
+ wallet: signer,
6292
+ contractAddress: this.saasAddress
6293
+ });
6294
+ return client.isOperator({ address: operator });
6295
+ }
6296
+ async depositSaas({
6297
+ signer,
6298
+ amount,
6299
+ gasStation = false,
6300
+ fee = 1.8
6301
+ }) {
6302
+ const client = await createSaasClientBy({
6303
+ rpcEndpoint: this.rpcEndpoint,
6304
+ wallet: signer,
6305
+ contractAddress: this.saasAddress
6306
+ });
6307
+ const funds = [
6308
+ {
6309
+ denom: "peaka",
6310
+ amount
6311
+ }
6312
+ ];
6313
+ if (gasStation && typeof fee !== "object") {
6314
+ const [{ address }] = await signer.getAccounts();
6315
+ const contractClient = await this.contractClient({ signer });
6316
+ const msg = {
6317
+ deposit: {}
5074
6318
  };
5075
- case "1" /* AMACI */:
5076
- return {
5077
- // parameters,
5078
- // groth16ProcessVkey,
5079
- // groth16TallyVkey,
5080
- // plonkProcessVkey,
5081
- // plonkTallyVkey,
6319
+ const gasEstimation = await contractClient.simulate(
6320
+ address,
6321
+ [
6322
+ {
6323
+ typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
6324
+ value: {
6325
+ sender: address,
6326
+ contract: this.saasAddress,
6327
+ msg: new TextEncoder().encode(JSON.stringify(msg)),
6328
+ funds
6329
+ }
6330
+ }
6331
+ ],
6332
+ ""
6333
+ );
6334
+ const multiplier = typeof fee === "number" ? fee : 1.8;
6335
+ const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
6336
+ const calculatedFee = (0, import_stargate2.calculateFee)(
6337
+ Math.round(gasEstimation * multiplier),
6338
+ gasPrice
6339
+ );
6340
+ const grantFee = {
6341
+ amount: calculatedFee.amount,
6342
+ gas: calculatedFee.gas,
6343
+ granter: this.saasAddress
5082
6344
  };
5083
- case "2" /* ORACLE_MACI */:
5084
- if (circuitType === "0" /* IP1V */) {
5085
- groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_1p1v_vkey;
5086
- groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_1p1v_vkey;
5087
- } else if (circuitType === "1" /* QV */) {
5088
- groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_qv_vkey;
5089
- groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_qv_vkey;
5090
- }
5091
- return {
5092
- parameters: CIRCUIT_INFO["9-4-3-625"].parameter,
5093
- groth16ProcessVkey,
5094
- groth16TallyVkey,
5095
- plonkProcessVkey: null,
5096
- plonkTallyVkey: null,
5097
- maciVoteType,
5098
- maciCertSystem: "0"
6345
+ return client.deposit(grantFee, void 0, funds);
6346
+ } else if (gasStation && typeof fee === "object") {
6347
+ const grantFee = {
6348
+ ...fee,
6349
+ granter: this.saasAddress
5099
6350
  };
5100
- }
5101
- }
5102
- function getAMaciRoundCircuitFee(network, maxVoter, maxOption) {
5103
- let requiredFee = {
5104
- denom: "peaka",
5105
- amount: "0"
5106
- };
5107
- if (maxVoter <= 25 && maxOption <= 5) {
5108
- if (network === "mainnet") {
5109
- requiredFee.amount = "20000000000000000000";
5110
- } else {
5111
- requiredFee.amount = "20000000000000000000";
6351
+ return client.deposit(grantFee, void 0, funds);
5112
6352
  }
5113
- } else if (maxVoter <= 625 && maxOption <= 25) {
5114
- if (network === "mainnet") {
5115
- requiredFee.amount = "750000000000000000000";
5116
- } else {
5117
- requiredFee.amount = "750000000000000000000";
6353
+ return client.deposit(fee, void 0, funds);
6354
+ }
6355
+ async withdrawSaas({
6356
+ signer,
6357
+ amount,
6358
+ gasStation = false,
6359
+ fee = 1.8
6360
+ }) {
6361
+ const client = await createSaasClientBy({
6362
+ rpcEndpoint: this.rpcEndpoint,
6363
+ wallet: signer,
6364
+ contractAddress: this.saasAddress
6365
+ });
6366
+ if (gasStation && typeof fee !== "object") {
6367
+ const [{ address }] = await signer.getAccounts();
6368
+ const contractClient = await this.contractClient({ signer });
6369
+ const msg = {
6370
+ withdraw: {
6371
+ amount
6372
+ }
6373
+ };
6374
+ const gasEstimation = await contractClient.simulate(
6375
+ address,
6376
+ [
6377
+ {
6378
+ typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
6379
+ value: {
6380
+ sender: address,
6381
+ contract: this.saasAddress,
6382
+ msg: new TextEncoder().encode(JSON.stringify(msg))
6383
+ }
6384
+ }
6385
+ ],
6386
+ ""
6387
+ );
6388
+ const multiplier = typeof fee === "number" ? fee : 1.8;
6389
+ const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
6390
+ const calculatedFee = (0, import_stargate2.calculateFee)(
6391
+ Math.round(gasEstimation * multiplier),
6392
+ gasPrice
6393
+ );
6394
+ const grantFee = {
6395
+ amount: calculatedFee.amount,
6396
+ gas: calculatedFee.gas,
6397
+ granter: this.saasAddress
6398
+ };
6399
+ return client.withdraw({ amount }, grantFee);
6400
+ } else if (gasStation && typeof fee === "object") {
6401
+ const grantFee = {
6402
+ ...fee,
6403
+ granter: this.saasAddress
6404
+ };
6405
+ return client.withdraw({ amount }, grantFee);
5118
6406
  }
5119
- } else {
5120
- throw new Error("Number of voters or options is too large.");
6407
+ return client.withdraw({ amount }, fee);
5121
6408
  }
5122
- return requiredFee;
5123
- }
5124
-
5125
- // src/libs/contract/contract.ts
5126
- var import_stargate2 = require("@cosmjs/stargate");
5127
- var Contract = class {
5128
- constructor({
5129
- network,
5130
- rpcEndpoint,
5131
- registryAddress,
5132
- saasAddress,
5133
- maciCodeId,
5134
- oracleCodeId,
5135
- saasOracleCodeId,
5136
- feegrantOperator,
5137
- whitelistBackendPubkey
6409
+ async queryRoundInfo({
6410
+ signer,
6411
+ roundAddress
5138
6412
  }) {
5139
- this.network = network;
5140
- this.rpcEndpoint = rpcEndpoint;
5141
- this.registryAddress = registryAddress;
5142
- this.saasAddress = saasAddress;
5143
- this.maciCodeId = maciCodeId;
5144
- this.oracleCodeId = oracleCodeId;
5145
- this.saasOracleCodeId = saasOracleCodeId;
5146
- this.feegrantOperator = feegrantOperator;
5147
- this.whitelistBackendPubkey = whitelistBackendPubkey;
6413
+ const client = await createMaciClientBy({
6414
+ rpcEndpoint: this.rpcEndpoint,
6415
+ wallet: signer,
6416
+ contractAddress: roundAddress
6417
+ });
6418
+ const roundInfo = await client.getRoundInfo();
6419
+ return roundInfo;
5148
6420
  }
5149
- async createAMaciRound({
6421
+ async oracleMaciClient({
5150
6422
  signer,
5151
- startVoting,
5152
- endVoting,
5153
- operator,
5154
- whitelist,
5155
- title,
5156
- description,
5157
- link,
5158
- maxVoter,
5159
- maxOption,
5160
- voiceCreditAmount,
5161
- circuitType,
5162
- preDeactivateRoot,
5163
- fee = "auto"
6423
+ contractAddress
5164
6424
  }) {
5165
- const start_time = (startVoting.getTime() * 10 ** 6).toString();
5166
- const end_time = (endVoting.getTime() * 10 ** 6).toString();
5167
- const client = await createRegistryClientBy({
6425
+ const client = await createOracleMaciClientBy({
5168
6426
  rpcEndpoint: this.rpcEndpoint,
5169
6427
  wallet: signer,
5170
- contractAddress: this.registryAddress
5171
- });
5172
- const requiredFee = getAMaciRoundCircuitFee(
5173
- this.network,
5174
- maxVoter,
5175
- maxOption
5176
- );
5177
- preDeactivateRoot = preDeactivateRoot || "0";
5178
- const res = await client.createRound(
5179
- {
5180
- operator,
5181
- preDeactivateRoot,
5182
- voiceCreditAmount,
5183
- whitelist,
5184
- roundInfo: {
5185
- title,
5186
- description: description || "",
5187
- link: link || ""
5188
- },
5189
- votingTime: {
5190
- start_time,
5191
- end_time
5192
- },
5193
- maxVoter: maxVoter.toString(),
5194
- maxOption: maxOption.toString(),
5195
- certificationSystem: "0",
5196
- circuitType
5197
- },
5198
- fee,
5199
- void 0,
5200
- [requiredFee]
5201
- );
5202
- let contractAddress = "";
5203
- res.events.map((event) => {
5204
- if (event.type === "wasm") {
5205
- let actionEvent = event.attributes.find(
5206
- (attr) => attr.key === "action"
5207
- );
5208
- if (actionEvent.value === "created_round") {
5209
- contractAddress = event.attributes.find((attr) => attr.key === "round_addr").value.toString();
5210
- }
5211
- }
6428
+ contractAddress
5212
6429
  });
5213
- return {
5214
- ...res,
6430
+ return client;
6431
+ }
6432
+ async registryClient({
6433
+ signer,
6434
+ contractAddress
6435
+ }) {
6436
+ return createRegistryClientBy({
6437
+ rpcEndpoint: this.rpcEndpoint,
6438
+ wallet: signer,
5215
6439
  contractAddress
5216
- };
6440
+ });
5217
6441
  }
5218
- async createMaciRound({
6442
+ async maciClient({
5219
6443
  signer,
5220
- operatorPubkey,
5221
- startVoting,
5222
- endVoting,
5223
- whitelist,
5224
- title,
5225
- description,
5226
- link,
5227
- maxVoter,
5228
- maxOption,
5229
- circuitType,
5230
- certSystemType,
5231
- fee = "auto"
6444
+ contractAddress
5232
6445
  }) {
5233
- const start_time = (startVoting.getTime() * 10 ** 6).toString();
5234
- const end_time = (endVoting.getTime() * 10 ** 6).toString();
5235
- const [{ address }] = await signer.getAccounts();
5236
- const client = await createContractClientByWallet(this.rpcEndpoint, signer);
5237
- const [operatorPubkeyX, operatorPubkeyY] = unpackPubKey(
5238
- BigInt(operatorPubkey)
5239
- );
5240
- const {
5241
- parameters,
5242
- groth16ProcessVkey,
5243
- groth16TallyVkey,
5244
- plonkProcessVkey,
5245
- plonkTallyVkey,
5246
- maciVoteType,
5247
- maciCertSystem
5248
- } = getContractParams(
5249
- "0" /* MACI */,
5250
- circuitType,
5251
- certSystemType,
5252
- maxVoter,
5253
- maxOption
5254
- );
5255
- const instantiateResponse = await client.instantiate(
5256
- address,
5257
- this.maciCodeId,
5258
- {
5259
- round_info: { title, description: description || "", link: link || "" },
5260
- voting_time: {
5261
- start_time,
5262
- end_time
5263
- },
5264
- parameters,
5265
- coordinator: {
5266
- x: operatorPubkeyX.toString(),
5267
- y: operatorPubkeyY.toString()
5268
- },
5269
- groth16_process_vkey: groth16ProcessVkey,
5270
- groth16_tally_vkey: groth16TallyVkey,
5271
- plonk_process_vkey: plonkProcessVkey,
5272
- plonk_tally_vkey: plonkTallyVkey,
5273
- max_vote_options: maxOption.toString(),
5274
- whitelist,
5275
- circuit_type: maciVoteType,
5276
- certification_system: maciCertSystem,
5277
- qtr_lib: QTR_LIB
5278
- },
5279
- `[MACI] ${title}`,
5280
- fee
5281
- );
5282
- return instantiateResponse;
6446
+ return createMaciClientBy({
6447
+ rpcEndpoint: this.rpcEndpoint,
6448
+ wallet: signer,
6449
+ contractAddress
6450
+ });
5283
6451
  }
5284
- async createOracleMaciRound({
6452
+ async amaciClient({
5285
6453
  signer,
5286
- operatorPubkey,
5287
- startVoting,
5288
- endVoting,
5289
- title,
5290
- description,
5291
- link,
5292
- voteOptionMap,
5293
- circuitType,
5294
- whitelistEcosystem,
5295
- whitelistSnapshotHeight,
5296
- whitelistVotingPowerArgs,
5297
- fee = "auto"
6454
+ contractAddress
5298
6455
  }) {
5299
- const start_time = (startVoting.getTime() * 1e6).toString();
5300
- const end_time = (endVoting.getTime() * 1e6).toString();
5301
- const [{ address }] = await signer.getAccounts();
5302
- const client = await createContractClientByWallet(this.rpcEndpoint, signer);
5303
- const [operatorPubkeyX, operatorPubkeyY] = unpackPubKey(
5304
- BigInt(operatorPubkey)
5305
- );
5306
- const { maciVoteType, maciCertSystem } = getContractParams(
5307
- "2" /* ORACLE_MACI */,
5308
- circuitType,
5309
- "groth16" /* GROTH16 */,
5310
- 0,
5311
- 0
5312
- );
5313
- const instantiateResponse = await client.instantiate(
5314
- address,
5315
- this.oracleCodeId,
5316
- {
5317
- round_info: { title, description: description || "", link: link || "" },
5318
- voting_time: {
5319
- start_time,
5320
- end_time
5321
- },
5322
- coordinator: {
5323
- x: operatorPubkeyX.toString(),
5324
- y: operatorPubkeyY.toString()
5325
- },
5326
- vote_option_map: voteOptionMap,
5327
- whitelist_backend_pubkey: this.whitelistBackendPubkey,
5328
- whitelist_ecosystem: whitelistEcosystem,
5329
- whitelist_snapshot_height: whitelistSnapshotHeight,
5330
- whitelist_voting_power_args: whitelistVotingPowerArgs,
5331
- circuit_type: maciVoteType,
5332
- certification_system: maciCertSystem,
5333
- feegrant_operator: this.feegrantOperator
5334
- },
5335
- `[Oracle MACI] ${title}`,
5336
- fee
5337
- );
5338
- return instantiateResponse;
6456
+ return createAMaciClientBy({
6457
+ rpcEndpoint: this.rpcEndpoint,
6458
+ wallet: signer,
6459
+ contractAddress
6460
+ });
5339
6461
  }
5340
- async createSaasOracleMaciRound({
6462
+ async apiMaciClient({
6463
+ signer,
6464
+ contractAddress
6465
+ }) {
6466
+ return createApiMaciClientBy({
6467
+ rpcEndpoint: this.rpcEndpoint,
6468
+ wallet: signer,
6469
+ contractAddress
6470
+ });
6471
+ }
6472
+ async saasClient({
6473
+ signer,
6474
+ contractAddress
6475
+ }) {
6476
+ return createSaasClientBy({
6477
+ rpcEndpoint: this.rpcEndpoint,
6478
+ wallet: signer,
6479
+ contractAddress
6480
+ });
6481
+ }
6482
+ async apiSaasClient({
6483
+ signer,
6484
+ contractAddress
6485
+ }) {
6486
+ return createApiSaasClientBy({
6487
+ rpcEndpoint: this.rpcEndpoint,
6488
+ wallet: signer,
6489
+ contractAddress
6490
+ });
6491
+ }
6492
+ async contractClient({ signer }) {
6493
+ return createContractClientByWallet(this.rpcEndpoint, signer);
6494
+ }
6495
+ async createApiSaasMaciRound({
5341
6496
  signer,
5342
6497
  operatorPubkey,
5343
6498
  startVoting,
@@ -5353,7 +6508,7 @@ var Contract = class {
5353
6508
  }) {
5354
6509
  const startTime = (startVoting.getTime() * 1e6).toString();
5355
6510
  const endTime = (endVoting.getTime() * 1e6).toString();
5356
- const client = await createSaasClientBy({
6511
+ const client = await createApiSaasClientBy({
5357
6512
  rpcEndpoint: this.rpcEndpoint,
5358
6513
  wallet: signer,
5359
6514
  contractAddress: this.saasAddress
@@ -5421,21 +6576,15 @@ var Contract = class {
5421
6576
  gas: calculatedFee.gas,
5422
6577
  granter: this.saasAddress
5423
6578
  };
5424
- createResponse = await client.createOracleMaciRound(
5425
- roundParams,
5426
- grantFee
5427
- );
6579
+ createResponse = await client.createApiMaciRound(roundParams, grantFee);
5428
6580
  } else if (gasStation && typeof fee === "object") {
5429
6581
  const grantFee = {
5430
6582
  ...fee,
5431
6583
  granter: this.saasAddress
5432
6584
  };
5433
- createResponse = await client.createOracleMaciRound(
5434
- roundParams,
5435
- grantFee
5436
- );
6585
+ createResponse = await client.createApiMaciRound(roundParams, grantFee);
5437
6586
  } else {
5438
- createResponse = await client.createOracleMaciRound(roundParams, fee);
6587
+ createResponse = await client.createApiMaciRound(roundParams, fee);
5439
6588
  }
5440
6589
  let contractAddress = "";
5441
6590
  createResponse.events.map((event) => {
@@ -5443,7 +6592,7 @@ var Contract = class {
5443
6592
  let actionEvent = event.attributes.find(
5444
6593
  (attr) => attr.key === "action"
5445
6594
  );
5446
- if (actionEvent.value === "created_oracle_maci_round") {
6595
+ if (actionEvent.value === "created_api_maci_round") {
5447
6596
  contractAddress = event.attributes.find((attr) => attr.key === "round_addr").value.toString();
5448
6597
  }
5449
6598
  }
@@ -5453,7 +6602,7 @@ var Contract = class {
5453
6602
  contractAddress
5454
6603
  };
5455
6604
  }
5456
- async setSaasOracleMaciRoundInfo({
6605
+ async setApiSaasMaciRoundInfo({
5457
6606
  signer,
5458
6607
  contractAddress,
5459
6608
  title,
@@ -5462,7 +6611,7 @@ var Contract = class {
5462
6611
  gasStation = false,
5463
6612
  fee = 1.8
5464
6613
  }) {
5465
- const client = await createSaasClientBy({
6614
+ const client = await createApiSaasClientBy({
5466
6615
  rpcEndpoint: this.rpcEndpoint,
5467
6616
  wallet: signer,
5468
6617
  contractAddress: this.saasAddress
@@ -5534,14 +6683,14 @@ var Contract = class {
5534
6683
  fee
5535
6684
  );
5536
6685
  }
5537
- async setSaasOracleMaciRoundVoteOptions({
6686
+ async setApiSaasMaciRoundVoteOptions({
5538
6687
  signer,
5539
6688
  contractAddress,
5540
6689
  voteOptionMap,
5541
6690
  gasStation = false,
5542
6691
  fee = 1.8
5543
6692
  }) {
5544
- const client = await createSaasClientBy({
6693
+ const client = await createApiSaasClientBy({
5545
6694
  rpcEndpoint: this.rpcEndpoint,
5546
6695
  wallet: signer,
5547
6696
  contractAddress: this.saasAddress
@@ -5596,238 +6745,36 @@ var Contract = class {
5596
6745
  {
5597
6746
  contractAddr: contractAddress,
5598
6747
  voteOptionMap
5599
- },
5600
- grantFee
5601
- );
5602
- }
5603
- return client.setVoteOptionsMap(
5604
- {
5605
- contractAddr: contractAddress,
5606
- voteOptionMap
5607
- },
5608
- fee
5609
- );
5610
- }
5611
- async saasGrantToVoter({
5612
- signer,
5613
- baseAmount,
5614
- contractAddress,
5615
- grantee,
5616
- gasStation = false,
5617
- fee = 1.8
5618
- }) {
5619
- const client = await createSaasClientBy({
5620
- rpcEndpoint: this.rpcEndpoint,
5621
- wallet: signer,
5622
- contractAddress: this.saasAddress
5623
- });
5624
- if (gasStation && typeof fee !== "object") {
5625
- const [{ address }] = await signer.getAccounts();
5626
- const contractClient = await this.contractClient({ signer });
5627
- const msg = {
5628
- grant_to_voter: {
5629
- base_amount: baseAmount,
5630
- contract_addr: contractAddress,
5631
- grantee
5632
- }
5633
- };
5634
- const gasEstimation = await contractClient.simulate(
5635
- address,
5636
- [
5637
- {
5638
- typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
5639
- value: {
5640
- sender: address,
5641
- contract: this.saasAddress,
5642
- msg: new TextEncoder().encode(JSON.stringify(msg))
5643
- }
5644
- }
5645
- ],
5646
- ""
5647
- );
5648
- const multiplier = typeof fee === "number" ? fee : 1.8;
5649
- const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
5650
- const calculatedFee = (0, import_stargate2.calculateFee)(
5651
- Math.round(gasEstimation * multiplier),
5652
- gasPrice
5653
- );
5654
- const grantFee = {
5655
- amount: calculatedFee.amount,
5656
- gas: calculatedFee.gas,
5657
- granter: this.saasAddress
5658
- };
5659
- return client.grantToVoter(
5660
- {
5661
- baseAmount,
5662
- contractAddr: contractAddress,
5663
- grantee
5664
- },
5665
- grantFee
5666
- );
5667
- } else if (gasStation && typeof fee === "object") {
5668
- const grantFee = {
5669
- ...fee,
5670
- granter: this.saasAddress
5671
- };
5672
- return client.grantToVoter(
5673
- {
5674
- baseAmount,
5675
- contractAddr: contractAddress,
5676
- grantee
5677
- },
5678
- grantFee
5679
- );
5680
- }
5681
- return client.grantToVoter(
5682
- {
5683
- baseAmount,
5684
- contractAddr: contractAddress,
5685
- grantee
5686
- },
5687
- fee
5688
- );
5689
- }
5690
- async addSaasOperator({
5691
- signer,
5692
- operator,
5693
- gasStation = false,
5694
- fee = 1.8
5695
- }) {
5696
- const client = await createSaasClientBy({
5697
- rpcEndpoint: this.rpcEndpoint,
5698
- wallet: signer,
5699
- contractAddress: this.saasAddress
5700
- });
5701
- if (gasStation && typeof fee !== "object") {
5702
- const [{ address }] = await signer.getAccounts();
5703
- const contractClient = await this.contractClient({ signer });
5704
- const msg = {
5705
- add_operator: {
5706
- operator
5707
- }
5708
- };
5709
- const gasEstimation = await contractClient.simulate(
5710
- address,
5711
- [
5712
- {
5713
- typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
5714
- value: {
5715
- sender: address,
5716
- contract: this.saasAddress,
5717
- msg: new TextEncoder().encode(JSON.stringify(msg))
5718
- }
5719
- }
5720
- ],
5721
- ""
5722
- );
5723
- const multiplier = typeof fee === "number" ? fee : 1.8;
5724
- const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
5725
- const calculatedFee = (0, import_stargate2.calculateFee)(
5726
- Math.round(gasEstimation * multiplier),
5727
- gasPrice
5728
- );
5729
- const grantFee = {
5730
- amount: calculatedFee.amount,
5731
- gas: calculatedFee.gas,
5732
- granter: this.saasAddress
5733
- };
5734
- return client.addOperator({ operator }, grantFee);
5735
- } else if (gasStation && typeof fee === "object") {
5736
- const grantFee = {
5737
- ...fee,
5738
- granter: this.saasAddress
5739
- };
5740
- return client.addOperator({ operator }, grantFee);
5741
- }
5742
- return client.addOperator({ operator }, fee);
5743
- }
5744
- async removeSaasOperator({
5745
- signer,
5746
- operator,
5747
- gasStation = false,
5748
- fee = 1.8
5749
- }) {
5750
- const client = await createSaasClientBy({
5751
- rpcEndpoint: this.rpcEndpoint,
5752
- wallet: signer,
5753
- contractAddress: this.saasAddress
5754
- });
5755
- if (gasStation && typeof fee !== "object") {
5756
- const [{ address }] = await signer.getAccounts();
5757
- const contractClient = await this.contractClient({ signer });
5758
- const msg = {
5759
- remove_operator: {
5760
- operator
5761
- }
5762
- };
5763
- const gasEstimation = await contractClient.simulate(
5764
- address,
5765
- [
5766
- {
5767
- typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
5768
- value: {
5769
- sender: address,
5770
- contract: this.saasAddress,
5771
- msg: new TextEncoder().encode(JSON.stringify(msg))
5772
- }
5773
- }
5774
- ],
5775
- ""
5776
- );
5777
- const multiplier = typeof fee === "number" ? fee : 1.8;
5778
- const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
5779
- const calculatedFee = (0, import_stargate2.calculateFee)(
5780
- Math.round(gasEstimation * multiplier),
5781
- gasPrice
5782
- );
5783
- const grantFee = {
5784
- amount: calculatedFee.amount,
5785
- gas: calculatedFee.gas,
5786
- granter: this.saasAddress
5787
- };
5788
- return client.removeOperator({ operator }, grantFee);
5789
- } else if (gasStation && typeof fee === "object") {
5790
- const grantFee = {
5791
- ...fee,
5792
- granter: this.saasAddress
5793
- };
5794
- return client.removeOperator({ operator }, grantFee);
5795
- }
5796
- return client.removeOperator({ operator }, fee);
5797
- }
5798
- async isSaasOperator({
5799
- signer,
5800
- operator
5801
- }) {
5802
- const client = await createSaasClientBy({
5803
- rpcEndpoint: this.rpcEndpoint,
5804
- wallet: signer,
5805
- contractAddress: this.saasAddress
5806
- });
5807
- return client.isOperator({ address: operator });
6748
+ },
6749
+ grantFee
6750
+ );
6751
+ }
6752
+ return client.setVoteOptionsMap(
6753
+ {
6754
+ contractAddr: contractAddress,
6755
+ voteOptionMap
6756
+ },
6757
+ fee
6758
+ );
5808
6759
  }
5809
- async depositSaas({
6760
+ async addApiSaasOperator({
5810
6761
  signer,
5811
- amount,
6762
+ operator,
5812
6763
  gasStation = false,
5813
6764
  fee = 1.8
5814
6765
  }) {
5815
- const client = await createSaasClientBy({
6766
+ const client = await createApiSaasClientBy({
5816
6767
  rpcEndpoint: this.rpcEndpoint,
5817
6768
  wallet: signer,
5818
6769
  contractAddress: this.saasAddress
5819
6770
  });
5820
- const funds = [
5821
- {
5822
- denom: "peaka",
5823
- amount
5824
- }
5825
- ];
5826
6771
  if (gasStation && typeof fee !== "object") {
5827
6772
  const [{ address }] = await signer.getAccounts();
5828
6773
  const contractClient = await this.contractClient({ signer });
5829
6774
  const msg = {
5830
- deposit: {}
6775
+ add_operator: {
6776
+ operator
6777
+ }
5831
6778
  };
5832
6779
  const gasEstimation = await contractClient.simulate(
5833
6780
  address,
@@ -5837,8 +6784,7 @@ var Contract = class {
5837
6784
  value: {
5838
6785
  sender: address,
5839
6786
  contract: this.saasAddress,
5840
- msg: new TextEncoder().encode(JSON.stringify(msg)),
5841
- funds
6787
+ msg: new TextEncoder().encode(JSON.stringify(msg))
5842
6788
  }
5843
6789
  }
5844
6790
  ],
@@ -5855,23 +6801,23 @@ var Contract = class {
5855
6801
  gas: calculatedFee.gas,
5856
6802
  granter: this.saasAddress
5857
6803
  };
5858
- return client.deposit(grantFee, void 0, funds);
6804
+ return client.addOperator({ operator }, grantFee);
5859
6805
  } else if (gasStation && typeof fee === "object") {
5860
6806
  const grantFee = {
5861
6807
  ...fee,
5862
6808
  granter: this.saasAddress
5863
6809
  };
5864
- return client.deposit(grantFee, void 0, funds);
6810
+ return client.addOperator({ operator }, grantFee);
5865
6811
  }
5866
- return client.deposit(fee, void 0, funds);
6812
+ return client.addOperator({ operator }, fee);
5867
6813
  }
5868
- async withdrawSaas({
6814
+ async removeApiSaasOperator({
5869
6815
  signer,
5870
- amount,
6816
+ operator,
5871
6817
  gasStation = false,
5872
6818
  fee = 1.8
5873
6819
  }) {
5874
- const client = await createSaasClientBy({
6820
+ const client = await createApiSaasClientBy({
5875
6821
  rpcEndpoint: this.rpcEndpoint,
5876
6822
  wallet: signer,
5877
6823
  contractAddress: this.saasAddress
@@ -5880,8 +6826,8 @@ var Contract = class {
5880
6826
  const [{ address }] = await signer.getAccounts();
5881
6827
  const contractClient = await this.contractClient({ signer });
5882
6828
  const msg = {
5883
- withdraw: {
5884
- amount
6829
+ remove_operator: {
6830
+ operator
5885
6831
  }
5886
6832
  };
5887
6833
  const gasEstimation = await contractClient.simulate(
@@ -5909,81 +6855,26 @@ var Contract = class {
5909
6855
  gas: calculatedFee.gas,
5910
6856
  granter: this.saasAddress
5911
6857
  };
5912
- return client.withdraw({ amount }, grantFee);
6858
+ return client.removeOperator({ operator }, grantFee);
5913
6859
  } else if (gasStation && typeof fee === "object") {
5914
6860
  const grantFee = {
5915
6861
  ...fee,
5916
6862
  granter: this.saasAddress
5917
6863
  };
5918
- return client.withdraw({ amount }, grantFee);
6864
+ return client.removeOperator({ operator }, grantFee);
5919
6865
  }
5920
- return client.withdraw({ amount }, fee);
5921
- }
5922
- async queryRoundInfo({
5923
- signer,
5924
- roundAddress
5925
- }) {
5926
- const client = await createMaciClientBy({
5927
- rpcEndpoint: this.rpcEndpoint,
5928
- wallet: signer,
5929
- contractAddress: roundAddress
5930
- });
5931
- const roundInfo = await client.getRoundInfo();
5932
- return roundInfo;
5933
- }
5934
- async oracleMaciClient({
5935
- signer,
5936
- contractAddress
5937
- }) {
5938
- const client = await createOracleMaciClientBy({
5939
- rpcEndpoint: this.rpcEndpoint,
5940
- wallet: signer,
5941
- contractAddress
5942
- });
5943
- return client;
5944
- }
5945
- async registryClient({
5946
- signer,
5947
- contractAddress
5948
- }) {
5949
- return createRegistryClientBy({
5950
- rpcEndpoint: this.rpcEndpoint,
5951
- wallet: signer,
5952
- contractAddress
5953
- });
5954
- }
5955
- async maciClient({
5956
- signer,
5957
- contractAddress
5958
- }) {
5959
- return createMaciClientBy({
5960
- rpcEndpoint: this.rpcEndpoint,
5961
- wallet: signer,
5962
- contractAddress
5963
- });
5964
- }
5965
- async amaciClient({
5966
- signer,
5967
- contractAddress
5968
- }) {
5969
- return createAMaciClientBy({
5970
- rpcEndpoint: this.rpcEndpoint,
5971
- wallet: signer,
5972
- contractAddress
5973
- });
6866
+ return client.removeOperator({ operator }, fee);
5974
6867
  }
5975
- async saasClient({
6868
+ async isApiSaasOperator({
5976
6869
  signer,
5977
- contractAddress
6870
+ operator
5978
6871
  }) {
5979
- return createSaasClientBy({
6872
+ const client = await createApiSaasClientBy({
5980
6873
  rpcEndpoint: this.rpcEndpoint,
5981
6874
  wallet: signer,
5982
- contractAddress
6875
+ contractAddress: this.saasAddress
5983
6876
  });
5984
- }
5985
- async contractClient({ signer }) {
5986
- return createContractClientByWallet(this.rpcEndpoint, signer);
6877
+ return client.isOperator({ address: operator });
5987
6878
  }
5988
6879
  };
5989
6880
 
@@ -6390,6 +7281,46 @@ var MACI = class {
6390
7281
  throw Error(`Signup failed! ${error}`);
6391
7282
  }
6392
7283
  }
7284
+ async rawSignup({
7285
+ signer,
7286
+ address,
7287
+ contractAddress,
7288
+ pubKey,
7289
+ oracleCertificate,
7290
+ gasStation = false,
7291
+ fee
7292
+ }) {
7293
+ try {
7294
+ if (!address) {
7295
+ address = (await signer.getAccounts())[0].address;
7296
+ }
7297
+ const client = await this.contract.contractClient({
7298
+ signer
7299
+ });
7300
+ if (oracleCertificate) {
7301
+ return await this.signupOracle({
7302
+ client,
7303
+ address,
7304
+ pubKey,
7305
+ contractAddress,
7306
+ oracleCertificate,
7307
+ gasStation,
7308
+ fee
7309
+ });
7310
+ } else {
7311
+ return await this.signupSimple({
7312
+ client,
7313
+ address,
7314
+ pubKey,
7315
+ contractAddress,
7316
+ gasStation,
7317
+ fee
7318
+ });
7319
+ }
7320
+ } catch (error) {
7321
+ throw Error(`Signup failed! ${error}`);
7322
+ }
7323
+ }
6393
7324
  async processVoteOptions({
6394
7325
  selectedOptions,
6395
7326
  contractAddress,
@@ -6508,6 +7439,84 @@ var MACI = class {
6508
7439
  throw Error(`Vote failed! ${error}`);
6509
7440
  }
6510
7441
  }
7442
+ async rawVote({
7443
+ signer,
7444
+ address,
7445
+ contractAddress,
7446
+ pubKey,
7447
+ payload,
7448
+ gasStation = false,
7449
+ fee = 1.8
7450
+ }) {
7451
+ const stateIdx = await this.getStateIdxByPubKey({
7452
+ contractAddress,
7453
+ pubKey
7454
+ });
7455
+ if (stateIdx === -1) {
7456
+ throw new Error(
7457
+ "State index is not set, Please signup or addNewKey first"
7458
+ );
7459
+ }
7460
+ try {
7461
+ const round = await this.indexer.getRoundWithFields(contractAddress, [
7462
+ "maciType",
7463
+ "voiceCreditAmount"
7464
+ ]);
7465
+ if (isErrorResponse(round)) {
7466
+ throw new Error(
7467
+ `Failed to get round info: ${round.error.type} ${round.error.message}`
7468
+ );
7469
+ }
7470
+ let voiceCreditBalance;
7471
+ if (round.data.round.maciType === "aMACI") {
7472
+ const isWhiteListed = await this.isWhitelisted({
7473
+ signer,
7474
+ address,
7475
+ contractAddress
7476
+ });
7477
+ if (isWhiteListed) {
7478
+ const round2 = await this.indexer.getRoundWithFields(contractAddress, [
7479
+ "voiceCreditAmount"
7480
+ ]);
7481
+ if (!isErrorResponse(round2)) {
7482
+ if (round2.data.round.voiceCreditAmount) {
7483
+ voiceCreditBalance = round2.data.round.voiceCreditAmount;
7484
+ } else {
7485
+ voiceCreditBalance = "0";
7486
+ }
7487
+ } else {
7488
+ throw new Error(
7489
+ `Failed to query amaci voice credit: ${round2.error.type} ${round2.error.message}`
7490
+ );
7491
+ }
7492
+ } else {
7493
+ voiceCreditBalance = "0";
7494
+ }
7495
+ } else {
7496
+ voiceCreditBalance = await this.getVoiceCreditBalance({
7497
+ signer,
7498
+ stateIdx,
7499
+ contractAddress
7500
+ });
7501
+ }
7502
+ if (!address) {
7503
+ address = (await signer.getAccounts())[0].address;
7504
+ }
7505
+ const client = await this.contract.contractClient({
7506
+ signer
7507
+ });
7508
+ return await this.publishMessage({
7509
+ client,
7510
+ address,
7511
+ payload,
7512
+ contractAddress,
7513
+ gasStation,
7514
+ fee
7515
+ });
7516
+ } catch (error) {
7517
+ throw Error(`Vote failed! ${error}`);
7518
+ }
7519
+ }
6511
7520
  async publishMessage({
6512
7521
  client,
6513
7522
  address,
@@ -6971,9 +7980,9 @@ var MaciClient2 = class {
6971
7980
  apiEndpoint,
6972
7981
  registryAddress,
6973
7982
  saasAddress,
7983
+ apiSaasAddress,
6974
7984
  maciCodeId,
6975
7985
  oracleCodeId,
6976
- saasOracleCodeId,
6977
7986
  customFetch,
6978
7987
  defaultOptions,
6979
7988
  feegrantOperator,
@@ -6990,9 +7999,9 @@ var MaciClient2 = class {
6990
7999
  this.certificateApiEndpoint = certificateApiEndpoint || defaultParams.certificateApiEndpoint;
6991
8000
  this.registryAddress = registryAddress || defaultParams.registryAddress;
6992
8001
  this.saasAddress = saasAddress || defaultParams.saasAddress;
8002
+ this.apiSaasAddress = apiSaasAddress || defaultParams.apiSaasAddress;
6993
8003
  this.maciCodeId = maciCodeId || defaultParams.maciCodeId;
6994
8004
  this.oracleCodeId = oracleCodeId || defaultParams.oracleCodeId;
6995
- this.saasOracleCodeId = saasOracleCodeId || defaultParams.saasCodeId;
6996
8005
  this.feegrantOperator = feegrantOperator || defaultParams.oracleFeegrantOperator;
6997
8006
  this.whitelistBackendPubkey = whitelistBackendPubkey || defaultParams.oracleWhitelistBackendPubkey;
6998
8007
  this.maciKeypair = maciKeypair ?? genKeypair();
@@ -7013,9 +8022,9 @@ var MaciClient2 = class {
7013
8022
  rpcEndpoint: this.rpcEndpoint,
7014
8023
  registryAddress: this.registryAddress,
7015
8024
  saasAddress: this.saasAddress,
8025
+ apiSaasAddress: this.apiSaasAddress,
7016
8026
  maciCodeId: this.maciCodeId,
7017
8027
  oracleCodeId: this.oracleCodeId,
7018
- saasOracleCodeId: this.saasOracleCodeId,
7019
8028
  feegrantOperator: this.feegrantOperator,
7020
8029
  whitelistBackendPubkey: this.whitelistBackendPubkey
7021
8030
  });
@@ -7416,6 +8425,44 @@ var MaciClient2 = class {
7416
8425
  fee
7417
8426
  });
7418
8427
  }
8428
+ async rawSignup({
8429
+ signer,
8430
+ address,
8431
+ contractAddress,
8432
+ pubKey,
8433
+ oracleCertificate,
8434
+ gasStation = false,
8435
+ fee
8436
+ }) {
8437
+ return await this.maci.rawSignup({
8438
+ signer: this.getSigner(signer),
8439
+ address,
8440
+ contractAddress,
8441
+ pubKey,
8442
+ oracleCertificate,
8443
+ gasStation,
8444
+ fee
8445
+ });
8446
+ }
8447
+ async rawVote({
8448
+ signer,
8449
+ address,
8450
+ contractAddress,
8451
+ pubKey,
8452
+ payload,
8453
+ gasStation = false,
8454
+ fee
8455
+ }) {
8456
+ return await this.maci.rawVote({
8457
+ signer: this.getSigner(signer),
8458
+ address,
8459
+ contractAddress,
8460
+ pubKey,
8461
+ payload,
8462
+ gasStation,
8463
+ fee
8464
+ });
8465
+ }
7419
8466
  };
7420
8467
  // Annotate the CommonJS export names for ESM import in node:
7421
8468
  0 && (module.exports = {