@dashevo/dapi-grpc 1.0.0-dev.4 → 1.0.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +22 -13
- package/build.rs +47 -23
- package/clients/core/v0/rust/core_example.rs +1 -1
- package/clients/platform/v0/nodejs/PlatformPromiseClient.js +117 -0
- package/clients/platform/v0/nodejs/platform_pbjs.js +3000 -1060
- package/clients/platform/v0/nodejs/platform_protoc.js +2609 -748
- package/clients/platform/v0/rust/platform_example.rs +1 -1
- package/clients/platform/v0/web/PlatformPromiseClient.js +28 -0
- package/clients/platform/v0/web/platform_pb.d.ts +253 -0
- package/clients/platform/v0/web/platform_pb.js +2609 -748
- package/clients/platform/v0/web/platform_pb_service.d.ts +38 -0
- package/clients/platform/v0/web/platform_pb_service.js +80 -0
- package/package.json +2 -2
- package/protos/platform/v0/platform.proto +51 -0
- package/src/core/proto/org.dash.platform.dapi.v0.rs +577 -0
- package/src/lib.rs +6 -0
- package/src/mock.rs +68 -0
- package/src/platform/proto/org.dash.platform.dapi.v0.rs +1549 -0
- package/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +22 -0
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
2
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
1
3
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
2
4
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
3
5
|
pub struct GetStatusRequest {}
|
|
6
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
7
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
4
8
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
5
9
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
6
10
|
pub struct GetStatusResponse {
|
|
@@ -21,6 +25,8 @@ pub struct GetStatusResponse {
|
|
|
21
25
|
}
|
|
22
26
|
/// Nested message and enum types in `GetStatusResponse`.
|
|
23
27
|
pub mod get_status_response {
|
|
28
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
29
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
24
30
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
25
31
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
26
32
|
pub struct Version {
|
|
@@ -31,6 +37,8 @@ pub mod get_status_response {
|
|
|
31
37
|
#[prost(string, tag = "3")]
|
|
32
38
|
pub agent: ::prost::alloc::string::String,
|
|
33
39
|
}
|
|
40
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
41
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
34
42
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
35
43
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
36
44
|
pub struct Time {
|
|
@@ -41,6 +49,8 @@ pub mod get_status_response {
|
|
|
41
49
|
#[prost(uint32, tag = "3")]
|
|
42
50
|
pub median: u32,
|
|
43
51
|
}
|
|
52
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
53
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
44
54
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
45
55
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
46
56
|
pub struct Chain {
|
|
@@ -61,6 +71,8 @@ pub mod get_status_response {
|
|
|
61
71
|
#[prost(double, tag = "8")]
|
|
62
72
|
pub sync_progress: f64,
|
|
63
73
|
}
|
|
74
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
75
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
64
76
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
65
77
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
66
78
|
pub struct Masternode {
|
|
@@ -77,6 +89,7 @@ pub mod get_status_response {
|
|
|
77
89
|
}
|
|
78
90
|
/// Nested message and enum types in `Masternode`.
|
|
79
91
|
pub mod masternode {
|
|
92
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
80
93
|
#[derive(
|
|
81
94
|
Clone,
|
|
82
95
|
Copy,
|
|
@@ -132,6 +145,8 @@ pub mod get_status_response {
|
|
|
132
145
|
}
|
|
133
146
|
}
|
|
134
147
|
}
|
|
148
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
149
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
135
150
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
136
151
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
137
152
|
pub struct NetworkFee {
|
|
@@ -140,6 +155,8 @@ pub mod get_status_response {
|
|
|
140
155
|
#[prost(double, tag = "2")]
|
|
141
156
|
pub incremental: f64,
|
|
142
157
|
}
|
|
158
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
159
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
143
160
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
144
161
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
145
162
|
pub struct Network {
|
|
@@ -148,6 +165,7 @@ pub mod get_status_response {
|
|
|
148
165
|
#[prost(message, optional, tag = "2")]
|
|
149
166
|
pub fee: ::core::option::Option<NetworkFee>,
|
|
150
167
|
}
|
|
168
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
151
169
|
#[derive(
|
|
152
170
|
Clone,
|
|
153
171
|
Copy,
|
|
@@ -191,6 +209,8 @@ pub mod get_status_response {
|
|
|
191
209
|
}
|
|
192
210
|
}
|
|
193
211
|
}
|
|
212
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
213
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
194
214
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
195
215
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
196
216
|
pub struct GetBlockRequest {
|
|
@@ -199,6 +219,7 @@ pub struct GetBlockRequest {
|
|
|
199
219
|
}
|
|
200
220
|
/// Nested message and enum types in `GetBlockRequest`.
|
|
201
221
|
pub mod get_block_request {
|
|
222
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
202
223
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
203
224
|
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
|
204
225
|
pub enum Block {
|
|
@@ -208,12 +229,16 @@ pub mod get_block_request {
|
|
|
208
229
|
Hash(::prost::alloc::string::String),
|
|
209
230
|
}
|
|
210
231
|
}
|
|
232
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
233
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
211
234
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
212
235
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
213
236
|
pub struct GetBlockResponse {
|
|
214
237
|
#[prost(bytes = "vec", tag = "1")]
|
|
215
238
|
pub block: ::prost::alloc::vec::Vec<u8>,
|
|
216
239
|
}
|
|
240
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
241
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
217
242
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
218
243
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
219
244
|
pub struct BroadcastTransactionRequest {
|
|
@@ -224,18 +249,24 @@ pub struct BroadcastTransactionRequest {
|
|
|
224
249
|
#[prost(bool, tag = "3")]
|
|
225
250
|
pub bypass_limits: bool,
|
|
226
251
|
}
|
|
252
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
253
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
227
254
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
228
255
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
229
256
|
pub struct BroadcastTransactionResponse {
|
|
230
257
|
#[prost(string, tag = "1")]
|
|
231
258
|
pub transaction_id: ::prost::alloc::string::String,
|
|
232
259
|
}
|
|
260
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
261
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
233
262
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
234
263
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
235
264
|
pub struct GetTransactionRequest {
|
|
236
265
|
#[prost(string, tag = "1")]
|
|
237
266
|
pub id: ::prost::alloc::string::String,
|
|
238
267
|
}
|
|
268
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
269
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
239
270
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
240
271
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
241
272
|
pub struct GetTransactionResponse {
|
|
@@ -252,6 +283,8 @@ pub struct GetTransactionResponse {
|
|
|
252
283
|
#[prost(bool, tag = "6")]
|
|
253
284
|
pub is_chain_locked: bool,
|
|
254
285
|
}
|
|
286
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
287
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
255
288
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
256
289
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
257
290
|
pub struct BlockHeadersWithChainLocksRequest {
|
|
@@ -264,6 +297,7 @@ pub struct BlockHeadersWithChainLocksRequest {
|
|
|
264
297
|
}
|
|
265
298
|
/// Nested message and enum types in `BlockHeadersWithChainLocksRequest`.
|
|
266
299
|
pub mod block_headers_with_chain_locks_request {
|
|
300
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
267
301
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
268
302
|
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
|
269
303
|
pub enum FromBlock {
|
|
@@ -273,6 +307,8 @@ pub mod block_headers_with_chain_locks_request {
|
|
|
273
307
|
FromBlockHeight(u32),
|
|
274
308
|
}
|
|
275
309
|
}
|
|
310
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
311
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
276
312
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
277
313
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
278
314
|
pub struct BlockHeadersWithChainLocksResponse {
|
|
@@ -283,6 +319,7 @@ pub struct BlockHeadersWithChainLocksResponse {
|
|
|
283
319
|
}
|
|
284
320
|
/// Nested message and enum types in `BlockHeadersWithChainLocksResponse`.
|
|
285
321
|
pub mod block_headers_with_chain_locks_response {
|
|
322
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
286
323
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
287
324
|
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
|
288
325
|
pub enum Responses {
|
|
@@ -292,24 +329,32 @@ pub mod block_headers_with_chain_locks_response {
|
|
|
292
329
|
ChainLock(::prost::alloc::vec::Vec<u8>),
|
|
293
330
|
}
|
|
294
331
|
}
|
|
332
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
333
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
295
334
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
296
335
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
297
336
|
pub struct BlockHeaders {
|
|
298
337
|
#[prost(bytes = "vec", repeated, tag = "1")]
|
|
299
338
|
pub headers: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
|
|
300
339
|
}
|
|
340
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
341
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
301
342
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
302
343
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
303
344
|
pub struct GetEstimatedTransactionFeeRequest {
|
|
304
345
|
#[prost(uint32, tag = "1")]
|
|
305
346
|
pub blocks: u32,
|
|
306
347
|
}
|
|
348
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
349
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
307
350
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
308
351
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
309
352
|
pub struct GetEstimatedTransactionFeeResponse {
|
|
310
353
|
#[prost(double, tag = "1")]
|
|
311
354
|
pub fee: f64,
|
|
312
355
|
}
|
|
356
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
357
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
313
358
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
314
359
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
315
360
|
pub struct TransactionsWithProofsRequest {
|
|
@@ -324,6 +369,7 @@ pub struct TransactionsWithProofsRequest {
|
|
|
324
369
|
}
|
|
325
370
|
/// Nested message and enum types in `TransactionsWithProofsRequest`.
|
|
326
371
|
pub mod transactions_with_proofs_request {
|
|
372
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
327
373
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
328
374
|
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
|
329
375
|
pub enum FromBlock {
|
|
@@ -333,6 +379,8 @@ pub mod transactions_with_proofs_request {
|
|
|
333
379
|
FromBlockHeight(u32),
|
|
334
380
|
}
|
|
335
381
|
}
|
|
382
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
383
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
336
384
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
337
385
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
338
386
|
pub struct BloomFilter {
|
|
@@ -345,6 +393,8 @@ pub struct BloomFilter {
|
|
|
345
393
|
#[prost(uint32, tag = "4")]
|
|
346
394
|
pub n_flags: u32,
|
|
347
395
|
}
|
|
396
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
397
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
348
398
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
349
399
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
350
400
|
pub struct TransactionsWithProofsResponse {
|
|
@@ -353,6 +403,7 @@ pub struct TransactionsWithProofsResponse {
|
|
|
353
403
|
}
|
|
354
404
|
/// Nested message and enum types in `TransactionsWithProofsResponse`.
|
|
355
405
|
pub mod transactions_with_proofs_response {
|
|
406
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
356
407
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
357
408
|
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
|
358
409
|
pub enum Responses {
|
|
@@ -364,12 +415,16 @@ pub mod transactions_with_proofs_response {
|
|
|
364
415
|
RawMerkleBlock(::prost::alloc::vec::Vec<u8>),
|
|
365
416
|
}
|
|
366
417
|
}
|
|
418
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
419
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
367
420
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
368
421
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
369
422
|
pub struct RawTransactions {
|
|
370
423
|
#[prost(bytes = "vec", repeated, tag = "1")]
|
|
371
424
|
pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
|
|
372
425
|
}
|
|
426
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
427
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
373
428
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
374
429
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
375
430
|
pub struct InstantSendLockMessages {
|
|
@@ -664,3 +719,525 @@ pub mod core_client {
|
|
|
664
719
|
}
|
|
665
720
|
}
|
|
666
721
|
}
|
|
722
|
+
/// Generated server implementations.
|
|
723
|
+
pub mod core_server {
|
|
724
|
+
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
|
|
725
|
+
use tonic::codegen::*;
|
|
726
|
+
/// Generated trait containing gRPC methods that should be implemented for use with CoreServer.
|
|
727
|
+
#[async_trait]
|
|
728
|
+
pub trait Core: Send + Sync + 'static {
|
|
729
|
+
async fn get_status(
|
|
730
|
+
&self,
|
|
731
|
+
request: tonic::Request<super::GetStatusRequest>,
|
|
732
|
+
) -> std::result::Result<
|
|
733
|
+
tonic::Response<super::GetStatusResponse>,
|
|
734
|
+
tonic::Status,
|
|
735
|
+
>;
|
|
736
|
+
async fn get_block(
|
|
737
|
+
&self,
|
|
738
|
+
request: tonic::Request<super::GetBlockRequest>,
|
|
739
|
+
) -> std::result::Result<
|
|
740
|
+
tonic::Response<super::GetBlockResponse>,
|
|
741
|
+
tonic::Status,
|
|
742
|
+
>;
|
|
743
|
+
async fn broadcast_transaction(
|
|
744
|
+
&self,
|
|
745
|
+
request: tonic::Request<super::BroadcastTransactionRequest>,
|
|
746
|
+
) -> std::result::Result<
|
|
747
|
+
tonic::Response<super::BroadcastTransactionResponse>,
|
|
748
|
+
tonic::Status,
|
|
749
|
+
>;
|
|
750
|
+
async fn get_transaction(
|
|
751
|
+
&self,
|
|
752
|
+
request: tonic::Request<super::GetTransactionRequest>,
|
|
753
|
+
) -> std::result::Result<
|
|
754
|
+
tonic::Response<super::GetTransactionResponse>,
|
|
755
|
+
tonic::Status,
|
|
756
|
+
>;
|
|
757
|
+
async fn get_estimated_transaction_fee(
|
|
758
|
+
&self,
|
|
759
|
+
request: tonic::Request<super::GetEstimatedTransactionFeeRequest>,
|
|
760
|
+
) -> std::result::Result<
|
|
761
|
+
tonic::Response<super::GetEstimatedTransactionFeeResponse>,
|
|
762
|
+
tonic::Status,
|
|
763
|
+
>;
|
|
764
|
+
/// Server streaming response type for the subscribeToBlockHeadersWithChainLocks method.
|
|
765
|
+
type subscribeToBlockHeadersWithChainLocksStream: futures_core::Stream<
|
|
766
|
+
Item = std::result::Result<
|
|
767
|
+
super::BlockHeadersWithChainLocksResponse,
|
|
768
|
+
tonic::Status,
|
|
769
|
+
>,
|
|
770
|
+
>
|
|
771
|
+
+ Send
|
|
772
|
+
+ 'static;
|
|
773
|
+
async fn subscribe_to_block_headers_with_chain_locks(
|
|
774
|
+
&self,
|
|
775
|
+
request: tonic::Request<super::BlockHeadersWithChainLocksRequest>,
|
|
776
|
+
) -> std::result::Result<
|
|
777
|
+
tonic::Response<Self::subscribeToBlockHeadersWithChainLocksStream>,
|
|
778
|
+
tonic::Status,
|
|
779
|
+
>;
|
|
780
|
+
/// Server streaming response type for the subscribeToTransactionsWithProofs method.
|
|
781
|
+
type subscribeToTransactionsWithProofsStream: futures_core::Stream<
|
|
782
|
+
Item = std::result::Result<
|
|
783
|
+
super::TransactionsWithProofsResponse,
|
|
784
|
+
tonic::Status,
|
|
785
|
+
>,
|
|
786
|
+
>
|
|
787
|
+
+ Send
|
|
788
|
+
+ 'static;
|
|
789
|
+
async fn subscribe_to_transactions_with_proofs(
|
|
790
|
+
&self,
|
|
791
|
+
request: tonic::Request<super::TransactionsWithProofsRequest>,
|
|
792
|
+
) -> std::result::Result<
|
|
793
|
+
tonic::Response<Self::subscribeToTransactionsWithProofsStream>,
|
|
794
|
+
tonic::Status,
|
|
795
|
+
>;
|
|
796
|
+
}
|
|
797
|
+
#[derive(Debug)]
|
|
798
|
+
pub struct CoreServer<T: Core> {
|
|
799
|
+
inner: _Inner<T>,
|
|
800
|
+
accept_compression_encodings: EnabledCompressionEncodings,
|
|
801
|
+
send_compression_encodings: EnabledCompressionEncodings,
|
|
802
|
+
max_decoding_message_size: Option<usize>,
|
|
803
|
+
max_encoding_message_size: Option<usize>,
|
|
804
|
+
}
|
|
805
|
+
struct _Inner<T>(Arc<T>);
|
|
806
|
+
impl<T: Core> CoreServer<T> {
|
|
807
|
+
pub fn new(inner: T) -> Self {
|
|
808
|
+
Self::from_arc(Arc::new(inner))
|
|
809
|
+
}
|
|
810
|
+
pub fn from_arc(inner: Arc<T>) -> Self {
|
|
811
|
+
let inner = _Inner(inner);
|
|
812
|
+
Self {
|
|
813
|
+
inner,
|
|
814
|
+
accept_compression_encodings: Default::default(),
|
|
815
|
+
send_compression_encodings: Default::default(),
|
|
816
|
+
max_decoding_message_size: None,
|
|
817
|
+
max_encoding_message_size: None,
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
pub fn with_interceptor<F>(
|
|
821
|
+
inner: T,
|
|
822
|
+
interceptor: F,
|
|
823
|
+
) -> InterceptedService<Self, F>
|
|
824
|
+
where
|
|
825
|
+
F: tonic::service::Interceptor,
|
|
826
|
+
{
|
|
827
|
+
InterceptedService::new(Self::new(inner), interceptor)
|
|
828
|
+
}
|
|
829
|
+
/// Enable decompressing requests with the given encoding.
|
|
830
|
+
#[must_use]
|
|
831
|
+
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
832
|
+
self.accept_compression_encodings.enable(encoding);
|
|
833
|
+
self
|
|
834
|
+
}
|
|
835
|
+
/// Compress responses with the given encoding, if the client supports it.
|
|
836
|
+
#[must_use]
|
|
837
|
+
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
838
|
+
self.send_compression_encodings.enable(encoding);
|
|
839
|
+
self
|
|
840
|
+
}
|
|
841
|
+
/// Limits the maximum size of a decoded message.
|
|
842
|
+
///
|
|
843
|
+
/// Default: `4MB`
|
|
844
|
+
#[must_use]
|
|
845
|
+
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
846
|
+
self.max_decoding_message_size = Some(limit);
|
|
847
|
+
self
|
|
848
|
+
}
|
|
849
|
+
/// Limits the maximum size of an encoded message.
|
|
850
|
+
///
|
|
851
|
+
/// Default: `usize::MAX`
|
|
852
|
+
#[must_use]
|
|
853
|
+
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
|
|
854
|
+
self.max_encoding_message_size = Some(limit);
|
|
855
|
+
self
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
impl<T, B> tonic::codegen::Service<http::Request<B>> for CoreServer<T>
|
|
859
|
+
where
|
|
860
|
+
T: Core,
|
|
861
|
+
B: Body + Send + 'static,
|
|
862
|
+
B::Error: Into<StdError> + Send + 'static,
|
|
863
|
+
{
|
|
864
|
+
type Response = http::Response<tonic::body::BoxBody>;
|
|
865
|
+
type Error = std::convert::Infallible;
|
|
866
|
+
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
867
|
+
fn poll_ready(
|
|
868
|
+
&mut self,
|
|
869
|
+
_cx: &mut Context<'_>,
|
|
870
|
+
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
871
|
+
Poll::Ready(Ok(()))
|
|
872
|
+
}
|
|
873
|
+
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
874
|
+
let inner = self.inner.clone();
|
|
875
|
+
match req.uri().path() {
|
|
876
|
+
"/org.dash.platform.dapi.v0.Core/getStatus" => {
|
|
877
|
+
#[allow(non_camel_case_types)]
|
|
878
|
+
struct getStatusSvc<T: Core>(pub Arc<T>);
|
|
879
|
+
impl<T: Core> tonic::server::UnaryService<super::GetStatusRequest>
|
|
880
|
+
for getStatusSvc<T> {
|
|
881
|
+
type Response = super::GetStatusResponse;
|
|
882
|
+
type Future = BoxFuture<
|
|
883
|
+
tonic::Response<Self::Response>,
|
|
884
|
+
tonic::Status,
|
|
885
|
+
>;
|
|
886
|
+
fn call(
|
|
887
|
+
&mut self,
|
|
888
|
+
request: tonic::Request<super::GetStatusRequest>,
|
|
889
|
+
) -> Self::Future {
|
|
890
|
+
let inner = Arc::clone(&self.0);
|
|
891
|
+
let fut = async move { (*inner).get_status(request).await };
|
|
892
|
+
Box::pin(fut)
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
let accept_compression_encodings = self.accept_compression_encodings;
|
|
896
|
+
let send_compression_encodings = self.send_compression_encodings;
|
|
897
|
+
let max_decoding_message_size = self.max_decoding_message_size;
|
|
898
|
+
let max_encoding_message_size = self.max_encoding_message_size;
|
|
899
|
+
let inner = self.inner.clone();
|
|
900
|
+
let fut = async move {
|
|
901
|
+
let inner = inner.0;
|
|
902
|
+
let method = getStatusSvc(inner);
|
|
903
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
904
|
+
let mut grpc = tonic::server::Grpc::new(codec)
|
|
905
|
+
.apply_compression_config(
|
|
906
|
+
accept_compression_encodings,
|
|
907
|
+
send_compression_encodings,
|
|
908
|
+
)
|
|
909
|
+
.apply_max_message_size_config(
|
|
910
|
+
max_decoding_message_size,
|
|
911
|
+
max_encoding_message_size,
|
|
912
|
+
);
|
|
913
|
+
let res = grpc.unary(method, req).await;
|
|
914
|
+
Ok(res)
|
|
915
|
+
};
|
|
916
|
+
Box::pin(fut)
|
|
917
|
+
}
|
|
918
|
+
"/org.dash.platform.dapi.v0.Core/getBlock" => {
|
|
919
|
+
#[allow(non_camel_case_types)]
|
|
920
|
+
struct getBlockSvc<T: Core>(pub Arc<T>);
|
|
921
|
+
impl<T: Core> tonic::server::UnaryService<super::GetBlockRequest>
|
|
922
|
+
for getBlockSvc<T> {
|
|
923
|
+
type Response = super::GetBlockResponse;
|
|
924
|
+
type Future = BoxFuture<
|
|
925
|
+
tonic::Response<Self::Response>,
|
|
926
|
+
tonic::Status,
|
|
927
|
+
>;
|
|
928
|
+
fn call(
|
|
929
|
+
&mut self,
|
|
930
|
+
request: tonic::Request<super::GetBlockRequest>,
|
|
931
|
+
) -> Self::Future {
|
|
932
|
+
let inner = Arc::clone(&self.0);
|
|
933
|
+
let fut = async move { (*inner).get_block(request).await };
|
|
934
|
+
Box::pin(fut)
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
let accept_compression_encodings = self.accept_compression_encodings;
|
|
938
|
+
let send_compression_encodings = self.send_compression_encodings;
|
|
939
|
+
let max_decoding_message_size = self.max_decoding_message_size;
|
|
940
|
+
let max_encoding_message_size = self.max_encoding_message_size;
|
|
941
|
+
let inner = self.inner.clone();
|
|
942
|
+
let fut = async move {
|
|
943
|
+
let inner = inner.0;
|
|
944
|
+
let method = getBlockSvc(inner);
|
|
945
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
946
|
+
let mut grpc = tonic::server::Grpc::new(codec)
|
|
947
|
+
.apply_compression_config(
|
|
948
|
+
accept_compression_encodings,
|
|
949
|
+
send_compression_encodings,
|
|
950
|
+
)
|
|
951
|
+
.apply_max_message_size_config(
|
|
952
|
+
max_decoding_message_size,
|
|
953
|
+
max_encoding_message_size,
|
|
954
|
+
);
|
|
955
|
+
let res = grpc.unary(method, req).await;
|
|
956
|
+
Ok(res)
|
|
957
|
+
};
|
|
958
|
+
Box::pin(fut)
|
|
959
|
+
}
|
|
960
|
+
"/org.dash.platform.dapi.v0.Core/broadcastTransaction" => {
|
|
961
|
+
#[allow(non_camel_case_types)]
|
|
962
|
+
struct broadcastTransactionSvc<T: Core>(pub Arc<T>);
|
|
963
|
+
impl<
|
|
964
|
+
T: Core,
|
|
965
|
+
> tonic::server::UnaryService<super::BroadcastTransactionRequest>
|
|
966
|
+
for broadcastTransactionSvc<T> {
|
|
967
|
+
type Response = super::BroadcastTransactionResponse;
|
|
968
|
+
type Future = BoxFuture<
|
|
969
|
+
tonic::Response<Self::Response>,
|
|
970
|
+
tonic::Status,
|
|
971
|
+
>;
|
|
972
|
+
fn call(
|
|
973
|
+
&mut self,
|
|
974
|
+
request: tonic::Request<super::BroadcastTransactionRequest>,
|
|
975
|
+
) -> Self::Future {
|
|
976
|
+
let inner = Arc::clone(&self.0);
|
|
977
|
+
let fut = async move {
|
|
978
|
+
(*inner).broadcast_transaction(request).await
|
|
979
|
+
};
|
|
980
|
+
Box::pin(fut)
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
let accept_compression_encodings = self.accept_compression_encodings;
|
|
984
|
+
let send_compression_encodings = self.send_compression_encodings;
|
|
985
|
+
let max_decoding_message_size = self.max_decoding_message_size;
|
|
986
|
+
let max_encoding_message_size = self.max_encoding_message_size;
|
|
987
|
+
let inner = self.inner.clone();
|
|
988
|
+
let fut = async move {
|
|
989
|
+
let inner = inner.0;
|
|
990
|
+
let method = broadcastTransactionSvc(inner);
|
|
991
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
992
|
+
let mut grpc = tonic::server::Grpc::new(codec)
|
|
993
|
+
.apply_compression_config(
|
|
994
|
+
accept_compression_encodings,
|
|
995
|
+
send_compression_encodings,
|
|
996
|
+
)
|
|
997
|
+
.apply_max_message_size_config(
|
|
998
|
+
max_decoding_message_size,
|
|
999
|
+
max_encoding_message_size,
|
|
1000
|
+
);
|
|
1001
|
+
let res = grpc.unary(method, req).await;
|
|
1002
|
+
Ok(res)
|
|
1003
|
+
};
|
|
1004
|
+
Box::pin(fut)
|
|
1005
|
+
}
|
|
1006
|
+
"/org.dash.platform.dapi.v0.Core/getTransaction" => {
|
|
1007
|
+
#[allow(non_camel_case_types)]
|
|
1008
|
+
struct getTransactionSvc<T: Core>(pub Arc<T>);
|
|
1009
|
+
impl<
|
|
1010
|
+
T: Core,
|
|
1011
|
+
> tonic::server::UnaryService<super::GetTransactionRequest>
|
|
1012
|
+
for getTransactionSvc<T> {
|
|
1013
|
+
type Response = super::GetTransactionResponse;
|
|
1014
|
+
type Future = BoxFuture<
|
|
1015
|
+
tonic::Response<Self::Response>,
|
|
1016
|
+
tonic::Status,
|
|
1017
|
+
>;
|
|
1018
|
+
fn call(
|
|
1019
|
+
&mut self,
|
|
1020
|
+
request: tonic::Request<super::GetTransactionRequest>,
|
|
1021
|
+
) -> Self::Future {
|
|
1022
|
+
let inner = Arc::clone(&self.0);
|
|
1023
|
+
let fut = async move {
|
|
1024
|
+
(*inner).get_transaction(request).await
|
|
1025
|
+
};
|
|
1026
|
+
Box::pin(fut)
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
let accept_compression_encodings = self.accept_compression_encodings;
|
|
1030
|
+
let send_compression_encodings = self.send_compression_encodings;
|
|
1031
|
+
let max_decoding_message_size = self.max_decoding_message_size;
|
|
1032
|
+
let max_encoding_message_size = self.max_encoding_message_size;
|
|
1033
|
+
let inner = self.inner.clone();
|
|
1034
|
+
let fut = async move {
|
|
1035
|
+
let inner = inner.0;
|
|
1036
|
+
let method = getTransactionSvc(inner);
|
|
1037
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
1038
|
+
let mut grpc = tonic::server::Grpc::new(codec)
|
|
1039
|
+
.apply_compression_config(
|
|
1040
|
+
accept_compression_encodings,
|
|
1041
|
+
send_compression_encodings,
|
|
1042
|
+
)
|
|
1043
|
+
.apply_max_message_size_config(
|
|
1044
|
+
max_decoding_message_size,
|
|
1045
|
+
max_encoding_message_size,
|
|
1046
|
+
);
|
|
1047
|
+
let res = grpc.unary(method, req).await;
|
|
1048
|
+
Ok(res)
|
|
1049
|
+
};
|
|
1050
|
+
Box::pin(fut)
|
|
1051
|
+
}
|
|
1052
|
+
"/org.dash.platform.dapi.v0.Core/getEstimatedTransactionFee" => {
|
|
1053
|
+
#[allow(non_camel_case_types)]
|
|
1054
|
+
struct getEstimatedTransactionFeeSvc<T: Core>(pub Arc<T>);
|
|
1055
|
+
impl<
|
|
1056
|
+
T: Core,
|
|
1057
|
+
> tonic::server::UnaryService<
|
|
1058
|
+
super::GetEstimatedTransactionFeeRequest,
|
|
1059
|
+
> for getEstimatedTransactionFeeSvc<T> {
|
|
1060
|
+
type Response = super::GetEstimatedTransactionFeeResponse;
|
|
1061
|
+
type Future = BoxFuture<
|
|
1062
|
+
tonic::Response<Self::Response>,
|
|
1063
|
+
tonic::Status,
|
|
1064
|
+
>;
|
|
1065
|
+
fn call(
|
|
1066
|
+
&mut self,
|
|
1067
|
+
request: tonic::Request<
|
|
1068
|
+
super::GetEstimatedTransactionFeeRequest,
|
|
1069
|
+
>,
|
|
1070
|
+
) -> Self::Future {
|
|
1071
|
+
let inner = Arc::clone(&self.0);
|
|
1072
|
+
let fut = async move {
|
|
1073
|
+
(*inner).get_estimated_transaction_fee(request).await
|
|
1074
|
+
};
|
|
1075
|
+
Box::pin(fut)
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
let accept_compression_encodings = self.accept_compression_encodings;
|
|
1079
|
+
let send_compression_encodings = self.send_compression_encodings;
|
|
1080
|
+
let max_decoding_message_size = self.max_decoding_message_size;
|
|
1081
|
+
let max_encoding_message_size = self.max_encoding_message_size;
|
|
1082
|
+
let inner = self.inner.clone();
|
|
1083
|
+
let fut = async move {
|
|
1084
|
+
let inner = inner.0;
|
|
1085
|
+
let method = getEstimatedTransactionFeeSvc(inner);
|
|
1086
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
1087
|
+
let mut grpc = tonic::server::Grpc::new(codec)
|
|
1088
|
+
.apply_compression_config(
|
|
1089
|
+
accept_compression_encodings,
|
|
1090
|
+
send_compression_encodings,
|
|
1091
|
+
)
|
|
1092
|
+
.apply_max_message_size_config(
|
|
1093
|
+
max_decoding_message_size,
|
|
1094
|
+
max_encoding_message_size,
|
|
1095
|
+
);
|
|
1096
|
+
let res = grpc.unary(method, req).await;
|
|
1097
|
+
Ok(res)
|
|
1098
|
+
};
|
|
1099
|
+
Box::pin(fut)
|
|
1100
|
+
}
|
|
1101
|
+
"/org.dash.platform.dapi.v0.Core/subscribeToBlockHeadersWithChainLocks" => {
|
|
1102
|
+
#[allow(non_camel_case_types)]
|
|
1103
|
+
struct subscribeToBlockHeadersWithChainLocksSvc<T: Core>(pub Arc<T>);
|
|
1104
|
+
impl<
|
|
1105
|
+
T: Core,
|
|
1106
|
+
> tonic::server::ServerStreamingService<
|
|
1107
|
+
super::BlockHeadersWithChainLocksRequest,
|
|
1108
|
+
> for subscribeToBlockHeadersWithChainLocksSvc<T> {
|
|
1109
|
+
type Response = super::BlockHeadersWithChainLocksResponse;
|
|
1110
|
+
type ResponseStream = T::subscribeToBlockHeadersWithChainLocksStream;
|
|
1111
|
+
type Future = BoxFuture<
|
|
1112
|
+
tonic::Response<Self::ResponseStream>,
|
|
1113
|
+
tonic::Status,
|
|
1114
|
+
>;
|
|
1115
|
+
fn call(
|
|
1116
|
+
&mut self,
|
|
1117
|
+
request: tonic::Request<
|
|
1118
|
+
super::BlockHeadersWithChainLocksRequest,
|
|
1119
|
+
>,
|
|
1120
|
+
) -> Self::Future {
|
|
1121
|
+
let inner = Arc::clone(&self.0);
|
|
1122
|
+
let fut = async move {
|
|
1123
|
+
(*inner)
|
|
1124
|
+
.subscribe_to_block_headers_with_chain_locks(request)
|
|
1125
|
+
.await
|
|
1126
|
+
};
|
|
1127
|
+
Box::pin(fut)
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
let accept_compression_encodings = self.accept_compression_encodings;
|
|
1131
|
+
let send_compression_encodings = self.send_compression_encodings;
|
|
1132
|
+
let max_decoding_message_size = self.max_decoding_message_size;
|
|
1133
|
+
let max_encoding_message_size = self.max_encoding_message_size;
|
|
1134
|
+
let inner = self.inner.clone();
|
|
1135
|
+
let fut = async move {
|
|
1136
|
+
let inner = inner.0;
|
|
1137
|
+
let method = subscribeToBlockHeadersWithChainLocksSvc(inner);
|
|
1138
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
1139
|
+
let mut grpc = tonic::server::Grpc::new(codec)
|
|
1140
|
+
.apply_compression_config(
|
|
1141
|
+
accept_compression_encodings,
|
|
1142
|
+
send_compression_encodings,
|
|
1143
|
+
)
|
|
1144
|
+
.apply_max_message_size_config(
|
|
1145
|
+
max_decoding_message_size,
|
|
1146
|
+
max_encoding_message_size,
|
|
1147
|
+
);
|
|
1148
|
+
let res = grpc.server_streaming(method, req).await;
|
|
1149
|
+
Ok(res)
|
|
1150
|
+
};
|
|
1151
|
+
Box::pin(fut)
|
|
1152
|
+
}
|
|
1153
|
+
"/org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs" => {
|
|
1154
|
+
#[allow(non_camel_case_types)]
|
|
1155
|
+
struct subscribeToTransactionsWithProofsSvc<T: Core>(pub Arc<T>);
|
|
1156
|
+
impl<
|
|
1157
|
+
T: Core,
|
|
1158
|
+
> tonic::server::ServerStreamingService<
|
|
1159
|
+
super::TransactionsWithProofsRequest,
|
|
1160
|
+
> for subscribeToTransactionsWithProofsSvc<T> {
|
|
1161
|
+
type Response = super::TransactionsWithProofsResponse;
|
|
1162
|
+
type ResponseStream = T::subscribeToTransactionsWithProofsStream;
|
|
1163
|
+
type Future = BoxFuture<
|
|
1164
|
+
tonic::Response<Self::ResponseStream>,
|
|
1165
|
+
tonic::Status,
|
|
1166
|
+
>;
|
|
1167
|
+
fn call(
|
|
1168
|
+
&mut self,
|
|
1169
|
+
request: tonic::Request<super::TransactionsWithProofsRequest>,
|
|
1170
|
+
) -> Self::Future {
|
|
1171
|
+
let inner = Arc::clone(&self.0);
|
|
1172
|
+
let fut = async move {
|
|
1173
|
+
(*inner)
|
|
1174
|
+
.subscribe_to_transactions_with_proofs(request)
|
|
1175
|
+
.await
|
|
1176
|
+
};
|
|
1177
|
+
Box::pin(fut)
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
let accept_compression_encodings = self.accept_compression_encodings;
|
|
1181
|
+
let send_compression_encodings = self.send_compression_encodings;
|
|
1182
|
+
let max_decoding_message_size = self.max_decoding_message_size;
|
|
1183
|
+
let max_encoding_message_size = self.max_encoding_message_size;
|
|
1184
|
+
let inner = self.inner.clone();
|
|
1185
|
+
let fut = async move {
|
|
1186
|
+
let inner = inner.0;
|
|
1187
|
+
let method = subscribeToTransactionsWithProofsSvc(inner);
|
|
1188
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
1189
|
+
let mut grpc = tonic::server::Grpc::new(codec)
|
|
1190
|
+
.apply_compression_config(
|
|
1191
|
+
accept_compression_encodings,
|
|
1192
|
+
send_compression_encodings,
|
|
1193
|
+
)
|
|
1194
|
+
.apply_max_message_size_config(
|
|
1195
|
+
max_decoding_message_size,
|
|
1196
|
+
max_encoding_message_size,
|
|
1197
|
+
);
|
|
1198
|
+
let res = grpc.server_streaming(method, req).await;
|
|
1199
|
+
Ok(res)
|
|
1200
|
+
};
|
|
1201
|
+
Box::pin(fut)
|
|
1202
|
+
}
|
|
1203
|
+
_ => {
|
|
1204
|
+
Box::pin(async move {
|
|
1205
|
+
Ok(
|
|
1206
|
+
http::Response::builder()
|
|
1207
|
+
.status(200)
|
|
1208
|
+
.header("grpc-status", "12")
|
|
1209
|
+
.header("content-type", "application/grpc")
|
|
1210
|
+
.body(empty_body())
|
|
1211
|
+
.unwrap(),
|
|
1212
|
+
)
|
|
1213
|
+
})
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
impl<T: Core> Clone for CoreServer<T> {
|
|
1219
|
+
fn clone(&self) -> Self {
|
|
1220
|
+
let inner = self.inner.clone();
|
|
1221
|
+
Self {
|
|
1222
|
+
inner,
|
|
1223
|
+
accept_compression_encodings: self.accept_compression_encodings,
|
|
1224
|
+
send_compression_encodings: self.send_compression_encodings,
|
|
1225
|
+
max_decoding_message_size: self.max_decoding_message_size,
|
|
1226
|
+
max_encoding_message_size: self.max_encoding_message_size,
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
impl<T: Core> Clone for _Inner<T> {
|
|
1231
|
+
fn clone(&self) -> Self {
|
|
1232
|
+
Self(Arc::clone(&self.0))
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
|
|
1236
|
+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
1237
|
+
write!(f, "{:?}", self.0)
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
impl<T: Core> tonic::server::NamedService for CoreServer<T> {
|
|
1241
|
+
const NAME: &'static str = "org.dash.platform.dapi.v0.Core";
|
|
1242
|
+
}
|
|
1243
|
+
}
|