Skip to main content

dapi_grpc/
lib.rs

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