vectis_wallet/interface/
wallet.rs1use crate::types::wallet::WalletInfo;
2use cosmwasm_std::{Binary, CosmosMsg, Response, StdError};
3use sylvia::types::{ExecCtx, QueryCtx};
4use sylvia::{interface, schemars};
5
6pub mod wallet_trait {
7 use super::*;
8 use crate::types::wallet::{Controller, RelayTransaction};
9
10 #[interface]
12 pub trait WalletTrait {
13 type Error: From<StdError>;
14
15 #[msg(query)]
17 fn info(&self, ctx: QueryCtx) -> Result<WalletInfo, StdError>;
18
19 #[msg(query)]
21 fn data(&self, ctx: QueryCtx, key: Binary) -> Result<Option<Binary>, StdError>;
22
23 #[msg(exec)]
25 fn controller_rotation(
26 &self,
27 ctx: ExecCtx,
28 new_controller: Controller,
29 ) -> Result<Response, Self::Error>;
30
31 #[msg(exec)]
34 fn auth_exec(
35 &self,
36 ctx: ExecCtx,
37 transaction: RelayTransaction,
38 ) -> Result<Response, Self::Error>;
39
40 #[msg(exec)]
44 fn auth_exec_without_plugins(
45 &self,
46 ctx: ExecCtx,
47 transaction: RelayTransaction,
48 ) -> Result<Response, Self::Error>;
49
50 #[msg(exec)]
53 fn controller_nonce_update(&self, ctx: ExecCtx) -> Result<Response, Self::Error>;
54
55 #[msg(exec)]
58 fn update_data(
59 &self,
60 ctx: ExecCtx,
61 data: Vec<(Binary, Option<Binary>)>,
63 ) -> Result<Response, Self::Error>;
64 }
65}
66
67pub mod wallet_plugin_trait {
68 use crate::types::plugin::{
69 PluginInstallParams, PluginListResponse, PluginMigrateParams, PluginPermission,
70 };
71
72 use super::*;
73
74 #[interface]
76 pub trait WalletPluginTrait {
77 type Error: From<StdError>;
78
79 #[msg(query)]
81 fn plugins(
82 &self,
83 ctx: QueryCtx,
84 ty: PluginPermission,
85 start_after: Option<String>,
86 limit: Option<u32>,
87 ) -> Result<PluginListResponse, StdError>;
88
89 #[msg(exec)]
90 fn plugin_execute(
91 &self,
92 ctx: ExecCtx,
93 msg: Vec<CosmosMsg>,
94 ) -> Result<Response, Self::Error>;
95
96 #[msg(exec)]
97 fn install_plugins(
98 &self,
99 ctx: ExecCtx,
100 install: Vec<PluginInstallParams>,
101 ) -> Result<Response, Self::Error>;
102
103 #[msg(exec)]
104 fn update_plugins(
105 &self,
106 ctx: ExecCtx,
107 migrate: Vec<PluginMigrateParams>,
108 ) -> Result<Response, Self::Error>;
109
110 #[msg(exec)]
113 fn remove_plugins(
114 &self,
115 ctx: ExecCtx,
116 plugin_addrs: Vec<String>,
117 ) -> Result<Response, Self::Error>;
118 }
119}