1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! Typed message constructors (composers) for every QoreChain custom-module
//! message and the standard Cosmos message types, plus the [`to_any`] helper
//! that packs any prost message into a `cosmrs::Any` with the correct
//! `type_url`.
//!
//! Each composer is a thin, typed constructor that returns the generated prost
//! message ready to pass to [`to_any`] and then to
//! [`crate::tx::send_messages`] / [`crate::tx::build_hybrid_tx`]. The composers
//! are grouped per module (`msg::amm`, `msg::bridge`, …) so callers write
//! `msg::amm::swap_exact_in(...)` and `msg::to_any(&m, msg::amm::SWAP_EXACT_IN)`,
//! or use the convenience `*_any` wrappers that return a `cosmrs::Any` directly.
//!
//! The custom-module messages all live in package `qorechain.<module>.v1`, so
//! every type URL is `/qorechain.<module>.v1.Msg*`. Type URLs are exposed as
//! public constants so they can be asserted and reused.
use Any;
use Message;
/// Packs a prost message into a `cosmrs::Any` with the given `type_url`.
///
/// `value = msg.encode_to_vec()`, so the resulting `Any` is byte-identical to
/// what the chain produces for the same message — this is what lets a custom Msg
/// ride in a tx body and be decoded back through the chain's interface registry.
/// Decodes the `value` of an `Any` back into a concrete prost message of type
/// `M`. The caller is responsible for matching `any.type_url` to `M`.