Skip to main content

dapi_grpc/
lib.rs

1pub use prost::Message;
2
3#[cfg(feature = "core")]
4pub mod core {
5    #![allow(non_camel_case_types)]
6    pub mod v0 {
7        // Note: only one of the features can be analyzed at a time
8        #[cfg(all(feature = "server", not(target_arch = "wasm32")))]
9        include!(concat!(
10            env!("DAPI_GRPC_OUT_DIR"),
11            "/core/server/org.dash.platform.dapi.v0.rs"
12        ));
13
14        #[cfg(all(
15            feature = "client",
16            not(feature = "server"),
17            not(target_arch = "wasm32")
18        ))]
19        include!(concat!(
20            env!("DAPI_GRPC_OUT_DIR"),
21            "/core/client/org.dash.platform.dapi.v0.rs"
22        ));
23
24        #[cfg(target_arch = "wasm32")]
25        include!(concat!(
26            env!("DAPI_GRPC_OUT_DIR"),
27            "/core/wasm/org.dash.platform.dapi.v0.rs"
28        ));
29
30        /// Serialized `FileDescriptorSet` for the Core proto — lets consumers
31        /// enumerate the served rpcs (e.g. to assert metrics allowlists).
32        #[cfg(all(feature = "server", not(target_arch = "wasm32")))]
33        pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!(concat!(
34            env!("DAPI_GRPC_OUT_DIR"),
35            "/core/server/descriptor.bin"
36        ));
37
38        /// Serialized `FileDescriptorSet` for the Core proto — lets consumers
39        /// enumerate the served rpcs (e.g. to assert metrics allowlists).
40        #[cfg(all(
41            feature = "client",
42            not(feature = "server"),
43            not(target_arch = "wasm32")
44        ))]
45        pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!(concat!(
46            env!("DAPI_GRPC_OUT_DIR"),
47            "/core/client/descriptor.bin"
48        ));
49    }
50}
51
52#[cfg(feature = "platform")]
53pub mod platform {
54    pub mod v0 {
55        #[cfg(all(feature = "server", not(target_arch = "wasm32")))]
56        include!(concat!(
57            env!("DAPI_GRPC_OUT_DIR"),
58            "/platform/server/org.dash.platform.dapi.v0.rs"
59        ));
60
61        #[cfg(all(
62            feature = "client",
63            not(feature = "server"),
64            not(target_arch = "wasm32")
65        ))]
66        include!(concat!(
67            env!("DAPI_GRPC_OUT_DIR"),
68            "/platform/client/org.dash.platform.dapi.v0.rs"
69        ));
70
71        #[cfg(target_arch = "wasm32")]
72        include!(concat!(
73            env!("DAPI_GRPC_OUT_DIR"),
74            "/platform/wasm/org.dash.platform.dapi.v0.rs"
75        ));
76
77        /// Serialized `FileDescriptorSet` for the Platform proto — lets
78        /// consumers enumerate the served rpcs (e.g. to assert metrics
79        /// allowlists).
80        #[cfg(all(feature = "server", not(target_arch = "wasm32")))]
81        pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!(concat!(
82            env!("DAPI_GRPC_OUT_DIR"),
83            "/platform/server/descriptor.bin"
84        ));
85
86        /// Serialized `FileDescriptorSet` for the Platform proto — lets
87        /// consumers enumerate the served rpcs (e.g. to assert metrics
88        /// allowlists).
89        #[cfg(all(
90            feature = "client",
91            not(feature = "server"),
92            not(target_arch = "wasm32")
93        ))]
94        pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!(concat!(
95            env!("DAPI_GRPC_OUT_DIR"),
96            "/platform/client/descriptor.bin"
97        ));
98    }
99
100    #[cfg(feature = "tenderdash-proto")]
101    pub use tenderdash_proto as proto;
102
103    #[cfg(any(feature = "server", feature = "client", target_arch = "wasm32"))]
104    mod versioning;
105    #[cfg(any(feature = "server", feature = "client", target_arch = "wasm32"))]
106    pub use versioning::{
107        MerkProofVersionedGrpcResponse, VersionedGrpcMessage, VersionedGrpcResponse,
108    };
109}
110
111#[cfg(all(feature = "drive", feature = "platform"))]
112pub(crate) mod dapi {
113    pub(crate) use crate::platform::*;
114}
115
116#[cfg(feature = "drive")]
117pub mod drive {
118    pub mod v0 {
119        #[cfg(all(feature = "server", not(target_arch = "wasm32")))]
120        include!(concat!(
121            env!("DAPI_GRPC_OUT_DIR"),
122            "/drive/server/org.dash.platform.drive.v0.rs"
123        ));
124
125        #[cfg(all(
126            feature = "client",
127            not(feature = "server"),
128            not(target_arch = "wasm32")
129        ))]
130        include!(concat!(
131            env!("DAPI_GRPC_OUT_DIR"),
132            "/drive/client/org.dash.platform.drive.v0.rs"
133        ));
134    }
135
136    #[cfg(feature = "tenderdash-proto")]
137    pub use tenderdash_proto as proto;
138}
139
140#[cfg(feature = "serde")]
141// Serde deserialization logic
142pub mod deserialization;
143
144// We need mock module even if the feature is disabled
145pub mod mock;
146
147// Re-export tonic to ensure everyone uses the same version
148pub use tonic;
149// Ensure the prost codec crate is linked and available to generated code
150pub use tonic_prost;