@dashevo/dapi-grpc 0.25.21 → 1.0.0-beta.1

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.
Files changed (31) hide show
  1. package/Cargo.toml +35 -16
  2. package/build.rs +139 -56
  3. package/clients/core/v0/nodejs/CorePromiseClient.js +124 -13
  4. package/clients/core/v0/nodejs/core_pbjs.js +1922 -987
  5. package/clients/core/v0/nodejs/core_protoc.js +1291 -645
  6. package/clients/core/v0/rust/core_example.rs +1 -1
  7. package/clients/core/v0/web/CorePromiseClient.js +49 -5
  8. package/clients/core/v0/web/core_pb.d.ts +173 -89
  9. package/clients/core/v0/web/core_pb.js +1291 -645
  10. package/clients/core/v0/web/core_pb_service.d.ts +59 -10
  11. package/clients/core/v0/web/core_pb_service.js +134 -6
  12. package/clients/platform/v0/nodejs/PlatformPromiseClient.js +208 -14
  13. package/clients/platform/v0/nodejs/platform_pbjs.js +22951 -9938
  14. package/clients/platform/v0/nodejs/platform_protoc.js +22332 -9091
  15. package/clients/platform/v0/rust/platform_example.rs +1 -1
  16. package/clients/platform/v0/web/PlatformPromiseClient.js +64 -8
  17. package/clients/platform/v0/web/platform_pb.d.ts +2057 -302
  18. package/clients/platform/v0/web/platform_pb.js +22332 -9091
  19. package/clients/platform/v0/web/platform_pb_service.d.ts +187 -35
  20. package/clients/platform/v0/web/platform_pb_service.js +355 -35
  21. package/package.json +2 -2
  22. package/protos/core/v0/core.proto +45 -23
  23. package/protos/platform/v0/platform.proto +429 -50
  24. package/src/lib.rs +26 -2
  25. package/src/mock/serde_mockable.rs +105 -0
  26. package/src/mock.rs +130 -0
  27. package/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js +27 -6
  28. package/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +55 -1
  29. package/test/unit/getCoreDefinition.spec.js +5 -2
  30. package/src/core/proto/org.dash.platform.dapi.v0.rs +0 -666
  31. package/src/platform/proto/org.dash.platform.dapi.v0.rs +0 -2481
