diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b9650a8..8cb319f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -79,7 +79,7 @@ jobs: # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability strategy: matrix: - msrv: [1.72.0] # cosmrs v0.15.0 requires 1.72.0 or newer + msrv: [1.76.0] # cosmrs v0.15.0 requires 1.76.0 or newer name: ubuntu / ${{ matrix.msrv }} steps: - uses: actions/checkout@v4 diff --git a/Cargo.toml b/Cargo.toml index 5a217f9..326b59d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,31 +3,32 @@ members = ["contracts/*", "packages/ibcmail", "tests"] resolver = "2" [workspace.package] -version = "0.2.0" +version = "0.3.1" [workspace.dependencies] -cosmwasm-std = "1.5.3" -cosmwasm-schema = "1.5.3" -cw-controllers = "1.1.2" -cw-storage-plus = "1.2.0" +cosmwasm-std = { version = "2.0.7", features = ["cosmwasm_2_0"] } +cosmwasm-schema = { version = "2.0.7" } +cw-controllers = { version = "2.0.0" } +cw-storage-plus = "2.0.0" thiserror = "1.0.50" -cw-paginate = "0.2.1" +cw-paginate = "2.0.0" schemars = "0.8" -cw-asset = "3.0.0" -cw-semver = { version = "1.0", features = ["serde"] } -cw-orch = "0.24.1" +cw-asset = "4.0.0" +cw-orch = "0.26.0" +cw-orch-interchain = { version = "0.8.1" } +abstract-cw-orch-polytone = "6.0.0" ibcmail = { path = "packages/ibcmail", package = "ibcmail" } client = { path = "contracts/client", package = "ibcmail-client" } server = { path = "contracts/server", package = "ibcmail-server" } -abstract-client = "0.23.0" -abstract-app = "0.23.0" -abstract-adapter = "0.23.0" -abstract-interface = "0.23.0" +abstract-client = { version = "0.25.0", git = "https://github.com/AbstractSDK/abstract", tag = "v0.25.0" } +abstract-app = { version = "0.25.0", git = "https://github.com/AbstractSDK/abstract", tag = "v0.25.0" } +abstract-adapter = { version = "0.25.0", git = "https://github.com/AbstractSDK/abstract", tag = "v0.25.0" } +abstract-interface = { version = "0.25.0", git = "https://github.com/AbstractSDK/abstract", tag = "v0.25.0" } speculoos = "0.11.0" semver = "1.0" dotenv = "0.15.0" -env_logger = "0.10.0" +env_logger = { package = "pretty_env_logger", version = "0.5.0" } clap = "4.3.7" const_format = "0.2.32" diff --git a/artifacts/checksums.txt b/artifacts/checksums.txt new file mode 100644 index 0000000..8e2a8dd --- /dev/null +++ b/artifacts/checksums.txt @@ -0,0 +1,2 @@ +0e19c3986fb452816aabde50ee78302fbd9dc444bcb63090e43dcbb6417aa9b1 ibcmail_client.wasm +29576933ccd938bf26b4fa2837cc62b4babbe0d373429218ce81bb55a704aeb4 ibcmail_server.wasm diff --git a/artifacts/ibcmail_client.wasm b/artifacts/ibcmail_client.wasm old mode 100755 new mode 100644 index 9c345b2..dcd0be0 Binary files a/artifacts/ibcmail_client.wasm and b/artifacts/ibcmail_client.wasm differ diff --git a/artifacts/ibcmail_server.wasm b/artifacts/ibcmail_server.wasm old mode 100755 new mode 100644 index d8b46d3..bbe08ba Binary files a/artifacts/ibcmail_server.wasm and b/artifacts/ibcmail_server.wasm differ diff --git a/contracts/client/examples/local_daemon.rs b/contracts/client/examples/local_daemon.rs index 6d26fe5..534ab40 100644 --- a/contracts/client/examples/local_daemon.rs +++ b/contracts/client/examples/local_daemon.rs @@ -38,7 +38,11 @@ fn main() -> anyhow::Result<()> { // Get the [`Publisher`] that owns the namespace. // If there isn't one, it creates an Account and claims the namespace. - let publisher: Publisher<_> = abstract_client.publisher_builder(app_namespace).build()?; + let publisher_acc = abstract_client + .fetch_or_build_account(app_namespace.clone(), |builder| { + builder.namespace(app_namespace) + })?; + let publisher: Publisher<_> = Publisher::new(&publisher_acc)?; // Ensure the current sender owns the namespace if publisher.account().owner()? != daemon.sender().address() { diff --git a/contracts/client/examples/publish.rs b/contracts/client/examples/publish.rs index 31afd35..86bb2f8 100644 --- a/contracts/client/examples/publish.rs +++ b/contracts/client/examples/publish.rs @@ -8,7 +8,6 @@ //! $ just publish uni-6 osmo-test-5 //! ``` -use abstract_app::objects::module::ModuleVersion; use abstract_app::objects::namespace::Namespace; use abstract_client::{AbstractClient, Publisher}; use clap::Parser; @@ -35,7 +34,11 @@ fn publish(networks: Vec) -> anyhow::Result<()> { let abstract_client: AbstractClient = AbstractClient::new(chain.clone())?; // Get the [`Publisher`] that owns the namespace, otherwise create a new one and claim the namespace - let publisher: Publisher<_> = abstract_client.publisher_builder(app_namespace).build()?; + let publisher_acc = abstract_client + .fetch_or_build_account(app_namespace.clone(), |builder| { + builder.namespace(app_namespace) + })?; + let publisher = Publisher::new(&publisher_acc)?; if publisher.account().owner()? != chain.sender().address() { panic!("The current sender can not publish to this namespace. Please use the wallet that owns the Account that owns the Namespace.") diff --git a/contracts/client/schema/execute_msg.json b/contracts/client/schema/execute_msg.json index 4453f93..c931c57 100644 --- a/contracts/client/schema/execute_msg.json +++ b/contracts/client/schema/execute_msg.json @@ -272,7 +272,7 @@ "null" ] }, - "version_control_address": { + "registry_address": { "type": [ "string", "null" diff --git a/contracts/client/schema/instantiate_msg.json b/contracts/client/schema/instantiate_msg.json index 32ce252..28744d3 100644 --- a/contracts/client/schema/instantiate_msg.json +++ b/contracts/client/schema/instantiate_msg.json @@ -53,7 +53,7 @@ "required": [ "account_base", "ans_host_address", - "version_control_address" + "registry_address" ], "properties": { "account_base": { @@ -62,7 +62,7 @@ "ans_host_address": { "type": "string" }, - "version_control_address": { + "registry_address": { "type": "string" } }, diff --git a/contracts/client/src/dependencies.rs b/contracts/client/src/dependencies.rs index 9546150..6362574 100644 --- a/contracts/client/src/dependencies.rs +++ b/contracts/client/src/dependencies.rs @@ -1,6 +1,6 @@ use abstract_app::objects::dependency::StaticDependency; #[cfg(feature = "interface")] -use abstract_app::{objects::module::ModuleInfo, std::manager::ModuleInstallConfig}; +use abstract_app::{objects::module::ModuleInfo, std::account::ModuleInstallConfig}; use ibcmail::IBCMAIL_SERVER_ID; pub const MAIL_SERVER_DEP: StaticDependency = diff --git a/contracts/client/src/handlers/query.rs b/contracts/client/src/handlers/query.rs index 9b38d3f..67fb0e3 100644 --- a/contracts/client/src/handlers/query.rs +++ b/contracts/client/src/handlers/query.rs @@ -1,6 +1,7 @@ -use abstract_app::sdk::cw_helpers::load_many; -use cosmwasm_std::{to_json_binary, Binary, Deps, Env}; -use cw_storage_plus::Bound; +use cosmwasm_schema::serde::de::DeserializeOwned; +use cosmwasm_schema::serde::Serialize; +use cosmwasm_std::{to_json_binary, Binary, Deps, Env, StdResult, Storage}; +use cw_storage_plus::{Bound, Map, PrimaryKey}; use ibcmail::{ client::{ error::ClientError, @@ -41,6 +42,26 @@ pub fn query_handler( .map_err(Into::into) } +/// Load a batch of values by their keys from a [`Map`]. +pub fn load_many<'a, K, V>( + map: Map, + storage: &dyn Storage, + keys: Vec, +) -> StdResult> +where + K: PrimaryKey<'a>, + V: DeserializeOwned + Serialize, +{ + let mut res: Vec<(K, V)> = vec![]; + + for key in keys.into_iter() { + let value = map.load(storage, key.clone())?; + res.push((key, value)); + } + + Ok(res) +} + fn query_messages( deps: Deps, status: MessageStatus, diff --git a/contracts/server/examples/local_daemon.rs b/contracts/server/examples/local_daemon.rs index 229c5a6..cac43aa 100644 --- a/contracts/server/examples/local_daemon.rs +++ b/contracts/server/examples/local_daemon.rs @@ -38,7 +38,11 @@ fn main() -> anyhow::Result<()> { // Get the [`Publisher`] that owns the namespace. // If there isn't one, it creates an Account and claims the namespace. - let publisher: Publisher<_> = abstract_client.publisher_builder(app_namespace).build()?; + let publisher_acc = abstract_client + .fetch_or_build_account(app_namespace.clone(), |builder| { + builder.namespace(app_namespace) + })?; + let publisher: Publisher<_> = Publisher::new(&publisher_acc)?; // Ensure the current sender owns the namespace if publisher.account().owner()? != daemon.sender().address() { diff --git a/contracts/server/examples/publish.rs b/contracts/server/examples/publish.rs index b23452c..9fdf88b 100644 --- a/contracts/server/examples/publish.rs +++ b/contracts/server/examples/publish.rs @@ -34,7 +34,11 @@ fn publish(networks: Vec) -> anyhow::Result<()> { let abstract_client: AbstractClient = AbstractClient::new(chain.clone())?; // Get the [`Publisher`] that owns the namespace, otherwise create a new one and claim the namespace - let publisher: Publisher<_> = abstract_client.publisher_builder(app_namespace).build()?; + let publisher_acc = abstract_client + .fetch_or_build_account(app_namespace.clone(), |builder| { + builder.namespace(app_namespace) + })?; + let publisher = Publisher::new(&publisher_acc)?; if publisher.account().owner()? != chain.sender().address() { panic!("The current sender can not publish to this namespace. Please use the wallet that owns the Account that owns the Namespace.") diff --git a/contracts/server/schema/instantiate_msg.json b/contracts/server/schema/instantiate_msg.json index fce08a5..8d594bc 100644 --- a/contracts/server/schema/instantiate_msg.json +++ b/contracts/server/schema/instantiate_msg.json @@ -27,18 +27,18 @@ "additionalProperties": false, "definitions": { "BaseInstantiateMsg": { - "description": "Used by Abstract to instantiate the contract The contract is then registered on the version control contract using [`crate::version_control::ExecuteMsg::ProposeModules`].", + "description": "Used by Abstract to instantiate the contract The contract is then registered on the version control contract using [`crate::registry::ExecuteMsg::ProposeModules`].", "type": "object", "required": [ "ans_host_address", - "version_control_address" + "registry_address" ], "properties": { "ans_host_address": { "description": "Used to easily perform address translation", "type": "string" }, - "version_control_address": { + "registry_address": { "description": "Used to verify senders", "type": "string" } diff --git a/contracts/server/schema/raw/response_to_base_config.json b/contracts/server/schema/raw/response_to_base_config.json index a266df1..3a95bb2 100644 --- a/contracts/server/schema/raw/response_to_base_config.json +++ b/contracts/server/schema/raw/response_to_base_config.json @@ -5,7 +5,7 @@ "required": [ "ans_host_address", "dependencies", - "version_control_address" + "registry_address" ], "properties": { "ans_host_address": { @@ -17,7 +17,7 @@ "type": "string" } }, - "version_control_address": { + "registry_address": { "$ref": "#/definitions/Addr" } }, diff --git a/contracts/server/src/contract.rs b/contracts/server/src/contract.rs index 75b44af..4800d53 100644 --- a/contracts/server/src/contract.rs +++ b/contracts/server/src/contract.rs @@ -15,7 +15,7 @@ pub type ServerResult = Result; const ADAPTER: Adapter = Adapter::new(IBCMAIL_SERVER_ID, APP_VERSION, None) .with_execute(handlers::execute_handler) .with_module_ibc(handlers::module_ibc_handler) - .with_dependencies(&[MAIL_CLIENT]); + .with_dependencies(&[]); // Export handlers #[cfg(feature = "export")] diff --git a/contracts/server/src/handlers/execute.rs b/contracts/server/src/handlers/execute.rs index 8c0e94f..82b98ba 100644 --- a/contracts/server/src/handlers/execute.rs +++ b/contracts/server/src/handlers/execute.rs @@ -2,11 +2,11 @@ use abstract_adapter::objects::TruncatedChainId; use abstract_adapter::sdk::{ features::ModuleIdentification, AccountVerification, ModuleRegistryInterface, }; -use abstract_adapter::std::version_control::AccountBase; +use abstract_adapter::std::registry::Account; use abstract_adapter::std::{ ibc_client, objects::{account::AccountTrace, module::ModuleInfo}, - version_control::NamespaceResponse, + registry::NamespaceResponse, IBC_CLIENT, }; use abstract_adapter::traits::AbstractResponse; @@ -197,7 +197,7 @@ fn route_to_local_account( // ANCHOR: set_acc_and_send // Set target account for actions, is used by APIs to retrieve mail client address. - let recipient_acc: AccountBase = app.account_registry(deps)?.account_base(&account_id)?; + let recipient_acc: Account = app.account_registry(deps)?.account(&account_id)?; app.target_account = Some(recipient_acc); let mail_client: MailClient<_> = app.mail_client(deps); diff --git a/justfile b/justfile index 99e69a5..b3f7695 100644 --- a/justfile +++ b/justfile @@ -67,7 +67,7 @@ wasm: docker run --rm -v "$(pwd)":/code \ --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - ${image}:0.14.0 + ${image}:0.16.0 # Generate the schemas for the client contract #schema: diff --git a/packages/ibcmail/Cargo.toml b/packages/ibcmail/Cargo.toml index 4a9f63c..8b9f945 100644 --- a/packages/ibcmail/Cargo.toml +++ b/packages/ibcmail/Cargo.toml @@ -18,5 +18,4 @@ cw-orch = { workspace = true } thiserror = { workspace = true } cw-asset = { workspace = true } cw-controllers = { workspace = true } -cw-semver = { workspace = true } const_format = { workspace = true } diff --git a/packages/ibcmail/src/client/api.rs b/packages/ibcmail/src/client/api.rs index 13408a1..20fb11c 100644 --- a/packages/ibcmail/src/client/api.rs +++ b/packages/ibcmail/src/client/api.rs @@ -1,8 +1,8 @@ use abstract_adapter::{sdk::AbstractSdkResult, std::objects::module::ModuleId}; use abstract_app::sdk::AppInterface; - -use cosmwasm_std::{CosmosMsg, Deps}; +use abstract_app::std::app; +use cosmwasm_std::{wasm_execute, CosmosMsg, Deps}; use crate::{ client::msg::ClientExecuteMsg, Header, IbcMailMessage, Message, Route, IBCMAIL_CLIENT_ID, @@ -37,8 +37,12 @@ impl<'a, T: ClientInterface> MailClient<'a, T> { // Execute a request on the ibc mail client fn request(&self, msg: ClientExecuteMsg) -> AbstractSdkResult { - let apps = self.base.apps(self.deps); - apps.execute(self.module_id(), msg) + let app_msg: app::ExecuteMsg<_> = msg.into(); + + let modules = self.base.modules(self.deps); + let app_address = modules.module_address(self.module_id())?; + + Ok(wasm_execute(app_address, &app_msg, vec![])?.into()) } /// Send message diff --git a/packages/ibcmail/src/client/msg.rs b/packages/ibcmail/src/client/msg.rs index 585aa60..c852f8a 100644 --- a/packages/ibcmail/src/client/msg.rs +++ b/packages/ibcmail/src/client/msg.rs @@ -15,7 +15,7 @@ pub struct ClientInstantiateMsg {} // # ANCHOR: execute_msg #[cosmwasm_schema::cw_serde] #[derive(cw_orch::ExecuteFns)] -#[cw_orch(impl_into(ExecuteMsg))] +// #[cw_orch(impl_into(ExecuteMsg))] pub enum ClientExecuteMsg { /// Receive a message from the server ReceiveMessage(IbcMailMessage), @@ -30,7 +30,7 @@ pub enum ClientExecuteMsg { /// App query messages #[cosmwasm_schema::cw_serde] #[derive(cw_orch::QueryFns)] -#[cw_orch(impl_into(QueryMsg))] +// #[cw_orch(impl_into(QueryMsg))] #[derive(QueryResponses)] pub enum ClientQueryMsg { #[returns(MessagesResponse)] diff --git a/packages/ibcmail/src/server/msg.rs b/packages/ibcmail/src/server/msg.rs index ff63277..2e185ef 100644 --- a/packages/ibcmail/src/server/msg.rs +++ b/packages/ibcmail/src/server/msg.rs @@ -11,6 +11,7 @@ pub struct ServerInstantiateMsg {} /// App execute messages #[cosmwasm_schema::cw_serde] +#[derive(cw_orch::ExecuteFns)] pub enum ServerExecuteMsg { /// Route a message ProcessMessage { @@ -29,14 +30,19 @@ pub enum ServerIbcMessage { /// App query messages #[cosmwasm_schema::cw_serde] -#[derive(cw_orch::QueryFns)] -#[cw_orch(impl_into(QueryMsg))] -#[derive(QueryResponses)] +#[derive(QueryResponses, cw_orch::QueryFns)] +// #[cw_orch(impl_into(QueryMsg))] pub enum ServerQueryMsg { #[returns(ConfigResponse)] Config {}, } +// impl From for QueryMsg { +// fn from(msg: ServerQueryMsg) -> Self { +// QueryMsg::Module(msg) +// } +// } + #[cosmwasm_schema::cw_serde] pub struct ConfigResponse {} diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 2bb32c9..f6cdf74 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -13,12 +13,10 @@ default = [] [dependencies] abstract-app = { workspace = true, features = ["test-utils"] } -abstract-cw-orch-polytone = "4.0.1" +abstract-cw-orch-polytone = { workspace = true } abstract-interface = { workspace = true } -abstract-interchain-tests = { git = "https://github.com/AbstractSDK/abstract", version = "0.23.0", tag = "v0.23.0" } -#abstract-interchain-tests = { git = "https://github.com/AbstractSDK/abstract", version = "0.22.1", branch = "removemm" } #cw-orch = { workspace = true } -cw-orch-interchain = { version = "0.3.1", features = ["daemon"] } +cw-orch-interchain = { workspace = true, features = ["daemon"] } cw-orch = { workspace = true, features = ["daemon"] } ibcmail = { workspace = true } cosmwasm-std = { workspace = true } @@ -30,7 +28,7 @@ client = { workspace = true, features = ["interface"] } speculoos = { workspace = true } server = { workspace = true, features = ["interface"] } abstract-client = { workspace = true, features = ["interchain"] } -clap.workspace = true -env_logger = "0.11.3" +clap = { workspace = true, features = ["derive"] } +env_logger = { workspace = true } dotenv = { workspace = true } anyhow = "1.0.86" diff --git a/tests/src/bin/approve.rs b/tests/src/bin/approve.rs index 1977c60..63722af 100644 --- a/tests/src/bin/approve.rs +++ b/tests/src/bin/approve.rs @@ -13,8 +13,7 @@ use abstract_interface::Abstract; use clap::Parser; use cw_orch::{ anyhow, - environment::TxHandler, - prelude::{*, DaemonBuilder, networks::parse_network}, + prelude::{networks::parse_network, DaemonBuilder, *}, tokio::runtime::Runtime, }; @@ -32,7 +31,8 @@ fn publish(networks: Vec) -> anyhow::Result<()> { // Create an [`AbstractClient`] let abs = Abstract::new(chain.clone()); - abs.version_control.approve_all_modules_for_namespace(app_namespace)?; + abs.registry + .approve_all_modules_for_namespace(app_namespace)?; } Ok(()) } diff --git a/tests/src/bin/demo.rs b/tests/src/bin/demo.rs index f2e6712..91457ae 100644 --- a/tests/src/bin/demo.rs +++ b/tests/src/bin/demo.rs @@ -1,11 +1,8 @@ use abstract_app::objects::TruncatedChainId; -use abstract_app::{ - objects::{account::AccountTrace, namespace::Namespace}, - std::version_control::QueryMsgFns, -}; +use abstract_app::objects::{account::AccountTrace, namespace::Namespace}; use abstract_client::AbstractClient; use cw_orch::{anyhow, prelude::*}; -use cw_orch_interchain::{ChannelCreationValidator, DaemonInterchainEnv, InterchainEnv}; +use cw_orch_interchain::prelude::*; use networks::{HARPOON_4, PION_1}; use client::ClientInterface; @@ -16,8 +13,7 @@ const SRC: ChainInfo = PION_1; const DST: ChainInfo = HARPOON_4; fn test() -> anyhow::Result<()> { - let interchain = - DaemonInterchainEnv::new(vec![(SRC, None), (DST, None)], &ChannelCreationValidator)?; + let interchain = DaemonInterchain::new(vec![SRC, DST], &ChannelCreationValidator)?; let src = interchain.get_chain(SRC.chain_id)?; let dst = interchain.get_chain(DST.chain_id)?; @@ -27,7 +23,6 @@ fn test() -> anyhow::Result<()> { let src_acc = abs_src .account_builder() - .install_on_sub_account(false) .namespace(Namespace::new(TEST_NAMESPACE)?) .build()?; @@ -35,7 +30,6 @@ fn test() -> anyhow::Result<()> { let dst_acc = abs_dst .account_builder() - .install_on_sub_account(false) .namespace(Namespace::new(TEST_NAMESPACE)?) .build()?; diff --git a/tests/src/bin/full_demo.rs b/tests/src/bin/full_demo.rs index 141b06f..50a5f6e 100644 --- a/tests/src/bin/full_demo.rs +++ b/tests/src/bin/full_demo.rs @@ -8,29 +8,28 @@ use abstract_app::{ }, std::{ ibc_client::QueryMsgFns as IbcQueryFns, + registry::{ExecuteMsgFns, ModuleFilter, QueryMsgFns}, IBC_HOST, - version_control::{ExecuteMsgFns, ModuleFilter, QueryMsgFns}, }, }; use abstract_client::AbstractClient; -use abstract_interface::{Abstract, VersionControl}; +use abstract_interface::{Abstract, Registry}; use clap::Parser; use cw_orch::tokio::runtime::Runtime; use cw_orch::{anyhow, prelude::*}; -use cw_orch_interchain::{ChannelCreationValidator, DaemonInterchainEnv, InterchainEnv}; +use cw_orch_interchain::prelude::*; use networks::{HARPOON_4, PION_1}; use client::ClientInterface; -use ibcmail::{client::msg::ClientExecuteMsgFns, IBCMAIL_NAMESPACE, Message}; +use ibcmail::{client::msg::ClientExecuteMsgFns, Message, IBCMAIL_NAMESPACE}; use tests::TEST_NAMESPACE; const SRC: ChainInfo = HARPOON_4; const DST: ChainInfo = PION_1; fn test() -> anyhow::Result<()> { - let rt = Runtime::new()?; - let interchain = - DaemonInterchainEnv::new(vec![(SRC, None), (DST, None)], &ChannelCreationValidator)?; + let _rt = Runtime::new()?; + let interchain = DaemonInterchain::new(vec![SRC, DST], &ChannelCreationValidator)?; let src = interchain.get_chain(SRC.chain_id)?; let dst = interchain.get_chain(DST.chain_id)?; @@ -45,13 +44,13 @@ fn test() -> anyhow::Result<()> { println!("hosts: {:?}", hosts); - // update_ibc_host(abs_src.version_control())?; - // update_ibc_host(abs_dst.version_control())?; + // update_ibc_host(abs_src.registry())?; + // update_ibc_host(abs_dst.registry())?; - // approve_mail_modules(abs_src.version_control())?; - // approve_mail_modules(abs_dst.version_control())?; + // approve_mail_modules(abs_src.registry())?; + // approve_mail_modules(abs_dst.registry())?; - let module_list = abs_src.version_control().module_list( + let module_list = abs_src.registry().module_list( Some(ModuleFilter { namespace: Some(IBCMAIL_NAMESPACE.to_string()), name: None, @@ -65,19 +64,17 @@ fn test() -> anyhow::Result<()> { let src_acc = abs_src .account_builder() - .install_on_sub_account(false) .namespace(Namespace::new(TEST_NAMESPACE)?) .build()?; // src_acc.install_app_with_dependencies::>(&ClientInstantiateMsg {}, Empty {}, &[])?; // let app = src_acc.install_app_with_dependencies::>(&ClientInstantiateMsg {}, Empty {},&[])?; - let app = src_acc.application::>()?; + let _app = src_acc.application::>()?; // app.authorize_on_adapters(&[IBCMAIL_SERVER_ID])?; - let src_client = src_acc.application::>()?; + let _src_client = src_acc.application::>()?; let dst_acc = abs_dst .account_builder() - .install_on_sub_account(false) .namespace(Namespace::new(TEST_NAMESPACE)?) .build()?; // let dst_acc = abs_dst.account_builder().sub_account(&abs_dst.account_from(AccountId::local(1))?).namespace(Namespace::new("mailtest")?).build()?; @@ -87,7 +84,7 @@ fn test() -> anyhow::Result<()> { // &[], // )?; - let app = dst_acc.application::>()?; + let _app = dst_acc.application::>()?; // app.authorize_on_adapters(&[IBCMAIL_SERVER_ID])?; let dst_client = dst_acc.application::>()?; @@ -111,7 +108,7 @@ fn test() -> anyhow::Result<()> { Ok(()) } -fn update_ibc_host(vc: &VersionControl) -> anyhow::Result<()> { +fn _update_ibc_host(vc: &Registry) -> anyhow::Result<()> { let ibc_host_module = vc .modules(vec![ModuleInfo::from_id_latest(IBC_HOST)?])? .modules @@ -132,7 +129,7 @@ fn update_ibc_host(vc: &VersionControl) -> anyhow::Result<()> { Ok(()) } -pub fn approve_mail_modules(vc: &VersionControl) -> anyhow::Result<()> { +pub fn approve_mail_modules(vc: &Registry) -> anyhow::Result<()> { let proposed_abstract_modules = vc.module_list( Some(ModuleFilter { namespace: Some(IBCMAIL_NAMESPACE.to_string()), diff --git a/tests/src/client.rs b/tests/src/client.rs index a8a501f..b1d1a2c 100644 --- a/tests/src/client.rs +++ b/tests/src/client.rs @@ -1,13 +1,13 @@ -use abstract_app::objects::{AccountId, namespace::Namespace}; -use abstract_client::{AbstractClient, Application, Environment}; +use abstract_app::objects::{namespace::Namespace, AccountId}; +use abstract_client::{AbstractClient, Application, Publisher}; use cw_orch::{anyhow, prelude::*}; use speculoos::prelude::*; // Use prelude to get all the necessary imports -use client::{*, contract::interface::ClientInterface, msg::ClientInstantiateMsg}; +use client::{contract::interface::ClientInterface, msg::ClientInstantiateMsg, *}; use ibcmail::{ - IBCMAIL_NAMESPACE, IBCMAIL_SERVER_ID, IbcMailMessage, Message, Recipient, - Sender, server::msg::ServerInstantiateMsg, + server::msg::ServerInstantiateMsg, IbcMailMessage, Message, Recipient, Sender, + IBCMAIL_NAMESPACE, IBCMAIL_SERVER_ID, }; use server::ServerInterface; @@ -32,15 +32,14 @@ impl TestEnv { // abs_client.set_balance(sender, &coins(123, "ucosm"))?; // Publish both the client and the server - let publisher = abs_client.publisher_builder(namespace).build()?; - publisher.publish_app::>()?; + let publisher_acc = abs_client + .fetch_or_build_account(namespace.clone(), |builder| builder.namespace(namespace))?; + let publisher: Publisher<_> = Publisher::new(&publisher_acc)?; publisher .publish_adapter::>(ServerInstantiateMsg {})?; + publisher.publish_app::>()?; - let acc = abs_client - .account_builder() - .install_on_sub_account(false) - .build()?; + let acc = abs_client.account_builder().build()?; let app = acc.install_app_with_dependencies::>( &ClientInstantiateMsg {}, @@ -50,10 +49,7 @@ impl TestEnv { app.authorize_on_adapters(&[IBCMAIL_SERVER_ID])?; // acc.install_adapter::>(&[])?; - let acc2 = abs_client - .account_builder() - .install_on_sub_account(false) - .build()?; + let acc2 = abs_client.account_builder().build()?; let app2 = acc2.install_app_with_dependencies::>( &ClientInstantiateMsg {}, Empty {}, @@ -88,7 +84,7 @@ fn create_test_message(from: AccountId, to: AccountId) -> IbcMailMessage { mod receive_msg { use speculoos::assert_that; - use ibcmail::{IBCMAIL_SERVER_ID, MessageStatus}; + use ibcmail::{MessageStatus, IBCMAIL_SERVER_ID}; use super::*; @@ -151,11 +147,11 @@ mod receive_msg { mod send_msg { use std::str::FromStr; - use abstract_app::{objects::account::AccountTrace, std::version_control::ExecuteMsgFns}; use abstract_app::objects::TruncatedChainId; - use cw_orch_interchain::{InterchainEnv, MockBech32InterchainEnv}; + use abstract_app::{objects::account::AccountTrace, std::registry::ExecuteMsgFns}; + use cw_orch_interchain::prelude::*; - use ibcmail::{IBCMAIL_CLIENT_ID, Message, MessageStatus, server::error::ServerError}; + use ibcmail::{server::error::ServerError, Message, MessageStatus, IBCMAIL_CLIENT_ID}; use super::*; @@ -191,7 +187,7 @@ mod send_msg { let namespace = "test"; env.abs - .version_control() + .registry() .claim_namespace(client2.account().id()?, namespace.to_string())?; let msg = Message::new( diff --git a/tests/src/lib.rs b/tests/src/lib.rs index 3ebb49e..8fd0181 100644 --- a/tests/src/lib.rs +++ b/tests/src/lib.rs @@ -1,4 +1,4 @@ #[cfg(test)] mod client; -pub const TEST_NAMESPACE: &str = "ibcmail-demo"; \ No newline at end of file +pub const TEST_NAMESPACE: &str = "ibcmail-demo";