@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/index.d.mts
CHANGED
|
@@ -130,16 +130,16 @@ type CreateRoundParams = {
|
|
|
130
130
|
circuitType: MaciCircuitType;
|
|
131
131
|
};
|
|
132
132
|
type CreateAMaciRoundParams = {
|
|
133
|
-
maxVoter:
|
|
134
|
-
maxOption:
|
|
133
|
+
maxVoter: number;
|
|
134
|
+
maxOption: number;
|
|
135
135
|
operator: string;
|
|
136
136
|
whitelist: Whitelist$2;
|
|
137
137
|
voiceCreditAmount: string;
|
|
138
138
|
preDeactivateRoot?: string;
|
|
139
139
|
} & CreateRoundParams;
|
|
140
140
|
type CreateMaciRoundParams = {
|
|
141
|
-
maxVoter:
|
|
142
|
-
maxOption:
|
|
141
|
+
maxVoter: number;
|
|
142
|
+
maxOption: number;
|
|
143
143
|
operatorPubkey: string;
|
|
144
144
|
whitelist: Whitelist$1;
|
|
145
145
|
certSystemType: MaciCertSystemType;
|
|
@@ -260,6 +260,18 @@ type ProofType = {
|
|
|
260
260
|
proof: string;
|
|
261
261
|
}[];
|
|
262
262
|
};
|
|
263
|
+
type OperatorDelayType = {
|
|
264
|
+
blockHeight: string;
|
|
265
|
+
delayProcessDmsgCount: number;
|
|
266
|
+
delayDuration: string;
|
|
267
|
+
delayReason: string;
|
|
268
|
+
delayType: string;
|
|
269
|
+
id: string;
|
|
270
|
+
nodeId: string;
|
|
271
|
+
operatorAddress: string;
|
|
272
|
+
timestamp: string;
|
|
273
|
+
roundAddress: string;
|
|
274
|
+
};
|
|
263
275
|
type OperatorType = {
|
|
264
276
|
id: string;
|
|
265
277
|
validatorAddress: string;
|
|
@@ -320,6 +332,24 @@ type BalanceResponse = SuccessResponse<{
|
|
|
320
332
|
type OperatorResponse = SuccessResponse<{
|
|
321
333
|
operator: OperatorType;
|
|
322
334
|
}> | ErrorResponse;
|
|
335
|
+
type MissRateResponse = SuccessResponse<{
|
|
336
|
+
missRate: (MissRateType & {
|
|
337
|
+
date: string;
|
|
338
|
+
})[];
|
|
339
|
+
}> | ErrorResponse;
|
|
340
|
+
type OperatorDelayOperationsResponse = SuccessResponse<{
|
|
341
|
+
operatorDelayOperations: {
|
|
342
|
+
pageInfo: {
|
|
343
|
+
endCursor: string;
|
|
344
|
+
hasNextPage: boolean;
|
|
345
|
+
};
|
|
346
|
+
edges: {
|
|
347
|
+
cursor: string;
|
|
348
|
+
node: OperatorDelayType;
|
|
349
|
+
}[];
|
|
350
|
+
totalCount: number;
|
|
351
|
+
};
|
|
352
|
+
}> | ErrorResponse;
|
|
323
353
|
type OperatorsResponse = SuccessResponse<{
|
|
324
354
|
operators: {
|
|
325
355
|
pageInfo: {
|
|
@@ -358,6 +388,31 @@ type RoundsCountGraphqlResponse = {
|
|
|
358
388
|
};
|
|
359
389
|
};
|
|
360
390
|
};
|
|
391
|
+
type VoteCountGraphqlResponse = {
|
|
392
|
+
data: {
|
|
393
|
+
signupsCount: {
|
|
394
|
+
totalCount: number;
|
|
395
|
+
};
|
|
396
|
+
messagesCount: {
|
|
397
|
+
totalCount: number;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
type OperatorDelayOperationsGraphqlResponse = {
|
|
402
|
+
data: {
|
|
403
|
+
operatorDelayOperations: {
|
|
404
|
+
pageInfo: {
|
|
405
|
+
endCursor: string;
|
|
406
|
+
hasNextPage: boolean;
|
|
407
|
+
};
|
|
408
|
+
edges: {
|
|
409
|
+
cursor: string;
|
|
410
|
+
node: OperatorDelayType;
|
|
411
|
+
}[];
|
|
412
|
+
totalCount: number;
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
};
|
|
361
416
|
type TransactionGraphqlResponse = {
|
|
362
417
|
data: {
|
|
363
418
|
transaction: TransactionType;
|
|
@@ -448,6 +503,21 @@ type SignUpEventsGraphqlResponse = {
|
|
|
448
503
|
};
|
|
449
504
|
};
|
|
450
505
|
};
|
|
506
|
+
type MissRateType = {
|
|
507
|
+
delayCount: number;
|
|
508
|
+
deactivateDelay: {
|
|
509
|
+
count: number;
|
|
510
|
+
dmsgCount: number;
|
|
511
|
+
};
|
|
512
|
+
tallyDelay: {
|
|
513
|
+
count: number;
|
|
514
|
+
};
|
|
515
|
+
totalDelayDuration: number;
|
|
516
|
+
avgDelayDuration: number;
|
|
517
|
+
tallyCount: number;
|
|
518
|
+
deactivateCount: number;
|
|
519
|
+
missRate: number;
|
|
520
|
+
};
|
|
451
521
|
|
|
452
522
|
declare class UserAccount {
|
|
453
523
|
http: Http;
|
|
@@ -467,7 +537,9 @@ declare class Operator {
|
|
|
467
537
|
amaciRegistryContract: string;
|
|
468
538
|
constructor(http: Http, amaciRegistryContract: string);
|
|
469
539
|
getOperatorByAddress(address: string): Promise<OperatorResponse>;
|
|
540
|
+
getOperatorDelayOperationsByAddress(address: string, after: string, limit?: number): Promise<OperatorDelayOperationsResponse>;
|
|
470
541
|
getOperators(after: string, limit?: number): Promise<OperatorsResponse>;
|
|
542
|
+
queryMissRate(address: string, durationDay: number): Promise<MissRateResponse>;
|
|
471
543
|
}
|
|
472
544
|
|
|
473
545
|
declare class Round {
|
|
@@ -584,6 +656,8 @@ declare class Indexer {
|
|
|
584
656
|
* @returns {Promise<OperatorResponse>} The operator response.
|
|
585
657
|
*/
|
|
586
658
|
getOperatorByAddress(address: string): Promise<OperatorResponse>;
|
|
659
|
+
getOperatorDelayOperationsByAddress(address: string, after: string, limit?: number): Promise<OperatorDelayOperationsResponse>;
|
|
660
|
+
queryMissRate(address: string, durationDay: number): Promise<MissRateResponse>;
|
|
587
661
|
/**
|
|
588
662
|
* @method getOperators
|
|
589
663
|
* @description Get multiple operators.
|
|
@@ -1667,6 +1741,12 @@ declare class MACI {
|
|
|
1667
1741
|
queryRoundIsQv({ contractAddress }: {
|
|
1668
1742
|
contractAddress: string;
|
|
1669
1743
|
}): Promise<boolean>;
|
|
1744
|
+
queryRoundClaimable({ contractAddress, }: {
|
|
1745
|
+
contractAddress: string;
|
|
1746
|
+
}): Promise<{
|
|
1747
|
+
claimable: boolean | null;
|
|
1748
|
+
balance: string | null;
|
|
1749
|
+
}>;
|
|
1670
1750
|
queryRoundGasStation({ contractAddress }: {
|
|
1671
1751
|
contractAddress: string;
|
|
1672
1752
|
}): Promise<boolean>;
|
|
@@ -2024,4 +2104,4 @@ declare function decompressPublicKey(compressedPubkey: string): {
|
|
|
2024
2104
|
};
|
|
2025
2105
|
declare function compressPublicKey(decompressedPubkey: any[]): string;
|
|
2026
2106
|
|
|
2027
|
-
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 };
|
|
2107
|
+
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/index.d.ts
CHANGED
|
@@ -130,16 +130,16 @@ type CreateRoundParams = {
|
|
|
130
130
|
circuitType: MaciCircuitType;
|
|
131
131
|
};
|
|
132
132
|
type CreateAMaciRoundParams = {
|
|
133
|
-
maxVoter:
|
|
134
|
-
maxOption:
|
|
133
|
+
maxVoter: number;
|
|
134
|
+
maxOption: number;
|
|
135
135
|
operator: string;
|
|
136
136
|
whitelist: Whitelist$2;
|
|
137
137
|
voiceCreditAmount: string;
|
|
138
138
|
preDeactivateRoot?: string;
|
|
139
139
|
} & CreateRoundParams;
|
|
140
140
|
type CreateMaciRoundParams = {
|
|
141
|
-
maxVoter:
|
|
142
|
-
maxOption:
|
|
141
|
+
maxVoter: number;
|
|
142
|
+
maxOption: number;
|
|
143
143
|
operatorPubkey: string;
|
|
144
144
|
whitelist: Whitelist$1;
|
|
145
145
|
certSystemType: MaciCertSystemType;
|
|
@@ -260,6 +260,18 @@ type ProofType = {
|
|
|
260
260
|
proof: string;
|
|
261
261
|
}[];
|
|
262
262
|
};
|
|
263
|
+
type OperatorDelayType = {
|
|
264
|
+
blockHeight: string;
|
|
265
|
+
delayProcessDmsgCount: number;
|
|
266
|
+
delayDuration: string;
|
|
267
|
+
delayReason: string;
|
|
268
|
+
delayType: string;
|
|
269
|
+
id: string;
|
|
270
|
+
nodeId: string;
|
|
271
|
+
operatorAddress: string;
|
|
272
|
+
timestamp: string;
|
|
273
|
+
roundAddress: string;
|
|
274
|
+
};
|
|
263
275
|
type OperatorType = {
|
|
264
276
|
id: string;
|
|
265
277
|
validatorAddress: string;
|
|
@@ -320,6 +332,24 @@ type BalanceResponse = SuccessResponse<{
|
|
|
320
332
|
type OperatorResponse = SuccessResponse<{
|
|
321
333
|
operator: OperatorType;
|
|
322
334
|
}> | ErrorResponse;
|
|
335
|
+
type MissRateResponse = SuccessResponse<{
|
|
336
|
+
missRate: (MissRateType & {
|
|
337
|
+
date: string;
|
|
338
|
+
})[];
|
|
339
|
+
}> | ErrorResponse;
|
|
340
|
+
type OperatorDelayOperationsResponse = SuccessResponse<{
|
|
341
|
+
operatorDelayOperations: {
|
|
342
|
+
pageInfo: {
|
|
343
|
+
endCursor: string;
|
|
344
|
+
hasNextPage: boolean;
|
|
345
|
+
};
|
|
346
|
+
edges: {
|
|
347
|
+
cursor: string;
|
|
348
|
+
node: OperatorDelayType;
|
|
349
|
+
}[];
|
|
350
|
+
totalCount: number;
|
|
351
|
+
};
|
|
352
|
+
}> | ErrorResponse;
|
|
323
353
|
type OperatorsResponse = SuccessResponse<{
|
|
324
354
|
operators: {
|
|
325
355
|
pageInfo: {
|
|
@@ -358,6 +388,31 @@ type RoundsCountGraphqlResponse = {
|
|
|
358
388
|
};
|
|
359
389
|
};
|
|
360
390
|
};
|
|
391
|
+
type VoteCountGraphqlResponse = {
|
|
392
|
+
data: {
|
|
393
|
+
signupsCount: {
|
|
394
|
+
totalCount: number;
|
|
395
|
+
};
|
|
396
|
+
messagesCount: {
|
|
397
|
+
totalCount: number;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
type OperatorDelayOperationsGraphqlResponse = {
|
|
402
|
+
data: {
|
|
403
|
+
operatorDelayOperations: {
|
|
404
|
+
pageInfo: {
|
|
405
|
+
endCursor: string;
|
|
406
|
+
hasNextPage: boolean;
|
|
407
|
+
};
|
|
408
|
+
edges: {
|
|
409
|
+
cursor: string;
|
|
410
|
+
node: OperatorDelayType;
|
|
411
|
+
}[];
|
|
412
|
+
totalCount: number;
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
};
|
|
361
416
|
type TransactionGraphqlResponse = {
|
|
362
417
|
data: {
|
|
363
418
|
transaction: TransactionType;
|
|
@@ -448,6 +503,21 @@ type SignUpEventsGraphqlResponse = {
|
|
|
448
503
|
};
|
|
449
504
|
};
|
|
450
505
|
};
|
|
506
|
+
type MissRateType = {
|
|
507
|
+
delayCount: number;
|
|
508
|
+
deactivateDelay: {
|
|
509
|
+
count: number;
|
|
510
|
+
dmsgCount: number;
|
|
511
|
+
};
|
|
512
|
+
tallyDelay: {
|
|
513
|
+
count: number;
|
|
514
|
+
};
|
|
515
|
+
totalDelayDuration: number;
|
|
516
|
+
avgDelayDuration: number;
|
|
517
|
+
tallyCount: number;
|
|
518
|
+
deactivateCount: number;
|
|
519
|
+
missRate: number;
|
|
520
|
+
};
|
|
451
521
|
|
|
452
522
|
declare class UserAccount {
|
|
453
523
|
http: Http;
|
|
@@ -467,7 +537,9 @@ declare class Operator {
|
|
|
467
537
|
amaciRegistryContract: string;
|
|
468
538
|
constructor(http: Http, amaciRegistryContract: string);
|
|
469
539
|
getOperatorByAddress(address: string): Promise<OperatorResponse>;
|
|
540
|
+
getOperatorDelayOperationsByAddress(address: string, after: string, limit?: number): Promise<OperatorDelayOperationsResponse>;
|
|
470
541
|
getOperators(after: string, limit?: number): Promise<OperatorsResponse>;
|
|
542
|
+
queryMissRate(address: string, durationDay: number): Promise<MissRateResponse>;
|
|
471
543
|
}
|
|
472
544
|
|
|
473
545
|
declare class Round {
|
|
@@ -584,6 +656,8 @@ declare class Indexer {
|
|
|
584
656
|
* @returns {Promise<OperatorResponse>} The operator response.
|
|
585
657
|
*/
|
|
586
658
|
getOperatorByAddress(address: string): Promise<OperatorResponse>;
|
|
659
|
+
getOperatorDelayOperationsByAddress(address: string, after: string, limit?: number): Promise<OperatorDelayOperationsResponse>;
|
|
660
|
+
queryMissRate(address: string, durationDay: number): Promise<MissRateResponse>;
|
|
587
661
|
/**
|
|
588
662
|
* @method getOperators
|
|
589
663
|
* @description Get multiple operators.
|
|
@@ -1667,6 +1741,12 @@ declare class MACI {
|
|
|
1667
1741
|
queryRoundIsQv({ contractAddress }: {
|
|
1668
1742
|
contractAddress: string;
|
|
1669
1743
|
}): Promise<boolean>;
|
|
1744
|
+
queryRoundClaimable({ contractAddress, }: {
|
|
1745
|
+
contractAddress: string;
|
|
1746
|
+
}): Promise<{
|
|
1747
|
+
claimable: boolean | null;
|
|
1748
|
+
balance: string | null;
|
|
1749
|
+
}>;
|
|
1670
1750
|
queryRoundGasStation({ contractAddress }: {
|
|
1671
1751
|
contractAddress: string;
|
|
1672
1752
|
}): Promise<boolean>;
|
|
@@ -2024,4 +2104,4 @@ declare function decompressPublicKey(compressedPubkey: string): {
|
|
|
2024
2104
|
};
|
|
2025
2105
|
declare function compressPublicKey(decompressedPubkey: any[]): string;
|
|
2026
2106
|
|
|
2027
|
-
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 };
|
|
2107
|
+
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 };
|