ibc_proto/
lib.rs

1//! ibc-proto library gives the developer access to the Cosmos SDK IBC proto-defined structs.
2
3// Todo: automate the creation of this module setup based on the dots in the filenames.
4// This module setup is necessary because the generated code contains "super::" calls for dependencies.
5#![cfg_attr(not(feature = "std"), no_std)]
6#![deny(warnings, trivial_casts, trivial_numeric_casts, unused_import_braces)]
7#![allow(clippy::large_enum_variant, clippy::needless_borrows_for_generic_args)]
8#![allow(rustdoc::bare_urls)]
9#![cfg_attr(
10    feature = "serde",
11    expect(
12        clippy::needless_lifetimes,
13        reason = "triggered in pbjson generated code; addressed by https://github.com/influxdata/pbjson/pull/138"
14    )
15)]
16#![forbid(unsafe_code)]
17
18pub use tendermint_proto::Error;
19pub use tendermint_proto::Protobuf;
20
21extern crate alloc;
22
23#[cfg(not(feature = "std"))]
24#[macro_use]
25extern crate core as std;
26
27#[macro_export]
28macro_rules! include_proto {
29    ($path:literal) => {
30        include!(concat!("prost/", $path));
31    };
32}
33
34/// The version (commit hash) of IBC Go used when generating this library.
35pub const IBC_GO_COMMIT: &str = include_str!("IBC_GO_COMMIT");
36
37/// The version (commit hash) of Interchain Security used when generating this library.
38pub const INTERCHAIN_SECURITY_COMMIT: &str = include_str!("INTERCHAIN_SECURITY_COMMIT");
39
40/// The version (commit hash) of nft-transfer used when generating this library.
41pub const NFT_TRANSFER_COMMIT: &str = include_str!("NFT_TRANSFER_COMMIT");
42
43/// File descriptor set of compiled proto.
44#[cfg(feature = "proto-descriptor")]
45pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("prost/proto_descriptor.bin");
46
47// Re-export the Google protos from the `tendermint_proto` crate
48pub mod google {
49    pub use tendermint_proto::google::*;
50}
51
52// Re-export Cosmos SDK protos from the `cosmos_sdk_proto` crate
53pub use cosmos_sdk_proto::cosmos;
54
55// Re-export the ICS23 proto from the `ics23` crate
56pub use ics23;
57
58pub mod ibc {
59    #[deprecated(since = "0.15.0", note = "Use `ibc_proto::ibc::applications` instead")]
60    pub mod apps {
61        pub use super::applications::*;
62    }
63    pub mod applications {
64        pub mod transfer {
65            pub mod v1 {
66                include_proto!("ibc.applications.transfer.v1.rs");
67                #[cfg(feature = "serde")]
68                include_proto!("ibc.applications.transfer.v1.serde.rs");
69            }
70            pub mod v2 {
71                include_proto!("ibc.applications.transfer.v2.rs");
72                #[cfg(feature = "serde")]
73                include_proto!("ibc.applications.transfer.v2.serde.rs");
74            }
75        }
76        pub mod fee {
77            pub mod v1 {
78                include_proto!("ibc.applications.fee.v1.rs");
79                #[cfg(feature = "serde")]
80                include_proto!("ibc.applications.fee.v1.serde.rs");
81            }
82        }
83        pub mod interchain_accounts {
84            pub mod v1 {
85                include_proto!("ibc.applications.interchain_accounts.v1.rs");
86                #[cfg(feature = "serde")]
87                include_proto!("ibc.applications.interchain_accounts.v1.serde.rs");
88            }
89            pub mod controller {
90                pub mod v1 {
91                    include_proto!("ibc.applications.interchain_accounts.controller.v1.rs");
92                    #[cfg(feature = "serde")]
93                    include_proto!("ibc.applications.interchain_accounts.controller.v1.serde.rs");
94                }
95            }
96            pub mod host {
97                pub mod v1 {
98                    include_proto!("ibc.applications.interchain_accounts.host.v1.rs");
99                    #[cfg(feature = "serde")]
100                    include_proto!("ibc.applications.interchain_accounts.host.v1.serde.rs");
101                }
102            }
103        }
104        pub mod nft_transfer {
105            pub mod v1 {
106                include_proto!("ibc.applications.nft_transfer.v1.rs");
107                #[cfg(feature = "serde")]
108                include_proto!("ibc.applications.nft_transfer.v1.serde.rs");
109            }
110        }
111    }
112    pub mod core {
113        pub mod channel {
114            pub mod v1 {
115                include_proto!("ibc.core.channel.v1.rs");
116                #[cfg(feature = "serde")]
117                include_proto!("ibc.core.channel.v1.serde.rs");
118            }
119        }
120        pub mod client {
121            pub mod v1 {
122                include_proto!("ibc.core.client.v1.rs");
123                #[cfg(feature = "serde")]
124                include_proto!("ibc.core.client.v1.serde.rs");
125            }
126        }
127        pub mod commitment {
128            pub mod v1 {
129                include_proto!("ibc.core.commitment.v1.rs");
130                #[cfg(feature = "serde")]
131                include_proto!("ibc.core.commitment.v1.serde.rs");
132            }
133        }
134        pub mod connection {
135            pub mod v1 {
136                include_proto!("ibc.core.connection.v1.rs");
137                #[cfg(feature = "serde")]
138                include_proto!("ibc.core.connection.v1.serde.rs");
139            }
140        }
141        pub mod types {
142            pub mod v1 {
143                include_proto!("ibc.core.types.v1.rs");
144                #[cfg(feature = "serde")]
145                include_proto!("ibc.core.types.v1.serde.rs");
146            }
147        }
148    }
149    pub mod lightclients {
150        pub mod localhost {
151            pub mod v1 {
152                include_proto!("ibc.lightclients.localhost.v1.rs");
153                #[cfg(feature = "serde")]
154                include_proto!("ibc.lightclients.localhost.v1.serde.rs");
155            }
156            pub mod v2 {
157                include_proto!("ibc.lightclients.localhost.v2.rs");
158                #[cfg(feature = "serde")]
159                include_proto!("ibc.lightclients.localhost.v2.serde.rs");
160            }
161        }
162        pub mod solomachine {
163            pub mod v3 {
164                include_proto!("ibc.lightclients.solomachine.v3.rs");
165                #[cfg(feature = "serde")]
166                include_proto!("ibc.lightclients.solomachine.v3.serde.rs");
167            }
168        }
169        pub mod tendermint {
170            pub mod v1 {
171                include_proto!("ibc.lightclients.tendermint.v1.rs");
172                #[cfg(feature = "serde")]
173                include_proto!("ibc.lightclients.tendermint.v1.serde.rs");
174            }
175        }
176        pub mod wasm {
177            pub mod v1 {
178                include_proto!("ibc.lightclients.wasm.v1.rs");
179                #[cfg(feature = "serde")]
180                include_proto!("ibc.lightclients.wasm.v1.serde.rs");
181            }
182        }
183    }
184    pub mod mock {
185        include_proto!("ibc.mock.rs");
186        #[cfg(feature = "serde")]
187        include_proto!("ibc.mock.serde.rs");
188    }
189}
190
191pub mod interchain_security {
192    pub mod ccv {
193        #[allow(clippy::match_single_binding)]
194        pub mod v1 {
195            include_proto!("interchain_security.ccv.v1.rs");
196        }
197        pub mod provider {
198            pub mod v1 {
199                include_proto!("interchain_security.ccv.provider.v1.rs");
200            }
201        }
202        pub mod consumer {
203            pub mod v1 {
204                include_proto!("interchain_security.ccv.consumer.v1.rs");
205            }
206        }
207    }
208}
209
210pub mod stride {
211    pub mod interchainquery {
212        pub mod v1 {
213            include_proto!("stride.interchainquery.v1.rs");
214        }
215    }
216}