@dorafactory/maci-sdk 0.0.35 → 0.0.37
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.ts +14 -2234
- package/dist/index.js +770 -348
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +741 -350
- package/dist/index.mjs.map +1 -1
- package/dist/libs/const.d.ts +118 -0
- package/dist/libs/contract/config.d.ts +29 -0
- package/dist/libs/contract/contract.d.ts +57 -0
- package/dist/libs/contract/index.d.ts +2 -0
- package/dist/libs/contract/ts/AMaci.client.d.ts +216 -0
- package/dist/libs/contract/ts/AMaci.types.d.ts +221 -0
- package/dist/libs/contract/ts/Maci.client.d.ts +180 -0
- package/dist/libs/contract/ts/Maci.types.d.ts +226 -0
- package/dist/libs/contract/ts/OracleMaci.client.d.ts +206 -0
- package/dist/libs/contract/ts/OracleMaci.types.d.ts +263 -0
- package/dist/libs/contract/ts/Registry.client.d.ts +128 -0
- package/dist/libs/contract/ts/Registry.types.d.ts +110 -0
- package/dist/libs/contract/types.d.ts +39 -0
- package/dist/libs/contract/utils.d.ts +58 -0
- package/dist/libs/contract/vars.d.ts +63 -0
- package/dist/libs/crypto/babyjub.d.ts +73 -0
- package/dist/libs/crypto/bigintUtils.d.ts +6 -0
- package/dist/libs/crypto/constants.d.ts +3 -0
- package/dist/libs/crypto/hashing.d.ts +69 -0
- package/dist/libs/crypto/index.d.ts +9 -0
- package/dist/libs/crypto/keys.d.ts +74 -0
- package/dist/libs/crypto/sign.d.ts +9 -0
- package/dist/libs/crypto/tree.d.ts +23 -0
- package/dist/libs/crypto/types.d.ts +55 -0
- package/dist/libs/errors/index.d.ts +28 -0
- package/dist/libs/errors/types.d.ts +19 -0
- package/dist/libs/http/http.d.ts +16 -0
- package/dist/libs/http/index.d.ts +1 -0
- package/dist/libs/index.d.ts +7 -0
- package/dist/libs/indexer/index.d.ts +1 -0
- package/dist/libs/indexer/indexer.d.ts +152 -0
- package/dist/libs/indexer/types.d.ts +7 -0
- package/dist/libs/maci/index.d.ts +1 -0
- package/dist/libs/maci/maci.d.ts +182 -0
- package/dist/libs/maci/types.d.ts +6 -0
- package/dist/libs/oracle-certificate/index.d.ts +1 -0
- package/dist/libs/oracle-certificate/oracle-certificate.d.ts +9 -0
- package/dist/libs/oracle-certificate/types.d.ts +40 -0
- package/dist/libs/query/account.d.ts +7 -0
- package/dist/libs/query/circuit.d.ts +8 -0
- package/dist/libs/query/event.d.ts +7 -0
- package/dist/libs/query/index.d.ts +7 -0
- package/dist/libs/query/operator.d.ts +11 -0
- package/dist/libs/query/proof.d.ts +7 -0
- package/dist/libs/query/round.d.ts +18 -0
- package/dist/libs/query/transaction.d.ts +9 -0
- package/dist/maci.d.ts +190 -0
- package/dist/types/index.d.ts +383 -0
- package/dist/utils/index.d.ts +7 -0
- package/package.json +18 -24
- package/src/index.ts +1 -3
- package/src/libs/contract/contract.ts +14 -13
- package/src/libs/contract/index.ts +1 -0
- package/src/libs/contract/types.ts +3 -3
- package/src/libs/contract/utils.ts +0 -24
- package/src/libs/crypto/babyjub.ts +132 -0
- package/src/libs/crypto/bigintUtils.ts +31 -0
- package/src/libs/crypto/constants.ts +22 -0
- package/src/libs/crypto/hashing.ts +167 -0
- package/src/libs/crypto/index.ts +9 -0
- package/src/libs/{circom/circomlib.ts → crypto/keys.ts} +104 -114
- package/src/libs/crypto/sign.ts +91 -0
- package/src/libs/crypto/tree.ts +176 -0
- package/src/libs/crypto/types.ts +101 -0
- package/src/libs/index.ts +1 -1
- package/src/libs/maci/maci.ts +28 -29
- package/src/maci.ts +132 -67
- package/src/types/index.ts +7 -0
- package/src/utils/index.ts +22 -22
- package/dist/browser.d.mts +0 -2233
- package/dist/browser.d.ts +0 -2233
- package/dist/browser.js +0 -31620
- package/dist/browser.js.map +0 -1
- package/dist/browser.mjs +0 -31631
- package/dist/browser.mjs.map +0 -1
- package/dist/index.d.mts +0 -2234
- package/src/browser.ts +0 -17
- package/src/libs/circom/index.ts +0 -98
- package/src/libs/circom/types.ts +0 -8
- package/src/polyfills/browser-polyfills.ts +0 -9
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { OfflineSigner } from '@cosmjs/proto-signing';
|
|
2
|
+
import { Keypair, PubKey } from '../crypto';
|
|
3
|
+
import { Contract } from '../contract';
|
|
4
|
+
import { Indexer } from '../indexer';
|
|
5
|
+
import { OracleCertificate } from '../oracle-certificate';
|
|
6
|
+
import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
|
|
7
|
+
import { CertificateEcosystem, ErrorResponse, RoundType } from '../../types';
|
|
8
|
+
import { SignatureResponse } from '../oracle-certificate/types';
|
|
9
|
+
import { OracleWhitelistConfig } from '../contract/ts/OracleMaci.types';
|
|
10
|
+
export declare function isErrorResponse(response: unknown): response is ErrorResponse;
|
|
11
|
+
export declare class MACI {
|
|
12
|
+
contract: Contract;
|
|
13
|
+
indexer: Indexer;
|
|
14
|
+
oracleCertificate: OracleCertificate;
|
|
15
|
+
maciKeypair: Keypair;
|
|
16
|
+
constructor({ contract, indexer, oracleCertificate, maciKeypair, }: {
|
|
17
|
+
contract: Contract;
|
|
18
|
+
indexer: Indexer;
|
|
19
|
+
oracleCertificate: OracleCertificate;
|
|
20
|
+
maciKeypair: Keypair;
|
|
21
|
+
});
|
|
22
|
+
getStateIdxInc({ signer, address, contractAddress, }: {
|
|
23
|
+
signer: OfflineSigner;
|
|
24
|
+
address?: string;
|
|
25
|
+
contractAddress: string;
|
|
26
|
+
}): Promise<string>;
|
|
27
|
+
getVoiceCreditBalance({ signer, stateIdx, contractAddress, }: {
|
|
28
|
+
signer: OfflineSigner;
|
|
29
|
+
stateIdx: number;
|
|
30
|
+
contractAddress: string;
|
|
31
|
+
}): Promise<string>;
|
|
32
|
+
getStateIdxByPubKey({ contractAddress, pubKey, }: {
|
|
33
|
+
contractAddress: string;
|
|
34
|
+
pubKey: bigint[];
|
|
35
|
+
}): Promise<number>;
|
|
36
|
+
feegrantAllowance({ address, contractAddress, }: {
|
|
37
|
+
address: string;
|
|
38
|
+
contractAddress: string;
|
|
39
|
+
}): Promise<import("../oracle-certificate/types").FeegrantAllowanceResponse>;
|
|
40
|
+
hasFeegrant({ address, contractAddress, }: {
|
|
41
|
+
address: string;
|
|
42
|
+
contractAddress: string;
|
|
43
|
+
}): Promise<boolean>;
|
|
44
|
+
queryWhitelistBalanceOf({ signer, address, contractAddress, certificate, mode, }: {
|
|
45
|
+
signer: OfflineSigner;
|
|
46
|
+
address?: string;
|
|
47
|
+
contractAddress: string;
|
|
48
|
+
certificate?: {
|
|
49
|
+
signature: string;
|
|
50
|
+
amount: string;
|
|
51
|
+
};
|
|
52
|
+
mode?: 'maci' | 'amaci';
|
|
53
|
+
}): Promise<string>;
|
|
54
|
+
isWhitelisted({ signer, address, contractAddress, }: {
|
|
55
|
+
signer: OfflineSigner;
|
|
56
|
+
address?: string;
|
|
57
|
+
contractAddress: string;
|
|
58
|
+
}): Promise<boolean>;
|
|
59
|
+
getOracleWhitelistConfig({ signer, contractAddress, }: {
|
|
60
|
+
signer: OfflineSigner;
|
|
61
|
+
contractAddress: string;
|
|
62
|
+
}): Promise<OracleWhitelistConfig>;
|
|
63
|
+
getRoundInfo({ contractAddress }: {
|
|
64
|
+
contractAddress: string;
|
|
65
|
+
}): Promise<RoundType>;
|
|
66
|
+
getRoundCircuitType({ contractAddress }: {
|
|
67
|
+
contractAddress: string;
|
|
68
|
+
}): Promise<string>;
|
|
69
|
+
queryRoundIsQv({ contractAddress }: {
|
|
70
|
+
contractAddress: string;
|
|
71
|
+
}): Promise<boolean>;
|
|
72
|
+
queryRoundClaimable({ contractAddress, }: {
|
|
73
|
+
contractAddress: string;
|
|
74
|
+
}): Promise<{
|
|
75
|
+
claimable: boolean | null;
|
|
76
|
+
balance: string | null;
|
|
77
|
+
}>;
|
|
78
|
+
queryAMaciChargeFee({ maxVoter, maxOption, }: {
|
|
79
|
+
maxVoter: number;
|
|
80
|
+
maxOption: number;
|
|
81
|
+
}): Promise<{
|
|
82
|
+
denom: string;
|
|
83
|
+
amount: string;
|
|
84
|
+
}>;
|
|
85
|
+
queryRoundGasStation({ contractAddress }: {
|
|
86
|
+
contractAddress: string;
|
|
87
|
+
}): Promise<boolean>;
|
|
88
|
+
parseRoundStatus(votingStart: number, votingEnd: number, status: string, currentTime: Date): string;
|
|
89
|
+
queryRoundBalance({ contractAddress }: {
|
|
90
|
+
contractAddress: string;
|
|
91
|
+
}): Promise<string>;
|
|
92
|
+
requestOracleCertificate({ signer, ecosystem, address, contractAddress, }: {
|
|
93
|
+
signer: OfflineSigner;
|
|
94
|
+
ecosystem: CertificateEcosystem;
|
|
95
|
+
address?: string;
|
|
96
|
+
contractAddress: string;
|
|
97
|
+
}): Promise<SignatureResponse>;
|
|
98
|
+
signup({ signer, address, contractAddress, maciKeypair, oracleCertificate, gasStation, }: {
|
|
99
|
+
signer: OfflineSigner;
|
|
100
|
+
address?: string;
|
|
101
|
+
contractAddress: string;
|
|
102
|
+
maciKeypair?: Keypair;
|
|
103
|
+
oracleCertificate?: {
|
|
104
|
+
amount: string;
|
|
105
|
+
signature: string;
|
|
106
|
+
};
|
|
107
|
+
gasStation?: boolean;
|
|
108
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
109
|
+
private processVoteOptions;
|
|
110
|
+
vote({ signer, address, stateIdx, contractAddress, selectedOptions, operatorCoordPubKey, maciKeypair, gasStation, }: {
|
|
111
|
+
signer: OfflineSigner;
|
|
112
|
+
address?: string;
|
|
113
|
+
stateIdx: number;
|
|
114
|
+
contractAddress: string;
|
|
115
|
+
selectedOptions: {
|
|
116
|
+
idx: number;
|
|
117
|
+
vc: number;
|
|
118
|
+
}[];
|
|
119
|
+
operatorCoordPubKey: PubKey;
|
|
120
|
+
maciKeypair?: Keypair;
|
|
121
|
+
gasStation?: boolean;
|
|
122
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").DeliverTxResponse>;
|
|
123
|
+
publishMessage({ client, address, payload, contractAddress, gasStation, }: {
|
|
124
|
+
client: SigningCosmWasmClient;
|
|
125
|
+
address: string;
|
|
126
|
+
payload: {
|
|
127
|
+
msg: bigint[];
|
|
128
|
+
encPubkeys: PubKey;
|
|
129
|
+
}[];
|
|
130
|
+
contractAddress: string;
|
|
131
|
+
gasStation: boolean;
|
|
132
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").DeliverTxResponse>;
|
|
133
|
+
signupSimple({ client, address, pubKey, contractAddress, gasStation, }: {
|
|
134
|
+
client: SigningCosmWasmClient;
|
|
135
|
+
address: string;
|
|
136
|
+
pubKey: PubKey;
|
|
137
|
+
contractAddress: string;
|
|
138
|
+
gasStation?: boolean;
|
|
139
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
140
|
+
signupOracle({ client, address, pubKey, contractAddress, oracleCertificate, gasStation, }: {
|
|
141
|
+
client: SigningCosmWasmClient;
|
|
142
|
+
address: string;
|
|
143
|
+
pubKey: PubKey;
|
|
144
|
+
contractAddress: string;
|
|
145
|
+
oracleCertificate: {
|
|
146
|
+
amount: string;
|
|
147
|
+
signature: string;
|
|
148
|
+
};
|
|
149
|
+
gasStation?: boolean;
|
|
150
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
151
|
+
claimAMaciRound({ signer, contractAddress, }: {
|
|
152
|
+
signer: OfflineSigner;
|
|
153
|
+
contractAddress: string;
|
|
154
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
155
|
+
getOracleCertificateConfig(): Promise<import("../oracle-certificate/types").EcosystemsResponse>;
|
|
156
|
+
/**
|
|
157
|
+
* Batch grant with bond (for maci)
|
|
158
|
+
* @param signer
|
|
159
|
+
* @param contractAddress
|
|
160
|
+
* @param address
|
|
161
|
+
* @param amount
|
|
162
|
+
* @returns
|
|
163
|
+
*/
|
|
164
|
+
batchGrantWithBond({ signer, contractAddress, address, amount, }: {
|
|
165
|
+
signer: OfflineSigner;
|
|
166
|
+
contractAddress: string;
|
|
167
|
+
amount: string;
|
|
168
|
+
address?: string;
|
|
169
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").DeliverTxResponse>;
|
|
170
|
+
/**
|
|
171
|
+
* Batch revoke with withdraw (for maci)
|
|
172
|
+
* @param client
|
|
173
|
+
* @param contractAddress
|
|
174
|
+
* @param address
|
|
175
|
+
* @returns
|
|
176
|
+
*/
|
|
177
|
+
batchRevokeWithdraw({ signer, contractAddress, address, }: {
|
|
178
|
+
signer: OfflineSigner;
|
|
179
|
+
contractAddress: string;
|
|
180
|
+
address?: string;
|
|
181
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").DeliverTxResponse>;
|
|
182
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OracleCertificate } from './oracle-certificate';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OracleCertificateParams, SignatureRequest, SignatureResponse, FeegrantAllowanceResponse, EcosystemsResponse } from './types';
|
|
2
|
+
export declare class OracleCertificate {
|
|
3
|
+
private certificateApiEndpoint;
|
|
4
|
+
private http;
|
|
5
|
+
constructor({ certificateApiEndpoint, http }: OracleCertificateParams);
|
|
6
|
+
sign(data: SignatureRequest): Promise<SignatureResponse>;
|
|
7
|
+
feegrantAllowance(granter: string, grantee: string): Promise<FeegrantAllowanceResponse>;
|
|
8
|
+
listEcosystems(): Promise<EcosystemsResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CertificateEcosystem } from '../../types';
|
|
2
|
+
import { Http } from '../http/http';
|
|
3
|
+
export type OracleCertificateParams = {
|
|
4
|
+
certificateApiEndpoint: string;
|
|
5
|
+
http: Http;
|
|
6
|
+
};
|
|
7
|
+
export type SignatureRequest = {
|
|
8
|
+
ecosystem: CertificateEcosystem;
|
|
9
|
+
address: string;
|
|
10
|
+
height: string;
|
|
11
|
+
contractAddress: string;
|
|
12
|
+
};
|
|
13
|
+
export type SignatureResponse = {
|
|
14
|
+
signature: string;
|
|
15
|
+
amount: string;
|
|
16
|
+
snapshotHeight: string;
|
|
17
|
+
};
|
|
18
|
+
export type FeegrantAllowanceResponse = {
|
|
19
|
+
granter: string;
|
|
20
|
+
grantee: string;
|
|
21
|
+
spend_limit: {
|
|
22
|
+
denom: string;
|
|
23
|
+
amount: string;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
export interface SnapshotHeightInfo {
|
|
27
|
+
lowestHeight: string;
|
|
28
|
+
latestHeight: string;
|
|
29
|
+
}
|
|
30
|
+
export interface Ecosystem {
|
|
31
|
+
name: string;
|
|
32
|
+
displayName: string;
|
|
33
|
+
decimals: number;
|
|
34
|
+
apiPath: string;
|
|
35
|
+
snapshotHeightInfo: SnapshotHeightInfo;
|
|
36
|
+
baseSlope: number;
|
|
37
|
+
}
|
|
38
|
+
export interface EcosystemsResponse {
|
|
39
|
+
ecosystems: Ecosystem[];
|
|
40
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Http } from '../../libs';
|
|
2
|
+
import { CircuitResponse, CircuitsResponse } from '../../types';
|
|
3
|
+
export declare class Circuit {
|
|
4
|
+
http: Http;
|
|
5
|
+
constructor(http: Http);
|
|
6
|
+
getCircuitByName(name: string): Promise<CircuitResponse>;
|
|
7
|
+
getCircuits(): Promise<CircuitsResponse>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { UserAccount } from './account';
|
|
2
|
+
export { Circuit } from './circuit';
|
|
3
|
+
export { Operator } from './operator';
|
|
4
|
+
export { Round } from './round';
|
|
5
|
+
export { Transaction } from './transaction';
|
|
6
|
+
export { Proof } from './proof';
|
|
7
|
+
export { Event } from './event';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Http } from '../../libs';
|
|
2
|
+
import { OperatorResponse, OperatorsResponse, OperatorDelayOperationsResponse, MissRateResponse } from '../../types';
|
|
3
|
+
export declare class Operator {
|
|
4
|
+
http: Http;
|
|
5
|
+
amaciRegistryContract: string;
|
|
6
|
+
constructor(http: Http, amaciRegistryContract: string);
|
|
7
|
+
getOperatorByAddress(address: string): Promise<OperatorResponse>;
|
|
8
|
+
getOperatorDelayOperationsByAddress(address: string, after: string, limit?: number): Promise<OperatorDelayOperationsResponse>;
|
|
9
|
+
getOperators(after: string, limit?: number): Promise<OperatorsResponse>;
|
|
10
|
+
queryMissRate(address: string, durationDay: number): Promise<MissRateResponse>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RoundsResponse, RoundResponse, SelectiveRoundResponse } from '../../types';
|
|
2
|
+
import { Http } from '../../libs';
|
|
3
|
+
export declare class Round {
|
|
4
|
+
http: Http;
|
|
5
|
+
constructor(http: Http);
|
|
6
|
+
getRoundById(address: string): Promise<RoundResponse>;
|
|
7
|
+
/**
|
|
8
|
+
* Get round information with selective fields
|
|
9
|
+
* @param address Round address
|
|
10
|
+
* @param fields Array of fields to return, returns all fields if empty
|
|
11
|
+
* @returns Round information response
|
|
12
|
+
*/
|
|
13
|
+
getRoundWithFields(address: string, fields?: string[]): Promise<SelectiveRoundResponse>;
|
|
14
|
+
getRounds(after: string, limit?: number): Promise<RoundsResponse>;
|
|
15
|
+
getRoundsByCircuitName(circuitName: string, after: string, limit?: number): Promise<RoundsResponse>;
|
|
16
|
+
getRoundsByStatus(status: string, after: string, limit?: number): Promise<RoundsResponse>;
|
|
17
|
+
getRoundsByOperator(operator: string, after: string, limit?: number): Promise<RoundsResponse>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TransactionsResponse, TransactionResponse } from '../../types';
|
|
2
|
+
import { Http } from '../../libs';
|
|
3
|
+
export declare class Transaction {
|
|
4
|
+
http: Http;
|
|
5
|
+
constructor(http: Http);
|
|
6
|
+
getTransactionByHash(txHash: string): Promise<TransactionResponse>;
|
|
7
|
+
getTransactions(after: string, limit?: number): Promise<TransactionsResponse>;
|
|
8
|
+
getTransactionsByContractAddress(address: string, after: string, limit?: number): Promise<TransactionsResponse>;
|
|
9
|
+
}
|
package/dist/maci.d.ts
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { ClientParams, CertificateEcosystem } from './types';
|
|
2
|
+
import { Http, Indexer, Contract, OracleCertificate, MACI } from './libs';
|
|
3
|
+
import { CreateAMaciRoundParams, CreateMaciRoundParams, CreateOracleMaciRoundParams } from './libs/contract/types';
|
|
4
|
+
import { OfflineSigner } from '@cosmjs/proto-signing';
|
|
5
|
+
import { Keypair, PubKey } from './libs/crypto';
|
|
6
|
+
import { OracleWhitelistConfig } from './libs/contract/ts/OracleMaci.types';
|
|
7
|
+
import { SignatureResponse } from './libs/oracle-certificate/types';
|
|
8
|
+
/**
|
|
9
|
+
* @class MaciClient
|
|
10
|
+
* @description This class is used to interact with Maci Client.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MaciClient {
|
|
13
|
+
network: 'mainnet' | 'testnet';
|
|
14
|
+
rpcEndpoint: string;
|
|
15
|
+
restEndpoint: string;
|
|
16
|
+
apiEndpoint: string;
|
|
17
|
+
certificateApiEndpoint: string;
|
|
18
|
+
registryAddress: string;
|
|
19
|
+
maciCodeId: number;
|
|
20
|
+
oracleCodeId: number;
|
|
21
|
+
feegrantOperator: string;
|
|
22
|
+
whitelistBackendPubkey: string;
|
|
23
|
+
http: Http;
|
|
24
|
+
indexer: Indexer;
|
|
25
|
+
contract: Contract;
|
|
26
|
+
oracleCertificate: OracleCertificate;
|
|
27
|
+
maci: MACI;
|
|
28
|
+
maciKeypair: Keypair;
|
|
29
|
+
signer: OfflineSigner;
|
|
30
|
+
/**
|
|
31
|
+
* @constructor
|
|
32
|
+
* @param {ClientParams} params - The parameters for the Maci Client instance.
|
|
33
|
+
*/
|
|
34
|
+
constructor({ signer, network, rpcEndpoint, restEndpoint, apiEndpoint, registryAddress, maciCodeId, oracleCodeId, customFetch, defaultOptions, feegrantOperator, whitelistBackendPubkey, certificateApiEndpoint, maciKeypair, }: ClientParams);
|
|
35
|
+
getSigner(signer?: OfflineSigner): OfflineSigner;
|
|
36
|
+
getMaciKeypair(): Keypair;
|
|
37
|
+
getMaciPubkey(): bigint;
|
|
38
|
+
packMaciPubkey(pubkey?: PubKey): bigint;
|
|
39
|
+
unpackMaciPubkey(pubkey: bigint | string): PubKey;
|
|
40
|
+
getAddress(signer?: OfflineSigner): Promise<string>;
|
|
41
|
+
oracleMaciClient({ signer, contractAddress, }: {
|
|
42
|
+
signer?: OfflineSigner;
|
|
43
|
+
contractAddress: string;
|
|
44
|
+
}): Promise<import("./libs/contract/ts/OracleMaci.client").OracleMaciClient>;
|
|
45
|
+
registryClient({ signer, contractAddress, }: {
|
|
46
|
+
signer?: OfflineSigner;
|
|
47
|
+
contractAddress: string;
|
|
48
|
+
}): Promise<import("./libs/contract/ts/Registry.client").RegistryClient>;
|
|
49
|
+
maciClient({ signer, contractAddress, }: {
|
|
50
|
+
signer?: OfflineSigner;
|
|
51
|
+
contractAddress: string;
|
|
52
|
+
}): Promise<import("./libs/contract/ts/Maci.client").MaciClient>;
|
|
53
|
+
amaciClient({ signer, contractAddress, }: {
|
|
54
|
+
signer?: OfflineSigner;
|
|
55
|
+
contractAddress: string;
|
|
56
|
+
}): Promise<import("./libs/contract/ts/AMaci.client").AMaciClient>;
|
|
57
|
+
createAMaciRound(params: CreateAMaciRoundParams): Promise<{
|
|
58
|
+
contractAddress: string;
|
|
59
|
+
logs: readonly import("@cosmjs/stargate/build/logs").Log[];
|
|
60
|
+
height: number;
|
|
61
|
+
transactionHash: string;
|
|
62
|
+
events: readonly import("@cosmjs/stargate").Event[];
|
|
63
|
+
gasWanted: bigint;
|
|
64
|
+
gasUsed: bigint;
|
|
65
|
+
}>;
|
|
66
|
+
createMaciRound(params: CreateMaciRoundParams): Promise<import("@cosmjs/cosmwasm-stargate").InstantiateResult>;
|
|
67
|
+
createOracleMaciRound(params: CreateOracleMaciRoundParams): Promise<import("@cosmjs/cosmwasm-stargate").InstantiateResult>;
|
|
68
|
+
genKeypairFromSign({ signer, address, }?: {
|
|
69
|
+
signer?: OfflineSigner;
|
|
70
|
+
address?: string;
|
|
71
|
+
}): Promise<Keypair>;
|
|
72
|
+
getStateIdxInc({ signer, address, contractAddress, }: {
|
|
73
|
+
signer?: OfflineSigner;
|
|
74
|
+
address?: string;
|
|
75
|
+
contractAddress: string;
|
|
76
|
+
}): Promise<string>;
|
|
77
|
+
getVoiceCreditBalance({ signer, stateIdx, contractAddress, }: {
|
|
78
|
+
signer?: OfflineSigner;
|
|
79
|
+
stateIdx: number;
|
|
80
|
+
contractAddress: string;
|
|
81
|
+
}): Promise<string>;
|
|
82
|
+
getStateIdxByPubKey({ contractAddress, pubKey, }: {
|
|
83
|
+
contractAddress: string;
|
|
84
|
+
pubKey: bigint[];
|
|
85
|
+
}): Promise<number>;
|
|
86
|
+
feegrantAllowance({ signer, address, contractAddress, }: {
|
|
87
|
+
signer?: OfflineSigner;
|
|
88
|
+
address?: string;
|
|
89
|
+
contractAddress: string;
|
|
90
|
+
}): Promise<import("./libs/oracle-certificate/types").FeegrantAllowanceResponse>;
|
|
91
|
+
hasFeegrant({ signer, address, contractAddress, }: {
|
|
92
|
+
signer?: OfflineSigner;
|
|
93
|
+
address?: string;
|
|
94
|
+
contractAddress: string;
|
|
95
|
+
}): Promise<boolean>;
|
|
96
|
+
queryWhitelistBalanceOf({ signer, address, contractAddress, certificate, mode, }: {
|
|
97
|
+
signer?: OfflineSigner;
|
|
98
|
+
address?: string;
|
|
99
|
+
contractAddress: string;
|
|
100
|
+
certificate?: {
|
|
101
|
+
signature: string;
|
|
102
|
+
amount: string;
|
|
103
|
+
};
|
|
104
|
+
mode?: 'maci' | 'amaci';
|
|
105
|
+
}): Promise<string>;
|
|
106
|
+
isWhitelisted({ signer, address, contractAddress, }: {
|
|
107
|
+
signer?: OfflineSigner;
|
|
108
|
+
address?: string;
|
|
109
|
+
contractAddress: string;
|
|
110
|
+
}): Promise<boolean>;
|
|
111
|
+
getOracleWhitelistConfig({ signer, contractAddress, }: {
|
|
112
|
+
signer?: OfflineSigner;
|
|
113
|
+
contractAddress: string;
|
|
114
|
+
}): Promise<OracleWhitelistConfig>;
|
|
115
|
+
getRoundInfo({ contractAddress }: {
|
|
116
|
+
contractAddress: string;
|
|
117
|
+
}): Promise<import("./types").RoundType>;
|
|
118
|
+
getRoundCircuitType({ contractAddress }: {
|
|
119
|
+
contractAddress: string;
|
|
120
|
+
}): Promise<string>;
|
|
121
|
+
queryRoundIsQv({ contractAddress }: {
|
|
122
|
+
contractAddress: string;
|
|
123
|
+
}): Promise<boolean>;
|
|
124
|
+
queryRoundClaimable({ contractAddress, }: {
|
|
125
|
+
contractAddress: string;
|
|
126
|
+
}): Promise<{
|
|
127
|
+
claimable: boolean | null;
|
|
128
|
+
balance: string | null;
|
|
129
|
+
}>;
|
|
130
|
+
queryAMaciChargeFee({ maxVoter, maxOption, }: {
|
|
131
|
+
maxVoter: number;
|
|
132
|
+
maxOption: number;
|
|
133
|
+
}): Promise<{
|
|
134
|
+
denom: string;
|
|
135
|
+
amount: string;
|
|
136
|
+
}>;
|
|
137
|
+
queryRoundGasStation({ contractAddress }: {
|
|
138
|
+
contractAddress: string;
|
|
139
|
+
}): Promise<boolean>;
|
|
140
|
+
parseRoundStatus(votingStart: number, votingEnd: number, status: string, currentTime: Date): string;
|
|
141
|
+
queryRoundBalance({ contractAddress }: {
|
|
142
|
+
contractAddress: string;
|
|
143
|
+
}): Promise<string>;
|
|
144
|
+
requestOracleCertificate({ signer, ecosystem, address, contractAddress, }: {
|
|
145
|
+
signer?: OfflineSigner;
|
|
146
|
+
ecosystem: CertificateEcosystem;
|
|
147
|
+
address?: string;
|
|
148
|
+
contractAddress: string;
|
|
149
|
+
}): Promise<SignatureResponse>;
|
|
150
|
+
signup({ signer, address, contractAddress, maciKeypair, oracleCertificate, gasStation, }: {
|
|
151
|
+
signer?: OfflineSigner;
|
|
152
|
+
address?: string;
|
|
153
|
+
contractAddress: string;
|
|
154
|
+
maciKeypair?: Keypair;
|
|
155
|
+
oracleCertificate?: {
|
|
156
|
+
amount: string;
|
|
157
|
+
signature: string;
|
|
158
|
+
};
|
|
159
|
+
gasStation?: boolean;
|
|
160
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
161
|
+
vote({ signer, address, stateIdx, contractAddress, selectedOptions, operatorCoordPubKey, maciKeypair, gasStation, }: {
|
|
162
|
+
signer?: OfflineSigner;
|
|
163
|
+
address?: string;
|
|
164
|
+
stateIdx: number;
|
|
165
|
+
contractAddress: string;
|
|
166
|
+
selectedOptions: {
|
|
167
|
+
idx: number;
|
|
168
|
+
vc: number;
|
|
169
|
+
}[];
|
|
170
|
+
operatorCoordPubKey: PubKey;
|
|
171
|
+
maciKeypair?: Keypair;
|
|
172
|
+
gasStation?: boolean;
|
|
173
|
+
}): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
174
|
+
claimAMaciRound({ signer, contractAddress, }: {
|
|
175
|
+
signer?: OfflineSigner;
|
|
176
|
+
contractAddress: string;
|
|
177
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
178
|
+
getOracleCertificateConfig(): Promise<import("./libs/oracle-certificate/types").EcosystemsResponse>;
|
|
179
|
+
batchGrantWithBond({ signer, contractAddress, address, amount, }: {
|
|
180
|
+
signer?: OfflineSigner;
|
|
181
|
+
contractAddress: string;
|
|
182
|
+
address?: string;
|
|
183
|
+
amount: string;
|
|
184
|
+
}): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
185
|
+
batchRevokeWithdraw({ signer, contractAddress, address, }: {
|
|
186
|
+
signer?: OfflineSigner;
|
|
187
|
+
contractAddress: string;
|
|
188
|
+
address?: string;
|
|
189
|
+
}): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
190
|
+
}
|