@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,561 @@
|
|
|
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, Addr, Timestamp, Uint64, VotingPowerMode, InstantiateMsg, PubKey, Groth16VKeyType, MaciParameters, PlonkVKeyType, QuinaryTreeRoot, RoundInfo, VotingTime, VotingPowerArgs, ExecuteMsg, Uint128, MessageData, Groth16ProofType, PlonkProofType, QueryMsg, PeriodStatus, Period, GrantConfig, Boolean, Binary, OracleWhitelistConfig, ArrayOfString, WhitelistConfig } from "./OracleMaci.types";
|
|
10
|
+
export interface OracleMaciReadOnlyInterface {
|
|
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
|
+
sender
|
|
39
|
+
}: {
|
|
40
|
+
amount: Uint256;
|
|
41
|
+
certificate: string;
|
|
42
|
+
sender: string;
|
|
43
|
+
}) => Promise<Boolean>;
|
|
44
|
+
whiteBalanceOf: ({
|
|
45
|
+
amount,
|
|
46
|
+
certificate,
|
|
47
|
+
sender
|
|
48
|
+
}: {
|
|
49
|
+
amount: Uint256;
|
|
50
|
+
certificate: string;
|
|
51
|
+
sender: string;
|
|
52
|
+
}) => Promise<Uint256>;
|
|
53
|
+
whiteInfo: ({
|
|
54
|
+
sender
|
|
55
|
+
}: {
|
|
56
|
+
sender: string;
|
|
57
|
+
}) => Promise<WhitelistConfig>;
|
|
58
|
+
grantInfo: ({
|
|
59
|
+
grantee
|
|
60
|
+
}: {
|
|
61
|
+
grantee: string;
|
|
62
|
+
}) => Promise<GrantConfig>;
|
|
63
|
+
maxWhitelistNum: () => Promise<Uint128>;
|
|
64
|
+
voteOptionMap: () => Promise<ArrayOfString>;
|
|
65
|
+
maxVoteOptions: () => Promise<Uint256>;
|
|
66
|
+
queryTotalFeeGrant: () => Promise<Uint128>;
|
|
67
|
+
queryCircuitType: () => Promise<Uint256>;
|
|
68
|
+
queryCertSystem: () => Promise<Uint256>;
|
|
69
|
+
queryOracleWhitelistConfig: () => Promise<OracleWhitelistConfig>;
|
|
70
|
+
}
|
|
71
|
+
export class OracleMaciQueryClient implements OracleMaciReadOnlyInterface {
|
|
72
|
+
client: CosmWasmClient;
|
|
73
|
+
contractAddress: string;
|
|
74
|
+
constructor(client: CosmWasmClient, contractAddress: string) {
|
|
75
|
+
this.client = client;
|
|
76
|
+
this.contractAddress = contractAddress;
|
|
77
|
+
this.getRoundInfo = this.getRoundInfo.bind(this);
|
|
78
|
+
this.getVotingTime = this.getVotingTime.bind(this);
|
|
79
|
+
this.getPeriod = this.getPeriod.bind(this);
|
|
80
|
+
this.getNumSignUp = this.getNumSignUp.bind(this);
|
|
81
|
+
this.getMsgChainLength = this.getMsgChainLength.bind(this);
|
|
82
|
+
this.getProcessedMsgCount = this.getProcessedMsgCount.bind(this);
|
|
83
|
+
this.getProcessedUserCount = this.getProcessedUserCount.bind(this);
|
|
84
|
+
this.getResult = this.getResult.bind(this);
|
|
85
|
+
this.getAllResult = this.getAllResult.bind(this);
|
|
86
|
+
this.getStateIdxInc = this.getStateIdxInc.bind(this);
|
|
87
|
+
this.getVoiceCreditBalance = this.getVoiceCreditBalance.bind(this);
|
|
88
|
+
this.isWhiteList = this.isWhiteList.bind(this);
|
|
89
|
+
this.whiteBalanceOf = this.whiteBalanceOf.bind(this);
|
|
90
|
+
this.whiteInfo = this.whiteInfo.bind(this);
|
|
91
|
+
this.grantInfo = this.grantInfo.bind(this);
|
|
92
|
+
this.maxWhitelistNum = this.maxWhitelistNum.bind(this);
|
|
93
|
+
this.voteOptionMap = this.voteOptionMap.bind(this);
|
|
94
|
+
this.maxVoteOptions = this.maxVoteOptions.bind(this);
|
|
95
|
+
this.queryTotalFeeGrant = this.queryTotalFeeGrant.bind(this);
|
|
96
|
+
this.queryCircuitType = this.queryCircuitType.bind(this);
|
|
97
|
+
this.queryCertSystem = this.queryCertSystem.bind(this);
|
|
98
|
+
this.queryOracleWhitelistConfig = this.queryOracleWhitelistConfig.bind(this);
|
|
99
|
+
}
|
|
100
|
+
getRoundInfo = async (): Promise<RoundInfo> => {
|
|
101
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
102
|
+
get_round_info: {}
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
getVotingTime = async (): Promise<VotingTime> => {
|
|
106
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
107
|
+
get_voting_time: {}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
getPeriod = async (): Promise<Period> => {
|
|
111
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
112
|
+
get_period: {}
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
getNumSignUp = async (): Promise<Uint256> => {
|
|
116
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
117
|
+
get_num_sign_up: {}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
getMsgChainLength = async (): Promise<Uint256> => {
|
|
121
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
122
|
+
get_msg_chain_length: {}
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
getProcessedMsgCount = async (): Promise<Uint256> => {
|
|
126
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
127
|
+
get_processed_msg_count: {}
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
getProcessedUserCount = async (): Promise<Uint256> => {
|
|
131
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
132
|
+
get_processed_user_count: {}
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
getResult = async ({
|
|
136
|
+
index
|
|
137
|
+
}: {
|
|
138
|
+
index: Uint256;
|
|
139
|
+
}): Promise<Uint256> => {
|
|
140
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
141
|
+
get_result: {
|
|
142
|
+
index
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
getAllResult = async (): Promise<Uint256> => {
|
|
147
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
148
|
+
get_all_result: {}
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
getStateIdxInc = async ({
|
|
152
|
+
address
|
|
153
|
+
}: {
|
|
154
|
+
address: Addr;
|
|
155
|
+
}): Promise<Uint256> => {
|
|
156
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
157
|
+
get_state_idx_inc: {
|
|
158
|
+
address
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
getVoiceCreditBalance = async ({
|
|
163
|
+
index
|
|
164
|
+
}: {
|
|
165
|
+
index: Uint256;
|
|
166
|
+
}): Promise<Uint256> => {
|
|
167
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
168
|
+
get_voice_credit_balance: {
|
|
169
|
+
index
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
isWhiteList = async ({
|
|
174
|
+
amount,
|
|
175
|
+
certificate,
|
|
176
|
+
sender
|
|
177
|
+
}: {
|
|
178
|
+
amount: Uint256;
|
|
179
|
+
certificate: string;
|
|
180
|
+
sender: string;
|
|
181
|
+
}): Promise<Boolean> => {
|
|
182
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
183
|
+
is_white_list: {
|
|
184
|
+
amount,
|
|
185
|
+
certificate,
|
|
186
|
+
sender
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
whiteBalanceOf = async ({
|
|
191
|
+
amount,
|
|
192
|
+
certificate,
|
|
193
|
+
sender
|
|
194
|
+
}: {
|
|
195
|
+
amount: Uint256;
|
|
196
|
+
certificate: string;
|
|
197
|
+
sender: string;
|
|
198
|
+
}): Promise<Uint256> => {
|
|
199
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
200
|
+
white_balance_of: {
|
|
201
|
+
amount,
|
|
202
|
+
certificate,
|
|
203
|
+
sender
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
whiteInfo = async ({
|
|
208
|
+
sender
|
|
209
|
+
}: {
|
|
210
|
+
sender: string;
|
|
211
|
+
}): Promise<WhitelistConfig> => {
|
|
212
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
213
|
+
white_info: {
|
|
214
|
+
sender
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
grantInfo = async ({
|
|
219
|
+
grantee
|
|
220
|
+
}: {
|
|
221
|
+
grantee: string;
|
|
222
|
+
}): Promise<GrantConfig> => {
|
|
223
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
224
|
+
grant_info: {
|
|
225
|
+
grantee
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
maxWhitelistNum = async (): Promise<Uint128> => {
|
|
230
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
231
|
+
max_whitelist_num: {}
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
voteOptionMap = async (): Promise<ArrayOfString> => {
|
|
235
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
236
|
+
vote_option_map: {}
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
maxVoteOptions = async (): Promise<Uint256> => {
|
|
240
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
241
|
+
max_vote_options: {}
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
queryTotalFeeGrant = async (): Promise<Uint128> => {
|
|
245
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
246
|
+
query_total_fee_grant: {}
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
queryCircuitType = async (): Promise<Uint256> => {
|
|
250
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
251
|
+
query_circuit_type: {}
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
queryCertSystem = async (): Promise<Uint256> => {
|
|
255
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
256
|
+
query_cert_system: {}
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
queryOracleWhitelistConfig = async (): Promise<OracleWhitelistConfig> => {
|
|
260
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
261
|
+
query_oracle_whitelist_config: {}
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
export interface OracleMaciInterface extends OracleMaciReadOnlyInterface {
|
|
266
|
+
contractAddress: string;
|
|
267
|
+
sender: string;
|
|
268
|
+
setParams: ({
|
|
269
|
+
intStateTreeDepth,
|
|
270
|
+
messageBatchSize,
|
|
271
|
+
stateTreeDepth,
|
|
272
|
+
voteOptionTreeDepth
|
|
273
|
+
}: {
|
|
274
|
+
intStateTreeDepth: Uint256;
|
|
275
|
+
messageBatchSize: Uint256;
|
|
276
|
+
stateTreeDepth: Uint256;
|
|
277
|
+
voteOptionTreeDepth: Uint256;
|
|
278
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
279
|
+
setRoundInfo: ({
|
|
280
|
+
roundInfo
|
|
281
|
+
}: {
|
|
282
|
+
roundInfo: RoundInfo;
|
|
283
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
284
|
+
setVoteOptionsMap: ({
|
|
285
|
+
voteOptionMap
|
|
286
|
+
}: {
|
|
287
|
+
voteOptionMap: string[];
|
|
288
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
289
|
+
startVotingPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
290
|
+
signUp: ({
|
|
291
|
+
amount,
|
|
292
|
+
certificate,
|
|
293
|
+
pubkey
|
|
294
|
+
}: {
|
|
295
|
+
amount: Uint256;
|
|
296
|
+
certificate: string;
|
|
297
|
+
pubkey: PubKey;
|
|
298
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
299
|
+
startProcessPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
300
|
+
stopVotingPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
301
|
+
publishMessage: ({
|
|
302
|
+
encPubKey,
|
|
303
|
+
message
|
|
304
|
+
}: {
|
|
305
|
+
encPubKey: PubKey;
|
|
306
|
+
message: MessageData;
|
|
307
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
308
|
+
processMessage: ({
|
|
309
|
+
groth16Proof,
|
|
310
|
+
newStateCommitment,
|
|
311
|
+
plonkProof
|
|
312
|
+
}: {
|
|
313
|
+
groth16Proof?: Groth16ProofType;
|
|
314
|
+
newStateCommitment: Uint256;
|
|
315
|
+
plonkProof?: PlonkProofType;
|
|
316
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
317
|
+
stopProcessingPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
318
|
+
processTally: ({
|
|
319
|
+
groth16Proof,
|
|
320
|
+
newTallyCommitment,
|
|
321
|
+
plonkProof
|
|
322
|
+
}: {
|
|
323
|
+
groth16Proof?: Groth16ProofType;
|
|
324
|
+
newTallyCommitment: Uint256;
|
|
325
|
+
plonkProof?: PlonkProofType;
|
|
326
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
327
|
+
stopTallyingPeriod: ({
|
|
328
|
+
results,
|
|
329
|
+
salt
|
|
330
|
+
}: {
|
|
331
|
+
results: Uint256[];
|
|
332
|
+
salt: Uint256;
|
|
333
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
334
|
+
grant: ({
|
|
335
|
+
baseAmount,
|
|
336
|
+
grantee
|
|
337
|
+
}: {
|
|
338
|
+
baseAmount: Uint128;
|
|
339
|
+
grantee: Addr;
|
|
340
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
341
|
+
revoke: ({
|
|
342
|
+
grantee
|
|
343
|
+
}: {
|
|
344
|
+
grantee: Addr;
|
|
345
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
346
|
+
bond: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
347
|
+
withdraw: ({
|
|
348
|
+
amount
|
|
349
|
+
}: {
|
|
350
|
+
amount?: Uint128;
|
|
351
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
352
|
+
}
|
|
353
|
+
export class OracleMaciClient extends OracleMaciQueryClient implements OracleMaciInterface {
|
|
354
|
+
client: SigningCosmWasmClient;
|
|
355
|
+
sender: string;
|
|
356
|
+
contractAddress: string;
|
|
357
|
+
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
|
358
|
+
super(client, contractAddress);
|
|
359
|
+
this.client = client;
|
|
360
|
+
this.sender = sender;
|
|
361
|
+
this.contractAddress = contractAddress;
|
|
362
|
+
this.setParams = this.setParams.bind(this);
|
|
363
|
+
this.setRoundInfo = this.setRoundInfo.bind(this);
|
|
364
|
+
this.setVoteOptionsMap = this.setVoteOptionsMap.bind(this);
|
|
365
|
+
this.startVotingPeriod = this.startVotingPeriod.bind(this);
|
|
366
|
+
this.signUp = this.signUp.bind(this);
|
|
367
|
+
this.startProcessPeriod = this.startProcessPeriod.bind(this);
|
|
368
|
+
this.stopVotingPeriod = this.stopVotingPeriod.bind(this);
|
|
369
|
+
this.publishMessage = this.publishMessage.bind(this);
|
|
370
|
+
this.processMessage = this.processMessage.bind(this);
|
|
371
|
+
this.stopProcessingPeriod = this.stopProcessingPeriod.bind(this);
|
|
372
|
+
this.processTally = this.processTally.bind(this);
|
|
373
|
+
this.stopTallyingPeriod = this.stopTallyingPeriod.bind(this);
|
|
374
|
+
this.grant = this.grant.bind(this);
|
|
375
|
+
this.revoke = this.revoke.bind(this);
|
|
376
|
+
this.bond = this.bond.bind(this);
|
|
377
|
+
this.withdraw = this.withdraw.bind(this);
|
|
378
|
+
}
|
|
379
|
+
setParams = async ({
|
|
380
|
+
intStateTreeDepth,
|
|
381
|
+
messageBatchSize,
|
|
382
|
+
stateTreeDepth,
|
|
383
|
+
voteOptionTreeDepth
|
|
384
|
+
}: {
|
|
385
|
+
intStateTreeDepth: Uint256;
|
|
386
|
+
messageBatchSize: Uint256;
|
|
387
|
+
stateTreeDepth: Uint256;
|
|
388
|
+
voteOptionTreeDepth: Uint256;
|
|
389
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
390
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
391
|
+
set_params: {
|
|
392
|
+
int_state_tree_depth: intStateTreeDepth,
|
|
393
|
+
message_batch_size: messageBatchSize,
|
|
394
|
+
state_tree_depth: stateTreeDepth,
|
|
395
|
+
vote_option_tree_depth: voteOptionTreeDepth
|
|
396
|
+
}
|
|
397
|
+
}, fee, memo, _funds);
|
|
398
|
+
};
|
|
399
|
+
setRoundInfo = async ({
|
|
400
|
+
roundInfo
|
|
401
|
+
}: {
|
|
402
|
+
roundInfo: RoundInfo;
|
|
403
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
404
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
405
|
+
set_round_info: {
|
|
406
|
+
round_info: roundInfo
|
|
407
|
+
}
|
|
408
|
+
}, fee, memo, _funds);
|
|
409
|
+
};
|
|
410
|
+
setVoteOptionsMap = async ({
|
|
411
|
+
voteOptionMap
|
|
412
|
+
}: {
|
|
413
|
+
voteOptionMap: string[];
|
|
414
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
415
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
416
|
+
set_vote_options_map: {
|
|
417
|
+
vote_option_map: voteOptionMap
|
|
418
|
+
}
|
|
419
|
+
}, fee, memo, _funds);
|
|
420
|
+
};
|
|
421
|
+
startVotingPeriod = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
422
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
423
|
+
start_voting_period: {}
|
|
424
|
+
}, fee, memo, _funds);
|
|
425
|
+
};
|
|
426
|
+
signUp = async ({
|
|
427
|
+
amount,
|
|
428
|
+
certificate,
|
|
429
|
+
pubkey
|
|
430
|
+
}: {
|
|
431
|
+
amount: Uint256;
|
|
432
|
+
certificate: string;
|
|
433
|
+
pubkey: PubKey;
|
|
434
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
435
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
436
|
+
sign_up: {
|
|
437
|
+
amount,
|
|
438
|
+
certificate,
|
|
439
|
+
pubkey
|
|
440
|
+
}
|
|
441
|
+
}, fee, memo, _funds);
|
|
442
|
+
};
|
|
443
|
+
startProcessPeriod = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
444
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
445
|
+
start_process_period: {}
|
|
446
|
+
}, fee, memo, _funds);
|
|
447
|
+
};
|
|
448
|
+
stopVotingPeriod = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
449
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
450
|
+
stop_voting_period: {}
|
|
451
|
+
}, fee, memo, _funds);
|
|
452
|
+
};
|
|
453
|
+
publishMessage = async ({
|
|
454
|
+
encPubKey,
|
|
455
|
+
message
|
|
456
|
+
}: {
|
|
457
|
+
encPubKey: PubKey;
|
|
458
|
+
message: MessageData;
|
|
459
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
460
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
461
|
+
publish_message: {
|
|
462
|
+
enc_pub_key: encPubKey,
|
|
463
|
+
message
|
|
464
|
+
}
|
|
465
|
+
}, fee, memo, _funds);
|
|
466
|
+
};
|
|
467
|
+
processMessage = async ({
|
|
468
|
+
groth16Proof,
|
|
469
|
+
newStateCommitment,
|
|
470
|
+
plonkProof
|
|
471
|
+
}: {
|
|
472
|
+
groth16Proof?: Groth16ProofType;
|
|
473
|
+
newStateCommitment: Uint256;
|
|
474
|
+
plonkProof?: PlonkProofType;
|
|
475
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
476
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
477
|
+
process_message: {
|
|
478
|
+
groth16_proof: groth16Proof,
|
|
479
|
+
new_state_commitment: newStateCommitment,
|
|
480
|
+
plonk_proof: plonkProof
|
|
481
|
+
}
|
|
482
|
+
}, fee, memo, _funds);
|
|
483
|
+
};
|
|
484
|
+
stopProcessingPeriod = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
485
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
486
|
+
stop_processing_period: {}
|
|
487
|
+
}, fee, memo, _funds);
|
|
488
|
+
};
|
|
489
|
+
processTally = async ({
|
|
490
|
+
groth16Proof,
|
|
491
|
+
newTallyCommitment,
|
|
492
|
+
plonkProof
|
|
493
|
+
}: {
|
|
494
|
+
groth16Proof?: Groth16ProofType;
|
|
495
|
+
newTallyCommitment: Uint256;
|
|
496
|
+
plonkProof?: PlonkProofType;
|
|
497
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
498
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
499
|
+
process_tally: {
|
|
500
|
+
groth16_proof: groth16Proof,
|
|
501
|
+
new_tally_commitment: newTallyCommitment,
|
|
502
|
+
plonk_proof: plonkProof
|
|
503
|
+
}
|
|
504
|
+
}, fee, memo, _funds);
|
|
505
|
+
};
|
|
506
|
+
stopTallyingPeriod = async ({
|
|
507
|
+
results,
|
|
508
|
+
salt
|
|
509
|
+
}: {
|
|
510
|
+
results: Uint256[];
|
|
511
|
+
salt: Uint256;
|
|
512
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
513
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
514
|
+
stop_tallying_period: {
|
|
515
|
+
results,
|
|
516
|
+
salt
|
|
517
|
+
}
|
|
518
|
+
}, fee, memo, _funds);
|
|
519
|
+
};
|
|
520
|
+
grant = async ({
|
|
521
|
+
baseAmount,
|
|
522
|
+
grantee
|
|
523
|
+
}: {
|
|
524
|
+
baseAmount: Uint128;
|
|
525
|
+
grantee: Addr;
|
|
526
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
527
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
528
|
+
grant: {
|
|
529
|
+
base_amount: baseAmount,
|
|
530
|
+
grantee
|
|
531
|
+
}
|
|
532
|
+
}, fee, memo, _funds);
|
|
533
|
+
};
|
|
534
|
+
revoke = async ({
|
|
535
|
+
grantee
|
|
536
|
+
}: {
|
|
537
|
+
grantee: Addr;
|
|
538
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
539
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
540
|
+
revoke: {
|
|
541
|
+
grantee
|
|
542
|
+
}
|
|
543
|
+
}, fee, memo, _funds);
|
|
544
|
+
};
|
|
545
|
+
bond = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
546
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
547
|
+
bond: {}
|
|
548
|
+
}, fee, memo, _funds);
|
|
549
|
+
};
|
|
550
|
+
withdraw = async ({
|
|
551
|
+
amount
|
|
552
|
+
}: {
|
|
553
|
+
amount?: Uint128;
|
|
554
|
+
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
|
|
555
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
556
|
+
withdraw: {
|
|
557
|
+
amount
|
|
558
|
+
}
|
|
559
|
+
}, fee, memo, _funds);
|
|
560
|
+
};
|
|
561
|
+
}
|