@dorafactory/maci-sdk 0.1.2 → 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
@@ -428,15 +428,14 @@ function getDefaultParams(network = "mainnet") {
428
428
  certificateApiEndpoint: "https://vota-certificate-api.dorafactory.org/api/v1",
429
429
  registryAddress: "dora1smg5qp5trjdkcekdjssqpjehdjf6n4cjss0clyvqcud3t3u3948s8rmgg4",
430
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: 124,
436
436
  oracleWhitelistBackendPubkey: "A61YtCv2ibMZmDeM02nEElil8wlHx1tLKogBk5dPgf/Q",
437
437
  oracleFeegrantOperator: "dora16s9tljk8dy9ae335yvyzlm8gvkypx9228q8pq8",
438
- oracleCodeIds: ["101", "116", "117", "119"],
439
- saasCodeIds: ["124"]
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,6 +4565,470 @@ var SaasClient = class extends SaasQueryClient {
4567
4565
  }
4568
4566
  };
4569
4567
 
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
+ }
4732
+ };
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
+
4570
5032
  // src/libs/contract/config.ts
4571
5033
  var defaultSigningClientOptions = {
4572
5034
  broadcastPollIntervalMs: 8e3,
@@ -4574,771 +5036,1463 @@ var defaultSigningClientOptions = {
4574
5036
  // 2min30s for the tx to be confirmed
4575
5037
  gasPrice: import_stargate.GasPrice.fromString("10000000000peaka")
4576
5038
  };
4577
- async function createMaciClientBy({
4578
- rpcEndpoint,
4579
- wallet,
4580
- contractAddress
4581
- }) {
4582
- const signingCosmWasmClient = await createContractClientByWallet(
4583
- rpcEndpoint,
4584
- wallet
4585
- );
4586
- const [{ address }] = await wallet.getAccounts();
4587
- return new MaciClient(signingCosmWasmClient, address, contractAddress);
4588
- }
4589
- async function createAMaciClientBy({
4590
- rpcEndpoint,
4591
- wallet,
4592
- contractAddress
4593
- }) {
4594
- const signingCosmWasmClient = await createContractClientByWallet(
4595
- rpcEndpoint,
4596
- wallet
4597
- );
4598
- const [{ address }] = await wallet.getAccounts();
4599
- return new AMaciClient(signingCosmWasmClient, address, contractAddress);
4600
- }
4601
- async function createRegistryClientBy({
4602
- rpcEndpoint,
4603
- wallet,
4604
- contractAddress
4605
- }) {
4606
- const signingCosmWasmClient = await createContractClientByWallet(
4607
- rpcEndpoint,
4608
- wallet
4609
- );
4610
- const [{ address }] = await wallet.getAccounts();
4611
- return new RegistryClient(signingCosmWasmClient, address, contractAddress);
4612
- }
4613
- async function createSaasClientBy({
4614
- rpcEndpoint,
4615
- wallet,
4616
- contractAddress
4617
- }) {
4618
- const signingCosmWasmClient = await createContractClientByWallet(
4619
- rpcEndpoint,
4620
- wallet
4621
- );
4622
- const [{ address }] = await wallet.getAccounts();
4623
- return new SaasClient(signingCosmWasmClient, address, contractAddress);
4624
- }
4625
- async function createOracleMaciClientBy({
4626
- rpcEndpoint,
4627
- wallet,
4628
- contractAddress
4629
- }) {
4630
- const signingCosmWasmClient = await createContractClientByWallet(
4631
- rpcEndpoint,
4632
- wallet
4633
- );
4634
- const [{ address }] = await wallet.getAccounts();
4635
- return new OracleMaciClient(signingCosmWasmClient, address, contractAddress);
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",
5157
+ int_state_tree_depth: "1",
5158
+ vote_option_tree_depth: "1",
5159
+ message_batch_size: "5"
5160
+ },
5161
+ groth16: {
5162
+ process_vkey: {
5163
+ vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
5164
+ vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
5165
+ vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
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
+ }
4636
5588
  }
4637
- async function createContractClientByWallet(rpcEndpoint, wallet) {
4638
- const client = await import_cosmwasm_stargate.SigningCosmWasmClient.connectWithSigner(
4639
- rpcEndpoint,
4640
- wallet,
4641
- {
4642
- ...defaultSigningClientOptions
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";
4643
5599
  }
4644
- );
4645
- return client;
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;
4646
5610
  }
4647
5611
 
4648
- // src/types/index.ts
4649
- var MaciCircuitType = /* @__PURE__ */ ((MaciCircuitType2) => {
4650
- MaciCircuitType2["IP1V"] = "0";
4651
- MaciCircuitType2["QV"] = "1";
4652
- return MaciCircuitType2;
4653
- })(MaciCircuitType || {});
4654
- var MaciCertSystemType = /* @__PURE__ */ ((MaciCertSystemType2) => {
4655
- MaciCertSystemType2["GROTH16"] = "groth16";
4656
- MaciCertSystemType2["PLONK"] = "plonk";
4657
- return MaciCertSystemType2;
4658
- })(MaciCertSystemType || {});
4659
- var MaciRoundType = /* @__PURE__ */ ((MaciRoundType2) => {
4660
- MaciRoundType2["MACI"] = "0";
4661
- MaciRoundType2["AMACI"] = "1";
4662
- MaciRoundType2["ORACLE_MACI"] = "2";
4663
- return MaciRoundType2;
4664
- })(MaciRoundType || {});
4665
-
4666
- // src/libs/contract/vars.ts
4667
- var CIRCUIT_INFO = {
4668
- "2-1-1-5": {
4669
- parameter: {
4670
- state_tree_depth: "2",
4671
- int_state_tree_depth: "1",
4672
- vote_option_tree_depth: "1",
4673
- message_batch_size: "5"
4674
- },
4675
- groth16: {
4676
- process_vkey: {
4677
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4678
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4679
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4680
- vk_delta_2: "2178a9c3805dd82071b2b28bb4c0ffc8178cad913c8c990b98b4863284dc3a5d175c0be554fc060c27c551e5e32effef015b918a0f5a2dc1b92909b8272719301c521d5f6542db5ea4775a42d32159c356a696599c1a3df011ec00559ae1c2b60d860f7e6513a7d20feaeaca401863e35a0f691dd7d30ce06d07946840de1ec8",
4681
- vk_ic0: "19126a54a9b6d0d415f892c246485cb2889487cf9c4a8cd88dab5e1140e1d0630d1d76ef4652df8887c9dc557aa57f25e221db7e5b2e4cf618a362bece107f5c",
4682
- vk_ic1: "0632e625fefc7172e8aec1070c4d32b90b6c482f6f3806773a4c55a03877c2d716cfd935eb3e3883f580c93f56adbf3a253ce3c208c52fb784f9d8fec139c617"
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
4683
5765
  },
4684
- tally_vkey: {
4685
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4686
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4687
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4688
- vk_delta_2: "2e9fad39728c543c5213599111e1a44b01720c999a6785e8136c3e3b3bf8e07e248e1933d477969ca6e27cb7a74bca18cac7e3bbdf9371be5c54fe151f6376a30955609ec69b89329322a2f435b706ca248d1312c7513853a50ef37ed0f7826c25a5c57bf07789d89e538bc24017cf2722811f21480b0bb8030ed0028ecb7cd8",
4689
- vk_ic0: "1bc1a1a3444256469c07cd6f4d1cfd9f7c9ddce596a306e0af077ca9e9c0fe9602db2a9aecef76a9dc4c19bf88c0099b04fc75410cc9004f0966440825e3790a",
4690
- vk_ic1: "05b8b475f2bfedba4fa04ab1972006da9764c2c3e6fb65d6dd0aac938fd298112a560e13770b06a3f709a49fddf016331ea205fa125026993f6666eff69f4def"
4691
- }
4692
- },
4693
- plonk: {
4694
- process_vkey: {
4695
- n: 1048575,
4696
- num_inputs: 1,
4697
- selector_commitments: [
4698
- "29b0f4a90bea69583a8fca1e74d23adf739d605af605a0e0971fac548df976fb2e10a42dfca2325684c1bca5fabbf9d7022fc8b997ea478f1052dd8808d99e44",
4699
- "119002055b6c2f98314ef408e4a917a6678f114ca991185749289f171f61efc32b3a931c700271b82d22c2073af9b7fffcb7bfa644ea09102d9ef8482410a991",
4700
- "10c5f32870d26f8e26d2eaae2705557b18210b2355677172e1bef5fe684120891f8317185390ddbb22ecb922d37e03c3cc524c84f65c8045f2324b0f164cfbdb",
4701
- "115a5f9af5d438d3261cfa31b7050b931b7d22647f628a43af41a41dcd44cb8d2e99368eb15cdc6d1f16faf9db0db4825613d6893c776aef456705bdc76eb728",
4702
- "1a61cc5f0fbe92fbc8c9bd58928ce467f63e4771e4d517966afbaf220ea069a91cec3231c370be07fee8d9ec01660d054c549b034715855ffa652ad5b67ced86",
4703
- "19e0d095a343115f6e7ad7ae1f51e375cd648fb35451cb2d5a8cf3bafbb25d0525efdc2cc5b5600ee0ae954dca3bf67c8277d470161fe23b4be7a5bcdf641e68"
4704
- ],
4705
- next_step_selector_commitments: [
4706
- "246ce82e01ed312e81492f132da2ee16bc13cc0024fbcc668de30173ad59067f0f072a892451cc495f5d9b8b99c8dc29be1d42d3004aed45fd5b2cd32a420016"
4707
- ],
4708
- permutation_commitments: [
4709
- "19c4143f41738480adc5ae49922d31b8a5afaa1d25ced5c20b869c0e1ccad91920c267c53d33907318cd194ba2ea08a85f250779765ba4121f7a0edfe1afe22b",
4710
- "114bda14aa702a0815e3f91318a08a2798244420fd6675c8fc3cc2b0232298890d2eb3c1f27a83f4a3be777524d6cc65aa435e0a472fae8d1158e0a6ded685d0",
4711
- "289f0b046968d2c095d05350e43996756fc85d2deb0e267a069615f0889a249413bdbe6f09edb4db956b8f3fc4488c4681cd52469dc0d419dab99a65b88309f7",
4712
- "16dd74a2089960aac0d68309d5e81c6b45c29fafe4d42c922c06eb633ed48d551d347d1f43ee9b137772eefc43a6dcdf5ac35ee1615bc8f7c243bce071c410a9"
4713
- ],
4714
- non_residues: [
4715
- "0000000000000000000000000000000000000000000000000000000000000005",
4716
- "0000000000000000000000000000000000000000000000000000000000000007",
4717
- "000000000000000000000000000000000000000000000000000000000000000a"
4718
- ],
4719
- g2_elements: [
4720
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4721
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4722
- ]
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
4723
5821
  },
4724
- tally_vkey: {
4725
- n: 524287,
4726
- num_inputs: 1,
4727
- selector_commitments: [
4728
- "18c2bb75c8ed53a5d15a56cc91c56f14c832419994ce7187c7c98b5e622cac0808b773f05e09822d8d267646198a78359ea2aa6fbaeb01317142f99fd11da6c0",
4729
- "181499098243a5968f5490b7759aa15f0f769f24f3f4219b69f96913cf4fb23c1cd7b3f109196d7577390fd2e6d3930a71b0559aff756f3ca43eef66ce7333f4",
4730
- "07ba2bdd452503fb16b56ea2940e95a98118c9dd120ae192680fe2b80bdb26f10ac6cdc7cb12b581a8c64d45b5af3d253c4282405eed3fd4d091ae05aac45cb6",
4731
- "1caf01f1775eeafa78a11202e926ee92be997ce040f9c6fbce161348a40aeda70d9f15738cccf538083784e566ceef651d000223ae810c980e2d5d98b91b4665",
4732
- "2c377c69cae1d591af413da2fd986ef3dca595d0c5817ee4932b92169d37c52d1218ce63dde705ebd1dc66d9b62daca287e4fdf6800b69204e5b78bfe84365a1",
4733
- "175dd4ff280e39f0e080c181f853845e40c4b91709a93e4398d24befc9cf556903675361817e031e86bd896ff1dd7bc1cc31ca920a101499db0c58d77f0730ec"
4734
- ],
4735
- next_step_selector_commitments: [
4736
- "12d76999d26137d433f7119ab34f3fc63cfedb9172052cfb34acfc3cdc570f511aba802ebe92b87f913496314b938cf526078280a68826c90b686b90420c7742"
4737
- ],
4738
- permutation_commitments: [
4739
- "167b05c0132399e7126e8d16efb224b1c6729942048fc7e730fd1451116e0a6e05acaf2a6d2c88cc25610474b651c8cdcb7e8e14e59ddfad819123e888c4b1b6",
4740
- "25aed62de4b701dc645e076543e2553c306010f2776c74edae55ea5253d9540403d042c4cb699cc04b2bb63d3c3edc0c85b049a84dc2fd44369f957d81363563",
4741
- "0e77fb0b0e84da1d955da3d66dbb8fa3988f22e999a34bc4ac537a0f9187ac40156f8d7cb6d005fd85a0178d794f941b4e84832fd389a37c2a78112dac09b758",
4742
- "051d3d906d457eaa9eff77a296dfa1760fd9ea379eec60487be38de91545ca2c1fcf457d6ac31afee10951245b0cc1e2c7674596f65955d189d48b6938fb3594"
4743
- ],
4744
- non_residues: [
4745
- "0000000000000000000000000000000000000000000000000000000000000005",
4746
- "0000000000000000000000000000000000000000000000000000000000000007",
4747
- "000000000000000000000000000000000000000000000000000000000000000a"
4748
- ],
4749
- g2_elements: [
4750
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4751
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4752
- ]
4753
- }
4754
- }
4755
- },
4756
- "4-2-2-25": {
4757
- parameter: {
4758
- state_tree_depth: "4",
4759
- int_state_tree_depth: "2",
4760
- vote_option_tree_depth: "2",
4761
- message_batch_size: "25"
4762
- },
4763
- groth16: {
4764
- process_vkey: {
4765
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4766
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4767
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4768
- vk_delta_2: "0d0fe390b9dd4d1d0f486787b6ea96765cbeaa8f00310fecc3429673c5866c081a27998596ba296f66f3f7b5e2450d1ce1bcc535c133b2e8b577ba07dc1ccb4c1895f7afb9b3168a6d628c9173157cd56ca51948cc66c129a25f80e3b665e4b12c9c50f0cc0d070978ed2fb8ce15956d67c5dc6c07c7f45f1facfb5522d7b656",
4769
- vk_ic0: "0ff2b22774da5c0ba94db4d759827b8c962aaf44db2649eb10407de02a40463a26497581d6d0979ad7f9057f26e048109158b0872700e2ad8447ffc9b4bf146b",
4770
- 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()
4771
5857
  },
4772
- tally_vkey: {
4773
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4774
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4775
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4776
- vk_delta_2: "08e44e0876bd574d8a3411e374884eb61da7292ca52903fa96553c37311b66ce0f2f529e59b1d37e55794a575d0f87548ca0d03331c19689bc203a68c1c4bae20e9fd25a7bffaa9b7409e694a48bc0d57f42df164d4a01bd5deecffedd2d3a3125eff290efb93eaf9c578cc7ee9d00406137607b9602de02424ff413ac948690",
4777
- vk_ic0: "295c8e84b4b6b8de44b24f80eb5cae1df65e4877c4af8da2dbadfbfc3586dc790661b9e636f2c2a83028d11cbb7c753675481b65a5dfe32fff7a558231b3c9ef",
4778
- vk_ic1: "299cfb28054cde0470bd7ff280349089350226d1ca154dcf6544b2680bf3bea925026e6644668273d6066ef6766c2f561c3607c523fbbd1379c5002376ef69c3"
4779
- }
4780
- },
4781
- plonk: {
4782
- process_vkey: {
4783
- n: 2097151,
4784
- num_inputs: 1,
4785
- selector_commitments: [
4786
- "126cbf10e0b68a56d45614be16c5bb48bd1374478e17b9fe1a78b726ea70f9b21f3cd20fd178d89e5923c422ef050ccc7134fbd76c9efdbb90f677ee41e01edb",
4787
- "12813166f206c95eddd998a40d8d2e54e29dd393f543e3583a7999b18d674832024cdd935540bd3b96207ec0609c6718ad8b14e2ef315594454c57d606494485",
4788
- "05da9eea3ee7151355067ced11a8e8ff57a56c758493afc9cbb6cfbacfc42e7b08993dfa25c85f20aeb7f64e87fe56ac8066cf6b8479dc96294e302ef5d55372",
4789
- "2e446e540bacde7daea23c93a67bc6b1424b7c16b33fd2cee251b0d093cd78300030b8e340f01f320639d60b77724e58fc8a2d778b7b2a5df2c953ce34debeea",
4790
- "1cf8c75b18071ede19d196b46a8776efc29ac514458a698d9f2e50b7bc692f6e06f7ff96897240eca31058fe330e8cbcd911324b79a3a34d03340a3cfed85fd5",
4791
- "17101fb5c293438a695075b221219679e278e4bd147239c9fc69081b19cacefe218eb895f1456ca81e29731967588aee4b0758ea51aa28e5fefc81fed4a11513"
4792
- ],
4793
- next_step_selector_commitments: [
4794
- "0cebff4fe8cd70325f986088a1e17ae129a025481137bd80aef9c1f1c2e52f1e265a4ccae1ed89cb2fba527165f007898e70f988311ee4e4e87e41376cfeed03"
4795
- ],
4796
- permutation_commitments: [
4797
- "025b5db167721133693f0b6d9d7cfadce68ad15365ef1605dda4a6c809edeea61927b27ca11713fc683c88f6330e9621837b05e5db74d5994d1cf04bc3d529b3",
4798
- "1fac93999f33b145613901846e6403d7f4237d582b51ccc4fb5c70038284c6e21cc804cc3cf7170b96da74fcbb30c81cd8c3405a629327c657025db7332f169a",
4799
- "0b6d7d383de73dbfc16f2c0f3af763135ff05a12ec937548008cfee944c195f902336a68a50f62f595953e44401e872fb41abb66a733684b079ffe550d09c233",
4800
- "225a1f5e92d105d3be026ae68904826f89b786faad75a846ef966ed714568bba28d1388786fde71dea206cdef16faa7a589e90863e6245d271e3f154c75c5531"
4801
- ],
4802
- non_residues: [
4803
- "0000000000000000000000000000000000000000000000000000000000000005",
4804
- "0000000000000000000000000000000000000000000000000000000000000007",
4805
- "000000000000000000000000000000000000000000000000000000000000000a"
4806
- ],
4807
- g2_elements: [
4808
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4809
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4810
- ]
5858
+ maxVoters: maxVoter,
5859
+ roundInfo: {
5860
+ title,
5861
+ description: description || "",
5862
+ link: link || ""
4811
5863
  },
4812
- tally_vkey: {
4813
- n: 1048575,
4814
- num_inputs: 1,
4815
- selector_commitments: [
4816
- "1588fb667b3f0e4d0970b8208e4b6b4c729c4926b936f8d877017cf42d07ca15069643791d98abcd6b7d0b0546e7560ab9011e069f2ee48ede581fc72d8b5e04",
4817
- "09c5480b103c44a81850ffd9a61ec21f7db41bc89996d8df075c3e029290eb5b083cb2b184d95c0761e585547be33250c8939929b87fdc39775ccea17d51b481",
4818
- "278e239bcac0a945a17572a6d61ba59f705746e6893a10a44841933a8c8310e712e4ee913af9b77c8fdcdc365316aa9f1b8dc081eb99ad80265768ec9f484beb",
4819
- "12532585ea307c5559b18a4d01db59b544a88088f61a5b5ed0431393e6f675af1309bf0dcaa7a552849e5f28d0300c8c61b18393fb638aed3b7d70e27bb91c35",
4820
- "172e7ecb8e485aaee801fd78b8fd7c0b862baef65e39e6832cffa2170b6f981928d86ab5887e8c3210e34e03cada468bd501f60ec3a8fa35b4c7067d6fb8c6ae",
4821
- "0c27211d046735fc681228b8366be2c8cf9a256cbd03dcd4af65152e94f95a6f1af151a5311b195b0f4acffeec4952cc52edbb7045aab61bbd3be9cd322ab99e"
4822
- ],
4823
- next_step_selector_commitments: [
4824
- "25ee15301d562e6c630946b3fbe36b9fbd8dfbd44ddf70cc825fb1fa1ebd966229081f6b9297da671c69064e10b8f5dd0f69b69d1bf79122c6197f119087ebe1"
4825
- ],
4826
- permutation_commitments: [
4827
- "194849a6ec5cb37e09d20801d387abbab04e453f630c5fbbf5c4819c5569480c0c8bf0ce2b4955cc4c891840da1d9e99feb81e8d43251dffbe4d6167639b9f9b",
4828
- "17717d2638632d406b3c8aa69550c8aeed1b79def3ab55e9d0c4bdf21cc339ad07d3bd3a331145fc96f34c85469a34a8c93b53b7aa36bb5a94c31e3b4d47713e",
4829
- "277b0c99b63c79bb9ed2f677c3987cf00acb293933dfced82b5afcb8bf0c34570d3187ce5c7e892582ddda4322cf7c50d41105fe98503fb60e41f4a08da5916d",
4830
- "0489f6dec0f27a8c21d147ebb9781b68b4b73db065a6017924c543f6d9fadbe922d24c0946bd8b19df7659810296d063b557cdf7aba510b11e08fbf2e9d37931"
4831
- ],
4832
- non_residues: [
4833
- "0000000000000000000000000000000000000000000000000000000000000005",
4834
- "0000000000000000000000000000000000000000000000000000000000000007",
4835
- "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
+ }
4836
5897
  ],
4837
- g2_elements: [
4838
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4839
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4840
- ]
4841
- }
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);
4842
5926
  }
4843
- },
4844
- "6-3-3-125": {
4845
- parameter: {
4846
- state_tree_depth: "6",
4847
- int_state_tree_depth: "3",
4848
- vote_option_tree_depth: "3",
4849
- message_batch_size: "125"
4850
- },
4851
- groth16: {
4852
- process_vkey: {
4853
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4854
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4855
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4856
- vk_delta_2: "057f25675851ef5a79a6d8706a43a6cd8e494cfb12c241ede46991d9174cf30605b081ff44f3ede774dab68ea9324c12308c13cb09cbb129adf94401b9134f5b16137d952fd32ab2d4243ebff4cb15d17206948ef17909ea8606886a8109bdad082f7d27e1cbf98925f055b39d1c89f9bcc4f6d92fdb920934ff5e37ba4d9b49",
4857
- vk_ic0: "27c937c032a18a320566e934448a0ffceea7050492a509c45a3bcb7e8ff8905d20789ada31729a833a4f595ff9f49f88adb66f2ab987de15a15deccb0e785bf4",
4858
- vk_ic1: "0ed2cefc103a2234dbc6bbd8634812d65332218b7589f4079b2c08eb5a4f5f63113a7f3cb53797a7f5819d7de7e3f0b2197d1c34790685a4a59af4314810420b"
4859
- },
4860
- tally_vkey: {
4861
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4862
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4863
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4864
- vk_delta_2: "2065e91c00fcc5cbc3d974cf52e24de972bdb1b4d8ded629dec20b5c904c3fa327ffe02402094795ff4d02588c8268fcad738f69eb4c732a0c98b485035e1f4913ede11b074ff143a929673e581a547717c58ce01af87d9d8b28f65f506093a61013e367b93e6782129362065840a0af9b77d7d9659a84577176e64a918d8d4c",
4865
- vk_ic0: "11db4a022aab89a265f06ff62aa18c74b21e913a8b23e7fce9cb46f76d1c4d9f2a7475b1eeb7be0a0dc457e6d52536ba351b621b63a7d77da75d4e773048537e",
4866
- 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
+ }
4867
5936
  }
4868
- },
4869
- plonk: {
4870
- process_vkey: {
4871
- n: 8388607,
4872
- num_inputs: 1,
4873
- selector_commitments: [
4874
- "216533ab27390f98812429524326ac08736d636d2891fb81446796cc1771a3230642f49db115acc15a186a1013f91a08efcd05640eb137d700276e80fd05bc90",
4875
- "11747f6f378e26dbdacff464ce7eb6a8869750d0fa7e508e263ac77b582c1e9b24ba3d208650b0c28943915c563cc94cc3f98cdb5fd8adc4f4d3e2a60eda3302",
4876
- "09239eb768d8d47b91c7e08e2ec6a374571964ed16be293cdc35e112393c4fd1182a0794be7f1441418664e9f718b67ed392a7da3e2868375bcf629131bb2680",
4877
- "2020f7db24940bbf38d097ea5d7ef7253e38b154d7eb0ff1782ea18ce215dd7b0e8475197b071b118adc6418b7b7fb42fea19b6272d1bb460cc47deacb299ec7",
4878
- "298923db1618185064bbab5df30ee03a3c9cbc7ce8f096d76cbd2a5ab3df86cd05bbedb938e6e0ff35cce23609458aff8081cdf3163655672074d1b18b0007bd",
4879
- "0effaabe8c6e8a076aedd36d10f2926f9871f552d93e22bfbe69e3c828a546fa2d0cd163b49a6de219ac2c048a8459ae448047748ba078b9d5d07b290c946b08"
4880
- ],
4881
- next_step_selector_commitments: [
4882
- "13e3d7299e30e6142699469d620df721eca35bbb807a8f4298f165260fdc24f823e7bd9bcb6506a094a5ebef44434c62e4bcb5d3dd7e092c49d5cb80b8ae0757"
4883
- ],
4884
- permutation_commitments: [
4885
- "03d94ab8fdc681523a8eec10f1ce5552937c268d1d970f9e75ee8657cd4c12a81e03476f83ef5c14db2f4d931b833a3b65b8d5689b37cc7f183914c90d3d065d",
4886
- "1b9c6ef20e68355c535bda6ff04a8a61d7552a594bb8e88d69a6f8840ddab04d2884824cc356d0d90cc278c247fc531de62efca4b19ed1be6f071144474d2037",
4887
- "1ff82de8312481e1591d2d1c2698fa3944b3f0afa0dd702be8a1a944a5a8997323ffbd0ab39a2e13608a8e76803c33ffda7317bb7101e335ce5552ed62dcd09d",
4888
- "2cb2bbdd51d22b79957b0401ecb6fe089f05426ba092b1205fa92f39b36cc5fc0c36c3934e47b7d407d4cda0c78c2b3fb23162cb0d295e8a8cce1a274956c34a"
4889
- ],
4890
- non_residues: [
4891
- "0000000000000000000000000000000000000000000000000000000000000005",
4892
- "0000000000000000000000000000000000000000000000000000000000000007",
4893
- "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
+ }
4894
5982
  ],
4895
- g2_elements: [
4896
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4897
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4898
- ]
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
4899
6020
  },
4900
- tally_vkey: {
4901
- n: 8388607,
4902
- num_inputs: 1,
4903
- selector_commitments: [
4904
- "258d101f9499e81c0d0da8986c659ef33da19d4955a142e56b4854d1327c902c1996baecd81432717a9cbf92ccf651e4217a788c1a2ed855f749480f8ce8203c",
4905
- "1892a17c9c01389e3149b0663069a1ad4fd3c8e2db5ce99795b781c47b55acf9001cf5f0b4c1d088fa2058ca19cd2f1e9559ebe059897bb0aadcb540ce5f468a",
4906
- "09912d6eaa4a22802451135d9a221ebf97c2ce8ad5bbb2942d5a860482e8e4202573995072c4b014cd0e9d09a1fd53ee7d602070b404288a7fd0d97b57d8f07d",
4907
- "0c62ef7ad01b05b2c01fca6188de269d63d725348a07a99bbc50f24c1518aa871fdc61bbf42399433a0917c919dcfe9e851b206e1c37dec0908f69ad89bb1f8e",
4908
- "07d181c1026ef4a6732bff3dffbc5ae0e3746e4860f478c6c2e8e258df2ed7671efe073fb31cf5a61c0eedceccb5e968220b9ff7e2b055b11d7c456a57fe7ac9",
4909
- "1bbd7ad96893df675c811e5a2be184e2e3bc9af0ce30a7b26e53a916a10a777a01ffa70dbe585201ac09778429c04c71229392608095d220c7d82631a0caedd6"
4910
- ],
4911
- next_step_selector_commitments: [
4912
- "2ae6c5c98d4c384e8e645d85a4ca362de4c4e75efe3c79d5bcbd126a9e305b831618df99300c7327f1eac6a498c8feac6013d4ba09b7ea046340f99b0598a832"
4913
- ],
4914
- permutation_commitments: [
4915
- "2458c5fb474ab3e7ae9c6b82cc432a111954d8be5e7e9b4fc58c14e1aed77f3207426dbe08272aa69ba8b73809f27f9ff083641b5c3c896c386a74bbed3083dd",
4916
- "0879ac4885674b1af0ab67c7b505bce6234f32a0335bdfd229023fea5f303ece0973ba8abc9ade8edcfb68c7d4b8b98272c7bf33eff841fec78d21c0c2e82aa6",
4917
- "07b74f37fcbcb2d9962a529fbc254d54925aeb1be1a49517affeb3571ef3e31e3033f7900ff5bb5759cbb98b64ca7f42967278c328d00e60c042aa65f2178ded",
4918
- "203c948fdc386e7bfbdc37363ab489e9ce3264f4ccd23c33dd8f2337fb9007a621cabf740aa26e522dcb7af6c0de9f93cbc69595b29b02e75c2f3507e97664ec"
4919
- ],
4920
- non_residues: [
4921
- "0000000000000000000000000000000000000000000000000000000000000005",
4922
- "0000000000000000000000000000000000000000000000000000000000000007",
4923
- "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
+ }
4924
6056
  ],
4925
- g2_elements: [
4926
- "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4927
- "260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
4928
- ]
4929
- }
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
+ );
4930
6089
  }
