From af77893c2f04e15bec11ccae53342b8264a29158 Mon Sep 17 00:00:00 2001 From: cyberhoward Date: Tue, 20 Aug 2024 14:54:59 +0200 Subject: [PATCH 1/2] rename --- cw-orch-interchain/examples/doc_daemon.rs | 8 ++++---- .../examples/follow_packets_txhash.rs | 4 ++-- cw-orch-interchain/examples/manual_ica_demo.rs | 2 +- cw-orch-interchain/src/lib.rs | 2 +- docs/src/interchain/index.md | 2 +- docs/src/interchain/integrations/daemon.md | 6 +++--- docs/src/interchain/quick-start.md | 2 +- .../interchain-daemon/src/channel_creator.rs | 12 ++++++------ .../interchain-daemon/src/interchain_env.rs | 14 +++++++------- packages/interchain/interchain-daemon/src/lib.rs | 2 +- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/cw-orch-interchain/examples/doc_daemon.rs b/cw-orch-interchain/examples/doc_daemon.rs index 7b84ec98c..860537209 100644 --- a/cw-orch-interchain/examples/doc_daemon.rs +++ b/cw-orch-interchain/examples/doc_daemon.rs @@ -1,12 +1,12 @@ use cw_orch::prelude::networks::{LOCAL_JUNO, LOCAL_MIGALOO, LOCAL_OSMO}; use cw_orch::prelude::*; use cw_orch_interchain::{ - ChannelCreationValidator, ChannelCreator, DaemonInterchainEnv, InterchainEnv, Starship, + ChannelCreationValidator, ChannelCreator, DaemonInterchain, InterchainEnv, Starship, }; /// Others -fn create_daemon_env() -> cw_orch::anyhow::Result { - let mut interchain = DaemonInterchainEnv::new( +fn create_daemon_env() -> cw_orch::anyhow::Result { + let mut interchain = DaemonInterchain::new( vec![(LOCAL_JUNO, None), (LOCAL_OSMO, None)], &ChannelCreationValidator, )?; @@ -22,7 +22,7 @@ fn create_daemon_env() -> cw_orch::anyhow::Result { Ok(interchain) } -fn create_starship_env() -> cw_orch::anyhow::Result> { +fn create_starship_env() -> cw_orch::anyhow::Result> { let starship = Starship::new(None)?; let interchain = starship.interchain_env(); diff --git a/cw-orch-interchain/examples/follow_packets_txhash.rs b/cw-orch-interchain/examples/follow_packets_txhash.rs index aff94aef9..a9a6e6fcc 100644 --- a/cw-orch-interchain/examples/follow_packets_txhash.rs +++ b/cw-orch-interchain/examples/follow_packets_txhash.rs @@ -3,7 +3,7 @@ use cw_orch::{ environment::{ChainInfo, NetworkInfo}, prelude::networks::osmosis::OSMOSIS_1, }; -use cw_orch_interchain_daemon::{ChannelCreationValidator, DaemonInterchainEnv}; +use cw_orch_interchain_daemon::{ChannelCreationValidator, DaemonInterchain}; pub const NOBLE: NetworkInfo = NetworkInfo { chain_name: "noble", @@ -27,7 +27,7 @@ fn follow_by_tx_hash() -> cw_orch::anyhow::Result<()> { let dst_chain = ARCHWAY_1; let src_chain = OSMOSIS_1; - let interchain = DaemonInterchainEnv::new( + let interchain = DaemonInterchain::new( vec![(src_chain.clone(), None), (dst_chain, None)], &ChannelCreationValidator, )?; diff --git a/cw-orch-interchain/examples/manual_ica_demo.rs b/cw-orch-interchain/examples/manual_ica_demo.rs index 31634ddf3..1bded974f 100644 --- a/cw-orch-interchain/examples/manual_ica_demo.rs +++ b/cw-orch-interchain/examples/manual_ica_demo.rs @@ -18,7 +18,7 @@ fn main() { let starship = Starship::new(None).unwrap(); - let interchain = DaemonInterchainEnv::from_daemons( + let interchain = DaemonInterchain::from_daemons( starship.daemons.values().cloned().collect(), &ChannelCreationValidator, ); diff --git a/cw-orch-interchain/src/lib.rs b/cw-orch-interchain/src/lib.rs index adb8edf98..ef6c3e383 100644 --- a/cw-orch-interchain/src/lib.rs +++ b/cw-orch-interchain/src/lib.rs @@ -13,7 +13,7 @@ pub mod prelude { #[cfg(feature = "daemon")] pub use cw_orch_interchain_daemon::{ - ChannelCreationValidator, ChannelCreator, DaemonInterchainEnv, + ChannelCreationValidator, ChannelCreator, DaemonInterchain, }; #[cfg(feature = "daemon")] pub use cw_orch_starship::Starship; diff --git a/docs/src/interchain/index.md b/docs/src/interchain/index.md index 4285e4991..35186b6da 100644 --- a/docs/src/interchain/index.md +++ b/docs/src/interchain/index.md @@ -72,6 +72,6 @@ Visit the dedicated [Starship](./integrations/daemon.md#for-testing) page for mo ### [Cosmos SDK Node Scripting](./integrations/daemon.md#for-scripting) -The `DaemonInterchainEnvironment` object allows developers to script, deploy and manage their application on running chains with attention to IBC functionalities. This enhances the developer experience with more tooling, more useful logging. This is the all-in-one toolbox cor the cosmwasm IBC developer. +The `DaemonInterchain` object allows developers to script, deploy and manage their application on running chains with attention to IBC functionalities. This enhances the developer experience with more tooling, more useful logging. This is the all-in-one toolbox cor the cosmwasm IBC developer. Visit the dedicated [Daemon Interchain](./integrations/daemon.md#for-scripting) page for more details and code snippets. diff --git a/docs/src/interchain/integrations/daemon.md b/docs/src/interchain/integrations/daemon.md index 00195f617..f4c4223fb 100644 --- a/docs/src/interchain/integrations/daemon.md +++ b/docs/src/interchain/integrations/daemon.md @@ -13,7 +13,7 @@ use cw_orch::prelude::*; use cw_orch_interchain::prelude::*; use cw_orch::prelude::networks::{LOCAL_JUNO, LOCAL_OSMO}; fn main(){ - let mut interchain = DaemonInterchainEnv::new(vec![ + let mut interchain = DaemonInterchain::new(vec![ (LOCAL_JUNO, None), (LOCAL_OSMO, None) ], &ChannelCreationValidator)?; @@ -121,7 +121,7 @@ Finally the `await_and_check_packets` function allows to follow all packet execu ## Analysis Usage The `await_single_packet` and `await_packets` function were coded for scripting usage in mind. They allow to await and repeatedly query Cosmos SDK Nodes until the cycle is complete. However, it is also possible to inspect past transactions using those tools. -Using the `DaemonInterchainEnv::await_packets_for_txhash` function, one can inspect the history of packets linked to a transaction from a transaction hash only. This enables all kinds of analysis usage, here are some: +Using the `DaemonInterchain::await_packets_for_txhash` function, one can inspect the history of packets linked to a transaction from a transaction hash only. This enables all kinds of analysis usage, here are some: - Relayer activity - Analysis of past transactions for fund recovery @@ -132,7 +132,7 @@ Using the `DaemonInterchainEnv::await_packets_for_txhash` function, one can insp cw-orchestrator doesn't provide[^documentation_date] relayer capabilities. We only provide tools to analyze IBC activity based on packet relaying mechanism that only relayers can provide. However, when testing your implementation with Starship, you might want to automatically create channels on your test setup. -This is what the second argument of the `DaemonInterchainEnv::new` function is used for. You provide an object which will be responsible for creating an IBC channel between two ports. We provide 2 such structures, you can obviously create your own if your needs differ: +This is what the second argument of the `DaemonInterchain::new` function is used for. You provide an object which will be responsible for creating an IBC channel between two ports. We provide 2 such structures, you can obviously create your own if your needs differ: 1. `cw_orch_interchain::interchain::ChannelCreationValidator` This is used when you want to have full control over the channel creation. When `interchain.create_channel` is called, the script will stop and prompt you to create a channel with external tools. Once the channel creation process is done on your side, you simply have to input the connection-id on which you created the channel to be able to resume execution. This solution is not ideal at all but allows you to script on actual nodes without having to separate your scripts into multiple parts or change the syntax you coded for your tests. diff --git a/docs/src/interchain/quick-start.md b/docs/src/interchain/quick-start.md index c07f9f77f..ce8087a20 100644 --- a/docs/src/interchain/quick-start.md +++ b/docs/src/interchain/quick-start.md @@ -206,7 +206,7 @@ let osmosis = Daemon::builder(cw_orch::daemon::networks::OSMO_5) .unwrap(); // This will allow us to follow packets execution between juno and osmosis -let interchain = DaemonInterchainEnv::from_daemons( +let interchain = DaemonInterchain::from_daemons( vec![juno, osmosis], &ChannelCreationValidator, ); diff --git a/packages/interchain/interchain-daemon/src/channel_creator.rs b/packages/interchain/interchain-daemon/src/channel_creator.rs index 66289a2b6..524b0f884 100644 --- a/packages/interchain/interchain-daemon/src/channel_creator.rs +++ b/packages/interchain/interchain-daemon/src/channel_creator.rs @@ -4,7 +4,7 @@ use cw_orch_starship::Starship; use dialoguer::Input; use ibc_relayer_types::core::ics24_host::identifier::PortId; -use crate::{interchain_env::DaemonInterchainEnv, InterchainDaemonError}; +use crate::{interchain_env::DaemonInterchain, InterchainDaemonError}; /// Used for allowing multiple interaction types with the Daemon interchain environment pub trait ChannelCreator: Clone { @@ -21,7 +21,7 @@ pub trait ChannelCreator: Clone { ) -> Result; /// Returns an interchain environment from the channel creator object - fn interchain_env(&self) -> DaemonInterchainEnv; + fn interchain_env(&self) -> DaemonInterchain; } /// This is a struct for use with actual RPCs where you want to create you channel manually @@ -47,8 +47,8 @@ impl ChannelCreator for ChannelCreationValidator { Ok(connection_id) } - fn interchain_env(&self) -> DaemonInterchainEnv { - panic!("To create an RPC based interchain environement, use DaemonInterchainEnv::new(). Use the Starship::interchain_env() method for interacting with Starship") + fn interchain_env(&self) -> DaemonInterchain { + panic!("To create an RPC based interchain environement, use DaemonInterchain::new(). Use the Starship::interchain_env() method for interacting with Starship") } } @@ -76,7 +76,7 @@ impl ChannelCreator for Starship { Ok(connection_id) } - fn interchain_env(&self) -> DaemonInterchainEnv { - DaemonInterchainEnv::from_daemons(self.daemons.values().cloned().collect(), self) + fn interchain_env(&self) -> DaemonInterchain { + DaemonInterchain::from_daemons(self.daemons.values().cloned().collect(), self) } } diff --git a/packages/interchain/interchain-daemon/src/interchain_env.rs b/packages/interchain/interchain-daemon/src/interchain_env.rs index 99443951e..10f191bfc 100644 --- a/packages/interchain/interchain-daemon/src/interchain_env.rs +++ b/packages/interchain/interchain-daemon/src/interchain_env.rs @@ -29,7 +29,7 @@ use tokio::runtime::Handle; /// Represents a set of locally running blockchain nodes and a Hermes relayer. #[derive(Clone)] -pub struct DaemonInterchainEnv { +pub struct DaemonInterchain { /// Daemons indexable by network id, i.e. "juno-1", "osmosis-2", ... daemons: HashMap, @@ -43,8 +43,8 @@ pub struct DaemonInterchainEnv { type Mnemonic = String; -impl DaemonInterchainEnv { - /// Builds a new [`DaemonInterchainEnv`] instance. +impl DaemonInterchain { + /// Builds a new [`DaemonInterchain`] instance. /// For use with starship, we advise to use [`cw_orch_starship::Starship::interchain_env`] instead /// channel_creator allows you to specify an object that is able to create channels /// Use [`crate::ChannelCreationValidator`] for manual channel creations. @@ -55,7 +55,7 @@ impl DaemonInterchainEnv { Self::new_with_runtime(chains, channel_creator, RUNTIME.handle()) } - /// Builds a new [`DaemonInterchainEnv`] instance. + /// Builds a new [`DaemonInterchain`] instance. /// For use with starship, we advise to use [`cw_orch_starship::Starship::interchain_env`] instead /// channel_creator allows you to specify an object that is able to create channels /// Use [`crate::ChannelCreationValidator`] for manual channel creations. @@ -157,7 +157,7 @@ impl DaemonInterchainEnv { } } -impl InterchainEnv for DaemonInterchainEnv { +impl InterchainEnv for DaemonInterchain { type ChannelCreationResult = (); type Error = InterchainDaemonError; @@ -291,7 +291,7 @@ impl InterchainEnv for DaemonInterchainEnv { } } -impl DaemonInterchainEnv { +impl DaemonInterchain { /// This function follows every IBC packet sent out in a tx result /// This allows only providing the transaction hash when you don't have access to the whole response object /// @@ -303,7 +303,7 @@ impl DaemonInterchainEnv { /// let dst_chain = ARCHWAY_1; /// let src_chain = OSMOSIS_1; /// - /// let interchain = DaemonInterchainEnv::new( + /// let interchain = DaemonInterchain::new( /// vec![(src_chain.clone(), None), (dst_chain, None)], /// &ChannelCreationValidator, /// ).unwrap(); diff --git a/packages/interchain/interchain-daemon/src/lib.rs b/packages/interchain/interchain-daemon/src/lib.rs index 7640acd1e..95585f823 100644 --- a/packages/interchain/interchain-daemon/src/lib.rs +++ b/packages/interchain/interchain-daemon/src/lib.rs @@ -18,4 +18,4 @@ pub type IcDaemonResult = Result; /// We want to export some major elements pub use channel_creator::{ChannelCreationValidator, ChannelCreator}; -pub use interchain_env::DaemonInterchainEnv; +pub use interchain_env::DaemonInterchain; From c2497dcc53ca6dca8f6d18105070d3871328ad3d Mon Sep 17 00:00:00 2001 From: cyberhoward Date: Tue, 20 Aug 2024 14:56:32 +0200 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 108f55f18..94b2c8497 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ ### Breaking +- Rename `DaemonInterchainEnv` to `DaemonInterchain` for consistency. + ## 0.24.1 - Added async query functions generations with cw_orch::QueryFns