@dorafactory/maci-sdk 0.0.12 → 0.0.13

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 (60) hide show
  1. package/dist/browser.d.mts +2007 -0
  2. package/dist/browser.d.ts +2007 -0
  3. package/dist/browser.js +30833 -0
  4. package/dist/browser.js.map +1 -0
  5. package/dist/browser.mjs +30844 -0
  6. package/dist/browser.mjs.map +1 -0
  7. package/dist/index.d.mts +2008 -0
  8. package/dist/index.d.ts +2006 -14
  9. package/dist/index.js +4 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +1 -1
  12. package/dist/index.mjs.map +1 -1
  13. package/package.json +31 -12
  14. package/src/browser.ts +17 -0
  15. package/src/libs/maci/maci.ts +1 -1
  16. package/src/polyfills/browser-polyfills.ts +9 -0
  17. package/dist/libs/circom/circomlib.d.ts +0 -39
  18. package/dist/libs/circom/index.d.ts +0 -10
  19. package/dist/libs/circom/tree.d.ts +0 -23
  20. package/dist/libs/circom/types.d.ts +0 -7
  21. package/dist/libs/const.d.ts +0 -117
  22. package/dist/libs/contract/config.d.ts +0 -29
  23. package/dist/libs/contract/contract.d.ts +0 -43
  24. package/dist/libs/contract/index.d.ts +0 -1
  25. package/dist/libs/contract/ts/AMaci.client.d.ts +0 -216
  26. package/dist/libs/contract/ts/AMaci.types.d.ts +0 -203
  27. package/dist/libs/contract/ts/Maci.client.d.ts +0 -180
  28. package/dist/libs/contract/ts/Maci.types.d.ts +0 -226
  29. package/dist/libs/contract/ts/OracleMaci.client.d.ts +0 -206
  30. package/dist/libs/contract/ts/OracleMaci.types.d.ts +0 -263
  31. package/dist/libs/contract/ts/Registry.client.d.ts +0 -128
  32. package/dist/libs/contract/ts/Registry.types.d.ts +0 -110
  33. package/dist/libs/contract/types.d.ts +0 -39
  34. package/dist/libs/contract/utils.d.ts +0 -59
  35. package/dist/libs/contract/vars.d.ts +0 -63
  36. package/dist/libs/errors/index.d.ts +0 -28
  37. package/dist/libs/errors/types.d.ts +0 -15
  38. package/dist/libs/http/http.d.ts +0 -16
  39. package/dist/libs/http/index.d.ts +0 -1
  40. package/dist/libs/index.d.ts +0 -7
  41. package/dist/libs/indexer/index.d.ts +0 -1
  42. package/dist/libs/indexer/indexer.d.ts +0 -142
  43. package/dist/libs/indexer/types.d.ts +0 -7
  44. package/dist/libs/maci/index.d.ts +0 -1
  45. package/dist/libs/maci/maci.d.ts +0 -121
  46. package/dist/libs/maci/types.d.ts +0 -6
  47. package/dist/libs/oracle-certificate/index.d.ts +0 -1
  48. package/dist/libs/oracle-certificate/oracle-certificate.d.ts +0 -7
  49. package/dist/libs/oracle-certificate/types.d.ts +0 -17
  50. package/dist/libs/query/account.d.ts +0 -7
  51. package/dist/libs/query/circuit.d.ts +0 -8
  52. package/dist/libs/query/event.d.ts +0 -7
  53. package/dist/libs/query/index.d.ts +0 -7
  54. package/dist/libs/query/operator.d.ts +0 -9
  55. package/dist/libs/query/proof.d.ts +0 -7
  56. package/dist/libs/query/round.d.ts +0 -11
  57. package/dist/libs/query/transaction.d.ts +0 -9
  58. package/dist/maci.d.ts +0 -157
  59. package/dist/types/index.d.ts +0 -294
  60. package/dist/utils/index.d.ts +0 -17
