@dorafactory/maci-sdk 0.0.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.
Files changed (74) hide show
  1. package/README.md +1 -0
  2. package/dist/index.d.ts +11 -0
  3. package/dist/index.js +4157 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +4123 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/dist/libs/const.d.ts +117 -0
  8. package/dist/libs/contract/config.d.ts +29 -0
  9. package/dist/libs/contract/contract.d.ts +37 -0
  10. package/dist/libs/contract/index.d.ts +1 -0
  11. package/dist/libs/contract/ts/AMaci.client.d.ts +216 -0
  12. package/dist/libs/contract/ts/AMaci.types.d.ts +203 -0
  13. package/dist/libs/contract/ts/Maci.client.d.ts +206 -0
  14. package/dist/libs/contract/ts/Maci.types.d.ts +217 -0
  15. package/dist/libs/contract/ts/OracleMaci.client.d.ts +206 -0
  16. package/dist/libs/contract/ts/OracleMaci.types.d.ts +253 -0
  17. package/dist/libs/contract/ts/Registry.client.d.ts +128 -0
  18. package/dist/libs/contract/ts/Registry.types.d.ts +110 -0
  19. package/dist/libs/contract/types.d.ts +50 -0
  20. package/dist/libs/contract/utils.d.ts +67 -0
  21. package/dist/libs/contract/vars.d.ts +65 -0
  22. package/dist/libs/errors/index.d.ts +28 -0
  23. package/dist/libs/errors/types.d.ts +14 -0
  24. package/dist/libs/http/http.d.ts +16 -0
  25. package/dist/libs/http/index.d.ts +1 -0
  26. package/dist/libs/index.d.ts +4 -0
  27. package/dist/libs/indexer/index.d.ts +1 -0
  28. package/dist/libs/indexer/indexer.d.ts +133 -0
  29. package/dist/libs/indexer/types.d.ts +7 -0
  30. package/dist/libs/query/account.d.ts +7 -0
  31. package/dist/libs/query/circuit.d.ts +8 -0
  32. package/dist/libs/query/index.d.ts +6 -0
  33. package/dist/libs/query/operator.d.ts +9 -0
  34. package/dist/libs/query/proof.d.ts +7 -0
  35. package/dist/libs/query/round.d.ts +11 -0
  36. package/dist/libs/query/transaction.d.ts +9 -0
  37. package/dist/maci.d.ts +151 -0
  38. package/dist/types/index.d.ts +254 -0
  39. package/dist/utils/index.d.ts +1 -0
  40. package/package.json +154 -0
  41. package/src/index.ts +11 -0
  42. package/src/libs/const.ts +196 -0
  43. package/src/libs/contract/config.ts +117 -0
  44. package/src/libs/contract/contract.ts +330 -0
  45. package/src/libs/contract/index.ts +1 -0
  46. package/src/libs/contract/ts/AMaci.client.ts +893 -0
  47. package/src/libs/contract/ts/AMaci.types.ts +252 -0
  48. package/src/libs/contract/ts/Maci.client.ts +906 -0
  49. package/src/libs/contract/ts/Maci.types.ts +263 -0
  50. package/src/libs/contract/ts/OracleMaci.client.ts +561 -0
  51. package/src/libs/contract/ts/OracleMaci.types.ts +254 -0
  52. package/src/libs/contract/ts/Registry.client.ts +466 -0
  53. package/src/libs/contract/ts/Registry.types.ts +127 -0
  54. package/src/libs/contract/types.ts +57 -0
  55. package/src/libs/contract/utils.ts +175 -0
  56. package/src/libs/contract/vars.ts +420 -0
  57. package/src/libs/errors/index.ts +122 -0
  58. package/src/libs/errors/types.ts +14 -0
  59. package/src/libs/http/http.ts +152 -0
  60. package/src/libs/http/index.ts +1 -0
  61. package/src/libs/index.ts +4 -0
  62. package/src/libs/indexer/index.ts +1 -0
  63. package/src/libs/indexer/indexer.ts +240 -0
  64. package/src/libs/indexer/types.ts +8 -0
  65. package/src/libs/query/account.ts +39 -0
  66. package/src/libs/query/circuit.ts +99 -0
  67. package/src/libs/query/index.ts +6 -0
  68. package/src/libs/query/operator.ts +263 -0
  69. package/src/libs/query/proof.ts +76 -0
  70. package/src/libs/query/round.ts +533 -0
  71. package/src/libs/query/transaction.ts +204 -0
  72. package/src/maci.ts +313 -0
  73. package/src/types/index.ts +301 -0
  74. package/src/utils/index.ts +44 -0
