@dashevo/dapi-grpc 0.25.0-dev.6 → 0.25.0-dev.7

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.
@@ -0,0 +1,223 @@
1
+ // This file is generated. Do not edit
2
+ // @generated
3
+
4
+ // https://github.com/Manishearth/rust-clippy/issues/702
5
+ #![allow(unknown_lints)]
6
+ #![allow(clippy::all)]
7
+
8
+ #![cfg_attr(rustfmt, rustfmt_skip)]
9
+
10
+ #![allow(box_pointers)]
11
+ #![allow(dead_code)]
12
+ #![allow(missing_docs)]
13
+ #![allow(non_camel_case_types)]
14
+ #![allow(non_snake_case)]
15
+ #![allow(non_upper_case_globals)]
16
+ #![allow(trivial_casts)]
17
+ #![allow(unsafe_code)]
18
+ #![allow(unused_imports)]
19
+ #![allow(unused_results)]
20
+
21
+
22
+ // server interface
23
+
24
+ pub trait Platform {
25
+ fn broadcast_state_transition(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle<super::platform::BroadcastStateTransitionRequest>, resp: ::grpc::ServerResponseUnarySink<super::platform::BroadcastStateTransitionResponse>) -> ::grpc::Result<()>;
26
+
27
+ fn get_identity(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle<super::platform::GetIdentityRequest>, resp: ::grpc::ServerResponseUnarySink<super::platform::GetIdentityResponse>) -> ::grpc::Result<()>;
28
+
29
+ fn get_data_contract(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle<super::platform::GetDataContractRequest>, resp: ::grpc::ServerResponseUnarySink<super::platform::GetDataContractResponse>) -> ::grpc::Result<()>;
30
+
31
+ fn get_documents(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle<super::platform::GetDocumentsRequest>, resp: ::grpc::ServerResponseUnarySink<super::platform::GetDocumentsResponse>) -> ::grpc::Result<()>;
32
+
33
+ fn get_identities_by_public_key_hashes(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle<super::platform::GetIdentitiesByPublicKeyHashesRequest>, resp: ::grpc::ServerResponseUnarySink<super::platform::GetIdentitiesByPublicKeyHashesResponse>) -> ::grpc::Result<()>;
34
+
35
+ fn wait_for_state_transition_result(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle<super::platform::WaitForStateTransitionResultRequest>, resp: ::grpc::ServerResponseUnarySink<super::platform::WaitForStateTransitionResultResponse>) -> ::grpc::Result<()>;
36
+
37
+ fn get_consensus_params(&self, o: ::grpc::ServerHandlerContext, req: ::grpc::ServerRequestSingle<super::platform::GetConsensusParamsRequest>, resp: ::grpc::ServerResponseUnarySink<super::platform::GetConsensusParamsResponse>) -> ::grpc::Result<()>;
38
+ }
39
+
40
+ // client
41
+
42
+ pub struct PlatformClient {
43
+ grpc_client: ::std::sync::Arc<::grpc::Client>,
44
+ }
45
+
46
+ impl ::grpc::ClientStub for PlatformClient {
47
+ fn with_client(grpc_client: ::std::sync::Arc<::grpc::Client>) -> Self {
48
+ PlatformClient {
49
+ grpc_client: grpc_client,
50
+ }
51
+ }
52
+ }
53
+
54
+ impl PlatformClient {
55
+ pub fn broadcast_state_transition(&self, o: ::grpc::RequestOptions, req: super::platform::BroadcastStateTransitionRequest) -> ::grpc::SingleResponse<super::platform::BroadcastStateTransitionResponse> {
56
+ let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
57
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/broadcastStateTransition"),
58
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
59
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
60
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
61
+ });
62
+ self.grpc_client.call_unary(o, req, descriptor)
63
+ }
64
+
65
+ pub fn get_identity(&self, o: ::grpc::RequestOptions, req: super::platform::GetIdentityRequest) -> ::grpc::SingleResponse<super::platform::GetIdentityResponse> {
66
+ let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
67
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getIdentity"),
68
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
69
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
70
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
71
+ });
72
+ self.grpc_client.call_unary(o, req, descriptor)
73
+ }
74
+
75
+ pub fn get_data_contract(&self, o: ::grpc::RequestOptions, req: super::platform::GetDataContractRequest) -> ::grpc::SingleResponse<super::platform::GetDataContractResponse> {
76
+ let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
77
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getDataContract"),
78
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
79
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
80
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
81
+ });
82
+ self.grpc_client.call_unary(o, req, descriptor)
83
+ }
84
+
85
+ pub fn get_documents(&self, o: ::grpc::RequestOptions, req: super::platform::GetDocumentsRequest) -> ::grpc::SingleResponse<super::platform::GetDocumentsResponse> {
86
+ let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
87
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getDocuments"),
88
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
89
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
90
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
91
+ });
92
+ self.grpc_client.call_unary(o, req, descriptor)
93
+ }
94
+
95
+ pub fn get_identities_by_public_key_hashes(&self, o: ::grpc::RequestOptions, req: super::platform::GetIdentitiesByPublicKeyHashesRequest) -> ::grpc::SingleResponse<super::platform::GetIdentitiesByPublicKeyHashesResponse> {
96
+ let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
97
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getIdentitiesByPublicKeyHashes"),
98
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
99
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
100
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
101
+ });
102
+ self.grpc_client.call_unary(o, req, descriptor)
103
+ }
104
+
105
+ pub fn wait_for_state_transition_result(&self, o: ::grpc::RequestOptions, req: super::platform::WaitForStateTransitionResultRequest) -> ::grpc::SingleResponse<super::platform::WaitForStateTransitionResultResponse> {
106
+ let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
107
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/waitForStateTransitionResult"),
108
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
109
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
110
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
111
+ });
112
+ self.grpc_client.call_unary(o, req, descriptor)
113
+ }
114
+
115
+ pub fn get_consensus_params(&self, o: ::grpc::RequestOptions, req: super::platform::GetConsensusParamsRequest) -> ::grpc::SingleResponse<super::platform::GetConsensusParamsResponse> {
116
+ let descriptor = ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
117
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getConsensusParams"),
118
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
119
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
120
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
121
+ });
122
+ self.grpc_client.call_unary(o, req, descriptor)
123
+ }
124
+ }
125
+
126
+ // server
127
+
128
+ pub struct PlatformServer;
129
+
130
+
131
+ impl PlatformServer {
132
+ pub fn new_service_def<H : Platform + 'static + Sync + Send + 'static>(handler: H) -> ::grpc::rt::ServerServiceDefinition {
133
+ let handler_arc = ::std::sync::Arc::new(handler);
134
+ ::grpc::rt::ServerServiceDefinition::new("/org.dash.platform.dapi.v0.Platform",
135
+ vec![
136
+ ::grpc::rt::ServerMethod::new(
137
+ ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
138
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/broadcastStateTransition"),
139
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
140
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
141
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
142
+ }),
143
+ {
144
+ let handler_copy = handler_arc.clone();
145
+ ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).broadcast_state_transition(ctx, req, resp))
146
+ },
147
+ ),
148
+ ::grpc::rt::ServerMethod::new(
149
+ ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
150
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getIdentity"),
151
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
152
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
153
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
154
+ }),
155
+ {
156
+ let handler_copy = handler_arc.clone();
157
+ ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).get_identity(ctx, req, resp))
158
+ },
159
+ ),
160
+ ::grpc::rt::ServerMethod::new(
161
+ ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
162
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getDataContract"),
163
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
164
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
165
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
166
+ }),
167
+ {
168
+ let handler_copy = handler_arc.clone();
169
+ ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).get_data_contract(ctx, req, resp))
170
+ },
171
+ ),
172
+ ::grpc::rt::ServerMethod::new(
173
+ ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
174
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getDocuments"),
175
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
176
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
177
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
178
+ }),
179
+ {
180
+ let handler_copy = handler_arc.clone();
181
+ ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).get_documents(ctx, req, resp))
182
+ },
183
+ ),
184
+ ::grpc::rt::ServerMethod::new(
185
+ ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
186
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getIdentitiesByPublicKeyHashes"),
187
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
188
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
189
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
190
+ }),
191
+ {
192
+ let handler_copy = handler_arc.clone();
193
+ ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).get_identities_by_public_key_hashes(ctx, req, resp))
194
+ },
195
+ ),
196
+ ::grpc::rt::ServerMethod::new(
197
+ ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
198
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/waitForStateTransitionResult"),
199
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
200
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
201
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
202
+ }),
203
+ {
204
+ let handler_copy = handler_arc.clone();
205
+ ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).wait_for_state_transition_result(ctx, req, resp))
206
+ },
207
+ ),
208
+ ::grpc::rt::ServerMethod::new(
209
+ ::grpc::rt::ArcOrStatic::Static(&::grpc::rt::MethodDescriptor {
210
+ name: ::grpc::rt::StringOrStatic::Static("/org.dash.platform.dapi.v0.Platform/getConsensusParams"),
211
+ streaming: ::grpc::rt::GrpcStreaming::Unary,
212
+ req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
213
+ resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
214
+ }),
215
+ {
216
+ let handler_copy = handler_arc.clone();
217
+ ::grpc::rt::MethodHandlerUnary::new(move |ctx, req, resp| (*handler_copy).get_consensus_params(ctx, req, resp))
218
+ },
219
+ ),
220
+ ],
221
+ )
222
+ }
223
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-grpc",
3
- "version": "0.25.0-dev.6",
3
+ "version": "0.25.0-dev.7",
4
4
  "description": "DAPI GRPC definition file and generated clients",
