@dorafactory/maci-sdk 0.0.20 → 0.0.21
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/dist/browser.d.mts +85 -5
- package/dist/browser.d.ts +85 -5
- package/dist/browser.js +380 -24
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +380 -24
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +85 -5
- package/dist/index.d.ts +85 -5
- package/dist/index.js +380 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +380 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/libs/contract/contract.ts +32 -21
- package/src/libs/contract/types.ts +4 -4
- package/src/libs/contract/utils.ts +26 -6
- package/src/libs/errors/types.ts +3 -0
- package/src/libs/indexer/indexer.ts +21 -0
- package/src/libs/maci/maci.ts +60 -0
- package/src/libs/query/operator.ts +338 -0
- package/src/types/index.ts +86 -0
package/dist/browser.d.mts
CHANGED
|
@@ -129,16 +129,16 @@ type CreateRoundParams = {
|
|
|
129
129
|
circuitType: MaciCircuitType;
|
|
130
130
|
};
|
|
131
131
|
type CreateAMaciRoundParams = {
|
|
132
|
-
maxVoter:
|
|
133
|
-
maxOption:
|
|
132
|
+
maxVoter: number;
|
|
133
|
+
maxOption: number;
|
|
134
134
|
operator: string;
|
|
135
135
|
whitelist: Whitelist$2;
|
|
136
136
|
voiceCreditAmount: string;
|
|
137
137
|
preDeactivateRoot?: string;
|
|
138
138
|
} & CreateRoundParams;
|
|
139
139
|
type CreateMaciRoundParams = {
|
|
140
|
-
maxVoter:
|
|
141
|
-
maxOption:
|
|
140
|
+
maxVoter: number;
|
|
141
|
+
maxOption: number;
|
|
142
142
|
operatorPubkey: string;
|
|
143
143
|
whitelist: Whitelist$1;
|
|
144
144
|
certSystemType: MaciCertSystemType;
|
|
@@ -259,6 +259,18 @@ type ProofType = {
|
|
|
259
259
|
proof: string;
|
|
260
260
|
}[];
|
|
261
261
|
};
|
|
262
|
+
type OperatorDelayType = {
|
|
263
|
+
blockHeight: string;
|
|
264
|
+
delayProcessDmsgCount: number;
|
|
265
|
+
delayDuration: string;
|
|
266
|
+
delayReason: string;
|
|
267
|
+
delayType: string;
|
|
268
|
+
id: string;
|
|
269
|
+
nodeId: string;
|
|
270
|
+
operatorAddress: string;
|
|
271
|
+
timestamp: string;
|
|
272
|
+
roundAddress: string;
|
|
273
|
+
};
|
|
262
274
|
type OperatorType = {
|
|
263
275
|
id: string;
|
|
264
276
|
validatorAddress: string;
|
|
@@ -319,6 +331,24 @@ type BalanceResponse = SuccessResponse<{
|
|
|
319
331
|
type OperatorResponse = SuccessResponse<{
|
|
320
332
|
operator: OperatorType;
|
|
321
333
|
}> | ErrorResponse;
|
|
334
|
+
type MissRateResponse = SuccessResponse<{
|
|
335
|
+
missRate: (MissRateType & {
|
|
336
|
+
date: string;
|
|
337
|
+
})[];
|
|
338
|
+
}> | ErrorResponse;
|
|
339
|
+
type OperatorDelayOperationsResponse = SuccessResponse<{
|
|
340
|
+
operatorDelayOperations: {
|
|
341
|
+
pageInfo: {
|
|
342
|
+
endCursor: string;
|
|
343
|
+
hasNextPage: boolean;
|
|
344
|
+
};
|
|
345
|
+
edges: {
|
|
346
|
+
cursor: string;
|
|
347
|
+
node: OperatorDelayType;
|
|
348
|
+
}[];
|
|
349
|
+
totalCount: number;
|
|
350
|
+
};
|
|
351
|
+
}> | ErrorResponse;
|
|
322
352
|
type OperatorsResponse = SuccessResponse<{
|
|
323
353
|
operators: {
|
|
324
354
|
pageInfo: {
|
|
@@ -357,6 +387,31 @@ type RoundsCountGraphqlResponse = {
|
|
|
357
387
|
};
|
|
358
388
|
};
|
|
359
389
|
};
|
|
390
|
+
type VoteCountGraphqlResponse = {
|
|
391
|
+
data: {
|
|
392
|
+
signupsCount: {
|
|
393
|
+
totalCount: number;
|
|
394
|
+
};
|
|
395
|
+
messagesCount: {
|
|
396
|
+
totalCount: number;
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
type OperatorDelayOperationsGraphqlResponse = {
|
|
401
|
+
data: {
|
|
402
|
+
operatorDelayOperations: {
|
|
403
|
+
pageInfo: {
|
|
404
|
+
endCursor: string;
|
|
405
|
+
hasNextPage: boolean;
|
|
406
|
+
};
|
|
407
|
+
edges: {
|
|
408
|
+
cursor: string;
|
|
409
|
+
node: OperatorDelayType;
|
|
410
|
+
}[];
|
|
411
|
+
totalCount: number;
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
};
|
|
360
415
|
type TransactionGraphqlResponse = {
|
|
361
416
|
data: {
|
|
362
417
|
transaction: TransactionType;
|
|
@@ -447,6 +502,21 @@ type SignUpEventsGraphqlResponse = {
|
|
|
447
502
|
};
|
|
448
503
|
};
|
|
449
504
|
};
|
|
505
|
+
type MissRateType = {
|
|
506
|
+
delayCount: number;
|
|
507
|
+
deactivateDelay: {
|
|
508
|
+
count: number;
|
|
509
|
+
dmsgCount: number;
|
|
510
|
+
};
|
|
511
|
+
tallyDelay: {
|
|
512
|
+
count: number;
|
|
513
|
+
};
|
|
514
|
+
totalDelayDuration: number;
|
|
515
|
+
avgDelayDuration: number;
|
|
516
|
+
tallyCount: number;
|
|
517
|
+
deactivateCount: number;
|
|
518
|
+
missRate: number;
|
|
519
|
+
};
|
|
450
520
|
|
|
451
521
|
declare class UserAccount {
|
|
452
522
|
http: Http;
|
|
@@ -466,7 +536,9 @@ declare class Operator {
|
|
|
466
536
|
amaciRegistryContract: string;
|
|
467
537
|
constructor(http: Http, amaciRegistryContract: string);
|
|
468
538
|
getOperatorByAddress(address: string): Promise<OperatorResponse>;
|
|
539
|
+
getOperatorDelayOperationsByAddress(address: string, after: string, limit?: number): Promise<OperatorDelayOperationsResponse>;
|
|
469
540
|
getOperators(after: string, limit?: number): Promise<OperatorsResponse>;
|
|
541
|
+
queryMissRate(address: string, durationDay: number): Promise<MissRateResponse>;
|
|
470
542
|
}
|
|
471
543
|
|
|
472
544
|
declare class Round {
|
|
@@ -583,6 +655,8 @@ declare class Indexer {
|
|
|
583
655
|
* @returns {Promise<OperatorResponse>} The operator response.
|
|
584
656
|
*/
|
|
585
657
|
getOperatorByAddress(address: string): Promise<OperatorResponse>;
|
|
658
|
+
getOperatorDelayOperationsByAddress(address: string, after: string, limit?: number): Promise<OperatorDelayOperationsResponse>;
|
|
659
|
+
queryMissRate(address: string, durationDay: number): Promise<MissRateResponse>;
|
|
586
660
|
/**
|
|
587
661
|
* @method getOperators
|
|
588
662
|
* @description Get multiple operators.
|
|
@@ -1666,6 +1740,12 @@ declare class MACI {
|
|
|
1666
1740
|
queryRoundIsQv({ contractAddress }: {
|
|
1667
1741
|
contractAddress: string;
|
|
1668
1742
|
}): Promise<boolean>;
|
|
1743
|
+
queryRoundClaimable({ contractAddress, }: {
|
|
1744
|
+
contractAddress: string;
|
|
1745
|
+
}): Promise<{
|
|
1746
|
+
claimable: boolean | null;
|
|
1747
|
+
balance: string | null;
|
|
1748
|
+
}>;
|
|
1669
1749
|
queryRoundGasStation({ contractAddress }: {
|
|
1670
1750
|
contractAddress: string;
|
|
1671
1751
|
}): Promise<boolean>;
|
|
@@ -2023,4 +2103,4 @@ declare function decompressPublicKey(compressedPubkey: string): {
|
|
|
2023
2103
|
};
|
|
2024
2104
|
declare function compressPublicKey(decompressedPubkey: any[]): string;
|
|
2025
2105
|
|
|
2026
|
-
export { type Account, type BalanceResponse, type CertificateEcosystem, Circom, Circuit, type CircuitResponse, type CircuitType, type CircuitsCountGraphqlResponse, type CircuitsResponse, type ClientParams, Contract, type ContractParams, type CreateAMaciRoundParams, type CreateMaciRoundParams, type CreateOracleMaciRoundParams, type CreateRoundParams, type ErrorResponse, Event, Http, Indexer, MACI, MaciCertSystemType, MaciCircuitType, MaciClient, MaciRoundType, type NetworkConfig, Operator, type OperatorResponse, type OperatorType, type OperatorsGraphqlResponse, type OperatorsResponse, OracleCertificate, type PrivateKey, Proof, type ProofGraphqlResponse, type ProofResponse, type ProofType, type PublicKey, Round, type RoundGraphqlResponse, type RoundResponse, type RoundType, type RoundsCountGraphqlResponse, type RoundsGraphqlResponse, type RoundsResponse, type SignUpEventType, type SignUpEventsGraphqlResponse, type SignUpEventsResponse, type SuccessResponse, Transaction, type TransactionGraphqlResponse, type TransactionResponse, type TransactionType, type TransactionsGraphqlResponse, type TransactionsResponse, UserAccount, batchGenMessage, circuits, compressPublicKey, decompressPublicKey, genAddKeyProof, genEcdhSharedKey, genKeypair, genMessageFactory, getDefaultParams, hexToDecimalString, isValidAddress, privateKeyFromTxt, stringizing, validator_operator_set };
|
|
2106
|
+
export { type Account, type BalanceResponse, type CertificateEcosystem, Circom, Circuit, type CircuitResponse, type CircuitType, type CircuitsCountGraphqlResponse, type CircuitsResponse, type ClientParams, Contract, type ContractParams, type CreateAMaciRoundParams, type CreateMaciRoundParams, type CreateOracleMaciRoundParams, type CreateRoundParams, type ErrorResponse, Event, Http, Indexer, MACI, MaciCertSystemType, MaciCircuitType, MaciClient, MaciRoundType, type MissRateResponse, type MissRateType, type NetworkConfig, Operator, type OperatorDelayOperationsGraphqlResponse, type OperatorDelayOperationsResponse, type OperatorDelayType, type OperatorResponse, type OperatorType, type OperatorsGraphqlResponse, type OperatorsResponse, OracleCertificate, type PrivateKey, Proof, type ProofGraphqlResponse, type ProofResponse, type ProofType, type PublicKey, Round, type RoundGraphqlResponse, type RoundResponse, type RoundType, type RoundsCountGraphqlResponse, type RoundsGraphqlResponse, type RoundsResponse, type SignUpEventType, type SignUpEventsGraphqlResponse, type SignUpEventsResponse, type SuccessResponse, Transaction, type TransactionGraphqlResponse, type TransactionResponse, type TransactionType, type TransactionsGraphqlResponse, type TransactionsResponse, UserAccount, type VoteCountGraphqlResponse, batchGenMessage, circuits, compressPublicKey, decompressPublicKey, genAddKeyProof, genEcdhSharedKey, genKeypair, genMessageFactory, getDefaultParams, hexToDecimalString, isValidAddress, privateKeyFromTxt, stringizing, validator_operator_set };
|
package/dist/browser.d.ts
CHANGED
|
@@ -129,16 +129,16 @@ type CreateRoundParams = {
|
|
|
129
129
|
circuitType: MaciCircuitType;
|
|
130
130
|
};
|
|
131
131
|
type CreateAMaciRoundParams = {
|
|
132
|
-
maxVoter:
|
|
133
|
-
maxOption:
|
|
132
|
+
maxVoter: number;
|
|
133
|
+
maxOption: number;
|
|
134
134
|
operator: string;
|
|
135
135
|
whitelist: Whitelist$2;
|
|
136
136
|
voiceCreditAmount: string;
|
|
137
137
|
preDeactivateRoot?: string;
|
|
138
138
|
} & CreateRoundParams;
|
|
139
139
|
type CreateMaciRoundParams = {
|
|
140
|
-
maxVoter:
|
|
141
|
-
maxOption:
|
|
140
|
+
maxVoter: number;
|
|
141
|
+
maxOption: number;
|
|
142
142
|
operatorPubkey: string;
|
|
143
143
|
whitelist: Whitelist$1;
|
|
144
144
|
certSystemType: MaciCertSystemType;
|
|
@@ -259,6 +259,18 @@ type ProofType = {
|
|
|
259
259
|
proof: string;
|
|
260
260
|
}[];
|
|
261
261
|
};
|
|
262
|
+
type OperatorDelayType = {
|
|
263
|
+
blockHeight: string;
|
|
264
|
+
delayProcessDmsgCount: number;
|
|
265
|
+
delayDuration: string;
|
|
266
|
+
delayReason: string;
|
|
267
|
+
delayType: string;
|
|
268
|
+
id: string;
|
|
269
|
+
nodeId: string;
|
|
270
|
+
operatorAddress: string;
|
|
271
|
+
timestamp: string;
|
|
272
|
+
roundAddress: string;
|
|
273
|
+
};
|
|
262
274
|
type OperatorType = {
|
|
263
275
|
id: string;
|
|
264
276
|
validatorAddress: string;
|
|
@@ -319,6 +331,24 @@ type BalanceResponse = SuccessResponse<{
|
|
|
319
331
|
type OperatorResponse = SuccessResponse<{
|
|
320
332
|
operator: OperatorType;
|
|
321
333
|
}> | ErrorResponse;
|
|
334
|
+
type MissRateResponse = SuccessResponse<{
|
|
335
|
+
missRate: (MissRateType & {
|
|
336
|
+
date: string;
|
|
337
|
+
})[];
|
|
338
|
+
}> | ErrorResponse;
|
|
339
|
+
type OperatorDelayOperationsResponse = SuccessResponse<{
|
|
340
|
+
operatorDelayOperations: {
|
|
341
|
+
pageInfo: {
|
|
342
|
+
endCursor: string;
|
|
343
|
+
hasNextPage: boolean;
|
|
344
|
+
};
|
|
345
|
+
edges: {
|
|
346
|
+
cursor: string;
|
|
347
|
+
node: OperatorDelayType;
|
|
348
|
+
}[];
|
|
349
|
+
totalCount: number;
|
|
350
|
+
};
|
|
351
|
+
}> | ErrorResponse;
|
|
322
352
|
type OperatorsResponse = SuccessResponse<{
|
|
323
353
|
operators: {
|
|
324
354
|
pageInfo: {
|
|
@@ -357,6 +387,31 @@ type RoundsCountGraphqlResponse = {
|
|
|
357
387
|
};
|
|
358
388
|
};
|
|
359
389
|
};
|
|
390
|
+
type VoteCountGraphqlResponse = {
|
|
391
|
+
data: {
|
|
392
|
+
signupsCount: {
|
|
393
|
+
totalCount: number;
|
|
394
|
+
};
|
|
395
|
+
messagesCount: {
|
|
396
|
+
totalCount: number;
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
type OperatorDelayOperationsGraphqlResponse = {
|
|
401
|
+
data: {
|
|
402
|
+
operatorDelayOperations: {
|
|
403
|
+
pageInfo: {
|
|
404
|
+
endCursor: string;
|
|
405
|
+
hasNextPage: boolean;
|
|
406
|
+
};
|
|
407
|
+
edges: {
|
|
408
|
+
cursor: string;
|
|
409
|
+
node: OperatorDelayType;
|
|
410
|
+
}[];
|
|
411
|
+
totalCount: number;
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
};
|
|
360
415
|
type TransactionGraphqlResponse = {
|
|
361
416
|
data: {
|
|
362
417
|
transaction: TransactionType;
|
|
@@ -447,6 +502,21 @@ type SignUpEventsGraphqlResponse = {
|
|
|
447
502
|
};
|
|
448
503
|
};
|
|
449
504
|
};
|
|
505
|
+
type MissRateType = {
|
|
506
|
+
delayCount: number;
|
|
507
|
+
deactivateDelay: {
|
|
508
|
+
count: number;
|
|
509
|
+
dmsgCount: number;
|
|
510
|
+
};
|
|
511
|
+
tallyDelay: {
|
|
512
|
+
count: number;
|
|
513
|
+
};
|
|
514
|
+
totalDelayDuration: number;
|
|
515
|
+
avgDelayDuration: number;
|
|
516
|
+
tallyCount: number;
|
|
517
|
+
deactivateCount: number;
|
|
518
|
+
missRate: number;
|
|
519
|
+
};
|
|
450
520
|
|
|
451
521
|
declare class UserAccount {
|
|
452
522
|
http: Http;
|
|
@@ -466,7 +536,9 @@ declare class Operator {
|
|
|
466
536
|
amaciRegistryContract: string;
|
|
467
537
|
constructor(http: Http, amaciRegistryContract: string);
|
|
468
538
|
getOperatorByAddress(address: string): Promise<OperatorResponse>;
|
|
539
|
+
getOperatorDelayOperationsByAddress(address: string, after: string, limit?: number): Promise<OperatorDelayOperationsResponse>;
|
|
469
540
|
getOperators(after: string, limit?: number): Promise<OperatorsResponse>;
|
|
541
|
+
queryMissRate(address: string, durationDay: number): Promise<MissRateResponse>;
|
|
470
542
|
}
|
|
471
543
|
|
|
472
544
|
declare class Round {
|
|
@@ -583,6 +655,8 @@ declare class Indexer {
|
|
|
583
655
|
* @returns {Promise<OperatorResponse>} The operator response.
|
|
584
656
|
*/
|
|
585
657
|
getOperatorByAddress(address: string): Promise<OperatorResponse>;
|
|
658
|
+
getOperatorDelayOperationsByAddress(address: string, after: string, limit?: number): Promise<OperatorDelayOperationsResponse>;
|
|
659
|
+
queryMissRate(address: string, durationDay: number): Promise<MissRateResponse>;
|
|
586
660
|
/**
|
|
587
661
|
* @method getOperators
|
|
588
662
|
* @description Get multiple operators.
|
|
@@ -1666,6 +1740,12 @@ declare class MACI {
|
|
|
1666
1740
|
queryRoundIsQv({ contractAddress }: {
|
|
1667
1741
|
contractAddress: string;
|
|
1668
1742
|
}): Promise<boolean>;
|
|
1743
|
+
queryRoundClaimable({ contractAddress, }: {
|
|
1744
|
+
contractAddress: string;
|
|
1745
|
+
}): Promise<{
|
|
1746
|
+
claimable: boolean | null;
|
|
1747
|
+
balance: string | null;
|
|
1748
|
+
}>;
|
|
1669
1749
|
queryRoundGasStation({ contractAddress }: {
|
|
1670
1750
|
contractAddress: string;
|
|
1671
1751
|
}): Promise<boolean>;
|
|
@@ -2023,4 +2103,4 @@ declare function decompressPublicKey(compressedPubkey: string): {
|
|
|
2023
2103
|
};
|
|
2024
2104
|
declare function compressPublicKey(decompressedPubkey: any[]): string;
|
|
2025
2105
|
|
|
2026
|
-
export { type Account, type BalanceResponse, type CertificateEcosystem, Circom, Circuit, type CircuitResponse, type CircuitType, type CircuitsCountGraphqlResponse, type CircuitsResponse, type ClientParams, Contract, type ContractParams, type CreateAMaciRoundParams, type CreateMaciRoundParams, type CreateOracleMaciRoundParams, type CreateRoundParams, type ErrorResponse, Event, Http, Indexer, MACI, MaciCertSystemType, MaciCircuitType, MaciClient, MaciRoundType, type NetworkConfig, Operator, type OperatorResponse, type OperatorType, type OperatorsGraphqlResponse, type OperatorsResponse, OracleCertificate, type PrivateKey, Proof, type ProofGraphqlResponse, type ProofResponse, type ProofType, type PublicKey, Round, type RoundGraphqlResponse, type RoundResponse, type RoundType, type RoundsCountGraphqlResponse, type RoundsGraphqlResponse, type RoundsResponse, type SignUpEventType, type SignUpEventsGraphqlResponse, type SignUpEventsResponse, type SuccessResponse, Transaction, type TransactionGraphqlResponse, type TransactionResponse, type TransactionType, type TransactionsGraphqlResponse, type TransactionsResponse, UserAccount, batchGenMessage, circuits, compressPublicKey, decompressPublicKey, genAddKeyProof, genEcdhSharedKey, genKeypair, genMessageFactory, getDefaultParams, hexToDecimalString, isValidAddress, privateKeyFromTxt, stringizing, validator_operator_set };
|
|
2106
|
+
export { type Account, type BalanceResponse, type CertificateEcosystem, Circom, Circuit, type CircuitResponse, type CircuitType, type CircuitsCountGraphqlResponse, type CircuitsResponse, type ClientParams, Contract, type ContractParams, type CreateAMaciRoundParams, type CreateMaciRoundParams, type CreateOracleMaciRoundParams, type CreateRoundParams, type ErrorResponse, Event, Http, Indexer, MACI, MaciCertSystemType, MaciCircuitType, MaciClient, MaciRoundType, type MissRateResponse, type MissRateType, type NetworkConfig, Operator, type OperatorDelayOperationsGraphqlResponse, type OperatorDelayOperationsResponse, type OperatorDelayType, type OperatorResponse, type OperatorType, type OperatorsGraphqlResponse, type OperatorsResponse, OracleCertificate, type PrivateKey, Proof, type ProofGraphqlResponse, type ProofResponse, type ProofType, type PublicKey, Round, type RoundGraphqlResponse, type RoundResponse, type RoundType, type RoundsCountGraphqlResponse, type RoundsGraphqlResponse, type RoundsResponse, type SignUpEventType, type SignUpEventsGraphqlResponse, type SignUpEventsResponse, type SuccessResponse, Transaction, type TransactionGraphqlResponse, type TransactionResponse, type TransactionType, type TransactionsGraphqlResponse, type TransactionsResponse, UserAccount, type VoteCountGraphqlResponse, batchGenMessage, circuits, compressPublicKey, decompressPublicKey, genAddKeyProof, genEcdhSharedKey, genKeypair, genMessageFactory, getDefaultParams, hexToDecimalString, isValidAddress, privateKeyFromTxt, stringizing, validator_operator_set };
|