@dorafactory/maci-sdk 0.1.2 → 0.1.3-pre.10

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 (39) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +2371 -975
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +2369 -975
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/libs/const.d.ts +1 -2
  7. package/dist/libs/contract/config.d.ts +12 -0
  8. package/dist/libs/contract/contract.d.ts +66 -4
  9. package/dist/libs/contract/ts/AMaci.client.d.ts +25 -3
  10. package/dist/libs/contract/ts/AMaci.types.d.ts +26 -1
  11. package/dist/libs/contract/ts/ApiMaci.client.d.ts +170 -0
  12. package/dist/libs/contract/ts/ApiMaci.types.d.ts +187 -0
  13. package/dist/libs/contract/ts/ApiSaas.client.d.ts +148 -0
  14. package/dist/libs/contract/ts/ApiSaas.types.d.ts +126 -0
  15. package/dist/libs/contract/ts/Registry.client.d.ts +17 -7
  16. package/dist/libs/contract/ts/Registry.types.d.ts +16 -5
  17. package/dist/libs/contract/types.d.ts +15 -3
  18. package/dist/libs/crypto/bigintUtils.d.ts +2 -0
  19. package/dist/libs/maci/maci.d.ts +34 -4
  20. package/dist/maci.d.ts +47 -3
  21. package/dist/types/index.d.ts +2 -2
  22. package/package.json +1 -1
  23. package/src/index.ts +5 -1
  24. package/src/libs/const.ts +5 -6
  25. package/src/libs/contract/config.ts +36 -0
  26. package/src/libs/contract/contract.ts +611 -6
  27. package/src/libs/contract/ts/AMaci.client.ts +66 -0
  28. package/src/libs/contract/ts/AMaci.types.ts +30 -1
  29. package/src/libs/contract/ts/ApiMaci.client.ts +459 -0
  30. package/src/libs/contract/ts/ApiMaci.types.ts +188 -0
  31. package/src/libs/contract/ts/ApiSaas.client.ts +581 -0
  32. package/src/libs/contract/ts/ApiSaas.types.ts +144 -0
  33. package/src/libs/contract/ts/Registry.client.ts +57 -9
  34. package/src/libs/contract/ts/Registry.types.ts +18 -5
  35. package/src/libs/contract/types.ts +16 -3
  36. package/src/libs/crypto/bigintUtils.ts +28 -0
  37. package/src/libs/maci/maci.ts +190 -9
  38. package/src/maci.ts +86 -4
  39. package/src/types/index.ts +2 -2