5
5
  "browser": "browser.js",
6
6
  "main": "node.js",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "homepage": "https://github.com/dashevo/dapi-grpc#readme",
35
35
  "dependencies": {
36
- "@dashevo/grpc-common": "0.25.0-dev.6",
36
+ "@dashevo/grpc-common": "0.25.0-dev.7",
37
37
  "@dashevo/protobufjs": "6.10.5",
38
38
  "@grpc/grpc-js": "^1.3.7",
39
39
  "@improbable-eng/grpc-web": "^0.15.0",
package/scripts/build.sh CHANGED
@@ -18,6 +18,9 @@ PLATFORM_OBJ_C_OUT_PATH="$PLATFORM_CLIENTS_PATH/objective-c"
18
18
  CORE_PYTHON_OUT_PATH="$CORE_CLIENTS_PATH/python"
19
19
  PLATFORM_PYTHON_OUT_PATH="$PLATFORM_CLIENTS_PATH/python"
20
20
 
21
+ CORE_RUST_OUT_PATH="$CORE_CLIENTS_PATH/rust"
22
+ PLATFORM_RUST_OUT_PATH="$PLATFORM_CLIENTS_PATH/rust"
23
+
21
24
  PROTOC_IMAGE="rvolosatovs/protoc:4.0.0"
22
25
 
23
26
  #################################################
@@ -182,3 +185,37 @@ docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
182
185
  --proto_path="$PLATFORM_PROTO_PATH" \
183
186
  -I="$PLATFORM_PROTO_PATH" \
184
187
  "platform.proto"
188
+
189
+ ###################################
190
+ # Generate Rust client for `Core` #
191
+ ###################################
192
+
193
+ rm -rf "$CORE_RUST_OUT_PATH/*"
194
+
195
+ docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
196
+ -v "$CORE_RUST_OUT_PATH:$CORE_RUST_OUT_PATH" \
197
+ --rm \
198
+ "$PROTOC_IMAGE" \
199
+ --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-rust \
200
+ --rust_out="$CORE_RUST_OUT_PATH" \
201
+ --grpc_out="$CORE_RUST_OUT_PATH" \
202
+ --proto_path="$CORE_PROTO_PATH" \
203
+ -I="$CORE_PROTO_PATH" \
204
+ "core.proto"
205
+
206
+ #######################################
207
+ # Generate Rust client for `Platform` #
208
+ #######################################
209
+
210
+ rm -rf "$PLATFORM_RUST_OUT_PATH/*"
211
+
212
+ docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
213
+ -v "$PLATFORM_RUST_OUT_PATH:$PLATFORM_RUST_OUT_PATH" \
214
+ --rm \
215
+ "$PROTOC_IMAGE" \
216
+ --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-rust \
217
+ --rust_out="$PLATFORM_RUST_OUT_PATH" \
218
+ --grpc_out="$PLATFORM_RUST_OUT_PATH" \
219
+ --proto_path="$PLATFORM_PROTO_PATH" \
220
+ -I="$PLATFORM_PROTO_PATH" \
221
+ "platform.proto"