@@ -1,666 +0,0 @@
1
- #[allow(clippy::derive_partial_eq_without_eq)]
2
- #[derive(Clone, PartialEq, ::prost::Message)]
3
- pub struct GetStatusRequest {}
4
- #[allow(clippy::derive_partial_eq_without_eq)]
5
- #[derive(Clone, PartialEq, ::prost::Message)]
6
- pub struct GetStatusResponse {
7
- #[prost(message, optional, tag = "1")]
8
- pub version: ::core::option::Option<get_status_response::Version>,
9
- #[prost(message, optional, tag = "2")]
10
- pub time: ::core::option::Option<get_status_response::Time>,
11
- #[prost(enumeration = "get_status_response::Status", tag = "3")]
12
- pub status: i32,
13
- #[prost(double, tag = "4")]
14
- pub sync_progress: f64,
15
- #[prost(message, optional, tag = "5")]
16
- pub chain: ::core::option::Option<get_status_response::Chain>,
17
- #[prost(message, optional, tag = "6")]
18
- pub masternode: ::core::option::Option<get_status_response::Masternode>,
19
- #[prost(message, optional, tag = "7")]
20
- pub network: ::core::option::Option<get_status_response::Network>,
21
- }
22
- /// Nested message and enum types in `GetStatusResponse`.
23
- pub mod get_status_response {
24
- #[allow(clippy::derive_partial_eq_without_eq)]
25
- #[derive(Clone, PartialEq, ::prost::Message)]
26
- pub struct Version {
27
- #[prost(uint32, tag = "1")]
28
- pub protocol: u32,
29
- #[prost(uint32, tag = "2")]
30
- pub software: u32,
31
- #[prost(string, tag = "3")]
32
- pub agent: ::prost::alloc::string::String,
33
- }
34
- #[allow(clippy::derive_partial_eq_without_eq)]
35
- #[derive(Clone, PartialEq, ::prost::Message)]
36
- pub struct Time {
37
- #[prost(uint32, tag = "1")]
38
- pub now: u32,
39
- #[prost(int32, tag = "2")]
40
- pub offset: i32,
41
- #[prost(uint32, tag = "3")]
42
- pub median: u32,
43
- }
44
- #[allow(clippy::derive_partial_eq_without_eq)]
45
- #[derive(Clone, PartialEq, ::prost::Message)]
46
- pub struct Chain {
47
- #[prost(string, tag = "1")]
48
- pub name: ::prost::alloc::string::String,
49
- #[prost(uint32, tag = "2")]
50
- pub headers_count: u32,
51
- #[prost(uint32, tag = "3")]
52
- pub blocks_count: u32,
53
- #[prost(bytes = "vec", tag = "4")]
54
- pub best_block_hash: ::prost::alloc::vec::Vec<u8>,
55
- #[prost(double, tag = "5")]
56
- pub difficulty: f64,
57
- #[prost(bytes = "vec", tag = "6")]
58
- pub chain_work: ::prost::alloc::vec::Vec<u8>,
59
- #[prost(bool, tag = "7")]
60
- pub is_synced: bool,
61
- #[prost(double, tag = "8")]
62
- pub sync_progress: f64,
63
- }
64
- #[allow(clippy::derive_partial_eq_without_eq)]
65
- #[derive(Clone, PartialEq, ::prost::Message)]
66
- pub struct Masternode {
67
- #[prost(enumeration = "masternode::Status", tag = "1")]
68
- pub status: i32,
69
- #[prost(bytes = "vec", tag = "2")]
70
- pub pro_tx_hash: ::prost::alloc::vec::Vec<u8>,
71
- #[prost(uint32, tag = "3")]
72
- pub pose_penalty: u32,
73
- #[prost(bool, tag = "4")]
74
- pub is_synced: bool,
75
- #[prost(double, tag = "5")]
76
- pub sync_progress: f64,
77
- }
78
- /// Nested message and enum types in `Masternode`.
79
- pub mod masternode {
80
- #[derive(
81
- Clone,
82
- Copy,
83
- Debug,
84
- PartialEq,
85
- Eq,
86
- Hash,
87
- PartialOrd,
88
- Ord,
89
- ::prost::Enumeration
90
- )]
91
- #[repr(i32)]
92
- pub enum Status {
93
- Unknown = 0,
94
- WaitingForProtx = 1,
95
- PoseBanned = 2,
96
- Removed = 3,
97
- OperatorKeyChanged = 4,
98
- ProtxIpChanged = 5,
99
- Ready = 6,
100
- Error = 7,
101
- }
102
- impl Status {
103
- /// String value of the enum field names used in the ProtoBuf definition.
104
- ///
105
- /// The values are not transformed in any way and thus are considered stable
106
- /// (if the ProtoBuf definition does not change) and safe for programmatic use.
107
- pub fn as_str_name(&self) -> &'static str {
108
- match self {
109
- Status::Unknown => "UNKNOWN",
110
- Status::WaitingForProtx => "WAITING_FOR_PROTX",
111
- Status::PoseBanned => "POSE_BANNED",
112
- Status::Removed => "REMOVED",
113
- Status::OperatorKeyChanged => "OPERATOR_KEY_CHANGED",
114
- Status::ProtxIpChanged => "PROTX_IP_CHANGED",
115
- Status::Ready => "READY",
116
- Status::Error => "ERROR",
117
- }
118
- }
119
- /// Creates an enum from field names used in the ProtoBuf definition.
120
- pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
121
- match value {
122
- "UNKNOWN" => Some(Self::Unknown),
123
- "WAITING_FOR_PROTX" => Some(Self::WaitingForProtx),
124
- "POSE_BANNED" => Some(Self::PoseBanned),
125
- "REMOVED" => Some(Self::Removed),
126
- "OPERATOR_KEY_CHANGED" => Some(Self::OperatorKeyChanged),
127
- "PROTX_IP_CHANGED" => Some(Self::ProtxIpChanged),
128
- "READY" => Some(Self::Ready),
129
- "ERROR" => Some(Self::Error),
130
- _ => None,
131
- }
132
- }
133
- }
134
- }
135
- #[allow(clippy::derive_partial_eq_without_eq)]
136
- #[derive(Clone, PartialEq, ::prost::Message)]
137
- pub struct NetworkFee {
138
- #[prost(double, tag = "1")]
139
- pub relay: f64,
140
- #[prost(double, tag = "2")]
141
- pub incremental: f64,
142
- }
143
- #[allow(clippy::derive_partial_eq_without_eq)]
144
- #[derive(Clone, PartialEq, ::prost::Message)]
145
- pub struct Network {
146
- #[prost(uint32, tag = "1")]
147
- pub peers_count: u32,
148
- #[prost(message, optional, tag = "2")]
149
- pub fee: ::core::option::Option<NetworkFee>,
150
- }
151
- #[derive(
152
- Clone,
153
- Copy,
154
- Debug,
155
- PartialEq,
156
- Eq,
157
- Hash,
158
- PartialOrd,
159
- Ord,
160
- ::prost::Enumeration
161
- )]
162
- #[repr(i32)]
163
- pub enum Status {
164
- NotStarted = 0,
165
- Syncing = 1,
166
- Ready = 2,
167
- Error = 3,
168
- }
169
- impl Status {
170
- /// String value of the enum field names used in the ProtoBuf definition.
171
- ///
172
- /// The values are not transformed in any way and thus are considered stable
173
- /// (if the ProtoBuf definition does not change) and safe for programmatic use.
174
- pub fn as_str_name(&self) -> &'static str {
175
- match self {
176
- Status::NotStarted => "NOT_STARTED",
177
- Status::Syncing => "SYNCING",
178
- Status::Ready => "READY",
179
- Status::Error => "ERROR",
180
- }
181
- }
182
- /// Creates an enum from field names used in the ProtoBuf definition.
183
- pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
184
- match value {
185
- "NOT_STARTED" => Some(Self::NotStarted),
186
- "SYNCING" => Some(Self::Syncing),
187
- "READY" => Some(Self::Ready),
188
- "ERROR" => Some(Self::Error),
189
- _ => None,
190
- }
191
- }
192
- }
193
- }
194
- #[allow(clippy::derive_partial_eq_without_eq)]
195
- #[derive(Clone, PartialEq, ::prost::Message)]
196
- pub struct GetBlockRequest {
197
- #[prost(oneof = "get_block_request::Block", tags = "1, 2")]
198
- pub block: ::core::option::Option<get_block_request::Block>,
199
- }
200
- /// Nested message and enum types in `GetBlockRequest`.
201
- pub mod get_block_request {
202
- #[allow(clippy::derive_partial_eq_without_eq)]
203
- #[derive(Clone, PartialEq, ::prost::Oneof)]
204
- pub enum Block {
205
- #[prost(uint32, tag = "1")]
206
- Height(u32),
207
- #[prost(string, tag = "2")]
208
- Hash(::prost::alloc::string::String),
209
- }
210
- }
211
- #[allow(clippy::derive_partial_eq_without_eq)]
212
- #[derive(Clone, PartialEq, ::prost::Message)]
213
- pub struct GetBlockResponse {
214
- #[prost(bytes = "vec", tag = "1")]
215
- pub block: ::prost::alloc::vec::Vec<u8>,
216
- }
217
- #[allow(clippy::derive_partial_eq_without_eq)]
218
- #[derive(Clone, PartialEq, ::prost::Message)]
219
- pub struct BroadcastTransactionRequest {
220
- #[prost(bytes = "vec", tag = "1")]
221
- pub transaction: ::prost::alloc::vec::Vec<u8>,
222
- #[prost(bool, tag = "2")]
223
- pub allow_high_fees: bool,
224
- #[prost(bool, tag = "3")]
225
- pub bypass_limits: bool,
226
- }
227
- #[allow(clippy::derive_partial_eq_without_eq)]
228
- #[derive(Clone, PartialEq, ::prost::Message)]
229
- pub struct BroadcastTransactionResponse {
230
- #[prost(string, tag = "1")]
231
- pub transaction_id: ::prost::alloc::string::String,
232
- }
233
- #[allow(clippy::derive_partial_eq_without_eq)]
234
- #[derive(Clone, PartialEq, ::prost::Message)]
235
- pub struct GetTransactionRequest {
236
- #[prost(string, tag = "1")]
237
- pub id: ::prost::alloc::string::String,
238
- }
239
- #[allow(clippy::derive_partial_eq_without_eq)]
240
- #[derive(Clone, PartialEq, ::prost::Message)]
241
- pub struct GetTransactionResponse {
242
- #[prost(bytes = "vec", tag = "1")]
243
- pub transaction: ::prost::alloc::vec::Vec<u8>,
244
- #[prost(bytes = "vec", tag = "2")]
245
- pub block_hash: ::prost::alloc::vec::Vec<u8>,
246
- #[prost(uint32, tag = "3")]
247
- pub height: u32,
248
- #[prost(uint32, tag = "4")]
249
- pub confirmations: u32,
250
- #[prost(bool, tag = "5")]
251
- pub is_instant_locked: bool,
252
- #[prost(bool, tag = "6")]
253
- pub is_chain_locked: bool,
254
- }
255
- #[allow(clippy::derive_partial_eq_without_eq)]
256
- #[derive(Clone, PartialEq, ::prost::Message)]
257
- pub struct BlockHeadersWithChainLocksRequest {
258
- #[prost(uint32, tag = "3")]
259
- pub count: u32,
260
- #[prost(oneof = "block_headers_with_chain_locks_request::FromBlock", tags = "1, 2")]
261
- pub from_block: ::core::option::Option<
262
- block_headers_with_chain_locks_request::FromBlock,
263
- >,
264
- }
265
- /// Nested message and enum types in `BlockHeadersWithChainLocksRequest`.
266
- pub mod block_headers_with_chain_locks_request {
267
- #[allow(clippy::derive_partial_eq_without_eq)]
268
- #[derive(Clone, PartialEq, ::prost::Oneof)]
269
- pub enum FromBlock {
270
- #[prost(bytes, tag = "1")]
271
- FromBlockHash(::prost::alloc::vec::Vec<u8>),
272
- #[prost(uint32, tag = "2")]
273
- FromBlockHeight(u32),
274
- }
275
- }
276
- #[allow(clippy::derive_partial_eq_without_eq)]
277
- #[derive(Clone, PartialEq, ::prost::Message)]
278
- pub struct BlockHeadersWithChainLocksResponse {
279
- #[prost(oneof = "block_headers_with_chain_locks_response::Responses", tags = "1, 2")]
280
- pub responses: ::core::option::Option<
281
- block_headers_with_chain_locks_response::Responses,
282
- >,
283
- }
284
- /// Nested message and enum types in `BlockHeadersWithChainLocksResponse`.
285
- pub mod block_headers_with_chain_locks_response {
286
- #[allow(clippy::derive_partial_eq_without_eq)]
287
- #[derive(Clone, PartialEq, ::prost::Oneof)]
288
- pub enum Responses {
289
- #[prost(message, tag = "1")]
290
- BlockHeaders(super::BlockHeaders),
291
- #[prost(bytes, tag = "2")]
292
- ChainLock(::prost::alloc::vec::Vec<u8>),
293
- }
294
- }
295
- #[allow(clippy::derive_partial_eq_without_eq)]
296
- #[derive(Clone, PartialEq, ::prost::Message)]
297
- pub struct BlockHeaders {
298
- #[prost(bytes = "vec", repeated, tag = "1")]
299
- pub headers: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
300
- }
301
- #[allow(clippy::derive_partial_eq_without_eq)]
302
- #[derive(Clone, PartialEq, ::prost::Message)]
303
- pub struct GetEstimatedTransactionFeeRequest {
304
- #[prost(uint32, tag = "1")]
305
- pub blocks: u32,
306
- }
307
- #[allow(clippy::derive_partial_eq_without_eq)]
308
- #[derive(Clone, PartialEq, ::prost::Message)]
309
- pub struct GetEstimatedTransactionFeeResponse {
310
- #[prost(double, tag = "1")]
311
- pub fee: f64,
312
- }
313
- #[allow(clippy::derive_partial_eq_without_eq)]
314
- #[derive(Clone, PartialEq, ::prost::Message)]
315
- pub struct TransactionsWithProofsRequest {
316
- #[prost(message, optional, tag = "1")]
317
- pub bloom_filter: ::core::option::Option<BloomFilter>,
318
- #[prost(uint32, tag = "4")]
319
- pub count: u32,
320
- #[prost(bool, tag = "5")]
321
- pub send_transaction_hashes: bool,
322
- #[prost(oneof = "transactions_with_proofs_request::FromBlock", tags = "2, 3")]
323
- pub from_block: ::core::option::Option<transactions_with_proofs_request::FromBlock>,
324
- }
325
- /// Nested message and enum types in `TransactionsWithProofsRequest`.
326
- pub mod transactions_with_proofs_request {
327
- #[allow(clippy::derive_partial_eq_without_eq)]
328
- #[derive(Clone, PartialEq, ::prost::Oneof)]
329
- pub enum FromBlock {
330
- #[prost(bytes, tag = "2")]
331
- FromBlockHash(::prost::alloc::vec::Vec<u8>),
332
- #[prost(uint32, tag = "3")]
333
- FromBlockHeight(u32),
334
- }
335
- }
336
- #[allow(clippy::derive_partial_eq_without_eq)]
337
- #[derive(Clone, PartialEq, ::prost::Message)]
338
- pub struct BloomFilter {
339
- #[prost(bytes = "vec", tag = "1")]
340
- pub v_data: ::prost::alloc::vec::Vec<u8>,
341
- #[prost(uint32, tag = "2")]
342
- pub n_hash_funcs: u32,
343
- #[prost(uint32, tag = "3")]
344
- pub n_tweak: u32,
345
- #[prost(uint32, tag = "4")]
346
- pub n_flags: u32,
347
- }
348
- #[allow(clippy::derive_partial_eq_without_eq)]
349
- #[derive(Clone, PartialEq, ::prost::Message)]
350
- pub struct TransactionsWithProofsResponse {
351
- #[prost(oneof = "transactions_with_proofs_response::Responses", tags = "1, 2, 3")]
352
- pub responses: ::core::option::Option<transactions_with_proofs_response::Responses>,
353
- }
354
- /// Nested message and enum types in `TransactionsWithProofsResponse`.
355
- pub mod transactions_with_proofs_response {
356
- #[allow(clippy::derive_partial_eq_without_eq)]
357
- #[derive(Clone, PartialEq, ::prost::Oneof)]
358
- pub enum Responses {
359
- #[prost(message, tag = "1")]
360
- RawTransactions(super::RawTransactions),
361
- #[prost(message, tag = "2")]
362
- InstantSendLockMessages(super::InstantSendLockMessages),
363
- #[prost(bytes, tag = "3")]
364
- RawMerkleBlock(::prost::alloc::vec::Vec<u8>),
365
- }
366
- }
367
- #[allow(clippy::derive_partial_eq_without_eq)]
368
- #[derive(Clone, PartialEq, ::prost::Message)]
369
- pub struct RawTransactions {
370
- #[prost(bytes = "vec", repeated, tag = "1")]
371
- pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
372
- }
373
- #[allow(clippy::derive_partial_eq_without_eq)]
374
- #[derive(Clone, PartialEq, ::prost::Message)]
375
- pub struct InstantSendLockMessages {
376
- #[prost(bytes = "vec", repeated, tag = "1")]
377
- pub messages: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
378
- }
379
- /// Generated client implementations.
380
- pub mod core_client {
381
- #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
382
- use tonic::codegen::*;
383
- use tonic::codegen::http::Uri;
384
- #[derive(Debug, Clone)]
385
- pub struct CoreClient<T> {
386
- inner: tonic::client::Grpc<T>,
387
- }
388
- impl CoreClient<tonic::transport::Channel> {
389
- /// Attempt to create a new client by connecting to a given endpoint.
390
- pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
391
- where
392
- D: TryInto<tonic::transport::Endpoint>,
393
- D::Error: Into<StdError>,
394
- {
395
- let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
396
- Ok(Self::new(conn))
397
- }
398
- }
399
- impl<T> CoreClient<T>
400
- where
401
- T: tonic::client::GrpcService<tonic::body::BoxBody>,
402
- T::Error: Into<StdError>,
403
- T::ResponseBody: Body<Data = Bytes> + Send + 'static,
404
- <T::ResponseBody as Body>::Error: Into<StdError> + Send,
405
- {
406
- pub fn new(inner: T) -> Self {
407
- let inner = tonic::client::Grpc::new(inner);
408
- Self { inner }
409
- }
410
- pub fn with_origin(inner: T, origin: Uri) -> Self {
411
- let inner = tonic::client::Grpc::with_origin(inner, origin);
412
- Self { inner }
413
- }
414
- pub fn with_interceptor<F>(
415
- inner: T,
416
- interceptor: F,
417
- ) -> CoreClient<InterceptedService<T, F>>
418
- where
419
- F: tonic::service::Interceptor,
420
- T::ResponseBody: Default,
421
- T: tonic::codegen::Service<
422
- http::Request<tonic::body::BoxBody>,
423
- Response = http::Response<
424
- <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
425
- >,
426
- >,
427
- <T as tonic::codegen::Service<
428
- http::Request<tonic::body::BoxBody>,
429
- >>::Error: Into<StdError> + Send + Sync,
430
- {
431
- CoreClient::new(InterceptedService::new(inner, interceptor))
432
- }
433
- /// Compress requests with the given encoding.
434
- ///
435
- /// This requires the server to support it otherwise it might respond with an
436
- /// error.
437
- #[must_use]
438
- pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
439
- self.inner = self.inner.send_compressed(encoding);
440
- self
441
- }
442
- /// Enable decompressing responses.
443
- #[must_use]
444
- pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
445
- self.inner = self.inner.accept_compressed(encoding);
446
- self
447
- }
448
- /// Limits the maximum size of a decoded message.
449
- ///
450
- /// Default: `4MB`
451
- #[must_use]
452
- pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
453
- self.inner = self.inner.max_decoding_message_size(limit);
454
- self
455
- }
456
- /// Limits the maximum size of an encoded message.
457
- ///
458
- /// Default: `usize::MAX`
459
- #[must_use]
460
- pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
461
- self.inner = self.inner.max_encoding_message_size(limit);
462
- self
463
- }
464
- pub async fn get_status(
465
- &mut self,
466
- request: impl tonic::IntoRequest<super::GetStatusRequest>,
467
- ) -> std::result::Result<
468
- tonic::Response<super::GetStatusResponse>,
469
- tonic::Status,
470
- > {
471
- self.inner
472
- .ready()
473
- .await
474
- .map_err(|e| {
475
- tonic::Status::new(
476
- tonic::Code::Unknown,
477
- format!("Service was not ready: {}", e.into()),
478
- )
479
- })?;
480
- let codec = tonic::codec::ProstCodec::default();
481
- let path = http::uri::PathAndQuery::from_static(
482
- "/org.dash.platform.dapi.v0.Core/getStatus",
483
- );
484
- let mut req = request.into_request();
485
- req.extensions_mut()
486
- .insert(GrpcMethod::new("org.dash.platform.dapi.v0.Core", "getStatus"));
487
- self.inner.unary(req, path, codec).await
488
- }
489
- pub async fn get_block(
490
- &mut self,
491
- request: impl tonic::IntoRequest<super::GetBlockRequest>,
492
- ) -> std::result::Result<
493
- tonic::Response<super::GetBlockResponse>,
494
- tonic::Status,
495
- > {
496
- self.inner
497
- .ready()
498
- .await
499
- .map_err(|e| {
500
- tonic::Status::new(
501
- tonic::Code::Unknown,
502
- format!("Service was not ready: {}", e.into()),
503
- )
504
- })?;
505
- let codec = tonic::codec::ProstCodec::default();
506
- let path = http::uri::PathAndQuery::from_static(
507
- "/org.dash.platform.dapi.v0.Core/getBlock",
508
- );
509
- let mut req = request.into_request();
510
- req.extensions_mut()
511
- .insert(GrpcMethod::new("org.dash.platform.dapi.v0.Core", "getBlock"));
512
- self.inner.unary(req, path, codec).await
513
- }
514
- pub async fn broadcast_transaction(
515
- &mut self,
516
- request: impl tonic::IntoRequest<super::BroadcastTransactionRequest>,
517
- ) -> std::result::Result<
518
- tonic::Response<super::BroadcastTransactionResponse>,
519
- tonic::Status,
520
- > {
521
- self.inner
522
- .ready()
523
- .await
524
- .map_err(|e| {
525
- tonic::Status::new(
526
- tonic::Code::Unknown,
527
- format!("Service was not ready: {}", e.into()),
528
- )
529
- })?;
530
- let codec = tonic::codec::ProstCodec::default();
531
- let path = http::uri::PathAndQuery::from_static(
532
- "/org.dash.platform.dapi.v0.Core/broadcastTransaction",
533
- );
534
- let mut req = request.into_request();
535
- req.extensions_mut()
536
- .insert(
537
- GrpcMethod::new(
538
- "org.dash.platform.dapi.v0.Core",
539
- "broadcastTransaction",
540
- ),
541
- );
542
- self.inner.unary(req, path, codec).await
543
- }
544
- pub async fn get_transaction(
545
- &mut self,
546
- request: impl tonic::IntoRequest<super::GetTransactionRequest>,
547
- ) -> std::result::Result<
548
- tonic::Response<super::GetTransactionResponse>,
549
- tonic::Status,
550
- > {
551
- self.inner
552
- .ready()
553
- .await
554
- .map_err(|e| {
555
- tonic::Status::new(
556
- tonic::Code::Unknown,
557
- format!("Service was not ready: {}", e.into()),
558
- )
559
- })?;
560
- let codec = tonic::codec::ProstCodec::default();
561
- let path = http::uri::PathAndQuery::from_static(
562
- "/org.dash.platform.dapi.v0.Core/getTransaction",
563
- );
564
- let mut req = request.into_request();
565
- req.extensions_mut()
566
- .insert(
567
- GrpcMethod::new("org.dash.platform.dapi.v0.Core", "getTransaction"),
568
- );
569
- self.inner.unary(req, path, codec).await
570
- }
571
- pub async fn get_estimated_transaction_fee(
572
- &mut self,
573
- request: impl tonic::IntoRequest<super::GetEstimatedTransactionFeeRequest>,
574
- ) -> std::result::Result<
575
- tonic::Response<super::GetEstimatedTransactionFeeResponse>,
576
- tonic::Status,
577
- > {
578
- self.inner
579
- .ready()
580
- .await
581
- .map_err(|e| {
582
- tonic::Status::new(
583
- tonic::Code::Unknown,
584
- format!("Service was not ready: {}", e.into()),
585
- )
586
- })?;
587
- let codec = tonic::codec::ProstCodec::default();
588
- let path = http::uri::PathAndQuery::from_static(
589
- "/org.dash.platform.dapi.v0.Core/getEstimatedTransactionFee",
590
- );
591
- let mut req = request.into_request();
592
- req.extensions_mut()
593
- .insert(
594
- GrpcMethod::new(
595
- "org.dash.platform.dapi.v0.Core",
596
- "getEstimatedTransactionFee",
597
- ),
598
- );
599
- self.inner.unary(req, path, codec).await
600
- }
601
- pub async fn subscribe_to_block_headers_with_chain_locks(
602
- &mut self,
603
- request: impl tonic::IntoRequest<super::BlockHeadersWithChainLocksRequest>,
604
- ) -> std::result::Result<
605
- tonic::Response<
606
- tonic::codec::Streaming<super::BlockHeadersWithChainLocksResponse>,
607
- >,
608
- tonic::Status,
609
- > {
610
- self.inner
611
- .ready()
612
- .await
613
- .map_err(|e| {
614
- tonic::Status::new(
615
- tonic::Code::Unknown,
616
- format!("Service was not ready: {}", e.into()),
617
- )
618
- })?;
619
- let codec = tonic::codec::ProstCodec::default();
620
- let path = http::uri::PathAndQuery::from_static(
621
- "/org.dash.platform.dapi.v0.Core/subscribeToBlockHeadersWithChainLocks",
622
- );
623
- let mut req = request.into_request();
624
- req.extensions_mut()
625
- .insert(
626
- GrpcMethod::new(
627
- "org.dash.platform.dapi.v0.Core",
628
- "subscribeToBlockHeadersWithChainLocks",
629
- ),
630
- );
631
- self.inner.server_streaming(req, path, codec).await
632
- }
633
- pub async fn subscribe_to_transactions_with_proofs(
634
- &mut self,
635
- request: impl tonic::IntoRequest<super::TransactionsWithProofsRequest>,
636
- ) -> std::result::Result<
637
- tonic::Response<
638
- tonic::codec::Streaming<super::TransactionsWithProofsResponse>,
639
- >,
640
- tonic::Status,
641
- > {
642
- self.inner
643
- .ready()
644
- .await
645
- .map_err(|e| {
646
- tonic::Status::new(
647
- tonic::Code::Unknown,
648
- format!("Service was not ready: {}", e.into()),
649
- )
650
- })?;
651
- let codec = tonic::codec::ProstCodec::default();
652
- let path = http::uri::PathAndQuery::from_static(
653
- "/org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs",
654
- );
655
- let mut req = request.into_request();
656
- req.extensions_mut()
657
- .insert(
658
- GrpcMethod::new(
659
- "org.dash.platform.dapi.v0.Core",
660
- "subscribeToTransactionsWithProofs",
661
- ),
662
- );
663
- self.inner.server_streaming(req, path, codec).await
664
- }
665
- }
666
- }