package/dist/maci.d.ts DELETED
@@ -1,157 +0,0 @@
1
- import { BalanceResponse, ClientParams, RoundResponse, RoundsResponse, OperatorResponse, OperatorsResponse, CircuitResponse, TransactionResponse, TransactionsResponse, CircuitsResponse, ProofResponse } from './types';
2
- import { Http, Indexer, Contract, OracleCertificate, Circom, MACI } from './libs';
3
- import { CreateAMaciRoundParams, CreateMaciRoundParams, CreateOracleMaciRoundParams } from './libs/contract/types';
4
- import { OfflineSigner } from '@cosmjs/proto-signing';
5
- /**
6
- * @class MaciClient
7
- * @description This class is used to interact with Maci Client.
8
- */
9
- export declare class MaciClient {
10
- rpcEndpoint: string;
11
- restEndpoint: string;
12
- apiEndpoint: string;
13
- certificateApiEndpoint: string;
14
- registryAddress: string;
15
- maciCodeId: number;
16
- oracleCodeId: number;
17
- feegrantOperator: string;
18
- whitelistBackendPubkey: string;
19
- http: Http;
20
- indexer: Indexer;
21
- contract: Contract;
22
- circom: Circom;
23
- oracleCertificate: OracleCertificate;
24
- maci: MACI;
25
- /**
26
- * @constructor
27
- * @param {ClientParams} params - The parameters for the Maci Client instance.
28
- */
29
- constructor({ network, rpcEndpoint, restEndpoint, apiEndpoint, registryAddress, maciCodeId, oracleCodeId, customFetch, defaultOptions, feegrantOperator, whitelistBackendPubkey, certificateApiEndpoint, }: ClientParams);
30
- oracleMaciClient({ signer, contractAddress, }: {
31
- signer: OfflineSigner;
32
- contractAddress: string;
33
- }): Promise<import("./libs/contract/ts/OracleMaci.client").OracleMaciClient>;
34
- registryClient({ signer, contractAddress, }: {
35
- signer: OfflineSigner;
36
- contractAddress: string;
37
- }): Promise<import("./libs/contract/ts/Registry.client").RegistryClient>;
38
- maciClient({ signer, contractAddress, }: {
39
- signer: OfflineSigner;
40
- contractAddress: string;
41
- }): Promise<import("./libs/contract/ts/Maci.client").MaciClient>;
42
- amaciClient({ signer, contractAddress, }: {
43
- signer: OfflineSigner;
44
- contractAddress: string;
45
- }): Promise<import("./libs/contract/ts/AMaci.client").AMaciClient>;
46
- createAMaciRound(params: CreateAMaciRoundParams): Promise<string>;
47
- createMaciRound(params: CreateMaciRoundParams): Promise<import("@cosmjs/cosmwasm-stargate").InstantiateResult>;
48
- createOracleMaciRound(params: CreateOracleMaciRoundParams): Promise<import("@cosmjs/cosmwasm-stargate").InstantiateResult>;
49
- /**
50
- * @method balanceOf
51
- * @description Get the balance of a specific address.
52
- * @param {string} address - The address to check the balance for.
53
- * @returns {Promise<BalanceResponse>} The balance response.
54
- */
55
- balanceOf(address: string): Promise<BalanceResponse>;
56
- /**
57
- * @method getRoundById
58
- * @description Get a round by its ID.
59
- * @param {string} id - The ID of the round.
60
- * @returns {Promise<RoundResponse>} The round response.
61
- */
62
- getRoundById(id: string): Promise<RoundResponse>;
63
- /**
64
- * @method getRounds
65
- * @description Get multiple rounds.
66
- * @param {string} after - The cursor to start after.
67
- * @param {number} [limit] - The number of rounds to retrieve.
68
- * @returns {Promise<RoundsResponse>} The rounds response.
69
- */
70
- getRounds(after: string, limit?: number): Promise<RoundsResponse>;
71
- /**
72
- * @method getRoundsByStatus
73
- * @description Get rounds by their status.
74
- * @param {string} status - The status of the rounds to retrieve.
75
- * @param {string} after - The cursor to start after.
76
- * @param {number} [limit] - The number of rounds to retrieve.
77
- * @returns {Promise<RoundsResponse>} The rounds response.
78
- */
79
- getRoundsByStatus(status: string, after: string, limit?: number): Promise<RoundsResponse>;
80
- /**
81
- * @method getRoundsByCircuitName
82
- * @description Get rounds by their circuit name.
83
- * @param {string} name - The name of the circuit.
84
- * @param {string} after - The cursor to start after.
85
- * @param {number} [limit] - The number of rounds to retrieve.
86
- * @returns {Promise<RoundsResponse>} The rounds response.
87
- */
88
- getRoundsByCircuitName(name: string, after: string, limit?: number): Promise<RoundsResponse>;
89
- /**
90
- * @method getRoundsByOperator
91
- * @description Get rounds by their operator address.
92
- * @param {string} address - The address of the operator.
93
- * @param {string} after - The cursor to start after.
94
- * @param {number} [limit] - The number of rounds to retrieve.
95
- * @returns {Promise<RoundsResponse>} The rounds response.
96
- */
97
- getRoundsByOperator(address: string, after: string, limit?: number): Promise<RoundsResponse>;
98
- /**
99
- * @method getOperatorByAddress
100
- * @description Get an operator by their address.
101
- * @param {string} address - The address of the operator.
102
- * @returns {Promise<OperatorResponse>} The operator response.
103
- */
104
- getOperatorByAddress(address: string): Promise<OperatorResponse>;
105
- /**
106
- * @method getOperators
107
- * @description Get multiple operators.
108
- * @param {string} after - The cursor to start after.
109
- * @param {number} [limit] - The number of operators to retrieve.
110
- * @returns {Promise<OperatorsResponse>} The operators response.
111
- */
112
- getOperators(after: string, limit?: number): Promise<OperatorsResponse>;
113
- /**
114
- * @method getCircuitByName
115
- * @description Get a circuit by its name.
116
- * @param {string} name - The name of the circuit.
117
- * @returns {Promise<CircuitResponse>} The circuit response.
118
- */
119
- getCircuitByName(name: string): Promise<CircuitResponse>;
120
- /**
121
- * @method getCircuits
122
- * @description Get all available circuits.
123
- * @returns {Promise<CircuitsResponse>} The circuits response.
124
- */
125
- getCircuits(): Promise<CircuitsResponse>;
126
- /**
127
- * @method getTransactionByHash
128
- * @description Get a transaction by its hash.
129
- * @param {string} hash - The hash of the transaction.
130
- * @returns {Promise<TransactionResponse>} The transaction response.
131
- */
132
- getTransactionByHash(hash: string): Promise<TransactionResponse>;
133
- /**
134
- * @method getTransactions
135
- * @description Get multiple transactions.
136
- * @param {string} after - The cursor to start after.
137
- * @param {number} [limit] - The number of transactions to retrieve.
138
- * @returns {Promise<TransactionsResponse>} The transactions response.
139
- */
140
- getTransactions(after: string, limit?: number): Promise<TransactionsResponse>;
141
- /**
142
- * @method getTransactionsByContractAddress
143
- * @description Get transactions by contract address.
144
- * @param {string} address - The contract address.
145
- * @param {string} after - The cursor to start after.
146
- * @param {number} [limit] - The number of transactions to retrieve.
147
- * @returns {Promise<TransactionsResponse>} The transactions response.
148
- */
149
- getTransactionsByContractAddress(address: string, after: string, limit?: number): Promise<TransactionsResponse>;
150
- /**
151
- * @method getProofByContractAddress
152
- * @description Get proof data by contract address.
153
- * @param {string} address - The contract address.
154
- * @returns {Promise<ProofResponse>} The proof response.
155
- */
156
- getProofByContractAddress(address: string): Promise<ProofResponse>;
157
- }
@@ -1,294 +0,0 @@
1
- import { FetchOptions } from '../libs/http/http';
2
- export type * from '../libs/contract/types';
3
- export declare enum MaciCircuitType {
4
- IP1V = "0",
5
- QV = "1"
6
- }
7
- export declare enum MaciCertSystemType {
8
- GROTH16 = "groth16",
9
- PLONK = "plonk"
10
- }
11
- export declare enum MaciRoundType {
12
- MACI = "0",
13
- AMACI = "1",
14
- ORACLE_MACI = "2"
15
- }
16
- export type CertificateEcosystem = 'cosmoshub' | 'doravota';
17
- export type ClientParams = {
18
- network: 'mainnet' | 'testnet';
19
- rpcEndpoint?: string;
20
- restEndpoint?: string;
21
- apiEndpoint?: string;
22
- certificateApiEndpoint?: string;
23
- registryAddress?: string;
24
- maciCodeId?: number;
25
- oracleCodeId?: number;
26
- customFetch?: typeof fetch;
27
- defaultOptions?: FetchOptions;
28
- feegrantOperator?: string;
29
- whitelistBackendPubkey?: string;
30
- };
31
- export type ContractParams = {
32
- rpcEndpoint: string;
33
- registryAddress: string;
34
- maciCodeId: number;
35
- oracleCodeId: number;
36
- whitelistBackendPubkey: string;
37
- feegrantOperator: string;
38
- };
39
- export type TransactionType = {
40
- id: string;
41
- blockHeight: string;
42
- txHash: string;
43
- timestamp: string;
44
- type: string;
45
- status: string;
46
- circuitName: string;
47
- fee: string;
48
- gasUsed: string;
49
- gasWanted: string;
50
- caller: string;
51
- contractAddress: string;
52
- };
53
- export type RoundType = {
54
- id: string;
55
- blockHeight: string;
56
- txHash: string;
57
- caller: string;
58
- admin: string;
59
- operator: string;
60
- contractAddress: string;
61
- circuitName: string;
62
- timestamp: string;
63
- votingStart: string;
64
- votingEnd: string;
65
- status: string;
66
- period: string;
67
- actionType: string;
68
- roundTitle: string;
69
- roundDescription: string;
70
- roundLink: string;
71
- coordinatorPubkeyX: string;
72
- coordinatorPubkeyY: string;
73
- voteOptionMap: string;
74
- results: string;
75
- allResult: string;
76
- gasStationEnable: boolean;
77
- totalGrant: string;
78
- baseGrant: string;
79
- totalBond: string;
80
- circuitType: string;
81
- circuitPower: string;
82
- certificationSystem: string;
83
- codeId: string;
84
- maciType: string;
85
- voiceCreditAmount: string;
86
- preDeactivateRoot: string;
87
- identity: string;
88
- operatorLogoUrl?: string;
89
- operatorMoniker?: string;
90
- resultsList?: {
91
- v: number;
92
- v2: number;
93
- }[];
94
- };
95
- export type ProofType = {
96
- nodes: {
97
- id: string;
98
- blockHeight: string;
99
- txHash: string;
100
- contractAddress: string;
101
- timestamp: string;
102
- actionType: string;
103
- commitment: string;
104
- proof: string;
105
- }[];
106
- };
107
- export type OperatorType = {
108
- id: string;
109
- validatorAddress: string;
110
- operatorAddress: string;
111
- coordinatorPubkeyX: string;
112
- coordinatorPubkeyY: string;
113
- identity: string;
114
- logoUrl: string;
115
- moniker: string;
116
- activeRoundsCount: number;
117
- completedRoundsCount: number;
118
- };
119
- export type CircuitType = {
120
- maciType: string;
121
- circuitType: string;
122
- displayName: string;
123
- repoUrl: string;
124
- zipUrl: string;
125
- roundCount?: number;
126
- };
127
- export type SignUpEventType = {
128
- id: string;
129
- blockHeight: string;
130
- txHash: string;
131
- contractAddress: string;
132
- timestamp: string;
133
- pubKey: string;
134
- stateIdx: number;
135
- balance: string;
136
- };
137
- export type CircuitsCountGraphqlResponse = {
138
- data: {
139
- rounds: {
140
- totalCount: number;
141
- };
142
- };
143
- };
144
- export type ErrorResponse = {
145
- code: number;
146
- error: {
147
- message: string;
148
- type: string;
149
- };
150
- };
151
- export type SuccessResponse<T> = {
152
- code: 200;
153
- data: T;
154
- };
155
- export type CircuitResponse = SuccessResponse<{
156
- circuit: CircuitType;
157
- }> | ErrorResponse;
158
- export type CircuitsResponse = SuccessResponse<{
159
- circuits: CircuitType[];
160
- }> | ErrorResponse;
161
- export type BalanceResponse = SuccessResponse<{
162
- balance: string;
163
- }> | ErrorResponse;
164
- export type OperatorResponse = SuccessResponse<{
165
- operator: OperatorType;
166
- }> | ErrorResponse;
167
- export type OperatorsResponse = SuccessResponse<{
168
- operators: {
169
- pageInfo: {
170
- endCursor: string;
171
- hasNextPage: boolean;
172
- };
173
- edges: {
174
- cursor: string;
175
- node: OperatorType;
176
- }[];
177
- totalCount: number;
178
- };
179
- }> | ErrorResponse;
180
- export type OperatorsGraphqlResponse = {
181
- data: {
182
- operators: {
183
- pageInfo: {
184
- endCursor: string;
185
- hasNextPage: boolean;
186
- };
187
- edges: {
188
- cursor: string;
189
- node: OperatorType;
190
- }[];
191
- totalCount: number;
192
- };
193
- };
194
- };
195
- export type RoundsCountGraphqlResponse = {
196
- data: {
197
- activeRoundsCount: {
198
- totalCount: number;
199
- };
200
- completedRoundsCount: {
201
- totalCount: number;
202
- };
203
- };
204
- };
205
- export type TransactionGraphqlResponse = {
206
- data: {
207
- transaction: TransactionType;
208
- };
209
- };
210
- export type TransactionResponse = SuccessResponse<{
211
- transaction: TransactionType;
212
- }> | ErrorResponse;
213
- export type TransactionsGraphqlResponse = {
214
- data: {
215
- transactions: {
216
- pageInfo: {
217
- endCursor: string;
218
- hasNextPage: boolean;
219
- };
220
- edges: {
221
- cursor: string;
222
- node: TransactionType;
223
- }[];
224
- totalCount: number;
225
- };
226
- };
227
- };
228
- export type TransactionsResponse = SuccessResponse<{
229
- transactions: {
230
- pageInfo: {
231
- endCursor: string;
232
- hasNextPage: boolean;
233
- };
234
- edges: {
235
- cursor: string;
236
- node: TransactionType;
237
- }[];
238
- totalCount: number;
239
- };
240
- }> | ErrorResponse;
241
- export type RoundResponse = SuccessResponse<{
242
- round: RoundType;
243
- }> | ErrorResponse;
244
- export type RoundsResponse = SuccessResponse<{
245
- rounds: {
246
- pageInfo: {
247
- endCursor: string;
248
- hasNextPage: boolean;
249
- };
250
- edges: {
251
- cursor: string;
252
- node: RoundType;
253
- }[];
254
- totalCount: number;
255
- };
256
- }> | ErrorResponse;
257
- export type RoundGraphqlResponse = {
258
- data: {
259
- round: RoundType;
260
- };
261
- };
262
- export type RoundsGraphqlResponse = {
263
- data: {
264
- rounds: {
265
- pageInfo: {
266
- endCursor: string;
267
- hasNextPage: boolean;
268
- };
269
- edges: {
270
- cursor: string;
271
- node: RoundType;
272
- }[];
273
- totalCount: number;
274
- };
275
- };
276
- };
277
- export type ProofResponse = SuccessResponse<{
278
- proofData: ProofType;
279
- }> | ErrorResponse;
280
- export type ProofGraphqlResponse = {
281
- data: {
282
- proofData: ProofType;
283
- };
284
- };
285
- export type SignUpEventsResponse = SuccessResponse<{
286
- signUpEvents: SignUpEventType[];
287
- }> | ErrorResponse;
288
- export type SignUpEventsGraphqlResponse = {
289
- data: {
290
- signUpEvents: {
291
- nodes: SignUpEventType[];
292
- };
293
- };
294
- };
@@ -1,17 +0,0 @@
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;
8
- /**
9
- * Parses a public key string into its x and y coordinates.
10
- * @param publickKey - The public key string to parse (128 characters long).
11
- * @returns An object containing the x and y coordinates as decimal strings.
12
- */
13
- export declare function decompressPublicKey(compressedPubkey: string): {
14
- x: string;
15
- y: string;
16
- };
17
- export declare function compressPublicKey(decompressedPubkey: any[]): string;