abstract_sdk/
feature_objects.rs1pub use abstract_std::objects::{ans_host::AnsHost, registry::RegistryContract};
8use abstract_std::{registry::Account, ANS_HOST, REGISTRY};
9use cosmwasm_std::Deps;
10
11use crate::{
12 features::{AccountIdentification, ModuleIdentification},
13 std::ACCOUNT,
14 AbstractSdkResult,
15};
16
17impl AccountIdentification for Account {
18 fn account(&self, _deps: Deps) -> AbstractSdkResult<Account> {
19 Ok(self.clone())
20 }
21}
22
23impl ModuleIdentification for Account {
24 fn module_id(&self) -> &'static str {
25 ACCOUNT
26 }
27}
28
29impl crate::features::AbstractRegistryAccess for RegistryContract {
30 fn abstract_registry(&self, _deps: Deps) -> AbstractSdkResult<RegistryContract> {
31 Ok(self.clone())
32 }
33}
34
35impl ModuleIdentification for RegistryContract {
36 fn module_id(&self) -> abstract_std::objects::module::ModuleId<'static> {
37 REGISTRY
38 }
39}
40
41impl crate::features::AbstractNameService for AnsHost {
42 fn ans_host(&self, _deps: Deps) -> AbstractSdkResult<AnsHost> {
43 Ok(self.clone())
44 }
45}
46
47impl ModuleIdentification for AnsHost {
48 fn module_id(&self) -> abstract_std::objects::module::ModuleId<'static> {
49 ANS_HOST
50 }
51}
52
53#[cfg(test)]
54mod tests {
55 use abstract_testing::prelude::*;
56 use cosmwasm_std::testing::mock_dependencies;
57
58 use super::*;
59
60 mod registry {
61
62 use super::*;
63 use crate::features::AbstractRegistryAccess;
64
65 #[coverage_helper::test]
66 fn test_registry() {
67 let mut deps = mock_dependencies();
68 deps.querier = abstract_mock_querier(deps.api);
69 let registry = RegistryContract::new(deps.as_ref(), 1).unwrap();
70
71 assert_eq!(registry.abstract_registry(deps.as_ref()).unwrap(), registry);
72 assert_eq!(registry.module_id(), REGISTRY);
73 }
74 }
75
76 mod ans {
77
78 use abstract_std::ANS_HOST;
79
80 use super::*;
81 use crate::features::AbstractNameService;
82
83 #[coverage_helper::test]
84 fn test_ans() {
85 let mut deps = mock_dependencies();
86 deps.querier = abstract_mock_querier(deps.api);
87 let ans = AnsHost::new(deps.as_ref(), 1).unwrap();
88
89 assert_eq!(ans.ans_host(deps.as_ref()).unwrap(), ans);
90 assert_eq!(ans.module_id(), ANS_HOST);
91 }
92 }
93
94 mod account {
95 use super::*;
96
97 #[coverage_helper::test]
98 fn test_account_object() {
99 let deps = mock_dependencies();
100 let account = test_account(deps.api);
101
102 assert_eq!(account.account(deps.as_ref()).unwrap(), account);
103 assert_eq!(account.module_id(), ACCOUNT);
104 }
105 }
106}