@dorafactory/maci-sdk 0.1.2 → 0.1.3-pre.10
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 +1 -1
- package/dist/index.js +2371 -975
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2369 -975
- package/dist/index.mjs.map +1 -1
- package/dist/libs/const.d.ts +1 -2
- package/dist/libs/contract/config.d.ts +12 -0
- package/dist/libs/contract/contract.d.ts +66 -4
- package/dist/libs/contract/ts/AMaci.client.d.ts +25 -3
- package/dist/libs/contract/ts/AMaci.types.d.ts +26 -1
- package/dist/libs/contract/ts/ApiMaci.client.d.ts +170 -0
- package/dist/libs/contract/ts/ApiMaci.types.d.ts +187 -0
- package/dist/libs/contract/ts/ApiSaas.client.d.ts +148 -0
- package/dist/libs/contract/ts/ApiSaas.types.d.ts +126 -0
- package/dist/libs/contract/ts/Registry.client.d.ts +17 -7
- package/dist/libs/contract/ts/Registry.types.d.ts +16 -5
- package/dist/libs/contract/types.d.ts +15 -3
- package/dist/libs/crypto/bigintUtils.d.ts +2 -0
- package/dist/libs/maci/maci.d.ts +34 -4
- package/dist/maci.d.ts +47 -3
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/index.ts +5 -1
- package/src/libs/const.ts +5 -6
- package/src/libs/contract/config.ts +36 -0
- package/src/libs/contract/contract.ts +611 -6
- package/src/libs/contract/ts/AMaci.client.ts +66 -0
- package/src/libs/contract/ts/AMaci.types.ts +30 -1
- package/src/libs/contract/ts/ApiMaci.client.ts +459 -0
- package/src/libs/contract/ts/ApiMaci.types.ts +188 -0
- package/src/libs/contract/ts/ApiSaas.client.ts +581 -0
- package/src/libs/contract/ts/ApiSaas.types.ts +144 -0
- package/src/libs/contract/ts/Registry.client.ts +57 -9
- package/src/libs/contract/ts/Registry.types.ts +18 -5
- package/src/libs/contract/types.ts +16 -3
- package/src/libs/crypto/bigintUtils.ts +28 -0
- package/src/libs/maci/maci.ts +190 -9
- package/src/maci.ts +86 -4
- package/src/types/index.ts +2 -2
package/dist/libs/const.d.ts
CHANGED
|
@@ -110,12 +110,11 @@ export interface NetworkConfig {
|
|
|
110
110
|
certificateApiEndpoint: string;
|
|
111
111
|
registryAddress: string;
|
|
112
112
|
saasAddress: string;
|
|
113
|
+
apiSaasAddress: string;
|
|
113
114
|
maciCodeId: number;
|
|
114
115
|
oracleCodeId: number;
|
|
115
|
-
saasCodeId: number;
|
|
116
116
|
oracleWhitelistBackendPubkey: string;
|
|
117
117
|
oracleFeegrantOperator: string;
|
|
118
118
|
oracleCodeIds: string[];
|
|
119
|
-
saasCodeIds: string[];
|
|
120
119
|
}
|
|
121
120
|
export declare function getDefaultParams(network?: 'mainnet' | 'testnet'): NetworkConfig;
|
|
@@ -6,6 +6,8 @@ import { AMaciClient } from './ts/AMaci.client';
|
|
|
6
6
|
import { RegistryClient } from './ts/Registry.client';
|
|
7
7
|
import { OracleMaciClient } from './ts/OracleMaci.client';
|
|
8
8
|
import { SaasClient } from './ts/Saas.client';
|
|
9
|
+
import { ApiMaciClient } from './ts/ApiMaci.client';
|
|
10
|
+
import { ApiSaasClient } from './ts/ApiSaas.client';
|
|
9
11
|
export declare function createMaciClientBy({ rpcEndpoint, wallet, contractAddress, }: {
|
|
10
12
|
rpcEndpoint: string;
|
|
11
13
|
wallet: OfflineSigner;
|
|
@@ -16,6 +18,11 @@ export declare function createAMaciClientBy({ rpcEndpoint, wallet, contractAddre
|
|
|
16
18
|
wallet: OfflineSigner;
|
|
17
19
|
contractAddress: string;
|
|
18
20
|
}): Promise<AMaciClient>;
|
|
21
|
+
export declare function createApiMaciClientBy({ rpcEndpoint, wallet, contractAddress, }: {
|
|
22
|
+
rpcEndpoint: string;
|
|
23
|
+
wallet: OfflineSigner;
|
|
24
|
+
contractAddress: string;
|
|
25
|
+
}): Promise<ApiMaciClient>;
|
|
19
26
|
export declare function createRegistryClientBy({ rpcEndpoint, wallet, contractAddress, }: {
|
|
20
27
|
rpcEndpoint: string;
|
|
21
28
|
wallet: OfflineSigner;
|
|
@@ -26,6 +33,11 @@ export declare function createSaasClientBy({ rpcEndpoint, wallet, contractAddres
|
|
|
26
33
|
wallet: OfflineSigner;
|
|
27
34
|
contractAddress: string;
|
|
28
35
|
}): Promise<SaasClient>;
|
|
36
|
+
export declare function createApiSaasClientBy({ rpcEndpoint, wallet, contractAddress, }: {
|
|
37
|
+
rpcEndpoint: string;
|
|
38
|
+
wallet: OfflineSigner;
|
|
39
|
+
contractAddress: string;
|
|
40
|
+
}): Promise<ApiSaasClient>;
|
|
29
41
|
export declare function createOracleMaciClientBy({ rpcEndpoint, wallet, contractAddress, }: {
|
|
30
42
|
rpcEndpoint: string;
|
|
31
43
|
wallet: OfflineSigner;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OfflineSigner } from '@cosmjs/proto-signing';
|
|
2
2
|
import { ContractParams } from '../../types';
|
|
3
|
-
import { CreateAMaciRoundParams, CreateMaciRoundParams, CreateOracleMaciRoundParams, CreateSaasOracleMaciRoundParams } from './types';
|
|
3
|
+
import { CreateAMaciRoundParams, CreateMaciRoundParams, CreateOracleMaciRoundParams, CreateSaasOracleMaciRoundParams, CreateApiSaasAmaciRoundParams } from './types';
|
|
4
4
|
import { StdFee } from '@cosmjs/stargate';
|
|
5
5
|
export declare const prefix = "dora";
|
|
6
6
|
export declare class Contract {
|
|
@@ -8,13 +8,13 @@ export declare class Contract {
|
|
|
8
8
|
rpcEndpoint: string;
|
|
9
9
|
registryAddress: string;
|
|
10
10
|
saasAddress: string;
|
|
11
|
+
apiSaasAddress: string;
|
|
11
12
|
maciCodeId: number;
|
|
12
13
|
oracleCodeId: number;
|
|
13
|
-
saasOracleCodeId: number;
|
|
14
14
|
feegrantOperator: string;
|
|
15
15
|
whitelistBackendPubkey: string;
|
|
16
|
-
constructor({ network, rpcEndpoint, registryAddress, saasAddress, maciCodeId, oracleCodeId,
|
|
17
|
-
createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter,
|
|
16
|
+
constructor({ network, rpcEndpoint, registryAddress, saasAddress, apiSaasAddress, maciCodeId, oracleCodeId, feegrantOperator, whitelistBackendPubkey, }: ContractParams);
|
|
17
|
+
createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, voteOptionMap, voiceCreditAmount, circuitType, preDeactivateRoot, oracleWhitelistPubkey, fee, }: CreateAMaciRoundParams & {
|
|
18
18
|
signer: OfflineSigner;
|
|
19
19
|
}): Promise<{
|
|
20
20
|
contractAddress: string;
|
|
@@ -114,11 +114,73 @@ export declare class Contract {
|
|
|
114
114
|
signer: OfflineSigner;
|
|
115
115
|
contractAddress: string;
|
|
116
116
|
}): Promise<import("./ts/AMaci.client").AMaciClient>;
|
|
117
|
+
apiMaciClient({ signer, contractAddress, }: {
|
|
118
|
+
signer: OfflineSigner;
|
|
119
|
+
contractAddress: string;
|
|
120
|
+
}): Promise<import("./ts/ApiMaci.client").ApiMaciClient>;
|
|
117
121
|
saasClient({ signer, contractAddress, }: {
|
|
118
122
|
signer: OfflineSigner;
|
|
119
123
|
contractAddress: string;
|
|
120
124
|
}): Promise<import("./ts/Saas.client").SaasClient>;
|
|
125
|
+
apiSaasClient({ signer, contractAddress, }: {
|
|
126
|
+
signer: OfflineSigner;
|
|
127
|
+
contractAddress: string;
|
|
128
|
+
}): Promise<import("./ts/ApiSaas.client").ApiSaasClient>;
|
|
121
129
|
contractClient({ signer }: {
|
|
122
130
|
signer: OfflineSigner;
|
|
123
131
|
}): Promise<import("@cosmjs/cosmwasm-stargate").SigningCosmWasmClient>;
|
|
132
|
+
createApiSaasMaciRound({ signer, operatorPubkey, startVoting, endVoting, title, description, link, maxVoter, voteOptionMap, whitelistBackendPubkey, gasStation, fee, }: CreateSaasOracleMaciRoundParams & {
|
|
133
|
+
signer: OfflineSigner;
|
|
134
|
+
}): Promise<{
|
|
135
|
+
contractAddress: string;
|
|
136
|
+
logs: readonly import("@cosmjs/stargate/build/logs").Log[];
|
|
137
|
+
height: number;
|
|
138
|
+
transactionHash: string;
|
|
139
|
+
events: readonly import("@cosmjs/stargate").Event[];
|
|
140
|
+
gasWanted: bigint;
|
|
141
|
+
gasUsed: bigint;
|
|
142
|
+
}>;
|
|
143
|
+
setApiSaasMaciRoundInfo({ signer, contractAddress, title, description, link, gasStation, fee, }: {
|
|
144
|
+
signer: OfflineSigner;
|
|
145
|
+
contractAddress: string;
|
|
146
|
+
title: string;
|
|
147
|
+
description: string;
|
|
148
|
+
link: string;
|
|
149
|
+
gasStation?: boolean;
|
|
150
|
+
fee?: StdFee | 'auto' | number;
|
|
151
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
152
|
+
setApiSaasMaciRoundVoteOptions({ signer, contractAddress, voteOptionMap, gasStation, fee, }: {
|
|
153
|
+
signer: OfflineSigner;
|
|
154
|
+
contractAddress: string;
|
|
155
|
+
voteOptionMap: string[];
|
|
156
|
+
gasStation?: boolean;
|
|
157
|
+
fee?: StdFee | 'auto' | number;
|
|
158
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
159
|
+
addApiSaasOperator({ signer, operator, gasStation, fee, }: {
|
|
160
|
+
signer: OfflineSigner;
|
|
161
|
+
operator: string;
|
|
162
|
+
gasStation?: boolean;
|
|
163
|
+
fee?: StdFee | 'auto' | number;
|
|
164
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
165
|
+
removeApiSaasOperator({ signer, operator, gasStation, fee, }: {
|
|
166
|
+
signer: OfflineSigner;
|
|
167
|
+
operator: string;
|
|
168
|
+
gasStation?: boolean;
|
|
169
|
+
fee?: StdFee | 'auto' | number;
|
|
170
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
171
|
+
isApiSaasOperator({ signer, operator, }: {
|
|
172
|
+
signer: OfflineSigner;
|
|
173
|
+
operator: string;
|
|
174
|
+
}): Promise<boolean>;
|
|
175
|
+
createApiSaasAmaciRound({ signer, operator, startVoting, endVoting, title, description, link, maxVoter, voteOptionMap, whitelist, voiceCreditAmount, preDeactivateRoot, oracleWhitelistPubkey, circuitType, gasStation, fee, }: CreateApiSaasAmaciRoundParams & {
|
|
176
|
+
signer: OfflineSigner;
|
|
177
|
+
}): Promise<{
|
|
178
|
+
contractAddress: string;
|
|
179
|
+
logs: readonly import("@cosmjs/stargate/build/logs").Log[];
|
|
180
|
+
height: number;
|
|
181
|
+
transactionHash: string;
|
|
182
|
+
events: readonly import("@cosmjs/stargate").Event[];
|
|
183
|
+
gasWanted: bigint;
|
|
184
|
+
gasUsed: bigint;
|
|
185
|
+
}>;
|
|
124
186
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate';
|
|
7
7
|
import { Coin, StdFee } from '@cosmjs/amino';
|
|
8
|
-
import { Addr, Uint256, PubKey, RoundInfo, VotingTime, WhitelistBase, MessageData, Groth16ProofType, Boolean, DelayRecords, Period, Uint128, ArrayOfString, Whitelist } from './AMaci.types';
|
|
8
|
+
import { Addr, Uint256, PubKey, RoundInfo, VotingTime, WhitelistBase, MessageData, Groth16ProofType, Boolean, DelayRecords, Period, TallyDelayInfo, NullableString, Uint128, ArrayOfString, Whitelist } from './AMaci.types';
|
|
9
9
|
export interface AMaciReadOnlyInterface {
|
|
10
10
|
contractAddress: string;
|
|
11
11
|
admin: () => Promise<Addr>;
|
|
@@ -50,6 +50,16 @@ export interface AMaciReadOnlyInterface {
|
|
|
50
50
|
queryCertSystem: () => Promise<Uint256>;
|
|
51
51
|
queryPreDeactivateRoot: () => Promise<Uint256>;
|
|
52
52
|
getDelayRecords: () => Promise<DelayRecords>;
|
|
53
|
+
getTallyDelay: () => Promise<TallyDelayInfo>;
|
|
54
|
+
queryOracleWhitelistConfig: () => Promise<NullableString>;
|
|
55
|
+
canSignUpWithOracle: ({ certificate, pubkey, }: {
|
|
56
|
+
certificate: string;
|
|
57
|
+
pubkey: PubKey;
|
|
58
|
+
}) => Promise<Boolean>;
|
|
59
|
+
whiteBalanceOf: ({ certificate, pubkey, }: {
|
|
60
|
+
certificate: string;
|
|
61
|
+
pubkey: PubKey;
|
|
62
|
+
}) => Promise<Uint256>;
|
|
53
63
|
}
|
|
54
64
|
export declare class AMaciQueryClient implements AMaciReadOnlyInterface {
|
|
55
65
|
client: CosmWasmClient;
|
|
@@ -97,6 +107,16 @@ export declare class AMaciQueryClient implements AMaciReadOnlyInterface {
|
|
|
97
107
|
queryCertSystem: () => Promise<Uint256>;
|
|
98
108
|
queryPreDeactivateRoot: () => Promise<Uint256>;
|
|
99
109
|
getDelayRecords: () => Promise<DelayRecords>;
|
|
110
|
+
getTallyDelay: () => Promise<TallyDelayInfo>;
|
|
111
|
+
queryOracleWhitelistConfig: () => Promise<NullableString>;
|
|
112
|
+
canSignUpWithOracle: ({ certificate, pubkey, }: {
|
|
113
|
+
certificate: string;
|
|
114
|
+
pubkey: PubKey;
|
|
115
|
+
}) => Promise<Boolean>;
|
|
116
|
+
whiteBalanceOf: ({ certificate, pubkey, }: {
|
|
117
|
+
certificate: string;
|
|
118
|
+
pubkey: PubKey;
|
|
119
|
+
}) => Promise<Uint256>;
|
|
100
120
|
}
|
|
101
121
|
export interface AMaciInterface extends AMaciReadOnlyInterface {
|
|
102
122
|
contractAddress: string;
|
|
@@ -110,7 +130,8 @@ export interface AMaciInterface extends AMaciReadOnlyInterface {
|
|
|
110
130
|
setVoteOptionsMap: ({ voteOptionMap, }: {
|
|
111
131
|
voteOptionMap: string[];
|
|
112
132
|
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
113
|
-
signUp: ({ pubkey, }: {
|
|
133
|
+
signUp: ({ certificate, pubkey, }: {
|
|
134
|
+
certificate?: string;
|
|
114
135
|
pubkey: PubKey;
|
|
115
136
|
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
116
137
|
startProcessPeriod: (fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
@@ -169,7 +190,8 @@ export declare class AMaciClient extends AMaciQueryClient implements AMaciInterf
|
|
|
169
190
|
setVoteOptionsMap: ({ voteOptionMap, }: {
|
|
170
191
|
voteOptionMap: string[];
|
|
171
192
|
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
172
|
-
signUp: ({ pubkey, }: {
|
|
193
|
+
signUp: ({ certificate, pubkey, }: {
|
|
194
|
+
certificate?: string;
|
|
173
195
|
pubkey: PubKey;
|
|
174
196
|
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
175
197
|
startProcessPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
@@ -12,12 +12,14 @@ export interface InstantiateMsg {
|
|
|
12
12
|
certification_system: Uint256;
|
|
13
13
|
circuit_type: Uint256;
|
|
14
14
|
coordinator: PubKey;
|
|
15
|
-
|
|
15
|
+
fee_recipient: Addr;
|
|
16
16
|
operator: Addr;
|
|
17
|
+
oracle_whitelist_pubkey?: string | null;
|
|
17
18
|
parameters: MaciParameters;
|
|
18
19
|
pre_deactivate_root: Uint256;
|
|
19
20
|
round_info: RoundInfo;
|
|
20
21
|
voice_credit_amount: Uint256;
|
|
22
|
+
vote_option_map: string[];
|
|
21
23
|
voting_time: VotingTime;
|
|
22
24
|
whitelist?: WhitelistBase | null;
|
|
23
25
|
}
|
|
@@ -60,6 +62,7 @@ export type ExecuteMsg = {
|
|
|
60
62
|
};
|
|
61
63
|
} | {
|
|
62
64
|
sign_up: {
|
|
65
|
+
certificate?: string | null;
|
|
63
66
|
pubkey: PubKey;
|
|
64
67
|
};
|
|
65
68
|
} | {
|
|
@@ -193,6 +196,20 @@ export type QueryMsg = {
|
|
|
193
196
|
query_pre_deactivate_root: {};
|
|
194
197
|
} | {
|
|
195
198
|
get_delay_records: {};
|
|
199
|
+
} | {
|
|
200
|
+
get_tally_delay: {};
|
|
201
|
+
} | {
|
|
202
|
+
query_oracle_whitelist_config: {};
|
|
203
|
+
} | {
|
|
204
|
+
can_sign_up_with_oracle: {
|
|
205
|
+
certificate: string;
|
|
206
|
+
pubkey: PubKey;
|
|
207
|
+
};
|
|
208
|
+
} | {
|
|
209
|
+
white_balance_of: {
|
|
210
|
+
certificate: string;
|
|
211
|
+
pubkey: PubKey;
|
|
212
|
+
};
|
|
196
213
|
};
|
|
197
214
|
export type Boolean = boolean;
|
|
198
215
|
export type DelayType = 'deactivate_delay' | 'tally_delay';
|
|
@@ -210,6 +227,14 @@ export type PeriodStatus = 'pending' | 'voting' | 'processing' | 'tallying' | 'e
|
|
|
210
227
|
export interface Period {
|
|
211
228
|
status: PeriodStatus;
|
|
212
229
|
}
|
|
230
|
+
export interface TallyDelayInfo {
|
|
231
|
+
calculated_hours: number;
|
|
232
|
+
delay_seconds: number;
|
|
233
|
+
msg_chain_length: Uint256;
|
|
234
|
+
num_sign_ups: Uint256;
|
|
235
|
+
total_work: number;
|
|
236
|
+
}
|
|
237
|
+
export type NullableString = string | null;
|
|
213
238
|
export type Uint128 = string;
|
|
214
239
|
export type ArrayOfString = string[];
|
|
215
240
|
export interface Whitelist {
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by @cosmwasm/ts-codegen@1.11.1.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
|
|
7
|
+
import { Coin, StdFee } from "@cosmjs/amino";
|
|
8
|
+
import { Uint256, PubKey, RoundInfo, VotingTime, Uint128, MessageData, Groth16ProofType, PlonkProofType, Addr, Period, Boolean, OracleWhitelistConfig, ArrayOfString, WhitelistConfig } from "./ApiMaci.types";
|
|
9
|
+
export interface ApiMaciReadOnlyInterface {
|
|
10
|
+
contractAddress: string;
|
|
11
|
+
getRoundInfo: () => Promise<RoundInfo>;
|
|
12
|
+
getVotingTime: () => Promise<VotingTime>;
|
|
13
|
+
getPeriod: () => Promise<Period>;
|
|
14
|
+
getNumSignUp: () => Promise<Uint256>;
|
|
15
|
+
getMsgChainLength: () => Promise<Uint256>;
|
|
16
|
+
getProcessedMsgCount: () => Promise<Uint256>;
|
|
17
|
+
getProcessedUserCount: () => Promise<Uint256>;
|
|
18
|
+
getResult: ({ index }: {
|
|
19
|
+
index: Uint256;
|
|
20
|
+
}) => Promise<Uint256>;
|
|
21
|
+
getAllResult: () => Promise<Uint256>;
|
|
22
|
+
getStateIdxInc: ({ address }: {
|
|
23
|
+
address: Addr;
|
|
24
|
+
}) => Promise<Uint256>;
|
|
25
|
+
getVoiceCreditBalance: ({ index }: {
|
|
26
|
+
index: Uint256;
|
|
27
|
+
}) => Promise<Uint256>;
|
|
28
|
+
isWhiteList: ({ amount, certificate, pubkey }: {
|
|
29
|
+
amount: Uint256;
|
|
30
|
+
certificate: string;
|
|
31
|
+
pubkey: PubKey;
|
|
32
|
+
}) => Promise<Boolean>;
|
|
33
|
+
whiteBalanceOf: ({ amount, certificate, pubkey }: {
|
|
34
|
+
amount: Uint256;
|
|
35
|
+
certificate: string;
|
|
36
|
+
pubkey: PubKey;
|
|
37
|
+
}) => Promise<Uint256>;
|
|
38
|
+
whiteInfo: ({ pubkey }: {
|
|
39
|
+
pubkey: PubKey;
|
|
40
|
+
}) => Promise<WhitelistConfig>;
|
|
41
|
+
maxWhitelistNum: () => Promise<Uint128>;
|
|
42
|
+
voteOptionMap: () => Promise<ArrayOfString>;
|
|
43
|
+
maxVoteOptions: () => Promise<Uint256>;
|
|
44
|
+
queryTotalFeeGrant: () => Promise<Uint128>;
|
|
45
|
+
queryCircuitType: () => Promise<Uint256>;
|
|
46
|
+
queryCertSystem: () => Promise<Uint256>;
|
|
47
|
+
queryOracleWhitelistConfig: () => Promise<OracleWhitelistConfig>;
|
|
48
|
+
}
|
|
49
|
+
export declare class ApiMaciQueryClient implements ApiMaciReadOnlyInterface {
|
|
50
|
+
client: CosmWasmClient;
|
|
51
|
+
contractAddress: string;
|
|
52
|
+
constructor(client: CosmWasmClient, contractAddress: string);
|
|
53
|
+
getRoundInfo: () => Promise<RoundInfo>;
|
|
54
|
+
getVotingTime: () => Promise<VotingTime>;
|
|
55
|
+
getPeriod: () => Promise<Period>;
|
|
56
|
+
getNumSignUp: () => Promise<Uint256>;
|
|
57
|
+
getMsgChainLength: () => Promise<Uint256>;
|
|
58
|
+
getProcessedMsgCount: () => Promise<Uint256>;
|
|
59
|
+
getProcessedUserCount: () => Promise<Uint256>;
|
|
60
|
+
getResult: ({ index }: {
|
|
61
|
+
index: Uint256;
|
|
62
|
+
}) => Promise<Uint256>;
|
|
63
|
+
getAllResult: () => Promise<Uint256>;
|
|
64
|
+
getStateIdxInc: ({ address }: {
|
|
65
|
+
address: Addr;
|
|
66
|
+
}) => Promise<Uint256>;
|
|
67
|
+
getVoiceCreditBalance: ({ index }: {
|
|
68
|
+
index: Uint256;
|
|
69
|
+
}) => Promise<Uint256>;
|
|
70
|
+
isWhiteList: ({ amount, certificate, pubkey }: {
|
|
71
|
+
amount: Uint256;
|
|
72
|
+
certificate: string;
|
|
73
|
+
pubkey: PubKey;
|
|
74
|
+
}) => Promise<Boolean>;
|
|
75
|
+
whiteBalanceOf: ({ amount, certificate, pubkey }: {
|
|
76
|
+
amount: Uint256;
|
|
77
|
+
certificate: string;
|
|
78
|
+
pubkey: PubKey;
|
|
79
|
+
}) => Promise<Uint256>;
|
|
80
|
+
whiteInfo: ({ pubkey }: {
|
|
81
|
+
pubkey: PubKey;
|
|
82
|
+
}) => Promise<WhitelistConfig>;
|
|
83
|
+
maxWhitelistNum: () => Promise<Uint128>;
|
|
84
|
+
voteOptionMap: () => Promise<ArrayOfString>;
|
|
85
|
+
maxVoteOptions: () => Promise<Uint256>;
|
|
86
|
+
queryTotalFeeGrant: () => Promise<Uint128>;
|
|
87
|
+
queryCircuitType: () => Promise<Uint256>;
|
|
88
|
+
queryCertSystem: () => Promise<Uint256>;
|
|
89
|
+
queryOracleWhitelistConfig: () => Promise<OracleWhitelistConfig>;
|
|
90
|
+
}
|
|
91
|
+
export interface ApiMaciInterface extends ApiMaciReadOnlyInterface {
|
|
92
|
+
contractAddress: string;
|
|
93
|
+
sender: string;
|
|
94
|
+
setRoundInfo: ({ roundInfo }: {
|
|
95
|
+
roundInfo: RoundInfo;
|
|
96
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
97
|
+
setVoteOptionsMap: ({ voteOptionMap }: {
|
|
98
|
+
voteOptionMap: string[];
|
|
99
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
100
|
+
signUp: ({ amount, certificate, pubkey }: {
|
|
101
|
+
amount: Uint256;
|
|
102
|
+
certificate: string;
|
|
103
|
+
pubkey: PubKey;
|
|
104
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
105
|
+
startProcessPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
106
|
+
publishMessage: ({ encPubKey, message }: {
|
|
107
|
+
encPubKey: PubKey;
|
|
108
|
+
message: MessageData;
|
|
109
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
110
|
+
processMessage: ({ groth16Proof, newStateCommitment, plonkProof }: {
|
|
111
|
+
groth16Proof?: Groth16ProofType;
|
|
112
|
+
newStateCommitment: Uint256;
|
|
113
|
+
plonkProof?: PlonkProofType;
|
|
114
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
115
|
+
stopProcessingPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
116
|
+
processTally: ({ groth16Proof, newTallyCommitment, plonkProof }: {
|
|
117
|
+
groth16Proof?: Groth16ProofType;
|
|
118
|
+
newTallyCommitment: Uint256;
|
|
119
|
+
plonkProof?: PlonkProofType;
|
|
120
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
121
|
+
stopTallyingPeriod: ({ results, salt }: {
|
|
122
|
+
results: Uint256[];
|
|
123
|
+
salt: Uint256;
|
|
124
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
125
|
+
bond: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
126
|
+
withdraw: ({ amount }: {
|
|
127
|
+
amount?: Uint128;
|
|
128
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
129
|
+
}
|
|
130
|
+
export declare class ApiMaciClient extends ApiMaciQueryClient implements ApiMaciInterface {
|
|
131
|
+
client: SigningCosmWasmClient;
|
|
132
|
+
sender: string;
|
|
133
|
+
contractAddress: string;
|
|
134
|
+
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string);
|
|
135
|
+
setRoundInfo: ({ roundInfo }: {
|
|
136
|
+
roundInfo: RoundInfo;
|
|
137
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
138
|
+
setVoteOptionsMap: ({ voteOptionMap }: {
|
|
139
|
+
voteOptionMap: string[];
|
|
140
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
141
|
+
signUp: ({ amount, certificate, pubkey }: {
|
|
142
|
+
amount: Uint256;
|
|
143
|
+
certificate: string;
|
|
144
|
+
pubkey: PubKey;
|
|
145
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
146
|
+
startProcessPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
147
|
+
publishMessage: ({ encPubKey, message }: {
|
|
148
|
+
encPubKey: PubKey;
|
|
149
|
+
message: MessageData;
|
|
150
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
151
|
+
processMessage: ({ groth16Proof, newStateCommitment, plonkProof }: {
|
|
152
|
+
groth16Proof?: Groth16ProofType;
|
|
153
|
+
newStateCommitment: Uint256;
|
|
154
|
+
plonkProof?: PlonkProofType;
|
|
155
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
156
|
+
stopProcessingPeriod: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
157
|
+
processTally: ({ groth16Proof, newTallyCommitment, plonkProof }: {
|
|
158
|
+
groth16Proof?: Groth16ProofType;
|
|
159
|
+
newTallyCommitment: Uint256;
|
|
160
|
+
plonkProof?: PlonkProofType;
|
|
161
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
162
|
+
stopTallyingPeriod: ({ results, salt }: {
|
|
163
|
+
results: Uint256[];
|
|
164
|
+
salt: Uint256;
|
|
165
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
166
|
+
bond: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
167
|
+
withdraw: ({ amount }: {
|
|
168
|
+
amount?: Uint128;
|
|
169
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
170
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by @cosmwasm/ts-codegen@1.11.1.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
export type Uint256 = string;
|
|
7
|
+
export type Timestamp = Uint64;
|
|
8
|
+
export type Uint64 = string;
|
|
9
|
+
export type VotingPowerMode = "slope" | "threshold";
|
|
10
|
+
export interface InstantiateMsg {
|
|
11
|
+
certification_system: Uint256;
|
|
12
|
+
circuit_type: Uint256;
|
|
13
|
+
coordinator: PubKey;
|
|
14
|
+
max_voters: number;
|
|
15
|
+
round_info: RoundInfo;
|
|
16
|
+
vote_option_map: string[];
|
|
17
|
+
voting_time: VotingTime;
|
|
18
|
+
whitelist_backend_pubkey: string;
|
|
19
|
+
whitelist_voting_power_args: VotingPowerArgs;
|
|
20
|
+
}
|
|
21
|
+
export interface PubKey {
|
|
22
|
+
x: Uint256;
|
|
23
|
+
y: Uint256;
|
|
24
|
+
}
|
|
25
|
+
export interface RoundInfo {
|
|
26
|
+
description: string;
|
|
27
|
+
link: string;
|
|
28
|
+
title: string;
|
|
29
|
+
}
|
|
30
|
+
export interface VotingTime {
|
|
31
|
+
end_time: Timestamp;
|
|
32
|
+
start_time: Timestamp;
|
|
33
|
+
}
|
|
34
|
+
export interface VotingPowerArgs {
|
|
35
|
+
mode: VotingPowerMode;
|
|
36
|
+
slope: Uint256;
|
|
37
|
+
threshold: Uint256;
|
|
38
|
+
}
|
|
39
|
+
export type ExecuteMsg = {
|
|
40
|
+
set_round_info: {
|
|
41
|
+
round_info: RoundInfo;
|
|
42
|
+
};
|
|
43
|
+
} | {
|
|
44
|
+
set_vote_options_map: {
|
|
45
|
+
vote_option_map: string[];
|
|
46
|
+
};
|
|
47
|
+
} | {
|
|
48
|
+
sign_up: {
|
|
49
|
+
amount: Uint256;
|
|
50
|
+
certificate: string;
|
|
51
|
+
pubkey: PubKey;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
start_process_period: {};
|
|
55
|
+
} | {
|
|
56
|
+
publish_message: {
|
|
57
|
+
enc_pub_key: PubKey;
|
|
58
|
+
message: MessageData;
|
|
59
|
+
};
|
|
60
|
+
} | {
|
|
61
|
+
process_message: {
|
|
62
|
+
groth16_proof?: Groth16ProofType | null;
|
|
63
|
+
new_state_commitment: Uint256;
|
|
64
|
+
plonk_proof?: PlonkProofType | null;
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
stop_processing_period: {};
|
|
68
|
+
} | {
|
|
69
|
+
process_tally: {
|
|
70
|
+
groth16_proof?: Groth16ProofType | null;
|
|
71
|
+
new_tally_commitment: Uint256;
|
|
72
|
+
plonk_proof?: PlonkProofType | null;
|
|
73
|
+
};
|
|
74
|
+
} | {
|
|
75
|
+
stop_tallying_period: {
|
|
76
|
+
results: Uint256[];
|
|
77
|
+
salt: Uint256;
|
|
78
|
+
};
|
|
79
|
+
} | {
|
|
80
|
+
bond: {};
|
|
81
|
+
} | {
|
|
82
|
+
withdraw: {
|
|
83
|
+
amount?: Uint128 | null;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export type Uint128 = string;
|
|
87
|
+
export interface MessageData {
|
|
88
|
+
data: [Uint256, Uint256, Uint256, Uint256, Uint256, Uint256, Uint256];
|
|
89
|
+
}
|
|
90
|
+
export interface Groth16ProofType {
|
|
91
|
+
a: string;
|
|
92
|
+
b: string;
|
|
93
|
+
c: string;
|
|
94
|
+
}
|
|
95
|
+
export interface PlonkProofType {
|
|
96
|
+
grand_product_at_z_omega: string;
|
|
97
|
+
grand_product_commitment: string;
|
|
98
|
+
input_values: string[];
|
|
99
|
+
linearization_polynomial_at_z: string;
|
|
100
|
+
n: number;
|
|
101
|
+
num_inputs: number;
|
|
102
|
+
opening_at_z_omega_proof: string;
|
|
103
|
+
opening_at_z_proof: string;
|
|
104
|
+
permutation_polynomials_at_z: string[];
|
|
105
|
+
quotient_poly_commitments: string[];
|
|
106
|
+
quotient_polynomial_at_z: string;
|
|
107
|
+
wire_commitments: string[];
|
|
108
|
+
wire_values_at_z: string[];
|
|
109
|
+
wire_values_at_z_omega: string[];
|
|
110
|
+
}
|
|
111
|
+
export type QueryMsg = {
|
|
112
|
+
get_round_info: {};
|
|
113
|
+
} | {
|
|
114
|
+
get_voting_time: {};
|
|
115
|
+
} | {
|
|
116
|
+
get_period: {};
|
|
117
|
+
} | {
|
|
118
|
+
get_num_sign_up: {};
|
|
119
|
+
} | {
|
|
120
|
+
get_msg_chain_length: {};
|
|
121
|
+
} | {
|
|
122
|
+
get_processed_msg_count: {};
|
|
123
|
+
} | {
|
|
124
|
+
get_processed_user_count: {};
|
|
125
|
+
} | {
|
|
126
|
+
get_result: {
|
|
127
|
+
index: Uint256;
|
|
128
|
+
};
|
|
129
|
+
} | {
|
|
130
|
+
get_all_result: {};
|
|
131
|
+
} | {
|
|
132
|
+
get_state_idx_inc: {
|
|
133
|
+
address: Addr;
|
|
134
|
+
};
|
|
135
|
+
} | {
|
|
136
|
+
get_voice_credit_balance: {
|
|
137
|
+
index: Uint256;
|
|
138
|
+
};
|
|
139
|
+
} | {
|
|
140
|
+
is_white_list: {
|
|
141
|
+
amount: Uint256;
|
|
142
|
+
certificate: string;
|
|
143
|
+
pubkey: PubKey;
|
|
144
|
+
};
|
|
145
|
+
} | {
|
|
146
|
+
white_balance_of: {
|
|
147
|
+
amount: Uint256;
|
|
148
|
+
certificate: string;
|
|
149
|
+
pubkey: PubKey;
|
|
150
|
+
};
|
|
151
|
+
} | {
|
|
152
|
+
white_info: {
|
|
153
|
+
pubkey: PubKey;
|
|
154
|
+
};
|
|
155
|
+
} | {
|
|
156
|
+
max_whitelist_num: {};
|
|
157
|
+
} | {
|
|
158
|
+
vote_option_map: {};
|
|
159
|
+
} | {
|
|
160
|
+
max_vote_options: {};
|
|
161
|
+
} | {
|
|
162
|
+
query_total_fee_grant: {};
|
|
163
|
+
} | {
|
|
164
|
+
query_circuit_type: {};
|
|
165
|
+
} | {
|
|
166
|
+
query_cert_system: {};
|
|
167
|
+
} | {
|
|
168
|
+
query_oracle_whitelist_config: {};
|
|
169
|
+
};
|
|
170
|
+
export type Addr = string;
|
|
171
|
+
export type PeriodStatus = "pending" | "voting" | "processing" | "tallying" | "ended";
|
|
172
|
+
export interface Period {
|
|
173
|
+
status: PeriodStatus;
|
|
174
|
+
}
|
|
175
|
+
export type Boolean = boolean;
|
|
176
|
+
export type Binary = string;
|
|
177
|
+
export interface OracleWhitelistConfig {
|
|
178
|
+
backend_pubkey: Binary;
|
|
179
|
+
slope: Uint256;
|
|
180
|
+
threshold: Uint256;
|
|
181
|
+
voting_power_mode: VotingPowerMode;
|
|
182
|
+
}
|
|
183
|
+
export type ArrayOfString = string[];
|
|
184
|
+
export interface WhitelistConfig {
|
|
185
|
+
balance: Uint256;
|
|
186
|
+
is_register: boolean;
|
|
187
|
+
}
|