@dashevo/dapi-grpc 1.0.0-pr.1694.6 → 1.0.0-pr.1694.9
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
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-pr.1694.
|
|
4
|
+
version = "1.0.0-pr.1694.9"
|
|
5
5
|
authors = [
|
|
6
6
|
"Samuel Westrich <sam@dash.org>",
|
|
7
7
|
"Igor Markin <igor.markin@dash.org>",
|
|
@@ -34,7 +34,9 @@ tonic = { version = "0.11", features = [
|
|
|
34
34
|
serde = { version = "1.0.171", optional = true, features = ["derive"] }
|
|
35
35
|
serde_bytes = { version = "0.11.12", optional = true }
|
|
36
36
|
serde_json = { version = "1.0", optional = true }
|
|
37
|
-
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", rev = "
|
|
37
|
+
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", rev = "47d4105a49a4a332d5578a91371333686c7c5b1a", features = [
|
|
38
|
+
"grpc-server",
|
|
39
|
+
] }
|
|
38
40
|
dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" }
|
|
39
41
|
platform-version = { path = "../rs-platform-version" }
|
|
40
42
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/dapi-grpc",
|
|
3
|
-
"version": "1.0.0-pr.1694.
|
|
3
|
+
"version": "1.0.0-pr.1694.9",
|
|
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-pr.1694.
|
|
48
|
+
"@dashevo/grpc-common": "1.0.0-pr.1694.9",
|
|
49
49
|
"@dashevo/protobufjs": "6.10.5",
|
|
50
50
|
"@grpc/grpc-js": "1.4.4",
|
|
51
51
|
"@improbable-eng/grpc-web": "^0.15.0",
|
|
@@ -719,3 +719,525 @@ pub mod core_client {
|
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
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
|
+
}
|