@dorafactory/maci-sdk 0.1.2 → 0.1.3-pre.1
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.js +2083 -1037
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2083 -1037
- 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 +53 -2
- 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 +122 -0
- package/dist/libs/contract/ts/ApiSaas.types.d.ts +102 -0
- package/dist/libs/maci/maci.d.ts +24 -0
- package/dist/maci.d.ts +26 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/libs/const.ts +5 -6
- package/src/libs/contract/config.ts +36 -0
- package/src/libs/contract/contract.ts +477 -3
- 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 +307 -0
- package/src/libs/contract/ts/ApiSaas.types.ts +103 -0
- package/src/libs/maci/maci.ts +153 -0
- package/src/maci.ts +66 -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;
|
|
@@ -8,12 +8,12 @@ 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,
|
|
16
|
+
constructor({ network, rpcEndpoint, registryAddress, saasAddress, apiSaasAddress, maciCodeId, oracleCodeId, feegrantOperator, whitelistBackendPubkey, }: ContractParams);
|
|
17
17
|
createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, fee, }: CreateAMaciRoundParams & {
|
|
18
18
|
signer: OfflineSigner;
|
|
19
19
|
}): Promise<{
|
|
@@ -114,11 +114,62 @@ 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>;
|
|
124
175
|
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
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 { Addr, Uint128, Uint256, Timestamp, Uint64, PubKey, RoundInfo, Config, Boolean, ArrayOfOperatorInfo } from "./ApiSaas.types";
|
|
9
|
+
export interface ApiSaasReadOnlyInterface {
|
|
10
|
+
contractAddress: string;
|
|
11
|
+
config: () => Promise<Config>;
|
|
12
|
+
operators: () => Promise<ArrayOfOperatorInfo>;
|
|
13
|
+
isOperator: ({ address }: {
|
|
14
|
+
address: Addr;
|
|
15
|
+
}) => Promise<Boolean>;
|
|
16
|
+
balance: () => Promise<Uint128>;
|
|
17
|
+
maciCodeId: () => Promise<Uint64>;
|
|
18
|
+
treasuryManager: () => Promise<Addr>;
|
|
19
|
+
}
|
|
20
|
+
export declare class ApiSaasQueryClient implements ApiSaasReadOnlyInterface {
|
|
21
|
+
client: CosmWasmClient;
|
|
22
|
+
contractAddress: string;
|
|
23
|
+
constructor(client: CosmWasmClient, contractAddress: string);
|
|
24
|
+
config: () => Promise<Config>;
|
|
25
|
+
operators: () => Promise<ArrayOfOperatorInfo>;
|
|
26
|
+
isOperator: ({ address }: {
|
|
27
|
+
address: Addr;
|
|
28
|
+
}) => Promise<Boolean>;
|
|
29
|
+
balance: () => Promise<Uint128>;
|
|
30
|
+
maciCodeId: () => Promise<Uint64>;
|
|
31
|
+
treasuryManager: () => Promise<Addr>;
|
|
32
|
+
}
|
|
33
|
+
export interface ApiSaasInterface extends ApiSaasReadOnlyInterface {
|
|
34
|
+
contractAddress: string;
|
|
35
|
+
sender: string;
|
|
36
|
+
updateConfig: ({ admin, denom }: {
|
|
37
|
+
admin?: Addr;
|
|
38
|
+
denom?: string;
|
|
39
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
40
|
+
updateMaciCodeId: ({ codeId }: {
|
|
41
|
+
codeId: number;
|
|
42
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
43
|
+
updateAmaciRegistryContract: ({ registryContract }: {
|
|
44
|
+
registryContract: Addr;
|
|
45
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
46
|
+
addOperator: ({ operator }: {
|
|
47
|
+
operator: Addr;
|
|
48
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
49
|
+
removeOperator: ({ operator }: {
|
|
50
|
+
operator: Addr;
|
|
51
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
52
|
+
deposit: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
53
|
+
withdraw: ({ amount, recipient }: {
|
|
54
|
+
amount: Uint128;
|
|
55
|
+
recipient?: Addr;
|
|
56
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
57
|
+
createApiMaciRound: ({ certificationSystem, circuitType, coordinator, endTime, maxVoters, roundInfo, startTime, voteOptionMap, whitelistBackendPubkey }: {
|
|
58
|
+
certificationSystem: Uint256;
|
|
59
|
+
circuitType: Uint256;
|
|
60
|
+
coordinator: PubKey;
|
|
61
|
+
endTime: Timestamp;
|
|
62
|
+
maxVoters: number;
|
|
63
|
+
roundInfo: RoundInfo;
|
|
64
|
+
startTime: Timestamp;
|
|
65
|
+
voteOptionMap: string[];
|
|
66
|
+
whitelistBackendPubkey: string;
|
|
67
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
68
|
+
setRoundInfo: ({ contractAddr, roundInfo }: {
|
|
69
|
+
contractAddr: string;
|
|
70
|
+
roundInfo: RoundInfo;
|
|
71
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
72
|
+
setVoteOptionsMap: ({ contractAddr, voteOptionMap }: {
|
|
73
|
+
contractAddr: string;
|
|
74
|
+
voteOptionMap: string[];
|
|
75
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
76
|
+
}
|
|
77
|
+
export declare class ApiSaasClient extends ApiSaasQueryClient implements ApiSaasInterface {
|
|
78
|
+
client: SigningCosmWasmClient;
|
|
79
|
+
sender: string;
|
|
80
|
+
contractAddress: string;
|
|
81
|
+
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string);
|
|
82
|
+
updateConfig: ({ admin, denom }: {
|
|
83
|
+
admin?: Addr;
|
|
84
|
+
denom?: string;
|
|
85
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
86
|
+
updateMaciCodeId: ({ codeId }: {
|
|
87
|
+
codeId: number;
|
|
88
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
89
|
+
updateAmaciRegistryContract: ({ registryContract }: {
|
|
90
|
+
registryContract: Addr;
|
|
91
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
92
|
+
addOperator: ({ operator }: {
|
|
93
|
+
operator: Addr;
|
|
94
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
95
|
+
removeOperator: ({ operator }: {
|
|
96
|
+
operator: Addr;
|
|
97
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
98
|
+
deposit: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
99
|
+
withdraw: ({ amount, recipient }: {
|
|
100
|
+
amount: Uint128;
|
|
101
|
+
recipient?: Addr;
|
|
102
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
103
|
+
createApiMaciRound: ({ certificationSystem, circuitType, coordinator, endTime, maxVoters, roundInfo, startTime, voteOptionMap, whitelistBackendPubkey }: {
|
|
104
|
+
certificationSystem: Uint256;
|
|
105
|
+
circuitType: Uint256;
|
|
106
|
+
coordinator: PubKey;
|
|
107
|
+
endTime: Timestamp;
|
|
108
|
+
maxVoters: number;
|
|
109
|
+
roundInfo: RoundInfo;
|
|
110
|
+
startTime: Timestamp;
|
|
111
|
+
voteOptionMap: string[];
|
|
112
|
+
whitelistBackendPubkey: string;
|
|
113
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
114
|
+
setRoundInfo: ({ contractAddr, roundInfo }: {
|
|
115
|
+
contractAddr: string;
|
|
116
|
+
roundInfo: RoundInfo;
|
|
117
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
118
|
+
setVoteOptionsMap: ({ contractAddr, voteOptionMap }: {
|
|
119
|
+
contractAddr: string;
|
|
120
|
+
voteOptionMap: string[];
|
|
121
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
122
|
+
}
|