diff --git a/contracts/core b/contracts/core index 6edab6e3..90ebeee5 160000 --- a/contracts/core +++ b/contracts/core @@ -1 +1 @@ -Subproject commit 6edab6e3dbdad22d86c8276c60632fe554e6a77c +Subproject commit 90ebeee560a4ca35f64a29da01e7f3172a41bfeb diff --git a/packages/vectis-tests/src/test_tube/plugin_registry_mgmt/query.rs b/packages/vectis-tests/src/test_tube/plugin_registry_mgmt/query.rs index ed1485a1..ff9fdfc3 100644 --- a/packages/vectis-tests/src/test_tube/plugin_registry_mgmt/query.rs +++ b/packages/vectis-tests/src/test_tube/plugin_registry_mgmt/query.rs @@ -6,7 +6,7 @@ use vectis_wallet::{ registry_management_trait::sv as registry_management_trait, wallet_plugin_trait::sv as wallet_plugin_trait, }, - types::plugin::{PluginListResponse, PluginWithVersionResponse}, + types::plugin::{PluginListResponse, PluginPermission, PluginWithVersionResponse}, }; use crate::{ @@ -49,10 +49,14 @@ fn can_query_plugin_by_addr() { let wallet = Contract::from_addr(&app, wallet_addr.to_string()); let plugins: PluginListResponse = wallet - .query(&wallet_plugin_trait::QueryMsg::Plugins {}) + .query(&wallet_plugin_trait::QueryMsg::Plugins { + ty: PluginPermission::PostTxHook, + start_after: None, + limit: None, + }) .unwrap(); - let post_tx_addr = plugins.post_tx_hooks[0].clone().0; + let post_tx_addr = plugins.plugins[0].clone().0; let registry = Contract::from_addr(&app, suite.plugin_registry); diff --git a/packages/vectis-tests/src/test_tube/wallet_plugin/migrate.rs b/packages/vectis-tests/src/test_tube/wallet_plugin/migrate.rs index dd56131a..d12188a7 100644 --- a/packages/vectis-tests/src/test_tube/wallet_plugin/migrate.rs +++ b/packages/vectis-tests/src/test_tube/wallet_plugin/migrate.rs @@ -47,7 +47,11 @@ fn can_migrate_plugin() { let wallet = Contract::from_addr(&app, wallet_addr.to_string()); let plugins: PluginListResponse = wallet - .query(&wallet_plugin_trait::sv::QueryMsg::Plugins {}) + .query(&wallet_plugin_trait::sv::QueryMsg::Plugins { + ty: PluginPermission::PreTxCheck, + start_after: None, + limit: None, + }) .unwrap(); let mut new_code_data = @@ -74,7 +78,7 @@ fn can_migrate_plugin() { contract_addr: wallet_addr.to_string(), msg: to_binary(&wallet_plugin_trait::sv::ExecMsg::update_plugins(vec![ PluginMigrateParams { - plugin_addr: plugins.pre_tx[0].clone().0, + plugin_addr: plugins.plugins[0].clone().0, plugin_permission: PluginPermission::PreTxCheck, target_src: PluginSource::VectisRegistry( suite.test_contracts.pre_tx.2, diff --git a/packages/vectis-tests/src/test_tube/wallet_plugin/plugin_exec.rs b/packages/vectis-tests/src/test_tube/wallet_plugin/plugin_exec.rs index da3d8ec1..f7a62c7c 100644 --- a/packages/vectis-tests/src/test_tube/wallet_plugin/plugin_exec.rs +++ b/packages/vectis-tests/src/test_tube/wallet_plugin/plugin_exec.rs @@ -14,7 +14,10 @@ use osmosis_test_tube::{Bank, OsmosisTestApp}; use serial_test::serial; use test_tube::module::Module; use test_vectis_plugin_exec::contract::sv::ExecMsg; -use vectis_wallet::{interface::wallet_plugin_trait, types::plugin::PluginListResponse}; +use vectis_wallet::{ + interface::wallet_plugin_trait, + types::plugin::{PluginListResponse, PluginPermission}, +}; // This uses the code from contracts/test-contracts/ // It will return false if msg contains bankmsg @@ -46,10 +49,14 @@ fn plugin_exec_works() { let wallet = Contract::from_addr(&app, wallet_addr.to_string()); let plugins: PluginListResponse = wallet - .query(&wallet_plugin_trait::sv::QueryMsg::Plugins {}) + .query(&wallet_plugin_trait::sv::QueryMsg::Plugins { + ty: PluginPermission::Exec, + start_after: None, + limit: None, + }) .unwrap(); - let exec_addr = plugins.exec[0].clone().0; + let exec_addr = plugins.plugins[0].clone().0; let exec_contract = Contract::from_addr(&app, exec_addr); // check wallet balance before plugin exec diff --git a/packages/vectis-tests/src/test_tube/wallet_plugin/post_tx.rs b/packages/vectis-tests/src/test_tube/wallet_plugin/post_tx.rs index 12743a7a..5829c3ec 100644 --- a/packages/vectis-tests/src/test_tube/wallet_plugin/post_tx.rs +++ b/packages/vectis-tests/src/test_tube/wallet_plugin/post_tx.rs @@ -3,7 +3,10 @@ use osmosis_test_tube::OsmosisTestApp; use serial_test::serial; use test_vectis_post_tx_exec::contract::sv::QueryMsg as PostTxQueryMsg; -use vectis_wallet::{interface::wallet_plugin_trait, types::plugin::PluginListResponse}; +use vectis_wallet::{ + interface::wallet_plugin_trait, + types::plugin::{PluginListResponse, PluginPermission}, +}; use crate::{ constants::*, @@ -47,10 +50,14 @@ fn post_tx_executes() { let wallet = Contract::from_addr(&app, wallet_addr.to_string()); let plugins: PluginListResponse = wallet - .query(&wallet_plugin_trait::sv::QueryMsg::Plugins {}) + .query(&wallet_plugin_trait::sv::QueryMsg::Plugins { + ty: PluginPermission::PostTxHook, + start_after: None, + limit: None, + }) .unwrap(); - let post_tx_addr = plugins.post_tx_hooks[0].clone().0; + let post_tx_addr = plugins.plugins[0].clone().0; let post_tx_contract = Contract::from_addr(&app, post_tx_addr); // initially counter is untouched diff --git a/packages/vectis-tests/src/test_tube/wallet_plugin/remove.rs b/packages/vectis-tests/src/test_tube/wallet_plugin/remove.rs index 2a600bf2..ec36e1f3 100644 --- a/packages/vectis-tests/src/test_tube/wallet_plugin/remove.rs +++ b/packages/vectis-tests/src/test_tube/wallet_plugin/remove.rs @@ -88,13 +88,19 @@ fn remove_installed_plugin_successfully() { assert_eq!(sub.plugin_installed.len(), 1); let wallet = Contract::from_addr(&app, wallet_addr.to_string()); - let info: PluginListResponse = wallet.query(&WalletPluginQueryMsg::Plugins {}).unwrap(); - assert_eq!(info.pre_tx.len(), 1); + let info: PluginListResponse = wallet + .query(&WalletPluginQueryMsg::Plugins { + ty: PluginPermission::PreTxCheck, + start_after: None, + limit: None, + }) + .unwrap(); + assert_eq!(info.plugins.len(), 1); // Remove plugin let remove_plugin_msg = RegistryServiceTraitExecMsg::ProxyRemovePlugins { addr: info - .pre_tx + .plugins .iter() .map(|(addr, _)| addr.to_string()) .collect(), @@ -114,8 +120,14 @@ fn remove_installed_plugin_successfully() { .unwrap(); // Check wallet and registry that this was removed - let info: PluginListResponse = wallet.query(&WalletPluginQueryMsg::Plugins {}).unwrap(); - assert_eq!(info.pre_tx.len(), 0); + let info: PluginListResponse = wallet + .query(&WalletPluginQueryMsg::Plugins { + ty: PluginPermission::PreTxCheck, + start_after: None, + limit: None, + }) + .unwrap(); + assert_eq!(info.plugins.len(), 0); let sub_result: Option = registry .query(®istry_service_trait::sv::QueryMsg::SubsciptionDetails { diff --git a/packages/vectis-tests/src/test_tube/wallet_services/auth_tx_without_plugins.rs b/packages/vectis-tests/src/test_tube/wallet_services/auth_tx_without_plugins.rs index 1ee283bb..4a92368b 100644 --- a/packages/vectis-tests/src/test_tube/wallet_services/auth_tx_without_plugins.rs +++ b/packages/vectis-tests/src/test_tube/wallet_services/auth_tx_without_plugins.rs @@ -7,7 +7,7 @@ use vectis_wallet::{ registry_service_trait::sv::RegistryServiceTraitExecMsg, wallet_plugin_trait::sv::QueryMsg as WalletPluginQueryMsg, }, - types::plugin::PluginListResponse, + types::plugin::{PluginListResponse, PluginPermission}, }; use crate::{ @@ -69,10 +69,16 @@ fn auth_tx_without_plugin_can_bypass_and_remove_plugin() { // Can remove plugin let wallet = Contract::from_addr(&app, wallet_addr.to_string()); - let info: PluginListResponse = wallet.query(&WalletPluginQueryMsg::Plugins {}).unwrap(); + let info: PluginListResponse = wallet + .query(&WalletPluginQueryMsg::Plugins { + ty: PluginPermission::PreTxCheck, + start_after: None, + limit: None, + }) + .unwrap(); let remove_plugin_msg = RegistryServiceTraitExecMsg::ProxyRemovePlugins { addr: info - .pre_tx + .plugins .iter() .map(|(addr, _)| addr.to_string()) .collect(), diff --git a/packages/vectis/src/interface/wallet.rs b/packages/vectis/src/interface/wallet.rs index 6017622d..3aec2c8f 100644 --- a/packages/vectis/src/interface/wallet.rs +++ b/packages/vectis/src/interface/wallet.rs @@ -65,7 +65,9 @@ pub mod wallet_trait { } pub mod wallet_plugin_trait { - use crate::types::plugin::{PluginInstallParams, PluginListResponse, PluginMigrateParams}; + use crate::types::plugin::{ + PluginInstallParams, PluginListResponse, PluginMigrateParams, PluginPermission, + }; use super::*; @@ -76,7 +78,13 @@ pub mod wallet_plugin_trait { /// Returns all installed plugins by types #[msg(query)] - fn plugins(&self, ctx: QueryCtx) -> Result; + fn plugins( + &self, + ctx: QueryCtx, + ty: PluginPermission, + start_after: Option, + limit: Option, + ) -> Result; #[msg(exec)] fn plugin_execute( diff --git a/packages/vectis/src/types/plugin/response.rs b/packages/vectis/src/types/plugin/response.rs index 634fdaaf..68d87f79 100644 --- a/packages/vectis/src/types/plugin/response.rs +++ b/packages/vectis/src/types/plugin/response.rs @@ -4,9 +4,8 @@ use super::types::*; #[cw_serde] pub struct PluginListResponse { - pub exec: Vec<(String, PluginInfo)>, - pub pre_tx: Vec<(String, PluginInfo)>, - pub post_tx_hooks: Vec<(String, PluginInfo)>, + pub ty: PluginPermission, + pub plugins: Vec<(String, PluginInfo)>, } #[cw_serde]