4931
- },
4932
- "9-4-3-625": {
4933
- parameter: {
4934
- state_tree_depth: "9",
4935
- int_state_tree_depth: "4",
4936
- message_batch_size: "625",
4937
- vote_option_tree_depth: "3"
4938
- },
4939
- groth16: {
4940
- process_1p1v_vkey: {
4941
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4942
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4943
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4944
- vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4945
- vk_ic0: "1195be678487bbc8c0ae726c0985a5caf6f75e3f8327926926c4f89e498ad733043e46e10b506d194b27275f402bc3fb208a2f5be69662e7c9898d1c0ece4f04",
4946
- vk_ic1: "10c34362189a7ee44b1c5e57755d7e0d672dba552e614d5cd9a53081bee2333425879fa4e4a9e3fff287824cce35f94725ca0edb60a4ffcbf50becb2fd96cb0b"
4947
- },
4948
- tally_1p1v_vkey: {
4949
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4950
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4951
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4952
- vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4953
- vk_ic0: "2ec191d51bd4ac7cd65cb3dd2decfa4e56c4f167bbc40e2c9e1ca728f9bc5b0e2ed1c82319dc554aea5ff2ca05d6f4d4d61e8f059a8c05d4b4faabae5128a437",
4954
- vk_ic1: "2f19db8f03b6b5896abc6989273371b14833356f45c12685e57bc292eccc53570cb629e551df179f73b9f3391946bad29739af8b808c80b0f057af45aea59849"
4955
- },
4956
- process_qv_vkey: {
4957
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4958
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4959
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4960
- vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4961
- vk_ic0: "1832600210a459fe61d971081d4baa1a1add23f87c8a8dc4042cd5cf6c6fdf8e3018489aec30d9deb26629e05965a3a7e038be58ce10c854cb7e1071f2708aad",
4962
- vk_ic1: "0274a24117a799333754d646e35f37292e7ca9984fb8781211504b158d69d2c422aa99651ca207c77084988b16ef363664b9cf36071f7131dcc10b98ea27d7f6"
6090
+ return client.setVoteOptionsMap(
6091
+ {
6092
+ contractAddr: contractAddress,
6093
+ voteOptionMap
4963
6094
  },
4964
- tally_qv_vkey: {
4965
- vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
4966
- vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
4967
- vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4968
- vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
4969
- vk_ic0: "2ec191d51bd4ac7cd65cb3dd2decfa4e56c4f167bbc40e2c9e1ca728f9bc5b0e2ed1c82319dc554aea5ff2ca05d6f4d4d61e8f059a8c05d4b4faabae5128a437",
4970
- vk_ic1: "2f19db8f03b6b5896abc6989273371b14833356f45c12685e57bc292eccc53570cb629e551df179f73b9f3391946bad29739af8b808c80b0f057af45aea59849"
4971
- }
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
+ );
4972
6167
  }
6168
+ return client.grantToVoter(
6169
+ {
6170
+ baseAmount,
6171
+ contractAddr: contractAddress,
6172
+ grantee
6173
+ },
6174
+ fee
6175
+ );
4973
6176
  }
4974
- };
4975
- var QTR_LIB = {
4976
- zeros: [
4977
- "0",
4978
- "14655542659562014735865511769057053982292279840403315552050801315682099828156",
4979
- "19261153649140605024552417994922546473530072875902678653210025980873274131905",
4980
- "21526503558325068664033192388586640128492121680588893182274749683522508994597",
4981
- "20017764101928005973906869479218555869286328459998999367935018992260318153770",
4982
- "16998355316577652097112514691750893516081130026395813155204269482715045879598",
4983
- "2612442706402737973181840577010736087708621987282725873936541279764292204086",
4984
- "17716535433480122581515618850811568065658392066947958324371350481921422579201",
4985
- "17437916409890180001398333108882255895598851862997171508841759030332444017770"
4986
- ]
4987
- };
4988
-
4989
- // src/libs/contract/utils.ts
4990
- function getContractParams(type, circuitType, proofSystem, maxVoter, maxOption) {
4991
- let parameters;
4992
- let groth16ProcessVkey = null;
4993
- let groth16TallyVkey = null;
4994
- let plonkProcessVkey = null;
4995
- let plonkTallyVkey = null;
4996
- let maciVoteType = null;
4997
- let maciCertSystem = null;
4998
- switch (circuitType) {
4999
- case "0" /* IP1V */:
5000
- maciVoteType = "0";
5001
- break;
5002
- case "1" /* QV */:
5003
- maciVoteType = "1";
5004
- break;
5005
- default:
5006
- throw new Error(
5007
- `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
5008
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);
5009
6230
  }
5010
- switch (proofSystem) {
5011
- case "groth16" /* GROTH16 */:
5012
- maciCertSystem = "0";
5013
- break;
5014
- case "plonk" /* PLONK */:
5015
- maciCertSystem = "1";
5016
- break;
5017
- default:
5018
- throw new Error(
5019
- `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
+ ""
5020
6263
  );
5021
- }
5022
- if (maxVoter <= 25 && maxOption <= 5) {
5023
- parameters = CIRCUIT_INFO["2-1-1-5"].parameter;
5024
- if (proofSystem === "groth16" /* GROTH16 */) {
5025
- groth16ProcessVkey = CIRCUIT_INFO["2-1-1-5"]["groth16"].process_vkey;
5026
- groth16TallyVkey = CIRCUIT_INFO["2-1-1-5"]["groth16"].tally_vkey;
5027
- } else if (proofSystem === "plonk" /* PLONK */) {
5028
- plonkProcessVkey = CIRCUIT_INFO["2-1-1-5"]["plonk"]?.process_vkey;
5029
- plonkTallyVkey = CIRCUIT_INFO["2-1-1-5"]["plonk"]?.tally_vkey;
5030
- }
5031
- } else if (maxVoter <= 625 && maxOption <= 25) {
5032
- parameters = CIRCUIT_INFO["4-2-2-25"].parameter;
5033
- if (proofSystem === "groth16" /* GROTH16 */) {
5034
- groth16ProcessVkey = CIRCUIT_INFO["4-2-2-25"]["groth16"].process_vkey;
5035
- groth16TallyVkey = CIRCUIT_INFO["4-2-2-25"]["groth16"].tally_vkey;
5036
- } else if (proofSystem === "plonk" /* PLONK */) {
5037
- plonkProcessVkey = CIRCUIT_INFO["4-2-2-25"]["plonk"]?.process_vkey;
5038
- plonkTallyVkey = CIRCUIT_INFO["4-2-2-25"]["plonk"]?.tally_vkey;
5039
- }
5040
- } else if (maxVoter <= 15625 && maxOption <= 125) {
5041
- parameters = CIRCUIT_INFO["6-3-3-125"].parameter;
5042
- if (proofSystem === "groth16" /* GROTH16 */) {
5043
- groth16ProcessVkey = CIRCUIT_INFO["6-3-3-125"]["groth16"].process_vkey;
5044
- groth16TallyVkey = CIRCUIT_INFO["6-3-3-125"]["groth16"].tally_vkey;
5045
- } else if (proofSystem === "plonk" /* PLONK */) {
5046
- plonkProcessVkey = CIRCUIT_INFO["6-3-3-125"]["plonk"]?.process_vkey;
5047
- plonkTallyVkey = CIRCUIT_INFO["6-3-3-125"]["plonk"]?.tally_vkey;
5048
- }
5049
- } else if (maxVoter <= 1953125 && maxOption <= 125) {
5050
- parameters = CIRCUIT_INFO["9-4-3-625"].parameter;
5051
- if (proofSystem === "groth16" /* GROTH16 */) {
5052
- if (circuitType === "0" /* IP1V */) {
5053
- groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_1p1v_vkey;
5054
- groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_1p1v_vkey;
5055
- } else if (circuitType === "1" /* QV */) {
5056
- groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_qv_vkey;
5057
- groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_qv_vkey;
5058
- }
5059
- } else if (proofSystem === "plonk" /* PLONK */) {
5060
- 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);
5061
6282
  }
5062
- } else {
5063
- throw new Error("Number of voters or options is too large.");
6283
+ return client.removeOperator({ operator }, fee);
5064
6284
  }
