@dorafactory/maci-sdk 0.0.34 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/index.d.ts +14 -2244
  2. package/dist/index.js +748 -363
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +722 -365
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/libs/const.d.ts +118 -0
  7. package/dist/libs/contract/config.d.ts +29 -0
  8. package/dist/libs/contract/contract.d.ts +57 -0
  9. package/dist/libs/contract/index.d.ts +1 -0
  10. package/dist/libs/contract/ts/AMaci.client.d.ts +216 -0
  11. package/dist/libs/contract/ts/AMaci.types.d.ts +221 -0
  12. package/dist/libs/contract/ts/Maci.client.d.ts +180 -0
  13. package/dist/libs/contract/ts/Maci.types.d.ts +226 -0
  14. package/dist/libs/contract/ts/OracleMaci.client.d.ts +206 -0
  15. package/dist/libs/contract/ts/OracleMaci.types.d.ts +263 -0
  16. package/dist/libs/contract/ts/Registry.client.d.ts +128 -0
  17. package/dist/libs/contract/ts/Registry.types.d.ts +110 -0
  18. package/dist/libs/contract/types.d.ts +39 -0
  19. package/dist/libs/contract/utils.d.ts +63 -0
  20. package/dist/libs/contract/vars.d.ts +63 -0
  21. package/dist/libs/crypto/babyjub.d.ts +73 -0
  22. package/dist/libs/crypto/bigintUtils.d.ts +6 -0
  23. package/dist/libs/crypto/constants.d.ts +3 -0
  24. package/dist/libs/crypto/hashing.d.ts +69 -0
  25. package/dist/libs/crypto/index.d.ts +9 -0
  26. package/dist/libs/crypto/keys.d.ts +74 -0
  27. package/dist/libs/crypto/sign.d.ts +9 -0
  28. package/dist/libs/crypto/tree.d.ts +23 -0
  29. package/dist/libs/crypto/types.d.ts +55 -0
  30. package/dist/libs/errors/index.d.ts +28 -0
  31. package/dist/libs/errors/types.d.ts +19 -0
  32. package/dist/libs/http/http.d.ts +16 -0
  33. package/dist/libs/http/index.d.ts +1 -0
  34. package/dist/libs/index.d.ts +7 -0
  35. package/dist/libs/indexer/index.d.ts +1 -0
  36. package/dist/libs/indexer/indexer.d.ts +152 -0
  37. package/dist/libs/indexer/types.d.ts +7 -0
  38. package/dist/libs/maci/index.d.ts +1 -0
  39. package/dist/libs/maci/maci.d.ts +182 -0
  40. package/dist/libs/maci/types.d.ts +6 -0
  41. package/dist/libs/oracle-certificate/index.d.ts +1 -0
  42. package/dist/libs/oracle-certificate/oracle-certificate.d.ts +9 -0
  43. package/dist/libs/oracle-certificate/types.d.ts +40 -0
  44. package/dist/libs/query/account.d.ts +7 -0
  45. package/dist/libs/query/circuit.d.ts +8 -0
  46. package/dist/libs/query/event.d.ts +7 -0
  47. package/dist/libs/query/index.d.ts +7 -0
  48. package/dist/libs/query/operator.d.ts +11 -0
  49. package/dist/libs/query/proof.d.ts +7 -0
  50. package/dist/libs/query/round.d.ts +18 -0
  51. package/dist/libs/query/transaction.d.ts +9 -0
  52. package/dist/maci.d.ts +190 -0
  53. package/dist/types/index.d.ts +383 -0
  54. package/dist/utils/index.d.ts +7 -0
  55. package/package.json +18 -24
  56. package/src/index.ts +1 -3
  57. package/src/libs/contract/contract.ts +14 -13
  58. package/src/libs/contract/types.ts +3 -3
  59. package/src/libs/crypto/babyjub.ts +132 -0
  60. package/src/libs/crypto/bigintUtils.ts +31 -0
  61. package/src/libs/crypto/constants.ts +22 -0
  62. package/src/libs/crypto/hashing.ts +167 -0
  63. package/src/libs/crypto/index.ts +9 -0
  64. package/src/libs/{circom/circomlib.ts → crypto/keys.ts} +104 -114
  65. package/src/libs/crypto/sign.ts +91 -0
  66. package/src/libs/crypto/tree.ts +176 -0
  67. package/src/libs/crypto/types.ts +101 -0
  68. package/src/libs/index.ts +1 -1
  69. package/src/libs/maci/maci.ts +28 -29
  70. package/src/maci.ts +140 -100
  71. package/src/types/index.ts +7 -0
  72. package/src/utils/index.ts +22 -22
  73. package/dist/browser.d.mts +0 -2243
  74. package/dist/browser.d.ts +0 -2243
  75. package/dist/browser.js +0 -31635
  76. package/dist/browser.js.map +0 -1
  77. package/dist/browser.mjs +0 -31646
  78. package/dist/browser.mjs.map +0 -1
  79. package/dist/index.d.mts +0 -2244
  80. package/src/browser.ts +0 -17
  81. package/src/libs/circom/index.ts +0 -98
  82. package/src/libs/circom/types.ts +0 -8
  83. package/src/polyfills/browser-polyfills.ts +0 -9
