@dorafactory/maci-sdk 0.1.1 → 0.1.2-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.
@@ -109,10 +109,13 @@ export interface NetworkConfig {
109
109
  apiEndpoint: string;
110
110
  certificateApiEndpoint: string;
111
111
  registryAddress: string;
112
+ saasAddress: string;
112
113
  maciCodeId: number;
113
114
  oracleCodeId: number;
115
+ saasCodeId: number;
114
116
  oracleWhitelistBackendPubkey: string;
115
117
  oracleFeegrantOperator: string;
116
118
  oracleCodeIds: string[];
119
+ saasCodeIds: string[];
117
120
  }
118
121
  export declare function getDefaultParams(network?: 'mainnet' | 'testnet'): NetworkConfig;
@@ -5,6 +5,7 @@ import { MaciClient } from './ts/Maci.client';
5
5
  import { AMaciClient } from './ts/AMaci.client';
6
6
  import { RegistryClient } from './ts/Registry.client';
7
7
  import { OracleMaciClient } from './ts/OracleMaci.client';
8
+ import { SaasClient } from './ts/Saas.client';
8
9
  export declare function createMaciClientBy({ rpcEndpoint, wallet, contractAddress, }: {
9
10
  rpcEndpoint: string;
10
11
  wallet: OfflineSigner;
@@ -20,6 +21,11 @@ export declare function createRegistryClientBy({ rpcEndpoint, wallet, contractAd
20
21
  wallet: OfflineSigner;
21
22
  contractAddress: string;
22
23
  }): Promise<RegistryClient>;
24
+ export declare function createSaasClientBy({ rpcEndpoint, wallet, contractAddress, }: {
25
+ rpcEndpoint: string;
26
+ wallet: OfflineSigner;
27
+ contractAddress: string;
28
+ }): Promise<SaasClient>;
23
29
  export declare function createOracleMaciClientBy({ rpcEndpoint, wallet, contractAddress, }: {
24
30
  rpcEndpoint: string;
25
31
  wallet: OfflineSigner;
@@ -1,16 +1,19 @@
1
1
  import { OfflineSigner } from '@cosmjs/proto-signing';
2
2
  import { ContractParams } from '../../types';
3
- import { CreateAMaciRoundParams, CreateMaciRoundParams, CreateOracleMaciRoundParams } from './types';
3
+ import { CreateAMaciRoundParams, CreateMaciRoundParams, CreateOracleMaciRoundParams, CreateSaasOracleMaciRoundParams } from './types';
4
+ import { StdFee } from '@cosmjs/stargate';
4
5
  export declare const prefix = "dora";
5
6
  export declare class Contract {
6
7
  network: 'mainnet' | 'testnet';
7
8
  rpcEndpoint: string;
8
9
  registryAddress: string;
10
+ saasAddress: string;
9
11
  maciCodeId: number;
10
12
  oracleCodeId: number;
13
+ saasOracleCodeId: number;
11
14
  feegrantOperator: string;
12
15
  whitelistBackendPubkey: string;
13
- constructor({ network, rpcEndpoint, registryAddress, maciCodeId, oracleCodeId, feegrantOperator, whitelistBackendPubkey, }: ContractParams);
16
+ constructor({ network, rpcEndpoint, registryAddress, saasAddress, maciCodeId, oracleCodeId, saasOracleCodeId, feegrantOperator, whitelistBackendPubkey, }: ContractParams);
14
17
  createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, fee, }: CreateAMaciRoundParams & {
15
18
  signer: OfflineSigner;
16
19
  }): Promise<{
@@ -25,9 +28,64 @@ export declare class Contract {
25
28
  createMaciRound({ signer, operatorPubkey, startVoting, endVoting, whitelist, title, description, link, maxVoter, maxOption, circuitType, certSystemType, fee, }: CreateMaciRoundParams & {
26
29
  signer: OfflineSigner;
27
30
  }): Promise<import("@cosmjs/cosmwasm-stargate").InstantiateResult>;
28
- createOracleMaciRound({ signer, operatorPubkey, startVoting, endVoting, title, description, link, voteOptionMap, circuitType, whitelistEcosystem, whitelistSnapshotHeight, whitelistVotingPowerArgs, fee, }: CreateOracleMaciRoundParams & {
31
+ createOracleMaciRound({ signer, operatorPubkey, startVoting, endVoting, title, description, link, maxVoter, voteOptionMap, circuitType, whitelistEcosystem, whitelistSnapshotHeight, whitelistVotingPowerArgs, whitelistBackendPubkey, feegrantOperator, fee, }: CreateOracleMaciRoundParams & {
29
32
  signer: OfflineSigner;
30
33
  }): Promise<import("@cosmjs/cosmwasm-stargate").InstantiateResult>;
34
+ createSaasOracleMaciRound({ signer, operatorPubkey, startVoting, endVoting, title, description, link, maxVoter, voteOptionMap, whitelistBackendPubkey, }: CreateSaasOracleMaciRoundParams & {
35
+ signer: OfflineSigner;
36
+ }): Promise<{
37
+ contractAddress: string;
38
+ logs: readonly import("@cosmjs/stargate/build/logs").Log[];
39
+ height: number;
40
+ transactionHash: string;
41
+ events: readonly import("@cosmjs/stargate").Event[];
42
+ gasWanted: bigint;
43
+ gasUsed: bigint;
44
+ }>;
45
+ setSaasOracleMaciRoundInfo({ signer, contractAddress, title, description, link, gasStation, fee, }: {
46
+ signer: OfflineSigner;
47
+ contractAddress: string;
48
+ title: string;
49
+ description: string;
50
+ link: string;
51
+ gasStation?: boolean;
52
+ fee?: StdFee | 'auto' | number;
53
+ }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
54
+ setSaasOracleMaciRoundVoteOptions({ signer, contractAddress, voteOptionMap, gasStation, fee, }: {
55
+ signer: OfflineSigner;
56
+ contractAddress: string;
57
+ voteOptionMap: string[];
58
+ gasStation?: boolean;
59
+ fee?: StdFee | 'auto' | number;
60
+ }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
61
+ addSaasOperator({ signer, operator, gasStation, fee, }: {
62
+ signer: OfflineSigner;
63
+ operator: string;
64
+ gasStation?: boolean;
65
+ fee?: StdFee | 'auto' | number;
66
+ }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
67
+ removeSaasOperator({ signer, operator, gasStation, fee, }: {
68
+ signer: OfflineSigner;
69
+ operator: string;
70
+ gasStation?: boolean;
71
+ fee?: StdFee | 'auto' | number;
72
+ }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
73
+ isSaasOperator({ signer, operator, }: {
74
+ signer: OfflineSigner;
75
+ operator: string;
76
+ }): Promise<boolean>;
77
+ depositSaas({ signer, amount, gasStation, fee, }: {
78
+ signer: OfflineSigner;
79
+ amount: string;
80
+ gasStation?: boolean;
81
+ fee?: StdFee | 'auto' | number;
82
+ }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
83
+ withdrawSaas({ signer, amount, gasStation, fee, }: {
84
+ signer: OfflineSigner;
85
+ amount: string;
86
+ gasStation?: boolean;
87
+ fee?: StdFee | 'auto' | number;
88
+ }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
31
89
  queryRoundInfo({ signer, roundAddress, }: {
32
90
  signer: OfflineSigner;
33
91
  roundAddress: string;
@@ -48,6 +106,10 @@ export declare class Contract {
48
106
  signer: OfflineSigner;
49
107
  contractAddress: string;
50
108
  }): Promise<import("./ts/AMaci.client").AMaciClient>;
109
+ saasClient({ signer, contractAddress, }: {
110
+ signer: OfflineSigner;
111
+ contractAddress: string;
112
+ }): Promise<import("./ts/Saas.client").SaasClient>;
51
113
  contractClient({ signer }: {
52
114
  signer: OfflineSigner;
53
115
  }): Promise<import("@cosmjs/cosmwasm-stargate").SigningCosmWasmClient>;
@@ -0,0 +1,150 @@
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, NullableMaciContractInfo, ArrayOfMaciContractInfo, ArrayOfOperatorInfo } from './Saas.types';
9
+ export interface SaasReadOnlyInterface {
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
+ maciContracts: ({ limit, startAfter, }: {
18
+ limit?: number;
19
+ startAfter?: number;
20
+ }) => Promise<ArrayOfMaciContractInfo>;
21
+ operatorMaciContracts: ({ limit, operator, startAfter, }: {
22
+ limit?: number;
23
+ operator: Addr;
24
+ startAfter?: number;
25
+ }) => Promise<ArrayOfMaciContractInfo>;
26
+ maciContract: ({ contractId, }: {
27
+ contractId: number;
28
+ }) => Promise<NullableMaciContractInfo>;
29
+ oracleMaciCodeId: () => Promise<Uint64>;
30
+ }
31
+ export declare class SaasQueryClient implements SaasReadOnlyInterface {
32
+ client: CosmWasmClient;
33
+ contractAddress: string;
34
+ constructor(client: CosmWasmClient, contractAddress: string);
35
+ config: () => Promise<Config>;
36
+ operators: () => Promise<ArrayOfOperatorInfo>;
37
+ isOperator: ({ address }: {
38
+ address: Addr;
39
+ }) => Promise<Boolean>;
40
+ balance: () => Promise<Uint128>;
41
+ maciContracts: ({ limit, startAfter, }: {
42
+ limit?: number;
43
+ startAfter?: number;
44
+ }) => Promise<ArrayOfMaciContractInfo>;
45
+ operatorMaciContracts: ({ limit, operator, startAfter, }: {
46
+ limit?: number;
47
+ operator: Addr;
48
+ startAfter?: number;
49
+ }) => Promise<ArrayOfMaciContractInfo>;
50
+ maciContract: ({ contractId, }: {
51
+ contractId: number;
52
+ }) => Promise<NullableMaciContractInfo>;
53
+ oracleMaciCodeId: () => Promise<Uint64>;
54
+ }
55
+ export interface SaasInterface extends SaasReadOnlyInterface {
56
+ contractAddress: string;
57
+ sender: string;
58
+ updateConfig: ({ admin, denom, registryContract, }: {
59
+ admin?: Addr;
60
+ denom?: string;
61
+ registryContract?: Addr;
62
+ }, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
63
+ addOperator: ({ operator, }: {
64
+ operator: Addr;
65
+ }, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
66
+ removeOperator: ({ operator, }: {
67
+ operator: Addr;
68
+ }, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
69
+ deposit: (fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
70
+ withdraw: ({ amount, recipient, }: {
71
+ amount: Uint128;
72
+ recipient?: Addr;
73
+ }, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
74
+ updateOracleMaciCodeId: ({ codeId, }: {
75
+ codeId: number;
76
+ }, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
77
+ createOracleMaciRound: ({ certificationSystem, circuitType, coordinator, endTime, maxVoters, roundInfo, startTime, voteOptionMap, whitelistBackendPubkey, }: {
78
+ certificationSystem: Uint256;
79
+ circuitType: Uint256;
80
+ coordinator: PubKey;
81
+ endTime: Timestamp;
82
+ maxVoters: number;
83
+ roundInfo: RoundInfo;
84
+ startTime: Timestamp;
85
+ voteOptionMap: string[];
86
+ whitelistBackendPubkey: string;
87
+ }, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
88
+ setRoundInfo: ({ contractAddr, roundInfo, }: {
89
+ contractAddr: string;
90
+ roundInfo: RoundInfo;
91
+ }, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
92
+ setVoteOptionsMap: ({ contractAddr, voteOptionMap, }: {
93
+ contractAddr: string;
94
+ voteOptionMap: string[];
95
+ }, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
96
+ grantToVoter: ({ baseAmount, contractAddr, grantee, }: {
97
+ baseAmount: Uint128;
98
+ contractAddr: string;
99
+ grantee: Addr;
100
+ }, fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
101
+ }
102
+ export declare class SaasClient extends SaasQueryClient implements SaasInterface {
103
+ client: SigningCosmWasmClient;
104
+ sender: string;
105
+ contractAddress: string;
106
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string);
107
+ updateConfig: ({ admin, denom, registryContract, }: {
108
+ admin?: Addr;
109
+ denom?: string;
110
+ registryContract?: Addr;
111
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
112
+ addOperator: ({ operator, }: {
113
+ operator: Addr;
114
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
115
+ removeOperator: ({ operator, }: {
116
+ operator: Addr;
117
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
118
+ deposit: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
119
+ withdraw: ({ amount, recipient, }: {
120
+ amount: Uint128;
121
+ recipient?: Addr;
122
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
123
+ updateOracleMaciCodeId: ({ codeId, }: {
124
+ codeId: number;
125
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
126
+ createOracleMaciRound: ({ certificationSystem, circuitType, coordinator, endTime, maxVoters, roundInfo, startTime, voteOptionMap, whitelistBackendPubkey, }: {
127
+ certificationSystem: Uint256;
128
+ circuitType: Uint256;
129
+ coordinator: PubKey;
130
+ endTime: Timestamp;
131
+ maxVoters: number;
132
+ roundInfo: RoundInfo;
133
+ startTime: Timestamp;
134
+ voteOptionMap: string[];
135
+ whitelistBackendPubkey: string;
136
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
137
+ setRoundInfo: ({ contractAddr, roundInfo, }: {
138
+ contractAddr: string;
139
+ roundInfo: RoundInfo;
140
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
141
+ setVoteOptionsMap: ({ contractAddr, voteOptionMap, }: {
142
+ contractAddr: string;
143
+ voteOptionMap: string[];
144
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
145
+ grantToVoter: ({ baseAmount, contractAddr, grantee, }: {
146
+ baseAmount: Uint128;
147
+ contractAddr: string;
148
+ grantee: Addr;
149
+ }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
150
+ }
@@ -0,0 +1,128 @@
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
+ oracle_maci_code_id: number;
11
+ registry_contract?: Addr | null;
12
+ }
13
+ export type ExecuteMsg = {
14
+ update_config: {
15
+ admin?: Addr | null;
16
+ denom?: string | null;
17
+ registry_contract?: Addr | null;
18
+ };
19
+ } | {
20
+ add_operator: {
21
+ operator: Addr;
22
+ };
23
+ } | {
24
+ remove_operator: {
25
+ operator: Addr;
26
+ };
27
+ } | {
28
+ deposit: {};
29
+ } | {
30
+ withdraw: {
31
+ amount: Uint128;
32
+ recipient?: Addr | null;
33
+ };
34
+ } | {
35
+ update_oracle_maci_code_id: {
36
+ code_id: number;
37
+ };
38
+ } | {
39
+ create_oracle_maci_round: {
40
+ certification_system: Uint256;
41
+ circuit_type: Uint256;
42
+ coordinator: PubKey;
43
+ end_time: Timestamp;
44
+ max_voters: number;
45
+ round_info: RoundInfo;
46
+ start_time: Timestamp;
47
+ vote_option_map: string[];
48
+ whitelist_backend_pubkey: string;
49
+ };
50
+ } | {
51
+ set_round_info: {
52
+ contract_addr: string;
53
+ round_info: RoundInfo;
54
+ };
55
+ } | {
56
+ set_vote_options_map: {
57
+ contract_addr: string;
58
+ vote_option_map: string[];
59
+ };
60
+ } | {
61
+ grant_to_voter: {
62
+ base_amount: Uint128;
63
+ contract_addr: string;
64
+ grantee: Addr;
65
+ };
66
+ };
67
+ export type Uint128 = string;
68
+ export type Uint256 = string;
69
+ export type Timestamp = Uint64;
70
+ export type Uint64 = string;
71
+ export interface PubKey {
72
+ x: Uint256;
73
+ y: Uint256;
74
+ }
75
+ export interface RoundInfo {
76
+ description: string;
77
+ link: string;
78
+ title: string;
79
+ }
80
+ export type QueryMsg = {
81
+ config: {};
82
+ } | {
83
+ operators: {};
84
+ } | {
85
+ is_operator: {
86
+ address: Addr;
87
+ };
88
+ } | {
89
+ balance: {};
90
+ } | {
91
+ maci_contracts: {
92
+ limit?: number | null;
93
+ start_after?: number | null;
94
+ };
95
+ } | {
96
+ operator_maci_contracts: {
97
+ limit?: number | null;
98
+ operator: Addr;
99
+ start_after?: number | null;
100
+ };
101
+ } | {
102
+ maci_contract: {
103
+ contract_id: number;
104
+ };
105
+ } | {
106
+ oracle_maci_code_id: {};
107
+ };
108
+ export interface Config {
109
+ admin: Addr;
110
+ denom: string;
111
+ registry_contract?: Addr | null;
112
+ }
113
+ export type Boolean = boolean;
114
+ export type NullableMaciContractInfo = MaciContractInfo | null;
115
+ export interface MaciContractInfo {
116
+ code_id: number;
117
+ contract_address: Addr;
118
+ created_at: Timestamp;
119
+ creation_fee: Uint128;
120
+ creator_operator: Addr;
121
+ round_title: string;
122
+ }
123
+ export type ArrayOfMaciContractInfo = MaciContractInfo[];
124
+ export type ArrayOfOperatorInfo = OperatorInfo[];
125
+ export interface OperatorInfo {
126
+ added_at: Timestamp;
127
+ address: Addr;
128
+ }
@@ -29,6 +29,7 @@ export type CreateMaciRoundParams = {
29
29
  certSystemType: MaciCertSystemType;
30
30
  } & CreateRoundParams;
31
31
  export type CreateOracleMaciRoundParams = {
32
+ maxVoter: number;
32
33
  voteOptionMap: string[];
33
34
  operatorPubkey: bigint | string;
34
35
  whitelistEcosystem: CertificateEcosystem;
@@ -38,4 +39,13 @@ export type CreateOracleMaciRoundParams = {
38
39
  slope: string;
39
40
  threshold: string;
40
41
  };
42
+ whitelistBackendPubkey?: string;
43
+ feegrantOperator?: string;
44
+ } & CreateRoundParams;
45
+ export type CreateSaasOracleMaciRoundParams = {
46
+ maxVoter: number;
47
+ voteOptionMap: string[];
48
+ operatorPubkey: bigint | string;
49
+ whitelistBackendPubkey?: string;
50
+ feegrantOperator?: string;
41
51
  } & CreateRoundParams;
@@ -107,10 +107,10 @@ export declare class MACI {
107
107
  signature: string;
108
108
  };
109
109
  gasStation?: boolean;
110
- fee?: StdFee;
110
+ fee?: StdFee | 'auto' | number;
111
111
  }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
112
112
  private processVoteOptions;
113
- vote({ signer, address, contractAddress, selectedOptions, operatorCoordPubKey, maciKeypair, gasStation, }: {
113
+ vote({ signer, address, contractAddress, selectedOptions, operatorCoordPubKey, maciKeypair, gasStation, fee, }: {
114
114
  signer: OfflineSigner;
115
115
  address?: string;
116
116
  contractAddress: string;
@@ -121,8 +121,9 @@ export declare class MACI {
121
121
  operatorCoordPubKey: PubKey;
122
122
  maciKeypair?: Keypair;
123
123
  gasStation?: boolean;
124
+ fee?: StdFee | 'auto' | number;
124
125
  }): Promise<import("@cosmjs/cosmwasm-stargate").DeliverTxResponse>;
125
- publishMessage({ client, address, payload, contractAddress, gasStation, }: {
126
+ publishMessage({ client, address, payload, contractAddress, gasStation, fee, }: {
126
127
  client: SigningCosmWasmClient;
127
128
  address: string;
128
129
  payload: {
@@ -131,6 +132,7 @@ export declare class MACI {
131
132
  }[];
132
133
  contractAddress: string;
133
134
  gasStation: boolean;
135
+ fee?: StdFee | 'auto' | number;
134
136
  }): Promise<import("@cosmjs/cosmwasm-stargate").DeliverTxResponse>;
135
137
  signupSimple({ client, address, pubKey, contractAddress, gasStation, fee, }: {
136
138
  client: SigningCosmWasmClient;
@@ -138,7 +140,7 @@ export declare class MACI {
138
140
  pubKey: PubKey;
139
141
  contractAddress: string;
140
142
  gasStation?: boolean;
141
- fee?: StdFee;
143
+ fee?: StdFee | 'auto' | number;
142
144
  }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
143
145
  signupOracle({ client, address, pubKey, contractAddress, oracleCertificate, gasStation, fee, }: {
144
146
  client: SigningCosmWasmClient;
@@ -150,7 +152,7 @@ export declare class MACI {
150
152
  signature: string;
151
153
  };
152
154
  gasStation?: boolean;
153
- fee?: StdFee;
155
+ fee?: StdFee | 'auto' | number;
154
156
  }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
155
157
  deactivate({ signer, address, maciKeypair, contractAddress, gasStation, fee, }: {
156
158
  signer: OfflineSigner;
@@ -158,7 +160,7 @@ export declare class MACI {
158
160
  maciKeypair?: Keypair;
159
161
  contractAddress: string;
160
162
  gasStation?: boolean;
161
- fee?: StdFee;
163
+ fee?: StdFee | 'auto' | number;
162
164
  }): Promise<import("@cosmjs/cosmwasm-stargate").ExecuteResult>;
163
165
  fetchAllDeactivateLogs({ contractAddress, }: {
164
166
  contractAddress: string;
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 } from './libs/contract/types';
3
+ import { CreateAMaciRoundParams, 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';
@@ -18,8 +18,10 @@ export declare class MaciClient {
18
18
  apiEndpoint: string;
19
19
  certificateApiEndpoint: string;
20
20
  registryAddress: string;
21
+ saasAddress: string;
21
22
  maciCodeId: number;
22
23
  oracleCodeId: number;
24
+ saasOracleCodeId: number;
23
25
  feegrantOperator: string;
24
26
  whitelistBackendPubkey: string;
25
27
  http: Http;
@@ -33,7 +35,7 @@ export declare class MaciClient {
33
35
  * @constructor
34
36
  * @param {ClientParams} params - The parameters for the Maci Client instance.
35
37
  */
36
- constructor({ signer, network, rpcEndpoint, restEndpoint, apiEndpoint, registryAddress, maciCodeId, oracleCodeId, customFetch, defaultOptions, feegrantOperator, whitelistBackendPubkey, certificateApiEndpoint, maciKeypair, }: ClientParams);
38
+ constructor({ signer, network, rpcEndpoint, restEndpoint, apiEndpoint, registryAddress, saasAddress, maciCodeId, oracleCodeId, saasOracleCodeId, customFetch, defaultOptions, feegrantOperator, whitelistBackendPubkey, certificateApiEndpoint, maciKeypair, }: ClientParams);
37
39
  getSigner(signer?: OfflineSigner): OfflineSigner;
38
40
  getMaciKeypair(): Keypair;
39
41
  getMaciPubkey(): bigint;
@@ -67,6 +69,15 @@ export declare class MaciClient {
67
69
  }>;
68
70
  createMaciRound(params: CreateMaciRoundParams): Promise<import("@cosmjs/cosmwasm-stargate").InstantiateResult>;
69
71
  createOracleMaciRound(params: CreateOracleMaciRoundParams): Promise<import("@cosmjs/cosmwasm-stargate").InstantiateResult>;
72
+ createSaasOracleMaciRound(params: CreateSaasOracleMaciRoundParams): Promise<{
73
+ contractAddress: string;
74
+ logs: readonly import("@cosmjs/stargate/build/logs").Log[];
75
+ height: number;
76
+ transactionHash: string;
77
+ events: readonly import("@cosmjs/stargate").Event[];
78
+ gasWanted: bigint;
79
+ gasUsed: bigint;
80
+ }>;
70
81
  genKeypairFromSign({ signer, address, }?: {
71
82
  signer?: OfflineSigner;
72
83
  address?: string;
@@ -25,8 +25,10 @@ export type ClientParams = {
25
25
  apiEndpoint?: string;
26
26
  certificateApiEndpoint?: string;
27
27
  registryAddress?: string;
28
+ saasAddress?: string;
28
29
  maciCodeId?: number;
29
30
  oracleCodeId?: number;
31
+ saasOracleCodeId?: number;
30
32
  customFetch?: typeof fetch;
31
33
  defaultOptions?: FetchOptions;
32
34
  feegrantOperator?: string;
@@ -39,8 +41,10 @@ export type ContractParams = {
39
41
  network: 'mainnet' | 'testnet';
40
42
  rpcEndpoint: string;
41
43
  registryAddress: string;
44
+ saasAddress: string;
42
45
  maciCodeId: number;
43
46
  oracleCodeId: number;
47
+ saasOracleCodeId: number;
44
48
  whitelistBackendPubkey: string;
45
49
  feegrantOperator: string;
46
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dorafactory/maci-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2-pre.1",
4
4
  "description": "SDK for interacting with maci",
5
5
  "keywords": [
6
6
  "maci",
package/src/libs/const.ts CHANGED
@@ -149,11 +149,14 @@ export interface NetworkConfig {
149
149
  apiEndpoint: string;
150
150
  certificateApiEndpoint: string;
151
151
  registryAddress: string;
152
+ saasAddress: string;
152
153
  maciCodeId: number;
153
154
  oracleCodeId: number;
155
+ saasCodeId: number;
154
156
  oracleWhitelistBackendPubkey: string;
155
157
  oracleFeegrantOperator: string;
156
158
  oracleCodeIds: string[];
159
+ saasCodeIds: string[];
157
160
  }
158
161
 
159
162
  export function getDefaultParams(
@@ -171,13 +174,17 @@ export function getDefaultParams(
171
174
  'https://vota-certificate-api.dorafactory.org/api/v1',
172
175
  registryAddress:
173
176
  'dora1smg5qp5trjdkcekdjssqpjehdjf6n4cjss0clyvqcud3t3u3948s8rmgg4',
177
+ saasAddress:
178
+ 'dora1dgnszrwnwxgr5djprrr6w4q45z8s3ghsew869g6tlp4ruqah39nqnemjya',
174
179
  maciCodeId: 106,
175
180
  // oracleCodeId: 116,// 9-4-3-625
176
181
  oracleCodeId: 119, // 6-3-3-125
182
+ saasCodeId: 152,
177
183
  oracleWhitelistBackendPubkey:
178
184
  'A61YtCv2ibMZmDeM02nEElil8wlHx1tLKogBk5dPgf/Q',
179
185
  oracleFeegrantOperator: 'dora16s9tljk8dy9ae335yvyzlm8gvkypx9228q8pq8',
180
186
  oracleCodeIds: ['101', '116', '117', '119'],
187
+ saasCodeIds: ['152'],
181
188
  };
182
189
  case 'testnet':
183
190
  return {
@@ -190,13 +197,17 @@ export function getDefaultParams(
190
197
  'https://vota-testnet-certificate-api.dorafactory.org/api/v1',
191
198
  registryAddress:
192
199
  'dora13c8aecstyxrhax9znvvh5zey89edrmd2k5va57pxvpe3fxtfsfeqlhsjnd',
193
- maciCodeId: 107,
200
+ saasAddress:
201
+ 'dora1dgnszrwnwxgr5djprrr6w4q45z8s3ghsew869g6tlp4ruqah39nqnemjya',
202
+ maciCodeId: 134,
194
203
  // oracleCodeId: 113, // 9-4-3-625
195
204
  oracleCodeId: 123, // 6-3-3-125
205
+ saasCodeId: 152,
196
206
  oracleWhitelistBackendPubkey:
197
207
  'AoYo/zENN/JquagPdG0/NMbWBBYxOM8BVN677mBXJKJQ',
198
208
  oracleFeegrantOperator: 'dora1xp0twdzsdeq4qg3c64v66552deax8zmvq4zw78',
199
209
  oracleCodeIds: ['102', '105', '108', '110', '113', '115', '123'],
210
+ saasCodeIds: ['152'],
200
211
  };
201
212
  }
202
213
  }
@@ -10,11 +10,12 @@ import { MaciClient } from './ts/Maci.client';
10
10
  import { AMaciClient } from './ts/AMaci.client';
11
11
  import { RegistryClient } from './ts/Registry.client';
12
12
  import { OracleMaciClient } from './ts/OracleMaci.client';
13
+ import { SaasClient } from './ts/Saas.client';
13
14
 
14
15
  const defaultSigningClientOptions: SigningStargateClientOptions = {
15
16
  broadcastPollIntervalMs: 8_000,
16
17
  broadcastTimeoutMs: 64_000,
17
- gasPrice: GasPrice.fromString('100000000000peaka'),
18
+ gasPrice: GasPrice.fromString('10000000000peaka'),
18
19
  };
19
20
 
20
21
  export async function createMaciClientBy({
@@ -68,6 +69,23 @@ export async function createRegistryClientBy({
68
69
  return new RegistryClient(signingCosmWasmClient, address, contractAddress);
69
70
  }
70
71
 
72
+ export async function createSaasClientBy({
73
+ rpcEndpoint,
74
+ wallet,
75
+ contractAddress,
76
+ }: {
77
+ rpcEndpoint: string;
78
+ wallet: OfflineSigner;
79
+ contractAddress: string;
80
+ }) {
81
+ const signingCosmWasmClient = await createContractClientByWallet(
82
+ rpcEndpoint,
83
+ wallet
84
+ );
85
+ const [{ address }] = await wallet.getAccounts();
86
+ return new SaasClient(signingCosmWasmClient, address, contractAddress);
87
+ }
88
+
71
89
  export async function createOracleMaciClientBy({
72
90
  rpcEndpoint,
73
91
  wallet,