@dorafactory/maci-sdk 0.0.26 → 0.0.28
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 +42 -1
- package/dist/browser.d.ts +42 -1
- package/dist/browser.js +477 -337
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +477 -337
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +149 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +149 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/libs/const.ts +5 -2
- package/src/libs/contract/contract.ts +1 -1
- package/src/libs/errors/types.ts +3 -1
- package/src/libs/indexer/indexer.ts +15 -0
- package/src/libs/maci/maci.ts +29 -5
- package/src/libs/query/round.ts +112 -0
- package/src/maci.ts +15 -0
- package/src/types/index.ts +18 -0
package/dist/browser.d.mts
CHANGED
|
@@ -242,6 +242,7 @@ type RoundType = {
|
|
|
242
242
|
voiceCreditAmount: string;
|
|
243
243
|
preDeactivateRoot: string;
|
|
244
244
|
identity: string;
|
|
245
|
+
funds: string;
|
|
245
246
|
operatorLogoUrl?: string;
|
|
246
247
|
operatorMoniker?: string;
|
|
247
248
|
resultsList?: {
|
|
@@ -249,6 +250,7 @@ type RoundType = {
|
|
|
249
250
|
v2: number;
|
|
250
251
|
}[];
|
|
251
252
|
};
|
|
253
|
+
type SelectiveRoundType = Partial<RoundType>;
|
|
252
254
|
type ProofType = {
|
|
253
255
|
nodes: {
|
|
254
256
|
id: string;
|
|
@@ -453,6 +455,9 @@ type TransactionsResponse = SuccessResponse<{
|
|
|
453
455
|
type RoundResponse = SuccessResponse<{
|
|
454
456
|
round: RoundType;
|
|
455
457
|
}> | ErrorResponse;
|
|
458
|
+
type SelectiveRoundResponse = SuccessResponse<{
|
|
459
|
+
round: SelectiveRoundType;
|
|
460
|
+
}> | ErrorResponse;
|
|
456
461
|
type RoundsResponse = SuccessResponse<{
|
|
457
462
|
rounds: {
|
|
458
463
|
pageInfo: {
|
|
@@ -471,6 +476,14 @@ type RoundGraphqlResponse = {
|
|
|
471
476
|
round: RoundType;
|
|
472
477
|
};
|
|
473
478
|
};
|
|
479
|
+
/**
|
|
480
|
+
* GraphQL response type for selective round fields
|
|
481
|
+
*/
|
|
482
|
+
type SelectiveRoundGraphqlResponse = {
|
|
483
|
+
data: {
|
|
484
|
+
round: SelectiveRoundType;
|
|
485
|
+
};
|
|
486
|
+
};
|
|
474
487
|
type RoundsGraphqlResponse = {
|
|
475
488
|
data: {
|
|
476
489
|
rounds: {
|
|
@@ -547,6 +560,13 @@ declare class Round {
|
|
|
547
560
|
http: Http;
|
|
548
561
|
constructor(http: Http);
|
|
549
562
|
getRoundById(address: string): Promise<RoundResponse>;
|
|
563
|
+
/**
|
|
564
|
+
* Get round information with selective fields
|
|
565
|
+
* @param address Round address
|
|
566
|
+
* @param fields Array of fields to return, returns all fields if empty
|
|
567
|
+
* @returns Round information response
|
|
568
|
+
*/
|
|
569
|
+
getRoundWithFields(address: string, fields?: string[]): Promise<SelectiveRoundResponse>;
|
|
550
570
|
getRounds(after: string, limit?: number): Promise<RoundsResponse>;
|
|
551
571
|
getRoundsByCircuitName(circuitName: string, after: string, limit?: number): Promise<RoundsResponse>;
|
|
552
572
|
getRoundsByStatus(status: string, after: string, limit?: number): Promise<RoundsResponse>;
|
|
@@ -615,6 +635,14 @@ declare class Indexer {
|
|
|
615
635
|
* @returns {Promise<RoundResponse>} The round response.
|
|
616
636
|
*/
|
|
617
637
|
getRoundById(id: string): Promise<RoundResponse>;
|
|
638
|
+
/**
|
|
639
|
+
* @method getRoundWithFields
|
|
640
|
+
* @description Get a round by its address with selective fields.
|
|
641
|
+
* @param {string} address - The address of the round.
|
|
642
|
+
* @param {string[]} [fields] - The fields to retrieve.
|
|
643
|
+
* @returns {Promise<SelectiveRoundResponse>} The round response.
|
|
644
|
+
*/
|
|
645
|
+
getRoundWithFields(address: string, fields?: string[]): Promise<SelectiveRoundResponse>;
|
|
618
646
|
/**
|
|
619
647
|
* @method getRounds
|
|
620
648
|
* @description Get multiple rounds.
|
|
@@ -1759,6 +1787,10 @@ declare class MACI {
|
|
|
1759
1787
|
address: string;
|
|
1760
1788
|
contractAddress: string;
|
|
1761
1789
|
}): Promise<FeegrantAllowanceResponse>;
|
|
1790
|
+
hasFeegrant({ address, contractAddress, }: {
|
|
1791
|
+
address: string;
|
|
1792
|
+
contractAddress: string;
|
|
1793
|
+
}): Promise<boolean>;
|
|
1762
1794
|
queryWhitelistBalanceOf({ signer, address, contractAddress, certificate, mode, }: {
|
|
1763
1795
|
signer: OfflineSigner;
|
|
1764
1796
|
address: string;
|
|
@@ -1984,6 +2016,7 @@ interface NetworkConfig {
|
|
|
1984
2016
|
oracleCodeId: number;
|
|
1985
2017
|
oracleWhitelistBackendPubkey: string;
|
|
1986
2018
|
oracleFeegrantOperator: string;
|
|
2019
|
+
oracleCodeIds: string[];
|
|
1987
2020
|
}
|
|
1988
2021
|
declare function getDefaultParams(network?: 'mainnet' | 'testnet'): NetworkConfig;
|
|
1989
2022
|
|
|
@@ -2053,6 +2086,14 @@ declare class MaciClient {
|
|
|
2053
2086
|
* @returns {Promise<RoundResponse>} The round response.
|
|
2054
2087
|
*/
|
|
2055
2088
|
getRoundById(id: string): Promise<RoundResponse>;
|
|
2089
|
+
/**
|
|
2090
|
+
* @method getRoundWithFields
|
|
2091
|
+
* @description Get a round by its address with selective fields.
|
|
2092
|
+
* @param {string} address - The address of the round.
|
|
2093
|
+
* @param {string[]} [fields] - The fields to retrieve.
|
|
2094
|
+
* @returns {Promise<SelectiveRoundResponse>} The round response.
|
|
2095
|
+
*/
|
|
2096
|
+
getRoundWithFields(address: string, fields?: string[]): Promise<SelectiveRoundResponse>;
|
|
2056
2097
|
/**
|
|
2057
2098
|
* @method getRounds
|
|
2058
2099
|
* @description Get multiple rounds.
|
|
@@ -2167,4 +2208,4 @@ declare function decompressPublicKey(compressedPubkey: string): {
|
|
|
2167
2208
|
};
|
|
2168
2209
|
declare function compressPublicKey(decompressedPubkey: any[]): string;
|
|
2169
2210
|
|
|
2170
|
-
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 };
|
|
2211
|
+
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 SelectiveRoundGraphqlResponse, type SelectiveRoundResponse, type SelectiveRoundType, 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
|
@@ -242,6 +242,7 @@ type RoundType = {
|
|
|
242
242
|
voiceCreditAmount: string;
|
|
243
243
|
preDeactivateRoot: string;
|
|
244
244
|
identity: string;
|
|
245
|
+
funds: string;
|
|
245
246
|
operatorLogoUrl?: string;
|
|
246
247
|
operatorMoniker?: string;
|
|
247
248
|
resultsList?: {
|
|
@@ -249,6 +250,7 @@ type RoundType = {
|
|
|
249
250
|
v2: number;
|
|
250
251
|
}[];
|
|
251
252
|
};
|
|
253
|
+
type SelectiveRoundType = Partial<RoundType>;
|
|
252
254
|
type ProofType = {
|
|
253
255
|
nodes: {
|
|
254
256
|
id: string;
|
|
@@ -453,6 +455,9 @@ type TransactionsResponse = SuccessResponse<{
|
|
|
453
455
|
type RoundResponse = SuccessResponse<{
|
|
454
456
|
round: RoundType;
|
|
455
457
|
}> | ErrorResponse;
|
|
458
|
+
type SelectiveRoundResponse = SuccessResponse<{
|
|
459
|
+
round: SelectiveRoundType;
|
|
460
|
+
}> | ErrorResponse;
|
|
456
461
|
type RoundsResponse = SuccessResponse<{
|
|
457
462
|
rounds: {
|
|
458
463
|
pageInfo: {
|
|
@@ -471,6 +476,14 @@ type RoundGraphqlResponse = {
|
|
|
471
476
|
round: RoundType;
|
|
472
477
|
};
|
|
473
478
|
};
|
|
479
|
+
/**
|
|
480
|
+
* GraphQL response type for selective round fields
|
|
481
|
+
*/
|
|
482
|
+
type SelectiveRoundGraphqlResponse = {
|
|
483
|
+
data: {
|
|
484
|
+
round: SelectiveRoundType;
|
|
485
|
+
};
|
|
486
|
+
};
|
|
474
487
|
type RoundsGraphqlResponse = {
|
|
475
488
|
data: {
|
|
476
489
|
rounds: {
|
|
@@ -547,6 +560,13 @@ declare class Round {
|
|
|
547
560
|
http: Http;
|
|
548
561
|
constructor(http: Http);
|
|
549
562
|
getRoundById(address: string): Promise<RoundResponse>;
|
|
563
|
+
/**
|
|
564
|
+
* Get round information with selective fields
|
|
565
|
+
* @param address Round address
|
|
566
|
+
* @param fields Array of fields to return, returns all fields if empty
|
|
567
|
+
* @returns Round information response
|
|
568
|
+
*/
|
|
569
|
+
getRoundWithFields(address: string, fields?: string[]): Promise<SelectiveRoundResponse>;
|
|
550
570
|
getRounds(after: string, limit?: number): Promise<RoundsResponse>;
|
|
551
571
|
getRoundsByCircuitName(circuitName: string, after: string, limit?: number): Promise<RoundsResponse>;
|
|
552
572
|
getRoundsByStatus(status: string, after: string, limit?: number): Promise<RoundsResponse>;
|
|
@@ -615,6 +635,14 @@ declare class Indexer {
|
|
|
615
635
|
* @returns {Promise<RoundResponse>} The round response.
|
|
616
636
|
*/
|
|
617
637
|
getRoundById(id: string): Promise<RoundResponse>;
|
|
638
|
+
/**
|
|
639
|
+
* @method getRoundWithFields
|
|
640
|
+
* @description Get a round by its address with selective fields.
|
|
641
|
+
* @param {string} address - The address of the round.
|
|
642
|
+
* @param {string[]} [fields] - The fields to retrieve.
|
|
643
|
+
* @returns {Promise<SelectiveRoundResponse>} The round response.
|
|
644
|
+
*/
|
|
645
|
+
getRoundWithFields(address: string, fields?: string[]): Promise<SelectiveRoundResponse>;
|
|
618
646
|
/**
|
|
619
647
|
* @method getRounds
|
|
620
648
|
* @description Get multiple rounds.
|
|
@@ -1759,6 +1787,10 @@ declare class MACI {
|
|
|
1759
1787
|
address: string;
|
|
1760
1788
|
contractAddress: string;
|
|
1761
1789
|
}): Promise<FeegrantAllowanceResponse>;
|
|
1790
|
+
hasFeegrant({ address, contractAddress, }: {
|
|
1791
|
+
address: string;
|
|
1792
|
+
contractAddress: string;
|
|
1793
|
+
}): Promise<boolean>;
|
|
1762
1794
|
queryWhitelistBalanceOf({ signer, address, contractAddress, certificate, mode, }: {
|
|
1763
1795
|
signer: OfflineSigner;
|
|
1764
1796
|
address: string;
|
|
@@ -1984,6 +2016,7 @@ interface NetworkConfig {
|
|
|
1984
2016
|
oracleCodeId: number;
|
|
1985
2017
|
oracleWhitelistBackendPubkey: string;
|
|
1986
2018
|
oracleFeegrantOperator: string;
|
|
2019
|
+
oracleCodeIds: string[];
|
|
1987
2020
|
}
|
|
1988
2021
|
declare function getDefaultParams(network?: 'mainnet' | 'testnet'): NetworkConfig;
|
|
1989
2022
|
|
|
@@ -2053,6 +2086,14 @@ declare class MaciClient {
|
|
|
2053
2086
|
* @returns {Promise<RoundResponse>} The round response.
|
|
2054
2087
|
*/
|
|
2055
2088
|
getRoundById(id: string): Promise<RoundResponse>;
|
|
2089
|
+
/**
|
|
2090
|
+
* @method getRoundWithFields
|
|
2091
|
+
* @description Get a round by its address with selective fields.
|
|
2092
|
+
* @param {string} address - The address of the round.
|
|
2093
|
+
* @param {string[]} [fields] - The fields to retrieve.
|
|
2094
|
+
* @returns {Promise<SelectiveRoundResponse>} The round response.
|
|
2095
|
+
*/
|
|
2096
|
+
getRoundWithFields(address: string, fields?: string[]): Promise<SelectiveRoundResponse>;
|
|
2056
2097
|
/**
|
|
2057
2098
|
* @method getRounds
|
|
2058
2099
|
* @description Get multiple rounds.
|
|
@@ -2167,4 +2208,4 @@ declare function decompressPublicKey(compressedPubkey: string): {
|
|
|
2167
2208
|
};
|
|
2168
2209
|
declare function compressPublicKey(decompressedPubkey: any[]): string;
|
|
2169
2210
|
|
|
2170
|
-
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 };
|
|
2211
|
+
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 SelectiveRoundGraphqlResponse, type SelectiveRoundResponse, type SelectiveRoundType, 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 };
|