@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
package/dist/index.js
ADDED
|
@@ -0,0 +1,4157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Account: () => Account,
|
|
24
|
+
Circuit: () => Circuit,
|
|
25
|
+
Contract: () => Contract,
|
|
26
|
+
Http: () => Http,
|
|
27
|
+
Indexer: () => Indexer,
|
|
28
|
+
MaciClient: () => MaciClient2,
|
|
29
|
+
Operator: () => Operator,
|
|
30
|
+
Proof: () => Proof,
|
|
31
|
+
Round: () => Round,
|
|
32
|
+
Transaction: () => Transaction,
|
|
33
|
+
circuits: () => circuits,
|
|
34
|
+
getDefaultParams: () => getDefaultParams,
|
|
35
|
+
validator_operator_set: () => validator_operator_set
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(src_exports);
|
|
38
|
+
|
|
39
|
+
// src/libs/errors/index.ts
|
|
40
|
+
var BaseError = class extends Error {
|
|
41
|
+
constructor(message, code, type) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.code = code;
|
|
44
|
+
this.type = type;
|
|
45
|
+
this.name = this.constructor.name;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var HttpError = class extends BaseError {
|
|
49
|
+
constructor(message, code) {
|
|
50
|
+
super(message, code, "ERROR_HTTP");
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var GraphQLError = class extends BaseError {
|
|
54
|
+
constructor(message) {
|
|
55
|
+
super(message, 400, "ERROR_GRAPHQL");
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var ValidationError = class extends BaseError {
|
|
59
|
+
constructor(message) {
|
|
60
|
+
super(message, 400, "ERROR_VALIDATION");
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var NotFoundError = class extends BaseError {
|
|
64
|
+
constructor(message) {
|
|
65
|
+
super(message, 404, "ERROR_NOT_FOUND");
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var ParseError = class extends BaseError {
|
|
69
|
+
constructor(message) {
|
|
70
|
+
super(message, 500, "ERROR_PARSE");
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
function handleError(error) {
|
|
74
|
+
if (!(error instanceof Error)) {
|
|
75
|
+
return {
|
|
76
|
+
code: 500,
|
|
77
|
+
error: {
|
|
78
|
+
message: "Unknown error occurred",
|
|
79
|
+
type: `ERROR_UNKNOWN`
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
switch (true) {
|
|
84
|
+
case error instanceof HttpError:
|
|
85
|
+
return {
|
|
86
|
+
code: error.code,
|
|
87
|
+
error: {
|
|
88
|
+
message: error.message,
|
|
89
|
+
type: "ERROR_HTTP"
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
case error instanceof GraphQLError:
|
|
93
|
+
return {
|
|
94
|
+
code: 400,
|
|
95
|
+
error: {
|
|
96
|
+
message: error.message,
|
|
97
|
+
type: "ERROR_GRAPHQL"
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
case error instanceof ValidationError:
|
|
101
|
+
return {
|
|
102
|
+
code: 400,
|
|
103
|
+
error: {
|
|
104
|
+
message: error.message,
|
|
105
|
+
type: "ERROR_VALIDATION"
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
case error instanceof NotFoundError:
|
|
109
|
+
return {
|
|
110
|
+
code: 404,
|
|
111
|
+
error: {
|
|
112
|
+
message: error.message,
|
|
113
|
+
type: "ERROR_NOT_FOUND"
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
case error instanceof ParseError:
|
|
117
|
+
return {
|
|
118
|
+
code: 500,
|
|
119
|
+
error: {
|
|
120
|
+
message: error.message,
|
|
121
|
+
type: "ERROR_PARSE"
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
case error instanceof BaseError:
|
|
125
|
+
return {
|
|
126
|
+
code: error.code,
|
|
127
|
+
error: {
|
|
128
|
+
message: error.message,
|
|
129
|
+
type: error.type
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
default:
|
|
133
|
+
return {
|
|
134
|
+
code: 500,
|
|
135
|
+
error: {
|
|
136
|
+
message: error.message || "Internal server error",
|
|
137
|
+
type: "ERROR_UNKNOWN"
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// src/libs/http/http.ts
|
|
144
|
+
var Http = class {
|
|
145
|
+
constructor(apiEndpoint, restEndpoint, customFetch, defaultOptions) {
|
|
146
|
+
this.customFetch = customFetch;
|
|
147
|
+
this.apiEndpoint = apiEndpoint;
|
|
148
|
+
this.restEndpoint = restEndpoint;
|
|
149
|
+
this.defaultOptions = defaultOptions;
|
|
150
|
+
}
|
|
151
|
+
getFetch() {
|
|
152
|
+
return this.customFetch || fetch;
|
|
153
|
+
}
|
|
154
|
+
async fetch(url) {
|
|
155
|
+
try {
|
|
156
|
+
const fetchFn = this.getFetch();
|
|
157
|
+
const response = await fetchFn(url, {
|
|
158
|
+
...this.defaultOptions
|
|
159
|
+
});
|
|
160
|
+
if (!response.ok) {
|
|
161
|
+
throw new HttpError(
|
|
162
|
+
`HTTP error! status: ${response.status}`,
|
|
163
|
+
response.status
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return response;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
if (error instanceof HttpError) {
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
throw new HttpError(`Failed to fetch: ${error.message}`, 500);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
async fetchGraphql(query, after, limit = 10) {
|
|
175
|
+
try {
|
|
176
|
+
const isFirstPage = after === "first";
|
|
177
|
+
const fetchFn = this.getFetch();
|
|
178
|
+
const response = await fetchFn(this.apiEndpoint, {
|
|
179
|
+
method: "POST",
|
|
180
|
+
headers: {
|
|
181
|
+
"Content-Type": "application/json",
|
|
182
|
+
Accept: "application/json"
|
|
183
|
+
},
|
|
184
|
+
body: JSON.stringify({
|
|
185
|
+
query,
|
|
186
|
+
variables: { limit, after: isFirstPage ? void 0 : after }
|
|
187
|
+
}),
|
|
188
|
+
...this.defaultOptions
|
|
189
|
+
});
|
|
190
|
+
if (!response.ok) {
|
|
191
|
+
const errorData = await response.json();
|
|
192
|
+
if (errorData.errors?.[0]?.message?.includes("Syntax Error")) {
|
|
193
|
+
throw new GraphQLError(
|
|
194
|
+
`GraphQL syntax error: ${errorData.errors[0].message}`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
if (errorData.errors?.length > 0) {
|
|
198
|
+
throw new GraphQLError(
|
|
199
|
+
errorData.errors[0].message || "Unknown GraphQL error"
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
throw new HttpError(
|
|
203
|
+
`HTTP error: ${JSON.stringify(errorData)}`,
|
|
204
|
+
response.status
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
const data = await response.json();
|
|
208
|
+
if (data.errors) {
|
|
209
|
+
throw new GraphQLError(
|
|
210
|
+
data.errors[0]?.message || "GraphQL query failed"
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
return data;
|
|
214
|
+
} catch (error) {
|
|
215
|
+
if (error instanceof BaseError) {
|
|
216
|
+
throw error;
|
|
217
|
+
}
|
|
218
|
+
if (error instanceof SyntaxError) {
|
|
219
|
+
throw new ParseError("Failed to parse JSON response");
|
|
220
|
+
}
|
|
221
|
+
throw new HttpError(
|
|
222
|
+
`Failed to fetch GraphQL: ${error.message}`,
|
|
223
|
+
500
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
async fetchRest(path) {
|
|
228
|
+
try {
|
|
229
|
+
const fetchFn = this.getFetch();
|
|
230
|
+
const response = await fetchFn(`${this.restEndpoint}${path}`, {
|
|
231
|
+
...this.defaultOptions
|
|
232
|
+
});
|
|
233
|
+
if (!response.ok) {
|
|
234
|
+
throw new HttpError(
|
|
235
|
+
`HTTP error! status: ${response.status}`,
|
|
236
|
+
response.status
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
return await response.json();
|
|
241
|
+
} catch (error) {
|
|
242
|
+
throw new ParseError("Failed to parse JSON response");
|
|
243
|
+
}
|
|
244
|
+
} catch (error) {
|
|
245
|
+
if (error instanceof BaseError) {
|
|
246
|
+
throw error;
|
|
247
|
+
}
|
|
248
|
+
throw new HttpError(
|
|
249
|
+
`Failed to fetch REST: ${error.message}`,
|
|
250
|
+
500
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// src/libs/errors/types.ts
|
|
257
|
+
var ERROR = {
|
|
258
|
+
ERROR_ADDRESS_NOT_FOUND: "ERROR_ADDRESS_NOT_FOUND",
|
|
259
|
+
ERROR_CIRCUIT_NOT_FOUND: "ERROR_CIRCUIT_NOT_FOUND",
|
|
260
|
+
ERROR_OPERATOR_INVALID_ADDRESS: "ERROR_OPERATOR_INVALID_ADDRESS",
|
|
261
|
+
ERROR_OPERATOR_NOT_FOUND: "ERROR_OPERATOR_NOT_FOUND",
|
|
262
|
+
ERROR_OPERATORS_NOT_FOUND: "ERROR_OPERATORS_NOT_FOUND",
|
|
263
|
+
ERROR_PROOF_NOT_FOUND: "ERROR_PROOF_NOT_FOUND",
|
|
264
|
+
ERROR_ROUND_INVALID_ADDRESS: "ERROR_ROUND_INVALID_ADDRESS",
|
|
265
|
+
ERROR_ROUND_INVALID_STATUS: "ERROR_ROUND_INVALID_STATUS",
|
|
266
|
+
ERROR_ROUND_NOT_FOUND: "ERROR_ROUND_NOT_FOUND",
|
|
267
|
+
ERROR_ROUNDS_NOT_FOUND: "ERROR_ROUNDS_NOT_FOUND",
|
|
268
|
+
ERROR_TRANSACTION_NOT_FOUND: "ERROR_TRANSACTION_NOT_FOUND",
|
|
269
|
+
ERROR_TRANSACTIONS_NOT_FOUND: "ERROR_TRANSACTIONS_NOT_FOUND"
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
// src/libs/query/account.ts
|
|
273
|
+
var Account = class {
|
|
274
|
+
constructor(http) {
|
|
275
|
+
this.http = http;
|
|
276
|
+
}
|
|
277
|
+
async balanceOf(address) {
|
|
278
|
+
try {
|
|
279
|
+
const path = `/cosmos/bank/v1beta1/balances/${address}/by_denom?denom=peaka`;
|
|
280
|
+
const data = await this.http.fetchRest(path);
|
|
281
|
+
if (data["code"] === void 0) {
|
|
282
|
+
const response = {
|
|
283
|
+
code: 200,
|
|
284
|
+
data: {
|
|
285
|
+
balance: data["balance"]["amount"]
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
return response;
|
|
289
|
+
} else {
|
|
290
|
+
return {
|
|
291
|
+
code: 404,
|
|
292
|
+
error: {
|
|
293
|
+
message: "Address not found",
|
|
294
|
+
type: ERROR.ERROR_ADDRESS_NOT_FOUND
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
} catch (error) {
|
|
299
|
+
return handleError(error);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
// src/libs/const.ts
|
|
305
|
+
var circuits = {
|
|
306
|
+
"maci-1p1v": {
|
|
307
|
+
maciType: "MACI",
|
|
308
|
+
circuitType: "1p1v",
|
|
309
|
+
displayName: "MACI-1p1v",
|
|
310
|
+
repoUrl: "https://github.com/DoraFactory/Vota-Circuits/tree/main/circuits/maci",
|
|
311
|
+
zipUrl: "https://github.com/DoraFactory/Vota-Circuits/archive/refs/heads/main.zip"
|
|
312
|
+
},
|
|
313
|
+
"maci-qv": {
|
|
314
|
+
maciType: "MACI",
|
|
315
|
+
circuitType: "QV",
|
|
316
|
+
displayName: "MACI-QV",
|
|
317
|
+
repoUrl: "https://github.com/DoraFactory/Vota-Circuits/tree/main/circuits/maci",
|
|
318
|
+
zipUrl: "https://github.com/DoraFactory/Vota-Circuits/archive/refs/heads/main.zip"
|
|
319
|
+
},
|
|
320
|
+
"amaci-1p1v": {
|
|
321
|
+
maciType: "aMACI",
|
|
322
|
+
circuitType: "1p1v",
|
|
323
|
+
displayName: "aMACI-1p1v",
|
|
324
|
+
repoUrl: "https://github.com/DoraFactory/Vota-Circuits/tree/main/circuits/amaci",
|
|
325
|
+
zipUrl: "https://github.com/DoraFactory/Vota-Circuits/archive/refs/heads/main.zip"
|
|
326
|
+
},
|
|
327
|
+
"amaci-qv": {
|
|
328
|
+
maciType: "aMACI",
|
|
329
|
+
circuitType: "QV",
|
|
330
|
+
displayName: "aMACI-QV",
|
|
331
|
+
repoUrl: "https://github.com/DoraFactory/Vota-Circuits/tree/main/circuits/amaci",
|
|
332
|
+
zipUrl: "https://github.com/DoraFactory/Vota-Circuits/archive/refs/heads/main.zip"
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
var validator_operator_set = {
|
|
336
|
+
doravaloper12yk434ut3un4wx0rult2aww89rsrel8nhmp387: {
|
|
337
|
+
operator_address: "",
|
|
338
|
+
account_address: "dora12yk434ut3un4wx0rult2aww89rsrel8nydy83p",
|
|
339
|
+
allocation: "22571615985356796592128",
|
|
340
|
+
allocation_dora: 22571.615985356795,
|
|
341
|
+
moniker: "\u{1D425}\u{1D41E}\u{1D42C}\u{1D427}\u{1D422}\u{1D424} | \u{1D414}\u{1D413}\u{1D412}\u{1D400}",
|
|
342
|
+
program_voting_power: 0.06432895760166438,
|
|
343
|
+
tokens: "200731587709257889972292"
|
|
344
|
+
},
|
|
345
|
+
doravaloper15frh0nn3v4yp3vv6sk4pn6jg9l8rt82f7uqfk5: {
|
|
346
|
+
operator_address: "",
|
|
347
|
+
account_address: "dora15frh0nn3v4yp3vv6sk4pn6jg9l8rt82fd29lqt",
|
|
348
|
+
allocation: "33745159209325474873344",
|
|
349
|
+
allocation_dora: 33745.15920932547,
|
|
350
|
+
moniker: "NomadValidator",
|
|
351
|
+
program_voting_power: 0.09617348254756773,
|
|
352
|
+
tokens: "300099000000000000000000"
|
|
353
|
+
},
|
|
354
|
+
doravaloper1ddewp74vd2w8jhth2p0uazmc8ajgtcuf3ntqgn: {
|
|
355
|
+
operator_address: "",
|
|
356
|
+
account_address: "dora1ddewp74vd2w8jhth2p0uazmc8ajgtcufz9wk7v",
|
|
357
|
+
allocation: "40789397021635754590208",
|
|
358
|
+
allocation_dora: 40789.397021635756,
|
|
359
|
+
moniker: "polkachu.com",
|
|
360
|
+
program_voting_power: 0.11624951413777938,
|
|
361
|
+
tokens: "362744095556470434789338"
|
|
362
|
+
},
|
|
363
|
+
doravaloper1gh8j89jtc2vx6d3y4ehllcdlvluwa49w6xmjsm: {
|
|
364
|
+
operator_address: "",
|
|
365
|
+
account_address: "dora1gh8j89jtc2vx6d3y4ehllcdlvluwa49wfs7yxy",
|
|
366
|
+
allocation: "33743029941764137943040",
|
|
367
|
+
allocation_dora: 33743.029941764136,
|
|
368
|
+
moniker: "ITRocket",
|
|
369
|
+
program_voting_power: 0.09616741414897524,
|
|
370
|
+
tokens: "300080064215405665352721"
|
|
371
|
+
},
|
|
372
|
+
doravaloper1j8ru7p8zctup6grfwuga6ndrjj7v88wzn407x7: {
|
|
373
|
+
operator_address: "",
|
|
374
|
+
account_address: "dora1j8ru7p8zctup6grfwuga6ndrjj7v88wzqr2gsp",
|
|
375
|
+
allocation: "22646525272055477174272",
|
|
376
|
+
allocation_dora: 22646.525272055478,
|
|
377
|
+
moniker: "StakeUs",
|
|
378
|
+
program_voting_power: 0.06454244857772638,
|
|
379
|
+
tokens: "201397763319500000000000"
|
|
380
|
+
},
|
|
381
|
+
doravaloper1l5zz0kkjt2n7nllsrymy96mc2v2gehda0zc85s: {
|
|
382
|
+
operator_address: "",
|
|
383
|
+
account_address: "dora1l5zz0kkjt2n7nllsrymy96mc2v2gehdau5a3z0",
|
|
384
|
+
allocation: "22622846742220005965824",
|
|
385
|
+
allocation_dora: 22622.846742220005,
|
|
386
|
+
moniker: "BlackNodes",
|
|
387
|
+
program_voting_power: 0.06447496492290769,
|
|
388
|
+
tokens: "201187187838702364379121"
|
|
389
|
+
},
|
|
390
|
+
doravaloper1m9v3txhhtadjxpv09gwjhhs344qsxgfscwxjkg: {
|
|
391
|
+
operator_address: "",
|
|
392
|
+
account_address: "dora1m9v3txhhtadjxpv09gwjhhs344qsxgfstcryqh",
|
|
393
|
+
allocation: "22549006983854435598336",
|
|
394
|
+
allocation_dora: 22549.006983854437,
|
|
395
|
+
moniker: "\u{1F44B} 79anvi \u{1F340}",
|
|
396
|
+
program_voting_power: 0.06426452209558432,
|
|
397
|
+
tokens: "200530523648490887200824"
|
|
398
|
+
},
|
|
399
|
+
doravaloper1tu8006g60t62zwgwf5knkaujv0uzhp2a6wh94h: {
|
|
400
|
+
operator_address: "",
|
|
401
|
+
account_address: "dora1tu8006g60t62zwgwf5knkaujv0uzhp2afcjnrg",
|
|
402
|
+
allocation: "39369183740744815345664",
|
|
403
|
+
allocation_dora: 39369.18374074482,
|
|
404
|
+
moniker: "Citadel.one",
|
|
405
|
+
program_voting_power: 0.11220191559671686,
|
|
406
|
+
tokens: "350114000000000000000000"
|
|
407
|
+
},
|
|
408
|
+
doravaloper1x5z0tkafrgyeuqkrwfjr933vghjxchqnqlhcdw: {
|
|
409
|
+
operator_address: "",
|
|
410
|
+
account_address: "dora1x5z0tkafrgyeuqkrwfjr933vghjxchqnnfjwm3",
|
|
411
|
+
allocation: "22611521290904268701696",
|
|
412
|
+
allocation_dora: 22611.521290904268,
|
|
413
|
+
moniker: "1ce",
|
|
414
|
+
program_voting_power: 0.064442687460896,
|
|
415
|
+
tokens: "201086469492900000000000"
|
|
416
|
+
},
|
|
417
|
+
doravaloper1z6kfew2nhuh02szc2hdecw4fqey2d32auucvux: {
|
|
418
|
+
operator_address: "",
|
|
419
|
+
account_address: "dora1z6kfew2nhuh02szc2hdecw4fqey2d32a02a62e",
|
|
420
|
+
allocation: "45246951843662957379584",
|
|
421
|
+
allocation_dora: 45246.95184366296,
|
|
422
|
+
moniker: "Nodes.Guru",
|
|
423
|
+
program_voting_power: 0.12895351616135226,
|
|
424
|
+
tokens: "402385566389000000000006"
|
|
425
|
+
},
|
|
426
|
+
doravaloper1zzne8ufazycklx4j6mgc987t8ykd6wxu63223v: {
|
|
427
|
+
operator_address: "",
|
|
428
|
+
account_address: "dora1zzne8ufazycklx4j6mgc987t8ykd6wxu63223v",
|
|
429
|
+
allocation: "44982761968475888943104",
|
|
430
|
+
allocation_dora: 44982.76196847589,
|
|
431
|
+
moniker: "ZKV",
|
|
432
|
+
program_voting_power: 0.12820057674882976,
|
|
433
|
+
tokens: "400036100000000000000000"
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
function getDefaultParams(network = "mainnet") {
|
|
437
|
+
switch (network) {
|
|
438
|
+
case "mainnet":
|
|
439
|
+
return {
|
|
440
|
+
network: "mainnet",
|
|
441
|
+
chainId: "vota-ash",
|
|
442
|
+
rpcEndpoint: "https://vota-rpc.dorafactory.org",
|
|
443
|
+
restEndpoint: "https://vota-rest.dorafactory.org",
|
|
444
|
+
apiEndpoint: "https://vota-api.dorafactory.org",
|
|
445
|
+
certificateApiEndpoint: "https://vota-certificate-api.dorafactory.org",
|
|
446
|
+
registryAddress: "dora1smg5qp5trjdkcekdjssqpjehdjf6n4cjss0clyvqcud3t3u3948s8rmgg4",
|
|
447
|
+
maciCodeId: 106,
|
|
448
|
+
oracleCodeId: 111,
|
|
449
|
+
oracleWhitelistBackendPubkey: "A61YtCv2ibMZmDeM02nEElil8wlHx1tLKogBk5dPgf/Q",
|
|
450
|
+
oracleFeegrantOperator: "dora16s9tljk8dy9ae335yvyzlm8gvkypx9228q8pq8"
|
|
451
|
+
};
|
|
452
|
+
case "testnet":
|
|
453
|
+
return {
|
|
454
|
+
network: "testnet",
|
|
455
|
+
chainId: "vota-testnet",
|
|
456
|
+
rpcEndpoint: "https://vota-testnet-rpc.dorafactory.org",
|
|
457
|
+
restEndpoint: "https://vota-testnet-rest.dorafactory.org",
|
|
458
|
+
apiEndpoint: "https://vota-testnet-api.dorafactory.org",
|
|
459
|
+
certificateApiEndpoint: "https://vota-testnet-certificate-api.dorafactory.org",
|
|
460
|
+
registryAddress: "dora13c8aecstyxrhax9znvvh5zey89edrmd2k5va57pxvpe3fxtfsfeqlhsjnd",
|
|
461
|
+
maciCodeId: 107,
|
|
462
|
+
oracleCodeId: 110,
|
|
463
|
+
oracleWhitelistBackendPubkey: "AoYo/zENN/JquagPdG0/NMbWBBYxOM8BVN677mBXJKJQ",
|
|
464
|
+
oracleFeegrantOperator: "dora1xp0twdzsdeq4qg3c64v66552deax8zmvq4zw78"
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// src/libs/query/circuit.ts
|
|
470
|
+
var Circuit = class {
|
|
471
|
+
constructor(http) {
|
|
472
|
+
this.http = http;
|
|
473
|
+
}
|
|
474
|
+
async getCircuitByName(name) {
|
|
475
|
+
try {
|
|
476
|
+
const circuitName = name;
|
|
477
|
+
const circuitData = circuits[circuitName];
|
|
478
|
+
if (circuitData === void 0) {
|
|
479
|
+
return {
|
|
480
|
+
code: 404,
|
|
481
|
+
error: {
|
|
482
|
+
message: `Circuit ${circuitName} not found`,
|
|
483
|
+
type: ERROR.ERROR_CIRCUIT_NOT_FOUND
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
const CIRCUIT_ROUNDS_COUNT_QUERY = `
|
|
488
|
+
query {
|
|
489
|
+
rounds(filter: { circuitName: { equalTo: "${circuitData.displayName}" } }) {
|
|
490
|
+
totalCount
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
`;
|
|
494
|
+
const circuitRoundsCountResponse = await this.http.fetchGraphql(
|
|
495
|
+
CIRCUIT_ROUNDS_COUNT_QUERY,
|
|
496
|
+
""
|
|
497
|
+
);
|
|
498
|
+
circuitData.roundCount = circuitRoundsCountResponse.data.rounds.totalCount;
|
|
499
|
+
const response = {
|
|
500
|
+
code: 200,
|
|
501
|
+
data: {
|
|
502
|
+
circuit: circuitData
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
return response;
|
|
506
|
+
} catch (error) {
|
|
507
|
+
return handleError(error);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
async getCircuits() {
|
|
511
|
+
try {
|
|
512
|
+
const circuitsArray = Object.values(circuits).sort(
|
|
513
|
+
(a, b) => a.displayName.localeCompare(b.displayName)
|
|
514
|
+
);
|
|
515
|
+
const circuitsWithRoundCount = await Promise.all(
|
|
516
|
+
circuitsArray.map(async (circuit) => {
|
|
517
|
+
const CIRCUIT_ROUNDS_COUNT_QUERY = `
|
|
518
|
+
query {
|
|
519
|
+
rounds(filter: { circuitName: { equalTo: "${circuit.displayName}" } }) {
|
|
520
|
+
totalCount
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
`;
|
|
524
|
+
const circuitRoundsCountResponse = await this.http.fetchGraphql(CIRCUIT_ROUNDS_COUNT_QUERY, "");
|
|
525
|
+
return {
|
|
526
|
+
...circuit,
|
|
527
|
+
roundCount: circuitRoundsCountResponse.data.rounds.totalCount
|
|
528
|
+
};
|
|
529
|
+
})
|
|
530
|
+
);
|
|
531
|
+
const response = {
|
|
532
|
+
code: 200,
|
|
533
|
+
data: {
|
|
534
|
+
circuits: circuitsWithRoundCount
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
return response;
|
|
538
|
+
} catch (error) {
|
|
539
|
+
return handleError(error);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
// src/utils/index.ts
|
|
545
|
+
var import_bech32 = require("bech32");
|
|
546
|
+
function verifyIsBech32(address) {
|
|
547
|
+
try {
|
|
548
|
+
(0, import_bech32.decode)(address);
|
|
549
|
+
} catch (error) {
|
|
550
|
+
return error instanceof Error ? error : new Error("Unknown error");
|
|
551
|
+
}
|
|
552
|
+
return void 0;
|
|
553
|
+
}
|
|
554
|
+
function isValidAddress(address) {
|
|
555
|
+
return address.startsWith("dora") && verifyIsBech32(address) === void 0;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// src/libs/query/operator.ts
|
|
559
|
+
var Operator = class {
|
|
560
|
+
constructor(http, amaciRegistryContract) {
|
|
561
|
+
this.http = http;
|
|
562
|
+
this.amaciRegistryContract = amaciRegistryContract;
|
|
563
|
+
}
|
|
564
|
+
async getOperatorByAddress(address) {
|
|
565
|
+
try {
|
|
566
|
+
if (!isValidAddress(address)) {
|
|
567
|
+
return {
|
|
568
|
+
code: 400,
|
|
569
|
+
error: {
|
|
570
|
+
message: "Invalid operator address format",
|
|
571
|
+
type: ERROR.ERROR_OPERATOR_INVALID_ADDRESS
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
const OPERATORS_QUERY = `query {
|
|
576
|
+
operators(filter: { operatorAddress: { equalTo: "${address}" } }) {
|
|
577
|
+
edges {
|
|
578
|
+
node {
|
|
579
|
+
id
|
|
580
|
+
validatorAddress
|
|
581
|
+
operatorAddress
|
|
582
|
+
coordinatorPubkeyX
|
|
583
|
+
coordinatorPubkeyY
|
|
584
|
+
identity
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}`;
|
|
589
|
+
const response = await this.http.fetchGraphql(
|
|
590
|
+
OPERATORS_QUERY,
|
|
591
|
+
""
|
|
592
|
+
);
|
|
593
|
+
if (!response || !response.data || !response.data.operators || !response.data.operators.edges || response.data.operators.edges.length === 0) {
|
|
594
|
+
return {
|
|
595
|
+
code: 404,
|
|
596
|
+
error: {
|
|
597
|
+
message: `No operator found for address ${address}`,
|
|
598
|
+
type: ERROR.ERROR_OPERATOR_NOT_FOUND
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
const operatorResponse = response.data.operators.edges[0].node;
|
|
603
|
+
if (operatorResponse.operatorAddress === "" || operatorResponse.coordinatorPubkeyX === "") {
|
|
604
|
+
operatorResponse.activeRoundsCount = 0;
|
|
605
|
+
operatorResponse.completedRoundsCount = 0;
|
|
606
|
+
} else {
|
|
607
|
+
const ROUNDS_QUERY = `query {
|
|
608
|
+
activeRoundsCount: rounds(filter: {
|
|
609
|
+
period: {notEqualTo: "Ended"},
|
|
610
|
+
operator: {equalTo: "${operatorResponse.operatorAddress}"},
|
|
611
|
+
caller: {equalTo: "${this.amaciRegistryContract}"}
|
|
612
|
+
}) {
|
|
613
|
+
totalCount
|
|
614
|
+
}
|
|
615
|
+
completedRoundsCount: rounds(filter: {
|
|
616
|
+
period: {equalTo: "Ended"},
|
|
617
|
+
operator: {equalTo: "${operatorResponse.operatorAddress}"},
|
|
618
|
+
caller: {equalTo: "${this.amaciRegistryContract}"}
|
|
619
|
+
}) {
|
|
620
|
+
totalCount
|
|
621
|
+
}
|
|
622
|
+
}`;
|
|
623
|
+
const roundsCount = await this.http.fetchGraphql(
|
|
624
|
+
ROUNDS_QUERY,
|
|
625
|
+
""
|
|
626
|
+
);
|
|
627
|
+
operatorResponse.activeRoundsCount = roundsCount.data.activeRoundsCount.totalCount;
|
|
628
|
+
operatorResponse.completedRoundsCount = roundsCount.data.completedRoundsCount.totalCount;
|
|
629
|
+
}
|
|
630
|
+
operatorResponse.logoUrl = "";
|
|
631
|
+
operatorResponse.moniker = "";
|
|
632
|
+
const identity = response.data.operators.edges[0].node.identity;
|
|
633
|
+
const keybaseUrl = `https://keybase.io/_/api/1.0/user/lookup.json?key_suffix=${identity}`;
|
|
634
|
+
const keybaseResponse = await this.http.fetch(keybaseUrl);
|
|
635
|
+
const keybaseData = await keybaseResponse.json();
|
|
636
|
+
if (keybaseData.status.code === 0) {
|
|
637
|
+
if (keybaseData.them[0]?.pictures?.primary?.url) {
|
|
638
|
+
operatorResponse.logoUrl = keybaseData.them[0].pictures.primary.url;
|
|
639
|
+
}
|
|
640
|
+
if (keybaseData.them[0]?.basics?.username_cased) {
|
|
641
|
+
operatorResponse.moniker = keybaseData.them[0].profile.full_name;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
const operator = {
|
|
645
|
+
code: 200,
|
|
646
|
+
data: {
|
|
647
|
+
operator: operatorResponse
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
return operator;
|
|
651
|
+
} catch (error) {
|
|
652
|
+
return handleError(error);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
async getOperators(after, limit) {
|
|
656
|
+
try {
|
|
657
|
+
const OPERATORS_QUERY = `query ($limit: Int, $after: Cursor) {
|
|
658
|
+
operators(first: $limit, after: $after) {
|
|
659
|
+
pageInfo {
|
|
660
|
+
endCursor
|
|
661
|
+
hasNextPage
|
|
662
|
+
}
|
|
663
|
+
totalCount
|
|
664
|
+
edges {
|
|
665
|
+
cursor
|
|
666
|
+
node {
|
|
667
|
+
id
|
|
668
|
+
validatorAddress
|
|
669
|
+
operatorAddress
|
|
670
|
+
coordinatorPubkeyX
|
|
671
|
+
coordinatorPubkeyY
|
|
672
|
+
identity
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}`;
|
|
677
|
+
const response = await this.http.fetchGraphql(
|
|
678
|
+
OPERATORS_QUERY,
|
|
679
|
+
after,
|
|
680
|
+
limit
|
|
681
|
+
);
|
|
682
|
+
if (!response || !response.data || !response.data.operators || !response.data.operators.edges) {
|
|
683
|
+
return {
|
|
684
|
+
code: 404,
|
|
685
|
+
error: {
|
|
686
|
+
message: "No operators found",
|
|
687
|
+
type: ERROR.ERROR_OPERATORS_NOT_FOUND
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
const operatorsWithRounds = await Promise.all(
|
|
692
|
+
response.data.operators.edges.map(async (edge) => {
|
|
693
|
+
const operator = edge.node;
|
|
694
|
+
if (operator.operatorAddress === "" || operator.coordinatorPubkeyX === "") {
|
|
695
|
+
operator.activeRoundsCount = 0;
|
|
696
|
+
operator.completedRoundsCount = 0;
|
|
697
|
+
return operator;
|
|
698
|
+
}
|
|
699
|
+
const ROUNDS_QUERY = `query {
|
|
700
|
+
activeRoundsCount: rounds(filter: {
|
|
701
|
+
period: {notEqualTo: "Ended"},
|
|
702
|
+
operator: {equalTo: "${operator.operatorAddress}"},
|
|
703
|
+
caller: {equalTo: "${this.amaciRegistryContract}"}
|
|
704
|
+
}) {
|
|
705
|
+
totalCount
|
|
706
|
+
}
|
|
707
|
+
completedRoundsCount: rounds(filter: {
|
|
708
|
+
period: {equalTo: "Ended"},
|
|
709
|
+
operator: {equalTo: "${operator.operatorAddress}"},
|
|
710
|
+
caller: {equalTo: "${this.amaciRegistryContract}"}
|
|
711
|
+
}) {
|
|
712
|
+
totalCount
|
|
713
|
+
}
|
|
714
|
+
}`;
|
|
715
|
+
const roundsCount = await this.http.fetchGraphql(
|
|
716
|
+
ROUNDS_QUERY,
|
|
717
|
+
""
|
|
718
|
+
);
|
|
719
|
+
operator.activeRoundsCount = roundsCount.data.activeRoundsCount.totalCount;
|
|
720
|
+
operator.completedRoundsCount = roundsCount.data.completedRoundsCount.totalCount;
|
|
721
|
+
return operator;
|
|
722
|
+
})
|
|
723
|
+
);
|
|
724
|
+
response.data.operators.edges = operatorsWithRounds.map(
|
|
725
|
+
(operator, index) => ({
|
|
726
|
+
cursor: response.data.operators.edges[index].cursor,
|
|
727
|
+
node: operator
|
|
728
|
+
})
|
|
729
|
+
);
|
|
730
|
+
await Promise.all(
|
|
731
|
+
response.data.operators.edges.map(async (edge) => {
|
|
732
|
+
const operator = edge.node;
|
|
733
|
+
const identity = operator.identity;
|
|
734
|
+
operator.logoUrl = "";
|
|
735
|
+
operator.moniker = "";
|
|
736
|
+
const keybaseUrl = `https://keybase.io/_/api/1.0/user/lookup.json?key_suffix=${identity}`;
|
|
737
|
+
const keybaseResponse = await this.http.fetch(keybaseUrl);
|
|
738
|
+
const keybaseData = await keybaseResponse.json();
|
|
739
|
+
if (keybaseData.status.code === 0) {
|
|
740
|
+
if (keybaseData.them[0]?.pictures?.primary?.url) {
|
|
741
|
+
operator.logoUrl = keybaseData.them[0].pictures.primary.url;
|
|
742
|
+
}
|
|
743
|
+
if (keybaseData.them[0]?.basics?.username_cased) {
|
|
744
|
+
operator.moniker = keybaseData.them[0].profile.full_name;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
return operator;
|
|
748
|
+
})
|
|
749
|
+
);
|
|
750
|
+
return {
|
|
751
|
+
code: 200,
|
|
752
|
+
data: response.data
|
|
753
|
+
};
|
|
754
|
+
} catch (error) {
|
|
755
|
+
return handleError(error);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
// src/libs/query/round.ts
|
|
761
|
+
var Round = class {
|
|
762
|
+
constructor(http) {
|
|
763
|
+
this.http = http;
|
|
764
|
+
}
|
|
765
|
+
async getRoundById(address) {
|
|
766
|
+
try {
|
|
767
|
+
if (!isValidAddress(address)) {
|
|
768
|
+
return {
|
|
769
|
+
code: 400,
|
|
770
|
+
error: {
|
|
771
|
+
message: "Invalid round address format",
|
|
772
|
+
type: ERROR.ERROR_ROUND_INVALID_ADDRESS
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
const ROUND_QUERY = `query {
|
|
777
|
+
round(id: "${address}") {
|
|
778
|
+
id
|
|
779
|
+
blockHeight
|
|
780
|
+
txHash
|
|
781
|
+
caller
|
|
782
|
+
admin
|
|
783
|
+
operator
|
|
784
|
+
contractAddress
|
|
785
|
+
circuitName
|
|
786
|
+
timestamp
|
|
787
|
+
votingStart
|
|
788
|
+
votingEnd
|
|
789
|
+
status
|
|
790
|
+
period
|
|
791
|
+
actionType
|
|
792
|
+
roundTitle
|
|
793
|
+
roundDescription
|
|
794
|
+
roundLink
|
|
795
|
+
coordinatorPubkeyX
|
|
796
|
+
coordinatorPubkeyY
|
|
797
|
+
voteOptionMap
|
|
798
|
+
results
|
|
799
|
+
allResult
|
|
800
|
+
gasStationEnable
|
|
801
|
+
totalGrant
|
|
802
|
+
baseGrant
|
|
803
|
+
totalBond
|
|
804
|
+
circuitType
|
|
805
|
+
circuitPower
|
|
806
|
+
certificationSystem
|
|
807
|
+
codeId
|
|
808
|
+
maciType
|
|
809
|
+
voiceCreditAmount
|
|
810
|
+
preDeactivateRoot
|
|
811
|
+
identity
|
|
812
|
+
}
|
|
813
|
+
}`;
|
|
814
|
+
const response = await this.http.fetchGraphql(
|
|
815
|
+
ROUND_QUERY,
|
|
816
|
+
""
|
|
817
|
+
);
|
|
818
|
+
if (!response || !response.data || !response.data.round) {
|
|
819
|
+
return {
|
|
820
|
+
code: 404,
|
|
821
|
+
error: {
|
|
822
|
+
message: `No round data found for address ${address}`,
|
|
823
|
+
type: ERROR.ERROR_ROUND_NOT_FOUND
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
}
|
|
827
|
+
response.data.round.operatorLogoUrl = "";
|
|
828
|
+
response.data.round.operatorMoniker = "";
|
|
829
|
+
const identity = response.data.round.identity;
|
|
830
|
+
const keybaseUrl = `https://keybase.io/_/api/1.0/user/lookup.json?key_suffix=${identity}`;
|
|
831
|
+
const keybaseResponse = await this.http.fetch(keybaseUrl);
|
|
832
|
+
const keybaseData = await keybaseResponse.json();
|
|
833
|
+
if (keybaseData.status.code === 0) {
|
|
834
|
+
if (keybaseData.them[0]?.pictures?.primary?.url) {
|
|
835
|
+
response.data.round.operatorLogoUrl = keybaseData.them[0].pictures.primary.url;
|
|
836
|
+
}
|
|
837
|
+
if (keybaseData.them[0]?.basics?.username_cased) {
|
|
838
|
+
response.data.round.operatorMoniker = keybaseData.them[0].profile.full_name;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
const results = JSON.parse(response.data.round.results);
|
|
842
|
+
const votes = results.map((r) => ({
|
|
843
|
+
v: Number(r.slice(0, -24)),
|
|
844
|
+
v2: Number(r.slice(-24))
|
|
845
|
+
}));
|
|
846
|
+
const totalVotes = votes.reduce(
|
|
847
|
+
(s, c) => ({
|
|
848
|
+
v: s.v + c.v,
|
|
849
|
+
v2: s.v2 + c.v2
|
|
850
|
+
}),
|
|
851
|
+
{ v: 0, v2: 0 }
|
|
852
|
+
);
|
|
853
|
+
const resultsList = votes.map((v) => ({
|
|
854
|
+
v: totalVotes.v === 0 ? "0.0" : (v.v / totalVotes.v * 100).toFixed(3),
|
|
855
|
+
v2: totalVotes.v2 === 0 ? "0.0" : (v.v2 / totalVotes.v2 * 100).toFixed(3)
|
|
856
|
+
}));
|
|
857
|
+
response.data.round.resultsList = resultsList;
|
|
858
|
+
return {
|
|
859
|
+
code: 200,
|
|
860
|
+
data: response.data
|
|
861
|
+
};
|
|
862
|
+
} catch (error) {
|
|
863
|
+
return handleError(error);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
async getRounds(after, limit) {
|
|
867
|
+
try {
|
|
868
|
+
const ROUND_HISTORY_QUERY = `query ($limit: Int, $after: Cursor) {
|
|
869
|
+
rounds(first: $limit, after: $after, orderBy: [TIMESTAMP_DESC]){
|
|
870
|
+
pageInfo {
|
|
871
|
+
endCursor
|
|
872
|
+
hasNextPage
|
|
873
|
+
}
|
|
874
|
+
totalCount
|
|
875
|
+
edges {
|
|
876
|
+
node {
|
|
877
|
+
id
|
|
878
|
+
blockHeight
|
|
879
|
+
txHash
|
|
880
|
+
caller
|
|
881
|
+
admin
|
|
882
|
+
operator
|
|
883
|
+
contractAddress
|
|
884
|
+
circuitName
|
|
885
|
+
timestamp
|
|
886
|
+
votingStart
|
|
887
|
+
votingEnd
|
|
888
|
+
status
|
|
889
|
+
period
|
|
890
|
+
actionType
|
|
891
|
+
roundTitle
|
|
892
|
+
roundDescription
|
|
893
|
+
roundLink
|
|
894
|
+
coordinatorPubkeyX
|
|
895
|
+
coordinatorPubkeyY
|
|
896
|
+
voteOptionMap
|
|
897
|
+
results
|
|
898
|
+
allResult
|
|
899
|
+
gasStationEnable
|
|
900
|
+
totalGrant
|
|
901
|
+
baseGrant
|
|
902
|
+
totalBond
|
|
903
|
+
circuitType
|
|
904
|
+
circuitPower
|
|
905
|
+
certificationSystem
|
|
906
|
+
codeId
|
|
907
|
+
maciType
|
|
908
|
+
voiceCreditAmount
|
|
909
|
+
preDeactivateRoot
|
|
910
|
+
}
|
|
911
|
+
cursor
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
`;
|
|
916
|
+
const response = await this.http.fetchGraphql(
|
|
917
|
+
ROUND_HISTORY_QUERY,
|
|
918
|
+
after,
|
|
919
|
+
limit
|
|
920
|
+
);
|
|
921
|
+
if (!response || !response.data || !response.data.rounds || !response.data.rounds.edges) {
|
|
922
|
+
return {
|
|
923
|
+
code: 404,
|
|
924
|
+
error: {
|
|
925
|
+
message: "No rounds data found",
|
|
926
|
+
type: ERROR.ERROR_ROUNDS_NOT_FOUND
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
return {
|
|
931
|
+
code: 200,
|
|
932
|
+
data: response.data
|
|
933
|
+
};
|
|
934
|
+
} catch (error) {
|
|
935
|
+
return handleError(error);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
async getRoundsByCircuitName(circuitName, after, limit) {
|
|
939
|
+
try {
|
|
940
|
+
const ROUND_HISTORY_QUERY = `query ($limit: Int, $after: Cursor) {
|
|
941
|
+
rounds(first: $limit, after: $after, filter:{
|
|
942
|
+
circuitName:{
|
|
943
|
+
equalTo: "${circuitName}"
|
|
944
|
+
}
|
|
945
|
+
}, orderBy: [TIMESTAMP_DESC]){
|
|
946
|
+
pageInfo {
|
|
947
|
+
endCursor
|
|
948
|
+
hasNextPage
|
|
949
|
+
}
|
|
950
|
+
totalCount
|
|
951
|
+
edges {
|
|
952
|
+
cursor
|
|
953
|
+
node {
|
|
954
|
+
id
|
|
955
|
+
blockHeight
|
|
956
|
+
txHash
|
|
957
|
+
caller
|
|
958
|
+
admin
|
|
959
|
+
operator
|
|
960
|
+
contractAddress
|
|
961
|
+
circuitName
|
|
962
|
+
timestamp
|
|
963
|
+
votingStart
|
|
964
|
+
votingEnd
|
|
965
|
+
status
|
|
966
|
+
period
|
|
967
|
+
actionType
|
|
968
|
+
roundTitle
|
|
969
|
+
roundDescription
|
|
970
|
+
roundLink
|
|
971
|
+
coordinatorPubkeyX
|
|
972
|
+
coordinatorPubkeyY
|
|
973
|
+
voteOptionMap
|
|
974
|
+
results
|
|
975
|
+
allResult
|
|
976
|
+
gasStationEnable
|
|
977
|
+
totalGrant
|
|
978
|
+
baseGrant
|
|
979
|
+
totalBond
|
|
980
|
+
circuitType
|
|
981
|
+
circuitPower
|
|
982
|
+
certificationSystem
|
|
983
|
+
codeId
|
|
984
|
+
maciType
|
|
985
|
+
voiceCreditAmount
|
|
986
|
+
preDeactivateRoot
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
`;
|
|
992
|
+
const response = await this.http.fetchGraphql(
|
|
993
|
+
ROUND_HISTORY_QUERY,
|
|
994
|
+
after,
|
|
995
|
+
limit
|
|
996
|
+
);
|
|
997
|
+
if (!response || !response.data || !response.data.rounds || !response.data.rounds.edges) {
|
|
998
|
+
return {
|
|
999
|
+
code: 404,
|
|
1000
|
+
error: {
|
|
1001
|
+
message: `No rounds data found for circuit name ${circuitName}`,
|
|
1002
|
+
type: ERROR.ERROR_ROUNDS_NOT_FOUND
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
return {
|
|
1007
|
+
code: 200,
|
|
1008
|
+
data: response.data
|
|
1009
|
+
};
|
|
1010
|
+
} catch (error) {
|
|
1011
|
+
return handleError(error);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
async getRoundsByStatus(status, after, limit) {
|
|
1015
|
+
try {
|
|
1016
|
+
const currentTime = Math.floor(Date.now() / 1e3);
|
|
1017
|
+
let filterCondition = "";
|
|
1018
|
+
switch (status) {
|
|
1019
|
+
case "Created":
|
|
1020
|
+
filterCondition = `
|
|
1021
|
+
or: [
|
|
1022
|
+
{ votingStart: { equalTo: "0" } },
|
|
1023
|
+
{ and: [
|
|
1024
|
+
{ votingStart: { notEqualTo: "0" } },
|
|
1025
|
+
{ votingStart: { greaterThan: "${currentTime.toString()}" } }
|
|
1026
|
+
] }
|
|
1027
|
+
]
|
|
1028
|
+
`;
|
|
1029
|
+
break;
|
|
1030
|
+
case "Ongoing":
|
|
1031
|
+
filterCondition = `
|
|
1032
|
+
or: [
|
|
1033
|
+
{ votingStart: { equalTo: "0" }},
|
|
1034
|
+
{ votingStart: { lessThanOrEqualTo: "${currentTime.toString()}" }, votingEnd: { greaterThan: "${currentTime.toString()}" } }
|
|
1035
|
+
]
|
|
1036
|
+
`;
|
|
1037
|
+
break;
|
|
1038
|
+
case "Tallying":
|
|
1039
|
+
filterCondition = `
|
|
1040
|
+
and: [
|
|
1041
|
+
{ status: { notEqualTo: "Closed" } },
|
|
1042
|
+
{ votingEnd: { lessThan: "${currentTime.toString()}" } },
|
|
1043
|
+
{ votingEnd: { notEqualTo: "0" } }
|
|
1044
|
+
]
|
|
1045
|
+
`;
|
|
1046
|
+
break;
|
|
1047
|
+
case "Closed":
|
|
1048
|
+
filterCondition = `status: { equalTo: "Closed" }`;
|
|
1049
|
+
break;
|
|
1050
|
+
default:
|
|
1051
|
+
return {
|
|
1052
|
+
code: 400,
|
|
1053
|
+
error: {
|
|
1054
|
+
message: `Invalid status: ${status}`,
|
|
1055
|
+
type: ERROR.ERROR_ROUND_INVALID_STATUS
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
const ROUND_HISTORY_QUERY = `query ($limit: Int!, $after: Cursor) {
|
|
1060
|
+
rounds(first: $limit, after: $after, filter: { ${filterCondition} }, orderBy: [TIMESTAMP_DESC]) {
|
|
1061
|
+
pageInfo {
|
|
1062
|
+
endCursor
|
|
1063
|
+
hasNextPage
|
|
1064
|
+
}
|
|
1065
|
+
totalCount
|
|
1066
|
+
edges {
|
|
1067
|
+
cursor
|
|
1068
|
+
node {
|
|
1069
|
+
id
|
|
1070
|
+
blockHeight
|
|
1071
|
+
txHash
|
|
1072
|
+
caller
|
|
1073
|
+
admin
|
|
1074
|
+
operator
|
|
1075
|
+
contractAddress
|
|
1076
|
+
circuitName
|
|
1077
|
+
timestamp
|
|
1078
|
+
votingStart
|
|
1079
|
+
votingEnd
|
|
1080
|
+
status
|
|
1081
|
+
period
|
|
1082
|
+
actionType
|
|
1083
|
+
roundTitle
|
|
1084
|
+
roundDescription
|
|
1085
|
+
roundLink
|
|
1086
|
+
coordinatorPubkeyX
|
|
1087
|
+
coordinatorPubkeyY
|
|
1088
|
+
voteOptionMap
|
|
1089
|
+
results
|
|
1090
|
+
allResult
|
|
1091
|
+
gasStationEnable
|
|
1092
|
+
totalGrant
|
|
1093
|
+
baseGrant
|
|
1094
|
+
totalBond
|
|
1095
|
+
circuitType
|
|
1096
|
+
circuitPower
|
|
1097
|
+
certificationSystem
|
|
1098
|
+
codeId
|
|
1099
|
+
maciType
|
|
1100
|
+
voiceCreditAmount
|
|
1101
|
+
preDeactivateRoot
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}`;
|
|
1106
|
+
const response = await this.http.fetchGraphql(
|
|
1107
|
+
ROUND_HISTORY_QUERY,
|
|
1108
|
+
after,
|
|
1109
|
+
limit
|
|
1110
|
+
);
|
|
1111
|
+
if (!response || !response.data || !response.data.rounds || !response.data.rounds.edges) {
|
|
1112
|
+
return {
|
|
1113
|
+
code: 404,
|
|
1114
|
+
error: {
|
|
1115
|
+
message: `No rounds data found for status ${status}`,
|
|
1116
|
+
type: ERROR.ERROR_ROUNDS_NOT_FOUND
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
return {
|
|
1121
|
+
code: 200,
|
|
1122
|
+
data: response.data
|
|
1123
|
+
};
|
|
1124
|
+
} catch (error) {
|
|
1125
|
+
return handleError(error);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
async getRoundsByOperator(operator, after, limit) {
|
|
1129
|
+
try {
|
|
1130
|
+
if (!isValidAddress(operator)) {
|
|
1131
|
+
return {
|
|
1132
|
+
code: 400,
|
|
1133
|
+
error: {
|
|
1134
|
+
message: "Invalid operator address format",
|
|
1135
|
+
type: ERROR.ERROR_OPERATOR_INVALID_ADDRESS
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
const ROUND_HISTORY_QUERY = `query ($limit: Int!, $after: Cursor) {
|
|
1140
|
+
rounds(first: $limit, after: $after, filter:{
|
|
1141
|
+
operator:{
|
|
1142
|
+
equalTo: "${operator}"
|
|
1143
|
+
}
|
|
1144
|
+
}, orderBy: [TIMESTAMP_DESC]){
|
|
1145
|
+
pageInfo {
|
|
1146
|
+
endCursor
|
|
1147
|
+
hasNextPage
|
|
1148
|
+
}
|
|
1149
|
+
totalCount
|
|
1150
|
+
edges {
|
|
1151
|
+
cursor
|
|
1152
|
+
node {
|
|
1153
|
+
id
|
|
1154
|
+
blockHeight
|
|
1155
|
+
txHash
|
|
1156
|
+
caller
|
|
1157
|
+
admin
|
|
1158
|
+
operator
|
|
1159
|
+
contractAddress
|
|
1160
|
+
circuitName
|
|
1161
|
+
timestamp
|
|
1162
|
+
votingStart
|
|
1163
|
+
votingEnd
|
|
1164
|
+
status
|
|
1165
|
+
period
|
|
1166
|
+
actionType
|
|
1167
|
+
roundTitle
|
|
1168
|
+
roundDescription
|
|
1169
|
+
roundLink
|
|
1170
|
+
coordinatorPubkeyX
|
|
1171
|
+
coordinatorPubkeyY
|
|
1172
|
+
voteOptionMap
|
|
1173
|
+
results
|
|
1174
|
+
allResult
|
|
1175
|
+
gasStationEnable
|
|
1176
|
+
totalGrant
|
|
1177
|
+
baseGrant
|
|
1178
|
+
totalBond
|
|
1179
|
+
circuitType
|
|
1180
|
+
circuitPower
|
|
1181
|
+
certificationSystem
|
|
1182
|
+
codeId
|
|
1183
|
+
maciType
|
|
1184
|
+
voiceCreditAmount
|
|
1185
|
+
preDeactivateRoot
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
}`;
|
|
1190
|
+
const response = await this.http.fetchGraphql(
|
|
1191
|
+
ROUND_HISTORY_QUERY,
|
|
1192
|
+
after,
|
|
1193
|
+
limit
|
|
1194
|
+
);
|
|
1195
|
+
if (!response || !response.data || !response.data.rounds || !response.data.rounds.edges) {
|
|
1196
|
+
return {
|
|
1197
|
+
code: 404,
|
|
1198
|
+
error: {
|
|
1199
|
+
message: `No rounds data found for operator ${operator}`,
|
|
1200
|
+
type: ERROR.ERROR_ROUNDS_NOT_FOUND
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
return {
|
|
1205
|
+
code: 200,
|
|
1206
|
+
data: response.data
|
|
1207
|
+
};
|
|
1208
|
+
} catch (error) {
|
|
1209
|
+
return handleError(error);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
// src/libs/query/transaction.ts
|
|
1215
|
+
var Transaction = class {
|
|
1216
|
+
constructor(http) {
|
|
1217
|
+
this.http = http;
|
|
1218
|
+
}
|
|
1219
|
+
async getTransactionByHash(txHash) {
|
|
1220
|
+
try {
|
|
1221
|
+
const TRANSACTION_QUERY = `query {
|
|
1222
|
+
transaction(id: "${txHash}") {
|
|
1223
|
+
id
|
|
1224
|
+
blockHeight
|
|
1225
|
+
txHash
|
|
1226
|
+
timestamp
|
|
1227
|
+
type
|
|
1228
|
+
status
|
|
1229
|
+
circuitName
|
|
1230
|
+
fee
|
|
1231
|
+
gasUsed
|
|
1232
|
+
gasWanted
|
|
1233
|
+
caller
|
|
1234
|
+
contractAddress
|
|
1235
|
+
}
|
|
1236
|
+
}`;
|
|
1237
|
+
const response = await this.http.fetchGraphql(
|
|
1238
|
+
TRANSACTION_QUERY,
|
|
1239
|
+
""
|
|
1240
|
+
);
|
|
1241
|
+
if (!response || !response.data || !response.data.transaction) {
|
|
1242
|
+
return {
|
|
1243
|
+
code: 404,
|
|
1244
|
+
error: {
|
|
1245
|
+
message: `No transaction found for txHash ${txHash}`,
|
|
1246
|
+
type: ERROR.ERROR_TRANSACTION_NOT_FOUND
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
return {
|
|
1251
|
+
code: 200,
|
|
1252
|
+
data: response.data
|
|
1253
|
+
};
|
|
1254
|
+
} catch (error) {
|
|
1255
|
+
return handleError(error);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
async getTransactions(after, limit) {
|
|
1259
|
+
try {
|
|
1260
|
+
const TRANSACTION_HISTORY_QUERY = `query transactions($limit: Int, $after: Cursor) {
|
|
1261
|
+
transactions(first: $limit, after: $after, orderBy: [TIMESTAMP_DESC]
|
|
1262
|
+
){
|
|
1263
|
+
pageInfo {
|
|
1264
|
+
endCursor
|
|
1265
|
+
hasNextPage
|
|
1266
|
+
}
|
|
1267
|
+
totalCount
|
|
1268
|
+
edges {
|
|
1269
|
+
cursor
|
|
1270
|
+
node {
|
|
1271
|
+
id
|
|
1272
|
+
blockHeight
|
|
1273
|
+
txHash
|
|
1274
|
+
timestamp
|
|
1275
|
+
type
|
|
1276
|
+
status
|
|
1277
|
+
circuitName
|
|
1278
|
+
fee
|
|
1279
|
+
gasUsed
|
|
1280
|
+
gasWanted
|
|
1281
|
+
caller
|
|
1282
|
+
contractAddress
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}`;
|
|
1287
|
+
const response = await this.http.fetchGraphql(
|
|
1288
|
+
TRANSACTION_HISTORY_QUERY,
|
|
1289
|
+
after,
|
|
1290
|
+
limit
|
|
1291
|
+
);
|
|
1292
|
+
if (!response || !response.data || !response.data.transactions || !response.data.transactions.edges) {
|
|
1293
|
+
return {
|
|
1294
|
+
code: 404,
|
|
1295
|
+
error: {
|
|
1296
|
+
message: "No transactions data found",
|
|
1297
|
+
type: ERROR.ERROR_TRANSACTIONS_NOT_FOUND
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
return {
|
|
1302
|
+
code: 200,
|
|
1303
|
+
data: response.data
|
|
1304
|
+
};
|
|
1305
|
+
} catch (error) {
|
|
1306
|
+
return handleError(error);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
async getTransactionsByContractAddress(address, after, limit) {
|
|
1310
|
+
try {
|
|
1311
|
+
if (!isValidAddress(address)) {
|
|
1312
|
+
return {
|
|
1313
|
+
code: 400,
|
|
1314
|
+
error: {
|
|
1315
|
+
message: "Invalid round address format",
|
|
1316
|
+
type: ERROR.ERROR_ROUND_INVALID_ADDRESS
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
const TRANSACTION_HISTORY_QUERY = `query transactions($limit: Int!, $after: Cursor) {
|
|
1321
|
+
transactions(first: $limit, after: $after, filter:{
|
|
1322
|
+
contractAddress:{
|
|
1323
|
+
equalTo: "${address}"
|
|
1324
|
+
}
|
|
1325
|
+
}, orderBy: [TIMESTAMP_DESC]
|
|
1326
|
+
){
|
|
1327
|
+
pageInfo {
|
|
1328
|
+
endCursor
|
|
1329
|
+
hasNextPage
|
|
1330
|
+
}
|
|
1331
|
+
totalCount
|
|
1332
|
+
edges {
|
|
1333
|
+
cursor
|
|
1334
|
+
node {
|
|
1335
|
+
id
|
|
1336
|
+
blockHeight
|
|
1337
|
+
txHash
|
|
1338
|
+
timestamp
|
|
1339
|
+
type
|
|
1340
|
+
status
|
|
1341
|
+
circuitName
|
|
1342
|
+
fee
|
|
1343
|
+
gasUsed
|
|
1344
|
+
gasWanted
|
|
1345
|
+
caller
|
|
1346
|
+
contractAddress
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
}`;
|
|
1351
|
+
const response = await this.http.fetchGraphql(
|
|
1352
|
+
TRANSACTION_HISTORY_QUERY,
|
|
1353
|
+
after,
|
|
1354
|
+
limit
|
|
1355
|
+
);
|
|
1356
|
+
if (!response || !response.data || !response.data.transactions || !response.data.transactions.edges) {
|
|
1357
|
+
return {
|
|
1358
|
+
code: 404,
|
|
1359
|
+
error: {
|
|
1360
|
+
message: "No transactions data found",
|
|
1361
|
+
type: ERROR.ERROR_TRANSACTIONS_NOT_FOUND
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
}
|
|
1365
|
+
return {
|
|
1366
|
+
code: 200,
|
|
1367
|
+
data: response.data
|
|
1368
|
+
};
|
|
1369
|
+
} catch (error) {
|
|
1370
|
+
return handleError(error);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
|
|
1375
|
+
// src/libs/query/proof.ts
|
|
1376
|
+
var Proof = class {
|
|
1377
|
+
constructor(http) {
|
|
1378
|
+
this.http = http;
|
|
1379
|
+
}
|
|
1380
|
+
async getProofByContractAddress(address) {
|
|
1381
|
+
try {
|
|
1382
|
+
if (!isValidAddress(address)) {
|
|
1383
|
+
return {
|
|
1384
|
+
code: 400,
|
|
1385
|
+
error: {
|
|
1386
|
+
message: "Invalid round address format",
|
|
1387
|
+
type: ERROR.ERROR_ROUND_INVALID_ADDRESS
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
const PROOF_QUERY = `query HomePage {
|
|
1392
|
+
proofData(first: 100, filter:{
|
|
1393
|
+
contractAddress:{
|
|
1394
|
+
equalTo: "${address}"
|
|
1395
|
+
}
|
|
1396
|
+
} ,orderBy: [TIMESTAMP_DESC]
|
|
1397
|
+
){
|
|
1398
|
+
nodes {
|
|
1399
|
+
id
|
|
1400
|
+
blockHeight
|
|
1401
|
+
txHash
|
|
1402
|
+
contractAddress
|
|
1403
|
+
timestamp
|
|
1404
|
+
actionType
|
|
1405
|
+
commitment
|
|
1406
|
+
proof
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
`;
|
|
1411
|
+
const response = await this.http.fetchGraphql(
|
|
1412
|
+
PROOF_QUERY,
|
|
1413
|
+
""
|
|
1414
|
+
);
|
|
1415
|
+
if (!response || !response.data || !response.data.proofData || !response.data.proofData.nodes || response.data.proofData.nodes.length === 0) {
|
|
1416
|
+
return {
|
|
1417
|
+
code: 404,
|
|
1418
|
+
error: {
|
|
1419
|
+
message: `No proof found for round address ${address}`,
|
|
1420
|
+
type: ERROR.ERROR_PROOF_NOT_FOUND
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
return {
|
|
1425
|
+
code: 200,
|
|
1426
|
+
data: response.data
|
|
1427
|
+
};
|
|
1428
|
+
} catch (error) {
|
|
1429
|
+
return handleError(error);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
|
|
1434
|
+
// src/libs/indexer/indexer.ts
|
|
1435
|
+
var Indexer = class {
|
|
1436
|
+
/**
|
|
1437
|
+
* @constructor
|
|
1438
|
+
* @param {IndexerParams} params - The parameters for the Maci Indexer instance.
|
|
1439
|
+
*/
|
|
1440
|
+
constructor({
|
|
1441
|
+
restEndpoint,
|
|
1442
|
+
apiEndpoint,
|
|
1443
|
+
registryAddress,
|
|
1444
|
+
http
|
|
1445
|
+
}) {
|
|
1446
|
+
this.http = http;
|
|
1447
|
+
this.restEndpoint = restEndpoint;
|
|
1448
|
+
this.apiEndpoint = apiEndpoint;
|
|
1449
|
+
this.registryAddress = registryAddress;
|
|
1450
|
+
this.round = new Round(this.http);
|
|
1451
|
+
this.account = new Account(this.http);
|
|
1452
|
+
this.circuit = new Circuit(this.http);
|
|
1453
|
+
this.operator = new Operator(this.http, this.registryAddress);
|
|
1454
|
+
this.proof = new Proof(this.http);
|
|
1455
|
+
this.transaction = new Transaction(this.http);
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* @method balanceOf
|
|
1459
|
+
* @description Get the balance of a specific address.
|
|
1460
|
+
* @param {string} address - The address to check the balance for.
|
|
1461
|
+
* @returns {Promise<BalanceResponse>} The balance response.
|
|
1462
|
+
*/
|
|
1463
|
+
async balanceOf(address) {
|
|
1464
|
+
return await this.account.balanceOf(address);
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* @method getRoundById
|
|
1468
|
+
* @description Get a round by its ID.
|
|
1469
|
+
* @param {string} id - The ID of the round.
|
|
1470
|
+
* @returns {Promise<RoundResponse>} The round response.
|
|
1471
|
+
*/
|
|
1472
|
+
async getRoundById(id) {
|
|
1473
|
+
return await this.round.getRoundById(id);
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* @method getRounds
|
|
1477
|
+
* @description Get multiple rounds.
|
|
1478
|
+
* @param {string} after - The cursor to start after.
|
|
1479
|
+
* @param {number} [limit] - The number of rounds to retrieve.
|
|
1480
|
+
* @returns {Promise<RoundsResponse>} The rounds response.
|
|
1481
|
+
*/
|
|
1482
|
+
async getRounds(after, limit) {
|
|
1483
|
+
return await this.round.getRounds(after, limit);
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* @method getRoundsByStatus
|
|
1487
|
+
* @description Get rounds by their status.
|
|
1488
|
+
* @param {string} status - The status of the rounds to retrieve.
|
|
1489
|
+
* @param {string} after - The cursor to start after.
|
|
1490
|
+
* @param {number} [limit] - The number of rounds to retrieve.
|
|
1491
|
+
* @returns {Promise<RoundsResponse>} The rounds response.
|
|
1492
|
+
*/
|
|
1493
|
+
async getRoundsByStatus(status, after, limit) {
|
|
1494
|
+
return await this.round.getRoundsByStatus(status, after, limit);
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* @method getRoundsByCircuitName
|
|
1498
|
+
* @description Get rounds by their circuit name.
|
|
1499
|
+
* @param {string} name - The name of the circuit.
|
|
1500
|
+
* @param {string} after - The cursor to start after.
|
|
1501
|
+
* @param {number} [limit] - The number of rounds to retrieve.
|
|
1502
|
+
* @returns {Promise<RoundsResponse>} The rounds response.
|
|
1503
|
+
*/
|
|
1504
|
+
async getRoundsByCircuitName(name, after, limit) {
|
|
1505
|
+
return await this.round.getRoundsByCircuitName(name, after, limit);
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* @method getRoundsByOperator
|
|
1509
|
+
* @description Get rounds by their operator address.
|
|
1510
|
+
* @param {string} address - The address of the operator.
|
|
1511
|
+
* @param {string} after - The cursor to start after.
|
|
1512
|
+
* @param {number} [limit] - The number of rounds to retrieve.
|
|
1513
|
+
* @returns {Promise<RoundsResponse>} The rounds response.
|
|
1514
|
+
*/
|
|
1515
|
+
async getRoundsByOperator(address, after, limit) {
|
|
1516
|
+
return await this.round.getRoundsByOperator(address, after, limit);
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* @method getOperatorByAddress
|
|
1520
|
+
* @description Get an operator by their address.
|
|
1521
|
+
* @param {string} address - The address of the operator.
|
|
1522
|
+
* @returns {Promise<OperatorResponse>} The operator response.
|
|
1523
|
+
*/
|
|
1524
|
+
async getOperatorByAddress(address) {
|
|
1525
|
+
return await this.operator.getOperatorByAddress(address);
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* @method getOperators
|
|
1529
|
+
* @description Get multiple operators.
|
|
1530
|
+
* @param {string} after - The cursor to start after.
|
|
1531
|
+
* @param {number} [limit] - The number of operators to retrieve.
|
|
1532
|
+
* @returns {Promise<OperatorsResponse>} The operators response.
|
|
1533
|
+
*/
|
|
1534
|
+
async getOperators(after, limit) {
|
|
1535
|
+
return await this.operator.getOperators(after, limit);
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* @method getCircuitByName
|
|
1539
|
+
* @description Get a circuit by its name.
|
|
1540
|
+
* @param {string} name - The name of the circuit.
|
|
1541
|
+
* @returns {Promise<CircuitResponse>} The circuit response.
|
|
1542
|
+
*/
|
|
1543
|
+
async getCircuitByName(name) {
|
|
1544
|
+
return await this.circuit.getCircuitByName(name);
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* @method getCircuits
|
|
1548
|
+
* @description Get all available circuits.
|
|
1549
|
+
* @returns {Promise<CircuitsResponse>} The circuits response.
|
|
1550
|
+
*/
|
|
1551
|
+
async getCircuits() {
|
|
1552
|
+
return await this.circuit.getCircuits();
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* @method getTransactionByHash
|
|
1556
|
+
* @description Get a transaction by its hash.
|
|
1557
|
+
* @param {string} hash - The hash of the transaction.
|
|
1558
|
+
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
1559
|
+
*/
|
|
1560
|
+
async getTransactionByHash(hash) {
|
|
1561
|
+
return await this.transaction.getTransactionByHash(hash);
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* @method getTransactions
|
|
1565
|
+
* @description Get multiple transactions.
|
|
1566
|
+
* @param {string} after - The cursor to start after.
|
|
1567
|
+
* @param {number} [limit] - The number of transactions to retrieve.
|
|
1568
|
+
* @returns {Promise<TransactionsResponse>} The transactions response.
|
|
1569
|
+
*/
|
|
1570
|
+
async getTransactions(after, limit) {
|
|
1571
|
+
return await this.transaction.getTransactions(after, limit);
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* @method getTransactionsByContractAddress
|
|
1575
|
+
* @description Get transactions by contract address.
|
|
1576
|
+
* @param {string} address - The contract address.
|
|
1577
|
+
* @param {string} after - The cursor to start after.
|
|
1578
|
+
* @param {number} [limit] - The number of transactions to retrieve.
|
|
1579
|
+
* @returns {Promise<TransactionsResponse>} The transactions response.
|
|
1580
|
+
*/
|
|
1581
|
+
async getTransactionsByContractAddress(address, after, limit) {
|
|
1582
|
+
return await this.transaction.getTransactionsByContractAddress(
|
|
1583
|
+
address,
|
|
1584
|
+
after,
|
|
1585
|
+
limit
|
|
1586
|
+
);
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* @method getProofByContractAddress
|
|
1590
|
+
* @description Get proof data by contract address.
|
|
1591
|
+
* @param {string} address - The contract address.
|
|
1592
|
+
* @returns {Promise<ProofResponse>} The proof response.
|
|
1593
|
+
*/
|
|
1594
|
+
async getProofByContractAddress(address) {
|
|
1595
|
+
return await this.proof.getProofByContractAddress(address);
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
|
|
1599
|
+
// src/libs/contract/config.ts
|
|
1600
|
+
var import_stargate = require("@cosmjs/stargate");
|
|
1601
|
+
var import_cosmwasm_stargate = require("@cosmjs/cosmwasm-stargate");
|
|
1602
|
+
|
|
1603
|
+
// src/libs/contract/ts/Maci.client.ts
|
|
1604
|
+
var MaciQueryClient = class {
|
|
1605
|
+
constructor(client, contractAddress) {
|
|
1606
|
+
this.getRoundInfo = async () => {
|
|
1607
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1608
|
+
get_round_info: {}
|
|
1609
|
+
});
|
|
1610
|
+
};
|
|
1611
|
+
this.getVotingTime = async () => {
|
|
1612
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1613
|
+
get_voting_time: {}
|
|
1614
|
+
});
|
|
1615
|
+
};
|
|
1616
|
+
this.getPeriod = async () => {
|
|
1617
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1618
|
+
get_period: {}
|
|
1619
|
+
});
|
|
1620
|
+
};
|
|
1621
|
+
this.getNumSignUp = async () => {
|
|
1622
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1623
|
+
get_num_sign_up: {}
|
|
1624
|
+
});
|
|
1625
|
+
};
|
|
1626
|
+
this.getMsgChainLength = async () => {
|
|
1627
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1628
|
+
get_msg_chain_length: {}
|
|
1629
|
+
});
|
|
1630
|
+
};
|
|
1631
|
+
this.getDMsgChainLength = async () => {
|
|
1632
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1633
|
+
get_d_msg_chain_length: {}
|
|
1634
|
+
});
|
|
1635
|
+
};
|
|
1636
|
+
this.getProcessedDMsgCount = async () => {
|
|
1637
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1638
|
+
get_processed_d_msg_count: {}
|
|
1639
|
+
});
|
|
1640
|
+
};
|
|
1641
|
+
this.getProcessedMsgCount = async () => {
|
|
1642
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1643
|
+
get_processed_msg_count: {}
|
|
1644
|
+
});
|
|
1645
|
+
};
|
|
1646
|
+
this.getProcessedUserCount = async () => {
|
|
1647
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1648
|
+
get_processed_user_count: {}
|
|
1649
|
+
});
|
|
1650
|
+
};
|
|
1651
|
+
this.getResult = async ({ index }) => {
|
|
1652
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1653
|
+
get_result: {
|
|
1654
|
+
index
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
};
|
|
1658
|
+
this.getAllResult = async () => {
|
|
1659
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1660
|
+
get_all_result: {}
|
|
1661
|
+
});
|
|
1662
|
+
};
|
|
1663
|
+
this.getStateIdxInc = async ({
|
|
1664
|
+
address
|
|
1665
|
+
}) => {
|
|
1666
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1667
|
+
get_state_idx_inc: {
|
|
1668
|
+
address
|
|
1669
|
+
}
|
|
1670
|
+
});
|
|
1671
|
+
};
|
|
1672
|
+
this.getVoiceCreditBalance = async ({
|
|
1673
|
+
index
|
|
1674
|
+
}) => {
|
|
1675
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1676
|
+
get_voice_credit_balance: {
|
|
1677
|
+
index
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
};
|
|
1681
|
+
this.whiteList = async () => {
|
|
1682
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1683
|
+
white_list: {}
|
|
1684
|
+
});
|
|
1685
|
+
};
|
|
1686
|
+
this.isWhiteList = async ({ sender }) => {
|
|
1687
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1688
|
+
is_white_list: {
|
|
1689
|
+
sender
|
|
1690
|
+
}
|
|
1691
|
+
});
|
|
1692
|
+
};
|
|
1693
|
+
this.voteOptionMap = async () => {
|
|
1694
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1695
|
+
vote_option_map: {}
|
|
1696
|
+
});
|
|
1697
|
+
};
|
|
1698
|
+
this.maxVoteOptions = async () => {
|
|
1699
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1700
|
+
max_vote_options: {}
|
|
1701
|
+
});
|
|
1702
|
+
};
|
|
1703
|
+
this.queryTotalFeeGrant = async () => {
|
|
1704
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1705
|
+
query_total_fee_grant: {}
|
|
1706
|
+
});
|
|
1707
|
+
};
|
|
1708
|
+
this.queryCircuitType = async () => {
|
|
1709
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1710
|
+
query_circuit_type: {}
|
|
1711
|
+
});
|
|
1712
|
+
};
|
|
1713
|
+
this.queryCertSystem = async () => {
|
|
1714
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
1715
|
+
query_cert_system: {}
|
|
1716
|
+
});
|
|
1717
|
+
};
|
|
1718
|
+
this.client = client;
|
|
1719
|
+
this.contractAddress = contractAddress;
|
|
1720
|
+
this.getRoundInfo = this.getRoundInfo.bind(this);
|
|
1721
|
+
this.getVotingTime = this.getVotingTime.bind(this);
|
|
1722
|
+
this.getPeriod = this.getPeriod.bind(this);
|
|
1723
|
+
this.getNumSignUp = this.getNumSignUp.bind(this);
|
|
1724
|
+
this.getMsgChainLength = this.getMsgChainLength.bind(this);
|
|
1725
|
+
this.getDMsgChainLength = this.getDMsgChainLength.bind(this);
|
|
1726
|
+
this.getProcessedDMsgCount = this.getProcessedDMsgCount.bind(this);
|
|
1727
|
+
this.getProcessedMsgCount = this.getProcessedMsgCount.bind(this);
|
|
1728
|
+
this.getProcessedUserCount = this.getProcessedUserCount.bind(this);
|
|
1729
|
+
this.getResult = this.getResult.bind(this);
|
|
1730
|
+
this.getAllResult = this.getAllResult.bind(this);
|
|
1731
|
+
this.getStateIdxInc = this.getStateIdxInc.bind(this);
|
|
1732
|
+
this.getVoiceCreditBalance = this.getVoiceCreditBalance.bind(this);
|
|
1733
|
+
this.whiteList = this.whiteList.bind(this);
|
|
1734
|
+
this.isWhiteList = this.isWhiteList.bind(this);
|
|
1735
|
+
this.voteOptionMap = this.voteOptionMap.bind(this);
|
|
1736
|
+
this.maxVoteOptions = this.maxVoteOptions.bind(this);
|
|
1737
|
+
this.queryTotalFeeGrant = this.queryTotalFeeGrant.bind(this);
|
|
1738
|
+
this.queryCircuitType = this.queryCircuitType.bind(this);
|
|
1739
|
+
this.queryCertSystem = this.queryCertSystem.bind(this);
|
|
1740
|
+
}
|
|
1741
|
+
};
|
|
1742
|
+
var MaciClient = class extends MaciQueryClient {
|
|
1743
|
+
constructor(client, sender, contractAddress) {
|
|
1744
|
+
super(client, contractAddress);
|
|
1745
|
+
this.setParams = async ({
|
|
1746
|
+
intStateTreeDepth,
|
|
1747
|
+
messageBatchSize,
|
|
1748
|
+
stateTreeDepth,
|
|
1749
|
+
voteOptionTreeDepth
|
|
1750
|
+
}, fee = "auto", memo, _funds) => {
|
|
1751
|
+
return await this.client.execute(
|
|
1752
|
+
this.sender,
|
|
1753
|
+
this.contractAddress,
|
|
1754
|
+
{
|
|
1755
|
+
set_params: {
|
|
1756
|
+
int_state_tree_depth: intStateTreeDepth,
|
|
1757
|
+
message_batch_size: messageBatchSize,
|
|
1758
|
+
state_tree_depth: stateTreeDepth,
|
|
1759
|
+
vote_option_tree_depth: voteOptionTreeDepth
|
|
1760
|
+
}
|
|
1761
|
+
},
|
|
1762
|
+
fee,
|
|
1763
|
+
memo,
|
|
1764
|
+
_funds
|
|
1765
|
+
);
|
|
1766
|
+
};
|
|
1767
|
+
this.setRoundInfo = async ({
|
|
1768
|
+
roundInfo
|
|
1769
|
+
}, fee = "auto", memo, _funds) => {
|
|
1770
|
+
return await this.client.execute(
|
|
1771
|
+
this.sender,
|
|
1772
|
+
this.contractAddress,
|
|
1773
|
+
{
|
|
1774
|
+
set_round_info: {
|
|
1775
|
+
round_info: roundInfo
|
|
1776
|
+
}
|
|
1777
|
+
},
|
|
1778
|
+
fee,
|
|
1779
|
+
memo,
|
|
1780
|
+
_funds
|
|
1781
|
+
);
|
|
1782
|
+
};
|
|
1783
|
+
this.setWhitelists = async ({
|
|
1784
|
+
whitelists
|
|
1785
|
+
}, fee = "auto", memo, _funds) => {
|
|
1786
|
+
return await this.client.execute(
|
|
1787
|
+
this.sender,
|
|
1788
|
+
this.contractAddress,
|
|
1789
|
+
{
|
|
1790
|
+
set_whitelists: {
|
|
1791
|
+
whitelists
|
|
1792
|
+
}
|
|
1793
|
+
},
|
|
1794
|
+
fee,
|
|
1795
|
+
memo,
|
|
1796
|
+
_funds
|
|
1797
|
+
);
|
|
1798
|
+
};
|
|
1799
|
+
this.setVoteOptionsMap = async ({
|
|
1800
|
+
voteOptionMap
|
|
1801
|
+
}, fee = "auto", memo, _funds) => {
|
|
1802
|
+
return await this.client.execute(
|
|
1803
|
+
this.sender,
|
|
1804
|
+
this.contractAddress,
|
|
1805
|
+
{
|
|
1806
|
+
set_vote_options_map: {
|
|
1807
|
+
vote_option_map: voteOptionMap
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
fee,
|
|
1811
|
+
memo,
|
|
1812
|
+
_funds
|
|
1813
|
+
);
|
|
1814
|
+
};
|
|
1815
|
+
this.startVotingPeriod = async (fee = "auto", memo, _funds) => {
|
|
1816
|
+
return await this.client.execute(
|
|
1817
|
+
this.sender,
|
|
1818
|
+
this.contractAddress,
|
|
1819
|
+
{
|
|
1820
|
+
start_voting_period: {}
|
|
1821
|
+
},
|
|
1822
|
+
fee,
|
|
1823
|
+
memo,
|
|
1824
|
+
_funds
|
|
1825
|
+
);
|
|
1826
|
+
};
|
|
1827
|
+
this.signUp = async ({
|
|
1828
|
+
pubkey
|
|
1829
|
+
}, fee = "auto", memo, _funds) => {
|
|
1830
|
+
return await this.client.execute(
|
|
1831
|
+
this.sender,
|
|
1832
|
+
this.contractAddress,
|
|
1833
|
+
{
|
|
1834
|
+
sign_up: {
|
|
1835
|
+
pubkey
|
|
1836
|
+
}
|
|
1837
|
+
},
|
|
1838
|
+
fee,
|
|
1839
|
+
memo,
|
|
1840
|
+
_funds
|
|
1841
|
+
);
|
|
1842
|
+
};
|
|
1843
|
+
this.startProcessPeriod = async (fee = "auto", memo, _funds) => {
|
|
1844
|
+
return await this.client.execute(
|
|
1845
|
+
this.sender,
|
|
1846
|
+
this.contractAddress,
|
|
1847
|
+
{
|
|
1848
|
+
start_process_period: {}
|
|
1849
|
+
},
|
|
1850
|
+
fee,
|
|
1851
|
+
memo,
|
|
1852
|
+
_funds
|
|
1853
|
+
);
|
|
1854
|
+
};
|
|
1855
|
+
this.stopVotingPeriod = async (fee = "auto", memo, _funds) => {
|
|
1856
|
+
return await this.client.execute(
|
|
1857
|
+
this.sender,
|
|
1858
|
+
this.contractAddress,
|
|
1859
|
+
{
|
|
1860
|
+
stop_voting_period: {}
|
|
1861
|
+
},
|
|
1862
|
+
fee,
|
|
1863
|
+
memo,
|
|
1864
|
+
_funds
|
|
1865
|
+
);
|
|
1866
|
+
};
|
|
1867
|
+
this.publishDeactivateMessage = async ({
|
|
1868
|
+
encPubKey,
|
|
1869
|
+
message
|
|
1870
|
+
}, fee = "auto", memo, _funds) => {
|
|
1871
|
+
return await this.client.execute(
|
|
1872
|
+
this.sender,
|
|
1873
|
+
this.contractAddress,
|
|
1874
|
+
{
|
|
1875
|
+
publish_deactivate_message: {
|
|
1876
|
+
enc_pub_key: encPubKey,
|
|
1877
|
+
message
|
|
1878
|
+
}
|
|
1879
|
+
},
|
|
1880
|
+
fee,
|
|
1881
|
+
memo,
|
|
1882
|
+
_funds
|
|
1883
|
+
);
|
|
1884
|
+
};
|
|
1885
|
+
this.processDeactivateMessage = async ({
|
|
1886
|
+
groth16Proof,
|
|
1887
|
+
newDeactivateCommitment,
|
|
1888
|
+
newDeactivateRoot,
|
|
1889
|
+
size
|
|
1890
|
+
}, fee = "auto", memo, _funds) => {
|
|
1891
|
+
return await this.client.execute(
|
|
1892
|
+
this.sender,
|
|
1893
|
+
this.contractAddress,
|
|
1894
|
+
{
|
|
1895
|
+
process_deactivate_message: {
|
|
1896
|
+
groth16_proof: groth16Proof,
|
|
1897
|
+
new_deactivate_commitment: newDeactivateCommitment,
|
|
1898
|
+
new_deactivate_root: newDeactivateRoot,
|
|
1899
|
+
size
|
|
1900
|
+
}
|
|
1901
|
+
},
|
|
1902
|
+
fee,
|
|
1903
|
+
memo,
|
|
1904
|
+
_funds
|
|
1905
|
+
);
|
|
1906
|
+
};
|
|
1907
|
+
this.addNewKey = async ({
|
|
1908
|
+
d,
|
|
1909
|
+
groth16Proof,
|
|
1910
|
+
nullifier,
|
|
1911
|
+
pubkey
|
|
1912
|
+
}, fee = "auto", memo, _funds) => {
|
|
1913
|
+
return await this.client.execute(
|
|
1914
|
+
this.sender,
|
|
1915
|
+
this.contractAddress,
|
|
1916
|
+
{
|
|
1917
|
+
add_new_key: {
|
|
1918
|
+
d,
|
|
1919
|
+
groth16_proof: groth16Proof,
|
|
1920
|
+
nullifier,
|
|
1921
|
+
pubkey
|
|
1922
|
+
}
|
|
1923
|
+
},
|
|
1924
|
+
fee,
|
|
1925
|
+
memo,
|
|
1926
|
+
_funds
|
|
1927
|
+
);
|
|
1928
|
+
};
|
|
1929
|
+
this.publishMessage = async ({
|
|
1930
|
+
encPubKey,
|
|
1931
|
+
message
|
|
1932
|
+
}, fee = "auto", memo, _funds) => {
|
|
1933
|
+
return await this.client.execute(
|
|
1934
|
+
this.sender,
|
|
1935
|
+
this.contractAddress,
|
|
1936
|
+
{
|
|
1937
|
+
publish_message: {
|
|
1938
|
+
enc_pub_key: encPubKey,
|
|
1939
|
+
message
|
|
1940
|
+
}
|
|
1941
|
+
},
|
|
1942
|
+
fee,
|
|
1943
|
+
memo,
|
|
1944
|
+
_funds
|
|
1945
|
+
);
|
|
1946
|
+
};
|
|
1947
|
+
this.processMessage = async ({
|
|
1948
|
+
groth16Proof,
|
|
1949
|
+
newStateCommitment
|
|
1950
|
+
}, fee = "auto", memo, _funds) => {
|
|
1951
|
+
return await this.client.execute(
|
|
1952
|
+
this.sender,
|
|
1953
|
+
this.contractAddress,
|
|
1954
|
+
{
|
|
1955
|
+
process_message: {
|
|
1956
|
+
groth16_proof: groth16Proof,
|
|
1957
|
+
new_state_commitment: newStateCommitment
|
|
1958
|
+
}
|
|
1959
|
+
},
|
|
1960
|
+
fee,
|
|
1961
|
+
memo,
|
|
1962
|
+
_funds
|
|
1963
|
+
);
|
|
1964
|
+
};
|
|
1965
|
+
this.stopProcessingPeriod = async (fee = "auto", memo, _funds) => {
|
|
1966
|
+
return await this.client.execute(
|
|
1967
|
+
this.sender,
|
|
1968
|
+
this.contractAddress,
|
|
1969
|
+
{
|
|
1970
|
+
stop_processing_period: {}
|
|
1971
|
+
},
|
|
1972
|
+
fee,
|
|
1973
|
+
memo,
|
|
1974
|
+
_funds
|
|
1975
|
+
);
|
|
1976
|
+
};
|
|
1977
|
+
this.processTally = async ({
|
|
1978
|
+
groth16Proof,
|
|
1979
|
+
newTallyCommitment
|
|
1980
|
+
}, fee = "auto", memo, _funds) => {
|
|
1981
|
+
return await this.client.execute(
|
|
1982
|
+
this.sender,
|
|
1983
|
+
this.contractAddress,
|
|
1984
|
+
{
|
|
1985
|
+
process_tally: {
|
|
1986
|
+
groth16_proof: groth16Proof,
|
|
1987
|
+
new_tally_commitment: newTallyCommitment
|
|
1988
|
+
}
|
|
1989
|
+
},
|
|
1990
|
+
fee,
|
|
1991
|
+
memo,
|
|
1992
|
+
_funds
|
|
1993
|
+
);
|
|
1994
|
+
};
|
|
1995
|
+
this.stopTallyingPeriod = async ({
|
|
1996
|
+
results,
|
|
1997
|
+
salt
|
|
1998
|
+
}, fee = "auto", memo, _funds) => {
|
|
1999
|
+
return await this.client.execute(
|
|
2000
|
+
this.sender,
|
|
2001
|
+
this.contractAddress,
|
|
2002
|
+
{
|
|
2003
|
+
stop_tallying_period: {
|
|
2004
|
+
results,
|
|
2005
|
+
salt
|
|
2006
|
+
}
|
|
2007
|
+
},
|
|
2008
|
+
fee,
|
|
2009
|
+
memo,
|
|
2010
|
+
_funds
|
|
2011
|
+
);
|
|
2012
|
+
};
|
|
2013
|
+
this.grant = async ({
|
|
2014
|
+
maxAmount
|
|
2015
|
+
}, fee = "auto", memo, _funds) => {
|
|
2016
|
+
return await this.client.execute(
|
|
2017
|
+
this.sender,
|
|
2018
|
+
this.contractAddress,
|
|
2019
|
+
{
|
|
2020
|
+
grant: {
|
|
2021
|
+
max_amount: maxAmount
|
|
2022
|
+
}
|
|
2023
|
+
},
|
|
2024
|
+
fee,
|
|
2025
|
+
memo,
|
|
2026
|
+
_funds
|
|
2027
|
+
);
|
|
2028
|
+
};
|
|
2029
|
+
this.revoke = async (fee = "auto", memo, _funds) => {
|
|
2030
|
+
return await this.client.execute(
|
|
2031
|
+
this.sender,
|
|
2032
|
+
this.contractAddress,
|
|
2033
|
+
{
|
|
2034
|
+
revoke: {}
|
|
2035
|
+
},
|
|
2036
|
+
fee,
|
|
2037
|
+
memo,
|
|
2038
|
+
_funds
|
|
2039
|
+
);
|
|
2040
|
+
};
|
|
2041
|
+
this.bond = async (fee = "auto", memo, _funds) => {
|
|
2042
|
+
return await this.client.execute(
|
|
2043
|
+
this.sender,
|
|
2044
|
+
this.contractAddress,
|
|
2045
|
+
{
|
|
2046
|
+
bond: {}
|
|
2047
|
+
},
|
|
2048
|
+
fee,
|
|
2049
|
+
memo,
|
|
2050
|
+
_funds
|
|
2051
|
+
);
|
|
2052
|
+
};
|
|
2053
|
+
this.withdraw = async ({
|
|
2054
|
+
amount
|
|
2055
|
+
}, fee = "auto", memo, _funds) => {
|
|
2056
|
+
return await this.client.execute(
|
|
2057
|
+
this.sender,
|
|
2058
|
+
this.contractAddress,
|
|
2059
|
+
{
|
|
2060
|
+
withdraw: {
|
|
2061
|
+
amount
|
|
2062
|
+
}
|
|
2063
|
+
},
|
|
2064
|
+
fee,
|
|
2065
|
+
memo,
|
|
2066
|
+
_funds
|
|
2067
|
+
);
|
|
2068
|
+
};
|
|
2069
|
+
this.client = client;
|
|
2070
|
+
this.sender = sender;
|
|
2071
|
+
this.contractAddress = contractAddress;
|
|
2072
|
+
this.setParams = this.setParams.bind(this);
|
|
2073
|
+
this.setRoundInfo = this.setRoundInfo.bind(this);
|
|
2074
|
+
this.setWhitelists = this.setWhitelists.bind(this);
|
|
2075
|
+
this.setVoteOptionsMap = this.setVoteOptionsMap.bind(this);
|
|
2076
|
+
this.startVotingPeriod = this.startVotingPeriod.bind(this);
|
|
2077
|
+
this.signUp = this.signUp.bind(this);
|
|
2078
|
+
this.startProcessPeriod = this.startProcessPeriod.bind(this);
|
|
2079
|
+
this.stopVotingPeriod = this.stopVotingPeriod.bind(this);
|
|
2080
|
+
this.publishDeactivateMessage = this.publishDeactivateMessage.bind(this);
|
|
2081
|
+
this.processDeactivateMessage = this.processDeactivateMessage.bind(this);
|
|
2082
|
+
this.addNewKey = this.addNewKey.bind(this);
|
|
2083
|
+
this.publishMessage = this.publishMessage.bind(this);
|
|
2084
|
+
this.processMessage = this.processMessage.bind(this);
|
|
2085
|
+
this.stopProcessingPeriod = this.stopProcessingPeriod.bind(this);
|
|
2086
|
+
this.processTally = this.processTally.bind(this);
|
|
2087
|
+
this.stopTallyingPeriod = this.stopTallyingPeriod.bind(this);
|
|
2088
|
+
this.grant = this.grant.bind(this);
|
|
2089
|
+
this.revoke = this.revoke.bind(this);
|
|
2090
|
+
this.bond = this.bond.bind(this);
|
|
2091
|
+
this.withdraw = this.withdraw.bind(this);
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
|
|
2095
|
+
// src/libs/contract/ts/AMaci.client.ts
|
|
2096
|
+
var AMaciQueryClient = class {
|
|
2097
|
+
constructor(client, contractAddress) {
|
|
2098
|
+
this.admin = async () => {
|
|
2099
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2100
|
+
admin: {}
|
|
2101
|
+
});
|
|
2102
|
+
};
|
|
2103
|
+
this.operator = async () => {
|
|
2104
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2105
|
+
operator: {}
|
|
2106
|
+
});
|
|
2107
|
+
};
|
|
2108
|
+
this.getRoundInfo = async () => {
|
|
2109
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2110
|
+
get_round_info: {}
|
|
2111
|
+
});
|
|
2112
|
+
};
|
|
2113
|
+
this.getVotingTime = async () => {
|
|
2114
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2115
|
+
get_voting_time: {}
|
|
2116
|
+
});
|
|
2117
|
+
};
|
|
2118
|
+
this.getPeriod = async () => {
|
|
2119
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2120
|
+
get_period: {}
|
|
2121
|
+
});
|
|
2122
|
+
};
|
|
2123
|
+
this.getNumSignUp = async () => {
|
|
2124
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2125
|
+
get_num_sign_up: {}
|
|
2126
|
+
});
|
|
2127
|
+
};
|
|
2128
|
+
this.getMsgChainLength = async () => {
|
|
2129
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2130
|
+
get_msg_chain_length: {}
|
|
2131
|
+
});
|
|
2132
|
+
};
|
|
2133
|
+
this.getDMsgChainLength = async () => {
|
|
2134
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2135
|
+
get_d_msg_chain_length: {}
|
|
2136
|
+
});
|
|
2137
|
+
};
|
|
2138
|
+
this.getProcessedDMsgCount = async () => {
|
|
2139
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2140
|
+
get_processed_d_msg_count: {}
|
|
2141
|
+
});
|
|
2142
|
+
};
|
|
2143
|
+
this.getProcessedMsgCount = async () => {
|
|
2144
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2145
|
+
get_processed_msg_count: {}
|
|
2146
|
+
});
|
|
2147
|
+
};
|
|
2148
|
+
this.getProcessedUserCount = async () => {
|
|
2149
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2150
|
+
get_processed_user_count: {}
|
|
2151
|
+
});
|
|
2152
|
+
};
|
|
2153
|
+
this.getResult = async ({ index }) => {
|
|
2154
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2155
|
+
get_result: {
|
|
2156
|
+
index
|
|
2157
|
+
}
|
|
2158
|
+
});
|
|
2159
|
+
};
|
|
2160
|
+
this.getAllResult = async () => {
|
|
2161
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2162
|
+
get_all_result: {}
|
|
2163
|
+
});
|
|
2164
|
+
};
|
|
2165
|
+
this.getStateIdxInc = async ({
|
|
2166
|
+
address
|
|
2167
|
+
}) => {
|
|
2168
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2169
|
+
get_state_idx_inc: {
|
|
2170
|
+
address
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
};
|
|
2174
|
+
this.getVoiceCreditBalance = async ({
|
|
2175
|
+
index
|
|
2176
|
+
}) => {
|
|
2177
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2178
|
+
get_voice_credit_balance: {
|
|
2179
|
+
index
|
|
2180
|
+
}
|
|
2181
|
+
});
|
|
2182
|
+
};
|
|
2183
|
+
this.getVoiceCreditAmount = async () => {
|
|
2184
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2185
|
+
get_voice_credit_amount: {}
|
|
2186
|
+
});
|
|
2187
|
+
};
|
|
2188
|
+
this.whiteList = async () => {
|
|
2189
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2190
|
+
white_list: {}
|
|
2191
|
+
});
|
|
2192
|
+
};
|
|
2193
|
+
this.isWhiteList = async ({ sender }) => {
|
|
2194
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2195
|
+
is_white_list: {
|
|
2196
|
+
sender
|
|
2197
|
+
}
|
|
2198
|
+
});
|
|
2199
|
+
};
|
|
2200
|
+
this.signuped = async ({ pubkeyX }) => {
|
|
2201
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2202
|
+
signuped: {
|
|
2203
|
+
pubkey_x: pubkeyX
|
|
2204
|
+
}
|
|
2205
|
+
});
|
|
2206
|
+
};
|
|
2207
|
+
this.voteOptionMap = async () => {
|
|
2208
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2209
|
+
vote_option_map: {}
|
|
2210
|
+
});
|
|
2211
|
+
};
|
|
2212
|
+
this.maxVoteOptions = async () => {
|
|
2213
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2214
|
+
max_vote_options: {}
|
|
2215
|
+
});
|
|
2216
|
+
};
|
|
2217
|
+
this.queryTotalFeeGrant = async () => {
|
|
2218
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2219
|
+
query_total_fee_grant: {}
|
|
2220
|
+
});
|
|
2221
|
+
};
|
|
2222
|
+
this.queryCircuitType = async () => {
|
|
2223
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2224
|
+
query_circuit_type: {}
|
|
2225
|
+
});
|
|
2226
|
+
};
|
|
2227
|
+
this.queryCertSystem = async () => {
|
|
2228
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2229
|
+
query_cert_system: {}
|
|
2230
|
+
});
|
|
2231
|
+
};
|
|
2232
|
+
this.queryPreDeactivateRoot = async () => {
|
|
2233
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2234
|
+
query_pre_deactivate_root: {}
|
|
2235
|
+
});
|
|
2236
|
+
};
|
|
2237
|
+
this.client = client;
|
|
2238
|
+
this.contractAddress = contractAddress;
|
|
2239
|
+
this.admin = this.admin.bind(this);
|
|
2240
|
+
this.operator = this.operator.bind(this);
|
|
2241
|
+
this.getRoundInfo = this.getRoundInfo.bind(this);
|
|
2242
|
+
this.getVotingTime = this.getVotingTime.bind(this);
|
|
2243
|
+
this.getPeriod = this.getPeriod.bind(this);
|
|
2244
|
+
this.getNumSignUp = this.getNumSignUp.bind(this);
|
|
2245
|
+
this.getMsgChainLength = this.getMsgChainLength.bind(this);
|
|
2246
|
+
this.getDMsgChainLength = this.getDMsgChainLength.bind(this);
|
|
2247
|
+
this.getProcessedDMsgCount = this.getProcessedDMsgCount.bind(this);
|
|
2248
|
+
this.getProcessedMsgCount = this.getProcessedMsgCount.bind(this);
|
|
2249
|
+
this.getProcessedUserCount = this.getProcessedUserCount.bind(this);
|
|
2250
|
+
this.getResult = this.getResult.bind(this);
|
|
2251
|
+
this.getAllResult = this.getAllResult.bind(this);
|
|
2252
|
+
this.getStateIdxInc = this.getStateIdxInc.bind(this);
|
|
2253
|
+
this.getVoiceCreditBalance = this.getVoiceCreditBalance.bind(this);
|
|
2254
|
+
this.getVoiceCreditAmount = this.getVoiceCreditAmount.bind(this);
|
|
2255
|
+
this.whiteList = this.whiteList.bind(this);
|
|
2256
|
+
this.isWhiteList = this.isWhiteList.bind(this);
|
|
2257
|
+
this.signuped = this.signuped.bind(this);
|
|
2258
|
+
this.voteOptionMap = this.voteOptionMap.bind(this);
|
|
2259
|
+
this.maxVoteOptions = this.maxVoteOptions.bind(this);
|
|
2260
|
+
this.queryTotalFeeGrant = this.queryTotalFeeGrant.bind(this);
|
|
2261
|
+
this.queryCircuitType = this.queryCircuitType.bind(this);
|
|
2262
|
+
this.queryCertSystem = this.queryCertSystem.bind(this);
|
|
2263
|
+
this.queryPreDeactivateRoot = this.queryPreDeactivateRoot.bind(this);
|
|
2264
|
+
}
|
|
2265
|
+
};
|
|
2266
|
+
var AMaciClient = class extends AMaciQueryClient {
|
|
2267
|
+
constructor(client, sender, contractAddress) {
|
|
2268
|
+
super(client, contractAddress);
|
|
2269
|
+
this.setRoundInfo = async ({
|
|
2270
|
+
roundInfo
|
|
2271
|
+
}, fee = "auto", memo, _funds) => {
|
|
2272
|
+
return await this.client.execute(
|
|
2273
|
+
this.sender,
|
|
2274
|
+
this.contractAddress,
|
|
2275
|
+
{
|
|
2276
|
+
set_round_info: {
|
|
2277
|
+
round_info: roundInfo
|
|
2278
|
+
}
|
|
2279
|
+
},
|
|
2280
|
+
fee,
|
|
2281
|
+
memo,
|
|
2282
|
+
_funds
|
|
2283
|
+
);
|
|
2284
|
+
};
|
|
2285
|
+
this.setWhitelists = async ({
|
|
2286
|
+
whitelists
|
|
2287
|
+
}, fee = "auto", memo, _funds) => {
|
|
2288
|
+
return await this.client.execute(
|
|
2289
|
+
this.sender,
|
|
2290
|
+
this.contractAddress,
|
|
2291
|
+
{
|
|
2292
|
+
set_whitelists: {
|
|
2293
|
+
whitelists
|
|
2294
|
+
}
|
|
2295
|
+
},
|
|
2296
|
+
fee,
|
|
2297
|
+
memo,
|
|
2298
|
+
_funds
|
|
2299
|
+
);
|
|
2300
|
+
};
|
|
2301
|
+
this.setVoteOptionsMap = async ({
|
|
2302
|
+
voteOptionMap
|
|
2303
|
+
}, fee = "auto", memo, _funds) => {
|
|
2304
|
+
return await this.client.execute(
|
|
2305
|
+
this.sender,
|
|
2306
|
+
this.contractAddress,
|
|
2307
|
+
{
|
|
2308
|
+
set_vote_options_map: {
|
|
2309
|
+
vote_option_map: voteOptionMap
|
|
2310
|
+
}
|
|
2311
|
+
},
|
|
2312
|
+
fee,
|
|
2313
|
+
memo,
|
|
2314
|
+
_funds
|
|
2315
|
+
);
|
|
2316
|
+
};
|
|
2317
|
+
this.signUp = async ({
|
|
2318
|
+
pubkey
|
|
2319
|
+
}, fee = "auto", memo, _funds) => {
|
|
2320
|
+
return await this.client.execute(
|
|
2321
|
+
this.sender,
|
|
2322
|
+
this.contractAddress,
|
|
2323
|
+
{
|
|
2324
|
+
sign_up: {
|
|
2325
|
+
pubkey
|
|
2326
|
+
}
|
|
2327
|
+
},
|
|
2328
|
+
fee,
|
|
2329
|
+
memo,
|
|
2330
|
+
_funds
|
|
2331
|
+
);
|
|
2332
|
+
};
|
|
2333
|
+
this.startProcessPeriod = async (fee = "auto", memo, _funds) => {
|
|
2334
|
+
return await this.client.execute(
|
|
2335
|
+
this.sender,
|
|
2336
|
+
this.contractAddress,
|
|
2337
|
+
{
|
|
2338
|
+
start_process_period: {}
|
|
2339
|
+
},
|
|
2340
|
+
fee,
|
|
2341
|
+
memo,
|
|
2342
|
+
_funds
|
|
2343
|
+
);
|
|
2344
|
+
};
|
|
2345
|
+
this.publishDeactivateMessage = async ({
|
|
2346
|
+
encPubKey,
|
|
2347
|
+
message
|
|
2348
|
+
}, fee = "auto", memo, _funds) => {
|
|
2349
|
+
return await this.client.execute(
|
|
2350
|
+
this.sender,
|
|
2351
|
+
this.contractAddress,
|
|
2352
|
+
{
|
|
2353
|
+
publish_deactivate_message: {
|
|
2354
|
+
enc_pub_key: encPubKey,
|
|
2355
|
+
message
|
|
2356
|
+
}
|
|
2357
|
+
},
|
|
2358
|
+
fee,
|
|
2359
|
+
memo,
|
|
2360
|
+
_funds
|
|
2361
|
+
);
|
|
2362
|
+
};
|
|
2363
|
+
this.processDeactivateMessage = async ({
|
|
2364
|
+
groth16Proof,
|
|
2365
|
+
newDeactivateCommitment,
|
|
2366
|
+
newDeactivateRoot,
|
|
2367
|
+
size
|
|
2368
|
+
}, fee = "auto", memo, _funds) => {
|
|
2369
|
+
return await this.client.execute(
|
|
2370
|
+
this.sender,
|
|
2371
|
+
this.contractAddress,
|
|
2372
|
+
{
|
|
2373
|
+
process_deactivate_message: {
|
|
2374
|
+
groth16_proof: groth16Proof,
|
|
2375
|
+
new_deactivate_commitment: newDeactivateCommitment,
|
|
2376
|
+
new_deactivate_root: newDeactivateRoot,
|
|
2377
|
+
size
|
|
2378
|
+
}
|
|
2379
|
+
},
|
|
2380
|
+
fee,
|
|
2381
|
+
memo,
|
|
2382
|
+
_funds
|
|
2383
|
+
);
|
|
2384
|
+
};
|
|
2385
|
+
this.addNewKey = async ({
|
|
2386
|
+
d,
|
|
2387
|
+
groth16Proof,
|
|
2388
|
+
nullifier,
|
|
2389
|
+
pubkey
|
|
2390
|
+
}, fee = "auto", memo, _funds) => {
|
|
2391
|
+
return await this.client.execute(
|
|
2392
|
+
this.sender,
|
|
2393
|
+
this.contractAddress,
|
|
2394
|
+
{
|
|
2395
|
+
add_new_key: {
|
|
2396
|
+
d,
|
|
2397
|
+
groth16_proof: groth16Proof,
|
|
2398
|
+
nullifier,
|
|
2399
|
+
pubkey
|
|
2400
|
+
}
|
|
2401
|
+
},
|
|
2402
|
+
fee,
|
|
2403
|
+
memo,
|
|
2404
|
+
_funds
|
|
2405
|
+
);
|
|
2406
|
+
};
|
|
2407
|
+
this.preAddNewKey = async ({
|
|
2408
|
+
d,
|
|
2409
|
+
groth16Proof,
|
|
2410
|
+
nullifier,
|
|
2411
|
+
pubkey
|
|
2412
|
+
}, fee = "auto", memo, _funds) => {
|
|
2413
|
+
return await this.client.execute(
|
|
2414
|
+
this.sender,
|
|
2415
|
+
this.contractAddress,
|
|
2416
|
+
{
|
|
2417
|
+
pre_add_new_key: {
|
|
2418
|
+
d,
|
|
2419
|
+
groth16_proof: groth16Proof,
|
|
2420
|
+
nullifier,
|
|
2421
|
+
pubkey
|
|
2422
|
+
}
|
|
2423
|
+
},
|
|
2424
|
+
fee,
|
|
2425
|
+
memo,
|
|
2426
|
+
_funds
|
|
2427
|
+
);
|
|
2428
|
+
};
|
|
2429
|
+
this.publishMessage = async ({
|
|
2430
|
+
encPubKey,
|
|
2431
|
+
message
|
|
2432
|
+
}, fee = "auto", memo, _funds) => {
|
|
2433
|
+
return await this.client.execute(
|
|
2434
|
+
this.sender,
|
|
2435
|
+
this.contractAddress,
|
|
2436
|
+
{
|
|
2437
|
+
publish_message: {
|
|
2438
|
+
enc_pub_key: encPubKey,
|
|
2439
|
+
message
|
|
2440
|
+
}
|
|
2441
|
+
},
|
|
2442
|
+
fee,
|
|
2443
|
+
memo,
|
|
2444
|
+
_funds
|
|
2445
|
+
);
|
|
2446
|
+
};
|
|
2447
|
+
this.processMessage = async ({
|
|
2448
|
+
groth16Proof,
|
|
2449
|
+
newStateCommitment
|
|
2450
|
+
}, fee = "auto", memo, _funds) => {
|
|
2451
|
+
return await this.client.execute(
|
|
2452
|
+
this.sender,
|
|
2453
|
+
this.contractAddress,
|
|
2454
|
+
{
|
|
2455
|
+
process_message: {
|
|
2456
|
+
groth16_proof: groth16Proof,
|
|
2457
|
+
new_state_commitment: newStateCommitment
|
|
2458
|
+
}
|
|
2459
|
+
},
|
|
2460
|
+
fee,
|
|
2461
|
+
memo,
|
|
2462
|
+
_funds
|
|
2463
|
+
);
|
|
2464
|
+
};
|
|
2465
|
+
this.stopProcessingPeriod = async (fee = "auto", memo, _funds) => {
|
|
2466
|
+
return await this.client.execute(
|
|
2467
|
+
this.sender,
|
|
2468
|
+
this.contractAddress,
|
|
2469
|
+
{
|
|
2470
|
+
stop_processing_period: {}
|
|
2471
|
+
},
|
|
2472
|
+
fee,
|
|
2473
|
+
memo,
|
|
2474
|
+
_funds
|
|
2475
|
+
);
|
|
2476
|
+
};
|
|
2477
|
+
this.processTally = async ({
|
|
2478
|
+
groth16Proof,
|
|
2479
|
+
newTallyCommitment
|
|
2480
|
+
}, fee = "auto", memo, _funds) => {
|
|
2481
|
+
return await this.client.execute(
|
|
2482
|
+
this.sender,
|
|
2483
|
+
this.contractAddress,
|
|
2484
|
+
{
|
|
2485
|
+
process_tally: {
|
|
2486
|
+
groth16_proof: groth16Proof,
|
|
2487
|
+
new_tally_commitment: newTallyCommitment
|
|
2488
|
+
}
|
|
2489
|
+
},
|
|
2490
|
+
fee,
|
|
2491
|
+
memo,
|
|
2492
|
+
_funds
|
|
2493
|
+
);
|
|
2494
|
+
};
|
|
2495
|
+
this.stopTallyingPeriod = async ({
|
|
2496
|
+
results,
|
|
2497
|
+
salt
|
|
2498
|
+
}, fee = "auto", memo, _funds) => {
|
|
2499
|
+
return await this.client.execute(
|
|
2500
|
+
this.sender,
|
|
2501
|
+
this.contractAddress,
|
|
2502
|
+
{
|
|
2503
|
+
stop_tallying_period: {
|
|
2504
|
+
results,
|
|
2505
|
+
salt
|
|
2506
|
+
}
|
|
2507
|
+
},
|
|
2508
|
+
fee,
|
|
2509
|
+
memo,
|
|
2510
|
+
_funds
|
|
2511
|
+
);
|
|
2512
|
+
};
|
|
2513
|
+
this.grant = async ({
|
|
2514
|
+
maxAmount
|
|
2515
|
+
}, fee = "auto", memo, _funds) => {
|
|
2516
|
+
return await this.client.execute(
|
|
2517
|
+
this.sender,
|
|
2518
|
+
this.contractAddress,
|
|
2519
|
+
{
|
|
2520
|
+
grant: {
|
|
2521
|
+
max_amount: maxAmount
|
|
2522
|
+
}
|
|
2523
|
+
},
|
|
2524
|
+
fee,
|
|
2525
|
+
memo,
|
|
2526
|
+
_funds
|
|
2527
|
+
);
|
|
2528
|
+
};
|
|
2529
|
+
this.revoke = async (fee = "auto", memo, _funds) => {
|
|
2530
|
+
return await this.client.execute(
|
|
2531
|
+
this.sender,
|
|
2532
|
+
this.contractAddress,
|
|
2533
|
+
{
|
|
2534
|
+
revoke: {}
|
|
2535
|
+
},
|
|
2536
|
+
fee,
|
|
2537
|
+
memo,
|
|
2538
|
+
_funds
|
|
2539
|
+
);
|
|
2540
|
+
};
|
|
2541
|
+
this.bond = async (fee = "auto", memo, _funds) => {
|
|
2542
|
+
return await this.client.execute(
|
|
2543
|
+
this.sender,
|
|
2544
|
+
this.contractAddress,
|
|
2545
|
+
{
|
|
2546
|
+
bond: {}
|
|
2547
|
+
},
|
|
2548
|
+
fee,
|
|
2549
|
+
memo,
|
|
2550
|
+
_funds
|
|
2551
|
+
);
|
|
2552
|
+
};
|
|
2553
|
+
this.withdraw = async ({
|
|
2554
|
+
amount
|
|
2555
|
+
}, fee = "auto", memo, _funds) => {
|
|
2556
|
+
return await this.client.execute(
|
|
2557
|
+
this.sender,
|
|
2558
|
+
this.contractAddress,
|
|
2559
|
+
{
|
|
2560
|
+
withdraw: {
|
|
2561
|
+
amount
|
|
2562
|
+
}
|
|
2563
|
+
},
|
|
2564
|
+
fee,
|
|
2565
|
+
memo,
|
|
2566
|
+
_funds
|
|
2567
|
+
);
|
|
2568
|
+
};
|
|
2569
|
+
this.client = client;
|
|
2570
|
+
this.sender = sender;
|
|
2571
|
+
this.contractAddress = contractAddress;
|
|
2572
|
+
this.setRoundInfo = this.setRoundInfo.bind(this);
|
|
2573
|
+
this.setWhitelists = this.setWhitelists.bind(this);
|
|
2574
|
+
this.setVoteOptionsMap = this.setVoteOptionsMap.bind(this);
|
|
2575
|
+
this.signUp = this.signUp.bind(this);
|
|
2576
|
+
this.startProcessPeriod = this.startProcessPeriod.bind(this);
|
|
2577
|
+
this.publishDeactivateMessage = this.publishDeactivateMessage.bind(this);
|
|
2578
|
+
this.processDeactivateMessage = this.processDeactivateMessage.bind(this);
|
|
2579
|
+
this.addNewKey = this.addNewKey.bind(this);
|
|
2580
|
+
this.preAddNewKey = this.preAddNewKey.bind(this);
|
|
2581
|
+
this.publishMessage = this.publishMessage.bind(this);
|
|
2582
|
+
this.processMessage = this.processMessage.bind(this);
|
|
2583
|
+
this.stopProcessingPeriod = this.stopProcessingPeriod.bind(this);
|
|
2584
|
+
this.processTally = this.processTally.bind(this);
|
|
2585
|
+
this.stopTallyingPeriod = this.stopTallyingPeriod.bind(this);
|
|
2586
|
+
this.grant = this.grant.bind(this);
|
|
2587
|
+
this.revoke = this.revoke.bind(this);
|
|
2588
|
+
this.bond = this.bond.bind(this);
|
|
2589
|
+
this.withdraw = this.withdraw.bind(this);
|
|
2590
|
+
}
|
|
2591
|
+
};
|
|
2592
|
+
|
|
2593
|
+
// src/libs/contract/ts/Registry.client.ts
|
|
2594
|
+
var RegistryQueryClient = class {
|
|
2595
|
+
constructor(client, contractAddress) {
|
|
2596
|
+
this.admin = async () => {
|
|
2597
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2598
|
+
admin: {}
|
|
2599
|
+
});
|
|
2600
|
+
};
|
|
2601
|
+
this.operator = async () => {
|
|
2602
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2603
|
+
operator: {}
|
|
2604
|
+
});
|
|
2605
|
+
};
|
|
2606
|
+
this.isMaciOperator = async ({
|
|
2607
|
+
address
|
|
2608
|
+
}) => {
|
|
2609
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2610
|
+
is_maci_operator: {
|
|
2611
|
+
address
|
|
2612
|
+
}
|
|
2613
|
+
});
|
|
2614
|
+
};
|
|
2615
|
+
this.isValidator = async ({ address }) => {
|
|
2616
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2617
|
+
is_validator: {
|
|
2618
|
+
address
|
|
2619
|
+
}
|
|
2620
|
+
});
|
|
2621
|
+
};
|
|
2622
|
+
this.getValidators = async () => {
|
|
2623
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2624
|
+
get_validators: {}
|
|
2625
|
+
});
|
|
2626
|
+
};
|
|
2627
|
+
this.getValidatorOperator = async ({
|
|
2628
|
+
address
|
|
2629
|
+
}) => {
|
|
2630
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2631
|
+
get_validator_operator: {
|
|
2632
|
+
address
|
|
2633
|
+
}
|
|
2634
|
+
});
|
|
2635
|
+
};
|
|
2636
|
+
this.getMaciOperatorPubkey = async ({
|
|
2637
|
+
address
|
|
2638
|
+
}) => {
|
|
2639
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2640
|
+
get_maci_operator_pubkey: {
|
|
2641
|
+
address
|
|
2642
|
+
}
|
|
2643
|
+
});
|
|
2644
|
+
};
|
|
2645
|
+
this.getMaciOperatorIdentity = async ({
|
|
2646
|
+
address
|
|
2647
|
+
}) => {
|
|
2648
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2649
|
+
get_maci_operator_identity: {
|
|
2650
|
+
address
|
|
2651
|
+
}
|
|
2652
|
+
});
|
|
2653
|
+
};
|
|
2654
|
+
this.client = client;
|
|
2655
|
+
this.contractAddress = contractAddress;
|
|
2656
|
+
this.admin = this.admin.bind(this);
|
|
2657
|
+
this.operator = this.operator.bind(this);
|
|
2658
|
+
this.isMaciOperator = this.isMaciOperator.bind(this);
|
|
2659
|
+
this.isValidator = this.isValidator.bind(this);
|
|
2660
|
+
this.getValidators = this.getValidators.bind(this);
|
|
2661
|
+
this.getValidatorOperator = this.getValidatorOperator.bind(this);
|
|
2662
|
+
this.getMaciOperatorPubkey = this.getMaciOperatorPubkey.bind(this);
|
|
2663
|
+
this.getMaciOperatorIdentity = this.getMaciOperatorIdentity.bind(this);
|
|
2664
|
+
}
|
|
2665
|
+
};
|
|
2666
|
+
var RegistryClient = class extends RegistryQueryClient {
|
|
2667
|
+
constructor(client, sender, contractAddress) {
|
|
2668
|
+
super(client, contractAddress);
|
|
2669
|
+
this.setMaciOperator = async ({
|
|
2670
|
+
operator
|
|
2671
|
+
}, fee = "auto", memo, _funds) => {
|
|
2672
|
+
return await this.client.execute(
|
|
2673
|
+
this.sender,
|
|
2674
|
+
this.contractAddress,
|
|
2675
|
+
{
|
|
2676
|
+
set_maci_operator: {
|
|
2677
|
+
operator
|
|
2678
|
+
}
|
|
2679
|
+
},
|
|
2680
|
+
fee,
|
|
2681
|
+
memo,
|
|
2682
|
+
_funds
|
|
2683
|
+
);
|
|
2684
|
+
};
|
|
2685
|
+
this.setMaciOperatorPubkey = async ({
|
|
2686
|
+
pubkey
|
|
2687
|
+
}, fee = "auto", memo, _funds) => {
|
|
2688
|
+
return await this.client.execute(
|
|
2689
|
+
this.sender,
|
|
2690
|
+
this.contractAddress,
|
|
2691
|
+
{
|
|
2692
|
+
set_maci_operator_pubkey: {
|
|
2693
|
+
pubkey
|
|
2694
|
+
}
|
|
2695
|
+
},
|
|
2696
|
+
fee,
|
|
2697
|
+
memo,
|
|
2698
|
+
_funds
|
|
2699
|
+
);
|
|
2700
|
+
};
|
|
2701
|
+
this.setMaciOperatorIdentity = async ({
|
|
2702
|
+
identity
|
|
2703
|
+
}, fee = "auto", memo, _funds) => {
|
|
2704
|
+
return await this.client.execute(
|
|
2705
|
+
this.sender,
|
|
2706
|
+
this.contractAddress,
|
|
2707
|
+
{
|
|
2708
|
+
set_maci_operator_identity: {
|
|
2709
|
+
identity
|
|
2710
|
+
}
|
|
2711
|
+
},
|
|
2712
|
+
fee,
|
|
2713
|
+
memo,
|
|
2714
|
+
_funds
|
|
2715
|
+
);
|
|
2716
|
+
};
|
|
2717
|
+
this.createRound = async ({
|
|
2718
|
+
certificationSystem,
|
|
2719
|
+
circuitType,
|
|
2720
|
+
maxOption,
|
|
2721
|
+
maxVoter,
|
|
2722
|
+
operator,
|
|
2723
|
+
preDeactivateRoot,
|
|
2724
|
+
roundInfo,
|
|
2725
|
+
voiceCreditAmount,
|
|
2726
|
+
votingTime,
|
|
2727
|
+
whitelist
|
|
2728
|
+
}, fee = "auto", memo, _funds) => {
|
|
2729
|
+
return await this.client.execute(
|
|
2730
|
+
this.sender,
|
|
2731
|
+
this.contractAddress,
|
|
2732
|
+
{
|
|
2733
|
+
create_round: {
|
|
2734
|
+
certification_system: certificationSystem,
|
|
2735
|
+
circuit_type: circuitType,
|
|
2736
|
+
max_option: maxOption,
|
|
2737
|
+
max_voter: maxVoter,
|
|
2738
|
+
operator,
|
|
2739
|
+
pre_deactivate_root: preDeactivateRoot,
|
|
2740
|
+
round_info: roundInfo,
|
|
2741
|
+
voice_credit_amount: voiceCreditAmount,
|
|
2742
|
+
voting_time: votingTime,
|
|
2743
|
+
whitelist
|
|
2744
|
+
}
|
|
2745
|
+
},
|
|
2746
|
+
fee,
|
|
2747
|
+
memo,
|
|
2748
|
+
_funds
|
|
2749
|
+
);
|
|
2750
|
+
};
|
|
2751
|
+
this.setValidators = async ({
|
|
2752
|
+
addresses
|
|
2753
|
+
}, fee = "auto", memo, _funds) => {
|
|
2754
|
+
return await this.client.execute(
|
|
2755
|
+
this.sender,
|
|
2756
|
+
this.contractAddress,
|
|
2757
|
+
{
|
|
2758
|
+
set_validators: {
|
|
2759
|
+
addresses
|
|
2760
|
+
}
|
|
2761
|
+
},
|
|
2762
|
+
fee,
|
|
2763
|
+
memo,
|
|
2764
|
+
_funds
|
|
2765
|
+
);
|
|
2766
|
+
};
|
|
2767
|
+
this.removeValidator = async ({
|
|
2768
|
+
address
|
|
2769
|
+
}, fee = "auto", memo, _funds) => {
|
|
2770
|
+
return await this.client.execute(
|
|
2771
|
+
this.sender,
|
|
2772
|
+
this.contractAddress,
|
|
2773
|
+
{
|
|
2774
|
+
remove_validator: {
|
|
2775
|
+
address
|
|
2776
|
+
}
|
|
2777
|
+
},
|
|
2778
|
+
fee,
|
|
2779
|
+
memo,
|
|
2780
|
+
_funds
|
|
2781
|
+
);
|
|
2782
|
+
};
|
|
2783
|
+
this.updateAmaciCodeId = async ({
|
|
2784
|
+
amaciCodeId
|
|
2785
|
+
}, fee = "auto", memo, _funds) => {
|
|
2786
|
+
return await this.client.execute(
|
|
2787
|
+
this.sender,
|
|
2788
|
+
this.contractAddress,
|
|
2789
|
+
{
|
|
2790
|
+
update_amaci_code_id: {
|
|
2791
|
+
amaci_code_id: amaciCodeId
|
|
2792
|
+
}
|
|
2793
|
+
},
|
|
2794
|
+
fee,
|
|
2795
|
+
memo,
|
|
2796
|
+
_funds
|
|
2797
|
+
);
|
|
2798
|
+
};
|
|
2799
|
+
this.changeOperator = async ({
|
|
2800
|
+
address
|
|
2801
|
+
}, fee = "auto", memo, _funds) => {
|
|
2802
|
+
return await this.client.execute(
|
|
2803
|
+
this.sender,
|
|
2804
|
+
this.contractAddress,
|
|
2805
|
+
{
|
|
2806
|
+
change_operator: {
|
|
2807
|
+
address
|
|
2808
|
+
}
|
|
2809
|
+
},
|
|
2810
|
+
fee,
|
|
2811
|
+
memo,
|
|
2812
|
+
_funds
|
|
2813
|
+
);
|
|
2814
|
+
};
|
|
2815
|
+
this.client = client;
|
|
2816
|
+
this.sender = sender;
|
|
2817
|
+
this.contractAddress = contractAddress;
|
|
2818
|
+
this.setMaciOperator = this.setMaciOperator.bind(this);
|
|
2819
|
+
this.setMaciOperatorPubkey = this.setMaciOperatorPubkey.bind(this);
|
|
2820
|
+
this.setMaciOperatorIdentity = this.setMaciOperatorIdentity.bind(this);
|
|
2821
|
+
this.createRound = this.createRound.bind(this);
|
|
2822
|
+
this.setValidators = this.setValidators.bind(this);
|
|
2823
|
+
this.removeValidator = this.removeValidator.bind(this);
|
|
2824
|
+
this.updateAmaciCodeId = this.updateAmaciCodeId.bind(this);
|
|
2825
|
+
this.changeOperator = this.changeOperator.bind(this);
|
|
2826
|
+
}
|
|
2827
|
+
};
|
|
2828
|
+
|
|
2829
|
+
// src/libs/contract/ts/OracleMaci.client.ts
|
|
2830
|
+
var OracleMaciQueryClient = class {
|
|
2831
|
+
constructor(client, contractAddress) {
|
|
2832
|
+
this.getRoundInfo = async () => {
|
|
2833
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2834
|
+
get_round_info: {}
|
|
2835
|
+
});
|
|
2836
|
+
};
|
|
2837
|
+
this.getVotingTime = async () => {
|
|
2838
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2839
|
+
get_voting_time: {}
|
|
2840
|
+
});
|
|
2841
|
+
};
|
|
2842
|
+
this.getPeriod = async () => {
|
|
2843
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2844
|
+
get_period: {}
|
|
2845
|
+
});
|
|
2846
|
+
};
|
|
2847
|
+
this.getNumSignUp = async () => {
|
|
2848
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2849
|
+
get_num_sign_up: {}
|
|
2850
|
+
});
|
|
2851
|
+
};
|
|
2852
|
+
this.getMsgChainLength = async () => {
|
|
2853
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2854
|
+
get_msg_chain_length: {}
|
|
2855
|
+
});
|
|
2856
|
+
};
|
|
2857
|
+
this.getProcessedMsgCount = async () => {
|
|
2858
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2859
|
+
get_processed_msg_count: {}
|
|
2860
|
+
});
|
|
2861
|
+
};
|
|
2862
|
+
this.getProcessedUserCount = async () => {
|
|
2863
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2864
|
+
get_processed_user_count: {}
|
|
2865
|
+
});
|
|
2866
|
+
};
|
|
2867
|
+
this.getResult = async ({
|
|
2868
|
+
index
|
|
2869
|
+
}) => {
|
|
2870
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2871
|
+
get_result: {
|
|
2872
|
+
index
|
|
2873
|
+
}
|
|
2874
|
+
});
|
|
2875
|
+
};
|
|
2876
|
+
this.getAllResult = async () => {
|
|
2877
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2878
|
+
get_all_result: {}
|
|
2879
|
+
});
|
|
2880
|
+
};
|
|
2881
|
+
this.getStateIdxInc = async ({
|
|
2882
|
+
address
|
|
2883
|
+
}) => {
|
|
2884
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2885
|
+
get_state_idx_inc: {
|
|
2886
|
+
address
|
|
2887
|
+
}
|
|
2888
|
+
});
|
|
2889
|
+
};
|
|
2890
|
+
this.getVoiceCreditBalance = async ({
|
|
2891
|
+
index
|
|
2892
|
+
}) => {
|
|
2893
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2894
|
+
get_voice_credit_balance: {
|
|
2895
|
+
index
|
|
2896
|
+
}
|
|
2897
|
+
});
|
|
2898
|
+
};
|
|
2899
|
+
this.isWhiteList = async ({
|
|
2900
|
+
amount,
|
|
2901
|
+
certificate,
|
|
2902
|
+
sender
|
|
2903
|
+
}) => {
|
|
2904
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2905
|
+
is_white_list: {
|
|
2906
|
+
amount,
|
|
2907
|
+
certificate,
|
|
2908
|
+
sender
|
|
2909
|
+
}
|
|
2910
|
+
});
|
|
2911
|
+
};
|
|
2912
|
+
this.whiteBalanceOf = async ({
|
|
2913
|
+
amount,
|
|
2914
|
+
certificate,
|
|
2915
|
+
sender
|
|
2916
|
+
}) => {
|
|
2917
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2918
|
+
white_balance_of: {
|
|
2919
|
+
amount,
|
|
2920
|
+
certificate,
|
|
2921
|
+
sender
|
|
2922
|
+
}
|
|
2923
|
+
});
|
|
2924
|
+
};
|
|
2925
|
+
this.whiteInfo = async ({
|
|
2926
|
+
sender
|
|
2927
|
+
}) => {
|
|
2928
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2929
|
+
white_info: {
|
|
2930
|
+
sender
|
|
2931
|
+
}
|
|
2932
|
+
});
|
|
2933
|
+
};
|
|
2934
|
+
this.grantInfo = async ({
|
|
2935
|
+
grantee
|
|
2936
|
+
}) => {
|
|
2937
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2938
|
+
grant_info: {
|
|
2939
|
+
grantee
|
|
2940
|
+
}
|
|
2941
|
+
});
|
|
2942
|
+
};
|
|
2943
|
+
this.maxWhitelistNum = async () => {
|
|
2944
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2945
|
+
max_whitelist_num: {}
|
|
2946
|
+
});
|
|
2947
|
+
};
|
|
2948
|
+
this.voteOptionMap = async () => {
|
|
2949
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2950
|
+
vote_option_map: {}
|
|
2951
|
+
});
|
|
2952
|
+
};
|
|
2953
|
+
this.maxVoteOptions = async () => {
|
|
2954
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2955
|
+
max_vote_options: {}
|
|
2956
|
+
});
|
|
2957
|
+
};
|
|
2958
|
+
this.queryTotalFeeGrant = async () => {
|
|
2959
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2960
|
+
query_total_fee_grant: {}
|
|
2961
|
+
});
|
|
2962
|
+
};
|
|
2963
|
+
this.queryCircuitType = async () => {
|
|
2964
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2965
|
+
query_circuit_type: {}
|
|
2966
|
+
});
|
|
2967
|
+
};
|
|
2968
|
+
this.queryCertSystem = async () => {
|
|
2969
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2970
|
+
query_cert_system: {}
|
|
2971
|
+
});
|
|
2972
|
+
};
|
|
2973
|
+
this.queryOracleWhitelistConfig = async () => {
|
|
2974
|
+
return this.client.queryContractSmart(this.contractAddress, {
|
|
2975
|
+
query_oracle_whitelist_config: {}
|
|
2976
|
+
});
|
|
2977
|
+
};
|
|
2978
|
+
this.client = client;
|
|
2979
|
+
this.contractAddress = contractAddress;
|
|
2980
|
+
this.getRoundInfo = this.getRoundInfo.bind(this);
|
|
2981
|
+
this.getVotingTime = this.getVotingTime.bind(this);
|
|
2982
|
+
this.getPeriod = this.getPeriod.bind(this);
|
|
2983
|
+
this.getNumSignUp = this.getNumSignUp.bind(this);
|
|
2984
|
+
this.getMsgChainLength = this.getMsgChainLength.bind(this);
|
|
2985
|
+
this.getProcessedMsgCount = this.getProcessedMsgCount.bind(this);
|
|
2986
|
+
this.getProcessedUserCount = this.getProcessedUserCount.bind(this);
|
|
2987
|
+
this.getResult = this.getResult.bind(this);
|
|
2988
|
+
this.getAllResult = this.getAllResult.bind(this);
|
|
2989
|
+
this.getStateIdxInc = this.getStateIdxInc.bind(this);
|
|
2990
|
+
this.getVoiceCreditBalance = this.getVoiceCreditBalance.bind(this);
|
|
2991
|
+
this.isWhiteList = this.isWhiteList.bind(this);
|
|
2992
|
+
this.whiteBalanceOf = this.whiteBalanceOf.bind(this);
|
|
2993
|
+
this.whiteInfo = this.whiteInfo.bind(this);
|
|
2994
|
+
this.grantInfo = this.grantInfo.bind(this);
|
|
2995
|
+
this.maxWhitelistNum = this.maxWhitelistNum.bind(this);
|
|
2996
|
+
this.voteOptionMap = this.voteOptionMap.bind(this);
|
|
2997
|
+
this.maxVoteOptions = this.maxVoteOptions.bind(this);
|
|
2998
|
+
this.queryTotalFeeGrant = this.queryTotalFeeGrant.bind(this);
|
|
2999
|
+
this.queryCircuitType = this.queryCircuitType.bind(this);
|
|
3000
|
+
this.queryCertSystem = this.queryCertSystem.bind(this);
|
|
3001
|
+
this.queryOracleWhitelistConfig = this.queryOracleWhitelistConfig.bind(this);
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
3004
|
+
var OracleMaciClient = class extends OracleMaciQueryClient {
|
|
3005
|
+
constructor(client, sender, contractAddress) {
|
|
3006
|
+
super(client, contractAddress);
|
|
3007
|
+
this.setParams = async ({
|
|
3008
|
+
intStateTreeDepth,
|
|
3009
|
+
messageBatchSize,
|
|
3010
|
+
stateTreeDepth,
|
|
3011
|
+
voteOptionTreeDepth
|
|
3012
|
+
}, fee = "auto", memo, _funds) => {
|
|
3013
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3014
|
+
set_params: {
|
|
3015
|
+
int_state_tree_depth: intStateTreeDepth,
|
|
3016
|
+
message_batch_size: messageBatchSize,
|
|
3017
|
+
state_tree_depth: stateTreeDepth,
|
|
3018
|
+
vote_option_tree_depth: voteOptionTreeDepth
|
|
3019
|
+
}
|
|
3020
|
+
}, fee, memo, _funds);
|
|
3021
|
+
};
|
|
3022
|
+
this.setRoundInfo = async ({
|
|
3023
|
+
roundInfo
|
|
3024
|
+
}, fee = "auto", memo, _funds) => {
|
|
3025
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3026
|
+
set_round_info: {
|
|
3027
|
+
round_info: roundInfo
|
|
3028
|
+
}
|
|
3029
|
+
}, fee, memo, _funds);
|
|
3030
|
+
};
|
|
3031
|
+
this.setVoteOptionsMap = async ({
|
|
3032
|
+
voteOptionMap
|
|
3033
|
+
}, fee = "auto", memo, _funds) => {
|
|
3034
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3035
|
+
set_vote_options_map: {
|
|
3036
|
+
vote_option_map: voteOptionMap
|
|
3037
|
+
}
|
|
3038
|
+
}, fee, memo, _funds);
|
|
3039
|
+
};
|
|
3040
|
+
this.startVotingPeriod = async (fee = "auto", memo, _funds) => {
|
|
3041
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3042
|
+
start_voting_period: {}
|
|
3043
|
+
}, fee, memo, _funds);
|
|
3044
|
+
};
|
|
3045
|
+
this.signUp = async ({
|
|
3046
|
+
amount,
|
|
3047
|
+
certificate,
|
|
3048
|
+
pubkey
|
|
3049
|
+
}, fee = "auto", memo, _funds) => {
|
|
3050
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3051
|
+
sign_up: {
|
|
3052
|
+
amount,
|
|
3053
|
+
certificate,
|
|
3054
|
+
pubkey
|
|
3055
|
+
}
|
|
3056
|
+
}, fee, memo, _funds);
|
|
3057
|
+
};
|
|
3058
|
+
this.startProcessPeriod = async (fee = "auto", memo, _funds) => {
|
|
3059
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3060
|
+
start_process_period: {}
|
|
3061
|
+
}, fee, memo, _funds);
|
|
3062
|
+
};
|
|
3063
|
+
this.stopVotingPeriod = async (fee = "auto", memo, _funds) => {
|
|
3064
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3065
|
+
stop_voting_period: {}
|
|
3066
|
+
}, fee, memo, _funds);
|
|
3067
|
+
};
|
|
3068
|
+
this.publishMessage = async ({
|
|
3069
|
+
encPubKey,
|
|
3070
|
+
message
|
|
3071
|
+
}, fee = "auto", memo, _funds) => {
|
|
3072
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3073
|
+
publish_message: {
|
|
3074
|
+
enc_pub_key: encPubKey,
|
|
3075
|
+
message
|
|
3076
|
+
}
|
|
3077
|
+
}, fee, memo, _funds);
|
|
3078
|
+
};
|
|
3079
|
+
this.processMessage = async ({
|
|
3080
|
+
groth16Proof,
|
|
3081
|
+
newStateCommitment,
|
|
3082
|
+
plonkProof
|
|
3083
|
+
}, fee = "auto", memo, _funds) => {
|
|
3084
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3085
|
+
process_message: {
|
|
3086
|
+
groth16_proof: groth16Proof,
|
|
3087
|
+
new_state_commitment: newStateCommitment,
|
|
3088
|
+
plonk_proof: plonkProof
|
|
3089
|
+
}
|
|
3090
|
+
}, fee, memo, _funds);
|
|
3091
|
+
};
|
|
3092
|
+
this.stopProcessingPeriod = async (fee = "auto", memo, _funds) => {
|
|
3093
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3094
|
+
stop_processing_period: {}
|
|
3095
|
+
}, fee, memo, _funds);
|
|
3096
|
+
};
|
|
3097
|
+
this.processTally = async ({
|
|
3098
|
+
groth16Proof,
|
|
3099
|
+
newTallyCommitment,
|
|
3100
|
+
plonkProof
|
|
3101
|
+
}, fee = "auto", memo, _funds) => {
|
|
3102
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3103
|
+
process_tally: {
|
|
3104
|
+
groth16_proof: groth16Proof,
|
|
3105
|
+
new_tally_commitment: newTallyCommitment,
|
|
3106
|
+
plonk_proof: plonkProof
|
|
3107
|
+
}
|
|
3108
|
+
}, fee, memo, _funds);
|
|
3109
|
+
};
|
|
3110
|
+
this.stopTallyingPeriod = async ({
|
|
3111
|
+
results,
|
|
3112
|
+
salt
|
|
3113
|
+
}, fee = "auto", memo, _funds) => {
|
|
3114
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3115
|
+
stop_tallying_period: {
|
|
3116
|
+
results,
|
|
3117
|
+
salt
|
|
3118
|
+
}
|
|
3119
|
+
}, fee, memo, _funds);
|
|
3120
|
+
};
|
|
3121
|
+
this.grant = async ({
|
|
3122
|
+
baseAmount,
|
|
3123
|
+
grantee
|
|
3124
|
+
}, fee = "auto", memo, _funds) => {
|
|
3125
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3126
|
+
grant: {
|
|
3127
|
+
base_amount: baseAmount,
|
|
3128
|
+
grantee
|
|
3129
|
+
}
|
|
3130
|
+
}, fee, memo, _funds);
|
|
3131
|
+
};
|
|
3132
|
+
this.revoke = async ({
|
|
3133
|
+
grantee
|
|
3134
|
+
}, fee = "auto", memo, _funds) => {
|
|
3135
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3136
|
+
revoke: {
|
|
3137
|
+
grantee
|
|
3138
|
+
}
|
|
3139
|
+
}, fee, memo, _funds);
|
|
3140
|
+
};
|
|
3141
|
+
this.bond = async (fee = "auto", memo, _funds) => {
|
|
3142
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3143
|
+
bond: {}
|
|
3144
|
+
}, fee, memo, _funds);
|
|
3145
|
+
};
|
|
3146
|
+
this.withdraw = async ({
|
|
3147
|
+
amount
|
|
3148
|
+
}, fee = "auto", memo, _funds) => {
|
|
3149
|
+
return await this.client.execute(this.sender, this.contractAddress, {
|
|
3150
|
+
withdraw: {
|
|
3151
|
+
amount
|
|
3152
|
+
}
|
|
3153
|
+
}, fee, memo, _funds);
|
|
3154
|
+
};
|
|
3155
|
+
this.client = client;
|
|
3156
|
+
this.sender = sender;
|
|
3157
|
+
this.contractAddress = contractAddress;
|
|
3158
|
+
this.setParams = this.setParams.bind(this);
|
|
3159
|
+
this.setRoundInfo = this.setRoundInfo.bind(this);
|
|
3160
|
+
this.setVoteOptionsMap = this.setVoteOptionsMap.bind(this);
|
|
3161
|
+
this.startVotingPeriod = this.startVotingPeriod.bind(this);
|
|
3162
|
+
this.signUp = this.signUp.bind(this);
|
|
3163
|
+
this.startProcessPeriod = this.startProcessPeriod.bind(this);
|
|
3164
|
+
this.stopVotingPeriod = this.stopVotingPeriod.bind(this);
|
|
3165
|
+
this.publishMessage = this.publishMessage.bind(this);
|
|
3166
|
+
this.processMessage = this.processMessage.bind(this);
|
|
3167
|
+
this.stopProcessingPeriod = this.stopProcessingPeriod.bind(this);
|
|
3168
|
+
this.processTally = this.processTally.bind(this);
|
|
3169
|
+
this.stopTallyingPeriod = this.stopTallyingPeriod.bind(this);
|
|
3170
|
+
this.grant = this.grant.bind(this);
|
|
3171
|
+
this.revoke = this.revoke.bind(this);
|
|
3172
|
+
this.bond = this.bond.bind(this);
|
|
3173
|
+
this.withdraw = this.withdraw.bind(this);
|
|
3174
|
+
}
|
|
3175
|
+
};
|
|
3176
|
+
|
|
3177
|
+
// src/libs/contract/config.ts
|
|
3178
|
+
var defaultSigningClientOptions = {
|
|
3179
|
+
broadcastPollIntervalMs: 8e3,
|
|
3180
|
+
broadcastTimeoutMs: 64e3,
|
|
3181
|
+
gasPrice: import_stargate.GasPrice.fromString("100000000000peaka")
|
|
3182
|
+
};
|
|
3183
|
+
async function createMaciClientBy({
|
|
3184
|
+
rpcEndpoint,
|
|
3185
|
+
wallet,
|
|
3186
|
+
contractAddress
|
|
3187
|
+
}) {
|
|
3188
|
+
const signingCosmWasmClient = await createContractClientByWallet(
|
|
3189
|
+
rpcEndpoint,
|
|
3190
|
+
wallet
|
|
3191
|
+
);
|
|
3192
|
+
const [{ address }] = await wallet.getAccounts();
|
|
3193
|
+
return new MaciClient(signingCosmWasmClient, address, contractAddress);
|
|
3194
|
+
}
|
|
3195
|
+
async function createAMaciClientBy({
|
|
3196
|
+
rpcEndpoint,
|
|
3197
|
+
wallet,
|
|
3198
|
+
contractAddress
|
|
3199
|
+
}) {
|
|
3200
|
+
const signingCosmWasmClient = await createContractClientByWallet(
|
|
3201
|
+
rpcEndpoint,
|
|
3202
|
+
wallet
|
|
3203
|
+
);
|
|
3204
|
+
const [{ address }] = await wallet.getAccounts();
|
|
3205
|
+
return new AMaciClient(signingCosmWasmClient, address, contractAddress);
|
|
3206
|
+
}
|
|
3207
|
+
async function createRegistryClientBy({
|
|
3208
|
+
rpcEndpoint,
|
|
3209
|
+
wallet,
|
|
3210
|
+
contractAddress
|
|
3211
|
+
}) {
|
|
3212
|
+
const signingCosmWasmClient = await createContractClientByWallet(
|
|
3213
|
+
rpcEndpoint,
|
|
3214
|
+
wallet
|
|
3215
|
+
);
|
|
3216
|
+
const [{ address }] = await wallet.getAccounts();
|
|
3217
|
+
return new RegistryClient(signingCosmWasmClient, address, contractAddress);
|
|
3218
|
+
}
|
|
3219
|
+
async function createOracleMaciClientBy({
|
|
3220
|
+
rpcEndpoint,
|
|
3221
|
+
wallet,
|
|
3222
|
+
contractAddress
|
|
3223
|
+
}) {
|
|
3224
|
+
const signingCosmWasmClient = await createContractClientByWallet(
|
|
3225
|
+
rpcEndpoint,
|
|
3226
|
+
wallet
|
|
3227
|
+
);
|
|
3228
|
+
const [{ address }] = await wallet.getAccounts();
|
|
3229
|
+
return new OracleMaciClient(signingCosmWasmClient, address, contractAddress);
|
|
3230
|
+
}
|
|
3231
|
+
async function createContractClientByWallet(rpcEndpoint, wallet) {
|
|
3232
|
+
const client = await import_cosmwasm_stargate.SigningCosmWasmClient.connectWithSigner(
|
|
3233
|
+
rpcEndpoint,
|
|
3234
|
+
wallet,
|
|
3235
|
+
{
|
|
3236
|
+
...defaultSigningClientOptions
|
|
3237
|
+
}
|
|
3238
|
+
);
|
|
3239
|
+
return client;
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3242
|
+
// src/libs/contract/vars.ts
|
|
3243
|
+
var CIRCUIT_INFO = {
|
|
3244
|
+
"2-1-1-5": {
|
|
3245
|
+
parameter: {
|
|
3246
|
+
state_tree_depth: "2",
|
|
3247
|
+
int_state_tree_depth: "1",
|
|
3248
|
+
vote_option_tree_depth: "1",
|
|
3249
|
+
message_batch_size: "5"
|
|
3250
|
+
},
|
|
3251
|
+
groth16: {
|
|
3252
|
+
process_vkey: {
|
|
3253
|
+
vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
|
|
3254
|
+
vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
|
|
3255
|
+
vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3256
|
+
vk_delta_2: "2178a9c3805dd82071b2b28bb4c0ffc8178cad913c8c990b98b4863284dc3a5d175c0be554fc060c27c551e5e32effef015b918a0f5a2dc1b92909b8272719301c521d5f6542db5ea4775a42d32159c356a696599c1a3df011ec00559ae1c2b60d860f7e6513a7d20feaeaca401863e35a0f691dd7d30ce06d07946840de1ec8",
|
|
3257
|
+
vk_ic0: "19126a54a9b6d0d415f892c246485cb2889487cf9c4a8cd88dab5e1140e1d0630d1d76ef4652df8887c9dc557aa57f25e221db7e5b2e4cf618a362bece107f5c",
|
|
3258
|
+
vk_ic1: "0632e625fefc7172e8aec1070c4d32b90b6c482f6f3806773a4c55a03877c2d716cfd935eb3e3883f580c93f56adbf3a253ce3c208c52fb784f9d8fec139c617"
|
|
3259
|
+
},
|
|
3260
|
+
tally_vkey: {
|
|
3261
|
+
vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
|
|
3262
|
+
vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
|
|
3263
|
+
vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3264
|
+
vk_delta_2: "2e9fad39728c543c5213599111e1a44b01720c999a6785e8136c3e3b3bf8e07e248e1933d477969ca6e27cb7a74bca18cac7e3bbdf9371be5c54fe151f6376a30955609ec69b89329322a2f435b706ca248d1312c7513853a50ef37ed0f7826c25a5c57bf07789d89e538bc24017cf2722811f21480b0bb8030ed0028ecb7cd8",
|
|
3265
|
+
vk_ic0: "1bc1a1a3444256469c07cd6f4d1cfd9f7c9ddce596a306e0af077ca9e9c0fe9602db2a9aecef76a9dc4c19bf88c0099b04fc75410cc9004f0966440825e3790a",
|
|
3266
|
+
vk_ic1: "05b8b475f2bfedba4fa04ab1972006da9764c2c3e6fb65d6dd0aac938fd298112a560e13770b06a3f709a49fddf016331ea205fa125026993f6666eff69f4def"
|
|
3267
|
+
}
|
|
3268
|
+
},
|
|
3269
|
+
plonk: {
|
|
3270
|
+
process_vkey: {
|
|
3271
|
+
n: 1048575,
|
|
3272
|
+
num_inputs: 1,
|
|
3273
|
+
selector_commitments: [
|
|
3274
|
+
"29b0f4a90bea69583a8fca1e74d23adf739d605af605a0e0971fac548df976fb2e10a42dfca2325684c1bca5fabbf9d7022fc8b997ea478f1052dd8808d99e44",
|
|
3275
|
+
"119002055b6c2f98314ef408e4a917a6678f114ca991185749289f171f61efc32b3a931c700271b82d22c2073af9b7fffcb7bfa644ea09102d9ef8482410a991",
|
|
3276
|
+
"10c5f32870d26f8e26d2eaae2705557b18210b2355677172e1bef5fe684120891f8317185390ddbb22ecb922d37e03c3cc524c84f65c8045f2324b0f164cfbdb",
|
|
3277
|
+
"115a5f9af5d438d3261cfa31b7050b931b7d22647f628a43af41a41dcd44cb8d2e99368eb15cdc6d1f16faf9db0db4825613d6893c776aef456705bdc76eb728",
|
|
3278
|
+
"1a61cc5f0fbe92fbc8c9bd58928ce467f63e4771e4d517966afbaf220ea069a91cec3231c370be07fee8d9ec01660d054c549b034715855ffa652ad5b67ced86",
|
|
3279
|
+
"19e0d095a343115f6e7ad7ae1f51e375cd648fb35451cb2d5a8cf3bafbb25d0525efdc2cc5b5600ee0ae954dca3bf67c8277d470161fe23b4be7a5bcdf641e68"
|
|
3280
|
+
],
|
|
3281
|
+
next_step_selector_commitments: [
|
|
3282
|
+
"246ce82e01ed312e81492f132da2ee16bc13cc0024fbcc668de30173ad59067f0f072a892451cc495f5d9b8b99c8dc29be1d42d3004aed45fd5b2cd32a420016"
|
|
3283
|
+
],
|
|
3284
|
+
permutation_commitments: [
|
|
3285
|
+
"19c4143f41738480adc5ae49922d31b8a5afaa1d25ced5c20b869c0e1ccad91920c267c53d33907318cd194ba2ea08a85f250779765ba4121f7a0edfe1afe22b",
|
|
3286
|
+
"114bda14aa702a0815e3f91318a08a2798244420fd6675c8fc3cc2b0232298890d2eb3c1f27a83f4a3be777524d6cc65aa435e0a472fae8d1158e0a6ded685d0",
|
|
3287
|
+
"289f0b046968d2c095d05350e43996756fc85d2deb0e267a069615f0889a249413bdbe6f09edb4db956b8f3fc4488c4681cd52469dc0d419dab99a65b88309f7",
|
|
3288
|
+
"16dd74a2089960aac0d68309d5e81c6b45c29fafe4d42c922c06eb633ed48d551d347d1f43ee9b137772eefc43a6dcdf5ac35ee1615bc8f7c243bce071c410a9"
|
|
3289
|
+
],
|
|
3290
|
+
non_residues: [
|
|
3291
|
+
"0000000000000000000000000000000000000000000000000000000000000005",
|
|
3292
|
+
"0000000000000000000000000000000000000000000000000000000000000007",
|
|
3293
|
+
"000000000000000000000000000000000000000000000000000000000000000a"
|
|
3294
|
+
],
|
|
3295
|
+
g2_elements: [
|
|
3296
|
+
"198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3297
|
+
"260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
|
|
3298
|
+
]
|
|
3299
|
+
},
|
|
3300
|
+
tally_vkey: {
|
|
3301
|
+
n: 524287,
|
|
3302
|
+
num_inputs: 1,
|
|
3303
|
+
selector_commitments: [
|
|
3304
|
+
"18c2bb75c8ed53a5d15a56cc91c56f14c832419994ce7187c7c98b5e622cac0808b773f05e09822d8d267646198a78359ea2aa6fbaeb01317142f99fd11da6c0",
|
|
3305
|
+
"181499098243a5968f5490b7759aa15f0f769f24f3f4219b69f96913cf4fb23c1cd7b3f109196d7577390fd2e6d3930a71b0559aff756f3ca43eef66ce7333f4",
|
|
3306
|
+
"07ba2bdd452503fb16b56ea2940e95a98118c9dd120ae192680fe2b80bdb26f10ac6cdc7cb12b581a8c64d45b5af3d253c4282405eed3fd4d091ae05aac45cb6",
|
|
3307
|
+
"1caf01f1775eeafa78a11202e926ee92be997ce040f9c6fbce161348a40aeda70d9f15738cccf538083784e566ceef651d000223ae810c980e2d5d98b91b4665",
|
|
3308
|
+
"2c377c69cae1d591af413da2fd986ef3dca595d0c5817ee4932b92169d37c52d1218ce63dde705ebd1dc66d9b62daca287e4fdf6800b69204e5b78bfe84365a1",
|
|
3309
|
+
"175dd4ff280e39f0e080c181f853845e40c4b91709a93e4398d24befc9cf556903675361817e031e86bd896ff1dd7bc1cc31ca920a101499db0c58d77f0730ec"
|
|
3310
|
+
],
|
|
3311
|
+
next_step_selector_commitments: [
|
|
3312
|
+
"12d76999d26137d433f7119ab34f3fc63cfedb9172052cfb34acfc3cdc570f511aba802ebe92b87f913496314b938cf526078280a68826c90b686b90420c7742"
|
|
3313
|
+
],
|
|
3314
|
+
permutation_commitments: [
|
|
3315
|
+
"167b05c0132399e7126e8d16efb224b1c6729942048fc7e730fd1451116e0a6e05acaf2a6d2c88cc25610474b651c8cdcb7e8e14e59ddfad819123e888c4b1b6",
|
|
3316
|
+
"25aed62de4b701dc645e076543e2553c306010f2776c74edae55ea5253d9540403d042c4cb699cc04b2bb63d3c3edc0c85b049a84dc2fd44369f957d81363563",
|
|
3317
|
+
"0e77fb0b0e84da1d955da3d66dbb8fa3988f22e999a34bc4ac537a0f9187ac40156f8d7cb6d005fd85a0178d794f941b4e84832fd389a37c2a78112dac09b758",
|
|
3318
|
+
"051d3d906d457eaa9eff77a296dfa1760fd9ea379eec60487be38de91545ca2c1fcf457d6ac31afee10951245b0cc1e2c7674596f65955d189d48b6938fb3594"
|
|
3319
|
+
],
|
|
3320
|
+
non_residues: [
|
|
3321
|
+
"0000000000000000000000000000000000000000000000000000000000000005",
|
|
3322
|
+
"0000000000000000000000000000000000000000000000000000000000000007",
|
|
3323
|
+
"000000000000000000000000000000000000000000000000000000000000000a"
|
|
3324
|
+
],
|
|
3325
|
+
g2_elements: [
|
|
3326
|
+
"198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3327
|
+
"260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
|
|
3328
|
+
]
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
},
|
|
3332
|
+
"4-2-2-25": {
|
|
3333
|
+
parameter: {
|
|
3334
|
+
state_tree_depth: "4",
|
|
3335
|
+
int_state_tree_depth: "2",
|
|
3336
|
+
vote_option_tree_depth: "2",
|
|
3337
|
+
message_batch_size: "25"
|
|
3338
|
+
},
|
|
3339
|
+
groth16: {
|
|
3340
|
+
process_vkey: {
|
|
3341
|
+
vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
|
|
3342
|
+
vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
|
|
3343
|
+
vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3344
|
+
vk_delta_2: "0d0fe390b9dd4d1d0f486787b6ea96765cbeaa8f00310fecc3429673c5866c081a27998596ba296f66f3f7b5e2450d1ce1bcc535c133b2e8b577ba07dc1ccb4c1895f7afb9b3168a6d628c9173157cd56ca51948cc66c129a25f80e3b665e4b12c9c50f0cc0d070978ed2fb8ce15956d67c5dc6c07c7f45f1facfb5522d7b656",
|
|
3345
|
+
vk_ic0: "0ff2b22774da5c0ba94db4d759827b8c962aaf44db2649eb10407de02a40463a26497581d6d0979ad7f9057f26e048109158b0872700e2ad8447ffc9b4bf146b",
|
|
3346
|
+
vk_ic1: "0a47be101a59d20641e1369c0b2b9fb839cd35ecbfbeac3866df43723b70c78d17e96303c417743d93b7726805b736f364d305036b50e4ad1b885fc41284daf5"
|
|
3347
|
+
},
|
|
3348
|
+
tally_vkey: {
|
|
3349
|
+
vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
|
|
3350
|
+
vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
|
|
3351
|
+
vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3352
|
+
vk_delta_2: "08e44e0876bd574d8a3411e374884eb61da7292ca52903fa96553c37311b66ce0f2f529e59b1d37e55794a575d0f87548ca0d03331c19689bc203a68c1c4bae20e9fd25a7bffaa9b7409e694a48bc0d57f42df164d4a01bd5deecffedd2d3a3125eff290efb93eaf9c578cc7ee9d00406137607b9602de02424ff413ac948690",
|
|
3353
|
+
vk_ic0: "295c8e84b4b6b8de44b24f80eb5cae1df65e4877c4af8da2dbadfbfc3586dc790661b9e636f2c2a83028d11cbb7c753675481b65a5dfe32fff7a558231b3c9ef",
|
|
3354
|
+
vk_ic1: "299cfb28054cde0470bd7ff280349089350226d1ca154dcf6544b2680bf3bea925026e6644668273d6066ef6766c2f561c3607c523fbbd1379c5002376ef69c3"
|
|
3355
|
+
}
|
|
3356
|
+
},
|
|
3357
|
+
plonk: {
|
|
3358
|
+
process_vkey: {
|
|
3359
|
+
n: 2097151,
|
|
3360
|
+
num_inputs: 1,
|
|
3361
|
+
selector_commitments: [
|
|
3362
|
+
"126cbf10e0b68a56d45614be16c5bb48bd1374478e17b9fe1a78b726ea70f9b21f3cd20fd178d89e5923c422ef050ccc7134fbd76c9efdbb90f677ee41e01edb",
|
|
3363
|
+
"12813166f206c95eddd998a40d8d2e54e29dd393f543e3583a7999b18d674832024cdd935540bd3b96207ec0609c6718ad8b14e2ef315594454c57d606494485",
|
|
3364
|
+
"05da9eea3ee7151355067ced11a8e8ff57a56c758493afc9cbb6cfbacfc42e7b08993dfa25c85f20aeb7f64e87fe56ac8066cf6b8479dc96294e302ef5d55372",
|
|
3365
|
+
"2e446e540bacde7daea23c93a67bc6b1424b7c16b33fd2cee251b0d093cd78300030b8e340f01f320639d60b77724e58fc8a2d778b7b2a5df2c953ce34debeea",
|
|
3366
|
+
"1cf8c75b18071ede19d196b46a8776efc29ac514458a698d9f2e50b7bc692f6e06f7ff96897240eca31058fe330e8cbcd911324b79a3a34d03340a3cfed85fd5",
|
|
3367
|
+
"17101fb5c293438a695075b221219679e278e4bd147239c9fc69081b19cacefe218eb895f1456ca81e29731967588aee4b0758ea51aa28e5fefc81fed4a11513"
|
|
3368
|
+
],
|
|
3369
|
+
next_step_selector_commitments: [
|
|
3370
|
+
"0cebff4fe8cd70325f986088a1e17ae129a025481137bd80aef9c1f1c2e52f1e265a4ccae1ed89cb2fba527165f007898e70f988311ee4e4e87e41376cfeed03"
|
|
3371
|
+
],
|
|
3372
|
+
permutation_commitments: [
|
|
3373
|
+
"025b5db167721133693f0b6d9d7cfadce68ad15365ef1605dda4a6c809edeea61927b27ca11713fc683c88f6330e9621837b05e5db74d5994d1cf04bc3d529b3",
|
|
3374
|
+
"1fac93999f33b145613901846e6403d7f4237d582b51ccc4fb5c70038284c6e21cc804cc3cf7170b96da74fcbb30c81cd8c3405a629327c657025db7332f169a",
|
|
3375
|
+
"0b6d7d383de73dbfc16f2c0f3af763135ff05a12ec937548008cfee944c195f902336a68a50f62f595953e44401e872fb41abb66a733684b079ffe550d09c233",
|
|
3376
|
+
"225a1f5e92d105d3be026ae68904826f89b786faad75a846ef966ed714568bba28d1388786fde71dea206cdef16faa7a589e90863e6245d271e3f154c75c5531"
|
|
3377
|
+
],
|
|
3378
|
+
non_residues: [
|
|
3379
|
+
"0000000000000000000000000000000000000000000000000000000000000005",
|
|
3380
|
+
"0000000000000000000000000000000000000000000000000000000000000007",
|
|
3381
|
+
"000000000000000000000000000000000000000000000000000000000000000a"
|
|
3382
|
+
],
|
|
3383
|
+
g2_elements: [
|
|
3384
|
+
"198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3385
|
+
"260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
|
|
3386
|
+
]
|
|
3387
|
+
},
|
|
3388
|
+
tally_vkey: {
|
|
3389
|
+
n: 1048575,
|
|
3390
|
+
num_inputs: 1,
|
|
3391
|
+
selector_commitments: [
|
|
3392
|
+
"1588fb667b3f0e4d0970b8208e4b6b4c729c4926b936f8d877017cf42d07ca15069643791d98abcd6b7d0b0546e7560ab9011e069f2ee48ede581fc72d8b5e04",
|
|
3393
|
+
"09c5480b103c44a81850ffd9a61ec21f7db41bc89996d8df075c3e029290eb5b083cb2b184d95c0761e585547be33250c8939929b87fdc39775ccea17d51b481",
|
|
3394
|
+
"278e239bcac0a945a17572a6d61ba59f705746e6893a10a44841933a8c8310e712e4ee913af9b77c8fdcdc365316aa9f1b8dc081eb99ad80265768ec9f484beb",
|
|
3395
|
+
"12532585ea307c5559b18a4d01db59b544a88088f61a5b5ed0431393e6f675af1309bf0dcaa7a552849e5f28d0300c8c61b18393fb638aed3b7d70e27bb91c35",
|
|
3396
|
+
"172e7ecb8e485aaee801fd78b8fd7c0b862baef65e39e6832cffa2170b6f981928d86ab5887e8c3210e34e03cada468bd501f60ec3a8fa35b4c7067d6fb8c6ae",
|
|
3397
|
+
"0c27211d046735fc681228b8366be2c8cf9a256cbd03dcd4af65152e94f95a6f1af151a5311b195b0f4acffeec4952cc52edbb7045aab61bbd3be9cd322ab99e"
|
|
3398
|
+
],
|
|
3399
|
+
next_step_selector_commitments: [
|
|
3400
|
+
"25ee15301d562e6c630946b3fbe36b9fbd8dfbd44ddf70cc825fb1fa1ebd966229081f6b9297da671c69064e10b8f5dd0f69b69d1bf79122c6197f119087ebe1"
|
|
3401
|
+
],
|
|
3402
|
+
permutation_commitments: [
|
|
3403
|
+
"194849a6ec5cb37e09d20801d387abbab04e453f630c5fbbf5c4819c5569480c0c8bf0ce2b4955cc4c891840da1d9e99feb81e8d43251dffbe4d6167639b9f9b",
|
|
3404
|
+
"17717d2638632d406b3c8aa69550c8aeed1b79def3ab55e9d0c4bdf21cc339ad07d3bd3a331145fc96f34c85469a34a8c93b53b7aa36bb5a94c31e3b4d47713e",
|
|
3405
|
+
"277b0c99b63c79bb9ed2f677c3987cf00acb293933dfced82b5afcb8bf0c34570d3187ce5c7e892582ddda4322cf7c50d41105fe98503fb60e41f4a08da5916d",
|
|
3406
|
+
"0489f6dec0f27a8c21d147ebb9781b68b4b73db065a6017924c543f6d9fadbe922d24c0946bd8b19df7659810296d063b557cdf7aba510b11e08fbf2e9d37931"
|
|
3407
|
+
],
|
|
3408
|
+
non_residues: [
|
|
3409
|
+
"0000000000000000000000000000000000000000000000000000000000000005",
|
|
3410
|
+
"0000000000000000000000000000000000000000000000000000000000000007",
|
|
3411
|
+
"000000000000000000000000000000000000000000000000000000000000000a"
|
|
3412
|
+
],
|
|
3413
|
+
g2_elements: [
|
|
3414
|
+
"198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3415
|
+
"260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
|
|
3416
|
+
]
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
},
|
|
3420
|
+
"6-3-3-125": {
|
|
3421
|
+
parameter: {
|
|
3422
|
+
state_tree_depth: "6",
|
|
3423
|
+
int_state_tree_depth: "3",
|
|
3424
|
+
vote_option_tree_depth: "3",
|
|
3425
|
+
message_batch_size: "125"
|
|
3426
|
+
},
|
|
3427
|
+
groth16: {
|
|
3428
|
+
process_vkey: {
|
|
3429
|
+
vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
|
|
3430
|
+
vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
|
|
3431
|
+
vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3432
|
+
vk_delta_2: "057f25675851ef5a79a6d8706a43a6cd8e494cfb12c241ede46991d9174cf30605b081ff44f3ede774dab68ea9324c12308c13cb09cbb129adf94401b9134f5b16137d952fd32ab2d4243ebff4cb15d17206948ef17909ea8606886a8109bdad082f7d27e1cbf98925f055b39d1c89f9bcc4f6d92fdb920934ff5e37ba4d9b49",
|
|
3433
|
+
vk_ic0: "27c937c032a18a320566e934448a0ffceea7050492a509c45a3bcb7e8ff8905d20789ada31729a833a4f595ff9f49f88adb66f2ab987de15a15deccb0e785bf4",
|
|
3434
|
+
vk_ic1: "0ed2cefc103a2234dbc6bbd8634812d65332218b7589f4079b2c08eb5a4f5f63113a7f3cb53797a7f5819d7de7e3f0b2197d1c34790685a4a59af4314810420b"
|
|
3435
|
+
},
|
|
3436
|
+
tally_vkey: {
|
|
3437
|
+
vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
|
|
3438
|
+
vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
|
|
3439
|
+
vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3440
|
+
vk_delta_2: "2065e91c00fcc5cbc3d974cf52e24de972bdb1b4d8ded629dec20b5c904c3fa327ffe02402094795ff4d02588c8268fcad738f69eb4c732a0c98b485035e1f4913ede11b074ff143a929673e581a547717c58ce01af87d9d8b28f65f506093a61013e367b93e6782129362065840a0af9b77d7d9659a84577176e64a918d8d4c",
|
|
3441
|
+
vk_ic0: "11db4a022aab89a265f06ff62aa18c74b21e913a8b23e7fce9cb46f76d1c4d9f2a7475b1eeb7be0a0dc457e6d52536ba351b621b63a7d77da75d4e773048537e",
|
|
3442
|
+
vk_ic1: "0f298d235d0822ad281386abdf511853529af4c864b0cd54140facebfc1356a3059cd6d0d4b27b39e5683548fe12025e2a6b2e2724c2ca87d2008ef932ed3801"
|
|
3443
|
+
}
|
|
3444
|
+
},
|
|
3445
|
+
plonk: {
|
|
3446
|
+
process_vkey: {
|
|
3447
|
+
n: 8388607,
|
|
3448
|
+
num_inputs: 1,
|
|
3449
|
+
selector_commitments: [
|
|
3450
|
+
"216533ab27390f98812429524326ac08736d636d2891fb81446796cc1771a3230642f49db115acc15a186a1013f91a08efcd05640eb137d700276e80fd05bc90",
|
|
3451
|
+
"11747f6f378e26dbdacff464ce7eb6a8869750d0fa7e508e263ac77b582c1e9b24ba3d208650b0c28943915c563cc94cc3f98cdb5fd8adc4f4d3e2a60eda3302",
|
|
3452
|
+
"09239eb768d8d47b91c7e08e2ec6a374571964ed16be293cdc35e112393c4fd1182a0794be7f1441418664e9f718b67ed392a7da3e2868375bcf629131bb2680",
|
|
3453
|
+
"2020f7db24940bbf38d097ea5d7ef7253e38b154d7eb0ff1782ea18ce215dd7b0e8475197b071b118adc6418b7b7fb42fea19b6272d1bb460cc47deacb299ec7",
|
|
3454
|
+
"298923db1618185064bbab5df30ee03a3c9cbc7ce8f096d76cbd2a5ab3df86cd05bbedb938e6e0ff35cce23609458aff8081cdf3163655672074d1b18b0007bd",
|
|
3455
|
+
"0effaabe8c6e8a076aedd36d10f2926f9871f552d93e22bfbe69e3c828a546fa2d0cd163b49a6de219ac2c048a8459ae448047748ba078b9d5d07b290c946b08"
|
|
3456
|
+
],
|
|
3457
|
+
next_step_selector_commitments: [
|
|
3458
|
+
"13e3d7299e30e6142699469d620df721eca35bbb807a8f4298f165260fdc24f823e7bd9bcb6506a094a5ebef44434c62e4bcb5d3dd7e092c49d5cb80b8ae0757"
|
|
3459
|
+
],
|
|
3460
|
+
permutation_commitments: [
|
|
3461
|
+
"03d94ab8fdc681523a8eec10f1ce5552937c268d1d970f9e75ee8657cd4c12a81e03476f83ef5c14db2f4d931b833a3b65b8d5689b37cc7f183914c90d3d065d",
|
|
3462
|
+
"1b9c6ef20e68355c535bda6ff04a8a61d7552a594bb8e88d69a6f8840ddab04d2884824cc356d0d90cc278c247fc531de62efca4b19ed1be6f071144474d2037",
|
|
3463
|
+
"1ff82de8312481e1591d2d1c2698fa3944b3f0afa0dd702be8a1a944a5a8997323ffbd0ab39a2e13608a8e76803c33ffda7317bb7101e335ce5552ed62dcd09d",
|
|
3464
|
+
"2cb2bbdd51d22b79957b0401ecb6fe089f05426ba092b1205fa92f39b36cc5fc0c36c3934e47b7d407d4cda0c78c2b3fb23162cb0d295e8a8cce1a274956c34a"
|
|
3465
|
+
],
|
|
3466
|
+
non_residues: [
|
|
3467
|
+
"0000000000000000000000000000000000000000000000000000000000000005",
|
|
3468
|
+
"0000000000000000000000000000000000000000000000000000000000000007",
|
|
3469
|
+
"000000000000000000000000000000000000000000000000000000000000000a"
|
|
3470
|
+
],
|
|
3471
|
+
g2_elements: [
|
|
3472
|
+
"198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3473
|
+
"260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
|
|
3474
|
+
]
|
|
3475
|
+
},
|
|
3476
|
+
tally_vkey: {
|
|
3477
|
+
n: 8388607,
|
|
3478
|
+
num_inputs: 1,
|
|
3479
|
+
selector_commitments: [
|
|
3480
|
+
"258d101f9499e81c0d0da8986c659ef33da19d4955a142e56b4854d1327c902c1996baecd81432717a9cbf92ccf651e4217a788c1a2ed855f749480f8ce8203c",
|
|
3481
|
+
"1892a17c9c01389e3149b0663069a1ad4fd3c8e2db5ce99795b781c47b55acf9001cf5f0b4c1d088fa2058ca19cd2f1e9559ebe059897bb0aadcb540ce5f468a",
|
|
3482
|
+
"09912d6eaa4a22802451135d9a221ebf97c2ce8ad5bbb2942d5a860482e8e4202573995072c4b014cd0e9d09a1fd53ee7d602070b404288a7fd0d97b57d8f07d",
|
|
3483
|
+
"0c62ef7ad01b05b2c01fca6188de269d63d725348a07a99bbc50f24c1518aa871fdc61bbf42399433a0917c919dcfe9e851b206e1c37dec0908f69ad89bb1f8e",
|
|
3484
|
+
"07d181c1026ef4a6732bff3dffbc5ae0e3746e4860f478c6c2e8e258df2ed7671efe073fb31cf5a61c0eedceccb5e968220b9ff7e2b055b11d7c456a57fe7ac9",
|
|
3485
|
+
"1bbd7ad96893df675c811e5a2be184e2e3bc9af0ce30a7b26e53a916a10a777a01ffa70dbe585201ac09778429c04c71229392608095d220c7d82631a0caedd6"
|
|
3486
|
+
],
|
|
3487
|
+
next_step_selector_commitments: [
|
|
3488
|
+
"2ae6c5c98d4c384e8e645d85a4ca362de4c4e75efe3c79d5bcbd126a9e305b831618df99300c7327f1eac6a498c8feac6013d4ba09b7ea046340f99b0598a832"
|
|
3489
|
+
],
|
|
3490
|
+
permutation_commitments: [
|
|
3491
|
+
"2458c5fb474ab3e7ae9c6b82cc432a111954d8be5e7e9b4fc58c14e1aed77f3207426dbe08272aa69ba8b73809f27f9ff083641b5c3c896c386a74bbed3083dd",
|
|
3492
|
+
"0879ac4885674b1af0ab67c7b505bce6234f32a0335bdfd229023fea5f303ece0973ba8abc9ade8edcfb68c7d4b8b98272c7bf33eff841fec78d21c0c2e82aa6",
|
|
3493
|
+
"07b74f37fcbcb2d9962a529fbc254d54925aeb1be1a49517affeb3571ef3e31e3033f7900ff5bb5759cbb98b64ca7f42967278c328d00e60c042aa65f2178ded",
|
|
3494
|
+
"203c948fdc386e7bfbdc37363ab489e9ce3264f4ccd23c33dd8f2337fb9007a621cabf740aa26e522dcb7af6c0de9f93cbc69595b29b02e75c2f3507e97664ec"
|
|
3495
|
+
],
|
|
3496
|
+
non_residues: [
|
|
3497
|
+
"0000000000000000000000000000000000000000000000000000000000000005",
|
|
3498
|
+
"0000000000000000000000000000000000000000000000000000000000000007",
|
|
3499
|
+
"000000000000000000000000000000000000000000000000000000000000000a"
|
|
3500
|
+
],
|
|
3501
|
+
g2_elements: [
|
|
3502
|
+
"198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3503
|
+
"260e01b251f6f1c7e7ff4e580791dee8ea51d87a358e038b4efe30fac09383c10118c4d5b837bcc2bc89b5b398b5974e9f5944073b32078b7e231fec938883b004fc6369f7110fe3d25156c1bb9a72859cf2a04641f99ba4ee413c80da6a5fe422febda3c0c0632a56475b4214e5615e11e6dd3f96e6cea2854a87d4dacc5e55"
|
|
3504
|
+
]
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
},
|
|
3508
|
+
"9-4-3-625": {
|
|
3509
|
+
parameter: {
|
|
3510
|
+
state_tree_depth: "9",
|
|
3511
|
+
int_state_tree_depth: "4",
|
|
3512
|
+
message_batch_size: "625",
|
|
3513
|
+
vote_option_tree_depth: "3"
|
|
3514
|
+
},
|
|
3515
|
+
groth16: {
|
|
3516
|
+
process_vkey: {
|
|
3517
|
+
vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
|
|
3518
|
+
vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
|
|
3519
|
+
vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3520
|
+
vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3521
|
+
vk_ic0: "1832600210a459fe61d971081d4baa1a1add23f87c8a8dc4042cd5cf6c6fdf8e3018489aec30d9deb26629e05965a3a7e038be58ce10c854cb7e1071f2708aad",
|
|
3522
|
+
vk_ic1: "0274a24117a799333754d646e35f37292e7ca9984fb8781211504b158d69d2c422aa99651ca207c77084988b16ef363664b9cf36071f7131dcc10b98ea27d7f6"
|
|
3523
|
+
},
|
|
3524
|
+
tally_vkey: {
|
|
3525
|
+
vk_alpha1: "2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e214bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d1926",
|
|
3526
|
+
vk_beta_2: "0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a71739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8",
|
|
3527
|
+
vk_gamma_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3528
|
+
vk_delta_2: "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
|
3529
|
+
vk_ic0: "2ec191d51bd4ac7cd65cb3dd2decfa4e56c4f167bbc40e2c9e1ca728f9bc5b0e2ed1c82319dc554aea5ff2ca05d6f4d4d61e8f059a8c05d4b4faabae5128a437",
|
|
3530
|
+
vk_ic1: "2f19db8f03b6b5896abc6989273371b14833356f45c12685e57bc292eccc53570cb629e551df179f73b9f3391946bad29739af8b808c80b0f057af45aea59849"
|
|
3531
|
+
}
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
};
|
|
3535
|
+
var QTR_LIB = {
|
|
3536
|
+
zeros: [
|
|
3537
|
+
"0",
|
|
3538
|
+
"14655542659562014735865511769057053982292279840403315552050801315682099828156",
|
|
3539
|
+
"19261153649140605024552417994922546473530072875902678653210025980873274131905",
|
|
3540
|
+
"21526503558325068664033192388586640128492121680588893182274749683522508994597",
|
|
3541
|
+
"20017764101928005973906869479218555869286328459998999367935018992260318153770",
|
|
3542
|
+
"16998355316577652097112514691750893516081130026395813155204269482715045879598",
|
|
3543
|
+
"2612442706402737973181840577010736087708621987282725873936541279764292204086",
|
|
3544
|
+
"17716535433480122581515618850811568065658392066947958324371350481921422579201",
|
|
3545
|
+
"17437916409890180001398333108882255895598851862997171508841759030332444017770"
|
|
3546
|
+
]
|
|
3547
|
+
};
|
|
3548
|
+
|
|
3549
|
+
// src/libs/contract/utils.ts
|
|
3550
|
+
function getContractParams(type, circuitType, proofSystem, maxVoter, maxOption) {
|
|
3551
|
+
let parameters;
|
|
3552
|
+
let groth16ProcessVkey = null;
|
|
3553
|
+
let groth16TallyVkey = null;
|
|
3554
|
+
let plonkProcessVkey = null;
|
|
3555
|
+
let plonkTallyVkey = null;
|
|
3556
|
+
let maciVoteType = null;
|
|
3557
|
+
let maciCertSystem = null;
|
|
3558
|
+
switch (circuitType) {
|
|
3559
|
+
case "0" /* IP1V */:
|
|
3560
|
+
maciVoteType = "0";
|
|
3561
|
+
break;
|
|
3562
|
+
case "1" /* QV */:
|
|
3563
|
+
maciVoteType = "1";
|
|
3564
|
+
break;
|
|
3565
|
+
default:
|
|
3566
|
+
throw new Error(
|
|
3567
|
+
`Invalid circuit type ${circuitType}, only support 1P1V and QV`
|
|
3568
|
+
);
|
|
3569
|
+
}
|
|
3570
|
+
switch (proofSystem) {
|
|
3571
|
+
case "groth16" /* GROTH16 */:
|
|
3572
|
+
maciCertSystem = "0";
|
|
3573
|
+
break;
|
|
3574
|
+
case "plonk" /* PLONK */:
|
|
3575
|
+
maciCertSystem = "1";
|
|
3576
|
+
break;
|
|
3577
|
+
default:
|
|
3578
|
+
throw new Error(
|
|
3579
|
+
`Invalid proof system ${proofSystem}, only support GROTH16 and PLONK`
|
|
3580
|
+
);
|
|
3581
|
+
}
|
|
3582
|
+
if (Number(maxVoter) <= 25 && Number(maxOption) <= 5) {
|
|
3583
|
+
parameters = CIRCUIT_INFO["2-1-1-5"].parameter;
|
|
3584
|
+
if (proofSystem === "groth16" /* GROTH16 */) {
|
|
3585
|
+
groth16ProcessVkey = CIRCUIT_INFO["2-1-1-5"]["groth16"].process_vkey;
|
|
3586
|
+
groth16TallyVkey = CIRCUIT_INFO["2-1-1-5"]["groth16"].tally_vkey;
|
|
3587
|
+
} else if (proofSystem === "plonk" /* PLONK */) {
|
|
3588
|
+
plonkProcessVkey = CIRCUIT_INFO["2-1-1-5"]["plonk"]?.process_vkey;
|
|
3589
|
+
plonkTallyVkey = CIRCUIT_INFO["2-1-1-5"]["plonk"]?.tally_vkey;
|
|
3590
|
+
}
|
|
3591
|
+
} else if (Number(maxVoter) <= 625 && Number(maxOption) <= 25) {
|
|
3592
|
+
parameters = CIRCUIT_INFO["4-2-2-25"].parameter;
|
|
3593
|
+
if (proofSystem === "groth16" /* GROTH16 */) {
|
|
3594
|
+
groth16ProcessVkey = CIRCUIT_INFO["4-2-2-25"]["groth16"].process_vkey;
|
|
3595
|
+
groth16TallyVkey = CIRCUIT_INFO["4-2-2-25"]["groth16"].tally_vkey;
|
|
3596
|
+
} else if (proofSystem === "plonk" /* PLONK */) {
|
|
3597
|
+
plonkProcessVkey = CIRCUIT_INFO["4-2-2-25"]["plonk"]?.process_vkey;
|
|
3598
|
+
plonkTallyVkey = CIRCUIT_INFO["4-2-2-25"]["plonk"]?.tally_vkey;
|
|
3599
|
+
}
|
|
3600
|
+
} else if (Number(maxVoter) <= 15625 && Number(maxOption) <= 125) {
|
|
3601
|
+
parameters = CIRCUIT_INFO["6-3-3-125"].parameter;
|
|
3602
|
+
if (proofSystem === "groth16" /* GROTH16 */) {
|
|
3603
|
+
groth16ProcessVkey = CIRCUIT_INFO["6-3-3-125"]["groth16"].process_vkey;
|
|
3604
|
+
groth16TallyVkey = CIRCUIT_INFO["6-3-3-125"]["groth16"].tally_vkey;
|
|
3605
|
+
} else if (proofSystem === "plonk" /* PLONK */) {
|
|
3606
|
+
plonkProcessVkey = CIRCUIT_INFO["6-3-3-125"]["plonk"]?.process_vkey;
|
|
3607
|
+
plonkTallyVkey = CIRCUIT_INFO["6-3-3-125"]["plonk"]?.tally_vkey;
|
|
3608
|
+
}
|
|
3609
|
+
} else if (Number(maxVoter) <= 1953125 && Number(maxOption) <= 125) {
|
|
3610
|
+
parameters = CIRCUIT_INFO["9-4-3-625"].parameter;
|
|
3611
|
+
if (proofSystem === "groth16" /* GROTH16 */) {
|
|
3612
|
+
groth16ProcessVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].process_vkey;
|
|
3613
|
+
groth16TallyVkey = CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_vkey;
|
|
3614
|
+
} else if (proofSystem === "plonk" /* PLONK */) {
|
|
3615
|
+
throw new Error("PLONK is not supported for MACI-9");
|
|
3616
|
+
}
|
|
3617
|
+
} else {
|
|
3618
|
+
throw new Error("Number of voters or options is too large.");
|
|
3619
|
+
}
|
|
3620
|
+
switch (type) {
|
|
3621
|
+
case "0" /* MACI */:
|
|
3622
|
+
return {
|
|
3623
|
+
parameters,
|
|
3624
|
+
groth16ProcessVkey,
|
|
3625
|
+
groth16TallyVkey,
|
|
3626
|
+
plonkProcessVkey,
|
|
3627
|
+
plonkTallyVkey,
|
|
3628
|
+
maciVoteType,
|
|
3629
|
+
maciCertSystem
|
|
3630
|
+
};
|
|
3631
|
+
case "1" /* AMACI */:
|
|
3632
|
+
return {
|
|
3633
|
+
// parameters,
|
|
3634
|
+
// groth16ProcessVkey,
|
|
3635
|
+
// groth16TallyVkey,
|
|
3636
|
+
// plonkProcessVkey,
|
|
3637
|
+
// plonkTallyVkey,
|
|
3638
|
+
};
|
|
3639
|
+
case "2" /* ORACLE_MACI */:
|
|
3640
|
+
return {
|
|
3641
|
+
parameters: CIRCUIT_INFO["9-4-3-625"].parameter,
|
|
3642
|
+
groth16ProcessVkey: CIRCUIT_INFO["9-4-3-625"]["groth16"].process_vkey,
|
|
3643
|
+
groth16TallyVkey: CIRCUIT_INFO["9-4-3-625"]["groth16"].tally_vkey,
|
|
3644
|
+
plonkProcessVkey: null,
|
|
3645
|
+
plonkTallyVkey: null,
|
|
3646
|
+
maciVoteType,
|
|
3647
|
+
maciCertSystem: "0"
|
|
3648
|
+
};
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
function hexToDecimalString(hexString) {
|
|
3652
|
+
const decimalString = BigInt("0x" + hexString).toString(10);
|
|
3653
|
+
return decimalString;
|
|
3654
|
+
}
|
|
3655
|
+
function parsePubkey(publickKey) {
|
|
3656
|
+
const x = publickKey.slice(0, 64);
|
|
3657
|
+
const y = publickKey.slice(64);
|
|
3658
|
+
return {
|
|
3659
|
+
x: hexToDecimalString(x),
|
|
3660
|
+
y: hexToDecimalString(y)
|
|
3661
|
+
};
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
// src/libs/contract/contract.ts
|
|
3665
|
+
var Contract = class {
|
|
3666
|
+
constructor({
|
|
3667
|
+
rpcEndpoint,
|
|
3668
|
+
registryAddress,
|
|
3669
|
+
maciCodeId,
|
|
3670
|
+
oracleCodeId
|
|
3671
|
+
}) {
|
|
3672
|
+
this.rpcEndpoint = rpcEndpoint;
|
|
3673
|
+
this.registryAddress = registryAddress;
|
|
3674
|
+
this.maciCodeId = maciCodeId;
|
|
3675
|
+
this.oracleCodeId = oracleCodeId;
|
|
3676
|
+
}
|
|
3677
|
+
async createAMaciRound({
|
|
3678
|
+
signer,
|
|
3679
|
+
startVoting,
|
|
3680
|
+
endVoting,
|
|
3681
|
+
operator,
|
|
3682
|
+
whitelist,
|
|
3683
|
+
title,
|
|
3684
|
+
description,
|
|
3685
|
+
link,
|
|
3686
|
+
maxVoter,
|
|
3687
|
+
maxOption,
|
|
3688
|
+
voiceCreditAmount,
|
|
3689
|
+
circuitType,
|
|
3690
|
+
preDeactivateRoot
|
|
3691
|
+
}) {
|
|
3692
|
+
const start_time = (startVoting.getTime() * 10 ** 6).toString();
|
|
3693
|
+
const end_time = (endVoting.getTime() * 10 ** 6).toString();
|
|
3694
|
+
const client = await createRegistryClientBy({
|
|
3695
|
+
rpcEndpoint: this.rpcEndpoint,
|
|
3696
|
+
wallet: signer,
|
|
3697
|
+
contractAddress: this.registryAddress
|
|
3698
|
+
});
|
|
3699
|
+
preDeactivateRoot = preDeactivateRoot || "0";
|
|
3700
|
+
const res = await client.createRound({
|
|
3701
|
+
operator,
|
|
3702
|
+
preDeactivateRoot,
|
|
3703
|
+
voiceCreditAmount,
|
|
3704
|
+
whitelist,
|
|
3705
|
+
roundInfo: {
|
|
3706
|
+
title,
|
|
3707
|
+
description: description || "",
|
|
3708
|
+
link: link || ""
|
|
3709
|
+
},
|
|
3710
|
+
votingTime: {
|
|
3711
|
+
start_time,
|
|
3712
|
+
end_time
|
|
3713
|
+
},
|
|
3714
|
+
maxVoter,
|
|
3715
|
+
maxOption,
|
|
3716
|
+
certificationSystem: "0",
|
|
3717
|
+
circuitType
|
|
3718
|
+
});
|
|
3719
|
+
let contractAddress = "";
|
|
3720
|
+
res.events.map((event) => {
|
|
3721
|
+
if (event.type === "wasm") {
|
|
3722
|
+
let actionEvent = event.attributes.find(
|
|
3723
|
+
(attr) => attr.key === "action"
|
|
3724
|
+
);
|
|
3725
|
+
if (actionEvent.value === "created_round") {
|
|
3726
|
+
contractAddress = event.attributes.find((attr) => attr.key === "round_addr").value.toString();
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
});
|
|
3730
|
+
console.log(`Deploy tx: ${res.transactionHash} - ${contractAddress}`);
|
|
3731
|
+
return contractAddress;
|
|
3732
|
+
}
|
|
3733
|
+
async createMaciRound({
|
|
3734
|
+
signer,
|
|
3735
|
+
operatorPubkey,
|
|
3736
|
+
startVoting,
|
|
3737
|
+
endVoting,
|
|
3738
|
+
whitelist,
|
|
3739
|
+
title,
|
|
3740
|
+
description,
|
|
3741
|
+
link,
|
|
3742
|
+
maxVoter,
|
|
3743
|
+
maxOption,
|
|
3744
|
+
circuitType,
|
|
3745
|
+
certSystemType
|
|
3746
|
+
}) {
|
|
3747
|
+
const start_time = (startVoting.getTime() * 10 ** 6).toString();
|
|
3748
|
+
const end_time = (endVoting.getTime() * 10 ** 6).toString();
|
|
3749
|
+
const [{ address }] = await signer.getAccounts();
|
|
3750
|
+
const client = await createContractClientByWallet(this.rpcEndpoint, signer);
|
|
3751
|
+
const { x: operatorPubkeyX, y: operatorPubkeyY } = parsePubkey(operatorPubkey);
|
|
3752
|
+
const {
|
|
3753
|
+
parameters,
|
|
3754
|
+
groth16ProcessVkey,
|
|
3755
|
+
groth16TallyVkey,
|
|
3756
|
+
plonkProcessVkey,
|
|
3757
|
+
plonkTallyVkey,
|
|
3758
|
+
maciVoteType,
|
|
3759
|
+
maciCertSystem
|
|
3760
|
+
} = getContractParams(
|
|
3761
|
+
"0" /* MACI */,
|
|
3762
|
+
circuitType,
|
|
3763
|
+
certSystemType,
|
|
3764
|
+
maxVoter,
|
|
3765
|
+
maxOption
|
|
3766
|
+
);
|
|
3767
|
+
const instantiateResponse = await client.instantiate(
|
|
3768
|
+
address,
|
|
3769
|
+
this.maciCodeId,
|
|
3770
|
+
{
|
|
3771
|
+
round_info: { title, description, link },
|
|
3772
|
+
voting_time: {
|
|
3773
|
+
start_time,
|
|
3774
|
+
end_time
|
|
3775
|
+
},
|
|
3776
|
+
parameters,
|
|
3777
|
+
coordinator: {
|
|
3778
|
+
x: operatorPubkeyX,
|
|
3779
|
+
y: operatorPubkeyY
|
|
3780
|
+
},
|
|
3781
|
+
groth16_process_vkey: groth16ProcessVkey,
|
|
3782
|
+
groth16_tally_vkey: groth16TallyVkey,
|
|
3783
|
+
plonk_process_vkey: plonkProcessVkey,
|
|
3784
|
+
plonk_tally_vkey: plonkTallyVkey,
|
|
3785
|
+
max_vote_options: maxOption,
|
|
3786
|
+
whitelist,
|
|
3787
|
+
circuit_type: maciVoteType,
|
|
3788
|
+
certification_system: maciCertSystem,
|
|
3789
|
+
qtr_lib: QTR_LIB
|
|
3790
|
+
},
|
|
3791
|
+
"MACI",
|
|
3792
|
+
"auto"
|
|
3793
|
+
);
|
|
3794
|
+
return instantiateResponse;
|
|
3795
|
+
}
|
|
3796
|
+
async createOracleMaciRound({
|
|
3797
|
+
signer,
|
|
3798
|
+
operatorPubkey,
|
|
3799
|
+
startVoting,
|
|
3800
|
+
endVoting,
|
|
3801
|
+
title,
|
|
3802
|
+
description,
|
|
3803
|
+
link,
|
|
3804
|
+
maxVoter,
|
|
3805
|
+
maxOption,
|
|
3806
|
+
circuitType,
|
|
3807
|
+
whitelistBackendPubkey,
|
|
3808
|
+
whitelistEcosystem,
|
|
3809
|
+
whitelistSnapshotHeight,
|
|
3810
|
+
whitelistVotingPowerArgs,
|
|
3811
|
+
feegrantOperator
|
|
3812
|
+
}) {
|
|
3813
|
+
const start_time = (startVoting.getTime() * 1e6).toString();
|
|
3814
|
+
const end_time = (endVoting.getTime() * 1e6).toString();
|
|
3815
|
+
const [{ address }] = await signer.getAccounts();
|
|
3816
|
+
const client = await createContractClientByWallet(this.rpcEndpoint, signer);
|
|
3817
|
+
const { x: operatorPubkeyX, y: operatorPubkeyY } = parsePubkey(operatorPubkey);
|
|
3818
|
+
const {
|
|
3819
|
+
parameters,
|
|
3820
|
+
groth16ProcessVkey,
|
|
3821
|
+
groth16TallyVkey,
|
|
3822
|
+
plonkProcessVkey,
|
|
3823
|
+
plonkTallyVkey,
|
|
3824
|
+
maciVoteType,
|
|
3825
|
+
maciCertSystem
|
|
3826
|
+
} = getContractParams(
|
|
3827
|
+
"2" /* ORACLE_MACI */,
|
|
3828
|
+
circuitType,
|
|
3829
|
+
"groth16" /* GROTH16 */,
|
|
3830
|
+
maxVoter,
|
|
3831
|
+
maxOption
|
|
3832
|
+
);
|
|
3833
|
+
const instantiateResponse = await client.instantiate(
|
|
3834
|
+
address,
|
|
3835
|
+
this.oracleCodeId,
|
|
3836
|
+
{
|
|
3837
|
+
round_info: { title, description: description || "", link: link || "" },
|
|
3838
|
+
voting_time: {
|
|
3839
|
+
start_time,
|
|
3840
|
+
end_time
|
|
3841
|
+
},
|
|
3842
|
+
parameters,
|
|
3843
|
+
coordinator: {
|
|
3844
|
+
x: operatorPubkeyX,
|
|
3845
|
+
y: operatorPubkeyY
|
|
3846
|
+
},
|
|
3847
|
+
groth16_process_vkey: groth16ProcessVkey,
|
|
3848
|
+
groth16_tally_vkey: groth16TallyVkey,
|
|
3849
|
+
plonk_process_vkey: plonkProcessVkey,
|
|
3850
|
+
plonk_tally_vkey: plonkTallyVkey,
|
|
3851
|
+
max_vote_options: maxOption,
|
|
3852
|
+
whitelist_backend_pubkey: whitelistBackendPubkey,
|
|
3853
|
+
whitelist_ecosystem: whitelistEcosystem,
|
|
3854
|
+
whitelist_snapshot_height: whitelistSnapshotHeight,
|
|
3855
|
+
whitelist_voting_power_args: whitelistVotingPowerArgs,
|
|
3856
|
+
circuit_type: maciVoteType,
|
|
3857
|
+
certification_system: maciCertSystem,
|
|
3858
|
+
qtr_lib: QTR_LIB,
|
|
3859
|
+
feegrant_operator: feegrantOperator
|
|
3860
|
+
},
|
|
3861
|
+
"[Oracle MACI]" + title,
|
|
3862
|
+
"auto"
|
|
3863
|
+
);
|
|
3864
|
+
return instantiateResponse;
|
|
3865
|
+
}
|
|
3866
|
+
async queryRoundInfo({
|
|
3867
|
+
signer,
|
|
3868
|
+
roundAddress
|
|
3869
|
+
}) {
|
|
3870
|
+
const client = await createMaciClientBy({
|
|
3871
|
+
rpcEndpoint: this.rpcEndpoint,
|
|
3872
|
+
wallet: signer,
|
|
3873
|
+
contractAddress: roundAddress
|
|
3874
|
+
});
|
|
3875
|
+
const roundInfo = await client.getRoundInfo();
|
|
3876
|
+
return roundInfo;
|
|
3877
|
+
}
|
|
3878
|
+
async oracleMaciClient({
|
|
3879
|
+
signer,
|
|
3880
|
+
contractAddress
|
|
3881
|
+
}) {
|
|
3882
|
+
const client = await createOracleMaciClientBy({
|
|
3883
|
+
rpcEndpoint: this.rpcEndpoint,
|
|
3884
|
+
wallet: signer,
|
|
3885
|
+
contractAddress
|
|
3886
|
+
});
|
|
3887
|
+
return client;
|
|
3888
|
+
}
|
|
3889
|
+
async registryClient({
|
|
3890
|
+
signer,
|
|
3891
|
+
contractAddress
|
|
3892
|
+
}) {
|
|
3893
|
+
return createRegistryClientBy({
|
|
3894
|
+
rpcEndpoint: this.rpcEndpoint,
|
|
3895
|
+
wallet: signer,
|
|
3896
|
+
contractAddress
|
|
3897
|
+
});
|
|
3898
|
+
}
|
|
3899
|
+
async maciClient({
|
|
3900
|
+
signer,
|
|
3901
|
+
contractAddress
|
|
3902
|
+
}) {
|
|
3903
|
+
return createMaciClientBy({
|
|
3904
|
+
rpcEndpoint: this.rpcEndpoint,
|
|
3905
|
+
wallet: signer,
|
|
3906
|
+
contractAddress
|
|
3907
|
+
});
|
|
3908
|
+
}
|
|
3909
|
+
async amaciClient({
|
|
3910
|
+
signer,
|
|
3911
|
+
contractAddress
|
|
3912
|
+
}) {
|
|
3913
|
+
return createAMaciClientBy({
|
|
3914
|
+
rpcEndpoint: this.rpcEndpoint,
|
|
3915
|
+
wallet: signer,
|
|
3916
|
+
contractAddress
|
|
3917
|
+
});
|
|
3918
|
+
}
|
|
3919
|
+
};
|
|
3920
|
+
|
|
3921
|
+
// src/maci.ts
|
|
3922
|
+
var MaciClient2 = class {
|
|
3923
|
+
/**
|
|
3924
|
+
* @constructor
|
|
3925
|
+
* @param {ClientParams} params - The parameters for the Maci Client instance.
|
|
3926
|
+
*/
|
|
3927
|
+
constructor({
|
|
3928
|
+
network,
|
|
3929
|
+
rpcEndpoint,
|
|
3930
|
+
restEndpoint,
|
|
3931
|
+
apiEndpoint,
|
|
3932
|
+
registryAddress,
|
|
3933
|
+
maciCodeId,
|
|
3934
|
+
oracleCodeId,
|
|
3935
|
+
customFetch,
|
|
3936
|
+
defaultOptions
|
|
3937
|
+
}) {
|
|
3938
|
+
const defaultParams = getDefaultParams(network);
|
|
3939
|
+
this.rpcEndpoint = rpcEndpoint || defaultParams.rpcEndpoint;
|
|
3940
|
+
this.restEndpoint = restEndpoint || defaultParams.restEndpoint;
|
|
3941
|
+
this.apiEndpoint = apiEndpoint || defaultParams.apiEndpoint;
|
|
3942
|
+
this.registryAddress = registryAddress || defaultParams.registryAddress;
|
|
3943
|
+
this.maciCodeId = maciCodeId || defaultParams.maciCodeId;
|
|
3944
|
+
this.oracleCodeId = oracleCodeId || defaultParams.oracleCodeId;
|
|
3945
|
+
this.http = new Http(
|
|
3946
|
+
this.apiEndpoint,
|
|
3947
|
+
this.restEndpoint,
|
|
3948
|
+
customFetch,
|
|
3949
|
+
defaultOptions
|
|
3950
|
+
);
|
|
3951
|
+
this.indexer = new Indexer({
|
|
3952
|
+
restEndpoint: this.restEndpoint,
|
|
3953
|
+
apiEndpoint: this.apiEndpoint,
|
|
3954
|
+
registryAddress: this.registryAddress,
|
|
3955
|
+
http: this.http
|
|
3956
|
+
});
|
|
3957
|
+
this.contract = new Contract({
|
|
3958
|
+
rpcEndpoint: this.rpcEndpoint,
|
|
3959
|
+
registryAddress: this.registryAddress,
|
|
3960
|
+
maciCodeId: this.maciCodeId,
|
|
3961
|
+
oracleCodeId: this.oracleCodeId
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
async oracleMaciClient({
|
|
3965
|
+
signer,
|
|
3966
|
+
contractAddress
|
|
3967
|
+
}) {
|
|
3968
|
+
return await this.contract.oracleMaciClient({
|
|
3969
|
+
signer,
|
|
3970
|
+
contractAddress
|
|
3971
|
+
});
|
|
3972
|
+
}
|
|
3973
|
+
async registryClient({
|
|
3974
|
+
signer,
|
|
3975
|
+
contractAddress
|
|
3976
|
+
}) {
|
|
3977
|
+
return await this.contract.registryClient({ signer, contractAddress });
|
|
3978
|
+
}
|
|
3979
|
+
async maciClient({
|
|
3980
|
+
signer,
|
|
3981
|
+
contractAddress
|
|
3982
|
+
}) {
|
|
3983
|
+
return await this.contract.maciClient({ signer, contractAddress });
|
|
3984
|
+
}
|
|
3985
|
+
async amaciClient({
|
|
3986
|
+
signer,
|
|
3987
|
+
contractAddress
|
|
3988
|
+
}) {
|
|
3989
|
+
return await this.contract.amaciClient({ signer, contractAddress });
|
|
3990
|
+
}
|
|
3991
|
+
async createAMaciRound(params) {
|
|
3992
|
+
return await this.contract.createAMaciRound(params);
|
|
3993
|
+
}
|
|
3994
|
+
async createMaciRound(params) {
|
|
3995
|
+
return await this.contract.createMaciRound(params);
|
|
3996
|
+
}
|
|
3997
|
+
async createOracleMaciRound(params) {
|
|
3998
|
+
return await this.contract.createOracleMaciRound(params);
|
|
3999
|
+
}
|
|
4000
|
+
/**
|
|
4001
|
+
* @method balanceOf
|
|
4002
|
+
* @description Get the balance of a specific address.
|
|
4003
|
+
* @param {string} address - The address to check the balance for.
|
|
4004
|
+
* @returns {Promise<BalanceResponse>} The balance response.
|
|
4005
|
+
*/
|
|
4006
|
+
async balanceOf(address) {
|
|
4007
|
+
return await this.indexer.account.balanceOf(address);
|
|
4008
|
+
}
|
|
4009
|
+
/**
|
|
4010
|
+
* @method getRoundById
|
|
4011
|
+
* @description Get a round by its ID.
|
|
4012
|
+
* @param {string} id - The ID of the round.
|
|
4013
|
+
* @returns {Promise<RoundResponse>} The round response.
|
|
4014
|
+
*/
|
|
4015
|
+
async getRoundById(id) {
|
|
4016
|
+
return await this.indexer.round.getRoundById(id);
|
|
4017
|
+
}
|
|
4018
|
+
/**
|
|
4019
|
+
* @method getRounds
|
|
4020
|
+
* @description Get multiple rounds.
|
|
4021
|
+
* @param {string} after - The cursor to start after.
|
|
4022
|
+
* @param {number} [limit] - The number of rounds to retrieve.
|
|
4023
|
+
* @returns {Promise<RoundsResponse>} The rounds response.
|
|
4024
|
+
*/
|
|
4025
|
+
async getRounds(after, limit) {
|
|
4026
|
+
return await this.indexer.round.getRounds(after, limit);
|
|
4027
|
+
}
|
|
4028
|
+
/**
|
|
4029
|
+
* @method getRoundsByStatus
|
|
4030
|
+
* @description Get rounds by their status.
|
|
4031
|
+
* @param {string} status - The status of the rounds to retrieve.
|
|
4032
|
+
* @param {string} after - The cursor to start after.
|
|
4033
|
+
* @param {number} [limit] - The number of rounds to retrieve.
|
|
4034
|
+
* @returns {Promise<RoundsResponse>} The rounds response.
|
|
4035
|
+
*/
|
|
4036
|
+
async getRoundsByStatus(status, after, limit) {
|
|
4037
|
+
return await this.indexer.round.getRoundsByStatus(status, after, limit);
|
|
4038
|
+
}
|
|
4039
|
+
/**
|
|
4040
|
+
* @method getRoundsByCircuitName
|
|
4041
|
+
* @description Get rounds by their circuit name.
|
|
4042
|
+
* @param {string} name - The name of the circuit.
|
|
4043
|
+
* @param {string} after - The cursor to start after.
|
|
4044
|
+
* @param {number} [limit] - The number of rounds to retrieve.
|
|
4045
|
+
* @returns {Promise<RoundsResponse>} The rounds response.
|
|
4046
|
+
*/
|
|
4047
|
+
async getRoundsByCircuitName(name, after, limit) {
|
|
4048
|
+
return await this.indexer.round.getRoundsByCircuitName(name, after, limit);
|
|
4049
|
+
}
|
|
4050
|
+
/**
|
|
4051
|
+
* @method getRoundsByOperator
|
|
4052
|
+
* @description Get rounds by their operator address.
|
|
4053
|
+
* @param {string} address - The address of the operator.
|
|
4054
|
+
* @param {string} after - The cursor to start after.
|
|
4055
|
+
* @param {number} [limit] - The number of rounds to retrieve.
|
|
4056
|
+
* @returns {Promise<RoundsResponse>} The rounds response.
|
|
4057
|
+
*/
|
|
4058
|
+
async getRoundsByOperator(address, after, limit) {
|
|
4059
|
+
return await this.indexer.round.getRoundsByOperator(address, after, limit);
|
|
4060
|
+
}
|
|
4061
|
+
/**
|
|
4062
|
+
* @method getOperatorByAddress
|
|
4063
|
+
* @description Get an operator by their address.
|
|
4064
|
+
* @param {string} address - The address of the operator.
|
|
4065
|
+
* @returns {Promise<OperatorResponse>} The operator response.
|
|
4066
|
+
*/
|
|
4067
|
+
async getOperatorByAddress(address) {
|
|
4068
|
+
return await this.indexer.operator.getOperatorByAddress(address);
|
|
4069
|
+
}
|
|
4070
|
+
/**
|
|
4071
|
+
* @method getOperators
|
|
4072
|
+
* @description Get multiple operators.
|
|
4073
|
+
* @param {string} after - The cursor to start after.
|
|
4074
|
+
* @param {number} [limit] - The number of operators to retrieve.
|
|
4075
|
+
* @returns {Promise<OperatorsResponse>} The operators response.
|
|
4076
|
+
*/
|
|
4077
|
+
async getOperators(after, limit) {
|
|
4078
|
+
return await this.indexer.operator.getOperators(after, limit);
|
|
4079
|
+
}
|
|
4080
|
+
/**
|
|
4081
|
+
* @method getCircuitByName
|
|
4082
|
+
* @description Get a circuit by its name.
|
|
4083
|
+
* @param {string} name - The name of the circuit.
|
|
4084
|
+
* @returns {Promise<CircuitResponse>} The circuit response.
|
|
4085
|
+
*/
|
|
4086
|
+
async getCircuitByName(name) {
|
|
4087
|
+
return await this.indexer.circuit.getCircuitByName(name);
|
|
4088
|
+
}
|
|
4089
|
+
/**
|
|
4090
|
+
* @method getCircuits
|
|
4091
|
+
* @description Get all available circuits.
|
|
4092
|
+
* @returns {Promise<CircuitsResponse>} The circuits response.
|
|
4093
|
+
*/
|
|
4094
|
+
async getCircuits() {
|
|
4095
|
+
return await this.indexer.circuit.getCircuits();
|
|
4096
|
+
}
|
|
4097
|
+
/**
|
|
4098
|
+
* @method getTransactionByHash
|
|
4099
|
+
* @description Get a transaction by its hash.
|
|
4100
|
+
* @param {string} hash - The hash of the transaction.
|
|
4101
|
+
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
4102
|
+
*/
|
|
4103
|
+
async getTransactionByHash(hash) {
|
|
4104
|
+
return await this.indexer.transaction.getTransactionByHash(hash);
|
|
4105
|
+
}
|
|
4106
|
+
/**
|
|
4107
|
+
* @method getTransactions
|
|
4108
|
+
* @description Get multiple transactions.
|
|
4109
|
+
* @param {string} after - The cursor to start after.
|
|
4110
|
+
* @param {number} [limit] - The number of transactions to retrieve.
|
|
4111
|
+
* @returns {Promise<TransactionsResponse>} The transactions response.
|
|
4112
|
+
*/
|
|
4113
|
+
async getTransactions(after, limit) {
|
|
4114
|
+
return await this.indexer.transaction.getTransactions(after, limit);
|
|
4115
|
+
}
|
|
4116
|
+
/**
|
|
4117
|
+
* @method getTransactionsByContractAddress
|
|
4118
|
+
* @description Get transactions by contract address.
|
|
4119
|
+
* @param {string} address - The contract address.
|
|
4120
|
+
* @param {string} after - The cursor to start after.
|
|
4121
|
+
* @param {number} [limit] - The number of transactions to retrieve.
|
|
4122
|
+
* @returns {Promise<TransactionsResponse>} The transactions response.
|
|
4123
|
+
*/
|
|
4124
|
+
async getTransactionsByContractAddress(address, after, limit) {
|
|
4125
|
+
return await this.indexer.transaction.getTransactionsByContractAddress(
|
|
4126
|
+
address,
|
|
4127
|
+
after,
|
|
4128
|
+
limit
|
|
4129
|
+
);
|
|
4130
|
+
}
|
|
4131
|
+
/**
|
|
4132
|
+
* @method getProofByContractAddress
|
|
4133
|
+
* @description Get proof data by contract address.
|
|
4134
|
+
* @param {string} address - The contract address.
|
|
4135
|
+
* @returns {Promise<ProofResponse>} The proof response.
|
|
4136
|
+
*/
|
|
4137
|
+
async getProofByContractAddress(address) {
|
|
4138
|
+
return await this.indexer.proof.getProofByContractAddress(address);
|
|
4139
|
+
}
|
|
4140
|
+
};
|
|
4141
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4142
|
+
0 && (module.exports = {
|
|
4143
|
+
Account,
|
|
4144
|
+
Circuit,
|
|
4145
|
+
Contract,
|
|
4146
|
+
Http,
|
|
4147
|
+
Indexer,
|
|
4148
|
+
MaciClient,
|
|
4149
|
+
Operator,
|
|
4150
|
+
Proof,
|
|
4151
|
+
Round,
|
|
4152
|
+
Transaction,
|
|
4153
|
+
circuits,
|
|
4154
|
+
getDefaultParams,
|
|
4155
|
+
validator_operator_set
|
|
4156
|
+
});
|
|
4157
|
+
//# sourceMappingURL=index.js.map
|