@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
|
@@ -0,0 +1,148 @@
|
|
|
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, VotingTime, WhitelistBase, 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
|
+
createMaciRound: ({ 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
|
+
createAmaciRound: ({ certificationSystem, circuitType, maxVoter, operator, oracleWhitelistPubkey, preDeactivateRoot, roundInfo, voiceCreditAmount, voteOptionMap, votingTime, whitelist, }: {
|
|
69
|
+
certificationSystem: Uint256;
|
|
70
|
+
circuitType: Uint256;
|
|
71
|
+
maxVoter: Uint256;
|
|
72
|
+
operator: Addr;
|
|
73
|
+
oracleWhitelistPubkey?: string;
|
|
74
|
+
preDeactivateRoot: Uint256;
|
|
75
|
+
roundInfo: RoundInfo;
|
|
76
|
+
voiceCreditAmount: Uint256;
|
|
77
|
+
voteOptionMap: string[];
|
|
78
|
+
votingTime: VotingTime;
|
|
79
|
+
whitelist?: WhitelistBase;
|
|
80
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
81
|
+
setRoundInfo: ({ contractAddr, roundInfo, }: {
|
|
82
|
+
contractAddr: string;
|
|
83
|
+
roundInfo: RoundInfo;
|
|
84
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
85
|
+
setVoteOptionsMap: ({ contractAddr, voteOptionMap, }: {
|
|
86
|
+
contractAddr: string;
|
|
87
|
+
voteOptionMap: string[];
|
|
88
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
89
|
+
}
|
|
90
|
+
export declare class ApiSaasClient extends ApiSaasQueryClient implements ApiSaasInterface {
|
|
91
|
+
client: SigningCosmWasmClient;
|
|
92
|
+
sender: string;
|
|
93
|
+
contractAddress: string;
|
|
94
|
+
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string);
|
|
95
|
+
updateConfig: ({ admin, denom, }: {
|
|
96
|
+
admin?: Addr;
|
|
97
|
+
denom?: string;
|
|
98
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
99
|
+
updateMaciCodeId: ({ codeId, }: {
|
|
100
|
+
codeId: number;
|
|
101
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
102
|
+
updateAmaciRegistryContract: ({ registryContract, }: {
|
|
103
|
+
registryContract: Addr;
|
|
104
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
105
|
+
addOperator: ({ operator, }: {
|
|
106
|
+
operator: Addr;
|
|
107
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
108
|
+
removeOperator: ({ operator, }: {
|
|
109
|
+
operator: Addr;
|
|
110
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
111
|
+
deposit: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
112
|
+
withdraw: ({ amount, recipient, }: {
|
|
113
|
+
amount: Uint128;
|
|
114
|
+
recipient?: Addr;
|
|
115
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
116
|
+
createMaciRound: ({ certificationSystem, circuitType, coordinator, endTime, maxVoters, roundInfo, startTime, voteOptionMap, whitelistBackendPubkey, }: {
|
|
117
|
+
certificationSystem: Uint256;
|
|
118
|
+
circuitType: Uint256;
|
|
119
|
+
coordinator: PubKey;
|
|
120
|
+
endTime: Timestamp;
|
|
121
|
+
maxVoters: number;
|
|
122
|
+
roundInfo: RoundInfo;
|
|
123
|
+
startTime: Timestamp;
|
|
124
|
+
voteOptionMap: string[];
|
|
125
|
+
whitelistBackendPubkey: string;
|
|
126
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
127
|
+
createAmaciRound: ({ certificationSystem, circuitType, maxVoter, operator, oracleWhitelistPubkey, preDeactivateRoot, roundInfo, voiceCreditAmount, voteOptionMap, votingTime, whitelist, }: {
|
|
128
|
+
certificationSystem: Uint256;
|
|
129
|
+
circuitType: Uint256;
|
|
130
|
+
maxVoter: Uint256;
|
|
131
|
+
operator: Addr;
|
|
132
|
+
oracleWhitelistPubkey?: string;
|
|
133
|
+
preDeactivateRoot: Uint256;
|
|
134
|
+
roundInfo: RoundInfo;
|
|
135
|
+
voiceCreditAmount: Uint256;
|
|
136
|
+
voteOptionMap: string[];
|
|
137
|
+
votingTime: VotingTime;
|
|
138
|
+
whitelist?: WhitelistBase;
|
|
139
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
140
|
+
setRoundInfo: ({ contractAddr, roundInfo, }: {
|
|
141
|
+
contractAddr: string;
|
|
142
|
+
roundInfo: RoundInfo;
|
|
143
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
144
|
+
setVoteOptionsMap: ({ contractAddr, voteOptionMap, }: {
|
|
145
|
+
contractAddr: string;
|
|
146
|
+
voteOptionMap: string[];
|
|
147
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
148
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
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 Addr = string;
|
|
7
|
+
export interface InstantiateMsg {
|
|
8
|
+
admin: Addr;
|
|
9
|
+
denom: string;
|
|
10
|
+
maci_code_id: number;
|
|
11
|
+
registry_contract: Addr;
|
|
12
|
+
treasury_manager: Addr;
|
|
13
|
+
}
|
|
14
|
+
export type ExecuteMsg = {
|
|
15
|
+
update_config: {
|
|
16
|
+
admin?: Addr | null;
|
|
17
|
+
denom?: string | null;
|
|
18
|
+
};
|
|
19
|
+
} | {
|
|
20
|
+
update_maci_code_id: {
|
|
21
|
+
code_id: number;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
update_amaci_registry_contract: {
|
|
25
|
+
registry_contract: Addr;
|
|
26
|
+
};
|
|
27
|
+
} | {
|
|
28
|
+
add_operator: {
|
|
29
|
+
operator: Addr;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
remove_operator: {
|
|
33
|
+
operator: Addr;
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
deposit: {};
|
|
37
|
+
} | {
|
|
38
|
+
withdraw: {
|
|
39
|
+
amount: Uint128;
|
|
40
|
+
recipient?: Addr | null;
|
|
41
|
+
};
|
|
42
|
+
} | {
|
|
43
|
+
create_maci_round: {
|
|
44
|
+
certification_system: Uint256;
|
|
45
|
+
circuit_type: Uint256;
|
|
46
|
+
coordinator: PubKey;
|
|
47
|
+
end_time: Timestamp;
|
|
48
|
+
max_voters: number;
|
|
49
|
+
round_info: RoundInfo;
|
|
50
|
+
start_time: Timestamp;
|
|
51
|
+
vote_option_map: string[];
|
|
52
|
+
whitelist_backend_pubkey: string;
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
create_amaci_round: {
|
|
56
|
+
certification_system: Uint256;
|
|
57
|
+
circuit_type: Uint256;
|
|
58
|
+
max_voter: Uint256;
|
|
59
|
+
operator: Addr;
|
|
60
|
+
oracle_whitelist_pubkey?: string | null;
|
|
61
|
+
pre_deactivate_root: Uint256;
|
|
62
|
+
round_info: RoundInfo;
|
|
63
|
+
voice_credit_amount: Uint256;
|
|
64
|
+
vote_option_map: string[];
|
|
65
|
+
voting_time: VotingTime;
|
|
66
|
+
whitelist?: WhitelistBase | null;
|
|
67
|
+
};
|
|
68
|
+
} | {
|
|
69
|
+
set_round_info: {
|
|
70
|
+
contract_addr: string;
|
|
71
|
+
round_info: RoundInfo;
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
set_vote_options_map: {
|
|
75
|
+
contract_addr: string;
|
|
76
|
+
vote_option_map: string[];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export type Uint128 = string;
|
|
80
|
+
export type Uint256 = string;
|
|
81
|
+
export type Timestamp = Uint64;
|
|
82
|
+
export type Uint64 = string;
|
|
83
|
+
export interface PubKey {
|
|
84
|
+
x: Uint256;
|
|
85
|
+
y: Uint256;
|
|
86
|
+
}
|
|
87
|
+
export interface RoundInfo {
|
|
88
|
+
description: string;
|
|
89
|
+
link: string;
|
|
90
|
+
title: string;
|
|
91
|
+
}
|
|
92
|
+
export interface VotingTime {
|
|
93
|
+
end_time: Timestamp;
|
|
94
|
+
start_time: Timestamp;
|
|
95
|
+
}
|
|
96
|
+
export interface WhitelistBase {
|
|
97
|
+
users: WhitelistBaseConfig[];
|
|
98
|
+
}
|
|
99
|
+
export interface WhitelistBaseConfig {
|
|
100
|
+
addr: Addr;
|
|
101
|
+
}
|
|
102
|
+
export type QueryMsg = {
|
|
103
|
+
config: {};
|
|
104
|
+
} | {
|
|
105
|
+
operators: {};
|
|
106
|
+
} | {
|
|
107
|
+
is_operator: {
|
|
108
|
+
address: Addr;
|
|
109
|
+
};
|
|
110
|
+
} | {
|
|
111
|
+
balance: {};
|
|
112
|
+
} | {
|
|
113
|
+
maci_code_id: {};
|
|
114
|
+
} | {
|
|
115
|
+
treasury_manager: {};
|
|
116
|
+
};
|
|
117
|
+
export interface Config {
|
|
118
|
+
admin: Addr;
|
|
119
|
+
denom: string;
|
|
120
|
+
}
|
|
121
|
+
export type Boolean = boolean;
|
|
122
|
+
export type ArrayOfOperatorInfo = OperatorInfo[];
|
|
123
|
+
export interface OperatorInfo {
|
|
124
|
+
added_at: Timestamp;
|
|
125
|
+
address: Addr;
|
|
126
|
+
}
|
|
@@ -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,
|
|
8
|
+
import { Addr, Uint256, PubKey, RoundInfo, VotingTime, WhitelistBase, ValidatorSet, CircuitChargeConfig, AdminResponse, String, Boolean } from './Registry.types';
|
|
9
9
|
export interface RegistryReadOnlyInterface {
|
|
10
10
|
contractAddress: string;
|
|
11
11
|
admin: () => Promise<AdminResponse>;
|
|
@@ -26,6 +26,7 @@ export interface RegistryReadOnlyInterface {
|
|
|
26
26
|
getMaciOperatorIdentity: ({ address }: {
|
|
27
27
|
address: Addr;
|
|
28
28
|
}) => Promise<String>;
|
|
29
|
+
getCircuitChargeConfig: () => Promise<CircuitChargeConfig>;
|
|
29
30
|
}
|
|
30
31
|
export declare class RegistryQueryClient implements RegistryReadOnlyInterface {
|
|
31
32
|
client: CosmWasmClient;
|
|
@@ -49,6 +50,7 @@ export declare class RegistryQueryClient implements RegistryReadOnlyInterface {
|
|
|
49
50
|
getMaciOperatorIdentity: ({ address, }: {
|
|
50
51
|
address: Addr;
|
|
51
52
|
}) => Promise<String>;
|
|
53
|
+
getCircuitChargeConfig: () => Promise<CircuitChargeConfig>;
|
|
52
54
|
}
|
|
53
55
|
export interface RegistryInterface extends RegistryReadOnlyInterface {
|
|
54
56
|
contractAddress: string;
|
|
@@ -62,17 +64,18 @@ export interface RegistryInterface extends RegistryReadOnlyInterface {
|
|
|
62
64
|
setMaciOperatorIdentity: ({ identity, }: {
|
|
63
65
|
identity: string;
|
|
64
66
|
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
65
|
-
createRound: ({ certificationSystem, circuitType,
|
|
67
|
+
createRound: ({ certificationSystem, circuitType, maxVoter, operator, oracleWhitelistPubkey, preDeactivateRoot, roundInfo, voiceCreditAmount, voteOptionMap, votingTime, whitelist, }: {
|
|
66
68
|
certificationSystem: Uint256;
|
|
67
69
|
circuitType: Uint256;
|
|
68
|
-
maxOption: Uint256;
|
|
69
70
|
maxVoter: Uint256;
|
|
70
71
|
operator: Addr;
|
|
72
|
+
oracleWhitelistPubkey?: string;
|
|
71
73
|
preDeactivateRoot: Uint256;
|
|
72
74
|
roundInfo: RoundInfo;
|
|
73
75
|
voiceCreditAmount: Uint256;
|
|
76
|
+
voteOptionMap: string[];
|
|
74
77
|
votingTime: VotingTime;
|
|
75
|
-
whitelist?:
|
|
78
|
+
whitelist?: WhitelistBase;
|
|
76
79
|
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
77
80
|
setValidators: ({ addresses, }: {
|
|
78
81
|
addresses: ValidatorSet;
|
|
@@ -86,6 +89,9 @@ export interface RegistryInterface extends RegistryReadOnlyInterface {
|
|
|
86
89
|
changeOperator: ({ address, }: {
|
|
87
90
|
address: Addr;
|
|
88
91
|
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
92
|
+
changeChargeConfig: ({ config, }: {
|
|
93
|
+
config: CircuitChargeConfig;
|
|
94
|
+
}, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
89
95
|
}
|
|
90
96
|
export declare class RegistryClient extends RegistryQueryClient implements RegistryInterface {
|
|
91
97
|
client: SigningCosmWasmClient;
|
|
@@ -101,17 +107,18 @@ export declare class RegistryClient extends RegistryQueryClient implements Regis
|
|
|
101
107
|
setMaciOperatorIdentity: ({ identity, }: {
|
|
102
108
|
identity: string;
|
|
103
109
|
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
104
|
-
createRound: ({ certificationSystem, circuitType,
|
|
110
|
+
createRound: ({ certificationSystem, circuitType, maxVoter, operator, oracleWhitelistPubkey, preDeactivateRoot, roundInfo, voiceCreditAmount, voteOptionMap, votingTime, whitelist, }: {
|
|
105
111
|
certificationSystem: Uint256;
|
|
106
112
|
circuitType: Uint256;
|
|
107
|
-
maxOption: Uint256;
|
|
108
113
|
maxVoter: Uint256;
|
|
109
114
|
operator: Addr;
|
|
115
|
+
oracleWhitelistPubkey?: string;
|
|
110
116
|
preDeactivateRoot: Uint256;
|
|
111
117
|
roundInfo: RoundInfo;
|
|
112
118
|
voiceCreditAmount: Uint256;
|
|
119
|
+
voteOptionMap: string[];
|
|
113
120
|
votingTime: VotingTime;
|
|
114
|
-
whitelist?:
|
|
121
|
+
whitelist?: WhitelistBase;
|
|
115
122
|
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
116
123
|
setValidators: ({ addresses, }: {
|
|
117
124
|
addresses: ValidatorSet;
|
|
@@ -125,4 +132,7 @@ export declare class RegistryClient extends RegistryQueryClient implements Regis
|
|
|
125
132
|
changeOperator: ({ address, }: {
|
|
126
133
|
address: Addr;
|
|
127
134
|
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
135
|
+
changeChargeConfig: ({ config, }: {
|
|
136
|
+
config: CircuitChargeConfig;
|
|
137
|
+
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
|
|
128
138
|
}
|
|
@@ -25,14 +25,15 @@ export type ExecuteMsg = {
|
|
|
25
25
|
create_round: {
|
|
26
26
|
certification_system: Uint256;
|
|
27
27
|
circuit_type: Uint256;
|
|
28
|
-
max_option: Uint256;
|
|
29
28
|
max_voter: Uint256;
|
|
30
29
|
operator: Addr;
|
|
30
|
+
oracle_whitelist_pubkey?: string | null;
|
|
31
31
|
pre_deactivate_root: Uint256;
|
|
32
32
|
round_info: RoundInfo;
|
|
33
33
|
voice_credit_amount: Uint256;
|
|
34
|
+
vote_option_map: string[];
|
|
34
35
|
voting_time: VotingTime;
|
|
35
|
-
whitelist?:
|
|
36
|
+
whitelist?: WhitelistBase | null;
|
|
36
37
|
};
|
|
37
38
|
} | {
|
|
38
39
|
set_validators: {
|
|
@@ -50,10 +51,15 @@ export type ExecuteMsg = {
|
|
|
50
51
|
change_operator: {
|
|
51
52
|
address: Addr;
|
|
52
53
|
};
|
|
54
|
+
} | {
|
|
55
|
+
change_charge_config: {
|
|
56
|
+
config: CircuitChargeConfig;
|
|
57
|
+
};
|
|
53
58
|
};
|
|
54
59
|
export type Uint256 = string;
|
|
55
60
|
export type Timestamp = Uint64;
|
|
56
61
|
export type Uint64 = string;
|
|
62
|
+
export type Decimal = string;
|
|
57
63
|
export interface PubKey {
|
|
58
64
|
x: Uint256;
|
|
59
65
|
y: Uint256;
|
|
@@ -67,15 +73,18 @@ export interface VotingTime {
|
|
|
67
73
|
end_time: Timestamp;
|
|
68
74
|
start_time: Timestamp;
|
|
69
75
|
}
|
|
70
|
-
export interface
|
|
71
|
-
users:
|
|
76
|
+
export interface WhitelistBase {
|
|
77
|
+
users: WhitelistBaseConfig[];
|
|
72
78
|
}
|
|
73
|
-
export interface
|
|
79
|
+
export interface WhitelistBaseConfig {
|
|
74
80
|
addr: Addr;
|
|
75
81
|
}
|
|
76
82
|
export interface ValidatorSet {
|
|
77
83
|
addresses: Addr[];
|
|
78
84
|
}
|
|
85
|
+
export interface CircuitChargeConfig {
|
|
86
|
+
fee_rate: Decimal;
|
|
87
|
+
}
|
|
79
88
|
export type QueryMsg = {
|
|
80
89
|
admin: {};
|
|
81
90
|
} | {
|
|
@@ -102,6 +111,8 @@ export type QueryMsg = {
|
|
|
102
111
|
get_maci_operator_identity: {
|
|
103
112
|
address: Addr;
|
|
104
113
|
};
|
|
114
|
+
} | {
|
|
115
|
+
get_circuit_charge_config: {};
|
|
105
116
|
};
|
|
106
117
|
export interface AdminResponse {
|
|
107
118
|
admin: Addr;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OfflineSigner } from '@cosmjs/proto-signing';
|
|
2
2
|
import { StdFee } from '@cosmjs/amino';
|
|
3
|
-
import {
|
|
3
|
+
import { WhitelistBase as RegistryWhitelist } from './ts/Registry.types';
|
|
4
4
|
import { Whitelist as MaciWhitelist } from './ts/Maci.types';
|
|
5
5
|
import { MaciCircuitType, MaciCertSystemType, CertificateEcosystem } from '../../types';
|
|
6
6
|
export type CreateRoundParams = {
|
|
@@ -15,11 +15,12 @@ export type CreateRoundParams = {
|
|
|
15
15
|
};
|
|
16
16
|
export type CreateAMaciRoundParams = {
|
|
17
17
|
maxVoter: number;
|
|
18
|
-
|
|
18
|
+
voteOptionMap: string[];
|
|
19
19
|
operator: string;
|
|
20
|
-
whitelist
|
|
20
|
+
whitelist?: RegistryWhitelist;
|
|
21
21
|
voiceCreditAmount: string;
|
|
22
22
|
preDeactivateRoot?: string;
|
|
23
|
+
oracleWhitelistPubkey?: string;
|
|
23
24
|
} & CreateRoundParams;
|
|
24
25
|
export type CreateMaciRoundParams = {
|
|
25
26
|
maxVoter: number;
|
|
@@ -48,3 +49,14 @@ export type CreateSaasOracleMaciRoundParams = {
|
|
|
48
49
|
gasStation?: boolean;
|
|
49
50
|
fee?: StdFee | 'auto' | number;
|
|
50
51
|
} & CreateRoundParams;
|
|
52
|
+
export type CreateApiSaasAmaciRoundParams = {
|
|
53
|
+
maxVoter: number;
|
|
54
|
+
voteOptionMap: string[];
|
|
55
|
+
operator: string;
|
|
56
|
+
whitelist?: RegistryWhitelist;
|
|
57
|
+
voiceCreditAmount: string;
|
|
58
|
+
preDeactivateRoot?: string;
|
|
59
|
+
oracleWhitelistPubkey?: string;
|
|
60
|
+
gasStation?: boolean;
|
|
61
|
+
fee?: StdFee | 'auto' | number;
|
|
62
|
+
} & CreateRoundParams;
|
|
@@ -3,4 +3,6 @@ type MixedData<T> = T | Array<MixedData<T>> | {
|
|
|
3
3
|
};
|
|
4
4
|
export declare const stringizing: (o: MixedData<bigint>, path?: MixedData<bigint>[]) => MixedData<string>;
|
|
5
5
|
export declare const bigInt2Buffer: (i: bigint) => Buffer<ArrayBuffer>;
|
|
6
|
+
export declare const buffer2Bigint: (buffer: Buffer | Uint8Array) => bigint;
|
|
7
|
+
export declare const destringizing: (o: MixedData<string>, path?: MixedData<string>[]) => MixedData<bigint>;
|
|
6
8
|
export {};
|
package/dist/libs/maci/maci.d.ts
CHANGED
|
@@ -103,10 +103,23 @@ export declare class MACI {
|
|
|
103
103
|
contractAddress: string;
|
|
104
104
|
maciKeypair?: Keypair;
|
|
105
105
|
oracleCertificate?: {
|
|
106
|
-
amount
|
|
106
|
+
amount?: string;
|
|
107
|
+
signature: string;
|
|
108
|
+
};
|
|
109
|
+
gasStation?: boolean;
|
|
110
|
+
fee?: StdFee | 'auto' | number;
|
|
111
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
112
|
+
rawSignup({ signer, address, contractAddress, pubKey, oracleCertificate, gasStation, granter, fee, }: {
|
|
113
|
+
signer: OfflineSigner;
|
|
114
|
+
address?: string;
|
|
115
|
+
contractAddress: string;
|
|
116
|
+
pubKey: PubKey;
|
|
117
|
+
oracleCertificate?: {
|
|
118
|
+
amount?: string;
|
|
107
119
|
signature: string;
|
|
108
120
|
};
|
|
109
121
|
gasStation?: boolean;
|
|
122
|
+
granter?: string;
|
|
110
123
|
fee?: StdFee | 'auto' | number;
|
|
111
124
|
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
112
125
|
private processVoteOptions;
|
|
@@ -123,7 +136,20 @@ export declare class MACI {
|
|
|
123
136
|
gasStation?: boolean;
|
|
124
137
|
fee?: StdFee | 'auto' | number;
|
|
125
138
|
}): Promise<import("@cosmjs/cosmwasm-stargate").DeliverTxResponse>;
|
|
126
|
-
|
|
139
|
+
rawVote({ signer, address, contractAddress, pubKey, payload, gasStation, granter, fee, }: {
|
|
140
|
+
signer: OfflineSigner;
|
|
141
|
+
address?: string;
|
|
142
|
+
contractAddress: string;
|
|
143
|
+
pubKey: PubKey;
|
|
144
|
+
payload: {
|
|
145
|
+
msg: bigint[];
|
|
146
|
+
encPubkeys: PubKey;
|
|
147
|
+
}[];
|
|
148
|
+
gasStation?: boolean;
|
|
149
|
+
granter?: string;
|
|
150
|
+
fee?: StdFee | 'auto' | number;
|
|
151
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").DeliverTxResponse>;
|
|
152
|
+
publishMessage({ client, address, payload, contractAddress, gasStation, granter, fee, }: {
|
|
127
153
|
client: SigningCosmWasmClient;
|
|
128
154
|
address: string;
|
|
129
155
|
payload: {
|
|
@@ -132,17 +158,20 @@ export declare class MACI {
|
|
|
132
158
|
}[];
|
|
133
159
|
contractAddress: string;
|
|
134
160
|
gasStation: boolean;
|
|
161
|
+
granter?: string;
|
|
135
162
|
fee?: StdFee | 'auto' | number;
|
|
136
163
|
}): Promise<import("@cosmjs/cosmwasm-stargate").DeliverTxResponse>;
|
|
137
|
-
signupSimple({ client, address, pubKey, contractAddress, gasStation, fee, }: {
|
|
164
|
+
signupSimple({ client, address, pubKey, contractAddress, certificate, gasStation, granter, fee, }: {
|
|
138
165
|
client: SigningCosmWasmClient;
|
|
139
166
|
address: string;
|
|
140
167
|
pubKey: PubKey;
|
|
141
168
|
contractAddress: string;
|
|
169
|
+
certificate?: string;
|
|
142
170
|
gasStation?: boolean;
|
|
171
|
+
granter?: string;
|
|
143
172
|
fee?: StdFee | 'auto' | number;
|
|
144
173
|
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
145
|
-
signupOracle({ client, address, pubKey, contractAddress, oracleCertificate, gasStation, fee, }: {
|
|
174
|
+
signupOracle({ client, address, pubKey, contractAddress, oracleCertificate, gasStation, granter, fee, }: {
|
|
146
175
|
client: SigningCosmWasmClient;
|
|
147
176
|
address: string;
|
|
148
177
|
pubKey: PubKey;
|
|
@@ -152,6 +181,7 @@ export declare class MACI {
|
|
|
152
181
|
signature: string;
|
|
153
182
|
};
|
|
154
183
|
gasStation?: boolean;
|
|
184
|
+
granter?: string;
|
|
155
185
|
fee?: StdFee | 'auto' | number;
|
|
156
186
|
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
157
187
|
deactivate({ signer, address, maciKeypair, contractAddress, gasStation, fee, }: {
|
package/dist/maci.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientParams, CertificateEcosystem } from './types';
|
|
2
2
|
import { Http, Indexer, Contract, OracleCertificate, MACI } from './libs';
|
|
3
|
-
import { CreateAMaciRoundParams, CreateMaciRoundParams, CreateOracleMaciRoundParams, CreateSaasOracleMaciRoundParams } from './libs/contract/types';
|
|
3
|
+
import { CreateAMaciRoundParams, CreateApiSaasAmaciRoundParams, CreateMaciRoundParams, CreateOracleMaciRoundParams, CreateSaasOracleMaciRoundParams } from './libs/contract/types';
|
|
4
4
|
import { OfflineSigner } from '@cosmjs/proto-signing';
|
|
5
5
|
import { Keypair, PubKey } from './libs/crypto';
|
|
6
6
|
import { OracleWhitelistConfig } from './libs/contract/ts/OracleMaci.types';
|
|
@@ -19,9 +19,9 @@ export declare class MaciClient {
|
|
|
19
19
|
certificateApiEndpoint: string;
|
|
20
20
|
registryAddress: string;
|
|
21
21
|
saasAddress: string;
|
|
22
|
+
apiSaasAddress: string;
|
|
22
23
|
maciCodeId: number;
|
|
23
24
|
oracleCodeId: number;
|
|
24
|
-
saasOracleCodeId: number;
|
|
25
25
|
feegrantOperator: string;
|
|
26
26
|
whitelistBackendPubkey: string;
|
|
27
27
|
http: Http;
|
|
@@ -35,7 +35,7 @@ export declare class MaciClient {
|
|
|
35
35
|
* @constructor
|
|
36
36
|
* @param {ClientParams} params - The parameters for the Maci Client instance.
|
|
37
37
|
*/
|
|
38
|
-
constructor({ signer, network, rpcEndpoint, restEndpoint, apiEndpoint, registryAddress, saasAddress, maciCodeId, oracleCodeId,
|
|
38
|
+
constructor({ signer, network, rpcEndpoint, restEndpoint, apiEndpoint, registryAddress, saasAddress, apiSaasAddress, maciCodeId, oracleCodeId, customFetch, defaultOptions, feegrantOperator, whitelistBackendPubkey, certificateApiEndpoint, maciKeypair, }: ClientParams);
|
|
39
39
|
getSigner(signer?: OfflineSigner): OfflineSigner;
|
|
40
40
|
getMaciKeypair(): Keypair;
|
|
41
41
|
getMaciPubkey(): bigint;
|
|
@@ -78,6 +78,24 @@ export declare class MaciClient {
|
|
|
78
78
|
gasWanted: bigint;
|
|
79
79
|
gasUsed: bigint;
|
|
80
80
|
}>;
|
|
81
|
+
createApiSaasMaciRound(params: CreateSaasOracleMaciRoundParams): Promise<{
|
|
82
|
+
contractAddress: string;
|
|
83
|
+
logs: readonly import("@cosmjs/stargate/build/logs").Log[];
|
|
84
|
+
height: number;
|
|
85
|
+
transactionHash: string;
|
|
86
|
+
events: readonly import("@cosmjs/stargate").Event[];
|
|
87
|
+
gasWanted: bigint;
|
|
88
|
+
gasUsed: bigint;
|
|
89
|
+
}>;
|
|
90
|
+
createApiSaasAmaciRound(params: CreateApiSaasAmaciRoundParams): Promise<{
|
|
91
|
+
contractAddress: string;
|
|
92
|
+
logs: readonly import("@cosmjs/stargate/build/logs").Log[];
|
|
93
|
+
height: number;
|
|
94
|
+
transactionHash: string;
|
|
95
|
+
events: readonly import("@cosmjs/stargate").Event[];
|
|
96
|
+
gasWanted: bigint;
|
|
97
|
+
gasUsed: bigint;
|
|
98
|
+
}>;
|
|
81
99
|
genKeypairFromSign({ signer, address, }?: {
|
|
82
100
|
signer?: OfflineSigner;
|
|
83
101
|
address?: string;
|
|
@@ -251,4 +269,30 @@ export declare class MaciClient {
|
|
|
251
269
|
address?: string;
|
|
252
270
|
fee?: number | StdFee | 'auto';
|
|
253
271
|
}): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
272
|
+
rawSignup({ signer, address, contractAddress, pubKey, oracleCertificate, gasStation, granter, fee, }: {
|
|
273
|
+
signer?: OfflineSigner;
|
|
274
|
+
address?: string;
|
|
275
|
+
contractAddress: string;
|
|
276
|
+
pubKey: PubKey;
|
|
277
|
+
oracleCertificate?: {
|
|
278
|
+
amount: string;
|
|
279
|
+
signature: string;
|
|
280
|
+
};
|
|
281
|
+
gasStation?: boolean;
|
|
282
|
+
granter?: string;
|
|
283
|
+
fee?: StdFee;
|
|
284
|
+
}): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
|
|
285
|
+
rawVote({ signer, address, contractAddress, pubKey, payload, gasStation, granter, fee, }: {
|
|
286
|
+
signer?: OfflineSigner;
|
|
287
|
+
address?: string;
|
|
288
|
+
contractAddress: string;
|
|
289
|
+
pubKey: PubKey;
|
|
290
|
+
payload: {
|
|
291
|
+
msg: bigint[];
|
|
292
|
+
encPubkeys: PubKey;
|
|
293
|
+
}[];
|
|
294
|
+
gasStation?: boolean;
|
|
295
|
+
granter?: string;
|
|
296
|
+
fee?: StdFee | 'auto' | number;
|
|
297
|
+
}): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
254
298
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -26,9 +26,9 @@ export type ClientParams = {
|
|
|
26
26
|
certificateApiEndpoint?: string;
|
|
27
27
|
registryAddress?: string;
|
|
28
28
|
saasAddress?: string;
|
|
29
|
+
apiSaasAddress?: string;
|
|
29
30
|
maciCodeId?: number;
|
|
30
31
|
oracleCodeId?: number;
|
|
31
|
-
saasOracleCodeId?: number;
|
|
32
32
|
customFetch?: typeof fetch;
|
|
33
33
|
defaultOptions?: FetchOptions;
|
|
34
34
|
feegrantOperator?: string;
|
|
@@ -42,9 +42,9 @@ export type ContractParams = {
|
|
|
42
42
|
rpcEndpoint: string;
|
|
43
43
|
registryAddress: string;
|
|
44
44
|
saasAddress: string;
|
|
45
|
+
apiSaasAddress: string;
|
|
45
46
|
maciCodeId: number;
|
|
46
47
|
oracleCodeId: number;
|
|
47
|
-
saasOracleCodeId: number;
|
|
48
48
|
whitelistBackendPubkey: string;
|
|
49
49
|
feegrantOperator: string;
|
|
50
50
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -23,6 +23,10 @@ export type * from './types';
|
|
|
23
23
|
export { circuits, getDefaultParams, type NetworkConfig } from './libs/const';
|
|
24
24
|
|
|
25
25
|
// Utils
|
|
26
|
-
export {
|
|
26
|
+
export {
|
|
27
|
+
stringizing,
|
|
28
|
+
destringizing,
|
|
29
|
+
bigInt2Buffer,
|
|
30
|
+
} from './libs/crypto/bigintUtils';
|
|
27
31
|
export { isValidAddress } from './utils';
|
|
28
32
|
export { getAMaciRoundCircuitFee } from './libs/contract/utils';
|