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