@@ -32,6 +32,8 @@ import {
32
32
  DelayRecord,
33
33
  PeriodStatus,
34
34
  Period,
35
+ TallyDelayInfo,
36
+ NullableString,
35
37
  Uint128,
36
38
  ArrayOfString,
37
39
  Whitelist,
@@ -67,6 +69,22 @@ export interface AMaciReadOnlyInterface {
67
69
  queryCertSystem: () => Promise<Uint256>;
68
70
  queryPreDeactivateRoot: () => Promise<Uint256>;
69
71
  getDelayRecords: () => Promise<DelayRecords>;
72
+ getTallyDelay: () => Promise<TallyDelayInfo>;
73
+ queryOracleWhitelistConfig: () => Promise<NullableString>;
74
+ canSignUpWithOracle: ({
75
+ certificate,
76
+ pubkey,
77
+ }: {
78
+ certificate: string;
79
+ pubkey: PubKey;
80
+ }) => Promise<Boolean>;
81
+ whiteBalanceOf: ({
82
+ certificate,
83
+ pubkey,
84
+ }: {
85
+ certificate: string;
86
+ pubkey: PubKey;
87
+ }) => Promise<Uint256>;
70
88
  }
71
89
  export class AMaciQueryClient implements AMaciReadOnlyInterface {
72
90
  client: CosmWasmClient;
@@ -102,6 +120,11 @@ export class AMaciQueryClient implements AMaciReadOnlyInterface {
102
120
  this.queryCertSystem = this.queryCertSystem.bind(this);
103
121
  this.queryPreDeactivateRoot = this.queryPreDeactivateRoot.bind(this);
104
122
  this.getDelayRecords = this.getDelayRecords.bind(this);
123
+ this.getTallyDelay = this.getTallyDelay.bind(this);
124
+ this.queryOracleWhitelistConfig =
125
+ this.queryOracleWhitelistConfig.bind(this);
126
+ this.canSignUpWithOracle = this.canSignUpWithOracle.bind(this);
127
+ this.whiteBalanceOf = this.whiteBalanceOf.bind(this);
105
128
  }
106
129
  admin = async (): Promise<Addr> => {
107
130
  return this.client.queryContractSmart(this.contractAddress, {
@@ -261,6 +284,44 @@ export class AMaciQueryClient implements AMaciReadOnlyInterface {
261
284
  get_delay_records: {},
262
285
  });
263
286
  };
287
+ getTallyDelay = async (): Promise<TallyDelayInfo> => {
288
+ return this.client.queryContractSmart(this.contractAddress, {
289
+ get_tally_delay: {},
290
+ });
291
+ };
292
+ queryOracleWhitelistConfig = async (): Promise<NullableString> => {
293
+ return this.client.queryContractSmart(this.contractAddress, {
294
+ query_oracle_whitelist_config: {},
295
+ });
296
+ };
297
+ canSignUpWithOracle = async ({
298
+ certificate,
299
+ pubkey,
300
+ }: {
301
+ certificate: string;
302
+ pubkey: PubKey;
303
+ }): Promise<Boolean> => {
304
+ return this.client.queryContractSmart(this.contractAddress, {
305
+ can_sign_up_with_oracle: {
306
+ certificate,
307
+ pubkey,
308
+ },
309
+ });
310
+ };
311
+ whiteBalanceOf = async ({
312
+ certificate,
313
+ pubkey,
314
+ }: {
315
+ certificate: string;
316
+ pubkey: PubKey;
317
+ }): Promise<Uint256> => {
318
+ return this.client.queryContractSmart(this.contractAddress, {
319
+ white_balance_of: {
320
+ certificate,
321
+ pubkey,
322
+ },
323
+ });
324
+ };
264
325
  }
265
326
  export interface AMaciInterface extends AMaciReadOnlyInterface {
266
327
  contractAddress: string;
@@ -297,8 +358,10 @@ export interface AMaciInterface extends AMaciReadOnlyInterface {
297
358
  ) => Promise<ExecuteResult>;
298
359
  signUp: (
299
360
  {
361
+ certificate,
300
362
  pubkey,
301
363
  }: {
364
+ certificate?: string;
302
365
  pubkey: PubKey;
303
366
  },
304
367
  fee?: number | StdFee | 'auto',
@@ -529,8 +592,10 @@ export class AMaciClient extends AMaciQueryClient implements AMaciInterface {
529
592
  };
530
593
  signUp = async (
531
594
  {
595
+ certificate,
532
596
  pubkey,
533
597
  }: {
598
+ certificate?: string;
534
599
  pubkey: PubKey;
535
600
  },
536
601
  fee: number | StdFee | 'auto' = 'auto',
@@ -542,6 +607,7 @@ export class AMaciClient extends AMaciQueryClient implements AMaciInterface {
542
607
  this.contractAddress,
543
608
  {
544
609
  sign_up: {
610
+ certificate,
545
611
  pubkey,
546
612
  },
547
613
  },
@@ -13,12 +13,14 @@ export interface InstantiateMsg {
13
13
  certification_system: Uint256;
14
14
  circuit_type: Uint256;
15
15
  coordinator: PubKey;
16
- max_vote_options: Uint256;
16
+ fee_recipient: Addr;
17
17
  operator: Addr;
18
+ oracle_whitelist_pubkey?: string | null;
18
19
  parameters: MaciParameters;
19
20
  pre_deactivate_root: Uint256;
20
21
  round_info: RoundInfo;
21
22
  voice_credit_amount: Uint256;
23
+ vote_option_map: string[];
22
24
  voting_time: VotingTime;
23
25
  whitelist?: WhitelistBase | null;
24
26
  }
@@ -65,6 +67,7 @@ export type ExecuteMsg =
65
67
  }
66
68
  | {
67
69
  sign_up: {
70
+ certificate?: string | null;
68
71
  pubkey: PubKey;
69
72
  };
70
73
  }
@@ -237,6 +240,24 @@ export type QueryMsg =
237
240
  }
238
241
  | {
239
242
  get_delay_records: {};
243
+ }
244
+ | {
245
+ get_tally_delay: {};
246
+ }
247
+ | {
248
+ query_oracle_whitelist_config: {};
249
+ }
250
+ | {
251
+ can_sign_up_with_oracle: {
252
+ certificate: string;
253
+ pubkey: PubKey;
254
+ };
255
+ }
256
+ | {
257
+ white_balance_of: {
258
+ certificate: string;
259
+ pubkey: PubKey;
260
+ };
240
261
  };
241
262
  export type Boolean = boolean;
242
263
  export type DelayType = 'deactivate_delay' | 'tally_delay';
@@ -259,6 +280,14 @@ export type PeriodStatus =
259
280
  export interface Period {
260
281
  status: PeriodStatus;
261
282
  }
283
+ export interface TallyDelayInfo {
284
+ calculated_hours: number;
285
+ delay_seconds: number;
286
+ msg_chain_length: Uint256;
287
+ num_sign_ups: Uint256;
288
+ total_work: number;
289
+ }
290
+ export type NullableString = string | null;
262
291
  export type Uint128 = string;
263
292
  export type ArrayOfString = string[];
264
293
  export interface Whitelist {
@@ -0,0 +1,459 @@
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 { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
8
+ import { Coin, StdFee } from "@cosmjs/amino";
9
+ import { Uint256, Timestamp, Uint64, VotingPowerMode, InstantiateMsg, PubKey, RoundInfo, VotingTime, VotingPowerArgs, ExecuteMsg, Uint128, MessageData, Groth16ProofType, PlonkProofType, QueryMsg, Addr, PeriodStatus, Period, Boolean, Binary, OracleWhitelistConfig, ArrayOfString, WhitelistConfig } from "./ApiMaci.types";
10
+ export interface ApiMaciReadOnlyInterface {
11
+ contractAddress: string;
12
+ getRoundInfo: () => Promise<RoundInfo>;
13
+ getVotingTime: () => Promise<VotingTime>;
14
+ getPeriod: () => Promise<Period>;
15
+ getNumSignUp: () => Promise<Uint256>;
16
+ getMsgChainLength: () => Promise<Uint256>;
17
+ getProcessedMsgCount: () => Promise<Uint256>;
18
+ getProcessedUserCount: () => Promise<Uint256>;
19
+ getResult: ({
20
+ index
21
+ }: {
22
+ index: Uint256;
23
+ }) => Promise<Uint256>;
24
+ getAllResult: () => Promise<Uint256>;
25
+ getStateIdxInc: ({
26
+ address
27
+ }: {
28
+ address: Addr;
29
+ }) => Promise<Uint256>;
30
+ getVoiceCreditBalance: ({
31
+ index
32
+ }: {
33
+ index: Uint256;
34
+ }) => Promise<Uint256>;
35
+ isWhiteList: ({
36
+ amount,
37
+ certificate,
38
+ pubkey
39
+ }: {
40
+ amount: Uint256;
41
+ certificate: string;
42
+ pubkey: PubKey;
43
+ }) => Promise<Boolean>;
44
+ whiteBalanceOf: ({
45
+ amount,
46
+ certificate,
47
+ pubkey
48
+ }: {
49
+ amount: Uint256;
50
+ certificate: string;
51
+ pubkey: PubKey;
52
+ }) => Promise<Uint256>;
53
+ whiteInfo: ({
54
+ pubkey
55
+ }: {
56
+ pubkey: PubKey;
57
+ }) => Promise<WhitelistConfig>;
58
+ maxWhitelistNum: () => Promise<Uint128>;
59
+ voteOptionMap: () => Promise<ArrayOfString>;
60
+ maxVoteOptions: () => Promise<Uint256>;
61
+ queryTotalFeeGrant: () => Promise<Uint128>;
62
+ queryCircuitType: () => Promise<Uint256>;
63
+ queryCertSystem: () => Promise<Uint256>;
64
+ queryOracleWhitelistConfig: () => Promise<OracleWhitelistConfig>;
65
+ }
66
+ export class ApiMaciQueryClient implements ApiMaciReadOnlyInterface {
67
+ client: CosmWasmClient;
68
+ contractAddress: string;
69
+ constructor(client: CosmWasmClient, contractAddress: string) {
70
+ this.client = client;
71
+ this.contractAddress = contractAddress;
72
+ this.getRoundInfo = this.getRoundInfo.bind(this);
73
+ this.getVotingTime = this.getVotingTime.bind(this);
74
+ this.getPeriod = this.getPeriod.bind(this);
75
+ this.getNumSignUp = this.getNumSignUp.bind(this);
76
+ this.getMsgChainLength = this.getMsgChainLength.bind(this);
77
+ this.getProcessedMsgCount = this.getProcessedMsgCount.bind(this);
78
+ this.getProcessedUserCount = this.getProcessedUserCount.bind(this);
79
+ this.getResult = this.getResult.bind(this);
80
+ this.getAllResult = this.getAllResult.bind(this);
81
+ this.getStateIdxInc = this.getStateIdxInc.bind(this);
82
+ this.getVoiceCreditBalance = this.getVoiceCreditBalance.bind(this);
83
+ this.isWhiteList = this.isWhiteList.bind(this);
84
+ this.whiteBalanceOf = this.whiteBalanceOf.bind(this);
85
+ this.whiteInfo = this.whiteInfo.bind(this);
86
+ this.maxWhitelistNum = this.maxWhitelistNum.bind(this);
87
+ this.voteOptionMap = this.voteOptionMap.bind(this);
88
+ this.maxVoteOptions = this.maxVoteOptions.bind(this);
89
+ this.queryTotalFeeGrant = this.queryTotalFeeGrant.bind(this);
90
+ this.queryCircuitType = this.queryCircuitType.bind(this);
91
+ this.queryCertSystem = this.queryCertSystem.bind(this);
92
+ this.queryOracleWhitelistConfig = this.queryOracleWhitelistConfig.bind(this);
93
+ }
94
+ getRoundInfo = async (): Promise<RoundInfo> => {
95
+ return this.client.queryContractSmart(this.contractAddress, {
96
+ get_round_info: {}
97
+ });
98
+ };
99
+ getVotingTime = async (): Promise<VotingTime> => {
100
+ return this.client.queryContractSmart(this.contractAddress, {
101
+ get_voting_time: {}
102
+ });
103
+ };
104
+ getPeriod = async (): Promise<Period> => {
105
+ return this.client.queryContractSmart(this.contractAddress, {
106
+ get_period: {}
107
+ });
108
+ };
109
+ getNumSignUp = async (): Promise<Uint256> => {
110
+ return this.client.queryContractSmart(this.contractAddress, {
111
+ get_num_sign_up: {}
112
+ });
113
+ };
114
+ getMsgChainLength = async (): Promise<Uint256> => {
115
+ return this.client.queryContractSmart(this.contractAddress, {
116
+ get_msg_chain_length: {}
117
+ });
118
+ };
119
+ getProcessedMsgCount = async (): Promise<Uint256> => {
120
+ return this.client.queryContractSmart(this.contractAddress, {
121
+ get_processed_msg_count: {}
122
+ });
123
+ };
124
+ getProcessedUserCount = async (): Promise<Uint256> => {
125
+ return this.client.queryContractSmart(this.contractAddress, {
126
+ get_processed_user_count: {}
127
+ });
128
+ };
129
+ getResult = async ({
130
+ index
131
+ }: {
132
+ index: Uint256;
133
+ }): Promise<Uint256> => {
134
+ return this.client.queryContractSmart(this.contractAddress, {
135
+ get_result: {
136
+ index
137
+ }
138
+ });
139
+ };
140
+ getAllResult = async (): Promise<Uint256> => {
141
+ return this.client.queryContractSmart(this.contractAddress, {
142
+ get_all_result: {}
143
+ });
144
+ };
145
+ getStateIdxInc = async ({
146
+ address
147
+ }: {
148
+ address: Addr;
149
+ }): Promise<Uint256> => {
150
+ return this.client.queryContractSmart(this.contractAddress, {
151
+ get_state_idx_inc: {
152
+ address
153
+ }
154
+ });
155
+ };
156
+ getVoiceCreditBalance = async ({
157
+ index
158
+ }: {
159
+ index: Uint256;
160
+ }): Promise<Uint256> => {
161
+ return this.client.queryContractSmart(this.contractAddress, {
162
+ get_voice_credit_balance: {
163
+ index
164
+ }
165
+ });
166
+ };
167
+ isWhiteList = async ({
168
+ amount,
169
+ certificate,
170
+ pubkey
171
+ }: {
172
+ amount: Uint256;
173
+ certificate: string;
174
+ pubkey: PubKey;
175
+ }): Promise<Boolean> => {
176
+ return this.client.queryContractSmart(this.contractAddress, {
177
+ is_white_list: {
178
+ amount,
179
+ certificate,
180
+ pubkey
181
+ }
182
+ });
183
+ };
184
+ whiteBalanceOf = async ({
185
+ amount,
186
+ certificate,
187
+ pubkey
188
+ }: {
189
+ amount: Uint256;
190
+ certificate: string;
191
+ pubkey: PubKey;
192
+ }): Promise<Uint256> => {
193
+ return this.client.queryContractSmart(this.contractAddress, {
194
+ white_balance_of: {
195
+ amount,
196
+ certificate,
197
+ pubkey
198
+ }
199
+ });
200
+ };
201
+ whiteInfo = async ({
202
+ pubkey
203
+ }: {
204
+ pubkey: PubKey;
205
+ }): Promise<WhitelistConfig> => {
206
+ return this.client.queryContractSmart(this.contractAddress, {
207
+ white_info: {
208
+ pubkey
209
+ }
210
+ });
211
+ };
212
+ maxWhitelistNum = async (): Promise<Uint128> => {
213
+ return this.client.queryContractSmart(this.contractAddress, {
214
+ max_whitelist_num: {}
215
+ });
216
+ };
217
+ voteOptionMap = async (): Promise<ArrayOfString> => {
218
+ return this.client.queryContractSmart(this.contractAddress, {
219
+ vote_option_map: {}
220
+ });
221
+ };
222
+ maxVoteOptions = async (): Promise<Uint256> => {
223
+ return this.client.queryContractSmart(this.contractAddress, {
224
+ max_vote_options: {}
225
+ });
226
+ };
227
+ queryTotalFeeGrant = async (): Promise<Uint128> => {
228
+ return this.client.queryContractSmart(this.contractAddress, {
229
+ query_total_fee_grant: {}
230
+ });
231
+ };
232
+ queryCircuitType = async (): Promise<Uint256> => {
233
+ return this.client.queryContractSmart(this.contractAddress, {
234
+ query_circuit_type: {}
235
+ });
236
+ };
237
+ queryCertSystem = async (): Promise<Uint256> => {
238
+ return this.client.queryContractSmart(this.contractAddress, {
239
+ query_cert_system: {}
240
+ });
241
+ };
242
+ queryOracleWhitelistConfig = async (): Promise<OracleWhitelistConfig> => {
243
+ return this.client.queryContractSmart(this.contractAddress, {
244
+ query_oracle_whitelist_config: {}
245
+ });
246
+ };
247
+ }
248
+ export interface ApiMaciInterface extends ApiMaciReadOnlyInterface {
249
+ contractAddress: string;
250
+ sender: string;
251
+ setRoundInfo: ({
252
+ roundInfo
253
+ }: {
254
+ roundInfo: RoundInfo;
255
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
256
+ setVoteOptionsMap: ({
257
+ voteOptionMap
258
+ }: {
259
+ voteOptionMap: string[];
260
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
261
+ signUp: ({
262
+ amount,
263
+ certificate,
264
+ pubkey
265
+ }: {
266
+ amount: Uint256;
267
+ certificate: string;
268
+ pubkey: PubKey;
269
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
270
+ startProcessPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
271
+ publishMessage: ({
272
+ encPubKey,
273
+ message
274
+ }: {
275
+ encPubKey: PubKey;
276
+ message: MessageData;
277
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
278
+ processMessage: ({
279
+ groth16Proof,
280
+ newStateCommitment,
281
+ plonkProof
282
+ }: {
283
+ groth16Proof?: Groth16ProofType;
284
+ newStateCommitment: Uint256;
285
+ plonkProof?: PlonkProofType;
286
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
287
+ stopProcessingPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
288
+ processTally: ({
289
+ groth16Proof,
290
+ newTallyCommitment,
291
+ plonkProof
292
+ }: {
293
+ groth16Proof?: Groth16ProofType;
294
+ newTallyCommitment: Uint256;
295
+ plonkProof?: PlonkProofType;
296
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
297
+ stopTallyingPeriod: ({
298
+ results,
299
+ salt
300
+ }: {
301
+ results: Uint256[];
302
+ salt: Uint256;
303
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
304
+ bond: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
305
+ withdraw: ({
306
+ amount
307
+ }: {
308
+ amount?: Uint128;
309
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
310
+ }
311
+ export class ApiMaciClient extends ApiMaciQueryClient implements ApiMaciInterface {
312
+ client: SigningCosmWasmClient;
313
+ sender: string;
314
+ contractAddress: string;
315
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
316
+ super(client, contractAddress);
317
+ this.client = client;
318
+ this.sender = sender;
319
+ this.contractAddress = contractAddress;
320
+ this.setRoundInfo = this.setRoundInfo.bind(this);
321
+ this.setVoteOptionsMap = this.setVoteOptionsMap.bind(this);
322
+ this.signUp = this.signUp.bind(this);
323
+ this.startProcessPeriod = this.startProcessPeriod.bind(this);
324
+ this.publishMessage = this.publishMessage.bind(this);
325
+ this.processMessage = this.processMessage.bind(this);
326
+ this.stopProcessingPeriod = this.stopProcessingPeriod.bind(this);
327
+ this.processTally = this.processTally.bind(this);
328
+ this.stopTallyingPeriod = this.stopTallyingPeriod.bind(this);
329
+ this.bond = this.bond.bind(this);
330
+ this.withdraw = this.withdraw.bind(this);
331
+ }
332
+ setRoundInfo = async ({
333
+ roundInfo
334
+ }: {
335
+ roundInfo: RoundInfo;
336
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
337
+ return await this.client.execute(this.sender, this.contractAddress, {
338
+ set_round_info: {
339
+ round_info: roundInfo
340
+ }
341
+ }, fee, memo, _funds);
342
+ };
343
+ setVoteOptionsMap = async ({
344
+ voteOptionMap
345
+ }: {
346
+ voteOptionMap: string[];
347
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
348
+ return await this.client.execute(this.sender, this.contractAddress, {
349
+ set_vote_options_map: {
350
+ vote_option_map: voteOptionMap
351
+ }
352
+ }, fee, memo, _funds);
353
+ };
354
+ signUp = async ({
355
+ amount,
356
+ certificate,
357
+ pubkey
358
+ }: {
359
+ amount: Uint256;
360
+ certificate: string;
361
+ pubkey: PubKey;
362
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
363
+ return await this.client.execute(this.sender, this.contractAddress, {
364
+ sign_up: {
365
+ amount,
366
+ certificate,
367
+ pubkey
368
+ }
369
+ }, fee, memo, _funds);
370
+ };
371
+ startProcessPeriod = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
372
+ return await this.client.execute(this.sender, this.contractAddress, {
373
+ start_process_period: {}
374
+ }, fee, memo, _funds);
375
+ };
376
+ publishMessage = async ({
377
+ encPubKey,
378
+ message
379
+ }: {
380
+ encPubKey: PubKey;
381
+ message: MessageData;
382
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
383
+ return await this.client.execute(this.sender, this.contractAddress, {
384
+ publish_message: {
385
+ enc_pub_key: encPubKey,
386
+ message
387
+ }
388
+ }, fee, memo, _funds);
389
+ };
390
+ processMessage = async ({
391
+ groth16Proof,
392
+ newStateCommitment,
393
+ plonkProof
394
+ }: {
395
+ groth16Proof?: Groth16ProofType;
396
+ newStateCommitment: Uint256;
397
+ plonkProof?: PlonkProofType;
398
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
399
+ return await this.client.execute(this.sender, this.contractAddress, {
400
+ process_message: {
401
+ groth16_proof: groth16Proof,
402
+ new_state_commitment: newStateCommitment,
403
+ plonk_proof: plonkProof
404
+ }
405
+ }, fee, memo, _funds);
406
+ };
407
+ stopProcessingPeriod = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
408
+ return await this.client.execute(this.sender, this.contractAddress, {
409
+ stop_processing_period: {}
410
+ }, fee, memo, _funds);
411
+ };
412
+ processTally = async ({
413
+ groth16Proof,
414
+ newTallyCommitment,
415
+ plonkProof
416
+ }: {
417
+ groth16Proof?: Groth16ProofType;
418
+ newTallyCommitment: Uint256;
419
+ plonkProof?: PlonkProofType;
420
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
421
+ return await this.client.execute(this.sender, this.contractAddress, {
422
+ process_tally: {
423
+ groth16_proof: groth16Proof,
424
+ new_tally_commitment: newTallyCommitment,
425
+ plonk_proof: plonkProof
426
+ }
427
+ }, fee, memo, _funds);
428
+ };
429
+ stopTallyingPeriod = async ({
430
+ results,
431
+ salt
432
+ }: {
433
+ results: Uint256[];
434
+ salt: Uint256;
435
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
436
+ return await this.client.execute(this.sender, this.contractAddress, {
437
+ stop_tallying_period: {
438
+ results,
439
+ salt
440
+ }
441
+ }, fee, memo, _funds);
442
+ };
443
+ bond = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
444
+ return await this.client.execute(this.sender, this.contractAddress, {
445
+ bond: {}
446
+ }, fee, memo, _funds);
447
+ };
448
+ withdraw = async ({
449
+ amount
450
+ }: {
451
+ amount?: Uint128;
452
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
453
+ return await this.client.execute(this.sender, this.contractAddress, {
454
+ withdraw: {
455
+ amount
456
+ }
457
+ }, fee, memo, _funds);
458
+ };
459
+ }