@dashevo/dapi-grpc 1.0.0-dev.10 → 1.0.0-dev.11
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 +13 -8
- package/build.rs +4 -2
- package/package.json +2 -2
- package/protos/platform/v0/platform.proto +32 -0
- package/src/platform/proto/org.dash.platform.dapi.v0.rs +176 -0
package/Cargo.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "dapi-grpc"
|
|
3
3
|
description = "GRPC client for Dash Platform"
|
|
4
|
-
version = "1.0.0-dev.
|
|
4
|
+
version = "1.0.0-dev.11"
|
|
5
5
|
authors = [
|
|
6
6
|
"Samuel Westrich <sam@dash.org>",
|
|
7
7
|
"Igor Markin <igor.markin@dash.org>",
|
|
@@ -21,9 +21,16 @@ default = ["core", "platform", "client", "serde", "server"]
|
|
|
21
21
|
core = []
|
|
22
22
|
platform = []
|
|
23
23
|
# Re-export Dash Platform protobuf types as `dapi_grpc::platform::proto`
|
|
24
|
+
# Note: client needs tls and tls-roots to connect to testnet which uses TLS.
|
|
24
25
|
tenderdash-proto = []
|
|
25
|
-
client = [
|
|
26
|
-
|
|
26
|
+
client = [
|
|
27
|
+
"tonic/channel",
|
|
28
|
+
"tonic/transport",
|
|
29
|
+
"tonic/tls",
|
|
30
|
+
"tonic/tls-roots",
|
|
31
|
+
"platform",
|
|
32
|
+
]
|
|
33
|
+
server = ["tonic/channel", "tonic/transport", "platform"]
|
|
27
34
|
serde = ["dep:serde", "dep:serde_bytes"]
|
|
28
35
|
mocks = ["dep:serde_json"]
|
|
29
36
|
|
|
@@ -34,12 +41,10 @@ tonic = { version = "0.11", features = [
|
|
|
34
41
|
"codegen",
|
|
35
42
|
"prost",
|
|
36
43
|
], default-features = false }
|
|
37
|
-
serde = { version = "1.0.
|
|
44
|
+
serde = { version = "1.0.197", optional = true, features = ["derive"] }
|
|
38
45
|
serde_bytes = { version = "0.11.12", optional = true }
|
|
39
46
|
serde_json = { version = "1.0", optional = true }
|
|
40
|
-
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "0.14.0-dev.
|
|
41
|
-
"grpc",
|
|
42
|
-
] }
|
|
47
|
+
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "0.14.0-dev.12", default-features = false }
|
|
43
48
|
dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" }
|
|
44
49
|
platform-version = { path = "../rs-platform-version" }
|
|
45
50
|
|
|
@@ -58,4 +63,4 @@ name = "platform_example"
|
|
|
58
63
|
path = "clients/platform/v0/rust/platform_example.rs"
|
|
59
64
|
|
|
60
65
|
[package.metadata.cargo-machete]
|
|
61
|
-
ignored = ["platform-version", "serde_bytes"]
|
|
66
|
+
ignored = ["platform-version", "serde_bytes", "futures-core"]
|
package/build.rs
CHANGED
|
@@ -39,7 +39,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
39
39
|
// Derive features for versioned messages
|
|
40
40
|
//
|
|
41
41
|
// "GetConsensusParamsRequest" is excluded as this message does not support proofs
|
|
42
|
-
const VERSIONED_REQUESTS: [&str;
|
|
42
|
+
const VERSIONED_REQUESTS: [&str; 18] = [
|
|
43
43
|
"GetDataContractHistoryRequest",
|
|
44
44
|
"GetDataContractRequest",
|
|
45
45
|
"GetDataContractsRequest",
|
|
@@ -57,10 +57,11 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
57
57
|
"WaitForStateTransitionResultRequest",
|
|
58
58
|
"GetProtocolVersionUpgradeStateRequest",
|
|
59
59
|
"GetProtocolVersionUpgradeVoteStatusRequest",
|
|
60
|
+
"GetPathElementsRequest",
|
|
60
61
|
];
|
|
61
62
|
|
|
62
63
|
// "GetConsensusParamsResponse" is excluded as this message does not support proofs
|
|
63
|
-
const VERSIONED_RESPONSES: [&str;
|
|
64
|
+
const VERSIONED_RESPONSES: [&str; 19] = [
|
|
64
65
|
"GetDataContractHistoryResponse",
|
|
65
66
|
"GetDataContractResponse",
|
|
66
67
|
"GetDataContractsResponse",
|
|
@@ -79,6 +80,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
79
80
|
"GetEpochsInfoResponse",
|
|
80
81
|
"GetProtocolVersionUpgradeStateResponse",
|
|
81
82
|
"GetProtocolVersionUpgradeVoteStatusResponse",
|
|
83
|
+
"GetPathElementsResponse",
|
|
82
84
|
];
|
|
83
85
|
|
|
84
86
|
// Derive VersionedGrpcMessage on requests
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/dapi-grpc",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.11",
|
|
4
4
|
"description": "DAPI GRPC definition file and generated clients",
|
|
5
5
|
"browser": "browser.js",
|
|
6
6
|
"main": "node.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/dashevo/dapi-grpc#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@dashevo/grpc-common": "1.0.0-dev.
|
|
48
|
+
"@dashevo/grpc-common": "1.0.0-dev.11",
|
|
49
49
|
"@dashevo/protobufjs": "6.10.5",
|
|
50
50
|
"@grpc/grpc-js": "1.4.4",
|
|
51
51
|
"@improbable-eng/grpc-web": "^0.15.0",
|
|
@@ -36,6 +36,7 @@ service Platform {
|
|
|
36
36
|
rpc getProtocolVersionUpgradeState(GetProtocolVersionUpgradeStateRequest) returns (GetProtocolVersionUpgradeStateResponse);
|
|
37
37
|
rpc getProtocolVersionUpgradeVoteStatus(GetProtocolVersionUpgradeVoteStatusRequest) returns (GetProtocolVersionUpgradeVoteStatusResponse);
|
|
38
38
|
rpc getEpochsInfo(GetEpochsInfoRequest) returns (GetEpochsInfoResponse);
|
|
39
|
+
rpc getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
message Proof {
|
|
@@ -620,3 +621,34 @@ message GetEpochsInfoResponse {
|
|
|
620
621
|
GetEpochsInfoResponseV0 v0 = 1;
|
|
621
622
|
}
|
|
622
623
|
}
|
|
624
|
+
|
|
625
|
+
message GetPathElementsRequest {
|
|
626
|
+
message GetPathElementsRequestV0 {
|
|
627
|
+
repeated bytes path = 1;
|
|
628
|
+
repeated bytes keys = 2;
|
|
629
|
+
bool prove = 3;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
oneof version {
|
|
633
|
+
GetPathElementsRequestV0 v0 = 1;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
message GetPathElementsResponse {
|
|
638
|
+
message GetPathElementsResponseV0 {
|
|
639
|
+
message Elements {
|
|
640
|
+
repeated bytes elements = 1;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
oneof result {
|
|
644
|
+
Elements elements = 1;
|
|
645
|
+
Proof proof = 2;
|
|
646
|
+
}
|
|
647
|
+
ResponseMetadata metadata = 3;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
oneof version {
|
|
651
|
+
GetPathElementsResponseV0 v0 = 1;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
@@ -2134,6 +2134,99 @@ pub mod get_epochs_info_response {
|
|
|
2134
2134
|
V0(GetEpochsInfoResponseV0),
|
|
2135
2135
|
}
|
|
2136
2136
|
}
|
|
2137
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
2138
|
+
#[serde(rename_all = "snake_case")]
|
|
2139
|
+
#[derive(::dapi_grpc_macros::VersionedGrpcMessage)]
|
|
2140
|
+
#[grpc_versions(0)]
|
|
2141
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
2142
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
2143
|
+
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
2144
|
+
pub struct GetPathElementsRequest {
|
|
2145
|
+
#[prost(oneof = "get_path_elements_request::Version", tags = "1")]
|
|
2146
|
+
pub version: ::core::option::Option<get_path_elements_request::Version>,
|
|
2147
|
+
}
|
|
2148
|
+
/// Nested message and enum types in `GetPathElementsRequest`.
|
|
2149
|
+
pub mod get_path_elements_request {
|
|
2150
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
2151
|
+
#[serde(rename_all = "snake_case")]
|
|
2152
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
2153
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
2154
|
+
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
2155
|
+
pub struct GetPathElementsRequestV0 {
|
|
2156
|
+
#[prost(bytes = "vec", repeated, tag = "1")]
|
|
2157
|
+
pub path: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
|
|
2158
|
+
#[prost(bytes = "vec", repeated, tag = "2")]
|
|
2159
|
+
pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
|
|
2160
|
+
#[prost(bool, tag = "3")]
|
|
2161
|
+
pub prove: bool,
|
|
2162
|
+
}
|
|
2163
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
2164
|
+
#[serde(rename_all = "snake_case")]
|
|
2165
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
2166
|
+
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
|
2167
|
+
pub enum Version {
|
|
2168
|
+
#[prost(message, tag = "1")]
|
|
2169
|
+
V0(GetPathElementsRequestV0),
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
2173
|
+
#[serde(rename_all = "snake_case")]
|
|
2174
|
+
#[derive(
|
|
2175
|
+
::dapi_grpc_macros::VersionedGrpcMessage,
|
|
2176
|
+
::dapi_grpc_macros::VersionedGrpcResponse
|
|
2177
|
+
)]
|
|
2178
|
+
#[grpc_versions(0)]
|
|
2179
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
2180
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
2181
|
+
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
2182
|
+
pub struct GetPathElementsResponse {
|
|
2183
|
+
#[prost(oneof = "get_path_elements_response::Version", tags = "1")]
|
|
2184
|
+
pub version: ::core::option::Option<get_path_elements_response::Version>,
|
|
2185
|
+
}
|
|
2186
|
+
/// Nested message and enum types in `GetPathElementsResponse`.
|
|
2187
|
+
pub mod get_path_elements_response {
|
|
2188
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
2189
|
+
#[serde(rename_all = "snake_case")]
|
|
2190
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
2191
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
2192
|
+
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
2193
|
+
pub struct GetPathElementsResponseV0 {
|
|
2194
|
+
#[prost(message, optional, tag = "3")]
|
|
2195
|
+
pub metadata: ::core::option::Option<super::ResponseMetadata>,
|
|
2196
|
+
#[prost(oneof = "get_path_elements_response_v0::Result", tags = "1, 2")]
|
|
2197
|
+
pub result: ::core::option::Option<get_path_elements_response_v0::Result>,
|
|
2198
|
+
}
|
|
2199
|
+
/// Nested message and enum types in `GetPathElementsResponseV0`.
|
|
2200
|
+
pub mod get_path_elements_response_v0 {
|
|
2201
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
2202
|
+
#[serde(rename_all = "snake_case")]
|
|
2203
|
+
#[derive(::dapi_grpc_macros::Mockable)]
|
|
2204
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
2205
|
+
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
2206
|
+
pub struct Elements {
|
|
2207
|
+
#[prost(bytes = "vec", repeated, tag = "1")]
|
|
2208
|
+
pub elements: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
|
|
2209
|
+
}
|
|
2210
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
2211
|
+
#[serde(rename_all = "snake_case")]
|
|
2212
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
2213
|
+
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
|
2214
|
+
pub enum Result {
|
|
2215
|
+
#[prost(message, tag = "1")]
|
|
2216
|
+
Elements(Elements),
|
|
2217
|
+
#[prost(message, tag = "2")]
|
|
2218
|
+
Proof(super::super::Proof),
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
#[derive(::serde::Serialize, ::serde::Deserialize)]
|
|
2222
|
+
#[serde(rename_all = "snake_case")]
|
|
2223
|
+
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
2224
|
+
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
|
2225
|
+
pub enum Version {
|
|
2226
|
+
#[prost(message, tag = "1")]
|
|
2227
|
+
V0(GetPathElementsResponseV0),
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2137
2230
|
/// Generated client implementations.
|
|
2138
2231
|
pub mod platform_client {
|
|
2139
2232
|
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
|
|
@@ -2816,6 +2909,36 @@ pub mod platform_client {
|
|
|
2816
2909
|
);
|
|
2817
2910
|
self.inner.unary(req, path, codec).await
|
|
2818
2911
|
}
|
|
2912
|
+
pub async fn get_path_elements(
|
|
2913
|
+
&mut self,
|
|
2914
|
+
request: impl tonic::IntoRequest<super::GetPathElementsRequest>,
|
|
2915
|
+
) -> std::result::Result<
|
|
2916
|
+
tonic::Response<super::GetPathElementsResponse>,
|
|
2917
|
+
tonic::Status,
|
|
2918
|
+
> {
|
|
2919
|
+
self.inner
|
|
2920
|
+
.ready()
|
|
2921
|
+
.await
|
|
2922
|
+
.map_err(|e| {
|
|
2923
|
+
tonic::Status::new(
|
|
2924
|
+
tonic::Code::Unknown,
|
|
2925
|
+
format!("Service was not ready: {}", e.into()),
|
|
2926
|
+
)
|
|
2927
|
+
})?;
|
|
2928
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
2929
|
+
let path = http::uri::PathAndQuery::from_static(
|
|
2930
|
+
"/org.dash.platform.dapi.v0.Platform/getPathElements",
|
|
2931
|
+
);
|
|
2932
|
+
let mut req = request.into_request();
|
|
2933
|
+
req.extensions_mut()
|
|
2934
|
+
.insert(
|
|
2935
|
+
GrpcMethod::new(
|
|
2936
|
+
"org.dash.platform.dapi.v0.Platform",
|
|
2937
|
+
"getPathElements",
|
|
2938
|
+
),
|
|
2939
|
+
);
|
|
2940
|
+
self.inner.unary(req, path, codec).await
|
|
2941
|
+
}
|
|
2819
2942
|
}
|
|
2820
2943
|
}
|
|
2821
2944
|
/// Generated server implementations.
|
|
@@ -2965,6 +3088,13 @@ pub mod platform_server {
|
|
|
2965
3088
|
tonic::Response<super::GetEpochsInfoResponse>,
|
|
2966
3089
|
tonic::Status,
|
|
2967
3090
|
>;
|
|
3091
|
+
async fn get_path_elements(
|
|
3092
|
+
&self,
|
|
3093
|
+
request: tonic::Request<super::GetPathElementsRequest>,
|
|
3094
|
+
) -> std::result::Result<
|
|
3095
|
+
tonic::Response<super::GetPathElementsResponse>,
|
|
3096
|
+
tonic::Status,
|
|
3097
|
+
>;
|
|
2968
3098
|
}
|
|
2969
3099
|
#[derive(Debug)]
|
|
2970
3100
|
pub struct PlatformServer<T: Platform> {
|
|
@@ -3989,6 +4119,52 @@ pub mod platform_server {
|
|
|
3989
4119
|
};
|
|
3990
4120
|
Box::pin(fut)
|
|
3991
4121
|
}
|
|
4122
|
+
"/org.dash.platform.dapi.v0.Platform/getPathElements" => {
|
|
4123
|
+
#[allow(non_camel_case_types)]
|
|
4124
|
+
struct getPathElementsSvc<T: Platform>(pub Arc<T>);
|
|
4125
|
+
impl<
|
|
4126
|
+
T: Platform,
|
|
4127
|
+
> tonic::server::UnaryService<super::GetPathElementsRequest>
|
|
4128
|
+
for getPathElementsSvc<T> {
|
|
4129
|
+
type Response = super::GetPathElementsResponse;
|
|
4130
|
+
type Future = BoxFuture<
|
|
4131
|
+
tonic::Response<Self::Response>,
|
|
4132
|
+
tonic::Status,
|
|
4133
|
+
>;
|
|
4134
|
+
fn call(
|
|
4135
|
+
&mut self,
|
|
4136
|
+
request: tonic::Request<super::GetPathElementsRequest>,
|
|
4137
|
+
) -> Self::Future {
|
|
4138
|
+
let inner = Arc::clone(&self.0);
|
|
4139
|
+
let fut = async move {
|
|
4140
|
+
(*inner).get_path_elements(request).await
|
|
4141
|
+
};
|
|
4142
|
+
Box::pin(fut)
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
4145
|
+
let accept_compression_encodings = self.accept_compression_encodings;
|
|
4146
|
+
let send_compression_encodings = self.send_compression_encodings;
|
|
4147
|
+
let max_decoding_message_size = self.max_decoding_message_size;
|
|
4148
|
+
let max_encoding_message_size = self.max_encoding_message_size;
|
|
4149
|
+
let inner = self.inner.clone();
|
|
4150
|
+
let fut = async move {
|
|
4151
|
+
let inner = inner.0;
|
|
4152
|
+
let method = getPathElementsSvc(inner);
|
|
4153
|
+
let codec = tonic::codec::ProstCodec::default();
|
|
4154
|
+
let mut grpc = tonic::server::Grpc::new(codec)
|
|
4155
|
+
.apply_compression_config(
|
|
4156
|
+
accept_compression_encodings,
|
|
4157
|
+
send_compression_encodings,
|
|
4158
|
+
)
|
|
4159
|
+
.apply_max_message_size_config(
|
|
4160
|
+
max_decoding_message_size,
|
|
4161
|
+
max_encoding_message_size,
|
|
4162
|
+
);
|
|
4163
|
+
let res = grpc.unary(method, req).await;
|
|
4164
|
+
Ok(res)
|
|
4165
|
+
};
|
|
4166
|
+
Box::pin(fut)
|
|
4167
|
+
}
|
|
3992
4168
|
_ => {
|
|
3993
4169
|
Box::pin(async move {
|
|
3994
4170
|
Ok(
|