@@ -0,0 +1,906 @@
1
+ /**
2
+ * This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
+ * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
5
+ */
6
+
7
+ import {
8
+ CosmWasmClient,
9
+ SigningCosmWasmClient,
10
+ ExecuteResult,
11
+ } from '@cosmjs/cosmwasm-stargate';
12
+ import { Coin, StdFee } from '@cosmjs/amino';
13
+ import {
14
+ Uint256,
15
+ Timestamp,
16
+ Uint64,
17
+ InstantiateMsg,
18
+ PubKey,
19
+ Groth16VKeyType,
20
+ MaciParameters,
21
+ QuinaryTreeRoot,
22
+ RoundInfo,
23
+ VotingTime,
24
+ Whitelist,
25
+ WhitelistConfig,
26
+ ExecuteMsg,
27
+ Uint128,
28
+ MessageData,
29
+ Groth16ProofType,
30
+ QueryMsg,
31
+ Addr,
32
+ PeriodStatus,
33
+ Period,
34
+ Boolean,
35
+ ArrayOfString,
36
+ } from './Maci.types';
37
+ export interface MaciReadOnlyInterface {
38
+ contractAddress: string;
39
+ getRoundInfo: () => Promise<RoundInfo>;
40
+ getVotingTime: () => Promise<VotingTime>;
41
+ getPeriod: () => Promise<Period>;
42
+ getNumSignUp: () => Promise<Uint256>;
43
+ getMsgChainLength: () => Promise<Uint256>;
44
+ getDMsgChainLength: () => Promise<Uint256>;
45
+ getProcessedDMsgCount: () => Promise<Uint256>;
46
+ getProcessedMsgCount: () => Promise<Uint256>;
47
+ getProcessedUserCount: () => Promise<Uint256>;
48
+ getResult: ({ index }: { index: Uint256 }) => Promise<Uint256>;
49
+ getAllResult: () => Promise<Uint256>;
50
+ getStateIdxInc: ({ address }: { address: Addr }) => Promise<Uint256>;
51
+ getVoiceCreditBalance: ({ index }: { index: Uint256 }) => Promise<Uint256>;
52
+ whiteList: () => Promise<Whitelist>;
53
+ isWhiteList: ({ sender }: { sender: string }) => Promise<Boolean>;
54
+ voteOptionMap: () => Promise<ArrayOfString>;
55
+ maxVoteOptions: () => Promise<Uint256>;
56
+ queryTotalFeeGrant: () => Promise<Uint128>;
57
+ queryCircuitType: () => Promise<Uint256>;
58
+ queryCertSystem: () => Promise<Uint256>;
59
+ }
60
+ export class MaciQueryClient implements MaciReadOnlyInterface {
61
+ client: CosmWasmClient;
62
+ contractAddress: string;
63
+
64
+ constructor(client: CosmWasmClient, contractAddress: string) {
65
+ this.client = client;
66
+ this.contractAddress = contractAddress;
67
+ this.getRoundInfo = this.getRoundInfo.bind(this);
68
+ this.getVotingTime = this.getVotingTime.bind(this);
69
+ this.getPeriod = this.getPeriod.bind(this);
70
+ this.getNumSignUp = this.getNumSignUp.bind(this);
71
+ this.getMsgChainLength = this.getMsgChainLength.bind(this);
72
+ this.getDMsgChainLength = this.getDMsgChainLength.bind(this);
73
+ this.getProcessedDMsgCount = this.getProcessedDMsgCount.bind(this);
74
+ this.getProcessedMsgCount = this.getProcessedMsgCount.bind(this);
75
+ this.getProcessedUserCount = this.getProcessedUserCount.bind(this);
76
+ this.getResult = this.getResult.bind(this);
77
+ this.getAllResult = this.getAllResult.bind(this);
78
+ this.getStateIdxInc = this.getStateIdxInc.bind(this);
79
+ this.getVoiceCreditBalance = this.getVoiceCreditBalance.bind(this);
80
+ this.whiteList = this.whiteList.bind(this);
81
+ this.isWhiteList = this.isWhiteList.bind(this);
82
+ this.voteOptionMap = this.voteOptionMap.bind(this);
83
+ this.maxVoteOptions = this.maxVoteOptions.bind(this);
84
+ this.queryTotalFeeGrant = this.queryTotalFeeGrant.bind(this);
85
+ this.queryCircuitType = this.queryCircuitType.bind(this);
86
+ this.queryCertSystem = this.queryCertSystem.bind(this);
87
+ }
88
+
89
+ getRoundInfo = async (): Promise<RoundInfo> => {
90
+ return this.client.queryContractSmart(this.contractAddress, {
91
+ get_round_info: {},
92
+ });
93
+ };
94
+ getVotingTime = async (): Promise<VotingTime> => {
95
+ return this.client.queryContractSmart(this.contractAddress, {
96
+ get_voting_time: {},
97
+ });
98
+ };
99
+ getPeriod = async (): Promise<Period> => {
100
+ return this.client.queryContractSmart(this.contractAddress, {
101
+ get_period: {},
102
+ });
103
+ };
104
+ getNumSignUp = async (): Promise<Uint256> => {
105
+ return this.client.queryContractSmart(this.contractAddress, {
106
+ get_num_sign_up: {},
107
+ });
108
+ };
109
+ getMsgChainLength = async (): Promise<Uint256> => {
110
+ return this.client.queryContractSmart(this.contractAddress, {
111
+ get_msg_chain_length: {},
112
+ });
113
+ };
114
+ getDMsgChainLength = async (): Promise<Uint256> => {
115
+ return this.client.queryContractSmart(this.contractAddress, {
116
+ get_d_msg_chain_length: {},
117
+ });
118
+ };
119
+ getProcessedDMsgCount = async (): Promise<Uint256> => {
120
+ return this.client.queryContractSmart(this.contractAddress, {
121
+ get_processed_d_msg_count: {},
122
+ });
123
+ };
124
+ getProcessedMsgCount = async (): Promise<Uint256> => {
125
+ return this.client.queryContractSmart(this.contractAddress, {
126
+ get_processed_msg_count: {},
127
+ });
128
+ };
129
+ getProcessedUserCount = async (): Promise<Uint256> => {
130
+ return this.client.queryContractSmart(this.contractAddress, {
131
+ get_processed_user_count: {},
132
+ });
133
+ };
134
+ getResult = async ({ index }: { index: Uint256 }): Promise<Uint256> => {
135
+ return this.client.queryContractSmart(this.contractAddress, {
136
+ get_result: {
137
+ index,
138
+ },
139
+ });
140
+ };
141
+ getAllResult = async (): Promise<Uint256> => {
142
+ return this.client.queryContractSmart(this.contractAddress, {
143
+ get_all_result: {},
144
+ });
145
+ };
146
+ getStateIdxInc = async ({
147
+ address,
148
+ }: {
149
+ address: Addr;
150
+ }): Promise<Uint256> => {
151
+ return this.client.queryContractSmart(this.contractAddress, {
152
+ get_state_idx_inc: {
153
+ address,
154
+ },
155
+ });
156
+ };
157
+ getVoiceCreditBalance = async ({
158
+ index,
159
+ }: {
160
+ index: Uint256;
161
+ }): Promise<Uint256> => {
162
+ return this.client.queryContractSmart(this.contractAddress, {
163
+ get_voice_credit_balance: {
164
+ index,
165
+ },
166
+ });
167
+ };
168
+ whiteList = async (): Promise<Whitelist> => {
169
+ return this.client.queryContractSmart(this.contractAddress, {
170
+ white_list: {},
171
+ });
172
+ };
173
+ isWhiteList = async ({ sender }: { sender: string }): Promise<Boolean> => {
174
+ return this.client.queryContractSmart(this.contractAddress, {
175
+ is_white_list: {
176
+ sender,
177
+ },
178
+ });
179
+ };
180
+ voteOptionMap = async (): Promise<ArrayOfString> => {
181
+ return this.client.queryContractSmart(this.contractAddress, {
182
+ vote_option_map: {},
183
+ });
184
+ };
185
+ maxVoteOptions = async (): Promise<Uint256> => {
186
+ return this.client.queryContractSmart(this.contractAddress, {
187
+ max_vote_options: {},
188
+ });
189
+ };
190
+ queryTotalFeeGrant = async (): Promise<Uint128> => {
191
+ return this.client.queryContractSmart(this.contractAddress, {
192
+ query_total_fee_grant: {},
193
+ });
194
+ };
195
+ queryCircuitType = async (): Promise<Uint256> => {
196
+ return this.client.queryContractSmart(this.contractAddress, {
197
+ query_circuit_type: {},
198
+ });
199
+ };
200
+ queryCertSystem = async (): Promise<Uint256> => {
201
+ return this.client.queryContractSmart(this.contractAddress, {
202
+ query_cert_system: {},
203
+ });
204
+ };
205
+ }
206
+ export interface MaciInterface extends MaciReadOnlyInterface {
207
+ contractAddress: string;
208
+ sender: string;
209
+ setParams: (
210
+ {
211
+ intStateTreeDepth,
212
+ messageBatchSize,
213
+ stateTreeDepth,
214
+ voteOptionTreeDepth,
215
+ }: {
216
+ intStateTreeDepth: Uint256;
217
+ messageBatchSize: Uint256;
218
+ stateTreeDepth: Uint256;
219
+ voteOptionTreeDepth: Uint256;
220
+ },
221
+ fee?: number | StdFee | 'auto',
222
+ memo?: string,
223
+ _funds?: Coin[]
224
+ ) => Promise<ExecuteResult>;
225
+ setRoundInfo: (
226
+ {
227
+ roundInfo,
228
+ }: {
229
+ roundInfo: RoundInfo;
230
+ },
231
+ fee?: number | StdFee | 'auto',
232
+ memo?: string,
233
+ _funds?: Coin[]
234
+ ) => Promise<ExecuteResult>;
235
+ setWhitelists: (
236
+ {
237
+ whitelists,
238
+ }: {
239
+ whitelists: Whitelist;
240
+ },
241
+ fee?: number | StdFee | 'auto',
242
+ memo?: string,
243
+ _funds?: Coin[]
244
+ ) => Promise<ExecuteResult>;
245
+ setVoteOptionsMap: (
246
+ {
247
+ voteOptionMap,
248
+ }: {
249
+ voteOptionMap: string[];
250
+ },
251
+ fee?: number | StdFee | 'auto',
252
+ memo?: string,
253
+ _funds?: Coin[]
254
+ ) => Promise<ExecuteResult>;
255
+ startVotingPeriod: (
256
+ fee?: number | StdFee | 'auto',
257
+ memo?: string,
258
+ _funds?: Coin[]
259
+ ) => Promise<ExecuteResult>;
260
+ signUp: (
261
+ {
262
+ pubkey,
263
+ }: {
264
+ pubkey: PubKey;
265
+ },
266
+ fee?: number | StdFee | 'auto',
267
+ memo?: string,
268
+ _funds?: Coin[]
269
+ ) => Promise<ExecuteResult>;
270
+ startProcessPeriod: (
271
+ fee?: number | StdFee | 'auto',
272
+ memo?: string,
273
+ _funds?: Coin[]
274
+ ) => Promise<ExecuteResult>;
275
+ stopVotingPeriod: (
276
+ fee?: number | StdFee | 'auto',
277
+ memo?: string,
278
+ _funds?: Coin[]
279
+ ) => Promise<ExecuteResult>;
280
+ publishDeactivateMessage: (
281
+ {
282
+ encPubKey,
283
+ message,
284
+ }: {
285
+ encPubKey: PubKey;
286
+ message: MessageData;
287
+ },
288
+ fee?: number | StdFee | 'auto',
289
+ memo?: string,
290
+ _funds?: Coin[]
291
+ ) => Promise<ExecuteResult>;
292
+ processDeactivateMessage: (
293
+ {
294
+ groth16Proof,
295
+ newDeactivateCommitment,
296
+ newDeactivateRoot,
297
+ size,
298
+ }: {
299
+ groth16Proof: Groth16ProofType;
300
+ newDeactivateCommitment: Uint256;
301
+ newDeactivateRoot: Uint256;
302
+ size: Uint256;
303
+ },
304
+ fee?: number | StdFee | 'auto',
305
+ memo?: string,
306
+ _funds?: Coin[]
307
+ ) => Promise<ExecuteResult>;
308
+ addNewKey: (
309
+ {
310
+ d,
311
+ groth16Proof,
312
+ nullifier,
313
+ pubkey,
314
+ }: {
315
+ d: Uint256[];
316
+ groth16Proof: Groth16ProofType;
317
+ nullifier: Uint256;
318
+ pubkey: PubKey;
319
+ },
320
+ fee?: number | StdFee | 'auto',
321
+ memo?: string,
322
+ _funds?: Coin[]
323
+ ) => Promise<ExecuteResult>;
324
+ publishMessage: (
325
+ {
326
+ encPubKey,
327
+ message,
328
+ }: {
329
+ encPubKey: PubKey;
330
+ message: MessageData;
331
+ },
332
+ fee?: number | StdFee | 'auto',
333
+ memo?: string,
334
+ _funds?: Coin[]
335
+ ) => Promise<ExecuteResult>;
336
+ processMessage: (
337
+ {
338
+ groth16Proof,
339
+ newStateCommitment,
340
+ }: {
341
+ groth16Proof: Groth16ProofType;
342
+ newStateCommitment: Uint256;
343
+ },
344
+ fee?: number | StdFee | 'auto',
345
+ memo?: string,
346
+ _funds?: Coin[]
347
+ ) => Promise<ExecuteResult>;
348
+ stopProcessingPeriod: (
349
+ fee?: number | StdFee | 'auto',
350
+ memo?: string,
351
+ _funds?: Coin[]
352
+ ) => Promise<ExecuteResult>;
353
+ processTally: (
354
+ {
355
+ groth16Proof,
356
+ newTallyCommitment,
357
+ }: {
358
+ groth16Proof: Groth16ProofType;
359
+ newTallyCommitment: Uint256;
360
+ },
361
+ fee?: number | StdFee | 'auto',
362
+ memo?: string,
363
+ _funds?: Coin[]
364
+ ) => Promise<ExecuteResult>;
365
+ stopTallyingPeriod: (
366
+ {
367
+ results,
368
+ salt,
369
+ }: {
370
+ results: Uint256[];
371
+ salt: Uint256;
372
+ },
373
+ fee?: number | StdFee | 'auto',
374
+ memo?: string,
375
+ _funds?: Coin[]
376
+ ) => Promise<ExecuteResult>;
377
+ grant: (
378
+ {
379
+ maxAmount,
380
+ }: {
381
+ maxAmount: Uint128;
382
+ },
383
+ fee?: number | StdFee | 'auto',
384
+ memo?: string,
385
+ _funds?: Coin[]
386
+ ) => Promise<ExecuteResult>;
387
+ revoke: (
388
+ fee?: number | StdFee | 'auto',
389
+ memo?: string,
390
+ _funds?: Coin[]
391
+ ) => Promise<ExecuteResult>;
392
+ bond: (
393
+ fee?: number | StdFee | 'auto',
394
+ memo?: string,
395
+ _funds?: Coin[]
396
+ ) => Promise<ExecuteResult>;
397
+ withdraw: (
398
+ {
399
+ amount,
400
+ }: {
401
+ amount?: Uint128;
402
+ },
403
+ fee?: number | StdFee | 'auto',
404
+ memo?: string,
405
+ _funds?: Coin[]
406
+ ) => Promise<ExecuteResult>;
407
+ }
408
+ export class MaciClient extends MaciQueryClient implements MaciInterface {
409
+ client: SigningCosmWasmClient;
410
+ sender: string;
411
+ contractAddress: string;
412
+
413
+ constructor(
414
+ client: SigningCosmWasmClient,
415
+ sender: string,
416
+ contractAddress: string
417
+ ) {
418
+ super(client, contractAddress);
419
+ this.client = client;
420
+ this.sender = sender;
421
+ this.contractAddress = contractAddress;
422
+ this.setParams = this.setParams.bind(this);
423
+ this.setRoundInfo = this.setRoundInfo.bind(this);
424
+ this.setWhitelists = this.setWhitelists.bind(this);
425
+ this.setVoteOptionsMap = this.setVoteOptionsMap.bind(this);
426
+ this.startVotingPeriod = this.startVotingPeriod.bind(this);
427
+ this.signUp = this.signUp.bind(this);
428
+ this.startProcessPeriod = this.startProcessPeriod.bind(this);
429
+ this.stopVotingPeriod = this.stopVotingPeriod.bind(this);
430
+ this.publishDeactivateMessage =
431
+ this.publishDeactivateMessage.bind(this);
432
+ this.processDeactivateMessage =
433
+ this.processDeactivateMessage.bind(this);
434
+ this.addNewKey = this.addNewKey.bind(this);
435
+ this.publishMessage = this.publishMessage.bind(this);
436
+ this.processMessage = this.processMessage.bind(this);
437
+ this.stopProcessingPeriod = this.stopProcessingPeriod.bind(this);
438
+ this.processTally = this.processTally.bind(this);
439
+ this.stopTallyingPeriod = this.stopTallyingPeriod.bind(this);
440
+ this.grant = this.grant.bind(this);
441
+ this.revoke = this.revoke.bind(this);
442
+ this.bond = this.bond.bind(this);
443
+ this.withdraw = this.withdraw.bind(this);
444
+ }
445
+
446
+ setParams = async (
447
+ {
448
+ intStateTreeDepth,
449
+ messageBatchSize,
450
+ stateTreeDepth,
451
+ voteOptionTreeDepth,
452
+ }: {
453
+ intStateTreeDepth: Uint256;
454
+ messageBatchSize: Uint256;
455
+ stateTreeDepth: Uint256;
456
+ voteOptionTreeDepth: Uint256;
457
+ },
458
+ fee: number | StdFee | 'auto' = 'auto',
459
+ memo?: string,
460
+ _funds?: Coin[]
461
+ ): Promise<ExecuteResult> => {
462
+ return await this.client.execute(
463
+ this.sender,
464
+ this.contractAddress,
465
+ {
466
+ set_params: {
467
+ int_state_tree_depth: intStateTreeDepth,
468
+ message_batch_size: messageBatchSize,
469
+ state_tree_depth: stateTreeDepth,
470
+ vote_option_tree_depth: voteOptionTreeDepth,
471
+ },
472
+ },
473
+ fee,
474
+ memo,
475
+ _funds
476
+ );
477
+ };
478
+ setRoundInfo = async (
479
+ {
480
+ roundInfo,
481
+ }: {
482
+ roundInfo: RoundInfo;
483
+ },
484
+ fee: number | StdFee | 'auto' = 'auto',
485
+ memo?: string,
486
+ _funds?: Coin[]
487
+ ): Promise<ExecuteResult> => {
488
+ return await this.client.execute(
489
+ this.sender,
490
+ this.contractAddress,
491
+ {
492
+ set_round_info: {
493
+ round_info: roundInfo,
494
+ },
495
+ },
496
+ fee,
497
+ memo,
498
+ _funds
499
+ );
500
+ };
501
+ setWhitelists = async (
502
+ {
503
+ whitelists,
504
+ }: {
505
+ whitelists: Whitelist;
506
+ },
507
+ fee: number | StdFee | 'auto' = 'auto',
508
+ memo?: string,
509
+ _funds?: Coin[]
510
+ ): Promise<ExecuteResult> => {
511
+ return await this.client.execute(
512
+ this.sender,
513
+ this.contractAddress,
514
+ {
515
+ set_whitelists: {
516
+ whitelists,
517
+ },
518
+ },
519
+ fee,
520
+ memo,
521
+ _funds
522
+ );
523
+ };
524
+ setVoteOptionsMap = async (
525
+ {
526
+ voteOptionMap,
527
+ }: {
528
+ voteOptionMap: string[];
529
+ },
530
+ fee: number | StdFee | 'auto' = 'auto',
531
+ memo?: string,
532
+ _funds?: Coin[]
533
+ ): Promise<ExecuteResult> => {
534
+ return await this.client.execute(
535
+ this.sender,
536
+ this.contractAddress,
537
+ {
538
+ set_vote_options_map: {
539
+ vote_option_map: voteOptionMap,
540
+ },
541
+ },
542
+ fee,
543
+ memo,
544
+ _funds
545
+ );
546
+ };
547
+ startVotingPeriod = async (
548
+ fee: number | StdFee | 'auto' = 'auto',
549
+ memo?: string,
550
+ _funds?: Coin[]
551
+ ): Promise<ExecuteResult> => {
552
+ return await this.client.execute(
553
+ this.sender,
554
+ this.contractAddress,
555
+ {
556
+ start_voting_period: {},
557
+ },
558
+ fee,
559
+ memo,
560
+ _funds
561
+ );
562
+ };
563
+ signUp = async (
564
+ {
565
+ pubkey,
566
+ }: {
567
+ pubkey: PubKey;
568
+ },
569
+ fee: number | StdFee | 'auto' = 'auto',
570
+ memo?: string,
571
+ _funds?: Coin[]
572
+ ): Promise<ExecuteResult> => {
573
+ return await this.client.execute(
574
+ this.sender,
575
+ this.contractAddress,
576
+ {
577
+ sign_up: {
578
+ pubkey,
579
+ },
580
+ },
581
+ fee,
582
+ memo,
583
+ _funds
584
+ );
585
+ };
586
+ startProcessPeriod = async (
587
+ fee: number | StdFee | 'auto' = 'auto',
588
+ memo?: string,
589
+ _funds?: Coin[]
590
+ ): Promise<ExecuteResult> => {
591
+ return await this.client.execute(
592
+ this.sender,
593
+ this.contractAddress,
594
+ {
595
+ start_process_period: {},
596
+ },
597
+ fee,
598
+ memo,
599
+ _funds
600
+ );
601
+ };
602
+ stopVotingPeriod = async (
603
+ fee: number | StdFee | 'auto' = 'auto',
604
+ memo?: string,
605
+ _funds?: Coin[]
606
+ ): Promise<ExecuteResult> => {
607
+ return await this.client.execute(
608
+ this.sender,
609
+ this.contractAddress,
610
+ {
611
+ stop_voting_period: {},
612
+ },
613
+ fee,
614
+ memo,
615
+ _funds
616
+ );
617
+ };
618
+ publishDeactivateMessage = async (
619
+ {
620
+ encPubKey,
621
+ message,
622
+ }: {
623
+ encPubKey: PubKey;
624
+ message: MessageData;
625
+ },
626
+ fee: number | StdFee | 'auto' = 'auto',
627
+ memo?: string,
628
+ _funds?: Coin[]
629
+ ): Promise<ExecuteResult> => {
630
+ return await this.client.execute(
631
+ this.sender,
632
+ this.contractAddress,
633
+ {
634
+ publish_deactivate_message: {
635
+ enc_pub_key: encPubKey,
636
+ message,
637
+ },
638
+ },
639
+ fee,
640
+ memo,
641
+ _funds
642
+ );
643
+ };
644
+ processDeactivateMessage = async (
645
+ {
646
+ groth16Proof,
647
+ newDeactivateCommitment,
648
+ newDeactivateRoot,
649
+ size,
650
+ }: {
651
+ groth16Proof: Groth16ProofType;
652
+ newDeactivateCommitment: Uint256;
653
+ newDeactivateRoot: Uint256;
654
+ size: Uint256;
655
+ },
656
+ fee: number | StdFee | 'auto' = 'auto',
657
+ memo?: string,
658
+ _funds?: Coin[]
659
+ ): Promise<ExecuteResult> => {
660
+ return await this.client.execute(
661
+ this.sender,
662
+ this.contractAddress,
663
+ {
664
+ process_deactivate_message: {
665
+ groth16_proof: groth16Proof,
666
+ new_deactivate_commitment: newDeactivateCommitment,
667
+ new_deactivate_root: newDeactivateRoot,
668
+ size,
669
+ },
670
+ },
671
+ fee,
672
+ memo,
673
+ _funds
674
+ );
675
+ };
676
+ addNewKey = async (
677
+ {
678
+ d,
679
+ groth16Proof,
680
+ nullifier,
681
+ pubkey,
682
+ }: {
683
+ d: Uint256[];
684
+ groth16Proof: Groth16ProofType;
685
+ nullifier: Uint256;
686
+ pubkey: PubKey;
687
+ },
688
+ fee: number | StdFee | 'auto' = 'auto',
689
+ memo?: string,
690
+ _funds?: Coin[]
691
+ ): Promise<ExecuteResult> => {
692
+ return await this.client.execute(
693
+ this.sender,
694
+ this.contractAddress,
695
+ {
696
+ add_new_key: {
697
+ d,
698
+ groth16_proof: groth16Proof,
699
+ nullifier,
700
+ pubkey,
701
+ },
702
+ },
703
+ fee,
704
+ memo,
705
+ _funds
706
+ );
707
+ };
708
+ publishMessage = async (
709
+ {
710
+ encPubKey,
711
+ message,
712
+ }: {
713
+ encPubKey: PubKey;
714
+ message: MessageData;
715
+ },
716
+ fee: number | StdFee | 'auto' = 'auto',
717
+ memo?: string,
718
+ _funds?: Coin[]
719
+ ): Promise<ExecuteResult> => {
720
+ return await this.client.execute(
721
+ this.sender,
722
+ this.contractAddress,
723
+ {
724
+ publish_message: {
725
+ enc_pub_key: encPubKey,
726
+ message,
727
+ },
728
+ },
729
+ fee,
730
+ memo,
731
+ _funds
732
+ );
733
+ };
734
+ processMessage = async (
735
+ {
736
+ groth16Proof,
737
+ newStateCommitment,
738
+ }: {
739
+ groth16Proof: Groth16ProofType;
740
+ newStateCommitment: Uint256;
741
+ },
742
+ fee: number | StdFee | 'auto' = 'auto',
743
+ memo?: string,
744
+ _funds?: Coin[]
745
+ ): Promise<ExecuteResult> => {
746
+ return await this.client.execute(
747
+ this.sender,
748
+ this.contractAddress,
749
+ {
750
+ process_message: {
751
+ groth16_proof: groth16Proof,
752
+ new_state_commitment: newStateCommitment,
753
+ },
754
+ },
755
+ fee,
756
+ memo,
757
+ _funds
758
+ );
759
+ };
760
+ stopProcessingPeriod = async (
761
+ fee: number | StdFee | 'auto' = 'auto',
762
+ memo?: string,
763
+ _funds?: Coin[]
764
+ ): Promise<ExecuteResult> => {
765
+ return await this.client.execute(
766
+ this.sender,
767
+ this.contractAddress,
768
+ {
769
+ stop_processing_period: {},
770
+ },
771
+ fee,
772
+ memo,
773
+ _funds
774
+ );
775
+ };
776
+ processTally = async (
777
+ {
778
+ groth16Proof,
779
+ newTallyCommitment,
780
+ }: {
781
+ groth16Proof: Groth16ProofType;
782
+ newTallyCommitment: Uint256;
783
+ },
784
+ fee: number | StdFee | 'auto' = 'auto',
785
+ memo?: string,
786
+ _funds?: Coin[]
787
+ ): Promise<ExecuteResult> => {
788
+ return await this.client.execute(
789
+ this.sender,
790
+ this.contractAddress,
791
+ {
792
+ process_tally: {
793
+ groth16_proof: groth16Proof,
794
+ new_tally_commitment: newTallyCommitment,
795
+ },
796
+ },
797
+ fee,
798
+ memo,
799
+ _funds
800
+ );
801
+ };
802
+ stopTallyingPeriod = async (
803
+ {
804
+ results,
805
+ salt,
806
+ }: {
807
+ results: Uint256[];
808
+ salt: Uint256;
809
+ },
810
+ fee: number | StdFee | 'auto' = 'auto',
811
+ memo?: string,
812
+ _funds?: Coin[]
813
+ ): Promise<ExecuteResult> => {
814
+ return await this.client.execute(
815
+ this.sender,
816
+ this.contractAddress,
817
+ {
818
+ stop_tallying_period: {
819
+ results,
820
+ salt,
821
+ },
822
+ },
823
+ fee,
824
+ memo,
825
+ _funds
826
+ );
827
+ };
828
+ grant = async (
829
+ {
830
+ maxAmount,
831
+ }: {
832
+ maxAmount: Uint128;
833
+ },
834
+ fee: number | StdFee | 'auto' = 'auto',
835
+ memo?: string,
836
+ _funds?: Coin[]
837
+ ): Promise<ExecuteResult> => {
838
+ return await this.client.execute(
839
+ this.sender,
840
+ this.contractAddress,
841
+ {
842
+ grant: {
843
+ max_amount: maxAmount,
844
+ },
845
+ },
846
+ fee,
847
+ memo,
848
+ _funds
849
+ );
850
+ };
851
+ revoke = async (
852
+ fee: number | StdFee | 'auto' = 'auto',
853
+ memo?: string,
854
+ _funds?: Coin[]
855
+ ): Promise<ExecuteResult> => {
856
+ return await this.client.execute(
857
+ this.sender,
858
+ this.contractAddress,
859
+ {
860
+ revoke: {},
861
+ },
862
+ fee,
863
+ memo,
864
+ _funds
865
+ );
866
+ };
867
+ bond = async (
868
+ fee: number | StdFee | 'auto' = 'auto',
869
+ memo?: string,
870
+ _funds?: Coin[]
871
+ ): Promise<ExecuteResult> => {
872
+ return await this.client.execute(
873
+ this.sender,
874
+ this.contractAddress,
875
+ {
876
+ bond: {},
877
+ },
878
+ fee,
879
+ memo,
880
+ _funds
881
+ );
882
+ };
883
+ withdraw = async (
884
+ {
885
+ amount,
886
+ }: {
887
+ amount?: Uint128;
888
+ },
889
+ fee: number | StdFee | 'auto' = 'auto',
890
+ memo?: string,
891
+ _funds?: Coin[]
892
+ ): Promise<ExecuteResult> => {
893
+ return await this.client.execute(
894
+ this.sender,
895
+ this.contractAddress,
896
+ {
897
+ withdraw: {
898
+ amount,
899
+ },
900
+ },
901
+ fee,
902
+ memo,
903
+ _funds
904
+ );
905
+ };
906
+ }