@dorafactory/maci-sdk 0.0.7 → 0.0.9

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 (50) hide show
  1. package/README.md +27 -7
  2. package/dist/index.js +751 -187
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +748 -187
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/libs/circom/tree.d.ts +20 -20
  7. package/dist/libs/contract/ts/AMaci.client.d.ts +1 -1
  8. package/dist/libs/contract/ts/Maci.client.d.ts +21 -47
  9. package/dist/libs/contract/ts/Maci.types.d.ts +40 -31
  10. package/dist/libs/contract/ts/OracleMaci.client.d.ts +52 -52
  11. package/dist/libs/contract/ts/OracleMaci.types.d.ts +17 -7
  12. package/dist/libs/contract/ts/Registry.client.d.ts +2 -2
  13. package/dist/libs/contract/types.d.ts +2 -2
  14. package/dist/libs/errors/types.d.ts +1 -0
  15. package/dist/libs/http/http.d.ts +1 -1
  16. package/dist/libs/index.d.ts +3 -0
  17. package/dist/libs/indexer/indexer.d.ts +11 -2
  18. package/dist/libs/maci/index.d.ts +1 -0
  19. package/dist/libs/maci/maci.d.ts +64 -5
  20. package/dist/libs/oracle-certificate/oracle-certificate.d.ts +1 -21
  21. package/dist/libs/oracle-certificate/types.d.ts +12 -0
  22. package/dist/libs/query/event.d.ts +7 -0
  23. package/dist/libs/query/index.d.ts +1 -0
  24. package/dist/maci.d.ts +7 -5
  25. package/dist/types/index.d.ts +22 -0
  26. package/package.json +1 -1
  27. package/src/libs/const.ts +3 -2
  28. package/src/libs/contract/contract.ts +2 -6
  29. package/src/libs/contract/ts/AMaci.client.ts +868 -874
  30. package/src/libs/contract/ts/AMaci.types.ts +216 -216
  31. package/src/libs/contract/ts/Maci.client.ts +748 -888
  32. package/src/libs/contract/ts/Maci.types.ts +229 -224
  33. package/src/libs/contract/ts/OracleMaci.client.ts +623 -348
  34. package/src/libs/contract/ts/OracleMaci.types.ts +191 -138
  35. package/src/libs/contract/ts/Registry.client.ts +438 -446
  36. package/src/libs/contract/ts/Registry.types.ts +97 -97
  37. package/src/libs/contract/types.ts +6 -2
  38. package/src/libs/contract/utils.ts +9 -0
  39. package/src/libs/errors/types.ts +1 -0
  40. package/src/libs/http/http.ts +3 -7
  41. package/src/libs/index.ts +3 -0
  42. package/src/libs/indexer/indexer.ts +18 -0
  43. package/src/libs/maci/index.ts +1 -0
  44. package/src/libs/maci/maci.ts +302 -10
  45. package/src/libs/oracle-certificate/oracle-certificate.ts +19 -73
  46. package/src/libs/oracle-certificate/types.ts +15 -1
  47. package/src/libs/query/event.ts +78 -0
  48. package/src/libs/query/index.ts +1 -0
  49. package/src/maci.ts +27 -5
  50. package/src/types/index.ts +28 -0
@@ -5,462 +5,454 @@
5
5
  */
6
6
 
7
7
  import {
8
- CosmWasmClient,
9
- SigningCosmWasmClient,
10
- ExecuteResult,
8
+ CosmWasmClient,
9
+ SigningCosmWasmClient,
10
+ ExecuteResult,
11
11
  } from '@cosmjs/cosmwasm-stargate';
12
12
  import { Coin, StdFee } from '@cosmjs/amino';
