@dashevo/dapi-grpc 1.0.0-dev.11 → 1.0.0-dev.13
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 +2 -1
- package/build.rs +4 -2
- package/clients/core/v0/nodejs/CorePromiseClient.js +51 -13
- package/clients/core/v0/nodejs/core_pbjs.js +869 -703
- package/clients/core/v0/nodejs/core_protoc.js +681 -609
- package/clients/core/v0/web/CorePromiseClient.js +19 -5
- package/clients/core/v0/web/core_pb.d.ts +99 -89
- package/clients/core/v0/web/core_pb.js +681 -609
- package/clients/core/v0/web/core_pb_service.d.ts +29 -10
- package/clients/core/v0/web/core_pb_service.js +46 -6
- package/clients/platform/v0/nodejs/PlatformPromiseClient.js +55 -14
- package/clients/platform/v0/nodejs/platform_pbjs.js +7805 -7761
- package/clients/platform/v0/nodejs/platform_protoc.js +7845 -7749
- package/clients/platform/v0/web/PlatformPromiseClient.js +22 -8
- package/clients/platform/v0/web/platform_pb.d.ts +388 -372
- package/clients/platform/v0/web/platform_pb.js +7845 -7749
- package/clients/platform/v0/web/platform_pb_service.d.ts +35 -35
- package/clients/platform/v0/web/platform_pb_service.js +35 -35
- package/package.json +2 -2
- package/protos/core/v0/core.proto +27 -23
- package/protos/platform/v0/platform.proto +49 -64
- package/src/core/proto/org.dash.platform.dapi.v0.rs +196 -101
- package/src/platform/proto/org.dash.platform.dapi.v0.rs +197 -345
- package/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js +27 -6
- package/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +21 -0
- package/test/unit/getCoreDefinition.spec.js +5 -2
|
@@ -2,29 +2,27 @@
|
|
|
2
2
|
#[derive(::dapi_grpc_macros::Mockable)]
|
|
3
3
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
4
4
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
5
|
-
pub struct
|
|
5
|
+
pub struct GetBlockchainStatusRequest {}
|
|
6
6
|
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
7
7
|
#[derive(::dapi_grpc_macros::Mockable)]
|
|
8
8
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
9
9
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
10
|
-
pub struct
|
|
10
|
+
pub struct GetBlockchainStatusResponse {
|
|
11
11
|
#[prost(message, optional, tag = "1")]
|
|
12
|
-
pub version: ::core::option::Option<
|
|
12
|
+
pub version: ::core::option::Option<get_blockchain_status_response::Version>,
|
|
13
13
|
#[prost(message, optional, tag = "2")]
|
|
14
|
-
pub time: ::core::option::Option<
|
|
15
|
-
#[prost(enumeration = "
|
|
14
|
+
pub time: ::core::option::Option<get_blockchain_status_response::Time>,
|
|
15
|
+
#[prost(enumeration = "get_blockchain_status_response::Status", tag = "3")]
|
|
16
16
|
pub status: i32,
|
|
17
17
|
#[prost(double, tag = "4")]
|
|
18
18
|
pub sync_progress: f64,
|
|
19
19
|
#[prost(message, optional, tag = "5")]
|
|
20
|
-
pub chain: ::core::option::Option<
|
|
21
|
-
#[prost(message, optional, tag = "6")]
|
|
22
|
-
pub masternode: ::core::option::Option<get_status_response::Masternode>,
|
|
20
|
+
pub chain: ::core::option::Option<get_blockchain_status_response::Chain>,
|
|
23
21
|
#[prost(message, optional, tag = "7")]
|
|
24
|
-
pub network: ::core::option::Option<
|
|
22
|
+
pub network: ::core::option::Option<get_blockchain_status_response::Network>,
|
|
25
23
|
}
|
|
26
|
-
/// Nested message and enum types in `
|
|
27
|
-
pub mod
|
|
24
|
+
/// Nested message and enum types in `GetBlockchainStatusResponse`.
|
|
25
|
+
pub mod get_blockchain_status_response {
|
|
28
26
|
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
29
27
|
#[derive(::dapi_grpc_macros::Mockable)]
|
|
30
28
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
@@ -75,80 +73,6 @@ pub mod get_status_response {
|
|
|
75
73
|
#[derive(::dapi_grpc_macros::Mockable)]
|
|
76
74
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
77
75
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
78
|
-
pub struct Masternode {
|
|
79
|
-
#[prost(enumeration = "masternode::Status", tag = "1")]
|
|
80
|
-
pub status: i32,
|
|
81
|
-
#[prost(bytes = "vec", tag = "2")]
|
|
82
|
-
pub pro_tx_hash: ::prost::alloc::vec::Vec<u8>,
|
|
83
|
-
#[prost(uint32, tag = "3")]
|
|
84
|
-
pub pose_penalty: u32,
|
|
85
|
-
#[prost(bool, tag = "4")]
|
|
86
|
-
pub is_synced: bool,
|
|
87
|
-
#[prost(double, tag = "5")]
|
|
88
|
-
pub sync_progress: f64,
|
|
89
|
-
}
|
|
90
|
-
/// Nested message and enum types in `Masternode`.
|
|
91
|
-
pub mod masternode {
|
|
92
|
-
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
93
|
-
#[derive(
|
|
94
|
-
Clone,
|
|
95
|
-
Copy,
|
|
96
|
-
Debug,
|
|
97
|
-
PartialEq,
|
|
98
|
-
Eq,
|
|
99
|
-
Hash,
|
|
100
|
-
PartialOrd,
|
|
101
|
-
Ord,
|
|
102
|
-
::prost::Enumeration
|
|
103
|
-
)]
|
|
104
|
-
#[repr(i32)]
|
|
105
|
-
pub enum Status {
|
|
106
|
-
Unknown = 0,
|
|
107
|
-
WaitingForProtx = 1,
|
|
108
|
-
PoseBanned = 2,
|
|
109
|
-
Removed = 3,
|
|
110
|
-
OperatorKeyChanged = 4,
|
|
111
|
-
ProtxIpChanged = 5,
|
|
112
|
-
Ready = 6,
|
|
113
|
-
Error = 7,
|
|
114
|
-
}
|
|
115
|
-
impl Status {
|
|
116
|
-
/// String value of the enum field names used in the ProtoBuf definition.
|
|
117
|
-
///
|
|
118
|
-
/// The values are not transformed in any way and thus are considered stable
|
|
119
|
-
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
120
|
-
pub fn as_str_name(&self) -> &'static str {
|
|
121
|
-
match self {
|
|
122
|
-
Status::Unknown => "UNKNOWN",
|
|
123
|
-
Status::WaitingForProtx => "WAITING_FOR_PROTX",
|
|
124
|
-
Status::PoseBanned => "POSE_BANNED",
|
|
125
|
-
Status::Removed => "REMOVED",
|
|
126
|
-
Status::OperatorKeyChanged => "OPERATOR_KEY_CHANGED",
|
|
127
|
-
Status::ProtxIpChanged => "PROTX_IP_CHANGED",
|
|
128
|
-
Status::Ready => "READY",
|
|
129
|
-
Status::Error => "ERROR",
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
133
|
-
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
134
|
-
match value {
|
|
135
|
-
"UNKNOWN" => Some(Self::Unknown),
|
|
136
|
-
"WAITING_FOR_PROTX" => Some(Self::WaitingForProtx),
|
|
137
|
-
"POSE_BANNED" => Some(Self::PoseBanned),
|
|
138
|
-
"REMOVED" => Some(Self::Removed),
|
|
139
|
-
"OPERATOR_KEY_CHANGED" => Some(Self::OperatorKeyChanged),
|
|
140
|
-
"PROTX_IP_CHANGED" => Some(Self::ProtxIpChanged),
|
|
141
|
-
"READY" => Some(Self::Ready),
|
|
142
|
-
"ERROR" => Some(Self::Error),
|
|
143
|
-
_ => None,
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
149
|
-
#[derive(::dapi_grpc_macros::Mockable)]
|
|
150
|
-
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
151
|
-
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
152
76
|
pub struct NetworkFee {
|
|
153
77
|
#[prost(double, tag = "1")]
|
|
154
78
|
pub relay: f64,
|
|
@@ -213,6 +137,85 @@ pub mod get_status_response {
|
|
|
213
137
|
#[derive(::dapi_grpc_macros::Mockable)]
|
|
214
138
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
215
139
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
140
|
+
pub struct GetMasternodeStatusRequest {}
|
|
141
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
142
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
143
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
144
|
+
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
145
|
+
pub struct GetMasternodeStatusResponse {
|
|
146
|
+
#[prost(enumeration = "get_masternode_status_response::Status", tag = "1")]
|
|
147
|
+
pub status: i32,
|
|
148
|
+
#[prost(bytes = "vec", tag = "2")]
|
|
149
|
+
pub pro_tx_hash: ::prost::alloc::vec::Vec<u8>,
|
|
150
|
+
#[prost(uint32, tag = "3")]
|
|
151
|
+
pub pose_penalty: u32,
|
|
152
|
+
#[prost(bool, tag = "4")]
|
|
153
|
+
pub is_synced: bool,
|
|
154
|
+
#[prost(double, tag = "5")]
|
|
155
|
+
pub sync_progress: f64,
|
|
156
|
+
}
|
|
157
|
+
/// Nested message and enum types in `GetMasternodeStatusResponse`.
|
|
158
|
+
pub mod get_masternode_status_response {
|
|
159
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
160
|
+
#[derive(
|
|
161
|
+
Clone,
|
|
162
|
+
Copy,
|
|
163
|
+
Debug,
|
|
164
|
+
PartialEq,
|
|
165
|
+
Eq,
|
|
166
|
+
Hash,
|
|
167
|
+
PartialOrd,
|
|
168
|
+
Ord,
|
|
169
|
+
::prost::Enumeration
|
|
170
|
+
)]
|
|
171
|
+
#[repr(i32)]
|
|
172
|
+
pub enum Status {
|
|
173
|
+
Unknown = 0,
|
|
174
|
+
WaitingForProtx = 1,
|
|
175
|
+
PoseBanned = 2,
|
|
176
|
+
Removed = 3,
|
|
177
|
+
OperatorKeyChanged = 4,
|
|
178
|
+
ProtxIpChanged = 5,
|
|
179
|
+
Ready = 6,
|
|
180
|
+
Error = 7,
|
|
181
|
+
}
|
|
182
|
+
impl Status {
|
|
183
|
+
/// String value of the enum field names used in the ProtoBuf definition.
|
|
184
|
+
///
|
|
185
|
+
/// The values are not transformed in any way and thus are considered stable
|
|
186
|
+
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
187
|
+
pub fn as_str_name(&self) -> &'static str {
|
|
188
|
+
match self {
|
|
189
|
+
Status::Unknown => "UNKNOWN",
|
|
190
|
+
Status::WaitingForProtx => "WAITING_FOR_PROTX",
|
|
191
|
+
Status::PoseBanned => "POSE_BANNED",
|
|
192
|
+
Status::Removed => "REMOVED",
|
|
193
|
+
Status::OperatorKeyChanged => "OPERATOR_KEY_CHANGED",
|
|
194
|
+
Status::ProtxIpChanged => "PROTX_IP_CHANGED",
|
|
195
|
+
Status::Ready => "READY",
|
|
196
|
+
Status::Error => "ERROR",
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
200
|
+
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
201
|
+
match value {
|
|
202
|
+
"UNKNOWN" => Some(Self::Unknown),
|
|
203
|
+
"WAITING_FOR_PROTX" => Some(Self::WaitingForProtx),
|
|
204
|
+
"POSE_BANNED" => Some(Self::PoseBanned),
|
|
205
|
+
"REMOVED" => Some(Self::Removed),
|
|
206
|
+
"OPERATOR_KEY_CHANGED" => Some(Self::OperatorKeyChanged),
|
|
207
|
+
"PROTX_IP_CHANGED" => Some(Self::ProtxIpChanged),
|
|
208
|
+
"READY" => Some(Self::Ready),
|
|
209
|
+
"ERROR" => Some(Self::Error),
|
|
210
|
+
_ => None,
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
216
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
217
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
218
|
+
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
216
219
|
pub struct GetBlockRequest {
|
|
217
220
|
#[prost(oneof = "get_block_request::Block", tags = "1, 2")]
|
|
218
221
|
pub block: ::core::option::Option<get_block_request::Block>,
|
|
@@ -516,11 +519,11 @@ pub mod core_client {
|
|
|
516
519
|
self.inner = self.inner.max_encoding_message_size(limit);
|
|
517
520
|
self
|
|
518
521
|
}
|
|
519
|
-
pub async fn
|
|
522
|
+
pub async fn get_blockchain_status(
|
|
520
523
|
&mut self,
|
|
521
|
-
request: impl tonic::IntoRequest<super::
|
|
524
|
+
request: impl tonic::IntoRequest<super::GetBlockchainStatusRequest>,
|
|
522
525
|
) -> std::result::Result<
|
|
523
|
-
tonic::Response<super::
|
|
526
|
+
tonic::Response<super::GetBlockchainStatusResponse>,
|
|
524
527
|
tonic::Status,
|
|
525
528
|
> {
|
|
526
529
|
self.inner
|
|
@@ -534,11 +537,46 @@ pub mod core_client {
|
|
|
534
537
|
})?;
|
|
535
538
|
let codec = tonic::codec::ProstCodec::default();
|
|
536
539
|
let path = http::uri::PathAndQuery::from_static(
|
|
537
|
-
"/org.dash.platform.dapi.v0.Core/
|
|
540
|
+
"/org.dash.platform.dapi.v0.Core/getBlockchainStatus",
|
|
538
541
|
);
|
|
539
542
|
let mut req = request.into_request();
|
|
540
543
|
req.extensions_mut()
|
|
541
|
-
.insert(
|
|
544
|
+
.insert(
|
|
545
|
+
GrpcMethod::new(
|
|
546
|
+
"org.dash.platform.dapi.v0.Core",
|
|
547
|
+
"getBlockchainStatus",
|
|
548
|
+
),
|
|
549
|
+
);
|
|
550
|
+
self.inner.unary(req, path, codec).await
|
|
551
|
+
}
|
|
552
|
+
pub async fn get_masternode_status(
|
|
553
|
+
&mut self,
|
|
554
|
+
request: impl tonic::IntoRequest<super::GetMasternodeStatusRequest>,
|
|
555
|
+
) -> std::result::Result<
|
|
556
|
+
tonic::Response<super::GetMasternodeStatusResponse>,
|
|
557
|
+
tonic::Status,
|
|
558
|
+
> {
|
|
559
|
+
self.inner
|
|
560
|
+
.ready()
|
|
561
|
+
.await
|
|
562
|
+
.map_err(|e| {
|
|
563
|
+
tonic::Status::new(
|
|
564
|
+
tonic::Code::Unknown,
|
|
565
|
+
format!("Service was not ready: {}", e.into()),
|
|
566
|
+
)
|
|
567
|
+
})?;
|
|
568
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
569
|
+
let path = http::uri::PathAndQuery::from_static(
|
|
570
|
+
"/org.dash.platform.dapi.v0.Core/getMasternodeStatus",
|
|
571
|
+
);
|
|
572
|
+
let mut req = request.into_request();
|
|
573
|
+
req.extensions_mut()
|
|
574
|
+
.insert(
|
|
575
|
+
GrpcMethod::new(
|
|
576
|
+
"org.dash.platform.dapi.v0.Core",
|
|
577
|
+
"getMasternodeStatus",
|
|
578
|
+
),
|
|
579
|
+
);
|
|
542
580
|
self.inner.unary(req, path, codec).await
|
|
543
581
|
}
|
|
544
582
|
pub async fn get_block(
|
|
@@ -726,11 +764,18 @@ pub mod core_server {
|
|
|
726
764
|
/// Generated trait containing gRPC methods that should be implemented for use with CoreServer.
|
|
727
765
|
#[async_trait]
|
|
728
766
|
pub trait Core: Send + Sync + 'static {
|
|
729
|
-
async fn
|
|
767
|
+
async fn get_blockchain_status(
|
|
730
768
|
&self,
|
|
731
|
-
request: tonic::Request<super::
|
|
769
|
+
request: tonic::Request<super::GetBlockchainStatusRequest>,
|
|
732
770
|
) -> std::result::Result<
|
|
733
|
-
tonic::Response<super::
|
|
771
|
+
tonic::Response<super::GetBlockchainStatusResponse>,
|
|
772
|
+
tonic::Status,
|
|
773
|
+
>;
|
|
774
|
+
async fn get_masternode_status(
|
|
775
|
+
&self,
|
|
776
|
+
request: tonic::Request<super::GetMasternodeStatusRequest>,
|
|
777
|
+
) -> std::result::Result<
|
|
778
|
+
tonic::Response<super::GetMasternodeStatusResponse>,
|
|
734
779
|
tonic::Status,
|
|
735
780
|
>;
|
|
736
781
|
async fn get_block(
|
|
@@ -873,22 +918,72 @@ pub mod core_server {
|
|
|
873
918
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
874
919
|
let inner = self.inner.clone();
|
|
875
920
|
match req.uri().path() {
|
|
876
|
-
"/org.dash.platform.dapi.v0.Core/
|
|
921
|
+
"/org.dash.platform.dapi.v0.Core/getBlockchainStatus" => {
|
|
922
|
+
#[allow(non_camel_case_types)]
|
|
923
|
+
struct getBlockchainStatusSvc<T: Core>(pub Arc<T>);
|
|
924
|
+
impl<
|
|
925
|
+
T: Core,
|
|
926
|
+
> tonic::server::UnaryService<super::GetBlockchainStatusRequest>
|
|
927
|
+
for getBlockchainStatusSvc<T> {
|
|
928
|
+
type Response = super::GetBlockchainStatusResponse;
|
|
929
|
+
type Future = BoxFuture<
|
|
930
|
+
tonic::Response<Self::Response>,
|
|
931
|
+
tonic::Status,
|
|
932
|
+
>;
|
|
933
|
+
fn call(
|
|
934
|
+
&mut self,
|
|
935
|
+
request: tonic::Request<super::GetBlockchainStatusRequest>,
|
|
936
|
+
) -> Self::Future {
|
|
937
|
+
let inner = Arc::clone(&self.0);
|
|
938
|
+
let fut = async move {
|
|
939
|
+
(*inner).get_blockchain_status(request).await
|
|
940
|
+
};
|
|
941
|
+
Box::pin(fut)
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
let accept_compression_encodings = self.accept_compression_encodings;
|
|
945
|
+
let send_compression_encodings = self.send_compression_encodings;
|
|
946
|
+
let max_decoding_message_size = self.max_decoding_message_size;
|
|
947
|
+
let max_encoding_message_size = self.max_encoding_message_size;
|
|
948
|
+
let inner = self.inner.clone();
|
|
949
|
+
let fut = async move {
|
|
950
|
+
let inner = inner.0;
|
|
951
|
+
let method = getBlockchainStatusSvc(inner);
|
|
952
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
953
|
+
let mut grpc = tonic::server::Grpc::new(codec)
|
|
954
|
+
.apply_compression_config(
|
|
955
|
+
accept_compression_encodings,
|
|
956
|
+
send_compression_encodings,
|
|
957
|
+
)
|
|
958
|
+
.apply_max_message_size_config(
|
|
959
|
+
max_decoding_message_size,
|
|
960
|
+
max_encoding_message_size,
|
|
961
|
+
);
|
|
962
|
+
let res = grpc.unary(method, req).await;
|
|
963
|
+
Ok(res)
|
|
964
|
+
};
|
|
965
|
+
Box::pin(fut)
|
|
966
|
+
}
|
|
967
|
+
"/org.dash.platform.dapi.v0.Core/getMasternodeStatus" => {
|
|
877
968
|
#[allow(non_camel_case_types)]
|
|
878
|
-
struct
|
|
879
|
-
impl<
|
|
880
|
-
|
|
881
|
-
|
|
969
|
+
struct getMasternodeStatusSvc<T: Core>(pub Arc<T>);
|
|
970
|
+
impl<
|
|
971
|
+
T: Core,
|
|
972
|
+
> tonic::server::UnaryService<super::GetMasternodeStatusRequest>
|
|
973
|
+
for getMasternodeStatusSvc<T> {
|
|
974
|
+
type Response = super::GetMasternodeStatusResponse;
|
|
882
975
|
type Future = BoxFuture<
|
|
883
976
|
tonic::Response<Self::Response>,
|
|
884
977
|
tonic::Status,
|
|
885
978
|
>;
|
|
886
979
|
fn call(
|
|
887
980
|
&mut self,
|
|
888
|
-
request: tonic::Request<super::
|
|
981
|
+
request: tonic::Request<super::GetMasternodeStatusRequest>,
|
|
889
982
|
) -> Self::Future {
|
|
890
983
|
let inner = Arc::clone(&self.0);
|
|
891
|
-
let fut = async move {
|
|
984
|
+
let fut = async move {
|
|
985
|
+
(*inner).get_masternode_status(request).await
|
|
986
|
+
};
|
|
892
987
|
Box::pin(fut)
|
|
893
988
|
}
|
|
894
989
|
}
|
|
@@ -899,7 +994,7 @@ pub mod core_server {
|
|
|
899
994
|
let inner = self.inner.clone();
|
|
900
995
|
let fut = async move {
|
|
901
996
|
let inner = inner.0;
|
|
902
|
-
let method =
|
|
997
|
+
let method = getMasternodeStatusSvc(inner);
|
|
903
998
|
let codec = tonic::codec::ProstCodec::default();
|
|
904
999
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
905
1000
|
.apply_compression_config(
|