@dorafactory/maci-sdk 0.0.19 → 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/index.d.mts CHANGED
@@ -19,7 +19,7 @@ declare class Http {
19
19
  private getFetch;
20
20
  fetch(url: string, options?: any): Promise<Response>;
21
21
  fetchGraphql<T>(query: string, after: string, limit?: number | null): Promise<T>;
22
- fetchRest(path: string): Promise<any>;
22
+ fetchRest(path: string, options?: any): Promise<any>;
23
23
  }
24
24
 
25
25
  /**
@@ -130,16 +130,16 @@ type CreateRoundParams = {
130
130
  circuitType: MaciCircuitType;
131
131
  };
132
132
  type CreateAMaciRoundParams = {
133
- maxVoter: string;
134
- maxOption: string;
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: string;
142
- maxOption: string;
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.
@@ -1541,12 +1615,21 @@ type SignatureResponse = {
1541
1615
  amount: string;
1542
1616
  snapshotHeight: string;
1543
1617
  };
1618
+ type FeegrantAllowanceResponse = {
1619
+ granter: string;
1620
+ grantee: string;
1621
+ spend_limit: {
1622
+ denom: string;
1623
+ amount: string;
1624
+ }[];
1625
+ };
1544
1626
 
1545
1627
  declare class OracleCertificate {
1546
1628
  private certificateApiEndpoint;
1547
1629
  private http;
1548
1630
  constructor({ certificateApiEndpoint, http }: OracleCertificateParams);
1549
1631
  sign(data: SignatureRequest): Promise<SignatureResponse>;
1632
+ feegrantAllowance(granter: string, grantee: string): Promise<FeegrantAllowanceResponse>;
1550
1633
  }
1551
1634
 
1552
1635
  type MixedData<T> = T | Array<MixedData<T>> | {
@@ -1629,6 +1712,10 @@ declare class MACI {
1629
1712
  contractAddress: string;
1630
1713
  pubKey: bigint[];
1631
1714
  }): Promise<number>;
1715
+ feegrantAllowance({ address, contractAddress, }: {
1716
+ address: string;
1717
+ contractAddress: string;
1718
+ }): Promise<FeegrantAllowanceResponse>;
1632
1719
  queryWhitelistBalanceOf({ signer, address, contractAddress, certificate, mode, }: {
1633
1720
  signer: OfflineSigner;
1634
1721
  address: string;
@@ -1654,6 +1741,12 @@ declare class MACI {
1654
1741
  queryRoundIsQv({ contractAddress }: {
1655
1742
  contractAddress: string;
1656
1743
  }): Promise<boolean>;
1744
+ queryRoundClaimable({ contractAddress, }: {
1745
+ contractAddress: string;
1746
+ }): Promise<{
1747
+ claimable: boolean | null;
1748
+ balance: string | null;
1749
+ }>;
1657
1750
  queryRoundGasStation({ contractAddress }: {
1658
1751
  contractAddress: string;
1659
1752
  }): Promise<boolean>;
@@ -2011,4 +2104,4 @@ declare function decompressPublicKey(compressedPubkey: string): {
2011
2104
  };
2012
2105
  declare function compressPublicKey(decompressedPubkey: any[]): string;
2013
2106
 
2014
- 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
@@ -19,7 +19,7 @@ declare class Http {
19
19
  private getFetch;
20
20
  fetch(url: string, options?: any): Promise<Response>;
21
21
  fetchGraphql<T>(query: string, after: string, limit?: number | null): Promise<T>;
22
- fetchRest(path: string): Promise<any>;
22
+ fetchRest(path: string, options?: any): Promise<any>;
23
23
  }
24
24
 
25
25
  /**
@@ -130,16 +130,16 @@ type CreateRoundParams = {
130
130
  circuitType: MaciCircuitType;
131
131
  };
132
132
  type CreateAMaciRoundParams = {
133
- maxVoter: string;
134
- maxOption: string;
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: string;
142
- maxOption: string;
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.
@@ -1541,12 +1615,21 @@ type SignatureResponse = {
1541
1615
  amount: string;
1542
1616
  snapshotHeight: string;
1543
1617
  };
1618
+ type FeegrantAllowanceResponse = {
1619
+ granter: string;
1620
+ grantee: string;
1621
+ spend_limit: {
1622
+ denom: string;
1623
+ amount: string;
1624
+ }[];
1625
+ };
1544
1626
 
1545
1627
  declare class OracleCertificate {
1546
1628
  private certificateApiEndpoint;
1547
1629
  private http;
1548
1630
  constructor({ certificateApiEndpoint, http }: OracleCertificateParams);
1549
1631
  sign(data: SignatureRequest): Promise<SignatureResponse>;
1632
+ feegrantAllowance(granter: string, grantee: string): Promise<FeegrantAllowanceResponse>;
1550
1633
  }
1551
1634
 
1552
1635
  type MixedData<T> = T | Array<MixedData<T>> | {
@@ -1629,6 +1712,10 @@ declare class MACI {
1629
1712
  contractAddress: string;
1630
1713
  pubKey: bigint[];
1631
1714
  }): Promise<number>;
1715
+ feegrantAllowance({ address, contractAddress, }: {
1716
+ address: string;
1717
+ contractAddress: string;
1718
+ }): Promise<FeegrantAllowanceResponse>;
1632
1719
  queryWhitelistBalanceOf({ signer, address, contractAddress, certificate, mode, }: {
1633
1720
  signer: OfflineSigner;
1634
1721
  address: string;
@@ -1654,6 +1741,12 @@ declare class MACI {
1654
1741
  queryRoundIsQv({ contractAddress }: {
1655
1742
  contractAddress: string;
1656
1743
  }): Promise<boolean>;
1744
+ queryRoundClaimable({ contractAddress, }: {
1745
+ contractAddress: string;
1746
+ }): Promise<{
1747
+ claimable: boolean | null;
1748
+ balance: string | null;
1749
+ }>;
1657
1750
  queryRoundGasStation({ contractAddress }: {
1658
1751
  contractAddress: string;
1659
1752
  }): Promise<boolean>;
@@ -2011,4 +2104,4 @@ declare function decompressPublicKey(compressedPubkey: string): {
2011
2104
  };
2012
2105
  declare function compressPublicKey(decompressedPubkey: any[]): string;
2013
2106
 
2014
- 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 };