13
13
  import {
14
- Addr,
15
- InstantiateMsg,
16
- ExecuteMsg,
17
- Uint256,
18
- Timestamp,
19
- Uint64,
20
- PubKey,
21
- RoundInfo,
22
- VotingTime,
23
- Whitelist,
24
- WhitelistConfig,
25
- ValidatorSet,
26
- QueryMsg,
27
- AdminResponse,
28
- String,
29
- Boolean,
14
+ Addr,
15
+ InstantiateMsg,
16
+ ExecuteMsg,
17
+ Uint256,
18
+ Timestamp,
19
+ Uint64,
20
+ PubKey,
21
+ RoundInfo,
22
+ VotingTime,
23
+ Whitelist,
24
+ WhitelistConfig,
25
+ ValidatorSet,
26
+ QueryMsg,
27
+ AdminResponse,
28
+ String,
29
+ Boolean,
30
30
  } from './Registry.types';
31
31
  export interface RegistryReadOnlyInterface {
32
- contractAddress: string;
33
- admin: () => Promise<AdminResponse>;
34
- operator: () => Promise<Addr>;
35
- isMaciOperator: ({ address }: { address: Addr }) => Promise<Boolean>;
36
- isValidator: ({ address }: { address: Addr }) => Promise<Boolean>;
37
- getValidators: () => Promise<ValidatorSet>;
38
- getValidatorOperator: ({ address }: { address: Addr }) => Promise<Addr>;
39
- getMaciOperatorPubkey: ({ address }: { address: Addr }) => Promise<PubKey>;
40
- getMaciOperatorIdentity: ({
41
- address,
42
- }: {
43
- address: Addr;
44
- }) => Promise<String>;
32
+ contractAddress: string;
33
+ admin: () => Promise<AdminResponse>;
34
+ operator: () => Promise<Addr>;
35
+ isMaciOperator: ({ address }: { address: Addr }) => Promise<Boolean>;
36
+ isValidator: ({ address }: { address: Addr }) => Promise<Boolean>;
37
+ getValidators: () => Promise<ValidatorSet>;
38
+ getValidatorOperator: ({ address }: { address: Addr }) => Promise<Addr>;
39
+ getMaciOperatorPubkey: ({ address }: { address: Addr }) => Promise<PubKey>;
40
+ getMaciOperatorIdentity: ({ address }: { address: Addr }) => Promise<String>;
45
41
  }
