vectis_wallet/interface/
factory.rs1use crate::types::factory::CodeIdType;
2use cosmwasm_std::{Addr, Binary, Coin, Response, StdError};
3use cw2::ContractVersion;
4use sylvia::types::{ExecCtx, QueryCtx};
5use sylvia::{interface, schemars};
6
7pub mod factory_service_trait {
8 use crate::types::factory::{CreateWalletMsg, MigrateWalletMsg};
9 use sylvia::types::ExecCtx;
10
11 use super::*;
12
13 #[interface]
15 pub trait FactoryServiceTrait {
16 type Error: From<StdError>;
17
18 #[msg(exec)]
19 fn create_wallet(
20 &self,
21 ctx: ExecCtx,
22 create_wallet_msg: CreateWalletMsg,
23 ) -> Result<Response, Self::Error>;
24
25 #[msg(exec)]
26 fn migrate_wallet(
27 &self,
28 ctx: ExecCtx,
29 migrations_msg: MigrateWalletMsg,
30 ) -> Result<Response, Self::Error>;
31
32 #[msg(query)]
34 fn wallet_by_vid(&self, ctx: QueryCtx, vid: String) -> Result<Option<Addr>, StdError>;
35
36 #[msg(query)]
38 fn wallet_by_vid_chain(
39 &self,
40 ctx: QueryCtx,
41 vid: String,
42 chain_id: String,
43 ) -> Result<Option<String>, StdError>;
44 }
45}
46
47pub mod factory_management_trait {
48
49 use super::*;
50 use crate::types::{
51 authenticator::AuthenticatorType,
52 factory::{ChainConnection, FeeType, FeesResponse},
53 };
54
55 #[interface]
57 pub trait FactoryManagementTrait {
58 type Error: From<StdError>;
59
60 #[msg(exec)]
64 fn update_code_id(
65 &self,
66 ctx: ExecCtx,
67 ty: CodeIdType,
68 code_id: u64,
69 version: Option<String>,
70 set_as_default: bool,
71 ) -> Result<Response, Self::Error>;
72
73 #[msg(exec)]
75 fn update_config_fee(
76 &self,
77 ctx: ExecCtx,
78 ty: FeeType,
79 new_fee: Coin,
80 ) -> Result<Response, Self::Error>;
81
82 #[msg(exec)]
84 fn update_supported_interchain(
85 &self,
86 ctx: ExecCtx,
87 chain_id: String,
88 chain_connection: Option<ChainConnection>,
89 ) -> Result<Response, Self::Error>;
90
91 #[msg(exec)]
93 fn update_deployer(&self, ctx: ExecCtx, addr: String) -> Result<Response, Self::Error>;
94
95 #[msg(exec)]
97 fn update_wallet_creator(
98 &self,
99 ctx: ExecCtx,
100 addr: String,
101 ) -> Result<Response, Self::Error>;
102
103 #[msg(exec)]
108 fn update_auth_provider(
109 &self,
110 ctx: ExecCtx,
111 ty: AuthenticatorType,
112 new_code_id: Option<u64>,
113 new_inst_msg: Option<Binary>,
114 ) -> Result<Response, Self::Error>;
115
116 #[msg(query)]
118 fn total_created(&self, ctx: QueryCtx) -> Result<u64, StdError>;
119
120 #[msg(query)]
122 fn default_proxy_code_id(&self, ctx: QueryCtx) -> Result<u64, StdError>;
123
124 #[msg(query)]
126 fn deployer(&self, ctx: QueryCtx) -> Result<Addr, StdError>;
127
128 #[msg(query)]
130 fn wallet_creator(&self, ctx: QueryCtx) -> Result<Addr, StdError>;
131
132 #[msg(query)]
134 fn supported_chains(
135 &self,
136 ctx: QueryCtx,
137 start_after: Option<String>,
138 limit: Option<u32>,
139 ) -> Result<Vec<(String, ChainConnection)>, StdError>;
140
141 #[msg(query)]
143 fn supported_proxies(
144 &self,
145 ctx: QueryCtx,
146 start_after: Option<u64>,
147 limit: Option<u32>,
148 ) -> Result<Vec<(u64, String)>, StdError>;
149
150 #[msg(query)]
152 fn fees(&self, ctx: QueryCtx) -> Result<FeesResponse, StdError>;
153
154 #[msg(query)]
156 fn auth_provider_addr(
157 &self,
158 ctx: QueryCtx,
159 ty: AuthenticatorType,
160 ) -> Result<Option<Addr>, StdError>;
161
162 #[msg(query)]
163 fn contract_version(&self, ctx: QueryCtx) -> Result<ContractVersion, StdError>;
164 }
165}