5065
- switch (type) {
5066
- case "0" /* MACI */:
5067
- return {
5068
- parameters,
5069
- groth16ProcessVkey,
5070
- groth16TallyVkey,
5071
- plonkProcessVkey,
5072
- plonkTallyVkey,
5073
- maciVoteType,
5074
- 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: {}
5075
6318
  };
5076
- case "1" /* AMACI */:
5077
- return {
5078
- // parameters,
5079
- // groth16ProcessVkey,
5080
- // groth16TallyVkey,
5081
- // plonkProcessVkey,
5082
- // 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
5083
6344
  };
5084
- case "2" /* ORACLE_MACI */:
5085
- if (circuitType === "0" /* IP1V */) {
5086
- groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_1p1v_vkey;
5087
- groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_1p1v_vkey;
5088
- } else if (circuitType === "1" /* QV */) {
5089
- groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_qv_vkey;
5090
- groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_qv_vkey;
5091
- }
5092
- return {
5093
- parameters: CIRCUIT_INFO["9-4-3-625"].parameter,
5094
- groth16ProcessVkey,
5095
- groth16TallyVkey,
5096
- plonkProcessVkey: null,
5097
- plonkTallyVkey: null,
5098
- maciVoteType,
5099
- 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
5100
6350
  };
5101
- }
5102
- }
5103
- function getAMaciRoundCircuitFee(network, maxVoter, maxOption) {
5104
- let requiredFee = {
5105
- denom: "peaka",
5106
- amount: "0"
5107
- };
5108
- if (maxVoter <= 25 && maxOption <= 5) {
5109
- if (network === "mainnet") {
5110
- requiredFee.amount = "20000000000000000000";
5111
- } else {
5112
- requiredFee.amount = "20000000000000000000";
6351
+ return client.deposit(grantFee, void 0, funds);
5113
6352
  }
5114
- } else if (maxVoter <= 625 && maxOption <= 25) {
5115
- if (network === "mainnet") {
5116
- requiredFee.amount = "750000000000000000000";
5117
- } else {
5118
- 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);
5119
6406
  }
5120
- } else {
5121
- throw new Error("Number of voters or options is too large.");
6407
+ return client.withdraw({ amount }, fee);
5122
6408
  }