46
42
  export class RegistryQueryClient implements RegistryReadOnlyInterface {
47
- client: CosmWasmClient;
48
- contractAddress: string;
49
- constructor(client: CosmWasmClient, contractAddress: string) {
50
- this.client = client;
51
- this.contractAddress = contractAddress;
52
- this.admin = this.admin.bind(this);
53
- this.operator = this.operator.bind(this);
54
- this.isMaciOperator = this.isMaciOperator.bind(this);
55
- this.isValidator = this.isValidator.bind(this);
56
- this.getValidators = this.getValidators.bind(this);
57
- this.getValidatorOperator = this.getValidatorOperator.bind(this);
58
- this.getMaciOperatorPubkey = this.getMaciOperatorPubkey.bind(this);
59
- this.getMaciOperatorIdentity = this.getMaciOperatorIdentity.bind(this);
60
- }
61
- admin = async (): Promise<AdminResponse> => {
62
- return this.client.queryContractSmart(this.contractAddress, {
63
- admin: {},
64
- });
65
- };
66
- operator = async (): Promise<Addr> => {
67
- return this.client.queryContractSmart(this.contractAddress, {
68
- operator: {},
69
- });
70
- };
71
- isMaciOperator = async ({
72
- address,
73
- }: {
74
- address: Addr;
75
- }): Promise<Boolean> => {
76
- return this.client.queryContractSmart(this.contractAddress, {
77
- is_maci_operator: {
78
- address,
79
- },
80
- });
81
- };
82
- isValidator = async ({ address }: { address: Addr }): Promise<Boolean> => {
83
- return this.client.queryContractSmart(this.contractAddress, {
84
- is_validator: {
85
- address,
86
- },
87
- });
88
- };
89
- getValidators = async (): Promise<ValidatorSet> => {
90
- return this.client.queryContractSmart(this.contractAddress, {
91
- get_validators: {},
92
- });
93
- };
94
- getValidatorOperator = async ({
95
- address,
96
- }: {
97
- address: Addr;
98
- }): Promise<Addr> => {
99
- return this.client.queryContractSmart(this.contractAddress, {
100
- get_validator_operator: {
101
- address,
102
- },
103
- });
104
- };
105
- getMaciOperatorPubkey = async ({
106
- address,
107
- }: {
108
- address: Addr;
109
- }): Promise<PubKey> => {
110
- return this.client.queryContractSmart(this.contractAddress, {
111
- get_maci_operator_pubkey: {
112
- address,
113
- },
114
- });
115
- };
116
- getMaciOperatorIdentity = async ({
117
- address,
118
- }: {
119
- address: Addr;
120
- }): Promise<String> => {
121
- return this.client.queryContractSmart(this.contractAddress, {
122
- get_maci_operator_identity: {
123
- address,
124
- },
125
- });
126
- };
43
+ client: CosmWasmClient;
44
+ contractAddress: string;
45
+ constructor(client: CosmWasmClient, contractAddress: string) {
46
+ this.client = client;
47
+ this.contractAddress = contractAddress;
48
+ this.admin = this.admin.bind(this);
49
+ this.operator = this.operator.bind(this);
50
+ this.isMaciOperator = this.isMaciOperator.bind(this);
51
+ this.isValidator = this.isValidator.bind(this);
52
+ this.getValidators = this.getValidators.bind(this);
53
+ this.getValidatorOperator = this.getValidatorOperator.bind(this);
54
+ this.getMaciOperatorPubkey = this.getMaciOperatorPubkey.bind(this);
55
+ this.getMaciOperatorIdentity = this.getMaciOperatorIdentity.bind(this);
56
+ }
57
+ admin = async (): Promise<AdminResponse> => {
58
+ return this.client.queryContractSmart(this.contractAddress, {
59
+ admin: {},
60
+ });
61
+ };
62
+ operator = async (): Promise<Addr> => {
63
+ return this.client.queryContractSmart(this.contractAddress, {
64
+ operator: {},
65
+ });
66
+ };
67
+ isMaciOperator = async ({ address }: { address: Addr }): Promise<Boolean> => {
68
+ return this.client.queryContractSmart(this.contractAddress, {
69
+ is_maci_operator: {
70
+ address,
71
+ },
72
+ });
73
+ };
74
+ isValidator = async ({ address }: { address: Addr }): Promise<Boolean> => {
75
+ return this.client.queryContractSmart(this.contractAddress, {
76
+ is_validator: {
77
+ address,
78
+ },
79
+ });
80
+ };
81
+ getValidators = async (): Promise<ValidatorSet> => {
82
+ return this.client.queryContractSmart(this.contractAddress, {
83
+ get_validators: {},
84
+ });
85
+ };
86
+ getValidatorOperator = async ({
87
+ address,
88
+ }: {
89
+ address: Addr;
90
+ }): Promise<Addr> => {
91
+ return this.client.queryContractSmart(this.contractAddress, {
92
+ get_validator_operator: {
93
+ address,
94
+ },
95
+ });
96
+ };
97
+ getMaciOperatorPubkey = async ({
98
+ address,
99
+ }: {
100
+ address: Addr;
101
+ }): Promise<PubKey> => {
102
+ return this.client.queryContractSmart(this.contractAddress, {
103
+ get_maci_operator_pubkey: {
104
+ address,
105
+ },
106
+ });
107
+ };
108
+ getMaciOperatorIdentity = async ({
109
+ address,
110
+ }: {
111
+ address: Addr;
112
+ }): Promise<String> => {
113
+ return this.client.queryContractSmart(this.contractAddress, {
114
+ get_maci_operator_identity: {
115
+ address,
116
+ },
117
+ });
118
+ };
127
119
  }
