// ANCHOR: underlying_into use cw_orch::interface; use cw_orch::prelude::*; // An execute message that is generic. #[cosmwasm_schema::cw_serde] pub enum GenericExecuteMsg { Generic(T), Nested(NestedMessageType), } // This is the message that will be used on our contract type ExecuteMsg = GenericExecuteMsg; #[cosmwasm_schema::cw_serde] #[derive(cw_orch::ExecuteFns)] pub enum Foo { Bar { a: String }, } impl From for ExecuteMsg { fn from(msg: Foo) -> Self { ExecuteMsg::Generic(msg) } } #[cosmwasm_schema::cw_serde] #[derive(cw_orch::ExecuteFns)] pub enum NestedMessageType { Test { b: u64 }, } impl From for ExecuteMsg { fn from(msg: NestedMessageType) -> Self { ExecuteMsg::Nested(msg) } } #[interface(Empty, ExecuteMsg, Empty, Empty)] struct Example; impl Example { pub fn test_macro(&self) { // function `bar` is available now! self.bar("hello".to_string()).unwrap(); // function `test` is available now! self.test(65u64).unwrap(); } } // ANCHOR_END: underlying_into