@@ -0,0 +1,383 @@
1
+ import { OfflineSigner } from '@cosmjs/proto-signing';
2
+ import { Keypair } from '../libs/crypto';
3
+ import { FetchOptions } from '../libs/http/http';
4
+ export type * from '../libs/contract/types';
5
+ export type * from '../libs/crypto/types';
6
+ export declare enum MaciCircuitType {
7
+ IP1V = "0",
8
+ QV = "1"
9
+ }
10
+ export declare enum MaciCertSystemType {
11
+ GROTH16 = "groth16",
12
+ PLONK = "plonk"
13
+ }
14
+ export declare enum MaciRoundType {
15
+ MACI = "0",
16
+ AMACI = "1",
17
+ ORACLE_MACI = "2"
18
+ }
19
+ export type CertificateEcosystem = 'cosmoshub' | 'doravota';
20
+ export type ClientParams = {
21
+ signer: OfflineSigner;
22
+ network: 'mainnet' | 'testnet';
23
+ rpcEndpoint?: string;
24
+ restEndpoint?: string;
25
+ apiEndpoint?: string;
26
+ certificateApiEndpoint?: string;
27
+ registryAddress?: string;
28
+ maciCodeId?: number;
29
+ oracleCodeId?: number;
30
+ customFetch?: typeof fetch;
31
+ defaultOptions?: FetchOptions;
32
+ feegrantOperator?: string;
33
+ whitelistBackendPubkey?: string;
34
+ maciKeypair?: Keypair;
35
+ secretKey?: string;
36
+ mnemonic?: string;
37
+ };
38
+ export type ContractParams = {
39
+ rpcEndpoint: string;
40
+ registryAddress: string;
41
+ maciCodeId: number;
42
+ oracleCodeId: number;
43
+ whitelistBackendPubkey: string;
44
+ feegrantOperator: string;
45
+ };
46
+ export type TransactionType = {
47
+ id: string;
48
+ blockHeight: string;
49
+ txHash: string;
50
+ timestamp: string;
51
+ type: string;
52
+ status: string;
53
+ circuitName: string;
54
+ fee: string;
55
+ gasUsed: string;
56
+ gasWanted: string;
57
+ caller: string;
58
+ contractAddress: string;
59
+ };
60
+ export type RoundType = {
61
+ id: string;
62
+ blockHeight: string;
63
+ txHash: string;
64
+ caller: string;
65
+ admin: string;
66
+ operator: string;
67
+ contractAddress: string;
68
+ circuitName: string;
69
+ timestamp: string;
70
+ votingStart: string;
71
+ votingEnd: string;
72
+ status: string;
73
+ period: string;
74
+ actionType: string;
75
+ roundTitle: string;
76
+ roundDescription: string;
77
+ roundLink: string;
78
+ coordinatorPubkeyX: string;
79
+ coordinatorPubkeyY: string;
80
+ voteOptionMap: string;
81
+ results: string;
82
+ allResult: string;
83
+ gasStationEnable: boolean;
84
+ totalGrant: string;
85
+ baseGrant: string;
86
+ totalBond: string;
87
+ circuitType: string;
88
+ circuitPower: string;
89
+ certificationSystem: string;
90
+ codeId: string;
91
+ maciType: string;
92
+ voiceCreditAmount: string;
93
+ preDeactivateRoot: string;
94
+ identity: string;
95
+ operatorLogoUrl?: string;
96
+ operatorMoniker?: string;
97
+ resultsList?: {
98
+ v: number;
99
+ v2: number;
100
+ }[];
101
+ };
102
+ export type SelectiveRoundType = Partial<RoundType>;
103
+ export type ProofType = {
104
+ nodes: {
105
+ id: string;
106
+ blockHeight: string;
107
+ txHash: string;
108
+ contractAddress: string;
109
+ timestamp: string;
110
+ actionType: string;
111
+ commitment: string;
112
+ proof: string;
113
+ }[];
114
+ };
115
+ export type OperatorDelayType = {
116
+ blockHeight: string;
117
+ delayProcessDmsgCount: number;
118
+ delayDuration: string;
119
+ delayReason: string;
120
+ delayType: string;
121
+ id: string;
122
+ nodeId: string;
123
+ operatorAddress: string;
124
+ timestamp: string;
125
+ roundAddress: string;
126
+ };
127
+ export type OperatorType = {
128
+ id: string;
129
+ validatorAddress: string;
130
+ operatorAddress: string;
131
+ coordinatorPubkeyX: string;
132
+ coordinatorPubkeyY: string;
133
+ identity: string;
134
+ logoUrl: string;
135
+ moniker: string;
136
+ activeRoundsCount: number;
137
+ completedRoundsCount: number;
138
+ };
139
+ export type CircuitType = {
140
+ maciType: string;
141
+ circuitType: string;
142
+ displayName: string;
143
+ repoUrl: string;
144
+ zipUrl: string;
145
+ roundCount?: number;
146
+ };
147
+ export type SignUpEventType = {
148
+ id: string;
149
+ blockHeight: string;
150
+ txHash: string;
151
+ contractAddress: string;
152
+ timestamp: string;
153
+ pubKey: string;
154
+ stateIdx: number;
155
+ balance: string;
156
+ };
157
+ export type CircuitsCountGraphqlResponse = {
158
+ data: {
159
+ rounds: {
160
+ totalCount: number;
161
+ };
162
+ };
163
+ };
164
+ export type ErrorResponse = {
165
+ code: number;
166
+ error: {
167
+ message: string;
168
+ type: string;
169
+ };
170
+ };
171
+ export type SuccessResponse<T> = {
172
+ code: 200;
173
+ data: T;
174
+ };
175
+ export type CircuitResponse = SuccessResponse<{
176
+ circuit: CircuitType;
177
+ }> | ErrorResponse;
178
+ export type CircuitsResponse = SuccessResponse<{
179
+ circuits: CircuitType[];
180
+ }> | ErrorResponse;
181
+ export type BalanceResponse = SuccessResponse<{
182
+ balance: string;
183
+ }> | ErrorResponse;
184
+ export type OperatorResponse = SuccessResponse<{
185
+ operator: OperatorType;
186
+ }> | ErrorResponse;
187
+ export type MissRateResponse = SuccessResponse<{
188
+ missRate: (MissRateType & {
189
+ date: string;
190
+ })[];
191
+ }> | ErrorResponse;
192
+ export type OperatorDelayOperationsResponse = SuccessResponse<{
193
+ operatorDelayOperations: {
194
+ pageInfo: {
195
+ endCursor: string;
196
+ hasNextPage: boolean;
197
+ };
198
+ edges: {
199
+ cursor: string;
200
+ node: OperatorDelayType;
201
+ }[];
202
+ totalCount: number;
203
+ };
204
+ }> | ErrorResponse;
205
+ export type OperatorsResponse = SuccessResponse<{
206
+ operators: {
207
+ pageInfo: {
208
+ endCursor: string;
209
+ hasNextPage: boolean;
210
+ };
211
+ edges: {
212
+ cursor: string;
213
+ node: OperatorType;
214
+ }[];
215
+ totalCount: number;
216
+ };
217
+ }> | ErrorResponse;
218
+ export type OperatorsGraphqlResponse = {
219
+ data: {
220
+ operators: {
221
+ pageInfo: {
222
+ endCursor: string;
223
+ hasNextPage: boolean;
224
+ };
225
+ edges: {
226
+ cursor: string;
227
+ node: OperatorType;
228
+ }[];
229
+ totalCount: number;
230
+ };
231
+ };
232
+ };
233
+ export type RoundsCountGraphqlResponse = {
234
+ data: {
235
+ activeRoundsCount: {
236
+ totalCount: number;
237
+ };
238
+ completedRoundsCount: {
239
+ totalCount: number;
240
+ };
241
+ };
242
+ };
243
+ export type VoteCountGraphqlResponse = {
244
+ data: {
245
+ signupsCount: {
246
+ totalCount: number;
247
+ };
248
+ messagesCount: {
249
+ totalCount: number;
250
+ };
251
+ };
252
+ };
253
+ export type OperatorDelayOperationsGraphqlResponse = {
254
+ data: {
255
+ operatorDelayOperations: {
256
+ pageInfo: {
257
+ endCursor: string;
258
+ hasNextPage: boolean;
259
+ };
260
+ edges: {
261
+ cursor: string;
262
+ node: OperatorDelayType;
263
+ }[];
264
+ totalCount: number;
265
+ };
266
+ };
267
+ };
268
+ export type TransactionGraphqlResponse = {
269
+ data: {
270
+ transaction: TransactionType;
271
+ };
272
+ };
273
+ export type TransactionResponse = SuccessResponse<{
274
+ transaction: TransactionType;
275
+ }> | ErrorResponse;
276
+ export type TransactionsGraphqlResponse = {
277
+ data: {
278
+ transactions: {
279
+ pageInfo: {
280
+ endCursor: string;
281
+ hasNextPage: boolean;
282
+ };
283
+ edges: {
284
+ cursor: string;
285
+ node: TransactionType;
286
+ }[];
287
+ totalCount: number;
288
+ };
289
+ };
290
+ };
291
+ export type TransactionsResponse = SuccessResponse<{
292
+ transactions: {
293
+ pageInfo: {
294
+ endCursor: string;
295
+ hasNextPage: boolean;
296
+ };
297
+ edges: {
298
+ cursor: string;
299
+ node: TransactionType;
300
+ }[];
301
+ totalCount: number;
302
+ };
303
+ }> | ErrorResponse;
304
+ export type RoundResponse = SuccessResponse<{
305
+ round: RoundType;
306
+ }> | ErrorResponse;
307
+ export type SelectiveRoundResponse = SuccessResponse<{
308
+ round: SelectiveRoundType;
309
+ }> | ErrorResponse;
310
+ export type RoundsResponse = SuccessResponse<{
311
+ rounds: {
312
+ pageInfo: {
313
+ endCursor: string;
314
+ hasNextPage: boolean;
315
+ };
316
+ edges: {
317
+ cursor: string;
318
+ node: RoundType;
319
+ }[];
320
+ totalCount: number;
321
+ };
322
+ }> | ErrorResponse;
323
+ export type RoundGraphqlResponse = {
324
+ data: {
325
+ round: RoundType;
326
+ };
327
+ };
328
+ /**
329
+ * GraphQL response type for selective round fields
330
+ */
331
+ export type SelectiveRoundGraphqlResponse = {
332
+ data: {
333
+ round: SelectiveRoundType;
334
+ };
335
+ };
336
+ export type RoundsGraphqlResponse = {
337
+ data: {
338
+ rounds: {
339
+ pageInfo: {
340
+ endCursor: string;
341
+ hasNextPage: boolean;
342
+ };
343
+ edges: {
344
+ cursor: string;
345
+ node: RoundType;
346
+ }[];
347
+ totalCount: number;
348
+ };
349
+ };
350
+ };
351
+ export type ProofResponse = SuccessResponse<{
352
+ proofData: ProofType;
353
+ }> | ErrorResponse;
354
+ export type ProofGraphqlResponse = {
355
+ data: {
356
+ proofData: ProofType;
357
+ };
358
+ };
359
+ export type SignUpEventsResponse = SuccessResponse<{
360
+ signUpEvents: SignUpEventType[];
361
+ }> | ErrorResponse;
362
+ export type SignUpEventsGraphqlResponse = {
363
+ data: {
364
+ signUpEvents: {
365
+ nodes: SignUpEventType[];
366
+ };
367
+ };
368
+ };
369
+ export type MissRateType = {
370
+ delayCount: number;
371
+ deactivateDelay: {
372
+ count: number;
373
+ dmsgCount: number;
374
+ };
375
+ tallyDelay: {
376
+ count: number;
377
+ };
378
+ totalDelayDuration: number;
379
+ avgDelayDuration: number;
380
+ tallyCount: number;
381
+ deactivateCount: number;
382
+ missRate: number;
383
+ };
@@ -0,0 +1,7 @@
1
+ export declare function isValidAddress(address: string): boolean;
2
+ /**
3
+ * Converts a hexadecimal string to a decimal string.
4
+ * @param hexString - The hexadecimal string to convert.
5
+ * @returns The decimal string representation of the input.
6
+ */
7
+ export declare function hexToDecimalString(hexString: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dorafactory/maci-sdk",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "SDK for interacting with maci",
5
5
  "keywords": [
6
6
  "maci",
@@ -20,18 +20,9 @@
20
20
  "engines": {
21
21
  "node": ">=18"
22
22
  },
23
- "exports": {
24
- ".": {
25
- "types": "./dist/index.d.ts",
26
- "import": "./dist/index.mjs",
27
- "require": "./dist/index.js",
28
- "default": "./dist/index.js"
29
- },
30
- "./browser": {
31
- "types": "./dist/browser.d.ts",
32
- "import": "./dist/browser.mjs"
33
- }
34
- },
23
+ "main": "./dist/index.js",
24
+ "module": "./dist/index.mjs",
25
+ "types": "./dist/index.d.ts",
35
26
  "files": [
36
27
  "dist",
37
28
  "src"
@@ -43,13 +34,16 @@
43
34
  "@cosmjs/launchpad": "^0.27.1",
44
35
  "@cosmjs/proto-signing": "^0.32.1",
45
36
  "@cosmjs/stargate": "^0.32.1",
37
+ "@zk-kit/baby-jubjub": "^1.0.3",
38
+ "@zk-kit/eddsa-poseidon": "^1.1.0",
39
+ "@zk-kit/poseidon-cipher": "^0.3.2",
40
+ "@zk-kit/utils": "^1.4.1",
46
41
  "assert": "^2.1.0",
47
42
  "bech32": "1.1.4",
48
43
  "blake-hash": "^2.0.0",
49
44
  "colorts": "^0.1.63",
50
45
  "cosmjs-types": "^0.9.0",
51
46
  "ethers": "^6.13.4",
52
- "ffjavascript": "^0.2.60",
53
47
  "gql.tada": "^1.7.0",
54
48
  "graphql": "^16.8.1",
55
49
  "husky": "^8.0.3",
@@ -59,8 +53,7 @@
59
53
  "tmp": "^0.2.1",
60
54
  "ts-retry-promise": "^0.7.1",
61
55
  "tweetnacl": "^1.0.3",
62
- "valibot": "0.36.0",
63
- "@dorafactory/circomlib": "0.0.3"
56
+ "valibot": "0.36.0"
64
57
  },
65
58
  "devDependencies": {
66
59
  "@commitlint/cli": "^18.0.0",
@@ -70,6 +63,7 @@
70
63
  "@types/tmp": "^0.2.5",
71
64
  "@typescript-eslint/eslint-plugin": "^6.8.0",
72
65
  "@typescript-eslint/parser": "^6.8.0",
66
+ "browserify-zlib": "^0.2.0",
73
67
  "buffer": "^6.0.3",
74
68
  "crypto-browserify": "^3.12.1",
75
69
  "dotenv": "^16.3.1",
@@ -81,7 +75,7 @@
81
75
  "events-browserify": "^0.0.1",
82
76
  "https-browserify": "^1.0.0",
83
77
  "lint-staged": "^15.0.2",
84
- "prettier": "^2.8.8",
78
+ "prettier": "^3.5.3",
85
79
  "process": "^0.11.10",
86
80
  "stream-browserify": "^3.0.0",
87
81
  "stream-http": "^3.2.0",
@@ -89,8 +83,7 @@
89
83
  "tsconfig-paths": "^4.2.0",
90
84
  "tsup": "^8.0.0",
91
85
  "typedoc": "^0.25.2",
92
- "typescript": "^5.2.2",
93
- "browserify-zlib": "^0.2.0"
86
+ "typescript": "^5.2.2"
94
87
  },
95
88
  "lint-staged": {
96
89
  "**/*.ts": [
@@ -151,17 +144,18 @@
151
144
  "scripts": {
152
145
  "clean": "rm -rf tsconfig.tsbuildinfo ./dist",
153
146
  "build": "npm run build:types && npm run build:tsup",
154
- "build:tsup": "tsup",
155
- "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist",
147
+ "build:tsup": "tsup ./src/index.ts --format esm,cjs --sourcemap",
148
+ "build:types": "tsc --build",
156
149
  "watch:tsup": "tsup ./src/index.ts --format esm,cjs --clean --splitting --watch",
157
150
  "watch:types": "tsc --watch",
158
151
  "watch": "pnpm run clean & pnpm run watch:types & pnpm run watch:tsup",
159
152
  "test": "pnpm test:typecheck && pnpm test:unit",
153
+ "test:typecheck": "tsc -p ./test",
154
+ "test:unit": "vitest run --test-timeout=60000",
155
+ "test:watch": "vitest",
160
156
  "format:fix": "prettier --ignore-path 'dist/* docs/*' --write '**/*.{ts,json,md}'",
161
157
  "lint:fix": "eslint . --ignore-pattern dist --ext .ts --fix",
162
158
  "commit": "commit",
163
- "doc": "typedoc --out docs src/index.ts",
164
- "chalk": "^5.0.1",
165
- "prettier": "^2.8.4"
159
+ "doc": "typedoc --out docs src/index.ts"
166
160
  }
167
161
  }
package/src/index.ts CHANGED
@@ -10,7 +10,5 @@ export { Circuit } from './libs/query';
10
10
  export { Operator } from './libs/query';
11
11
  export { Proof } from './libs/query';
12
12
  export { Transaction } from './libs/query';
13
- export * from './libs/circom';
13
+ export * from './libs/crypto';
14
14
  export * from './utils';
15
- export { Scalar, utils } from 'ffjavascript';
16
- export { default as createBlakeHash } from 'blake-hash';
@@ -34,7 +34,7 @@ import {
34
34
  } from './utils';
35
35
  import { QTR_LIB } from './vars';
36
36
  import { MaciRoundType, MaciCertSystemType } from '../../types';
37
- import { decompressPublicKey } from '../../utils';
37
+ import { unpackPubKey } from '../crypto';
38
38
 
39
39
  export const prefix = 'dora';
40
40
 
@@ -76,10 +76,9 @@ export class Contract {
76
76
  voiceCreditAmount,
77
77
  circuitType,
78
78
  preDeactivateRoot,
79
- }: CreateAMaciRoundParams) {
79
+ }: CreateAMaciRoundParams & { signer: OfflineSigner }) {
80
80
  const start_time = (startVoting.getTime() * 10 ** 6).toString();
81
81
  const end_time = (endVoting.getTime() * 10 ** 6).toString();
82
-
83
82
  const client = await createRegistryClientBy({
84
83
  rpcEndpoint: this.rpcEndpoint,
85
84
  wallet: signer,
@@ -145,13 +144,14 @@ export class Contract {
145
144
  maxOption,
146
145
  circuitType,
147
146
  certSystemType,
148
- }: CreateMaciRoundParams) {
147
+ }: CreateMaciRoundParams & { signer: OfflineSigner }) {
149
148
  const start_time = (startVoting.getTime() * 10 ** 6).toString();
150
149
  const end_time = (endVoting.getTime() * 10 ** 6).toString();
151
150
  const [{ address }] = await signer.getAccounts();
152
151
  const client = await createContractClientByWallet(this.rpcEndpoint, signer);
153
- const { x: operatorPubkeyX, y: operatorPubkeyY } =
154
- decompressPublicKey(operatorPubkey);
152
+ const [operatorPubkeyX, operatorPubkeyY] = unpackPubKey(
153
+ BigInt(operatorPubkey)
154
+ );
155
155
  const {
156
156
  parameters,
157
157
  groth16ProcessVkey,
@@ -178,8 +178,8 @@ export class Contract {
178
178
  },
179
179
  parameters,
180
180
  coordinator: {
181
- x: operatorPubkeyX,
182
- y: operatorPubkeyY,
181
+ x: operatorPubkeyX.toString(),
182
+ y: operatorPubkeyY.toString(),
183
183
  },
184
184
  groth16_process_vkey: groth16ProcessVkey,
185
185
  groth16_tally_vkey: groth16TallyVkey,
@@ -211,13 +211,14 @@ export class Contract {
211
211
  whitelistEcosystem,
212
212
  whitelistSnapshotHeight,
213
213
  whitelistVotingPowerArgs,
214
- }: CreateOracleMaciRoundParams) {
214
+ }: CreateOracleMaciRoundParams & { signer: OfflineSigner }) {
215
215
  const start_time = (startVoting.getTime() * 1_000_000).toString();
216
216
  const end_time = (endVoting.getTime() * 1_000_000).toString();
217
217
  const [{ address }] = await signer.getAccounts();
218
218
  const client = await createContractClientByWallet(this.rpcEndpoint, signer);
219
- const { x: operatorPubkeyX, y: operatorPubkeyY } =
220
- decompressPublicKey(operatorPubkey);
219
+ const [operatorPubkeyX, operatorPubkeyY] = unpackPubKey(
220
+ BigInt(operatorPubkey)
221
+ );
221
222
  const { maciVoteType, maciCertSystem } = getContractParams(
222
223
  MaciRoundType.ORACLE_MACI,
223
224
  circuitType,
@@ -235,8 +236,8 @@ export class Contract {
235
236
  end_time,
236
237
  },
237
238
  coordinator: {
238
- x: operatorPubkeyX,
239
- y: operatorPubkeyY,
239
+ x: operatorPubkeyX.toString(),
240
+ y: operatorPubkeyY.toString(),
240
241
  },
241
242
  vote_option_map: voteOptionMap,
242
243
  whitelist_backend_pubkey: this.whitelistBackendPubkey,
@@ -8,7 +8,7 @@ import {
8
8
  } from '../../types';
9
9
 
10
10
  export type CreateRoundParams = {
11
- signer: OfflineSigner;
11
+ signer?: OfflineSigner;
12
12
  title: string;
13
13
  description?: string;
14
14
  link?: string;
@@ -29,14 +29,14 @@ export type CreateAMaciRoundParams = {
29
29
  export type CreateMaciRoundParams = {
30
30
  maxVoter: number;
31
31
  maxOption: number;
32
- operatorPubkey: string;
32
+ operatorPubkey: bigint | string;
33
33
  whitelist: MaciWhitelist;
34
34
  certSystemType: MaciCertSystemType;
35
35
  } & CreateRoundParams;
36
36
 
37
37
  export type CreateOracleMaciRoundParams = {
38
38
  voteOptionMap: string[];
39
- operatorPubkey: string;
39
+ operatorPubkey: bigint | string;
40
40
  whitelistEcosystem: CertificateEcosystem;
41
41
  whitelistSnapshotHeight: string;
42
42
  whitelistVotingPowerArgs: {