128
120
  export interface RegistryInterface extends RegistryReadOnlyInterface {
129
- contractAddress: string;
130
- sender: string;
131
- setMaciOperator: (
132
- {
133
- operator,
134
- }: {
135
- operator: Addr;
136
- },
137
- fee?: number | StdFee | 'auto',
138
- memo?: string,
139
- _funds?: Coin[]
140
- ) => Promise<ExecuteResult>;
141
- setMaciOperatorPubkey: (
142
- {
143
- pubkey,
144
- }: {
145
- pubkey: PubKey;
146
- },
147
- fee?: number | StdFee | 'auto',
148
- memo?: string,
149
- _funds?: Coin[]
150
- ) => Promise<ExecuteResult>;
151
- setMaciOperatorIdentity: (
152
- {
153
- identity,
154
- }: {
155
- identity: string;
156
- },
157
- fee?: number | StdFee | 'auto',
158
- memo?: string,
159
- _funds?: Coin[]
160
- ) => Promise<ExecuteResult>;
161
- createRound: (
162
- {
163
- certificationSystem,
164
- circuitType,
165
- maxOption,
166
- maxVoter,
167
- operator,
168
- preDeactivateRoot,
169
- roundInfo,
170
- voiceCreditAmount,
171
- votingTime,
172
- whitelist,
173
- }: {
174
- certificationSystem: Uint256;
175
- circuitType: Uint256;
176
- maxOption: Uint256;
177
- maxVoter: Uint256;
178
- operator: Addr;
179
- preDeactivateRoot: Uint256;
180
- roundInfo: RoundInfo;
181
- voiceCreditAmount: Uint256;
182
- votingTime: VotingTime;
183
- whitelist?: Whitelist;
184
- },
185
- fee?: number | StdFee | 'auto',
186
- memo?: string,
187
- _funds?: Coin[]
188
- ) => Promise<ExecuteResult>;
189
- setValidators: (
190
- {
191
- addresses,
192
- }: {
193
- addresses: ValidatorSet;
194
- },
195
- fee?: number | StdFee | 'auto',
196
- memo?: string,
197
- _funds?: Coin[]
198
- ) => Promise<ExecuteResult>;
199
- removeValidator: (
200
- {
201
- address,
202
- }: {
203
- address: Addr;
204
- },
205
- fee?: number | StdFee | 'auto',
206
- memo?: string,
207
- _funds?: Coin[]
208
- ) => Promise<ExecuteResult>;
209
- updateAmaciCodeId: (
210
- {
211
- amaciCodeId,
212
- }: {
213
- amaciCodeId: number;
214
- },
215
- fee?: number | StdFee | 'auto',
216
- memo?: string,
217
- _funds?: Coin[]
218
- ) => Promise<ExecuteResult>;
219
- changeOperator: (
220
- {
221
- address,
222
- }: {
223
- address: Addr;
224
- },
225
- fee?: number | StdFee | 'auto',
226
- memo?: string,
227
- _funds?: Coin[]
228
- ) => Promise<ExecuteResult>;
121
+ contractAddress: string;
122
+ sender: string;
123
+ setMaciOperator: (
124
+ {
125
+ operator,
126
+ }: {
127
+ operator: Addr;
128
+ },
129
+ fee?: number | StdFee | 'auto',
130
+ memo?: string,
131
+ _funds?: Coin[]
132
+ ) => Promise<ExecuteResult>;
133
+ setMaciOperatorPubkey: (
134
+ {
135
+ pubkey,
136
+ }: {
137
+ pubkey: PubKey;
138
+ },
139
+ fee?: number | StdFee | 'auto',
140
+ memo?: string,
141
+ _funds?: Coin[]
142
+ ) => Promise<ExecuteResult>;
143
+ setMaciOperatorIdentity: (
144
+ {
145
+ identity,
146
+ }: {
147
+ identity: string;
148
+ },
149
+ fee?: number | StdFee | 'auto',
150
+ memo?: string,
151
+ _funds?: Coin[]
152
+ ) => Promise<ExecuteResult>;
153
+ createRound: (
154
+ {
155
+ certificationSystem,
156
+ circuitType,
157
+ maxOption,
158
+ maxVoter,
159
+ operator,
160
+ preDeactivateRoot,
161
+ roundInfo,
162
+ voiceCreditAmount,
163
+ votingTime,
164
+ whitelist,
165
+ }: {
166
+ certificationSystem: Uint256;
167
+ circuitType: Uint256;
168
+ maxOption: Uint256;
169
+ maxVoter: Uint256;
170
+ operator: Addr;
171
+ preDeactivateRoot: Uint256;
172
+ roundInfo: RoundInfo;
173
+ voiceCreditAmount: Uint256;
174
+ votingTime: VotingTime;
175
+ whitelist?: Whitelist;
176
+ },
177
+ fee?: number | StdFee | 'auto',
178
+ memo?: string,
179
+ _funds?: Coin[]
180
+ ) => Promise<ExecuteResult>;
181
+ setValidators: (
182
+ {
183
+ addresses,
184
+ }: {
185
+ addresses: ValidatorSet;
186
+ },
187
+ fee?: number | StdFee | 'auto',
188
+ memo?: string,
189
+ _funds?: Coin[]
190
+ ) => Promise<ExecuteResult>;
191
+ removeValidator: (
192
+ {
193
+ address,
194
+ }: {
195
+ address: Addr;
196
+ },
197
+ fee?: number | StdFee | 'auto',
198
+ memo?: string,
199
+ _funds?: Coin[]
200
+ ) => Promise<ExecuteResult>;
201
+ updateAmaciCodeId: (
202
+ {
203
+ amaciCodeId,
204
+ }: {
205
+ amaciCodeId: number;
206
+ },
207
+ fee?: number | StdFee | 'auto',
208
+ memo?: string,
209
+ _funds?: Coin[]
210
+ ) => Promise<ExecuteResult>;
211
+ changeOperator: (
212
+ {
213
+ address,
214
+ }: {
215
+ address: Addr;
216
+ },
217
+ fee?: number | StdFee | 'auto',
218
+ memo?: string,
219
+ _funds?: Coin[]
220
+ ) => Promise<ExecuteResult>;
229
221
  }
