@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.
- package/README.md +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +4157 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4123 -0
- package/dist/index.mjs.map +1 -0
- package/dist/libs/const.d.ts +117 -0
- package/dist/libs/contract/config.d.ts +29 -0
- package/dist/libs/contract/contract.d.ts +37 -0
- package/dist/libs/contract/index.d.ts +1 -0
- package/dist/libs/contract/ts/AMaci.client.d.ts +216 -0
- package/dist/libs/contract/ts/AMaci.types.d.ts +203 -0
- package/dist/libs/contract/ts/Maci.client.d.ts +206 -0
- package/dist/libs/contract/ts/Maci.types.d.ts +217 -0
- package/dist/libs/contract/ts/OracleMaci.client.d.ts +206 -0
- package/dist/libs/contract/ts/OracleMaci.types.d.ts +253 -0
- package/dist/libs/contract/ts/Registry.client.d.ts +128 -0
- package/dist/libs/contract/ts/Registry.types.d.ts +110 -0
- package/dist/libs/contract/types.d.ts +50 -0
- package/dist/libs/contract/utils.d.ts +67 -0
- package/dist/libs/contract/vars.d.ts +65 -0
- package/dist/libs/errors/index.d.ts +28 -0
- package/dist/libs/errors/types.d.ts +14 -0
- package/dist/libs/http/http.d.ts +16 -0
- package/dist/libs/http/index.d.ts +1 -0
- package/dist/libs/index.d.ts +4 -0
- package/dist/libs/indexer/index.d.ts +1 -0
- package/dist/libs/indexer/indexer.d.ts +133 -0
- package/dist/libs/indexer/types.d.ts +7 -0
- package/dist/libs/query/account.d.ts +7 -0
- package/dist/libs/query/circuit.d.ts +8 -0
- package/dist/libs/query/index.d.ts +6 -0
- package/dist/libs/query/operator.d.ts +9 -0
- package/dist/libs/query/proof.d.ts +7 -0
- package/dist/libs/query/round.d.ts +11 -0
- package/dist/libs/query/transaction.d.ts +9 -0
- package/dist/maci.d.ts +151 -0
- package/dist/types/index.d.ts +254 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +154 -0
- package/src/index.ts +11 -0
- package/src/libs/const.ts +196 -0
- package/src/libs/contract/config.ts +117 -0
- package/src/libs/contract/contract.ts +330 -0
- package/src/libs/contract/index.ts +1 -0
- package/src/libs/contract/ts/AMaci.client.ts +893 -0
- package/src/libs/contract/ts/AMaci.types.ts +252 -0
- package/src/libs/contract/ts/Maci.client.ts +906 -0
- package/src/libs/contract/ts/Maci.types.ts +263 -0
- package/src/libs/contract/ts/OracleMaci.client.ts +561 -0
- package/src/libs/contract/ts/OracleMaci.types.ts +254 -0
- package/src/libs/contract/ts/Registry.client.ts +466 -0
- package/src/libs/contract/ts/Registry.types.ts +127 -0
- package/src/libs/contract/types.ts +57 -0
- package/src/libs/contract/utils.ts +175 -0
- package/src/libs/contract/vars.ts +420 -0
- package/src/libs/errors/index.ts +122 -0
- package/src/libs/errors/types.ts +14 -0
- package/src/libs/http/http.ts +152 -0
- package/src/libs/http/index.ts +1 -0
- package/src/libs/index.ts +4 -0
- package/src/libs/indexer/index.ts +1 -0
- package/src/libs/indexer/indexer.ts +240 -0
- package/src/libs/indexer/types.ts +8 -0
- package/src/libs/query/account.ts +39 -0
- package/src/libs/query/circuit.ts +99 -0
- package/src/libs/query/index.ts +6 -0
- package/src/libs/query/operator.ts +263 -0
- package/src/libs/query/proof.ts +76 -0
- package/src/libs/query/round.ts +533 -0
- package/src/libs/query/transaction.ts +204 -0
- package/src/maci.ts +313 -0
- package/src/types/index.ts +301 -0
- package/src/utils/index.ts +44 -0
|
@@ -0,0 +1,254 @@
|
|
|
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
|
+
export type Uint256 = string;
|
|
8
|
+
export type Addr = string;
|
|
9
|
+
export type Timestamp = Uint64;
|
|
10
|
+
export type Uint64 = string;
|
|
11
|
+
export type VotingPowerMode = "slope" | "threshold";
|
|
12
|
+
export interface InstantiateMsg {
|
|
13
|
+
certification_system: Uint256;
|
|
14
|
+
circuit_type: Uint256;
|
|
15
|
+
coordinator: PubKey;
|
|
16
|
+
feegrant_operator: Addr;
|
|
17
|
+
groth16_process_vkey?: Groth16VKeyType | null;
|
|
18
|
+
groth16_tally_vkey?: Groth16VKeyType | null;
|
|
19
|
+
max_vote_options: Uint256;
|
|
20
|
+
parameters: MaciParameters;
|
|
21
|
+
plonk_process_vkey?: PlonkVKeyType | null;
|
|
22
|
+
plonk_tally_vkey?: PlonkVKeyType | null;
|
|
23
|
+
qtr_lib: QuinaryTreeRoot;
|
|
24
|
+
round_info: RoundInfo;
|
|
25
|
+
voting_time?: VotingTime | null;
|
|
26
|
+
whitelist_backend_pubkey: string;
|
|
27
|
+
whitelist_ecosystem: string;
|
|
28
|
+
whitelist_snapshot_height: Uint256;
|
|
29
|
+
whitelist_voting_power_args: VotingPowerArgs;
|
|
30
|
+
}
|
|
31
|
+
export interface PubKey {
|
|
32
|
+
x: Uint256;
|
|
33
|
+
y: Uint256;
|
|
34
|
+
}
|
|
35
|
+
export interface Groth16VKeyType {
|
|
36
|
+
vk_alpha1: string;
|
|
37
|
+
vk_beta_2: string;
|
|
38
|
+
vk_delta_2: string;
|
|
39
|
+
vk_gamma_2: string;
|
|
40
|
+
vk_ic0: string;
|
|
41
|
+
vk_ic1: string;
|
|
42
|
+
}
|
|
43
|
+
export interface MaciParameters {
|
|
44
|
+
int_state_tree_depth: Uint256;
|
|
45
|
+
message_batch_size: Uint256;
|
|
46
|
+
state_tree_depth: Uint256;
|
|
47
|
+
vote_option_tree_depth: Uint256;
|
|
48
|
+
}
|
|
49
|
+
export interface PlonkVKeyType {
|
|
50
|
+
g2_elements: string[];
|
|
51
|
+
n: number;
|
|
52
|
+
next_step_selector_commitments: string[];
|
|
53
|
+
non_residues: string[];
|
|
54
|
+
num_inputs: number;
|
|
55
|
+
permutation_commitments: string[];
|
|
56
|
+
selector_commitments: string[];
|
|
57
|
+
}
|
|
58
|
+
export interface QuinaryTreeRoot {
|
|
59
|
+
zeros: [Uint256, Uint256, Uint256, Uint256, Uint256, Uint256, Uint256, Uint256, Uint256];
|
|
60
|
+
}
|
|
61
|
+
export interface RoundInfo {
|
|
62
|
+
description: string;
|
|
63
|
+
link: string;
|
|
64
|
+
title: string;
|
|
65
|
+
}
|
|
66
|
+
export interface VotingTime {
|
|
67
|
+
end_time?: Timestamp | null;
|
|
68
|
+
start_time?: Timestamp | null;
|
|
69
|
+
}
|
|
70
|
+
export interface VotingPowerArgs {
|
|
71
|
+
mode: VotingPowerMode;
|
|
72
|
+
slope: Uint256;
|
|
73
|
+
threshold: Uint256;
|
|
74
|
+
}
|
|
75
|
+
export type ExecuteMsg = {
|
|
76
|
+
set_params: {
|
|
77
|
+
int_state_tree_depth: Uint256;
|
|
78
|
+
message_batch_size: Uint256;
|
|
79
|
+
state_tree_depth: Uint256;
|
|
80
|
+
vote_option_tree_depth: Uint256;
|
|
81
|
+
};
|
|
82
|
+
} | {
|
|
83
|
+
set_round_info: {
|
|
84
|
+
round_info: RoundInfo;
|
|
85
|
+
};
|
|
86
|
+
} | {
|
|
87
|
+
set_vote_options_map: {
|
|
88
|
+
vote_option_map: string[];
|
|
89
|
+
};
|
|
90
|
+
} | {
|
|
91
|
+
start_voting_period: {};
|
|
92
|
+
} | {
|
|
93
|
+
sign_up: {
|
|
94
|
+
amount: Uint256;
|
|
95
|
+
certificate: string;
|
|
96
|
+
pubkey: PubKey;
|
|
97
|
+
};
|
|
98
|
+
} | {
|
|
99
|
+
start_process_period: {};
|
|
100
|
+
} | {
|
|
101
|
+
stop_voting_period: {};
|
|
102
|
+
} | {
|
|
103
|
+
publish_message: {
|
|
104
|
+
enc_pub_key: PubKey;
|
|
105
|
+
message: MessageData;
|
|
106
|
+
};
|
|
107
|
+
} | {
|
|
108
|
+
process_message: {
|
|
109
|
+
groth16_proof?: Groth16ProofType | null;
|
|
110
|
+
new_state_commitment: Uint256;
|
|
111
|
+
plonk_proof?: PlonkProofType | null;
|
|
112
|
+
};
|
|
113
|
+
} | {
|
|
114
|
+
stop_processing_period: {};
|
|
115
|
+
} | {
|
|
116
|
+
process_tally: {
|
|
117
|
+
groth16_proof?: Groth16ProofType | null;
|
|
118
|
+
new_tally_commitment: Uint256;
|
|
119
|
+
plonk_proof?: PlonkProofType | null;
|
|
120
|
+
};
|
|
121
|
+
} | {
|
|
122
|
+
stop_tallying_period: {
|
|
123
|
+
results: Uint256[];
|
|
124
|
+
salt: Uint256;
|
|
125
|
+
};
|
|
126
|
+
} | {
|
|
127
|
+
grant: {
|
|
128
|
+
base_amount: Uint128;
|
|
129
|
+
grantee: Addr;
|
|
130
|
+
};
|
|
131
|
+
} | {
|
|
132
|
+
revoke: {
|
|
133
|
+
grantee: Addr;
|
|
134
|
+
};
|
|
135
|
+
} | {
|
|
136
|
+
bond: {};
|
|
137
|
+
} | {
|
|
138
|
+
withdraw: {
|
|
139
|
+
amount?: Uint128 | null;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
export type Uint128 = string;
|
|
143
|
+
export interface MessageData {
|
|
144
|
+
data: [Uint256, Uint256, Uint256, Uint256, Uint256, Uint256, Uint256];
|
|
145
|
+
}
|
|
146
|
+
export interface Groth16ProofType {
|
|
147
|
+
a: string;
|
|
148
|
+
b: string;
|
|
149
|
+
c: string;
|
|
150
|
+
}
|
|
151
|
+
export interface PlonkProofType {
|
|
152
|
+
grand_product_at_z_omega: string;
|
|
153
|
+
grand_product_commitment: string;
|
|
154
|
+
input_values: string[];
|
|
155
|
+
linearization_polynomial_at_z: string;
|
|
156
|
+
n: number;
|
|
157
|
+
num_inputs: number;
|
|
158
|
+
opening_at_z_omega_proof: string;
|
|
159
|
+
opening_at_z_proof: string;
|
|
160
|
+
permutation_polynomials_at_z: string[];
|
|
161
|
+
quotient_poly_commitments: string[];
|
|
162
|
+
quotient_polynomial_at_z: string;
|
|
163
|
+
wire_commitments: string[];
|
|
164
|
+
wire_values_at_z: string[];
|
|
165
|
+
wire_values_at_z_omega: string[];
|
|
166
|
+
}
|
|
167
|
+
export type QueryMsg = {
|
|
168
|
+
get_round_info: {};
|
|
169
|
+
} | {
|
|
170
|
+
get_voting_time: {};
|
|
171
|
+
} | {
|
|
172
|
+
get_period: {};
|
|
173
|
+
} | {
|
|
174
|
+
get_num_sign_up: {};
|
|
175
|
+
} | {
|
|
176
|
+
get_msg_chain_length: {};
|
|
177
|
+
} | {
|
|
178
|
+
get_processed_msg_count: {};
|
|
179
|
+
} | {
|
|
180
|
+
get_processed_user_count: {};
|
|
181
|
+
} | {
|
|
182
|
+
get_result: {
|
|
183
|
+
index: Uint256;
|
|
184
|
+
};
|
|
185
|
+
} | {
|
|
186
|
+
get_all_result: {};
|
|
187
|
+
} | {
|
|
188
|
+
get_state_idx_inc: {
|
|
189
|
+
address: Addr;
|
|
190
|
+
};
|
|
191
|
+
} | {
|
|
192
|
+
get_voice_credit_balance: {
|
|
193
|
+
index: Uint256;
|
|
194
|
+
};
|
|
195
|
+
} | {
|
|
196
|
+
is_white_list: {
|
|
197
|
+
amount: Uint256;
|
|
198
|
+
certificate: string;
|
|
199
|
+
sender: string;
|
|
200
|
+
};
|
|
201
|
+
} | {
|
|
202
|
+
white_balance_of: {
|
|
203
|
+
amount: Uint256;
|
|
204
|
+
certificate: string;
|
|
205
|
+
sender: string;
|
|
206
|
+
};
|
|
207
|
+
} | {
|
|
208
|
+
white_info: {
|
|
209
|
+
sender: string;
|
|
210
|
+
};
|
|
211
|
+
} | {
|
|
212
|
+
grant_info: {
|
|
213
|
+
grantee: string;
|
|
214
|
+
};
|
|
215
|
+
} | {
|
|
216
|
+
max_whitelist_num: {};
|
|
217
|
+
} | {
|
|
218
|
+
vote_option_map: {};
|
|
219
|
+
} | {
|
|
220
|
+
max_vote_options: {};
|
|
221
|
+
} | {
|
|
222
|
+
query_total_fee_grant: {};
|
|
223
|
+
} | {
|
|
224
|
+
query_circuit_type: {};
|
|
225
|
+
} | {
|
|
226
|
+
query_cert_system: {};
|
|
227
|
+
} | {
|
|
228
|
+
query_oracle_whitelist_config: {};
|
|
229
|
+
};
|
|
230
|
+
export type PeriodStatus = "pending" | "voting" | "processing" | "tallying" | "ended";
|
|
231
|
+
export interface Period {
|
|
232
|
+
status: PeriodStatus;
|
|
233
|
+
}
|
|
234
|
+
export interface GrantConfig {
|
|
235
|
+
fee_amount: Uint128;
|
|
236
|
+
fee_grant: boolean;
|
|
237
|
+
}
|
|
238
|
+
export type Boolean = boolean;
|
|
239
|
+
export type Binary = string;
|
|
240
|
+
export interface OracleWhitelistConfig {
|
|
241
|
+
backend_pubkey: Binary;
|
|
242
|
+
ecosystem: string;
|
|
243
|
+
slope: Uint256;
|
|
244
|
+
snapshot_height: Uint256;
|
|
245
|
+
threshold: Uint256;
|
|
246
|
+
voting_power_mode: VotingPowerMode;
|
|
247
|
+
}
|
|
248
|
+
export type ArrayOfString = string[];
|
|
249
|
+
export interface WhitelistConfig {
|
|
250
|
+
balance: Uint256;
|
|
251
|
+
fee_amount: Uint128;
|
|
252
|
+
fee_grant: boolean;
|
|
253
|
+
is_register: boolean;
|
|
254
|
+
}
|
|
@@ -0,0 +1,466 @@
|
|
|
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
|
+
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
|
+
} from './Registry.types';
|
|
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>;
|
|
45
|
+
}
|
|
46
|
+
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
|
+
};
|
|
127
|
+
}
|
|
128
|
+
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>;
|
|
229
|
+
}
|
|
230
|
+
export class RegistryClient
|
|
231
|
+
extends RegistryQueryClient
|
|
232
|
+
implements RegistryInterface
|
|
233
|
+
{
|
|
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
|
+
};
|
|
466
|
+
}
|