Skip to main content

cosmos_tx/
msg.rs

1//! Transaction messages
2
3use prost_types::Any;
4
5/// Transaction messages
6pub struct Msg(pub(crate) Any);
7
8impl Msg {
9    /// Create a new message type
10    pub fn new(type_url: impl Into<String>, value: impl Into<Vec<u8>>) -> Self {
11        Msg(Any {
12            type_url: type_url.into(),
13            value: value.into(),
14        })
15    }
16}
17
18impl From<Any> for Msg {
19    fn from(any: Any) -> Msg {
20        Msg(any)
21    }
22}
23
24impl From<Msg> for Any {
25    fn from(msg: Msg) -> Any {
26        msg.0
27    }
28}