230
222
  export class RegistryClient
231
- extends RegistryQueryClient
232
- implements RegistryInterface
223
+ extends RegistryQueryClient
224
+ implements RegistryInterface
233
225
  {
234
- client: SigningCosmWasmClient;
235
- sender: string;
236
- contractAddress: string;
237
- constructor(
238
- client: SigningCosmWasmClient,
239
- sender: string,
240
- contractAddress: string
241
- ) {
242
- super(client, contractAddress);
243
- this.client = client;
244
- this.sender = sender;
245
- this.contractAddress = contractAddress;
246
- this.setMaciOperator = this.setMaciOperator.bind(this);
247
- this.setMaciOperatorPubkey = this.setMaciOperatorPubkey.bind(this);
248
- this.setMaciOperatorIdentity = this.setMaciOperatorIdentity.bind(this);
249
- this.createRound = this.createRound.bind(this);
250
- this.setValidators = this.setValidators.bind(this);
251
- this.removeValidator = this.removeValidator.bind(this);
252
- this.updateAmaciCodeId = this.updateAmaciCodeId.bind(this);
253
- this.changeOperator = this.changeOperator.bind(this);
254
- }
255
- setMaciOperator = async (
256
- {
257
- operator,
258
- }: {
259
- operator: Addr;
260
- },
261
- fee: number | StdFee | 'auto' = 'auto',
262
- memo?: string,
263
- _funds?: Coin[]
264
- ): Promise<ExecuteResult> => {
265
- return await this.client.execute(
266
- this.sender,
267
- this.contractAddress,
268
- {
269
- set_maci_operator: {
270
- operator,
271
- },
272
- },
273
- fee,
274
- memo,
275
- _funds
276
- );
277
- };
278
- setMaciOperatorPubkey = async (
279
- {
280
- pubkey,
281
- }: {
282
- pubkey: PubKey;
283
- },
284
- fee: number | StdFee | 'auto' = 'auto',
285
- memo?: string,
286
- _funds?: Coin[]
287
- ): Promise<ExecuteResult> => {
288
- return await this.client.execute(
289
- this.sender,
290
- this.contractAddress,
291
- {
292
- set_maci_operator_pubkey: {
293
- pubkey,
294
- },
295
- },
296
- fee,
297
- memo,
298
- _funds
299
- );
300
- };
301
- setMaciOperatorIdentity = async (
302
- {
303
- identity,
304
- }: {
305
- identity: string;
306
- },
307
- fee: number | StdFee | 'auto' = 'auto',
308
- memo?: string,
309
- _funds?: Coin[]
310
- ): Promise<ExecuteResult> => {
311
- return await this.client.execute(
312
- this.sender,
313
- this.contractAddress,
314
- {
315
- set_maci_operator_identity: {
316
- identity,
317
- },
318
- },
319
- fee,
320
- memo,
321
- _funds
322
- );
323
- };
324
- createRound = async (
325
- {
326
- certificationSystem,
327
- circuitType,
328
- maxOption,
329
- maxVoter,
330
- operator,
331
- preDeactivateRoot,
332
- roundInfo,
333
- voiceCreditAmount,
334
- votingTime,
335
- whitelist,
336
- }: {
337
- certificationSystem: Uint256;
338
- circuitType: Uint256;
339
- maxOption: Uint256;
340
- maxVoter: Uint256;
341
- operator: Addr;
342
- preDeactivateRoot: Uint256;
343
- roundInfo: RoundInfo;
344
- voiceCreditAmount: Uint256;
345
- votingTime: VotingTime;
346
- whitelist?: Whitelist;
347
- },
348
- fee: number | StdFee | 'auto' = 'auto',
349
- memo?: string,
350
- _funds?: Coin[]
351
- ): Promise<ExecuteResult> => {
352
- return await this.client.execute(
353
- this.sender,
354
- this.contractAddress,
355
- {
356
- create_round: {
357
- certification_system: certificationSystem,
358
- circuit_type: circuitType,
359
- max_option: maxOption,
360
- max_voter: maxVoter,
361
- operator,
362
- pre_deactivate_root: preDeactivateRoot,
363
- round_info: roundInfo,
364
- voice_credit_amount: voiceCreditAmount,
365
- voting_time: votingTime,
366
- whitelist,
367
- },
368
- },
369
- fee,
370
- memo,
371
- _funds
372
- );
373
- };
374
- setValidators = async (
375
- {
376
- addresses,
377
- }: {
378
- addresses: ValidatorSet;
379
- },
380
- fee: number | StdFee | 'auto' = 'auto',
381
- memo?: string,
382
- _funds?: Coin[]
383
- ): Promise<ExecuteResult> => {
384
- return await this.client.execute(
385
- this.sender,
386
- this.contractAddress,
387
- {
388
- set_validators: {
389
- addresses,
390
- },
391
- },
392
- fee,
393
- memo,
394
- _funds
395
- );
396
- };
397
- removeValidator = async (
398
- {
399
- address,
400
- }: {
401
- address: Addr;
402
- },
403
- fee: number | StdFee | 'auto' = 'auto',
404
- memo?: string,
405
- _funds?: Coin[]
406
- ): Promise<ExecuteResult> => {
407
- return await this.client.execute(
408
- this.sender,
409
- this.contractAddress,
410
- {
411
- remove_validator: {
412
- address,
413
- },
414
- },
415
- fee,
416
- memo,
417
- _funds
418
- );
419
- };
420
- updateAmaciCodeId = async (
421
- {
422
- amaciCodeId,
423
- }: {
424
- amaciCodeId: number;
425
- },
426
- fee: number | StdFee | 'auto' = 'auto',
427
- memo?: string,
428
- _funds?: Coin[]
429
- ): Promise<ExecuteResult> => {
430
- return await this.client.execute(
431
- this.sender,
432
- this.contractAddress,
433
- {
434
- update_amaci_code_id: {
435
- amaci_code_id: amaciCodeId,
436
- },
437
- },
438
- fee,
439
- memo,
440
- _funds
441
- );
442
- };
443
- changeOperator = async (
444
- {
445
- address,
446
- }: {
447
- address: Addr;
448
- },
449
- fee: number | StdFee | 'auto' = 'auto',
450
- memo?: string,
451
- _funds?: Coin[]
452
- ): Promise<ExecuteResult> => {
453
- return await this.client.execute(
454
- this.sender,
455
- this.contractAddress,
456
- {
457
- change_operator: {
458
- address,
459
- },
460
- },
461
- fee,
462
- memo,
463
- _funds
464
- );
465
- };
226
+ client: SigningCosmWasmClient;
227
+ sender: string;
228
+ contractAddress: string;
229
+ constructor(
230
+ client: SigningCosmWasmClient,
231
+ sender: string,
232
+ contractAddress: string
233
+ ) {
234
+ super(client, contractAddress);
235
+ this.client = client;
236
+ this.sender = sender;
237
+ this.contractAddress = contractAddress;
238
+ this.setMaciOperator = this.setMaciOperator.bind(this);
239
+ this.setMaciOperatorPubkey = this.setMaciOperatorPubkey.bind(this);
240
+ this.setMaciOperatorIdentity = this.setMaciOperatorIdentity.bind(this);
241
+ this.createRound = this.createRound.bind(this);
242
+ this.setValidators = this.setValidators.bind(this);
243
+ this.removeValidator = this.removeValidator.bind(this);
244
+ this.updateAmaciCodeId = this.updateAmaciCodeId.bind(this);
245
+ this.changeOperator = this.changeOperator.bind(this);
246
+ }
247
+ setMaciOperator = async (
248
+ {
249
+ operator,
250
+ }: {
251
+ operator: Addr;
252
+ },
253
+ fee: number | StdFee | 'auto' = 'auto',
254
+ memo?: string,
255
+ _funds?: Coin[]
256
+ ): Promise<ExecuteResult> => {
257
+ return await this.client.execute(
258
+ this.sender,
259
+ this.contractAddress,
260
+ {
261
+ set_maci_operator: {
262
+ operator,
263
+ },
264
+ },
265
+ fee,
266
+ memo,
267
+ _funds
268
+ );
269
+ };
270
+ setMaciOperatorPubkey = async (
271
+ {
272
+ pubkey,
273
+ }: {
274
+ pubkey: PubKey;
275
+ },
276
+ fee: number | StdFee | 'auto' = 'auto',
277
+ memo?: string,
278
+ _funds?: Coin[]
279
+ ): Promise<ExecuteResult> => {
280
+ return await this.client.execute(
281
+ this.sender,
282
+ this.contractAddress,
283
+ {
284
+ set_maci_operator_pubkey: {
285
+ pubkey,
286
+ },
287
+ },
288
+ fee,
289
+ memo,
290
+ _funds
291
+ );
292
+ };
293
+ setMaciOperatorIdentity = async (
294
+ {
295
+ identity,
296
+ }: {
297
+ identity: string;
298
+ },
299
+ fee: number | StdFee | 'auto' = 'auto',
300
+ memo?: string,
301
+ _funds?: Coin[]
302
+ ): Promise<ExecuteResult> => {
303
+ return await this.client.execute(
304
+ this.sender,
305
+ this.contractAddress,
306
+ {
307
+ set_maci_operator_identity: {
308
+ identity,
309
+ },
310
+ },
311
+ fee,
312
+ memo,
313
+ _funds
314
+ );
315
+ };
316
+ createRound = async (
317
+ {
318
+ certificationSystem,
319
+ circuitType,
320
+ maxOption,
321
+ maxVoter,
322
+ operator,
323
+ preDeactivateRoot,
324
+ roundInfo,
325
+ voiceCreditAmount,
326
+ votingTime,
327
+ whitelist,
328
+ }: {
329
+ certificationSystem: Uint256;
330
+ circuitType: Uint256;
331
+ maxOption: Uint256;
332
+ maxVoter: Uint256;
333
+ operator: Addr;
334
+ preDeactivateRoot: Uint256;
335
+ roundInfo: RoundInfo;
336
+ voiceCreditAmount: Uint256;
337
+ votingTime: VotingTime;
338
+ whitelist?: Whitelist;
339
+ },
340
+ fee: number | StdFee | 'auto' = 'auto',
341
+ memo?: string,
342
+ _funds?: Coin[]
343
+ ): Promise<ExecuteResult> => {
344
+ return await this.client.execute(
345
+ this.sender,
346
+ this.contractAddress,
347
+ {
348
+ create_round: {
349
+ certification_system: certificationSystem,
350
+ circuit_type: circuitType,
351
+ max_option: maxOption,
352
+ max_voter: maxVoter,
353
+ operator,
354
+ pre_deactivate_root: preDeactivateRoot,
355
+ round_info: roundInfo,
356
+ voice_credit_amount: voiceCreditAmount,
357
+ voting_time: votingTime,
358
+ whitelist,
359
+ },
360
+ },
361
+ fee,
362
+ memo,
363
+ _funds
364
+ );
365
+ };
366
+ setValidators = async (
367
+ {
368
+ addresses,
369
+ }: {
370
+ addresses: ValidatorSet;
371
+ },
372
+ fee: number | StdFee | 'auto' = 'auto',
373
+ memo?: string,
374
+ _funds?: Coin[]
375
+ ): Promise<ExecuteResult> => {
376
+ return await this.client.execute(
377
+ this.sender,
378
+ this.contractAddress,
379
+ {
380
+ set_validators: {
381
+ addresses,
382
+ },
383
+ },
384
+ fee,
385
+ memo,
386
+ _funds
387
+ );
388
+ };
389
+ removeValidator = async (
390
+ {
391
+ address,
392
+ }: {
393
+ address: Addr;
394
+ },
395
+ fee: number | StdFee | 'auto' = 'auto',
396
+ memo?: string,
397
+ _funds?: Coin[]
398
+ ): Promise<ExecuteResult> => {
399
+ return await this.client.execute(
400
+ this.sender,
401
+ this.contractAddress,
402
+ {
403
+ remove_validator: {
404
+ address,
405
+ },
406
+ },
407
+ fee,
408
+ memo,
409
+ _funds
410
+ );
411
+ };
412
+ updateAmaciCodeId = async (
413
+ {
414
+ amaciCodeId,
415
+ }: {
416
+ amaciCodeId: number;
417
+ },
418
+ fee: number | StdFee | 'auto' = 'auto',
419
+ memo?: string,
420
+ _funds?: Coin[]
421
+ ): Promise<ExecuteResult> => {
422
+ return await this.client.execute(
423
+ this.sender,
424
+ this.contractAddress,
425
+ {
426
+ update_amaci_code_id: {
427
+ amaci_code_id: amaciCodeId,
428
+ },
429
+ },
430
+ fee,
431
+ memo,
432
+ _funds
433
+ );
434
+ };
435
+ changeOperator = async (
436
+ {
437
+ address,
438
+ }: {
439
+ address: Addr;
440
+ },
441
+ fee: number | StdFee | 'auto' = 'auto',
442
+ memo?: string,
443
+ _funds?: Coin[]
444
+ ): Promise<ExecuteResult> => {
445
+ return await this.client.execute(
446
+ this.sender,
447
+ this.contractAddress,
448
+ {
449
+ change_operator: {
450
+ address,
451
+ },
452
+ },
453
+ fee,
454
+ memo,
455
+ _funds
456
+ );
457
+ };
466
458
  }