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