@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,253 @@
|
|
|
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
|
+
export type Uint256 = string;
|
|
7
|
+
export type Addr = string;
|
|
8
|
+
export type Timestamp = Uint64;
|
|
9
|
+
export type Uint64 = string;
|
|
10
|
+
export type VotingPowerMode = "slope" | "threshold";
|
|
11
|
+
export interface InstantiateMsg {
|
|
12
|
+
certification_system: Uint256;
|
|
13
|
+
circuit_type: Uint256;
|
|
14
|
+
coordinator: PubKey;
|
|
15
|
+
feegrant_operator: Addr;
|
|
16
|
+
groth16_process_vkey?: Groth16VKeyType | null;
|
|
17
|
+
groth16_tally_vkey?: Groth16VKeyType | null;
|
|
18
|
+
max_vote_options: Uint256;
|
|
19
|
+
parameters: MaciParameters;
|
|
20
|
+
plonk_process_vkey?: PlonkVKeyType | null;
|
|
21
|
+
plonk_tally_vkey?: PlonkVKeyType | null;
|
|
22
|
+
qtr_lib: QuinaryTreeRoot;
|
|
23
|
+
round_info: RoundInfo;
|
|
24
|
+
voting_time?: VotingTime | null;
|
|
25
|
+
whitelist_backend_pubkey: string;
|
|
26
|
+
whitelist_ecosystem: string;
|
|
27
|
+
whitelist_snapshot_height: Uint256;
|
|
28
|
+
whitelist_voting_power_args: VotingPowerArgs;
|
|
29
|
+
}
|
|
30
|
+
export interface PubKey {
|
|
31
|
+
x: Uint256;
|
|
32
|
+
y: Uint256;
|
|
33
|
+
}
|
|
34
|
+
export interface Groth16VKeyType {
|
|
35
|
+
vk_alpha1: string;
|
|
36
|
+
vk_beta_2: string;
|
|
37
|
+
vk_delta_2: string;
|
|
38
|
+
vk_gamma_2: string;
|
|
39
|
+
vk_ic0: string;
|
|
40
|
+
vk_ic1: string;
|
|
41
|
+
}
|
|
42
|
+
export interface MaciParameters {
|
|
43
|
+
int_state_tree_depth: Uint256;
|
|
44
|
+
message_batch_size: Uint256;
|
|
45
|
+
state_tree_depth: Uint256;
|
|
46
|
+
vote_option_tree_depth: Uint256;
|
|
47
|
+
}
|
|
48
|
+
export interface PlonkVKeyType {
|
|
49
|
+
g2_elements: string[];
|
|
50
|
+
n: number;
|
|
51
|
+
next_step_selector_commitments: string[];
|
|
52
|
+
non_residues: string[];
|
|
53
|
+
num_inputs: number;
|
|
54
|
+
permutation_commitments: string[];
|
|
55
|
+
selector_commitments: string[];
|
|
56
|
+
}
|
|
57
|
+
export interface QuinaryTreeRoot {
|
|
58
|
+
zeros: [Uint256, Uint256, Uint256, Uint256, Uint256, Uint256, Uint256, Uint256, Uint256];
|
|
59
|
+
}
|
|
60
|
+
export interface RoundInfo {
|
|
61
|
+
description: string;
|
|
62
|
+
link: string;
|
|
63
|
+
title: string;
|
|
64
|
+
}
|
|
65
|
+
export interface VotingTime {
|
|
66
|
+
end_time?: Timestamp | null;
|
|
67
|
+
start_time?: Timestamp | null;
|
|
68
|
+
}
|
|
69
|
+
export interface VotingPowerArgs {
|
|
70
|
+
mode: VotingPowerMode;
|
|
71
|
+
slope: Uint256;
|
|
72
|
+
threshold: Uint256;
|
|
73
|
+
}
|
|
74
|
+
export type ExecuteMsg = {
|
|
75
|
+
set_params: {
|
|
76
|
+
int_state_tree_depth: Uint256;
|
|
77
|
+
message_batch_size: Uint256;
|
|
78
|
+
state_tree_depth: Uint256;
|
|
79
|
+
vote_option_tree_depth: Uint256;
|
|
80
|
+
};
|
|
81
|
+
} | {
|
|
82
|
+
set_round_info: {
|
|
83
|
+
round_info: RoundInfo;
|
|
84
|
+
};
|
|
85
|
+
} | {
|
|
86
|
+
set_vote_options_map: {
|
|
87
|
+
vote_option_map: string[];
|
|
88
|
+
};
|
|
89
|
+
} | {
|
|
90
|
+
start_voting_period: {};
|
|
91
|
+
} | {
|
|
92
|
+
sign_up: {
|
|
93
|
+
amount: Uint256;
|
|
94
|
+
certificate: string;
|
|
95
|
+
pubkey: PubKey;
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
start_process_period: {};
|
|
99
|
+
} | {
|
|
100
|
+
stop_voting_period: {};
|
|
101
|
+
} | {
|
|
102
|
+
publish_message: {
|
|
103
|
+
enc_pub_key: PubKey;
|
|
104
|
+
message: MessageData;
|
|
105
|
+
};
|
|
106
|
+
} | {
|
|
107
|
+
process_message: {
|
|
108
|
+
groth16_proof?: Groth16ProofType | null;
|
|
109
|
+
new_state_commitment: Uint256;
|
|
110
|
+
plonk_proof?: PlonkProofType | null;
|
|
111
|
+
};
|
|
112
|
+
} | {
|
|
113
|
+
stop_processing_period: {};
|
|
114
|
+
} | {
|
|
115
|
+
process_tally: {
|
|
116
|
+
groth16_proof?: Groth16ProofType | null;
|
|
117
|
+
new_tally_commitment: Uint256;
|
|
118
|
+
plonk_proof?: PlonkProofType | null;
|
|
119
|
+
};
|
|
120
|
+
} | {
|
|
121
|
+
stop_tallying_period: {
|
|
122
|
+
results: Uint256[];
|
|
123
|
+
salt: Uint256;
|
|
124
|
+
};
|
|
125
|
+
} | {
|
|
126
|
+
grant: {
|
|
127
|
+
base_amount: Uint128;
|
|
128
|
+
grantee: Addr;
|
|
129
|
+
};
|
|
130
|
+
} | {
|
|
131
|
+
revoke: {
|
|
132
|
+
grantee: Addr;
|
|
133
|
+
};
|
|
134
|
+
} | {
|
|
135
|
+
bond: {};
|
|
136
|
+
} | {
|
|
137
|
+
withdraw: {
|
|
138
|
+
amount?: Uint128 | null;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export type Uint128 = string;
|
|
142
|
+
export interface MessageData {
|
|
143
|
+
data: [Uint256, Uint256, Uint256, Uint256, Uint256, Uint256, Uint256];
|
|
144
|
+
}
|
|
145
|
+
export interface Groth16ProofType {
|
|
146
|
+
a: string;
|
|
147
|
+
b: string;
|
|
148
|
+
c: string;
|
|
149
|
+
}
|
|
150
|
+
export interface PlonkProofType {
|
|
151
|
+
grand_product_at_z_omega: string;
|
|
152
|
+
grand_product_commitment: string;
|
|
153
|
+
input_values: string[];
|
|
154
|
+
linearization_polynomial_at_z: string;
|
|
155
|
+
n: number;
|
|
156
|
+
num_inputs: number;
|
|
157
|
+
opening_at_z_omega_proof: string;
|
|
158
|
+
opening_at_z_proof: string;
|
|
159
|
+
permutation_polynomials_at_z: string[];
|
|
160
|
+
quotient_poly_commitments: string[];
|
|
161
|
+
quotient_polynomial_at_z: string;
|
|
162
|
+
wire_commitments: string[];
|
|
163
|
+
wire_values_at_z: string[];
|
|
164
|
+
wire_values_at_z_omega: string[];
|
|
165
|
+
}
|
|
166
|
+
export type QueryMsg = {
|
|
167
|
+
get_round_info: {};
|
|
168
|
+
} | {
|
|
169
|
+
get_voting_time: {};
|
|
170
|
+
} | {
|
|
171
|
+
get_period: {};
|
|
172
|
+
} | {
|
|
173
|
+
get_num_sign_up: {};
|
|
174
|
+
} | {
|
|
175
|
+
get_msg_chain_length: {};
|
|
176
|
+
} | {
|
|
177
|
+
get_processed_msg_count: {};
|
|
178
|
+
} | {
|
|
179
|
+
get_processed_user_count: {};
|
|
180
|
+
} | {
|
|
181
|
+
get_result: {
|
|
182
|
+
index: Uint256;
|
|
183
|
+
};
|
|
184
|
+
} | {
|
|
185
|
+
get_all_result: {};
|
|
186
|
+
} | {
|
|
187
|
+
get_state_idx_inc: {
|
|
188
|
+
address: Addr;
|
|
189
|
+
};
|
|
190
|
+
} | {
|
|
191
|
+
get_voice_credit_balance: {
|
|
192
|
+
index: Uint256;
|
|
193
|
+
};
|
|
194
|
+
} | {
|
|
195
|
+
is_white_list: {
|
|
196
|
+
amount: Uint256;
|
|
197
|
+
certificate: string;
|
|
198
|
+
sender: string;
|
|
199
|
+
};
|
|
200
|
+
} | {
|
|
201
|
+
white_balance_of: {
|
|
202
|
+
amount: Uint256;
|
|
203
|
+
certificate: string;
|
|
204
|
+
sender: string;
|
|
205
|
+
};
|
|
206
|
+
} | {
|
|
207
|
+
white_info: {
|
|
208
|
+
sender: string;
|
|
209
|
+
};
|
|
210
|
+
} | {
|
|
211
|
+
grant_info: {
|
|
212
|
+
grantee: string;
|
|
213
|
+
};
|
|
214
|
+
} | {
|
|
215
|
+
max_whitelist_num: {};
|
|
216
|
+
} | {
|
|
217
|
+
vote_option_map: {};
|
|
218
|
+
} | {
|
|
219
|
+
max_vote_options: {};
|
|
220
|
+
} | {
|
|
221
|
+
query_total_fee_grant: {};
|
|
222
|
+
} | {
|
|
223
|
+
query_circuit_type: {};
|
|
224
|
+
} | {
|
|
225
|
+
query_cert_system: {};
|
|
226
|
+
} | {
|
|
227
|
+
query_oracle_whitelist_config: {};
|
|
228
|
+
};
|
|
229
|
+
export type PeriodStatus = "pending" | "voting" | "processing" | "tallying" | "ended";
|
|
230
|
+
export interface Period {
|
|
231
|
+
status: PeriodStatus;
|
|
232
|
+
}
|
|
233
|
+
export interface GrantConfig {
|
|
234
|
+
fee_amount: Uint128;
|
|
235
|
+
fee_grant: boolean;
|
|
236
|
+
}
|
|
237
|
+
export type Boolean = boolean;
|
|
238
|
+
export type Binary = string;
|
|
239
|
+
export interface OracleWhitelistConfig {
|
|
240
|
+
backend_pubkey: Binary;
|
|
241
|
+
ecosystem: string;
|
|
242
|
+
slope: Uint256;
|
|
243
|
+
snapshot_height: Uint256;
|
|
244
|
+
threshold: Uint256;
|
|
245
|
+
voting_power_mode: VotingPowerMode;
|
|
246
|
+
}
|
|
247
|
+
export type ArrayOfString = string[];
|
|
248
|
+
export interface WhitelistConfig {
|
|
249
|
+
balance: Uint256;
|
|
250
|
+
fee_amount: Uint128;
|
|
251
|
+
fee_grant: boolean;
|
|
252
|
+
is_register: boolean;
|
|
253
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate';
|
|
7
|
+
import { Coin, StdFee } from '@cosmjs/amino';
|
|
8
|
+
import { Addr, Uint256, PubKey, RoundInfo, VotingTime, Whitelist, ValidatorSet, AdminResponse, String, Boolean } from './Registry.types';
|
|
9
|
+
export interface RegistryReadOnlyInterface {
|
|
10
|
+
contractAddress: string;
|
|
11
|
+
admin: () => Promise<AdminResponse>;
|
|
12
|
+
operator: () => Promise<Addr>;
|
|
13
|
+
isMaciOperator: ({ address }: {
|
|
14
|
+
address: Addr;
|
|
15
|
+
}) => Promise<Boolean>;
|
|
16
|
+
isValidator: ({ address }: {
|
|
17
|
+
address: Addr;
|
|
18
|
+
}) => Promise<Boolean>;
|
|
19
|
+
getValidators: () => Promise<ValidatorSet>;
|
|
20
|
+
getValidatorOperator: ({ address }: {
|
|
21
|
+
address: Addr;
|
|
22
|
+
}) => Promise<Addr>;
|
|
23
|
+
getMaciOperatorPubkey: ({ address }: {
|
|
24
|
+
address: Addr;
|
|
25
|
+
}) => Promise<PubKey>;
|
|
26
|
+
getMaciOperatorIdentity: ({ address, }: {
|
|
27
|
+
address: Addr;
|
|
28
|
+
}) => Promise<String>;
|
|
29
|
+
}
|
|
30
|
+
export declare class RegistryQueryClient implements RegistryReadOnlyInterface {
|
|
31
|
+
client: CosmWasmClient;
|
|
32
|
+
contractAddress: string;
|
|
33
|
+
constructor(client: CosmWasmClient, contractAddress: string);
|
|
34
|
+
admin: () => Promise<AdminResponse>;
|
|
35
|
+
operator: () => Promise<Addr>;
|
|
36
|
+
isMaciOperator: ({ address, }: {
|
|
37
|
+
address: Addr;
|
|
38
|
+
}) => Promise<Boolean>;
|
|
39
|
+
isValidator: ({ address }: {
|
|
40
|
+
address: Addr;
|
|
41
|
+
}) => Promise<Boolean>;
|
|
42
|
+
getValidators: () => Promise<ValidatorSet>;
|
|
43
|
+
getValidatorOperator: ({ address, }: {
|
|
44
|
+
address: Addr;
|
|
45
|
+
}) => Promise<Addr>;
|
|
46
|
+
getMaciOperatorPubkey: ({ address, }: {
|
|
47
|
+
address: Addr;
|
|
48
|
+
}) => Promise<PubKey>;
|
|
49
|
+
getMaciOperatorIdentity: ({ address, }: {
|
|
50
|
+
address: Addr;
|
|
51
|
+
}) => Promise<String>;
|
|
52
|
+
}
|
|
53
|
+
export interface RegistryInterface extends RegistryReadOnlyInterface {
|
|
54
|
+
contractAddress: string;
|
|
55
|
+
sender: string;
|
|
56
|
+
setMaciOperator: ({ operator, }: {
|
|
57
|
+
operator: Addr;
|
|
58
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
59
|
+
setMaciOperatorPubkey: ({ pubkey, }: {
|
|
60
|
+
pubkey: PubKey;
|
|
61
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
62
|
+
setMaciOperatorIdentity: ({ identity, }: {
|
|
63
|
+
identity: string;
|
|
64
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
65
|
+
createRound: ({ certificationSystem, circuitType, maxOption, maxVoter, operator, preDeactivateRoot, roundInfo, voiceCreditAmount, votingTime, whitelist, }: {
|
|
66
|
+
certificationSystem: Uint256;
|
|
67
|
+
circuitType: Uint256;
|
|
68
|
+
maxOption: Uint256;
|
|
69
|
+
maxVoter: Uint256;
|
|
70
|
+
operator: Addr;
|
|
71
|
+
preDeactivateRoot: Uint256;
|
|
72
|
+
roundInfo: RoundInfo;
|
|
73
|
+
voiceCreditAmount: Uint256;
|
|
74
|
+
votingTime: VotingTime;
|
|
75
|
+
whitelist?: Whitelist;
|
|
76
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
77
|
+
setValidators: ({ addresses, }: {
|
|
78
|
+
addresses: ValidatorSet;
|
|
79
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
80
|
+
removeValidator: ({ address, }: {
|
|
81
|
+
address: Addr;
|
|
82
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
83
|
+
updateAmaciCodeId: ({ amaciCodeId, }: {
|
|
84
|
+
amaciCodeId: number;
|
|
85
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
86
|
+
changeOperator: ({ address, }: {
|
|
87
|
+
address: Addr;
|
|
88
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
89
|
+
}
|
|
90
|
+
export declare class RegistryClient extends RegistryQueryClient implements RegistryInterface {
|
|
91
|
+
client: SigningCosmWasmClient;
|
|
92
|
+
sender: string;
|
|
93
|
+
contractAddress: string;
|
|
94
|
+
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string);
|
|
95
|
+
setMaciOperator: ({ operator, }: {
|
|
96
|
+
operator: Addr;
|
|
97
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
98
|
+
setMaciOperatorPubkey: ({ pubkey, }: {
|
|
99
|
+
pubkey: PubKey;
|
|
100
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
101
|
+
setMaciOperatorIdentity: ({ identity, }: {
|
|
102
|
+
identity: string;
|
|
103
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
104
|
+
createRound: ({ certificationSystem, circuitType, maxOption, maxVoter, operator, preDeactivateRoot, roundInfo, voiceCreditAmount, votingTime, whitelist, }: {
|
|
105
|
+
certificationSystem: Uint256;
|
|
106
|
+
circuitType: Uint256;
|
|
107
|
+
maxOption: Uint256;
|
|
108
|
+
maxVoter: Uint256;
|
|
109
|
+
operator: Addr;
|
|
110
|
+
preDeactivateRoot: Uint256;
|
|
111
|
+
roundInfo: RoundInfo;
|
|
112
|
+
voiceCreditAmount: Uint256;
|
|
113
|
+
votingTime: VotingTime;
|
|
114
|
+
whitelist?: Whitelist;
|
|
115
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
116
|
+
setValidators: ({ addresses, }: {
|
|
117
|
+
addresses: ValidatorSet;
|
|
118
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
119
|
+
removeValidator: ({ address, }: {
|
|
120
|
+
address: Addr;
|
|
121
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
122
|
+
updateAmaciCodeId: ({ amaciCodeId, }: {
|
|
123
|
+
amaciCodeId: number;
|
|
124
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
125
|
+
changeOperator: ({ address, }: {
|
|
126
|
+
address: Addr;
|
|
127
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
128
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
export type Addr = string;
|
|
7
|
+
export interface InstantiateMsg {
|
|
8
|
+
admin: Addr;
|
|
9
|
+
amaci_code_id: number;
|
|
10
|
+
operator: Addr;
|
|
11
|
+
}
|
|
12
|
+
export type ExecuteMsg = {
|
|
13
|
+
set_maci_operator: {
|
|
14
|
+
operator: Addr;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
set_maci_operator_pubkey: {
|
|
18
|
+
pubkey: PubKey;
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
set_maci_operator_identity: {
|
|
22
|
+
identity: string;
|
|
23
|
+
};
|
|
24
|
+
} | {
|
|
25
|
+
create_round: {
|
|
26
|
+
certification_system: Uint256;
|
|
27
|
+
circuit_type: Uint256;
|
|
28
|
+
max_option: Uint256;
|
|
29
|
+
max_voter: Uint256;
|
|
30
|
+
operator: Addr;
|
|
31
|
+
pre_deactivate_root: Uint256;
|
|
32
|
+
round_info: RoundInfo;
|
|
33
|
+
voice_credit_amount: Uint256;
|
|
34
|
+
voting_time: VotingTime;
|
|
35
|
+
whitelist?: Whitelist | null;
|
|
36
|
+
};
|
|
37
|
+
} | {
|
|
38
|
+
set_validators: {
|
|
39
|
+
addresses: ValidatorSet;
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
42
|
+
remove_validator: {
|
|
43
|
+
address: Addr;
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
update_amaci_code_id: {
|
|
47
|
+
amaci_code_id: number;
|
|
48
|
+
};
|
|
49
|
+
} | {
|
|
50
|
+
change_operator: {
|
|
51
|
+
address: Addr;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type Uint256 = string;
|
|
55
|
+
export type Timestamp = Uint64;
|
|
56
|
+
export type Uint64 = string;
|
|
57
|
+
export interface PubKey {
|
|
58
|
+
x: Uint256;
|
|
59
|
+
y: Uint256;
|
|
60
|
+
}
|
|
61
|
+
export interface RoundInfo {
|
|
62
|
+
description: string;
|
|
63
|
+
link: string;
|
|
64
|
+
title: string;
|
|
65
|
+
}
|
|
66
|
+
export interface VotingTime {
|
|
67
|
+
end_time: Timestamp;
|
|
68
|
+
start_time: Timestamp;
|
|
69
|
+
}
|
|
70
|
+
export interface Whitelist {
|
|
71
|
+
users: WhitelistConfig[];
|
|
72
|
+
}
|
|
73
|
+
export interface WhitelistConfig {
|
|
74
|
+
addr: Addr;
|
|
75
|
+
}
|
|
76
|
+
export interface ValidatorSet {
|
|
77
|
+
addresses: Addr[];
|
|
78
|
+
}
|
|
79
|
+
export type QueryMsg = {
|
|
80
|
+
admin: {};
|
|
81
|
+
} | {
|
|
82
|
+
operator: {};
|
|
83
|
+
} | {
|
|
84
|
+
is_maci_operator: {
|
|
85
|
+
address: Addr;
|
|
86
|
+
};
|
|
87
|
+
} | {
|
|
88
|
+
is_validator: {
|
|
89
|
+
address: Addr;
|
|
90
|
+
};
|
|
91
|
+
} | {
|
|
92
|
+
get_validators: {};
|
|
93
|
+
} | {
|
|
94
|
+
get_validator_operator: {
|
|
95
|
+
address: Addr;
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
get_maci_operator_pubkey: {
|
|
99
|
+
address: Addr;
|
|
100
|
+
};
|
|
101
|
+
} | {
|
|
102
|
+
get_maci_operator_identity: {
|
|
103
|
+
address: Addr;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export interface AdminResponse {
|
|
107
|
+
admin: Addr;
|
|
108
|
+
}
|
|
109
|
+
export type String = string;
|
|
110
|
+
export type Boolean = boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Whitelist as RegistryWhitelist } from './ts/Registry.types';
|
|
2
|
+
import { Whitelist as MaciWhitelist } from './ts/Maci.types';
|
|
3
|
+
import { OfflineSigner } from '@cosmjs/proto-signing';
|
|
4
|
+
export declare enum MaciCircuitType {
|
|
5
|
+
IP1V = "0",
|
|
6
|
+
QV = "1"
|
|
7
|
+
}
|
|
8
|
+
export declare enum MaciCertSystemType {
|
|
9
|
+
GROTH16 = "groth16",
|
|
10
|
+
PLONK = "plonk"
|
|
11
|
+
}
|
|
12
|
+
export declare enum MaciRoundType {
|
|
13
|
+
MACI = "0",
|
|
14
|
+
AMACI = "1",
|
|
15
|
+
ORACLE_MACI = "2"
|
|
16
|
+
}
|
|
17
|
+
export interface CreateRoundParams {
|
|
18
|
+
signer: OfflineSigner;
|
|
19
|
+
title: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
link?: string;
|
|
22
|
+
startVoting: Date;
|
|
23
|
+
endVoting: Date;
|
|
24
|
+
maxVoter: string;
|
|
25
|
+
maxOption: string;
|
|
26
|
+
circuitType: MaciCircuitType;
|
|
27
|
+
}
|
|
28
|
+
export type CreateAMaciRoundParams = {
|
|
29
|
+
operator: string;
|
|
30
|
+
whitelist: RegistryWhitelist;
|
|
31
|
+
voiceCreditAmount: string;
|
|
32
|
+
preDeactivateRoot?: string;
|
|
33
|
+
} & CreateRoundParams;
|
|
34
|
+
export type CreateMaciRoundParams = {
|
|
35
|
+
operatorPubkey: string;
|
|
36
|
+
whitelist: MaciWhitelist;
|
|
37
|
+
certSystemType: MaciCertSystemType;
|
|
38
|
+
} & CreateRoundParams;
|
|
39
|
+
export type CreateOracleMaciRoundParams = {
|
|
40
|
+
operatorPubkey: string;
|
|
41
|
+
whitelistEcosystem: string;
|
|
42
|
+
whitelistSnapshotHeight: string;
|
|
43
|
+
whitelistVotingPowerArgs: {
|
|
44
|
+
mode: string;
|
|
45
|
+
slope: string;
|
|
46
|
+
threshold: string;
|
|
47
|
+
};
|
|
48
|
+
whitelistBackendPubkey?: string;
|
|
49
|
+
feegrantOperator?: string;
|
|
50
|
+
} & CreateRoundParams;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { MaciCertSystemType, MaciCircuitType, MaciRoundType } from './types';
|
|
2
|
+
type MixedData<T> = T | Array<MixedData<T>> | {
|
|
3
|
+
[key: string]: MixedData<T>;
|
|
4
|
+
};
|
|
5
|
+
export declare const stringizing: (o: MixedData<bigint>, path?: MixedData<bigint>[]) => MixedData<string>;
|
|
6
|
+
export declare function getContractParams(type: MaciRoundType, circuitType: MaciCircuitType, proofSystem: MaciCertSystemType, maxVoter: string, maxOption: string): {
|
|
7
|
+
parameters: {
|
|
8
|
+
state_tree_depth: string;
|
|
9
|
+
int_state_tree_depth: string;
|
|
10
|
+
vote_option_tree_depth: string;
|
|
11
|
+
message_batch_size: string;
|
|
12
|
+
};
|
|
13
|
+
groth16ProcessVkey: {
|
|
14
|
+
vk_alpha1: string;
|
|
15
|
+
vk_beta_2: string;
|
|
16
|
+
vk_gamma_2: string;
|
|
17
|
+
vk_delta_2: string;
|
|
18
|
+
vk_ic0: string;
|
|
19
|
+
vk_ic1: string;
|
|
20
|
+
} | null;
|
|
21
|
+
groth16TallyVkey: {
|
|
22
|
+
vk_alpha1: string;
|
|
23
|
+
vk_beta_2: string;
|
|
24
|
+
vk_gamma_2: string;
|
|
25
|
+
vk_delta_2: string;
|
|
26
|
+
vk_ic0: string;
|
|
27
|
+
vk_ic1: string;
|
|
28
|
+
} | null;
|
|
29
|
+
plonkProcessVkey: {
|
|
30
|
+
n: number;
|
|
31
|
+
num_inputs: number;
|
|
32
|
+
selector_commitments: string[];
|
|
33
|
+
next_step_selector_commitments: string[];
|
|
34
|
+
permutation_commitments: string[];
|
|
35
|
+
non_residues: string[];
|
|
36
|
+
g2_elements: string[];
|
|
37
|
+
} | null | undefined;
|
|
38
|
+
plonkTallyVkey: {
|
|
39
|
+
n: number;
|
|
40
|
+
num_inputs: number;
|
|
41
|
+
selector_commitments: string[];
|
|
42
|
+
next_step_selector_commitments: string[];
|
|
43
|
+
permutation_commitments: string[];
|
|
44
|
+
non_residues: string[];
|
|
45
|
+
g2_elements: string[];
|
|
46
|
+
} | null | undefined;
|
|
47
|
+
maciVoteType: string;
|
|
48
|
+
maciCertSystem: string;
|
|
49
|
+
} | {
|
|
50
|
+
parameters?: undefined;
|
|
51
|
+
groth16ProcessVkey?: undefined;
|
|
52
|
+
groth16TallyVkey?: undefined;
|
|
53
|
+
plonkProcessVkey?: undefined;
|
|
54
|
+
plonkTallyVkey?: undefined;
|
|
55
|
+
maciVoteType?: undefined;
|
|
56
|
+
maciCertSystem?: undefined;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Parses a public key string into its x and y coordinates.
|
|
60
|
+
* @param publickKey - The public key string to parse (128 characters long).
|
|
61
|
+
* @returns An object containing the x and y coordinates as decimal strings.
|
|
62
|
+
*/
|
|
63
|
+
export declare function parsePubkey(publickKey: string): {
|
|
64
|
+
x: string;
|
|
65
|
+
y: string;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
type CircuitInfoType = {
|
|
2
|
+
[key: string]: {
|
|
3
|
+
parameter: {
|
|
4
|
+
state_tree_depth: string;
|
|
5
|
+
int_state_tree_depth: string;
|
|
6
|
+
vote_option_tree_depth: string;
|
|
7
|
+
message_batch_size: string;
|
|
8
|
+
};
|
|
9
|
+
groth16: {
|
|
10
|
+
process_vkey: {
|
|
11
|
+
vk_alpha1: string;
|
|
12
|
+
vk_beta_2: string;
|
|
13
|
+
vk_gamma_2: string;
|
|
14
|
+
vk_delta_2: string;
|
|
15
|
+
vk_ic0: string;
|
|
16
|
+
vk_ic1: string;
|
|
17
|
+
};
|
|
18
|
+
tally_vkey: {
|
|
19
|
+
vk_alpha1: string;
|
|
20
|
+
vk_beta_2: string;
|
|
21
|
+
vk_gamma_2: string;
|
|
22
|
+
vk_delta_2: string;
|
|
23
|
+
vk_ic0: string;
|
|
24
|
+
vk_ic1: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
plonk?: {
|
|
28
|
+
process_vkey: {
|
|
29
|
+
n: number;
|
|
30
|
+
num_inputs: number;
|
|
31
|
+
selector_commitments: string[];
|
|
32
|
+
next_step_selector_commitments: string[];
|
|
33
|
+
permutation_commitments: string[];
|
|
34
|
+
non_residues: string[];
|
|
35
|
+
g2_elements: string[];
|
|
36
|
+
};
|
|
37
|
+
tally_vkey: {
|
|
38
|
+
n: number;
|
|
39
|
+
num_inputs: number;
|
|
40
|
+
selector_commitments: string[];
|
|
41
|
+
next_step_selector_commitments: string[];
|
|
42
|
+
permutation_commitments: string[];
|
|
43
|
+
non_residues: string[];
|
|
44
|
+
g2_elements: string[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare const CIRCUIT_INFO: CircuitInfoType;
|
|
50
|
+
export declare const MACI_TYPE: {
|
|
51
|
+
'maci-1p1v': string;
|
|
52
|
+
'maci-qv': string;
|
|
53
|
+
};
|
|
54
|
+
export declare const AMACI_TYPE: {
|
|
55
|
+
'amaci-1p1v': string;
|
|
56
|
+
'amaci-qv': string;
|
|
57
|
+
};
|
|
58
|
+
export declare const PROOF_SYSTEM: {
|
|
59
|
+
groth16: string;
|
|
60
|
+
plonk: string;
|
|
61
|
+
};
|
|
62
|
+
export declare const QTR_LIB: {
|
|
63
|
+
zeros: string[];
|
|
64
|
+
};
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare class BaseError extends Error {
|
|
2
|
+
code: number;
|
|
3
|
+
type: string;
|
|
4
|
+
constructor(message: string, code: number, type: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class HttpError extends BaseError {
|
|
7
|
+
constructor(message: string, code: number);
|
|
8
|
+
}
|
|
9
|
+
export declare class GraphQLError extends BaseError {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class ValidationError extends BaseError {
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class NotFoundError extends BaseError {
|
|
16
|
+
constructor(message: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class ParseError extends BaseError {
|
|
19
|
+
constructor(message: string);
|
|
20
|
+
}
|
|
21
|
+
export type ErrorType = BaseError | Error | HttpError | NotFoundError | ValidationError | ParseError | GraphQLError;
|
|
22
|
+
export declare function handleError(error: ErrorType): {
|
|
23
|
+
code: number;
|
|
24
|
+
error: {
|
|
25
|
+
message: string;
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
};
|