@dorafactory/maci-sdk 0.1.3-pre.4 → 0.1.3-pre.6
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 +149 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +149 -69
- package/dist/index.mjs.map +1 -1
- package/dist/libs/contract/ts/ApiSaas.client.d.ts +35 -35
- package/dist/libs/maci/maci.d.ts +10 -5
- package/dist/maci.d.ts +4 -2
- package/package.json +1 -1
- package/src/libs/contract/ts/ApiSaas.client.ts +415 -228
- package/src/libs/maci/maci.ts +19 -6
- package/src/maci.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -4866,9 +4866,7 @@ var ApiSaasQueryClient = class {
|
|
|
4866
4866
|
operators: {}
|
|
4867
4867
|
});
|
|
4868
4868
|
};
|
|
4869
|
-
this.isOperator = async ({
|
|
4870
|
-
address
|
|
4871
|
-
}) => {
|
|
4869
|
+
this.isOperator = async ({ address }) => {
|
|
4872
4870
|
return this.client.queryContractSmart(this.contractAddress, {
|
|
4873
4871
|
is_operator: {
|
|
4874
4872
|
address
|
|
@@ -4907,64 +4905,113 @@ var ApiSaasClient = class extends ApiSaasQueryClient {
|
|
|
4907
4905
|
admin,
|
|
4908
4906
|
denom
|
|
4909
4907
|
}, fee = "auto", memo, _funds) => {
|
|
4910
|
-
return await this.client.execute(
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4908
|
+
return await this.client.execute(
|
|
4909
|
+
this.sender,
|
|
4910
|
+
this.contractAddress,
|
|
4911
|
+
{
|
|
4912
|
+
update_config: {
|
|
4913
|
+
admin,
|
|
4914
|
+
denom
|
|
4915
|
+
}
|
|
4916
|
+
},
|
|
4917
|
+
fee,
|
|
4918
|
+
memo,
|
|
4919
|
+
_funds
|
|
4920
|
+
);
|
|
4916
4921
|
};
|
|
4917
4922
|
this.updateMaciCodeId = async ({
|
|
4918
4923
|
codeId
|
|
4919
4924
|
}, fee = "auto", memo, _funds) => {
|
|
4920
|
-
return await this.client.execute(
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
+
return await this.client.execute(
|
|
4926
|
+
this.sender,
|
|
4927
|
+
this.contractAddress,
|
|
4928
|
+
{
|
|
4929
|
+
update_maci_code_id: {
|
|
4930
|
+
code_id: codeId
|
|
4931
|
+
}
|
|
4932
|
+
},
|
|
4933
|
+
fee,
|
|
4934
|
+
memo,
|
|
4935
|
+
_funds
|
|
4936
|
+
);
|
|
4925
4937
|
};
|
|
4926
4938
|
this.updateAmaciRegistryContract = async ({
|
|
4927
4939
|
registryContract
|
|
4928
4940
|
}, fee = "auto", memo, _funds) => {
|
|
4929
|
-
return await this.client.execute(
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4941
|
+
return await this.client.execute(
|
|
4942
|
+
this.sender,
|
|
4943
|
+
this.contractAddress,
|
|
4944
|
+
{
|
|
4945
|
+
update_amaci_registry_contract: {
|
|
4946
|
+
registry_contract: registryContract
|
|
4947
|
+
}
|
|
4948
|
+
},
|
|
4949
|
+
fee,
|
|
4950
|
+
memo,
|
|
4951
|
+
_funds
|
|
4952
|
+
);
|
|
4934
4953
|
};
|
|
4935
4954
|
this.addOperator = async ({
|
|
4936
4955
|
operator
|
|
4937
4956
|
}, fee = "auto", memo, _funds) => {
|
|
4938
|
-
return await this.client.execute(
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4957
|
+
return await this.client.execute(
|
|
4958
|
+
this.sender,
|
|
4959
|
+
this.contractAddress,
|
|
4960
|
+
{
|
|
4961
|
+
add_operator: {
|
|
4962
|
+
operator
|
|
4963
|
+
}
|
|
4964
|
+
},
|
|
4965
|
+
fee,
|
|
4966
|
+
memo,
|
|
4967
|
+
_funds
|
|
4968
|
+
);
|
|
4943
4969
|
};
|
|
4944
4970
|
this.removeOperator = async ({
|
|
4945
4971
|
operator
|
|
4946
4972
|
}, fee = "auto", memo, _funds) => {
|
|
4947
|
-
return await this.client.execute(
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4973
|
+
return await this.client.execute(
|
|
4974
|
+
this.sender,
|
|
4975
|
+
this.contractAddress,
|
|
4976
|
+
{
|
|
4977
|
+
remove_operator: {
|
|
4978
|
+
operator
|
|
4979
|
+
}
|
|
4980
|
+
},
|
|
4981
|
+
fee,
|
|
4982
|
+
memo,
|
|
4983
|
+
_funds
|
|
4984
|
+
);
|
|
4952
4985
|
};
|
|
4953
4986
|
this.deposit = async (fee = "auto", memo, _funds) => {
|
|
4954
|
-
return await this.client.execute(
|
|
4955
|
-
|
|
4956
|
-
|
|
4987
|
+
return await this.client.execute(
|
|
4988
|
+
this.sender,
|
|
4989
|
+
this.contractAddress,
|
|
4990
|
+
{
|
|
4991
|
+
deposit: {}
|
|
4992
|
+
},
|
|
4993
|
+
fee,
|
|
4994
|
+
memo,
|
|
4995
|
+
_funds
|
|
4996
|
+
);
|
|
4957
4997
|
};
|
|
4958
4998
|
this.withdraw = async ({
|
|
4959
4999
|
amount,
|
|
4960
5000
|
recipient
|
|
4961
5001
|
}, fee = "auto", memo, _funds) => {
|
|
4962
|
-
return await this.client.execute(
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
5002
|
+
return await this.client.execute(
|
|
5003
|
+
this.sender,
|
|
5004
|
+
this.contractAddress,
|
|
5005
|
+
{
|
|
5006
|
+
withdraw: {
|
|
5007
|
+
amount,
|
|
5008
|
+
recipient
|
|
5009
|
+
}
|
|
5010
|
+
},
|
|
5011
|
+
fee,
|
|
5012
|
+
memo,
|
|
5013
|
+
_funds
|
|
5014
|
+
);
|
|
4968
5015
|
};
|
|
4969
5016
|
this.createApiMaciRound = async ({
|
|
4970
5017
|
certificationSystem,
|
|
@@ -4977,41 +5024,62 @@ var ApiSaasClient = class extends ApiSaasQueryClient {
|
|
|
4977
5024
|
voteOptionMap,
|
|
4978
5025
|
whitelistBackendPubkey
|
|
4979
5026
|
}, fee = "auto", memo, _funds) => {
|
|
4980
|
-
return await this.client.execute(
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
5027
|
+
return await this.client.execute(
|
|
5028
|
+
this.sender,
|
|
5029
|
+
this.contractAddress,
|
|
5030
|
+
{
|
|
5031
|
+
create_api_maci_round: {
|
|
5032
|
+
certification_system: certificationSystem,
|
|
5033
|
+
circuit_type: circuitType,
|
|
5034
|
+
coordinator,
|
|
5035
|
+
end_time: endTime,
|
|
5036
|
+
max_voters: maxVoters.toString(),
|
|
5037
|
+
round_info: roundInfo,
|
|
5038
|
+
start_time: startTime,
|
|
5039
|
+
vote_option_map: voteOptionMap,
|
|
5040
|
+
whitelist_backend_pubkey: whitelistBackendPubkey
|
|
5041
|
+
}
|
|
5042
|
+
},
|
|
5043
|
+
fee,
|
|
5044
|
+
memo,
|
|
5045
|
+
_funds
|
|
5046
|
+
);
|
|
4993
5047
|
};
|
|
4994
5048
|
this.setRoundInfo = async ({
|
|
4995
5049
|
contractAddr,
|
|
4996
5050
|
roundInfo
|
|
4997
5051
|
}, fee = "auto", memo, _funds) => {
|
|
4998
|
-
return await this.client.execute(
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5052
|
+
return await this.client.execute(
|
|
5053
|
+
this.sender,
|
|
5054
|
+
this.contractAddress,
|
|
5055
|
+
{
|
|
5056
|
+
set_round_info: {
|
|
5057
|
+
contract_addr: contractAddr,
|
|
5058
|
+
round_info: roundInfo
|
|
5059
|
+
}
|
|
5060
|
+
},
|
|
5061
|
+
fee,
|
|
5062
|
+
memo,
|
|
5063
|
+
_funds
|
|
5064
|
+
);
|
|
5004
5065
|
};
|
|
5005
5066
|
this.setVoteOptionsMap = async ({
|
|
5006
5067
|
contractAddr,
|
|
5007
5068
|
voteOptionMap
|
|
5008
5069
|
}, fee = "auto", memo, _funds) => {
|
|
5009
|
-
return await this.client.execute(
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5070
|
+
return await this.client.execute(
|
|
5071
|
+
this.sender,
|
|
5072
|
+
this.contractAddress,
|
|
5073
|
+
{
|
|
5074
|
+
set_vote_options_map: {
|
|
5075
|
+
contract_addr: contractAddr,
|
|
5076
|
+
vote_option_map: voteOptionMap
|
|
5077
|
+
}
|
|
5078
|
+
},
|
|
5079
|
+
fee,
|
|
5080
|
+
memo,
|
|
5081
|
+
_funds
|
|
5082
|
+
);
|
|
5015
5083
|
};
|
|
5016
5084
|
this.client = client;
|
|
5017
5085
|
this.sender = sender;
|
|
@@ -7288,6 +7356,7 @@ var MACI = class {
|
|
|
7288
7356
|
pubKey,
|
|
7289
7357
|
oracleCertificate,
|
|
7290
7358
|
gasStation = false,
|
|
7359
|
+
granter,
|
|
7291
7360
|
fee
|
|
7292
7361
|
}) {
|
|
7293
7362
|
try {
|
|
@@ -7305,6 +7374,7 @@ var MACI = class {
|
|
|
7305
7374
|
contractAddress,
|
|
7306
7375
|
oracleCertificate,
|
|
7307
7376
|
gasStation,
|
|
7377
|
+
granter,
|
|
7308
7378
|
fee
|
|
7309
7379
|
});
|
|
7310
7380
|
} else {
|
|
@@ -7314,6 +7384,7 @@ var MACI = class {
|
|
|
7314
7384
|
pubKey,
|
|
7315
7385
|
contractAddress,
|
|
7316
7386
|
gasStation,
|
|
7387
|
+
granter,
|
|
7317
7388
|
fee
|
|
7318
7389
|
});
|
|
7319
7390
|
}
|
|
@@ -7446,6 +7517,7 @@ var MACI = class {
|
|
|
7446
7517
|
pubKey,
|
|
7447
7518
|
payload,
|
|
7448
7519
|
gasStation = false,
|
|
7520
|
+
granter,
|
|
7449
7521
|
fee = 1.8
|
|
7450
7522
|
}) {
|
|
7451
7523
|
const stateIdx = await this.getStateIdxByPubKey({
|
|
@@ -7511,6 +7583,7 @@ var MACI = class {
|
|
|
7511
7583
|
payload,
|
|
7512
7584
|
contractAddress,
|
|
7513
7585
|
gasStation,
|
|
7586
|
+
granter,
|
|
7514
7587
|
fee
|
|
7515
7588
|
});
|
|
7516
7589
|
} catch (error) {
|
|
@@ -7523,6 +7596,7 @@ var MACI = class {
|
|
|
7523
7596
|
payload,
|
|
7524
7597
|
contractAddress,
|
|
7525
7598
|
gasStation,
|
|
7599
|
+
granter,
|
|
7526
7600
|
fee = 1.8
|
|
7527
7601
|
}) {
|
|
7528
7602
|
const msgs = payload.map(
|
|
@@ -7560,13 +7634,13 @@ var MACI = class {
|
|
|
7560
7634
|
const grantFee = {
|
|
7561
7635
|
amount: calculatedFee.amount,
|
|
7562
7636
|
gas: calculatedFee.gas,
|
|
7563
|
-
granter: contractAddress
|
|
7637
|
+
granter: granter || contractAddress
|
|
7564
7638
|
};
|
|
7565
7639
|
return client.signAndBroadcast(address, msgs, grantFee);
|
|
7566
7640
|
} else if (gasStation && typeof fee === "object") {
|
|
7567
7641
|
const grantFee = {
|
|
7568
7642
|
...fee,
|
|
7569
|
-
granter: contractAddress
|
|
7643
|
+
granter: granter || contractAddress
|
|
7570
7644
|
};
|
|
7571
7645
|
return client.signAndBroadcast(address, msgs, grantFee);
|
|
7572
7646
|
}
|
|
@@ -7578,6 +7652,7 @@ var MACI = class {
|
|
|
7578
7652
|
pubKey,
|
|
7579
7653
|
contractAddress,
|
|
7580
7654
|
gasStation,
|
|
7655
|
+
granter,
|
|
7581
7656
|
fee = 1.8
|
|
7582
7657
|
}) {
|
|
7583
7658
|
const msg = {
|
|
@@ -7612,13 +7687,13 @@ var MACI = class {
|
|
|
7612
7687
|
const grantFee = {
|
|
7613
7688
|
amount: calculatedFee.amount,
|
|
7614
7689
|
gas: calculatedFee.gas,
|
|
7615
|
-
granter: contractAddress
|
|
7690
|
+
granter: granter || contractAddress
|
|
7616
7691
|
};
|
|
7617
7692
|
return client.execute(address, contractAddress, msg, grantFee);
|
|
7618
7693
|
} else if (gasStation === true && typeof fee === "object") {
|
|
7619
7694
|
const grantFee = {
|
|
7620
7695
|
...fee,
|
|
7621
|
-
granter: contractAddress
|
|
7696
|
+
granter: granter || contractAddress
|
|
7622
7697
|
};
|
|
7623
7698
|
return client.execute(address, contractAddress, msg, grantFee);
|
|
7624
7699
|
}
|
|
@@ -7631,6 +7706,7 @@ var MACI = class {
|
|
|
7631
7706
|
contractAddress,
|
|
7632
7707
|
oracleCertificate,
|
|
7633
7708
|
gasStation,
|
|
7709
|
+
granter,
|
|
7634
7710
|
fee = 1.8
|
|
7635
7711
|
}) {
|
|
7636
7712
|
const msg = {
|
|
@@ -7667,13 +7743,13 @@ var MACI = class {
|
|
|
7667
7743
|
const grantFee = {
|
|
7668
7744
|
amount: calculatedFee.amount,
|
|
7669
7745
|
gas: calculatedFee.gas,
|
|
7670
|
-
granter: contractAddress
|
|
7746
|
+
granter: granter || contractAddress
|
|
7671
7747
|
};
|
|
7672
7748
|
return client.execute(address, contractAddress, msg, grantFee);
|
|
7673
7749
|
} else if (gasStation === true && typeof fee === "object") {
|
|
7674
7750
|
const grantFee = {
|
|
7675
7751
|
...fee,
|
|
7676
|
-
granter: contractAddress
|
|
7752
|
+
granter: granter || contractAddress
|
|
7677
7753
|
};
|
|
7678
7754
|
return client.execute(address, contractAddress, msg, grantFee);
|
|
7679
7755
|
}
|
|
@@ -8438,6 +8514,7 @@ var MaciClient2 = class {
|
|
|
8438
8514
|
pubKey,
|
|
8439
8515
|
oracleCertificate,
|
|
8440
8516
|
gasStation = false,
|
|
8517
|
+
granter,
|
|
8441
8518
|
fee
|
|
8442
8519
|
}) {
|
|
8443
8520
|
return await this.maci.rawSignup({
|
|
@@ -8447,6 +8524,7 @@ var MaciClient2 = class {
|
|
|
8447
8524
|
pubKey,
|
|
8448
8525
|
oracleCertificate,
|
|
8449
8526
|
gasStation,
|
|
8527
|
+
granter,
|
|
8450
8528
|
fee
|
|
8451
8529
|
});
|
|
8452
8530
|
}
|
|
@@ -8457,6 +8535,7 @@ var MaciClient2 = class {
|
|
|
8457
8535
|
pubKey,
|
|
8458
8536
|
payload,
|
|
8459
8537
|
gasStation = false,
|
|
8538
|
+
granter,
|
|
8460
8539
|
fee
|
|
8461
8540
|
}) {
|
|
8462
8541
|
return await this.maci.rawVote({
|
|
@@ -8466,6 +8545,7 @@ var MaciClient2 = class {
|
|
|
8466
8545
|
pubKey,
|
|
8467
8546
|
payload,
|
|
8468
8547
|
gasStation,
|
|
8548
|
+
granter,
|
|
8469
8549
|
fee
|
|
8470
8550
|
});
|
|
8471
8551
|
}
|