nibiru_std/proto/
mod.rs

1//! proto/mod.rs: Protobuf types defined in NibiruChain/nibiru/proto.
2
3mod traits;
4mod type_url_cosmos;
5mod type_url_nibiru;
6
7pub use traits::*;
8
9pub mod cosmos {
10    /// Authentication of accounts and transactions.
11    pub mod auth {
12        pub mod v1beta1 {
13            include!("buf/cosmos.auth.v1beta1.rs");
14        }
15    }
16
17    pub mod authz {
18        pub mod v1beta1 {
19            include!("buf/cosmos.authz.v1beta1.rs");
20        }
21    }
22
23    pub mod bank {
24        pub mod v1beta1 {
25            include!("buf/cosmos.bank.v1beta1.rs");
26        }
27    }
28
29    /// Base functionality.
30    pub mod base {
31        /// Application BlockChain Interface (ABCI).
32        ///
33        /// Interface that defines the boundary between the replication engine
34        /// (the blockchain), and the state machine (the application).
35        pub mod abci {
36            pub mod v1beta1 {
37                include!("buf/cosmos.base.abci.v1beta1.rs");
38            }
39        }
40
41        /// Key-value pairs.
42        pub mod kv {
43            pub mod v1beta1 {
44                include!("buf/cosmos.base.kv.v1beta1.rs");
45            }
46        }
47
48        /// Query support.
49        pub mod query {
50            pub mod v1beta1 {
51                include!("buf/cosmos.base.query.v1beta1.rs");
52            }
53        }
54
55        /// Reflection support.
56        pub mod reflection {
57            pub mod v1beta1 {
58                include!("buf/cosmos.base.reflection.v1beta1.rs");
59            }
60
61            pub mod v2alpha1 {
62                include!("buf/cosmos.base.reflection.v2alpha1.rs");
63            }
64        }
65
66        /// Snapshots containing Tendermint state sync info.
67        pub mod snapshots {
68            pub mod v1beta1 {
69                include!("buf/cosmos.base.snapshots.v1beta1.rs");
70            }
71        }
72
73        /// Data structure that holds the state of the application.
74        pub mod store {
75            pub mod v1beta1 {
76                include!("buf/cosmos.base.store.v1beta1.rs");
77            }
78        }
79
80        /// Defines base data structures like Coin, DecCoin, IntProto, and
81        /// DecProto. These types implement custo method signatures required by
82        /// gogoproto.
83        pub mod v1beta1 {
84            include!("buf/cosmos.base.v1beta1.rs");
85        }
86
87        /// For consensus types related to blocks, block headers, and merkle
88        /// proofs.
89        pub mod tendermint {
90            pub mod v1beta1 {
91                include!("buf/cosmos.base.tendermint.v1beta1.rs");
92            }
93        }
94    }
95
96    pub mod crisis {
97        pub mod v1beta1 {
98            include!("buf/cosmos.crisis.v1beta1.rs");
99        }
100    }
101
102    pub mod crypto {
103        pub mod v1beta1 {
104            include!("buf/cosmos.crisis.v1beta1.rs");
105        }
106
107        pub mod ed25519 {
108            include!("buf/cosmos.crypto.ed25519.rs");
109        }
110
111        pub mod hd {
112            pub mod v1 {
113                include!("buf/cosmos.crypto.hd.v1.rs");
114            }
115        }
116
117        pub mod keyring {
118            pub mod v1 {
119                include!("buf/cosmos.crypto.keyring.v1.rs");
120            }
121        }
122
123        pub mod multisig {
124            pub mod v1beta1 {
125                include!("buf/cosmos.crypto.multisig.v1beta1.rs");
126            }
127        }
128        pub mod secp256r1 {
129            include!("buf/cosmos.crypto.secp256r1.rs");
130        }
131    }
132
133    pub mod genutil {
134        pub mod v1beta1 {
135            include!("buf/cosmos.genutil.v1beta1.rs");
136        }
137    }
138
139    /// Types related to decentralized governance of the network.
140    pub mod gov {
141        pub mod v1 {
142            include!("buf/cosmos.gov.v1.rs");
143        }
144    }
145
146    pub mod group {
147        pub mod v1 {
148            include!("buf/cosmos.group.v1.rs");
149        }
150    }
151
152    pub mod mint {
153        pub mod v1beta1 {
154            include!("buf/cosmos.mint.v1beta1.rs");
155        }
156    }
157
158    pub mod nft {
159        pub mod v1beta1 {
160            include!("buf/cosmos.nft.v1beta1.rs");
161        }
162    }
163
164    pub mod params {
165        pub mod v1beta1 {
166            include!("buf/cosmos.params.v1beta1.rs");
167        }
168    }
169    pub mod reflection {
170        pub mod v1 {
171            include!("buf/cosmos.reflection.v1.rs");
172        }
173    }
174    pub mod slashing {
175        pub mod v1beta1 {
176            include!("buf/cosmos.slashing.v1beta1.rs");
177        }
178    }
179    pub mod staking {
180        pub mod v1beta1 {
181            include!("buf/cosmos.staking.v1beta1.rs");
182        }
183    }
184    pub mod tx {
185        pub mod config {
186            pub mod v1 {
187                include!("buf/cosmos.tx.config.v1.rs");
188            }
189        }
190        pub mod signing {
191            pub mod v1beta1 {
192                include!("buf/cosmos.tx.signing.v1beta1.rs");
193            }
194        }
195        pub mod v1beta1 {
196            include!("buf/cosmos.tx.v1beta1.rs");
197        }
198    }
199
200    pub mod upgrade {
201        pub mod v1beta1 {
202            include!("buf/cosmos.upgrade.v1beta1.rs");
203        }
204    }
205
206    pub mod vesting {
207        pub mod v1beta1 {
208            include!("buf/cosmos.vesting.v1beta1.rs");
209        }
210    }
211
212    // TODO: protobuf mod for cosmos capability
213    // TODO: protobuf mod for cosmos consensus
214    // TODO: protobuf mod for cosmos crisis
215    // TODO: protobuf mod for cosmos crypto
216    // TODO: protobuf mod for cosmos distribution
217    // TODO: protobuf mod for cosmos evidence
218    // TODO: protobuf mod for cosmos feegrant
219}
220
221pub mod nibiru {
222    pub mod devgas {
223        include!("buf/nibiru.devgas.v1.rs");
224    }
225    pub mod epochs {
226        include!("buf/nibiru.epochs.v1.rs");
227    }
228    pub mod genmsg {
229        include!("buf/nibiru.genmsg.v1.rs");
230    }
231    pub mod inflation {
232        include!("buf/nibiru.inflation.v1.rs");
233    }
234    pub mod oracle {
235        include!("buf/nibiru.oracle.v1.rs");
236    }
237    pub mod perp {
238        include!("buf/nibiru.perp.v2.rs");
239    }
240    pub mod spot {
241        include!("buf/nibiru.spot.v1.rs");
242    }
243    pub mod sudo {
244        include!("buf/nibiru.sudo.v1.rs");
245    }
246    pub mod tokenfactory {
247        include!("buf/nibiru.tokenfactory.v1.rs");
248    }
249}
250
251pub mod tendermint {
252    pub mod abci {
253        include!("buf/tendermint.abci.rs");
254    }
255    pub mod crypto {
256        include!("buf/tendermint.crypto.rs");
257    }
258    pub mod p2p {
259        include!("buf/tendermint.p2p.rs");
260    }
261    pub mod types {
262        include!("buf/tendermint.types.rs");
263    }
264    pub mod version {
265        include!("buf/tendermint.version.rs");
266    }
267}
268
269pub mod eth {
270    pub mod evm {
271        include!("buf/eth.evm.v1.rs");
272    }
273    pub mod types {
274        include!("buf/eth.types.v1.rs");
275    }
276}
277
278#[cfg(test)]
279mod tests {
280
281    use super::{
282        cosmos::{self, base::v1beta1::Coin},
283        eth,
284        nibiru::perp,
285    };
286
287    #[test]
288    fn nibiru_common_imports() {
289        let _ = perp::MsgMarketOrder {
290            sender: "sender".to_string(),
291            pair: "nibi:usd".to_string(),
292            side: perp::Direction::Long.into(),
293            quote_asset_amount: "123".into(),
294            leverage: "123".into(),
295            base_asset_amount_limit: "0".into(),
296        };
297    }
298
299    #[test]
300    fn cosmos_imports() {
301        let _ = cosmos::bank::v1beta1::MsgSend {
302            from_address: "from".to_string(),
303            to_address: "to".to_string(),
304            amount: vec![Coin {
305                denom: "unibi".to_string(),
306                amount: "123".to_string(),
307            }],
308        };
309    }
310
311    #[test]
312    fn eth_imports() {
313        let _ = eth::evm::MsgEthereumTx {
314            data: Some(prost_types::Any {
315                type_url: String::from(""),
316                value: vec![0, 1, 2],
317            }),
318            from: "0xfrom".to_string(), // dummy
319            hash: "0xhash".to_string(), // dummy
320            size: 420f64,
321        };
322    }
323}