5123
- return requiredFee;
5124
- }
5125
-
5126
- // src/libs/contract/contract.ts
5127
- var import_stargate2 = require("@cosmjs/stargate");
5128
- var Contract = class {
5129
- constructor({
5130
- network,
5131
- rpcEndpoint,
5132
- registryAddress,
5133
- saasAddress,
5134
- maciCodeId,
5135
- oracleCodeId,
5136
- saasOracleCodeId,
5137
- feegrantOperator,
5138
- whitelistBackendPubkey
6409
+ async queryRoundInfo({
6410
+ signer,
6411
+ roundAddress
5139
6412
  }) {
5140
- this.network = network;
5141
- this.rpcEndpoint = rpcEndpoint;
5142
- this.registryAddress = registryAddress;
5143
- this.saasAddress = saasAddress;
5144
- this.maciCodeId = maciCodeId;
5145
- this.oracleCodeId = oracleCodeId;
5146
- this.saasOracleCodeId = saasOracleCodeId;
5147
- this.feegrantOperator = feegrantOperator;
5148
- 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;
5149
6420
  }
5150
- async createAMaciRound({
6421
+ async oracleMaciClient({
5151
6422
  signer,
5152
- startVoting,
5153
- endVoting,
5154
- operator,
5155
- whitelist,
5156
- title,
5157
- description,
5158
- link,
5159
- maxVoter,
5160
- maxOption,
5161
- voiceCreditAmount,
5162
- circuitType,
5163
- preDeactivateRoot,
5164
- fee = "auto"
6423
+ contractAddress
5165
6424
  }) {
5166
- const start_time = (startVoting.getTime() * 10 ** 6).toString();
5167
- const end_time = (endVoting.getTime() * 10 ** 6).toString();
5168
- const client = await createRegistryClientBy({
6425
+ const client = await createOracleMaciClientBy({
5169
6426
  rpcEndpoint: this.rpcEndpoint,
5170
6427
  wallet: signer,
5171
- contractAddress: this.registryAddress
5172
- });
5173
- const requiredFee = getAMaciRoundCircuitFee(
5174
- this.network,
5175
- maxVoter,
5176
- maxOption
5177
- );
5178
- preDeactivateRoot = preDeactivateRoot || "0";
5179
- const res = await client.createRound(
5180
- {
5181
- operator,
5182
- preDeactivateRoot,
5183
- voiceCreditAmount,
5184
- whitelist,
5185
- roundInfo: {
5186
- title,
5187
- description: description || "",
5188
- link: link || ""
5189
- },
5190
- votingTime: {
5191
- start_time,
5192
- end_time
5193
- },
5194
- maxVoter: maxVoter.toString(),
5195
- maxOption: maxOption.toString(),
5196
- certificationSystem: "0",
5197
- circuitType
5198
- },
5199
- fee,
5200
- void 0,
5201
- [requiredFee]
5202
- );
5203
- let contractAddress = "";
5204
- res.events.map((event) => {
5205
- if (event.type === "wasm") {
5206
- let actionEvent = event.attributes.find(
5207
- (attr) => attr.key === "action"
5208
- );
5209
- if (actionEvent.value === "created_round") {
5210
- contractAddress = event.attributes.find((attr) => attr.key === "round_addr").value.toString();
5211
- }
5212
- }
6428
+ contractAddress
5213
6429
  });
5214
- return {
5215
- ...res,
6430
+ return client;
6431
+ }
6432
+ async registryClient({
6433
+ signer,
6434
+ contractAddress
6435
+ }) {
6436
+ return createRegistryClientBy({
6437
+ rpcEndpoint: this.rpcEndpoint,
6438
+ wallet: signer,
5216
6439
  contractAddress
5217
- };
6440
+ });
5218
6441
  }
5219
- async createMaciRound({
6442
+ async maciClient({
5220
6443
  signer,
5221
- operatorPubkey,
5222
- startVoting,
5223
- endVoting,
5224
- whitelist,
5225
- title,
5226
- description,
5227
- link,
5228
- maxVoter,
5229
- maxOption,
5230
- circuitType,
5231
- certSystemType,
5232
- fee = "auto"
6444
+ contractAddress
5233
6445
  }) {
5234
- const start_time = (startVoting.getTime() * 10 ** 6).toString();
5235
- const end_time = (endVoting.getTime() * 10 ** 6).toString();
5236
- const [{ address }] = await signer.getAccounts();
5237
- const client = await createContractClientByWallet(this.rpcEndpoint, signer);
5238
- const [operatorPubkeyX, operatorPubkeyY] = unpackPubKey(
5239
- BigInt(operatorPubkey)
5240
- );
5241
- const {
5242
- parameters,
5243
- groth16ProcessVkey,
5244
- groth16TallyVkey,
5245
- plonkProcessVkey,
5246
- plonkTallyVkey,
5247
- maciVoteType,
5248
- maciCertSystem
5249
- } = getContractParams(
5250
- "0" /* MACI */,
5251
- circuitType,
5252
- certSystemType,
5253
- maxVoter,
5254
- maxOption
5255
- );
5256
- const instantiateResponse = await client.instantiate(
5257
- address,
5258
- this.maciCodeId,
5259
- {
5260
- round_info: { title, description: description || "", link: link || "" },
5261
- voting_time: {
5262
- start_time,
5263
- end_time
5264
- },
5265
- parameters,
5266
- coordinator: {
5267
- x: operatorPubkeyX.toString(),
5268
- y: operatorPubkeyY.toString()
5269
- },
5270
- groth16_process_vkey: groth16ProcessVkey,
5271
- groth16_tally_vkey: groth16TallyVkey,
5272
- plonk_process_vkey: plonkProcessVkey,
5273
- plonk_tally_vkey: plonkTallyVkey,
5274
- max_vote_options: maxOption.toString(),
5275
- whitelist,
5276
- circuit_type: maciVoteType,
5277
- certification_system: maciCertSystem,
5278
- qtr_lib: QTR_LIB
5279
- },
5280
- `[MACI] ${title}`,
5281
- fee
5282
- );
5283
- return instantiateResponse;
6446
+ return createMaciClientBy({
6447
+ rpcEndpoint: this.rpcEndpoint,
6448
+ wallet: signer,
6449
+ contractAddress
6450
+ });
5284
6451
  }
5285
- async createOracleMaciRound({
6452
+ async amaciClient({
5286
6453
  signer,
5287
- operatorPubkey,
5288
- startVoting,
5289
- endVoting,
5290
- title,
5291
- description,
5292
- link,
5293
- voteOptionMap,
5294
- circuitType,
5295
- whitelistEcosystem,
5296
- whitelistSnapshotHeight,
5297
- whitelistVotingPowerArgs,
5298
- fee = "auto"
6454
+ contractAddress
5299
6455
  }) {
5300
- const start_time = (startVoting.getTime() * 1e6).toString();
5301
- const end_time = (endVoting.getTime() * 1e6).toString();
5302
- const [{ address }] = await signer.getAccounts();
5303
- const client = await createContractClientByWallet(this.rpcEndpoint, signer);
5304
- const [operatorPubkeyX, operatorPubkeyY] = unpackPubKey(
5305
- BigInt(operatorPubkey)
5306
- );
5307
- const { maciVoteType, maciCertSystem } = getContractParams(
5308
- "2" /* ORACLE_MACI */,
5309
- circuitType,
5310
- "groth16" /* GROTH16 */,
5311
- 0,
5312
- 0
5313
- );
5314
- const instantiateResponse = await client.instantiate(
5315
- address,
5316
- this.oracleCodeId,
5317
- {
5318
- round_info: { title, description: description || "", link: link || "" },
5319
- voting_time: {
5320
- start_time,
5321
- end_time
5322
- },
5323
- coordinator: {
5324
- x: operatorPubkeyX.toString(),
5325
- y: operatorPubkeyY.toString()
5326
- },
5327
- vote_option_map: voteOptionMap,
5328
- whitelist_backend_pubkey: this.whitelistBackendPubkey,
5329
- whitelist_ecosystem: whitelistEcosystem,
5330
- whitelist_snapshot_height: whitelistSnapshotHeight,
5331
- whitelist_voting_power_args: whitelistVotingPowerArgs,
5332
- circuit_type: maciVoteType,
5333
- certification_system: maciCertSystem,
5334
- feegrant_operator: this.feegrantOperator
5335
- },
5336
- `[Oracle MACI] ${title}`,
5337
- fee
5338
- );
5339
- return instantiateResponse;
6456
+ return createAMaciClientBy({
6457
+ rpcEndpoint: this.rpcEndpoint,
6458
+ wallet: signer,
6459
+ contractAddress
6460
+ });
5340
6461
  }
5341
- 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({
5342
6496
  signer,
5343
6497
  operatorPubkey,
5344
6498
  startVoting,
@@ -5354,7 +6508,7 @@ var Contract = class {
5354
6508
  }) {
5355
6509
  const startTime = (startVoting.getTime() * 1e6).toString();
5356
6510
  const endTime = (endVoting.getTime() * 1e6).toString();
5357
- const client = await createSaasClientBy({
6511
+ const client = await createApiSaasClientBy({
5358
6512
  rpcEndpoint: this.rpcEndpoint,
5359
6513
  wallet: signer,
5360
6514
  contractAddress: this.saasAddress
@@ -5422,21 +6576,15 @@ var Contract = class {
5422
6576
  gas: calculatedFee.gas,
5423
6577
  granter: this.saasAddress
5424
6578
  };
5425
- createResponse = await client.createOracleMaciRound(
5426
- roundParams,
5427
- grantFee
5428
- );
6579
+ createResponse = await client.createApiMaciRound(roundParams, grantFee);
5429
6580
  } else if (gasStation && typeof fee === "object") {
5430
6581
  const grantFee = {
5431
6582
  ...fee,
5432
6583
  granter: this.saasAddress
5433
6584
  };
5434
- createResponse = await client.createOracleMaciRound(
5435
- roundParams,
5436
- grantFee
5437
- );
6585
+ createResponse = await client.createApiMaciRound(roundParams, grantFee);
5438
6586
  } else {
5439
- createResponse = await client.createOracleMaciRound(roundParams, fee);
6587
+ createResponse = await client.createApiMaciRound(roundParams, fee);
5440
6588
  }
5441
6589
  let contractAddress = "";
5442
6590
  createResponse.events.map((event) => {
@@ -5444,7 +6592,7 @@ var Contract = class {
5444
6592
  let actionEvent = event.attributes.find(
5445
6593
  (attr) => attr.key === "action"
5446
6594
  );
5447
- if (actionEvent.value === "created_oracle_maci_round") {
6595
+ if (actionEvent.value === "created_api_maci_round") {
5448
6596
  contractAddress = event.attributes.find((attr) => attr.key === "round_addr").value.toString();
5449
6597
  }
5450
6598
  }
@@ -5454,7 +6602,7 @@ var Contract = class {
5454
6602
  contractAddress
5455
6603
  };
5456
6604
  }
5457
- async setSaasOracleMaciRoundInfo({
6605
+ async setApiSaasMaciRoundInfo({
5458
6606
  signer,
5459
6607
  contractAddress,
5460
6608
  title,
@@ -5463,7 +6611,7 @@ var Contract = class {
5463
6611
  gasStation = false,
5464
6612
  fee = 1.8
5465
6613
  }) {
5466
- const client = await createSaasClientBy({
6614
+ const client = await createApiSaasClientBy({
5467
6615
  rpcEndpoint: this.rpcEndpoint,
5468
6616
  wallet: signer,
5469
6617
  contractAddress: this.saasAddress
@@ -5535,14 +6683,14 @@ var Contract = class {
5535
6683
  fee
5536
6684
  );
5537
6685
  }
5538
- async setSaasOracleMaciRoundVoteOptions({
6686
+ async setApiSaasMaciRoundVoteOptions({
5539
6687
  signer,
5540
6688
  contractAddress,
5541
6689
  voteOptionMap,
5542
6690
  gasStation = false,
5543
6691
  fee = 1.8
5544
6692
  }) {
5545
- const client = await createSaasClientBy({
6693
+ const client = await createApiSaasClientBy({
5546
6694
  rpcEndpoint: this.rpcEndpoint,
5547
6695
  wallet: signer,
5548
6696
  contractAddress: this.saasAddress
@@ -5597,238 +6745,36 @@ var Contract = class {
5597
6745
  {
5598
6746
  contractAddr: contractAddress,
5599
6747
  voteOptionMap
5600
- },
5601
- grantFee
5602
- );
5603
- }
5604
- return client.setVoteOptionsMap(
5605
- {
5606
- contractAddr: contractAddress,
5607
- voteOptionMap
5608
- },
5609
- fee
5610
- );
5611
- }
5612
- async saasGrantToVoter({
5613
- signer,
5614
- baseAmount,
5615
- contractAddress,
5616
- grantee,
5617
- gasStation = false,
5618
- fee = 1.8
5619
- }) {
5620
- const client = await createSaasClientBy({
5621
- rpcEndpoint: this.rpcEndpoint,
5622
- wallet: signer,
5623
- contractAddress: this.saasAddress
5624
- });
5625
- if (gasStation && typeof fee !== "object") {
5626
- const [{ address }] = await signer.getAccounts();
5627
- const contractClient = await this.contractClient({ signer });
5628
- const msg = {
5629
- grant_to_voter: {
5630
- base_amount: baseAmount,
5631
- contract_addr: contractAddress,
5632
- grantee
5633
- }
5634
- };
5635
- const gasEstimation = await contractClient.simulate(
5636
- address,
5637
- [
5638
- {
5639
- typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
5640
- value: {
5641
- sender: address,
5642
- contract: this.saasAddress,
5643
- msg: new TextEncoder().encode(JSON.stringify(msg))
5644
- }
5645
- }
5646
- ],
5647
- ""
5648
- );
5649
- const multiplier = typeof fee === "number" ? fee : 1.8;
5650
- const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
5651
- const calculatedFee = (0, import_stargate2.calculateFee)(
5652
- Math.round(gasEstimation * multiplier),
5653
- gasPrice
5654
- );
5655
- const grantFee = {
5656
- amount: calculatedFee.amount,
5657
- gas: calculatedFee.gas,
5658
- granter: this.saasAddress
5659
- };
5660
- return client.grantToVoter(
5661
- {
5662
- baseAmount,
5663
- contractAddr: contractAddress,
5664
- grantee
5665
- },
5666
- grantFee
5667
- );
5668
- } else if (gasStation && typeof fee === "object") {
5669
- const grantFee = {
5670
- ...fee,
5671
- granter: this.saasAddress
5672
- };
5673
- return client.grantToVoter(
5674
- {
5675
- baseAmount,
5676
- contractAddr: contractAddress,
5677
- grantee
5678
- },
5679
- grantFee
5680
- );
5681
- }
5682
- return client.grantToVoter(
5683
- {
5684
- baseAmount,
5685
- contractAddr: contractAddress,
5686
- grantee
5687
- },
5688
- fee
5689
- );
5690
- }
5691
- async addSaasOperator({
5692
- signer,
5693
- operator,
5694
- gasStation = false,
5695
- fee = 1.8
5696
- }) {
5697
- const client = await createSaasClientBy({
5698
- rpcEndpoint: this.rpcEndpoint,
5699
- wallet: signer,
5700
- contractAddress: this.saasAddress
5701
- });
5702
- if (gasStation && typeof fee !== "object") {
5703
- const [{ address }] = await signer.getAccounts();
5704
- const contractClient = await this.contractClient({ signer });
5705
- const msg = {
5706
- add_operator: {
5707
- operator
5708
- }
5709
- };
5710
- const gasEstimation = await contractClient.simulate(
5711
- address,
5712
- [
5713
- {
5714
- typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
5715
- value: {
5716
- sender: address,
5717
- contract: this.saasAddress,
5718
- msg: new TextEncoder().encode(JSON.stringify(msg))
5719
- }
5720
- }
5721
- ],
5722
- ""
5723
- );
5724
- const multiplier = typeof fee === "number" ? fee : 1.8;
5725
- const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
5726
- const calculatedFee = (0, import_stargate2.calculateFee)(
5727
- Math.round(gasEstimation * multiplier),
5728
- gasPrice
5729
- );
5730
- const grantFee = {
5731
- amount: calculatedFee.amount,
5732
- gas: calculatedFee.gas,
5733
- granter: this.saasAddress
5734
- };
5735
- return client.addOperator({ operator }, grantFee);
5736
- } else if (gasStation && typeof fee === "object") {
5737
- const grantFee = {
5738
- ...fee,
5739
- granter: this.saasAddress
5740
- };
5741
- return client.addOperator({ operator }, grantFee);
5742
- }
5743
- return client.addOperator({ operator }, fee);
5744
- }
5745
- async removeSaasOperator({
5746
- signer,
5747
- operator,
5748
- gasStation = false,
5749
- fee = 1.8
5750
- }) {
5751
- const client = await createSaasClientBy({
5752
- rpcEndpoint: this.rpcEndpoint,
5753
- wallet: signer,
5754
- contractAddress: this.saasAddress
5755
- });
5756
- if (gasStation && typeof fee !== "object") {
5757
- const [{ address }] = await signer.getAccounts();
5758
- const contractClient = await this.contractClient({ signer });
5759
- const msg = {
5760
- remove_operator: {
5761
- operator
5762
- }
5763
- };
5764
- const gasEstimation = await contractClient.simulate(
5765
- address,
5766
- [
5767
- {
5768
- typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
5769
- value: {
5770
- sender: address,
5771
- contract: this.saasAddress,
5772
- msg: new TextEncoder().encode(JSON.stringify(msg))
5773
- }
5774
- }
5775
- ],
5776
- ""
5777
- );
5778
- const multiplier = typeof fee === "number" ? fee : 1.8;
5779
- const gasPrice = import_stargate2.GasPrice.fromString("10000000000peaka");
5780
- const calculatedFee = (0, import_stargate2.calculateFee)(
5781
- Math.round(gasEstimation * multiplier),
5782
- gasPrice
5783
- );
5784
- const grantFee = {
5785
- amount: calculatedFee.amount,
5786
- gas: calculatedFee.gas,
5787
- granter: this.saasAddress
5788
- };
5789
- return client.removeOperator({ operator }, grantFee);
5790
- } else if (gasStation && typeof fee === "object") {
5791
- const grantFee = {
5792
- ...fee,
5793
- granter: this.saasAddress
5794
- };
5795
- return client.removeOperator({ operator }, grantFee);
5796
- }
5797
- return client.removeOperator({ operator }, fee);
5798
- }
5799
- async isSaasOperator({
5800
- signer,
5801
- operator
5802
- }) {
5803
- const client = await createSaasClientBy({
5804
- rpcEndpoint: this.rpcEndpoint,
5805
- wallet: signer,
5806
- contractAddress: this.saasAddress
5807
- });
5808
- return client.isOperator({ address: operator });
6748
+ },
6749
+ grantFee
6750
+ );
6751
+ }
6752
+ return client.setVoteOptionsMap(
6753
+ {
6754
+ contractAddr: contractAddress,
6755
+ voteOptionMap
6756
+ },
6757
+ fee
6758
+ );
5809
6759
  }
5810
- async depositSaas({
6760
+ async addApiSaasOperator({
5811
6761
  signer,
5812
- amount,
6762
+ operator,
5813
6763
  gasStation = false,
5814
6764
  fee = 1.8
5815
6765
  }) {
5816
- const client = await createSaasClientBy({
6766
+ const client = await createApiSaasClientBy({
5817
6767
  rpcEndpoint: this.rpcEndpoint,
5818
6768
  wallet: signer,
5819
6769
  contractAddress: this.saasAddress
5820
6770
  });
5821
- const funds = [
5822
- {
5823
- denom: "peaka",
5824
- amount
5825
- }
5826
- ];
5827
6771
  if (gasStation && typeof fee !== "object") {
5828
6772
  const [{ address }] = await signer.getAccounts();
5829
6773
  const contractClient = await this.contractClient({ signer });
5830
6774
  const msg = {
5831
- deposit: {}
6775
+ add_operator: {
6776
+ operator
6777
+ }
5832
6778
  };
5833
6779
  const gasEstimation = await contractClient.simulate(
5834
6780
  address,
@@ -5838,8 +6784,7 @@ var Contract = class {
5838
6784
  value: {
5839
6785
  sender: address,
5840
6786
  contract: this.saasAddress,
5841
- msg: new TextEncoder().encode(JSON.stringify(msg)),
5842
- funds
6787
+ msg: new TextEncoder().encode(JSON.stringify(msg))
5843
6788
  }
5844
6789
  }
5845
6790
  ],
@@ -5856,23 +6801,23 @@ var Contract = class {
5856
6801
  gas: calculatedFee.gas,
5857
6802
  granter: this.saasAddress
5858
6803
  };
5859
- return client.deposit(grantFee, void 0, funds);
6804
+ return client.addOperator({ operator }, grantFee);
5860
6805
  } else if (gasStation && typeof fee === "object") {
5861
6806
  const grantFee = {
5862
6807
  ...fee,
5863
6808
  granter: this.saasAddress
5864
6809
  };
5865
- return client.deposit(grantFee, void 0, funds);
6810
+ return client.addOperator({ operator }, grantFee);
5866
6811
  }
5867
- return client.deposit(fee, void 0, funds);
6812
+ return client.addOperator({ operator }, fee);
5868
6813
  }
5869
- async withdrawSaas({
6814
+ async removeApiSaasOperator({
5870
6815
  signer,
5871
- amount,
6816
+ operator,
5872
6817
  gasStation = false,
5873
6818
  fee = 1.8
5874
6819
  }) {
5875
- const client = await createSaasClientBy({
6820
+ const client = await createApiSaasClientBy({
5876
6821
  rpcEndpoint: this.rpcEndpoint,
5877
6822
  wallet: signer,
5878
6823
  contractAddress: this.saasAddress
@@ -5881,8 +6826,8 @@ var Contract = class {
5881
6826
  const [{ address }] = await signer.getAccounts();
5882
6827
  const contractClient = await this.contractClient({ signer });
5883
6828
  const msg = {
5884
- withdraw: {
5885
- amount
6829
+ remove_operator: {
6830
+ operator
5886
6831
  }
5887
6832
  };
5888
6833
  const gasEstimation = await contractClient.simulate(
@@ -5910,81 +6855,26 @@ var Contract = class {
5910
6855
  gas: calculatedFee.gas,
5911
6856
  granter: this.saasAddress
5912
6857
  };
5913
- return client.withdraw({ amount }, grantFee);
6858
+ return client.removeOperator({ operator }, grantFee);
5914
6859
  } else if (gasStation && typeof fee === "object") {
5915
6860
  const grantFee = {
5916
6861
  ...fee,
5917
6862
  granter: this.saasAddress
5918
6863
  };
5919
- return client.withdraw({ amount }, grantFee);
6864
+ return client.removeOperator({ operator }, grantFee);
5920
6865
  }
5921
- return client.withdraw({ amount }, fee);
5922
- }
5923
- async queryRoundInfo({
5924
- signer,
5925
- roundAddress
5926
- }) {
5927
- const client = await createMaciClientBy({
5928
- rpcEndpoint: this.rpcEndpoint,
5929
- wallet: signer,
5930
- contractAddress: roundAddress
5931
- });
5932
- const roundInfo = await client.getRoundInfo();
5933
- return roundInfo;
5934
- }
5935
- async oracleMaciClient({
5936
- signer,
5937
- contractAddress
5938
- }) {
5939
- const client = await createOracleMaciClientBy({
5940
- rpcEndpoint: this.rpcEndpoint,
5941
- wallet: signer,
5942
- contractAddress
5943
- });
5944
- return client;
5945
- }
5946
- async registryClient({
5947
- signer,
5948
- contractAddress
5949
- }) {
5950
- return createRegistryClientBy({
5951
- rpcEndpoint: this.rpcEndpoint,
5952
- wallet: signer,
5953
- contractAddress
5954
- });
5955
- }
5956
- async maciClient({
5957
- signer,
5958
- contractAddress
5959
- }) {
5960
- return createMaciClientBy({
5961
- rpcEndpoint: this.rpcEndpoint,
5962
- wallet: signer,
5963
- contractAddress
5964
- });
5965
- }
5966
- async amaciClient({
5967
- signer,
5968
- contractAddress
5969
- }) {
5970
- return createAMaciClientBy({
5971
- rpcEndpoint: this.rpcEndpoint,
5972
- wallet: signer,
5973
- contractAddress
5974
- });
6866
+ return client.removeOperator({ operator }, fee);
5975
6867
  }
5976
- async saasClient({
6868
+ async isApiSaasOperator({
5977
6869
  signer,
5978
- contractAddress
6870
+ operator
5979
6871
  }) {
5980
- return createSaasClientBy({
6872
+ const client = await createApiSaasClientBy({
5981
6873
  rpcEndpoint: this.rpcEndpoint,
5982
6874
  wallet: signer,
5983
- contractAddress
6875
+ contractAddress: this.saasAddress
5984
6876
  });
5985
- }
5986
- async contractClient({ signer }) {
5987
- return createContractClientByWallet(this.rpcEndpoint, signer);
6877
+ return client.isOperator({ address: operator });
5988
6878
  }
5989
6879
  };
5990
6880
 
@@ -6391,6 +7281,46 @@ var MACI = class {
6391
7281
  throw Error(`Signup failed! ${error}`);
6392
7282
  }
6393
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
+ }
6394
7324
  async processVoteOptions({
6395
7325
  selectedOptions,
6396
7326
  contractAddress,
@@ -6509,6 +7439,84 @@ var MACI = class {
6509
7439
  throw Error(`Vote failed! ${error}`);
6510
7440
  }
6511
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
+ }
6512
7520
  async publishMessage({
6513
7521
  client,
6514
7522
  address,
@@ -6972,9 +7980,9 @@ var MaciClient2 = class {
6972
7980
  apiEndpoint,
6973
7981
  registryAddress,
6974
7982
  saasAddress,
7983
+ apiSaasAddress,
6975
7984
  maciCodeId,
6976
7985
  oracleCodeId,
6977
- saasOracleCodeId,
6978
7986
  customFetch,
6979
7987
  defaultOptions,
6980
7988
  feegrantOperator,
@@ -6991,9 +7999,9 @@ var MaciClient2 = class {
6991
7999
  this.certificateApiEndpoint = certificateApiEndpoint || defaultParams.certificateApiEndpoint;
6992
8000
  this.registryAddress = registryAddress || defaultParams.registryAddress;
6993
8001
  this.saasAddress = saasAddress || defaultParams.saasAddress;
8002
+ this.apiSaasAddress = apiSaasAddress || defaultParams.apiSaasAddress;
6994
8003
  this.maciCodeId = maciCodeId || defaultParams.maciCodeId;
6995
8004
  this.oracleCodeId = oracleCodeId || defaultParams.oracleCodeId;
6996
- this.saasOracleCodeId = saasOracleCodeId || defaultParams.saasCodeId;
6997
8005
  this.feegrantOperator = feegrantOperator || defaultParams.oracleFeegrantOperator;
6998
8006
  this.whitelistBackendPubkey = whitelistBackendPubkey || defaultParams.oracleWhitelistBackendPubkey;
6999
8007
  this.maciKeypair = maciKeypair ?? genKeypair();
@@ -7014,9 +8022,9 @@ var MaciClient2 = class {
7014
8022
  rpcEndpoint: this.rpcEndpoint,
7015
8023
  registryAddress: this.registryAddress,
7016
8024
  saasAddress: this.saasAddress,
8025
+ apiSaasAddress: this.apiSaasAddress,
7017
8026
  maciCodeId: this.maciCodeId,
7018
8027
  oracleCodeId: this.oracleCodeId,
7019
- saasOracleCodeId: this.saasOracleCodeId,
7020
8028
  feegrantOperator: this.feegrantOperator,
7021
8029
  whitelistBackendPubkey: this.whitelistBackendPubkey
7022
8030
  });
@@ -7417,6 +8425,44 @@ var MaciClient2 = class {
7417
8425
  fee
7418
8426
  });
7419
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
+ }
7420
8466
  };
7421
8467
  // Annotate the CommonJS export names for ESM import in node:
7422
8468
  0 && (module.exports = {